|
@@ -6,6 +6,7 @@ import cn.hutool.core.lang.Dict;
|
|
|
import cn.hutool.json.JSONUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.ozs.common.core.domain.entity.SysDictData;
|
|
|
+import com.ozs.common.core.redis.RedisCache;
|
|
|
import com.ozs.common.utils.DictUtils;
|
|
|
import com.ozs.service.entity.BaseCameraManagement;
|
|
|
import com.ozs.service.entity.MsgAlarm;
|
|
@@ -16,6 +17,7 @@ import com.ozs.service.service.RedisService;
|
|
|
import com.ozs.system.service.ISysDictTypeService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
@@ -68,6 +70,8 @@ public class ShotPictureTaskExecutors {
|
|
|
|
|
|
@Resource
|
|
|
private BaseCameraManagementMapper baseCameraManagementMapper;
|
|
|
+ @Autowired
|
|
|
+ RedisCache redisCache;
|
|
|
|
|
|
|
|
|
/**
|
|
@@ -139,33 +143,38 @@ public class ShotPictureTaskExecutors {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 处理非预警摄像头截图, 间隔: 60s
|
|
|
+ * 处理预警摄像头截图, 间隔: 5s
|
|
|
*/
|
|
|
@Scheduled(fixedDelay = 5 * 1000, initialDelay = 10 * 1000)
|
|
|
public void batchProcess() {
|
|
|
if (!isMaster) return;
|
|
|
// 填充默认路径
|
|
|
String address = storeAddress;
|
|
|
- // 获取字典值: 获取截图开关
|
|
|
- List<SysDictData> dataList = DictUtils.getDictCache("shot_switch");
|
|
|
- if (CollectionUtils.isEmpty(dataList)) {
|
|
|
- DictUtils.setDictCache("shot_switch", dataList = iSysDictTypeService.selectDictDataByType("shot_switch"));
|
|
|
+ //获取截图开关
|
|
|
+ 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");
|
|
|
+ }
|
|
|
}
|
|
|
// 判断开关是否执行
|
|
|
-// boolean shotSwitch = CollectionUtils.isEmpty(dataList) && Boolean.parseBoolean(dataList.get(0).getDictLabel());
|
|
|
-// if (!shotSwitch) {
|
|
|
+// if (status != 1) {
|
|
|
// return;
|
|
|
// }
|
|
|
// 获取字典值: 截图存放路径
|
|
|
List<SysDictData> addressDataList = DictUtils.getDictCache("shot_address");
|
|
|
- if (CollectionUtils.isEmpty(addressDataList)) {
|
|
|
+ if(CollectionUtils.isEmpty(addressDataList) || Objects.isNull(addressDataList.get(0))){
|
|
|
DictUtils.setDictCache("shot_address", addressDataList = iSysDictTypeService.selectDictDataByType("shot_address"));
|
|
|
}
|
|
|
- // 设置路径地址为字典表最终值
|
|
|
- if (!CollectionUtils.isEmpty(dataList) && Boolean.parseBoolean(dataList.get(0).getDictLabel())
|
|
|
- && !CollectionUtils.isEmpty(addressDataList)) {
|
|
|
+ if(!CollectionUtils.isEmpty(addressDataList) && Objects.nonNull(addressDataList.get(0))){
|
|
|
address = addressDataList.get(0).getDictLabel();
|
|
|
}
|
|
|
+ // 设置路径地址为字典表最终值
|
|
|
Map<Object, Object> entries = redisService.redisTemplate.opsForHash().entries(CAMERA_NORMAL_HASH);
|
|
|
if (!CollectionUtils.isEmpty(entries)) {
|
|
|
final String finalAddress = address;
|