过滤空值

This commit is contained in:
2026-04-20 15:59:34 +08:00
parent 0d394d5628
commit 660226d133
9 changed files with 250 additions and 61 deletions

View File

@@ -2,6 +2,7 @@ package com.czg.controller.admin;
import com.czg.order.dto.FinanceStsDTO; import com.czg.order.dto.FinanceStsDTO;
import com.czg.order.param.FinanceStsQueryParam; import com.czg.order.param.FinanceStsQueryParam;
import com.czg.order.param.SaleSummaryCountParam;
import com.czg.order.service.FinanceStsService; import com.czg.order.service.FinanceStsService;
import com.czg.resp.CzgResult; import com.czg.resp.CzgResult;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
@@ -41,10 +42,20 @@ public class FinanceStsController {
/** /**
* 查询财务报表 * 打印经营日报
*/ */
@GetMapping("/print") @GetMapping("/printDayReport")
public CzgResult<FinanceStsDTO> printFinanceSts(FinanceStsQueryParam param) { public CzgResult<Void> printDayReport(SaleSummaryCountParam param) {
return CzgResult.success(financeStsService.getFinanceSts(param)); financeStsService.printDayReport(param);
return CzgResult.success();
}
/**
* 日结单
*/
@GetMapping("/printDaySettle")
public CzgResult<Void> printDaySettle(SaleSummaryCountParam param) {
financeStsService.printDaySettle(param);
return CzgResult.success();
} }
} }

View File

