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 93e28879..5fc4be0f 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 @@ -60,6 +60,7 @@ public class DcEventServiceImpl implements IDcEventService { @Autowired private IMiddleDatabaseService middleDatabaseService; //查询路网信息 + @Autowired private DcFacilityServiceImpl dcFacilityService; @@ -115,6 +116,8 @@ public class DcEventServiceImpl implements IDcEventService { */ @Override public int insertDcEvent(DcEvent dcEvent) { + //获取事件类型 + int eventType = Math.toIntExact(dcEvent.getEventType()); //设置事件Id UUID无下划线格式32 String uuid = IdUtils.fastSimpleUUID(); @@ -129,35 +132,37 @@ public class DcEventServiceImpl implements IDcEventService { //处理无桩号事件 //交通事故 - if (dcEvent.getDcEventAccident().getFacilityId() != null) { + if (eventType ==1&& dcEvent.getDcEventAccident().getFacilityId() != null) { String facilityId = String.valueOf(dcEvent.getDcEventAccident().getFacilityId()); - dcEvent.setStakeMark( extracted(facilityId)); + dcEvent.setStakeMark( extracted(facilityId)); } //车辆事故 - if (dcEvent.getDcEventVehicleAccident().getFacilityId() != null) { + if (eventType ==2 && dcEvent.getDcEventVehicleAccident().getFacilityId() != null) { String facilityId = String.valueOf(dcEvent.getDcEventVehicleAccident().getFacilityId()); dcEvent.setStakeMark( extracted(facilityId)); } //交通管制 - if (dcEvent.getDcEventTrafficControl().getFacilityId() != null) { + if (eventType ==3 && dcEvent.getDcEventTrafficControl().getFacilityId() != null) { String facilityId = String.valueOf(dcEvent.getDcEventTrafficControl().getFacilityId()); dcEvent.setStakeMark( extracted(facilityId)); } //交通拥堵 - if (dcEvent.getDcEventTrafficCongestion().getFacilityId() != null) { + if (eventType ==4 && dcEvent.getDcEventTrafficCongestion().getFacilityId() != null) { String facilityId = String.valueOf(dcEvent.getDcEventTrafficCongestion().getFacilityId()); dcEvent.setStakeMark( extracted(facilityId)); } //施工建设 - if (dcEvent.getDcEventConstruction().getFacilityId() != null) { + if ( eventType ==7&& dcEvent.getDcEventConstruction().getFacilityId() != null) { String facilityId = String.valueOf(dcEvent.getDcEventConstruction().getFacilityId()); dcEvent.setStakeMark( extracted(facilityId)); } //服务区异常 - if (dcEvent.getDcEventServiceArea().getFacilityId() != null) { + if (eventType ==8 && dcEvent.getDcEventServiceArea().getFacilityId() != null) { String facilityId = String.valueOf(dcEvent.getDcEventServiceArea().getFacilityId()); dcEvent.setStakeMark( extracted(facilityId)); } + + int i7 = dcEventMapper.insertDcEvent(dcEvent); if (i7 > 0) { @@ -165,9 +170,6 @@ public class DcEventServiceImpl implements IDcEventService { //中间库 MdEvent mdEvent = new MdEvent(dcEvent); middleDatabaseService.insertMiddleDatabaseEvent(mdEvent); - - //获取事件类型 - int eventType = Math.toIntExact(dcEvent.getEventType()); switch (eventType) { //交通事故 case 1: