|  |  |  | 
|---|
|  |  |  | private InsuranceApplyMapper insuranceApplyMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private CompanySolutionMapper companySolutionMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private ApplyChangeJoinMapper applyChangeJoinMapper; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(addList!=null && addList.size()>0){ | 
|---|
|  |  |  | applyChagneDetailJoinMapper.insertBatchSomeColumn(addList); | 
|---|
|  |  |  | applyDetailJoinMapper.insertBatchSomeColumn(addList); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(totalFee.compareTo(new BigDecimal(0)) != 0){ | 
|---|
|  |  |  | //如果保单金额发生编码,更新总保单金额 | 
|---|
|  |  |  | 
|---|
|  |  |  | if(Objects.isNull(solutions)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保险方案"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | CompanySolution companySolution = companySolutionMapper.selectOne(new QueryWrapper<CompanySolution>().lambda() | 
|---|
|  |  |  | .eq(CompanySolution::getCompanyId,loginUserInfo.getCompanyId()) | 
|---|
|  |  |  | .eq(CompanySolution::getSolutionBaseId,solutions.getId()) | 
|---|
|  |  |  | .eq(CompanySolution::getIsdeleted,Constants.ZERO) | 
|---|
|  |  |  | .last(" limit 1 ") | 
|---|
|  |  |  | ); | 
|---|
|  |  |  | if(Objects.isNull(companySolution)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到企业分配保险方案信息"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //申请时间必须处于保单的时间范围内 | 
|---|
|  |  |  | if (!(DateUtil.compareDate(applyChange.getValidTime(), insuranceApply.getStartTime()) >= Constants.ZERO | 
|---|
|  |  |  | && DateUtil.compareDate(insuranceApply.getEndTime(), applyChange.getValidTime()) >= Constants.ZERO)) { | 
|---|
|  |  |  | 
|---|
|  |  |  | //加保数据 | 
|---|
|  |  |  | List<ApplyChagneDetail> addDetailList = applyChange.getAddDetailList(); | 
|---|
|  |  |  | if (CollectionUtils.isNotEmpty(addDetailList)) { | 
|---|
|  |  |  | if(companySolution.getCanAdd().equals(Constants.ZERO)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "该企业分配保险方案无法进行加保"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.addChangeDetail(applyChange,addDetailList,duWorktypeList,duSolutionList,insuranceApply,solutions,loginUserInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | //减保数据 | 
|---|
|  |  |  | List<ApplyChagneDetail> delDetailList = applyChange.getDelDetailList(); | 
|---|
|  |  |  | if (CollectionUtils.isNotEmpty(delDetailList)) { | 
|---|
|  |  |  | if(companySolution.getCanReduce().equals(Constants.ZERO)){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "该企业分配保险方案无法进行加保"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | this.delChangeDetail(applyChange,delDetailList,insuranceApply,solutions,loginUserInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | //换厂业务 | 
|---|