فهرست منبع

V0.5.4
1、修改了设置动态库的对比项页面,新增了一些配置项
2、服务应用了对比项的参数

Apple 1 روز پیش
والد
کامیت
aa97dde30b

+ 20 - 19
Server/GlobalInfo/GlobalInfo.h

@@ -12,6 +12,7 @@
  * @copyright Copyright (c) 2025
  * 
  *    1、Server的全局信息,一些参数通过ReadConfig读取,这个类是ReadConfig友元
+ *    2、这个类里都是一些固定的参数,可以配置的在SysConfig中
  */
 
 
@@ -121,16 +122,16 @@ public:
     /* 获取是否需要等待静音状态 */
     int nIsSameBothMinDBWaitNum() const {return m_nIsSameBothMinDBWaitNum;}
     /* 获取一致性对比时间间隔 */
-    int compareTimeSpan() const {return m_nCompareTimeSpan <= 500 ? 500 : m_nCompareTimeSpan; } // 最小500毫秒
+    // int compareTimeSpan() const {return m_nCompareTimeSpan <= 500 ? 500 : m_nCompareTimeSpan; } // 最小500毫秒
 
     /* 获取AI对比持续次数 */
-    int AICMPThresholdNum() const {return m_nAICMPThresholdNum;}
-    /* 获取AI对比相似度阀值 */
-    float AICMPThresholdNot() const {return m_fAICMPThresholdNot;}
-    /* 获取音频错位百分比 */
-    float AICMPOffset() const {return m_fAICMPOffset;}
-    /* 获取AI对比相似度阀值 */
-    float AICMPThreshold() const {return m_fAICMPThresholdNot > 0.99 ? 0.99 : m_fAICMPThresholdNot; } //
+    // int AICMPThresholdNum() const {return m_nAICMPThresholdNum;}
+    // /* 获取AI对比相似度阀值 */
+    // float AICMPThresholdNot() const {return m_fAICMPThresholdNot;}
+    // /* 获取音频错位百分比 */
+    // float AICMPOffset() const {return m_fAICMPOffset;}
+    // /* 获取AI对比相似度阀值 */
+    // float AICMPThreshold() const {return m_fAICMPThresholdNot > 0.99 ? 0.99 : m_fAICMPThresholdNot; } //
 
 private:
     /* 初始化文件夹 */
@@ -213,17 +214,17 @@ private:
     
 
     /******************** AI比对参数(动态库比对参数) *********************/
-    // AI对比持续次数
-    int m_nAICMPThresholdNum = 3;
-    // AI对比相似度阀值,比这个阀值小,就表示不一致性
-    float m_fAICMPThresholdNot = 0.6;
-    // 音频错位百分比(比如0.5就是错位不能超过一半,超过一半判断为不一致):
-    float m_fAICMPOffset = 0.5;
-    // AI对比相似度阀值,比这个阀值大,就表示一致性
-    float m_fAICMPThreshold = 0.7;
-
-    // 一致性对比时间间隔(单位毫秒);8000采样时建议1000毫秒,48000采样时建议3000;DoubleCompare比较时时间会自动翻倍
-    int m_nCompareTimeSpan = 3000;
+    // // AI对比持续次数
+    // int m_nAICMPThresholdNum = 3;
+    // // AI对比相似度阀值,比这个阀值小,就表示不一致性
+    // float m_fAICMPThresholdNot = 0.6;
+    // // 音频错位百分比(比如0.5就是错位不能超过一半,超过一半判断为不一致):
+    // float m_fAICMPOffset = 0.5;
+    // // AI对比相似度阀值,比这个阀值大,就表示一致性
+    // float m_fAICMPThreshold = 0.7;
+
+    // // 一致性对比时间间隔(单位毫秒);8000采样时建议1000毫秒,48000采样时建议3000;DoubleCompare比较时时间会自动翻倍
+    // int m_nCompareTimeSpan = 3000;
     
 };
 

