|
|
@ -1,13 +1,11 @@ |
|
|
|
package com.zc.business.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.ruoyi.common.core.domain.AjaxResult; |
|
|
|
import com.ruoyi.common.utils.DateUtils; |
|
|
|
import com.ruoyi.common.utils.SecurityUtils; |
|
|
|
import com.ruoyi.common.utils.uuid.IdUtils; |
|
|
|
import com.zc.business.domain.DcDevice; |
|
|
|
import com.zc.business.domain.DcEvent; |
|
|
|
import com.zc.business.domain.DcWarning; |
|
|
|
import com.zc.business.domain.DcWarningBatchConvert; |
|
|
|
import com.zc.business.domain.*; |
|
|
|
import com.zc.business.enums.ValueConverter; |
|
|
|
import com.zc.business.mapper.DcEventMapper; |
|
|
|
import com.zc.business.mapper.DcWarningMapper; |
|
|
@ -19,6 +17,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.Calendar; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
@ -204,7 +203,7 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
|
if ("0".equals(dcWarningBatchConvert.getType())){ |
|
|
|
dcWarningMapper.batchDelete(dcWarningList); |
|
|
|
} else { |
|
|
|
//确认,批量转换为事件
|
|
|
|
//确认,批量转换为事件
|
|
|
|
List<DcEvent> dcEventList = new ArrayList<>(); |
|
|
|
for (DcWarning dcWarning : dcWarningList) { |
|
|
|
if (dcWarning == null || dcWarning.getId() == null || StringUtils.isBlank(dcWarning.getStakeMark()) || |
|
|
@ -239,6 +238,156 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
|
dcEvent.setCreateTime(DateUtils.getNowDate());//创建时间
|
|
|
|
dcEvent.setUserId(SecurityUtils.getUserId());//处置人员
|
|
|
|
|
|
|
|
Calendar cal = Calendar.getInstance(); |
|
|
|
cal.add(Calendar.HOUR,3); |
|
|
|
dcEvent.setEstimatedEndTime(cal.getTime()); //预计解除时间
|
|
|
|
dcEvent.setRoadId(1L); //道路id
|
|
|
|
dcEvent.setRoadName("济菏高速"); //道路id
|
|
|
|
dcEvent.setInTunnel(0); //是否处在隧道
|
|
|
|
|
|
|
|
|
|
|
|
Integer warningType = dcWarning.getWarningType(); |
|
|
|
if (warningType == 1){ |
|
|
|
|
|
|
|
//交通拥堵
|
|
|
|
DcEventTrafficCongestion dcEventTrafficCongestion = new DcEventTrafficCongestion(); |
|
|
|
dcEventTrafficCongestion.setId(dcWarning.getId()); |
|
|
|
dcEventTrafficCongestion.setCongestionCause(5L); |
|
|
|
dcEventTrafficCongestion.setCongestionMileage(0F); |
|
|
|
dcEventTrafficCongestion.setMaxCongestionMileage(0F); |
|
|
|
dcEvent.setDcEventTrafficCongestion(dcEventTrafficCongestion); |
|
|
|
} else if (warningType == 4) { |
|
|
|
//停车
|
|
|
|
DcEventVehicleAccident dcEventVehicleAccident = new DcEventVehicleAccident(); |
|
|
|
dcEventVehicleAccident.setId(dcWarning.getId()); |
|
|
|
|
|
|
|
if (dcWarning.getWarningSource() == 1) { |
|
|
|
dcEventVehicleAccident.setReporterName("视频AI"); |
|
|
|
} else if (dcWarning.getWarningSource() == 2) { |
|
|
|
dcEventVehicleAccident.setReporterName("雷达识别"); |
|
|
|
} else if (dcWarning.getWarningSource() == 3) { |
|
|
|
dcEventVehicleAccident.setReporterName("智慧锥桶"); |
|
|
|
} else if (dcWarning.getWarningSource() == 4) { |
|
|
|
dcEventVehicleAccident.setReporterName("护栏碰撞"); |
|
|
|
} else if (dcWarning.getWarningSource() == 6) { |
|
|
|
dcEventVehicleAccident.setReporterName("非机预警"); |
|
|
|
} |
|
|
|
dcEventVehicleAccident.setReporterPhoneNumber("96659"); |
|
|
|
dcEventVehicleAccident.setLocationType(1L); |
|
|
|
dcEventVehicleAccident.setTrafficJam(0L); |
|
|
|
dcEventVehicleAccident.setWeatherCondition(1L); |
|
|
|
dcEventVehicleAccident.setCongestionAhead(1); |
|
|
|
dcEventVehicleAccident.setAtIntersection(1); |
|
|
|
dcEventVehicleAccident.setOnCurve(1); |
|
|
|
dcEventVehicleAccident.setSmallCar(0L); |
|
|
|
dcEventVehicleAccident.setTrucks(0L); |
|
|
|
dcEventVehicleAccident.setBuses(0L); |
|
|
|
dcEventVehicleAccident.setTankers(0L); |
|
|
|
dcEventVehicleAccident.setMinorInjuries(0L); |
|
|
|
dcEventVehicleAccident.setSeriousInjuries(0L); |
|
|
|
dcEventVehicleAccident.setFatalities(0L); |
|
|
|
dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident); |
|
|
|
} else if (warningType == 7){ |
|
|
|
//道路施工
|
|
|
|
|
|
|
|
} else if (warningType == 8) { |
|
|
|
//异常天气
|
|
|
|
DcEventAbnormalWeather dcEventAbnormalWeather = new DcEventAbnormalWeather(); |
|
|
|
dcEventAbnormalWeather.setId(dcWarning.getId()); |
|
|
|
dcEventAbnormalWeather.setEmergencyLevel(1L); |
|
|
|
dcEvent.setDcEventAbnormalWeather(dcEventAbnormalWeather); |
|
|
|
} else if (warningType == 9) { |
|
|
|
//护栏碰撞
|
|
|
|
DcEventAccident dcEventAccident = new DcEventAccident(); |
|
|
|
dcEventAccident.setId(dcWarning.getId()); |
|
|
|
if (dcWarning.getWarningSource() == 1) { |
|
|
|
dcEventAccident.setReporterName("视频AI"); |
|
|
|
dcEventAccident.setReporterPhoneNumber("96659"); |
|
|
|
} else if (dcWarning.getWarningSource() == 2) { |
|
|
|
dcEventAccident.setReporterName("雷达识别"); |
|
|
|
dcEventAccident.setReporterPhoneNumber("96659"); |
|
|
|
} else if (dcWarning.getWarningSource() == 3) { |
|
|
|
dcEventAccident.setReporterName("智慧锥桶"); |
|
|
|
dcEventAccident.setReporterPhoneNumber("96659"); |
|
|
|
} else if (dcWarning.getWarningSource() == 4) { |
|
|
|
dcEventAccident.setReporterName("护栏碰撞"); |
|
|
|
dcEventAccident.setReporterPhoneNumber("96659"); |
|
|
|
} else if (dcWarning.getWarningSource() == 5) { |
|
|
|
dcEventAccident.setReporterName("扫码报警"); |
|
|
|
JSONObject otherConfig = JSONObject.parseObject(dcWarning.getOtherConfig()); |
|
|
|
if (otherConfig != null && otherConfig.containsKey("phone")) { |
|
|
|
dcEventAccident.setReporterPhoneNumber(otherConfig.getString("phone")); |
|
|
|
dcEventAccident.setVehicleOwnerPhone(otherConfig.getString("phone")); |
|
|
|
} |
|
|
|
} else if (dcWarning.getWarningSource() == 6) { |
|
|
|
dcEventAccident.setReporterName("非机预警"); |
|
|
|
dcEventAccident.setReporterPhoneNumber("96659"); |
|
|
|
} |
|
|
|
dcEventAccident.setLocationType(1L); |
|
|
|
dcEventAccident.setTrafficJam(0f); |
|
|
|
dcEventAccident.setWeatherCondition(1L); |
|
|
|
dcEventAccident.setImpactLevel(1L); |
|
|
|
dcEventAccident.setIsReverseCargo(0); |
|
|
|
dcEventAccident.setIsMaintenance(0); |
|
|
|
dcEventAccident.setCongestionAhead(0); |
|
|
|
dcEventAccident.setOnCurve(0); |
|
|
|
dcEventAccident.setSmallCar(0L); |
|
|
|
dcEventAccident.setTrucks(0L); |
|
|
|
dcEventAccident.setBuses(0L); |
|
|
|
dcEventAccident.setTankers(0L); |
|
|
|
dcEventAccident.setMinorInjuries(0L); |
|
|
|
dcEventAccident.setSeriousInjuries(0L); |
|
|
|
dcEventAccident.setFatalities(0L); |
|
|
|
dcEvent.setDcEventAccident(dcEventAccident); |
|
|
|
} else if (warningType == 10) { |
|
|
|
//交通事故
|
|
|
|
DcEventAccident dcEventAccident = new DcEventAccident(); |
|
|
|
|
|
|
|
|
|
|
|
} else if (warningType == 11) { |
|
|
|
//车辆故障
|
|
|
|
DcEventVehicleAccident dcEventVehicleAccident = new DcEventVehicleAccident(); |
|
|
|
dcEventVehicleAccident.setId(dcWarning.getId()); |
|
|
|
|
|
|
|
if (dcWarning.getWarningSource() == 1) { |
|
|
|
dcEventVehicleAccident.setReporterName("视频AI"); |
|
|
|
dcEventVehicleAccident.setReporterPhoneNumber("96659"); |
|
|
|
} else if (dcWarning.getWarningSource() == 2) { |
|
|
|
dcEventVehicleAccident.setReporterName("雷达识别"); |
|
|
|
dcEventVehicleAccident.setReporterPhoneNumber("96659"); |
|
|
|
} else if (dcWarning.getWarningSource() == 3) { |
|
|
|
dcEventVehicleAccident.setReporterName("智慧锥桶"); |
|
|
|
dcEventVehicleAccident.setReporterPhoneNumber("96659"); |
|
|
|
} else if (dcWarning.getWarningSource() == 4) { |
|
|
|
dcEventVehicleAccident.setReporterName("护栏碰撞"); |
|
|
|
dcEventVehicleAccident.setReporterPhoneNumber("96659"); |
|
|
|
} else if (dcWarning.getWarningSource() == 5) { |
|
|
|
dcEventVehicleAccident.setReporterName("扫码报警"); |
|
|
|
JSONObject otherConfig = JSONObject.parseObject(dcWarning.getOtherConfig()); |
|
|
|
if (otherConfig != null && otherConfig.containsKey("phone")) { |
|
|
|
dcEventVehicleAccident.setReporterPhoneNumber(otherConfig.getString("phone")); |
|
|
|
} |
|
|
|
} else if (dcWarning.getWarningSource() == 6) { |
|
|
|
dcEventVehicleAccident.setReporterName("非机预警"); |
|
|
|
dcEventVehicleAccident.setReporterPhoneNumber("96659"); |
|
|
|
} |
|
|
|
dcEventVehicleAccident.setLocationType(1L); |
|
|
|
dcEventVehicleAccident.setTrafficJam(0L); |
|
|
|
dcEventVehicleAccident.setWeatherCondition(1L); |
|
|
|
dcEventVehicleAccident.setCongestionAhead(1); |
|
|
|
dcEventVehicleAccident.setAtIntersection(1); |
|
|
|
dcEventVehicleAccident.setOnCurve(1); |
|
|
|
dcEventVehicleAccident.setSmallCar(0L); |
|
|
|
dcEventVehicleAccident.setTrucks(0L); |
|
|
|
dcEventVehicleAccident.setBuses(0L); |
|
|
|
dcEventVehicleAccident.setTankers(0L); |
|
|
|
dcEventVehicleAccident.setMinorInjuries(0L); |
|
|
|
dcEventVehicleAccident.setSeriousInjuries(0L); |
|
|
|
dcEventVehicleAccident.setFatalities(0L); |
|
|
|
dcEvent.setDcEventVehicleAccident(dcEventVehicleAccident); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
dcEventList.add(dcEvent); |
|
|
|
} |
|
|
|
|
|
|
@ -246,6 +395,7 @@ public class DcWarningServiceImpl implements IDcWarningService |
|
|
|
dcWarningMapper.batchUpdateState(SecurityUtils.getUserId(),dcWarningList); |
|
|
|
//批量插入事件表
|
|
|
|
dcEventService.batchInsertDcEventWarning(dcEventList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|