添加定时报文同步流量计设备运行状态

This commit is contained in:
蒾酒
2025-01-01 01:54:09 +08:00
parent e2bd886b57
commit ec614c02b1

View File

@ -106,14 +106,28 @@ public class DeviceOtherMsgConsumer {
if(jsonObject.getStr("type")!=null){ if(jsonObject.getStr("type")!=null){
//上报正常数据 //上报正常数据
if(jsonObject.getStr("type").equals("waterEleData")){ if(jsonObject.getStr("type").equals("waterEleData")){
String data1 = jsonObject.getStr("data"); JSONObject data1 = jsonObject.getJSONObject("data");
//收到开阀定时报文 //收到开阀定时报文
if(JSONUtil.parseObj(data1).get("action").equals("timeMsg")){ if(data1.get("action").equals("timeMsg")){
pumpUsageRecords.setMessageContent(JSONUtil.toJsonStr(jsonObject)); pumpUsageRecords.setMessageContent(JSONUtil.toJsonStr(jsonObject));
// int i = ngWaterPumpUsageRecordsMapper.insertNgWaterPumpUsageRecords(pumpUsageRecords); // int i = ngWaterPumpUsageRecordsMapper.insertNgWaterPumpUsageRecords(pumpUsageRecords);
// if(i<1){ // if(i<1){
// System.err.println("--------------------------保存使用记录失败!---------------------------"); // System.err.println("--------------------------保存使用记录失败!---------------------------");
// } // }
//同步设备运行状态
//获取设备当前运行状态
Integer valveState = data1.getInt("valveState");
Integer runStatus = null;
if(valveState==0){
runStatus=2;
} else if (valveState==1) {
runStatus=1;
}
if(runStatus!=null){
new LambdaUpdateChainWrapper<>(deviceReportInfoMapper).set(DeviceReportInfo::getRunStatus,runStatus).eq(DeviceReportInfo::getSerialNumber,serialNumber).update();
}
} }
//收到关阀时定时报文 //收到关阀时定时报文
else if(JSONUtil.parseObj(data1).get("action").equals("safeMsg")){ else if(JSONUtil.parseObj(data1).get("action").equals("safeMsg")){