| | |
| | | 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; |
| | |
| | | if (user != null) { |
| | | 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(systemUserService.findList(zbUserNum).size()>=company.getUserNum()){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"对不起,已超出企业可分配主播数量,如有疑问请联系系统管理员!"); |
| | | } |
| | | } |
| | | SystemUser systemUser = new SystemUser(); |
| | | BeanUtils.copyProperties(createCompanyUserDTO,systemUser); |
| | | systemUser.setCompanyId(loginUserInfo.getCompanyId()); |