This commit is contained in:
van
2026-04-02 20:09:31 +08:00
parent d361e93895
commit 72d5856838
9 changed files with 469 additions and 22 deletions

View File

@@ -0,0 +1,55 @@
package com.ruoyi.jarvis.domain.dto;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* 企微桥接处理结果:首条走被动回复,其余由 Jarvis 调 wxSend 主动推送。
*/
public class WeComInboundResult {
private static final String TRACE_SEP = "\n\n————————————\n\n";
private final String passiveReply;
private final List<String> activePushContents;
public WeComInboundResult(String passiveReply, List<String> activePushContents) {
this.passiveReply = passiveReply != null ? passiveReply : "";
this.activePushContents = activePushContents != null
? Collections.unmodifiableList(new ArrayList<>(activePushContents))
: Collections.emptyList();
}
public static WeComInboundResult empty() {
return new WeComInboundResult("", Collections.emptyList());
}
public static WeComInboundResult passiveOnly(String passive) {
return new WeComInboundResult(passive, Collections.emptyList());
}
public String getPassiveReply() {
return passiveReply;
}
public List<String> getActivePushContents() {
return activePushContents;
}
public boolean hasActivePush() {
return !activePushContents.isEmpty();
}
/** 追踪表落库:被动 + 主动条文拼在一起便于审计 */
public String toTraceFullText() {
if (activePushContents.isEmpty()) {
return passiveReply;
}
StringBuilder sb = new StringBuilder(passiveReply);
for (String s : activePushContents) {
sb.append(TRACE_SEP).append(s != null ? s : "");
}
return sb.toString();
}
}