From 9c86df06c83dffc854f58e34e4fca78428d40a8c Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Mon, 5 Feb 2024 18:16:23 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=B8=AD=E9=97=B4=E5=BA=93=E6=B0=94?= =?UTF-8?q?=E8=B1=A1=E6=A3=80=E6=B5=8B=E5=99=A8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DcMeteorologicalDetectorDataMapper.java | 16 ++++++++ .../DevicePropertyReportListener.java | 8 +++- .../IDcMeteorologicalDetectorDataService.java | 8 ++++ ...MeteorologicalDetectorDataServiceImpl.java | 20 ++++++++++ .../DcMeteorologicalDetectorDataMapper.xml | 40 ++++++++++++++++++- 5 files changed, 89 insertions(+), 3 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java index 3a0868cb..b98086ce 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcMeteorologicalDetectorDataMapper.java @@ -43,6 +43,22 @@ public interface DcMeteorologicalDetectorDataMapper */ int updateDcMeteorologicalDetectorData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); + /** + * 中间库新增气象检测器数据 + * + * @param dcMeteorologicalDetectorData 气象检测器数据 + * @return 结果 + */ + Boolean insertIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); + + /** + * 中间库修改气象检测器数据 + * + * @param dcMeteorologicalDetectorData 气象检测器数据 + * @return 结果 + */ + Boolean updateIntermediateWarehouseData(DcMeteorologicalDetectorData dcMeteorologicalDetectorData); + /** * 删除气象检测器数据 * diff --git a/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java b/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java index d7370696..561c79e6 100644 --- a/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java +++ b/zc-business/src/main/java/com/zc/business/message/device/listener/DevicePropertyReportListener.java @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; import com.google.gson.JsonObject; import com.zc.business.domain.DcDevice; import com.zc.business.domain.DcMeteorologicalDetectorData; +import com.zc.business.enums.IotProductEnum; import com.zc.business.service.IDcMeteorologicalDetectorDataService; import com.zc.common.core.redis.stream.RedisStream; import org.slf4j.Logger; @@ -46,11 +47,14 @@ public class DevicePropertyReportListener implements StreamListener where id = #{id} - + insert into dc_meteorological_detector_data @@ -146,6 +146,44 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + insert into meteorological_detector_data + + device_id, + temperature, + humidity, + precipitation_type, + rainfall, + road_surface_status, + water_film_thickness, + update_time + + + #{iotDeviceId}, + #{temperature}, + #{humidity}, + #{precipitationType}, + #{rainfall}, + #{roadSurfaceStatus}, + #{waterFilmThickness}, + current_date + + + + + update meteorological_detector_data + + temperature = #{temperature}, + humidity = #{humidity}, + precipitation_type = #{precipitationType}, + rainfall = #{rainfall}, + road_surface_status = #{roadSurfaceStatus}, + water_film_thickness = #{waterFilmThickness}, + update_time = current_date + + where device_id = #{iotDeviceId} + + delete from dc_meteorological_detector_data where id = #{id} From bc96cbd19e7631deec138f24828f5a807aa3a24f Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Tue, 6 Feb 2024 17:12:29 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=94=B6=E8=B4=B9=E7=AB=99=E7=AE=A1?= =?UTF-8?q?=E5=88=B6=E5=88=86=E6=9E=90=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DcTrafficIncidentsController.java | 8 +- .../mapper/DcTrafficIncidentsMapper.java | 15 +- .../service/IDcTrafficIncidentsService.java | 4 +- .../impl/DcTrafficIncidentsServiceImpl.java | 186 ++++++++++-------- .../business/DcTrafficIncidentsMapper.xml | 35 +++- 5 files changed, 159 insertions(+), 89 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcTrafficIncidentsController.java b/zc-business/src/main/java/com/zc/business/controller/DcTrafficIncidentsController.java index 4c2f2547..4fd32ec0 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcTrafficIncidentsController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcTrafficIncidentsController.java @@ -162,6 +162,8 @@ public class DcTrafficIncidentsController { * * @author liuwenge * @date 2024/1/15 17:31 + * @param searchType 查询条件(1:站点,2:原因) + * @param facilityIdList 站点id * @param controlType 类型(1:封闭,2:限行) * @param startTime 开始时间 * @param endTime 结束时间 @@ -169,10 +171,12 @@ public class DcTrafficIncidentsController { */ @ApiOperation("收费站统计分析table") @PostMapping("/selectTollStationAnalysis") - public AjaxResult selectTollStationAnalysis(@ApiParam(value="类型(1:封闭,2:限行)", name="controlType", required=true) @RequestParam ("controlType") String controlType, + public AjaxResult selectTollStationAnalysis(@ApiParam(value="查询条件(1:站点,2:原因)", name="searchType", required=true) @RequestParam ("searchType") String searchType, + @ApiParam(value="站点id", name="facilityId", required=false) @RequestParam (name="facilityId",required = false) String[] facilityIdList, + @ApiParam(value="类型(1:封闭,2:限行)", name="controlType", required=false) @RequestParam (name="controlType",required = false) String controlType, @ApiParam(value="开始时间", name="startTime", required=true) @RequestParam ("startTime") String startTime, @ApiParam(value="结束时间", name="endTime", required=true) @RequestParam ("endTime") String endTime){ - return trafficIncidentsService.selectTollStationAnalysis(controlType,startTime,endTime); + return trafficIncidentsService.selectTollStationAnalysis(searchType,facilityIdList,controlType,startTime,endTime); } /** diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcTrafficIncidentsMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcTrafficIncidentsMapper.java index 601d1176..d0cfeb9b 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcTrafficIncidentsMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcTrafficIncidentsMapper.java @@ -181,12 +181,25 @@ public interface DcTrafficIncidentsMapper { * * @author liuwenge * @date 2024/1/16 14:18 + * @param facilityIdList 站点id * @param controlType 类型(1:封闭,2:限行) * @param startTime 开始时间 * @param endTime 结束时间 * @return java.util.List> */ - List> selectTollStationAnalysis(@Param("controlType") String controlType,@Param("startTime") String startTime,@Param("endTime") String endTime); + List> selectTollStationAnalysis(@Param("facilityIdList") String[] facilityIdList,@Param("controlType") String controlType,@Param("startTime") String startTime,@Param("endTime") String endTime); + + /** + * @Description 收费站统计分析table 根据站点 + * + * @author liuwenge + * @date 2024/2/6 15:18 + * @param facilityIdList 站点id + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return java.util.List> + */ + List> selectTollStationAnalysisByFacility(@Param("facilityIdList") String[] facilityIdList,@Param("startTime") String startTime,@Param("endTime") String endTime); /** * @Description 收费站统计分析echarts diff --git a/zc-business/src/main/java/com/zc/business/service/IDcTrafficIncidentsService.java b/zc-business/src/main/java/com/zc/business/service/IDcTrafficIncidentsService.java index 9fe3c4ff..8687a48a 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcTrafficIncidentsService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcTrafficIncidentsService.java @@ -103,12 +103,14 @@ public interface IDcTrafficIncidentsService { * @return com.ruoyi.common.core.domain.AjaxResult * @Description 路网管控-事件管控分析-收费站统计分析table * @author liuwenge + * @param searchType 查询条件 + * @param facilityIdList 站点id * @param controlType 类型(1:封闭,2:限行) * @param startTime 开始时间 * @param endTime 结束时间 * @date 2024/1/15 17:31 */ - AjaxResult selectTollStationAnalysis(String controlType,String startTime,String endTime); + AjaxResult selectTollStationAnalysis(String searchType,String[] facilityIdList,String controlType,String startTime,String endTime); /** * @Description 路网管控-事件管控分析-收费站统计分析echarts(当月) diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficIncidentsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficIncidentsServiceImpl.java index f29ad12a..4e0dea1e 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficIncidentsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficIncidentsServiceImpl.java @@ -2,6 +2,7 @@ package com.zc.business.service.impl; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.StakeMarkUtils; +import com.ruoyi.common.utils.StringUtils; import com.zc.business.domain.DcEvent; import com.zc.business.domain.DcEventType; import com.zc.business.mapper.DcTrafficIncidentsMapper; @@ -15,6 +16,7 @@ import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.time.Year; import java.util.*; +import java.util.stream.Collectors; /** * @Description 交通事件统计Service业务层处理 @@ -352,111 +354,129 @@ public class DcTrafficIncidentsServiceImpl implements IDcTrafficIncidentsService * @Description 路网管控-事件管控分析-收费站统计分析table * @return com.ruoyi.common.core.domain.AjaxResult * @author liuwenge + * @param searchType 查询条件 + * @param facilityIdList 站点id * @param controlType 类型(1:封闭,2:限行) * @param startTime 开始时间 * @param endTime 结束时间 * @date 2024/1/15 17:31 */ @Override - public AjaxResult selectTollStationAnalysis(String controlType,String startTime,String endTime){ - - //目标时段 - List> list = trafficIncidentsMapper.selectTollStationAnalysis(controlType,startTime,endTime); - BigDecimal allNum = BigDecimal.ZERO; - BigDecimal allTime = BigDecimal.ZERO; - for (Map data : list) { - allNum = allNum.add(new BigDecimal(data.get("num").toString())); - allTime = allTime.add(new BigDecimal(data.get("minuteTime").toString())); - } - for (Map data : list) { - //计算站次占比 - if (allNum.compareTo(BigDecimal.ZERO) > 0){ - BigDecimal numRatio = new BigDecimal(data.get("num").toString()).multiply(new BigDecimal("100")).divide(allNum,2, RoundingMode.HALF_UP); - data.put("numRatio",numRatio); - } else { - data.put("numRatio",0); - } + public AjaxResult selectTollStationAnalysis(String searchType,String[] facilityIdList,String controlType,String startTime,String endTime){ - //计算时长占比 - if (allTime.compareTo(BigDecimal.ZERO) > 0){ - BigDecimal timeRatio = new BigDecimal(data.get("minuteTime").toString()).multiply(new BigDecimal("100")).divide(allTime,2, RoundingMode.HALF_UP); - data.put("timeRatio",timeRatio); - } else { - data.put("timeRatio",0); - } - } + //站点 + if ("1".equals(searchType)){ + List> list = trafficIncidentsMapper.selectTollStationAnalysisByFacility(facilityIdList,startTime,endTime); + return AjaxResult.success(list); - //去年同期 - try { - SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - Calendar cal = Calendar.getInstance(); - - Date startDate = dateFormat.parse(startTime); - cal.setTime(startDate); - cal.add(Calendar.YEAR,-1); - String lastStartTime = dateFormat.format(cal.getTime()); - - Date endDate = dateFormat.parse(endTime); - cal.setTime(endDate); - cal.add(Calendar.YEAR,-1); - String lastEndTime = dateFormat.format(cal.getTime()); - - List> lastList = trafficIncidentsMapper.selectTollStationAnalysis(controlType,lastStartTime,lastEndTime); - BigDecimal lastAllNum = BigDecimal.ZERO; - BigDecimal lastAllTime = BigDecimal.ZERO; - - for (int i = 0; i < lastList.size(); i++) { - //去年同期站次 - lastAllNum = lastAllNum.add(new BigDecimal(lastList.get(i).get("num").toString())); - list.get(i).put("lastYearNum",lastList.get(i).get("num").toString()); - - //去年同期时长 - lastAllTime = lastAllTime.add(new BigDecimal(lastList.get(i).get("minuteTime").toString())); - list.get(i).put("lastYearTime",lastList.get(i).get("minuteTime").toString()); - } + } else { + //原因 - for (int i = 0; i < lastList.size(); i++) { - //去年同期站次占比 - if (lastAllNum.compareTo(BigDecimal.ZERO) > 0){ - BigDecimal numRatio = new BigDecimal(lastList.get(i).get("num").toString()).multiply(new BigDecimal("100")).divide(lastAllNum,2, RoundingMode.HALF_UP); - list.get(i).put("lastYearNumRatio",numRatio); + if (StringUtils.isEmpty(controlType)){ + return AjaxResult.error("请选择事件类型"); + } + //目标时段 + List> list = trafficIncidentsMapper.selectTollStationAnalysis(facilityIdList,controlType,startTime,endTime); + BigDecimal allNum = BigDecimal.ZERO; + BigDecimal allTime = BigDecimal.ZERO; + for (Map data : list) { + allNum = allNum.add(new BigDecimal(data.get("num").toString())); + allTime = allTime.add(new BigDecimal(data.get("minuteTime").toString())); + } + for (Map data : list) { + //计算站次占比 + if (allNum.compareTo(BigDecimal.ZERO) > 0){ + BigDecimal numRatio = new BigDecimal(data.get("num").toString()).multiply(new BigDecimal("100")).divide(allNum,2, RoundingMode.HALF_UP); + data.put("numRatio",numRatio); } else { - list.get(i).put("lastYearNumRatio",0); + data.put("numRatio",0); } - ////去年同期时长占比 - if (lastAllTime.compareTo(BigDecimal.ZERO) > 0) { - BigDecimal timeRatio = new BigDecimal(lastList.get(i).get("minuteTime").toString()).multiply(new BigDecimal("100")).divide(lastAllTime, 2, RoundingMode.HALF_UP); - list.get(i).put("lastYearTimeRatio", timeRatio); + + //计算时长占比 + if (allTime.compareTo(BigDecimal.ZERO) > 0){ + BigDecimal timeRatio = new BigDecimal(data.get("minuteTime").toString()).multiply(new BigDecimal("100")).divide(allTime,2, RoundingMode.HALF_UP); + data.put("timeRatio",timeRatio); } else { - list.get(i).put("lastYearTimeRatio", 0); + data.put("timeRatio",0); } } - //同比 - for (Map map : list) { - //站次同比 - if (new BigDecimal(map.get("lastYearNum").toString()).compareTo(BigDecimal.ZERO) > 0){ - BigDecimal yearNumRatio = new BigDecimal(map.get("num").toString()).multiply(new BigDecimal("100")).divide(new BigDecimal(map.get("lastYearNum").toString()),2, RoundingMode.HALF_UP); - map.put("yearNumRatio",yearNumRatio); - } else { - map.put("yearNumRatio",0); + //去年同期 + try { + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + Calendar cal = Calendar.getInstance(); + + Date startDate = dateFormat.parse(startTime); + cal.setTime(startDate); + cal.add(Calendar.YEAR,-1); + String lastStartTime = dateFormat.format(cal.getTime()); + + Date endDate = dateFormat.parse(endTime); + cal.setTime(endDate); + cal.add(Calendar.YEAR,-1); + String lastEndTime = dateFormat.format(cal.getTime()); + + List> lastList = trafficIncidentsMapper.selectTollStationAnalysis(facilityIdList,controlType,lastStartTime,lastEndTime); + BigDecimal lastAllNum = BigDecimal.ZERO; + BigDecimal lastAllTime = BigDecimal.ZERO; + + for (int i = 0; i < lastList.size(); i++) { + //去年同期站次 + lastAllNum = lastAllNum.add(new BigDecimal(lastList.get(i).get("num").toString())); + list.get(i).put("lastYearNum",lastList.get(i).get("num").toString()); + + //去年同期时长 + lastAllTime = lastAllTime.add(new BigDecimal(lastList.get(i).get("minuteTime").toString())); + list.get(i).put("lastYearTime",lastList.get(i).get("minuteTime").toString()); } - //时长同比 - if (new BigDecimal(map.get("lastYearTime").toString()).compareTo(BigDecimal.ZERO) > 0){ - BigDecimal yearTimeRatio = new BigDecimal(map.get("minuteTime").toString()).multiply(new BigDecimal("100")).divide(new BigDecimal(map.get("lastYearTime").toString()),2, RoundingMode.HALF_UP); - map.put("yearTimeRatio",yearTimeRatio); - } else { - map.put("yearTimeRatio",0); + for (int i = 0; i < lastList.size(); i++) { + //去年同期站次占比 + if (lastAllNum.compareTo(BigDecimal.ZERO) > 0){ + BigDecimal numRatio = new BigDecimal(lastList.get(i).get("num").toString()).multiply(new BigDecimal("100")).divide(lastAllNum,2, RoundingMode.HALF_UP); + list.get(i).put("lastYearNumRatio",numRatio); + } else { + list.get(i).put("lastYearNumRatio",0); + } + ////去年同期时长占比 + if (lastAllTime.compareTo(BigDecimal.ZERO) > 0) { + BigDecimal timeRatio = new BigDecimal(lastList.get(i).get("minuteTime").toString()).multiply(new BigDecimal("100")).divide(lastAllTime, 2, RoundingMode.HALF_UP); + list.get(i).put("lastYearTimeRatio", timeRatio); + } else { + list.get(i).put("lastYearTimeRatio", 0); + } + } + + //同比 + for (Map map : list) { + //站次同比 + if (new BigDecimal(map.get("lastYearNum").toString()).compareTo(BigDecimal.ZERO) > 0){ + BigDecimal yearNumRatio = new BigDecimal(map.get("num").toString()).multiply(new BigDecimal("100")).divide(new BigDecimal(map.get("lastYearNum").toString()),2, RoundingMode.HALF_UP); + map.put("yearNumRatio",yearNumRatio); + } else { + map.put("yearNumRatio",0); + } + + //时长同比 + if (new BigDecimal(map.get("lastYearTime").toString()).compareTo(BigDecimal.ZERO) > 0){ + BigDecimal yearTimeRatio = new BigDecimal(map.get("minuteTime").toString()).multiply(new BigDecimal("100")).divide(new BigDecimal(map.get("lastYearTime").toString()),2, RoundingMode.HALF_UP); + map.put("yearTimeRatio",yearTimeRatio); + } else { + map.put("yearTimeRatio",0); + } } + + } catch (Exception e){ + e.printStackTrace(); } - } catch (Exception e){ - e.printStackTrace(); - } + return AjaxResult.success(list); - return AjaxResult.success(list); + } + } + private String customKey(Map map){ + return map.get("facilityId").toString(); } /** diff --git a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml index e9337764..077f7aef 100644 --- a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml @@ -225,15 +225,46 @@ then TIMESTAMPDIFF(MINUTE,t1.start_time,t1.end_time) else 0 end) minuteTime from dc_event t1 LEFT JOIN dc_event_traffic_control t2 on t1.id = t2.id - where - t1.event_type = '3' and t1.event_subclass = '3-2' and t2.control_type = #{controlType} + + t1.event_type = '3' and t1.event_subclass = '3-2' + + AND t2.facility_id in + + #{facilityId} + + and date_format(t1.start_time,'%Y-%m-%d %H:%i:%s') <= date_format(#{endTime},'%Y-%m-%d %H:%i:%s') and (date_format(t1.end_time,'%Y-%m-%d %H:%i:%s') > date_format(#{startTime},'%Y-%m-%d %H:%i:%s') or ISNULL(t1.end_time)) + GROUP BY t2.control_cause,t2.cause_type) t4 on t3.control_cause = t4.control_cause and t3.cause_type = t4.cause_type ORDER BY t3.control_cause, t3.cause_type + + select - t2.facility_id facilityId,t3.facility_name,classify, + t2.facility_id facilityId,t3.facility_name facilityName,classify, SUM(case when t2.classify = '6' then 1 else 0 end) facilityClose, SUM(case when t2.classify = '7' then 1 else 0 end) facilityRestriction, SUM(case when t2.classify = '9' then 1 else 0 end) facilityInterval From 9212ea8bac0cd9361c982029d2feb9fabc4c740e Mon Sep 17 00:00:00 2001 From: wangsixiang <2970484253@qq.com> Date: Tue, 6 Feb 2024 17:36:10 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=84=9F=E7=9F=A5=E8=B7=AF=E6=AE=B5?= =?UTF-8?q?=E6=8E=92=E5=90=8D=E6=8E=A5=E5=8F=A3=E4=BF=AE=E6=94=B9=EF=BC=8C?= =?UTF-8?q?=E8=B7=AF=E6=AE=B5=E8=8C=83=E5=9B=B4=E5=86=85=E6=A1=A9=E5=8F=B7?= =?UTF-8?q?=E5=88=86=E5=B8=83=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DCPerceivedEventsWarningController.java | 17 ++++- .../com/zc/business/domain/DcWarning.java | 41 +++--------- .../DcPerceivedEventsWarningMapper.java | 6 +- .../IDCPerceivedEventsWarningService.java | 3 +- .../DcPerceivedEventsWarningServiceImpl.java | 13 +++- .../DcPerceivedEventsWarningMapper.xml | 63 +++++++++++++------ 6 files changed, 87 insertions(+), 56 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java b/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java index 05eed037..0b426534 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java @@ -119,7 +119,7 @@ public class DCPerceivedEventsWarningController extends BaseController { return AjaxResult.error("参数数据异常"); } if (type.equals("quarter")) { - List> total = perceivedEventsWarningService.selectWarningSectionTypeCountQuarter(dcWarning); + String total = perceivedEventsWarningService.selectWarningSectionTypeCountQuarter(dcWarning); map.put("total",total); } else { String total = perceivedEventsWarningService.selectWarningSectionTypeCount(dcWarning); @@ -140,8 +140,21 @@ public class DCPerceivedEventsWarningController extends BaseController { if (StringUtils.isBlank(direction)){ return AjaxResult.error("参数异常"); } - return AjaxResult.success(perceivedEventsWarningService.selectSectionMark(dcWarning)); + return AjaxResult.success(perceivedEventsWarningService.selectSectionMarkOptimize(dcWarning)); } + //查询某个路段下的全部桩号 +// @PostMapping("/sectionMarkNumberOptimize") +// public AjaxResult getSectionMarkOptimize(@RequestBody DcWarning dcWarning){ +// String sectionId = dcWarning.getSectionId(); +// if (StringUtils.isBlank(sectionId)){ +// return AjaxResult.error("参数异常"); +// } +// String direction = dcWarning.getDirection(); +// if (StringUtils.isBlank(direction)){ +// return AjaxResult.error("参数异常"); +// } +// return AjaxResult.success(perceivedEventsWarningService.selectSectionMarkOptimize(dcWarning)); +// } //预警事件,事件列表 查询状态为上报的感知事件 @PostMapping("/warningEscalation") diff --git a/zc-business/src/main/java/com/zc/business/domain/DcWarning.java b/zc-business/src/main/java/com/zc/business/domain/DcWarning.java index d7f02601..e7afdaeb 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcWarning.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcWarning.java @@ -25,10 +25,7 @@ public class DcWarning extends BaseEntity @Excel(name = "所在桩号") private String stakeMark; - /** 方向: - 1-上行 - 2-中 - 3-下行 */ + /** 方向:1-上行2-中3-下行 */ @Excel(name = "方向: 1-上行 2-中 3-下行") private String direction; @@ -36,30 +33,20 @@ public class DcWarning extends BaseEntity @Excel(name = "所属部门") private Long deptId; - /** 警情状态: - 1-上报 - 2-已完成 - 3-已终止 - 4-自动结束 */ + /** 警情状态:1-上报2-已完成3-已终止4-自动结束 */ @Excel(name = "警情状态: 1-上报 2-已完成 3-已终止 4-自动结束") private Integer warningState; /** 预警时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "预警时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8") + @Excel(name = "预警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date warningTime; /** 处理人员 */ @Excel(name = "处理人员") private Long userId; - /** 信息来源: - 1-视频AI - 2-雷达识别 - 3-锥桶 - 4-护栏碰撞 - 5-扫码报警 - 6-非机预警 */ + /** 信息来源:1-视频AI2-雷达识别3-锥桶4-护栏碰撞5-扫码报警6-非机预警 */ @Excel(name = "信息来源: 1-视频AI 2-雷达识别 3-锥桶 4-护栏碰撞 5-扫码报警 6-非机预警") private Integer warningSource; @@ -67,22 +54,11 @@ public class DcWarning extends BaseEntity @Excel(name = "预警级别") private Integer warningLevel; - /** 事件主类: - 1-交通拥堵 - 2-行人 - 3-非机动车 - 4-停车 - 5-倒车/逆行 - 6-烟火 - 7-撒落物 - 8-异常天气 - 9-护栏碰撞 */ + /** 事件主类:1-交通拥堵2-行人3-非机动车4-停车5-倒车/逆行6-烟火7-撒落物8-异常天气9-护栏碰撞 */ @Excel(name = "事件主类: 1-交通拥堵 2-行人 3-非机动车 4-停车 5-倒车/逆行 6-烟火 7-撒落物 8-异常天气 9-护栏碰撞") private Integer warningType; - /** 事件子类: - 1-1 拥堵 - 1-2 缓行 */ + /** 事件子类:1-1 拥堵1-2 缓行 */ @Excel(name = "事件子类: 1-1 拥堵 1-2 缓行") private String warningSubclass; @@ -112,7 +88,8 @@ public class DcWarning extends BaseEntity private String longitude; private String latitude; - + /** 车辆类型 */ + @Excel(name = "车辆类型") private String vehicleType; public String getVehicleType() { diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java index a27a458f..66f8c064 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java @@ -56,7 +56,7 @@ public interface DcPerceivedEventsWarningMapper { String selectWarningSectionTypeMonthCount(DcWarning dcWarning); //感知事件某路段类型季占比 List> selectWarningSectionTypeQuarter(DcWarning dcWarning); - List> selectWarningSectionTypeQuarterCount(DcWarning dcWarning); + String selectWarningSectionTypeQuarterCount(DcWarning dcWarning); //感知事件某路段类型年占比 List> selectWarningSectionTypeYear(DcWarning dcWarning); String selectWarningSectionTypeYearCount(DcWarning dcWarning); @@ -73,4 +73,8 @@ public interface DcPerceivedEventsWarningMapper { String selectWarningMarkMonth(DcWarning dcWarning); List> selectWarningMarkQuarter(DcWarning dcWarning); String selectWarningMarkYear(DcWarning dcWarning); + + List> selectWarningMarkDayOptimize(DcWarning dcWarning); + List> selectWarningMarkQuarterOptimize(DcWarning dcWarning); + } diff --git a/zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java b/zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java index 87f47928..03ab7364 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java @@ -41,9 +41,10 @@ public interface IDCPerceivedEventsWarningService { //感知事件某路段类型占比 List> selectWarningSectionType(DcWarning dcWarning); String selectWarningSectionTypeCount(DcWarning dcWarning); - List> selectWarningSectionTypeCountQuarter(DcWarning dcWarning); + String selectWarningSectionTypeCountQuarter(DcWarning dcWarning); //查询某个路段下的全部桩号 List> selectSectionMark(DcWarning dcWarning); + List> selectSectionMarkOptimize(DcWarning dcWarning); //预警事件,事件列表 查询状态为上报的感知事件 List> selectWarningEscalation(DcWarning dcWarning); //修改感知事件信息 diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java index 15bdbb98..3953cd0f 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java @@ -8,6 +8,7 @@ import com.zc.business.service.IDCPerceivedEventsWarningService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.sound.midi.Soundbank; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; @@ -159,7 +160,7 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa } @Override - public List> selectWarningSectionTypeCountQuarter(DcWarning dcWarning) { + public String selectWarningSectionTypeCountQuarter(DcWarning dcWarning) { if (dcWarning.getType().equals("quarter")==false){ return null; } @@ -209,6 +210,16 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa } + @Override + public List> selectSectionMarkOptimize(DcWarning dcWarning) { + if (dcWarning.getType().equals("quarter")){ + return perceivedEventsWarningMapper.selectWarningMarkQuarterOptimize(dcWarning); + }else { + return perceivedEventsWarningMapper.selectWarningMarkDayOptimize(dcWarning); + } + } + + //预警事件,事件列表 查询状态为上报的感知事件 @Override public List> selectWarningEscalation(DcWarning dcWarning) { diff --git a/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml index b0863075..463eae16 100644 --- a/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml @@ -39,19 +39,25 @@ - SELECT - CASE - WHEN MONTH(warning.create_time) BETWEEN 1 AND 3 THEN '第一季度' - WHEN MONTH(warning.create_time) BETWEEN 4 AND 6 THEN '第二季度' - WHEN MONTH(warning.create_time) BETWEEN 7 AND 9 THEN '第三季度' - ELSE '第四季度' - END AS QUARTER,COUNT(*) AS number + COUNT(*) AS number FROM dc_warning as warning LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y') AND warning.direction=#{direction} and mark.`section_id`=#{sectionId} - GROUP BY QUARTER @@ -286,5 +286,30 @@ select count(1) from dc_warning + + + \ No newline at end of file