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 cd6838c7..2d6e93a7 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 @@ -649,48 +649,61 @@ public class MdEvent String eventType = dcEvent.getEventType().toString(); if ("1".equals(eventType)){ DcEventAccident dcEventAccident = dcEvent.getDcEventAccident(); - //事故天气情况 - this.accidentWeather = dcEventAccident.getWeatherCondition(); - //事故压车(公里) - this.accidentQueue = new BigDecimal(Float.toString(dcEventAccident.getTrafficJam())); + if (dcEventAccident != null){ + //事故天气情况 + this.accidentWeather = dcEventAccident.getWeatherCondition(); + //事故压车(公里) + this.accidentQueue = new BigDecimal(Float.toString(dcEventAccident.getTrafficJam())); + } } else if ("2".equals(eventType)){ DcEventVehicleAccident dcEventVehicleAccident = dcEvent.getDcEventVehicleAccident(); - //事故天气情况 - this.accidentWeather = dcEventVehicleAccident.getWeatherCondition(); - //事故压车(公里) - this.accidentQueue = new BigDecimal(Float.toString(dcEventVehicleAccident.getTrafficJam())); + if (dcEventVehicleAccident != null) { + //事故天气情况 + this.accidentWeather = dcEventVehicleAccident.getWeatherCondition(); + //事故压车(公里) + this.accidentQueue = new BigDecimal(Float.toString(dcEventVehicleAccident.getTrafficJam())); + } } else if ("3".equals(eventType)){ DcEventTrafficControl dcEventTrafficControl = dcEvent.getDcEventTrafficControl(); - //管制分类 - this.controlCategory = dcEventTrafficControl.getControlType(); - //管制原因类型 - this.controlReasonType = dcEventTrafficControl.getControlCause().toString(); - //管制出入口 - this.controlStation = dcEventTrafficControl.getFacilityId(); - //管制措施 - this.controlStrategy = dcEventTrafficControl.getMeasure(); - //管制限制类型 - this.controlType = dcEventTrafficControl.getLimitedType(); - //管制车辆类型 - this.controlVehicleType = dcEventTrafficControl.getVehicleType(); + if (dcEventTrafficControl != null) { + //管制分类 + this.controlCategory = dcEventTrafficControl.getControlType(); + //管制原因类型 + this.controlReasonType = dcEventTrafficControl.getControlCause().toString(); + //管制出入口 + this.controlStation = dcEventTrafficControl.getFacilityId(); + //管制措施 + this.controlStrategy = dcEventTrafficControl.getMeasure(); + //管制限制类型 + this.controlType = dcEventTrafficControl.getLimitedType(); + //管制车辆类型 + this.controlVehicleType = dcEventTrafficControl.getVehicleType(); + } } else if ("4".equals(eventType)){ DcEventTrafficCongestion dcEventTrafficCongestion = dcEvent.getDcEventTrafficCongestion(); - //拥堵里程(公里) - this.congestionPile = dcEventTrafficCongestion.getCongestionMileage().longValue(); - //拥堵原因 - this.congestionReason = dcEventTrafficCongestion.getCongestionCause(); + if (dcEventTrafficCongestion != null) { + //拥堵里程(公里) + this.congestionPile = dcEventTrafficCongestion.getCongestionMileage().longValue(); + //拥堵原因 + this.congestionReason = dcEventTrafficCongestion.getCongestionCause(); + } } else if ("7".equals(eventType)){ DcEventConstruction dcEventConstruction = dcEvent.getDcEventConstruction(); - //管制分类 - this.controlCategory = dcEventConstruction.getControlMode(); + if (dcEventConstruction != null) { + //管制分类 + this.controlCategory = dcEventConstruction.getControlMode(); + } } else if ("8".equals(eventType)){ DcEventServiceArea dcEventServiceArea = dcEvent.getDcEventServiceArea(); - //管制出入口 - this.controlStation = dcEventServiceArea.getFacilityId(); + if (dcEventServiceArea != null) { + //管制出入口 + this.controlStation = dcEventServiceArea.getFacilityId(); + } } else if ("10".equals(eventType)){ DcEventAbnormalWeather dcEventAbnormalWeather = dcEvent.getDcEventAbnormalWeather(); + if (dcEventAbnormalWeather != null){ - + } } } 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 aba999b6..c83f4be3 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 @@ -129,8 +129,8 @@ public class DcEventServiceImpl implements IDcEventService { if (i7 > 0) { //中间库 -// MdEvent mdEvent = new MdEvent(dcEvent); -// middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); + MdEvent mdEvent = new MdEvent(dcEvent); + middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); //获取事件类型 int eventType = Math.toIntExact(dcEvent.getEventType()); @@ -224,8 +224,8 @@ public class DcEventServiceImpl implements IDcEventService { if (i7 > 0) { //中间库 -// MdEvent mdEvent = new MdEvent(dcEvent); -// middleDatabaseService.updateMiddleDatabaseEvent(mdEvent); + MdEvent mdEvent = new MdEvent(dcEvent); + middleDatabaseService.updateMiddleDatabaseEvent(mdEvent); int eventType = Math.toIntExact(dcEvent.getEventType()); switch (eventType) {