fix: 开关数据状态变化,bug修复。
This commit is contained in:
@@ -2,6 +2,7 @@ package com.intc.iot.handler;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONConfig;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.intc.iot.domain.AquMapMessageWarnCallNotice;
|
||||
@@ -163,7 +164,7 @@ public class DeviceDataHandler {
|
||||
*/
|
||||
public void handlePropertyPost(String topic, String payload) {
|
||||
try {
|
||||
JSONObject data = JSONUtil.parseObj(payload);
|
||||
JSONObject data = new JSONObject(payload, JSONConfig.create().setIgnoreCase(false));
|
||||
|
||||
// 解析飞燕平台消息格式
|
||||
JSONObject params = data.getJSONObject("params");
|
||||
@@ -196,7 +197,7 @@ public class DeviceDataHandler {
|
||||
if (isController) {
|
||||
// 判断数据类型(开关数据和传感器数据不会同时出现)
|
||||
if (hasSwitchData(params)) {
|
||||
// 开关数据:更新MySQL的开关状态和电压电流
|
||||
// 开关数据:更新开关状态和电压电流
|
||||
handleSwitchData(deviceName, params);
|
||||
} else if (hasSensorData(params)) {
|
||||
// 传感器数据:写入TDengine
|
||||
@@ -252,7 +253,7 @@ public class DeviceDataHandler {
|
||||
*/
|
||||
public void handleEventPost(String topic, String payload) {
|
||||
try {
|
||||
JSONObject data = JSONUtil.parseObj(payload);
|
||||
JSONObject data = new JSONObject(payload, JSONConfig.create().setIgnoreCase(false));
|
||||
|
||||
JSONObject params = data.getJSONObject("params");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user