退单金额

This commit is contained in:
2026-04-21 17:42:52 +08:00
parent 8665a8d4dc
commit f873674f73
2 changed files with 12 additions and 11 deletions

View File

@@ -140,10 +140,10 @@ public class RabbitPublisher {
/** /**
* 后付费订单打印消息 * 后付费订单打印消息
* *
* @param orderId 订单id * @param orderId 订单id
* @param before 0后付费/1先付费 * @param before 0后付费/1先付费
* @param status 订单状态 0未完成/1完成 * @param status 订单状态 0未完成/1完成
* @param placeNum 第几次下单 * @param placeNum 第几次下单
*/ */
public void sendOrderPrintMsg(Long orderId, Integer before, Integer status, Integer placeNum, String source) { public void sendOrderPrintMsg(Long orderId, Integer before, Integer status, Integer placeNum, String source) {
log.info("订单打印消息, orderId:{},{},{},第:{}次下单,source:{}", log.info("订单打印消息, orderId:{},{},{},第:{}次下单,source:{}",
@@ -162,11 +162,12 @@ public class RabbitPublisher {
* @param printTypeEnum * @param printTypeEnum
* @param data * @param data
*/ */
public void sendOrderPrintLocalMsg(Long shopId, Long orderId, Integer placeNum, String printTypeEnum, String data, String operator) { public void sendOrderPrintLocalMsg(Long shopId, Long orderId, Integer placeNum, String printTypeEnum, String data, String operator, String amount) {
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("shopId", shopId); jsonObject.put("shopId", shopId);
jsonObject.put("orderId", orderId); jsonObject.put("orderId", orderId);
jsonObject.put("placeNum", placeNum); jsonObject.put("placeNum", placeNum);
jsonObject.put("amount", amount);
jsonObject.put("printType", printTypeEnum); jsonObject.put("printType", printTypeEnum);
jsonObject.put("data", data); jsonObject.put("data", data);
jsonObject.put("operator", operator); jsonObject.put("operator", operator);

View File

@@ -119,7 +119,7 @@ public class PrintConfig implements ApplicationRunner {
orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId())); orderDetailService.list(new QueryWrapper().eq(OrderDetail::getOrderId, orderInfo.getId()));
default -> orderDetailList; default -> orderDetailList;
}; };
sendOrderPrintMsg(orderInfo.getShopId(), orderInfo.getId(), placeNum, printTypeEnum + "", null, ""); sendOrderPrintMsg(orderInfo.getShopId(), orderInfo.getId(), placeNum, printTypeEnum + "", null, "", "");
for (PrintMachine machine : getPrintMachine(orderInfo.getShopId(), printTypeEnum)) { for (PrintMachine machine : getPrintMachine(orderInfo.getShopId(), printTypeEnum)) {
PrinterHandler printer = getPrinter(machine.getBrand()); PrinterHandler printer = getPrinter(machine.getBrand());
switch (printTypeEnum) { switch (printTypeEnum) {
@@ -254,7 +254,7 @@ public class PrintConfig implements ApplicationRunner {
* 处理退菜退款订单打印 * 处理退菜退款订单打印
*/ */
public void kitchenRefundAllHandler(String operator, OrderInfo orderInfo, List<OrderDetail> detailList) { public void kitchenRefundAllHandler(String operator, OrderInfo orderInfo, List<OrderDetail> detailList) {
sendOrderPrintMsg(orderInfo.getShopId(), orderInfo.getId(), null, PrinterHandler.PrintTypeEnum.REFUND_KITCHEN + "", detailList, operator); sendOrderPrintMsg(orderInfo.getShopId(), orderInfo.getId(), null, PrinterHandler.PrintTypeEnum.REFUND_KITCHEN + "", detailList, operator, "");
//后厨退菜单 //后厨退菜单
getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.REFUND_KITCHEN).forEach(machine -> { getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.REFUND_KITCHEN).forEach(machine -> {
getPrinter(machine.getBrand()).returnKitchenPrint(operator, orderInfo, detailList, machine); getPrinter(machine.getBrand()).returnKitchenPrint(operator, orderInfo, detailList, machine);
@@ -276,11 +276,11 @@ public class PrintConfig implements ApplicationRunner {
OrderInfo orderInfo, List<OrderDetail> detailList) { OrderInfo orderInfo, List<OrderDetail> detailList) {
//前台退菜单 //前台退菜单
if ("退菜单".equals(printTitle)) { if ("退菜单".equals(printTitle)) {
sendOrderPrintMsg(orderInfo.getShopId(), orderInfo.getId(), null, PrinterHandler.PrintTypeEnum.RETURN_ORDER + "", detailList, operator); sendOrderPrintMsg(orderInfo.getShopId(), orderInfo.getId(), null, PrinterHandler.PrintTypeEnum.RETURN_ORDER + "", detailList, operator, refundAmount);
getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.RETURN_ORDER).forEach(machine -> getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.RETURN_ORDER).forEach(machine ->
getPrinter(machine.getBrand()).returnOrderPrint(printTitle, operator, refundAmount, refundReason, refundType, orderInfo, machine, detailList)); getPrinter(machine.getBrand()).returnOrderPrint(printTitle, operator, refundAmount, refundReason, refundType, orderInfo, machine, detailList));
} else if ("退款单".equals(printTitle)) { } else if ("退款单".equals(printTitle)) {
sendOrderPrintMsg(orderInfo.getShopId(), orderInfo.getId(), null, PrinterHandler.PrintTypeEnum.REFUND_ORDER + "", detailList, operator); sendOrderPrintMsg(orderInfo.getShopId(), orderInfo.getId(), null, PrinterHandler.PrintTypeEnum.REFUND_ORDER + "", detailList, operator, refundAmount);
getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.REFUND_ORDER).forEach(machine -> { getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.REFUND_ORDER).forEach(machine -> {
PrinterHandler printer = getPrinter(machine.getBrand()); PrinterHandler printer = getPrinter(machine.getBrand());
machine.setVolumeSwitch(0); machine.setVolumeSwitch(0);
@@ -374,7 +374,7 @@ public class PrintConfig implements ApplicationRunner {
} }
private void sendOrderPrintMsg(Long shopId, Long orderId, Integer placeNum, String printType, List<OrderDetail> detailList, String operator) { private void sendOrderPrintMsg(Long shopId, Long orderId, Integer placeNum, String printType, List<OrderDetail> detailList, String operator, String amount) {
FunUtils.safeRunVoid(() -> { FunUtils.safeRunVoid(() -> {
List<OrderDetailPrintDTO> list = new ArrayList<>(); List<OrderDetailPrintDTO> list = new ArrayList<>();
if (CollUtil.isNotEmpty(detailList)) { if (CollUtil.isNotEmpty(detailList)) {
@@ -386,7 +386,7 @@ public class PrintConfig implements ApplicationRunner {
return printDTO; return printDTO;
}).toList(); }).toList();
} }
rabbitPublisher.sendOrderPrintLocalMsg(shopId, orderId, placeNum, printType, JSONObject.toJSONString(list), operator); rabbitPublisher.sendOrderPrintLocalMsg(shopId, orderId, placeNum, printType, JSONObject.toJSONString(list), operator, amount);
}, "订单{}消息发送失败,订单信息: {}", printType, orderId); }, "订单{}消息发送失败,订单信息: {}", printType, orderId);
} }