重构评论
This commit is contained in:
@@ -678,10 +678,6 @@ public class JDUtil {
|
|||||||
case GIFT_MONEY_FLOW:
|
case GIFT_MONEY_FLOW:
|
||||||
handleGiftMoneyFlow(fromWxid, message, state);
|
handleGiftMoneyFlow(fromWxid, message, state);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COMMENT_GENERATION:
|
|
||||||
handleCommentInteraction(fromWxid, message, state);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
resetState(fromWxid, state);
|
resetState(fromWxid, state);
|
||||||
wxUtil.sendTextMessage(fromWxid, "流程异常,请重新开始", 1, fromWxid, false);
|
wxUtil.sendTextMessage(fromWxid, "流程异常,请重新开始", 1, fromWxid, false);
|
||||||
@@ -1638,10 +1634,10 @@ public class JDUtil {
|
|||||||
public void sendOrderToWxByOrderP(String order, String fromWxid) {
|
public void sendOrderToWxByOrderP(String order, String fromWxid) {
|
||||||
logger.info("sendOrderToWxByOrderP.order {}", order);
|
logger.info("sendOrderToWxByOrderP.order {}", order);
|
||||||
// 检查是否命中“评”指令
|
// 检查是否命中“评”指令
|
||||||
UserInteractionState state = null;
|
|
||||||
if (!productTypeMap.containsKey(order.trim())) {
|
if (!productTypeMap.containsKey(order.trim())) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
getProductTypeMap();
|
||||||
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();
|
||||||
@@ -1652,12 +1648,12 @@ public class JDUtil {
|
|||||||
logger.info("进入生成评论流程 - 用户: {}", fromWxid);
|
logger.info("进入生成评论流程 - 用户: {}", fromWxid);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("生成评论流程初始化异常 - 用户: {}, 状态: {}", fromWxid, state, e);
|
logger.error("生成评论流程初始化异常 - 用户: {}", fromWxid, e);
|
||||||
wxUtil.sendTextMessage(fromWxid, "处理异常,请重新开始", 1, fromWxid, false);
|
wxUtil.sendTextMessage(fromWxid, "处理异常,请重新开始", 1, fromWxid, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 如果未命中“评”指令,检查是否在生成评论流程中
|
// 如果未命中“评”指令,检查是否在生成评论流程中
|
||||||
handleCommentInteraction(fromWxid, order, state);
|
handleCommentInteraction(fromWxid, order);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1682,7 +1678,6 @@ public class JDUtil {
|
|||||||
private void handleCommentInteraction(String fromWxid, String message) {
|
private void handleCommentInteraction(String fromWxid, String message) {
|
||||||
logger.info("handleCommentInteraction 处理生成评论流程中的用户交互 - 用户: {},message: {}", fromWxid, message);
|
logger.info("handleCommentInteraction 处理生成评论流程中的用户交互 - 用户: {},message: {}", fromWxid, message);
|
||||||
try {
|
try {
|
||||||
|
|
||||||
getProductTypeMap();
|
getProductTypeMap();
|
||||||
if (productTypeMap == null) {
|
if (productTypeMap == null) {
|
||||||
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
||||||
|
|||||||
@@ -126,12 +126,13 @@ public class WxMessageConsumer {
|
|||||||
|
|
||||||
if (("47484514467@chatroom".equals(fromWxid))) {
|
if (("47484514467@chatroom".equals(fromWxid))) {
|
||||||
logger.info("消息以评开头,处理评价指令消息");
|
logger.info("消息以评开头,处理评价指令消息");
|
||||||
jdUtils.sendOrderToWxByOrderP(msg.replace("评", ""), fromWxid);
|
jdUtils.sendOrderToWxByOrderP(msg.trim(), fromWxid);
|
||||||
return;
|
}else {
|
||||||
}
|
|
||||||
|
|
||||||
logger.info("未命中前置指令,开始命中 Default 流程");
|
logger.info("未命中前置指令,开始命中 Default 流程");
|
||||||
jdUtils.sendOrderToWxByOrderDefault(msg, fromWxid);
|
jdUtils.sendOrderToWxByOrderDefault(msg, fromWxid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user