|
|
@ -133,6 +133,97 @@ public class DeviceMessageHandler { |
|
|
|
if (IotProductEnum.GUARDRAIL_COLLISION.value().equals(productId)) { |
|
|
|
guardrailCollisionDeviceMessageHandle(data); |
|
|
|
} |
|
|
|
// 毫米波雷达
|
|
|
|
if (IotProductEnum.MILLIMETER_WAVE_RADAR.value().equals(productId)) { |
|
|
|
millimeterWaveRadarDeviceMessageHandle(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 毫米波雷达消息处理入口 |
|
|
|
* |
|
|
|
* @param event 设备消息 |
|
|
|
*/ |
|
|
|
private void millimeterWaveRadarDeviceMessageHandle(JSONObject event) { |
|
|
|
JSONObject jsonObject = event.getJSONObject("data"); |
|
|
|
String eventTopic = event.getString("event"); |
|
|
|
if (Objects.equals(eventTopic, "RADAR_TOPIC")) { |
|
|
|
// 雷达目标检测事件
|
|
|
|
|
|
|
|
} else if (Objects.equals(eventTopic, "trafficAnalysis")) { |
|
|
|
// 交通事件
|
|
|
|
String deviceId = event.getString("deviceId"); |
|
|
|
|
|
|
|
LambdaQueryWrapper<DcDevice> lambdaQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
lambdaQueryWrapper.eq(DcDevice::getIotDeviceId, deviceId); |
|
|
|
List<DcDevice> dcDevices = dcDeviceService.list(lambdaQueryWrapper); |
|
|
|
if (dcDevices.size() == 0) { |
|
|
|
return; |
|
|
|
} |
|
|
|
DcDevice dcDevice = dcDevices.get(0); |
|
|
|
String direction = dcDevice.getDirection(); |
|
|
|
String stakeMark = dcDevice.getStakeMark(); |
|
|
|
Date happenTime = jsonObject.getDate("happenTime"); |
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss"); |
|
|
|
String formattedDate = sdf.format(happenTime); |
|
|
|
|
|
|
|
String directio; |
|
|
|
if (Objects.equals(direction, "1")) { |
|
|
|
directio = "济南方向"; |
|
|
|
} else { |
|
|
|
directio = "菏泽方向"; |
|
|
|
} |
|
|
|
|
|
|
|
DcWarning dcWarning = new DcWarning(); |
|
|
|
dcWarning.setStakeMark(stakeMark); |
|
|
|
dcWarning.setDirection(direction); |
|
|
|
dcWarning.setCreateTime(new Date()); |
|
|
|
dcWarning.setWarningTime(happenTime); |
|
|
|
dcWarning.setWarningSource(2); |
|
|
|
dcWarning.setWarningState(1); |
|
|
|
String illegalTrafficEvent = jsonObject.getString("illegalTrafficEvent"); |
|
|
|
String eventName = ""; |
|
|
|
if (Objects.equals(illegalTrafficEvent, "congestion")) { |
|
|
|
dcWarning.setWarningType(1); |
|
|
|
dcWarning.setWarningSubclass("1-1"); |
|
|
|
eventName = "拥堵"; |
|
|
|
} else if (Objects.equals(illegalTrafficEvent, "wrongDirection")) { |
|
|
|
dcWarning.setWarningType(5); |
|
|
|
dcWarning.setWarningSubclass("5-1"); |
|
|
|
eventName = "逆行"; |
|
|
|
} else if (Objects.equals(illegalTrafficEvent, "Speed")) { |
|
|
|
dcWarning.setWarningType(5); |
|
|
|
dcWarning.setWarningSubclass("5-4"); |
|
|
|
eventName = "超速"; |
|
|
|
} else if (Objects.equals(illegalTrafficEvent, "laneChange")) { |
|
|
|
dcWarning.setWarningType(5); |
|
|
|
dcWarning.setWarningSubclass("5-6"); |
|
|
|
eventName = "违规变道"; |
|
|
|
} else if (Objects.equals(illegalTrafficEvent, "illegalParking")) { |
|
|
|
dcWarning.setWarningType(4); |
|
|
|
dcWarning.setWarningSubclass("4-1"); |
|
|
|
eventName = "停车"; |
|
|
|
} else if (Objects.equals(illegalTrafficEvent, "lowSpeed")) { |
|
|
|
dcWarning.setWarningType(5); |
|
|
|
dcWarning.setWarningSubclass("5-5"); |
|
|
|
eventName = "机动车低速行驶"; |
|
|
|
} else if (Objects.equals(illegalTrafficEvent, "notKeepDistance")) { |
|
|
|
dcWarning.setWarningType(5); |
|
|
|
dcWarning.setWarningSubclass("5-7"); |
|
|
|
eventName = "未保持安全车距"; |
|
|
|
} |
|
|
|
dcWarning.setWarningTitle(stakeMark + " " + directio+ " " + "发生" + eventName + "事件"); |
|
|
|
dcWarning.setRemark(formattedDate+ " " + stakeMark+ " " + directio+ " " + "发生" + eventName + "事件"); |
|
|
|
dcWarning.setOtherConfig(event.toJSONString()); |
|
|
|
dcWarningService.insertDcWarning(dcWarning); |
|
|
|
} else if (Objects.equals(eventTopic, "timeRange")) { |
|
|
|
// 交通统计
|
|
|
|
|
|
|
|
} else if (Objects.equals(eventTopic, "realTime")) { |
|
|
|
// 交通状态数据
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -252,11 +343,11 @@ public class DeviceMessageHandler { |
|
|
|
dcWarning.setOtherConfig(otherConfig.toString()); |
|
|
|
//异常天气等级 过滤
|
|
|
|
if (data.getInteger("warningType") == VISIBILITY_LEVEL) { |
|
|
|
int WarningLevel=data.getInteger("visibilityLevel"); |
|
|
|
if (WarningLevel !=0){ |
|
|
|
int WarningLevel = data.getInteger("visibilityLevel"); |
|
|
|
if (WarningLevel != 0) { |
|
|
|
dcWarningService.insertDcWarning(dcWarning); |
|
|
|
} |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
dcWarningService.insertDcWarning(dcWarning); |
|
|
|
} |
|
|
|
|
|
|
|