|
|
@@ -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);
|