Browse Source

Merge remote-tracking branch 'origin/develop' into develop

develop
zhao-meiyu 1 year ago
parent
commit
7ded9765b8
  1. 32
      zc-business/src/main/java/com/zc/business/controller/DcEventTypeController.java
  2. 97
      zc-business/src/main/java/com/zc/business/controller/DcTrafficIncidentsController.java
  3. 4
      zc-business/src/main/java/com/zc/business/domain/DcEventType.java
  4. 2
      zc-business/src/main/java/com/zc/business/domain/DcProcessConfig.java
  5. 125
      zc-business/src/main/java/com/zc/business/mapper/DcTrafficIncidentsMapper.java
  6. 2
      zc-business/src/main/java/com/zc/business/service/IDcEventTypeService.java
  7. 62
      zc-business/src/main/java/com/zc/business/service/IDcTrafficIncidentsService.java
  8. 16
      zc-business/src/main/java/com/zc/business/service/impl/DcEventTypeServiceImpl.java
  9. 153
      zc-business/src/main/java/com/zc/business/service/impl/DcTrafficIncidentsServiceImpl.java
  10. 65
      zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml

32
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<DcEventType> list = dcEventTypeService.selectDcEventTypeList(dcEventType);
ExcelUtil<DcEventType> 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}")

97
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();
}
}

4
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;

2
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;
/** 处置流程 */

125
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<java.lang.String,java.lang.Object>
*/
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<java.util.Map<java.lang.String,java.lang.Object>>
*/
List<Map<String,Object>> getEventListByType(String eventType);
/**
* @Description 获取本日的交通事件数量
*
* @author liuwenge
* @date 2024/1/13 15:11
* @param
* @return java.util.Map<java.lang.String,java.lang.Object>
*/
Long selectTrafficIncidentsDay();
/**
* @Description 获取本周的交通事件数量
*
* @author liuwenge
* @date 2024/1/13 15:11
* @param
* @return java.util.Map<java.lang.String,java.lang.Object>
*/
Long selectTrafficIncidentsWeek();
/**
* @Description 获取本月的交通事件数量
*
* @author liuwenge
* @date 2024/1/13 15:11
* @param
* @return java.util.Map<java.lang.String,java.lang.Object>
*/
Long selectTrafficIncidentsMonth();
/**
* @Description 获取本年的交通事件数量
*
* @author liuwenge
* @date 2024/1/13 15:11
* @param
* @return java.util.Map<java.lang.String,java.lang.Object>
*/
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<java.util.Map<java.lang.String,java.lang.Object>>
*/
List<Map<String,Object>> selectEventTypeList();
/**
* @Description 查询各个处理状态数量
*
* @author liuwenge
* @date 2024/1/13 15:57
* @param
* @return java.util.Map<java.lang.String,java.lang.Object>
*/
List<Map<String,Object>> selectStatusCountByEventType(String eventType);
}

2
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);
/**
* 批量删除事件类型

62
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();
}

16
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<DcProcessConfig> processConfigList = dcEventType.getProcessConfigList();
if (processConfigList != null && processConfigList.size() > 0){
for (DcProcessConfig dcProcessConfig : processConfigList) {
dcProcessConfig.setEventType(dcEventType.getEventType());
for (int i=0; i<processConfigList.size(); i++) {
processConfigList.get(i).setEventType(dcEventType.getEventType());
processConfigList.get(i).setNodeNode(String.valueOf(i+1));
}
//先批量删除
dcProcessConfigMapper.deleteDcProcessConfigByEventType(eventType);
//重新添加
dcProcessConfigMapper.insertDcProcessConfigByList(processConfigList);
}

153
zc-business/src/main/java/com/zc/business/service/impl/DcTrafficIncidentsServiceImpl.java

@ -0,0 +1,153 @@
package com.zc.business.service.impl;
import com.ruoyi.common.core.domain.AjaxResult;
import com.zc.business.domain.DcEvent;
import com.zc.business.domain.DcEventType;
import com.zc.business.mapper.DcTrafficIncidentsMapper;
import com.zc.business.service.IDcTrafficIncidentsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @Description 交通事件统计Service业务层处理
*
* @author liuwenge
* @date 2024/1/13 9:45
*/
@Service
public class DcTrafficIncidentsServiceImpl implements IDcTrafficIncidentsService{
@Autowired
private DcTrafficIncidentsMapper trafficIncidentsMapper;
@Autowired
private DcEventServiceImpl eventService;
/**
* @Description 首页-重点数据
*
* @author liuwenge
* @date 2024/1/13 10:10
* @param
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@Override
public AjaxResult getKeyData(){
Map<String,Object> 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<Map<String,Object>> 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<String,Object> 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<Map<String,Object>> eventTypeList = trafficIncidentsMapper.selectEventTypeList();
for (Map<String, Object> eventType : eventTypeList) {
//该类型下的各状态事件数量
List<Map<String,Object>> eventTypeDataList = trafficIncidentsMapper.selectStatusCountByEventType(eventType.get("eventType").toString());
if (eventTypeDataList != null && eventTypeDataList.size() > 0){
int total = 0;
for (Map<String, Object> 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);
}
}

65
zc-business/src/main/resources/mapper/business/DcTrafficIncidentsMapper.xml

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zc.business.mapper.DcTrafficIncidentsMapper">
<select id="getTrafficIncidentsProcessing" resultType="Integer">
select count(*) from dc_event
where event_type = '1' and event_state != '2' and date_format(create_time,'%y%m%d') = date_format(now(),'%y%m%d')
</select>
<select id="getTrafficIncidentsAll" resultType="Integer">
select count(*) from dc_event
where event_type = '1' and date_format(create_time,'%y%m%d') = date_format(now(),'%y%m%d')
</select>
<select id="getConstructionNum" resultType="java.lang.Integer">
select count(*) from dc_event
where event_type = '7' and event_state != '2'
</select>
<select id="getEventListByType" resultType="java.util.Map" parameterType="String">
select t1.id,t1.stake_mark stakeMark,t1.direction, t2.longitude,t2.latitude
from dc_event t1 left join dc_stake_mark t2 on t1.stake_mark = t2.id and t1.direction = t2.direction
where t1.event_type = #{eventType}
</select>
<select id="selectTrafficIncidentsDay" resultType="Long">
select count(*) from dc_event
where date_format(create_time,'%y%m%d') = date_format(now(),'%y%m%d')
</select>
<select id="selectTrafficIncidentsWeek" resultType="Long">
select count(*) from dc_event
where YEARWEEK(create_time, 1) = YEARWEEK(now(), 1)
</select>
<select id="selectTrafficIncidentsMonth" resultType="Long">
select count(*) from dc_event
where date_format(create_time,'%y%m') = date_format(now(),'%y%m')
</select>
<select id="selectTrafficIncidentsYear" resultType="Long">
select count(*) from dc_event
where date_format(create_time,'%y') = date_format(now(),'%y')
</select>
<select id="selectTrafficIncidentsAllProcessing" resultType="java.lang.Long">
select count(*) from dc_event
where event_state != '2'
</select>
<select id="selectEventTypeList" resultType="java.util.Map">
select event_type eventType,event_name eventName from dc_event_type
</select>
<select id="selectStatusCountByEventType" resultType="java.util.Map" parameterType="String">
select event_state eventState,count(*) num from dc_event
where event_type = #{eventType} and date_format(create_time,'%y%m%d') = date_format(now(),'%y%m%d')
group by event_state
</select>
</mapper>
Loading…
Cancel
Save