diff --git a/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/OrderInfoCustomServiceImpl.java b/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/OrderInfoCustomServiceImpl.java index 8c5a20899..aa12839b6 100644 --- a/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/OrderInfoCustomServiceImpl.java +++ b/cash-service/order-service/src/main/java/com/czg/service/order/service/impl/OrderInfoCustomServiceImpl.java @@ -1182,6 +1182,10 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService { @Override @Transactional public void upOrderInfo(OrderInfo orderInfo, BigDecimal payAmount, LocalDateTime payTime, Long payOrderId, PayEnums payType) { + if (orderInfo.getStatus().equals(OrderStatusEnums.DONE.getCode())) { + log.info("订单{}已完成,不再更新", orderInfo.getId()); + return; + } OrderInfo upOrderInfo = new OrderInfo() .setId(orderInfo.getId()) .setPayAmount(payAmount) @@ -1223,16 +1227,20 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService { if (StrUtil.isNotBlank(orderInfo.getTableCode())) { ThreadUtil.execAsync(() -> exTable(orderInfo)); } - // 事务成功提交后执行消息发送 - String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1"; - rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "事务环境打印"); + if (payType == PayEnums.BACK_SCAN) { + // 事务成功提交后执行消息发送 + String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1"; + rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "事务环境打印"); + } // log.info("订单{}事务提交后,发送打印消息", orderId); } }); } else { - // 非事务环境下直接发送(兼容无事务场景) - String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1"; - rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "非事务环境打印"); + if (payType == PayEnums.BACK_SCAN) { + // 非事务环境下直接发送(兼容无事务场景) + String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1"; + rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "非事务环境打印"); + } // log.info("非事务环境下,直接发送订单{}打印消息", orderId); } rabbitPublisher.sendOrderDetailStatusMsg(orderInfo.getShopId().toString(), "bc");