提交 b82a7e71 authored 作者: huyufan's avatar huyufan

取消支付

上级 f49d4154
......@@ -67,7 +67,6 @@ public class RabbitBeanConfig {
/**
* 处理延迟消息货单挂单
* @return
*/
@Bean
public Queue orderGoodsOnDeadQueue() {
......@@ -93,7 +92,6 @@ public class RabbitBeanConfig {
/**
* 订单取消队列
* @return
*/
@Bean
public Queue orderCancelQueue() {
......@@ -118,7 +116,6 @@ public class RabbitBeanConfig {
/**
* 运单同步网络货运队列
* @return
*/
@Bean
public Queue orderChildSyncTransportQueue() {
......@@ -143,7 +140,6 @@ public class RabbitBeanConfig {
/**
* 处理延迟消息orderGoodsTruckBind
* @return
*/
@Bean
public Queue orderGoodsTruckBindQueue() {
......@@ -166,4 +162,28 @@ public class RabbitBeanConfig {
public Binding orderGoodsTruckBindBindingDelayedExchange(@Qualifier("orderGoodsTruckBindQueue")Queue queue,@Qualifier("orderGoodsTruckBindExchange")CustomExchange customExchange) {
return BindingBuilder.bind(queue).to(customExchange).with(RabbitKeyConstants.ORDER_TRUCK_BIND_LAZY_ROUTE_KEY).noargs();
}
/**
* 货主借款支付处理
*/
@Bean
public Queue ownerLoanPayQueue() {
return new Queue(RabbitKeyConstants.OWNER_LOAN_PAY_QUEUE, true, false, false);
}
/**
* 货主借款支付处理
**/
@Bean
public DirectExchange ownerLoanExchange() {
return new DirectExchange(RabbitKeyConstants.OWNER_LOAN_EXCHANGE);
}
/**
* 货主借款支付处理
*/
@Bean
public Binding ownerLoanBind() {
return BindingBuilder.bind(ownerLoanPayQueue()).to(ownerLoanExchange()).with(RabbitKeyConstants.OWNER_LOAN_PAY_ROUTE_KEY);
}
}
......@@ -83,4 +83,10 @@ public class RabbitKeyConstants {
public static final String ORDER_TRUCK_BIND_LAZY_QUEUE ="clx-order.truck.bind.lazy.queue";
public static final String ORDER_TRUCK_BIND_LAZY_ROUTE_KEY ="clx-order.truck.bind.lazy.route.key";
public static final String OWNER_LOAN_EXCHANGE ="clx-performance.loan.exchange";
public static final String OWNER_LOAN_PAY_ROUTE_KEY ="clx-performance.loan.pay.route.key";
public static final String OWNER_LOAN_PAY_QUEUE ="clx-performance.loan.pay.queue";
}
......@@ -22,7 +22,7 @@ public class OwnerLoanPayNotifyListener {
private final OwnerLoanRecordService ownerLoanRecordService;
@RabbitListener(queues = RabbitKeyConstants.ORDER_CANCEL_QUEUE)
@RabbitListener(queues = RabbitKeyConstants.OWNER_LOAN_PAY_QUEUE)
public void onMessage(String message) {
log.info("处理货主借款支付监听器执行,数据为{}", message);
OwnerLoanPayNotifyMqParam param = JSONUtil.toBean(message, OwnerLoanPayNotifyMqParam.class);
......
package com.clx.performance.service.impl.thirdparty.nbbank;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSONObject;
import com.clx.performance.OwnerLoanPayNotifyMqParam;
import com.clx.performance.component.IdGenerateSnowFlake;
import com.clx.performance.constant.RabbitKeyConstants;
import com.clx.performance.dao.loan.BankTradeDao;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.loan.BankTradeEnum;
......@@ -17,6 +20,9 @@ import com.clx.performance.vo.pc.nbbank.NbBankOrderResultVO;
import com.msl.common.exception.ServiceSystemException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -39,6 +45,9 @@ public class NbBankServiceImpl implements NbBankService {
@Autowired
private IdGenerateSnowFlake idGenerateSnowFlake;
@Autowired
private RabbitTemplate rabbitTemplate;
/**
* 转账支付
......@@ -228,22 +237,17 @@ public class NbBankServiceImpl implements NbBankService {
// 更新状态
bankTradeDao.updateStatus(bankTrade);
//TODO 增加如果后置逻辑失败业务处理
// 货主借款支付回调
if (Objects.equals(bankTrade.getOrderType(), BankTradeEnum.OrderType.OWNER_LOAN_RECORD.getCode())){
if (Objects.equals(transStatus, NbBankStatusEnum.Status.SUCCESS.getCode())) {
SpringContextUtils.getBeanByClass(OwnerLoanRecordService.class).paySuccess(merSeqNo);
}
else if (Objects.equals(transStatus, NbBankStatusEnum.Status.FAIL.getCode())) {
SpringContextUtils.getBeanByClass(OwnerLoanRecordService.class).payFail(merSeqNo);
}
else {
// TODO 其它情况
}
}
else {
OwnerLoanPayNotifyMqParam param = new OwnerLoanPayNotifyMqParam();
param.setLoanNo(merSeqNo);
param.setPayStatus(transStatus);
Message message = MessageBuilder.withBody(JSONUtil.parse(param).toString().getBytes()).build();
//执行解绑自有车辆处理逻辑,将绑定记录正常改为取消
rabbitTemplate.send(
RabbitKeyConstants.OWNER_LOAN_EXCHANGE, RabbitKeyConstants.OWNER_LOAN_PAY_ROUTE_KEY, message
);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论