mengff
11 months ago
42 changed files with 1186 additions and 163 deletions
@ -0,0 +1,46 @@ |
|||
package com.zc.business.controller; |
|||
|
|||
import com.ruoyi.common.core.controller.BaseController; |
|||
import com.ruoyi.common.core.domain.AjaxResult; |
|||
import com.zc.business.domain.DcWarning; |
|||
import com.zc.business.service.IDCPerceivedEventsWarningService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.web.bind.annotation.PostMapping; |
|||
import org.springframework.web.bind.annotation.RequestBody; |
|||
import org.springframework.web.bind.annotation.RequestMapping; |
|||
import org.springframework.web.bind.annotation.RestController; |
|||
|
|||
/** |
|||
* @author 王思祥 |
|||
* @ClassName DCPerceivedEventsWarningController |
|||
*/ |
|||
@RestController |
|||
@RequestMapping("/perceivedEvents/warning") |
|||
|
|||
public class DCPerceivedEventsWarningController extends BaseController { |
|||
@Autowired |
|||
private IDCPerceivedEventsWarningService perceivedEventsWarningService; |
|||
//查询预警表与历史表所有感知事件的数量
|
|||
@PostMapping("/warningTotal") |
|||
public AjaxResult getPerceivedEventsWarning(){ |
|||
return AjaxResult.success(perceivedEventsWarningService.perceivedEventsWarningNum()); |
|||
} |
|||
|
|||
//感知事件类型
|
|||
@PostMapping("/evenType") |
|||
public AjaxResult getEvenTypeList(){ |
|||
return AjaxResult.success(perceivedEventsWarningService.selectEventTypeList()); |
|||
} |
|||
|
|||
//查询预警感知事件类型
|
|||
@PostMapping("/warningType") |
|||
public AjaxResult getWarningTypeList(){ |
|||
return AjaxResult.success(perceivedEventsWarningService.selectWarningTypeList()); |
|||
} |
|||
//根据类型查询预计事件
|
|||
@PostMapping("/perceivedEventsList") |
|||
public AjaxResult getPerceivedEventsList(@RequestBody DcWarning dcWarning){ |
|||
return AjaxResult.success(perceivedEventsWarningService.selectPerceivedEventsList(dcWarning)); |
|||
} |
|||
|
|||
} |
@ -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(); |
|||
} |
|||
} |
@ -0,0 +1,235 @@ |
|||
package com.zc.business.domain; |
|||
|
|||
import java.util.Date; |
|||
import com.fasterxml.jackson.annotation.JsonFormat; |
|||
import org.apache.commons.lang3.builder.ToStringBuilder; |
|||
import org.apache.commons.lang3.builder.ToStringStyle; |
|||
import com.ruoyi.common.annotation.Excel; |
|||
import com.ruoyi.common.core.domain.BaseEntity; |
|||
|
|||
/** |
|||
* 预警信息对象 dc_warning |
|||
* |
|||
* @author ruoyi |
|||
* @date 2024-01-13 |
|||
*/ |
|||
public class DcWarning extends BaseEntity |
|||
{ |
|||
private static final long serialVersionUID = 1L; |
|||
|
|||
/** 预警编号 */ |
|||
private Long id; |
|||
|
|||
/** 所在桩号 */ |
|||
@Excel(name = "所在桩号") |
|||
private String stakeMarkId; |
|||
|
|||
/** 方向: |
|||
1-上行 |
|||
2-中 |
|||
3-下行 */ |
|||
@Excel(name = "方向: 1-上行 2-中 3-下行") |
|||
private String direction; |
|||
|
|||
/** 所属部门 */ |
|||
@Excel(name = "所属部门") |
|||
private Long deptId; |
|||
|
|||
/** 警情状态: |
|||
1-上报 |
|||
2-已完成 |
|||
3-已终止 |
|||
4-自动结束 */ |
|||
@Excel(name = "警情状态: 1-上报 2-已完成 3-已终止 4-自动结束") |
|||
private Integer warningState; |
|||
|
|||
/** 预警时间 */ |
|||
@JsonFormat(pattern = "yyyy-MM-dd") |
|||
@Excel(name = "预警时间", width = 30, dateFormat = "yyyy-MM-dd") |
|||
private Date warningTime; |
|||
|
|||
/** 处理人员 */ |
|||
@Excel(name = "处理人员") |
|||
private Long userId; |
|||
|
|||
/** 信息来源: |
|||
1-视频AI |
|||
2-雷达识别 |
|||
3-锥桶 |
|||
4-护栏碰撞 |
|||
5-扫码报警 |
|||
6-非机预警 */ |
|||
@Excel(name = "信息来源: 1-视频AI 2-雷达识别 3-锥桶 4-护栏碰撞 5-扫码报警 6-非机预警") |
|||
private Integer warningSource; |
|||
|
|||
/** 预警级别 */ |
|||
@Excel(name = "预警级别") |
|||
private Integer warningLevel; |
|||
|
|||
/** 事件主类: |
|||
1-交通拥堵 |
|||
2-行人 |
|||
3-非机动车 |
|||
4-停车 |
|||
5-倒车/逆行 |
|||
6-烟火 |
|||
7-撒落物 |
|||
8-异常天气 |
|||
9-护栏碰撞 */ |
|||
@Excel(name = "事件主类: 1-交通拥堵 2-行人 3-非机动车 4-停车 5-倒车/逆行 6-烟火 7-撒落物 8-异常天气 9-护栏碰撞") |
|||
private Integer warningType; |
|||
|
|||
/** 事件子类: |
|||
1-1 拥堵 |
|||
1-2 缓行 */ |
|||
@Excel(name = "事件子类: 1-1 拥堵 1-2 缓行") |
|||
private String warningSubclass; |
|||
|
|||
/** 事件标题 */ |
|||
@Excel(name = "事件标题") |
|||
private String warningTitle; |
|||
|
|||
/** $column.columnComment */ |
|||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()") |
|||
private String otherConfig; |
|||
|
|||
public void setId(Long id) |
|||
{ |
|||
this.id = id; |
|||
} |
|||
|
|||
public Long getId() |
|||
{ |
|||
return id; |
|||
} |
|||
public void setStakeMarkId(String stakeMarkId) |
|||
{ |
|||
this.stakeMarkId = stakeMarkId; |
|||
} |
|||
|
|||
public String getStakeMarkId() |
|||
{ |
|||
return stakeMarkId; |
|||
} |
|||
public void setDirection(String direction) |
|||
{ |
|||
this.direction = direction; |
|||
} |
|||
|
|||
public String getDirection() |
|||
{ |
|||
return direction; |
|||
} |
|||
public void setDeptId(Long deptId) |
|||
{ |
|||
this.deptId = deptId; |
|||
} |
|||
|
|||
public Long getDeptId() |
|||
{ |
|||
return deptId; |
|||
} |
|||
public void setWarningState(Integer warningState) |
|||
{ |
|||
this.warningState = warningState; |
|||
} |
|||
|
|||
public Integer getWarningState() |
|||
{ |
|||
return warningState; |
|||
} |
|||
public void setWarningTime(Date warningTime) |
|||
{ |
|||
this.warningTime = warningTime; |
|||
} |
|||
|
|||
public Date getWarningTime() |
|||
{ |
|||
return warningTime; |
|||
} |
|||
public void setUserId(Long userId) |
|||
{ |
|||
this.userId = userId; |
|||
} |
|||
|
|||
public Long getUserId() |
|||
{ |
|||
return userId; |
|||
} |
|||
public void setWarningSource(Integer warningSource) |
|||
{ |
|||
this.warningSource = warningSource; |
|||
} |
|||
|
|||
public Integer getWarningSource() |
|||
{ |
|||
return warningSource; |
|||
} |
|||
public void setWarningLevel(Integer warningLevel) |
|||
{ |
|||
this.warningLevel = warningLevel; |
|||
} |
|||
|
|||
public Integer getWarningLevel() |
|||
{ |
|||
return warningLevel; |
|||
} |
|||
public void setWarningType(Integer warningType) |
|||
{ |
|||
this.warningType = warningType; |
|||
} |
|||
|
|||
public Integer getWarningType() |
|||
{ |
|||
return warningType; |
|||
} |
|||
public void setWarningSubclass(String warningSubclass) |
|||
{ |
|||
this.warningSubclass = warningSubclass; |
|||
} |
|||
|
|||
public String getWarningSubclass() |
|||
{ |
|||
return warningSubclass; |
|||
} |
|||
public void setWarningTitle(String warningTitle) |
|||
{ |
|||
this.warningTitle = warningTitle; |
|||
} |
|||
|
|||
public String getWarningTitle() |
|||
{ |
|||
return warningTitle; |
|||
} |
|||
public void setOtherConfig(String otherConfig) |
|||
{ |
|||
this.otherConfig = otherConfig; |
|||
} |
|||
|
|||
public String getOtherConfig() |
|||
{ |
|||
return otherConfig; |
|||
} |
|||
|
|||
@Override |
|||
public String toString() { |
|||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
|||
.append("id", getId()) |
|||
.append("stakeMarkId", getStakeMarkId()) |
|||
.append("direction", getDirection()) |
|||
.append("deptId", getDeptId()) |
|||
.append("warningState", getWarningState()) |
|||
.append("warningTime", getWarningTime()) |
|||
.append("userId", getUserId()) |
|||
.append("warningSource", getWarningSource()) |
|||
.append("warningLevel", getWarningLevel()) |
|||
.append("remark", getRemark()) |
|||
.append("createTime", getCreateTime()) |
|||
.append("updateTime", getUpdateTime()) |
|||
.append("warningType", getWarningType()) |
|||
.append("warningSubclass", getWarningSubclass()) |
|||
.append("warningTitle", getWarningTitle()) |
|||
.append("otherConfig", getOtherConfig()) |
|||
.toString(); |
|||
} |
|||
} |
@ -0,0 +1,27 @@ |
|||
package com.zc.business.mapper; |
|||
|
|||
import cn.hutool.core.lang.hash.Hash; |
|||
import com.zc.business.domain.DcEventType; |
|||
import com.zc.business.domain.DcWarning; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 王思祥 |
|||
* @ClassName DcPerceivedEventsWarningMapper |
|||
*/ |
|||
|
|||
public interface DcPerceivedEventsWarningMapper { |
|||
|
|||
//查询预警信息表数量
|
|||
int perceivedEventsWarningNum(); |
|||
//查询历史预警信息表数量
|
|||
int perceivedEventsWarningHistoryNum(); |
|||
//感知事件类型
|
|||
List<DcEventType> selectEventTypeList(); |
|||
//查询预警感知事件类型
|
|||
List<HashMap<String,Object>> selectWarningTypeList(); |
|||
//根据类型查询预计事件
|
|||
List<DcWarning> selectPerceivedEventsList(DcWarning dcWarning); |
|||
} |
@ -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); |
|||
|
|||
|
|||
} |
@ -0,0 +1,23 @@ |
|||
package com.zc.business.service; |
|||
|
|||
import com.zc.business.domain.DcEventType; |
|||
import com.zc.business.domain.DcWarning; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 王思祥 |
|||
* @ClassName IDCPerceivedEventsWarningService |
|||
*/ |
|||
|
|||
public interface IDCPerceivedEventsWarningService { |
|||
//查询预警表所有感知事件的数量
|
|||
int perceivedEventsWarningNum(); |
|||
//感知事件类型
|
|||
List<DcEventType> selectEventTypeList(); |
|||
//查询预警感知事件类型
|
|||
List<HashMap<String,Object>> selectWarningTypeList(); |
|||
//根据类型查询预计事件
|
|||
List<DcWarning> selectPerceivedEventsList(DcWarning dcWarning); |
|||
} |
@ -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(); |
|||
} |
@ -0,0 +1,44 @@ |
|||
package com.zc.business.service.impl; |
|||
|
|||
import com.zc.business.domain.DcEventType; |
|||
import com.zc.business.domain.DcWarning; |
|||
import com.zc.business.mapper.DcPerceivedEventsWarningMapper; |
|||
import com.zc.business.service.IDCPerceivedEventsWarningService; |
|||
import org.springframework.beans.factory.annotation.Autowired; |
|||
import org.springframework.stereotype.Service; |
|||
|
|||
import java.util.HashMap; |
|||
import java.util.List; |
|||
|
|||
/** |
|||
* @author 王思祥 |
|||
* @ClassName DcPerceivedEventsWarningServiceImpl |
|||
*/ |
|||
@Service |
|||
public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWarningService { |
|||
@Autowired |
|||
private DcPerceivedEventsWarningMapper perceivedEventsWarningMapper; |
|||
|
|||
|
|||
@Override |
|||
public int perceivedEventsWarningNum() { |
|||
int warningNum = perceivedEventsWarningMapper.perceivedEventsWarningNum();//预警表数量
|
|||
int warningHistoryNum = perceivedEventsWarningMapper.perceivedEventsWarningHistoryNum();//历史预警数量
|
|||
return warningNum+warningHistoryNum; |
|||
} |
|||
//感知事件类型
|
|||
@Override |
|||
public List<DcEventType> selectEventTypeList() { |
|||
return perceivedEventsWarningMapper.selectEventTypeList(); |
|||
} |
|||
//查询预警感知事件类型
|
|||
@Override |
|||
public List<HashMap<String, Object>> selectWarningTypeList() { |
|||
return perceivedEventsWarningMapper.selectWarningTypeList(); |
|||
} |
|||
//根据类型查询预计事件
|
|||
@Override |
|||
public List<DcWarning> selectPerceivedEventsList(DcWarning dcWarning) { |
|||
return perceivedEventsWarningMapper.selectPerceivedEventsList(dcWarning); |
|||
} |
|||
} |
@ -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); |
|||
} |
|||
} |
@ -0,0 +1,30 @@ |
|||
<?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.DcPerceivedEventsWarningMapper"> |
|||
|
|||
|
|||
<select id="perceivedEventsWarningNum" resultType="java.lang.Integer"> |
|||
select count(1) from dc_warning |
|||
</select> |
|||
<select id="perceivedEventsWarningHistoryNum" resultType="java.lang.Integer"> |
|||
select count(1) from dc_warning_history |
|||
</select> |
|||
<select id="selectEventTypeList" resultType="com.zc.business.domain.DcEventType"> |
|||
select event_type, event_name from dc_event_type |
|||
</select> |
|||
<select id="selectWarningTypeList" resultType="java.util.HashMap"> |
|||
select event_type eventType,event_subclass eventSubclass from dc_event |
|||
</select> |
|||
<select id="selectPerceivedEventsList" resultType="com.zc.business.domain.DcWarning"> |
|||
select `id`,`stake_mark_id`, `direction`,`dept_id`, `warning_state`,`warning_time`,`user_id`, |
|||
`warning_source`,`warning_level`, `remark`, `create_time`,`update_time`,`warning_type`, |
|||
`warning_subclass`,`warning_title`,`other_config` from dc_warning |
|||
<where> |
|||
<if test="warningType != null and warningType != ''"> and warning_type = #{warningType}</if> |
|||
<if test="warningSubclass != null and warningSubclass != ''"> and warning_subclass = #{warningSubclass}</if> |
|||
</where> |
|||
</select> |
|||
|
|||
</mapper> |
@ -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…
Reference in new issue