|
|
@ -7,23 +7,24 @@ import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.ruoyi.common.core.redis.RedisCache; |
|
|
|
import com.zc.business.constant.RedisKeyConstants; |
|
|
|
import com.zc.business.domain.DcDevice; |
|
|
|
import com.zc.business.domain.DcMeteorologicalDetectorData; |
|
|
|
import com.zc.business.domain.DcWarning; |
|
|
|
import com.zc.business.domain.MdDeviceData; |
|
|
|
import com.zc.business.enums.IotProductEnum; |
|
|
|
import com.zc.business.enums.WarningSourceEnum; |
|
|
|
import com.zc.business.enums.WarningStateEnum; |
|
|
|
import com.zc.business.enums.WarningSubclassEnum; |
|
|
|
import com.zc.business.service.DcTrafficSectionDataService; |
|
|
|
import com.zc.business.service.IDcDeviceService; |
|
|
|
import com.zc.business.service.IDcWarningService; |
|
|
|
import com.zc.business.service.IMiddleDatabaseService; |
|
|
|
import com.zc.business.service.*; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -53,6 +54,12 @@ public class DeviceMessageHandler { |
|
|
|
@Resource |
|
|
|
private DcTrafficSectionDataService dcTrafficSectionDataService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IDcMeteorologicalDetectorDataService meteorologicalDetectorDataService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IDcYzsqbdcHmbldDataService dcYzsqbdcHmbldDataService; |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新设备状态 |
|
|
|
* |
|
|
@ -102,6 +109,12 @@ public class DeviceMessageHandler { |
|
|
|
// 一站式情况调查站
|
|
|
|
if (IotProductEnum.ONE_STOP_PRODUCT.value().equals(productId)) { |
|
|
|
oneStopDeviceMessageHandle(data); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
// 一站式情况调查站
|
|
|
|
if (IotProductEnum.WEATHER_DETECTOR.value().equals(productId)) { |
|
|
|
weatherDetectorMessageHandle(data); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -319,4 +332,42 @@ public class DeviceMessageHandler { |
|
|
|
dcTrafficSectionDataService.processRealtimeMessage(msg); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 气象检测器消息处理入口 |
|
|
|
* @param msg 设备消息 |
|
|
|
*/ |
|
|
|
private void weatherDetectorMessageHandle(JSONObject msg) { |
|
|
|
|
|
|
|
DcMeteorologicalDetectorData meteorologicalDetectorData = (DcMeteorologicalDetectorData) msg.get("properties"); |
|
|
|
meteorologicalDetectorData.setIotDeviceId(msg.get("deviceId").toString()); |
|
|
|
meteorologicalDetectorDataService.insertDcMeteorologicalDetectorData(meteorologicalDetectorData); |
|
|
|
|
|
|
|
//设计院中间库 插入设备数据
|
|
|
|
MdDeviceData mdDeviceData = new MdDeviceData(); |
|
|
|
mdDeviceData.setDevNo(meteorologicalDetectorData.getIotDeviceId()); |
|
|
|
mdDeviceData.setDevType("3"); |
|
|
|
mdDeviceData.setTimeStamp(new Date()); |
|
|
|
mdDeviceData.setCreatorUserId("自动存储"); |
|
|
|
|
|
|
|
Map<String,Object> expands = new HashMap<>(); |
|
|
|
expands.put("rainFall",meteorologicalDetectorData.getRainfall()); //雨量
|
|
|
|
expands.put("windSpeed",meteorologicalDetectorData.getWindSpeed()); //风速
|
|
|
|
expands.put("windDirection",meteorologicalDetectorData.getWindDirection()); //风向
|
|
|
|
expands.put("temperature",meteorologicalDetectorData.getTemperature()); //大气温度
|
|
|
|
expands.put("humidity",meteorologicalDetectorData.getHumidity()); //大气湿度
|
|
|
|
expands.put("airPressure",meteorologicalDetectorData.getAtmosphericPressure()); //数字气压
|
|
|
|
expands.put("wet",meteorologicalDetectorData.getWetSlipperyCoefficient()); //湿滑
|
|
|
|
expands.put("rainXingTai",meteorologicalDetectorData.getPrecipitationType()); //雨量降水形态
|
|
|
|
expands.put("visibility",meteorologicalDetectorData.getVisibility()); //能见度
|
|
|
|
expands.put("pathContactLu",meteorologicalDetectorData.getRoadSurfaceTemperature()); //路面温度
|
|
|
|
expands.put("pathContactBing",meteorologicalDetectorData.getFreezingPointTemperature()); //冰点温度
|
|
|
|
expands.put("pathContactYan",meteorologicalDetectorData.getSalinityValue()); //路面盐度
|
|
|
|
expands.put("pathContactZhuang",meteorologicalDetectorData.getRemoteRoadSurfaceStatus()); //路面状况
|
|
|
|
|
|
|
|
mdDeviceData.setExpands(JSONObject.toJSONString(expands)); |
|
|
|
|
|
|
|
middleDatabaseService.insertMiddleDatabaseDeviceData(mdDeviceData); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|