diff --git a/zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java b/zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java index 0c031fd1..92a12557 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcInfoBoardVocabularyController.java @@ -19,6 +19,8 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.InputStream; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; import java.util.List; /** @@ -66,10 +68,14 @@ public class DcInfoBoardVocabularyController extends BaseController @ApiOperation("导出敏感词模板") @Log(title = "导出敏感词模板", businessType = BusinessType.EXPORT) @PostMapping("/exportModel") - public void exportModel(HttpServletResponse response) + public void exportModel(HttpServletResponse response) throws Exception { response.setContentType(UniversalEnum.DERIVE_THE_TWO_WAY_REAL_TIME_TRAFFIC_FLOW_OF_THE_WHOLE_SECTION.getValue()); response.setCharacterEncoding(UniversalEnum.LOWERCASE_UTF_8.getValue()); + String fileName = URLEncoder.encode("敏感字模板.xlsx", StandardCharsets.UTF_8.toString()).replaceAll("\\+", "%20"); + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition,download-filename"); + response.setHeader("Content-disposition", "attachment; filename="+fileName+";filename*=utf-8''"+fileName); + response.setHeader("download-filename", fileName); InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(UniversalEnum.EXPORT_SENSITIVE_WORD_TEMPLATES.getValue()); try { XSSFWorkbook workbook = new XSSFWorkbook(inputStream); diff --git a/zc-business/src/main/java/com/zc/business/controller/DcRoadConditionInformationController.java b/zc-business/src/main/java/com/zc/business/controller/DcRoadConditionInformationController.java index 66713b66..ed1df8a1 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcRoadConditionInformationController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcRoadConditionInformationController.java @@ -5,7 +5,6 @@ import javax.servlet.http.HttpServletResponse; import com.zc.business.domain.DcRoadConditionInformation; import com.zc.business.service.IDcRoadConditionInformationService; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -23,7 +22,7 @@ import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; -/** +/**DcTimingOfTrafficConditionsController * 路况信息Controller * * @author ruoyi @@ -47,6 +46,12 @@ public class DcRoadConditionInformationController extends BaseController List list = dcRoadConditionInformationService.selectDcRoadConditionInformationList(dcRoadConditionInformation); return getDataTable(list); } + @GetMapping("/listTime") + public TableDataInfo listTime() + { + List list = dcRoadConditionInformationService.selectlistTime(); + return getDataTable(list); + } /** * 导出路况信息列表 @@ -56,6 +61,10 @@ public class DcRoadConditionInformationController extends BaseController @PostMapping("/export") public void export(HttpServletResponse response, DcRoadConditionInformation dcRoadConditionInformation) { + + + + List list = dcRoadConditionInformationService.selectDcRoadConditionInformationList(dcRoadConditionInformation); ExcelUtil util = new ExcelUtil<>(DcRoadConditionInformation.class); util.exportExcel(response, list, "路况信息数据"); diff --git a/zc-business/src/main/java/com/zc/business/controller/DcTimingOfTrafficConditionsController.java b/zc-business/src/main/java/com/zc/business/controller/DcTimingOfTrafficConditionsController.java new file mode 100644 index 00000000..29c88a5a --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcTimingOfTrafficConditionsController.java @@ -0,0 +1,36 @@ +package com.zc.business.controller; + +import com.alibaba.fastjson.JSONArray; +import com.ruoyi.common.core.domain.AjaxResult; +import com.zc.business.domain.DcRoadConditionInformation; +import com.zc.business.service.IDcRoadConditionInformationService; +import com.zc.business.service.IDcTrafficStatisticsService; +import com.zc.common.core.httpclient.exception.HttpException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import java.io.IOException; + +/** + *路况信息 每小时入一次库 + */ +@Component +public class DcTimingOfTrafficConditionsController { + @Autowired + private IDcTrafficStatisticsService dcTrafficStatisticsService; + @Autowired + private IDcRoadConditionInformationService dcRoadConditionInformationService; + + // 调用服务层方法,获取当前交通指标数据 + @Scheduled(cron = "0 0 * * * *") + public void getTheCurrentCongestedSection() throws HttpException, IOException { + // 调用服务层方法,获取当前交通指标数据 + JSONArray jsonArray = dcTrafficStatisticsService.getTheCurrentCongestedSection(); + //插入 数据库 + DcRoadConditionInformation dcRoadConditionInformation =new DcRoadConditionInformation(); + dcRoadConditionInformation.setOtherConfig(jsonArray.toJSONString()); + dcRoadConditionInformationService.insertDcRoadConditionInformation(dcRoadConditionInformation); + // 将获取到的交通指标数据封装为成功的结果并返回 + } +} 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 300436e5..bd05e259 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 @@ -1,7 +1,10 @@ package com.zc.business.controller; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.zc.business.domain.DcEventListQuery; +import com.zc.business.domain.export.*; +import com.zc.business.enums.UniversalEnum; import com.zc.business.service.IDcTrafficIncidentsService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -10,8 +13,12 @@ import org.apache.ibatis.annotations.Param; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; import java.util.Date; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** * @Description 交通事件统计 @@ -111,6 +118,31 @@ public class DcTrafficIncidentsController { return trafficIncidentsService.getAllEventNum(); } + @ApiOperation(value = "导出事件类型分析",tags = {"ECharts导出"}) + @GetMapping("/exportGetAllEventNum") + public void exportGetAllEventNum(HttpServletResponse response){ + + AjaxResult ajaxResult = trafficIncidentsService.getAllEventNum(); + List list = new ArrayList<>(); + if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { + List> data = (List>) ajaxResult.get("data"); + Long total = data.stream().mapToLong(item -> (long) item.get("num")).sum(); + for (Map datum : data) { + AllEventNum allEventNum = new AllEventNum(); + allEventNum.setEventName(datum.get("eventName").toString()); + allEventNum.setNum(datum.get("num").toString()); + //计算百分比 + double ratio = (double) Long.parseLong(datum.get("num").toString()) / total * 100; + ratio = Math.round(ratio * 100.0) / 100.0; + allEventNum.setRatio(ratio + "%"); + list.add(allEventNum); + } + } + + ExcelUtil util = new ExcelUtil<>(AllEventNum.class); + util.exportExcel(response, list, "事件类型分析"); + } + /** * @Description 路网管控-事件管控分析-事件源分析占比 * @@ -139,6 +171,27 @@ public class DcTrafficIncidentsController { return trafficIncidentsService.getEventTrend(); } + @ApiOperation(value="导出今日事件趋势",tags = {"ECharts导出"}) + @GetMapping("/exportGetEventTrend") + public void exportGetEventTrend(HttpServletResponse response){ + AjaxResult ajaxResult = trafficIncidentsService.getEventTrend(); + List list = new ArrayList<>(); + if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { + Map data = (Map) ajaxResult.get("data"); + List> perception = (List>)data.get("perception"); + List> traffic = (List>)data.get("traffic"); + for (int i = 0; i < perception.size(); i++) { + EventTrend eventTrend = new EventTrend(); + eventTrend.setHours(perception.get(i).get("hours").toString() + "时"); + eventTrend.setPerception(perception.get(i).get("num").toString()); + eventTrend.setTraffic(traffic.get(i).get("num").toString()); + list.add(eventTrend); + } + } + + ExcelUtil util = new ExcelUtil<>(EventTrend.class); + util.exportExcel(response, list, "今日事件趋势"); + } /** * @Description 路网管控-事件管控分析-事故车型分析 * @@ -157,6 +210,28 @@ public class DcTrafficIncidentsController { @ApiParam(value="时间", name="startTime", required=true) @RequestParam ("startTime") String startTime){ return trafficIncidentsService.getAccidentVehicleAnalysis(direction,type,startTime); } + @ApiOperation(value="导出事故车型分析",tags = {"ECharts导出"}) + @GetMapping("/exportSelectAccidentVehicleAnalysis") + public void exportSelectAccidentVehicleAnalysis(HttpServletResponse response, + @ApiParam(value="方向", name="direction", required=true) @RequestParam ("direction") String direction, + @ApiParam(value="类型(1:日, 2:月, 3:季度, 4-年)", name="type", required=true) @RequestParam ("type") String type, + @ApiParam(value="时间", name="startTime", required=true) @RequestParam ("startTime") String startTime){ + AjaxResult ajaxResult = trafficIncidentsService.getAccidentVehicleAnalysis(direction,type,startTime); + List list = new ArrayList<>(); + if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { + List> data = (List>) ajaxResult.get("data"); + for (Map datum : data) { + AccidentVehicleAnalysis accidentVehicleAnalysis = new AccidentVehicleAnalysis(); + accidentVehicleAnalysis.setTypeName(datum.get("typeName").toString()); + accidentVehicleAnalysis.setNum(datum.get("num").toString()); + accidentVehicleAnalysis.setAvgTime(datum.get("avgTime").toString()); + list.add(accidentVehicleAnalysis); + } + } + + ExcelUtil util = new ExcelUtil<>(AccidentVehicleAnalysis.class); + util.exportExcel(response, list, "事故车型分析"); + } /** * @Description 路网管控-事件管控分析-收费站统计分析table @@ -194,6 +269,25 @@ public class DcTrafficIncidentsController { return trafficIncidentsService.getTollStationAnalysis(); } + @ApiOperation(value="导出收费站管制分析",tags = {"ECharts导出"}) + @GetMapping("/exportGetTollStationAnalysis") + public void exportGetTollStationAnalysis(HttpServletResponse response){ + AjaxResult ajaxResult = trafficIncidentsService.getTollStationAnalysis(); + List list = new ArrayList<>(); + if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { + List> data = (List>) ajaxResult.get("data"); + for (Map datum : data) { + TollStationAnalysis tollStationAnalysis = new TollStationAnalysis(); + tollStationAnalysis.setFacilityName(datum.get("facilityName").toString()); + tollStationAnalysis.setTrafficClose(datum.get("trafficClose").toString()); + tollStationAnalysis.setTrafficRestriction(datum.get("trafficRestriction").toString()); + list.add(tollStationAnalysis); + } + } + ExcelUtil util = new ExcelUtil<>(TollStationAnalysis.class); + util.exportExcel(response, list, "收费站管制分析"); + } + /** * @Description 路网管控-事件管控分析-事故多发路段分析 * @@ -212,6 +306,31 @@ public class DcTrafficIncidentsController { return trafficIncidentsService.selectRoadSectionAnalysis(direction,type,startTime); } + @ApiOperation(value="导出事故多发路段分析",tags = {"ECharts导出"}) + @GetMapping("/exportSelectRoadSectionAnalysis") + public void exportSelectRoadSectionAnalysis(HttpServletResponse response, + @ApiParam(value="方向", name="direction", required=true) @RequestParam ("direction") String direction, + @ApiParam(value="类型(1:日, 2:月, 3:季度, 4-年)", name="type", required=true) @RequestParam ("type") String type, + @ApiParam(value="时间", name="startTime", required=true) @RequestParam ("startTime") String startTime){ + AjaxResult ajaxResult = trafficIncidentsService.selectRoadSectionAnalysis(direction,type,startTime); + List list = new ArrayList<>(); + if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { + List> data = (List>) ajaxResult.get("data"); + for (Map datum : data) { + RoadSectionAnalysis roadSectionAnalysis = new RoadSectionAnalysis(); + roadSectionAnalysis.setSection_name(datum.get("section_name").toString()); + roadSectionAnalysis.setNum(datum.get("num").toString()); + roadSectionAnalysis.setAvgNum(datum.get("avgNum").toString()); + roadSectionAnalysis.setLastNum(datum.get("lastNum").toString()); + roadSectionAnalysis.setMileage(datum.get("mileage").toString()); + list.add(roadSectionAnalysis); + } + } + + ExcelUtil util = new ExcelUtil<>(RoadSectionAnalysis.class); + util.exportExcel(response, list, "事故多发路段分析"); + } + /** * @Description 路网管控-事件管控分析-事故类型分析 * @@ -229,4 +348,29 @@ public class DcTrafficIncidentsController { @ApiParam(value="时间", name="startTime", required=true) @RequestParam ("startTime") String startTime){ return trafficIncidentsService.selectEventTypeAnalysis(direction,type,startTime); } + + @ApiOperation(value="导出事故类型分析",tags = {"ECharts导出"}) + @GetMapping("/exportSelectEventTypeAnalysis") + public void exportSelectEventTypeAnalysis(HttpServletResponse response, + @ApiParam(value="方向", name="direction", required=true) @RequestParam ("direction") String direction, + @ApiParam(value="类型(1:日, 2:月, 3:季度, 4-年)", name="type", required=true) @RequestParam ("type") String type, + @ApiParam(value="时间", name="startTime", required=true) @RequestParam ("startTime") String startTime){ + AjaxResult ajaxResult = trafficIncidentsService.selectEventTypeAnalysis(direction,type,startTime); + List list = new ArrayList<>(); + if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { + List> data = (List>) ajaxResult.get("data"); + for (Map datum : data) { + EventTypeAnalysis eventTypeAnalysis = new EventTypeAnalysis(); + eventTypeAnalysis.setEventSubclassName(datum.get("eventSubclassName").toString()); + eventTypeAnalysis.setNum(datum.get("num").toString()); + eventTypeAnalysis.setLastNum(datum.get("lastNum").toString()); + eventTypeAnalysis.setAvgTime(datum.get("avgTime").toString()); + eventTypeAnalysis.setLastAvgTime(datum.get("lastAvgTime").toString()); + list.add(eventTypeAnalysis); + } + } + + ExcelUtil util = new ExcelUtil<>(EventTypeAnalysis.class); + util.exportExcel(response, list, "事故类型分析"); + } } diff --git a/zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java b/zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java index 59ea6b56..8986f5bb 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcTrafficStatisticsController.java @@ -46,7 +46,7 @@ import java.util.stream.Collectors; * * @author xiepufeng */ -@Component + @Api(tags = "交通数据统计") @RestController @RequestMapping("/business/traffic-statistics") @@ -745,8 +745,7 @@ public AjaxResult realTimeTrafficFlow(String startDate, String direction,String // 将获取到的交通指标数据封装为成功的结果并返回 return AjaxResult.success(jsonArray); } - @Scheduled(cron = "0 */1 * * * ?") - // @Scheduled(cron = "0/30 * * * * ?") + @ApiOperation("获取当前拥堵路段") @GetMapping("/current/getTheCurrentCongestedSection") public AjaxResult getTheCurrentCongestedSection() throws HttpException, IOException { diff --git a/zc-business/src/main/java/com/zc/business/domain/export/AccidentVehicleAnalysis.java b/zc-business/src/main/java/com/zc/business/domain/export/AccidentVehicleAnalysis.java new file mode 100644 index 00000000..9fca0011 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/AccidentVehicleAnalysis.java @@ -0,0 +1,63 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 导出事故车型分析对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class AccidentVehicleAnalysis extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 事故类型 */ + @Excel(name = "车型") + private String typeName; + + /** 事件数量 */ + @Excel(name = "事件数量") + private String num; + /** 平均处置时长 */ + @Excel(name = "平均处置时长") + private String avgTime; + + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public String getNum() { + return num; + } + + public void setNum(String num) { + this.num = num; + } + + public String getAvgTime() { + return avgTime; + } + + public void setAvgTime(String avgTime) { + this.avgTime = avgTime; + } + + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("typeName", getTypeName()) + .append("num", getNum()) + .append("avgTime", getAvgTime()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/AllEventNum.java b/zc-business/src/main/java/com/zc/business/domain/export/AllEventNum.java new file mode 100644 index 00000000..6aa9daf7 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/AllEventNum.java @@ -0,0 +1,61 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 导出事件类型分析对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class AllEventNum extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 类型 */ + @Excel(name = "类型") + private String eventName; + + /** 数量 */ + @Excel(name = "数量") + private String num; + /** 占比 */ + @Excel(name = "占比") + private String ratio; + + public String getEventName() { + return eventName; + } + + public void setEventName(String eventName) { + this.eventName = eventName; + } + + public String getNum() { + return num; + } + + public void setNum(String num) { + this.num = num; + } + + public String getRatio() { + return ratio; + } + + public void setRatio(String ratio) { + this.ratio = ratio; + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("eventName", eventName) + .append("num", num) + .append("ratio", ratio) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/EventTrend.java b/zc-business/src/main/java/com/zc/business/domain/export/EventTrend.java new file mode 100644 index 00000000..f4758dc7 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/EventTrend.java @@ -0,0 +1,62 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 导出今日事件趋势对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class EventTrend extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 时间 */ + @Excel(name = "时间") + private String hours; + + /** 感知事件 */ + @Excel(name = "感知事件") + private String perception; + /** 交通事件 */ + @Excel(name = "交通事件") + private String traffic; + + public String getHours() { + return hours; + } + + public void setHours(String hours) { + this.hours = hours; + } + + public String getPerception() { + return perception; + } + + public void setPerception(String perception) { + this.perception = perception; + } + + public String getTraffic() { + return traffic; + } + + public void setTraffic(String traffic) { + this.traffic = traffic; + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("hours", hours) + .append("perception", perception) + .append("traffic", traffic) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/EventTypeAnalysis.java b/zc-business/src/main/java/com/zc/business/domain/export/EventTypeAnalysis.java new file mode 100644 index 00000000..b1ad51a0 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/EventTypeAnalysis.java @@ -0,0 +1,87 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 导出事故类型分析对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class EventTypeAnalysis extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 事故类型 */ + @Excel(name = "事故类型") + private String eventSubclassName; + + /** 事件数量 */ + @Excel(name = "事件数量") + private String num; + /** 去年同期总量 */ + @Excel(name = "去年同期总量") + private String lastNum; + /** 平均处置时长 */ + @Excel(name = "平均处置时长") + private String avgTime; + /** 去年同期平均处置时长 */ + @Excel(name = "去年同期平均处置时长") + private String lastAvgTime; + + + public String getEventSubclassName() { + return eventSubclassName; + } + + public void setEventSubclassName(String eventSubclassName) { + this.eventSubclassName = eventSubclassName; + } + + public String getNum() { + return num; + } + + public void setNum(String num) { + this.num = num; + } + + public String getLastNum() { + return lastNum; + } + + public void setLastNum(String lastNum) { + this.lastNum = lastNum; + } + + public String getAvgTime() { + return avgTime; + } + + public void setAvgTime(String avgTime) { + this.avgTime = avgTime; + } + + public String getLastAvgTime() { + return lastAvgTime; + } + + public void setLastAvgTime(String lastAvgTime) { + this.lastAvgTime = lastAvgTime; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("eventSubclassName", getEventSubclassName()) + .append("num", getNum()) + .append("avgTime", getAvgTime()) + .append("lastNum", getLastNum()) + .append("lastAvgTime", getLastAvgTime()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/RoadSectionAnalysis.java b/zc-business/src/main/java/com/zc/business/domain/export/RoadSectionAnalysis.java new file mode 100644 index 00000000..8f28ec0c --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/RoadSectionAnalysis.java @@ -0,0 +1,86 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +/** + * 导出事故多发路段分析对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class RoadSectionAnalysis extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 路段 */ + @Excel(name = "路段") + private String section_name; + + /** 事故总量 */ + @Excel(name = "事故总量") + private String num; + /** 百公里事故总量 */ + @Excel(name = "百公里事故总量") + private String avgNum; + /** 去年事故总量 */ + @Excel(name = "去年事故总量") + private String lastNum; + /** 路段里程数 */ + @Excel(name = "路段里程数") + private String mileage; + + public String getSection_name() { + return section_name; + } + + public void setSection_name(String section_name) { + this.section_name = section_name; + } + + public String getNum() { + return num; + } + + public void setNum(String num) { + this.num = num; + } + + public String getAvgNum() { + return avgNum; + } + + public void setAvgNum(String avgNum) { + this.avgNum = avgNum; + } + + public String getLastNum() { + return lastNum; + } + + public void setLastNum(String lastNum) { + this.lastNum = lastNum; + } + + public String getMileage() { + return mileage; + } + + public void setMileage(String mileage) { + this.mileage = mileage; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("section_name", getSection_name()) + .append("num", getNum()) + .append("avgNum", getAvgNum()) + .append("lastNum", getLastNum()) + .append("mileage", getMileage()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/export/TollStationAnalysis.java b/zc-business/src/main/java/com/zc/business/domain/export/TollStationAnalysis.java new file mode 100644 index 00000000..29e388da --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/export/TollStationAnalysis.java @@ -0,0 +1,61 @@ +package com.zc.business.domain.export; + +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; + +/** + * 导出收费站管制分析对象 + * + * @author ruoyi + * @date 2024-01-13 + */ +public class TollStationAnalysis extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + + /** 时间 */ + @Excel(name = "收费站") + private String facilityName; + + /** 封闭 */ + @Excel(name = "封闭") + private String trafficClose; + /** 限行 */ + @Excel(name = "限行") + private String trafficRestriction; + + public String getFacilityName() { + return facilityName; + } + + public void setFacilityName(String facilityName) { + this.facilityName = facilityName; + } + + public String getTrafficClose() { + return trafficClose; + } + + public void setTrafficClose(String trafficClose) { + this.trafficClose = trafficClose; + } + + public String getTrafficRestriction() { + return trafficRestriction; + } + + public void setTrafficRestriction(String trafficRestriction) { + this.trafficRestriction = trafficRestriction; + } + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("facilityName", facilityName) + .append("trafficClose", trafficClose) + .append("trafficRestriction", trafficRestriction) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/enums/UniversalEnum.java b/zc-business/src/main/java/com/zc/business/enums/UniversalEnum.java index c45fd380..53165bfd 100644 --- a/zc-business/src/main/java/com/zc/business/enums/UniversalEnum.java +++ b/zc-business/src/main/java/com/zc/business/enums/UniversalEnum.java @@ -1917,6 +1917,7 @@ public enum UniversalEnum { //dcEventAccident.location DC_EVENT_ACCIDENT_LOCATION(0, "dcEventAccident.location"), + DC_EVENT_ACCIDENT_RAMP_ID(0, "dcEventAccident.rampId"), // warningStrategy WARNING_STRATEGY(0, "warningStrategy"), diff --git a/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java b/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java index e146a163..78fcb19c 100644 --- a/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java +++ b/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java @@ -231,7 +231,7 @@ public class ValueConverter { eventLabel.put("dcEventAccident.fatalities","死亡(人)"); eventLabel.put("dcEventAccident.isPrivate","私密事件"); eventLabel.put("dcEventAccident.facilityId","设施"); -// eventLabel.put("dcEventAccident.rampId","匝道id"); + eventLabel.put("dcEventAccident.rampId","匝道id"); eventLabel.put("dcEventAccident.location","地点"); eventLabel.put("dcEventConstruction.controlMode","管制方式"); eventLabel.put("dcEventConstruction.locationType","地点类型"); diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcRoadConditionInformationMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcRoadConditionInformationMapper.java index 190850be..29beb5fe 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcRoadConditionInformationMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcRoadConditionInformationMapper.java @@ -59,4 +59,7 @@ public interface DcRoadConditionInformationMapper * @return 结果 */ int deleteDcRoadConditionInformationByIds(Long[] ids); + + List selectlistTime(); + } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcRoadConditionInformationService.java b/zc-business/src/main/java/com/zc/business/service/IDcRoadConditionInformationService.java index 7deb570e..7fccc8a8 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcRoadConditionInformationService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcRoadConditionInformationService.java @@ -59,4 +59,7 @@ public interface IDcRoadConditionInformationService * @return 结果 */ int deleteDcRoadConditionInformationById(Long id); + + List selectlistTime(); + } 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 f2cf9e4c..abed104e 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 @@ -1774,7 +1774,8 @@ public class DcEventServiceImpl extends ServiceImpl impl if (dcFacility != null){ result.setRight(dcFacility.getFacilityName()); } - } else if (UniversalEnum.DC_EVENT_ACCIDENT_LOCATION.getValue().equals(result.getRightPath())){ + } else if (UniversalEnum.DC_EVENT_ACCIDENT_LOCATION.getValue().equals(result.getRightPath()) + || UniversalEnum.DC_EVENT_ACCIDENT_RAMP_ID.getValue().equals(result.getRightPath())){ DcEventAccident dcEventAccident = newEvent.getDcEventAccident(); if (dcEventAccident.getLocationType() == UniversalEnum.THREE.getNumber()){ diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcRoadConditionInformationServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcRoadConditionInformationServiceImpl.java index e0e45b06..4d7f9ffd 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcRoadConditionInformationServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcRoadConditionInformationServiceImpl.java @@ -94,4 +94,9 @@ public class DcRoadConditionInformationServiceImpl implements IDcRoadConditionIn { return dcRoadConditionInformationMapper.deleteDcRoadConditionInformationById(id); } + + @Override + public List selectlistTime() { + return dcRoadConditionInformationMapper.selectlistTime(); + } } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java index e3eab352..0c9631fd 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficStatisticsServiceImpl.java @@ -57,8 +57,6 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi @Resource private IDcFacilityService facilityService; - @Autowired - private IDcRoadConditionInformationService dcRoadConditionInformationService; @Resource private IDcRoadSectionService roadSectionService; @@ -965,11 +963,9 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi // System.out.printf("最大距离为: %.2f 米%n", distanceM); jsonObject.put("max_jam_dist", distanceM);//最大拥堵距离 double endMake = startPileNo +Double.parseDouble(String.format("%.3f", distanceM)); - String endmark = formatNumber(endMake); jsonObject.put("endMark", endmark);//结束桩号 - String[] split = string1.split(","); double firstLon = Double.parseDouble(split[UniversalEnum.ZERO.getNumber()]); double firstLat = Double.parseDouble(split[UniversalEnum.ONE.getNumber()]); @@ -984,14 +980,9 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi double distanceMeters = distanceKm * UniversalEnum.THOUSAND.getNumber(); // 将距离转换为米 //System.out.printf("两点之间的距离为: %.2f 米%n", distanceMeters); jsonObject.put("jam_dist", distanceMeters);//当前拥堵距离 - } - } - //插入 数据库 road_condition_information - DcRoadConditionInformation dcRoadConditionInformation =new DcRoadConditionInformation(); - dcRoadConditionInformation.setOtherConfig(jsonArray.toJSONString()); - dcRoadConditionInformationService.insertDcRoadConditionInformation(dcRoadConditionInformation); + return jsonArray; } diff --git a/zc-business/src/main/resources/mapper/business/DcRoadConditionInformationMapper.xml b/zc-business/src/main/resources/mapper/business/DcRoadConditionInformationMapper.xml index df07b2a4..2059e010 100644 --- a/zc-business/src/main/resources/mapper/business/DcRoadConditionInformationMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcRoadConditionInformationMapper.xml @@ -23,6 +23,12 @@ ORDER BY create_time DESC +