| | |
| | | .apply(" t1.BASE_ID in ( select du.id from dispatch_unit du where du.STATUS = 0 and du.ISDELETED = 0 ) ") |
| | | ); |
| | | if(!CollectionUtils.isNotEmpty(duSolutionList)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"数据异常:保险方案下未查询到派遣单位"); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,保险方案下未查询到派遣单位信息,请确保派遣单位和工作配置并审核通过!"); |
| | | } |
| | | //查询所有派遣单位下的工种 |
| | | List<Integer> duSolutionIdList = duSolutionList.stream().map(i->i.getId()).collect(Collectors.toList()); |
| | |
| | | .eq(checkNewData,Worktype::getDataType,Constants.TWO) |
| | | .in(DuWorktype::getDuSolutionId,duSolutionIdList)); |
| | | if(!CollectionUtils.isNotEmpty(duWorktypeList)){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"数据异常:保险方案下未查询到工种信息"); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,保险方案下未查询到工种信息,请确保派遣单位和工作配置并审核通过!"); |
| | | } |
| | | |
| | | if(CollectionUtils.isNotEmpty(applyDetailList)){ |
| | |
| | | member.setCompanyId(insuranceApply.getCompanyId()); |
| | | member.setSex(Constants.getSexByIdCard(applyDetail.getIdcardNo())); |
| | | if(!IdcardUtil.isValidCard(applyDetail.getIdcardNo())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保员工信息身份证信息错误["+member.getName()+"]"); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,投保员工【"+member.getName()+"】身份证信息【"+applyDetail.getIdcardNo()+"】错误"); |
| | | } |
| | | member.setIdcardNo(applyDetail.getIdcardNo()); |
| | | member.setApplyId(insuranceApply.getId()); |
| | |
| | | ||Objects.isNull(applyDetail.getDuId()) |
| | | ||Objects.isNull(applyDetail.getWorktypeId()) |
| | | ){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保员工信息数据缺失"); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,投保员工信息数据缺失,请按照要求填写员工的有效信息!"); |
| | | } |
| | | applyDetail.setCreateDate(new Date()); |
| | | applyDetail.setCreator(loginUserInfo.getId()); |
| | |
| | | //获取计算总天数 |
| | | Integer maxDays = DateUtil.calculateBetween(applyDetail.getStartTime(),applyDetail.getEndTime(),0); |
| | | if(Constants.equalsInteger(maxDays,0)||Objects.isNull(applyDetail.getFee())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保信息异常:总天数与总金额错误"); |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"投保信息异常:投保总天数与总金额错误"); |
| | | } |
| | | applyDetail.setPrice( |
| | | applyDetail.getFee().divide(new BigDecimal(maxDays),7,RoundingMode.HALF_UP) |
| | | ); |
| | | //验证派遣单位信息是否存在 |
| | | if(duSolutionList.stream().filter(d->d.getDispatchUnitId().equals(applyDetail.getDuId())).collect(Collectors.toList()).size()<=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工派遣单位未查询到!"); |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+applyDetail.getIdcardNo()+"】员工派遣单位未查询到!"); |
| | | } |
| | | if(duWorktypeList.stream().filter(d->d.getWorkTypeId().equals(applyDetail.getWorktypeId())) |
| | | .collect(Collectors.toList()).size()<=Constants.ZERO){ |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+"】员工工种信息未查询到!"); |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"【"+applyDetail.getMemberName()+applyDetail.getIdcardNo()+"】员工工种信息未查询到!"); |
| | | } |
| | | } |
| | | applyDetailJoinMapper.insertBatchSomeColumn(applyDetailList); |