diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventController.java index 3b6d1218..14b32b58 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventController.java @@ -227,4 +227,18 @@ public class DcEventController extends BaseController public AjaxResult getLinkEvent(@ApiParam(name = "eventId", value = "事件id", required = true) @PathVariable("eventId") String eventId){ return dcEventService.getLinkEvent(eventId); } + + /** + * @Description 获取事件数量 + * + * @author liuwenge + * @date 2024/6/6 18:45 + * @param type + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @ApiOperation("获取事件数量") + @GetMapping( "/getCountNum/{type}") + public AjaxResult getCountNum(@ApiParam(name = "type", value = "类型 1:告警 2:待确认 3:处置中", required = true) @PathVariable("type") String type){ + return dcEventService.getCountNum(type); + } } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcMetricsController.java b/zc-business/src/main/java/com/zc/business/controller/DcMetricsController.java index 9185c987..bbc75610 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcMetricsController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcMetricsController.java @@ -148,7 +148,7 @@ public class DcMetricsController { // 如果昨天或前天的数据为空,则返回错误信息 if (yesterdayData == null || beforeYesterdayData == null) { - return AjaxResult.error("暂无数据"); + return AjaxResult.success(null); } // 将数据放入列表并返回 diff --git a/zc-business/src/main/java/com/zc/business/controller/WordController.java b/zc-business/src/main/java/com/zc/business/controller/WordController.java index 76929ef0..5a24c460 100644 --- a/zc-business/src/main/java/com/zc/business/controller/WordController.java +++ b/zc-business/src/main/java/com/zc/business/controller/WordController.java @@ -2,8 +2,11 @@ package com.zc.business.controller; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.domain.AjaxResult; +import com.zc.business.domain.DcTollStationStatisticsData; import com.zc.business.domain.DcTrafficSectionData; +import com.zc.business.enums.TrafficDataPeriodTypeEnum; import com.zc.business.mapper.DcTrafficIncidentsMapper; +import com.zc.business.service.IDcTollStationStatisticsDataService; import com.zc.business.utils.PoiUtil; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -45,6 +48,9 @@ public class WordController { @Autowired private DcTrafficIncidentsMapper dcTrafficIncidentsMapper; + @Autowired + private IDcTollStationStatisticsDataService dcTollStationStatisticsDataService; + @PostMapping("/trafficSituationReport") @ApiOperation("导出通行情况快报") @@ -506,15 +512,60 @@ public class WordController { List> trafficFlowList = new ArrayList<>(); - Map trafficFlow = new HashMap<>(); - trafficFlow.put("label","入口"); - trafficFlow.put("num","0"); - trafficFlowList.add(trafficFlow); - - trafficFlow = new HashMap<>(); - trafficFlow.put("label","出口"); - trafficFlow.put("num","0"); - trafficFlowList.add(trafficFlow); + + DcTollStationStatisticsData dcTollStationStatisticsData = new DcTollStationStatisticsData(); + dcTollStationStatisticsData.setPeriodType(TrafficDataPeriodTypeEnum.DAY); + + Calendar startCalendar = Calendar.getInstance(); + startCalendar.set(Calendar.HOUR_OF_DAY, 0); + startCalendar.set(Calendar.MINUTE, 0); + startCalendar.set(Calendar.SECOND, 0); + startCalendar.set(Calendar.MILLISECOND, 0); + Date startTime = startCalendar.getTime(); + dcTollStationStatisticsData.setStartTime(startTime); + + Calendar endCalendar = Calendar.getInstance(); + endCalendar.set(Calendar.HOUR_OF_DAY, 23); + endCalendar.set(Calendar.MINUTE, 59); + endCalendar.set(Calendar.SECOND, 59); + endCalendar.set(Calendar.MILLISECOND, 999); + Date emdTime = endCalendar.getTime(); + dcTollStationStatisticsData.setEndTime(emdTime); + + List statisticsDataList = dcTollStationStatisticsDataService.tollStationData(dcTollStationStatisticsData); + if (statisticsDataList != null && statisticsDataList.size() > 0){ + + Integer entrance = 0; //入口 + Integer export = 0; //出口 + for (DcTollStationStatisticsData tollStationStatisticsData : statisticsDataList) { + if (tollStationStatisticsData.getAccessType() == 1){ + entrance = entrance + tollStationStatisticsData.getTrafficVolume(); + } else if (tollStationStatisticsData.getAccessType() == 2){ + export = export + tollStationStatisticsData.getTrafficVolume(); + } + } + + Map trafficFlow = new HashMap<>(); + trafficFlow.put("label", "入口"); + trafficFlow.put("num", entrance); + trafficFlowList.add(trafficFlow); + + trafficFlow = new HashMap<>(); + trafficFlow.put("label", "出口"); + trafficFlow.put("num", export); + trafficFlowList.add(trafficFlow); + + } else { + Map trafficFlow = new HashMap<>(); + trafficFlow.put("label", "入口"); + trafficFlow.put("num", "0"); + trafficFlowList.add(trafficFlow); + + trafficFlow = new HashMap<>(); + trafficFlow.put("label", "出口"); + trafficFlow.put("num", "0"); + trafficFlowList.add(trafficFlow); + } if (trafficFlowList != null && trafficFlowList.size() > 0) { diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java index 63ed43a8..324da21a 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcEventMapper.java @@ -121,6 +121,8 @@ public interface DcEventMapper extends BaseMapper int selectClearInfo(String eventId); List dispatchRecordEventList(DcEvent dcEvent); + + Long selectEventNumByStatus(@Param("status") String status); } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java index fa39632b..ac585d4e 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcWarningMapper.java @@ -150,4 +150,6 @@ public interface DcWarningMapper public String organizationName(Long id); //事件id查询调度记录id public HashMap selectDispatchId(@Param("eventId")String eventId); + + Long selectWarningNum(); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcEventService.java b/zc-business/src/main/java/com/zc/business/service/IDcEventService.java index 8d5d5933..6e2943eb 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcEventService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcEventService.java @@ -139,4 +139,14 @@ public interface IDcEventService AjaxResult getLinkEvent(String eventId); List dispatchRecordEventList(DcEvent dcEvent); + + /** + * @Description 获取事件数量 + * + * @author liuwenge + * @date 2024/6/6 18:45 + * @param type 类型 1:告警 2:待确认 3:处置中 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + AjaxResult getCountNum(String type); } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index 2dada580..b50c21a4 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -1924,4 +1924,33 @@ public class DcEventServiceImpl extends ServiceImpl impl } + /** + * @Description 获取事件数量 + * + * @author liuwenge + * @date 2024/6/6 18:45 + * @param type 类型 1:告警 2:待确认 3:处置中 + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @Override + public AjaxResult getCountNum(String type){ + if (StringUtils.isEmpty(type)){ + return AjaxResult.error("类型不能为空"); + } + + Long num = 0L; + //告警 + if (type.equals("1")){ + num = dcWarningMapper.selectWarningNum(); + } else if (type.equals("2")){ + num = dcEventMapper.selectEventNumByStatus("0"); + } else if (type.equals("3")){ + num = dcEventMapper.selectEventNumByStatus("1"); + } + + return AjaxResult.success(num); + } + + + } diff --git a/zc-business/src/main/resources/mapper/business/DcEmergencyPlansMapper.xml b/zc-business/src/main/resources/mapper/business/DcEmergencyPlansMapper.xml index bb15469d..d18eb453 100644 --- a/zc-business/src/main/resources/mapper/business/DcEmergencyPlansMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEmergencyPlansMapper.xml @@ -116,6 +116,9 @@ and plan_name like concat('%', #{planName}, '%') and event_type = #{eventType} + + and trigger_mechanism =#{triggerMechanism} + order by t1.id desc diff --git a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml index 38faaef3..f88c5b12 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventMapper.xml @@ -850,4 +850,7 @@ + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml index 4bfb8a26..7992b584 100644 --- a/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcWarningMapper.xml @@ -433,5 +433,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" +