Browse Source

中间库事件录入

develop
lau572 6 months ago
parent
commit
c41720545d
  1. 59
      zc-business/src/main/java/com/zc/business/domain/MdEvent.java
  2. 65
      zc-business/src/main/java/com/zc/business/enums/ValueConverter.java
  3. 5
      zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java
  4. 10
      zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml

59
zc-business/src/main/java/com/zc/business/domain/MdEvent.java

@ -4,6 +4,7 @@ import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.StringUtils;
import com.zc.business.enums.ValueConverter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
@ -33,6 +34,10 @@ public class MdEvent
@Excel(name = "交通事件类型")
private String eventTypeCode;
/** 交通事件类型名称 */
@Excel(name = "交通事件类型名称")
private String eventTypeName;
/** 交通事件详情 */
@Excel(name = "交通事件详情")
private String eventDesc;
@ -99,6 +104,10 @@ public class MdEvent
@Excel(name = "交通事件类型子类")
private String eventTypeCode2;
/** 交通事件类型子类名称 */
@Excel(name = "交通事件类型子类名称")
private String eventTypeName2;
/** 交通事件原因 */
@Excel(name = "交通事件原因")
private String eventCause;
@ -534,6 +543,22 @@ public class MdEvent
return deletionTime;
}
public String getEventTypeName() {
return eventTypeName;
}
public void setEventTypeName(String eventTypeName) {
this.eventTypeName = eventTypeName;
}
public String getEventTypeName2() {
return eventTypeName2;
}
public void setEventTypeName2(String eventTypeName2) {
this.eventTypeName2 = eventTypeName2;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -576,6 +601,8 @@ public class MdEvent
.append("isDeleted", getIsDeleted())
.append("deleterUserId", getDeleterUserId())
.append("deletionTime", getDeletionTime())
.append("eventTypeName", getEventTypeName())
.append("eventTypeName2", getEventTypeName2())
.toString();
}
@ -604,6 +631,7 @@ public class MdEvent
// 11-其他事件
String eventType = dcEvent.getEventType().toString();
this.eventTypeCode = eventType;
this.eventTypeName = ValueConverter.eventTypeName(eventType);
if ("1".equals(eventType)){
DcEventAccident dcEventAccident = dcEvent.getDcEventAccident();
if (dcEventAccident != null){
@ -682,33 +710,7 @@ public class MdEvent
this.eventSourceCode = dcEvent.getEventSource();
//事件来源编码 1-96659,2-交警转接,3-道路巡查,4-视频巡查,5-视频AI,6-一键救援,7-其他
if (dcEvent.getEventSource() != null && dcEvent.getEventSource() > 0){
if (dcEvent.getEventSource() == 1){
this.eventSource = "96659";
} else if (dcEvent.getEventSource() == 2){
this.eventSource = "交警转接";
} else if (dcEvent.getEventSource() == 3){
this.eventSource = "道路巡查";
} else if (dcEvent.getEventSource() == 4){
this.eventSource = "视频巡查";
} else if (dcEvent.getEventSource() == 5){
this.eventSource = "视频AI";
} else if (dcEvent.getEventSource() == 6){
this.eventSource = "一键救援";
} else if (dcEvent.getEventSource() == 7){
this.eventSource = "其他";
} else if (dcEvent.getEventSource() == 8){
this.eventSource = "雷达识别";
} else if (dcEvent.getEventSource() == 9){
this.eventSource = "锥桶";
} else if (dcEvent.getEventSource() == 10){
this.eventSource = "护栏碰撞";
} else if (dcEvent.getEventSource() == 11){
this.eventSource = "扫码报警";
} else if (dcEvent.getEventSource() == 12){
this.eventSource = "非机预警";
} else if (dcEvent.getEventSource() == 13){
this.eventSource = "气象检测器";
}
this.eventSource = ValueConverter.eventSourceName(dcEvent.getEventSource().toString());
}
//事件状态:0-待确认,1-处理中,2-已完成
this.eventStatus = dcEvent.getEventState();
@ -719,7 +721,10 @@ public class MdEvent
this.sectionId = dcEvent.getRoadId().toString();
}
//交通事件类型子类
if (StringUtils.isNotEmpty(dcEvent.getEventSubclass())) {
this.eventTypeCode2 = dcEvent.getEventSubclass();
this.eventTypeName2 = ValueConverter.eventSubclassName(dcEvent.getEventSubclass());
}
//事件原因
this.eventCause = dcEvent.getEventCause();
}

65
zc-business/src/main/java/com/zc/business/enums/ValueConverter.java

