Bläddra i källkod

心态接口修改

gao.qiang 4 månader sedan
förälder
incheckning
c47fd9d5d5

+ 12 - 0
business-service/src/main/java/com/ozs/entity/response/BaseCameraManagementReq.java

@@ -0,0 +1,12 @@
+package com.ozs.entity.response;
+
+import lombok.Data;
+
+@Data
+public class BaseCameraManagementReq {
+
+    private Integer distance;
+    private Integer installMile;
+    private Integer lineDir;
+    private String railwayCode;
+}

+ 3 - 0
business-service/src/main/java/com/ozs/mapper/BaseCameraManagementMapper.java

@@ -3,6 +3,7 @@ package com.ozs.mapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.ozs.entity.BaseCameraManagement;
 import com.ozs.entity.SkynetHeartbeatLog;
+import com.ozs.entity.response.BaseCameraManagementReq;
 import com.ozs.entity.vo.BaseCameraManagementVo;
 import com.ozs.entity.vo.MsgAlarmVo;
 import org.apache.ibatis.annotations.Mapper;
@@ -29,4 +30,6 @@ public interface BaseCameraManagementMapper extends BaseMapper<BaseCameraManagem
     Map<String, Integer> getMessageStatisticsCamera();
 
     SkynetHeartbeatLog selectSkynetHeartbeatLogByCameraCode(@Param("cameraCode") String cameraCode);
+
+    List<BaseCameraManagement> cameraMangemnetList(BaseCameraManagementReq baseCameraManagementReq);
 }

+ 4 - 0
business-service/src/main/java/com/ozs/service/BaseCameraManagementService.java

@@ -1,9 +1,11 @@
 package com.ozs.service;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.ozs.common.core.domain.AjaxResult;
 import com.ozs.entity.BaseCameraManagement;
+import com.ozs.entity.response.BaseCameraManagementReq;
 import com.ozs.entity.vo.BaseCameraManagementHomeVo;
 import com.ozs.entity.vo.BaseCameraManagementVo;
 import com.ozs.entity.vo.BaseCameraManagementVos;
@@ -45,4 +47,6 @@ public interface BaseCameraManagementService extends IService<BaseCameraManageme
     AjaxResult nonContactAlarmCamera(String cameraCode);
 
     List<BaseVehicleTerminalDto> videoCaptureUrl(BaseVehicleTerminalDto baseVehicleTerminalDto);
+
+    List<BaseCameraManagement> cameraMangemnetList(BaseCameraManagementReq baseCameraManagementReq);
 }

+ 6 - 0
business-service/src/main/java/com/ozs/service/impl/BaseCameraManagementServiceImpl.java

@@ -14,6 +14,7 @@ import com.ozs.common.utils.StringUtils;
 import com.ozs.common.utils.bean.BeanUtils;
 import com.ozs.common.utils.bean.BeanValidators;
 import com.ozs.entity.*;
+import com.ozs.entity.response.BaseCameraManagementReq;
 import com.ozs.entity.vo.BaseCameraManagementHomeVo;
 import com.ozs.entity.vo.BaseCameraManagementVo;
 import com.ozs.entity.vo.BaseCameraManagementVos;
@@ -496,4 +497,9 @@ public class BaseCameraManagementServiceImpl extends ServiceImpl<BaseCameraManag
         }
         return urlList;
     }
+
+    @Override
+    public List<BaseCameraManagement> cameraMangemnetList(BaseCameraManagementReq baseCameraManagementReq) {
+        return baseCameraManagementMapper.cameraMangemnetList(baseCameraManagementReq);
+    }
 }

+ 32 - 0
business-service/src/main/resources/mapper/BaseCameraManagementMapper.xml

@@ -57,4 +57,36 @@
     <select id="selectSkynetHeartbeatLogByCameraCode" resultType="com.ozs.entity.SkynetHeartbeatLog" parameterType="java.lang.String">
         select /*+ GROUP_OPT_FLAG(1)*/ id, camera_code, max(create_time) as createTime from skynet_heartbeat_log where camera_code = #{cameraCode}
     </select>
+    <select id="cameraMangemnetList" resultType="com.ozs.entity.BaseCameraManagement" parameterType="com.ozs.entity.response.BaseCameraManagementReq">
+        SELECT b1.id, b1.camera_code, b1.railway_code, b1.channel, b1.dept_id, b1.station_name, b1.line_dir,
+        b1.install_mile, b1.begin_mile, b1.end_mile, b1.install_longitude, b1.install_latitude, b1.task_id,
+        b1.monitoring_direction, b1.start_recording, b1.online, b1.url, b1.enable_or_not, b1.rtsp_url, b1.grou, b1.sort,
+        b1.graphics_card, b1.train_num, b1.ab_section, b1.create_by, b1.create_time, b1.update_by, b1.update_time,
+        b1.remark
+        FROM base_camera_management b1
+        <if test="lineDir != null and lineDir == 1 ">
+            WHERE b1.install_mile &gt;= #{distance} AND b1.INSTALL_MILE &lt;= #{installMile} AND b1.monitoring_direction
+            IN (1, 3) AND b1.railway_code = #{railwayCode}
+            AND b1.online = 2 AND b1.enable_or_not = 1
+            AND NOT EXISTS (
+            SELECT 1
+            FROM base_camera_management b2
+            WHERE b1.grou = b2.grou AND b1.sort > b2.sort
+            )
+            ORDER BY b1.grou ASC, b1.sort ASC
+            LIMIT 2;
+        </if>
+        <if test="lineDir != null and lineDir == 2 ">
+            WHERE b1.install_mile &gt;= #{installMile} AND b1.INSTALL_MILE &lt;= #{distance} AND b1.monitoring_direction
+            IN (2, 3) AND b1.railway_code = #{railwayCode}
+            AND b1.online = 2 AND b1.enable_or_not = 1
+            AND NOT EXISTS (
+            SELECT 1
+            FROM base_camera_management b2
+            WHERE b1.grou = b2.grou AND b1.sort > b2.sort
+            )
+            ORDER BY b1.grou desc, b1.sort desc
+            LIMIT 2;
+        </if>
+    </select>
 </mapper>

+ 15 - 27
vehicle-sdk/src/main/java/com/ozs/controller/upload/GeoHazardMonitorTokenController.java

@@ -33,6 +33,7 @@ import com.ozs.entity.SvcAddress;
 import com.ozs.entity.TerminalIgnoreAlarm;
 import com.ozs.entity.VehiclePosition;
 import com.ozs.entity.BaseVideoTrains;
+import com.ozs.entity.response.BaseCameraManagementReq;
 import com.ozs.entity.response.PreAlarmListResponse;
 import com.ozs.entity.response.PreAlarmResponse;
 import com.ozs.entity.response.VehicleVedioResponse;
