1
This commit is contained in:
@@ -319,9 +319,10 @@ public class JDUtil {
|
||||
OrderFetchStrategy strategy = new Days3090Strategy();
|
||||
for (WXUtil.SuperAdmin admin : super_admins.values()) {
|
||||
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) {
|
||||
logger.error("账号{}拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
||||
logger.error("账号 {} 拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -342,7 +343,8 @@ public class JDUtil {
|
||||
OrderFetchStrategy strategy = new Days1430Strategy(); // 需补充Days1430Strategy实现
|
||||
for (WXUtil.SuperAdmin admin : super_admins.values()) {
|
||||
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) {
|
||||
logger.error("账号 {} 拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
||||
}
|
||||
@@ -365,9 +367,11 @@ public class JDUtil {
|
||||
super_admins.values().parallelStream().forEach(admin -> {
|
||||
if (Util.isAnyEmpty(admin.getAppKey(), admin.getSecretKey())) return;
|
||||
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) {
|
||||
logger.error("账号{}0714拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
||||
logger.error("账号 {} 0714拉取异常: {}", admin.getAppKey().substring(18), e.getMessage());
|
||||
}
|
||||
});
|
||||
} catch (Exception ex) {
|
||||
@@ -735,7 +739,7 @@ public class JDUtil {
|
||||
content.append("\r" + "违规佣金:").append(getStreamForWeiGui(todayOrders).mapToDouble(orderRow -> orderRow.getEstimateCosPrice() * orderRow.getCommissionRate() * 0.01).sum());
|
||||
|
||||
|
||||
if(!todayOrders.isEmpty()){
|
||||
if (!todayOrders.isEmpty()) {
|
||||
orderUtil.orderToWxBatch(todayOrders);
|
||||
}
|
||||
|
||||
@@ -760,7 +764,7 @@ public class JDUtil {
|
||||
content.append("已完成佣金:").append(yesterdayOrders.stream().filter(orderRow -> orderRow.getValidCode() == 17).mapToDouble(OrderRow::getEstimateFee).sum());
|
||||
content.append("\r" + "违规佣金:").append(getStreamForWeiGui(yesterdayOrders).mapToDouble(orderRow -> orderRow.getEstimateCosPrice() * orderRow.getCommissionRate() * 0.01).sum());
|
||||
|
||||
if(!yesterdayOrders.isEmpty()){
|
||||
if (!yesterdayOrders.isEmpty()) {
|
||||
orderUtil.orderToWxBatch(todayOrders);
|
||||
}
|
||||
|
||||
@@ -785,7 +789,7 @@ public class JDUtil {
|
||||
content.append("已完成佣金:").append(last7DaysOrders.stream().filter(orderRow -> orderRow.getValidCode() == 17).mapToDouble(OrderRow::getEstimateFee).sum());
|
||||
content.append("\r" + "违规佣金:").append(getStreamForWeiGui(last7DaysOrders).mapToDouble(orderRow -> orderRow.getEstimateCosPrice() * orderRow.getCommissionRate() * 0.01).sum());
|
||||
|
||||
if(!last7DaysOrders.isEmpty()){
|
||||
if (!last7DaysOrders.isEmpty()) {
|
||||
orderUtil.orderToWxBatch(last7DaysOrders);
|
||||
}
|
||||
|
||||
@@ -1267,21 +1271,28 @@ public class JDUtil {
|
||||
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
|
||||
@Setter
|
||||
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 String lastInteractionTime;
|
||||
private ProcessState currentState;
|
||||
private Map<String, String> collectedFields; // 用于存储收集到的字段值
|
||||
@@ -1307,23 +1318,15 @@ public class JDUtil {
|
||||
updateLastInteractionTime();
|
||||
}
|
||||
|
||||
// 推荐使用枚举管理状态
|
||||
public enum ProcessState {
|
||||
INIT, GIFT_MONEY_FLOW, DISINFECTANT_CABINET
|
||||
}
|
||||
|
||||
// 增强京东链接解析的正则表达式
|
||||
private String parseSkuFromUrl(String url) {
|
||||
Pattern pattern = Pattern.compile("/(\\d+)(\\.html|\\?)"); // 支持更多链接格式
|
||||
Matcher matcher = pattern.matcher(url);
|
||||
return matcher.find() ? matcher.group(1) : null;
|
||||
public enum GiftMoneyStep {
|
||||
STEP_PRODUCT_LINK, STEP_AMOUNT, STEP_QUANTITY
|
||||
}
|
||||
|
||||
// 改进金额验证提示
|
||||
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