From b86c4bea8813a5b1dd431350c76df7cb28e1a9f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8D=92?= Date: Sat, 13 Dec 2025 13:48:42 +0800 Subject: [PATCH] 1 --- .../service/impl/InstructionServiceImpl.java | 66 +++++++++---------- 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/InstructionServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/InstructionServiceImpl.java index 44e4982..43e4724 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/InstructionServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/InstructionServiceImpl.java @@ -60,12 +60,12 @@ public class InstructionServiceImpl implements IInstructionService { public List execute(String command) { return execute(command, false); } - + @Override public List execute(String command, boolean forceGenerate) { return execute(command, forceGenerate, false); } - + @Override public List execute(String command, boolean forceGenerate, boolean isFromConsole) { // 存储接收的消息到Redis队列 @@ -228,11 +228,11 @@ public class InstructionServiceImpl implements IInstructionService { private List handleRecordLikeMulti(String input) { return handleRecordLikeMulti(input, false, false); } - + private List handleRecordLikeMulti(String input, boolean forceGenerate) { return handleRecordLikeMulti(input, forceGenerate, false); } - + private List handleRecordLikeMulti(String input, boolean forceGenerate, boolean isFromConsole) { // 仅实现“慢搜/慢查 关键词”与“录单/慢单 日期范围”的只读输出,避免侵入写库 if (input.startsWith("慢搜") || input.startsWith("慢查")) { @@ -644,14 +644,14 @@ public class InstructionServiceImpl implements IInstructionService { static { /* - -13723151190 -18839187854 -15639125541 +留着三个 13243039070 +15639125541 +15514786055 */ phoneWithTF.add("15639125541"); phoneWithTF.add("13243039070"); + phoneWithTF.add("15514786055"); } @@ -667,7 +667,7 @@ public class InstructionServiceImpl implements IInstructionService { private String handleTF(String input) { return handleTF(input, false); } - + private String handleTF(String input, boolean forceGenerate) { String body = input.replaceFirst("^TF\\s*", ""); body = body.replaceAll("[啊阿]", ""); @@ -703,7 +703,7 @@ public class InstructionServiceImpl implements IInstructionService { // 提取电话(第7个字段) String phone = parts[6]; // 将触发号码替换为 phoneWithTF 列表中的号码,按顺序循环 - if (("13243039070".equals(phone) || "17530176250".equals(phone)) && !phoneWithTF.isEmpty()) { + if (("13243039070".equals(phone) ) && !phoneWithTF.isEmpty()) { String originalPhone = phone; if (stringRedisTemplate != null) { try { @@ -765,7 +765,7 @@ public class InstructionServiceImpl implements IInstructionService { private String handleH(String input) { return handleH(input, false); } - + private String handleH(String input, boolean forceGenerate) { return handleHLike(input, "H", "H", forceGenerate); } @@ -773,7 +773,7 @@ public class InstructionServiceImpl implements IInstructionService { private String handleW(String input) { return handleW(input, false); } - + private String handleW(String input, boolean forceGenerate) { return handleHLike(input, "W", "W", forceGenerate); } @@ -781,7 +781,7 @@ public class InstructionServiceImpl implements IInstructionService { private String handleHLike(String input, String commandKeyword, String distributionMark) { return handleHLike(input, commandKeyword, distributionMark, false); } - + private String handleHLike(String input, String commandKeyword, String distributionMark, boolean forceGenerate) { String cleaned = input.replaceFirst("^" + Pattern.quote(commandKeyword), ""); if (cleaned.startsWith("\n")) { @@ -815,7 +815,7 @@ public class InstructionServiceImpl implements IInstructionService { private String handleSheng(String input) { return handleSheng(input, false); } - + private String handleSheng(String input, boolean forceGenerate) { // 输入格式: // 生\n分销标记\n型号\n转链链接\n数量\n地址 @@ -876,7 +876,7 @@ public class InstructionServiceImpl implements IInstructionService { private String handlePDD(String input) { return handlePDD(input, false); } - + private String handlePDD(String input, boolean forceGenerate) { return handlePDDWithMark(input, "拼多多", "PDD", forceGenerate); } @@ -884,7 +884,7 @@ public class InstructionServiceImpl implements IInstructionService { private String handlePDDW(String input) { return handlePDDW(input, false); } - + private String handlePDDW(String input, boolean forceGenerate) { return handlePDDWithMark(input, "拼多多 W", "PDD-W", forceGenerate); } @@ -892,7 +892,7 @@ public class InstructionServiceImpl implements IInstructionService { private String handlePDDWithMark(String input, String commandKeyword, String distributionMark) { return handlePDDWithMark(input, commandKeyword, distributionMark, false); } - + private String handlePDDWithMark(String input, String commandKeyword, String distributionMark, boolean forceGenerate) { // 拼多多新格式: // <指令>251102-457567158704072 @@ -1087,7 +1087,7 @@ public class InstructionServiceImpl implements IInstructionService { private String generateOrderText(String shengInput, String providedThirdPartyOrderNo) { return generateOrderText(shengInput, providedThirdPartyOrderNo, false); } - + private String generateOrderText(String shengInput, String providedThirdPartyOrderNo, boolean forceGenerate) { String[] split = shengInput.split("\n"); // 第一行可能是 生 或 生{备注} @@ -1279,11 +1279,11 @@ public class InstructionServiceImpl implements IInstructionService { private String handleDanWriteDb(String input) { return handleDanWriteDb(input, false, false); } - + private String handleDanWriteDb(String input, boolean forceGenerate) { return handleDanWriteDb(input, forceGenerate, false); } - + private String handleDanWriteDb(String input, boolean forceGenerate, boolean isFromConsole) { // 保存原始输入,用于返回前端时保留完整物流链接 String originalInput = input.trim().replace("元", ""); @@ -1376,7 +1376,7 @@ public class InstructionServiceImpl implements IInstructionService { // 判断新增/更新:所有入口都优先根据订单号更新(用于刷新数据) JDOrder exists = null; - + // 如果订单号不为空,优先根据订单号查找已存在的订单(用于刷新数据) if (!isEmpty(order.getOrderId())) { exists = jdOrderService.selectJDOrderByOrderId(order.getOrderId()); @@ -1386,7 +1386,7 @@ public class InstructionServiceImpl implements IInstructionService { jdOrderService.updateJDOrder(order); } } - + // 如果没有通过订单号找到,则按 remark 判断新增/更新 if (exists == null) { exists = jdOrderService.selectJDOrderByRemark(order.getRemark()); @@ -1908,17 +1908,17 @@ public class InstructionServiceImpl implements IInstructionService { // 提取订单号:订单:343216308806 Pattern orderPattern = Pattern.compile("订单[::]\\s*(\\d+)"); Matcher matcher = orderPattern.matcher(message); - + if (matcher.find()) { String orderId = matcher.group(1); - + // 查找订单 JDOrder order = jdOrderService.selectJDOrderByOrderId(orderId); if (order != null) { // 设置后返到账状态为1,并设置到账日期为当前时间 order.setIsRebateReceived(1); order.setRebateReceivedDate(new Date()); - + // 更新订单 int updateResult = jdOrderService.updateJDOrder(order); if (updateResult > 0) { @@ -1947,18 +1947,18 @@ public class InstructionServiceImpl implements IInstructionService { public void batchMarkRebateReceivedForCompensation() { try { System.out.println("开始批量标记后返到账(赔付金额>0的订单)..."); - + // 查询所有订单 List allOrders = jdOrderService.selectJDOrderList(new JDOrder()); - + // 查询所有订单的赔付金额(从OrderRows表) int updatedCount = 0; int skippedCount = 0; - + for (JDOrder order : allOrders) { // 查询订单的赔付金额 OrderRows orderRows = orderRowsService.selectOrderRowsByOrderId(order.getOrderId()); - + if (orderRows != null && orderRows.getProPriceAmount() != null && orderRows.getProPriceAmount() > 0) { // 如果赔付金额大于0,且后返到账状态不是1,则更新 if (order.getIsRebateReceived() == null || order.getIsRebateReceived() != 1) { @@ -1967,11 +1967,11 @@ public class InstructionServiceImpl implements IInstructionService { if (order.getRebateReceivedDate() == null) { order.setRebateReceivedDate(new Date()); } - + int updateResult = jdOrderService.updateJDOrder(order); if (updateResult > 0) { updatedCount++; - System.out.println("✓ 标记后返到账 - 订单号: " + order.getOrderId() + + System.out.println("✓ 标记后返到账 - 订单号: " + order.getOrderId() + ", 赔付金额: " + orderRows.getProPriceAmount()); } else { System.err.println("✗ 更新失败 - 订单号: " + order.getOrderId()); @@ -1983,12 +1983,12 @@ public class InstructionServiceImpl implements IInstructionService { skippedCount++; } } - + System.out.println("批量标记完成!"); System.out.println("更新数量: " + updatedCount); System.out.println("跳过数量: " + skippedCount); System.out.println("总计: " + allOrders.size()); - + } catch (Exception e) { System.err.println("✗ 批量标记后返到账时发生异常: " + e.getMessage()); e.printStackTrace();