+ 26 - 26
Server/ThreadCalculate/CompareDoubleThread.cpp → Server/ThreadCalculate/CompareDoubleThread.cpp__

@@ -151,7 +151,7 @@ bool CompareDoubleThread::initData()
     // m_isAINotConsistencyAlone = GInfo.isAINotConsistencyAlone(); // 获取杭州台是否按上面的逻辑来
     m_nIsSameBothMinDBWaitNum = GInfo.nIsSameBothMinDBWaitNum(); // 获取是否需要等待静音状态
 
-    m_nCompareTimeSpan = GInfo.compareTimeSpan(); // 获取比对时间间隔
+    // m_nCompareTimeSpan = GInfo.compareTimeSpan(); // 获取比对时间间隔
 
     /* 获取生成音量的线程,循环等待获取 */
     auto startTime = std::chrono::steady_clock::now(); // 记录开始时间
@@ -598,33 +598,33 @@ bool CompareDoubleThread::compareConsistencyBaseOnAI(bool& bConsistency, const b
     /* 更新动态库的一致性比对结果,计算结果 */
 
     std::string strAIValue, strAIValueNot;
-    bool bAICon = m_consistencyResult.IsAIConsistency(GInfo.AICMPThresholdNum(), GInfo.AICMPThreshold(), strAIValue);
-    bool bAINot = m_consistencyResult.IsAINotConsistency(GInfo.AICMPThresholdNum(), GInfo.AICMPThresholdNot(), strAIValueNot);
-    if (false == bAICon || false == bAINot)
-    {
-        bConsistency = true;
-        return false;
-    }
+    // bool bAICon = m_consistencyResult.IsAIConsistency(GInfo.AICMPThresholdNum(), GInfo.AICMPThreshold(), strAIValue);
+    // bool bAINot = m_consistencyResult.IsAINotConsistency(GInfo.AICMPThresholdNum(), GInfo.AICMPThresholdNot(), strAIValueNot);
+    // if (false == bAICon || false == bAINot)
+    // {
+    //     bConsistency = true;
+    //     return false;
+    // }
 
-    if (bAICon)
-    {
-        bConsistency = true;
-        if (!lastConsistency)
-        {
-            SPDLOG_LOGGER_INFO(m_logger, "当前AI判定为一致,上次是不一致,确认为一致(第{}次),{}", ++m_arryAIChangeRetNum[1], strAIValue);
-        }
-        return true;
-    }
+    // if (bAICon)
+    // {
+    //     bConsistency = true;
+    //     if (!lastConsistency)
+    //     {
+    //         SPDLOG_LOGGER_INFO(m_logger, "当前AI判定为一致,上次是不一致,确认为一致(第{}次),{}", ++m_arryAIChangeRetNum[1], strAIValue);
+    //     }
+    //     return true;
+    // }
 
-    if (bAINot)
-    {
-        bConsistency = false;
-        if (lastConsistency)
-        {
-            SPDLOG_LOGGER_INFO(m_logger, "当前AI判定为不一致,上次是一致,确认为不一致(第{}次),{}", ++m_arryAIChangeRetNum[3], strAIValueNot);
-        }
-        return true;
-    }
+    // if (bAINot)
+    // {
+    //     bConsistency = false;
+    //     if (lastConsistency)
+    //     {
+    //         SPDLOG_LOGGER_INFO(m_logger, "当前AI判定为不一致,上次是一致,确认为不一致(第{}次),{}", ++m_arryAIChangeRetNum[3], strAIValueNot);
+    //     }
+    //     return true;
+    // }
 
     bConsistency = lastConsistency; // 如果都不是一致和不一致,则使用上一次的一致性结果
     return true;

+ 0 - 0
Server/ThreadCalculate/CompareDoubleThread.h → Server/ThreadCalculate/CompareDoubleThread.h__


+ 15 - 15
Server/ThreadCalculate/CompareItemThread.cpp

@@ -203,10 +203,10 @@ bool CompareItemThread::initData()
     /* 获取参数 */
     m_noiseDetectConfig = SysConfig.getNoiseDetectBaseConfig();
     /* 一致性对比的一些参数 */
-    const auto& baseConfig = SysConfig.getBaseConfigSrc();
-    m_isConsistencyNoWarnWhenOtherAlarm = (baseConfig.nNotConsistency == 1);
-    m_isNotConsistencyOneRoadNoise = (baseConfig.nNotConsistency == 2);
-    m_isNotConsistencyIgnoreSilent = (baseConfig.nNotConsistency == 3);
+    const auto& aiCompareConfig = SysConfig.getAICompareConfig();
+    m_isConsistencyNoWarnWhenOtherAlarm = aiCompareConfig.bNoConsistencyAlarmOtherAlarm;
+    // m_isNotConsistencyOneRoadNoise = (baseConfig.nNotConsistency == 2);
+    // m_isNotConsistencyIgnoreSilent = (baseConfig.nNotConsistency == 3);
 
     /* 创建录音通道线程 */
     for(const auto& road : m_threadInfo.compareItemInfo.mapRoad)
@@ -713,17 +713,17 @@ bool CompareItemThread::updateResultData()
         }
 
         /* 判断是否开启了不一致报警条件: 如果主通道、其他通道,二者一个噪音,一个非噪音,直接判定为不一致 */
