Commit c6249b21 by YG8999

mqtt回复消息写入

parent 6682a26e
......@@ -17,7 +17,7 @@ public enum MqttReportType {
// topic: 解析网关下属锁id信息: 锁id、信号值、电量、锁状态
MQTT_GATEWAY_BATCH_REPORT("batch_report", "解析网关下属锁id信息", "/thing/data/batch_report"),
// topic: 下发组号、锁id/取电开关id列表 回复主题
MQTT_GATEWAY_PROPERTY_SET("property_set", "下发组号、锁id/取电开关id信息回复主题", "/thing/property/set"),
MQTT_GATEWAY_PROPERTY_SET_RESPONSE("property_set_response", "下发组号、锁id/取电开关id信息回复主题", "/thing/property/set_response"),
MQTT_GATEWAY_EXECUTE_RESPONSE("execute_response", "开门、取电、语音返回信息主题", "/thing/action/execute_response")
;
private String code;
......
......@@ -140,6 +140,8 @@ public class MqttxServiceImpl implements MqttxService {
isSuccess = this.updateDevice(topic, payload);
} else if (topic.endsWith(MqttReportType.getTopicStr("execute_response"))) {
isSuccess = this.updateDeviceLog(topic, payload);
} else if (topic.endsWith(MqttReportType.getTopicStr("property_set_response"))) {
isSuccess = this.updateDeviceLog(topic, payload);
}
return isSuccess;
}
......@@ -533,7 +535,7 @@ public class MqttxServiceImpl implements MqttxService {
JSONObject json = JSONUtil.parseObj(payload);
if (json.size() > 0) {
JSONArray array = json.getJSONArray("params");
if (array != null) {
if (array != null && array.size() > 0) {
List<Device> list = new ArrayList<>();
for (Object o : array) {
JSONArray jsonArray = JSONUtil.parseArray(o);
......
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 to comment