Merge remote-tracking branch 'origin/master'

This commit is contained in:
Tankaikai 2025-02-26 17:49:49 +08:00
commit c82895d1e3
4 changed files with 23 additions and 2 deletions

View File

@ -1,5 +1,7 @@
package com.czg.controller.admin; package com.czg.controller.admin;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@ -11,4 +13,7 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping @RequestMapping
public class ShopStorageGoodController { public class ShopStorageGoodController {
// @SaAdminCheckPermission("")
// public CzgResult<>
} }

View File

@ -40,11 +40,11 @@ public class PrintMqListener {
@Resource @Resource
private PrinterHandler printerHandler; private PrinterHandler printerHandler;
@RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.ORDER_PRINT_QUEUE}) @RabbitListener(queues = {"${spring.profiles.active}-" + RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE})
public void orderPrint(String orderId) { public void orderPrint(String orderId) {
long startTime = DateUtil.date().getTime(); long startTime = DateUtil.date().getTime();
log.info("接收到订单打印消息:{}", orderId); log.info("接收到订单打印消息:{}", orderId);
MqLog mqLog = new MqLog().setQueue(RabbitConstants.Queue.ORDER_PRINT_QUEUE).setMsg(orderId).setType("orderPrint").setPlat("java.account").setCreateTime(DateUtil.date().toLocalDateTime()); MqLog mqLog = new MqLog().setQueue(RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE).setMsg(orderId).setType("orderPrint").setPlat("java.account").setCreateTime(DateUtil.date().toLocalDateTime());
try { try {
OrderInfo orderInfo = orderInfoService.getById(orderId); OrderInfo orderInfo = orderInfoService.getById(orderId);
if (orderInfo == null) { if (orderInfo == null) {

View File

@ -28,6 +28,15 @@ public class RabbitConfig {
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_PRINT_QUEUE, true, false, false, args); return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_PRINT_QUEUE, true, false, false, args);
} }
@Bean
public Queue orderMachinePrintQueue() {
// 创建一个用于存储队列参数的 Map
// Map<String, Object> args = new HashMap<>();
// 设置消息过期时间为 180000 毫秒 180
// args.put("x-message-ttl", 180000);
return new Queue(activeProfile + "-" + RabbitConstants.Queue.ORDER_MACHINE_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);
@ -50,6 +59,12 @@ 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 bindingOrderMachinePrintExchange(Queue orderMachinePrintQueue, DirectExchange exchange) {
return BindingBuilder.bind(orderMachinePrintQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_MACHINE_PRINT_QUEUE);
}
@Bean @Bean
public Binding bindingOrderStockExchange(Queue orderStockQueue, DirectExchange exchange) { public Binding bindingOrderStockExchange(Queue orderStockQueue, DirectExchange exchange) {
return BindingBuilder.bind(orderStockQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_STOCK_QUEUE); return BindingBuilder.bind(orderStockQueue).to(exchange).with(activeProfile + "-" + RabbitConstants.Queue.ORDER_STOCK_QUEUE);

View File

@ -13,5 +13,6 @@ public interface RabbitConstants {
public static final String ORDER_STOCK_QUEUE = "order.stock.queue"; public static final String ORDER_STOCK_QUEUE = "order.stock.queue";
public static final String ORDER_CANCEL_QUEUE = "order.cancel.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_PRINT_QUEUE = "order.print.queue";
public static final String ORDER_MACHINE_PRINT_QUEUE = "order.machine.print.queue";
} }
} }