10 changed files with 530 additions and 28 deletions
@ -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,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,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,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,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