排队叫号打印
This commit is contained in:
@@ -80,4 +80,12 @@ public class PrintMqListener {
|
|||||||
public void handoverPrint(String id) {
|
public void handoverPrint(String id) {
|
||||||
invokeFun("handoverPrint", "java.order", id, (data) -> printerHandler.handler(data, PrinterHandler.PrintTypeEnum.HANDOVER));
|
invokeFun("handoverPrint", "java.order", id, (data) -> printerHandler.handler(data, PrinterHandler.PrintTypeEnum.HANDOVER));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交班打印
|
||||||
|
*/
|
||||||
|
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.CALL_TABLE_PRINT_QUEUE})
|
||||||
|
public void callTablePrint(String id) {
|
||||||
|
invokeFun("handoverPrint", "java.order", id, (data) -> printerHandler.handler(data, PrinterHandler.PrintTypeEnum.CALL));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,11 @@ public class RabbitConfig {
|
|||||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, true, false, false);
|
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, true, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Queue callTablePrintQueue() {
|
||||||
|
return new Queue(activeProfile + "-" + RabbitConstants.Queue.CALL_TABLE_PRINT_QUEUE, true, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Queue orderCancelQueue() {
|
public Queue orderCancelQueue() {
|
||||||
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_CANCEL_QUEUE, true);
|
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_CANCEL_QUEUE, true);
|
||||||
@@ -77,6 +82,11 @@ public class RabbitConfig {
|
|||||||
return BindingBuilder.bind(orderPrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_PRINT_QUEUE);
|
return BindingBuilder.bind(orderPrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_PRINT_QUEUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Binding bindingCallTablePrintExchange(Queue callTablePrintQueue, DirectExchange exchange) {
|
||||||
|
return BindingBuilder.bind(callTablePrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.CALL_TABLE_PRINT_QUEUE);
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public Binding bindingHandoverPrintExchange(Queue handoverPrintQueue, DirectExchange exchange) {
|
public Binding bindingHandoverPrintExchange(Queue handoverPrintQueue, DirectExchange exchange) {
|
||||||
return BindingBuilder.bind(handoverPrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE);
|
return BindingBuilder.bind(handoverPrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE);
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public interface RabbitConstants {
|
|||||||
public static final String ORDER_PRINT_QUEUE = "order.print.queue";
|
public static final String ORDER_PRINT_QUEUE = "order.print.queue";
|
||||||
public static final String ORDER_MACHINE_PRINT_QUEUE = "order.machine.print.queue";
|
public static final String ORDER_MACHINE_PRINT_QUEUE = "order.machine.print.queue";
|
||||||
public static final String ORDER_HANDOVER_PRINT_QUEUE = "order.handover.print.queue";
|
public static final String ORDER_HANDOVER_PRINT_QUEUE = "order.handover.print.queue";
|
||||||
|
public static final String CALL_TABLE_PRINT_QUEUE = "call.table.print.queue";
|
||||||
public static final String PRODUCT_INFO_CHANGE_QUEUE = "product.info.change.queue";
|
public static final String PRODUCT_INFO_CHANGE_QUEUE = "product.info.change.queue";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,6 +85,13 @@ public class RabbitPublisher {
|
|||||||
sendMsg(RabbitConstants.Queue.PRODUCT_INFO_CHANGE_QUEUE, shopId);
|
sendMsg(RabbitConstants.Queue.PRODUCT_INFO_CHANGE_QUEUE, shopId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排队叫号小票打印
|
||||||
|
* @param id 叫号队列id
|
||||||
|
*/
|
||||||
|
public void printCallNumTicket(Long id) {
|
||||||
|
sendMsg(RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, id.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void sendMsg(String queue, String msg) {
|
private void sendMsg(String queue, String msg) {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import cn.hutool.extra.qrcode.QrConfig;
|
|||||||
import com.czg.account.dto.calltable.*;
|
import com.czg.account.dto.calltable.*;
|
||||||
import com.czg.account.entity.*;
|
import com.czg.account.entity.*;
|
||||||
import com.czg.account.service.*;
|
import com.czg.account.service.*;
|
||||||
|
import com.czg.config.RabbitPublisher;
|
||||||
import com.czg.config.RedisCst;
|
import com.czg.config.RedisCst;
|
||||||
import com.czg.exception.ApiNotPrintException;
|
import com.czg.exception.ApiNotPrintException;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
@@ -59,6 +60,8 @@ public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable
|
|||||||
private CallConfigService callConfigService;
|
private CallConfigService callConfigService;
|
||||||
@Resource
|
@Resource
|
||||||
private CallQueueMapper callQueueMapper;
|
private CallQueueMapper callQueueMapper;
|
||||||
|
@Resource
|
||||||
|
private RabbitPublisher rabbitPublisher;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CallTablePage get(Long shopId, Long callTableId, Integer state) {
|
public CallTablePage get(Long shopId, Long callTableId, Integer state) {
|
||||||
@@ -215,8 +218,8 @@ public class CallTableServiceImpl extends ServiceImpl<CallTableMapper, CallTable
|
|||||||
|
|
||||||
callQueueService.save(callQueue);
|
callQueueService.save(callQueue);
|
||||||
|
|
||||||
// todo 打印排号票信息
|
// 打印排号票信息
|
||||||
// rabbitMsgUtils.printCallNumTicket(callQueue.getId(), callQueue.getShopId());
|
rabbitPublisher.printCallNumTicket(callQueue.getId());
|
||||||
|
|
||||||
return new CallTableNumDTO().setTableName(callTable.getName()).setTableNote(callTable.getNote())
|
return new CallTableNumDTO().setTableName(callTable.getName()).setTableNote(callTable.getNote())
|
||||||
.setCallNum(callQueue.getCallNum());
|
.setCallNum(callQueue.getCallNum());
|
||||||
|
|||||||
@@ -232,6 +232,15 @@ public abstract class PrinterHandler {
|
|||||||
printMethod = "all";
|
printMethod = "all";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PrintTypeEnum.CALL:
|
||||||
|
CallQueue queue = callQueueService.getById(data);
|
||||||
|
if (queue == null) {
|
||||||
|
throw new RuntimeException("叫号信息不存在: " + data);
|
||||||
|
}
|
||||||
|
shopId = queue.getShopId();
|
||||||
|
obj = queue;
|
||||||
|
printType = "queue";
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
throw new RuntimeException("未知打印类型");
|
throw new RuntimeException("未知打印类型");
|
||||||
|
|
||||||
@@ -346,8 +355,8 @@ public abstract class PrinterHandler {
|
|||||||
break;
|
break;
|
||||||
case PrintTypeEnum.CALL:
|
case PrintTypeEnum.CALL:
|
||||||
log.info("准备开始打印叫号单");
|
log.info("准备开始打印叫号单");
|
||||||
if (data instanceof Long id) {
|
if (data instanceof CallQueue queue) {
|
||||||
onlyCallNumPrint(machine, id);
|
onlyCallNumPrint(machine, queue);
|
||||||
}else {
|
}else {
|
||||||
throw new RuntimeException("传递数据类型有误");
|
throw new RuntimeException("传递数据类型有误");
|
||||||
}
|
}
|
||||||
@@ -506,12 +515,7 @@ public abstract class PrinterHandler {
|
|||||||
/**
|
/**
|
||||||
* 打印排队小票
|
* 打印排队小票
|
||||||
*/
|
*/
|
||||||
private void onlyCallNumPrint(PrintMachine machine, Long callQueueId) {
|
private void onlyCallNumPrint(PrintMachine machine, CallQueue queue) {
|
||||||
if (callQueueId == null) {
|
|
||||||
log.warn("打印叫号小票失败,id为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
CallQueue queue = callQueueService.getById(callQueueId);
|
|
||||||
if (queue == null) {
|
if (queue == null) {
|
||||||
log.warn("叫号记录不存在");
|
log.warn("叫号记录不存在");
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user