后付费 客看单

This commit is contained in:
2026-04-07 11:40:05 +08:00
parent bf8be19afd
commit be37a2d92b
3 changed files with 21 additions and 7 deletions

View File

@@ -50,20 +50,28 @@ public class RabbitPublisher {
sendMsg(RabbitConstants.Queue.ORDER_REFUND_QUEUE, refundMap);
}
/**
* 后付费订单打印消息
*
* @param orderId 订单id
*/
public void sendOrderPrintMsg(String orderId, boolean printOrder, String source) {
log.info("订单打印消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
//结算票 预结算单 客看单
if (printOrder) {
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
}
}
/**
* 订单打印消息
*
* @param orderId 订单id
* @param printOrder 是否打印结算单
*/
public void sendOrderPrintMsg(String orderId, boolean printOrder, String source) {
log.info("开始发送打印mq消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
public void sendKitchenOrderPrintMsg(String orderId, boolean printOrder, String source) {
log.info("厨房打印消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
//厨房票
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", orderId).fluentPut("printOrder", printOrder).toString());
//前台票
if (printOrder) {
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
}
}
/**

View File

@@ -330,7 +330,8 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
//发送打票信息 后付费推送多次 需要处理
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_0_0", false, "后付费打印");
rabbitPublisher.sendKitchenOrderPrintMsg(orderInfo.getId() + "_0_0", false, "后付费打印");
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_0_0_" + orderInfo.getPlaceNum(), true, "后付费打印");
} else {
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15);
}
@@ -1275,6 +1276,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
if (payType != PayEnums.BACK_SCAN) {
// 事务成功提交后执行消息发送
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
rabbitPublisher.sendKitchenOrderPrintMsg(printParam, isPrint, "事务环境打印");
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "事务环境打印");
}
// log.info("订单{}事务提交后,发送打印消息", orderId);
@@ -1285,6 +1287,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
// 非事务环境下直接发送(兼容无事务场景)
String printParam = orderId + "_" + (!"after-pay".equals(payMode) ? 1 : 0) + "_1";
rabbitPublisher.sendOrderPrintMsg(printParam, isPrint, "非事务环境打印");
rabbitPublisher.sendKitchenOrderPrintMsg(printParam, isPrint, "非事务环境打印");
}
// log.info("非事务环境下,直接发送订单{}打印消息", orderId);
}

View File

@@ -118,6 +118,8 @@ public class OrderPayServiceImpl implements OrderPayService {
//发送打票信息
//orderId_0_0 订单ID_先付后付(1先付0后付)_订单状态 0未完成 1完成
//orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_0"
rabbitPublisher.sendKitchenOrderPrintMsg(orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1",
orderInfo.getIsPrint() == 1, "0元付款");
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1",
orderInfo.getIsPrint() == 1, "0元付款");
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
@@ -362,6 +364,7 @@ public class OrderPayServiceImpl implements OrderPayService {
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
// 事务成功提交后执行消息发送
String printParam = orderInfo.getId() + "_" + (!"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0) + "_1";
rabbitPublisher.sendKitchenOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
rabbitPublisher.sendOrderPrintMsg(printParam, orderInfo.getIsPrint() == 1, "事务环境打印");
} else {
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,