diff --git a/src/main/java/com/example/zxweb/utils/IotUtils.java b/src/main/java/com/example/zxweb/utils/IotUtils.java index b36407b..8d21a32 100644 --- a/src/main/java/com/example/zxweb/utils/IotUtils.java +++ b/src/main/java/com/example/zxweb/utils/IotUtils.java @@ -2,6 +2,7 @@ package com.example.zxweb.utils; import com.alibaba.fastjson.JSONObject; import org.springframework.stereotype.Component; +import org.springframework.util.StringUtils; /** * @Description ios 设备请求工具 @@ -10,7 +11,7 @@ import org.springframework.stereotype.Component; */ @Component 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"; private static final JSONObject headers=JSONObject.parseObject("{\"x-consumer-username\":\"dwVendor\",\"appCode\":\"42142fd0jkbf4515853b7fcec64748f6\"}"); @@ -21,6 +22,9 @@ public class IotUtils { int i=0; for (String field : queryData.keySet()) { String value = (String) queryData.get(field); + if (StringUtils.isEmpty(value)) { + continue; + } sb.append(i==0?"?":"&"); sb.append(field).append("=").append(value); i++;