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..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("timestamp")); + map.put("timestamp", formatValue.get("equipmentReportingTime")); list.add(map); }); return AjaxResult.success(list); @@ -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)); } } 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..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 @@ -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,13 @@ 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 +187,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 +355,7 @@ public class DeviceMessageHandler { * @param msg 设备消息 */ private void oneStopDeviceMessageHandle(JSONObject msg) { - dcTrafficSectionDataService.processRealtimeOneStopMessage(msg); + dcTrafficSectionDataService.processRealtimeOneStopMessage(msg); } @@ -445,12 +451,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 +480,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));