合并敦煌功能5
This commit is contained in:
parent
a30c1502f5
commit
2d3c64dcdb
@ -0,0 +1,9 @@
|
||||
package com.zhgd.xmgl.modules.project.entity.bo;
|
||||
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectVideoConfig;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class ProjectVideoConfigBo extends ProjectVideoConfig {
|
||||
private String ids;
|
||||
}
|
||||
@ -1,9 +1,12 @@
|
||||
package com.zhgd.xmgl.modules.project.mapper;
|
||||
|
||||
import com.zhgd.xmgl.modules.project.entity.bo.ProjectVideoConfigBo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectVideoConfig;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 视频配置
|
||||
* @author: pds
|
||||
@ -12,5 +15,9 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
*/
|
||||
@Mapper
|
||||
public interface ProjectVideoConfigMapper extends BaseMapper<ProjectVideoConfig> {
|
||||
|
||||
/**
|
||||
* 查询所有的开启的ISC的配置
|
||||
* @return
|
||||
*/
|
||||
List<ProjectVideoConfigBo> getIscConfigsGroupByConfig();
|
||||
}
|
||||
|
||||
@ -1,5 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.zhgd.xmgl.modules.project.mapper.ProjectVideoConfigMapper">
|
||||
|
||||
<select id="getIscConfigsGroupByConfig" resultType="com.zhgd.xmgl.modules.project.entity.bo.ProjectVideoConfigBo">
|
||||
select group_concat(distinct id) ids,account, password, app_id, app_secret
|
||||
from project_video_config
|
||||
where is_enable = 1
|
||||
and video_type = 3
|
||||
and account != ''
|
||||
and password != ''
|
||||
and app_id != ''
|
||||
and app_secret != ''
|
||||
and account is not null
|
||||
and password is not null
|
||||
and app_id is not null
|
||||
and app_secret is not null
|
||||
group by account, password, app_id, app_secret
|
||||
</select>
|
||||
</mapper>
|
||||
@ -1,30 +1,40 @@
|
||||
package com.zhgd.xmgl.task;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.zhgd.xmgl.async.AsyncEnvironment;
|
||||
import com.zhgd.xmgl.modules.policecamera.entity.PoliceCameraItem;
|
||||
import com.zhgd.xmgl.modules.policecamera.entity.PoliceCameraVideoConfig;
|
||||
import com.zhgd.xmgl.modules.policecamera.service.IPoliceCameraItemService;
|
||||
import com.zhgd.xmgl.modules.policecamera.service.IPoliceCameraVideoConfigService;
|
||||
import com.zhgd.xmgl.modules.project.entity.ProjectVideoConfig;
|
||||
import com.zhgd.xmgl.modules.project.entity.bo.ProjectVideoConfigBo;
|
||||
import com.zhgd.xmgl.modules.project.enums.ProjectVideoConfigVideoTypeEnum;
|
||||
import com.zhgd.xmgl.modules.project.mapper.ProjectVideoConfigMapper;
|
||||
import com.zhgd.xmgl.modules.video.entity.VideoItem;
|
||||
import com.zhgd.xmgl.modules.video.mapper.VideoItemMapper;
|
||||
import com.zhgd.xmgl.modules.video.service.impl.VideoItemServiceImpl;
|
||||
import com.zhgd.xmgl.util.HikVideoUtil;
|
||||
import com.zhgd.xmgl.util.YsVideoUtil;
|
||||
import lombok.extern.log4j.Log4j;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.javacrumbs.shedlock.core.SchedulerLock;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @program: wisdomSite
|
||||
@ -70,7 +80,7 @@ public class VideoTask {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("error:",e);
|
||||
log.error("error:", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +97,7 @@ public class VideoTask {
|
||||
videoItem.setDeviceState(state);
|
||||
videoItemMapper.updateById(videoItem);
|
||||
}
|
||||
}else if (Objects.equals(videoConfig.getVideoType(), ProjectVideoConfigVideoTypeEnum.ISC.getValue())) {
|
||||
} else if (Objects.equals(videoConfig.getVideoType(), ProjectVideoConfigVideoTypeEnum.ISC.getValue())) {
|
||||
if (StringUtils.isNotEmpty(videoConfig.getAccount()) && StringUtils.isNotEmpty(videoConfig.getPassword())
|
||||
&& StringUtils.isNotEmpty(videoConfig.getAppId()) && StringUtils.isNotEmpty(videoConfig.getAppSecret())) {
|
||||
for (VideoItem videoItem : list) {
|
||||
@ -123,7 +133,7 @@ public class VideoTask {
|
||||
/**
|
||||
* 高频更新isc监控状态
|
||||
*/
|
||||
@Scheduled(cron = "*/10 * * * * ?")
|
||||
@Scheduled(cron = "* */30 * * * ?")
|
||||
@RequestMapping("updateIscVideoState")
|
||||
public void updateIscVideoState() {
|
||||
try {
|
||||
@ -204,7 +214,7 @@ public class VideoTask {
|
||||
/**
|
||||
* 高频更新执法记录仪的isc监控状态
|
||||
*/
|
||||
@Scheduled(cron = "*/10 * * * * ?")
|
||||
@Scheduled(cron = "* */30 * * * ?")
|
||||
@RequestMapping("updatePoliceCameraItemIscVideoState")
|
||||
public void updatePoliceCameraItemIscVideoState() {
|
||||
try {
|
||||
|
||||
@ -132,6 +132,26 @@ public class HikVideoUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件获取监控点在线状态接口
|
||||
*/
|
||||
public static JSONObject callPostApiOnlineStatus(String Ip, String port, String appke, String appSecret, int pageNo) {
|
||||
final String getCamsApi = ARTEMIS_PATH + "/api/nms/v1/online/camera/get";
|
||||
Map<String, Object> paramMap = new HashMap<String, Object>();// post请求Form表单参数
|
||||
paramMap.put("pageNo", pageNo);
|
||||
paramMap.put("pageSize", 1000);
|
||||
String body = JSON.toJSON(paramMap).toString();
|
||||
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.debug("callPostApiOnlineStatus:{}", result);
|
||||
return JSONObject.parseObject(result);
|
||||
}
|
||||
|
||||
public static String setSubscriptionByEvent(String backUrl, String Ip, String port, String appke, String appSecret, Integer[] eventTypes) {
|
||||
String message = null;
|
||||
final String getCamsApi = ARTEMIS_PATH + "/api/eventService/v1/eventSubscriptionByEventTypes";
|
||||
@ -262,7 +282,7 @@ public class HikVideoUtil {
|
||||
}
|
||||
|
||||
public static String doPostStringArtemis(String host, Map<String, String> path, String body, Map<String, String> querys, String accept, String contentType, String appKey, String appSecret) {
|
||||
log.info("海康isc调用http开始>>>>>>>>> host:{},path:{},body:{}", host, JSON.toJSONString(path), body);
|
||||
log.debug("海康isc调用http开始>>>>>>>>> host:{},path:{},body:{}", host, JSON.toJSONString(path), body);
|
||||
String httpSchema = (String) path.keySet().toArray()[0];
|
||||
if (httpSchema != null && !StringUtils.isEmpty(httpSchema)) {
|
||||
String responseStr = null;
|
||||
@ -290,7 +310,7 @@ public class HikVideoUtil {
|
||||
} catch (Exception var10) {
|
||||
log.error("海康isc调用http错误>>>>>>>" + var10);
|
||||
}
|
||||
log.info("海康isc调用http结果>>>>> {}", responseStr);
|
||||
log.debug("海康isc调用http结果>>>>> {}", responseStr);
|
||||
return responseStr;
|
||||
} else {
|
||||
throw new RuntimeException("http和https参数错误httpSchema: " + httpSchema);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user