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