打印 调整

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

@@ -70,26 +70,16 @@ public class RabbitConfig {
return BindingBuilder.bind(orderMachinePrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE);
}
//------------------------------------------------------交班打票
//------------------------------------------------------其它打印消息打票
@Bean
public Queue handoverPrintQueue() {
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, true, false, false);
public Queue otherPrintQueue() {
return new Queue(activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_QUEUE, true, false, false);
}
@Bean
public Binding bindingHandoverPrintExchange(Queue handoverPrintQueue, DirectExchange exchange) {
return BindingBuilder.bind(handoverPrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE);
}
//------------------------------------------------------叫号 打票
@Bean
public Queue callTablePrintQueue() {
return new Queue(activeProfile + "-" + RabbitConstants.Queue.CALL_TABLE_QUEUE, true, false, false);
}
@Bean
public Binding bindingCallTablePrintExchange(Queue callTablePrintQueue, DirectExchange exchange) {
return BindingBuilder.bind(callTablePrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.CALL_TABLE_QUEUE);
public Binding bindingOtherPrintExchange(Queue otherPrintQueue, DirectExchange exchange) {
return BindingBuilder.bind(otherPrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_QUEUE);
}
//------------------------------------------------------订单取消

View File

@@ -14,10 +14,11 @@ public interface RabbitConstants {
public static final String ORDER_STOCK_QUEUE = "order.stock.queue";
public static final String ORDER_REFUND_QUEUE = "order.refund.queue";
public static final String ORDER_CANCEL_QUEUE = "order.cancel.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_HANDOVER_PRINT_QUEUE = "order.handover.print.queue";
public static final String CALL_TABLE_QUEUE = "call.table.print.queue";
public static final String OTHER_PRINT_QUEUE = "other.print.queue";
public static final String PRODUCT_INFO_CHANGE_QUEUE = "product.info.change.queue";
public static final String CONS_INFO_CHANGE_QUEUE = "cons.info.change.queue";

View File

@@ -7,6 +7,7 @@ import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
@@ -62,37 +63,19 @@ public class RabbitPublisher {
sendMsg(RabbitConstants.Queue.ORDER_PRINT_QUEUE, orderId);
}
}
/**
* 订单打印消息
* 厨房票打印消息
*
* @param orderId 订单id
* @param printOrder 是否打印结算单
*/
public void sendKitchenOrderPrintMsg(String orderId, boolean printOrder, String source) {
log.info("厨房打印消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
log.info("厨房菜品单打印消息, orderId: {}, printOrder: {}, source: {}", orderId, printOrder, source);
//厨房票
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", orderId).fluentPut("printOrder", printOrder).toString());
}
/**
* 退款订单打印消息
*
* @param orderId 订单id
*/
public void sendOrderReturnPrintMsg(String orderId) {
//厨房票
sendMsg(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE, new JSONObject().fluentPut("orderId", orderId).fluentPut("printOrder", true).toString());
}
/**
* 交班小票打印消息
*
* @param handoverRecordId 交班记录id
*/
public void sendHandoverPrintMsg(String handoverRecordId) {
sendMsg(RabbitConstants.Queue.ORDER_HANDOVER_PRINT_QUEUE, handoverRecordId);
}
/**
* 商品信息变动消息
*
@@ -111,15 +94,6 @@ public class RabbitPublisher {
sendMsg(RabbitConstants.Queue.CONS_INFO_CHANGE_QUEUE, shopId);
}
/**
* 排队叫号小票打印
*
* @param id 叫号队列id
*/
public void printCallNumTicket(Long id) {
sendMsg(RabbitConstants.Queue.CALL_TABLE_QUEUE, id.toString());
}
/**
* 1,2,applySmsTemp 模版审核 shop_id,sms_shop_template.id,applySmsTemp
* 1,2,sendMarkSms 发送营销短信 shop_id,sms_push_event.id,sendMarkSms
@@ -172,4 +146,25 @@ public class RabbitPublisher {
rabbitTemplate.convertAndSend(activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE, activeProfile + "-" + queue, msg);
}
/**
* 其它类型 打印消息
* STOCK 出入库
* DAY_REPORT 经营日报
* PRODUCT_REPORT 商品报表
* RECHARGE 储值单
* STOCK_CHECK 库存盘点
* HANDOVER 交班单
* CALL 排队取号
* @param printType {@link com.czg.service.order.print.PrinterHandler.PrintTypeEnum}
*/
public void sendOtherPrintMsg(Long shopId, Object data, String printType) {
String exchange = activeProfile + "-" + RabbitConstants.Exchange.CASH_EXCHANGE;
String queueName = activeProfile + "-" + RabbitConstants.Queue.OTHER_PRINT_QUEUE;
Map<String, Object> msg = new HashMap<>();
msg.put("shopId", shopId);
msg.put("data", data);
msg.put("printTypeEnum", printType);
rabbitTemplate.convertAndSend(exchange, queueName, msg);
}
}