延迟发送订阅消息
This commit is contained in:
@@ -32,7 +32,7 @@ public class RabbitMsgUtils implements RabbitTemplate.ConfirmCallback {
|
||||
}
|
||||
}
|
||||
|
||||
private <T> void sendMsg(String exchange, String routingKey, T data, String note, boolean isJson, Integer waitTime) {
|
||||
private <T> void sendMsg(String exchange, String routingKey, T data, String note, boolean isJson, Integer waitTime) {
|
||||
ThreadUtil.execAsync(() -> {
|
||||
if (waitTime != null) {
|
||||
ThreadUtil.sleep(waitTime, TimeUnit.SECONDS);
|
||||
@@ -47,7 +47,11 @@ public class RabbitMsgUtils implements RabbitTemplate.ConfirmCallback {
|
||||
sendMsg(RabbitConstants.CART_ORDER_COLLECT_PUT, RabbitConstants.CART_ORDER_COLLECT_ROUTINGKEY_PUT, data, "订单信息收集", true, null);
|
||||
}
|
||||
|
||||
public void printTicket(String orderId){
|
||||
public <T> void sendOrderCollectMsg(T data, int waitTime) {
|
||||
sendMsg(RabbitConstants.CART_ORDER_COLLECT_PUT, RabbitConstants.CART_ORDER_COLLECT_ROUTINGKEY_PUT, data, "订单信息收集", true, waitTime);
|
||||
}
|
||||
|
||||
public void printTicket(String orderId) {
|
||||
sendMsg(RabbitConstants.PRINT_MECHINE_COLLECT_PUT, RabbitConstants.PRINT_MECHINE_COLLECT_ROUTINGKEY_PUT, orderId, "打印票", false, null);
|
||||
}
|
||||
|
||||
@@ -91,7 +95,7 @@ public class RabbitMsgUtils implements RabbitTemplate.ConfirmCallback {
|
||||
printDTO.setCurrentUserId(SecurityUtils.getCurrentUserId());
|
||||
printDTO.setCurrentUserName(SecurityUtils.getCurrentUsername());
|
||||
printDTO.setCurrentUserNickName(SecurityUtils.getCurrentUserNickName());
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
log.error("获取当前用户信息失败", e);
|
||||
}
|
||||
sendMsg(RabbitConstants.EXCHANGE_PRINT, RabbitConstants.ROUTING_KEY_CALL_TABLE, printDTO, "排号小票打印", true, null);
|
||||
@@ -106,12 +110,12 @@ public class RabbitMsgUtils implements RabbitTemplate.ConfirmCallback {
|
||||
|
||||
}
|
||||
|
||||
public void buildCurrentUserInfo(JSONObject jsonObject){
|
||||
public void buildCurrentUserInfo(JSONObject jsonObject) {
|
||||
try {
|
||||
jsonObject.put("currentUserId", SecurityUtils.getCurrentUserId());
|
||||
jsonObject.put("currentUserName", SecurityUtils.getCurrentUsername());
|
||||
jsonObject.put("currentUserNickName", SecurityUtils.getCurrentUserNickName());
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
log.error("获取当前用户信息失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user