From f6c0d4d0de50d284464d080db0481d475d7dfe0c Mon Sep 17 00:00:00 2001 From: zhouwentao <1577701412@qq.com> Date: Fri, 15 Sep 2023 10:56:17 +0800 Subject: [PATCH] updates --- .../com/example/zxweb/utils/IotUtils.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/main/java/com/example/zxweb/utils/IotUtils.java b/src/main/java/com/example/zxweb/utils/IotUtils.java index afc0d33..bf81e63 100644 --- a/src/main/java/com/example/zxweb/utils/IotUtils.java +++ b/src/main/java/com/example/zxweb/utils/IotUtils.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject; import com.example.zxweb.common.constant.DevConstant; import com.example.zxweb.common.constant.enums.IotApiEnum; import com.example.zxweb.exception.BusinessException; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; @@ -18,6 +19,7 @@ import java.util.List; * @Date 2023/9/8 11:59 */ @Component +@Slf4j public class IotUtils { //请求服务地址 https://10.0.10.153:2443/api/iot/v1 private static final String API_PREFIX = "https://10.0.10.153:2443/api/iot/v1"; @@ -87,16 +89,14 @@ public class IotUtils { System.out.println(requestBody.toJSONString()); try { JSONObject jsonObject = postApi(IotApiEnum.getPathByText("向设备发送方法"), requestBody); - Integer code = jsonObject.getInteger("code"); - if (code==0) { - JSONObject data = jsonObject.getJSONObject("data"); - if (data!=null) { - JSONObject outputData = data.getJSONObject("outputData"); - if (outputData!=null) { - String code1 = outputData.getString("code"); - if (StringUtils.isNotBlank(code1) && "1".equals(code1)) { - return true;//更改成功 - } + log.info(jsonObject.toJSONString()); + JSONObject data = jsonObject.getJSONObject("data"); + if (data!=null) { + JSONObject outputData = data.getJSONObject("outputData"); + if (outputData!=null) { + Integer code1 = outputData.getInteger("code"); + if (code1!=null && 1==code1) { + return true;//更改成功 } } }