This commit is contained in:
2023-08-23 16:46:07 +08:00
parent c5a8b808c6
commit 2b6ded7b75
4 changed files with 9 additions and 5 deletions

View File

@@ -329,7 +329,7 @@ public class OrderService {
* 汇付退款
* @param dto
*/
public void adapayRefund(ApplyRefundDTO dto) {
public void adapayRefund(ApplyRefundDTO dto){
log.info("汇付退款 param:{}", JSON.toJSONString(dto));
// 退款有两种情况 1-订单结算退款 2-用户余额退款
String refundType = dto.getRefundType();

View File

@@ -26,7 +26,7 @@ public class CacheConstants {
public static final String PUSH_STATION_CONNECTOR = "push_station_connector";
// 会员余额退款正在进行中
public static final String MEMBER_BALANCE_REFUNDS_ARE_IN_PROGRESS = "Member_Balance_Refunds_Are_In_Progress:";
public static final String MEMBER_BALANCE_REFUNDS_ARE_IN_PROGRESS = "member_balance_refunds_are_in_progress:";
public static final String PLATFORM_TESTER = "platform_tester:";

View File

@@ -5,6 +5,7 @@ import com.jsowell.adapay.response.PaymentReverseResponse;
import com.jsowell.adapay.vo.OrderSettleResult;
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.domain.ykc.TransactionRecordsData;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.pile.domain.AdapayMemberAccount;
import com.jsowell.pile.domain.OrderBasicInfo;
import com.jsowell.pile.domain.OrderDetail;

View File

@@ -2369,10 +2369,10 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
}
@Override
public void refundBalanceWithAdapay(ApplyRefundDTO dto) {
public void refundBalanceWithAdapay(ApplyRefundDTO dto){
String redisKey = CacheConstants.MEMBER_BALANCE_REFUNDS_ARE_IN_PROGRESS + dto.getMemberId();
String redisResult = redisCache.getCacheObject(redisKey);
if (StringUtils.isNotBlank(redisResult)) {
PaymentReverseResponse redisResult = redisCache.getCacheObject(redisKey);
if (Objects.nonNull(redisResult)) {
throw new BusinessException(ReturnCodeEnum.CODE_BALANCE_REFUNDS_ARE_IN_PROGRESS_ERROR);
}
@@ -2389,6 +2389,9 @@ public class OrderBasicInfoServiceImpl implements IOrderBasicInfoService {
throw new BusinessException(ReturnCodeEnum.CODE_REFUND_MEMBER_BALANCE_ERROR);
}
// 模拟放缓存
redisCache.setCacheObject(redisKey, new PaymentConfirmResponse(), CacheConstants.cache_expire_time_30m);
// 查询用户充值余额订单 过滤掉已经退款的充值订单
List<BalanceDeductionAmountVO> list = calculateTheBalanceDeductionAmount(dto.getMemberId(), refundAmount);
for (BalanceDeductionAmountVO vo : list) {