Browse Source

感知路段排名接口修改,路段范围内桩号分布接口优化

develop
wangsixiang 1 year ago
parent
commit
9212ea8bac
  1. 17
      zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java
  2. 41
      zc-business/src/main/java/com/zc/business/domain/DcWarning.java
  3. 6
      zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java
  4. 3
      zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java
  5. 13
      zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java
  6. 63
      zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

17
zc-business/src/main/java/com/zc/business/controller/DCPerceivedEventsWarningController.java

@ -119,7 +119,7 @@ public class DCPerceivedEventsWarningController extends BaseController {
return AjaxResult.error("参数数据异常");
}
if (type.equals("quarter")) {
List<HashMap<String, Object>> total = perceivedEventsWarningService.selectWarningSectionTypeCountQuarter(dcWarning);
String total = perceivedEventsWarningService.selectWarningSectionTypeCountQuarter(dcWarning);
map.put("total",total);
} else {
String total = perceivedEventsWarningService.selectWarningSectionTypeCount(dcWarning);
@ -140,8 +140,21 @@ public class DCPerceivedEventsWarningController extends BaseController {
if (StringUtils.isBlank(direction)){
return AjaxResult.error("参数异常");
}
return AjaxResult.success(perceivedEventsWarningService.selectSectionMark(dcWarning));
return AjaxResult.success(perceivedEventsWarningService.selectSectionMarkOptimize(dcWarning));
}
//查询某个路段下的全部桩号
// @PostMapping("/sectionMarkNumberOptimize")
// public AjaxResult getSectionMarkOptimize(@RequestBody DcWarning dcWarning){
// String sectionId = dcWarning.getSectionId();
// if (StringUtils.isBlank(sectionId)){
// return AjaxResult.error("参数异常");
// }
// String direction = dcWarning.getDirection();
// if (StringUtils.isBlank(direction)){
// return AjaxResult.error("参数异常");
// }
// return AjaxResult.success(perceivedEventsWarningService.selectSectionMarkOptimize(dcWarning));
// }
//预警事件,事件列表 查询状态为上报的感知事件
@PostMapping("/warningEscalation")

41
zc-business/src/main/java/com/zc/business/domain/DcWarning.java

@ -25,10 +25,7 @@ public class DcWarning extends BaseEntity
@Excel(name = "所在桩号")
private String stakeMark;
/** 方向
1-上行
2-
3-下行 */
/** 方向:1-上行2-中3-下行 */
@Excel(name = "方向: 1-上行 2-中 3-下行")
private String direction;
@ -36,30 +33,20 @@ public class DcWarning extends BaseEntity
@Excel(name = "所属部门")
private Long deptId;
/** 警情状态
1-上报
2-已完成
3-已终止
4-自动结束 */
/** 警情状态: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")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
@Excel(name = "预警时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date warningTime;
/** 处理人员 */
@Excel(name = "处理人员")
private Long userId;
/** 信息来源
1-视频AI
2-雷达识别
3-锥桶
4-护栏碰撞
5-扫码报警
6-非机预警 */
/** 信息来源:1-视频AI2-雷达识别3-锥桶4-护栏碰撞5-扫码报警6-非机预警 */
@Excel(name = "信息来源: 1-视频AI 2-雷达识别 3-锥桶 4-护栏碰撞 5-扫码报警 6-非机预警")
private Integer warningSource;
@ -67,22 +54,11 @@ public class DcWarning extends BaseEntity
@Excel(name = "预警级别")
private Integer warningLevel;
/** 事件主类
1-交通拥堵
2-行人
3-非机动车
4-停车
5-倒车/逆行
6-烟火
7-撒落物
8-异常天气
9-护栏碰撞 */
/** 事件主类: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 缓行 */
/** 事件子类:1-1 拥堵1-2 缓行 */
@Excel(name = "事件子类: 1-1 拥堵 1-2 缓行")
private String warningSubclass;
@ -112,7 +88,8 @@ public class DcWarning extends BaseEntity
private String longitude;
private String latitude;
/** 车辆类型 */
@Excel(name = "车辆类型")
private String vehicleType;
public String getVehicleType() {

6
zc-business/src/main/java/com/zc/business/mapper/DcPerceivedEventsWarningMapper.java

@ -56,7 +56,7 @@ public interface DcPerceivedEventsWarningMapper {
String selectWarningSectionTypeMonthCount(DcWarning dcWarning);
//感知事件某路段类型季占比
List<HashMap<String,Object>> selectWarningSectionTypeQuarter(DcWarning dcWarning);
List<HashMap<String,Object>> selectWarningSectionTypeQuarterCount(DcWarning dcWarning);
String selectWarningSectionTypeQuarterCount(DcWarning dcWarning);
//感知事件某路段类型年占比
List<HashMap<String,Object>> selectWarningSectionTypeYear(DcWarning dcWarning);
String selectWarningSectionTypeYearCount(DcWarning dcWarning);
@ -73,4 +73,8 @@ public interface DcPerceivedEventsWarningMapper {
String selectWarningMarkMonth(DcWarning dcWarning);
List<HashMap<String,String>> selectWarningMarkQuarter(DcWarning dcWarning);
String selectWarningMarkYear(DcWarning dcWarning);
List<HashMap<String,String>> selectWarningMarkDayOptimize(DcWarning dcWarning);
List<HashMap<String,String>> selectWarningMarkQuarterOptimize(DcWarning dcWarning);
}

3
zc-business/src/main/java/com/zc/business/service/IDCPerceivedEventsWarningService.java

@ -41,9 +41,10 @@ public interface IDCPerceivedEventsWarningService {
//感知事件某路段类型占比
List<HashMap<String,Object>> selectWarningSectionType(DcWarning dcWarning);
String selectWarningSectionTypeCount(DcWarning dcWarning);
List<HashMap<String,Object>> selectWarningSectionTypeCountQuarter(DcWarning dcWarning);
String selectWarningSectionTypeCountQuarter(DcWarning dcWarning);
//查询某个路段下的全部桩号
List<HashMap<String,Object>> selectSectionMark(DcWarning dcWarning);
List<HashMap<String,String>> selectSectionMarkOptimize(DcWarning dcWarning);
//预警事件,事件列表 查询状态为上报的感知事件
List<HashMap<String,Object>> selectWarningEscalation(DcWarning dcWarning);
//修改感知事件信息

13
zc-business/src/main/java/com/zc/business/service/impl/DcPerceivedEventsWarningServiceImpl.java

@ -8,6 +8,7 @@ import com.zc.business.service.IDCPerceivedEventsWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.sound.midi.Soundbank;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@ -159,7 +160,7 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa
}
@Override
public List<HashMap<String,Object>> selectWarningSectionTypeCountQuarter(DcWarning dcWarning) {
public String selectWarningSectionTypeCountQuarter(DcWarning dcWarning) {
if (dcWarning.getType().equals("quarter")==false){
return null;
}
@ -209,6 +210,16 @@ public class DcPerceivedEventsWarningServiceImpl implements IDCPerceivedEventsWa
}
@Override
public List<HashMap<String, String>> selectSectionMarkOptimize(DcWarning dcWarning) {
if (dcWarning.getType().equals("quarter")){
return perceivedEventsWarningMapper.selectWarningMarkQuarterOptimize(dcWarning);
}else {
return perceivedEventsWarningMapper.selectWarningMarkDayOptimize(dcWarning);
}
}
//预警事件,事件列表 查询状态为上报的感知事件
@Override
public List<HashMap<String, Object>> selectWarningEscalation(DcWarning dcWarning) {

63
zc-business/src/main/resources/mapper/business/DcPerceivedEventsWarningMapper.xml

@ -39,19 +39,25 @@
</where>
</select>
<select id="selectSectionPerceivedEventsList" resultType="hashmap">
SELECT COUNT(1) as number,section.section_name sectionName FROM dc_warning AS warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark
LEFT JOIN dc_road_section AS section ON mark.section_id=section.id
where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
group by section.section_name
select s.section_name sectionName,
(select COUNT(1) FROM `dc_warning` as w where
DATE_FORMAT(w.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
and mark.stake_mark=w.stake_mark)number from dc_warning as w
left JOIN dc_stake_mark as mark ON mark.stake_mark=w.stake_mark
LEFT JOIN dc_road_section as s ON mark.section_id=s.id
where mark.stake_mark is not null
group by w.stake_mark
order by number desc
</select>
<select id="selectSectionPerceivedNumber" resultType="java.util.HashMap">
SELECT COUNT(1) as number,section.section_name sectionName FROM dc_warning AS warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark
LEFT JOIN dc_road_section AS section ON mark.section_id=section.id
where DATE_FORMAT(warning.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
group by section.section_name
select s.section_name sectionName,
(select COUNT(1) FROM `dc_warning` as w where
DATE_FORMAT(w.create_time,'%Y-%m-%d')=DATE_FORMAT(#{createTime},'%Y-%m-%d')
and mark.stake_mark=w.stake_mark)number from dc_warning as w
left JOIN dc_stake_mark as mark ON mark.stake_mark=w.stake_mark
LEFT JOIN dc_road_section as s ON mark.section_id=s.id
where mark.stake_mark is not null
group by w.stake_mark
</select>
<select id="selectDailyCumulative" resultType="java.util.HashMap">
SELECT DATE_FORMAT(create_time, '%Y-%m-%d %H') AS time, COUNT(*) AS number
@ -168,20 +174,14 @@
GROUP BY warning_type
ORDER BY number DESC
</select>
<select id="selectWarningSectionTypeQuarterCount" resultType="hashmap">
<select id="selectWarningSectionTypeQuarterCount" resultType="string">
SELECT
CASE
WHEN MONTH(warning.create_time) BETWEEN 1 AND 3 THEN '第一季度'
WHEN MONTH(warning.create_time) BETWEEN 4 AND 6 THEN '第二季度'
WHEN MONTH(warning.create_time) BETWEEN 7 AND 9 THEN '第三季度'
ELSE '第四季度'
END AS QUARTER,COUNT(*) AS number
COUNT(*) AS number
FROM dc_warning as warning
LEFT JOIN dc_stake_mark AS mark ON warning.stake_mark=mark.stake_mark
WHERE YEAR(warning.create_time) =DATE_FORMAT(#{createTime},'%Y')
AND warning.direction=#{direction}
and mark.`section_id`=#{sectionId}
GROUP BY QUARTER
</select>
<select id="selectWarningSectionTypeQuarter" resultType="java.util.HashMap">
SELECT
@ -278,7 +278,7 @@
END AS QUARTER
from dc_warning where stake_mark=#{stakeMark} and
YEAR(create_time) =DATE_FORMAT(#{createTime},'%Y')
AND direction=#{direction}
AND direction=#{direction} and stake_mark is not null
GROUP BY QUARTER
ORDER BY QUARTER;
</select>
@ -286,5 +286,30 @@
select count(1) from dc_warning
</select>
<select id="selectWarningMarkQuarterOptimize" resultType="java.util.HashMap">
SELECT count( 1 ) sectionNumber,
CASE
WHEN MONTH ( w.create_time ) BETWEEN 1 AND 3 THEN '第一季度'
WHEN MONTH ( w.create_time ) BETWEEN 4 AND 6 THEN '第二季度'
WHEN MONTH ( w.create_time ) BETWEEN 7 AND 9 THEN '第三季度'
ELSE '第四季度'
END AS QUARTER
FROM dc_warning w
LEFT JOIN dc_stake_mark m ON w.stake_mark = m.stake_mark
WHERE m.stake_mark IS NOT null and w.direction=#{direction}
and YEAR(w.create_time) =DATE_FORMAT(#{createTime},'%Y')
GROUP BY QUARTER
ORDER BY QUARTER;
</select>
<select id="selectWarningMarkDayOptimize" resultType="java.util.HashMap">
SELECT DISTINCT m.stake_mark stakeMarkId,
(SELECT count( 0 ) FROM dc_warning w WHERE w.stake_mark = m.stake_mark
<if test = 'type == "day"' >and DATE(w.create_time)= DATE_FORMAT(#{createTime},'%Y-%m-%d')</if>
<if test = 'type == "month"' >and DATE_FORMAT(w.create_time,'%Y-%m') =DATE_FORMAT(#{createTime},'%Y-%m')</if>
<if test = 'type == "year"' >and YEAR(w.create_time) =DATE_FORMAT(#{createTime},'%Y')</if>
AND w.direction = #{direction}) sectionNumber FROM dc_stake_mark AS m
WHERE m.section_id = #{sectionId}
</select>
</mapper>
Loading…
Cancel
Save