-        if(m_isNotConsistencyOneRoadNoise == true)
-        {
-            bool isMainRoadNoise = m_compareResult.mapRoadVolumes[1].isNoise;
-            bool isOtherRoadNoise = m_compareResult.mapRoadVolumes[pair.first].isNoise;
-            if(isMainRoadNoise != isOtherRoadNoise)
-            {
-                m_compareResult.mapRoadVolumes[pair.first].isConsistency = false;
-                m_compareResult.mapRoadVolumes[pair.first].isNotConsistencyWarning = true;
-                continue; // 直接进入下一个通道
-            }
-        }
+        // if(m_isNotConsistencyOneRoadNoise == true)
+        // {
+        //     bool isMainRoadNoise = m_compareResult.mapRoadVolumes[1].isNoise;
+        //     bool isOtherRoadNoise = m_compareResult.mapRoadVolumes[pair.first].isNoise;
+        //     if(isMainRoadNoise != isOtherRoadNoise)
+        //     {
+        //         m_compareResult.mapRoadVolumes[pair.first].isConsistency = false;
+        //         m_compareResult.mapRoadVolumes[pair.first].isNotConsistencyWarning = true;
+        //         continue; // 直接进入下一个通道
+        //     }
+        // }
     }
 
     return true;

+ 2 - 2
Server/ThreadCalculate/CompareItemThread.h

@@ -131,8 +131,8 @@ private:
     /* ---------------------- 动态库设置的参数 ---------------------- */
     /* 这三个参数从设置动态库中获取 */
     bool m_isConsistencyNoWarnWhenOtherAlarm = false;   /* 在其他报警时,不一致不报警且后台不进行不一致对比 */
-    bool m_isNotConsistencyOneRoadNoise = false;        /* 如果主通道、其他通道,二者一个噪音,一个非噪音,直接判定为不一致 */
-    bool m_isNotConsistencyIgnoreSilent = false;        /* 不一致对比不进行静音、反相等处理 */
+    // bool m_isNotConsistencyOneRoadNoise = false;        /* 如果主通道、其他通道,二者一个噪音,一个非噪音,直接判定为不一致 */
+    // bool m_isNotConsistencyIgnoreSilent = false;        /* 不一致对比不进行静音、反相等处理 */
     
 
     /* ---------------------- 对比项 ---------------------- */

+ 11 - 0
Server/ThreadCalculate/ConsistencyCompareThread.cpp

@@ -1,12 +1,16 @@
 #include "ConsistencyCompareThread.h"
 
 #include "GlobalVariable.h"
