main
周文涛 2 years ago
parent 998d915ee3
commit d23e32343e

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

Loading…
Cancel
Save