This commit is contained in:
van
2026-04-01 02:10:14 +08:00
parent f2f6d02b2f
commit a515ec33fb
6 changed files with 243 additions and 15 deletions

View File

@@ -0,0 +1,74 @@
package com.ruoyi.jarvis.domain.dto;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
/**
* 企微侧多轮交互会话(与 Jarvis_java JDUtil 中 interaction_state + Redis 存 JSON 方式对齐)
*/
public class WeComChatSession {
public static final String SCENE_JD_LOGISTICS_SHARE = "JD_LOGISTICS_SHARE";
public static final String STEP_WAIT_REMARK = "WAIT_REMARK";
private static final DateTimeFormatter FMT = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
/** 业务场景 */
private String scene;
/** 当前步骤 */
private String step;
/** 已识别的京东 3.cn 物流短链 */
private String logisticsUrl;
/** 最近一次交互时间(超时清理用) */
private String lastInteractionTime;
public static WeComChatSession startLogisticsWaitRemark(String logisticsUrl) {
WeComChatSession s = new WeComChatSession();
s.setScene(SCENE_JD_LOGISTICS_SHARE);
s.setStep(STEP_WAIT_REMARK);
s.setLogisticsUrl(logisticsUrl);
s.touch();
return s;
}
public void touch() {
this.lastInteractionTime = LocalDateTime.now().format(FMT);
}
public boolean isLogisticsWaitRemark() {
return SCENE_JD_LOGISTICS_SHARE.equals(scene) && STEP_WAIT_REMARK.equals(step)
&& logisticsUrl != null && !logisticsUrl.isEmpty();
}
public String getScene() {
return scene;
}
public void setScene(String scene) {
this.scene = scene;
}
public String getStep() {
return step;
}
public void setStep(String step) {
this.step = step;
}
public String getLogisticsUrl() {
return logisticsUrl;
}
public void setLogisticsUrl(String logisticsUrl) {
this.logisticsUrl = logisticsUrl;
}
public String getLastInteractionTime() {
return lastInteractionTime;
}
public void setLastInteractionTime(String lastInteractionTime) {
this.lastInteractionTime = lastInteractionTime;
}
}