|
@@ -1,6 +1,7 @@
|
|
|
package com.ozs.web.controller.shotschedule;
|
|
|
|
|
|
import com.ozs.common.core.domain.entity.SysDictData;
|
|
|
+import com.ozs.common.core.redis.RedisCache;
|
|
|
import com.ozs.common.utils.DictUtils;
|
|
|
import com.ozs.system.service.ISysDictDataService;
|
|
|
import com.ozs.system.service.ISysDictTypeService;
|
|
@@ -38,6 +39,8 @@ public class ShotPictureExecutors {
|
|
|
private String storeAddress;
|
|
|
@Resource
|
|
|
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
|
|
+ @Autowired
|
|
|
+ RedisCache redisCache;
|
|
|
|
|
|
/**
|
|
|
* 处理非预警摄像头截图
|
|
@@ -47,12 +50,18 @@ public class ShotPictureExecutors {
|
|
|
public void handleNormalPicture() {
|
|
|
|
|
|
try {
|
|
|
- List<SysDictData> dataList = DictUtils.getDictCache("shot_switch");
|
|
|
- if(CollectionUtils.isEmpty(dataList)){
|
|
|
- dataList = iSysDictTypeService.selectDictDataByType("shot_switch");
|
|
|
- DictUtils.setDictCache("shot_switch",dataList);
|
|
|
+ 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(Boolean.parseBoolean(dataList.get(0).getDictLabel())){
|
|
|
+ if(status == 1){
|
|
|
this.threadPoolTaskExecutor.execute(taskService::getNormalPicture);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -67,12 +76,18 @@ public class ShotPictureExecutors {
|
|
|
@Scheduled(fixedRate = 500)
|
|
|
public void handleAlarmPicture() {
|
|
|
try {
|
|
|
- List<SysDictData> dataList = DictUtils.getDictCache("shot_switch");
|
|
|
- if(CollectionUtils.isEmpty(dataList)){
|
|
|
- dataList = iSysDictTypeService.selectDictDataByType("shot_switch");
|
|
|
- DictUtils.setDictCache("shot_switch",dataList);
|
|
|
+ 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(Boolean.parseBoolean(dataList.get(0).getDictLabel())){
|
|
|
+ if(status == 1){
|
|
|
this.threadPoolTaskExecutor.execute(taskService::getAlarmPicture);
|
|
|
}
|
|
|
} catch (Exception e) {
|