+#include "SystemConfig.h"
 #include "ThreadManager.h"
 #include "CreateRecordFileThread.h"
 #include "ThreadAlarmManager.h"
 
 #include "CreateWAVThread.h"
 #include "LHCompareAPI.h"
+#include "SystemConfig.h"
+
+
 
 ConsistencyCompareThread::ConsistencyCompareThread(CalculateThreadInfo_t& threadInfo)
     : BaseCalculateThread(threadInfo)
@@ -148,6 +152,13 @@ bool ConsistencyCompareThread::initData()
         SPDLOG_LOGGER_ERROR(m_logger, "{} 录音通道信息不足,至少需要两个通道", m_logBase);
         return false;
     }
+    /* 获取一致性检测的参数 */
+    const auto& compareConfig = SysConfig.getAICompareConfig();
+    m_numCompareContinue = compareConfig.nAiCompareCount;
+    m_numFileDuration = compareConfig.nAiComputeDuration;
+    m_fNotConsistencyThreshold = compareConfig.fNotSimilarThrehold;
+    m_fConsistencyThreshold = compareConfig.fSimilarThrehold;
+
     /* 获取两个录音通道的信息 */
     auto it = m_threadInfo.compareItemInfo.mapRoad.begin();
     m_itemRoadInfo1 = it.value(); // 第一个通道

+ 22 - 5
SettingLibrary/Modules/AICompare/aicomparewidget.cpp

@@ -5,6 +5,9 @@
 #include "UIStyleManager.h"
 #include "SystemConfig.h"
 #include "FromWebAPI.h"
+#include "commonFunc.h"
+
+
 
 AICompareWidget::AICompareWidget(QWidget *parent) :
     QWidget(parent),
@@ -24,9 +27,17 @@ AICompareWidget::AICompareWidget(QWidget *parent) :
     /* 设置输入栏的弱提示符 */
     ui->lineEdit_length->setPlaceholderText("请输入, 限制1-120秒");
 
-    /* 隐藏AI对比目录,不需要了 */
-    ui->lineEdit_dir->hide();
-    ui->label_2->hide();
+    /* ai对比持续次数 */
+    ui->lineEdit_compareCount->setValidator(new QIntValidator(1, 10, this));
+    ui->lineEdit_compareCount->setPlaceholderText("请输入, 持续对比次数限制1-10次");
+
+    /* 不相似度阈值 */
+    ui->lineEdit_notSimilarThrehold->setValidator(new StrictDoubleValidator(0.0, 1.0, 3, this));
+    ui->lineEdit_notSimilarThrehold->setPlaceholderText("请输入, 阈值限制0.0-1.0");
+
+    /* 相似度阈值 */
+    ui->lineEdit_similarThrehold->setValidator(new StrictDoubleValidator(0.0, 1.0, 3, this));
+    ui->lineEdit_similarThrehold->setPlaceholderText("请输入, 阈值限制0.0-1.0");
 
     /* 设置初始化的参数 */
     do_pBtn_restore_clicked();
