|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.inspect.base.core.constant.Color; |
|
|
|
import com.inspect.base.core.domain.Response; |
|
|
|
import com.inspect.base.core.utils.StringUtils; |
|
|
|
import com.inspect.ivs.base.feign.view.SipbDeviceListView; |
|
|
|
import com.inspect.ivs.constant.IvsConst; |
|
|
|
import com.inspect.ivs.domain.Temp; |
|
|
|
@ -20,7 +21,6 @@ import com.inspect.ivs.vo.IvsDevChanSnapVo; |
|
|
|
import java.io.*; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.http.HttpResponse; |
|
|
|
import org.apache.http.client.methods.HttpGet; |
|
|
|
import org.apache.http.impl.client.CloseableHttpClient; |
|
|
|
@ -81,23 +81,26 @@ public class IvsDeviceController { |
|
|
|
ruleItem.put("alarmSettingList", alarmSettingListEx);//写死 |
|
|
|
radiometryRuleExList.add(ruleItem); |
|
|
|
// 遍历 FastJSON 的 JSONArray |
|
|
|
for (Object obj : radiometryRuleExListOrginl) { |
|
|
|
if (obj instanceof JSONObject) { |
|
|
|
JSONObject jsonObject = (JSONObject) obj; |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
// FastJSON 的 JSONObject 可以直接转换为 Map |
|
|
|
map = jsonObject.getInnerMap(); // 直接获取内部 Map |
|
|
|
// 或者逐个处理 key-value(更安全) |
|
|
|
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { |
|
|
|
map.put(entry.getKey(), entry.getValue()); |
|
|
|
if(StringUtils.isNotNull(radiometryRuleExListOrginl)){ |
|
|
|
for (Object obj : radiometryRuleExListOrginl) { |
|
|
|
if (obj instanceof JSONObject) { |
|
|
|
JSONObject jsonObject = (JSONObject) obj; |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
// FastJSON 的 JSONObject 可以直接转换为 Map |
|
|
|
map = jsonObject.getInnerMap(); // 直接获取内部 Map |
|
|
|
// 或者逐个处理 key-value(更安全) |
|
|
|
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { |
|
|
|
map.put(entry.getKey(), entry.getValue()); |
|
|
|
} |
|
|
|
radiometryRuleExList.add(map); |
|
|
|
} else if (obj instanceof String) { |
|
|
|
// 处理基本类型(如果 JSONArray 中包含字符串等) |
|
|
|
Map<String, Object> map = Collections.singletonMap("value", obj); |
|
|
|
radiometryRuleExList.add(map); |
|
|
|
} |
|
|
|
radiometryRuleExList.add(map); |
|
|
|
} else if (obj instanceof String) { |
|
|
|
// 处理基本类型(如果 JSONArray 中包含字符串等) |
|
|
|
Map<String, Object> map = Collections.singletonMap("value", obj); |
|
|
|
radiometryRuleExList.add(map); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 设置 configItem |
|
|
|
configItem.put("radiometryRuleExList", radiometryRuleExList); |
|
|
|
List<Map<String, Object>> radiometryRuleList = new ArrayList<>(); |
|
|
|
@ -132,23 +135,26 @@ public class IvsDeviceController { |
|
|
|
radiometryRuleList.add(radiometryRule); |
|
|
|
|
|
|
|
// 遍历 FastJSON 的 JSONArray |
|
|
|
for (Object obj : radiometryRuleListOrginl) { |
|
|
|
if (obj instanceof JSONObject) { |
|
|
|
JSONObject jsonObject = (JSONObject) obj; |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
// FastJSON 的 JSONObject 可以直接转换为 Map |
|
|
|
map = jsonObject.getInnerMap(); // 直接获取内部 Map |
|
|
|
// 或者逐个处理 key-value(更安全) |
|
|
|
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { |
|
|
|
map.put(entry.getKey(), entry.getValue()); |
|
|
|
if(StringUtils.isNotNull(radiometryRuleListOrginl)){ |
|
|
|
for (Object obj : radiometryRuleListOrginl) { |
|
|
|
if (obj instanceof JSONObject) { |
|
|
|
JSONObject jsonObject = (JSONObject) obj; |
|
|
|
Map<String, Object> map = new HashMap<>(); |
|
|
|
// FastJSON 的 JSONObject 可以直接转换为 Map |
|
|
|
map = jsonObject.getInnerMap(); // 直接获取内部 Map |
|
|
|
// 或者逐个处理 key-value(更安全) |
|
|
|
for (Map.Entry<String, Object> entry : jsonObject.entrySet()) { |
|
|
|
map.put(entry.getKey(), entry.getValue()); |
|
|
|
} |
|
|
|
radiometryRuleList.add(map); |
|
|
|
} else if (obj instanceof String) { |
|
|
|
// 处理基本类型(如果 JSONArray 中包含字符串等) |
|
|
|
Map<String, Object> map = Collections.singletonMap("value", obj); |
|
|
|
radiometryRuleList.add(map); |
|
|
|
} |
|
|
|
radiometryRuleList.add(map); |
|
|
|
} else if (obj instanceof String) { |
|
|
|
// 处理基本类型(如果 JSONArray 中包含字符串等) |
|
|
|
Map<String, Object> map = Collections.singletonMap("value", obj); |
|
|
|
radiometryRuleList.add(map); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
configItem.put("radiometryRuleList", radiometryRuleList); |
|
|
|
json.put("deviceCode", tempConfiguration.getCameraCode().split("#")[0]);//传 |
|
|
|
json.put("configType", 500);//写死500 |
|
|
|
|