|
|
@ -507,12 +507,12 @@ public class CashRefundServiceImpl implements RefundService { |
|
|
// 钱包更新 - 按原始充值流水 wallet_id 优先级顺序原路退回(1-10,越小优先级越高) |
|
|
// 钱包更新 - 按原始充值流水 wallet_id 优先级顺序原路退回(1-10,越小优先级越高) |
|
|
String orderCodeA = "XJ" + orderCode.substring(4); |
|
|
String orderCodeA = "XJ" + orderCode.substring(4); |
|
|
|
|
|
|
|
|
// 1. 查询原始充值流水(type=3 充值,status=0 正常) |
|
|
|
|
|
|
|
|
// 1. 查询原始充值流水(type=0 充值,status=0 正常) |
|
|
List<UserWalletRecord> originalRecords = walletService.selectUserWalletRecord(userGoldRecord.getJwcode(), orderCodeA); |
|
|
List<UserWalletRecord> originalRecords = walletService.selectUserWalletRecord(userGoldRecord.getJwcode(), orderCodeA); |
|
|
if (!CollectionUtils.isEmpty(originalRecords)) { |
|
|
if (!CollectionUtils.isEmpty(originalRecords)) { |
|
|
// 过滤充值记录并按 wallet_id 升序排序 |
|
|
// 过滤充值记录并按 wallet_id 升序排序 |
|
|
originalRecords = originalRecords.stream() |
|
|
originalRecords = originalRecords.stream() |
|
|
.filter(r -> r.getType() == 3 && r.getStatus() == 0) |
|
|
|
|
|
|
|
|
.filter(r -> r.getType() == 0 && r.getStatus() == 0) |
|
|
.sorted(Comparator.comparing(UserWalletRecord::getWalletId)) |
|
|
.sorted(Comparator.comparing(UserWalletRecord::getWalletId)) |
|
|
.collect(Collectors.toList()); |
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
@ -554,7 +554,7 @@ public class CashRefundServiceImpl implements RefundService { |
|
|
|
|
|
|
|
|
// 5. 插入退款流水(amount 存负数,表示扣减) |
|
|
// 5. 插入退款流水(amount 存负数,表示扣减) |
|
|
UserWalletRecord refundRecord = new UserWalletRecord(); |
|
|
UserWalletRecord refundRecord = new UserWalletRecord(); |
|
|
refundRecord.setType(4); // 充值退款类型 |
|
|
|
|
|
|
|
|
refundRecord.setType(2); // 充值退款类型 |
|
|
refundRecord.setJwcode(userGoldRecord.getJwcode()); |
|
|
refundRecord.setJwcode(userGoldRecord.getJwcode()); |
|
|
refundRecord.setWalletId(walletId); |
|
|
refundRecord.setWalletId(walletId); |
|
|
refundRecord.setAmount(refundAmount.negate().intValue()); // 🔥 负数扣款 |
|
|
refundRecord.setAmount(refundAmount.negate().intValue()); // 🔥 负数扣款 |
|
|
|