@@ -49,7 +60,10 @@ bool AICompareWidget::saveConfig()
 {
     AICompareConfig_t aiConfig;
     aiConfig.nAiComputeDuration = ui->lineEdit_length->text().toInt();
-    aiConfig.strAiCompareDir = ui->lineEdit_dir->text();
+    aiConfig.nAiCompareCount = ui->lineEdit_compareCount->text().toInt();
+    aiConfig.fSimilarThrehold = ui->lineEdit_similarThrehold->text().toFloat();
+    aiConfig.fNotSimilarThrehold = ui->lineEdit_notSimilarThrehold->text().toFloat();
+    aiConfig.bNoConsistencyAlarmOtherAlarm = ui->checkBox_noConsistencyOtherAlarm->isChecked();
 
     /* 和历史数据进行对比 */
     const AICompareConfig_t &oldConfig = SysConfig.getAICompareConfig();
@@ -87,5 +101,8 @@ void AICompareWidget::do_pBtn_restore_clicked()
 {
     const AICompareConfig_t &aiConfig = SysConfig.getAICompareConfig();
     ui->lineEdit_length->setText(QString::number(aiConfig.nAiComputeDuration));
-    ui->lineEdit_dir->setText(aiConfig.strAiCompareDir);
+    ui->lineEdit_compareCount->setText(QString::number(aiConfig.nAiCompareCount));
+    ui->lineEdit_similarThrehold->setText(QString::number(aiConfig.fSimilarThrehold, 'f', 3));
+    ui->lineEdit_notSimilarThrehold->setText(QString::number(aiConfig.fNotSimilarThrehold, 'f', 3));
+    ui->checkBox_noConsistencyOtherAlarm->setChecked(aiConfig.bNoConsistencyAlarmOtherAlarm);
 }

+ 33 - 59
SettingLibrary/Modules/AICompare/aicomparewidget.ui

@@ -54,27 +54,24 @@
        <number>16</number>
       </property>
       <item row="1" column="0">
-       <widget class="QLabel" name="label_2">
+       <widget class="QLabel" name="label_3">
         <property name="text">
-         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;对比文件目录:</string>
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#d21f21;&quot;&gt;*&lt;/span&gt;AI对比持续次数:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
         </property>
         <property name="alignment">
          <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
-      <item row="0" column="0">
-       <widget class="QLabel" name="label">
+      <item row="4" column="0" colspan="2">
+       <widget class="QCheckBox" name="checkBox_noConsistencyOtherAlarm">
         <property name="text">
-         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;AI每次判断的文件时长(秒):</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+         <string>其他报警时,不一致不报警且后台不进行不一致对比</string>
         </property>
        </widget>
       </item>
-      <item row="4" column="1">
-       <widget class="QLineEdit" name="lineEdit_similarThrehold">
+      <item row="1" column="1">
+       <widget class="QLineEdit" name="lineEdit_compareCount">
         <property name="minimumSize">
          <size>
           <width>168</width>
@@ -83,13 +80,13 @@
         </property>
         <property name="maximumSize">
          <size>
-          <width>168</width>
+          <width>192</width>
           <height>32</height>
          </size>
         </property>
        </widget>
       </item>
-      <item row="3" column="0">
+      <item row="2" column="0">
        <widget class="QLabel" name="label_4">
         <property name="text">
          <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#d21f21;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;不相似度&lt;/span&gt;阈值:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
@@ -99,27 +96,7 @@
         </property>
        </widget>
       </item>
-      <item row="4" column="0">
-       <widget class="QLabel" name="label_5">
-        <property name="text">
-         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#d21f21;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;相似度&lt;/span&gt;阈值:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="2" column="0">
-       <widget class="QLabel" name="label_3">
-        <property name="text">
-         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#d21f21;&quot;&gt;*&lt;/span&gt;AI对比持续次数:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
-        </property>
-        <property name="alignment">
-         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
-        </property>
-       </widget>
-      </item>
-      <item row="3" column="1">
+      <item row="2" column="1">
        <widget class="QLineEdit" name="lineEdit_notSimilarThrehold">
         <property name="minimumSize">
          <size>
@@ -129,30 +106,34 @@
         </property>
         <property name="maximumSize">
          <size>
-          <width>168</width>
+          <width>192</width>
           <height>32</height>
          </size>
         </property>
        </widget>
       </item>
-      <item row="0" column="1">
-       <widget class="QLineEdit" name="lineEdit_length">
-        <property name="minimumSize">
-         <size>
-          <width>168</width>
-          <height>32</height>
-         </size>
+      <item row="0" column="0">
+       <widget class="QLabel" name="label">
+        <property name="text">
+         <string>&lt;font color = #D21F21 &gt;*&lt;/font&gt;AI每次判断的文件时长(秒):</string>
         </property>
-        <property name="maximumSize">
-         <size>
-          <width>168</width>
-          <height>32</height>
-         </size>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
         </property>
        </widget>
       </item>
-      <item row="2" column="1">
-       <widget class="QLineEdit" name="lineEdit_compareCount">
+      <item row="3" column="0">
+       <widget class="QLabel" name="label_5">
+        <property name="text">
+         <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; color:#d21f21;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot; color:#000000;&quot;&gt;相似度&lt;/span&gt;阈值:&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+        </property>
+        <property name="alignment">
+         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <widget class="QLineEdit" name="lineEdit_similarThrehold">
         <property name="minimumSize">
          <size>
           <width>168</width>
@@ -161,14 +142,14 @@
         </property>
         <property name="maximumSize">
          <size>
-          <width>168</width>
+          <width>192</width>
           <height>32</height>
          </size>
         </property>
        </widget>
       </item>
-      <item row="1" column="1">
-       <widget class="QLineEdit" name="lineEdit_dir">
+      <item row="0" column="1">
+       <widget class="QLineEdit" name="lineEdit_length">
         <property name="minimumSize">
          <size>
           <width>168</width>
@@ -177,19 +158,12 @@
         </property>
         <property name="maximumSize">
          <size>
-          <width>168</width>
+          <width>192</width>
           <height>32</height>
          </size>
         </property>
        </widget>
       </item>
-      <item row="5" column="0" colspan="2">
-       <widget class="QCheckBox" name="checkBox_noConsistencyOtherAlarm">
-        <property name="text">
-         <string>其他报警时,不一致不报警且后台不进行不一致对比</string>
-        </property>
-       </widget>
-      </item>
      </layout>
     </widget>
    </item>

+ 28 - 1
SettingLibrary/Resources/qss/white/aicomparewidget.qss

@@ -134,4 +134,31 @@ QPushButton#pBtn_addPlan:hover
     color:white;
     background: qlineargradient( x0:1,x1:1,y1:0,y2:0,stop:0 #5D73FF,stop:1 #6092FF);
     border-radius: 4px;
-} */
+} */
+
+
+/* ==========================================================
+ *  QCheckBox
+ * ========================================================== */
+QCheckBox
+{
+	font-weight: 400;
+	font-size: 14px;
+	color: #3A3F63;
+}
+QCheckBox::indicator
+{
+	width: 16px; 
+	height: 16px;
+}
+QCheckBox::indicator:unchecked
+{
+	image: url(:/icon/unchecked.png);
+}
+QCheckBox::indicator:checked
+{
+	image: url(:/icon/checked.png);
+}
+
+
+

