调用海康查询监控点列表v2

This commit is contained in:
guoshengxiong 2024-09-06 09:43:04 +08:00
parent 13b12f861e
commit 75bdfdf411
5 changed files with 64 additions and 0 deletions

View File

@ -379,5 +379,20 @@ public class VideoItemController {
return Result.success(videoItemService.countStatusTrend(param));
}
@ApiOperation(value = "调用海康查询监控点列表v2", notes = "调用海康查询监控点列表v2", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目sn", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "name", value = "名称模糊搜索最大长度32若包含中文最大长度指不超过按照指定编码的字节长度即getBytes(\"utf-8\").length", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "isSubRegion", value = "true时搜索regionIndexCodes及其子孙区域的资源 false时只搜索 regionIndexCodes的资源", paramType = "body", required = true, dataType = "Boolean"),
@ApiImplicitParam(name = "pageNo", value = "当前页码", paramType = "body", required = true, dataType = "Number"),
@ApiImplicitParam(name = "pageSize", value = "分页大小", paramType = "body", required = true, dataType = "Number"),
@ApiImplicitParam(name = "orderBy", value = "排序字段,注意:排序字段必须是查询条件,否则返回参数错误", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "orderType", value = "降序升序,降序desc 升序asc", paramType = "body", required = true, dataType = "String"),
})
@PostMapping(value = "/camera/search")
public Result<Object> searchCameraFromHk(@ApiIgnore @RequestBody Map<String, Object> param) {
return Result.success(videoItemService.searchCameraFromHk(param));
}
}

View File

@ -257,4 +257,6 @@ public interface IVideoItemService extends IService<VideoItem> {
* @return
*/
List<CountStatusVo> countStatusTrend(Map<String, Object> param);
String searchCameraFromHk(Map<String, Object> param);
}

View File

@ -756,4 +756,17 @@ public class VideoItemServiceImpl extends ServiceImpl<VideoItemMapper, VideoItem
return rtList;
}
@Override
public String searchCameraFromHk(Map<String, Object> param) {
ProjectVideoConfig projectVideoConfig = getEnableProjectVideoConfigByProjectSn(param);
if (projectVideoConfig == null) {
throw new OpenAlertException("未启用视频配置");
}
if (Objects.equals(projectVideoConfig.getVideoType(), ProjectVideoConfigVideoTypeEnum.ISC.getValue())) {
return HikVideoUtil.searchCamera(param, projectVideoConfig.getAccount(), projectVideoConfig.getPassword(), projectVideoConfig.getAppId(), projectVideoConfig.getAppSecret());
} else {
throw new OpenAlertException("未启用海康视频配置");
}
}
}

View File

@ -80,6 +80,23 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
http.authorizeRequests()
//请求路径允许访问
.antMatchers("/xmgl/videoItem/camera/search").permitAll()
.antMatchers("/xmgl/videoItem/getVideoItemInfo").permitAll()
.antMatchers("/xmgl/contractorProjectMonthlyWeeklyReport/flow/add").permitAll()
.antMatchers("/xmgl/projectEnterprise/flow/add").permitAll()
.antMatchers("/xmgl/flowExceptionLog/flow/add").permitAll()
.antMatchers("/xmgl/flowExceptionLog/add").permitAll()
.antMatchers("/xmgl/civilEngineeringQualityInspectionOrder/flow/add").permitAll()
.antMatchers("/xmgl/nondestructiveTestOrderTicket/flow/add").permitAll()
.antMatchers("/xmgl/constructionEquipmentTool/flow/add").permitAll()
.antMatchers("/xmgl/xzSupplierQualificationApply/flow/start/token").permitAll()
.antMatchers("/xmgl/xzSupplierQualificationApply/flow/saveInfo").permitAll()
.antMatchers("/xmgl/pouringOrderLedger/flow/add").permitAll()
.antMatchers("/xmgl/qualityCommonProblemRecord/flow/add").permitAll()
.antMatchers("/xmgl/liftingOperation/flow/add").permitAll()
.antMatchers("/xmgl/confinedSpaceOperation/flow/add").permitAll()
.antMatchers("/xmgl/firstOrderFire/flow/add").permitAll()
.antMatchers("/xmgl/heightPermit/flow/add").permitAll()
.antMatchers("/xmgl/dangerEnvironmentEvaluate/flow/add").permitAll()
.antMatchers("/xmgl/firstExampleManage/flow/add").permitAll()
.antMatchers("/actuator/**").permitAll()

View File

@ -565,4 +565,21 @@ public class HikVideoUtil {
//log.info(data);
}
public static String searchCamera(Map<String, Object> param, String ip, String port, String appke, String appSecret) {
final String getCamsApi = ARTEMIS_PATH + "/api/resource/v2/camera/search";
String body = JSON.toJSONString(param);
Map<String, String> path = new HashMap<String, String>(2) {
{
put("https://", getCamsApi);
}
};
String host = ip + ":" + port;
String result = doPostStringArtemis(host, path, body, null, null, "application/json", appke, appSecret);
log.info("海康查询监控点列表v2返回结果:{}", result);
if (result != null && result.length() > 0) {
return result;
} else {
throw new OpenAlertException(MessageUtil.get("failErr"));
}
}
}