diff --git a/src/main/java/com/hisense/monitormanage/config/ScheduleConfig.java b/src/main/java/com/hisense/monitormanage/config/ScheduleConfig.java new file mode 100644 index 0000000..13366b6 --- /dev/null +++ b/src/main/java/com/hisense/monitormanage/config/ScheduleConfig.java @@ -0,0 +1,17 @@ +package com.hisense.monitormanage.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.SchedulingConfigurer; +import org.springframework.scheduling.config.ScheduledTaskRegistrar; + +import java.util.concurrent.Executors; + +@Configuration +//所有的定时任务都放在一个线程池中,定时任务启动时使用不同都线程 +public class ScheduleConfig implements SchedulingConfigurer { + @Override + public void configureTasks(ScheduledTaskRegistrar scheduledTaskRegistrar) { + //设定一个长度20的定时任务线程池 + scheduledTaskRegistrar.setScheduler(Executors.newScheduledThreadPool(20)); + } +} diff --git a/src/main/java/com/hisense/monitormanage/controller/EventController.java b/src/main/java/com/hisense/monitormanage/controller/EventController.java index 6a6a175..7fbb5f8 100644 --- a/src/main/java/com/hisense/monitormanage/controller/EventController.java +++ b/src/main/java/com/hisense/monitormanage/controller/EventController.java @@ -202,69 +202,105 @@ public class EventController { @GetMapping("selectByName") @ApiOperation("根据事件名称查询事件") @ApiImplicitParam(name = "eventNewName",value = "事件名称",required = true,dataType = "String") - public Result selectByName(String eventNewName){ + public Result selectByName(String eventNewName,Integer page,Integer pageSize){ if (eventNewName.equals("环境卫生")){ - List lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'"); + List lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'",page,pageSize); for (EventDto list: lists) { list.setEventNewName("环境卫生"); } - Result success = Result.success(lists); + Integer integer = eventMapper.selectCountByName("'塑料篮子','纸箱','街头散落垃圾'"); + Map map = new HashMap<>(); + map.put("sum",integer); + map.put("events",lists); + Result success = Result.success(map); return success; }else if (eventNewName.equals("占道经营")){ - List lists = eventMapper.selectByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'"); + List lists = eventMapper.selectByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'",page,pageSize); for (EventDto list: lists) { list.setEventNewName("占道经营"); } - Result success = Result.success(lists); + Integer integer = eventMapper.selectCountByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'"); + Map map = new HashMap<>(); + map.put("sum",integer); + map.put("events",lists); + Result success = Result.success(map); return success; }else if (eventNewName.equals("沿街晾晒")){ - List lists = eventMapper.selectByName("'沿街晾晒衣物被单'"); + List lists = eventMapper.selectByName("'沿街晾晒衣物被单'",page,pageSize); for (EventDto list: lists) { list.setEventNewName("沿街晾晒"); } - Result success = Result.success(lists); + Integer integer = eventMapper.selectCountByName("'沿街晾晒衣物被单'"); + Map map = new HashMap<>(); + map.put("sum",integer); + map.put("events",lists); + Result success = Result.success(map); return success; }else if (eventNewName.equals("违章停车")){ - List lists = eventMapper.selectByName("'机动车违停'"); + List lists = eventMapper.selectByName("'机动车违停'",page,pageSize); for (EventDto list: lists) { list.setEventNewName("违章停车"); } - Result success = Result.success(lists); + Integer integer = eventMapper.selectCountByName("'机动车违停'"); + Map map = new HashMap<>(); + map.put("sum",integer); + map.put("events",lists); + Result success = Result.success(map); return success; }else if (eventNewName.equals("渣土车发现")) { - List lists = eventMapper.selectByName("'渣土车发现'"); + List lists = eventMapper.selectByName("'渣土车发现'",page,pageSize); for (EventDto list : lists) { list.setEventNewName("渣土车发现"); } - Result success = Result.success(lists); + Integer integer = eventMapper.selectCountByName("'渣土车发现'"); + Map map = new HashMap<>(); + map.put("sum",integer); + map.put("events",lists); + Result success = Result.success(map); return success; }else if (eventNewName.equals("安保区域人员滞留")) { - List lists = eventMapper.selectByName("'安保区域人员滞留'"); + List lists = eventMapper.selectByName("'安保区域人员滞留'",page,pageSize); for (EventDto list : lists) { list.setEventNewName("安保区域人员滞留"); } - Result success = Result.success(lists); + Integer integer = eventMapper.selectCountByName("'安保区域人员滞留'"); + Map map = new HashMap<>(); + map.put("sum",integer); + map.put("events",lists); + Result success = Result.success(map); return success; }else if (eventNewName.equals("安保区域人员徘徊")) { - List lists = eventMapper.selectByName("'安保区域人员徘徊'"); + List lists = eventMapper.selectByName("'安保区域人员徘徊'",page,pageSize); for (EventDto list : lists) { list.setEventNewName("安保区域人员徘徊"); } - Result success = Result.success(lists); + Integer integer = eventMapper.selectCountByName("'安保区域人员徘徊'"); + Map map = new HashMap<>(); + map.put("sum",integer); + map.put("events",lists); + Result success = Result.success(map); return success; }else if (eventNewName.equals("渣土车未密闭")) { - List lists = eventMapper.selectByName("'渣土车未密闭'"); + List lists = eventMapper.selectByName("'渣土车未密闭'",page,pageSize); for (EventDto list : lists) { list.setEventNewName("渣土车未密闭"); } - Result success = Result.success(lists); + Integer integer = eventMapper.selectCountByName("'渣土车未密闭'"); + Map map = new HashMap<>(); + map.put("sum",integer); + map.put("events",lists); + Result success = Result.success(map); return success; }else if (eventNewName.equals("道路积水事件")) { - List lists = eventMapper.selectByName("'道路积水事件'"); + List lists = eventMapper.selectByName("'道路积水事件'",page,pageSize); for (EventDto list : lists) { list.setEventNewName("道路积水事件"); } - Result success = Result.success(lists); + Integer integer = eventMapper.selectCountByName("'道路积水事件'"); + Map map = new HashMap<>(); + map.put("sum",integer); + map.put("events",lists); + Result success = Result.success(map); return success; } return Result.error("请输入正确的事件类型"); @@ -329,14 +365,14 @@ public class EventController { Result success = Result.success(lists); return success; }else if (eventNewName.equals("渣土车未密闭")) { - List lists = eventMapper.selectByName("'渣土车未密闭'"); + List lists = eventMapper.selectByTimeAndName("'渣土车未密闭'"); for (EventDto list : lists) { list.setEventNewName("渣土车未密闭"); } Result success = Result.success(lists); return success; }else if (eventNewName.equals("道路积水事件")) { - List lists = eventMapper.selectByName("'道路积水事件'"); + List lists = eventMapper.selectByTimeAndName("'道路积水事件'"); for (EventDto list : lists) { list.setEventNewName("道路积水事件"); } diff --git a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java index 995e3af..afc0fc3 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/CameraChannelMapper.java @@ -58,6 +58,6 @@ public interface CameraChannelMapper extends BaseMapper { List selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize); - @Select("SELECT * FROM t_camera_channel WHERE channel_code < '404_37020310541317325240' AND channel_code > '404_37020300001310016729' ORDER BY channel_code DESC" ) + @Select("SELECT * FROM t_camera_channel WHERE channel_code < '404_37020303541317325034' AND channel_code > '404_37020300001310016729' ORDER BY channel_code DESC" ) List selectCameraChannel(); } diff --git a/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java b/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java index a1d7be5..9c5bb67 100644 --- a/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java +++ b/src/main/java/com/hisense/monitormanage/mapper/EventMapper.java @@ -20,8 +20,10 @@ public interface EventMapper extends BaseMapper { @Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND track_event = 'START'") List selectByTime(); - @Select("select * from t_event where track_event = 'START' and event_cn_name in (${eventNewName})") - List selectByName(@Param("eventNewName") String eventNewName); + List selectByName(@Param("eventNewName") String eventNewName,@Param("page") Integer page,@Param("pageSize") Integer pageSize); + + @Select("select count(*) from t_event where track_event = 'START' and event_cn_name in (${eventNewName})") + Integer selectCountByName(@Param("eventNewName")String eventNewName); @Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND event_cn_name in (${eventNewName}) AND track_event = 'START'") List selectByTimeAndName(@Param("eventNewName") String eventNewName); diff --git a/src/main/java/com/hisense/monitormanage/service/MonitorService.java b/src/main/java/com/hisense/monitormanage/service/MonitorService.java index 0ee98aa..da9b24c 100644 --- a/src/main/java/com/hisense/monitormanage/service/MonitorService.java +++ b/src/main/java/com/hisense/monitormanage/service/MonitorService.java @@ -214,6 +214,9 @@ public class MonitorService { } } + /** + * 工地农贸市场抓图 + */ @Scheduled(cron = "0 0 8 1/1 * ?") public void construction() { @@ -256,6 +259,9 @@ public class MonitorService { } } + /** + * 海水浴场景区抓图 + */ @Scheduled(cron = "0 0 8/1 * * ?") public void scenicSpotAndBathing() { @@ -298,6 +304,9 @@ public class MonitorService { } } + /** + * 所有摄像头抓图 sql持续更新 + */ @Scheduled(cron = "0 30 8 * * ?") public void CameraScreenshot () { try { @@ -1038,6 +1047,9 @@ public class MonitorService { } } + /** + * 积水点抓图 + */ @Scheduled(cron = "0 0 8 * * ?") public void WaterPointService() { try { diff --git a/src/main/java/com/hisense/monitormanage/service/QidiService.java b/src/main/java/com/hisense/monitormanage/service/QidiService.java index 55c9b14..a990c71 100644 --- a/src/main/java/com/hisense/monitormanage/service/QidiService.java +++ b/src/main/java/com/hisense/monitormanage/service/QidiService.java @@ -93,21 +93,21 @@ public class QidiService { //环卫车轨迹数据 public List resCatalogApplyHJWS () { String token = this.qidiToken(); - String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000442_1?search=[{json}]"; + String url = "http://120.221.95.13:9090/catalog/resCatalogApply/getData/UC_QUERY_HJWS_307013400000000442_1"; HttpHeaders headers = new HttpHeaders(); headers.add("Authorization", "Bearer " + token); Map map = new HashMap<>(); - JSONObject search = new JSONObject(); + /*JSONObject search = new JSONObject(); search.put("opt","LIKE"); search.put("key","updatetime"); search.put("val",this.dateStr()); - map.put("json",search); + map.put("json",search);*/ HttpEntity> request = new HttpEntity<>(null, headers); ResponseEntity responseEntity; try { - responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map); + responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class); JSONObject jsonObject = responseEntity.getBody(); JSONArray jsonArray = jsonObject.getJSONArray("list"); return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class); diff --git a/src/main/resources/mapper/EventMapper.xml b/src/main/resources/mapper/EventMapper.xml index c45a9cb..258278e 100644 --- a/src/main/resources/mapper/EventMapper.xml +++ b/src/main/resources/mapper/EventMapper.xml @@ -6,4 +6,12 @@ limit #{page},#{pageSize} + + \ No newline at end of file