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