Browse Source

报警详情 返回相机编码

sunhh 1 year ago
parent
commit
2bb6ae63a3

+ 22 - 0
vehicle-admin/src/main/java/com/ozs/web/controller/accountmanagment/MsgAlarmController.java

@@ -257,8 +257,30 @@ public class MsgAlarmController extends BaseController {
                 wrapper.eq(BaseRailwayManagement::getRailwayCode, msgAlarm.getRailwayCode());
             }
             BaseRailwayManagement baseRailwayManagement = baseRailwayManagementService.getOne(wrapper);
+            if (StringUtils.isEmptySunhh(baseRailwayManagement)) {
+                return AjaxResult.error("线路编码:" + msgAlarm.getRailwayCode() + "不存在!");
+            }
+            // 查询里程位置最近的相机
+            LambdaQueryWrapper<BaseCameraManagement> lw = new LambdaQueryWrapper<>();
+            if (!StringUtils.isEmptySunhh(msgAlarm.getRailwayCode())) {
+                lw.eq(BaseCameraManagement::getRailwayCode, msgAlarm.getRailwayCode());
+            }
+            if (!StringUtils.isEmptySunhh(msgAlarm.getAlarmMile())) {
+                lw.le(BaseCameraManagement::getBeginMile, msgAlarm.getAlarmMile());
+                lw.gt(BaseCameraManagement::getEndMile, msgAlarm.getAlarmMile());
+            }
+            List<BaseCameraManagement> baseCameraManagementList = baseCameraManagementService.list(lw);
+            BaseCameraManagement baseCameraManagement = new BaseCameraManagement();
+            if (!StringUtils.isEmptySunhh(baseCameraManagementList) && baseCameraManagementList.size() > 0) {
+                baseCameraManagement = baseCameraManagementList.get(0);
+            }
+//        BaseCameraManagement baseCameraManagement = baseCameraManagementMapper.selectOne(lw);
+            if (StringUtils.isEmptySunhh(baseCameraManagement)) {
+                return AjaxResult.error("线路编码:" + msgAlarm.getRailwayCode() + "不存在对应里程范围为:"+ msgAlarm.getAlarmMile() +"的相机!");
+            }
             MsgAlarmResp msgAlarmResp = new MsgAlarmResp();
             BeanUtils.copyProperties(msgAlarm, msgAlarmResp);
+            msgAlarmResp.setCameraCode(baseCameraManagement.getCameraCode());
             if (!StringUtils.isEmptySunhh(msgAlarm.getReleasedBy())) {
 //                BaseUser user = baseUserService.getUser(msgAlarm.getReleasedBy());
 //                if (!StringUtils.isEmptySunhh(user) && !StringUtils.isEmptySunhh(user.getNickName())) {