| | |
| | | import com.doumee.core.utils.Constants; |
| | | import com.doumee.core.utils.DateUtil; |
| | | import com.doumee.core.utils.Utils; |
| | | import com.doumee.dao.business.InsuranceApplyMapper; |
| | | import com.doumee.dao.business.MemberMapper; |
| | | import com.doumee.dao.business.SolutionsMapper; |
| | | import com.doumee.dao.business.WorktypeMapper; |
| | | import com.doumee.dao.business.dto.MemberImport; |
| | | import com.doumee.dao.business.dto.MemberQueryDTO; |
| | | import com.doumee.dao.business.dto.MemberReduceImport; |
| | | import com.doumee.dao.business.dto.WorktypeImport; |
| | | import com.doumee.dao.business.join.ApplyDetailJoinMapper; |
| | | import com.doumee.dao.business.join.DispatchUnitJoinMapper; |
| | | import com.doumee.dao.business.join.MemberJoinMapper; |
| | | import com.doumee.dao.business.join.SolutionWorktypeJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.service.business.MemberService; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | import lombok.extern.java.Log; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.checkerframework.checker.units.qual.C; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | |
| | | @Autowired |
| | | private DispatchUnitJoinMapper dispatchUnitJoinMapper; |
| | | @Autowired |
| | | private ApplyDetailJoinMapper applyDetailJoinMapper; |
| | | |
| | | @Autowired |
| | | private WorktypeMapper worktypeMapper; |
| | | |
| | | @Autowired |
| | | private SolutionsMapper solutionsMapper; |
| | | @Autowired |
| | | private InsuranceApplyMapper insuranceApplyMapper; |
| | | @Autowired |
| | | private SolutionWorktypeJoinMapper solutionWorktypeJoinMapper; |
| | | |
| | | @Override |
| | | public Integer create(Member member) { |
| | |
| | | " and ad.END_TIME >= '"+DateUtil.DateToStr(memberQueryDTO.getValidTime(),"yyyy-MM-dd HH:mm:ss.SSS")+"' and ad.START_TIME <= '"+DateUtil.DateToStr(memberQueryDTO.getValidTime(),"yyyy-MM-dd HH:mm:ss.SSS")+"' and ad.isdeleted = 0 " + |
| | | " and ad.member_id = t.id ") ; |
| | | if(!Objects.isNull(memberQueryDTO.getInsuranceApplyId())){ |
| | | if(Objects.isNull(memberQueryDTO.getValidTime())){ |
| | | memberQueryDTO.setValidTime(new Date()); |
| | | } |
| | | lambdaWrapper = new MPJLambdaWrapper<Member>() |
| | | .select(Member::getId,Member::getName,Member::getIdcardNo) |
| | | .selectAs(Worktype::getId,Member::getWorktypeId) |
| | |
| | | .eq(InsuranceApply::getId,memberQueryDTO.getInsuranceApplyId()) |
| | | .and(StringUtils.isNotBlank(memberQueryDTO.getName()),i->i.like(Member::getName,memberQueryDTO.getName()) |
| | | .or().like(Member::getIdcardNo,memberQueryDTO.getName())) |
| | | .le(!Objects.isNull(memberQueryDTO.getValidTime()),ApplyDetail::getStartTime,memberQueryDTO.getValidTime()) |
| | | // .le(!Objects.isNull(memberQueryDTO.getValidTime()),ApplyDetail::getStartTime,memberQueryDTO.getValidTime()) |
| | | .ge(!Objects.isNull(memberQueryDTO.getValidTime()),ApplyDetail::getEndTime,memberQueryDTO.getValidTime()) |
| | | .in(CollectionUtils.isNotEmpty(memberQueryDTO.getSubtractMemberIds()),Member::getId,memberQueryDTO.getSubtractMemberIds()) |
| | | .exists(!Objects.isNull(memberQueryDTO.getInsuranceApplyId())&&!Objects.isNull(memberQueryDTO.getValidTime()), |
| | | " select 1 from apply_detail ad where ad.apply_id = "+memberQueryDTO.getInsuranceApplyId()+"" + |
| | | " and ad.END_TIME >= '"+DateUtil.DateToStr(memberQueryDTO.getValidTime(),"yyyy-MM-dd HH:mm:ss.SSS")+"' and ad.START_TIME <= '"+DateUtil.DateToStr(memberQueryDTO.getValidTime(),"yyyy-MM-dd HH:mm:ss.SSS")+"' and ad.isdeleted = 0 " + |
| | | " and ad.END_TIME >= '"+DateUtil.DateToStr(memberQueryDTO.getValidTime(),"yyyy-MM-dd HH:mm:ss.SSS")+"'" + |
| | | // " and ad.START_TIME <= '"+DateUtil.DateToStr(memberQueryDTO.getValidTime(),"yyyy-MM-dd HH:mm:ss.SSS")+"'" + |
| | | " and ad.isdeleted = 0 " + |
| | | " and ad.member_id = t.id "); |
| | | } |
| | | List<Member> memberList = memberJoinMapper.selectJoinList(Member.class,lambdaWrapper); |
| | | if(!Objects.isNull(memberQueryDTO.getInsuranceApplyId())&&Objects.isNull(memberQueryDTO.getValidTime())){ |
| | | if(!Objects.isNull(memberQueryDTO.getInsuranceApplyId())&&Objects.nonNull(memberQueryDTO.getValidTime())){ |
| | | if(CollectionUtils.isNotEmpty(memberList)){ |
| | | Solutions solutions = solutionsMapper.selectById(memberList.get(Constants.ZERO).getSolutionId()); |
| | | Date reduceEndTime = DateUtil.getMontageDate( |
| | | DateUtil.afterDateByType(new Date(),0,solutions.getDelValidDays()),3); |
| | | memberList = memberList.stream().filter(member->member.getDetailStartTime().getTime()<=reduceEndTime.getTime() |
| | | &&member.getDetailEndTime().getTime()>=reduceEndTime.getTime()).collect(Collectors.toList()); |
| | | // Date reduceEndTime = DateUtil.getMontageDate( |
| | | // DateUtil.afterDateByType(new Date(),0,solutions.getDelValidDays()),3); |
| | | // Date reduceEndTime = DateUtil.getMontageDate(new Date(),3); |
| | | for (Member member:memberList) { |
| | | //减保业务 使用 选择人员 根据日期实时查询 |
| | | member.setFee( |
| | | Constants.reduceFee(solutions, |
| | | Objects.isNull(member.getDetailServerCost())? |
| | | solutions.getPrice():solutions.getPrice().add(member.getDetailServerCost()),member.getStartTime(),member.getEndTime(),member.getDetailStartTime(), |
| | | reduceEndTime).subtract(member.getFee())); |
| | | //如果当前日期 小于 人员保单明细记录的开始时间 则使用开始日期 开始日期 = 结束日期 且 费用全部退回 |
| | | // if(System.currentTimeMillis()<=member.getStartTime().getTime()){ |
| | | // member.setFee(solutions.getPrice().multiply(new BigDecimal(-1))); |
| | | if(System.currentTimeMillis()<=member.getDetailStartTime().getTime()){ |
| | | member.setFee(member.getFee().multiply(new BigDecimal(-1))); |
| | | }else{ |
| | | Date reduceEndTime = DateUtil.getMontageDate( |
| | | DateUtil.afterDateByType(new Date(),0,solutions.getDelValidDays()),3); |
| | | member.setFee( |
| | | Constants.reduceFee(solutions, |
| | | Objects.isNull(member.getDetailServerCost())? |
| | | solutions.getPrice():solutions.getPrice().add(member.getDetailServerCost()),member.getStartTime(),member.getEndTime(),member.getDetailStartTime(), |
| | | reduceEndTime).subtract(member.getFee())); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MemberImport> importBatch(MultipartFile file,Integer solutionId){ |
| | | public List<MemberReduceImport> importReduceBatch(MultipartFile file, Integer applyId){ |
| | | if(applyId == null ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请选择有效的方案再进行操作!"); |
| | | } |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业人员无法进行该操作"); |
| | | } |
| | | List<Member> list = memberJoinMapper.selectJoinList(Member.class,new MPJLambdaWrapper<Member>() |
| | | .selectAll(Member.class) |
| | | .selectAs(DispatchUnit::getName,Member::getDuName) |
| | | .selectAs(Worktype::getName,Member::getWorkTypeName) |
| | | .leftJoin(DispatchUnit.class,DispatchUnit::getId,Member::getDuId) |
| | | .leftJoin(Worktype.class,Worktype::getId,Member::getWorktypeId) |
| | | .isNotNull(Member::getIdcardNo) |
| | | .eq(Member::getCompanyId,loginUserInfo.getCompanyId()) |
| | | .eq(Member::getIsdeleted,Constants.ZERO) |
| | | ); |
| | | ExcelImporter ie = null; |
| | | List<MemberReduceImport> dataList =null; |
| | | try { |
| | | ie = new ExcelImporter(file,1,0); |
| | | dataList = ie.getDataList(MemberReduceImport.class,null); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | if(dataList == null || dataList.size() ==0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,录入数据为空!"); |
| | | } |
| | | |
| | | InsuranceApply insuranceApply = insuranceApplyMapper.selectById(applyId); |
| | | if (Objects.isNull(insuranceApply) || !Constants.equalsInteger(insuranceApply.getCompanyId(),loginUserInfo.getCompanyId())) { |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"对不起,保单信息不存在,请刷新页面重试!"); |
| | | } |
| | | if (!(Constants.equalsInteger(insuranceApply.getStatus(), Constants.InsuranceApplyStatus.UPLOAD_INSURANCE.getKey()) |
| | | ||Constants.equalsInteger(insuranceApply.getStatus(), Constants.InsuranceApplyStatus.WTB_DONE.getKey()) |
| | | )) { |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(), "对不起,保单当前状态不支持该操作!"); |
| | | } |
| | | if (DateUtil.compareDate(insuranceApply.getEndTime(),new Date()) >= Constants.ZERO ) { |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "保单已过保,不支持该操作"); |
| | | } |
| | | Solutions solutions = solutionsMapper.selectById(insuranceApply.getSolutionId()); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到保险方案"); |
| | | } |
| | | // Date reduceEndTime = DateUtil.getMontageDate( |
| | | // DateUtil.afterDateByType(new Date(),0,solutions.getDelValidDays()),3); |
| | | |
| | | // Date reduceEndTime = DateUtil.getMontageDate(new Date(),3); |
| | | int index = Constants.TWO; |
| | | Map<String,String> idCardMap = new HashMap<>(); |
| | | for(MemberReduceImport model : dataList){ |
| | | //校验参数是否合法 |
| | | validReduceImportParam(model,idCardMap,index); |
| | | index += 1; |
| | | } |
| | | index = Constants.TWO; |
| | | for(MemberReduceImport model : dataList){ |
| | | ApplyDetail detail =applyDetailJoinMapper.selectJoinOne(ApplyDetail.class,new MPJLambdaWrapper<ApplyDetail>() |
| | | .selectAll(ApplyDetail.class) |
| | | .selectAs(Worktype::getName,ApplyDetail::getWorkTypeName) |
| | | .selectAs(DispatchUnit::getName,ApplyDetail::getDuName) |
| | | // .selectAs(InsuranceApply::getStartTime,ApplyDetail::getStartTime) |
| | | // .selectAs(InsuranceApply::getEndTime,ApplyDetail::getEndTime) |
| | | .selectAs(InsuranceApply::getServerCost,ApplyDetail::getDetailServerCost) |
| | | .leftJoin(Worktype.class,Worktype::getId,ApplyDetail::getWorktypeId) |
| | | .leftJoin(DispatchUnit.class,DispatchUnit::getId,ApplyDetail::getDuId) |
| | | .leftJoin(InsuranceApply.class,InsuranceApply::getId,ApplyDetail::getApplyId) |
| | | .eq(ApplyDetail::getApplyId,insuranceApply.getId()) |
| | | .eq(ApplyDetail::getApplyId,insuranceApply.getId()) |
| | | .eq(ApplyDetail::getIdcardNo,model.getIdCard()) |
| | | /* .le(ApplyDetail::getStartTime,DateUtil.getMontageDate(new Date(),1))*/ |
| | | .ge(ApplyDetail::getEndTime,DateUtil.getMontageDate(new Date(),3)) |
| | | .orderByAsc(ApplyDetail::getEndTime) |
| | | .last(" limit 1 ") |
| | | ); |
| | | if(detail == null){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,员工【" + model.getName()+model.getIdCard() + "】非在保人员,无法进行该操作"); |
| | | } |
| | | if(!StringUtils.equals(model.getName(), detail.getMemberName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,员工【" +model.getName()+ model.getIdCard() + "】与其登记在保记录姓名不一致,请核实填写正确再操作"); |
| | | } |
| | | if(!Constants.equalsInteger(Constants.ZERO, detail.getChangeStatus())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "当前保单下,员工【" +model.getName()+ model.getIdCard() + "】已进行过减保申请,不能再次进行该操作"); |
| | | } |
| | | model.setDuId(detail.getDuId()); |
| | | model.setDuName(detail.getDuName()); |
| | | model.setWorktypeId(detail.getWorktypeId()); |
| | | model.setMemberId(detail.getMemberId()); |
| | | model.setWorkTypeName(detail.getWorkTypeName()); |
| | | //如果当前日期 小于 人员保单明细记录的开始时间 则使用开始日期 开始日期 = 结束日期 且 费用全部退回 |
| | | if(System.currentTimeMillis()<=detail.getStartTime().getTime()){ |
| | | model.setFee(solutions.getPrice().multiply(new BigDecimal(-1))); |
| | | }else{ |
| | | Date reduceEndTime = DateUtil.getMontageDate( |
| | | DateUtil.afterDateByType(new Date(),0,solutions.getDelValidDays()),3); |
| | | model.setFee( |
| | | Constants.reduceFee(solutions, |
| | | Objects.isNull(detail.getDetailServerCost())?solutions.getPrice():solutions.getPrice().add(detail.getDetailServerCost()), |
| | | insuranceApply.getStartTime(), |
| | | insuranceApply.getEndTime(), |
| | | detail.getStartTime(), |
| | | reduceEndTime).subtract(detail.getFee())); |
| | | } |
| | | index += 1; |
| | | } |
| | | return dataList; |
| | | } |
| | | |
| | | private void validReduceImportParam(MemberReduceImport model, Map<String, String> idCardMap, int index) { |
| | | if(StringUtils.isBlank(model.getName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据姓名不能为空!"); |
| | | } |
| | | if(StringUtils.isBlank(model.getIdCard())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证号不能为空!"); |
| | | } |
| | | if(StringUtils.isBlank(model.getIdCard())||model.getIdCard().length()!=18){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证【"+model.getIdCard()+"】格式不正确!"); |
| | | } |
| | | if(!IdcardUtil.isValidCard(model.getIdCard())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证【"+model.getIdCard()+"】信息不正确!"); |
| | | } |
| | | if(Objects.nonNull(idCardMap.get(model.getIdCard()))){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,文档中第"+index+"行数据身份证号【"+model.getIdCard()+"】存在相同数据!"); |
| | | } |
| | | idCardMap.put(model.getIdCard(), model.getIdCard()); |
| | | } |
| | | @Override |
| | | public List<MemberImport> importBatch(MultipartFile file,Integer solutionId){ |
| | | if(solutionId == null ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请选择有效的方案再进行操作!"); |
| | | } |
| | | LoginUserInfo loginUserInfo = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(!loginUserInfo.getType().equals(Constants.ONE)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"非企业人员无法进行该操作"); |
| | | } |
| | | if(Objects.isNull(solutionId)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"参数错误 - 方案信息"); |
| | | } |
| | | Solutions solutions = solutionsMapper.selectById(solutionId); |
| | | if(Objects.isNull(solutions)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到方案信息"); |
| | | } |
| | | ExcelImporter ie = null; |
| | | List<MemberImport> dataList =null; |
| | | try { |
| | |
| | | if(dataList == null || dataList.size() ==0){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,录入数据为空!"); |
| | | } |
| | | List<String> idCardList = dataList.stream().map(m->m.getIdCard()).collect(Collectors.toList()); |
| | | Set<String> set = new HashSet<>(idCardList); |
| | | if(idCardList.size() != set.size()){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"对不起,录入数据存在身份证号相同数据!"); |
| | | int index = Constants.TWO; |
| | | Map<String,String> idCardMap = new HashMap<>(); |
| | | for(MemberImport model : dataList){ |
| | | //校验参数是否合法 |
| | | validImportParam(model,idCardMap,dataList,index,solutions); |
| | | index += 1; |
| | | } |
| | | List<DispatchUnit> dispatchUnitList = new ArrayList<>(); |
| | | if(!Objects.isNull(solutionId)){ |
| | | dispatchUnitList = dispatchUnitJoinMapper.selectJoinList(DispatchUnit.class, |
| | | List<SolutionWorktype> solutionWorktypeList = new ArrayList<>(); |
| | | //2024年11月6日15:39:10 加入 根据方案是否有保险方案进行判断 |
| | | if(Constants.equalsInteger(solutions.getHasDispatchUnit(),Constants.ZERO)){ |
| | | dispatchUnitList = dispatchUnitJoinMapper.selectJoinList(DispatchUnit.class, |
| | | new MPJLambdaWrapper<DispatchUnit>() |
| | | .selectAll(DispatchUnit.class) |
| | | .select("(select b.id from du_solution b where b.isdeleted=0 and b.dispatch_unit_id=t.id and b.solution_id="+solutionId+" limit 1) as du_solution_id" ) |
| | | .select("(select b.id from du_solution b where b.isdeleted=0 and b.dispatch_unit_id=t.id and b.solution_id="+solutionId+" order by b.CHECK_DATE desc limit 1) as du_solution_id" ) |
| | | .eq(DispatchUnit::getIsdeleted,Constants.ZERO) |
| | | .eq(DispatchUnit::getStatus,Constants.ZERO) |
| | | .eq(DispatchUnit::getDataType,Constants.TWO) |
| | |
| | | dispatchUnit.setWorktypeList(worktypeList); |
| | | } |
| | | } |
| | | }else{ |
| | | //方案不选择派遣单位情况下的业务 |
| | | solutionWorktypeList = solutionWorktypeJoinMapper.selectJoinList(SolutionWorktype.class, |
| | | new MPJLambdaWrapper<SolutionWorktype>() |
| | | .selectAll(SolutionWorktype.class) |
| | | .selectAs(Worktype::getName,SolutionWorktype::getWorktypeName) |
| | | .leftJoin(Worktype.class,Worktype::getId,SolutionWorktype::getWorktypeId) |
| | | .eq(SolutionWorktype::getSolutionId,solutions.getId()) |
| | | ); |
| | | if(CollectionUtils.isEmpty(solutionWorktypeList)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,保险方案下未查询到工种信息"); |
| | | } |
| | | } |
| | | long index = Constants.TWO; |
| | | |
| | | index = Constants.TWO; |
| | | for(MemberImport model : dataList){ |
| | | if(StringUtils.isBlank(model.getIdCard())||model.getIdCard().length()!=18){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证信息异常!"); |
| | | } |
| | | if(!IdcardUtil.isValidCard(model.getIdCard())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证信息异常!"); |
| | | } |
| | | if(StringUtils.isBlank(model.getName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据姓名信息异常!"); |
| | | } |
| | | index = index + Constants.ONE; |
| | | if(CollectionUtils.isNotEmpty(list)){ |
| | | Optional<Member> memberOptional= list.stream().filter(m->m.getIdcardNo().equals(model.getIdCard())).findFirst(); |
| | | if(memberOptional.isPresent()){ |
| | | Member member = memberOptional.get(); |
| | | model.setIdCard(member.getIdcardNo()); |
| | | model.setSex(member.getSex()); |
| | | }else{ |
| | | model.setSex(Constants.getSexByIdCard(model.getIdCard())); |
| | | } |
| | | }else{ |
| | | model.setSex(Constants.getSexByIdCard(model.getIdCard())); |
| | | } |
| | | if(StringUtils.isNotBlank(model.getDuName())&&CollectionUtils.isNotEmpty(dispatchUnitList)){ |
| | | //检查派遣单位和工种有效性 |
| | | dealDuAndWorktype(model,index,dispatchUnitList,solutions,solutionWorktypeList); |
| | | index += 1; |
| | | model.setSex(Constants.getSexByIdCard(model.getIdCard())); |
| | | } |
| | | return dataList; |
| | | } |
| | | |
| | | |
| | | private void dealDuAndWorktype(MemberImport model, int index, List<DispatchUnit> dispatchUnitList , Solutions solutions,List<SolutionWorktype> solutionWorktypeList) { |
| | | //2024年11月6日15:39:10 加入 根据方案是否有保险方案进行判断 |
| | | if(Constants.equalsInteger(solutions.getHasDispatchUnit(),Constants.ZERO)){ |
| | | if(CollectionUtils.isNotEmpty(dispatchUnitList)){ |
| | | Optional<DispatchUnit> dispatchUnitOptional= dispatchUnitList.stream().filter(m->m.getName().equals(model.getDuName())).findFirst(); |
| | | if(dispatchUnitOptional.isPresent()){ |
| | | DispatchUnit dispatchUnit = dispatchUnitOptional.get(); |
| | | model.setDuId(dispatchUnit.getId()); |
| | | if(StringUtils.isNotBlank(model.getWorkTypeName())&&CollectionUtils.isNotEmpty(dispatchUnit.getWorktypeList())){ |
| | | Optional<Worktype> worktypeOptional= dispatchUnit.getWorktypeList().stream().filter(m->m.getName().equals(model.getWorkTypeName())).findFirst(); |
| | | Optional<Worktype> worktypeOptional= dispatchUnit.getWorktypeList().stream().filter(m->m.getName().replaceAll(" ","").equals(model.getWorkTypeName().replaceAll(" ",""))).findFirst(); |
| | | if(worktypeOptional.isPresent()){ |
| | | Worktype worktype = worktypeOptional.get(); |
| | | model.setWorktypeId(worktype.getId()); |
| | |
| | | } |
| | | } |
| | | if(Objects.isNull(model.getDuId())){ |
| | | model.setWorkTypeName(null); |
| | | model.setDuName(null); |
| | | }else if(Objects.isNull(model.getWorktypeId())){ |
| | | model.setWorkTypeName(null); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据派遣单位【"+model.getDuName()+"】不正确!"); |
| | | } |
| | | }else{ |
| | | Optional<SolutionWorktype> worktypeOptional= solutionWorktypeList.stream().filter(m->m.getWorktypeName().replaceAll(" ","") |
| | | .equals(model.getWorkTypeName().replaceAll(" ",""))).findFirst(); |
| | | if(worktypeOptional.isPresent()){ |
| | | SolutionWorktype worktype = worktypeOptional.get(); |
| | | model.setWorktypeId(worktype.getId()); |
| | | } |
| | | } |
| | | return dataList; |
| | | if(Objects.isNull(model.getWorktypeId())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据工种【"+model.getWorkTypeName()+"】不正确!"); |
| | | } |
| | | } |
| | | |
| | | private void validImportParam(MemberImport model, Map<String, String> idCardMap, List<MemberImport> dataList,int index,Solutions solutions) { |
| | | if(StringUtils.isBlank(model.getName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据姓名不能为空!"); |
| | | } |
| | | if(StringUtils.isBlank(model.getIdCard())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证号不能为空!"); |
| | | } |
| | | //2024年11月6日15:39:10 加入 根据方案是否有保险方案进行判断 |
| | | if(Constants.equalsInteger(solutions.getHasDispatchUnit(),Constants.ZERO)){ |
| | | if(StringUtils.isBlank(model.getDuName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据派遣单位不能为空!"); |
| | | } |
| | | } |
| | | if(StringUtils.isBlank(model.getWorkTypeName())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据工种不能为空!"); |
| | | } |
| | | if(StringUtils.isBlank(model.getIdCard())||model.getIdCard().length()!=18){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证【"+model.getIdCard()+"】格式不正确!"); |
| | | } |
| | | if(!IdcardUtil.isValidCard(model.getIdCard())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第"+index+"行数据身份证【"+model.getIdCard()+"】信息不正确!"); |
| | | } |
| | | if(Objects.nonNull(idCardMap.get(model.getIdCard()))){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,文档中第"+index+"行数据身份证号【"+model.getIdCard()+"】存在相同数据!"); |
| | | } |
| | | idCardMap.put(model.getIdCard(), model.getIdCard()); |
| | | |
| | | } |
| | | |
| | | |