Commit b9813778 by huangjy

fix:设备告警问题

parent 21882d5b
package com.makeit.external.strategy; package com.makeit.external.strategy;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
...@@ -82,7 +83,7 @@ public class HuiNengStrategy implements OpenApiBaseStrategy { ...@@ -82,7 +83,7 @@ public class HuiNengStrategy implements OpenApiBaseStrategy {
reportInfo.setTurnState(bodymove.equals("0") ? "0" : "1"); reportInfo.setTurnState(bodymove.equals("0") ? "0" : "1");
data.add(reportInfo); data.add(reportInfo);
dto.setData(data); dto.setData(data);
String reqJson = JSON.toJSONString(dto); String reqJson = JSONUtil.toJsonStr(dto);
String url = platTenant.getOpenApiUrl() + "/admin-api/v1/HealthMonitoringEquipment/TimingdataPush?token=aHVpbmVuZ2dhbnpoaV9wdXNoc2V0"; String url = platTenant.getOpenApiUrl() + "/admin-api/v1/HealthMonitoringEquipment/TimingdataPush?token=aHVpbmVuZ2dhbnpoaV9wdXNoc2V0";
log.info("请求url:{},参数:{}", url, reqJson); log.info("请求url:{},参数:{}", url, reqJson);
String result = HttpUtil.createPost(url) String result = HttpUtil.createPost(url)
......
...@@ -111,7 +111,7 @@ public class PushCallback implements MqttCallback { ...@@ -111,7 +111,7 @@ public class PushCallback implements MqttCallback {
// 收到消息并设置返回字符串格式 // 收到消息并设置返回字符串格式
String payload = new String(message.getPayload(), "UTF-8"); String payload = new String(message.getPayload(), "UTF-8");
logger.info("接收消息内容:payload格式:{}", payload); //logger.info("接收消息内容:payload格式:{}", payload);
// 解析数据 // 解析数据
DeviceInfo device = JSON.parseObject(payload, DeviceInfo.class); DeviceInfo device = JSON.parseObject(payload, DeviceInfo.class);
...@@ -210,13 +210,13 @@ public class PushCallback implements MqttCallback { ...@@ -210,13 +210,13 @@ public class PushCallback implements MqttCallback {
PlatDevice platDevice = deviceCacheUtil.get(deviceId + ":" + iot_tenantId); PlatDevice platDevice = deviceCacheUtil.get(deviceId + ":" + iot_tenantId);
if (platDevice == null) { if (platDevice == null) {
logger.error("获取设备信息异常,设备iot-id,iot_tenantId:" + deviceId+","+iot_tenantId); logger.error("获取设备信息异常,设备iot-id,iot_tenantId:" + deviceId+","+iot_tenantId);
return; continue;
} }
List<PlatAlarmConfig> deviceAlarmConfigList = alarmConfigCacheUtil.getDeviceAlarmConfigMap(platDevice); List<PlatAlarmConfig> deviceAlarmConfigList = alarmConfigCacheUtil.getDeviceAlarmConfigMap(platDevice);
deviceAlarmConfigList.removeIf(Objects::isNull); deviceAlarmConfigList.removeIf(Objects::isNull);
if (CollectionUtils.isEmpty(deviceAlarmConfigList)) { if (CollectionUtils.isEmpty(deviceAlarmConfigList)) {
logger.error("该设备没有告警配置,设备iot-id,iot_tenantId:" + deviceId+","+iot_tenantId); logger.error("该设备没有告警配置,设备iot-id,iot_tenantId:" + deviceId+","+iot_tenantId);
return; continue;
} }
handleOffBed(platDevice,properties,messageType); handleOffBed(platDevice,properties,messageType);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment