|
@ -22,7 +22,6 @@ import org.springframework.stereotype.Service; |
|
|
import org.springframework.util.ObjectUtils; |
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.text.ParseException; |
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
@ -134,6 +133,7 @@ public class DeviceMessageHandler { |
|
|
if (IotProductEnum.GUARDRAIL_COLLISION.value().equals(productId)) { |
|
|
if (IotProductEnum.GUARDRAIL_COLLISION.value().equals(productId)) { |
|
|
guardrailCollisionDeviceMessageHandle(data); |
|
|
guardrailCollisionDeviceMessageHandle(data); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// 毫米波雷达
|
|
|
// 毫米波雷达
|
|
|
if (IotProductEnum.MILLIMETER_WAVE_RADAR.value().equals(productId)) { |
|
|
if (IotProductEnum.MILLIMETER_WAVE_RADAR.value().equals(productId)) { |
|
|
millimeterWaveRadarDeviceMessageHandle(data); |
|
|
millimeterWaveRadarDeviceMessageHandle(data); |
|
@ -151,7 +151,7 @@ public class DeviceMessageHandler { |
|
|
if (Objects.equals(eventTopic, UniversalEnum.RADAR_TOPIC.getValue())) { |
|
|
if (Objects.equals(eventTopic, UniversalEnum.RADAR_TOPIC.getValue())) { |
|
|
// 雷达目标检测事件
|
|
|
// 雷达目标检测事件
|
|
|
|
|
|
|
|
|
} else if (Objects.equals(eventTopic, UniversalEnum.TRAFFIC_ANALYSIS.getNumber())) { |
|
|
} else if (Objects.equals(eventTopic, UniversalEnum.TRAFFIC_ANALYSIS.getValue())) { |
|
|
// 交通事件
|
|
|
// 交通事件
|
|
|
String deviceId = event.getString("deviceId"); |
|
|
String deviceId = event.getString("deviceId"); |
|
|
|
|
|
|
|
@ -220,7 +220,7 @@ public class DeviceMessageHandler { |
|
|
} else if (Objects.equals(eventTopic, UniversalEnum.TIME_RANGE.getValue())) { |
|
|
} else if (Objects.equals(eventTopic, UniversalEnum.TIME_RANGE.getValue())) { |
|
|
// 交通统计
|
|
|
// 交通统计
|
|
|
|
|
|
|
|
|
} else if (Objects.equals(eventTopic, UniversalEnum.REAL_TIME.getNumber())) { |
|
|
} else if (Objects.equals(eventTopic, UniversalEnum.REAL_TIME.getValue())) { |
|
|
// 交通状态数据
|
|
|
// 交通状态数据
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
@ -491,6 +491,7 @@ public class DeviceMessageHandler { |
|
|
String serviceIP = dataJsonObject.getString("serviceIP");//告警ip
|
|
|
String serviceIP = dataJsonObject.getString("serviceIP");//告警ip
|
|
|
String timeOfFireAlarming = dataJsonObject.getString("timeOfFireAlarming");//告警时间
|
|
|
String timeOfFireAlarming = dataJsonObject.getString("timeOfFireAlarming");//告警时间
|
|
|
JSONArray jsonArray = dataJsonObject.getJSONArray("data"); |
|
|
JSONArray jsonArray = dataJsonObject.getJSONArray("data"); |
|
|
|
|
|
String deviceId = msg.getString("deviceId"); |
|
|
for (Object o : jsonArray) { |
|
|
for (Object o : jsonArray) { |
|
|
JSONObject jsonObject = JSONObject.parseObject(o.toString()); |
|
|
JSONObject jsonObject = JSONObject.parseObject(o.toString()); |
|
|
String nodeAddress = jsonObject.getString("nodeAddress");//节点地址
|
|
|
String nodeAddress = jsonObject.getString("nodeAddress");//节点地址
|
|
@ -500,9 +501,11 @@ public class DeviceMessageHandler { |
|
|
DcWarning dcWarning = new DcWarning(); |
|
|
DcWarning dcWarning = new DcWarning(); |
|
|
|
|
|
|
|
|
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
lambdaQueryWrapper.eq(DcDevice::getIotDeviceId, nodeAddress); |
|
|
lambdaQueryWrapper.eq(DcDevice::getIotDeviceId, deviceId); |
|
|
List<DcDevice> dcDevices = dcDeviceService.list(lambdaQueryWrapper); |
|
|
List<DcDevice> dcDevices = dcDeviceService.list(lambdaQueryWrapper); |
|
|
|
|
|
if (dcDevices.size() == UniversalEnum.ZERO.getNumber()) { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
String direction = UniversalEnum.EMPTY_STRING.getValue(); |
|
|
String direction = UniversalEnum.EMPTY_STRING.getValue(); |
|
|
if (Objects.equals(location, UniversalEnum.ZERO.getValue())) { |
|
|
if (Objects.equals(location, UniversalEnum.ZERO.getValue())) { |
|
|
dcWarning.setDirection(UniversalEnum.ONE.getValue()); |
|
|
dcWarning.setDirection(UniversalEnum.ONE.getValue()); |
|
@ -545,20 +548,14 @@ public class DeviceMessageHandler { |
|
|
dcWarning.setWarningSubclass(UniversalEnum.FOUR_EIGHT.getValue()); |
|
|
dcWarning.setWarningSubclass(UniversalEnum.FOUR_EIGHT.getValue()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat(UniversalEnum.PURE_CHINESE_CHARACTER_TIME_FORMATS.getValue()); |
|
|
dcWarning.setWarningTime(new Date()); |
|
|
try { |
|
|
DcDevice dcDevice = dcDevices.get(UniversalEnum.ZERO.getNumber()); |
|
|
Date date = sdf.parse(timeOfFireAlarming); |
|
|
dcWarning.setStakeMark(dcDevice.getStakeMark()); |
|
|
dcWarning.setWarningTime(date); |
|
|
dcWarning.setDirection(dcDevice.getDirection()); |
|
|
} catch (ParseException e) { |
|
|
dcWarning.setWarningSource(UniversalEnum.FOUR.getNumber()); |
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
dcWarning.setStakeMark(dcDevices.get(UniversalEnum.ZERO.getNumber()).getStakeMark()); |
|
|
|
|
|
|
|
|
|
|
|
dcWarning.setWarningType(UniversalEnum.NINE.getNumber()); |
|
|
|
|
|
dcWarning.setWarningSubclass(UniversalEnum.FOUR.getValue()); |
|
|
|
|
|
dcWarning.setWarningState(UniversalEnum.ONE.getNumber()); |
|
|
dcWarning.setWarningState(UniversalEnum.ONE.getNumber()); |
|
|
dcWarning.setCreateTime(new Date()); |
|
|
dcWarning.setCreateTime(new Date()); |
|
|
dcWarning.setDirection("护栏碰撞上报事件:区域号为" + areaCode + "在20" + timeOfFireAlarming + direction + UniversalEnum.TAKE_PLACE.getValue() + eventType + UniversalEnum.INCIDENT.getValue()); |
|
|
dcWarning.setRemark("护栏碰撞上报事件:区域号为" + areaCode + "在20" + timeOfFireAlarming + direction + UniversalEnum.TAKE_PLACE.getValue() + eventType + UniversalEnum.INCIDENT.getValue()); |
|
|
dcWarning.setWarningTitle("护栏碰撞在20" + timeOfFireAlarming + direction + UniversalEnum.TAKE_PLACE.getValue() + eventType + UniversalEnum.INCIDENT.getValue()); |
|
|
dcWarning.setWarningTitle("护栏碰撞在20" + timeOfFireAlarming + direction + UniversalEnum.TAKE_PLACE.getValue() + eventType + UniversalEnum.INCIDENT.getValue()); |
|
|
dcWarning.setOtherConfig(dataJsonObject.toJSONString()); |
|
|
dcWarning.setOtherConfig(dataJsonObject.toJSONString()); |
|
|
dcWarningService.insertDcWarning(dcWarning); |
|
|
dcWarningService.insertDcWarning(dcWarning); |
|
@ -587,7 +584,7 @@ public class DeviceMessageHandler { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//设备名称
|
|
|
//设备名称
|
|
|
meteorologicalDetectorData.setDeviceName(deviceName+UniversalEnum.OPEN_PARENTHESIS.getValue()+stakeMark+UniversalEnum.CLOSING_PARENTHESIS.getValue()); |
|
|
meteorologicalDetectorData.setDeviceName(deviceName + UniversalEnum.OPEN_PARENTHESIS.getValue() + stakeMark + UniversalEnum.CLOSING_PARENTHESIS.getValue()); |
|
|
//位置
|
|
|
//位置
|
|
|
meteorologicalDetectorData.setStakeMark(stakeMark); |
|
|
meteorologicalDetectorData.setStakeMark(stakeMark); |
|
|
//方向
|
|
|
//方向
|
|
@ -618,7 +615,7 @@ public class DeviceMessageHandler { |
|
|
|
|
|
|
|
|
DcWarning dcWarning = new DcWarning(); |
|
|
DcWarning dcWarning = new DcWarning(); |
|
|
dcWarning.setWarningState(UniversalEnum.ONE.getNumber()); |
|
|
dcWarning.setWarningState(UniversalEnum.ONE.getNumber()); |
|
|
dcWarning.setRemark(new Date()+" "+content); |
|
|
dcWarning.setRemark(new Date() + UniversalEnum.BLANK_SPACE.getValue() + content); |
|
|
dcWarning.setWarningTime(new Date()); |
|
|
dcWarning.setWarningTime(new Date()); |
|
|
dcWarning.setWarningType(UniversalEnum.EIGHT_ONE.getNumber()); |
|
|
dcWarning.setWarningType(UniversalEnum.EIGHT_ONE.getNumber()); |
|
|
dcWarning.setWarningSubclass(UniversalEnum.EIGHT_ONE.getValue()); |
|
|
dcWarning.setWarningSubclass(UniversalEnum.EIGHT_ONE.getValue()); |
|
@ -665,7 +662,7 @@ public class DeviceMessageHandler { |
|
|
String string = object.toString(); |
|
|
String string = object.toString(); |
|
|
DcWarning dcWarning = new DcWarning(); |
|
|
DcWarning dcWarning = new DcWarning(); |
|
|
dcWarning.setWarningState(UniversalEnum.ONE.getNumber()); |
|
|
dcWarning.setWarningState(UniversalEnum.ONE.getNumber()); |
|
|
dcWarning.setRemark(new Date()+" "+content); |
|
|
dcWarning.setRemark(new Date() + UniversalEnum.BLANK_SPACE.getValue() + content); |
|
|
dcWarning.setWarningTime(new Date()); |
|
|
dcWarning.setWarningTime(new Date()); |
|
|
dcWarning.setWarningType(UniversalEnum.EIGHT_FOUR.getNumber()); |
|
|
dcWarning.setWarningType(UniversalEnum.EIGHT_FOUR.getNumber()); |
|
|
dcWarning.setWarningSubclass(UniversalEnum.EIGHT_FOUR.getValue()); |
|
|
dcWarning.setWarningSubclass(UniversalEnum.EIGHT_FOUR.getValue()); |
|
|