bacn scan 打印两次问题

This commit is contained in:
2026-01-17 15:01:32 +08:00
parent fff14043b5
commit de21e0a202

View File

@@ -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");