From d772fedd4df8eecb78085c112e4939d29ba1b665 Mon Sep 17 00:00:00 2001
From: Administrator <ard@qq.com>
Date: 星期四, 26 十月 2023 09:58:46 +0800
Subject: [PATCH] 修改报错
---
ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java | 203 ++++++++++++++++++++++++--------------------------
1 files changed, 97 insertions(+), 106 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java
index 61ef513..3181820 100644
--- a/ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java
+++ b/ard-work/src/main/java/com/ruoyi/inspect/service/impl/InspectionTaskManager.java
@@ -1,106 +1,97 @@
-package com.ruoyi.inspect.service.impl;
-
-import com.ruoyi.constant.Global;
-import com.ruoyi.device.camera.domain.CameraCmd;
-import com.ruoyi.device.hiksdk.common.GlobalVariable;
-import com.ruoyi.device.hiksdk.service.IHikClientService;
-import com.ruoyi.device.hiksdk.service.impl.HikClientServiceImpl;
-import com.ruoyi.inspect.domain.ArdVideoInspectTask;
-import com.ruoyi.inspect.mapper.ArdVideoInspectTaskMapper;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.Resource;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @Description: 宸℃浠诲姟绠$悊
- * @ClassName: InspectionTaskManager
- * @Author: 鍒樿嫃涔�
- * @Date: 2023骞�06鏈�01鏃�10:40
- * @Version: 1.0
- **/
-
-@Component
-@Slf4j(topic = "PatrolInspectionTask")
-public class InspectionTaskManager {
-
- @Resource
- ArdVideoInspectTaskMapper ardVideoInspectTaskMapper;
- @Resource
- private IHikClientService hikClientService;
-
- public static Map<String, InspectionTask> taskMap;//宸插惎鍔ㄤ换鍔ap
-
- public InspectionTaskManager() {
- taskMap = new HashMap<>();
- }
-
- public Map<String, InspectionTask> getTaskMap() {
- return taskMap;
- }
-
- /*鍚姩浠诲姟*/
- public void startInspectionTask(String taskId) {
- if(taskMap.containsKey(taskId))
- {
- log.info("宸℃浠诲姟宸插惎鍔細" + taskId);
- return;
- }
- /*姣忔鍚姩浠诲姟娓呯┖浠诲姟褰撳墠姝ラ淇℃伅*/
- ArdVideoInspectTask ardVideoInspectTask = ardVideoInspectTaskMapper.selectArdVideoInspectTaskById(taskId);
- ardVideoInspectTask.setCurrentStepId("");
- ardVideoInspectTask.setCurrentStepStartTime("");
- ardVideoInspectTaskMapper.updateArdVideoInspectTask(ardVideoInspectTask);
- /*灏嗗叧鑱旂殑鐩告満褰曞儚鍏抽棴*/
- if( Global.task_record.contains(taskId))
- {
-// Integer userId = GlobalVariable.loginMap.get(ardVideoInspectTask.getCameraId());//鑾峰彇褰撳墠鐩告満鐨勭櫥褰旾D
-// if( GlobalVariable.user_real_Map.containsKey(userId))
-// { //褰撳墠鐩告満姝e湪褰曞儚锛屽垯鍋滄褰曞儚
-// CameraCmd cmd = new CameraCmd();
-// cmd.setCameraId(ardVideoInspectTask.getCameraId());
-// cmd.setChannelNum(ardVideoInspectTask.getChannel());
-// cmd.setEnable(false);//鍋滄褰曞儚
-// cmd.setUploadMinio(false);
-// hikClientService.recordToMinio(cmd);
-// }
- Global.task_record.remove(taskId);
- }
- InspectionTask task = new InspectionTask(taskId);
- task.start();
- taskMap.put(taskId, task);
- log.info("宸℃浠诲姟鍚姩锛�" + taskId);
- }
- /*鍋滄浠诲姟*/
- public void stopInspectionTask(String taskId) {
- /*灏嗕换鍔℃楠や俊鎭竻绌�*/
- ArdVideoInspectTask ardVideoInspectTask = ardVideoInspectTaskMapper.selectArdVideoInspectTaskById(taskId);
- ardVideoInspectTask.setCurrentStepId("");
- ardVideoInspectTask.setCurrentStepStartTime("");
- ardVideoInspectTaskMapper.updateArdVideoInspectTask(ardVideoInspectTask);
- /*灏嗗叧鑱旂殑鐩告満褰曞儚鍏抽棴*/
- Integer userId = GlobalVariable.loginMap.get(ardVideoInspectTask.getCameraId());//鑾峰彇褰撳墠鐩告満鐨勭櫥褰旾D
- if( GlobalVariable.user_real_Map.containsKey(userId))
- { //褰撳墠鐩告満姝e湪褰曞儚锛屽垯鍋滄褰曞儚
- CameraCmd cmd = new CameraCmd();
- cmd.setCameraId(ardVideoInspectTask.getCameraId());
- cmd.setChannelNum(ardVideoInspectTask.getChannel());
- cmd.setEnable(false);//鍋滄褰曞儚
- cmd.setUploadMinio(false);
- hikClientService.recordToMinio(cmd);
- GlobalVariable.user_real_Map.remove(userId);
- }
- InspectionTask task = taskMap.get(taskId);
- if (task != null) {
- task.stop();
- taskMap.remove(taskId);
- log.info("宸℃浠诲姟宸插仠姝細" + taskId);
-
- } else {
- log.info("鎵句笉鍒版寚瀹氱殑宸℃浠诲姟锛�" + taskId);
- }
- }
-}
+package com.ruoyi.inspect.service.impl;
+
+import com.ruoyi.device.camera.domain.CameraCmd;
+import com.ruoyi.utils.sdk.common.GlobalVariable;
+import com.ruoyi.utils.sdk.hiksdk.service.IHikClientService;
+import com.ruoyi.inspect.domain.ArdVideoInspectTask;
+import com.ruoyi.inspect.mapper.ArdVideoInspectTaskMapper;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @Description: 宸℃浠诲姟绠$悊
+ * @ClassName: InspectionTaskManager
+ * @Author: 鍒樿嫃涔�
+ * @Date: 2023骞�06鏈�01鏃�10:40
+ * @Version: 1.0
+ **/
+
+@Component
+@Slf4j(topic = "patrolInspectionTask")
+public class InspectionTaskManager {
+
+ @Resource
+ ArdVideoInspectTaskMapper ardVideoInspectTaskMapper;
+ @Resource
+ private IHikClientService hikClientService;
+
+ public static Map<String, InspectionTask> taskMap;//宸插惎鍔ㄤ换鍔ap
+
+ public InspectionTaskManager() {
+ taskMap = new HashMap<>();
+ }
+
+ public Map<String, InspectionTask> getTaskMap() {
+ return taskMap;
+ }
+
+ /*鍚姩浠诲姟*/
+ public void startInspectionTask(String taskId) {
+ if(taskMap.containsKey(taskId))
+ {
+ log.info("鎵嬪姩宸℃浠诲姟宸插惎鍔細" + taskId);
+ return;
+ }
+ /*姣忔鍚姩浠诲姟娓呯┖浠诲姟褰撳墠姝ラ淇℃伅*/
+ ArdVideoInspectTask ardVideoInspectTask = ardVideoInspectTaskMapper.selectArdVideoInspectTaskById(taskId);
+ String cameraId = ardVideoInspectTask.getCameraId();
+ /*灏嗗綋鍓嶇浉鏈虹殑鎵�鏈変换鍔″綋鍓嶆椂闂寸疆绌�*/
+ ardVideoInspectTask=new ArdVideoInspectTask();
+ ardVideoInspectTask.setCameraId(cameraId);
+ List<ArdVideoInspectTask> ardVideoInspectTasks = ardVideoInspectTaskMapper.selectArdVideoInspectTaskList(ardVideoInspectTask);
+ if(ardVideoInspectTasks.size()>0) {
+ for (ArdVideoInspectTask VideoInspectTask : ardVideoInspectTasks) {
+ VideoInspectTask.setCurrentStepStartTime("");
+ ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(VideoInspectTask);
+ }
+ }
+ /*寮�鍚换鍔�*/
+ InspectionTask task = new InspectionTask(taskId);
+ task.start();
+ taskMap.put(taskId, task);
+ log.info("鎵嬪姩宸℃浠诲姟鍚姩锛�" + taskId);
+ }
+ /*鍋滄浠诲姟*/
+ public void stopInspectionTask(String taskId) {
+
+ ArdVideoInspectTask ardVideoInspectTask = ardVideoInspectTaskMapper.selectArdVideoInspectTaskById(taskId);
+ /*灏嗗叧鑱旂殑鐩告満褰曞儚鍏抽棴*/
+ String cameraId = ardVideoInspectTask.getCameraId();
+ if( GlobalVariable.previewMap.containsKey(cameraId))
+ { //褰撳墠鐩告満姝e湪褰曞儚锛屽垯鍋滄褰曞儚
+ CameraCmd cmd = new CameraCmd();
+ cmd.setCameraId(ardVideoInspectTask.getCameraId());
+ cmd.setChanNo(ardVideoInspectTask.getChannel());
+ hikClientService.recordStopNotToMinio(cmd);
+ GlobalVariable.previewMap.remove(cameraId);
+ }
+ /*鍋滄浠诲姟*/
+ InspectionTask task = taskMap.get(taskId);
+ if (task != null) {
+ task.stop();
+ taskMap.remove(taskId);
+ log.info("鎵嬪姩宸℃浠诲姟宸插仠姝細" + taskId);
+ /*灏嗕换鍔℃楠や俊鎭竻绌�*/
+ ardVideoInspectTask.setCurrentStepId("");
+ ardVideoInspectTask.setCurrentStepStartTime("");
+ ardVideoInspectTaskMapper.updateArdVideoInspectTaskWithCurrentSetpInfo(ardVideoInspectTask);
+ } else {
+ log.info("鎵句笉鍒版寚瀹氱殑鎵嬪姩宸℃浠诲姟锛�" + taskId);
+ }
+ }
+}
--
Gitblit v1.9.3