|  |  | 
 |  |  |         updBean.setId(insuranceApply.getId()); | 
 |  |  |         updBean.setFee(applyDetailList.stream().map(ApplyDetail::getFee).reduce(BigDecimal.ZERO,BigDecimal::add)); | 
 |  |  |         insuranceApplyMapper.updateById(updBean); | 
 |  |  |  | 
 |  |  | //        if(1==1){ | 
 |  |  | //            throw new BusinessException(ResponseStatus.NOT_ALLOWED); | 
 |  |  | //        } | 
 |  |  |  | 
 |  |  |         //存储日志数据 | 
 |  |  |         Constants.ApplyLogType applyLogType = Constants.ApplyLogType.UPLOAD; | 
 |  |  |         String info =applyLogType.getInfo(); | 
 |  |  | 
 |  |  |                     } | 
 |  |  |                     member.setIdcardNo(applyDetail.getIdcardNo()); | 
 |  |  |                     member.setApplyId(insuranceApply.getId()); | 
 |  |  |                     member.setStartTime(applyDetail.getStartTime()); | 
 |  |  |                     member.setEndTime(applyDetail.getEndTime()); | 
 |  |  | //                    member.setStartTime(applyDetail.getStartTime()); | 
 |  |  | //                    member.setEndTime(applyDetail.getEndTime()); | 
 |  |  |                     member.setDuId(applyDetail.getDuId()); | 
 |  |  |                     member.setWorktypeId(applyDetail.getWorktypeId()); | 
 |  |  |                     addMemberList.add(member); | 
 |  |  | 
 |  |  |                 applyDetail.setEndTime(insuranceApply.getApplyEndTime()); | 
 |  |  |                 applyDetail.setSortnum(i); | 
 |  |  |                 applyDetail.setApplyId(insuranceApply.getId()); | 
 |  |  |  | 
 |  |  |                 //根据员工身份证进行判断年龄 | 
 |  |  |                 long age = Constants.getAgeByIdCard(applyDetail.getIdcardNo()); | 
 |  |  |                 if(Objects.isNull(age) | 
 |  |  |                         || age > solutions.getMaxAge() | 
 |  |  |                         || age < solutions.getMinAge()){ | 
 |  |  |                     throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+applyDetail.getMemberName()+"】员工年龄超出方案配置,方案配置【"+solutions.getMinAge()+" - "+solutions.getMaxAge()+"】!"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 Member member = null; | 
 |  |  |                 if(Objects.isNull(applyDetail.getMemberId())){ | 
 |  |  |                     if(CollectionUtils.isNotEmpty(memberList)){ | 
 |  |  | 
 |  |  |                         member.setApplyId(insuranceApply.getId()); | 
 |  |  |                         member.setDuId(applyDetail.getDuId()); | 
 |  |  |                         member.setWorktypeId(applyDetail.getWorktypeId()); | 
 |  |  |                         member.setStartTime(applyDetail.getStartTime()); | 
 |  |  |                         member.setEndTime(applyDetail.getEndTime()); | 
 |  |  | //                        member.setStartTime(applyDetail.getStartTime()); | 
 |  |  | //                        member.setEndTime(applyDetail.getEndTime()); | 
 |  |  |                         memberMapper.updateById(member); | 
 |  |  |                     } | 
 |  |  |                 }else{ | 
 |  |  | 
 |  |  |                     member.setApplyId(insuranceApply.getId()); | 
 |  |  |                     member.setDuId(applyDetail.getDuId()); | 
 |  |  |                     member.setWorktypeId(applyDetail.getWorktypeId()); | 
 |  |  |                     member.setStartTime(applyDetail.getStartTime()); | 
 |  |  |                     member.setEndTime(applyDetail.getEndTime()); | 
 |  |  | //                    member.setStartTime(applyDetail.getStartTime()); | 
 |  |  | //                    member.setEndTime(applyDetail.getEndTime()); | 
 |  |  |                     memberMapper.updateById(member); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 //根据员工身份证进行判断年龄 | 
 |  |  |                 long age = Constants.getAgeByIdCard(member.getIdcardNo()); | 
 |  |  |                 if(Objects.isNull(age) | 
 |  |  |                     || age > solutions.getMaxAge() | 
 |  |  |                     || age < solutions.getMinAge()){ | 
 |  |  |                     throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+applyDetail.getMemberName()+"】员工年龄超出方案配置,方案配置【"+solutions.getMinAge()+" - "+solutions.getMaxAge()+"】!"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  |                 applyDetail.setMemberId(member.getId()); | 
 |  |  |                 applyDetail.setIdcardNo(member.getIdcardNo()); | 
 |  |  |                 applyDetail.setSex(member.getSex()); | 
 |  |  | 
 |  |  |                             .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId) | 
 |  |  |                             .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) | 
 |  |  |                             .eq(ApplyDetail::getIdcardNo,idCode) | 
 |  |  |                             .eq(ApplyDetail::getIsdeleted,Constants.ZERO) | 
 |  |  |                             .eq(Solutions::getBaseId,solutionId) | 
 |  |  |                             .ne(Objects.nonNull(applyId),InsuranceApply::getId,applyId) | 
 |  |  |                             .notIn(InsuranceApply::getStatus | 
 |  |  |                                     ,Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey() | 
 |  |  |                                     ,Constants.InsuranceApplyStatus.FAIL_RETURN.getKey() | 
 |  |  |                                     ,Constants.InsuranceApplyStatus.CLOSE.getKey() | 
 |  |  |                                     ,Constants.InsuranceApplyStatus.WTB_RETURN.getKey() | 
 |  |  |                                     ,Constants.InsuranceApplyStatus.WTB_CLOSED.getKey() ) | 
 |  |  |                             .apply(" ( " + | 
 |  |  |                                     " '"+DateUtil.getPlusTime(startTime)+"'  <= t.start_time AND t.start_time < '"+DateUtil.getPlusTime(endTime)+"' " + | 
 |  |  | 
 |  |  |                             .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) | 
 |  |  |                             .eq(ApplyDetail::getIdcardNo,idCode) | 
 |  |  |                             .eq(Solutions::getBaseId,solutionId) | 
 |  |  |                             .eq(ApplyDetail::getIsdeleted,Constants.ZERO) | 
 |  |  |                             .notIn(InsuranceApply::getStatus | 
 |  |  |                                     ,Constants.InsuranceApplyStatus.PLATFORM_RETURN.getKey() | 
 |  |  |                                     ,Constants.InsuranceApplyStatus.FAIL_RETURN.getKey() | 
 |  |  |                                     ,Constants.InsuranceApplyStatus.CLOSE.getKey() | 
 |  |  |                                     ,Constants.InsuranceApplyStatus.WTB_RETURN.getKey() | 
 |  |  |                                     ,Constants.InsuranceApplyStatus.WTB_CLOSED.getKey() ) | 
 |  |  |                             .apply(" ( " + | 
 |  |  |                                     " '"+DateUtil.getPlusTime(startTime)+"'  <= t.start_time AND t.start_time < '"+DateUtil.getPlusTime(endTime)+"' " + | 
 |  |  | 
 |  |  |                 .selectAs(Solutions::getName,InsuranceApply::getSolutionsName) | 
 |  |  |                 .selectAs(Solutions::getType,InsuranceApply::getSolutionType) | 
 |  |  |                 .selectAs(Company::getName,InsuranceApply::getCompanyName) | 
 |  |  |                 .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad inner join insurance_apply a on ad.apply_id = a.id  and a.status in ( 5 , 27 )  where ad.apply_id = t.id and ad.END_TIME > now() ) as guaranteeNum") | 
 |  |  |                 .select(" ( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad  where ad.apply_id = t.id ) as insureNum") | 
 |  |  |                 .select(" ifnull(( select count(DISTINCT(ad.MEMBER_ID)) from apply_detail ad inner join insurance_apply a on ad.apply_id = a.id  and a.status in ( 5 , 27 )  where ad.apply_id = t.id and ad.END_TIME > now() ),0) as guaranteeNum") | 
 |  |  |                 .leftJoin(Solutions.class,Solutions::getId,InsuranceApply::getSolutionId) | 
 |  |  |                 .leftJoin(Company.class,Company::getId,InsuranceApply::getCompanyId) | 
 |  |  |                 .eq(InsuranceApply::getId,model.getId()) | 
 |  |  | 
 |  |  |         //查询明细 | 
 |  |  |         List<ApplyDetail> detailList =applyDetailJoinMapper.selectJoinList(ApplyDetail.class,wrapper1); | 
 |  |  |         if(detailList!=null){ | 
 |  |  |             insuranceApply.setInsureNum(detailList.size()); | 
 |  |  | //            insuranceApply.setInsureNum(detailList.size()); | 
 |  |  |             insuranceApply.setApplyDetailList(detailList); | 
 |  |  |         } | 
 |  |  |         insuranceApply.setRemark(model.getRemark()); |