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) {