+ 9 - 2
common/DataManager/SystemConfig.cpp

@@ -120,7 +120,11 @@ bool SystemConfigInfo::getAICompareConfigFromJson(const std::string& jsonStr)
     try {
         nJson jsonConfig = nJson::parse(jsonStr);
         m_aiCompareConfig.nAiComputeDuration = jsonConfig["AiComputeDuration"].get<int>();
-        m_aiCompareConfig.strAiCompareDir = jsonConfig["AiCompareDir"].is_null() ? "" : QString::fromStdString(jsonConfig["AiCompareDir"].get<std::string>());
+        m_aiCompareConfig.nAiCompareCount = jsonConfig["AiCompareCount"].get<int>();
+        m_aiCompareConfig.fSimilarThrehold = jsonConfig["SimilarThrehold"].get<float>();
+        m_aiCompareConfig.fNotSimilarThrehold = jsonConfig["NotSimilarThrehold"].get<float>();
+        m_aiCompareConfig.bNoConsistencyAlarmOtherAlarm = jsonConfig["NoConsistencyAlarmOtherAlarm"].get<bool>();
+        
     }nJsonCatch
 
     return true;
@@ -132,7 +136,10 @@ bool SystemConfigInfo::setAICompareConfigToJson(const AICompareConfig_t& aiCompa
     try {
         nJson jsonConfig;
         jsonConfig["AiComputeDuration"] = aiCompareConfig.nAiComputeDuration;
-        jsonConfig["AiCompareDir"] = aiCompareConfig.strAiCompareDir.toStdString();
+        jsonConfig["AiCompareCount"] = aiCompareConfig.nAiCompareCount;
+        jsonConfig["SimilarThrehold"] = aiCompareConfig.fSimilarThrehold;
+        jsonConfig["NotSimilarThrehold"] = aiCompareConfig.fNotSimilarThrehold;
+        jsonConfig["NoConsistencyAlarmOtherAlarm"] = aiCompareConfig.bNoConsistencyAlarmOtherAlarm;
 
         strJson = jsonConfig.dump();
     }nJsonCatch

+ 10 - 5
common/DataManager/SystemConfigStruct.cpp

@@ -1,4 +1,5 @@
 #include "SystemConfigStruct.h"
+#include <cstdlib>
 
 
 
@@ -36,12 +37,16 @@ bool AICompareConfig_t::operator==(const AICompareConfig_t &other) const
         return true; // 自身比较
     }
 
