1
This commit is contained in:
@@ -319,7 +319,8 @@ public class JDUtil {
|
|||||||
OrderFetchStrategy strategy = new Days3090Strategy();
|
OrderFetchStrategy strategy = new Days3090Strategy();
|
||||||
for (WXUtil.SuperAdmin admin : super_admins.values()) {
|
for (WXUtil.SuperAdmin admin : super_admins.values()) {
|
||||||
try {
|
try {
|
||||||
fetchOrders(strategy, admin.getAppKey(), admin.getSecretKey());
|
int count = fetchOrders(strategy, admin.getAppKey(), admin.getSecretKey());
|
||||||
|
logger.info("账号{} 3090订单拉取完成,新增{}条", admin.getAppKey().substring(18), count);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("账号 {} 拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
logger.error("账号 {} 拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -342,7 +343,8 @@ public class JDUtil {
|
|||||||
OrderFetchStrategy strategy = new Days1430Strategy(); // 需补充Days1430Strategy实现
|
OrderFetchStrategy strategy = new Days1430Strategy(); // 需补充Days1430Strategy实现
|
||||||
for (WXUtil.SuperAdmin admin : super_admins.values()) {
|
for (WXUtil.SuperAdmin admin : super_admins.values()) {
|
||||||
try {
|
try {
|
||||||
fetchOrders(strategy, admin.getAppKey(), admin.getSecretKey());
|
int count = fetchOrders(strategy, admin.getAppKey(), admin.getSecretKey());
|
||||||
|
logger.info("账号{} 1430订单拉取完成,新增{}条", admin.getAppKey().substring(18), count);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("账号 {} 拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
logger.error("账号 {} 拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -365,7 +367,9 @@ public class JDUtil {
|
|||||||
super_admins.values().parallelStream().forEach(admin -> {
|
super_admins.values().parallelStream().forEach(admin -> {
|
||||||
if (Util.isAnyEmpty(admin.getAppKey(), admin.getSecretKey())) return;
|
if (Util.isAnyEmpty(admin.getAppKey(), admin.getSecretKey())) return;
|
||||||
try {
|
try {
|
||||||
fetchOrders(strategy, admin.getAppKey(), admin.getSecretKey());
|
int count = fetchOrders(strategy, admin.getAppKey(), admin.getSecretKey());
|
||||||
|
logger.info("账号{} 0714订单拉取完成,新增{}条", admin.getAppKey().substring(18), count);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("账号 {} 0714拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
logger.error("账号 {} 0714拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -1267,21 +1271,28 @@ public class JDUtil {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 增强京东链接解析的正则表达式
|
||||||
|
private String parseSkuFromUrl(String url) {
|
||||||
|
Pattern pattern = Pattern.compile("/(\\d+)(\\.html|\\?)"); // 支持更多链接格式
|
||||||
|
Matcher matcher = pattern.matcher(url);
|
||||||
|
return matcher.find() ? matcher.group(1) : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 改进金额验证提示
|
||||||
|
private boolean isValidAmount(String input) {
|
||||||
|
String fromWxid = "";
|
||||||
|
if (!input.matches("^\\d+(\\.\\d{1,2})?$")) {
|
||||||
|
wxUtil.sendTextMessage(fromWxid, "金额格式错误,请输入数字(可包含两位小数)\n示例:50 或 29.9", 1, fromWxid);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// 定义一个内部类来存储用户交互状态
|
// 定义一个内部类来存储用户交互状态
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
static class UserInteractionState {
|
static class UserInteractionState {
|
||||||
// 推荐使用枚举管理状态
|
|
||||||
public enum ProcessState {
|
|
||||||
INIT, GIFT_MONEY_FLOW, DISINFECTANT_CABINET
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum GiftMoneyStep {
|
|
||||||
STEP_PRODUCT_LINK, STEP_AMOUNT, STEP_QUANTITY
|
|
||||||
}
|
|
||||||
|
|
||||||
private GiftMoneyStep currentStep; // 新增当前步骤字段
|
private GiftMoneyStep currentStep; // 新增当前步骤字段
|
||||||
|
|
||||||
private String lastInteractionTime;
|
private String lastInteractionTime;
|
||||||
private ProcessState currentState;
|
private ProcessState currentState;
|
||||||
private Map<String, String> collectedFields; // 用于存储收集到的字段值
|
private Map<String, String> collectedFields; // 用于存储收集到的字段值
|
||||||
@@ -1307,23 +1318,15 @@ public class JDUtil {
|
|||||||
updateLastInteractionTime();
|
updateLastInteractionTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 推荐使用枚举管理状态
|
||||||
|
public enum ProcessState {
|
||||||
|
INIT, GIFT_MONEY_FLOW, DISINFECTANT_CABINET
|
||||||
}
|
}
|
||||||
|
|
||||||
// 增强京东链接解析的正则表达式
|
public enum GiftMoneyStep {
|
||||||
private String parseSkuFromUrl(String url) {
|
STEP_PRODUCT_LINK, STEP_AMOUNT, STEP_QUANTITY
|
||||||
Pattern pattern = Pattern.compile("/(\\d+)(\\.html|\\?)"); // 支持更多链接格式
|
|
||||||
Matcher matcher = pattern.matcher(url);
|
|
||||||
return matcher.find() ? matcher.group(1) : null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 改进金额验证提示
|
|
||||||
private boolean isValidAmount(String input) {
|
|
||||||
String fromWxid = "";
|
|
||||||
if (!input.matches("^\\d+(\\.\\d{1,2})?$")) {
|
|
||||||
wxUtil.sendTextMessage(fromWxid, "金额格式错误,请输入数字(可包含两位小数)\n示例:50 或 29.9", 1, fromWxid);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 限流异常类(需自定义)
|
// 限流异常类(需自定义)
|
||||||
|
|||||||
Reference in New Issue
Block a user