|  |  | 
 |  |  | import com.doumee.core.model.LoginUserInfo; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.core.utils.Utils; | 
 |  |  | import com.doumee.dao.business.model.Company; | 
 |  |  | import com.doumee.dao.system.dto.*; | 
 |  |  | import com.doumee.dao.system.model.SystemDepartment; | 
 |  |  | import com.doumee.dao.system.model.SystemDepartmentUser; | 
 |  |  | import com.doumee.dao.system.model.SystemUser; | 
 |  |  | import com.doumee.dao.system.model.SystemUserRole; | 
 |  |  | import com.doumee.service.business.CompanyService; | 
 |  |  | import com.doumee.service.system.*; | 
 |  |  | import org.apache.commons.lang3.RandomStringUtils; | 
 |  |  | import org.apache.commons.lang3.StringUtils; | 
 |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SystemUserService systemUserService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private CompanyService companyService; | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private SystemUserRoleService systemUserRoleService; | 
 |  |  | 
 |  |  |         queryUserDto.setDeleted(Boolean.FALSE); | 
 |  |  |         SystemUser user = systemUserService.findOne(queryUserDto); | 
 |  |  |         if (user != null) { | 
 |  |  |             throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "用户名已存在"); | 
 |  |  |             throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "登录账号已存在"); | 
 |  |  |         } | 
 |  |  |         // 验证工号 | 
 |  |  |        if (StringUtils.isNotBlank(systemUser.getEmpNo())) { | 
 |  |  | 
 |  |  |             queryUserDto.setDeleted(Boolean.FALSE); | 
 |  |  |             user = systemUserService.findOne(queryUserDto); | 
 |  |  |             if (user != null && !user.getId().equals(systemUser.getId())) { | 
 |  |  |                 throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "用户名已存在"); | 
 |  |  |                 throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "登录账号已存在"); | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |  | 
 |  |  | 
 |  |  |         queryUserDto.setDeleted(Boolean.FALSE); | 
 |  |  |         SystemUser user = systemUserService.findOne(queryUserDto); | 
 |  |  |         if (user != null) { | 
 |  |  |             throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "用户名已存在"); | 
 |  |  |             throw new BusinessException(ResponseStatus.DATA_EXISTS.getCode(), "登录账号已存在"); | 
 |  |  |         } | 
 |  |  |         if(createCompanyUserDTO.getType().equals(Constants.UserType.ZHUBO.getKey())){ | 
 |  |  |             Company company = companyService.findById(loginUserInfo.getCompanyId()); | 
 |  |  |             SystemUser zbUserNum = new SystemUser(); | 
 |  |  |             zbUserNum.setCompanyId(loginUserInfo.getCompanyId()); | 
 |  |  |             zbUserNum.setDeleted(Boolean.FALSE); | 
 |  |  |             zbUserNum.setType(Constants.UserType.ZHUBO.getKey()); | 
 |  |  |             if(!Objects.isNull(company.getUserNum())&&company.getUserNum()!=Constants.ZERO){ | 
 |  |  |                 if(systemUserService.findList(zbUserNum).size()>=company.getUserNum()){ | 
 |  |  |                     throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,已超出企业可分配主播数量,如有疑问请联系系统管理员!"); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         } | 
 |  |  |         SystemUser systemUser  = new SystemUser(); | 
 |  |  |         BeanUtils.copyProperties(createCompanyUserDTO,systemUser); |