|  |  |  | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,第【"+index+"】行【手机号】员工账号已经存!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cuu.setPhone(null); | 
|---|
|  |  |  | cuu.setCode(p.getNo()); | 
|---|
|  |  |  | if(companyUserService.findOne(cuu) !=null){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,第【"+index+"】行【工号】已经存!"); | 
|---|
|  |  |  | if (StringUtils.isNotBlank(p.getNo())){ | 
|---|
|  |  |  | cuu.setCode(p.getNo()); | 
|---|
|  |  |  | if(companyUserService.findOne(cuu) !=null){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "对不起,第【"+index+"】行【工号】已经存!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SystemUser systemUser = new SystemUser(); | 
|---|
|  |  |  | systemUser.setUsername(cu.getPhone()); | 
|---|
|  |  |  | systemUser.setDeleted(Boolean.FALSE); | 
|---|
|  |  |  | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "手机号已存在!"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cu.setCode(systemUser.getEmpNo()); | 
|---|
|  |  |  | if(companyUserService.findOne(cu) !=null){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号已存在"); | 
|---|
|  |  |  | //存在工号需要唯一判断 | 
|---|
|  |  |  | if (StringUtils.isNotBlank(systemUser.getEmpNo())){ | 
|---|
|  |  |  | cu.setCode(systemUser.getEmpNo()); | 
|---|
|  |  |  | if(companyUserService.findOne(cu) !=null){ | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | cu.setUserId(userId); | 
|---|
|  |  |  | cu.setComDepartId(loginUser.getComDepartment().getId()); | 
|---|
|  |  |  | cu.setCreateUser(loginUser.getId()); | 
|---|
|  |  |  | 
|---|
|  |  |  | if (codeUser != null && !codeUser.getId().equals(cu.getId())) { | 
|---|
|  |  |  | throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "工号已存在"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else if (StringUtils.isBlank(systemUser.getEmpNo())) { | 
|---|
|  |  |  | u.setCode(systemUser.getEmpNo()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | u.setId(cu.getId()); | 
|---|
|  |  |  | u.setName(systemUser.getRealname()); | 
|---|