打印 调整

This commit is contained in:
2026-04-15 18:17:41 +08:00
parent 44f896168f
commit 45fbdd514e
33 changed files with 1887 additions and 1155 deletions

View File

@@ -221,7 +221,7 @@ public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable
callQueueService.save(callQueue);
// 打印排号票信息
rabbitPublisher.printCallNumTicket(callQueue.getId());
rabbitPublisher.sendOtherPrintMsg(callQueue.getShopId(), callQueue, "CALL");
return new CallTableNumDTO().setTableName(callTable.getName()).setTableNote(callTable.getNote())
.setCallNum(callQueue.getCallNum()).setQueueId(callQueue.getId());
@@ -341,6 +341,7 @@ public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable
}
return 1;
}
private String getStrByState(Integer state) {
return switch (state) {
case -1 -> "已取消";

View File

@@ -11,7 +11,6 @@ import com.alibaba.fastjson2.JSONWriter;
import com.czg.account.dto.HandoverRecordDTO;
import com.czg.account.entity.HandoverRecord;
import com.czg.account.service.HandoverRecordService;
import com.czg.account.vo.HandoverCategoryListVo;
import com.czg.account.vo.HandoverProductListVo;
import com.czg.account.vo.HandoverTotalVo;
import com.czg.constants.SystemConstants;
@@ -117,20 +116,20 @@ public class HandoverRecordServiceImpl extends ServiceImpl<HandoverRecordMapper,
@Override
@Transactional(rollbackFor = Exception.class)
public Long handover() {
public HandoverRecord handover() {
HandoverTotalVo data = totalHandoverData();
HandoverRecord entity = BeanUtil.copyProperties(data, HandoverRecord.class);
entity.setCategoryData(JSON.toJSONString(data.getCategoryList(), JSONWriter.Feature.WriteMapNullValue));
List<HandoverProductListVo> productData = data.getDetailList();
entity.setProductData(JSON.toJSONString(productData, JSONWriter.Feature.WriteMapNullValue));
super.updateById(entity);
return entity.getId();
return entity;
}
@Override
public void printHandoverReceipt(Long handoverRecordId, Integer isPrint) {
public void printHandoverReceipt(HandoverRecord record, Integer isPrint) {
if (isPrint == SystemConstants.OneZero.ONE) {
orderInfoRpcService.sendHandoverReceiptPrintMsgToMq(handoverRecordId);
orderInfoRpcService.sendHandoverReceiptPrintMsgToMq(record.getShopId(), record);
}
}
}

View File

@@ -3,8 +3,6 @@ package com.czg.service.account.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil;
import com.czg.account.dto.print.PrinterAddDTO;
import com.czg.account.dto.print.PrinterEditDTO;
import com.czg.account.entity.PrintMachine;
import com.czg.account.service.PrintMachineService;
import com.czg.exception.CzgException;
@@ -20,32 +18,36 @@ import org.apache.dubbo.config.annotation.DubboService;
* @since 2025-02-20
*/
@DubboService
public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, PrintMachine> implements PrintMachineService{
public class PrintMachineServiceImpl extends ServiceImpl<PrintMachineMapper, PrintMachine> implements PrintMachineService {
@Override
public boolean add(Long shopId, PrinterAddDTO dto) {
public boolean add(Long shopId, PrintMachine dto) {
//分类打印选择部分打印时必传JsonArray字符串数据 如:[{"id":125,"name":"意式咖啡"},{"id":127,"name":"饮品"}]
if ("1".equals(dto.getClassifyPrint()) || "2".equals(dto.getClassifyPrint())) {
if (StrUtil.isBlank(dto.getCategoryList())) {
if ("1".equals(dto.getClassifyPrint())) {
if (StrUtil.isBlank(dto.getCategoryIds()) || dto.getCategoryIds().length() < 3) {
throw new CzgException("分类打印选择部分打印时,必须勾选需要部分打印的菜品");
}
if (!JSONUtil.isTypeJSONArray(dto.getCategoryList())) {
if (!JSONUtil.isTypeJSONArray(dto.getCategoryIds())) {
throw new CzgException("传递的部分打印菜品数据不合法");
}
if (StrUtil.isBlank(dto.getCategoryIds())) {
throw new CzgException("分类打印选择部分打印时传递的部分打印菜品id数据不能为空");
}
} else {
dto.setCategoryIds(null);
dto.setCategoryList(null);
}
PrintMachine entity = BeanUtil.copyProperties(dto, PrintMachine.class);
entity.setShopId(shopId);
return save(entity);
return save(dto);
}
@Override
public Boolean edit(Long shopId, PrinterEditDTO printerEditDTO) {
public Boolean edit(Long shopId, PrintMachine printerEditDTO) {
if ("1".equals(printerEditDTO.getClassifyPrint())) {
if (StrUtil.isBlank(printerEditDTO.getCategoryIds()) || printerEditDTO.getCategoryIds().length() < 3) {
throw new CzgException("分类打印选择部分打印时,必须勾选需要部分打印的菜品");
}
if (!JSONUtil.isTypeJSONArray(printerEditDTO.getCategoryIds())) {
throw new CzgException("传递的部分打印菜品数据不合法");
}
} else {
printerEditDTO.setCategoryIds(null);
}
PrintMachine printMachine = getOne(new QueryWrapper().eq(PrintMachine::getShopId, shopId).eq(PrintMachine::getId, printerEditDTO.getId()));
if (printMachine == null) {
throw new CzgException("打印机不存在");