|
@@ -7,11 +7,14 @@ 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.AppendUtils;
|
|
|
import com.ozs.common.utils.DictUtils;
|
|
|
import com.ozs.service.entity.BaseCameraManagement;
|
|
|
+import com.ozs.service.entity.BaseRailwayManagement;
|
|
|
import com.ozs.service.entity.MsgAlarm;
|
|
|
import com.ozs.service.entity.vo.BaseCameraVO;
|
|
|
import com.ozs.service.mapper.BaseCameraManagementMapper;
|
|
|
+import com.ozs.service.mapper.BaseRailwayManagementMapper;
|
|
|
import com.ozs.service.mapper.MsgAlarmMapper;
|
|
|
import com.ozs.service.service.RedisService;
|
|
|
import com.ozs.system.service.ISysDictTypeService;
|
|
@@ -73,6 +76,9 @@ public class ShotPictureTaskExecutors {
|
|
|
|
|
|
@Resource
|
|
|
private BaseCameraManagementMapper baseCameraManagementMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private BaseRailwayManagementMapper baseRailwayManagementMapper;
|
|
|
@Autowired
|
|
|
RedisCache redisCache;
|
|
|
|
|
@@ -102,17 +108,23 @@ public class ShotPictureTaskExecutors {
|
|
|
.stream().map(f -> f.getCameraCode()).distinct().collect(Collectors.toList());
|
|
|
try {
|
|
|
QueryWrapper<BaseCameraManagement> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.select("distinct camera_code, channel");
|
|
|
+ queryWrapper.select("distinct camera_code, channel,railway_code,install_mile");
|
|
|
// 获取数据库中最新摄像头相关内容
|
|
|
List<BaseCameraManagement> dbAlarms = baseCameraManagementMapper.selectList(queryWrapper).stream().collect(Collectors.toList());
|
|
|
+ List<BaseRailwayManagement> dbRailways = baseRailwayManagementMapper.selectList(null);
|
|
|
if (!CollectionUtils.isEmpty(dbAlarms)) {
|
|
|
+ for(BaseRailwayManagement dbRailway:dbRailways){
|
|
|
+ redisCache.setCacheObject(dbRailway.getRailwayCode(),dbRailway.getRailwayName());
|
|
|
+ }
|
|
|
Set<Object> hashAlarmKeys = redisService.redisTemplate.opsForHash().keys(CAMERA_ALARM_HASH);
|
|
|
Set<Object> hashNormalKeys = redisService.redisTemplate.opsForHash().keys(CAMERA_NORMAL_HASH);
|
|
|
// 数据库中存在的数据, 但是缓存中不存在, 则进行补全
|
|
|
for (BaseCameraManagement dbAlarm : dbAlarms) {
|
|
|
- BaseCameraVO vo = new BaseCameraVO();
|
|
|
+ BaseCameraVO vo = new BaseCameraVO();
|
|
|
vo.setCameraCode(dbAlarm.getCameraCode());
|
|
|
vo.setChannel(dbAlarm.getChannel());
|
|
|
+ vo.setInstallMiles(AppendUtils.stringAppend(dbAlarm.getInstallMile()));
|
|
|
+ vo.setRailwayName(redisCache.getCacheObject(dbAlarm.getRailwayCode()));
|
|
|
vo.setNextExecuteTime(DateTime.now().toString("yyyy-MM-dd HH:mm:ss"));
|
|
|
if (lockedMsgAlarmCameraCodes.contains(vo.getCameraCode()) && !hashAlarmKeys.contains(vo.getCameraCode())) {
|
|
|
vo.setIsAlarm(true);
|
|
@@ -165,12 +177,13 @@ public class ShotPictureTaskExecutors {
|
|
|
status = redisCache.getCacheObject("shot_switch");
|
|
|
}
|
|
|
}
|
|
|
- //判断开关是否执行
|
|
|
- if (status != 1) return;
|
|
|
-
|
|
|
+ // 判断开关是否执行
|
|
|
+ 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(addressDataList) && Objects.nonNull(addressDataList.get(0))){
|
|
@@ -194,6 +207,8 @@ public class ShotPictureTaskExecutors {
|
|
|
dict.put("cameraCode", item.getCameraCode());
|
|
|
dict.put("channel", item.getChannel());
|
|
|
dict.put("address", finalAddress);
|
|
|
+ dict.put("railwayName", item.getRailwayName());
|
|
|
+ dict.put("installMiles", item.getInstallMiles());
|
|
|
dict.put("isAlarm", false);
|
|
|
dict.put("nextExecuteTime", item.getNextExecuteTime());
|
|
|
redisPushService.pushMsg(JSONUtil.toJsonStr(dict));
|
|
@@ -217,6 +232,8 @@ public class ShotPictureTaskExecutors {
|
|
|
dict.put("cameraCode", item.getCameraCode());
|
|
|
dict.put("channel", item.getChannel());
|
|
|
dict.put("address", finalAddress);
|
|
|
+ dict.put("railwayName", item.getRailwayName());
|
|
|
+ dict.put("installMiles", item.getInstallMiles());
|
|
|
dict.put("isAlarm", true);
|
|
|
dict.put("nextExecuteTime", item.getNextExecuteTime());
|
|
|
redisPushService.pushMsg(JSONUtil.toJsonStr(dict));
|