mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
退款逻辑整理
This commit is contained in:
@@ -349,9 +349,9 @@ public class OrderService {
|
||||
// 退款有两种情况 1-订单结算退款 2-用户余额退款
|
||||
String refundType = dto.getRefundType();
|
||||
if (StringUtils.equals(refundType, "1")) {
|
||||
orderBasicInfoService.refundForOrderWithAdapay(dto);
|
||||
orderBasicInfoService.refundOrderWithAdapay(dto);
|
||||
} else if (StringUtils.equals(refundType, "2")) {
|
||||
orderBasicInfoService.refundForBalanceWithAdapay(dto);
|
||||
orderBasicInfoService.refundBalanceWithAdapay(dto);
|
||||
} else {
|
||||
log.warn("没有找到退款处理逻辑");
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.jsowell.pile.vo.web.IndexOrderInfoVO;
|
||||
import com.jsowell.pile.vo.web.OrderListVO;
|
||||
import com.jsowell.pile.vo.web.OrderTotalDataVO;
|
||||
import com.jsowell.pile.dto.ApplyRefundDTO;
|
||||
import com.jsowell.wxpay.response.WechatPayRefundResponse;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -113,6 +114,10 @@ public interface IOrderBasicInfoService {
|
||||
*/
|
||||
int close15MinutesOfUnpaidOrders();
|
||||
|
||||
WechatPayRefundResponse refundOrderWithWechatPay(ApplyRefundDTO dto);
|
||||
|
||||
WechatPayRefundResponse refundBalanceWithWechatPay(ApplyRefundDTO dto);
|
||||
|
||||
/**
|
||||
* 通过订单号查询订单详情
|
||||
*
|
||||
@@ -271,13 +276,13 @@ public interface IOrderBasicInfoService {
|
||||
* 汇付支付 订单退款
|
||||
* @param dto
|
||||
*/
|
||||
void refundForOrderWithAdapay(ApplyRefundDTO dto);
|
||||
void refundOrderWithAdapay(ApplyRefundDTO dto);
|
||||
|
||||
/**
|
||||
* 汇付支付 余额退款
|
||||
* @param dto
|
||||
*/
|
||||
void refundForBalanceWithAdapay(ApplyRefundDTO dto);
|
||||
void refundBalanceWithAdapay(ApplyRefundDTO dto);
|
||||
|
||||
/**
|
||||
* 生成订单日报
|
||||
|
||||
@@ -846,7 +846,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
if (StringUtils.equals(transactionRecord.getPaymentInstitutions(), PaymentInstitutionsEnum.WECHAT_PAY.getValue())) {
|
||||
this.weChatRefund(weChatRefundDTO);
|
||||
} else if (StringUtils.equals(transactionRecord.getPaymentInstitutions(), PaymentInstitutionsEnum.ADAPAY.getValue())) {
|
||||
this.refundForOrderWithAdapay(weChatRefundDTO);
|
||||
this.refundOrderWithAdapay(weChatRefundDTO);
|
||||
}
|
||||
// 订单支付记录
|
||||
OrderPayRecord orderPayRecord = payRecordList.get(0);
|
||||
@@ -1436,7 +1436,8 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
/**
|
||||
* 微信支付-订单退款处理逻辑
|
||||
*/
|
||||
private WechatPayRefundResponse refundOrderWithWechatPay(ApplyRefundDTO dto) {
|
||||
@Override
|
||||
public WechatPayRefundResponse refundOrderWithWechatPay(ApplyRefundDTO dto) {
|
||||
// 查出来原来的支付信息
|
||||
WxpayCallbackRecord record = wxpayCallbackRecordService.selectByOrderCode(dto.getOrderCode());
|
||||
if (Objects.isNull(record)) {
|
||||
@@ -1476,7 +1477,8 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
/**
|
||||
* 微信支付-余额退款处理逻辑
|
||||
*/
|
||||
private WechatPayRefundResponse refundBalanceWithWechatPay(ApplyRefundDTO dto) {
|
||||
@Override
|
||||
public WechatPayRefundResponse refundBalanceWithWechatPay(ApplyRefundDTO dto) {
|
||||
// 查会员余额
|
||||
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(dto.getMemberId());
|
||||
if (memberVO == null) {
|
||||
@@ -1960,8 +1962,12 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
return "共查询到" + orderListVOS.size() + "条订单,修改成功" + i + "条订单数据";
|
||||
}
|
||||
|
||||
/**
|
||||
* 汇付支付-订单退款处理逻辑
|
||||
* @param dto
|
||||
*/
|
||||
@Override
|
||||
public void refundForOrderWithAdapay(ApplyRefundDTO dto) {
|
||||
public void refundOrderWithAdapay(ApplyRefundDTO dto) {
|
||||
logger.info("汇付支付订单:{}, 执行退款逻辑 param:{}", dto.getOrderCode(), JSON.toJSONString(dto));
|
||||
// 查出来原来的支付信息
|
||||
AdapayCallbackRecord record = adapayCallbackRecordService.selectByOrderCode(dto.getOrderCode());
|
||||
@@ -1983,6 +1989,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
String snowflakeId = SnowflakeIdWorker.getSnowflakeId();
|
||||
String amount = AdapayUtil.formatAmount(dto.getRefundAmount());
|
||||
|
||||
// TODO 拿orderCode查询清分状态
|
||||
String payMode = "delay";
|
||||
if (StringUtils.equals("", payMode)) {
|
||||
// 延迟分账确认的调退款接口
|
||||
@@ -2014,7 +2021,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refundForBalanceWithAdapay(ApplyRefundDTO dto) {
|
||||
public void refundBalanceWithAdapay(ApplyRefundDTO dto) {
|
||||
// 查会员余额
|
||||
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(dto.getMemberId());
|
||||
if (memberVO == null) {
|
||||
@@ -2264,7 +2271,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
weChatRefundDTO = new ApplyRefundDTO();
|
||||
weChatRefundDTO.setOrderCode(refundOrder.getOrderCode());
|
||||
weChatRefundDTO.setRefundAmount(new BigDecimal(refundOrder.getRefundAmount()));
|
||||
this.refundForOrderWithAdapay(weChatRefundDTO);
|
||||
this.refundOrderWithAdapay(weChatRefundDTO);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user