From 51235d916a936af4726df22c0d0d181178a08e73 Mon Sep 17 00:00:00 2001 From: lau572 <1010031226@qq.com> Date: Sat, 13 Jan 2024 17:20:24 +0800 Subject: [PATCH] =?UTF-8?q?1.=E9=A6=96=E9=A1=B5=E4=BA=A4=E9=80=9A=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E5=90=84=E7=B1=BB=E7=BB=9F=E8=AE=A1=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=202.=E4=BA=8B=E4=BB=B6=E7=AE=A1=E6=8E=A7=E5=88=86=E6=9E=90?= =?UTF-8?q?=E4=BA=A4=E9=80=9A=E4=BA=8B=E4=BB=B6=E7=BB=9F=E8=AE=A1=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/DcEventTypeController.java | 32 ++-- .../DcTrafficIncidentsController.java | 97 +++++++++++ .../com/zc/business/domain/DcEventType.java | 4 +- .../zc/business/domain/DcProcessConfig.java | 2 +- .../mapper/DcTrafficIncidentsMapper.java | 125 ++++++++++++++ .../business/service/IDcEventTypeService.java | 2 +- .../service/IDcTrafficIncidentsService.java | 62 +++++++ .../service/impl/DcEventTypeServiceImpl.java | 16 +- .../impl/DcTrafficIncidentsServiceImpl.java | 153 ++++++++++++++++++ .../business/DcTrafficIncidentsMapper.xml | 65 ++++++++ 10 files changed, 530 insertions(+), 28 deletions(-) create mode 100644 zc-business/src/main/java/com/zc/business/controller/DcTrafficIncidentsController.java create mode 100644 zc-business/src/main/java/com/zc/business/mapper/DcTrafficIncidentsMapper.java create mode 100644 zc-business/src/main/java/com/zc/business/service/IDcTrafficIncidentsService.java create mode 100644 zc-business/src/main/java/com/zc/business/service/impl/DcTrafficIncidentsServiceImpl.java create mode 100644 zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml diff --git a/zc-business/src/main/java/com/zc/business/controller/DcEventTypeController.java b/zc-business/src/main/java/com/zc/business/controller/DcEventTypeController.java index ea17ddb3..368dc349 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcEventTypeController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcEventTypeController.java @@ -26,12 +26,12 @@ import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; /** - * 事件类型Controller + * 事件处置流程Controller * * @author ruoyi * @date 2024-01-03 */ -@Api(value = "事件类型",tags = {"事件类型"}) +@Api(value = "事件处置流程配置",tags = {"事件处置流程配置"}) @RestController @RequestMapping("/business/dcEventType") public class DcEventTypeController extends BaseController @@ -40,9 +40,9 @@ public class DcEventTypeController extends BaseController private IDcEventTypeService dcEventTypeService; /** - * 查询事件类型列表 + * 查询事件类型配置列表 */ - @ApiOperation("查询事件类型列表") + @ApiOperation("查询事件类型配置列表") // @PreAuthorize("@ss.hasPermi('business:dcEventType:list')") @GetMapping("/list") public TableDataInfo list(DcEventType dcEventType) @@ -53,22 +53,22 @@ public class DcEventTypeController extends BaseController } /** - * 导出事件类型列表 + * 导出事件类型配置列表 */ // @PreAuthorize("@ss.hasPermi('business:dcEventType:export')") - @Log(title = "事件类型", businessType = BusinessType.EXPORT) + @Log(title = "事件类型配置", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, DcEventType dcEventType) { List list = dcEventTypeService.selectDcEventTypeList(dcEventType); ExcelUtil util = new ExcelUtil<>(DcEventType.class); - util.exportExcel(response, list, "事件类型数据"); + util.exportExcel(response, list, "事件类型配置数据"); } /** - * 获取事件类型详细信息 + * 获取事件类型配置详细信息 */ - @ApiOperation("获取事件类型详细信息") + @ApiOperation("获取事件类型配置详细信息") // @PreAuthorize("@ss.hasPermi('business:dcEventType:query')") @GetMapping(value = "/{eventType}") public AjaxResult getInfo(@PathVariable("eventType") @ApiParam(name = "eventType", value = "事件类型", required = true) Integer eventType) @@ -79,10 +79,10 @@ public class DcEventTypeController extends BaseController /** * 新增事件类型 */ - @ApiOperation("新增事件类型") +// @ApiOperation("新增事件类型") // @PreAuthorize("@ss.hasPermi('business:dcEventType:add')") @Log(title = "事件类型", businessType = BusinessType.INSERT) - @PostMapping + @PostMapping("/add") public AjaxResult add(@RequestBody DcEventType dcEventType) { return dcEventTypeService.insertDcEventType(dcEventType); @@ -91,19 +91,19 @@ public class DcEventTypeController extends BaseController /** * 修改事件类型 */ - @ApiOperation("修改事件类型") + @ApiOperation("修改事件流程配置") // @PreAuthorize("@ss.hasPermi('business:dcEventType:edit')") @Log(title = "事件类型", businessType = BusinessType.UPDATE) - @PutMapping - public AjaxResult edit(@RequestBody DcEventType dcEventType) + @PostMapping("/updateDcProcessConfig") + public AjaxResult updateDcProcessConfig(@RequestBody DcEventType dcEventType) { - return dcEventTypeService.updateDcEventType(dcEventType); + return dcEventTypeService.updateDcProcessConfig(dcEventType); } /** * 删除事件类型 */ - @ApiOperation("删除事件类型") +// @ApiOperation("删除事件类型") // @PreAuthorize("@ss.hasPermi('business:dcEventType:remove')") @Log(title = "事件类型", businessType = BusinessType.DELETE) @DeleteMapping("/{eventType}") 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 new file mode 100644 index 00000000..a044397b --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcTrafficIncidentsController.java @@ -0,0 +1,97 @@ +package com.zc.business.controller; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.zc.business.service.IDcTrafficIncidentsService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Description 交通事件统计 + * + * @author liuwenge + * @date 2024/1/13 9:41 + */ +@Api(tags = "交通事件统计") +@RestController +@RequestMapping("/business/trafficIncidents") +public class DcTrafficIncidentsController { + + @Autowired + private IDcTrafficIncidentsService trafficIncidentsService; + + /** + * @Description 首页-重点数据 + * + * @author liuwenge + * @date 2024/1/13 10:10 + * @param + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @ApiOperation("首页-重点监控") + @GetMapping("/getKeyData") + public AjaxResult getKeyData(){ + return trafficIncidentsService.getKeyData(); + } + + /** + * @Description 首页-事件专题-根据事件类型获取事件列表 + * + * @author liuwenge + * @date 2024/1/13 14:27 + * @param eventType + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @ApiOperation("根据类型获取事件列表") + @GetMapping("/getEventList/{eventType}") + public AjaxResult getEventList(@ApiParam(value = "事件类型", name = "eventType",required = true) @PathVariable("eventType") String eventType){ + return trafficIncidentsService.getEventListByType(eventType); + } + + /** + * @Description 首页-事件专题-根据事件id获取事件详情 + * + * @author liuwenge + * @date 2024/1/13 14:43 + * @param eventId + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @ApiOperation("获取交通事件详情") + @GetMapping("/getEventInfo/{eventId}") + public AjaxResult getEventInfo(@ApiParam(value = "事件id", name = "eventId",required = true) @PathVariable("eventId") String eventId){ + return trafficIncidentsService.getEventInfo(eventId); + } + + /** + * @Description 首页-状况统计-获取日周月年交通事件数量 + * + * @author liuwenge + * @date 2024/1/13 15:07 + * @param + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @ApiOperation("获取日、周、月、年的交通事件数量") + @GetMapping("/getTrafficIncidentsNum") + public AjaxResult getTrafficIncidentsNum(){ + return trafficIncidentsService.getTrafficIncidentsNum(); + } + + /** + * @Description 路网管控-事件管控分析-统计各类型的交通事件数量 + * + * @author liuwenge + * @date 2024/1/13 15:07 + * @param + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @ApiOperation("统计各类型的交通事件数量") + @GetMapping("/getAllEventNum") + public AjaxResult getAllEventNum(){ + return trafficIncidentsService.getAllEventNum(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcEventType.java b/zc-business/src/main/java/com/zc/business/domain/DcEventType.java index bb1eaa8a..55a675f3 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcEventType.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcEventType.java @@ -21,12 +21,12 @@ public class DcEventType { /** 事件类型 */ - @ApiModelProperty(value = "事件类型", required = true) + @ApiModelProperty(value = "事件类型") @Excel(name = "事件类型") private Integer eventType; /** 事件名称 */ - @ApiModelProperty(value = "事件名称", required = true) + @ApiModelProperty(value = "事件名称") @Excel(name = "事件名称") private String eventName; diff --git a/zc-business/src/main/java/com/zc/business/domain/DcProcessConfig.java b/zc-business/src/main/java/com/zc/business/domain/DcProcessConfig.java index 936948fa..b19ee3f6 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcProcessConfig.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcProcessConfig.java @@ -21,7 +21,7 @@ public class DcProcessConfig private Long id; /** 事件类型 */ - @ApiModelProperty(value = "事件类型", required = true) + @ApiModelProperty(value = "事件类型") private Integer eventType; /** 处置流程 */ 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 new file mode 100644 index 00000000..4cb7bbcd --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/DcTrafficIncidentsMapper.java @@ -0,0 +1,125 @@ +package com.zc.business.mapper; + +import java.util.List; +import java.util.Map; + +/** + * @Description 交通事件Mapper接口 + * + * @author liuwenge + * @date 2024/1/13 9:46 + */ +public interface DcTrafficIncidentsMapper { + + /** + * @Description 首页-当日交通事件总数 + * + * @author liuwenge + * @date 2024/1/13 10:24 + * @param + * @return java.util.Map + */ + int getTrafficIncidentsAll(); + + /** + * @Description 首页-当日交通事件未完成数量 + * + * @author liuwenge + * @date 2024/1/13 10:43 + * @param + * @return int + */ + int getTrafficIncidentsProcessing(); + + /** + * @Description 首页-施工路段未完成数量 + * + * @author liuwenge + * @date 2024/1/13 10:43 + * @param + * @return int + */ + int getConstructionNum(); + + /** + * @Description 首页-事件专题-根据事件类型获取事件列表 + * + * @author liuwenge + * @date 2024/1/13 14:29 + * @param eventType + * @return java.util.List> + */ + List> getEventListByType(String eventType); + + /** + * @Description 获取本日的交通事件数量 + * + * @author liuwenge + * @date 2024/1/13 15:11 + * @param + * @return java.util.Map + */ + Long selectTrafficIncidentsDay(); + + /** + * @Description 获取本周的交通事件数量 + * + * @author liuwenge + * @date 2024/1/13 15:11 + * @param + * @return java.util.Map + */ + Long selectTrafficIncidentsWeek(); + + /** + * @Description 获取本月的交通事件数量 + * + * @author liuwenge + * @date 2024/1/13 15:11 + * @param + * @return java.util.Map + */ + Long selectTrafficIncidentsMonth(); + + /** + * @Description 获取本年的交通事件数量 + * + * @author liuwenge + * @date 2024/1/13 15:11 + * @param + * @return java.util.Map + */ + Long selectTrafficIncidentsYear(); + + /** + * @Description 查询全部的未完成事件 + * + * @author liuwenge + * @date 2024/1/13 15:20 + * @param + * @return java.lang.Long + */ + Long selectTrafficIncidentsAllProcessing(); + + /** + * @Description 查询事件类型列表 + * + * @author liuwenge + * @date 2024/1/13 15:52 + * @param + * @return java.util.List> + */ + List> selectEventTypeList(); + + /** + * @Description 查询各个处理状态数量 + * + * @author liuwenge + * @date 2024/1/13 15:57 + * @param + * @return java.util.Map + */ + List> selectStatusCountByEventType(String eventType); + + +} diff --git a/zc-business/src/main/java/com/zc/business/service/IDcEventTypeService.java b/zc-business/src/main/java/com/zc/business/service/IDcEventTypeService.java index f27638a3..32a93d2e 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcEventTypeService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcEventTypeService.java @@ -43,7 +43,7 @@ public interface IDcEventTypeService * @param dcEventType 事件类型 * @return 结果 */ - AjaxResult updateDcEventType(DcEventType dcEventType); + AjaxResult updateDcProcessConfig(DcEventType dcEventType); /** * 批量删除事件类型 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 new file mode 100644 index 00000000..bdc46528 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/IDcTrafficIncidentsService.java @@ -0,0 +1,62 @@ +package com.zc.business.service; + +import com.ruoyi.common.core.domain.AjaxResult; + +/** + * @Description 交通事件统计Service接口 + * + * @author liuwenge + * @date 2024/1/13 9:42 + */ +public interface IDcTrafficIncidentsService { + + /** + * @Description 首页-重点数据 + * + * @author liuwenge + * @date 2024/1/13 10:09 + * @param + * @return com.ruoyi.common.core.domain.AjaxResult + */ + AjaxResult getKeyData(); + + /** + * @Description 首页-事件专题-根据事件类型获取事件列表 + * + * @author liuwenge + * @date 2024/1/13 14:26 + * @param eventType + * @return com.ruoyi.common.core.domain.AjaxResult + */ + AjaxResult getEventListByType(String eventType); + + /** + * @Description 首页-事件专题-根据事件id获取详情 + * + * @author liuwenge + * @date 2024/1/13 14:43 + * @param eventId + * @return com.ruoyi.common.core.domain.AjaxResult + */ + AjaxResult getEventInfo(String eventId); + + /** + * @Description 首页-状况统计-获取日、周、月、年的交通事件数量 + * + * @author liuwenge + * @date 2024/1/13 15:08 + * @param + * @return com.ruoyi.common.core.domain.AjaxResult + */ + AjaxResult getTrafficIncidentsNum(); + + /** + * @Description 路网管控-事件管控分析-统计各类型的交通事件数量 + * + * @author liuwenge + * @date 2024/1/13 15:46 + * @param + * @return com.ruoyi.common.core.domain.AjaxResult + */ + AjaxResult getAllEventNum(); +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventTypeServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventTypeServiceImpl.java index 56cedee4..ab80aad2 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventTypeServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventTypeServiceImpl.java @@ -102,29 +102,29 @@ public class DcEventTypeServiceImpl implements IDcEventTypeService } /** - * 修改事件类型 + * 修改事件流程配置 * * @param dcEventType 事件类型 * @return 结果 */ @Override - public AjaxResult updateDcEventType(DcEventType dcEventType) + public AjaxResult updateDcProcessConfig(DcEventType dcEventType) { Integer eventType = dcEventType.getEventType(); if (eventType == null || eventType == 0){ return AjaxResult.error("修改失败,参数错误"); } - //事件类型表 - dcEventTypeMapper.updateDcEventType(dcEventType); + //先批量删除 + dcProcessConfigMapper.deleteDcProcessConfigByEventType(eventType); + //事件流程配置 List processConfigList = dcEventType.getProcessConfigList(); if (processConfigList != null && processConfigList.size() > 0){ - for (DcProcessConfig dcProcessConfig : processConfigList) { - dcProcessConfig.setEventType(dcEventType.getEventType()); + for (int i=0; i result = new HashMap<>(); + result.put("total",trafficIncidentsMapper.getTrafficIncidentsAll()); + result.put("processing",trafficIncidentsMapper.getTrafficIncidentsProcessing()); + result.put("construction",trafficIncidentsMapper.getConstructionNum()); + + return AjaxResult.success(result); + } + + /** + * @Description 首页-事件专题-根据事件类型获取事件列表 + * + * @author liuwenge + * @date 2024/1/13 14:28 + * @param eventType + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @Override + public AjaxResult getEventListByType(String eventType){ + + List> eventList = trafficIncidentsMapper.getEventListByType(eventType); + return AjaxResult.success(eventList); + } + + /** + * @Description 首页-事件专题-根据事件id获取事件详情 + * + * @author liuwenge + * @date 2024/1/13 14:45 + * @param eventId + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @Override + public AjaxResult getEventInfo(String eventId){ + DcEvent event = eventService.selectDcEventById(eventId); + return AjaxResult.success(event); + } + + /** + * @Description 首页-状况统计-获取日、周、月、年的交通事件数量 + * + * @author liuwenge + * @date 2024/1/13 15:09 + * @param + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @Override + public AjaxResult getTrafficIncidentsNum(){ + Map result = new HashMap<>(); + //本日数量 + result.put("day",trafficIncidentsMapper.selectTrafficIncidentsDay()); + //本周数量 + result.put("week",trafficIncidentsMapper.selectTrafficIncidentsWeek()); + //本月数量 + result.put("month",trafficIncidentsMapper.selectTrafficIncidentsMonth()); + //本年数量 + result.put("year",trafficIncidentsMapper.selectTrafficIncidentsYear()); + //处理中的 + result.put("processing",trafficIncidentsMapper.selectTrafficIncidentsAllProcessing()); + return AjaxResult.success(result); + } + + /** + * @Description 路网管控-事件管控分析-统计各类型的交通事件数量 + * + * @author liuwenge + * @date 2024/1/13 15:46 + * @param + * @return com.ruoyi.common.core.domain.AjaxResult + */ + @Override + public AjaxResult getAllEventNum(){ + //事件类型 + List> eventTypeList = trafficIncidentsMapper.selectEventTypeList(); + + for (Map eventType : eventTypeList) { + //该类型下的各状态事件数量 + List> eventTypeDataList = trafficIncidentsMapper.selectStatusCountByEventType(eventType.get("eventType").toString()); + + if (eventTypeDataList != null && eventTypeDataList.size() > 0){ + int total = 0; + for (Map eventTypeData : eventTypeDataList) { + + String status = eventTypeData.get("eventState").toString(); + if ("0".equals(status)) { + //待确认 + eventType.put("unconfirmed", eventTypeData.get("num")); + } else if ("1".equals(status)) { + //处理中 + eventType.put("processing", eventTypeData.get("num")); + } else if ("2".equals(status)) { + //已完成 + eventType.put("finished", eventTypeData.get("num")); + } + total += Integer.parseInt(eventTypeData.get("num").toString()); + } + eventType.put("total",total); + } else { + //待确认 + eventType.put("unconfirmed", "0"); + //处理中 + eventType.put("processing", "0"); + //已完成 + eventType.put("finished", "0"); + //总数 + eventType.put("total", "0"); + } + + } + + return AjaxResult.success(eventTypeList); + } +} diff --git a/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml new file mode 100644 index 00000000..904cd063 --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file