修改香薰机-2
This commit is contained in:
parent
9c76284402
commit
c1339fc599
@ -1,6 +1,7 @@
|
||||
package com.qiuguo.iot.third.service;
|
||||
|
||||
import cn.hutool.log.Log;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.qiuguo.iot.data.entity.user.UserHandlingDeviceEntity;
|
||||
@ -190,7 +191,8 @@ public class TuyaDeviceService {
|
||||
int intValue = (int) value;
|
||||
jsonObject.put("value", intValue <= min ? min + 1 : intValue);
|
||||
}
|
||||
if (javaList.contains(jsonObject)&&!Objects.equals(deviceInfo.getString("category"),"xxj")) {
|
||||
boolean categoryBoolean = Objects.equals(deviceInfo.getString("category"), "xxj");
|
||||
if (javaList.contains(jsonObject)&&!categoryBoolean) {
|
||||
tuyaResponse.setMessage("已在当前状态");
|
||||
tuyaResponse.setCode(200);
|
||||
return Mono.just(tuyaResponse);
|
||||
@ -199,7 +201,7 @@ public class TuyaDeviceService {
|
||||
List<JSONObject> collect = javaList.stream().filter(jl -> !ObjectUtils.isEmpty(jl.get("value")))
|
||||
.filter(jl -> !jl.getString("value").startsWith("{"))
|
||||
.filter(jl -> !jl.getString("value").startsWith("[")).collect(Collectors.toList());
|
||||
commands.put("commands", collect);
|
||||
commands.put("commands", categoryBoolean ? Arrays.asList(jsonObject) : collect);
|
||||
Boolean result = tuyaDeviceConnector.controlDevice(query.getDeviceId(), commands);
|
||||
if (result) {
|
||||
tuyaResponse.setMessage("ok");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user