Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -28,6 +28,8 @@ public class TbPrintMachine implements Serializable {
|
|||||||
|
|
||||||
private String categoryIds;
|
private String categoryIds;
|
||||||
|
|
||||||
|
private String categoryList;
|
||||||
|
|
||||||
private String contentType;
|
private String contentType;
|
||||||
|
|
||||||
private Long createdAt;
|
private Long createdAt;
|
||||||
@@ -200,6 +202,14 @@ public class TbPrintMachine implements Serializable {
|
|||||||
return receiptSize;
|
return receiptSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getCategoryList() {
|
||||||
|
return categoryList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCategoryList(String categoryList) {
|
||||||
|
this.categoryList = categoryList;
|
||||||
|
}
|
||||||
|
|
||||||
public void setReceiptSize(String receiptSize) {
|
public void setReceiptSize(String receiptSize) {
|
||||||
this.receiptSize = receiptSize;
|
this.receiptSize = receiptSize;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ public class TbPrintMachineLog implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String printQty;
|
private String printQty;
|
||||||
/**
|
/**
|
||||||
* 打印方式 1-普通 2-单个菜
|
* 打印方式 normal-普通出单 one-一菜一品 callTicket-排队取号
|
||||||
*/
|
*/
|
||||||
private String printMethod;
|
private String printMethod;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -41,5 +41,8 @@ public class TbShopTable implements Serializable {
|
|||||||
|
|
||||||
private Integer autoClear;
|
private Integer autoClear;
|
||||||
|
|
||||||
|
private Integer productNum;
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
private BigDecimal realAmount;
|
||||||
|
private Integer useNum;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class ShopPrintLogDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String printQty;
|
private String printQty;
|
||||||
/**
|
/**
|
||||||
* 打印方式 1-普通 2-单个菜
|
* 打印方式 normal-普通出单 one-一菜一品 callTicket-排队取号
|
||||||
*/
|
*/
|
||||||
private String printMethod;
|
private String printMethod;
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class FeiPrinter extends PrinterHandler{
|
public class FeiPrinter extends PrinterHandler {
|
||||||
|
|
||||||
private final MPOrderInfoMapper mPOrderInfoMapper;
|
private final MPOrderInfoMapper mPOrderInfoMapper;
|
||||||
private final MpShopInfoMapper mpShopInfoMapper;
|
private final MpShopInfoMapper mpShopInfoMapper;
|
||||||
@@ -88,7 +88,7 @@ public class FeiPrinter extends PrinterHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void callNumPrint(CallNumPrintDTO printDTO) {
|
protected void callNumPrint(TbPrintMachine machine, CallNumPrintDTO printDTO) {
|
||||||
log.error("未实现打印方法");
|
log.error("未实现打印方法");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import java.util.List;
|
|||||||
|
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class LocalLabelPrinter extends PrinterHandler{
|
public class LocalLabelPrinter extends PrinterHandler {
|
||||||
|
|
||||||
private final MPOrderDetailMapper mPOrderDetailMapper;
|
private final MPOrderDetailMapper mPOrderDetailMapper;
|
||||||
private final TbProductSkuMapper tbProductSkuMapper;
|
private final TbProductSkuMapper tbProductSkuMapper;
|
||||||
@@ -67,7 +67,7 @@ public class LocalLabelPrinter extends PrinterHandler{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void callNumPrint(CallNumPrintDTO printDTO) {
|
protected void callNumPrint(TbPrintMachine machine, CallNumPrintDTO printDTO) {
|
||||||
log.error("未实现打印方法");
|
log.error("未实现打印方法");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,27 +1,22 @@
|
|||||||
package com.chaozhanggui.system.cashierservice.rabbit.print;
|
package com.chaozhanggui.system.cashierservice.rabbit.print;
|
||||||
|
|
||||||
import cn.hutool.core.lang.func.Func0;
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbProductMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbProductMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.dao.TbShopUserMapper;
|
import com.chaozhanggui.system.cashierservice.dao.TbShopUserMapper;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||||
import com.chaozhanggui.system.cashierservice.entity.dto.CallNumPrintDTO;
|
import com.chaozhanggui.system.cashierservice.entity.dto.CallNumPrintDTO;
|
||||||
|
import com.chaozhanggui.system.cashierservice.exception.MsgException;
|
||||||
import com.chaozhanggui.system.cashierservice.model.CategoryInfo;
|
import com.chaozhanggui.system.cashierservice.model.CategoryInfo;
|
||||||
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
||||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
import com.chaozhanggui.system.cashierservice.util.JSONUtil;
|
||||||
import com.chaozhanggui.system.cashierservice.util.PrinterUtils;
|
|
||||||
import com.chaozhanggui.system.cashierservice.util.Utils;
|
import com.chaozhanggui.system.cashierservice.util.Utils;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -43,14 +38,13 @@ public abstract class PrinterHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void print(TbPrintMachine machine, boolean isReturn, TbOrderInfo orderInfo, List<TbOrderDetail> tbOrderDetailList, CallNumPrintDTO printDTO) {
|
protected void print(TbPrintMachine machine, boolean isReturn, TbOrderInfo orderInfo, List<TbOrderDetail> tbOrderDetailList, CallNumPrintDTO printDTO) {
|
||||||
String configStr = machine.getConfig();
|
String printMethod = machine.getPrintMethod();
|
||||||
Utils.checkValueUnReturn(configStr, "打印机配置为空");
|
if (StrUtil.isBlank(printMethod)) {
|
||||||
JSONObject config = JSONObject.parseObject(configStr);
|
throw new MsgException("打印机配置为空");
|
||||||
String model = JSONObject.parseObject(configStr).getString("model");
|
}
|
||||||
|
List<CategoryInfo> categoryInfos = JSONUtil.parseJSONStr2TList(StrUtil.emptyToDefault(machine.getCategoryList(), "[]"), CategoryInfo.class);
|
||||||
|
|
||||||
List<CategoryInfo> categoryInfos = JSONUtil.parseJSONStr2TList(config.getJSONArray("categoryList").toString(), CategoryInfo.class);
|
switch (printMethod) {
|
||||||
|
|
||||||
switch (model) {
|
|
||||||
case "one":
|
case "one":
|
||||||
tbOrderDetailList.forEach(item -> {
|
tbOrderDetailList.forEach(item -> {
|
||||||
log.info("开始打印退单菜品,商品名:{}", item.getProductName());
|
log.info("开始打印退单菜品,商品名:{}", item.getProductName());
|
||||||
@@ -122,10 +116,10 @@ public abstract class PrinterHandler {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "callTicket":
|
case "callTicket":
|
||||||
callNumPrint(printDTO);
|
callNumPrint(machine, printDTO);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
log.warn("未知打印类型: {}", model);
|
log.warn("未知打印类型: {}", printMethod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -149,7 +143,7 @@ public abstract class PrinterHandler {
|
|||||||
|
|
||||||
protected abstract void normalOrderPrint(TbOrderInfo orderInfo, TbPrintMachine machine, String balance, List<OrderDetailPO.Detail> detailList);
|
protected abstract void normalOrderPrint(TbOrderInfo orderInfo, TbPrintMachine machine, String balance, List<OrderDetailPO.Detail> detailList);
|
||||||
|
|
||||||
protected abstract void callNumPrint(CallNumPrintDTO printDTO);
|
protected abstract void callNumPrint(TbPrintMachine machine, CallNumPrintDTO printDTO);
|
||||||
|
|
||||||
// 抽象方法,子类实现判断能否处理请求
|
// 抽象方法,子类实现判断能否处理请求
|
||||||
boolean canHandleRequest(String currentBrand, String connectType) {
|
boolean canHandleRequest(String currentBrand, String connectType) {
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ public class YxyPrinter extends PrinterHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void callNumPrint(CallNumPrintDTO printDTO) {
|
protected void callNumPrint(TbPrintMachine machine, CallNumPrintDTO printDTO) {
|
||||||
TbCallQueue queue = tbCallQueueMapper.selectById(printDTO.getCallQueueId());
|
TbCallQueue queue = tbCallQueueMapper.selectById(printDTO.getCallQueueId());
|
||||||
if (queue == null) {
|
if (queue == null) {
|
||||||
log.warn("叫号记录不存在");
|
log.warn("叫号记录不存在");
|
||||||
@@ -146,9 +146,7 @@ public class YxyPrinter extends PrinterHandler {
|
|||||||
po.setShopNote(StrUtil.format("过号顺延{}桌 {}桌后需重新排号 谢谢理解!", tbCallTable.getPostponeNum(), tbCallTable.getPostponeNum()));
|
po.setShopNote(StrUtil.format("过号顺延{}桌 {}桌后需重新排号 谢谢理解!", tbCallTable.getPostponeNum(), tbCallTable.getPostponeNum()));
|
||||||
String data = PrinterUtils.getCallNumPrintData(po);
|
String data = PrinterUtils.getCallNumPrintData(po);
|
||||||
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一条新的排号记录\"}";
|
String voiceJson = "{\"bizType\":\"2\",\"content\":\"您有一条新的排号记录\"}";
|
||||||
String resp = PrinterUtils.printTickets(voiceJson, 3, 1, "ZF544PG03W00005", data);
|
String resp = PrinterUtils.printTickets(voiceJson, 3, 1, machine.getAddress(), data);
|
||||||
TbPrintMachine machine = new TbPrintMachine();
|
|
||||||
machine.setAddress("ZF544PG03W00005");
|
|
||||||
shopPrintLogService.save(machine, "叫号单", data, resp);
|
shopPrintLogService.save(machine, "叫号单", data, resp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,6 +125,9 @@ public class OrderService {
|
|||||||
@Resource
|
@Resource
|
||||||
private TbOrderPaymentMapper tbOrderPaymentMapper;
|
private TbOrderPaymentMapper tbOrderPaymentMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MPOrderDetailMapper mpOrderDetailMapper;
|
||||||
|
|
||||||
|
|
||||||
public OrderService(WxAccountUtil wxAccountUtil, MPCashierCartMapper mpCashierCartMapper,
|
public OrderService(WxAccountUtil wxAccountUtil, MPCashierCartMapper mpCashierCartMapper,
|
||||||
TbShopOpenIdMapper shopOpenIdMapper, MpShopTableMapper mpShopTableMapper,
|
TbShopOpenIdMapper shopOpenIdMapper, MpShopTableMapper mpShopTableMapper,
|
||||||
@@ -1888,5 +1891,38 @@ public class OrderService {
|
|||||||
}
|
}
|
||||||
tbOrderPaymentMapper.updateByPrimaryKey(payment);
|
tbOrderPaymentMapper.updateByPrimaryKey(payment);
|
||||||
}
|
}
|
||||||
|
mpOrderDetailMapper.update(null, new LambdaUpdateWrapper<TbOrderDetail>()
|
||||||
|
.eq(TbOrderDetail::getOrderId, entity.getId())
|
||||||
|
.set(TbOrderDetail::getStatus, "closed")
|
||||||
|
.set(TbOrderDetail::getUpdateTime, new Date())
|
||||||
|
);
|
||||||
|
mpCashierCartMapper.update(null, new LambdaUpdateWrapper<TbCashierCart>().
|
||||||
|
eq(TbCashierCart::getOrderId, entity.getId())
|
||||||
|
.set(TbCashierCart::getStatus, "final")
|
||||||
|
.set(TbCashierCart::getUpdatedAt, System.currentTimeMillis())
|
||||||
|
);
|
||||||
|
if (StrUtil.isBlank(entity.getTableId())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
|
||||||
|
.eq(TbShopTable::getQrcode, entity.getTableId())
|
||||||
|
.eq(TbShopTable::getAutoClear, 1)
|
||||||
|
.set(TbShopTable::getStatus, "idle")
|
||||||
|
.set(TbShopTable::getProductNum, 0)
|
||||||
|
.set(TbShopTable::getTotalAmount, BigDecimal.ZERO)
|
||||||
|
.set(TbShopTable::getRealAmount, BigDecimal.ZERO)
|
||||||
|
.set(TbShopTable::getUseNum, 0)
|
||||||
|
.set(TbShopTable::getUpdatedAt, System.currentTimeMillis())
|
||||||
|
);
|
||||||
|
mpShopTableMapper.update(null, new LambdaUpdateWrapper<TbShopTable>()
|
||||||
|
.eq(TbShopTable::getQrcode, entity.getTableId())
|
||||||
|
.eq(TbShopTable::getAutoClear, 0)
|
||||||
|
.set(TbShopTable::getStatus, "cleaning")
|
||||||
|
.set(TbShopTable::getProductNum, 0)
|
||||||
|
.set(TbShopTable::getTotalAmount, BigDecimal.ZERO)
|
||||||
|
.set(TbShopTable::getRealAmount, BigDecimal.ZERO)
|
||||||
|
.set(TbShopTable::getUseNum, 0)
|
||||||
|
.set(TbShopTable::getUpdatedAt, System.currentTimeMillis())
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
|
||||||
<mapper namespace="cn.ysk.cashier.mybatis.mapper.TbPrintMachineLogMapper">
|
<mapper namespace="com.chaozhanggui.system.cashierservice.dao.TbPrintMachineLogMapper">
|
||||||
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Reference in New Issue
Block a user