@ -26,6 +26,8 @@ public class ValueConverter {
private static final Map<String, String> eventSourceName = new HashMap<>();
// 事件类型名称
private static final Map<String, String> eventTypeName = new HashMap<>();
// 事件子类名称
private static final Map<String, String> eventSubclassName = new HashMap<>();
// 事件字段
private static final Map<String, String> eventLabel = new HashMap<>();
@ -121,6 +123,60 @@ public class ValueConverter {
eventTypeName.put("10","异常天气");
eventTypeName.put("11","其他事件");
eventSubclassName.put("1-1","追尾");
eventSubclassName.put("1-2","侧翻");
eventSubclassName.put("1-3","撞护栏");
eventSubclassName.put("1-4","自然");
eventSubclassName.put("1-5","其他事故");
eventSubclassName.put("2-1","车辆故障");
eventSubclassName.put("3-1","主线封闭和限行");
eventSubclassName.put("3-2","收费站封闭和限行");
eventSubclassName.put("3-3","立交封闭和限行");
eventSubclassName.put("3-4","服务区封闭和限行");
eventSubclassName.put("4-1","道路拥堵");
eventSubclassName.put("4-2","立交拥堵");
eventSubclassName.put("4-3","收费站拥堵");
eventSubclassName.put("4-4","服务区拥堵");
eventSubclassName.put("5-1","行人");
eventSubclassName.put("5-2","非机动车");
eventSubclassName.put("5-3","摩托车");
eventSubclassName.put("5-4","其他");
eventSubclassName.put("6-1","烟雾");
eventSubclassName.put("6-2","倒伏树木");
eventSubclassName.put("6-3","撒落物");
eventSubclassName.put("6-4","动物");
eventSubclassName.put("6-5","其他");
eventSubclassName.put("7-1","道路养护施工");
eventSubclassName.put("7-2","收费站养护施工");
eventSubclassName.put("7-3","服务区养护施工");
eventSubclassName.put("7-4","枢纽立交匝道养护施工");
eventSubclassName.put("7-5","地方道路养护施工");
eventSubclassName.put("7-6","道路工程建设施工");
eventSubclassName.put("7-7","收费站工程建设施工");
eventSubclassName.put("7-8","服务区工程建设施工");
eventSubclassName.put("7-9","枢纽立交匝道工程建设施工");
eventSubclassName.put("7-10","地方道路工程建设施工");
eventSubclassName.put("8-1","封闭、暂停营业");
eventSubclassName.put("8-2","重要设施停用");
eventSubclassName.put("8-3","服务区其他异常");
eventSubclassName.put("9-1","摄像机");
eventSubclassName.put("9-2","护栏");
eventSubclassName.put("9-3","隔离栅");
eventSubclassName.put("9-4","情报板");
eventSubclassName.put("9-5","防炫板");
eventSubclassName.put("9-6","其他");
eventSubclassName.put("10-1","雨");
eventSubclassName.put("10-2","雪");
eventSubclassName.put("10-3","雾");
eventSubclassName.put("10-4","大风");
eventSubclassName.put("10-5","低温寒潮");
eventSubclassName.put("10-6","路面积雪");
eventSubclassName.put("10-7","路面结冰");
eventSubclassName.put("10-8","路面积水");
eventSubclassName.put("10-9","其他");
eventSubclassName.put("11-1","其他事件");
eventLabel.put("id","事件编号");
eventLabel.put("deptId","所属部门");
eventLabel.put("stakeMark","桩号");
@ -255,6 +311,11 @@ public class ValueConverter {
public static Map<String, String> getEventLabel() {
return ValueMappingHolder.eventLabel;
}
public static Map<String, String> getEventSubclassName() {
return ValueMappingHolder.eventSubclassName;
}
/**
* 根据输入值返回转换后的值
* 如果输入值不在映射中则返回输入值本身
@ -288,6 +349,10 @@ public class ValueConverter {
Map<String, String> mapping = getEventLabel();
return mapping.getOrDefault(inputValue, "");
}
public static String eventSubclassName(String inputValue) {
Map<String, String> mapping = getEventSubclassName();
return mapping.getOrDefault(inputValue, inputValue);
}
//测试
// @Test

5
zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java

@ -587,6 +587,9 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
//设置事件Id UUID无下划线格式32
String uuid = dcEvent.getId();
int i7 = dcEventMapper.insertDcEvent(dcEvent);
if (i7 > 0) {
//中间库
if (StringUtils.isNotEmpty(dcEvent.getStakeMark()) && StringUtils.isNotEmpty(dcEvent.getDirection())){
DcStakeMark dcStakeMark = dcStakeMarkMapper.selectByDirection(dcEvent.getStakeMark(),dcEvent.getDirection());
if (dcStakeMark != null){
@ -595,8 +598,6 @@ public class DcEventServiceImpl extends ServiceImpl<DcEventMapper, DcEvent> impl
}
}
if (i7 > 0) {
//中间库
MdEvent mdEvent = new MdEvent(dcEvent);
middleDatabaseService.insertMiddleDatabaseEvent(mdEvent);

10
zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml

@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fusionId != null">fusionId,</if>
<if test="eventName != null">event_name,</if>
<if test="eventTypeCode != null">event_type_code,</if>
<if test="eventTypeName != null">event_type_name,</if>
<if test="eventDesc != null">event_desc,</if>
<if test="occurTime != null">occur_time,</if>
<if test="endTime != null">end_time,</if>
@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="eventLevel != null">event_level,</if>
<if test="sectionId != null">section_id,</if>
<if test="eventTypeCode2 != null">event_type_code2,</if>
<if test="eventTypeName2 != null">event_type_name2,</if>
<if test="eventCause != null">event_cause,</if>
<if test="accidentWeather != null">accident_weather,</if>
<if test="accidentQueue != null">accident_queue,</if>
@ -79,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="fusionId != null">#{fusionId},</if>
<if test="eventName != null">#{eventName},</if>
<if test="eventTypeCode != null">#{eventTypeCode},</if>
<if test="eventTypeName != null">#{eventTypeName},</if>
<if test="eventDesc != null">#{eventDesc},</if>
<if test="occurTime != null">#{occurTime},</if>
<if test="endTime != null">#{endTime},</if>
@ -94,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="eventLevel != null">#{eventLevel},</if>
<if test="sectionId != null">#{sectionId},</if>
<if test="eventTypeCode2 != null">#{eventTypeCode2},</if>
<if test="eventTypeName2 != null">#{eventTypeName2},</if>
<if test="eventCause != null">#{eventCause},</if>
<if test="accidentWeather != null">#{accidentWeather},</if>
<if test="accidentQueue != null">#{accidentQueue},</if>
@ -238,6 +242,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mdEvent.fusionId != null">fusionId,</if>
<if test="mdEvent.eventName != null">event_name,</if>
<if test="mdEvent.eventTypeCode != null">event_type_code,</if>
<if test="mdEvent.eventTypeName != null">event_type_name,</if>
<if test="mdEvent.eventDesc != null">event_desc,</if>
<if test="mdEvent.occurTime != null">occur_time,</if>
<if test="mdEvent.endTime != null">end_time,</if>
@ -253,6 +258,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mdEvent.eventLevel != null">event_level,</if>
<if test="mdEvent.sectionId != null">section_id,</if>
<if test="mdEvent.eventTypeCode2 != null">event_type_code2,</if>
<if test="mdEvent.eventTypeName2 != null">event_type_name2,</if>
<if test="mdEvent.eventCause != null">event_cause,</if>
<if test="mdEvent.accidentWeather != null">accident_weather,</if>
<if test="mdEvent.accidentQueue != null">accident_queue,</if>
@ -278,6 +284,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mdEvent.fusionId != null">#{mdEvent.fusionId},</if>
<if test="mdEvent.eventName != null">#{mdEvent.eventName},</if>
<if test="mdEvent.eventTypeCode != null">#{mdEvent.eventTypeCode},</if>
<if test="mdEvent.eventTypeName != null">#{mdEvent.eventTypeName},</if>
<if test="mdEvent.eventDesc != null">#{mdEvent.eventDesc},</if>
<if test="mdEvent.occurTime != null">#{mdEvent.occurTime},</if>
<if test="mdEvent.endTime != null">#{mdEvent.endTime},</if>
@ -293,6 +300,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="mdEvent.eventLevel != null">#{mdEvent.eventLevel},</if>
<if test="mdEvent.sectionId != null">#{mdEvent.sectionId},</if>
<if test="mdEvent.eventTypeCode2 != null">#{mdEvent.eventTypeCode2},</if>
<if test="mdEvent.eventTypeName2 != null">#{mdEvent.eventTypeName2},</if>
<if test="mdEvent.eventCause != null">#{mdEvent.eventCause},</if>
<if test="mdEvent.accidentWeather != null">#{mdEvent.accidentWeather},</if>
<if test="mdEvent.accidentQueue != null">#{mdEvent.accidentQueue},</if>
@ -357,6 +365,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="eventName != null">event_name = #{eventName},</if>
<if test="eventTypeCode != null">event_type_code = #{eventTypeCode},</if>
<if test="eventTypeName != null">event_type_name = #{eventTypeName},</if>
<if test="eventDesc != null">event_desc = #{eventDesc},</if>
<if test="occurTime != null">occur_time = #{occurTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
@ -372,6 +381,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="eventLevel != null">event_level = #{eventLevel},</if>
<if test="sectionId != null">section_id = #{sectionId},</if>
<if test="eventTypeCode2 != null">event_type_code2 = #{eventTypeCode2},</if>
<if test="eventTypeName2 != null">event_type_name2 = #{eventTypeName2},</if>
<if test="eventCause != null">event_cause = #{eventCause},</if>
<if test="accidentWeather != null">accident_weather = #{accidentWeather},</if>
<if test="accidentQueue != null">accident_queue = #{accidentQueue},</if>

Loading…
Cancel
Save