|
|
@@ -15,6 +15,8 @@ import com.jzg.commons.entity.po.*;
|
|
|
import com.jzg.commons.entity.vo.SysSystemPermsVo;
|
|
|
import com.jzg.commons.entity.vo.SysSystemVo;
|
|
|
import com.jzg.commons.entity.vo.UpAndDownVo;
|
|
|
+import com.jzg.commons.exception.SystemException;
|
|
|
+import com.jzg.commons.util.AssertionUtils;
|
|
|
import com.jzg.commons.util.MinioUtils;
|
|
|
import com.jzg.commons.util.StringUtils;
|
|
|
import com.jzg.mapper.*;
|
|
|
@@ -260,8 +262,18 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
}else{
|
|
|
// 新增管理员用户
|
|
|
user = new SysUser(param);
|
|
|
+ // 用户名和手机号不允许重复
|
|
|
+ boolean mobileExists = this.isExistsMobile(user.getMobile());
|
|
|
+ if(mobileExists){
|
|
|
+ throw new SystemException("管理员手机号重复!");
|
|
|
+ }
|
|
|
+ boolean nameExists = this.isExistsUserName(user.getUsername());
|
|
|
+ if(nameExists){
|
|
|
+ throw new SystemException("管理员用户名重复!");
|
|
|
+ }
|
|
|
sysUserMapper.insert(user);
|
|
|
}
|
|
|
+
|
|
|
// 新增用户机构关联信息
|
|
|
SysUserJzgInfo info = new SysUserJzgInfo(user, sysSystem.getSysCode());
|
|
|
sysUserJzgInfoMapper.insert(info);
|
|
|
@@ -297,6 +309,20 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
this.updateById(sysSystem);
|
|
|
}
|
|
|
|
|
|
+ private boolean isExistsUserName(String username) {
|
|
|
+ long count = sysUserMapper.selectCount(new LambdaQueryWrapper<SysUser>()
|
|
|
+ .eq(SysUser::getUsername, username)
|
|
|
+ );
|
|
|
+ return count > 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ private boolean isExistsMobile(String mobile) {
|
|
|
+ long count = sysUserMapper.selectCount(new LambdaQueryWrapper<SysUser>()
|
|
|
+ .eq(SysUser::getMobile, mobile)
|
|
|
+ );
|
|
|
+ return count > 0;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 租户权限保存
|
|
|
* @param permsList 树形租户权限
|
|
|
@@ -326,9 +352,6 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
SysSystem sysSystem = new SysSystem();
|
|
|
BeanUtils.copyProperties(param, sysSystem);
|
|
|
updateById(sysSystem);
|
|
|
- SysSystem system = getById(sysSystem.getId());
|
|
|
- // 修改管理员信息
|
|
|
-
|
|
|
List<SysUser> userList = sysUserMapper.selectList(new LambdaQueryWrapper<SysUser>()
|
|
|
.eq(SysUser::getMobile, param.getUserAccount())
|
|
|
);
|
|
|
@@ -340,6 +363,14 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
}else{
|
|
|
// 新增管理员用户
|
|
|
sysUser = new SysUser(param);
|
|
|
+ boolean mobileExists = this.isExistsMobile(sysUser.getMobile());
|
|
|
+ if(mobileExists){
|
|
|
+ throw new SystemException("管理员手机号重复!");
|
|
|
+ }
|
|
|
+ boolean nameExists = this.isExistsUserName(sysUser.getUsername());
|
|
|
+ if(nameExists){
|
|
|
+ throw new SystemException("管理员用户名重复!");
|
|
|
+ }
|
|
|
sysUserMapper.insert(sysUser);
|
|
|
// 新增用户机构关联信息
|
|
|
SysUserJzgInfo info = new SysUserJzgInfo(sysUser,sysSystem.getSysCode());
|
|
|
@@ -401,10 +432,10 @@ public class SysSystemServiceImpl extends ServiceImpl<SysSystemMapper, SysSystem
|
|
|
return errorStr;
|
|
|
}
|
|
|
|
|
|
- Long count = sysUserPlateInfoMapper.selectCount(new LambdaQueryWrapper<SysUserPlateInfo>()
|
|
|
- .eq(SysUserPlateInfo::getSystemCode, sysSystem.getSysCode())
|
|
|
- .eq(SysUserPlateInfo::getIsEnable, 1)
|
|
|
- .eq(SysUserPlateInfo::getIsDelete, 0));
|
|
|
+ Long count = sysUserJzgInfoMapper.selectCount(new LambdaQueryWrapper<SysUserJzgInfo>()
|
|
|
+ .eq(SysUserJzgInfo::getSystemCode, sysSystem.getSysCode())
|
|
|
+ .eq(SysUserJzgInfo::getIsEnable, 0)
|
|
|
+ .eq(SysUserJzgInfo::getIsDelete, 0));
|
|
|
|
|
|
if(count > 0){
|
|
|
errorStr = "租户["+sysSystem.getSysName()+"]还有部分员工,请将这些员工变更机构或者删除后,再进行删除!";
|