重构评论
This commit is contained in:
@@ -1650,7 +1650,18 @@ public class JDUtil {
|
||||
state.setCurrentState(UserInteractionState.ProcessState.COMMENT_GENERATION);
|
||||
state.setCurrentField("commentTypeSelection");
|
||||
// 提示用户选择评论类型
|
||||
wxUtil.sendTextMessage(fromWxid, "请选择要生成的评论类型:\n回复 1 - 消毒柜评论\n回复 2 - 油烟机评论", 1, fromWxid, false);
|
||||
getProductTypeMap();
|
||||
if (productTypeMap == null){
|
||||
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
||||
return;
|
||||
}
|
||||
StringBuilder productTypeStr = new StringBuilder();
|
||||
for (Map.Entry<String, String> entry : productTypeMap.entrySet()) {
|
||||
String k = entry.getKey();
|
||||
String value = entry.getValue();
|
||||
productTypeStr.append(k).append(":").append(value).append("\n");
|
||||
}
|
||||
wxUtil.sendTextMessage(fromWxid, "请选择要生成的评论类型:" + productTypeStr, 1, fromWxid, false);
|
||||
logger.info("进入生成评论流程 - 用户: {}", fromWxid);
|
||||
|
||||
} catch (Exception e) {
|
||||
@@ -1676,16 +1687,6 @@ public class JDUtil {
|
||||
* 处理生成评论流程中的用户交互
|
||||
*/
|
||||
private void handleCommentInteraction(String fromWxid, String message, UserInteractionState state) {
|
||||
try {
|
||||
String[] split = message.replaceAll("\r", "").split("\n");
|
||||
if (split.length != 0) {
|
||||
message = split[0].trim().replace("\n", "");
|
||||
for (int i = 1; i < split.length; i++) {
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("handleCommentInteraction 处理生成评论流程中的用户交互异常 - 用户: {}, 状态: {}", fromWxid, state, e);
|
||||
}
|
||||
String key = INTERACTION_STATE_PREFIX + fromWxid;
|
||||
logger.info("handleCommentInteraction 处理生成评论流程中的用户交互 - 用户: {}, 状态: {},message: {}", fromWxid, state, message);
|
||||
try {
|
||||
@@ -1694,6 +1695,10 @@ public class JDUtil {
|
||||
return;
|
||||
}
|
||||
getProductTypeMap();
|
||||
if (productTypeMap == null){
|
||||
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
||||
return;
|
||||
}
|
||||
if (productTypeMap.containsKey(message)) {
|
||||
generateComment(fromWxid, message);
|
||||
} else {
|
||||
@@ -1718,6 +1723,10 @@ public class JDUtil {
|
||||
|
||||
// 获取产品ID
|
||||
getProductTypeMap();
|
||||
if (productTypeMap == null){
|
||||
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
||||
return;
|
||||
}
|
||||
String product_id = productTypeMap.get(productType);
|
||||
if (product_id == null || product_id.isEmpty()) {
|
||||
wxUtil.sendTextMessage(fromWxid, "缺失对应的SKUID", 1, fromWxid, false);
|
||||
|
||||
Reference in New Issue
Block a user