From 708ee9059b1c0e94cd0dbdf5be4ddf8a3e147511 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Wed, 17 Jan 2024 15:08:08 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BA=8B=E4=BB=B6=E7=AE=A1=E6=8E=A7=E5=88=86?= =?UTF-8?q?=E6=9E=90=E6=8E=A5=E5=8F=A3=202.=E6=A1=A9=E5=8F=B7=E8=B7=9D?= =?UTF-8?q?=E7=A6=BB=E8=AE=A1=E7=AE=97=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/common/utils/StakeMarkUtils.java | 44 ++++++++ .../DcTrafficIncidentsController.java | 16 ++- .../mapper/DcTrafficIncidentsMapper.java | 23 ++++ .../service/IDcTrafficIncidentsService.java | 10 ++ .../impl/DcTrafficIncidentsServiceImpl.java | 19 +++- .../business/DcTrafficIncidentsMapper.xml | 104 ++++++++++++++++++ 6 files changed, 214 insertions(+), 2 deletions(-) create mode 100644 ruoyi-common/src/main/java/com/ruoyi/common/utils/StakeMarkUtils.java diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/StakeMarkUtils.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StakeMarkUtils.java new file mode 100644 index 00000000..b68119ea --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/StakeMarkUtils.java @@ -0,0 +1,44 @@ +package com.ruoyi.common.utils; + +import java.math.BigDecimal; +import java.math.RoundingMode; + +/** + * @Description 桩号距离计算工具 + * + * @author liuwenge + * @date 2024/1/17 14:43 + */ +public class StakeMarkUtils { + + /** + * @Description 计算桩号距离(公里) + * + * @author liuwenge + * @date 2024/1/17 14:45 + * @param startStakeMark 开始桩号 + * @param endStakeMark 结束桩号 + * @return java.math.BigDecimal 距离 + */ + public static BigDecimal getKilometre(String startStakeMark, String endStakeMark){ + String start = startStakeMark.toLowerCase().replace("k","").replace("+","."); + String end = endStakeMark.toLowerCase().replace("k","").replace("+","."); + return new BigDecimal(end).subtract(new BigDecimal(start)).setScale(3, RoundingMode.HALF_UP); + } + + /** + * @Description 计算桩号距离(米) + * + * @author liuwenge + * @date 2024/1/17 15:04 + * @param startStakeMark 开始桩号 + * @param endStakeMark 结束桩号 + * @return java.math.BigDecimal 距离 + */ + public static BigDecimal getMetre(String startStakeMark, String endStakeMark){ + String start = startStakeMark.toLowerCase().replace("k","").replace("+","."); + String end = endStakeMark.toLowerCase().replace("k","").replace("+","."); + return new BigDecimal(end).subtract(new BigDecimal(start)).multiply(new BigDecimal("1000")).setScale(0, RoundingMode.HALF_UP); + } + +} 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 32a8c616..6c5ed6b5 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 @@ -172,9 +172,23 @@ public class DcTrafficIncidentsController { * @param params * @return com.ruoyi.common.core.domain.AjaxResult */ - @ApiOperation("收费站统计分析table") + @ApiOperation("事故多发路段分析") @PostMapping("/selectRoadSectionAnalysis") public AjaxResult selectRoadSectionAnalysis(@RequestBody Map params){ return trafficIncidentsService.selectRoadSectionAnalysis(params); } + + /** + * @Description 路网管控-事件管控分析-事故类型分析 + * + * @author liuwenge + * @date 2024/1/16 15:52 + * @param params + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @ApiOperation("事故类型分析") + @PostMapping("/selectEventTypeAnalysis") + public AjaxResult selectEventTypeAnalysis(@RequestBody Map params){ + return trafficIncidentsService.selectEventTypeAnalysis(params); + } } 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 e5273281..2ed3bdc3 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 @@ -1,5 +1,7 @@ package com.zc.business.mapper; +import org.apache.ibatis.annotations.Param; + import java.util.List; import java.util.Map; @@ -190,4 +192,25 @@ public interface DcTrafficIncidentsMapper { * @return java.util.List> */ List> getTollStationAnalysis(); + + /** + * @Description 事故多发路段分析 + * + * @author liuwenge + * @date 2024/1/17 14:18 + * @param params + * @return java.util.List> + */ + List> selectRoadSectionAnalysis(Map params); + + /** + * @Description 事故类型分析 + * + * @author liuwenge + * @date 2024/1/17 14:18 + * @param params + * @return java.util.List> + */ + List> selectEventTypeAnalysis(Map params); + } 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 be68a5ee..2d822a76 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 @@ -115,4 +115,14 @@ public interface IDcTrafficIncidentsService { * @return com.ruoyi.common.core.domain.AjaxResult */ AjaxResult selectRoadSectionAnalysis(Map params); + + /** + * @Description 路网管控-事件管控分析-事故类型分析 + * + * @author liuwenge + * @date 2024/1/16 15:52 + * @param params + * @return com.ruoyi.common.core.domain.AjaxResult + */ + AjaxResult selectEventTypeAnalysis(Map params); } 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 b7013880..9757ee00 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 @@ -1,6 +1,7 @@ package com.zc.business.service.impl; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.StakeMarkUtils; import com.zc.business.domain.DcEvent; import com.zc.business.domain.DcEventType; import com.zc.business.mapper.DcTrafficIncidentsMapper; @@ -421,6 +422,22 @@ public class DcTrafficIncidentsServiceImpl implements IDcTrafficIncidentsService @Override public AjaxResult selectRoadSectionAnalysis(Map params){ - return AjaxResult.success(); + List> list = trafficIncidentsMapper.selectRoadSectionAnalysis(params); + return AjaxResult.success(list); + } + + /** + * @Description 路网管控-事件管控分析-事故类型分析 + * + * @author liuwenge + * @date 2024/1/16 15:52 + * @param params + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @Override + public AjaxResult selectEventTypeAnalysis(Map params){ + + List> list = trafficIncidentsMapper.selectEventTypeAnalysis(params); + return AjaxResult.success(list); } } diff --git a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml index 3e2083fd..1587360d 100644 --- a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml @@ -236,4 +236,108 @@ on t3.id = t4.facilityId + + + + \ No newline at end of file