Riku
2025-07-13 37d47c6a7ab0f454b948b68c987146b261117993
2025.7.13
动态溯源逻辑调整
已修改9个文件
72 ■■■■ 文件已修改
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousSingle.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionResult.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcChangeRate.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RealTimeExceptionValueMutation.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSummary.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/RealTimeExceptionResult.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/BaseExceptionContinuousSingle.kt
@@ -20,7 +20,7 @@
                    it.startData = data
                }
                // 判断相邻数据是否连续并且是否满足异常判断
                if (!isContinue || needCut(it, hasException[f])) {
                if (!isContinue || needCut(it, hasException[f], data)) {
                    recordException(s, it, data)
                } else {
                    if (hasException[f] == true) {
src/main/kotlin/com/flightfeather/uav/biz/dataanalysis/model/ExceptionResult.kt
@@ -20,8 +20,8 @@
    var exception: String? = null
    var exceptionType: Int? = null
    var exceptionValue: Float? = null
    var factorId: Int? = null
    var factorName: String? = null
//    var factorId: Int? = null
//    var factorName: String? = null
    var subFactorId: List<Int>? = null
    var subFactorName: List<String>? = null
    var selectedFactor: FactorFilter.SelectedFactor? = null
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/SourceTraceController.kt
@@ -110,28 +110,32 @@
    }
    // 数据突变异常回调
    private fun exceptionCallback(ex: PollutedClue) {
    private fun exceptionCallback(ex: List<PollutedClue>) {
        ex.forEach {
        // 溯源污染源信息
        ex.searchScenes(sceneInfoRep)
        ex.msgType = MsgType.PolClue.value
            it.searchScenes(sceneInfoRep)
            it.msgType = MsgType.PolClue.value
        }
        // 广播污染溯源异常结果
        UnderwayWebSocketSender.broadcast(MsgType.PolClue.value, ex)
        sourceTraceRep.insert(MsgType.PolClue, ex)
        sourceTraceRep.insertList(MsgType.PolClue, ex)
        // 记录污染线索
        pollutedSummary.addClue(ex)
        pollutedSummary.addClueList(ex)
    }
    // 数据变化提醒回调
    private fun dataChangeCallback(ex: PollutedClue) {
    private fun dataChangeCallback(ex: List<PollutedClue>) {
        ex.forEach {
        // 溯源污染源信息
        ex.searchScenes(sceneInfoRep)
        ex.msgType = MsgType.DataChange.value
            it.searchScenes(sceneInfoRep)
            it.msgType = MsgType.DataChange.value
        }
        // 广播数据变化提醒
        UnderwayWebSocketSender.broadcast(MsgType.DataChange.value, ex)
        sourceTraceRep.insert(MsgType.DataChange, ex)
        sourceTraceRep.insertList(MsgType.DataChange, ex)
    }
    private fun summaryCallback(ex: AnalysisResult) {
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcChangeRate.kt
@@ -131,10 +131,10 @@
        latestCombinedResult
        callback?.let { func ->
            latestExceptionResult.forEach {
                func.invoke(it as PollutedClue)
                func.invoke(listOf(it as PollutedClue))
            }
            latestCombinedResult.forEach {
                func.invoke(it as PollutedClue)
                func.invoke(it as List<PollutedClue>)
            }
        }
    }
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/BaseRTExcWindLevel.kt
@@ -16,7 +16,7 @@
// 异常数据生成回调类
typealias NewPolluteClueCallback = (ex: PollutedClue) -> Unit
typealias NewPolluteClueCallback = (ex: List<PollutedClue>) -> Unit
/**
 * 不同风速下,数据突变异常基类
 * @date 2025/5/29
@@ -134,9 +134,23 @@
        exceptionStatus: ExceptionStatusType,
    ) {
        super.onNewException(tag, factor, exceptionStatus)
//        callback?.let { func ->
//            val exc = tag.exceptionResult.last()
//            func.invoke(exc as PollutedClue)
//        }
    }
    override fun mergeExceptionResult() {
        super.mergeExceptionResult()
        latestExceptionResult
        latestCombinedResult
        callback?.let { func ->
            val exc = tag.exceptionResult.last()
            func.invoke(exc as PollutedClue)
            latestExceptionResult.forEach {
                func.invoke(listOf(it as PollutedClue))
            }
            latestCombinedResult.forEach {
                func.invoke(it as List<PollutedClue>)
            }
        }
    }
}
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/exceptiontype/RealTimeExceptionValueMutation.kt
@@ -62,7 +62,7 @@
        return b1 || b2
    }
    override fun needCut(tag: ExceptionTag, hasException: Boolean?): Boolean {
    override fun needCut(tag: ExceptionTag, hasException: Boolean?, data: BaseRealTimeData): Boolean {
        // 按照时长和距离限制将异常截取
        if (tag.exceptionData.isEmpty()) return false
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/PollutedSummary.kt
@@ -69,6 +69,12 @@
        analysisOnClueCount()
    }
    // 新增一条污染线索
    fun addClueList(pollutedClues: List<PollutedClue>) {
        clueList.addAll(pollutedClues)
        analysisOnClueCount()
    }
    // 刷新当前最新的走航监测数据
    fun refreshLatestMonitorData(data: BaseRealTimeData) {
//        realTimeDataList.clear()
src/main/kotlin/com/flightfeather/uav/biz/sourcetrace/model/RealTimeExceptionResult.kt
@@ -26,8 +26,8 @@
    var exception: String? = null
    var exceptionType: Int? = null
    var factorId: Int? = null
    var factorName: String? = null
//    var factorId: Int? = null
//    var factorName: String? = null
    var subFactorId: List<Int>? = null
    var subFactorName: List<String>? = null
    var selectedFactor: FactorFilter.SelectedFactor? = null
src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt
@@ -42,6 +42,14 @@
        }
    }
    fun insertList(msgType: MsgType, objList: List<PollutedClue>): Int {
        var res = 0
        objList.forEach {
            res += insert(msgType, it)
        }
        return res
    }
    /**
     * 插入线索信息
     */