打印样式修改

This commit is contained in:
谭凯凯 2024-10-15 09:59:10 +08:00 committed by Tankaikai
parent 8d54e4971c
commit 7138271279
1 changed files with 18 additions and 10 deletions

View File

@ -21,8 +21,8 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Component
@ -68,7 +68,7 @@ public class PrintConsumer {
}
// 菜品票
getPrintMachine(Integer.valueOf(orderInfo.getShopId()), "cash", "one").forEach(machine -> {
getPrintMachine(Integer.valueOf(orderInfo.getShopId()), "cash", "one", null).forEach(machine -> {
log.info("打印机信息: {}", machine);
machine.setCurrentUserId(currentUserId);
machine.setCurrentUserName(currentUserName);
@ -77,7 +77,7 @@ public class PrintConsumer {
});
// 标签打印
getPrintMachine(Integer.valueOf(orderInfo.getShopId()), "label", "one").forEach(machine -> {
getPrintMachine(Integer.valueOf(orderInfo.getShopId()), "label", "one", null).forEach(machine -> {
log.info("打印机信息: {}", machine);
machine.setCurrentUserId(currentUserId);
machine.setCurrentUserName(currentUserName);
@ -104,7 +104,7 @@ public class PrintConsumer {
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(Integer.valueOf(orderInfo.getShopId()));
Utils.checkValueUnReturn(shopInfo, "店铺信息不存在");
getPrintMachine(shopInfo.getId(), "cash", "normal").forEach(machine -> {
getPrintMachine(shopInfo.getId(), "cash", "normal", null).forEach(machine -> {
List<TbOrderDetail> tbOrderDetails = tbOrderDetailMapper.selectAllByOrderId(orderInfo.getId());
printerHandler.handleRequest(machine, isReturn, orderInfo, tbOrderDetails, null);
// printPlaceTicket(isReturn, machine, orderInfo, shopInfo);
@ -121,7 +121,7 @@ public class PrintConsumer {
log.info("打印消息mq 接收到打印取号小票消息,消息内容: {}", msg);
CallNumPrintDTO printDTO = JSONObject.parseObject(msg, CallNumPrintDTO.class);
getPrintMachine(printDTO.getShopId(), "cash", "callTicket").forEach(machine -> {
getPrintMachine(printDTO.getShopId(), "cash", null, "callTicket").forEach(machine -> {
machine.setCurrentUserId(printDTO.getCurrentUserId());
machine.setCurrentUserName(printDTO.getCurrentUserName());
machine.setCurrentUserNickName(printDTO.getCurrentUserNickName());
@ -134,19 +134,27 @@ public class PrintConsumer {
}
private List<TbPrintMachine> getPrintMachine(Integer shopId, String subType, String printMethod) {
private List<TbPrintMachine> getPrintMachine(Integer shopId, String subType, String printMethod, String printType) {
TbShopInfo shopInfo = tbShopInfoMapper.selectByPrimaryKey(shopId);
if (ObjectUtil.isEmpty(shopInfo)) {
log.error("店铺信息不存在");
return new ArrayList<>();
}
List<TbPrintMachine> list = mpPrintMachineMapper.selectList(new LambdaQueryWrapper<TbPrintMachine>()
LambdaQueryWrapper<TbPrintMachine> wrapper = new LambdaQueryWrapper<TbPrintMachine>()
.eq(TbPrintMachine::getStatus, 1)
.eq(TbPrintMachine::getShopId, shopId)
.eq(TbPrintMachine::getSubType, subType)
.eq(TbPrintMachine::getPrintMethod, printMethod)
.eq(TbPrintMachine::getConnectionType, "network"));
.eq(TbPrintMachine::getConnectionType, "network");
if (StrUtil.isNotEmpty(printMethod)) {
wrapper.in(TbPrintMachine::getPrintMethod, Arrays.asList(printMethod, "all"));
}
if ("callTicket".equals(printType)) {
printType = "queue";
}
if (StrUtil.isNotEmpty(printType)) {
wrapper.like(TbPrintMachine::getPrintType, printType);
}
List<TbPrintMachine> list = mpPrintMachineMapper.selectList(wrapper);
if (list.isEmpty()) {
log.error("店铺未配置打印机店铺id: {}", shopId);
return list;