打印样式修改
This commit is contained in:
parent
8d54e4971c
commit
7138271279
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue