重构评论
This commit is contained in:
@@ -146,31 +146,6 @@ public class JDUtil {
|
|||||||
return todayOrders.stream().filter(orderRow -> orderRow.getValidCode() == 13 || orderRow.getValidCode() == 25 || orderRow.getValidCode() == 26 || orderRow.getValidCode() == 27 || orderRow.getValidCode() == 28 || orderRow.getValidCode() == 29);
|
return todayOrders.stream().filter(orderRow -> orderRow.getValidCode() == 13 || orderRow.getValidCode() == 25 || orderRow.getValidCode() == 26 || orderRow.getValidCode() == 27 || orderRow.getValidCode() == 28 || orderRow.getValidCode() == 29);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 拼多多地址
|
|
||||||
*/
|
|
||||||
public String convertAddress(String input) {
|
|
||||||
try {
|
|
||||||
// 正则表达式分解输入内容
|
|
||||||
Pattern pattern = Pattern.compile("^(.+?)\\[(\\d+)\\]\\s+(\\d+)\\s+(.+)\\[\\d+]$");
|
|
||||||
Matcher matcher = pattern.matcher(input);
|
|
||||||
|
|
||||||
if (matcher.matches()) {
|
|
||||||
// 提取各部分内容
|
|
||||||
String name = matcher.group(1);
|
|
||||||
String code = matcher.group(2);
|
|
||||||
String phone = matcher.group(3);
|
|
||||||
String address = matcher.group(4).trim();
|
|
||||||
|
|
||||||
// 构造新地址格式
|
|
||||||
return String.format("%s 13068923963 %s联系客户%s转%s", name, address, phone, code);
|
|
||||||
}
|
|
||||||
} catch (Exception ignored) {
|
|
||||||
return "地址格式不匹配";
|
|
||||||
}
|
|
||||||
return "地址格式不匹配";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void sendOrderToWxByOrderDefault(String order, String fromWxid) {
|
public void sendOrderToWxByOrderDefault(String order, String fromWxid) {
|
||||||
logger.info("执行 sendOrderToWxByOrderDefault 方法,order: {}, fromWxid: {}", order, fromWxid);
|
logger.info("执行 sendOrderToWxByOrderDefault 方法,order: {}, fromWxid: {}", order, fromWxid);
|
||||||
@@ -225,12 +200,6 @@ public class JDUtil {
|
|||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendOrderToWxByOrderPDD(String order, String fromWxid) {
|
|
||||||
String convertAddress = convertAddress(order);
|
|
||||||
wxUtil.sendTextMessage(fromWxid, convertAddress, 0, fromWxid, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接收京粉指令指令
|
* 接收京粉指令指令
|
||||||
*/
|
*/
|
||||||
@@ -1648,6 +1617,17 @@ public class JDUtil {
|
|||||||
wxUtil.sendTextMessage(fromWxid, "处理异常,请重新开始", 1, fromWxid, false);
|
wxUtil.sendTextMessage(fromWxid, "处理异常,请重新开始", 1, fromWxid, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (order.startsWith("添加型号")){
|
||||||
|
String replace = order.replace("添加型号-", "");
|
||||||
|
String[] split = replace.split("-");
|
||||||
|
if (split.length == 2){
|
||||||
|
addProductTypeMap(split[0], split[1]);
|
||||||
|
wxUtil.sendTextMessage(fromWxid, "添加型号成功", 1, fromWxid, false);
|
||||||
|
return;
|
||||||
|
}else {
|
||||||
|
wxUtil.sendTextMessage(fromWxid, "添加型号格式错误,请输入正确的格式:添加型号-型号名称-型号SKU", 1, fromWxid, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
// 如果未命中“评”指令,检查是否在生成评论流程中
|
// 如果未命中“评”指令,检查是否在生成评论流程中
|
||||||
handleCommentInteraction(fromWxid, order);
|
handleCommentInteraction(fromWxid, order);
|
||||||
}
|
}
|
||||||
@@ -1666,6 +1646,9 @@ public class JDUtil {
|
|||||||
logger.warn("Redis 中未找到键为 {} 的 Hash 数据", PRODUCT_TYPE_MAP_PREFIX);
|
logger.warn("Redis 中未找到键为 {} 的 Hash 数据", PRODUCT_TYPE_MAP_PREFIX);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void addProductTypeMap(String key, String value) {
|
||||||
|
redisTemplate.opsForHash().put(PRODUCT_TYPE_MAP_PREFIX, key, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1700,10 +1683,6 @@ 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