|
@@ -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;
|
|
@@ -70,6 +73,9 @@ public class ShotPictureTaskExecutors {
|
|
|
|
|
|
@Resource
|
|
|
private BaseCameraManagementMapper baseCameraManagementMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private BaseRailwayManagementMapper baseRailwayManagementMapper;
|
|
|
@Autowired
|
|
|
RedisCache redisCache;
|
|
|
|
|
@@ -99,10 +105,14 @@ 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);
|
|
|
// 数据库中存在的数据, 但是缓存中不存在, 则进行补全
|
|
@@ -110,6 +120,8 @@ public class ShotPictureTaskExecutors {
|
|
|
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);
|
|
@@ -192,6 +204,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));
|
|
@@ -215,6 +229,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));
|