From d3ee2de7d4b60b573842b1c7f31e755c854df0d4 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期一, 11 九月 2023 09:28:05 +0800
Subject: [PATCH] 小程序菜单
---
server/src/main/java/doumeemes/biz/system/impl/SystemUserBizImpl.java | 32 ++++++++++++++++++++++++++------
1 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/server/src/main/java/doumeemes/biz/system/impl/SystemUserBizImpl.java b/server/src/main/java/doumeemes/biz/system/impl/SystemUserBizImpl.java
index e3ac14e..f6ea8f1 100644
--- a/server/src/main/java/doumeemes/biz/system/impl/SystemUserBizImpl.java
+++ b/server/src/main/java/doumeemes/biz/system/impl/SystemUserBizImpl.java
@@ -10,6 +10,7 @@
import doumeemes.core.utils.DateUtil;
import doumeemes.core.utils.Utils;
import doumeemes.core.utils.excel.EasyExcelUtil;
+import doumeemes.dao.business.CompanyMapper;
import doumeemes.dao.business.CompanyPositionMapper;
import doumeemes.dao.business.dto.AutoLoginUserDTO;
import doumeemes.dao.business.dto.CompanyInitDataDTO;
@@ -78,6 +79,9 @@
private DepartmentExtService departmentExtService;
@Autowired
private CompanyUserExtMapper companyUserExtMapper;
+
+ @Autowired
+ private CompanyMapper companyMapper;
@Override
public void deleteById(Integer id) {
@@ -162,6 +166,18 @@
if(plansList == null || plansList.size()==0){
throw new BusinessException(ResponseStatus.SERVER_ERROR.getCode(), "瀵煎叆鏁版嵁鍐呭鏈夎锛�");
}
+ //娣诲姞浼佷笟鍛樺伐鍏宠仈鍏崇郴
+ CompanyUser cuw = new CompanyUser();
+ cuw.setDeleted(Constants.ZERO);
+ cuw.setRootDepartId(user.getRootDepartment().getId());
+ Company company = companyMapper.selectById(user.getCompany().getId());
+ if(company.getOpenUserNum() > 0){
+ //浜烘暟闄愬埗杈撳叆0锛岃〃绀轰笉闄愬埗浜烘暟
+ if(companyUserExtMapper.selectCount(new QueryWrapper<>(cuw)) + plansList.size() > company.getOpenUserNum() ){
+ throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛鏁伴噺瓒呰繃璐拱鏁伴噺锛岃鑱旂郴涓氬姟缁忕悊缁喘!");
+ }
+ }
+
CompanyPosition cp = new CompanyPosition();
cp.setDeleted(Constants.ZERO);
cp.setCompanyId(user.getCompany().getId());
@@ -213,10 +229,13 @@
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);
@@ -543,10 +562,11 @@
cu.setDeleted(Constants.ZERO);
cu.setRootDepartId(loginUser.getRootDepartment().getId());
//闄愬埗浜烘暟
- int limitUserNum = Constants.formatIntegerNum(loginUser.getCompany().getOpenUserNum());
- if(limitUserNum > 0){
+// int limitUserNum = Constants.formatIntegerNum(loginUser.getCompany().getOpenUserNum());
+ Company company = companyMapper.selectById(loginUser.getCompany().getId());
+ if(company.getOpenUserNum() > 0){
//浜烘暟闄愬埗杈撳叆0锛岃〃绀轰笉闄愬埗浜烘暟
- if(companyUserExtMapper.selectCount(new QueryWrapper<>(cu)) +1 > limitUserNum ){
+ if(companyUserExtMapper.selectCount(new QueryWrapper<>(cu)) +1 > company.getOpenUserNum() ){
throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"鐢ㄦ埛鏁伴噺瓒呰繃璐拱鏁伴噺锛岃鑱旂郴涓氬姟缁忕悊缁喘!");
}
}
--
Gitblit v1.9.3