diff --git a/zc-business/src/main/java/com/zc/business/domain/MdEvent.java b/zc-business/src/main/java/com/zc/business/domain/MdEvent.java index 5cb58fe8..8b5915b9 100644 --- a/zc-business/src/main/java/com/zc/business/domain/MdEvent.java +++ b/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(); } //交通事件类型子类 - this.eventTypeCode2 = dcEvent.getEventSubclass(); + if (StringUtils.isNotEmpty(dcEvent.getEventSubclass())) { + this.eventTypeCode2 = dcEvent.getEventSubclass(); + this.eventTypeName2 = ValueConverter.eventSubclassName(dcEvent.getEventSubclass()); + } //事件原因 this.eventCause = dcEvent.getEventCause(); } diff --git a/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java b/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java index 06f255cc..46592723 100644 --- a/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java +++ b/zc-business/src/main/java/com/zc/business/enums/ValueConverter.java @@ -26,6 +26,8 @@ public class ValueConverter { private static final Map eventSourceName = new HashMap<>(); // 事件类型名称 private static final Map eventTypeName = new HashMap<>(); + // 事件子类名称 + private static final Map eventSubclassName = new HashMap<>(); // 事件字段 private static final Map 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 getEventLabel() { return ValueMappingHolder.eventLabel; } + + public static Map getEventSubclassName() { + return ValueMappingHolder.eventSubclassName; + } + /** * 根据输入值返回转换后的值 * 如果输入值不在映射中,则返回输入值本身 @@ -288,6 +349,10 @@ public class ValueConverter { Map mapping = getEventLabel(); return mapping.getOrDefault(inputValue, ""); } + public static String eventSubclassName(String inputValue) { + Map mapping = getEventSubclassName(); + return mapping.getOrDefault(inputValue, inputValue); + } //测试 // @Test diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java index 08683621..2dada580 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcEventServiceImpl.java @@ -587,16 +587,17 @@ public class DcEventServiceImpl extends ServiceImpl impl //设置事件Id UUID无下划线格式32 String uuid = dcEvent.getId(); int i7 = dcEventMapper.insertDcEvent(dcEvent); - if (StringUtils.isNotEmpty(dcEvent.getStakeMark()) && StringUtils.isNotEmpty(dcEvent.getDirection())){ - DcStakeMark dcStakeMark = dcStakeMarkMapper.selectByDirection(dcEvent.getStakeMark(),dcEvent.getDirection()); - if (dcStakeMark != null){ - dcEvent.setLongitude(dcStakeMark.getLongitude()); - dcEvent.setDimension(dcStakeMark.getLatitude()); - } - } if (i7 > 0) { //中间库 + if (StringUtils.isNotEmpty(dcEvent.getStakeMark()) && StringUtils.isNotEmpty(dcEvent.getDirection())){ + DcStakeMark dcStakeMark = dcStakeMarkMapper.selectByDirection(dcEvent.getStakeMark(),dcEvent.getDirection()); + if (dcStakeMark != null){ + dcEvent.setLongitude(dcStakeMark.getLongitude()); + dcEvent.setDimension(dcStakeMark.getLatitude()); + } + } + MdEvent mdEvent = new MdEvent(dcEvent); middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); diff --git a/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml b/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml index 1baa680b..2ead119f 100644 --- a/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml +++ b/zc-business/src/main/resources/mapper/business/MiddleDatabaseMapper.xml @@ -39,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" fusionId, event_name, event_type_code, + event_type_name, event_desc, occur_time, end_time, @@ -54,6 +55,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" event_level, section_id, event_type_code2, + event_type_name2, event_cause, accident_weather, accident_queue, @@ -79,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{fusionId}, #{eventName}, #{eventTypeCode}, + #{eventTypeName}, #{eventDesc}, #{occurTime}, #{endTime}, @@ -94,6 +97,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{eventLevel}, #{sectionId}, #{eventTypeCode2}, + #{eventTypeName2}, #{eventCause}, #{accidentWeather}, #{accidentQueue}, @@ -238,6 +242,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" fusionId, event_name, event_type_code, + event_type_name, event_desc, occur_time, end_time, @@ -253,6 +258,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" event_level, section_id, event_type_code2, + event_type_name2, event_cause, accident_weather, accident_queue, @@ -278,6 +284,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{mdEvent.fusionId}, #{mdEvent.eventName}, #{mdEvent.eventTypeCode}, + #{mdEvent.eventTypeName}, #{mdEvent.eventDesc}, #{mdEvent.occurTime}, #{mdEvent.endTime}, @@ -293,6 +300,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{mdEvent.eventLevel}, #{mdEvent.sectionId}, #{mdEvent.eventTypeCode2}, + #{mdEvent.eventTypeName2}, #{mdEvent.eventCause}, #{mdEvent.accidentWeather}, #{mdEvent.accidentQueue}, @@ -357,6 +365,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" event_name = #{eventName}, event_type_code = #{eventTypeCode}, + event_type_name = #{eventTypeName}, event_desc = #{eventDesc}, occur_time = #{occurTime}, end_time = #{endTime}, @@ -372,6 +381,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" event_level = #{eventLevel}, section_id = #{sectionId}, event_type_code2 = #{eventTypeCode2}, + event_type_name2 = #{eventTypeName2}, event_cause = #{eventCause}, accident_weather = #{accidentWeather}, accident_queue = #{accidentQueue},