From 6af7dca5fea7087486c9ad161c35f948b6bfdd69 Mon Sep 17 00:00:00 2001 From: wany <13995595726@qq.com> Date: Thu, 1 Aug 2024 10:48:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E8=A7=86=E9=A2=91=E5=9C=A8?= =?UTF-8?q?=E7=BA=BF=E7=8A=B6=E6=80=81=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xyt/controller/AttCctvBaseController.java | 5 -- .../gunshi/project/xyt/model/AttCctvBase.java | 4 -- .../xyt/service/AttCctvBaseService.java | 24 ------- .../project/xyt/service/IscService.java | 72 ------------------- 4 files changed, 105 deletions(-) delete mode 100644 src/main/java/com/gunshi/project/xyt/service/IscService.java diff --git a/src/main/java/com/gunshi/project/xyt/controller/AttCctvBaseController.java b/src/main/java/com/gunshi/project/xyt/controller/AttCctvBaseController.java index df57c1b..b5182e0 100644 --- a/src/main/java/com/gunshi/project/xyt/controller/AttCctvBaseController.java +++ b/src/main/java/com/gunshi/project/xyt/controller/AttCctvBaseController.java @@ -137,10 +137,5 @@ public class AttCctvBaseController { return R.ok(ret); } - @Operation(summary = "视频点列表(带在线状态)") - @GetMapping("/listWithStatus") - public R> listWithStatus() { - return R.ok(service.listWithStatus()); - } } \ No newline at end of file diff --git a/src/main/java/com/gunshi/project/xyt/model/AttCctvBase.java b/src/main/java/com/gunshi/project/xyt/model/AttCctvBase.java index 46410c7..d716bb5 100644 --- a/src/main/java/com/gunshi/project/xyt/model/AttCctvBase.java +++ b/src/main/java/com/gunshi/project/xyt/model/AttCctvBase.java @@ -125,8 +125,4 @@ public class AttCctvBase implements Serializable { private Date createTime; - @TableField(exist = false) - @Schema(description="在线状态,0离线,1在线") - private Integer online; - } \ No newline at end of file diff --git a/src/main/java/com/gunshi/project/xyt/service/AttCctvBaseService.java b/src/main/java/com/gunshi/project/xyt/service/AttCctvBaseService.java index 1db6b86..de00a92 100644 --- a/src/main/java/com/gunshi/project/xyt/service/AttCctvBaseService.java +++ b/src/main/java/com/gunshi/project/xyt/service/AttCctvBaseService.java @@ -1,20 +1,12 @@ package com.gunshi.project.xyt.service; -import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; 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.model.AttCctvBase; -import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; 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 @@ -26,22 +18,6 @@ import java.util.stream.Collectors; public class AttCctvBaseService extends ServiceImpl { - @Resource - private IscService iscService; - - public List listWithStatus() { - List list = this.list(); - if(CollectionUtils.isEmpty(list)){ - return new ArrayList<>(); - } - List indexCodes = list.stream().map(AttCctvBase::getIndexCode).collect(Collectors.toList()); - List cameraOnlineVos = iscService.getCameraOnlineStatus(indexCodes); - Map map = cameraOnlineVos.stream().collect(Collectors.toMap(CameraOnlineVo::getIndexCode, CameraOnlineVo::getOnline)); - for (AttCctvBase base : list){ - base.setOnline(map.get(base.getIndexCode())); - } - return list; - } } diff --git a/src/main/java/com/gunshi/project/xyt/service/IscService.java b/src/main/java/com/gunshi/project/xyt/service/IscService.java deleted file mode 100644 index dd35257..0000000 --- a/src/main/java/com/gunshi/project/xyt/service/IscService.java +++ /dev/null @@ -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 getCameraOnlineStatus(List 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 path = new HashMap(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); - } -}