瀏覽代碼

feat: 算法多类型支持
算法识别同时支持多种类型

kindring 1 年之前
父節點
當前提交
3a12907d52

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/storager/IAiControlStorage.java

@@ -14,7 +14,7 @@ import java.util.List;
  */
 @SuppressWarnings("rawtypes")
 public interface IAiControlStorage {
-    public PageInfo<AiAlarmData> searchAiAlarm(int arithmetic,String key,String alarmState,String startTime, String endTime, String order, String sort, int p, int l);
+    public PageInfo<AiAlarmData> searchAiAlarm(String arithmetic, String key, String alarmState, String startTime, String endTime, String order, String sort, int p, int l);
 
     public AiAlarmData getAlarmData(String alarmId);
 

+ 2 - 1
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java

@@ -173,8 +173,9 @@ public interface IVideoManagerStorage {
 	public PageInfo<AiLib> searchAiLibItems(int page,int count,int libraryId,String key);
 	public PageInfo<AiLib> searchAiLib(int page,int count,String key,Integer arithmetic);
 
-	public int saveAlarm(String deviceId, String channelId, String arithmetic, JSONArray alarmItems, List<MultipartFile> uploads,
+	public int saveAlarm(String deviceId, String channelId, List<String> arithmetic, JSONArray alarmItems, List<MultipartFile> uploads,
 						 String firmware_version, String timestamp, String battery, String signal, String temp_env, String temp_cpu, String ccid);
+
 	/**
 	 * 获取多个设备
 	 *

+ 46 - 40
src/main/java/com/genersoft/iot/vmp/storager/dao/HfyDevAiMapper.java

@@ -216,54 +216,58 @@ public interface HfyDevAiMapper {
 
     @Insert(
             "insert into ai_alarm_item(" +
-            "alarmId," +
-            "score," +
-            "x1," +
-            "x2," +
-            "y1," +
-            "y2," +
-            "info," +
-            "trait," +
-            "uid" +
-            ") values " +
-            "(" +
-            "#{alarmId}," +
-            "#{score}," +
-            "#{x1}," +
-            "#{x2}," +
-            "#{y1}," +
-            "#{y2}," +
-            "#{info}," +
-            "#{trait}," +
-            "#{uid}" +
-            ")"
-            )
-
-    int inertAiarmItem(int alarmId,String score,int x1,int x2,int y1,int y2,String info,String trait,String uid);
+                    "alarmId," +
+                    "score," +
+                    "x1," +
+                    "x2," +
+                    "y1," +
+                    "y2," +
+                    "info," +
+                    "trait," +
+                    "uid," +
+                    "arithmetic" +
+                    ") values " +
+                    "(" +
+                    "#{alarmId}," +
+                    "#{score}," +
+                    "#{x1}," +
+                    "#{x2}," +
+                    "#{y1}," +
+                    "#{y2}," +
+                    "#{info}," +
+                    "#{trait}," +
+                    "#{uid}," +
+                    "#{arithmetic}" +
+                    ")"
+    )
+    int inertAlarmItem(int alarmId, String score, int x1, int x2, int y1, int y2, String info, String trait, String uid, String arithmetic);
 
 
     @Select("<script>" +
-            "select * from ai_alarm " +
+            "SELECT * FROM ai_alarm " +
             "<where>" +
-            "<if test='startTime != null'  >" +
-            " createTime &gt;= #{startTime}" +
+            "<if test='startTime != null'>" +
+            " createTime >= #{startTime}" +
             "</if>" +
-            "<if test='arithmetic != 0'  >" +
-            " and arithmetic = #{arithmetic}" +
+            "<if test='arithmetic != null and arithmetic.size() > 0'>" +
+            " AND" +
+            "<foreach collection='arithmetic' item='item' open='(' close=')' separator=','>" +
+            " arithmetic LIKE CONCAT('%',#{item},'%')" +
+            "</foreach>" +
             "</if>" +
-            "<if test='(key != null)and(key != \"\")'  >" +
-            " and firmware_version like '%${key}%'" +
+            "<if test='key != null and key != \"\"'>" +
+            " AND firmware_version LIKE CONCAT('%',#{key},'%')" +
             "</if>" +
-            "<if test='alarmState != null'  >" +
-            " and alarmState = #{alarmState}" +
+            "<if test='alarmState != null'>" +
+            " AND alarmState = #{alarmState}" +
             "</if>" +
-            "<if test='endTime != null' >" +
-            " and createTime &lt;= #{endTime}" +
+            "<if test='endTime != null'>" +
+            " AND createTime &lt;= #{endTime}" +
             "</if>" +
             "</where>" +
-            "ORDER BY ${sort} ${order}" +
+            " ORDER BY ${sort} ${order}" +
             "</script>")
-    List<AiAlarmData> getAiAlarms(int arithmetic, String key, String alarmState, int startTime, int endTime, String order, String sort);
+    List<AiAlarmData> getAiAlarms(@Param("arithmetic") List<String> arithmetic, @Param("key") String key, @Param("alarmState") String alarmState, @Param("startTime") int startTime, @Param("endTime") int endTime, @Param("order") String order, @Param("sort") String sort);
 
     @Select("select * from ai_alarm" +
             " where alarmId = #{alarmId}")
@@ -288,9 +292,11 @@ public interface HfyDevAiMapper {
     @Update("update ai_alarm set alarmState = #{alarmState} where alarmId = #{alarmId}")
     int changeAlarmState(String alarmId, int alarmState);
 
-    @Update("update ai_alarm set alarmState = #{alarmState} where arithmetic = #{arithmetic} and alarmState = 1")
-    int changeAllAlarmState(int arithmetic,int alarmState);
+    @Update("update ai_alarm set alarmState = #{alarmState} " +
+            "where arithmetic LIKE CONCAT('%',#{arithmetic},'%')" +
+            " and alarmState = 1")
+    int changeAllAlarmState(int arithmetic, int alarmState);
 
     @Update("update ai_alarm set alarmType = #{alarmType} where alarmId = #{alarmId}")
-    int changeAlarmType(int alarmId,int alarmType);
+    int changeAlarmType(int alarmId, int alarmType);
 }

+ 27 - 23
src/main/java/com/genersoft/iot/vmp/storager/impl/AiControlStorageImpl.java

@@ -14,6 +14,7 @@ import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 
@@ -25,17 +26,17 @@ public class AiControlStorageImpl implements IAiControlStorage {
     @Autowired
     private HfyDevAiMapper HfyDevAiMapper;
 
-    public PageInfo<AiAlarmData> searchAiAlarm(int arithmetic,String key,String alarmState,String startTime, String endTime, String order, String sort, int p, int l){
+    public PageInfo<AiAlarmData> searchAiAlarm(String arithmeticStr, String key, String alarmState, String startTime, String endTime, String order, String sort, int p, int l) {
         PageHelper.startPage(p, l);
         // 排序不分
-        logger.info("search prop:{} order:{}",sort,order);
-        if(sort == "createTime" || sort == "create"){
+        logger.info("search prop:{} order:{}", sort, order);
+        if (sort == "createTime" || sort == "create") {
             sort = "createTime";
-        }else if(order.contains("operation")){
+        } else if (order.contains("operation")) {
             sort = "operationTime";
-        }else if(order.contains("signal")){
+        } else if (order.contains("signal")) {
             sort = "signal";
-        }else{
+        } else {
             sort = "createTime";
         }
         if(order.contains("asc")){
@@ -45,30 +46,33 @@ public class AiControlStorageImpl implements IAiControlStorage {
         }else{
             order = "desc";
         }
-        logger.info("search prop:{} order:{}",sort,order);
+        logger.info("search prop:{} order:{}", sort, order);
         // 确定开始时间
-        if(endTime == null || endTime.isEmpty()){endTime = String.valueOf((new Date().getTime()/1000) + 1000);}
-        if(startTime == null || startTime.isEmpty()){startTime = "0";}
+        if (endTime == null || endTime.isEmpty()) {
+            endTime = String.valueOf((new Date().getTime() / 1000) + 1000);
+        }
+        if (startTime == null || startTime.isEmpty()) {
+            startTime = "0";
+        }
         int _endTime = Integer.parseInt(endTime),
                 _startTime = Integer.parseInt(startTime);
-        logger.info("查询时间 start={} end={}" ,_startTime, _endTime);
+        logger.info("查询时间 start={} end={}", _startTime, _endTime);
 
-        // 分析算法
-        if(arithmetic>0){
-            // 启用算法
-        }
+        // 算法字符串转为字符数组, 使用,分割
+
+        List<String> arithmeticList = Arrays.asList(arithmeticStr.split(","));
         // 分析 阅读类型
-        if(alarmState.contains("unread")){
-            alarmState="1";
-        }else if(alarmState.contains("Ignored")){
-            alarmState="2";
-        }else if(alarmState.contains("read")){
-            alarmState="3";
-        }else{
-            alarmState=null;
+        if (alarmState.contains("unread")) {
+            alarmState = "1";
+        } else if (alarmState.contains("Ignored")) {
+            alarmState = "2";
+        } else if (alarmState.contains("read")) {
+            alarmState = "3";
+        } else {
+            alarmState = null;
         }
         // 查表
-        List<AiAlarmData> result = HfyDevAiMapper.getAiAlarms(arithmetic,key,alarmState,_startTime,_endTime,order ,sort);
+        List<AiAlarmData> result = HfyDevAiMapper.getAiAlarms(arithmeticList, key, alarmState, _startTime, _endTime, order, sort);
         return new PageInfo<>(result);
     }
 

+ 20 - 18
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java

@@ -726,6 +726,7 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 
 	/**
 	 * 存储告警数据
+	 *
 	 * @param deviceId
 	 * @param channelId
 	 * @param arithmetic
@@ -733,8 +734,8 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 	 * @param uploads
 	 * @return
 	 */
-	public int saveAlarm(String deviceId, String channelId, String arithmetic, JSONArray alarmItems, List<MultipartFile> uploads,
-						 String firmware_version, String timestamp, String battery, String signal, String temp_env, String temp_cpu, String ccid){
+	public int saveAlarm(String deviceId, String channelId, List<String> arithmetic, JSONArray alarmItems, List<MultipartFile> uploads,
+						 String firmware_version, String timestamp, String battery, String signal, String temp_env, String temp_cpu, String ccid) {
 		// 1. 转储上传文件
 		UploadService uploadHandle = new UploadService();
 		String filePaths = uploadHandle.saveDevAlarm(sipConfig.getMediaPath(), deviceId, uploads);
@@ -742,14 +743,13 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 		long unixTimestamp = date.getTime() / 1000;
 		logger.info("[文件操作] 告警文件存储成功 文件:{}", filePaths);
 		logger.info("[数据库操作] alarmItems:{}", alarmItems);
-//		int arithmeticNum = Integer.parseInt(arithmetic);
-//		arithmeticNum = arithmeticNum + 1;
-//		arithmetic = String.valueOf(arithmeticNum);
+		// 使用,组合算法类型
+		String arithmeticStr = String.join(",", arithmetic);
 
-		HfyDevAiMapper.saveAiAlarm(deviceId, channelId, arithmetic, alarmItems.size(), String.valueOf(unixTimestamp), filePaths,
+		HfyDevAiMapper.saveAiAlarm(deviceId, channelId, arithmeticStr, alarmItems.size(), String.valueOf(unixTimestamp), filePaths,
 				firmware_version, timestamp, battery, signal, temp_env, temp_cpu, ccid);
 		logger.info("[数据库操作] saveAiAlarm ok");
-		List<AiAlarm> agoAlarms = HfyDevAiMapper.findInsertAiAlarm(deviceId, channelId, arithmetic, alarmItems.size(), String.valueOf(unixTimestamp), filePaths);
+		List<AiAlarm> agoAlarms = HfyDevAiMapper.findInsertAiAlarm(deviceId, channelId, arithmeticStr, alarmItems.size(), String.valueOf(unixTimestamp), filePaths);
 		if (agoAlarms.isEmpty()) {
 			logger.info("[数据库操作] 存储的数据文件无法找到{}", filePaths);
 			return 1;
@@ -772,39 +772,41 @@ public class VideoManagerStorageImpl implements IVideoManagerStorage {
 				int y1 = alarm.getIntValue("y1");
 				int x2 = alarm.getIntValue("x2");
 				int y2 = alarm.getIntValue("y2");
+				String itemArithmetic = alarm.getString("arithmetic");
 				String similarity = String.valueOf(alarm.getDoubleValue("similarity"));
 				String scoreStr = String.valueOf(alarm.getDoubleValue("score"));
 				logger.info("Uid={}", uid);
 				if (uid != null && !uid.equals("-1")) {
 					isFindUid = true;
 				}
+
 				String info = "";
-				if (arithmetic.equals("1")) {
+				if (itemArithmetic.equals("1")) {
 					info = "人脸识别";
-				} else if (arithmetic.equals("2")) {
+				} else if (itemArithmetic.equals("2")) {
 					info = id;
-					track_id = arithmetic;
+					track_id = itemArithmetic;
 					similarity = scoreStr;
 				} else {
-					if (arithmetic.equals("6")) {
+					if (itemArithmetic.equals("6")) {
 						info = "吊车";
-					} else if (arithmetic.equals("7")) {
+					} else if (itemArithmetic.equals("7")) {
 						info = "塔吊";
-					} else if (arithmetic.equals("8")) {
+					} else if (itemArithmetic.equals("8")) {
 						info = "火焰";
-					} else if (arithmetic.equals("9")) {
+					} else if (itemArithmetic.equals("9")) {
 						info = "施工机械";
-					} else if (arithmetic.equals("10")) {
+					} else if (itemArithmetic.equals("10")) {
 						info = "吊线异物";
-					} else if (arithmetic.equals("11")) {
+					} else if (itemArithmetic.equals("11")) {
 						info = "烟雾";
 					}
 					track_id = id;
 					similarity = scoreStr;
 				}
-				HfyDevAiMapper.inertAiarmItem(AlarmId, similarity,
+				HfyDevAiMapper.inertAlarmItem(AlarmId, similarity,
 						x1, x2, y1, y2,
-						info, track_id, uid);
+						info, track_id, uid, itemArithmetic);
 			}
 		}
 		logger.info("arithmetic:{}",arithmetic);

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/vmanager/bean/AiAlarmData.java

@@ -10,7 +10,7 @@ public class AiAlarmData {
     @Schema(description = "通道id")
     private String channelId;
     @Schema(description = "算法类型")
-    private String arithmetic = "1";
+    private String arithmetic = "";
     @Schema(description = "告警id")
     private int alarmId;
     @Schema(description = "对应的设置id")

+ 7 - 5
src/main/java/com/genersoft/iot/vmp/vmanager/bean/AiRequestBody.java

@@ -25,18 +25,20 @@ public class AiRequestBody {
     @Schema(description = "搜索关键字")
     private String alarmState;
 
-    public int getArithmetic() {
+    @Schema(description = "搜索算法")
+    private String arithmetic;
+
+    public String getArithmetic() {
         return arithmetic;
     }
 
-    public void setArithmetic(int arithmetic) {
+    public void setArithmetic(String arithmetic) {
         this.arithmetic = arithmetic;
     }
 
-    @Schema(description = "算法")
-    private int arithmetic;
+
     public String getAlarmState() {
-        return alarmState!=null?alarmState:"";
+        return alarmState != null ? alarmState : "";
     }
 
     public void setAlarmState(String alarmState) {

+ 5 - 3
src/main/java/com/genersoft/iot/vmp/vmanager/bean/Ai_parse.java

@@ -2,17 +2,19 @@ package com.genersoft.iot.vmp.vmanager.bean;
 
 import com.alibaba.fastjson2.JSONArray;
 
+import java.util.List;
+
 public class Ai_parse {
-    private String arithmetic;
+    private List<String> arithmetic;
     private JSONArray ai_info;
 
-    public String getArithmetic() {
+    public List<String> getArithmetic() {
         return arithmetic;
     }
 
     ;
 
-    public void setArithmetic(String arithmetic) {
+    public void setArithmetic(List<String> arithmetic) {
         this.arithmetic = arithmetic;
     }
 

+ 7 - 7
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/aiLib/AiApi.java

@@ -39,15 +39,15 @@ public class AiApi {
     public WVPResult getAlarms(@RequestBody AiRequestBody req){
         WVPResult result = new WVPResult<>();
         String startTime = req.getStartTime(),
-        endTime = req.getEndTime(),
-        order = req.getOrder(),
-        sort = req.getSort(),
-        key = req.getKey(),
-        alarmState = req.getAlarmState();
+                endTime = req.getEndTime(),
+                order = req.getOrder(),
+                sort = req.getSort(),
+                key = req.getKey(),
+                arithmetic = req.getArithmetic(),
+                alarmState = req.getAlarmState();
 
         int p = req.getPage(),
-        l=req.getLimit(),
-        arithmetic = req.getArithmetic();
+                l = req.getLimit();
 
         logger.info("req data is {}",req);
         PageInfo<AiAlarmData> pageInfo = storager.searchAiAlarm(arithmetic,key,alarmState,startTime,endTime,order,sort,p,l);

+ 38 - 19
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/aiLib/AiControl.java

@@ -26,6 +26,7 @@ import java.io.InputStream;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
 
 
 @Tag(name = "ai控制项")
@@ -246,7 +247,8 @@ public class AiControl {
      */
     public Ai_parse getAiInfo(BodyAiAlarm bodyAiAlarm) {
 //        人脸 1, 识别从 6开始, 中间预留部分给其它可能的算法, 车牌 2
-        String arithmetic = "";
+        List<String> arithmetic = new ArrayList<>();
+        Boolean is_plates = false;
         JSONObject reco_info = JSON.parseObject(bodyAiAlarm.getReco_info());
         if (reco_info == null) {
             logger.error("ai upload not reco_info");
@@ -256,38 +258,55 @@ public class AiControl {
         if (ai_info == null) {
             // 判断是否是车牌识别
             ai_info = JSON.parseObject(bodyAiAlarm.getReco_info()).getJSONArray("plates");
-            arithmetic = "2";
-
+            arithmetic.add("2");
+            is_plates = true;
         }
         // 判断是否为空数组
         if (ai_info == null || 0 == ai_info.size()) {
             logger.error("ai upload not reco_info");
             return null;
         }
-        // 获取
-        // 判断是人脸还是识别算法, 人脸识别的 识别对象中包含 msgid 识别则是 id
-        if (arithmetic.equals("") && ai_info.getJSONObject(0).containsKey("msgid")) {
-            arithmetic = "1";
-        }
-        // 判断具体是哪一项识别项
-        if (arithmetic.equals("")) {
-            // 根据id 文本判断是什么识别
-            // "DiaoChe","TaDiao","fire","ShiGongJiXie","DaoXianYiWu","smoke"
-            String id = ai_info.getJSONObject(0).getString("id");
+        for (int i = 0; i < ai_info.size(); i++) {
+            JSONObject jsonObject = ai_info.getJSONObject(i);
+            // 车牌类型
+            if (is_plates) {
+                jsonObject.put("arithmetic", "2");
+                break;
+            }
+            // 人脸类型
+            if (jsonObject.containsKey("msgid")) {
+                arithmetic.add("1");
+                jsonObject.put("arithmetic", "1");
+                break;
+            }
+            // 识别类型
+            String id = jsonObject.getString("id");
             if (id.equals("DiaoChe")) {
-                arithmetic = "6";
+                arithmetic.add("6");
+                jsonObject.put("arithmetic", "6");
             } else if (id.equals("TaDiao")) {
-                arithmetic = "7";
+                arithmetic.add("7");
+                jsonObject.put("arithmetic", "7");
             } else if (id.equals("fire")) {
-                arithmetic = "8";
+                arithmetic.add("8");
+                jsonObject.put("arithmetic", "8");
             } else if (id.equals("ShiGongJiXie")) {
-                arithmetic = "9";
+                arithmetic.add("9");
+                jsonObject.put("arithmetic", "9");
             } else if (id.equals("DaoXianYiWu")) {
-                arithmetic = "10";
+                arithmetic.add("10");
+                jsonObject.put("arithmetic", "10");
             } else if (id.equals("smoke")) {
-                arithmetic = "11";
+                arithmetic.add("11");
+                jsonObject.put("arithmetic", "11");
             }
+
         }
+        logger.info("arithmetic distinctArray:{}", arithmetic);
+        // 算法存储的数据去除重复项
+        arithmetic = arithmetic.stream().distinct().collect(Collectors.toList());
+        logger.info("arithmetic distinctArray end:{}", arithmetic);
+
         Ai_parse ai_parse = new Ai_parse();
         ai_parse.setArithmetic(arithmetic);
         ai_parse.setAi_info(ai_info);

+ 44 - 20
web_src/src/components/bell.vue

@@ -65,36 +65,46 @@
       </div>
       <div class="tab-content">
         <el-table
-          class="table"
-          style="overflow-y: auto;"
-          :data="tabList"
-          header-row-class-name="table-header"
-          @sort-change="tableSortChange"
+            class="table"
+            style="overflow-y: auto;"
+            :data="tabList"
+            header-row-class-name="table-header"
+            @sort-change="tableSortChange"
         >
-          <el-table-column prop="alarmId" label="id" :sortable="'alarmId'"></el-table-column>
           <el-table-column label="是否识别" v-if="aiTypeVal == '1'">
             <template slot-scope="scope">
               <span>{{ parseAlarmType(scope.row.alarmType) }}</span>
             </template>
           </el-table-column>
+          <el-table-column label="识别类型" min-width="120">
+            <template slot-scope="scope">
+              <el-tag
+                  class="mx-025"
+                  v-for="item in scope.row.arithmetic.split(',')"
+                  :key="`${scope.row.arithmetic.id}-${item}`">
+                {{ getArithmeticName(item) }}
+              </el-tag>
+            </template>
+          </el-table-column>
           <el-table-column prop="deviceId" label="设备号"></el-table-column>
-          <el-table-column prop="infoNum" label="子项数量" :sortable="'infoNum'"></el-table-column>
           <el-table-column prop="firmware_version" label="固件版本号"></el-table-column>
-          <el-table-column prop="signal" label="上传时信号值" :sortable="'signal'">
+          <el-table-column prop="signal" label="信号" :sortable="'signal'" width="60">
             <template slot-scope="scope">
-              <el-tooltip class="item" effect="dark" :content="scope.row.signal+' '+signalTransform(scope.row.signal,false)" placement="left-start">
+              <el-tooltip class="item" effect="dark"
+                          :content="scope.row.signal+' '+signalTransform(scope.row.signal,false)"
+                          placement="left-start">
                 <signal-info :signal-text="scope.row.signal"></signal-info>
               </el-tooltip>
             </template>
           </el-table-column>
-          <el-table-column prop="createTime" label="文件上传时间" :sortable="'createTime'">
+          <el-table-column prop="createTime" label="上传时间" :sortable="'createTime'">
             <template slot-scope="scope">
-              <span>{{getTimeText(scope.row.createTime)}}</span>
+              <span>{{ getTimeText(scope.row.createTime) }}</span>
             </template>
           </el-table-column>
-          <el-table-column prop="alarmState" label="已读状态">
+          <el-table-column prop="alarmState" label="状态" width="80">
             <template slot-scope="scope">
-              <span>{{getAlarmState(scope.row.alarmState)}}</span>
+              <span>{{ getAlarmState(scope.row.alarmState) }}</span>
             </template>
           </el-table-column>
           <el-table-column label="操作" >
@@ -304,17 +314,25 @@ export default {
         cancelButtonText: '取消',
         type: 'warning'
       }).then(async () => {
-        let [err,res] = await handle(this.$axios.get(`/ai/markAll?arithmetic=${this.aiTypeVal}`))
-        if(err){return this.$message.error(err.msg)}
-        if(res.data.code!==0){return this.$message.warning(res.data.msg)}
+        let [err, res] = await handle(this.$axios.get(`/ai/markAll?arithmetic=${this.aiTypeVal}`))
+        if (err) {
+          return this.$message.error(err.msg)
+        }
+        if (res.data.code !== 0) {
+          return this.$message.warning(res.data.msg)
+        }
         this.$message.success("操作成功!!!");
       })
     },
-    parseAlarmType(text){
+    getArithmeticName(text) {
+      let res = this.aiTypeArr.find(item => item.val == text)
+      return res ? res.text : "未知";
+    },
+    parseAlarmType(text) {
       let r = ""
-      if(text=="1"){
+      if (text == "1") {
         r = "设备名单人员";
-      }else{
+      } else {
         r = "陌生人"
       }
       return r
@@ -324,7 +342,12 @@ export default {
 </script>
 
 <style scoped>
-.page-header{
+.mx-025 {
+  margin-left: 0.25rem;
+  margin-right: 0.25rem;
+}
+
+.page-header {
   height: 45px;
   box-sizing: border-box;
   margin-bottom: 5px;
@@ -359,4 +382,5 @@ export default {
 .tab-box .tab-page{
   height: 35px;
 }
+
 </style>

+ 1 - 0
web_src/src/components/dialog/customPlayer.vue

@@ -634,4 +634,5 @@ export default {
   margin-left: 1rem;
   margin-right: 1rem;
 }
+
 </style>

+ 3 - 1
web_src/src/layout/UiHeader.vue

@@ -53,6 +53,7 @@
 import changePasswordDialog from '../components/dialog/changePassword.vue'
 import userService from '../components/service/UserService'
 import handle from "@/until/handle";
+import {arithmeticEnum} from "@/map/ai";
 
 export default {
   name: "UiHeader",
@@ -184,7 +185,8 @@ export default {
         // 寻找火情信息, 并进行去重
         for (let i = 0; i < arr.length; i++) {
           let alarmIndex = this.showFireAlarm.findIndex(item => item.alarmId === arr[i].alarmId);
-          if (alarmIndex === -1) {
+          // 判断是否有火情内容
+          if (alarmIndex === -1 && arr[i].arithmetic.includes(arithmeticEnum.fire.val)) {
             this.showFireAlarm.push(arr[i]);
             // 显示
             this.fireAlarm(this.showFireAlarm.length - 1)

+ 12 - 12
web_src/src/map/ai.js

@@ -1,17 +1,17 @@
 import {toNumber} from "../until/typeTool";
 
-const arithmeticEnum = {
-  face:{
-    val: 1,
-    text: '人脸识别',
-  },
-  fire: {
-    val: 8,
-    text: '火情识别'
-  },
-  carPlate: {
-    val: 2,
-    text: '车牌识别'
+export const arithmeticEnum = {
+    face: {
+        val: 1,
+        text: '人脸识别',
+    },
+    fire: {
+        val: 8,
+        text: '火情'
+    },
+    carPlate: {
+        val: 2,
+        text: '车牌'
   },
   DiaoChe: {
     val: 6, text: '吊车'

+ 32 - 31
参考文档/数据库扩展.md

@@ -59,40 +59,41 @@
 > 识别算法包含 "DiaoChe","TaDiao","fire","ShiGongJiXie","DaoXianYiWu","smoke"
 > 吊车, 塔吊, 火, 施工机械, 吊线异物, 烟
 
-| 字段               | 类型      | 可选值 | 备注                  |
-|------------------|---------|-----|---------------------|
-| alarmId          | pk      |     |                     |
-| arithmetic       | int     | 1-3 | 算法 人脸, 识别, 车牌       |
-| mediaPath        | varchar | 255 | 资源地址                |
-| rawMediaPath     | varchar | 255 | 资源地址                |
-| alarmState       | int     | 1-5 | 告警状态 1 未读, 2忽略,3已处理 |  
-| createTime       | varchar | 255 | 报警时间, 时间戳           |
-| operationTime    | varchar | 255 | 操作时间,时间戳            |
-| triggerType      | int     |     | 触发类型                |
-| deviceId         | varchar | ''  | 设备id                |
-| channelId        | varchar | ''  | 通道id                |
-| firmware_version | varchar | ''  | 固件版本                |
-| devTime          | varchar | ''  | 设备创建时间              |
-| signal           | varchar | ''  | 信号                  |
-| temp_env         | varchar | ''  | 环境温度                |
-| temp_cpu         | varchar | ''  | cpu温度               |
-| ccid             | varchar | ''  | ccid                |
-| zoom_rate        | varchar | ''  | 对焦信息                |
+| 字段               | 类型      | 可选值 | 备注                        |
+|------------------|---------|-----|---------------------------|
+| alarmId          | pk      |     |                           |
+| arithmetic       | varchar |     | 算法 人脸, 识别, 车牌 使用逗号分隔不同的算法 |
+| mediaPath        | varchar | 255 | 资源地址                      |
+| rawMediaPath     | varchar | 255 | 资源地址                      |
+| alarmState       | int     | 1-5 | 告警状态 1 未读, 2忽略,3已处理       |  
+| createTime       | varchar | 255 | 报警时间, 时间戳                 |
+| operationTime    | varchar | 255 | 操作时间,时间戳                  |
+| triggerType      | int     |     | 触发类型                      |
+| deviceId         | varchar | ''  | 设备id                      |
+| channelId        | varchar | ''  | 通道id                      |
+| firmware_version | varchar | ''  | 固件版本                      |
+| devTime          | varchar | ''  | 设备创建时间                    |
+| signal           | varchar | ''  | 信号                        |
+| temp_env         | varchar | ''  | 环境温度                      |
+| temp_cpu         | varchar | ''  | cpu温度                     |
+| ccid             | varchar | ''  | ccid                      |
+| zoom_rate        | varchar | ''  | 对焦信息                      |
 
 ### ai告警库 ai_alarm_item
 
-| 字段      | 类型      | 可选值   | 备注   |
-|---------|---------|-------|------|
-| itemId  | int     | pk    | id   |
-| alarmId | int     | tk    | id   |
-| score   | float   | 0-100 | 相似度  |
-| x1      | float   | n     | 位置x1 |
-| x2      | float   | n     | 位置x2 |
-| y1      | float   | n     | 位置y1 |
-| y2      | float   | n     | 位置y2 |
-| info    | Varchar |       | 文字信息 |
-| trait   | varchar | ''    | 特征码  |
-| uid     | varchar | ''    | uid  |
+| 字段         | 类型      | 可选值   | 备注                            |
+|------------|---------|-------|-------------------------------|
+| itemId     | int     | pk    | id                            |
+| alarmId    | int     | tk    | id                            |
+| score      | float   | 0-100 | 相似度                           |
+| x1         | float   | n     | 位置x1                          |
+| x2         | float   | n     | 位置x2                          |
+| y1         | float   | n     | 位置y1                          |
+| y2         | float   | n     | 位置y2                          |
+| info       | Varchar |       | 文字信息                          |
+| trait      | varchar | ''    | 特征码                           |
+| uid        | varchar | ''    | uid                           |
+| arithmetic | int     | ''    | 算法识别类型 人脸: 1,车牌: 2, 其它识别项6-11 |
 
 ## 授权码机制