[6.4.0]FM信息增加消息过滤逻辑
This commit is contained in:
@@ -4,6 +4,7 @@ import com.mogo.eagle.core.data.msgbox.FMFilterInfoMsg
|
||||
import com.mogo.eagle.core.data.msgbox.FMInfoMsg
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||
import com.mogo.eagle.core.data.msgbox.MsgFmData
|
||||
import com.mogo.eagle.core.function.api.autopilot.IMoGoFaultManagementStateListener
|
||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager
|
||||
@@ -18,6 +19,11 @@ object CallerFaultManagementStateListenerManager : CallerBase<IMoGoFaultManageme
|
||||
|
||||
private val cachePolicyMap = hashMapOf<String, FMFilterInfoMsg>()
|
||||
|
||||
private var currentHighAction: Int = 10 //故障Level,默认为10
|
||||
private var faultIdStr: String = "" //故障信息内容
|
||||
private var lastFaultTime: Long= 0 //故障时间
|
||||
private var tempHighAction: Int = 9 //临时故障Level
|
||||
|
||||
fun invokeFaultManagementState(fmInfo: FmInfo.FaultResultMsg) {
|
||||
val policyCode = fmInfo.downgradePolicyCode
|
||||
if (policyCode == null || policyCode.isEmpty()) {
|
||||
@@ -32,6 +38,43 @@ object CallerFaultManagementStateListenerManager : CallerBase<IMoGoFaultManageme
|
||||
}
|
||||
return
|
||||
}
|
||||
/**
|
||||
* 6.4.0新增FM数据过滤
|
||||
* 当最高优先级的actions无变化、故障信息内容对比上一次无变化时,10min内仅产生一条消息
|
||||
* 当最高优先级的actions无变化、故障信息内容对比上一次有变化时,1min内仅产生一条消息
|
||||
* 当最高优先级的actions有变化时,产生一条新的消息
|
||||
*/
|
||||
//通过此遍历,获取当前INFO的最高优先级的Action和故障信息内容
|
||||
val fmFaultReason = StringBuilder()
|
||||
list.forEach {info ->
|
||||
if(info.faultActionCount != 0){
|
||||
info.faultActionList.forEach { action ->
|
||||
//如果此故障Level高于之前的最高优先级的故障,则进行赋值
|
||||
if(MsgFmData.FaultAction.getFaultLevel(action) < tempHighAction){
|
||||
tempHighAction = MsgFmData.FaultAction.getFaultLevel(action)
|
||||
}
|
||||
}
|
||||
}
|
||||
fmFaultReason.append(info.faultId)
|
||||
}
|
||||
if(tempHighAction == currentHighAction){
|
||||
//最高优先级的Action无变化,故障信息内容对比上一次无变化时,10min内仅产生一条消息
|
||||
if(faultIdStr == fmFaultReason.toString()){
|
||||
if(System.currentTimeMillis() - lastFaultTime < 10*60*1000){
|
||||
return
|
||||
}
|
||||
}else{
|
||||
//当最高优先级的actions无变化、故障信息内容对比上一次有变化时,1min内仅产生一条消息
|
||||
if(faultIdStr != fmFaultReason.toString()){
|
||||
if(System.currentTimeMillis() - lastFaultTime < 60*1000){
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}else{
|
||||
currentHighAction = tempHighAction
|
||||
}
|
||||
faultIdStr = fmFaultReason.toString()
|
||||
val fmFilterInfoMsg = cachePolicyMap[policyCode]
|
||||
val cacheFaultList = ArrayList<String>()
|
||||
val policyTime = fmInfo.time
|
||||
@@ -40,11 +83,7 @@ object CallerFaultManagementStateListenerManager : CallerBase<IMoGoFaultManageme
|
||||
//判断两个集合重复 true:return
|
||||
var sameResult = false
|
||||
list.forEach {
|
||||
if(fmFilterInfoMsg.cacheFilterList?.contains(it.faultId) == true){
|
||||
if(System.currentTimeMillis()-fmFilterInfoMsg.receiveTime < 10*60*1000){
|
||||
sameResult = true
|
||||
}
|
||||
}
|
||||
sameResult = fmFilterInfoMsg.cacheFilterList?.contains(it.faultId) == true
|
||||
}
|
||||
if (sameResult) {
|
||||
return
|
||||
@@ -60,6 +99,7 @@ object CallerFaultManagementStateListenerManager : CallerBase<IMoGoFaultManageme
|
||||
fmFilterInfoMsg.receiveTime = System.currentTimeMillis()
|
||||
cachePolicyMap[policyCode] = fmFilterInfoMsg
|
||||
CallerTrace.write("FaultMsg",fmInfo)
|
||||
lastFaultTime = System.currentTimeMillis()
|
||||
CallerMsgBoxManager.saveMsgBoxHasPB(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.FMINFO,
|
||||
@@ -76,6 +116,7 @@ object CallerFaultManagementStateListenerManager : CallerBase<IMoGoFaultManageme
|
||||
}
|
||||
cachePolicyMap[policyCode] = FMFilterInfoMsg(list, policyCode, cacheFaultList,System.currentTimeMillis())
|
||||
CallerTrace.write("FaultMsg",fmInfo)
|
||||
lastFaultTime = System.currentTimeMillis()
|
||||
CallerMsgBoxManager.saveMsgBoxHasPB(
|
||||
MsgBoxBean(
|
||||
MsgBoxType.FMINFO,
|
||||
|
||||
Reference in New Issue
Block a user