按名称查询创城和重点区域事件添加分页以及事件总数

添加定时任务线程池
This commit is contained in:
wuweida 2022-07-15 14:31:23 +08:00
parent 0572c41a41
commit 2837e1e7a3
7 changed files with 103 additions and 28 deletions

View File

@ -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));
}
}

View File

@ -202,69 +202,105 @@ public class EventController {
@GetMapping("selectByName") @GetMapping("selectByName")
@ApiOperation("根据事件名称查询事件") @ApiOperation("根据事件名称查询事件")
@ApiImplicitParam(name = "eventNewName",value = "事件名称",required = true,dataType = "String") @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("环境卫生")){ if (eventNewName.equals("环境卫生")){
List<EventDto> lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'"); List<EventDto> lists = eventMapper.selectByName("'塑料篮子','纸箱','街头散落垃圾'",page,pageSize);
for (EventDto list: lists) { for (EventDto list: lists) {
list.setEventNewName("环境卫生"); list.setEventNewName("环境卫生");
} }
Result success = Result.success(lists); Integer integer = eventMapper.selectCountByName("'塑料篮子','纸箱','街头散落垃圾'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("占道经营")){ }else if (eventNewName.equals("占道经营")){
List<EventDto> lists = eventMapper.selectByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'"); List<EventDto> lists = eventMapper.selectByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'",page,pageSize);
for (EventDto list: lists) { for (EventDto list: lists) {
list.setEventNewName("占道经营"); list.setEventNewName("占道经营");
} }
Result success = Result.success(lists); Integer integer = eventMapper.selectCountByName("'街头伞篷','水果和食品摊','地摊','户外桌椅'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("沿街晾晒")){ }else if (eventNewName.equals("沿街晾晒")){
List<EventDto> lists = eventMapper.selectByName("'沿街晾晒衣物被单'"); List<EventDto> lists = eventMapper.selectByName("'沿街晾晒衣物被单'",page,pageSize);
for (EventDto list: lists) { for (EventDto list: lists) {
list.setEventNewName("沿街晾晒"); list.setEventNewName("沿街晾晒");
} }
Result success = Result.success(lists); Integer integer = eventMapper.selectCountByName("'沿街晾晒衣物被单'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("违章停车")){ }else if (eventNewName.equals("违章停车")){
List<EventDto> lists = eventMapper.selectByName("'机动车违停'"); List<EventDto> lists = eventMapper.selectByName("'机动车违停'",page,pageSize);
for (EventDto list: lists) { for (EventDto list: lists) {
list.setEventNewName("违章停车"); list.setEventNewName("违章停车");
} }
Result success = Result.success(lists); Integer integer = eventMapper.selectCountByName("'机动车违停'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("渣土车发现")) { }else if (eventNewName.equals("渣土车发现")) {
List<EventDto> lists = eventMapper.selectByName("'渣土车发现'"); List<EventDto> lists = eventMapper.selectByName("'渣土车发现'",page,pageSize);
for (EventDto list : lists) { for (EventDto list : lists) {
list.setEventNewName("渣土车发现"); list.setEventNewName("渣土车发现");
} }
Result success = Result.success(lists); Integer integer = eventMapper.selectCountByName("'渣土车发现'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("安保区域人员滞留")) { }else if (eventNewName.equals("安保区域人员滞留")) {
List<EventDto> lists = eventMapper.selectByName("'安保区域人员滞留'"); List<EventDto> lists = eventMapper.selectByName("'安保区域人员滞留'",page,pageSize);
for (EventDto list : lists) { for (EventDto list : lists) {
list.setEventNewName("安保区域人员滞留"); list.setEventNewName("安保区域人员滞留");
} }
Result success = Result.success(lists); Integer integer = eventMapper.selectCountByName("'安保区域人员滞留'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("安保区域人员徘徊")) { }else if (eventNewName.equals("安保区域人员徘徊")) {
List<EventDto> lists = eventMapper.selectByName("'安保区域人员徘徊'"); List<EventDto> lists = eventMapper.selectByName("'安保区域人员徘徊'",page,pageSize);
for (EventDto list : lists) { for (EventDto list : lists) {
list.setEventNewName("安保区域人员徘徊"); list.setEventNewName("安保区域人员徘徊");
} }
Result success = Result.success(lists); Integer integer = eventMapper.selectCountByName("'安保区域人员徘徊'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("渣土车未密闭")) { }else if (eventNewName.equals("渣土车未密闭")) {
List<EventDto> lists = eventMapper.selectByName("'渣土车未密闭'"); List<EventDto> lists = eventMapper.selectByName("'渣土车未密闭'",page,pageSize);
for (EventDto list : lists) { for (EventDto list : lists) {
list.setEventNewName("渣土车未密闭"); list.setEventNewName("渣土车未密闭");
} }
Result success = Result.success(lists); Integer integer = eventMapper.selectCountByName("'渣土车未密闭'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success; return success;
}else if (eventNewName.equals("道路积水事件")) { }else if (eventNewName.equals("道路积水事件")) {
List<EventDto> lists = eventMapper.selectByName("'道路积水事件'"); List<EventDto> lists = eventMapper.selectByName("'道路积水事件'",page,pageSize);
for (EventDto list : lists) { for (EventDto list : lists) {
list.setEventNewName("道路积水事件"); list.setEventNewName("道路积水事件");
} }
Result success = Result.success(lists); Integer integer = eventMapper.selectCountByName("'道路积水事件'");
Map<String,Object> map = new HashMap<>();
map.put("sum",integer);
map.put("events",lists);
Result success = Result.success(map);
return success; return success;
} }
return Result.error("请输入正确的事件类型"); return Result.error("请输入正确的事件类型");
@ -329,14 +365,14 @@ public class EventController {
Result success = Result.success(lists); Result success = Result.success(lists);
return success; return success;
}else if (eventNewName.equals("渣土车未密闭")) { }else if (eventNewName.equals("渣土车未密闭")) {
List<EventDto> lists = eventMapper.selectByName("'渣土车未密闭'"); List<EventDto> lists = eventMapper.selectByTimeAndName("'渣土车未密闭'");
for (EventDto list : lists) { for (EventDto list : lists) {
list.setEventNewName("渣土车未密闭"); list.setEventNewName("渣土车未密闭");
} }
Result success = Result.success(lists); Result success = Result.success(lists);
return success; return success;
}else if (eventNewName.equals("道路积水事件")) { }else if (eventNewName.equals("道路积水事件")) {
List<EventDto> lists = eventMapper.selectByName("'道路积水事件'"); List<EventDto> lists = eventMapper.selectByTimeAndName("'道路积水事件'");
for (EventDto list : lists) { for (EventDto list : lists) {
list.setEventNewName("道路积水事件"); list.setEventNewName("道路积水事件");
} }

View File

@ -58,6 +58,6 @@ public interface CameraChannelMapper extends BaseMapper<CameraChannel> {
List<CameraChannelNLDto> selectNLAll(@Param("page") Integer page,@Param("pageSize") Integer pageSize); List<CameraChannelNLDto> 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<CameraChannel> selectCameraChannel(); List<CameraChannel> selectCameraChannel();
} }

View File

@ -20,8 +20,10 @@ public interface EventMapper extends BaseMapper<Event> {
@Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND track_event = 'START'") @Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND track_event = 'START'")
List<EventDto> selectByTime(); List<EventDto> selectByTime();
@Select("select * from t_event where track_event = 'START' and event_cn_name in (${eventNewName})") List<EventDto> selectByName(@Param("eventNewName") String eventNewName,@Param("page") Integer page,@Param("pageSize") Integer pageSize);
List<EventDto> selectByName(@Param("eventNewName") String eventNewName);
@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'") @Select("SELECT * FROM t_event where TO_DAYS(capture_time) = TO_DAYS(NOW()) AND event_cn_name in (${eventNewName}) AND track_event = 'START'")
List<EventDto> selectByTimeAndName(@Param("eventNewName") String eventNewName); List<EventDto> selectByTimeAndName(@Param("eventNewName") String eventNewName);

View File

@ -214,6 +214,9 @@ public class MonitorService {
} }
} }
/**
* 工地农贸市场抓图
*/
@Scheduled(cron = "0 0 8 1/1 * ?") @Scheduled(cron = "0 0 8 1/1 * ?")
public void construction() { public void construction() {
@ -256,6 +259,9 @@ public class MonitorService {
} }
} }
/**
* 海水浴场景区抓图
*/
@Scheduled(cron = "0 0 8/1 * * ?") @Scheduled(cron = "0 0 8/1 * * ?")
public void scenicSpotAndBathing() { public void scenicSpotAndBathing() {
@ -298,6 +304,9 @@ public class MonitorService {
} }
} }
/**
* 所有摄像头抓图 sql持续更新
*/
@Scheduled(cron = "0 30 8 * * ?") @Scheduled(cron = "0 30 8 * * ?")
public void CameraScreenshot () { public void CameraScreenshot () {
try { try {
@ -1038,6 +1047,9 @@ public class MonitorService {
} }
} }
/**
* 积水点抓图
*/
@Scheduled(cron = "0 0 8 * * ?") @Scheduled(cron = "0 0 8 * * ?")
public void WaterPointService() { public void WaterPointService() {
try { try {

View File

@ -93,21 +93,21 @@ public class QidiService {
//环卫车轨迹数据 //环卫车轨迹数据
public List<Map> resCatalogApplyHJWS () { public List<Map> resCatalogApplyHJWS () {
String token = this.qidiToken(); 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(); HttpHeaders headers = new HttpHeaders();
headers.add("Authorization", "Bearer " + token); headers.add("Authorization", "Bearer " + token);
Map<String,Object> map = new HashMap<>(); Map<String,Object> map = new HashMap<>();
JSONObject search = new JSONObject(); /*JSONObject search = new JSONObject();
search.put("opt","LIKE"); search.put("opt","LIKE");
search.put("key","updatetime"); search.put("key","updatetime");
search.put("val",this.dateStr()); search.put("val",this.dateStr());
map.put("json",search); map.put("json",search);*/
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers); HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(null, headers);
ResponseEntity<JSONObject> responseEntity; ResponseEntity<JSONObject> responseEntity;
try { try {
responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class,map); responseEntity = restTemplate.exchange(url, HttpMethod.GET, request, JSONObject.class);
JSONObject jsonObject = responseEntity.getBody(); JSONObject jsonObject = responseEntity.getBody();
JSONArray jsonArray = jsonObject.getJSONArray("list"); JSONArray jsonArray = jsonObject.getJSONArray("list");
return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class); return JSONObject.parseArray(JSONObject.toJSONString(jsonArray), Map.class);

View File

@ -6,4 +6,12 @@
<bind name="page" value="(page-1)*pageSize"/> <bind name="page" value="(page-1)*pageSize"/>
limit #{page},#{pageSize} limit #{page},#{pageSize}
</select> </select>
<select id="selectByName" resultType="com.hisense.monitormanage.dto.EventDto">
select * from t_event where track_event = 'START' and event_cn_name in (${eventNewName})
<if test="page!=null and '' != page and pageSize != null and '' != pageSize">
<bind name="page" value="(page-1)*pageSize"/>
limit #{page},#{pageSize}
</if>
</select>
</mapper> </mapper>