@@ -50,28 +50,6 @@ public class RabbitPublisher {
sendMsg(RabbitConstants.Queue.ORDER_REFUND_QUEUE, refundMap); sendMsg(RabbitConstants.Queue.ORDER_REFUND_QUEUE, refundMap);
} }
/**
* 后付费订单打印消息
*
* @param orderId 订单id
* @param before 0后付费/1先付费
* @param status 订单状态 0未完成/1完成
* @param placeNum 第几次下单
* @param printOrder 是否打印结算单
*/
public void sendOrderPrintMsg(Long orderId, Integer before, Integer status, Integer placeNum, boolean printOrder, String source) {
log.info("订单打印消息, orderId:{},{},{},第:{}次下单,通知本地:{},source:{}",
orderId, before == 0 ? "后付" : "先付", status == 0 ? "未完成" : "完成", placeNum, printOrder, source);
String sendOrderId = orderId + "_" + before + "_" + status + "_" + placeNum;
//本地打印机 消息通知
if (printOrder) {
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, sendOrderId);
}
//厨房单 printOrder 表示打不打结算单
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", sendOrderId).fluentPut("printOrder", printOrder).toString());
}
/** /**
* 商品信息变动消息 * 商品信息变动消息
* *
@@ -137,15 +115,12 @@ public class RabbitPublisher {
))); )));
} }
private void sendMsg(String queue, String msg) {
log.info("开始发送mq消息,exchange:{}, queue: {}, msg: {}", activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
rabbitTemplate.convertAndSend(activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
}
/** /**
* 其它类型 打印消息 * 其它类型 打印消息
* STOCK 出入库 * STOCK 出入库
* DAY_REPORT 经营日报 * DAY_REPORT 经营日报
* DAY_ORDER 日结单
* PRODUCT_REPORT 商品报表 * PRODUCT_REPORT 商品报表
* RECHARGE 储值单 * RECHARGE 储值单
* STOCK_CHECK 库存盘点 * STOCK_CHECK 库存盘点
@@ -155,23 +130,73 @@ public class RabbitPublisher {
* @param printType {@link com.czg.service.order.print.PrinterHandler.PrintTypeEnum} * @param printType {@link com.czg.service.order.print.PrinterHandler.PrintTypeEnum}
*/ */
public void sendOtherPrintMsg(Long shopId, Object data, String printType) { public void sendOtherPrintMsg(Long shopId, Object data, String printType) {
String exchange = activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE;
String queueName = activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_QUEUE;
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("shopId", shopId); jsonObject.put("shopId", shopId);
jsonObject.put("data", data); jsonObject.put("data", data);
jsonObject.put("printTypeEnum", printType); jsonObject.put("printTypeEnum", printType);
rabbitTemplate.convertAndSend(exchange, queueName, jsonObject.toString()); sendMsg(RabbitConstants.Queue.OTHER_PRINT_QUEUE, jsonObject.toString());
} }
/**
* 后付费订单打印消息
*
* @param orderId 订单id
* @param before 0后付费/1先付费
* @param status 订单状态 0未完成/1完成
* @param placeNum 第几次下单
*/
public void sendOrderPrintMsg(Long orderId, Integer before, Integer status, Integer placeNum, String source) {
log.info("订单打印消息, orderId:{},{},{},第:{}次下单,source:{}",
orderId, before == 0 ? "后付" : "先付", status == 0 ? "未完成" : "完成", placeNum, source);
String sendOrderId = orderId + "_" + before + "_" + status + "_" + placeNum;
//厨房单
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", sendOrderId).toString());
}
/**
* 本地打印机 订单消息通知
*
* @param shopId 店铺Id
* @param orderId
* @param placeNum
* @param printTypeEnum
* @param data
*/
public void sendOrderPrintLocalMsg(Long shopId, Long orderId, Integer placeNum, String printTypeEnum, String data, String operator) {
JSONObject jsonObject = new JSONObject();
jsonObject.put("shopId", shopId);
jsonObject.put("orderId", orderId);
jsonObject.put("placeNum", placeNum);
jsonObject.put("printType", printTypeEnum);
jsonObject.put("data", data);
jsonObject.put("operator", operator);
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, jsonObject.toString());
}
/**
* 其它类型 打印消息
* STOCK 出入库
* DAY_REPORT 经营日报
* DAY_ORDER 日结单
* PRODUCT_REPORT 商品报表
* RECHARGE 储值单
* STOCK_CHECK 库存盘点
* HANDOVER 交班单
* CALL 排队取号
*
* @param printType {@link com.czg.service.order.print.PrinterHandler.PrintTypeEnum}
*/
public void sendOtherPrintLocalMsg(Long shopId, String printType, Long dataId) { public void sendOtherPrintLocalMsg(Long shopId, String printType, Long dataId) {
String exchange = activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE;
String queueName = activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_LOCAL_QUEUE;
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("shopId", shopId); jsonObject.put("shopId", shopId);
jsonObject.put("dataId", dataId); jsonObject.put("dataId", dataId);
jsonObject.put("printType", printType); jsonObject.put("printType", printType);
rabbitTemplate.convertAndSend(exchange, queueName, jsonObject.toString()); sendMsg(RabbitConstants.Queue.OTHER_PRINT_LOCAL_QUEUE, jsonObject.toString());
} }
private void sendMsg(String queue, String msg) {
log.info("开始发送mq消息,exchange:{}, queue: {}, msg: {}", activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
rabbitTemplate.convertAndSend(activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
}
} }

View File

@@ -389,6 +389,12 @@ public class ShopOrderStatistic implements Serializable {
@ExcelProperty("净利润率(%)") @ExcelProperty("净利润率(%)")
private BigDecimal netProfitRate; private BigDecimal netProfitRate;
@ExcelIgnore
private BigDecimal douyinGroup;
@ExcelIgnore
private BigDecimal meituanGroup;
/** /**
* 创建时间 * 创建时间
*/ */

View File

@@ -2,6 +2,7 @@ package com.czg.order.service;
import com.czg.order.dto.FinanceStsDTO; import com.czg.order.dto.FinanceStsDTO;
import com.czg.order.param.FinanceStsQueryParam; import com.czg.order.param.FinanceStsQueryParam;
import com.czg.order.param.SaleSummaryCountParam;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
/** /**
@@ -16,4 +17,9 @@ public interface FinanceStsService {
FinanceStsDTO getFinanceSts(FinanceStsQueryParam param); FinanceStsDTO getFinanceSts(FinanceStsQueryParam param);
void exportFinanceSts(FinanceStsQueryParam param, HttpServletResponse response); void exportFinanceSts(FinanceStsQueryParam param, HttpServletResponse response);
void printDayReport(SaleSummaryCountParam param);
void printDaySettle(SaleSummaryCountParam param);
} }

View File

@@ -0,0 +1,93 @@
package com.czg.print;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* 订单详情 实体类。
*
* @author ww
* @since 2025-02-14
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class OrderDetailPrintDTO implements Serializable {
@Serial
private static final long serialVersionUID = 1L;
private Long id;
private String productName;
/**
* 商品类型:单规格商品 single 多规格商品 sku 套餐商品 package 称重商品 weigh 团购券 coupon
*/
private String productType;
private String skuName;
/**
* 原价
*/
private BigDecimal price;
/**
* 临时改价/临时菜价
*/
private BigDecimal discountSaleAmount;
/**
* 最终单价
*/
private BigDecimal unitPrice;
/**
* 是否赠送 0否 1是
*/
private Integer isGift;
private boolean isUrgent;
/**
* 数量
*/
private BigDecimal num;
/**
* 退菜数量(不管价格)
*/
private BigDecimal returnNum;
/**
* 当前下单次数
*/
private Integer placeNum;
private BigDecimal returnAmount;
/**
* 是否等叫
*/
private Integer isWaitCall;
/**
* 是否是临时菜品
*/
private Integer isTemporary;
/**
* 套餐商品选择信息
*/
private String proGroupInfo;
/**
* 备注
*/
private String remark;
/**
* 退款备注
*/
private String refundRemark;
}

