Browse Source

ivs1800红外流程调试

master
王寅 6 months ago
parent
commit
fc46a1c186
2 changed files with 72 additions and 5 deletions
  1. +71
    -5
      inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsDeviceController.java
  2. +1
    -0
      inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/controller/PatrolPresetPosController.java

+ 71
- 5
inspect-ivs/src/main/java/com/inspect/ivs/controller/IvsDeviceController.java View File

@ -1,6 +1,7 @@
package com.inspect.ivs.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.inspect.base.core.constant.Color;
import com.inspect.base.core.domain.Response;
@ -17,10 +18,7 @@ import com.inspect.ivs.vo.IvsDevChanListVo;
import com.inspect.ivs.vo.IvsDevChanSnapVo;
import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
@ -57,6 +55,14 @@ public class IvsDeviceController {
*/
@PostMapping("/setHwConfig")
public Response setHwConfig(@RequestBody TempConfiguration tempConfiguration) throws Exception {
Temp temp = new Temp();
temp.setCameraCode(tempConfiguration.getCameraCode());
JSONObject config = getConfig(temp);
JSONArray radiometryRuleExListOrginl = config.getJSONArray("radiometryRuleExList");
JSONArray radiometryRuleListOrginl = config.getJSONArray("radiometryRuleList");
log.info("[infra_1800] =======tempConfiguration: {}", tempConfiguration);
JSONObject json = new JSONObject();
JSONObject configItem = new JSONObject();
@ -65,6 +71,7 @@ public class IvsDeviceController {
alarmSettings.put("preDuration", 0);
alarmSettings.put("preThreshold", 22);
alarmSettingListEx.add(alarmSettings);
//设置blockBodyTemp
List<Map<String, Object>> radiometryRuleExList = new ArrayList<>();
Map<String, Object> ruleItem = new HashMap<>();
@ -73,6 +80,24 @@ public class IvsDeviceController {
ruleItem.put("usefReflectedTemp", false);//写死
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());
}
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<>();
@ -105,6 +130,25 @@ public class IvsDeviceController {
radiometryRule.put("localParam", localParam);
radiometryRule.put("polygonList", tempConfiguration.getPolygonList());
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());
}
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
@ -150,7 +194,29 @@ public class IvsDeviceController {
return "0";
}
/**
* 获取原始规则
*
* @param
* @return
* @throws Exception
*/
@PostMapping("/getConfig")
public JSONObject getConfig(@RequestBody Temp temp) {
log.info( "[infrared_1800] 获取红外温度 temper param: {}", temp);
String cameraCode = temp.getCameraCode().split("#")[0];
String nvrcode = temp.getCameraCode().split("#")[1];
String requestMsg = "";
//发送请求
String resp = ivsCommonService.sendsslGetCookie(address + "/device/deviceconfig/500/"+cameraCode+"/"+nvrcode, requestMsg,"UTF-8");
JSONObject jsonObject = JSON.parseObject(resp);
JSONObject configItem = jsonObject.getJSONObject("configItem");
log.info( "configItem: {}", configItem);
return configItem;
// JSONArray radiometryRuleExList = configItem.getJSONArray("radiometryRuleExList");
// JSONArray radiometryRuleList = configItem.getJSONArray("radiometryRuleList");
// return "0";
}
@GetMapping({"channelsnap"})
public ResponseEntity<InputStreamResource> channelSnap(IvsDevChanSnapVo ivsDevChanSnapVo) throws Exception {


+ 1
- 0
inspect-main/inspect-main-video/src/main/java/com/inspect/patrol/controller/PatrolPresetPosController.java View File

@ -506,6 +506,7 @@ public class PatrolPresetPosController extends BaseController {
PatrolPresetParam patrolPresetParam = patrolPresetPos.getPresetParamList().get(0);
final String temperUrl = liveSIPBUrl + "/api/v1/device/setHwConfig";
logger.info("=========temperUrl====={}", temperUrl);
logger.info("=========patrolPresetParam====={}", patrolPresetParam);
JSONObject temperParam = new JSONObject();
temperParam.put("ruleId", Integer.parseInt(patrolPresetParam.getPresetParamCode())); //设置ruleId
temperParam.put("presetId", patrolPresetPos.getPresetPosCode());


Loading…
Cancel
Save