|
@@ -32,7 +32,10 @@ import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.time.Duration;
|
|
|
-import java.util.*;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
+import java.util.Set;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -155,9 +158,9 @@ public class ShotPictureTaskExecutors {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 处理预警摄像头截图, 间隔: 5s
|
|
|
+ * 处理非预警摄像头截图, 间隔: 5s
|
|
|
*/
|
|
|
- @Scheduled(fixedDelay = 1 * 1000, initialDelay = 10 * 1000)
|
|
|
+ @Scheduled(fixedDelay = 5 * 1000, initialDelay = 10 * 1000)
|
|
|
public void batchProcess() {
|
|
|
if (!isMaster) return;
|
|
|
// 填充默认路径
|
|
@@ -212,6 +215,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;
|