流量计设备实时数据接口修改,修复设备码字体服务器不支持问题。流量计设备实时数据接口调整等

This commit is contained in:
蒾酒
2024-12-23 14:47:34 +08:00
parent 38a856af55
commit a2d9eaa80e
11 changed files with 128 additions and 49 deletions

View File

@ -56,16 +56,26 @@ public class DeviceOtherMsgConsumer {
System.err.println("主题:"+topic+"--产品id:"+productId+"--设备序列号:"+serialNumber);
//设备上报数据消息
if(topic.endsWith("hzlink/info/up")){
if(topic.endsWith("/info/up")){
deviceDataReportHandler(new String(data));
//保存使用记录
NgWaterPumpUsageRecords pumpUsageRecords=new NgWaterPumpUsageRecords();
pumpUsageRecords.setDeviceNumber(serialNumber);
pumpUsageRecords.setMessageContent(new String(data));
int i = ngWaterPumpUsageRecordsMapper.insertNgWaterPumpUsageRecords(pumpUsageRecords);
if(i<1){
System.err.println("--------------------------保存使用记录失败!---------------------------");
JSONObject jsonObject = JSONUtil.parseObj(data);
if(jsonObject.getStr("type")!=null){
if(jsonObject.getStr("type").equals("waterEleData")){
String data1 = jsonObject.getStr("data");
if(JSONUtil.parseObj(data1).get("action").equals("timeMsg")){
pumpUsageRecords.setMessageContent(JSONUtil.toJsonStr(jsonObject));
int i = ngWaterPumpUsageRecordsMapper.insertNgWaterPumpUsageRecords(pumpUsageRecords);
if(i<1){
System.err.println("--------------------------保存使用记录失败!---------------------------");
}
}
}
}
//构建回复消息
Map<String,Object> reportMsg=new HashMap<>();
reportMsg.put("code",0);
@ -74,7 +84,7 @@ public class DeviceOtherMsgConsumer {
} else if ( topic.endsWith("/info/reply")) {
platformDataReportAckHandler(new String(data));
} else if (topic.endsWith("hzlink/cmd/down")) {
} else if (topic.endsWith("/cmd/down")) {
platformCmdHandler(new String(data));
//回应