From 9c20f268e0628017d09427989724cdf2a8e9e8e2 Mon Sep 17 00:00:00 2001 From: jiaosong <jiaosong6760@dingtalk.com> Date: 星期二, 19 九月 2023 12:47:08 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev --- server/service/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-) diff --git a/server/service/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java b/server/service/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java index 04ea0cb..dee67ff 100644 --- a/server/service/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java +++ b/server/service/src/main/java/com/doumee/biz/system/impl/SystemUserBizImpl.java @@ -7,11 +7,13 @@ 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; @@ -32,6 +34,9 @@ @Autowired private SystemUserService systemUserService; + + @Autowired + private CompanyService companyService; @Autowired private SystemUserRoleService systemUserRoleService; @@ -247,6 +252,16 @@ 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()); -- Gitblit v1.9.3