mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 11:05:18 +08:00
update 汇付退款
This commit is contained in:
@@ -50,6 +50,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -129,6 +130,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
@Autowired
|
||||
private IPileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Value("${adapay.refundCallback}")
|
||||
private String ADAPAY_REFUND_CALLBACK_URL;
|
||||
|
||||
/**
|
||||
* 条件查询订单基本信息
|
||||
*
|
||||
@@ -1756,6 +1760,7 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
Map<String, Object> refundParams = Maps.newHashMap();
|
||||
refundParams.put("refund_amt", AdapayUtil.formatAmount(dto.getRefundAmount()));
|
||||
refundParams.put("refund_order_no", SnowflakeIdWorker.getSnowflakeId());
|
||||
refundParams.put("notify_url", ADAPAY_REFUND_CALLBACK_URL);
|
||||
Map<String, Object> response = Refund.create(id, refundParams);
|
||||
logger.info("创建退款对象:{}", JSON.toJSONString(response));
|
||||
|
||||
@@ -1763,6 +1768,20 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
|
||||
|
||||
@Override
|
||||
public void refundForBalanceWithAdapay(WeChatRefundDTO dto) {
|
||||
// 查会员余额
|
||||
MemberVO memberVO = memberBasicInfoService.queryMemberInfoByMemberId(dto.getMemberId());
|
||||
if (memberVO == null) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_SELECT_MEMBER_NULL_ERROR);
|
||||
}
|
||||
// 校验退款金额
|
||||
BigDecimal principalBalance = memberVO.getPrincipalBalance();
|
||||
BigDecimal refundAmount = dto.getRefundAmount();
|
||||
if (refundAmount.compareTo(principalBalance) > 0) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_REFUND_MEMBER_BALANCE_ERROR);
|
||||
}
|
||||
|
||||
// 查询用户充值余额订单 过滤掉已经退款的充值订单
|
||||
|
||||
// 也许需要多笔支付订单才够退款
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user