重构评论
This commit is contained in:
@@ -1650,7 +1650,18 @@ public class JDUtil {
|
|||||||
state.setCurrentState(UserInteractionState.ProcessState.COMMENT_GENERATION);
|
state.setCurrentState(UserInteractionState.ProcessState.COMMENT_GENERATION);
|
||||||
state.setCurrentField("commentTypeSelection");
|
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);
|
logger.info("进入生成评论流程 - 用户: {}", fromWxid);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -1676,16 +1687,6 @@ public class JDUtil {
|
|||||||
* 处理生成评论流程中的用户交互
|
* 处理生成评论流程中的用户交互
|
||||||
*/
|
*/
|
||||||
private void handleCommentInteraction(String fromWxid, String message, UserInteractionState state) {
|
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;
|
String key = INTERACTION_STATE_PREFIX + fromWxid;
|
||||||
logger.info("handleCommentInteraction 处理生成评论流程中的用户交互 - 用户: {}, 状态: {},message: {}", fromWxid, state, message);
|
logger.info("handleCommentInteraction 处理生成评论流程中的用户交互 - 用户: {}, 状态: {},message: {}", fromWxid, state, message);
|
||||||
try {
|
try {
|
||||||
@@ -1694,6 +1695,10 @@ public class JDUtil {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
getProductTypeMap();
|
getProductTypeMap();
|
||||||
|
if (productTypeMap == null){
|
||||||
|
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (productTypeMap.containsKey(message)) {
|
if (productTypeMap.containsKey(message)) {
|
||||||
generateComment(fromWxid, message);
|
generateComment(fromWxid, message);
|
||||||
} else {
|
} else {
|
||||||
@@ -1718,6 +1723,10 @@ public class JDUtil {
|
|||||||
|
|
||||||
// 获取产品ID
|
// 获取产品ID
|
||||||
getProductTypeMap();
|
getProductTypeMap();
|
||||||
|
if (productTypeMap == null){
|
||||||
|
wxUtil.sendTextMessage(fromWxid, "productTypeMap 为空 ", 1, fromWxid, false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
String product_id = productTypeMap.get(productType);
|
String product_id = productTypeMap.get(productType);
|
||||||
if (product_id == null || product_id.isEmpty()) {
|
if (product_id == null || product_id.isEmpty()) {
|
||||||
wxUtil.sendTextMessage(fromWxid, "缺失对应的SKUID", 1, fromWxid, false);
|
wxUtil.sendTextMessage(fromWxid, "缺失对应的SKUID", 1, fromWxid, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user