Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
commit
5557b2b360
|
|
@ -2,6 +2,7 @@ package com.chaozhanggui.system.cashierservice.entity;
|
|||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import lombok.Data;
|
||||
import org.springframework.data.annotation.Transient;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -59,6 +60,9 @@ public class TbOrderDetail implements Serializable {
|
|||
private BigDecimal canReturnAmount;
|
||||
private BigDecimal returnAmount;
|
||||
private Integer isPrint;
|
||||
@Transient
|
||||
@TableField(exist = false)
|
||||
private Integer isGift;
|
||||
|
||||
private BigDecimal discountSaleAmount;
|
||||
private String discountSaleNote;
|
||||
|
|
|
|||
|
|
@ -11,11 +11,9 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|||
import com.chaozhanggui.system.cashierservice.dao.TbOrderDetailMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbOrderInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopInfoMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderDetail;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbOrderInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbPrintMachine;
|
||||
import com.chaozhanggui.system.cashierservice.entity.TbShopInfo;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.CallNumPrintDTO;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MPCashierCartMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MPOrderDetailMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MpPrintMachineMapper;
|
||||
import com.chaozhanggui.system.cashierservice.rabbit.print.PrinterHandler;
|
||||
|
|
@ -37,15 +35,17 @@ public class PrintConsumer {
|
|||
private final TbShopInfoMapper tbShopInfoMapper;
|
||||
private final TbOrderDetailMapper tbOrderDetailMapper;
|
||||
private final MPOrderDetailMapper mpOrderDetailMapper;
|
||||
private final MPCashierCartMapper mpCashierCartMapper;
|
||||
private final MpPrintMachineMapper mpPrintMachineMapper;
|
||||
|
||||
private final PrinterHandler printerHandler;
|
||||
|
||||
public PrintConsumer(TbOrderInfoMapper tbOrderInfoMapper, TbShopInfoMapper tbShopInfoMapper, TbOrderDetailMapper tbOrderDetailMapper, MPOrderDetailMapper mpOrderDetailMapper, MpPrintMachineMapper mpPrintMachineMapper, PrinterHandler printerHandler) {
|
||||
public PrintConsumer(TbOrderInfoMapper tbOrderInfoMapper, TbShopInfoMapper tbShopInfoMapper, TbOrderDetailMapper tbOrderDetailMapper, MPOrderDetailMapper mpOrderDetailMapper, MPCashierCartMapper mpCashierCartMapper, MpPrintMachineMapper mpPrintMachineMapper, PrinterHandler printerHandler) {
|
||||
this.tbOrderInfoMapper = tbOrderInfoMapper;
|
||||
this.tbShopInfoMapper = tbShopInfoMapper;
|
||||
this.tbOrderDetailMapper = tbOrderDetailMapper;
|
||||
this.mpOrderDetailMapper = mpOrderDetailMapper;
|
||||
this.mpCashierCartMapper = mpCashierCartMapper;
|
||||
this.mpPrintMachineMapper = mpPrintMachineMapper;
|
||||
this.printerHandler = printerHandler;
|
||||
}
|
||||
|
|
@ -84,6 +84,12 @@ public class PrintConsumer {
|
|||
for (TbOrderDetail detail : orderDetails) {
|
||||
detail.setIsPrint(isPrintMap.get(detail.getId()));
|
||||
}
|
||||
List<TbCashierCart> cartList = mpCashierCartMapper.selectList(Wrappers.<TbCashierCart>lambdaQuery().eq(TbCashierCart::getOrderId, orderInfo.getId()));
|
||||
Map<Integer, String> map = cartList.stream().collect(Collectors.toMap(TbCashierCart::getId, TbCashierCart::getIsGift));
|
||||
orderDetails.parallelStream().forEach(item->{
|
||||
int isGift = "true".equals(map.get(item.getCartId())) ? 1 : 0;
|
||||
item.setIsGift(isGift);
|
||||
});
|
||||
if (orderDetails.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -127,6 +133,12 @@ public class PrintConsumer {
|
|||
|
||||
getPrintMachine(shopInfo.getId(), "cash", "normal", null).forEach(machine -> {
|
||||
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(orderInfo.getId());
|
||||
List<TbCashierCart> cartList = mpCashierCartMapper.selectList(Wrappers.<TbCashierCart>lambdaQuery().eq(TbCashierCart::getOrderId, orderInfo.getId()));
|
||||
Map<Integer, String> map = cartList.stream().collect(Collectors.toMap(TbCashierCart::getId, TbCashierCart::getIsGift));
|
||||
tbOrderDetails.parallelStream().forEach(item->{
|
||||
int isGift = "true".equals(map.get(item.getCartId())) ? 1 : 0;
|
||||
item.setIsGift(isGift);
|
||||
});
|
||||
printerHandler.handleRequest(machine, isReturn, orderInfo, tbOrderDetails, null);
|
||||
// printPlaceTicket(isReturn, machine, orderInfo, shopInfo);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -243,6 +243,9 @@ public class PrintMechineConsumer {
|
|||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
if (it.getIsGift() == 1) {
|
||||
unitPrice = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
|
@ -324,6 +327,10 @@ public class PrintMechineConsumer {
|
|||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
}
|
||||
Integer isGift = ObjectUtil.defaultIfNull(it.getIsGift(), 0);
|
||||
if (isGift == 1) {
|
||||
it.setProductName("【赠】" + it.getProductName());
|
||||
}
|
||||
log.info("获取当前类别是否未打印类别:{}", count);
|
||||
if (count > 0) {
|
||||
// 统计已打数量
|
||||
|
|
@ -545,6 +552,10 @@ public class PrintMechineConsumer {
|
|||
c.getId().toString().equals(categoryId)
|
||||
).count();
|
||||
}
|
||||
Integer isGift = ObjectUtil.defaultIfNull(it.getIsGift(), 0);
|
||||
if (isGift == 1) {
|
||||
it.setProductName("【赠】" + it.getProductName());
|
||||
}
|
||||
String classifyPrint = tbPrintMachineWithBLOBs.getClassifyPrint();
|
||||
// 如果是部分打印,并且所属分类不在设置的列表中,则不打印
|
||||
if ("1".equals(classifyPrint) && count == 0) {
|
||||
|
|
@ -603,6 +614,9 @@ public class PrintMechineConsumer {
|
|||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
if (it.getIsGift() == 1) {
|
||||
unitPrice = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
|
@ -671,6 +685,9 @@ public class PrintMechineConsumer {
|
|||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
if ("true".equals(it.getIsGift())) {
|
||||
unitPrice = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNumber(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public abstract class PrinterHandler {
|
|||
log.info("开始打印退单菜品,商品名:{}", item.getProductName());
|
||||
Integer isWaitCall = ObjectUtil.defaultIfNull(item.getIsWaitCall(), 0);
|
||||
if (isWaitCall == 1) {
|
||||
if (!item.getProductName().startsWith("【等叫】")) {
|
||||
if (!item.getProductName().contains("【等叫】")) {
|
||||
item.setProductName("【等叫】" + item.getProductName());
|
||||
}
|
||||
}
|
||||
|
|
@ -97,10 +97,14 @@ public abstract class PrinterHandler {
|
|||
if (isTemporary == 1) {
|
||||
item.setProductId(0);
|
||||
item.setProductSkuId(0);
|
||||
if (!item.getProductName().startsWith("【临】")) {
|
||||
if (!item.getProductName().contains("【临】")) {
|
||||
item.setProductName("【临】" + item.getProductName());
|
||||
}
|
||||
}
|
||||
Integer isGift = ObjectUtil.defaultIfNull(item.getIsGift(), 0);
|
||||
if (isGift == 1 && !item.getProductName().contains("【赠】")) {
|
||||
item.setProductName("【赠】" + item.getProductName());
|
||||
}
|
||||
// 台位费不打印
|
||||
if (item.getProductId().equals(-999)) {
|
||||
log.info("台位费商品,不打印");
|
||||
|
|
@ -170,10 +174,17 @@ public abstract class PrinterHandler {
|
|||
if (isTemporary == 1) {
|
||||
it.setProductName("【临】" + it.getProductName());
|
||||
}
|
||||
Integer isGift = ObjectUtil.defaultIfNull(it.getIsGift(), 0);
|
||||
if (isGift == 1) {
|
||||
it.setProductName("【赠】" + it.getProductName());
|
||||
}
|
||||
BigDecimal unitPrice = it.getPrice();
|
||||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
if (it.getIsGift() == 1) {
|
||||
unitPrice = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
|
@ -227,4 +238,17 @@ public abstract class PrinterHandler {
|
|||
Utils.checkValueUnReturn(printerBrand, "打印机品牌未赋值");
|
||||
return printerBrand.equals(currentBrand) && "network".equals(connectType);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String a = "1【赠1】1【临1】1【等叫1】1";
|
||||
if (!a.contains("【赠】")) {
|
||||
System.out.println("不包含");
|
||||
}
|
||||
if (a.indexOf("【临】") != -1) {
|
||||
System.out.println("包含");
|
||||
}
|
||||
if (a.indexOf("【等叫】") != -1) {
|
||||
System.out.println("包含");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -281,6 +281,9 @@ public class CloudPrinterService {
|
|||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
if (it.getIsGift() == 1) {
|
||||
unitPrice = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
|
@ -355,6 +358,9 @@ public class CloudPrinterService {
|
|||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
if ("true".equals(it.getIsGift())) {
|
||||
unitPrice = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNumber(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
|
@ -428,6 +434,9 @@ public class CloudPrinterService {
|
|||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
if (it.getIsGift() == 1) {
|
||||
unitPrice = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNum(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getProductName(), it.getNum().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
|
@ -484,6 +493,9 @@ public class CloudPrinterService {
|
|||
if (it.getIsMember() == 1) {
|
||||
unitPrice = it.getMemberPrice();
|
||||
}
|
||||
if ("true".equals(it.getIsGift())) {
|
||||
unitPrice = BigDecimal.ZERO;
|
||||
}
|
||||
BigDecimal subTotal = NumberUtil.mul(it.getNumber(), unitPrice.subtract(NumberUtil.null2Zero(it.getDiscountSaleAmount())));
|
||||
OrderDetailPO.Detail detail = new OrderDetailPO.Detail(it.getName(), it.getNumber().toString(), subTotal.toPlainString(), remark, it.getProGroupInfo());
|
||||
detailList.add(detail);
|
||||
|
|
|
|||
Loading…
Reference in New Issue