修改退款逻辑

This commit is contained in:
韩鹏辉
2023-08-30 14:09:59 +08:00
parent fc770b633e
commit ff8e7c5770
3 changed files with 29 additions and 17 deletions

View File

@@ -25,3 +25,5 @@ server:
servlet: servlet:
context-path: /api context-path: /api
port: 7004 port: 7004
environment: test

View File

@@ -81,6 +81,7 @@ import org.junit.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
@@ -230,6 +231,10 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
private UserMakerQuotaService userMakerQuotaService; private UserMakerQuotaService userMakerQuotaService;
@Value("${environment}")
private String environment;
@Override @Override
public Map<String, Object> billCollect(MerchantOrder merchantOrder) { public Map<String, Object> billCollect(MerchantOrder merchantOrder) {
UserApp tokenUserApp = userAppService.queryUserAppByToken(); UserApp tokenUserApp = userAppService.queryUserAppByToken();
@@ -1690,24 +1695,30 @@ public class MerchantOrderServiceImpl extends ServiceImpl<MerchantOrderMapper, M
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
MerchantRefundOrder refundOrder = new MerchantRefundOrder(); MerchantRefundOrder refundOrder = new MerchantRefundOrder();
if (channel.getChannel() == 1) { if(!"test".equals(environment)){
resultMap = sxfPayService.refundPay(order, channel.getMerchantId()); if (channel.getChannel() == 1) {
} else if (channel.getChannel() == 2) { resultMap = sxfPayService.refundPay(order, channel.getMerchantId());
MsgException.throwException("通道已关闭!"); } else if (channel.getChannel() == 2) {
} else if (channel.getChannel() == 3) { MsgException.throwException("通道已关闭!");
resultMap = ryxPayService.refundPay(order, channel.getMerchantId()); } else if (channel.getChannel() == 3) {
} else if (channel.getChannel() == 4) { resultMap = ryxPayService.refundPay(order, channel.getMerchantId());
resultMap = ysPayOldService.refundPay(order, channel.getMerchantId()); } else if (channel.getChannel() == 4) {
}else if(channel.getChannel()==5){ resultMap = ysPayOldService.refundPay(order, channel.getMerchantId());
resultMap = lkLPayServiceImpl.refundPay(order,channel.getMerchantCode()); }else if(channel.getChannel()==5){
resultMap = lkLPayServiceImpl.refundPay(order,channel.getMerchantCode());
}
else {
MsgException.throwException("未知通道!");
}
if (ResultCode.SUCCESS.code() != (Integer) resultMap.get("code")) {
throw new MsgException(resultMap.get("msg") + "");
}
} }
else {
MsgException.throwException("未知通道!");
}
if (ResultCode.SUCCESS.code() != (Integer) resultMap.get("code")) {
throw new MsgException(resultMap.get("msg") + "");
}
MerchantOrder update = new MerchantOrder(); MerchantOrder update = new MerchantOrder();
if(StringUtil.isNotEmpty(order.getMarketAmt()) && order.getMarketAmt().doubleValue() > 0){ if(StringUtil.isNotEmpty(order.getMarketAmt()) && order.getMarketAmt().doubleValue() > 0){
update.setId(order.getId()); update.setId(order.getId());

View File

@@ -43,7 +43,6 @@ public class ApiPayController {
@Autowired @Autowired
private MerchantOrderService merchantOrderService; private MerchantOrderService merchantOrderService;
@Autowired @Autowired
private NotifyMessageService notifyMessageService; private NotifyMessageService notifyMessageService;