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 c259849..ea4ba0d 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 @@ -1175,13 +1175,15 @@ private String handleTF(String input) { return warn; } - // 验证2:如果京粉实际价格不为空,检查与付款金额的差值 + // 验证2:如果京粉实际价格不为空,检查与付款金额是否一致 if (order.getJingfenActualPrice() != null && order.getPaymentAmount() != null) { double diff = Math.abs(order.getPaymentAmount() - order.getJingfenActualPrice()); - if (Math.abs(diff - 100.0) < 0.01) { // 允许浮点数误差 - String warn = "[炸弹] [炸弹] [炸弹] 录单警告!!! \n付款金额和实际金额相差100,请联系管理员录单\n" + + // 如果金额不一致(允许0.01的浮点数误差),则提示警告 + if (diff > 0.01) { + String warn = "[炸弹] [炸弹] [炸弹] 录单警告!!! \n付款金额和实际金额不一致,请联系管理员录单\n" + "付款金额:" + order.getPaymentAmount() + "\n" + - "京粉实际价格:" + order.getJingfenActualPrice(); + "京粉实际价格:" + order.getJingfenActualPrice() + "\n" + + "差额:" + String.format("%.2f", diff); return warn; } } @@ -1266,12 +1268,12 @@ private String handleTF(String input) { extractField(input, fields, "物流链接:", "订单号:"); extractField(input, fields, "订单号:", "下单人:"); + // 京粉实际价格不从表单解析,而是从数据库查询获取 + // 如果表单中有这个字段,也提取出来(但不会使用,仅用于兼容) if (hasJingfenPrice) { - // 新格式:有京粉实际价格字段 extractField(input, fields, "下单人:", "京粉实际价格:"); extractField(input, fields, "京粉实际价格:", ""); } else { - // 旧格式:下单人后面没有京粉实际价格 extractField(input, fields, "下单人:", ""); } @@ -1331,14 +1333,7 @@ private String handleTF(String input) { order.setLogisticsLink(extractFirstUrl(fields.getOrDefault("物流链接", ""))); order.setOrderId(fields.getOrDefault("订单号", null)); order.setBuyer(fields.getOrDefault("下单人", null)); - // 解析京粉实际价格 - try { - String jingfenPriceStr = fields.getOrDefault("京粉实际价格", null); - if (jingfenPriceStr != null && !jingfenPriceStr.trim().isEmpty()) { - order.setJingfenActualPrice(Double.parseDouble(jingfenPriceStr.trim())); - } - } catch (Exception ignore) { - } + // 京粉实际价格不从表单解析,而是从数据库order_rows表中查询获取 // 默认参与统计 order.setIsCountEnabled(1); try {