Merge branch 'feature-BOX一期' of http://47.99.132.106:10081/wulin/qiuguo-iot into feature-BOX一期

This commit is contained in:
wulin 2023-10-09 15:07:24 +08:00
commit ee0973628e
3 changed files with 8 additions and 2 deletions

View File

@ -20,6 +20,9 @@ public enum TuyaCategoryEnum {
SD("sd", "扫地机器人", "power"), SD("sd", "扫地机器人", "power"),
DD("dd", "灯带", "switch_led"),
XXJ("xxj", "香薰机", "switch"),
; ;

View File

@ -58,6 +58,7 @@ public class MusicService {
.defaultHeader("Accept-Encoding", "gzip, deflate, br") .defaultHeader("Accept-Encoding", "gzip, deflate, br")
.defaultHeader("Connection", "keep-alive") .defaultHeader("Connection", "keep-alive")
.defaultHeader("Accept", "*") .defaultHeader("Accept", "*")
.defaultHeader("music-key", "qiuguo")
.build(); .build();
String baseUrl = "http://121.40.172.241:8031"; String baseUrl = "http://121.40.172.241:8031";
if (type == 1) { if (type == 1) {

View File

@ -1,6 +1,7 @@
package com.qiuguo.iot.third.service; package com.qiuguo.iot.third.service;
import cn.hutool.log.Log; import cn.hutool.log.Log;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.qiuguo.iot.data.entity.user.UserHandlingDeviceEntity; import com.qiuguo.iot.data.entity.user.UserHandlingDeviceEntity;
@ -190,7 +191,8 @@ public class TuyaDeviceService {
int intValue = (int) value; int intValue = (int) value;
jsonObject.put("value", intValue <= min ? min + 1 : intValue); jsonObject.put("value", intValue <= min ? min + 1 : intValue);
} }
if (javaList.contains(jsonObject)) { boolean categoryBoolean = Objects.equals(deviceInfo.getString("category"), "xxj");
if (javaList.contains(jsonObject)&&!categoryBoolean) {
tuyaResponse.setMessage("已在当前状态"); tuyaResponse.setMessage("已在当前状态");
tuyaResponse.setCode(200); tuyaResponse.setCode(200);
return Mono.just(tuyaResponse); return Mono.just(tuyaResponse);
@ -199,7 +201,7 @@ public class TuyaDeviceService {
List<JSONObject> collect = javaList.stream().filter(jl -> !ObjectUtils.isEmpty(jl.get("value"))) List<JSONObject> collect = javaList.stream().filter(jl -> !ObjectUtils.isEmpty(jl.get("value")))
.filter(jl -> !jl.getString("value").startsWith("{")) .filter(jl -> !jl.getString("value").startsWith("{"))
.filter(jl -> !jl.getString("value").startsWith("[")).collect(Collectors.toList()); .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); Boolean result = tuyaDeviceConnector.controlDevice(query.getDeviceId(), commands);
if (result) { if (result) {
tuyaResponse.setMessage("ok"); tuyaResponse.setMessage("ok");