Parcourir la source

执法记录仪告警添加部门id和部门名称字段

bihs il y a 2 semaines
Parent
commit
621968d4ec

+ 29 - 1
src/main/java/com/sooka/sponest/monitor/camera/domain/CentermonitorTRecorderAlarm.java

@@ -47,12 +47,22 @@ public class CentermonitorTRecorderAlarm extends BaseEntity {
     @Excel(name = "在线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date alarmTime;
 
-
     /**
      * 工单id
      */
     private String recordId;
 
+    /**
+     * 部门ids
+     */
+    private String deptIds;
+
+    /**
+     * 部门名称s
+     */
+    private String deptNames;
+
+
 
     public void setCameraCode(String cameraCode) {
         this.cameraCode = cameraCode;
@@ -103,6 +113,22 @@ public class CentermonitorTRecorderAlarm extends BaseEntity {
         this.recordId = recordId;
     }
 
+    public String getDeptIds() {
+        return deptIds;
+    }
+
+    public void setDeptIds(String deptIds) {
+        this.deptIds = deptIds;
+    }
+
+    public String getDeptNames() {
+        return deptNames;
+    }
+
+    public void setDeptNames(String deptNames) {
+        this.deptNames = deptNames;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
@@ -112,6 +138,8 @@ public class CentermonitorTRecorderAlarm extends BaseEntity {
                 .append("alarmTime", getAlarmTime())
                 .append("recordId", getRecordId())
                 .append("status", getStatus())
+                .append("deptIds", getDeptIds())
+                .append("deptNames", getDeptNames())
                 .toString();
     }
 }

+ 4 - 1
src/main/java/com/sooka/sponest/monitor/dahua/utils/DeviceMonitorManager.java

@@ -10,6 +10,7 @@ import com.sooka.sponest.monitor.camera.mapper.CentermonitorTCamerachannelMapper
 import com.sooka.sponest.monitor.camera.mapper.CentermonitorTRecorderAlarmMapper;
 import com.sooka.sponest.monitor.camera.mapper.CentermonitorTRecorderMapper;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
@@ -46,7 +47,7 @@ public class DeviceMonitorManager {
     private String userName;
     @Value("${sooka.dahua_interface_server.userPwd}")
     private String userPwd;
-    //    private String loginIp = "10.53.0.35";
+//    private String loginIp = "10.53.0.35";
 //    private String loginPort = "7901";
 //    private String userName = "system";
 //    private String userPwd = "Admin123";
@@ -142,6 +143,8 @@ public class DeviceMonitorManager {
             saveVo.setAlarmTime(onlineTime);
             saveVo.setRecordId(recordId);
             saveVo.setStatus(status);
+            saveVo.setDeptIds(ObjectUtils.isEmpty(map.get("deptIds")) ? null : map.get("deptIds").toString());
+            saveVo.setDeptNames(ObjectUtils.isEmpty(map.get("deptNames")) ? null : map.get("deptNames").toString());
 //            log.info("设备编码:{}摄像头编码:{}时间:{}执行报警操作.", deviceCode, map.get("channelCode").toString(), onlineTime);
             centermonitorTRecorderAlarmMapper.insertCentermonitorTRecorderAlarm(saveVo);
 //        System.out.println("设备编码:" + deviceCode + "摄像头编码:" + map.get("channelCode").toString() + "执行报警操作.");

+ 7 - 3
src/main/resources/mapper/monitor/camera/CentermonitorTCamerachannelMapper.xml

@@ -7,10 +7,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectChannelCodeByDeviceCode" resultType="java.util.Map">
         SELECT
             channel_name channelName,
-            channel_code channelCode
+            channel_code channelCode,
+            GROUP_CONCAT(ta.map_dept_id) deptIds,
+            GROUP_CONCAT(ta.map_dept_name) deptNames
         FROM
-            centermonitor_t_camerachannel
+            centermonitor_t_camerachannel tc
+                left join centermonitor_t_aidevicedept ta on tc.camera_id = ta.device_id
         WHERE
-            device_code = #{deviceCode}
+            tc.device_code = #{deviceCode}
+        GROUP BY tc.device_code
     </select>
 </mapper>

+ 3 - 2
src/main/resources/mapper/monitor/camera/CentermonitorTRecorderAlarmMapper.xml

@@ -11,8 +11,9 @@
     </resultMap>
 
     <insert id="insertCentermonitorTRecorderAlarm" parameterType="CentermonitorTRecorderAlarm">
-        INSERT INTO centermonitor_t_recorder_alarm (camera_code, camera_name, alarm_name, alarm_time, record_id, status)
-        VALUES (#{cameraCode}, #{cameraName}, #{alarmName}, #{alarmTime}, #{recordId}, #{status})
+        INSERT INTO centermonitor_t_recorder_alarm (camera_code, camera_name, alarm_name, alarm_time, record_id, status,
+                                                    dept_ids, dept_names)
+        VALUES (#{cameraCode}, #{cameraName}, #{alarmName}, #{alarmTime}, #{recordId}, #{status}, #{deptIds}, #{deptNames})
     </insert>
 
     <select id="selectRecorderAlarm" resultType="java.lang.Integer">