店铺管理-店铺配置:打印机设置相关接口
This commit is contained in:
@@ -1,12 +1,17 @@
|
||||
package com.chaozhanggui.system.cashierservice.rabbit.print;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbProductMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbProductSkuMapper;
|
||||
import com.chaozhanggui.system.cashierservice.dao.TbShopUserMapper;
|
||||
import com.chaozhanggui.system.cashierservice.entity.*;
|
||||
import com.chaozhanggui.system.cashierservice.entity.dto.CallNumPrintDTO;
|
||||
import com.chaozhanggui.system.cashierservice.entity.po.CallNumPrintPO;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.TbCallQueueMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mapper.TbCallTableMapper;
|
||||
import com.chaozhanggui.system.cashierservice.model.OrderDetailPO;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MPOrderDetailMapper;
|
||||
import com.chaozhanggui.system.cashierservice.mybatis.MPOrderInfoMapper;
|
||||
@@ -15,6 +20,7 @@ import com.chaozhanggui.system.cashierservice.service.ShopPrintLogService;
|
||||
import com.chaozhanggui.system.cashierservice.util.DateUtils;
|
||||
import com.chaozhanggui.system.cashierservice.util.FeieyunPrintUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -25,6 +31,14 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class FeiPrinter extends PrinterHandler {
|
||||
|
||||
@Resource
|
||||
private TbCallQueueMapper tbCallQueueMapper;
|
||||
@Resource
|
||||
private TbCallTableMapper tbCallTableMapper;
|
||||
|
||||
@Value("${wx.mini.page.call}")
|
||||
private String callPageUrl;
|
||||
|
||||
private final MPOrderInfoMapper mPOrderInfoMapper;
|
||||
private final MpShopInfoMapper mpShopInfoMapper;
|
||||
private final MPOrderDetailMapper mPOrderDetailMapper;
|
||||
@@ -93,6 +107,30 @@ public class FeiPrinter extends PrinterHandler {
|
||||
@Override
|
||||
protected void callNumPrint(TbPrintMachine machine, CallNumPrintDTO printDTO) {
|
||||
log.error("未实现打印方法");
|
||||
TbCallQueue queue = tbCallQueueMapper.selectById(printDTO.getCallQueueId());
|
||||
if (queue == null) {
|
||||
log.warn("叫号记录不存在");
|
||||
return;
|
||||
}
|
||||
|
||||
TbCallTable tbCallTable = tbCallTableMapper.selectById(queue.getCallTableId());
|
||||
TbShopInfo shopInfo = mpShopInfoMapper.selectById(queue.getShopId());
|
||||
CallNumPrintPO po = new CallNumPrintPO();
|
||||
po.setCallNum(queue.getCallNum());
|
||||
po.setShopName(shopInfo.getShopName());
|
||||
po.setTableName(tbCallTable.getName());
|
||||
po.setTableNote(tbCallTable.getNote());
|
||||
po.setPreNum(tbCallQueueMapper.selectCount(new LambdaQueryWrapper<TbCallQueue>()
|
||||
.eq(TbCallQueue::getShopId, queue.getShopId())
|
||||
.eq(TbCallQueue::getCallTableId, queue.getCallTableId())
|
||||
.lt(TbCallQueue::getId, queue.getId())
|
||||
.in(TbCallQueue::getState, 0, 1)).toString());
|
||||
po.setCallNum(queue.getCallNum());
|
||||
po.setCodeUrl(StrUtil.format(callPageUrl, queue.getShopId(), queue.getId()));
|
||||
po.setTakeTime(queue.getCreateTime());
|
||||
po.setShopNote(StrUtil.format("过号顺延{}桌 {}桌后需重新排号 谢谢理解!", tbCallTable.getPostponeNum(), tbCallTable.getPostponeNum()));
|
||||
String data = FeieyunPrintUtil.getCallNumPrintData(po);
|
||||
String resp = FeieyunPrintUtil.print("",machine.getAddress());
|
||||
shopPrintLogService.save(machine, "叫号单", data, resp);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user