|
@@ -164,6 +164,7 @@ public class DeviceDataServiceImpl implements DeviceDataService {
|
|
|
* </p>
|
|
|
*/
|
|
|
protected DeviceError judgeLoRaMeterCode(Device device, Map<String, MeasuringData> dataMap, String receiveTime){
|
|
|
+ log.info("对设备{}进行水表电子号判断!",device.getDeviceNo());
|
|
|
DeviceError error = null ;
|
|
|
// 1,判断设备是否为LoRa水表
|
|
|
if(device.getIsLoraMeter() == 1){
|
|
@@ -190,11 +191,16 @@ public class DeviceDataServiceImpl implements DeviceDataService {
|
|
|
if(StringUtils.isNotEmpty(errorMessage)){
|
|
|
log.info("Judge LoRa meter with message = {}",errorMessage);
|
|
|
AlarmType forQuery = new AlarmType();
|
|
|
+ forQuery.setDeviceTypeId(0);
|
|
|
+ forQuery.setStatus(1);
|
|
|
+ forQuery.setChannelId(device.getSysId());
|
|
|
+ forQuery.setSiteId(device.getSiteId());
|
|
|
forQuery.setCode("abnormal data");
|
|
|
Map<String, Object> alarmTypeQueryParam = (Map<String, Object>) MapTransformUtils.objectToMap(forQuery);
|
|
|
List<AlarmType> alarmTypeList = alarmTypeMapper.list(alarmTypeQueryParam, 0, 1);
|
|
|
- if(alarmTypeList.size() > 1){
|
|
|
+ if(alarmTypeList.size() > 0){
|
|
|
AlarmType alarmType = alarmTypeList.get(0);
|
|
|
+ // 4.1,新生成告警
|
|
|
error = new DeviceError();
|
|
|
long alarmId = idWorker.nextId();
|
|
|
error.setAlarmCategory(alarmType.getAlarmCategory());
|
|
@@ -209,9 +215,22 @@ public class DeviceDataServiceImpl implements DeviceDataService {
|
|
|
error.setSiteId(device.getSiteId());
|
|
|
error.setSysId(device.getSysId());
|
|
|
error.setStatus(1);
|
|
|
- error.setAlarmTime(parserDate(receiveTime)); // 首次告警时间
|
|
|
- error.setLastAlarmTime(parserDate(receiveTime)); // 最后告警时间
|
|
|
- error.setAlarmCount(1); // 告警次数
|
|
|
+ error.setAlarmTime(parserDate(receiveTime));
|
|
|
+ error.setLastAlarmTime(parserDate(receiveTime));
|
|
|
+ error.setAlarmCount(1);
|
|
|
+ // 4.2,告警对应的测点数据
|
|
|
+ List<AlarmMeasuringData> amdList = new ArrayList<>();
|
|
|
+ AlarmMeasuringData amd = new AlarmMeasuringData();
|
|
|
+ amd.setAlarmId(alarmId);
|
|
|
+ amd.setMeasuringCode("METER_NO");
|
|
|
+ amd.setMeasuringData(protocolMeterNo);
|
|
|
+ amd.setMeasuringName(meterNoData.getMeasuringName());
|
|
|
+ amd.setShowData(errorMessage);
|
|
|
+ amd.setStatus(1);
|
|
|
+ amd.setId(idWorker.nextId());
|
|
|
+ amdList.add(amd);
|
|
|
+ error.setAlarmMeasuringData(amdList);
|
|
|
+
|
|
|
}
|
|
|
else{
|
|
|
log.warn("系统未配置电子号数据异常告警类型");
|
|
@@ -219,6 +238,9 @@ public class DeviceDataServiceImpl implements DeviceDataService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ else{
|
|
|
+ log.info("设备{}非LoRa水表,Param Is_LoRa_Meter = {}",device.getDeviceNo(),device.getIsLoraMeter());
|
|
|
+ }
|
|
|
return error ;
|
|
|
}
|
|
|
/**
|