From 8994fe62b498572f26c8cc84149a702a7e3a261d Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Mon, 3 Jun 2024 15:00:10 +0800 Subject: [PATCH 01/15] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E6=BA=90=E5=88=86?= =?UTF-8?q?=E6=9E=90=E5=A2=9E=E5=8A=A0=E4=BA=8B=E4=BB=B6=E6=BA=90=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/business/DcTrafficIncidentsMapper.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml index f4695f04..eaa01cd6 100644 --- a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml @@ -89,7 +89,13 @@ UNION ALL select '4' as eventSource,'视频巡查' as eventSourceName UNION ALL select '5' as eventSource,'视频AI' as eventSourceName UNION ALL select '6' as eventSource,'一键救援' as eventSourceName - UNION ALL select '7' as eventSource,'其他' as eventSourceName) t1 + UNION ALL select '7' as eventSource,'其他' as eventSourceName + UNION ALL select '8' as eventSource,'雷达识别' as eventSourceName + UNION ALL select '9' as eventSource,'锥桶' as eventSourceName + UNION ALL select '10' as eventSource,'护栏碰撞' as eventSourceName + UNION ALL select '11' as eventSource,'扫码报警' as eventSourceName + UNION ALL select '12' as eventSource,'非机预警' as eventSourceName + UNION ALL select '13' as eventSource,'气象检测器' as eventSourceName) t1 LEFT JOIN (select event_source eventSource,count(*) num from dc_event From 1e6d6ced36765f7c7610202d668540f2a1da364e Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Mon, 3 Jun 2024 16:21:04 +0800 Subject: [PATCH 02/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=BD=E5=B7=A5?= =?UTF-8?q?=E5=BB=BA=E8=AE=BE=E4=BA=8B=E4=BB=B6=E5=80=BC=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/service/impl/DcEventServiceImpl.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) 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 464dcb6b..0a3b5b33 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 @@ -1552,9 +1552,17 @@ public class DcEventServiceImpl extends ServiceImpl impl } } else if ("dcEventConstruction.trafficCondition".equals(result.getRightPath())) { if ("1".equals(result.getRight())) { - result.setRight("通行正常"); + result.setRight("通行受限"); } else if ("2".equals(result.getRight())) { - result.setRight("通行受阻"); + result.setRight("车辆谨慎慢行"); + } else if ("3".equals(result.getRight())) { + result.setRight("车辆正常通行"); + } + } else if ("dcEventConstruction.constructionMethod".equals(result.getRightPath())) { + if ("1".equals(result.getRight())) { + result.setRight("车道"); + } else if ("2".equals(result.getRight())) { + result.setRight("其他"); } } else if ("dcEventServiceArea.disableFacility".equals(result.getRightPath())) { if ("1".equals(result.getRight())) { From 016ac3b4704c5adbc0253e6463526141537658c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Mon, 3 Jun 2024 16:30:33 +0800 Subject: [PATCH 03/15] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=BD=E5=B7=A5?= =?UTF-8?q?=E5=BB=BA=E8=AE=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/business/DcEventConstructionMapper.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/zc-business/src/main/resources/mapper/business/DcEventConstructionMapper.xml b/zc-business/src/main/resources/mapper/business/DcEventConstructionMapper.xml index 16de9bcc..b3812a37 100644 --- a/zc-business/src/main/resources/mapper/business/DcEventConstructionMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcEventConstructionMapper.xml @@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -29,11 +30,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select location,local_road_name,end_stake_mark,id, control_mode, location_type, special_place_description, special_construction, other_construction_name, construction_measurement, facility_id, exits_inlets, lane_occupancy, traffic_condition from dc_event_construction + select construction_method,location,local_road_name,end_stake_mark,id, control_mode, location_type, special_place_description, special_construction, other_construction_name, construction_measurement, facility_id, exits_inlets, lane_occupancy, traffic_condition from dc_event_construction SELECT dc_event_construction.id as id, + dc_event_construction.construction_method as construction_method, dc_event_construction.control_mode as control_mode, dc_event_construction.location_type as location_type, dc_event_construction.special_place_description as special_place_description, @@ -95,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" end_stake_mark, local_road_name, location, + construction_method, #{id}, @@ -111,6 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{endStakeMark}, #{localRoadName}, #{location}, + #{constructionMethod}, @@ -130,6 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" end_stake_mark = #{endStakeMark}, local_road_name = #{localRoadName}, location = #{location}, + construction_method = #{constructionMethod}, where id = #{id} From 4577c59bdad643b94a813e960762de479fbec8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Mon, 3 Jun 2024 17:39:24 +0800 Subject: [PATCH 04/15] =?UTF-8?q?=E4=BA=8B=E4=BB=B6=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=B7=B2=E8=A2=AB=E4=BF=AE=E6=94=B9=20=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zc/business/service/impl/DcEventServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 0a3b5b33..5bd94cb4 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 @@ -1188,12 +1188,12 @@ public class DcEventServiceImpl extends ServiceImpl impl if (dcEvent1 == null) { return 1; } -/* + //事件状态已被修改 返回成功 - if (dcEvent1.getEventState() == state) { + if (dcEvent1.getEventState() == 1) { return 1; } -*/ + int i = dcEventMapper.updateDcEventState(id, state); if (i > 0) { From d118ffb1b2d14cb1c6c7751a5d53aacabce0ea50 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Mon, 3 Jun 2024 19:44:58 +0800 Subject: [PATCH 05/15] =?UTF-8?q?=E9=80=9A=E8=A1=8C=E5=BF=AB=E6=8A=A5=20?= =?UTF-8?q?=E5=A4=A9=E6=B0=94=E6=83=85=E5=86=B5=E6=8E=A5=E5=8F=A3=E6=9B=B4?= =?UTF-8?q?=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/controller/WordController.java | 100 ++++++++++++------ 1 file changed, 70 insertions(+), 30 deletions(-) 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 775ff31f..76929ef0 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,6 +2,7 @@ package com.zc.business.controller; import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.domain.AjaxResult; +import com.zc.business.domain.DcTrafficSectionData; import com.zc.business.mapper.DcTrafficIncidentsMapper; import com.zc.business.utils.PoiUtil; import io.swagger.annotations.Api; @@ -19,9 +20,12 @@ import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.math.BigInteger; import java.text.SimpleDateFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; import java.time.OffsetDateTime; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.stream.Collectors; import static com.zc.business.utils.PoiUtil.*; @@ -128,68 +132,102 @@ public class WordController { PoiUtil.createHeading2(doc,"天气情况统计"); - AjaxResult ajaxResult = weatherForecastController.hourlyWeather(); +// AjaxResult ajaxResult = weatherForecastController.hourlyWeather(); + HashMap params = new HashMap<>(); + params.put("roadId","G003537"); + params.put("stakeNum","K60+000|K105+000|K145+000|K165+000|K175+000|K190+000|K200+000|K205+000"); + params.put("forecastHour","24"); + AjaxResult ajaxResult = weatherForecastController.currentWeatherAndForecastInformation(params); + if (ajaxResult.get("code").equals(200)) { - Map>> data = (Map>>) ajaxResult.get("data"); + List> data = (List>) ajaxResult.get("data"); if (data != null && data.size() != 0){ - XWPFTable table = doc.createTable(9, 25); + XWPFTable table = doc.createTable(9, 10); //列宽自动分割 CTTblWidth infoTableWidth = table.getCTTbl().addNewTblPr().addNewTblW(); infoTableWidth.setType(STTblWidth.DXA); infoTableWidth.setW(BigInteger.valueOf(9072)); - data.keySet().forEach(key ->{ - if ("hourlyWeather1".equals(key)){ + DateTimeFormatter parseFormatter = DateTimeFormatter.ISO_LOCAL_DATE_TIME; + + data.forEach(dataItem ->{ + if ("K60+000".equals(dataItem.get("stakeNum"))){ setTableFonts(table.getRow(1).getCell(0), "长清区"); - List> weatherList = data.get(key); + List> weatherList = (List>) dataItem.get("forecastList"); + weatherList = weatherList.stream() + .sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) + .collect(Collectors.toList()); for (int i = 0; i < weatherList.size(); i++) { - OffsetDateTime offsetDateTime = OffsetDateTime.parse(weatherList.get(i).get("fxTime").toString()); - setTableFonts(table.getRow(0).getCell(i+1),offsetDateTime.format(DateTimeFormatter.ofPattern("dd日HH时"))); - setTableFonts(table.getRow(1).getCell(i+1), weatherList.get(i).get("text").toString()); + //第一行 格式化时间 + LocalDateTime localDateTime = LocalDateTime.parse(weatherList.get(i).get("weatherTime").toString(), parseFormatter); + DateTimeFormatter formatFormatter = DateTimeFormatter.ofPattern("dd日HH时"); + setTableFonts(table.getRow(0).getCell(i+1),localDateTime.format(formatFormatter)); + setTableFonts(table.getRow(1).getCell(i+1), weatherList.get(i).get("weatherDescription").toString()); } - } else if ("hourlyWeather2".equals(key)){ + } else if ("K105+000".equals(dataItem.get("stakeNum"))){ setTableFonts(table.getRow(2).getCell(0), "平阴县"); - List> weatherList = data.get(key); + List> weatherList = (List>) dataItem.get("forecastList"); + weatherList = weatherList.stream() + .sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) + .collect(Collectors.toList()); for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(2).getCell(i+1), weatherList.get(i).get("text").toString()); + setTableFonts(table.getRow(2).getCell(i+1), weatherList.get(i).get("weatherDescription").toString()); } - } else if ("hourlyWeather3".equals(key)){ + } else if ("K145+000".equals(dataItem.get("stakeNum"))){ setTableFonts(table.getRow(3).getCell(0), "东平县"); - List> weatherList = data.get(key); + List> weatherList = (List>) dataItem.get("forecastList"); + weatherList = weatherList.stream() + .sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) + .collect(Collectors.toList()); for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(3).getCell(i+1), weatherList.get(i).get("text").toString()); + setTableFonts(table.getRow(3).getCell(i+1), weatherList.get(i).get("weatherDescription").toString()); } - } else if ("hourlyWeather4".equals(key)){ + } else if ("K165+000".equals(dataItem.get("stakeNum"))){ setTableFonts(table.getRow(4).getCell(0), "汶上县"); - List> weatherList = data.get(key); + List> weatherList = (List>) dataItem.get("forecastList"); + weatherList = weatherList.stream() + .sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) + .collect(Collectors.toList()); for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(4).getCell(i+1), weatherList.get(i).get("text").toString()); + setTableFonts(table.getRow(4).getCell(i+1), weatherList.get(i).get("weatherDescription").toString()); } - } else if ("hourlyWeather5".equals(key)){ + } else if ("K175+000".equals(dataItem.get("stakeNum"))){ setTableFonts(table.getRow(5).getCell(0), "梁山县"); - List> weatherList = data.get(key); + List> weatherList = (List>) dataItem.get("forecastList"); + weatherList = weatherList.stream() + .sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) + .collect(Collectors.toList()); for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(5).getCell(i+1), weatherList.get(i).get("text").toString()); + setTableFonts(table.getRow(5).getCell(i+1), weatherList.get(i).get("weatherDescription").toString()); } - } else if ("hourlyWeather6".equals(key)){ + } else if ("K190+000".equals(dataItem.get("stakeNum"))){ setTableFonts(table.getRow(6).getCell(0), "嘉祥县"); - List> weatherList = data.get(key); + List> weatherList = (List>) dataItem.get("forecastList"); + weatherList = weatherList.stream() + .sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) + .collect(Collectors.toList()); for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(6).getCell(i+1), weatherList.get(i).get("text").toString()); + setTableFonts(table.getRow(6).getCell(i+1), weatherList.get(i).get("weatherDescription").toString()); } - } else if ("hourlyWeather7".equals(key)){ + } else if ("K200+000".equals(dataItem.get("stakeNum"))){ setTableFonts(table.getRow(7).getCell(0), "巨野县"); - List> weatherList = data.get(key); + List> weatherList = (List>) dataItem.get("forecastList"); + weatherList = weatherList.stream() + .sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) + .collect(Collectors.toList()); for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(7).getCell(i+1), weatherList.get(i).get("text").toString()); + setTableFonts(table.getRow(7).getCell(i+1), weatherList.get(i).get("weatherDescription").toString()); } - } else if ("hourlyWeather8".equals(key)){ + } else if ("K205+000".equals(dataItem.get("stakeNum"))){ setTableFonts(table.getRow(8).getCell(0), "郓城县"); - List> weatherList = data.get(key); + List> weatherList = (List>) dataItem.get("forecastList"); + weatherList = weatherList.stream() + .sorted(Comparator.comparing(map -> LocalDateTime.parse(map.get("weatherTime").toString(), parseFormatter))) + .collect(Collectors.toList()); for (int i = 0; i < weatherList.size(); i++) { - setTableFonts(table.getRow(8).getCell(i+1), weatherList.get(i).get("text").toString()); + setTableFonts(table.getRow(8).getCell(i+1), weatherList.get(i).get("weatherDescription").toString()); } } }); @@ -197,6 +235,8 @@ public class WordController { addDescription(doc,"暂无数据"); } + } else { + addDescription(doc,"暂无数据"); } //换行 From e6f270ac639f13866b0b03d79d6392d10bef9087 Mon Sep 17 00:00:00 2001 From: zhaoxianglong Date: Tue, 4 Jun 2024 15:41:12 +0800 Subject: [PATCH 06/15] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=9C=B0=E5=8C=BA?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E8=BF=94=E5=9B=9E=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zc-business/src/main/java/com/zc/business/domain/DcRegion.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/zc-business/src/main/java/com/zc/business/domain/DcRegion.java b/zc-business/src/main/java/com/zc/business/domain/DcRegion.java index f15246e6..5cc48e2b 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcRegion.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcRegion.java @@ -18,4 +18,6 @@ public class DcRegion { private String longitude; @ApiModelProperty("纬度") private String latitude; + @ApiModelProperty("桩号") + private String stakeNum; } From 460cc5ee7089e0ed88cf7bd44eb687b90cd41c90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Tue, 4 Jun 2024 15:43:17 +0800 Subject: [PATCH 07/15] =?UTF-8?q?=E5=90=84=E6=94=B6=E8=B4=B9=E7=AB=99?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E5=88=86=E8=BD=A6=E5=9E=8B=E5=B0=8F=E6=97=B6?= =?UTF-8?q?=E8=BD=A6=E6=B5=81=E9=87=8F=EF=BC=8C=E5=85=A8=E8=B7=AF=E6=AE=B5?= =?UTF-8?q?=E5=8F=8C=E5=90=91=E5=AE=9E=E6=97=B6=E8=BD=A6=E6=B5=81=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DcTrafficStatisticsController.java | 36 +++++- .../mapper/DcGantryStatisticsDataMapper.java | 7 ++ .../IDcGantryStatisticsDataService.java | 5 + .../service/IDcTrafficStatisticsService.java | 8 ++ .../impl/DcGantryStatisticsDataImpl.java | 11 +- .../impl/DcTrafficStatisticsServiceImpl.java | 104 +++++++++++++++++- .../business/DcGantryStatisticsDataMapper.xml | 43 +++++++- 7 files changed, 207 insertions(+), 7 deletions(-) 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 cb2eb3a4..ae1e0d1a 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 @@ -179,6 +179,20 @@ public class DcTrafficStatisticsController { // 将查询结果封装为成功响应并返回 return AjaxResult.success(dcStatisticsData); } +/** + * 全路段双向实时车流量 + * @param startDate 时间 + * @param direction 方向 + * @param periodType 时间粒子 + */ +@ApiOperation("全路段双向实时车流量") +@GetMapping("/history/realTimeTrafficFlow") +public AjaxResult realTimeTrafficFlow(String startDate, String direction,String periodType ){ + List> mapList = dcGantryStatisticsDataService.realTimeTrafficFlow(startDate,direction,periodType); + // 将查询结果封装为成功响应并返回 + return AjaxResult.success(mapList); +} + /********************************************* 智慧高速平接口 **************************************************/ @@ -246,6 +260,26 @@ public class DcTrafficStatisticsController { // 将获取到的交通指标数据封装为成功的结果并返回 return AjaxResult.success(jsonArray); } +/** + * 断面小时车流量分车型 + */ +@ApiOperation("断面小时车流量分车型") +@GetMapping("/history/sectionHourlyTrafficFlow") +public AjaxResult sectionHourlyTrafficFlow(String startDate, String endDate) throws HttpException, IOException { + // 调用服务层方法,获取当前交通指标数据 + JSONArray jsonArray = dcTrafficStatisticsService.sectionHourlyTrafficFlow(startDate, endDate); + // 将获取到的交通指标数据封装为成功的结果并返回 + return AjaxResult.success(jsonArray); - +}/** + * 各收费站入口分车型小时车流量 + */ +@ApiOperation("各收费站入口分车型小时车流量") +@GetMapping("/history/trafficFlowAtTollStationEntrance") +public AjaxResult trafficFlowAtTollStationEntrance(String startDate, String endDate,String stationType) throws HttpException, IOException { + // 调用服务层方法,获取当前交通指标数据 + List> jsonArray = dcTrafficStatisticsService.trafficFlowAtTollStationEntrance(startDate, endDate, stationType); + // 将获取到的交通指标数据封装为成功的结果并返回 + return AjaxResult.success(jsonArray); +} } diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcGantryStatisticsDataMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcGantryStatisticsDataMapper.java index b7eb758a..7dc79413 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcGantryStatisticsDataMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcGantryStatisticsDataMapper.java @@ -3,8 +3,11 @@ package com.zc.business.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.zc.business.domain.DcGantryStatisticsData; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.Date; +import java.util.List; +import java.util.Map; /** * 这是一个接口的注释,用于描述门架数据统计的Mapper。 @@ -29,5 +32,9 @@ public interface DcGantryStatisticsDataMapper extends BaseMapper> realTimeTrafficFlow(@Param("startDate") String startDate, @Param("direction")String direction, @Param("periodType")String periodType ); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcGantryStatisticsDataService.java b/zc-business/src/main/java/com/zc/business/service/IDcGantryStatisticsDataService.java index e6b95a43..850eac05 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcGantryStatisticsDataService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcGantryStatisticsDataService.java @@ -6,6 +6,7 @@ import com.zc.business.domain.DcStatisticsData; import com.zc.business.domain.DcTollStationStatisticsData; import java.util.List; +import java.util.Map; /** * 门架数据统计接口。该接口扩展了IService接口,用于对DcGantryStatisticsData类型的实体进行数据库操作。 @@ -34,4 +35,8 @@ public interface IDcGantryStatisticsDataService extends IService gantryData(DcGantryStatisticsData dcGantryStatisticsData); + /** + * 全路段双向实时车流量 + */ + List> realTimeTrafficFlow(String startDate, String direction,String periodType ); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java b/zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java index cb272e49..9835ede1 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcTrafficStatisticsService.java @@ -43,4 +43,12 @@ public interface IDcTrafficStatisticsService { * 获取车道占有率信息 */ JSONArray laneOccupancy(String startDate, String endDate) throws HttpException, IOException; + /** + * 断面小时车流量分车型 + */ + JSONArray sectionHourlyTrafficFlow(String startDate, String endDate) throws HttpException, IOException; + /** + * 各收费站入口分车型小时车流量 + */ + List>trafficFlowAtTollStationEntrance(String startDate, String endDate,String stationType) throws HttpException, IOException; } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java index ed8d6d38..f38a8ae2 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcGantryStatisticsDataImpl.java @@ -21,6 +21,7 @@ import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.util.Date; import java.util.List; +import java.util.Map; /** * 门架数据统计服务实现类 @@ -37,7 +38,8 @@ public class DcGantryStatisticsDataImpl extends ServiceImpl> realTimeTrafficFlow(String startDate, String direction,String periodType ) { + return dcGantryStatisticsDataMapper.realTimeTrafficFlow(startDate,direction,periodType); + } /** * 恢复日缓存数据的方法 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 af3b68d7..162560dc 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 @@ -23,10 +23,7 @@ import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Service public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsService { @@ -509,5 +506,104 @@ public class DcTrafficStatisticsServiceImpl implements IDcTrafficStatisticsServi return new JSONArray(); } + /** + * 断面小时车流量分车型 + */ + @Override + public JSONArray sectionHourlyTrafficFlow(String startDate, String endDate) throws HttpException, IOException { + OkHttp okHttp = new OkHttp(); + + RequestParams requestParams = new RequestParams(); + + requestParams.put("sysid", sysid); + + JSONObject parameters = new JSONObject() { + { + put("start_date", startDate); + put("end_date", endDate); + } + }; + + requestParams.put("parameters", parameters.toJSONString()); + + Map headers = new HashMap<>(); + headers.put("Authorization", getAccessToken()); + + Response response // 请求响应 + = okHttp + .headers(headers) + .url(baseUrl + "/api/dc/query/rd_jihe_d_vehtypeflowbydatesection") // 请求地址 + .data(requestParams) // 请求参数 + .post(); // 请求方法 + + ResponseBody body = response.body(); + if (body != null) { + return JSON.parseArray(body.string()); + } + + return new JSONArray(); + } +/** + * 各收费站入口分车型小时车流量 + */ + @Override + public List> trafficFlowAtTollStationEntrance(String startDate, String endDate,String stationType) throws HttpException, IOException { + OkHttp okHttp = new OkHttp(); + + RequestParams requestParams = new RequestParams(); + + requestParams.put("sysid", sysid); + + JSONObject parameters = new JSONObject() { + { + put("start_date", startDate); + put("end_date", endDate); + put("station_type", stationType); + } + }; + + requestParams.put("parameters", parameters.toJSONString()); + + Map headers = new HashMap<>(); + headers.put("Authorization", getAccessToken()); + + Response response // 请求响应 + = okHttp + .headers(headers) + .url(baseUrl + "/api/dc/query/ts_jihe_d_vehtypeflowbyhourstation") // 请求地址 + .data(requestParams) // 请求参数 + .post(); // 请求方法 + + ResponseBody body = response.body(); + if (body != null) { + JSONArray jsonArray = JSON.parseArray(body.string()); + +// 使用HashMap来分组并求和 + Map sumByName = new HashMap<>(); + List> list = new ArrayList(); + + for (Object item : jsonArray) { // 这里做了微调,直接遍历jsonArray的Object + JSONObject jsonObject = (JSONObject) item; + String name = jsonObject.getString("ts_name"); // 更安全的取值方式 + int totalFlow = jsonObject.getInteger("total_flow"); // 专门针对Integer类型 + sumByName.put(name, sumByName.getOrDefault(name, 0) + totalFlow); + + } + +// 输出结果 +// 输出结果 + // 正确创建新的映射对象并添加到list中 + for (Map.Entry entry : sumByName.entrySet()) { + Map singleResult = new HashMap<>(); // 每次循环都创建一个新的映射 + singleResult.put("name", entry.getKey()); + singleResult.put("value", entry.getValue().toString()); + list.add(singleResult); + System.out.println(entry.getKey() + " 的 total_flow 总和为: " + entry.getValue()); + } + return list; + } + + return new ArrayList(); + } } diff --git a/zc-business/src/main/resources/mapper/business/DcGantryStatisticsDataMapper.xml b/zc-business/src/main/resources/mapper/business/DcGantryStatisticsDataMapper.xml index 851f7fe9..e8b420dd 100644 --- a/zc-business/src/main/resources/mapper/business/DcGantryStatisticsDataMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcGantryStatisticsDataMapper.xml @@ -3,7 +3,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - + + + + INSERT INTO @@ -87,5 +90,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM dc_gantry_statistics_data + From 463db731c6100d13a146b287be77d580560a0422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Wed, 5 Jun 2024 09:34:28 +0800 Subject: [PATCH 08/15] =?UTF-8?q?=E8=8F=9C=E5=8D=95=E6=98=AF=E5=90=A6dc?= =?UTF-8?q?=E5=90=8E=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-ui/src/views/system/menu/index.vue | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue index c30be850..6f249b5e 100644 --- a/ruoyi-ui/src/views/system/menu/index.vue +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -65,6 +65,7 @@ +