|
|
@ -4,9 +4,10 @@ import com.alibaba.fastjson.JSON; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
import com.inspect.base.core.constant.Color; |
|
|
import com.inspect.base.core.constant.Color; |
|
|
import com.inspect.base.core.domain.Response; |
|
|
import com.inspect.base.core.domain.Response; |
|
|
import com.inspect.base.core.exception.ServiceException; |
|
|
|
|
|
import com.inspect.ivs.base.feign.view.SipbDeviceListView; |
|
|
import com.inspect.ivs.base.feign.view.SipbDeviceListView; |
|
|
import com.inspect.ivs.constant.IvsConst; |
|
|
import com.inspect.ivs.constant.IvsConst; |
|
|
|
|
|
import com.inspect.ivs.domain.Temp; |
|
|
|
|
|
import com.inspect.ivs.domain.TempConfiguration; |
|
|
import com.inspect.ivs.service.IvsCommonService; |
|
|
import com.inspect.ivs.service.IvsCommonService; |
|
|
import com.inspect.ivs.util.UriUtils; |
|
|
import com.inspect.ivs.util.UriUtils; |
|
|
import com.inspect.ivs.view.IvsPlatformSnapshotView; |
|
|
import com.inspect.ivs.view.IvsPlatformSnapshotView; |
|
|
@ -16,15 +17,10 @@ import com.inspect.ivs.vo.IvsDevChanListVo; |
|
|
import com.inspect.ivs.vo.IvsDevChanSnapVo; |
|
|
import com.inspect.ivs.vo.IvsDevChanSnapVo; |
|
|
|
|
|
|
|
|
import java.io.*; |
|
|
import java.io.*; |
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.HashMap; |
|
|
import java.util.HashMap; |
|
|
|
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
import java.util.Timer; |
|
|
|
|
|
import java.util.TimerTask; |
|
|
|
|
|
import java.util.concurrent.Callable; |
|
|
|
|
|
import java.util.concurrent.ExecutionException; |
|
|
|
|
|
import java.util.concurrent.FutureTask; |
|
|
|
|
|
import javax.servlet.ServletOutputStream; |
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
|
|
|
import org.apache.http.HttpResponse; |
|
|
import org.apache.http.HttpResponse; |
|
|
import org.apache.http.client.methods.HttpGet; |
|
|
import org.apache.http.client.methods.HttpGet; |
|
|
@ -34,12 +30,8 @@ import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.beans.factory.annotation.Value; |
|
|
import org.springframework.core.io.InputStreamResource; |
|
|
import org.springframework.core.io.InputStreamResource; |
|
|
import org.springframework.http.HttpMethod; |
|
|
|
|
|
import org.springframework.http.MediaType; |
|
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.http.ResponseEntity; |
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
@RestController |
|
|
@RestController |
|
|
@RequestMapping({"/api/v1/device"}) |
|
|
@RequestMapping({"/api/v1/device"}) |
|
|
@ -50,12 +42,117 @@ public class IvsDeviceController { |
|
|
private String activeProfile; |
|
|
private String activeProfile; |
|
|
@Value("${ivs.version:3800}") |
|
|
@Value("${ivs.version:3800}") |
|
|
private String version; |
|
|
private String version; |
|
|
|
|
|
@Value("${ivs.address}") |
|
|
|
|
|
private String address; |
|
|
private final IvsCommonService ivsCommonService; |
|
|
private final IvsCommonService ivsCommonService; |
|
|
|
|
|
|
|
|
public IvsDeviceController(IvsCommonService ivsCommonService) { |
|
|
public IvsDeviceController(IvsCommonService ivsCommonService) { |
|
|
this.ivsCommonService = ivsCommonService; |
|
|
this.ivsCommonService = ivsCommonService; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 设置红外规则 |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostMapping("/setHwConfig") |
|
|
|
|
|
public String setHwConfig(@RequestBody TempConfiguration tempConfiguration) throws Exception { |
|
|
|
|
|
JSONObject json = new JSONObject(); |
|
|
|
|
|
JSONObject configItem = new JSONObject(); |
|
|
|
|
|
List<Map<String, Object>> alarmSettingListEx = new ArrayList<>(); |
|
|
|
|
|
Map<String, Object> alarmSettings = new HashMap<>(); |
|
|
|
|
|
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<>(); |
|
|
|
|
|
ruleItem.put("blockBodyTemp", 0);//写死 |
|
|
|
|
|
ruleItem.put("reflectedTemp", 0);//写死 |
|
|
|
|
|
ruleItem.put("usefReflectedTemp", false);//写死 |
|
|
|
|
|
ruleItem.put("alarmSettingList", alarmSettingListEx);//写死 |
|
|
|
|
|
radiometryRuleExList.add(ruleItem); |
|
|
|
|
|
|
|
|
|
|
|
// 设置 configItem |
|
|
|
|
|
configItem.put("radiometryRuleExList", radiometryRuleExList); |
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> radiometryRuleList = new ArrayList<>(); |
|
|
|
|
|
JSONObject radiometryRule = new JSONObject(); |
|
|
|
|
|
Map<String, Object> localParam = new HashMap<>(); |
|
|
|
|
|
List<Map<String, Object>> alarmSettingList = new ArrayList<>(); |
|
|
|
|
|
Map<String, Object> alarmSetting = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
radiometryRule.put("areaSubType", 1);//区域测温的子类型 1:矩形 |
|
|
|
|
|
radiometryRule.put("enable", 1);//使能 |
|
|
|
|
|
radiometryRule.put("meterType", 3);//区域 |
|
|
|
|
|
radiometryRule.put("presetId", tempConfiguration.getPresetId());//传 预置位id |
|
|
|
|
|
radiometryRule.put("ruleId", 12);//自己取最大没人用的 |
|
|
|
|
|
radiometryRule.put("samplePeriod", 3);// |
|
|
|
|
|
radiometryRule.put("name", tempConfiguration.getName());//传 定义一个名字 |
|
|
|
|
|
|
|
|
|
|
|
//设置localParam |
|
|
|
|
|
localParam.put("enable", 1); |
|
|
|
|
|
localParam.put("objectDistance", 4); |
|
|
|
|
|
localParam.put("objectEmissivity", 0.9700000286102295); |
|
|
|
|
|
localParam.put("refalectedTemp", 25); |
|
|
|
|
|
|
|
|
|
|
|
//设置alarmSettingList |
|
|
|
|
|
alarmSetting.put("alarmCondition", 1); |
|
|
|
|
|
alarmSetting.put("duration", 30); |
|
|
|
|
|
alarmSetting.put("enable", 1); |
|
|
|
|
|
alarmSetting.put("hysteresis", 0.10000000149011612); |
|
|
|
|
|
alarmSetting.put("id", 0); |
|
|
|
|
|
alarmSetting.put("resultType", 2); |
|
|
|
|
|
alarmSetting.put("threshold", 20.1); |
|
|
|
|
|
alarmSettingList.add(alarmSetting); |
|
|
|
|
|
|
|
|
|
|
|
radiometryRule.put("alarmSettingList", alarmSettingList); |
|
|
|
|
|
radiometryRule.put("localParam", localParam); |
|
|
|
|
|
// |
|
|
|
|
|
radiometryRule.put("polygonList", tempConfiguration.getPolygonList()); |
|
|
|
|
|
|
|
|
|
|
|
radiometryRuleList.add(radiometryRule); |
|
|
|
|
|
configItem.put("radiometryRuleList", radiometryRuleList); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
json.put("deviceCode", tempConfiguration.getCameraCode());//传 |
|
|
|
|
|
json.put("configType", 500);//写死500 |
|
|
|
|
|
json.put("configItem", configItem); |
|
|
|
|
|
System.out.println(json); |
|
|
|
|
|
String message = JSON.toJSONString(json); |
|
|
|
|
|
String resp = ivsCommonService.sendSSLPostString(address+"/device/setdeviceconfig", message); |
|
|
|
|
|
return "0"; |
|
|
|
|
|
// JSONObject jsonObject = JSON.parseObject(resp); |
|
|
|
|
|
// String resultCode = jsonObject.getString("resultCode"); |
|
|
|
|
|
// if(resultCode.equals("0")){ |
|
|
|
|
|
// return Response.ok(); |
|
|
|
|
|
// } |
|
|
|
|
|
// return Response.fail(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 获取红外数据 |
|
|
|
|
|
* @param |
|
|
|
|
|
* @return |
|
|
|
|
|
* @throws Exception |
|
|
|
|
|
*/ |
|
|
|
|
|
@PostMapping("/temper") |
|
|
|
|
|
public Response temper(@RequestBody Temp temp){ |
|
|
|
|
|
String cameraCode = temp.getCameraCode(); //cameraCode摄像机编码 |
|
|
|
|
|
int presetId = temp.getPresetId(); //预设位ID |
|
|
|
|
|
int ruleId = temp.getRuleId(); //规则ID 暂时写死取12就行 |
|
|
|
|
|
// int meterType = temp.getMeterType(); |
|
|
|
|
|
String requestMsg = "presetId=" + presetId+ "&" + "ruleId=" + ruleId + "&" + "meterType=" + 3; |
|
|
|
|
|
//发送请求 |
|
|
|
|
|
String resp = ivsCommonService.sendsslGetCookie(address+"/device/radiometry-temper/"+cameraCode, requestMsg, "UTF-8"); |
|
|
|
|
|
JSONObject jsonObject = JSON.parseObject(resp); |
|
|
|
|
|
String resultCode = jsonObject.getString("resultCode"); |
|
|
|
|
|
if(resultCode.equals("0")){ |
|
|
|
|
|
return Response.ok(); |
|
|
|
|
|
} |
|
|
|
|
|
return Response.fail(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@GetMapping({"channelsnap"}) |
|
|
@GetMapping({"channelsnap"}) |
|
|
public ResponseEntity<InputStreamResource> channelSnap(IvsDevChanSnapVo ivsDevChanSnapVo) throws Exception { |
|
|
public ResponseEntity<InputStreamResource> channelSnap(IvsDevChanSnapVo ivsDevChanSnapVo) throws Exception { |
|
|
if (version.equals("1800")) { |
|
|
if (version.equals("1800")) { |
|
|
@ -136,7 +233,7 @@ public class IvsDeviceController { |
|
|
|
|
|
|
|
|
public byte[] Ivs1800channelSnap(IvsDevChanSnapVo ivsDevChanSnapVo) throws Exception { |
|
|
public byte[] Ivs1800channelSnap(IvsDevChanSnapVo ivsDevChanSnapVo) throws Exception { |
|
|
log.info("++++++++++++++++++++++++执行1800channelsnap截图接口++++++++++++++++++++++++++++++"); |
|
|
log.info("++++++++++++++++++++++++执行1800channelsnap截图接口++++++++++++++++++++++++++++++"); |
|
|
String url = "https://172.27.144.61:18531/snapshot/manualsnapshot"; |
|
|
|
|
|
|
|
|
String url = address+"/snapshot/manualsnapshot"; |
|
|
Map<String, Object> controlMap = new HashMap<>(); |
|
|
Map<String, Object> controlMap = new HashMap<>(); |
|
|
controlMap.put("cameraCode", ivsDevChanSnapVo.getCameraCode()); |
|
|
controlMap.put("cameraCode", ivsDevChanSnapVo.getCameraCode()); |
|
|
String requestMsg = JSON.toJSONString(controlMap); |
|
|
String requestMsg = JSON.toJSONString(controlMap); |
|
|
|