获取监控点回放取流URL V2, 尝试先中心存储,没有记录再设备存储
This commit is contained in:
parent
a16d2e6c60
commit
34725b6e20
@ -0,0 +1,24 @@
|
||||
package com.zhgd.xmgl.modules.ammeter.controller;
|
||||
|
||||
import com.zhgd.jeecg.common.api.vo.Result;
|
||||
import com.zhgd.jeecg.common.util.SpringContextUtils;
|
||||
import com.zhgd.xmgl.security.WebSecurityConfig;
|
||||
import io.swagger.annotations.Api;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.config.annotation.web.builders.WebSecurity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/xmgl/configReload")
|
||||
@Slf4j
|
||||
@Api(tags = "配置重载控制器")
|
||||
public class ConfigReloadController {
|
||||
|
||||
}
|
||||
@ -691,7 +691,7 @@ public class VideoItemServiceImpl extends ServiceImpl<VideoItemMapper, VideoItem
|
||||
return null;
|
||||
}
|
||||
if (projectVideoConfig.getVideoType() == 3) {
|
||||
return HikVideoUtil.callPostPlaybackURLsV2(cameraIndexCode, recordLocation, protocol, transmode, beginTime, endTime, uuid, expand, streamform, lockType, projectVideoConfig.getAccount(), projectVideoConfig.getPassword(), projectVideoConfig.getAppId(), projectVideoConfig.getAppSecret());
|
||||
return HikVideoUtil.callPostPlaybackURLsV2(cameraIndexCode, protocol, transmode, beginTime, endTime, uuid, expand, streamform, lockType, projectVideoConfig.getAccount(), projectVideoConfig.getPassword(), projectVideoConfig.getAppId(), projectVideoConfig.getAppSecret());
|
||||
} else {
|
||||
throw new OpenAlertException(MessageUtil.get("paramErr"));
|
||||
}
|
||||
|
||||
@ -80,6 +80,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
|
||||
http.authorizeRequests()
|
||||
//请求路径允许访问
|
||||
.antMatchers("/xmgl/xzEmergencyRecord/**").permitAll()
|
||||
.antMatchers("/xmgl/xzDeductScoreRecord/**").permitAll()
|
||||
.antMatchers("/xmgl/workerInfo/selectWorkerInfoByIdCard").permitAll()
|
||||
.antMatchers("/xmgl/recognition/checkFace").permitAll()
|
||||
|
||||
@ -485,7 +485,7 @@ public class HikVideoUtil {
|
||||
final String playbackURLs = ARTEMIS_PATH + "/api/video/v2/cameras/playbackURLs";
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();// post请求Form表单参数
|
||||
paramMap.put("cameraIndexCode", cameraIndexCode);
|
||||
paramMap.put("recordLocation", 1);
|
||||
paramMap.put("recordLocation", recordLocation);
|
||||
paramMap.put("protocol", "rtsp");
|
||||
paramMap.put("transmode", 0);
|
||||
paramMap.put("beginTime", DateUtils.getISO8601StrWithMs(beginTime));
|
||||
@ -503,14 +503,43 @@ public class HikVideoUtil {
|
||||
String host = Ip + ":" + port;
|
||||
log.info("调用获取监控点回放取流URLv2>>>监控点唯一标识(cameraIndexCode):{}", cameraIndexCode);
|
||||
String result = doPostStringArtemis(host, path, body, null, null, "application/json", appke, appSecret);
|
||||
JSONObject json = JSONObject.parseObject(result);
|
||||
if ("0".equals((String) json.get("code"))) {
|
||||
return JSONObject.parseObject(json.getString("data"));
|
||||
} else {
|
||||
throw new OpenAlertException(json.toJSONString());
|
||||
}
|
||||
return JSONObject.parseObject(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取监控点回放取流URL V2, 尝试先中心存储,没有记录再设备存储
|
||||
*
|
||||
* @param cameraIndexCode
|
||||
* @param protocol
|
||||
* @param transmode
|
||||
* @param beginTime
|
||||
* @param endTime
|
||||
* @param uuid
|
||||
* @param expand
|
||||
* @param streamform
|
||||
* @param lockType
|
||||
* @param Ip
|
||||
* @param port
|
||||
* @param appke
|
||||
* @param appSecret
|
||||
* @return
|
||||
*/
|
||||
public static JSONObject callPostPlaybackURLsV2(String cameraIndexCode, String protocol, Integer transmode, Date beginTime, Date endTime, String uuid, String expand, String streamform, String lockType, String Ip, String port, String appke, String appSecret) {
|
||||
log.info("调用获取监控点回放取流URLv2,中心存储方式,cameraIndexCode:{}", cameraIndexCode);
|
||||
JSONObject jsonObject = callPostPlaybackURLsV2(cameraIndexCode, 0, protocol, transmode, beginTime, endTime, uuid, expand, streamform, lockType, Ip, port, appke, appSecret);
|
||||
if (jsonObject.getString("code").equals("0") && jsonObject.getJSONObject("data").getJSONArray("list") != null && jsonObject.getJSONObject("data").getJSONArray("list").size() > 0) {
|
||||
return jsonObject;
|
||||
}
|
||||
log.info("调用获取监控点回放取流URLv2,设备存储方式,cameraIndexCode:{}", cameraIndexCode);
|
||||
jsonObject = callPostPlaybackURLsV2(cameraIndexCode, 1, protocol, transmode, beginTime, endTime, uuid, expand, streamform, lockType, Ip, port, appke, appSecret);
|
||||
if ("0".equals(jsonObject.getString("code"))) {
|
||||
return JSONObject.parseObject(jsonObject.getString("data"));
|
||||
} else if ("0x0d200b28".equals(jsonObject.getString("code"))) {
|
||||
throw new OpenAlertException("监控点不存在");
|
||||
} else {
|
||||
throw new OpenAlertException("调用获取监控点回放取流URLv2失败");
|
||||
}
|
||||
}
|
||||
|
||||
//String cameraIndexCode,String type,Integer streamType,String Ip,String port,String appke,String appSecret
|
||||
// public static void main(String[] args) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user