-    if(nAiComputeDuration == other.nAiComputeDuration &&
-       strAiCompareDir == other.strAiCompareDir)
+    if( nAiComputeDuration == other.nAiComputeDuration &&
+        nAiCompareCount == other.nAiCompareCount &&
+        std::abs(fNotSimilarThrehold - other.fNotSimilarThrehold) <= fespipe &&
+        std::abs(fSimilarThrehold - other.fSimilarThrehold) <= fespipe &&
+        bNoConsistencyAlarmOtherAlarm == other.bNoConsistencyAlarmOtherAlarm)
     {
         return true;
     }
 
+
     return false;
 }
 
@@ -79,9 +84,9 @@ bool NoiseDetectParam_t::operator==(const NoiseDetectParam_t &other) const
         nNoiseDetectContinueCount == other.nNoiseDetectContinueCount &&
         nNoiseContinueCountIsWarn == other.nNoiseContinueCountIsWarn &&
         nNoiseContinueCountPercent == other.nNoiseContinueCountPercent &&
-        dThresholdSlient == other.dThresholdSlient &&
-        dThresholdDB == other.dThresholdDB &&
-        dThresholdCV == other.dThresholdCV &&
+        std::abs(dThresholdSlient - other.dThresholdSlient) <= despipe &&
+        std::abs(dThresholdDB - other.dThresholdDB) <= despipe &&
+        std::abs(dThresholdCV - other.dThresholdCV) <= despipe &&
         nPerseg == other.nPerseg &&
         nOverlap == other.nOverlap &&
         nFFT == other.nFFT

+ 10 - 2
common/DataManager/SystemConfigStruct.h

@@ -4,6 +4,7 @@
 
 #include <QString>
 #include <QMap>
+#include <cerrno>
 
 #include "GlobalVariable.h"
 
@@ -26,6 +27,10 @@ const QMap<int, QString> g_mapRecordModes =
     {1, "ASIO"}
 };
 
+const float fespipe = 1e-6f;    /* 单精度浮点数比较时的误差 */
+const double despipe = 1e-10;   /* 双精度浮点数比较时的误差 */
+
+
 /**
  * @brief 基础配置结构体
  * 
@@ -51,8 +56,11 @@ struct BaseConfig_t
 
 struct AICompareConfig_t
 {
-    int nAiComputeDuration = 0;     /* AI计算所需文件的时长,单位为秒 */
-    QString strAiCompareDir;        /* AI对比文件夹 */
+    int nAiComputeDuration = 0;         /* AI计算所需文件的时长,单位为秒 */
+    int nAiCompareCount = 0;            /* AI对比持续次数 */
+    float fNotSimilarThrehold = 0.0;    /* 不相似度阈值 */
+    float fSimilarThrehold = 0.0;       /* 相似度阈值 */
+    bool bNoConsistencyAlarmOtherAlarm = false; /* 在其他报警时,不一致不报警且后台不进行不一致对比 */
 
     bool operator==(const AICompareConfig_t &other) const;
 };