| | |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = {Exception.class}) |
| | | public void updateApplyCurrentFee(){ |
| | | public void updateApplyCurrentFee(Integer id){ |
| | | List<InsuranceApply> insuranceApplyList = insuranceApplyMapper.selectList(new QueryWrapper<InsuranceApply>().lambda() |
| | | .eq(InsuranceApply::getIsdeleted,Constants.ZERO) |
| | | .eq(InsuranceApply::getStatus,Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()) |
| | | .ge(InsuranceApply::getStartTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 00:00:00") |
| | | .le(InsuranceApply::getEndTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 23:59:59") |
| | | .eq(!Objects.isNull(id),InsuranceApply::getId,id) |
| | | .le(InsuranceApply::getStartTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 00:00:00") |
| | | .ge(InsuranceApply::getEndTime,DateUtil.getDate(new Date(),"yyyy-MM-dd") + " 23:59:59") |
| | | ); |
| | | |
| | | if(CollectionUtils.isNotEmpty(insuranceApplyList)){ |
| | |
| | | List<ApplyDetail> applyDetailList = applyDetailMapper.selectList(new QueryWrapper<ApplyDetail>().lambda().eq(ApplyDetail::getApplyId,insuranceApply.getId())); |
| | | if(CollectionUtils.isNotEmpty(applyDetailList)){ |
| | | for (ApplyDetail applyDetail: applyDetailList) { |
| | | applyDetail.setCurrentFee(Constants.countDetailFee(solutions,new Date(),applyDetail.getStartTime())); |
| | | applyDetailMapper.updateById(applyDetail); |
| | | //2024-1-30 10:04:24 修改 根据实际天数进行计算 当前费用 总金额/总天数*实际天数 |
| | | Integer maxDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0) + 1 ; |
| | | BigDecimal fee = applyDetail.getFee(); |
| | | if(applyDetail.getStartTime().compareTo(new Date()) <= 0 && applyDetail.getEndTime().compareTo(new Date()) >= 0 ){ |
| | | Integer days = DateUtil.calculateBetween(applyDetail.getStartTime(),new Date(),0) + 1 ; |
| | | applyDetail.setCurrentFee(fee.divide(BigDecimal.valueOf(maxDays),2, BigDecimal.ROUND_HALF_UP).multiply(BigDecimal.valueOf(days))); |
| | | applyDetailMapper.updateById(applyDetail); |
| | | } |
| | | // DateUtil.daysBetweenDates(applyDetail.getEndTime(),applyDetail.getStartTime()); |
| | | // applyDetail.setCurrentFee(Constants.countDetailFee(solutions,new Date(),applyDetail.getStartTime())); |
| | | // applyDetailMapper.updateById(applyDetail); |
| | | sumAmount = sumAmount.add(applyDetail.getCurrentFee()); |
| | | } |
| | | } |