View File

@@ -8,6 +8,7 @@ import com.czg.account.entity.PrintMachine;
import com.czg.account.entity.ShopInfo; import com.czg.account.entity.ShopInfo;
import com.czg.account.service.PrintMachineService; import com.czg.account.service.PrintMachineService;
import com.czg.account.service.ShopInfoService; import com.czg.account.service.ShopInfoService;
import com.czg.config.RabbitPublisher;
import com.czg.config.RedisCst; import com.czg.config.RedisCst;
import com.czg.exception.CzgException; import com.czg.exception.CzgException;
import com.czg.market.service.OrderInfoService; import com.czg.market.service.OrderInfoService;
@@ -24,6 +25,7 @@ import com.mybatisflex.core.query.QueryWrapper;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference; import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.BeanUtils;
import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner; import org.springframework.boot.ApplicationRunner;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
@@ -58,6 +60,8 @@ public class PrintConfig implements ApplicationRunner {
protected ProductService productService; protected ProductService productService;
@Resource @Resource
protected RedisService redisService; protected RedisService redisService;
@Resource
private RabbitPublisher rabbitPublisher;
public static final Map<String, PrinterHandler> PRINTER_MAP = new ConcurrentHashMap<>(); public static final Map<String, PrinterHandler> PRINTER_MAP = new ConcurrentHashMap<>();
@@ -114,6 +118,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 + "", orderDetailList, "");
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) {
@@ -156,10 +161,6 @@ public class PrintConfig implements ApplicationRunner {
}); });
break; break;
case PrinterHandler.PrintTypeEnum.ALL_KITCHEN: case PrinterHandler.PrintTypeEnum.ALL_KITCHEN:
Boolean exit = redisService.hasKey(RedisCst.kitchenAll(orderInfo.getId(), machine.getId()));
if (exit) {
break;
}
// 判断订单是否是先付费或者已结算 // 判断订单是否是先付费或者已结算
if (!"after-pay".equals(orderInfo.getPayMode()) && (OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus()) || OrderStatusEnums.CANCELLED.getCode().equals(orderInfo.getStatus()))) { if (!"after-pay".equals(orderInfo.getPayMode()) && (OrderStatusEnums.UNPAID.getCode().equals(orderInfo.getStatus()) || OrderStatusEnums.CANCELLED.getCode().equals(orderInfo.getStatus()))) {
log.warn("此订单未支付, 订单信息: {}", orderInfo.getId()); log.warn("此订单未支付, 订单信息: {}", orderInfo.getId());
@@ -171,7 +172,6 @@ public class PrintConfig implements ApplicationRunner {
} }
log.info("准备开始打印后厨整单"); log.info("准备开始打印后厨整单");
printer.allKitchenPrint(orderInfo, allOrderDetailList, machine); printer.allKitchenPrint(orderInfo, allOrderDetailList, machine);
redisService.set(RedisCst.kitchenAll(orderInfo.getId(), machine.getId()), "", 20);
break; break;
} }
} }
@@ -240,13 +240,10 @@ 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);
//后厨退菜单 //后厨退菜单
getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.REFUND_KITCHEN).forEach(machine -> { getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.REFUND_KITCHEN).forEach(machine -> {
// Boolean isPrint = redisService.hasKey(RedisCst.kitchenRefundAll(orderInfo.getId(), machine.getId())); getPrinter(machine.getBrand()).returnKitchenPrint(operator, orderInfo, detailList, machine);
// if (!isPrint) {
getPrinter(machine.getBrand()).returnKitchenPrint(operator, orderInfo, detailList, machine);
// redisService.set(RedisCst.kitchenRefundAll(orderInfo.getId(), machine.getId()), "", 180);
// }
}); });
} }
@@ -265,9 +262,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);
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);
getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.REFUND_ORDER).forEach(machine -> getPrintMachine(orderInfo.getShopId(), PrinterHandler.PrintTypeEnum.REFUND_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 { } else {
@@ -281,7 +280,16 @@ public class PrintConfig implements ApplicationRunner {
boolean partPrint = false; boolean partPrint = false;
if ("1".equals(machine.getClassifyPrint())) { if ("1".equals(machine.getClassifyPrint())) {
partPrint = true; partPrint = true;
List categoryIds = JSONObject.parseObject(StrUtil.emptyToDefault(machine.getCategoryIds(), "[]"), List.class);
//617,616,615,614
List<String> categoryIds = List.of();
if (StrUtil.isNotBlank(machine.getCategoryIds())) {
// 按逗号分割,自动去空字符串
categoryIds = Arrays.stream(machine.getCategoryIds().split(","))
.map(String::trim)
.filter(StrUtil::isNotBlank)
.collect(Collectors.toList());
}
if (CollUtil.isEmpty(categoryIds)) { if (CollUtil.isEmpty(categoryIds)) {
return Collections.emptyList(); return Collections.emptyList();
} }
@@ -348,5 +356,19 @@ public class PrintConfig implements ApplicationRunner {
return list; return list;
} }
private void sendOrderPrintMsg(Long shopId, Long orderId, Integer placeNum, String printType, List<OrderDetail> detailList, String operator) {
FunUtils.safeRunVoid(() -> {
List<OrderDetailPrintDTO> list2 = detailList.stream()
.map(detail -> {
OrderDetailPrintDTO printDTO = new OrderDetailPrintDTO();
// 自动拷贝相同名称的字段
BeanUtils.copyProperties(detail, printDTO);
return printDTO;
}).toList();
rabbitPublisher.sendOrderPrintLocalMsg(shopId, orderId, placeNum, printType, JSONObject.toJSONString(list2), operator);
}, "订单{}消息发送失败,订单信息: {}", printType, orderId);
}
} }

View File

@@ -1,19 +1,24 @@
package com.czg.service.order.service.impl; package com.czg.service.order.service.impl;
import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.date.LocalDateTimeUtil;
import com.czg.config.RabbitPublisher;
import com.czg.excel.ExcelExportUtil; import com.czg.excel.ExcelExportUtil;
import com.czg.exception.CzgException; import com.czg.exception.CzgException;
import com.czg.order.dto.FinanceStsDTO; import com.czg.order.dto.FinanceStsDTO;
import com.czg.order.entity.ShopOrderStatistic; import com.czg.order.entity.ShopOrderStatistic;
import com.czg.order.param.FinanceStsQueryParam; import com.czg.order.param.FinanceStsQueryParam;
import com.czg.order.param.SaleSummaryCountParam;
import com.czg.order.service.FinanceStsService; import com.czg.order.service.FinanceStsService;
import com.czg.order.service.ShopOrderStatisticService; import com.czg.order.service.ShopOrderStatisticService;
import com.czg.print.DayReportPrintDTO;
import com.czg.print.DaySettlePrintDTO;
import jakarta.annotation.Resource; import jakarta.annotation.Resource;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* @author yjjie * @author yjjie
@@ -24,6 +29,8 @@ public class FinanceStsServiceImpl implements FinanceStsService {
@Resource @Resource
private ShopOrderStatisticService orderStatisticService; private ShopOrderStatisticService orderStatisticService;
@Resource
private RabbitPublisher rabbitPublisher;
@Override @Override
public FinanceStsDTO getFinanceSts(FinanceStsQueryParam param) { public FinanceStsDTO getFinanceSts(FinanceStsQueryParam param) {
@@ -95,6 +102,28 @@ public class FinanceStsServiceImpl implements FinanceStsService {
throw new CzgException("平台不支持"); throw new CzgException("平台不支持");
} }
@Override
public void printDayReport(SaleSummaryCountParam param) {
DayReportPrintDTO dayReportPrintDTO = new DayReportPrintDTO();
// 打印经营日报
rabbitPublisher.sendOtherPrintMsg(param.getShopId(), dayReportPrintDTO, "DAY_REPORT");
}
@Override
public void printDaySettle(SaleSummaryCountParam param) {
// 打印日结单
rabbitPublisher.sendOtherPrintMsg(param.getShopId(), buildDaySettlePrint(param), "DAY_ORDER");
}
private Map<String, DayReportPrintDTO> buildDayReportPrint(SaleSummaryCountParam param) {
return null;
}
private Map<String, DaySettlePrintDTO> buildDaySettlePrint(SaleSummaryCountParam param) {
return null;
}
private ShopOrderStatistic getStatisticData(FinanceStsQueryParam param) { private ShopOrderStatistic getStatisticData(FinanceStsQueryParam param) {
LocalDate today = LocalDate.now(); LocalDate today = LocalDate.now();
if (param.getQueryDate().equals(today)) { if (param.getQueryDate().equals(today)) {

View File

@@ -329,12 +329,11 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
.eq(CashierCart::getTableCode, param.getTableCode()) .eq(CashierCart::getTableCode, param.getTableCode())
); );
if ("after-pay".equals(orderInfo.getPayMode())) { if ("after-pay".equals(orderInfo.getPayMode())) {
//
log.info("后付费生成订单{},第{}", orderInfo.getId(), orderInfo.getPlaceNum()); log.info("后付费生成订单{},第{}", orderInfo.getId(), orderInfo.getPlaceNum());
//客看单 //客看单
printConfig.orderHandler(orderInfo.getId(), PrinterHandler.PrintTypeEnum.GUEST_ORDER, orderInfo.getPlaceNum()); printConfig.orderHandler(orderInfo.getId(), PrinterHandler.PrintTypeEnum.GUEST_ORDER, orderInfo.getPlaceNum());
// 消息通知 本地打印机执行 // 消息通知 本地打印机执行
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId(), 0, 0, orderInfo.getPlaceNum(), true, "后付费打印"); rabbitPublisher.sendOrderPrintMsg(orderInfo.getId(), 0, 0, orderInfo.getPlaceNum(), "后付费打印");
} else { } else {
redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15); redisService.set(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId(), "", 60 * 15);
} }
@@ -1296,14 +1295,14 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
} }
if (payType != PayEnums.BACK_SCAN) { if (payType != PayEnums.BACK_SCAN) {
// 事务成功提交后执行消息发送 // 事务成功提交后执行消息发送
rabbitPublisher.sendOrderPrintMsg(orderId, !"after-pay".equals(payMode) ? 1 : 0, 1, 1, isPrint, "事务环境打印"); rabbitPublisher.sendOrderPrintMsg(orderId, !"after-pay".equals(payMode) ? 1 : 0, 1, 1, "事务环境打印");
} }
} }
}); });
} else { } else {
if (payType != PayEnums.BACK_SCAN) { if (payType != PayEnums.BACK_SCAN) {
// 非事务环境下直接发送(兼容无事务场景) // 非事务环境下直接发送(兼容无事务场景)
rabbitPublisher.sendOrderPrintMsg(orderId, !"after-pay".equals(payMode) ? 1 : 0, 1, 1, isPrint, "非事务环境打印"); rabbitPublisher.sendOrderPrintMsg(orderId, !"after-pay".equals(payMode) ? 1 : 0, 1, 1, "非事务环境打印");
} }
// log.info("非事务环境下,直接发送订单{}打印消息", orderId); // log.info("非事务环境下,直接发送订单{}打印消息", orderId);

View File

@@ -114,7 +114,7 @@ public class OrderPayServiceImpl implements OrderPayService {
OrderInfo orderInfo = orderInfoCustomService.checkOrderPay(checkOrderPay); OrderInfo orderInfo = orderInfoCustomService.checkOrderPay(checkOrderPay);
if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) { if (orderInfo.getOrderAmount().compareTo(BigDecimal.ZERO) == 0) {
//发送打票信息 //发送打票信息
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId(), !"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0, 1, 1, orderInfo.getIsPrint() == 1, "0元付款"); rabbitPublisher.sendOrderPrintMsg(orderInfo.getId(), !"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0, 1, 1, "0元付款");
redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId()); redisService.del(RedisCst.classKeyExpired.EXPIRED_ORDER + orderInfo.getId());
throw new PaySuccessException("支付成功"); throw new PaySuccessException("支付成功");
} }
@@ -355,7 +355,7 @@ public class OrderPayServiceImpl implements OrderPayService {
if (mapCzgResult.getCode() == 200) { if (mapCzgResult.getCode() == 200) {
orderInfoCustomService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(), orderInfoCustomService.upOrderInfo(orderInfo, orderInfo.getOrderAmount(),
LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN); LocalDateTime.now(), paymentId, PayEnums.BACK_SCAN);
rabbitPublisher.sendOrderPrintMsg(orderInfo.getId(), !"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0, 1, 1, orderInfo.getIsPrint() == 1, "扫码收款"); rabbitPublisher.sendOrderPrintMsg(orderInfo.getId(), !"after-pay".equals(orderInfo.getPayMode()) ? 1 : 0, 1, 1, "扫码收款");
} else { } else {
upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId, upOrderPayInfo(orderInfo.getId(), PayEnums.BACK_SCAN, paymentId,
payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark()); payParam.getCheckOrderPay() == null ? null : payParam.getCheckOrderPay().getRemark());
@@ -515,14 +515,12 @@ public class OrderPayServiceImpl implements OrderPayService {
orderInfo.setRefundRemark(orderInfo.getRefundRemark() + param.getRefundReason()); orderInfo.setRefundRemark(orderInfo.getRefundRemark() + param.getRefundReason());
orderInfoService.updateById(orderInfo); orderInfoService.updateById(orderInfo);
//退款后续 退款单/退菜单 //退款后续 退款单/退菜单
if (param.isPrint()) { String finalPrintTitle = printTitle;
String finalPrintTitle = printTitle; boolean finalIsPay = isPay;
boolean finalIsPay = isPay; FunUtils.safeRunVoid(() -> printConfig.refundOrderHandler(finalPrintTitle, StrUtil.isNotBlank(param.getOperator()) ? param.getOperator() : ""
FunUtils.safeRunVoid(() -> printConfig.refundOrderHandler(finalPrintTitle, StrUtil.isNotBlank(param.getOperator()) ? param.getOperator() : "" , finalIsPay ? param.getRefundAmount().toPlainString() : "0"
, finalIsPay ? param.getRefundAmount().toPlainString() : "0" , param.getRefundReason(), orderInfo.getRefundType(), orderInfo, param.getRefundDetails()),
, param.getRefundReason(), orderInfo.getRefundType(), orderInfo, param.getRefundDetails()), "订单id:{} 退款,前台打印消息失败", orderInfo.getId());
"订单id:{} 退款,前台打印消息失败", orderInfo.getId());
}
//后厨退菜单 //后厨退菜单
FunUtils.safeRunVoid(() -> printConfig.kitchenRefundAllHandler(StrUtil.isNotBlank(param.getOperator()) ? param.getOperator() : "", orderInfo, param.getRefundDetails()), FunUtils.safeRunVoid(() -> printConfig.kitchenRefundAllHandler(StrUtil.isNotBlank(param.getOperator()) ? param.getOperator() : "", orderInfo, param.getRefundDetails()),
"订单id:{} 退款,后厨退菜单打印消息失败", orderInfo.getId()); "订单id:{} 退款,后厨退菜单打印消息失败", orderInfo.getId());