From 40d53fc85f07155b93d92f9cec4d64c94f74abb3 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期三, 09 八月 2023 11:05:57 +0800
Subject: [PATCH] 修改相机控制优先级配置到字典
---
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RongCloudTask.java | 35 ++++++-----
/dev/null | 29 ---------
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MinioTask.java | 12 +--
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/PatrolInspectionTask.java | 25 ++------
ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java | 15 ++--
ard-work/src/main/java/com/ruoyi/test/ReadAccessDatabase.java | 11 +++
ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java | 20 +++---
7 files changed, 56 insertions(+), 91 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
index 94c327e..a5935ee 100644
--- a/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarm/global/service/impl/GlobalAlarmServiceImpl.java
@@ -30,8 +30,8 @@
import com.ruoyi.common.constant.CacheConstants;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.constant.CamPriority;
import com.ruoyi.device.external.domain.ArdEquipExternal;
import com.ruoyi.device.external.mapper.ArdEquipExternalMapper;
import com.ruoyi.utils.tools.ArdTool;
@@ -42,16 +42,12 @@
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.utils.tube.GeoPoint;
import com.ruoyi.utils.tube.TubeTools;
-import lombok.AllArgsConstructor;
-import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
-
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.*;
-import java.util.concurrent.PriorityBlockingQueue;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@@ -694,8 +690,13 @@
//鎺ユ敹鏃堕棿
guideTask.setReceiveTime(fmt.format(receiveTime));
//鎶ヨ浼樺厛绾�(閫氳繃浼樺厛绾у瓧鍏�)
- Integer priority = CamPriority.priorityMap.get(alarmType);
- guideTask.setPriority(priority);
+ String priority = DictUtils.getDictValue("cameras_priority", alarmType);
+ if(StringUtils.isEmpty(priority))
+ {
+ log.debug("鏈尮閰嶅埌浼樺厛绾�,璇锋鏌ヤ紭鍏堢骇瀛楀吀閰嶇疆");
+ return;
+ }
+ guideTask.setPriority(Integer.valueOf(priority));
//鎶ヨ娆℃暟
guideTask.setNum(num);
//褰曞儚瀛樺偍浣嶇疆
diff --git a/ard-work/src/main/java/com/ruoyi/constant/CamPriority.java b/ard-work/src/main/java/com/ruoyi/constant/CamPriority.java
deleted file mode 100644
index 3b651b6..0000000
--- a/ard-work/src/main/java/com/ruoyi/constant/CamPriority.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.ruoyi.constant;
-
-import lombok.extern.slf4j.Slf4j;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @Description: 鐩告満鎺у埗浼樺厛绾�
- * @ClassName: sdkPriority
- * @Author: 鍒樿嫃涔�
- * @Date: 2023骞�05鏈�23鏃�11:25
- * @Version: 1.0
- **/
-@Slf4j
-public class CamPriority {
-
- public static Map<String, Integer> priorityMap = new HashMap<>();
-
- static {
- priorityMap.put("sys_radar_fire", 999);//闆疯揪闃茬伀鎶ヨ
- priorityMap.put("sys_radar_move", 900);//闆疯揪绉诲姩鎶ヨ
- priorityMap.put("sys_tube_leak", 800);//绠$嚎娉勯湶鎶ヨ
- priorityMap.put("sys_radar_pumpshutdown", 800);//闆疯揪鎶芥补鏈哄仠鏈�
- priorityMap.put("sys_external", 700);//澶栬仈鎶ヨ
- priorityMap.put("sys_access_control", 600);//闂ㄧ鎶ヨ
- priorityMap.put("sys_app_onekey", 500);//app涓�閿姤璀�
- priorityMap.put("sys_patrol_inspect", 1);//宸℃
- }
-}
diff --git a/ard-work/src/main/java/com/ruoyi/test/ReadAccessDatabase.java b/ard-work/src/main/java/com/ruoyi/test/ReadAccessDatabase.java
index 4f6fa2e..7a69f81 100644
--- a/ard-work/src/main/java/com/ruoyi/test/ReadAccessDatabase.java
+++ b/ard-work/src/main/java/com/ruoyi/test/ReadAccessDatabase.java
@@ -8,14 +8,21 @@
* @Version: 1.0
**/
+import com.ruoyi.app.position.domain.ArdAppPosition;
+import com.ruoyi.utils.websocket.util.WebSocketUtils;
+import lombok.extern.slf4j.Slf4j;
+
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.sql.*;
-
+import java.util.*;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+@Slf4j
public class ReadAccessDatabase {
public static void main(String[] args) {
-
// // 澶氫釜鏁版嵁搴撴枃浠惰矾寰�
// String[] dbPaths = {
// "D:\\mdb\\閬撹矾涓績绾�.mdb",
diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java
index 25cb772..38974b1 100644
--- a/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java
+++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/aspectj/SdkOperateAspect.java
@@ -1,31 +1,26 @@
package com.ruoyi.framework.aspectj;
-import com.ruoyi.common.annotation.SdkOperate;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.domain.model.LoginUser;
+import com.ruoyi.common.core.redis.RedisCache;
+import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.constant.CamPriority;
import com.ruoyi.device.camera.domain.ArdCameras;
import com.ruoyi.device.camera.domain.CameraCmd;
import com.ruoyi.device.camera.service.IArdCamerasService;
import com.ruoyi.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
-import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.aspectj.lang.reflect.MethodSignature;
import org.springframework.stereotype.Component;
-
-import javax.annotation.Nullable;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.util.Date;
-import static jdk.nashorn.internal.runtime.regexp.joni.Config.log;
/**
* SDK鎺у埗澶勭悊
@@ -67,6 +62,7 @@
* @param joinPoint 鍒囩偣
*/
public Boolean controlScopeFilter(ProceedingJoinPoint joinPoint) {
+
//鑾峰彇璇锋眰鎺у埗鐩告満鐨勫懡浠や俊鎭�
CameraCmd cmd = (CameraCmd) joinPoint.getArgs()[0];
String operator = cmd.getOperator();//鐢宠鑰�
@@ -97,18 +93,20 @@
} else {
/*褰撳墠鐩告満鏈変汉鎺у埗骞朵笖閰嶇疆浜嗚繃鏈熸椂闂达紝鍏堝垽鏂紭鍏堢骇锛屼紭鍏堢骇楂樺厑璁告帶鍒�*/
Integer currentLevel = 0;//褰撳墠鐩告満鐨勬搷浣滆�呯殑浼樺厛绾�
- if (CamPriority.priorityMap.containsKey(currentOperator)) {
+ String camerasPriority = DictUtils.getDictValue("cameras_priority", currentOperator);
+ if(StringUtils.isNotEmpty(camerasPriority)) {
/*褰撳墠鎺у埗鑰呬负绯荤粺鎶ヨ鐢ㄦ埛*/
- currentLevel = (Integer) CamPriority.priorityMap.get(currentOperator);
+ currentLevel = Integer.valueOf(camerasPriority);
} else {
/*褰撳墠鎺у埗鑰呬负鏅�氱敤鎴�*/
SysUser sysUser = sysUserService.selectUserById(currentOperator);
currentLevel = sysUser.getCameraPriority();
}
Integer operatorLevel = 0;//鑾峰彇鐢宠鑰呯殑浼樺厛绾�
- if (CamPriority.priorityMap.containsKey(operator)) {
+ String operatorPriority = DictUtils.getDictValue("cameras_priority", operator);
+ if (StringUtils.isNotEmpty(operatorPriority)) {
/*鍖呭惈璇存槑褰撳墠鐢宠鎺у埗鑰呬负绯荤粺鎶ヨ鐢ㄦ埛*/
- operatorLevel = (Integer) CamPriority.priorityMap.get(operator);
+ operatorLevel = Integer.valueOf(operatorPriority);
} else {
/*鍚﹀垯鐢宠鎺у埗鑰呬负褰撳墠鐧诲綍鐢ㄦ埛*/
LoginUser loginUser = SecurityUtils.getLoginUser();
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MinioTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MinioTask.java
index e2cb0f7..3ca0f65 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MinioTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/MinioTask.java
@@ -26,17 +26,17 @@
log.debug("鎵ц鍘嗗彶鏁版嵁鍒犻櫎");
//閬嶅巻瀛樺偍
try {
- List<String> buckets=new ArrayList<>();
+ List<String> buckets = new ArrayList<>();
buckets.add("pic");
buckets.add("record");
- for (String name:buckets) {
+ for (String name : buckets) {
Iterable<Result<Item>> listObjectsPic = MinioUtils.getObjectsByBucket(name);
for (Result<Item> result : listObjectsPic) {
Item item = result.get();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.of("Asia/Shanghai"));
String objectTime = item.lastModified().format(formatter);
- Date now= new Date();
+ Date now = new Date();
// 鎶婃棩鏈熷線鍓嶅鍔犱竴澶�,鏁存暟寰�鍚庢帹,璐熸暟寰�鍓嶇Щ鍔�
Calendar calendar = new GregorianCalendar();
calendar.setTime(now);
@@ -49,9 +49,8 @@
log.debug("expireTime : " + expireTime);
log.debug("objectTime 鏃堕棿鍦� expireTime 涔嬪墠,鎵ц鍒犻櫎");
boolean b = MinioUtils.removeObject(name, item.objectName());
- if(b)
- {
- log.debug("鎴愬姛鍒犻櫎杩囨湡鏁版嵁锛�"+ item.objectName()+"---"+item.lastModified());
+ if (b) {
+ log.debug("鎴愬姛鍒犻櫎杩囨湡鏁版嵁锛�" + item.objectName() + "---" + item.lastModified());
}
}
}
@@ -60,5 +59,4 @@
log.error("minio鍘嗗彶鏁版嵁鍒犻櫎寮傚父锛�" + ex.getMessage());
}
}
-
}
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/PatrolInspectionTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/PatrolInspectionTask.java
index 542133a..675ff00 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/PatrolInspectionTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/PatrolInspectionTask.java
@@ -1,26 +1,10 @@
package com.ruoyi.quartz.task;
-import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
-import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
-import com.ruoyi.common.utils.DateUtils;
-import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.device.camera.domain.ArdCameras;
-import com.ruoyi.device.camera.domain.CameraCmd;
-import com.ruoyi.device.camera.service.IArdCamerasService;
-import com.ruoyi.device.hiksdk.config.MinioClientSingleton;
-import com.ruoyi.device.hiksdk.service.IHikClientService;
-import com.ruoyi.inspect.domain.ArdVideoInspectRecord;
-import com.ruoyi.inspect.domain.ArdVideoInspectTask;
-import com.ruoyi.inspect.domain.ArdVideoInspectTaskStep;
-import com.ruoyi.inspect.service.IArdVideoInspectRecordService;
import com.ruoyi.inspect.service.IArdVideoInspectTaskService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
-
import javax.annotation.Resource;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.*;
+
/**
* @Description: 宸℃浠诲姟
@@ -30,13 +14,16 @@
* @Version: 1.0
**/
@Component("PatrolInspectionTask")
-@Slf4j(topic = "PatrolInspectionTask")
public class PatrolInspectionTask {
@Resource
IArdVideoInspectTaskService ardVideoInspectTaskService;
- //宸℃浠诲姟
+ /**
+ * 瀹氭椂宸℃浠诲姟
+ * 鍒樿嫃涔�
+ * 2023/8/9 9:18:42
+ */
public void scanRun() {
ardVideoInspectTaskService.autoTaskRun();
}
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RongCloudTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RongCloudTask.java
index aa5a322..ded475e 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RongCloudTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RongCloudTask.java
@@ -28,25 +28,28 @@
ISysUserService sysUserService;
@Resource
RongCloudService rongCloudService;
+ /**
+ * 瀹氭椂鑾峰彇app鐢ㄦ埛鍦ㄧ嚎鐘舵��
+ * 鍒樿嫃涔�
+ * 2023/8/9 9:17:48
+ */
+ public void getAppUserOnlineStateTask() {
- public void getAppUserOnlineStateTask()
- {
- try{
- List<SysUser> SysUserList = sysUserService.selectAllAppUserList(new SysUser());
- if(SysUserList.size()>0) {
- for (SysUser sysUser : SysUserList) {
- Boolean online = rongCloudService.checkOnline(sysUser.getUserId());
- if (online) {
- sysUser.setAppOnlineState("1");
- } else {
- sysUser.setAppOnlineState("0");
+ try {
+ List<SysUser> SysUserList = sysUserService.selectAllAppUserList(new SysUser());
+ if (SysUserList.size() > 0) {
+ for (SysUser sysUser : SysUserList) {
+ Boolean online = rongCloudService.checkOnline(sysUser.getUserId());
+ if (online) {
+ sysUser.setAppOnlineState("1");
+ } else {
+ sysUser.setAppOnlineState("0");
+ }
+ sysUserService.updateUserProfile(sysUser);
}
- sysUserService.updateUserProfile(sysUser);
}
- }}
- catch (Exception ex)
- {
- log.error("铻嶄簯鍦ㄧ嚎鎺ュ彛寮傚父锛�"+ex.getMessage());
+ } catch (Exception ex) {
+ log.error("铻嶄簯鍦ㄧ嚎鎺ュ彛寮傚父锛�" + ex.getMessage());
}
}
}
--
Gitblit v1.9.3