1、新增了获取渣土车轨迹并保存和根据经纬度、半径查询符合条件的渣土车轨迹修改
This commit is contained in:
parent
be0c88bfdc
commit
51831372d5
|
@ -7,12 +7,16 @@ import com.hisense.monitormanage.dto.ScenicCameraDto;
|
|||
import com.hisense.monitormanage.entity.*;
|
||||
import com.hisense.monitormanage.mapper.*;
|
||||
import com.hisense.monitormanage.service.MonitorService;
|
||||
import com.hisense.monitormanage.service.PassengerFlowService;
|
||||
import com.hisense.monitormanage.service.SedimentTrailService;
|
||||
import com.hisense.monitormanage.service.TrailSanitationService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.Clock;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -42,6 +46,12 @@ public class Controller {
|
|||
@Autowired
|
||||
private CameraOrgenizationMapper cameraOrgenMapper;
|
||||
|
||||
@Autowired
|
||||
private PassengerFlowService passengerFlowService;
|
||||
|
||||
@Autowired
|
||||
private TrailSanitationService trailSanitationService;
|
||||
|
||||
@RequestMapping("all")
|
||||
public Object all(){
|
||||
List<Project> projects = projectMapper.selectList(null);
|
||||
|
@ -107,23 +117,6 @@ public class Controller {
|
|||
return success;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据channelId查询摄像头详细信息
|
||||
* @param channelId
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping("selectByChannelId")
|
||||
public Result selectByChannelId(String channelId){
|
||||
|
||||
List<CameraChannel> list = cameraChannelMapper.selectByChannelId(channelId);
|
||||
|
||||
Result success = Result.success(list);
|
||||
|
||||
return success;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -218,21 +211,26 @@ public class Controller {
|
|||
return success;
|
||||
}
|
||||
|
||||
|
||||
//根据用户已输入的文字请求输入建议信息
|
||||
//text:用户输入的文字信息,必填
|
||||
//maxSuggestions:最大建议数量,0~10,默认2
|
||||
@RequestMapping("suggest")
|
||||
public Result suggest(
|
||||
@RequestParam(value ="text") String text,
|
||||
@RequestParam(value = "maxSuggestions",required = false,defaultValue = "2") Integer maxSuggestions
|
||||
//查询视频点播巡检结果,只取异常的
|
||||
@RequestMapping("listChannelPlayStates")
|
||||
public Result listChannelPlayStates(
|
||||
@RequestParam(value="page",required = false,defaultValue = "1") Integer page,
|
||||
@RequestParam(value="pageSize",required = false,defaultValue = "20") String pageSize
|
||||
){
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("text",text);
|
||||
map.put("maxSuggestions",maxSuggestions);
|
||||
return monitorService.suggest(map);
|
||||
}
|
||||
Map<String,Object> condition = new HashMap<>();
|
||||
LocalDateTime localDateTime = LocalDateTime.now(Clock.systemUTC());
|
||||
|
||||
LocalDateTime startTime = localDateTime.minusDays(7);
|
||||
condition.put("diagnoseResultState",0);
|
||||
condition.put("startTime",startTime.toString());
|
||||
condition.put("endTime",localDateTime.toString());
|
||||
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
map.put("condition",condition);
|
||||
map.put("page",page);
|
||||
map.put("pageSize",pageSize);
|
||||
return monitorService.listChannelPlayStates(map);
|
||||
}
|
||||
|
||||
//道路统计数据与排名
|
||||
@RequestMapping("roadData")
|
||||
|
@ -283,13 +281,19 @@ public class Controller {
|
|||
|
||||
//获取渣土车轨迹并保存到t_trail_sediment
|
||||
@RequestMapping(value = "saveResCatalogApplyZTYS")
|
||||
public boolean resCatalogApplyZTYS(){
|
||||
return sedimentTrailService.batchSaveSedimentTrail();
|
||||
public Result resCatalogApplyZTYS(){
|
||||
|
||||
boolean result = sedimentTrailService.batchSaveSedimentTrail();
|
||||
if(result){
|
||||
return Result.success();
|
||||
}else{
|
||||
return Result.error(String.valueOf(result));
|
||||
}
|
||||
}
|
||||
|
||||
//根据输入的经纬度和查询的半径(米)时间查询范围内的渣土车轨迹信息
|
||||
@RequestMapping(value = "listSedimentTrailByPoints")
|
||||
public List<SedimentTrail> listSedimentTrailByPoints(
|
||||
public Result listSedimentTrailByPoints(
|
||||
@RequestParam(value="longitude") double longitude,
|
||||
@RequestParam(value="latitude") double latitude,
|
||||
@RequestParam(value="raidus") Integer raidus,
|
||||
|
@ -297,7 +301,60 @@ public class Controller {
|
|||
@RequestParam(value = "end") String end
|
||||
){
|
||||
System.out.println("listSedimentTrailByPoints......");
|
||||
return sedimentTrailService.listSedimentTrailByPoints(longitude,latitude,raidus,start,end);
|
||||
List<SedimentTrail> list = sedimentTrailService.listSedimentTrailByPoints(longitude,latitude,raidus,start,end);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@RequestMapping("passengerFlow")
|
||||
public List<Map> passengerFlow(){
|
||||
List<Map> list = passengerFlowService.passengerFlow();
|
||||
return list;
|
||||
}
|
||||
//获取实时客流并保存到表t_passenger_flow
|
||||
@RequestMapping("savePassengerFlow")
|
||||
public Result savePassengerFlow(){
|
||||
List<Map> list = passengerFlowService.passengerFlow();
|
||||
boolean result = passengerFlowService.savePassengerFlow(list);
|
||||
if(result){
|
||||
return Result.success();
|
||||
}else{
|
||||
return Result.error(String.valueOf(result));
|
||||
}
|
||||
}
|
||||
|
||||
//根据输入的经纬度和查询的半径(米)和hourId查询游客总数
|
||||
@RequestMapping("getPassengerNum")
|
||||
public Result getPassengerNum(
|
||||
@RequestParam(value="longitude") double longitude,
|
||||
@RequestParam(value="latitude") double latitude,
|
||||
@RequestParam(value="raidus") Integer raidus,
|
||||
@RequestParam(value="timeId") String timeId
|
||||
){
|
||||
return Result.success(String.valueOf(passengerFlowService.passengerNums(longitude,latitude,raidus,timeId)));
|
||||
}
|
||||
|
||||
//查询并保存环卫车轨迹到表t_trail_sanitation
|
||||
@RequestMapping("saveTrailSanitation")
|
||||
public Result saveTrailSanitation(){
|
||||
boolean result = trailSanitationService.saveTrailSanitation();
|
||||
if(result){
|
||||
return Result.success();
|
||||
}else{
|
||||
return Result.error(String.valueOf(result));
|
||||
}
|
||||
}
|
||||
|
||||
//根据输入的经纬度和查询的半径(米)时间查询范围内的环卫车轨迹信息
|
||||
@RequestMapping(value = "listTrailSanitationByPoints")
|
||||
public Result listTrailSanitationByPoints(
|
||||
@RequestParam(value="longitude") double longitude,
|
||||
@RequestParam(value="latitude") double latitude,
|
||||
@RequestParam(value="raidus") Integer raidus,
|
||||
@RequestParam(value="start") String start,
|
||||
@RequestParam(value = "end") String end
|
||||
){
|
||||
System.out.println("listTrailSanitationByPoints......");
|
||||
List<TrailSanitation> list = trailSanitationService.listSedimentTrailByPoints(longitude,latitude,raidus,start,end);
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package com.hisense.monitormanage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName PassengerFlow.java
|
||||
* @Description 实时客流
|
||||
* @createTime 2022年05月10日 14:25:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("t_passenger_flow")
|
||||
public class PassengerFlow {
|
||||
@TableId
|
||||
private Integer id;
|
||||
private String hourId;
|
||||
private String timeId;
|
||||
private double longitude;
|
||||
private double latitude;
|
||||
private Integer allNums;
|
||||
private Integer localNums;
|
||||
private Integer nonlocalNums;
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
package com.hisense.monitormanage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName TrailSanitation.java
|
||||
* @Description 环卫车轨迹类
|
||||
* @createTime 2022年05月10日 16:29:00
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("t_trail_sanitation")
|
||||
public class TrailSanitation {
|
||||
@TableId
|
||||
private Integer id;
|
||||
private String simkh;
|
||||
private String cph;
|
||||
private String wz;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private LocalDateTime fssj;
|
||||
private double jd;
|
||||
private double wd;
|
||||
private double sd;
|
||||
private Integer fx;
|
||||
private String zt;
|
||||
private double yl;
|
||||
private double lc;
|
||||
private double yl2;
|
||||
private Integer sfzx;
|
||||
private Integer xh;
|
||||
private String bjzt;
|
||||
private double gd;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
private LocalDateTime updatetime;
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.hisense.monitormanage.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.hisense.monitormanage.entity.PassengerFlow;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface PassengerFlowlMapper extends BaseMapper<PassengerFlow> {
|
||||
void batchSave(List<Map> list);
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package com.hisense.monitormanage.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.hisense.monitormanage.entity.TrailSanitation;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface TrailSanitationMapper extends BaseMapper<TrailSanitation> {
|
||||
public void batchaSave(List<Map> list);
|
||||
}
|
|
@ -4,6 +4,7 @@ import cn.hutool.core.collection.ListUtil;
|
|||
import cn.hutool.crypto.SecureUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.hisense.monitormanage.entity.*;
|
||||
import com.hisense.monitormanage.mapper.*;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
|
@ -423,7 +424,7 @@ public class MonitorService {
|
|||
}
|
||||
|
||||
//查询视频点播巡检结果
|
||||
public void listChannelPlayStates(Map<String,Object> map){
|
||||
public Result listChannelPlayStates(Map<String,Object> map){
|
||||
String url = monitorDomain + "/nms/api/channel/play/list";
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.add("X-Subject-Token",token);
|
||||
|
@ -441,11 +442,12 @@ public class MonitorService {
|
|||
thisPage = nextPage;
|
||||
}
|
||||
List<Map> list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray),Map.class);
|
||||
List<List<Map>> listMap = ListUtil.partition(list,500);
|
||||
|
||||
List<List<Map>> listMap = Lists.partition(list,500);
|
||||
for(List<Map> ll:listMap){
|
||||
cameraChannelMapper.updateState(ll);
|
||||
}
|
||||
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
//道路统计数据与排名
|
||||
|
|
|
@ -0,0 +1,213 @@
|
|||
package com.hisense.monitormanage.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.hisense.monitormanage.entity.PassengerFlow;
|
||||
import com.hisense.monitormanage.mapper.PassengerFlowlMapper;
|
||||
import com.hisense.monitormanage.utils.LongLatUtil;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author admin
|
||||
* @version 1.0.0
|
||||
* @ClassName PassengerFlowService.java
|
||||
* @Description 实时客流service
|
||||
* @createTime 2022年05月10日 14:45:00
|
||||
*/
|
||||
@Service
|
||||
@Log4j2
|
||||
public class PassengerFlowService {
|
||||
@Autowired
|
||||
private PassengerFlowlMapper passengerFlowMapper;
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
|
||||
//实时客流相关参数
|
||||
@Value("202204141052331249fcc8-046")
|
||||
private String APIKEY;
|
||||
@Value("apitest")
|
||||
private String appId;
|
||||
@Value("7eb78b134e0310904d46039ccea20c32")
|
||||
private String appSecret;
|
||||
|
||||
/**
|
||||
* 实时客流
|
||||
* @param
|
||||
* @return List
|
||||
*/
|
||||
public List<Map> passengerFlow(){
|
||||
//JSONObject map = new JSONObject();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
//MultiValueMap<String,Object> map = new LinkedMultiValueMap<>();
|
||||
DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||
|
||||
LocalDateTime dateNow = LocalDateTime.now();
|
||||
String timeStamp = dateNow.format(dateTimeFormatter1);//yyyyMMddHHmmss
|
||||
String[] tt = this.minusMinutesStr(dateNow,180);
|
||||
|
||||
String url = "http://15.72.158.72:8081/getway/api/Proxy/HandleByKey/1249fcc8-0466-4897-87b4-d2111a9baf4f";
|
||||
map.put("APIKEY",APIKEY);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("appId",appId);
|
||||
//安全认证 MD5(appId+”-”+timeStamp+”-”+ appSecret)
|
||||
String code = appId+"-"+timeStamp+"-"+ appSecret;
|
||||
String md5Str = DigestUtils.md5DigestAsHex(code.getBytes(StandardCharsets.UTF_8));
|
||||
jsonObject.put("mac",md5Str);
|
||||
jsonObject.put("timeStamp",timeStamp);
|
||||
jsonObject.put("hourId",tt[1]);
|
||||
jsonObject.put("timeId",tt[0]);
|
||||
//jsonObject.put("apiType","***");
|
||||
JSONObject para = new JSONObject();
|
||||
para.put("data",JSONObject.toJSONString(jsonObject));
|
||||
map.put("ParamJson",para);
|
||||
|
||||
System.out.println("multimap->"+map.toString());
|
||||
ResponseEntity<String> responseEntity;
|
||||
List<Map> list = new ArrayList<>();
|
||||
try{
|
||||
responseEntity = restTemplate.postForEntity(url,map,String.class);
|
||||
//System.out.println(responseEntity.getStatusCodeValue());
|
||||
if(responseEntity.getStatusCodeValue() == 200){
|
||||
String result = responseEntity.getBody();
|
||||
//System.out.println("passengerFlow ->"+result);
|
||||
JSONObject jsonResult = JSONObject.parseObject(result);
|
||||
System.out.println(jsonResult.keySet().toString());
|
||||
if(jsonResult.getIntValue("code") == 0){
|
||||
JSONArray jsonArray = jsonResult.getJSONArray("result");
|
||||
list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray),Map.class);
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
log.error("[passengerFlow] Exception:"+e.getMessage());
|
||||
}
|
||||
return list;
|
||||
}
|
||||
@Scheduled(cron = "0 30 11-23/1 * * ? ")
|
||||
//11:30 到晚上11:30
|
||||
public void passengerFlowSchedule(){
|
||||
//JSONObject map = new JSONObject();
|
||||
Map<String,Object> map = new HashMap<>();
|
||||
//MultiValueMap<String,Object> map = new LinkedMultiValueMap<>();
|
||||
DateTimeFormatter dateTimeFormatter1 = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||
|
||||
LocalDateTime dateNow = LocalDateTime.now();
|
||||
String timeStamp = dateNow.format(dateTimeFormatter1);//yyyyMMddHHmmss
|
||||
String[] tt = this.minusMinutesStr(dateNow,180);
|
||||
|
||||
String url = "http://15.72.158.72:8081/getway/api/Proxy/HandleByKey/1249fcc8-0466-4897-87b4-d2111a9baf4f";
|
||||
map.put("APIKEY",APIKEY);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("appId",appId);
|
||||
//安全认证 MD5(appId+”-”+timeStamp+”-”+ appSecret)
|
||||
String code = appId+"-"+timeStamp+"-"+ appSecret;
|
||||
String md5Str = DigestUtils.md5DigestAsHex(code.getBytes(StandardCharsets.UTF_8));
|
||||
jsonObject.put("mac",md5Str);
|
||||
jsonObject.put("timeStamp",timeStamp);
|
||||
jsonObject.put("hourId",tt[1]);
|
||||
jsonObject.put("timeId",tt[0]);
|
||||
//jsonObject.put("apiType","***");
|
||||
JSONObject para = new JSONObject();
|
||||
para.put("data",JSONObject.toJSONString(jsonObject));
|
||||
map.put("ParamJson",para);
|
||||
|
||||
System.out.println("multimap->"+map.toString());
|
||||
ResponseEntity<String> responseEntity;
|
||||
List<Map> list = new ArrayList<>();
|
||||
try{
|
||||
responseEntity = restTemplate.postForEntity(url,map,String.class);
|
||||
//System.out.println(responseEntity.getStatusCodeValue());
|
||||
if(responseEntity.getStatusCodeValue() == 200){
|
||||
String result = responseEntity.getBody();
|
||||
//System.out.println("passengerFlow ->"+result);
|
||||
JSONObject jsonResult = JSONObject.parseObject(result);
|
||||
System.out.println(jsonResult.keySet().toString());
|
||||
if(jsonResult.getIntValue("code") == 0){
|
||||
JSONArray jsonArray = jsonResult.getJSONArray("result");
|
||||
list = JSONObject.parseArray(JSONObject.toJSONString(jsonArray),Map.class);
|
||||
List<List<Map>> lists = Lists.partition(list,200);
|
||||
lists.forEach(ll ->passengerFlowMapper.batchSave(ll));
|
||||
}
|
||||
}
|
||||
} catch (Exception e){
|
||||
log.error("[passengerFlowSchedule] Exception:"+e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
//保存实时客流
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean savePassengerFlow(List<Map> maps){
|
||||
List<List<Map>> lists = Lists.partition(maps,200);
|
||||
try{
|
||||
lists.forEach(list ->passengerFlowMapper.batchSave(list));
|
||||
return true;
|
||||
}catch (Exception e){
|
||||
log.error("[savePassengerFlow] Exception:"+e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//根据半径,一个经纬度和hour_id查询游客总数
|
||||
public Integer passengerNums(double longitude, double latitude, Integer raidus,String timeId){
|
||||
double[] points = LongLatUtil.getAround(longitude,latitude,raidus);
|
||||
QueryWrapper<PassengerFlow> wrapper = new QueryWrapper<>();
|
||||
|
||||
|
||||
wrapper.eq("time_id",timeId).between("longitude",points[0],points[2]).between("latitude",points[1],points[3]);
|
||||
int count = 0;
|
||||
try{
|
||||
List<PassengerFlow> list = passengerFlowMapper.selectList(wrapper);
|
||||
for(PassengerFlow p:list){
|
||||
count+=p.getAllNums();
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.error("[passengerNums] Exception:"+e.getMessage());
|
||||
return count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
//当前时间减去固定的分钟数,然后分钟取30
|
||||
private String[] minusMinutesStr(LocalDateTime datetime,long minutes){
|
||||
String t1,t2;//t1 yyyyMMddHHmm t2 yyyyMMddHH
|
||||
LocalDateTime minus = datetime.minus(minutes, ChronoUnit.MINUTES);
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyyMMddHHmm");
|
||||
DateTimeFormatter dateTimeFormatter2 = DateTimeFormatter.ofPattern("yyyyMMddHH");
|
||||
String time1 = minus.format(dateTimeFormatter);
|
||||
System.out.println(time1);
|
||||
String mm = time1.substring(time1.length() -2,time1.length());
|
||||
System.out.println(mm);
|
||||
if(0 < Integer.parseInt(mm) &&Integer.parseInt(mm)<30){
|
||||
t1 = time1.substring(0,time1.length() -2)+"30";
|
||||
}else if(Integer.parseInt(mm)>30){
|
||||
LocalDateTime lastHour = LocalDateTime.parse(time1,dateTimeFormatter).plus(1,ChronoUnit.HOURS);
|
||||
t1 = lastHour.format(dateTimeFormatter2)+"00";
|
||||
}else{
|
||||
t1 = time1;
|
||||
}
|
||||
|
||||
t2 = t1.substring(0,t1.length()-2);
|
||||
System.out.println("t1->"+t1+"...t2->"+t2);
|
||||
return new String[]{t1,t2};
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
package com.hisense.monitormanage.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.hisense.monitormanage.entity.SedimentTrail;
|
||||
import com.hisense.monitormanage.entity.TrailSanitation;
|
||||
import com.hisense.monitormanage.mapper.TrailSanitationMapper;
|
||||
import com.hisense.monitormanage.utils.LongLatUtil;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
@Log4j2
|
||||
public class TrailSanitationService {
|
||||
@Autowired
|
||||
private TrailSanitationMapper trailSanitationMapper;
|
||||
@Autowired
|
||||
private MonitorService monitorService;
|
||||
|
||||
public boolean saveTrailSanitation(){
|
||||
boolean result = false;
|
||||
try{
|
||||
List<Map> list = monitorService.resCatalogApplyHJWS();
|
||||
List<List<Map>> lists = Lists.partition(list,200);
|
||||
lists.forEach(l->trailSanitationMapper.batchaSave(l));
|
||||
result = true;
|
||||
}catch (Exception e){
|
||||
log.error("[saveTrailSanitation] Exception:",e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据输入的经纬度和查询的半径(米)查询范围内的环卫车轨迹信息
|
||||
* @param longitude(经度) latitude(纬度) raidus(米) start(时间) end(时间)
|
||||
*
|
||||
*/
|
||||
public List<TrailSanitation> listSedimentTrailByPoints(double longitude, double latitude, Integer raidus, String start, String end){
|
||||
double[] points = LongLatUtil.getAround(longitude,latitude,raidus);
|
||||
QueryWrapper<TrailSanitation> wrapper = new QueryWrapper<>();
|
||||
wrapper.between("fssj",start,end).between("jd",points[0],points[2]).between("wd",points[1],points[3]);
|
||||
return trailSanitationMapper.selectList(wrapper);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hisense.monitormanage.mapper.PassengerFlowlMapper">
|
||||
|
||||
<insert id="batchSave" parameterType="java.util.List">
|
||||
INSERT INTO t_passenger_flow
|
||||
(hour_id,time_id,longitude,latitude,all_nums,local_nums,nonlocal_nums)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator="," >
|
||||
(
|
||||
#{item.hour_id},#{item.time_id},#{item.longitude},#{item.latitude},#{item.all_nums},
|
||||
#{item.local_nums},#{item.nonlocal_nums}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.hisense.monitormanage.mapper.TrailSanitationMapper">
|
||||
|
||||
<insert id="batchaSave" parameterType="java.util.List">
|
||||
INSERT INTO t_trail_sanitation
|
||||
(simkh,cph,fssj,jd,wd,sd,fx,zt,yl,lc,sfzx,bjzt,gd,updatetime)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator="," >
|
||||
(
|
||||
#{item.SIMKH},#{item.CPH},#{item.FSSJ},#{item.JD},#{item.WD},
|
||||
#{item.SD},#{item.FX},#{item.ZT},#{item.YL},#{item.LC},
|
||||
#{item.SFZX},#{item.BJZT},#{item.GD},#{item.updatetime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue