Sfoglia il codice sorgente

报警抓拍优化2

hanzhiwei 2 anni fa
parent
commit
9bb83f47de

+ 1 - 1
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/RemoteLabHardwareService.java

@@ -36,5 +36,5 @@ public interface RemoteLabHardwareService {
     @GetMapping("/hardware/findCameraByType")
     ResultData findCameraByType(@RequestParam("subId") Long subId,
                                 @RequestParam("type") Integer type,
-                                @RequestParam("subType") String[] subType);
+                                @RequestParam("subType") String subType);
 }

+ 1 - 1
zd-api/zd-laboratory-api/src/main/java/com/zd/laboratory/api/feign/fallback/RemoteLabHardwareFallbackFactory.java

@@ -30,7 +30,7 @@ public class RemoteLabHardwareFallbackFactory implements FallbackFactory<RemoteL
             }
 
             @Override
-            public ResultData findCameraByType(Long subId, Integer type, String[] subType) {
+            public ResultData findCameraByType(Long subId, Integer type, String subType) {
                 return ResultData.fail("请求失败!");
             }
         };

+ 1 - 1
zd-modules/zd-airbottle/src/main/java/com/zd/airbottle/service/impl/AlarmRecordServiceImpl.java

@@ -215,7 +215,7 @@ public class AlarmRecordServiceImpl implements IAlarmRecordService {
                         log.info("==================>{},{}",alarm.getCode(),alarm.getMsg());
                     }
                     // TODO 报警的同时传入摄像头ip
-                    ResultData result = remoteLabHardwareService.findCameraByType(storageRVo.getSubjectId(), 4, new String[] {"2"});
+                    ResultData result = remoteLabHardwareService.findCameraByType(storageRVo.getSubjectId(), 4, "2");
                     if (HttpStatus.SUCCESS == result.getCode()) {
                         String ip = String.valueOf(result.getData());
                         startVideo(ip);

+ 1 - 1
zd-modules/zd-chemical/src/main/java/com/zd/chemical/service/impl/HxpStockServiceImpl.java

@@ -462,7 +462,7 @@ public class HxpStockServiceImpl implements IHxpStockService {
                         R<Boolean> alarm = remoteRfidService.alarm(hardwareRfidDto);
                         logger.info("==================>{},{}",alarm.getCode(),alarm.getMsg());
                     }
-                    ResultData result = remoteLabHardwareService.findCameraByType(hxpStock.getSubId(), 4, new String[] {"2"});
+                    ResultData result = remoteLabHardwareService.findCameraByType(hxpStock.getSubId(), 4, "2");
                     if (HttpStatus.SUCCESS == result.getCode()) {
                         String ip = String.valueOf(result.getData());
                         startVideo(ip);

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/controller/LabHardwareController.java

@@ -519,7 +519,7 @@ public class LabHardwareController extends BaseController {
     @RequestMapping("/findCameraByType")
     public ResultData findCameraByType(@RequestParam("subId") Long subId,
                                        @RequestParam("type") Integer type,
-                                       @RequestParam("subType") String[] subType) {
+                                       @RequestParam("subType") String subType) {
         LabHardware labHardware = labHardwareService.findCameraByType(subId, type, subType);
         return ResultData.success(labHardware.getIpAddress());
     }

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/event/RedisExpiredPhotographListener.java

@@ -113,7 +113,7 @@ public class RedisExpiredPhotographListener extends KeyExpirationEventMessageLis
             String[] keyStr = key.split("~");
             WarningNoticeLog warningNoticeLog = JSON.parseObject(JSON.toJSONString(JSON.parseObject(keyStr[1]).getJSONObject("photographQueue")), WarningNoticeLog.class);
             //调用拍摄照片接口
-            LabHardware labHardware = labHardwareService.findCameraByType(warningNoticeLog.getSubId(), 4, new String[] {"1"});
+            LabHardware labHardware = labHardwareService.findCameraByType(warningNoticeLog.getSubId(), 4, "1");
             if (labHardware != null && StringUtils.isNotBlank(labHardware.getIpAddress())) {
                 //拼装StreamUrl
                 String streamUrl = "rtsp://admin:hk123456@" + labHardware.getIpAddress() + ":554/h264/ch1/main/av_stream";

+ 2 - 2
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/mapper/LabHardwareMapper.java

@@ -175,8 +175,8 @@ public interface LabHardwareMapper {
 
     /**
      * 根据类型查询摄像头信息
-     * @Param [subId, type, pcType]
+     * @Param [subId, type, subType]
      * @Return com.zd.laboratory.domain.LabHardware
      **/
-    LabHardware findCameraByType(@Param("subId") Long subId, @Param("type") Integer type, @Param("subType") String[] subType);
+    LabHardware findCameraByType(@Param("subId") Long subId, @Param("type") Integer type, @Param("subType") String subType);
 }

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/ILabHardwareService.java

@@ -188,5 +188,5 @@ public interface ILabHardwareService {
      *          subType 子类型 摄像头类型:(0普通摄像头 1抓拍摄像头 2违规带离摄像头)]
      * @Return com.zd.laboratory.domain.LabHardware
      **/
-    LabHardware findCameraByType(Long subId, Integer type, String[] subType);
+    LabHardware findCameraByType(Long subId, Integer type, String subType);
 }

+ 1 - 1
zd-modules/zd-modules-laboratory/src/main/java/com/zd/laboratory/service/impl/LabHardwareServiceImpl.java

@@ -854,7 +854,7 @@ public class LabHardwareServiceImpl implements ILabHardwareService {
     }
 
     @Override
-    public LabHardware findCameraByType(Long subId, Integer type, String[] subType) {
+    public LabHardware findCameraByType(Long subId, Integer type, String subType) {
         return labHardwareMapper.findCameraByType(subId,type,subType);
     }
 }

+ 6 - 1
zd-modules/zd-modules-laboratory/src/main/resources/mapper/laboratory/LabHardwareMapper.xml

@@ -9,6 +9,7 @@
         <result property="name" column="name"/>
         <result property="factory" column="factory"/>
         <result property="type" column="type" typeHandler="org.apache.ibatis.type.EnumOrdinalTypeHandler"/>
+        <result property="subType" column="sub_type"/>
         <result property="pcType" column="pc_type"/>
         <result property="macAdd" column="mac_add"/>
         <result property="subjectId" column="subject_id"/>
@@ -57,6 +58,7 @@
                      he.name,
                      he.factory,
                      he.type,
+                     he.sub_type,
                      he.is_pcfire,
                      he.pc_type,
                      he.mac_add,
@@ -395,6 +397,7 @@
             <if test="name != null">name,</if>
             <if test="factory != null">factory,</if>
             <if test="type != null">type,</if>
+            <if test="subType != null">sub_type,</if>
             <if test="pcType != null">pc_type,</if>
             <if test="macAdd != null">mac_add,</if>
             <if test="subjectId != null">subject_id,</if>
@@ -432,6 +435,7 @@
             <if test="name != null">#{name},</if>
             <if test="factory != null">#{factory},</if>
             <if test="type != null">#{type},</if>
+            <if test="subType != null">#{subType},</if>
             <if test="pcType != null">#{pcType},</if>
             <if test="macAdd != null">#{macAdd},</if>
             <if test="subjectId != null">#{subjectId},</if>
@@ -472,6 +476,7 @@
             <if test="name != null">name = #{name},</if>
             <if test="factory != null">factory = #{factory},</if>
             <if test="type != null">type = #{type},</if>
+            <if test="subType != null">sub_type = #{subType},</if>
             <if test="pcType != null">pc_type = #{pcType},</if>
             <if test="macAdd != null">mac_add = #{macAdd},</if>
             <if test="subjectId != null">subject_id = #{subjectId},</if>
@@ -601,7 +606,7 @@
         where lh.ip_address is not null
         and lh.subject_id = #{subId}
         and lh.type = #{type}
-        and lh.sub_type in #{subType}
+        and FIND_IN_SET(#{subType},lh.sub_type)
         order by create_time desc
         limit 1
     </select>