update 加注释 and 特定站点id走新的分账逻辑

This commit is contained in:
Guoqs
2024-12-26 16:29:00 +08:00
parent 9b1c2df87a
commit d0be55940b
2 changed files with 14 additions and 6 deletions

View File

@@ -78,7 +78,7 @@ public class RabbitConfig {
// 预加载消息数量 -- QOS
containerFactory.setPrefetchCount(1);
// 应答模式(此处设置为手动)
// containerFactory.setAcknowledgeMode(AcknowledgeMode.MANUAL);
// containerFactory.setAcknowledgeMode(AcknowledgeMode.MANUAL); // 2024年12月26日16点27分 取消了手动应答配置
// 消息序列化方式
containerFactory.setMessageConverter(new Jackson2JsonMessageConverter());
// 设置通知调用链 (这里设置的是重试机制的调用链)

View File

@@ -1,5 +1,7 @@
package com.jsowell.mq;
import com.google.common.collect.Lists;
import com.huifu.adapay.core.exception.BaseAdaPayException;
import com.jsowell.common.constant.RabbitConstants;
import com.jsowell.pile.dto.AfterSettleOrderDTO;
import com.jsowell.pile.service.OrderBasicInfoService;
@@ -11,6 +13,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.List;
/**
* 监听RabbitMQ消息 订单
@@ -21,6 +24,8 @@ public class OrderRabbitListener {
@Autowired
private OrderBasicInfoService orderBasicInfoService;
private List<String> stationIdList = Lists.newArrayList();
/**
* 多线程消费请求消息
* @param message
@@ -29,12 +34,15 @@ public class OrderRabbitListener {
public void receiveChargeOrderData(AfterSettleOrderDTO afterSettleOrderDTO, Channel channel, Message message) throws IOException {
log.info("接收到订单结算数据:{}", afterSettleOrderDTO);
// try {
// orderBasicInfoService.realTimeOrderSplit(afterSettleOrderDTO);
// } catch (BaseAdaPayException e) {
// throw new RuntimeException(e);
// }
if (stationIdList.contains(afterSettleOrderDTO.getStationId())) {
try {
orderBasicInfoService.realTimeOrderSplit(afterSettleOrderDTO);
} catch (BaseAdaPayException e) {
throw new RuntimeException(e);
}
}
// 2024年12月26日16点27分 取消了手动应答配置
//由于配置设置了手动应答所以这里要进行一个手动应答。注意如果设置了自动应答这里又进行手动应答会出现double ack那么程序会报错。
// channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);
}