去掉视频在线状态查询接口
parent
5be62326e2
commit
6af7dca5fe
|
|
@ -137,10 +137,5 @@ public class AttCctvBaseController {
|
||||||
return R.ok(ret);
|
return R.ok(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "视频点列表(带在线状态)")
|
|
||||||
@GetMapping("/listWithStatus")
|
|
||||||
public R<List<AttCctvBase>> listWithStatus() {
|
|
||||||
return R.ok(service.listWithStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -125,8 +125,4 @@ public class AttCctvBase implements Serializable {
|
||||||
private Date createTime;
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
@TableField(exist = false)
|
|
||||||
@Schema(description="在线状态,0离线,1在线")
|
|
||||||
private Integer online;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,20 +1,12 @@
|
||||||
package com.gunshi.project.xyt.service;
|
package com.gunshi.project.xyt.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gunshi.project.xyt.entity.vo.CameraOnlineVo;
|
|
||||||
import com.gunshi.project.xyt.mapper.AttCctvBaseMapper;
|
import com.gunshi.project.xyt.mapper.AttCctvBaseMapper;
|
||||||
import com.gunshi.project.xyt.model.AttCctvBase;
|
import com.gunshi.project.xyt.model.AttCctvBase;
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 描述: 视频基本信息表
|
* 描述: 视频基本信息表
|
||||||
* author: xusan
|
* author: xusan
|
||||||
|
|
@ -26,22 +18,6 @@ import java.util.stream.Collectors;
|
||||||
public class AttCctvBaseService extends ServiceImpl<AttCctvBaseMapper, AttCctvBase>
|
public class AttCctvBaseService extends ServiceImpl<AttCctvBaseMapper, AttCctvBase>
|
||||||
{
|
{
|
||||||
|
|
||||||
@Resource
|
|
||||||
private IscService iscService;
|
|
||||||
|
|
||||||
public List<AttCctvBase> listWithStatus() {
|
|
||||||
List<AttCctvBase> list = this.list();
|
|
||||||
if(CollectionUtils.isEmpty(list)){
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
|
||||||
List<String> indexCodes = list.stream().map(AttCctvBase::getIndexCode).collect(Collectors.toList());
|
|
||||||
List<CameraOnlineVo> cameraOnlineVos = iscService.getCameraOnlineStatus(indexCodes);
|
|
||||||
Map<String, Integer> map = cameraOnlineVos.stream().collect(Collectors.toMap(CameraOnlineVo::getIndexCode, CameraOnlineVo::getOnline));
|
|
||||||
for (AttCctvBase base : list){
|
|
||||||
base.setOnline(map.get(base.getIndexCode()));
|
|
||||||
}
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,72 +0,0 @@
|
||||||
package com.gunshi.project.xyt.service;
|
|
||||||
|
|
||||||
import cn.hutool.json.JSONArray;
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.gunshi.project.xyt.entity.vo.CameraOnlineVo;
|
|
||||||
import com.hikvision.artemis.sdk.ArtemisHttpUtil;
|
|
||||||
import com.hikvision.artemis.sdk.config.ArtemisConfig;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Description:
|
|
||||||
* Created by wanyan on 2024/7/26
|
|
||||||
*
|
|
||||||
* @author wanyan
|
|
||||||
* @version 1.0
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class IscService {
|
|
||||||
|
|
||||||
public List<CameraOnlineVo> getCameraOnlineStatus(List<String> indexCodes) {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* STEP1:设置平台参数,根据实际情况,设置host appkey appsecret 三个参数.
|
|
||||||
*/
|
|
||||||
|
|
||||||
ArtemisConfig.host="223.76.234.232:1443";
|
|
||||||
ArtemisConfig.appKey="22410244";
|
|
||||||
ArtemisConfig.appSecret="6WYT5OVPyCHJJmaaAZr9";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* STEP2:设置OpenAPI接口的上下文
|
|
||||||
*/
|
|
||||||
final String ARTEMIS_PATH = "/artemis";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* STEP3:设置接口的URI地址
|
|
||||||
*/
|
|
||||||
final String previewURLsApi = ARTEMIS_PATH + "/api/nms/v1/online/camera/get";
|
|
||||||
Map<String, String> path = new HashMap<String, String>(2) {
|
|
||||||
{
|
|
||||||
put("https://", previewURLsApi);//根据现场环境部署确认是http还是https
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* STEP4:设置参数提交方式
|
|
||||||
*/
|
|
||||||
String contentType = "application/json";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* STEP5:组装请求参数
|
|
||||||
*/
|
|
||||||
JSONObject jsonBody = new JSONObject();
|
|
||||||
jsonBody.put("indexCodes", indexCodes);
|
|
||||||
jsonBody.put("pageNo", 1);
|
|
||||||
jsonBody.put("pageSize", 1000);
|
|
||||||
String body = jsonBody.toString();
|
|
||||||
/**
|
|
||||||
* STEP6:调用接口
|
|
||||||
*/
|
|
||||||
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType , null);// post请求application/json类型参数
|
|
||||||
JSONObject obj = JSONUtil.parseObj(result);
|
|
||||||
JSONObject jsonObject = obj.getJSONObject("data");
|
|
||||||
JSONArray list = jsonObject.getJSONArray("list");
|
|
||||||
return list.toList(CameraOnlineVo.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue