|
|
|
@ -947,41 +947,6 @@ public class CashRefundServiceImpl implements RefundService { |
|
|
|
} |
|
|
|
List<FundsDTO> list = cashRefundMapper.selectfunds(fundsDTO); |
|
|
|
|
|
|
|
// 2. 收集 status == 6 的记录 ID |
|
|
|
List<Integer> needQueryIds = new ArrayList<>(); |
|
|
|
for (FundsDTO dto : list) { |
|
|
|
if (dto.getStatus() != null && dto.getStatus() == 6) { |
|
|
|
needQueryIds.add(dto.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 3. 批量查询 refundDetail 信息(用于负数处理) |
|
|
|
if (!needQueryIds.isEmpty()) { |
|
|
|
List<FundsDTO> detailList = cashRefundMapper.selectRefundCount(needQueryIds); |
|
|
|
|
|
|
|
Map<Integer, FundsDTO> detailMap = new HashMap<>(); |
|
|
|
for (FundsDTO detail : detailList) { |
|
|
|
// 假设 detail.getRelatedId() 对应主表的 id |
|
|
|
detailMap.put(detail.getRelatedId(), detail); |
|
|
|
} |
|
|
|
|
|
|
|
// 回填 refundAmount(取负)和 refundCurrency |
|
|
|
for (FundsDTO dto : list) { |
|
|
|
if (dto.getStatus() != null && dto.getStatus() == 6) { |
|
|
|
FundsDTO detail = detailMap.get(dto.getId()); |
|
|
|
if (detail != null) { |
|
|
|
BigDecimal amount = detail.getRefundAmount(); |
|
|
|
if (amount != null) { |
|
|
|
dto.setRefundAmount(amount.negate()); // 转为负数 |
|
|
|
} else { |
|
|
|
dto.setRefundAmount(null); // 或设为 BigDecimal.ZERO |
|
|
|
} |
|
|
|
dto.setRefundCurrency(detail.getRefundCurrency()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 4. 收集所有需要转换的 regionId 和 currencyId |
|
|
|
Set<Integer> regionIds = new HashSet<>(); |
|
|
|
Set<Integer> currencyIds = new HashSet<>(); |
|
|
|
@ -1033,6 +998,37 @@ public class CashRefundServiceImpl implements RefundService { |
|
|
|
// 8. 返回分页结果 |
|
|
|
return new PageInfo<>(list); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 复制 FundsDTO 对象(浅拷贝) |
|
|
|
*/ |
|
|
|
private FundsDTO copyFundsDTO(FundsDTO source) { |
|
|
|
FundsDTO target = new FundsDTO(); |
|
|
|
target.setId(source.getId()); |
|
|
|
target.setPayTime(source.getPayTime()); |
|
|
|
target.setOrderCode("TK" + source.getOrderCode()); |
|
|
|
target.setReceivedMarket(source.getReceivedMarket()); |
|
|
|
target.setPerformanceMarket(source.getPerformanceMarket()); |
|
|
|
target.setName(source.getName()); |
|
|
|
target.setJwcode(source.getJwcode()); |
|
|
|
target.setIncomeType(source.getIncomeType()); |
|
|
|
target.setGoodNum(source.getGoodNum()); |
|
|
|
target.setPayType(source.getPayType()); |
|
|
|
target.setReceivedCurrency(source.getReceivedCurrency()); |
|
|
|
target.setPaymentAmount(source.getPaymentAmount()); |
|
|
|
target.setHandlingCharge(source.getHandlingCharge()); |
|
|
|
target.setReceivedAmount(source.getReceivedAmount()); |
|
|
|
target.setMarket(source.getMarket()); |
|
|
|
target.setMarketName(source.getMarketName()); |
|
|
|
target.setMarkets(source.getMarkets()); |
|
|
|
target.setPerformanceMarkets(source.getPerformanceMarkets()); |
|
|
|
target.setPaymentCurrency(source.getPaymentCurrency()); |
|
|
|
target.setPaymentCurrencyName(source.getPaymentCurrencyName()); |
|
|
|
target.setReceivedCurrencyName(source.getReceivedCurrencyName()); |
|
|
|
target.setStatus(source.getStatus()); |
|
|
|
target.setStatusName(source.getStatusName()); |
|
|
|
return target; |
|
|
|
} |
|
|
|
/** |
|
|
|
* 计算用户指定钱包列表的总可用余额 |
|
|
|
* @param jwcode 用户标识 |
|
|
|
|