@@ -877,27 +878,20 @@ public class GeoHazardMonitorTokenController {
                         }
                         respHeartbeatVo.setPreAlarmList(responseList);
                     } else {
+                        BaseCameraManagementReq baseCameraManagementReq=new BaseCameraManagementReq();
                         //没有报警信息的时候
                         if (heartbeatVo.getLineDir() == 1) {
                             distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
-                            camera.ge(BaseCameraManagement::getInstallMile, distance);
-                            camera.le(BaseCameraManagement::getInstallMile, (heartbeatVo.getCurrentMile() + 10000));
-                            camera.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
-                            camera.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
+                            baseCameraManagementReq.setInstallMile(heartbeatVo.getCurrentMile() + 10000);
                         }
                         if (heartbeatVo.getLineDir() == 2) {
                             distance = heartbeatVo.getCurrentMile() - heartbeatVo.getVisualDistance();
-                            camera.le(BaseCameraManagement::getInstallMile, distance);
-                            camera.ge(BaseCameraManagement::getInstallMile, (heartbeatVo.getCurrentMile() - 10000));
-                            camera.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
-                            camera.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
-                            ;
+                            baseCameraManagementReq.setInstallMile(heartbeatVo.getCurrentMile() - 10000);
                         }
-                        camera.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
-                        camera.eq(BaseCameraManagement::getOnline, 2);
-                        camera.eq(BaseCameraManagement::getEnableOrNot, 1);
-                        camera.last("limit 2");
-                        List<BaseCameraManagement> list1 = baseCameraManagementService.list(camera);
+                        baseCameraManagementReq.setDistance(distance);
+                        baseCameraManagementReq.setLineDir(heartbeatVo.getLineDir());
+                        baseCameraManagementReq.setRailwayCode(heartbeatVo.getRailwayCode());
+                        List<BaseCameraManagement> list1 = baseCameraManagementService.cameraMangemnetList(baseCameraManagementReq);
                         if (list1.size() <= 0) {
                             AjaxResults1 = new AjaxResults(0, "前方没有摄像机", respHeartbeatVo);
                             return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);
@@ -1066,25 +1060,19 @@ public class GeoHazardMonitorTokenController {
                 } else {
                     //没有报警信息的时候
                     LambdaQueryWrapper<BaseCameraManagement> base = new LambdaQueryWrapper<>();
+                    BaseCameraManagementReq baseCameraManagementReq=new BaseCameraManagementReq();
                     if (heartbeatVo.getLineDir() == 1) {
                         distance = heartbeatVo.getVisualDistance() + heartbeatVo.getCurrentMile();
-                        base.ge(BaseCameraManagement::getInstallMile, distance);
-                        base.in(BaseCameraManagement::getMonitoringDirection, 1, 3);
-                        base.orderByAsc(BaseCameraManagement::getGrou).orderByAsc(BaseCameraManagement::getSort);
-                        base.le(BaseCameraManagement::getInstallMile, (heartbeatVo.getCurrentMile() + 10000));
+                        baseCameraManagementReq.setInstallMile(heartbeatVo.getCurrentMile() +10000);
                     }
                     if (heartbeatVo.getLineDir() == 2) {
                         distance = heartbeatVo.getCurrentMile() - heartbeatVo.getVisualDistance();
-                        base.le(BaseCameraManagement::getInstallMile, distance);
-                        base.ge(BaseCameraManagement::getInstallMile, (heartbeatVo.getCurrentMile() - 10000));
-                        base.in(BaseCameraManagement::getMonitoringDirection, 2, 3);
-                        base.orderByDesc(BaseCameraManagement::getGrou).orderByDesc(BaseCameraManagement::getSort);
+                        baseCameraManagementReq.setInstallMile(heartbeatVo.getCurrentMile() - 10000);
                     }
-                    base.eq(BaseCameraManagement::getRailwayCode, heartbeatVo.getRailwayCode());
-                    base.eq(BaseCameraManagement::getOnline, 2);
-                    base.eq(BaseCameraManagement::getEnableOrNot, 1);
-                    base.last("limit 2");
-                    List<BaseCameraManagement> list1 = baseCameraManagementService.list(base);
+                    baseCameraManagementReq.setDistance(distance);
+                    baseCameraManagementReq.setLineDir(heartbeatVo.getLineDir());
+                    baseCameraManagementReq.setRailwayCode(heartbeatVo.getRailwayCode());
+                    List<BaseCameraManagement> list1 = baseCameraManagementService.cameraMangemnetList(baseCameraManagementReq);
                     if (list1.size() <= 0) {
                         AjaxResults1 = new AjaxResults(0, "前方没有摄像机", respHeartbeatVo);
                         return SM4Utils.encryptData_ECB(JSONObject.toJSONString(AjaxResults1), key);