This commit is contained in:
dinggang 2022-07-29 17:52:26 +08:00
parent b525a1d50a
commit 4760fa1898
1 changed files with 27 additions and 83 deletions

View File

@ -1,5 +1,6 @@
package io.renren.modules.monitor.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import io.renren.modules.monitor.dto.*;
@ -151,9 +152,7 @@ public class Controller {
List<CameraChannelDto1> list = cameraChannelMapper.selectByChannelCode(channelCode);
Result success = Result.success(list);
return success;
return Result.success(list);
}
@ -170,9 +169,7 @@ public class Controller {
List<CameraChannel> labels = cameraChannelMapper.selectByChannelName(channelName);
Result success = Result.success(labels);
return success;
return Result.success(labels);
}
/**
@ -254,8 +251,7 @@ public class Controller {
public Result selectAllByGps(Double gpsX,Double gpsY,Integer radius){
double[] around = LongLatUtil.getAround(gpsX, gpsY, radius);
List<CameraChannel> c = cameraChannelMapper.selectAllByGps(around[0], around[2], around[1], around[3]);
Result success = Result.success(c);
return success;
return Result.success(c);
}
/**
@ -268,9 +264,7 @@ public class Controller {
List<Label> labels = cameraChannelMapper.selectAllLabel();
Result success = Result.success(labels);
return success;
return Result.success(labels);
}
/**
@ -283,9 +277,7 @@ public class Controller {
List<Label> labels = cameraChannelMapper.selectByLabelCity();
Result success = Result.success(labels);
return success;
return Result.success(labels);
}
/**
* 根据标签名字模糊查询标签
@ -299,9 +291,7 @@ public class Controller {
List<Label> labels = cameraChannelMapper.selectByLabelName(labelName);
Result success = Result.success(labels);
return success;
return Result.success(labels);
}
/**
@ -319,9 +309,7 @@ public class Controller {
List<CameraOrganization> organs = cameraOrgenMapper.selectSubOrganization(parentId);
Result success = Result.success(organs);
return success;
return Result.success(organs);
}
/**
@ -338,24 +326,13 @@ public class Controller {
})
public Result selectNLAll(Integer page,Integer pageSize,String labelCode){
List<CameraChannelNLDto> selectNLAll = cameraChannelMapper.selectNLAll(page,pageSize);
if (labelCode != null && labelCode != ""){
if (labelCode != null && !"".equals(labelCode)){
List<CameraChannelNLDto> dtos = cameraChannelMapper.selectByLabel(page, pageSize);
Result success = Result.success(dtos);
return success;
return Result.success(dtos);
}
Result success = Result.success(selectNLAll);
return success;
return Result.success(selectNLAll);
}
//查询视频点播巡检结果只取异常的
// @RequestMapping("listChannelPlayStates")
// public Result listChannelPlayStates(
// @RequestParam(value="page",required = false,defaultValue = "1") Integer page,
// @RequestParam(value="pageSize",required = false,defaultValue = "20") Integer pageSize
// ){
// return monitorService.listChannelPlayStates();
// }
//道路统计数据与排名
@GetMapping("roadData")
@ApiOperation("道路统计数据与排名根据后台dt调用接口")
@ -450,8 +427,7 @@ public class Controller {
@GetMapping("passengerFlow")
@ApiOperation("获取最新的客流列表,测试接口,调用接口获取")
public List<Map> passengerFlow(){
List<Map> list = passengerFlowService.passengerFlow();
return list;
return passengerFlowService.passengerFlow();
}
//获取最新的实时客流列表从表获取
@ -459,15 +435,13 @@ public class Controller {
@ApiOperation("获取最新的实时客流列表,从表获取,热力图")
@ApiImplicitParam(name="timeId",value = "时间点",required = false,paramType = "query",dataType = "string")
public List<PassengerFlow> listPassengerFlow(@RequestParam(value="timeId",required = false,defaultValue = "1970000000") String timeId){
List<PassengerFlow> list = passengerFlowService.listPassengerFlow(timeId);
return list;
return passengerFlowService.listPassengerFlow(timeId);
}
//从表中获取最新的客流列表并筛选出all_nums >=5000的
@GetMapping("listPassengerFlowByAllNums")
@ApiOperation("从表中获取最新的客流列表并筛选出all_nums >=5000的")
public List<PassengerFlow> listPassengerFlowByAllNums(){
List<PassengerFlow> list = passengerFlowService.listPassengerFlowByAllNums();
return list;
return passengerFlowService.listPassengerFlowByAllNums();
}
//获取实时客流并保存到表t_passenger_flow
@ -567,7 +541,7 @@ public class Controller {
@ApiImplicitParam(name="longitude",value = "经度",paramType = "query",required = true,dataType = "double")
})
public Result listBuildingSiteByPoints(double longitude,double latitude,Integer radius){
List<BuildingSite> list = new ArrayList<>();
List<BuildingSite> list;
list = buildingSitrService.listBuildingSiteByPoints(longitude,latitude,radius);
return Result.success(list);
}
@ -580,8 +554,7 @@ public class Controller {
@ApiOperation("查询全部工地信息")
public Result selectBuildSite(){
List<BuildingSite> buildingSites = buildingSiteMapper.selectBuildSite();
Result success = Result.success(buildingSites);
return success;
return Result.success(buildingSites);
}
/******************************2022/07/13 ytl修改视频资源 start********************************************/
@ -598,13 +571,9 @@ public class Controller {
if (parentId == null){
parentId = "";
}
//List<CameraOrganization> organs = cameraOrgenMapper.selectSubOrganization(parentId);
List<Map> maps = monitorService.selectSubOrganizationNew(parentId);
Result success = Result.success(maps);
return success;
return Result.success(maps);
}
/**
@ -640,23 +609,19 @@ public class Controller {
list1 = Arrays.asList(labelCodes);
}
//查询当前地区及下级地区的id,组成list,2022-07-14,ytl
List<Map> orgenIds = new ArrayList<>();
String path = "";
if(queryMap.get("parentId") != null && StringUtils.isNotBlank(queryMap.get("parentId").toString())){
//根据parentId获取地区表中的path
Map parentId = cameraOrgenMapper.selectOrgenizationById(queryMap.get("parentId").toString());
path = parentId.get("path").toString();
}
List<Map> list = cameraChannelMapper.selectByParentIdNew(queryMap, list1,path);
Result success = Result.success(list);
success.setCount(cameraChannelMapper.selectByParentIdCountNew(queryMap, list1,path));
return success;
}
/**
* 摄像头按照市区进行聚合查询
*/
@ -670,24 +635,18 @@ public class Controller {
* 保存区域信息
*/
@GetMapping("/saveOrgenization")
public Result saveOrgenization() throws Exception{
List<JSONObject> orgenizationByPage = monitorService.getOrgenization(new ArrayList<JSONObject>(10000));
List<Map> maps = JSONObject.parseArray(JSONObject.toJSONString(orgenizationByPage), Map.class);
if(maps.size() > 0){
public Result saveOrgenization() {
List<JSONObject> orgenizationByPage = monitorService.getOrgenization(new ArrayList<>());
List<Map> maps = JSON.parseArray(JSON.toJSONString(orgenizationByPage), Map.class);
if(!maps.isEmpty()){
List<List<Map>> lists = Lists.partition(maps,100);
lists.forEach(list->{
cameraOrgenMapper.batchSaveOrgenization(list);
});
lists.forEach(list-> cameraOrgenMapper.batchSaveOrgenization(list));
//修改path 信息
List<Map> maps2 = cameraOrgenMapper.testAll();
maps2.forEach(map->{
monitorService.setOrganizationPath(map,map.get("parent_id").toString());
});
maps2.forEach(map-> monitorService.setOrganizationPath(map,map.get("parent_id").toString()));
maps2.forEach(m->{
cameraOrgenMapper.updateOrganizationPaht(m.get("path").toString(),m.get("id").toString());
});
maps2.forEach(m-> cameraOrgenMapper.updateOrganizationPaht(m.get("path").toString(),m.get("id").toString()));
}
return Result.success();
@ -708,8 +667,8 @@ public class Controller {
*/
@GetMapping("saveChannelInfoAsync")
public Result saveChannelInfoAsync() throws Exception{
monitorService.saveChannelInfoAsync();
return Result.success();
monitorService.saveChannelInfoAsync();
return Result.success("成功收到指令,请耐心等待");
}
/******************************2022/07/13 ytl修改视频资源 end********************************************/
/**
@ -720,21 +679,6 @@ public class Controller {
*/
@GetMapping("/checkCameraIfExists")
public Result checkCameraIfExists(@RequestParam List<String> list){
Result result = cameraChannelService.checkCameraIfExists(list);
return result;
return cameraChannelService.checkCameraIfExists(list);
}
// //以下是7月26号的测试用的
// @GetMapping("/getCameraChannelByPID")
// public Result getCameraChannelByPID(@RequestParam String pid) throws Exception{
// List<Map> channelInfo = monitorService.getChannelInfo(pid);
// return Result.success(channelInfo);
// }
//
// @GetMapping("/getOrganization")
// public Result getOrganization() throws Exception{
// List<JSONObject> orgenization = monitorService.getOrgenization(new ArrayList<>());
// return Result.success(orgenization);
// }
}