| | |
| | | if (claimDetails == null || claimDetails.isEmpty()) { |
| | | throw new RuntimeException("认领明细列表不能为空"); |
| | | } |
| | | |
| | | // 计算总认领金额 |
| | | BigDecimal totalClaimAmount = BigDecimal.ZERO; |
| | | // 验证认领明细的必填字段 |
| | | for (FundFlowClaimDetail claimDetail : claimDetails) { |
| | | if (claimDetail.getClaimAmount() == null || claimDetail.getClaimAmount().compareTo(BigDecimal.ZERO) <= 0) { |
| | | throw new RuntimeException("认领金额必须大于0"); |
| | | } |
| | | totalClaimAmount = totalClaimAmount.add(claimDetail.getClaimAmount()); |
| | | } |
| | | |
| | | // 查询资金流水信息 |
| | | FundFlow fundFlow = fundFlowMapper.selectFundFlowById(fundFlowId); |
| | | |
| | | // 根据总认领金额与交易金额的比较设置状态 |
| | | String newStatus = getString(fundFlowId, claimDetails, fundFlow); |
| | | |
| | | // 更新资金流水状态 |
| | | // 更新资金流水状态和已认领金额 |
| | | fundFlow.setStatus(newStatus); |
| | | fundFlow.setClaimedAmount(totalClaimAmount); // 设置已认领金额 |
| | | fundFlow.setUpdateTime(DateUtils.getNowDate()); |
| | | int updateResult = fundFlowMapper.updateFundFlow(fundFlow); |
| | | if (updateResult <= 0) { |
| | |
| | | |
| | | // 先删除该资金流水ID下的所有认领明细(避免重复认领) |
| | | fundFlowClaimDetailMapper.deleteFundFlowClaimDetailByFundFlowId(fundFlowId); |
| | | |
| | | |
| | | // 批量保存所有账单认领明细 |
| | | for (FundFlowClaimDetail claimDetail : claimDetails) { |
| | | // 设置资金流水ID |