2026-09-07 15:11:33 +08:00
|
|
|
|
package com.gzzn.omms.msgexchange.processing
|
2026-09-06 16:13:50 +08:00
|
|
|
|
|
2026-09-07 15:11:33 +08:00
|
|
|
|
import com.gzzn.omms.msgexchange.config.PipelineProps
|
|
|
|
|
|
import com.gzzn.omms.msgexchange.domain.DecodedMessage
|
2026-09-06 16:13:50 +08:00
|
|
|
|
import java.time.LocalDate
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* ACMA-8 I3:幂等键 = SNDR|TYPE|STYP|SEQN。
|
|
|
|
|
|
* 计算集中此处唯一入口;“是否含日边界”可配置且默认关闭(CONFIRM 矩阵 #11,
|
|
|
|
|
|
* SEQN 重置作用域确认前不改语义——上线后不改幂等键)。
|
|
|
|
|
|
*/
|
|
|
|
|
|
object Identity {
|
|
|
|
|
|
fun of(
|
|
|
|
|
|
msg: DecodedMessage,
|
|
|
|
|
|
includeDayBoundary: Boolean,
|
|
|
|
|
|
day: LocalDate = LocalDate.now(),
|
|
|
|
|
|
): String {
|
|
|
|
|
|
val base = "${msg.meta.sndr}|${msg.meta.type}|${msg.meta.styp}|${msg.meta.seqn}"
|
|
|
|
|
|
return if (includeDayBoundary) "$base|${day}" else base
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fun of(msg: DecodedMessage, props: PipelineProps.Identity): String =
|
|
|
|
|
|
of(msg, props.includeDayBoundary)
|
|
|
|
|
|
}
|