重构评论
This commit is contained in:
@@ -1646,20 +1646,11 @@ public class JDUtil {
|
|||||||
logger.info("loadOrCreateState - 用户: {}, 状态: {}", fromWxid, state);
|
logger.info("loadOrCreateState - 用户: {}, 状态: {}", fromWxid, state);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 设置当前状态为生成评论流程
|
|
||||||
state.setCurrentState(UserInteractionState.ProcessState.COMMENT_GENERATION);
|
|
||||||
state.setCurrentField("commentTypeSelection");
|
|
||||||
// 提示用户选择评论类型
|
|
||||||
getProductTypeMap();
|
|
||||||
if (productTypeMap == null) {
|
|
||||||
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
StringBuilder productTypeStr = new StringBuilder();
|
StringBuilder productTypeStr = new StringBuilder();
|
||||||
for (Map.Entry<String, String> entry : productTypeMap.entrySet()) {
|
for (Map.Entry<String, String> entry : productTypeMap.entrySet()) {
|
||||||
String k = entry.getKey();
|
String k = entry.getKey();
|
||||||
//String value = entry.getValue();
|
//String value = entry.getValue();
|
||||||
productTypeStr.append(" ").append(k) .append("\n");
|
productTypeStr.append(" ").append(k).append("\n");
|
||||||
}
|
}
|
||||||
wxUtil.sendTextMessage(fromWxid, "请选择要生成的评论类型:\n " + productTypeStr, 1, fromWxid, false);
|
wxUtil.sendTextMessage(fromWxid, "请选择要生成的评论类型:\n " + productTypeStr, 1, fromWxid, false);
|
||||||
logger.info("进入生成评论流程 - 用户: {}", fromWxid);
|
logger.info("进入生成评论流程 - 用户: {}", fromWxid);
|
||||||
@@ -1672,6 +1663,15 @@ public class JDUtil {
|
|||||||
saveState(key, state);
|
saveState(key, state);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
// 初始化用户交互状态
|
||||||
|
String key = INTERACTION_STATE_PREFIX + fromWxid;
|
||||||
|
state = loadOrCreateState(key);
|
||||||
|
logger.info("loadOrCreateState - 用户: {}, 状态: {}", fromWxid, state);
|
||||||
|
// 设置当前状态为生成评论流程
|
||||||
|
state.setCurrentState(UserInteractionState.ProcessState.COMMENT_GENERATION);
|
||||||
|
state.setCurrentField("commentTypeSelection");
|
||||||
|
saveState(key, state);
|
||||||
|
|
||||||
// 如果未命中“评”指令,检查是否在生成评论流程中
|
// 如果未命中“评”指令,检查是否在生成评论流程中
|
||||||
handleCommentInteraction(fromWxid, order, state);
|
handleCommentInteraction(fromWxid, order, state);
|
||||||
}
|
}
|
||||||
@@ -1700,9 +1700,9 @@ public class JDUtil {
|
|||||||
logger.info("handleCommentInteraction 处理生成评论流程中的用户交互 - 用户: {}, 状态: {},message: {}", fromWxid, state, message);
|
logger.info("handleCommentInteraction 处理生成评论流程中的用户交互 - 用户: {}, 状态: {},message: {}", fromWxid, state, message);
|
||||||
try {
|
try {
|
||||||
// 检查当前状态是否为生成评论流程
|
// 检查当前状态是否为生成评论流程
|
||||||
if (!"commentTypeSelection".equals(state.getCurrentField())) {
|
//if (!"commentTypeSelection".equals(state.getCurrentField())) {
|
||||||
return;
|
// return;
|
||||||
}
|
//}
|
||||||
getProductTypeMap();
|
getProductTypeMap();
|
||||||
if (productTypeMap == null) {
|
if (productTypeMap == null) {
|
||||||
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user