From fdbb32a582169709d461e1711838078fdab997fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Wed, 3 Apr 2024 09:50:35 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=A9=E6=B0=94?= =?UTF-8?q?=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../device/handler/DeviceMessageHandler.java | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java index ec36ba9f..949a00df 100644 --- a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java +++ b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java @@ -37,6 +37,7 @@ public class DeviceMessageHandler { private final int EVENT_AI = 1; private final int EVENT_STATE = 1; private final int EVENTEND_STATE = 4; + private final int VISIBILITY_LEVEL = 8; private final Logger logger = LoggerFactory.getLogger(this.getClass()); @Resource @@ -113,7 +114,7 @@ public class DeviceMessageHandler { // 气象检测器 if (IotProductEnum.WEATHER_DETECTOR.value().equals(productId)) { weatherDetectorMessageHandle(data); - return; + return; } // 护栏碰撞 @@ -168,8 +169,12 @@ public class DeviceMessageHandler { dcWarning.setWarningTime(new Date(captureTime)); // 信息来源 dcWarning.setWarningSource(WarningSourceEnum.VIDEO_AI.getCode()); + // 事件主类型 dcWarning.setWarningType(data.getInteger("warningType")); + if (data.getInteger("warningType") == VISIBILITY_LEVEL) { + dcWarning.setWarningLevel(data.getInteger("visibilityLevel")); + } String warningSubclass = data.getString("warningSubclass"); // 子类型 @@ -181,10 +186,10 @@ public class DeviceMessageHandler { //方向 if (arr[2] != null) { if (arr[2].equals("上行")) { - direction=arr[0]+" "+arr[1]+ " 菏泽方向 "; + direction = arr[0] + " " + arr[1] + " 菏泽方向 "; } if (arr[2].equals("下行")) { - direction=arr[0]+" "+arr[1]+ " 济南方向 "; + direction = arr[0] + " " + arr[1] + " 济南方向 "; } } @@ -349,7 +354,7 @@ public class DeviceMessageHandler { * @param msg 设备消息 */ private void oneStopDeviceMessageHandle(JSONObject msg) { - dcTrafficSectionDataService.processRealtimeOneStopMessage(msg); + dcTrafficSectionDataService.processRealtimeOneStopMessage(msg); } @@ -445,12 +450,12 @@ public class DeviceMessageHandler { */ private void weatherDetectorMessageHandle(JSONObject msg) { - // DcMeteorologicalDetectorData meteorologicalDetectorData = (DcMeteorologicalDetectorData) msg.get("properties"); + // DcMeteorologicalDetectorData meteorologicalDetectorData = (DcMeteorologicalDetectorData) msg.get("properties"); JSONObject jsonObject = (JSONObject) msg.get("properties"); DcMeteorologicalDetectorData meteorologicalDetectorData = jsonObject.toJavaObject(DcMeteorologicalDetectorData.class); - JSONObject jsonObjectHeaders = (JSONObject)msg.get("headers"); + JSONObject jsonObjectHeaders = (JSONObject) msg.get("headers"); String parts = jsonObjectHeaders.getString("deviceName"); String[] strings = parts.split("-"); String deviceName = strings[0]; @@ -474,19 +479,19 @@ public class DeviceMessageHandler { mdDeviceData.setTimeStamp(new Date()); mdDeviceData.setCreatorUserId("自动存储"); - Map expands = new HashMap<>(); - expands.put("rainFall",meteorologicalDetectorData.getRainfall()); //雨量 - expands.put("windDirection",meteorologicalDetectorData.getWindDirection()); //风向 - expands.put("windSpeed",meteorologicalDetectorData.getWindSpeed()); //风速 - expands.put("temperature",meteorologicalDetectorData.getTemperature()); //大气温度 - expands.put("humidity",meteorologicalDetectorData.getHumidity()); //大气湿度 - expands.put("airPressure",meteorologicalDetectorData.getAtmosphericPressure()); //气压 - expands.put("waterThick",meteorologicalDetectorData.getWaterFilmIceSnowValue()); //水膜厚度 - expands.put("wet",meteorologicalDetectorData.getWetSlipperyCoefficient()); //湿滑 - expands.put("rainXingTai",meteorologicalDetectorData.getPrecipitationType()); //雨量降水形态 - expands.put("visibility",meteorologicalDetectorData.getVisibility()); //能见度 - expands.put("remoteRoadSurfaceTemperature",meteorologicalDetectorData.getRemoteRoadSurfaceTemperature()); //路面温度 - expands.put("pathContactZhuang",meteorologicalDetectorData.getRemoteRoadSurfaceStatus()); //路面状况 + Map expands = new HashMap<>(); + expands.put("rainFall", meteorologicalDetectorData.getRainfall()); //雨量 + expands.put("windDirection", meteorologicalDetectorData.getWindDirection()); //风向 + expands.put("windSpeed", meteorologicalDetectorData.getWindSpeed()); //风速 + expands.put("temperature", meteorologicalDetectorData.getTemperature()); //大气温度 + expands.put("humidity", meteorologicalDetectorData.getHumidity()); //大气湿度 + expands.put("airPressure", meteorologicalDetectorData.getAtmosphericPressure()); //气压 + expands.put("waterThick", meteorologicalDetectorData.getWaterFilmIceSnowValue()); //水膜厚度 + expands.put("wet", meteorologicalDetectorData.getWetSlipperyCoefficient()); //湿滑 + expands.put("rainXingTai", meteorologicalDetectorData.getPrecipitationType()); //雨量降水形态 + expands.put("visibility", meteorologicalDetectorData.getVisibility()); //能见度 + expands.put("remoteRoadSurfaceTemperature", meteorologicalDetectorData.getRemoteRoadSurfaceTemperature()); //路面温度 + expands.put("pathContactZhuang", meteorologicalDetectorData.getRemoteRoadSurfaceStatus()); //路面状况 mdDeviceData.setExpands(JSONObject.toJSONString(expands)); From ca0ebb2cc8f98843549fe9de4d563cb55df5c2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=85=B4=E7=90=B3?= <1911390090@qq.com> Date: Wed, 3 Apr 2024 09:51:23 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=A4=A9=E6=B0=94?= =?UTF-8?q?=E7=AD=89=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../zc/business/message/device/handler/DeviceMessageHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java index 949a00df..d2c12a66 100644 --- a/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java +++ b/zc-business/src/main/java/com/zc/business/message/device/handler/DeviceMessageHandler.java @@ -172,6 +172,7 @@ public class DeviceMessageHandler { // 事件主类型 dcWarning.setWarningType(data.getInteger("warningType")); + //异常天气等级 if (data.getInteger("warningType") == VISIBILITY_LEVEL) { dcWarning.setWarningLevel(data.getInteger("visibilityLevel")); } From 6631a1ccd8c1baba52dc6b8c88f9df08d8d5715e Mon Sep 17 00:00:00 2001 From: zhaoxianglong Date: Wed, 3 Apr 2024 15:06:28 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=89=B9=E9=87=8F=E6=93=8D=E4=BD=9C=E5=8A=9F=E8=83=BD=E5=85=BC?= =?UTF-8?q?=E5=AE=B9=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zc/business/controller/DcDeviceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index 1cee37f7..b71a2ad2 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -459,7 +459,7 @@ public class DcDeviceController extends BaseController { JSONObject functionJSONObject = (JSONObject) JSON.toJSON(function); //JSONObject functionJSONObject = (JSONObject) JSON.toJSON(function.toString()) ; String functionId = functionJSONObject.getString("functionId"); - JSONObject jsonObject = functionJSONObject.getJSONObject("params") == null?functionJSONObject.getJSONObject("params"):new JSONObject(); + JSONObject jsonObject = functionJSONObject.getJSONObject("params") != null?functionJSONObject.getJSONObject("params"):new JSONObject(); resultArray.add(getResult(device, iotDeviceId, functionId, jsonObject)); } } From 128c6f3ca61876e41d8c91064e0aff5f03c4ab59 Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Wed, 3 Apr 2024 15:31:57 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=BD=93=E5=A4=A9=E8=AE=BE=E5=A4=87=E6=8C=87=E5=AE=9A=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zc/business/controller/DcDeviceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index b71a2ad2..c77cb89c 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -247,7 +247,7 @@ public class DcDeviceController extends BaseController { JSONObject formatValue = JSON.parseObject(jsonObject.get("formatValue").toString()); map.put("1", formatValue.get("1")); map.put("3", formatValue.get("3")); - map.put("timestamp", jsonObject.get("timestamp")); + map.put("timestamp", jsonObject.get("equipmentReportingTime")); list.add(map); }); return AjaxResult.success(list); From 416dbfa3f9a9de0f85adaaad489820644d6dfc78 Mon Sep 17 00:00:00 2001 From: "Mr.Wang" Date: Wed, 3 Apr 2024 15:34:42 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=BD=93=E5=A4=A9=E8=AE=BE=E5=A4=87=E6=8C=87=E5=AE=9A=E5=B1=9E?= =?UTF-8?q?=E6=80=A7=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/zc/business/controller/DcDeviceController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java index c77cb89c..00b09ef1 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcDeviceController.java @@ -247,7 +247,7 @@ public class DcDeviceController extends BaseController { JSONObject formatValue = JSON.parseObject(jsonObject.get("formatValue").toString()); map.put("1", formatValue.get("1")); map.put("3", formatValue.get("3")); - map.put("timestamp", jsonObject.get("equipmentReportingTime")); + map.put("timestamp", formatValue.get("equipmentReportingTime")); list.add(map); }); return AjaxResult.success(list);