|
@@ -136,6 +136,10 @@ public class ShotPictureTaskExecutors {
|
|
|
}
|
|
|
// 排除缓存中未删除, 但是系统中删除的情况
|
|
|
for (Object hashAlarmKey : hashAlarmKeys) {
|
|
|
+ //如果报警信息数据库不存在但报警缓存中存在, 则进行删除
|
|
|
+ if(!lockedMsgAlarmCameraCodes.contains(hashAlarmKey)){
|
|
|
+ redisService.redisTemplate.opsForHash().delete(CAMERA_ALARM_HASH, hashAlarmKey);
|
|
|
+ }
|
|
|
// 如果在数据库中都不存在, 则进行删除删除
|
|
|
if (!hashAlarmKeys.contains(hashAlarmKey) && !hashNormalKeys.contains(hashAlarmKey)) {
|
|
|
redisService.redisTemplate.opsForHash().delete(CAMERA_ALARM_HASH, hashAlarmKey);
|
|
@@ -160,7 +164,7 @@ public class ShotPictureTaskExecutors {
|
|
|
/**
|
|
|
* 处理预警摄像头截图, 间隔: 5s
|
|
|
*/
|
|
|
- @Scheduled(fixedDelay = 1 * 1000, initialDelay = 10 * 1000)
|
|
|
+ @Scheduled(fixedDelay = 5 * 1000, initialDelay = 10 * 1000)
|
|
|
public void batchProcess() {
|
|
|
if (!isMaster) return;
|
|
|
// 填充默认路径
|
|
@@ -215,6 +219,40 @@ public class ShotPictureTaskExecutors {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 处理预警摄像头截图, 间隔: 1s
|
|
|
+ */
|
|
|
+ @Scheduled(fixedDelay = 1 * 1000, initialDelay = 10 * 1000)
|
|
|
+ public void batchAlarmProcess() {
|
|
|
+ if (!isMaster) return;
|
|
|
+ // 填充默认路径
|
|
|
+ String address = storeAddress;
|
|
|
+ //获取截图开关
|
|
|
+ Integer status = redisCache.getCacheObject("shot_switch");
|
|
|
+ if(status == null){
|
|
|
+ List<SysDictData> dataList = iSysDictTypeService.selectDictDataByType("shot_switch");
|
|
|
+ if(CollectionUtils.isEmpty(dataList)){
|
|
|
+ redisCache.setCacheObject("shot_switch",2);
|
|
|
+ status = redisCache.getCacheObject("shot_switch");
|
|
|
+ }else{
|
|
|
+ redisCache.setCacheObject("shot_switch",dataList.get(0).getStatus());
|
|
|
+ status = redisCache.getCacheObject("shot_switch");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 判断开关是否执行
|
|
|
+ if (status != 1) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 获取字典值: 截图存放路径
|
|
|
+ List<SysDictData> addressDataList = DictUtils.getDictCache("shot_address");
|
|
|
+ if(CollectionUtils.isEmpty(addressDataList) || Objects.isNull(addressDataList.get(0))){
|
|
|
+ DictUtils.setDictCache("shot_address", addressDataList = iSysDictTypeService.selectDictDataByType("shot_address"));
|
|
|
+ }
|
|
|
+ if(!CollectionUtils.isEmpty(addressDataList) && Objects.nonNull(addressDataList.get(0))){
|
|
|
+ address = addressDataList.get(0).getDictLabel();
|
|
|
+ }
|
|
|
Map<Object, Object> alarmEntries = redisService.redisTemplate.opsForHash().entries(CAMERA_ALARM_HASH);
|
|
|
if (!CollectionUtils.isEmpty(alarmEntries)) {
|
|
|
final String finalAddress = address;
|
|
@@ -241,5 +279,4 @@ public class ShotPictureTaskExecutors {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|