Browse Source

3.17 修改退款充值

milestone-20260224-现金钱包
huangqizhen 3 weeks ago
parent
commit
c3a87aa35e
  1. 6
      src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java
  2. 1
      src/main/resources/mapper/WalletMapper.xml

6
src/main/java/com/example/demo/serviceImpl/cash/CashRefundServiceImpl.java

@ -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()); // 🔥 负数扣款

1
src/main/resources/mapper/WalletMapper.xml

@ -88,6 +88,5 @@
<foreach item="item" index="index" collection="walletIds" separator="," close=")" open="("> <foreach item="item" index="index" collection="walletIds" separator="," close=")" open="(">
#{item} #{item}
</foreach> </foreach>
/>
</select> </select>
</mapper> </mapper>
Loading…
Cancel
Save