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