|
|
@ -94,30 +94,49 @@ public class DataProcessServiceImpl implements IDataProcessService { |
|
|
// @Qualifier("sysMqttClient")
|
|
|
// @Qualifier("sysMqttClient")
|
|
|
// private MqttClient sysMqttClient;
|
|
|
// private MqttClient sysMqttClient;
|
|
|
|
|
|
|
|
|
@Value("${category.alarm.deviceTypeIds}") |
|
|
// @Value("${category.alarm.deviceTypeIds}")
|
|
|
private List<Integer> alarmTypeIds; |
|
|
// private List<Integer> alarmTypeIds;
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Value("${category.measure.deviceTypeIds}")
|
|
|
|
|
|
// private List<Integer> measureTypeIds;
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Value("${category.accumulate.deviceTypeIds}")
|
|
|
|
|
|
// private List<Integer> accumulateTypeIds;
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Value("${category.status.deviceTypeIds}")
|
|
|
|
|
|
// private List<Integer> statusTypeIds;
|
|
|
|
|
|
//
|
|
|
|
|
|
@Value("${category.temperature-humidity.deviceTypeIds}") |
|
|
|
|
|
private List<Integer> temperatureHumidityTypeIds; |
|
|
|
|
|
//
|
|
|
|
|
|
// // 所有设备类型ID集合
|
|
|
|
|
|
// public static final List<Integer> ALL_DEVICE_TYPE_IDS = new ArrayList<>();
|
|
|
|
|
|
|
|
|
@Value("${category.measure.deviceTypeIds}") |
|
|
@Value("${category.id.alarm}") |
|
|
private List<Integer> measureTypeIds; |
|
|
private List<Long> categoryIdAlarm; |
|
|
|
|
|
|
|
|
@Value("${category.accumulate.deviceTypeIds}") |
|
|
@Value("${category.id.measure}") |
|
|
private List<Integer> accumulateTypeIds; |
|
|
private List<Long> categoryIdMeasure; |
|
|
|
|
|
|
|
|
@Value("${category.status.deviceTypeIds}") |
|
|
@Value("${category.id.accumulate}") |
|
|
private List<Integer> statusTypeIds; |
|
|
private List<Long> categoryIdAccumulate; |
|
|
|
|
|
|
|
|
@Value("${category.temperature-humidity.deviceTypeIds}") |
|
|
@Value("${category.id.status}") |
|
|
private List<Integer> temperatureHumidityTypeIds; |
|
|
private List<Long> categoryIdStatus; |
|
|
|
|
|
|
|
|
// 所有设备类型ID集合
|
|
|
// 所有设备类型ID集合
|
|
|
public static final List<Integer> ALL_DEVICE_TYPE_IDS = new ArrayList<>(); |
|
|
public static final List<Long> ALL_CATEGORY_ID = new ArrayList<>(); |
|
|
|
|
|
|
|
|
@PostConstruct |
|
|
@PostConstruct |
|
|
public void init() { |
|
|
public void init() { |
|
|
ALL_DEVICE_TYPE_IDS.addAll(alarmTypeIds); |
|
|
// ALL_DEVICE_TYPE_IDS.addAll(alarmTypeIds);
|
|
|
ALL_DEVICE_TYPE_IDS.addAll(measureTypeIds); |
|
|
// ALL_DEVICE_TYPE_IDS.addAll(measureTypeIds);
|
|
|
ALL_DEVICE_TYPE_IDS.addAll(accumulateTypeIds); |
|
|
// ALL_DEVICE_TYPE_IDS.addAll(accumulateTypeIds);
|
|
|
ALL_DEVICE_TYPE_IDS.addAll(statusTypeIds); |
|
|
// ALL_DEVICE_TYPE_IDS.addAll(statusTypeIds);
|
|
|
|
|
|
ALL_CATEGORY_ID.addAll(categoryIdAlarm); |
|
|
|
|
|
ALL_CATEGORY_ID.addAll(categoryIdMeasure); |
|
|
|
|
|
ALL_CATEGORY_ID.addAll(categoryIdAccumulate); |
|
|
|
|
|
ALL_CATEGORY_ID.addAll(categoryIdStatus); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private static final String REDIS_DASHBOARD_DEVICE_STATUS_KEY = "dashboard_device_status"; |
|
|
private static final String REDIS_DASHBOARD_DEVICE_STATUS_KEY = "dashboard_device_status"; |
|
|
@ -619,6 +638,9 @@ public class DataProcessServiceImpl implements IDataProcessService { |
|
|
if (deviceInfoVO.getRetainAlert()!=null){ |
|
|
if (deviceInfoVO.getRetainAlert()!=null){ |
|
|
baseTransDataEntity.setRetainAlert(deviceInfoVO.getRetainAlert()); |
|
|
baseTransDataEntity.setRetainAlert(deviceInfoVO.getRetainAlert()); |
|
|
} |
|
|
} |
|
|
|
|
|
if (deviceInfoVO.getCategoryId()!=null){ |
|
|
|
|
|
baseTransDataEntity.setCategoryId(deviceInfoVO.getCategoryId()); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
baseTransDataEntity.setHashId(UUID.randomUUID()); |
|
|
baseTransDataEntity.setHashId(UUID.randomUUID()); |
|
|
|
|
|
|
|
|
@ -690,14 +712,16 @@ public class DataProcessServiceImpl implements IDataProcessService { |
|
|
} |
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
String uploadValue = uploadValueList.get(0);//这里只取第一个元素
|
|
|
String uploadValue = uploadValueList.get(0);//这里只取第一个元素
|
|
|
if (accumulateTypeIds.contains(baseTransDataEntity.getTypeId())) { |
|
|
if (baseTransDataEntity.getDeviceId().endsWith("_85")){ |
|
|
|
|
|
if (categoryIdAccumulate.contains(baseTransDataEntity.getCategoryId())) { |
|
|
storageAccumulate(DeviceAttrCode.COMMON, uploadValue, baseTransDataEntity); |
|
|
storageAccumulate(DeviceAttrCode.COMMON, uploadValue, baseTransDataEntity); |
|
|
} |
|
|
} |
|
|
if (measureTypeIds.contains(baseTransDataEntity.getTypeId())) { |
|
|
if (categoryIdMeasure.contains(baseTransDataEntity.getCategoryId())) { |
|
|
storageMeasure(DeviceAttrCode.COMMON, uploadValue, baseTransDataEntity); |
|
|
storageMeasure(DeviceAttrCode.COMMON, uploadValue, baseTransDataEntity); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
private void storageMeasure(String attrCode, String uploadValue, DynamodbEntity baseTransDataEntity) throws Exception { |
|
|
private void storageMeasure(String attrCode, String uploadValue, DynamodbEntity baseTransDataEntity) throws Exception { |
|
|
BigDecimal currentValue = new BigDecimal(uploadValue); |
|
|
BigDecimal currentValue = new BigDecimal(uploadValue); |
|
|
@ -854,7 +878,7 @@ public class DataProcessServiceImpl implements IDataProcessService { |
|
|
|
|
|
|
|
|
private void handleDashboardAlert(DynamodbEntity baseTransDataEntity) { |
|
|
private void handleDashboardAlert(DynamodbEntity baseTransDataEntity) { |
|
|
|
|
|
|
|
|
if (!ALL_DEVICE_TYPE_IDS.contains(baseTransDataEntity.getTypeId())) { |
|
|
if (!ALL_CATEGORY_ID.contains(baseTransDataEntity.getCategoryId())) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -873,7 +897,7 @@ public class DataProcessServiceImpl implements IDataProcessService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//告警历史处理
|
|
|
//告警历史处理
|
|
|
if (alarmTypeIds.contains(baseTransDataEntity.getTypeId())) { |
|
|
if (categoryIdAlarm.contains(baseTransDataEntity.getCategoryId())) { |
|
|
String status = baseTransDataEntity.getStatus(); |
|
|
String status = baseTransDataEntity.getStatus(); |
|
|
if (null == redisOldStatusObj) { |
|
|
if (null == redisOldStatusObj) { |
|
|
if ("alert".equals(status)) { |
|
|
if ("alert".equals(status)) { |
|
|
|