添加查询七天内的回放录像的功能模块

This commit is contained in:
XinYi Song 2022-02-15 14:06:04 +08:00
parent d3ac08778d
commit d8268ef1c8

View File

@ -131,4 +131,50 @@ public class EquipmentController {
List<Map<String, String>> equipment = equipmentDao.findEquipment();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,equipment,locale);
}
/**
* 查询录像回放根据设备编码和时间段
* @param map
* @return
* @throws JsonProcessingException
*/
@PostMapping("/getHistoricalVideo")
public String getHistoricalVideo(@RequestBody Map map) throws JsonProcessingException {
// 设备编码
String deviceCode = (String) map.get("deviceCode");
// 开始时间
String beginTime = (String) map.get("beginTime");
// 结束时间
String endTime = (String) map.get("endTime");
if(deviceCode == null || "".equals(deviceCode)){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"设备编码不能为空!",locale);
}
if(beginTime == null || "".equals(beginTime)){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"开始时间不能为空!",locale);
}
if(endTime == null || "".equals(endTime)){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"结束时间不能为空!",locale);
}
String token = GetTokenTool.getToken();
String url = "https://111.26.161.203:443/admin/API/hls/getRecordUrl?token=" + token;
JSONObject jsonObject = new JSONObject();
jsonObject.put("devicecode",deviceCode);
jsonObject.put("chnSeq","0");
jsonObject.put("streamType","1");
jsonObject.put("recordSource","3");
jsonObject.put("beginTime",beginTime);
jsonObject.put("recordType","0");
jsonObject.put("endTime",endTime);
List list = new ArrayList(3);
list.add(jsonObject);
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("hlsBeanXoList",list);
/*JSONObject jsonObject2 = new JSONObject();
jsonObject2.put("data",jsonObject1);*/
String s = RequestUtil.doPostJson(url, jsonObject1.toString());
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = objectMapper.readTree(s);
String data = jsonNode.get("data").asText();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,data,locale);
}
}