|
@@ -29,6 +29,7 @@ import cn.hutool.core.lang.tree.TreeNode;
|
|
import cn.hutool.core.lang.tree.TreeUtil;
|
|
import cn.hutool.core.lang.tree.TreeUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
import cn.hutool.core.util.PhoneUtil;
|
|
import cn.hutool.core.util.PhoneUtil;
|
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.core.util.StrUtil;
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONObject;
|
|
import cn.hutool.json.JSONUtil;
|
|
import cn.hutool.json.JSONUtil;
|
|
@@ -65,16 +66,21 @@ import vip.xiaonuo.biz.modular.user.enums.BizRoleCategoryEnum;
|
|
import vip.xiaonuo.biz.modular.user.enums.BizUserStatusEnum;
|
|
import vip.xiaonuo.biz.modular.user.enums.BizUserStatusEnum;
|
|
import vip.xiaonuo.biz.modular.user.mapper.BizUserMapper;
|
|
import vip.xiaonuo.biz.modular.user.mapper.BizUserMapper;
|
|
import vip.xiaonuo.biz.modular.user.param.*;
|
|
import vip.xiaonuo.biz.modular.user.param.*;
|
|
|
|
+import vip.xiaonuo.biz.modular.user.result.BizMemberUserResult;
|
|
import vip.xiaonuo.biz.modular.user.result.BizUserExportResult;
|
|
import vip.xiaonuo.biz.modular.user.result.BizUserExportResult;
|
|
import vip.xiaonuo.biz.modular.user.result.BizUserRoleResult;
|
|
import vip.xiaonuo.biz.modular.user.result.BizUserRoleResult;
|
|
import vip.xiaonuo.biz.modular.user.service.BizUserService;
|
|
import vip.xiaonuo.biz.modular.user.service.BizUserService;
|
|
|
|
+import vip.xiaonuo.common.cache.CommonCacheOperator;
|
|
|
|
+import vip.xiaonuo.common.enums.CommonDeleteFlagEnum;
|
|
import vip.xiaonuo.common.enums.CommonSortOrderEnum;
|
|
import vip.xiaonuo.common.enums.CommonSortOrderEnum;
|
|
import vip.xiaonuo.common.excel.CommonExcelCustomMergeStrategy;
|
|
import vip.xiaonuo.common.excel.CommonExcelCustomMergeStrategy;
|
|
import vip.xiaonuo.common.exception.CommonException;
|
|
import vip.xiaonuo.common.exception.CommonException;
|
|
import vip.xiaonuo.common.listener.CommonDataChangeEventCenter;
|
|
import vip.xiaonuo.common.listener.CommonDataChangeEventCenter;
|
|
import vip.xiaonuo.common.page.CommonPageRequest;
|
|
import vip.xiaonuo.common.page.CommonPageRequest;
|
|
|
|
+import vip.xiaonuo.common.pojo.CommonEntity;
|
|
import vip.xiaonuo.common.util.*;
|
|
import vip.xiaonuo.common.util.*;
|
|
import vip.xiaonuo.dev.api.DevConfigApi;
|
|
import vip.xiaonuo.dev.api.DevConfigApi;
|
|
|
|
+import vip.xiaonuo.dev.api.DevSmsApi;
|
|
import vip.xiaonuo.sys.api.SysRoleApi;
|
|
import vip.xiaonuo.sys.api.SysRoleApi;
|
|
import vip.xiaonuo.sys.api.SysUserApi;
|
|
import vip.xiaonuo.sys.api.SysUserApi;
|
|
|
|
|
|
@@ -117,6 +123,12 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
@Resource
|
|
@Resource
|
|
private BizPositionService bizPositionService;
|
|
private BizPositionService bizPositionService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private CommonCacheOperator commonCacheOperator;
|
|
|
|
+ @Resource
|
|
|
|
+ private DevSmsApi devSmsApi;
|
|
|
|
+
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public Page<BizUser> page(BizUserPageParam bizUserPageParam) {
|
|
public Page<BizUser> page(BizUserPageParam bizUserPageParam) {
|
|
QueryWrapper<BizUser> queryWrapper = new QueryWrapper<BizUser>().checkSqlInjection();
|
|
QueryWrapper<BizUser> queryWrapper = new QueryWrapper<BizUser>().checkSqlInjection();
|
|
@@ -139,9 +151,11 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
}
|
|
}
|
|
// 排除超管
|
|
// 排除超管
|
|
queryWrapper.lambda().ne(BizUser::getAccount, BizBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue());
|
|
queryWrapper.lambda().ne(BizUser::getAccount, BizBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue());
|
|
|
|
+ //排除会员
|
|
|
|
+ queryWrapper.lambda().ne(BizUser::getUserType, 3);
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
queryWrapper.lambda().in(BizUser::getOrgId, loginUserDataScope);
|
|
queryWrapper.lambda().in(BizUser::getOrgId, loginUserDataScope);
|
|
} else {
|
|
} else {
|
|
queryWrapper.lambda().eq(BizUser::getId, StpUtil.getLoginIdAsString());
|
|
queryWrapper.lambda().eq(BizUser::getId, StpUtil.getLoginIdAsString());
|
|
@@ -149,12 +163,28 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
return this.page(CommonPageRequest.defaultPage(), queryWrapper);
|
|
return this.page(CommonPageRequest.defaultPage(), queryWrapper);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public Page<BizMemberUserResult> memberPage(BizUserPageParam bizUserPageParam) {
|
|
|
|
+ QueryWrapper<BizUser> queryWrapper = new QueryWrapper<BizUser>().checkSqlInjection();
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserPageParam.getSearchKey())) {
|
|
|
|
+ queryWrapper.lambda().and(q -> q.like(BizUser::getAccount, bizUserPageParam.getSearchKey())
|
|
|
|
+ .or().like(BizUser::getName, bizUserPageParam.getSearchKey()));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserPageParam.getUserStatus())) {
|
|
|
|
+ queryWrapper.lambda().eq(BizUser::getUserStatus, bizUserPageParam.getUserStatus());
|
|
|
|
+ }
|
|
|
|
+ queryWrapper.lambda().eq(BizUser::getUserType, 3);
|
|
|
|
+ queryWrapper.lambda().eq(CommonEntity::getDeleteFlag, CommonDeleteFlagEnum.NOT_DELETE);
|
|
|
|
+ queryWrapper.lambda().orderByDesc(CommonEntity::getCreateTime);
|
|
|
|
+ return baseMapper.memberPage(CommonPageRequest.defaultPage(), queryWrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Override
|
|
@Override
|
|
public void add(BizUserAddParam bizUserAddParam) {
|
|
public void add(BizUserAddParam bizUserAddParam) {
|
|
checkParam(bizUserAddParam);
|
|
checkParam(bizUserAddParam);
|
|
BizUser bizUser = BeanUtil.toBean(bizUserAddParam, BizUser.class);
|
|
BizUser bizUser = BeanUtil.toBean(bizUserAddParam, BizUser.class);
|
|
- if(ObjectUtil.isEmpty(bizUser.getAvatar())) {
|
|
|
|
|
|
+ if (ObjectUtil.isEmpty(bizUser.getAvatar())) {
|
|
// 设置默认头像
|
|
// 设置默认头像
|
|
bizUser.setAvatar(CommonAvatarUtil.generateImg(bizUser.getName()));
|
|
bizUser.setAvatar(CommonAvatarUtil.generateImg(bizUser.getName()));
|
|
}
|
|
}
|
|
@@ -171,8 +201,8 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
private void checkParam(BizUserAddParam bizUserAddParam) {
|
|
private void checkParam(BizUserAddParam bizUserAddParam) {
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
- if(!loginUserDataScope.contains(bizUserAddParam.getOrgId())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
+ if (!loginUserDataScope.contains(bizUserAddParam.getOrgId())) {
|
|
throw new CommonException("您没有权限在该机构下增加人员,机构id:{}", bizUserAddParam.getOrgId());
|
|
throw new CommonException("您没有权限在该机构下增加人员,机构id:{}", bizUserAddParam.getOrgId());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -182,8 +212,8 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
.eq(BizUser::getAccount, bizUserAddParam.getAccount())) > 0) {
|
|
.eq(BizUser::getAccount, bizUserAddParam.getAccount())) > 0) {
|
|
throw new CommonException("存在重复的账号,账号为:{}", bizUserAddParam.getAccount());
|
|
throw new CommonException("存在重复的账号,账号为:{}", bizUserAddParam.getAccount());
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotEmpty(bizUserAddParam.getPhone())) {
|
|
|
|
- if(!PhoneUtil.isMobile(bizUserAddParam.getPhone())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserAddParam.getPhone())) {
|
|
|
|
+ if (!PhoneUtil.isMobile(bizUserAddParam.getPhone())) {
|
|
throw new CommonException("手机号码:{}格式错误", bizUserAddParam.getPhone());
|
|
throw new CommonException("手机号码:{}格式错误", bizUserAddParam.getPhone());
|
|
}
|
|
}
|
|
if (this.count(new LambdaQueryWrapper<BizUser>()
|
|
if (this.count(new LambdaQueryWrapper<BizUser>()
|
|
@@ -191,8 +221,8 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
throw new CommonException("存在重复的手机号,手机号为:{}", bizUserAddParam.getPhone());
|
|
throw new CommonException("存在重复的手机号,手机号为:{}", bizUserAddParam.getPhone());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotEmpty(bizUserAddParam.getEmail())) {
|
|
|
|
- if(!CommonEmailUtil.isEmail(bizUserAddParam.getEmail())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserAddParam.getEmail())) {
|
|
|
|
+ if (!CommonEmailUtil.isEmail(bizUserAddParam.getEmail())) {
|
|
throw new CommonException("邮箱:{}格式错误", bizUserAddParam.getEmail());
|
|
throw new CommonException("邮箱:{}格式错误", bizUserAddParam.getEmail());
|
|
}
|
|
}
|
|
if (this.count(new LambdaQueryWrapper<BizUser>()
|
|
if (this.count(new LambdaQueryWrapper<BizUser>()
|
|
@@ -209,7 +239,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
checkParam(bizUserEditParam);
|
|
checkParam(bizUserEditParam);
|
|
boolean updateSuperAdminAccount = bizUser.getAccount().equals(BizBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue()) &&
|
|
boolean updateSuperAdminAccount = bizUser.getAccount().equals(BizBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue()) &&
|
|
!bizUserEditParam.getAccount().equals(BizBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue());
|
|
!bizUserEditParam.getAccount().equals(BizBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue());
|
|
- if(updateSuperAdminAccount) {
|
|
|
|
|
|
+ if (updateSuperAdminAccount) {
|
|
throw new CommonException("不可修改系统内置超管人员账号");
|
|
throw new CommonException("不可修改系统内置超管人员账号");
|
|
}
|
|
}
|
|
BeanUtil.copyProperties(bizUserEditParam, bizUser);
|
|
BeanUtil.copyProperties(bizUserEditParam, bizUser);
|
|
@@ -222,12 +252,12 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
private void checkParam(BizUserEditParam bizUserEditParam) {
|
|
private void checkParam(BizUserEditParam bizUserEditParam) {
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
- if(!loginUserDataScope.contains(bizUserEditParam.getOrgId())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
+ if (!loginUserDataScope.contains(bizUserEditParam.getOrgId())) {
|
|
throw new CommonException("您没有权限编辑该机构下的人员,机构id:{}", bizUserEditParam.getOrgId());
|
|
throw new CommonException("您没有权限编辑该机构下的人员,机构id:{}", bizUserEditParam.getOrgId());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if(!bizUserEditParam.getId().equals(StpUtil.getLoginIdAsString())) {
|
|
|
|
|
|
+ if (!bizUserEditParam.getId().equals(StpUtil.getLoginIdAsString())) {
|
|
throw new CommonException("您没有权限编辑该机构下的人员,机构id:{}", bizUserEditParam.getOrgId());
|
|
throw new CommonException("您没有权限编辑该机构下的人员,机构id:{}", bizUserEditParam.getOrgId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -236,8 +266,8 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
.ne(BizUser::getId, bizUserEditParam.getId())) > 0) {
|
|
.ne(BizUser::getId, bizUserEditParam.getId())) > 0) {
|
|
throw new CommonException("存在重复的账号,账号为:{}", bizUserEditParam.getAccount());
|
|
throw new CommonException("存在重复的账号,账号为:{}", bizUserEditParam.getAccount());
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotEmpty(bizUserEditParam.getPhone())) {
|
|
|
|
- if(!PhoneUtil.isMobile(bizUserEditParam.getPhone())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserEditParam.getPhone())) {
|
|
|
|
+ if (!PhoneUtil.isMobile(bizUserEditParam.getPhone())) {
|
|
throw new CommonException("手机号码:{}格式错误", bizUserEditParam.getPhone());
|
|
throw new CommonException("手机号码:{}格式错误", bizUserEditParam.getPhone());
|
|
}
|
|
}
|
|
if (this.count(new LambdaQueryWrapper<BizUser>()
|
|
if (this.count(new LambdaQueryWrapper<BizUser>()
|
|
@@ -246,8 +276,8 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
throw new CommonException("存在重复的手机号,手机号为:{}", bizUserEditParam.getPhone());
|
|
throw new CommonException("存在重复的手机号,手机号为:{}", bizUserEditParam.getPhone());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotEmpty(bizUserEditParam.getEmail())) {
|
|
|
|
- if(!CommonEmailUtil.isEmail(bizUserEditParam.getEmail())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserEditParam.getEmail())) {
|
|
|
|
+ if (!CommonEmailUtil.isEmail(bizUserEditParam.getEmail())) {
|
|
throw new CommonException("邮箱:{}格式错误", bizUserEditParam.getEmail());
|
|
throw new CommonException("邮箱:{}格式错误", bizUserEditParam.getEmail());
|
|
}
|
|
}
|
|
if (this.count(new LambdaQueryWrapper<BizUser>()
|
|
if (this.count(new LambdaQueryWrapper<BizUser>()
|
|
@@ -262,23 +292,23 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
@Override
|
|
@Override
|
|
public void delete(List<BizUserIdParam> bizUserIdParamList) {
|
|
public void delete(List<BizUserIdParam> bizUserIdParamList) {
|
|
List<String> bizUserIdList = CollStreamUtil.toList(bizUserIdParamList, BizUserIdParam::getId);
|
|
List<String> bizUserIdList = CollStreamUtil.toList(bizUserIdParamList, BizUserIdParam::getId);
|
|
- if(ObjectUtil.isNotEmpty(bizUserIdList)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserIdList)) {
|
|
boolean containsSuperAdminAccount = this.listByIds(bizUserIdList).stream().map(BizUser::getAccount)
|
|
boolean containsSuperAdminAccount = this.listByIds(bizUserIdList).stream().map(BizUser::getAccount)
|
|
.collect(Collectors.toSet()).contains(BizBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue());
|
|
.collect(Collectors.toSet()).contains(BizBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue());
|
|
- if(containsSuperAdminAccount) {
|
|
|
|
|
|
+ if (containsSuperAdminAccount) {
|
|
throw new CommonException("不可删除系统内置超管人员");
|
|
throw new CommonException("不可删除系统内置超管人员");
|
|
}
|
|
}
|
|
// 获取这些人员的的机构id集合
|
|
// 获取这些人员的的机构id集合
|
|
Set<String> userOrgIdList = this.listByIds(bizUserIdList).stream().map(BizUser::getOrgId).collect(Collectors.toSet());
|
|
Set<String> userOrgIdList = this.listByIds(bizUserIdList).stream().map(BizUser::getOrgId).collect(Collectors.toSet());
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
- if(!loginUserDataScope.containsAll(userOrgIdList)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
+ if (!loginUserDataScope.containsAll(userOrgIdList)) {
|
|
throw new CommonException("您没有权限删除这些机构下的人员,机构id:{}",
|
|
throw new CommonException("您没有权限删除这些机构下的人员,机构id:{}",
|
|
CollectionUtil.subtract(userOrgIdList, loginUserDataScope));
|
|
CollectionUtil.subtract(userOrgIdList, loginUserDataScope));
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if(bizUserIdList.size() != 1 || !bizUserIdList.get(0).equals(StpUtil.getLoginIdAsString())) {
|
|
|
|
|
|
+ if (bizUserIdList.size() != 1 || !bizUserIdList.get(0).equals(StpUtil.getLoginIdAsString())) {
|
|
throw new CommonException("您没有权限删除这些机构下的人员,机构id:{}", userOrgIdList);
|
|
throw new CommonException("您没有权限删除这些机构下的人员,机构id:{}", userOrgIdList);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -286,7 +316,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
this.update(new LambdaUpdateWrapper<BizUser>().in(BizUser::getDirectorId, bizUserIdList).set(BizUser::getDirectorId, null));
|
|
this.update(new LambdaUpdateWrapper<BizUser>().in(BizUser::getDirectorId, bizUserIdList).set(BizUser::getDirectorId, null));
|
|
|
|
|
|
// 清除【将这些人员作为兼任岗位的主管】的信息
|
|
// 清除【将这些人员作为兼任岗位的主管】的信息
|
|
- this.list(new LambdaQueryWrapper<BizUser>() .isNotNull(BizUser::getPositionJson)).forEach(bizUser -> {
|
|
|
|
|
|
+ this.list(new LambdaQueryWrapper<BizUser>().isNotNull(BizUser::getPositionJson)).forEach(bizUser -> {
|
|
List<JSONObject> handledJsonObjectList = JSONUtil.toList(JSONUtil.parseArray(bizUser.getPositionJson()),
|
|
List<JSONObject> handledJsonObjectList = JSONUtil.toList(JSONUtil.parseArray(bizUser.getPositionJson()),
|
|
JSONObject.class).stream().peek(jsonObject -> {
|
|
JSONObject.class).stream().peek(jsonObject -> {
|
|
String directorId = jsonObject.getStr("directorId");
|
|
String directorId = jsonObject.getStr("directorId");
|
|
@@ -320,12 +350,12 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
BizUser bizUser = this.detail(bizUserIdParam);
|
|
BizUser bizUser = this.detail(bizUserIdParam);
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
- if(!loginUserDataScope.contains(bizUser.getOrgId())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
+ if (!loginUserDataScope.contains(bizUser.getOrgId())) {
|
|
throw new CommonException("您没有权限禁用该机构下的人员:{},机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
throw new CommonException("您没有权限禁用该机构下的人员:{},机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if(!bizUser.getId().equals(StpUtil.getLoginIdAsString())) {
|
|
|
|
|
|
+ if (!bizUser.getId().equals(StpUtil.getLoginIdAsString())) {
|
|
throw new CommonException("您没有权限禁用该机构下的人员:{},机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
throw new CommonException("您没有权限禁用该机构下的人员:{},机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -339,12 +369,12 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
BizUser bizUser = this.detail(bizUserIdParam);
|
|
BizUser bizUser = this.detail(bizUserIdParam);
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
- if(!loginUserDataScope.contains(bizUser.getOrgId())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
+ if (!loginUserDataScope.contains(bizUser.getOrgId())) {
|
|
throw new CommonException("您没有权限启用该机构下的人员:{},机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
throw new CommonException("您没有权限启用该机构下的人员:{},机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if(!bizUser.getId().equals(StpUtil.getLoginIdAsString())) {
|
|
|
|
|
|
+ if (!bizUser.getId().equals(StpUtil.getLoginIdAsString())) {
|
|
throw new CommonException("您没有权限启用该机构下的人员:{},机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
throw new CommonException("您没有权限启用该机构下的人员:{},机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -358,12 +388,12 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
BizUser bizUser = this.detail(bizUserIdParam);
|
|
BizUser bizUser = this.detail(bizUserIdParam);
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
- if(!loginUserDataScope.contains(bizUser.getOrgId())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
+ if (!loginUserDataScope.contains(bizUser.getOrgId())) {
|
|
throw new CommonException("您没有权限为该机构下的人员:{}重置密码,机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
throw new CommonException("您没有权限为该机构下的人员:{}重置密码,机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if(!bizUser.getId().equals(StpUtil.getLoginIdAsString())) {
|
|
|
|
|
|
+ if (!bizUser.getId().equals(StpUtil.getLoginIdAsString())) {
|
|
throw new CommonException("您没有权限为该机构下的人员:{}重置密码,机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
throw new CommonException("您没有权限为该机构下的人员:{}重置密码,机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -383,12 +413,12 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
BizUser bizUser = this.queryEntity(bizUserGrantRoleParam.getId());
|
|
BizUser bizUser = this.queryEntity(bizUserGrantRoleParam.getId());
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
- if(!loginUserDataScope.contains(bizUser.getOrgId())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
+ if (!loginUserDataScope.contains(bizUser.getOrgId())) {
|
|
throw new CommonException("您没有权限为该机构下的人员:{}授权角色,机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
throw new CommonException("您没有权限为该机构下的人员:{}授权角色,机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- if(!bizUser.getId().equals(StpUtil.getLoginIdAsString())) {
|
|
|
|
|
|
+ if (!bizUser.getId().equals(StpUtil.getLoginIdAsString())) {
|
|
throw new CommonException("您没有权限为该机构下的人员:{}授权角色,机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
throw new CommonException("您没有权限为该机构下的人员:{}授权角色,机构id:{}", bizUser.getName(), bizUser.getOrgId());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -404,12 +434,12 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
queryWrapper.lambda().ne(BizUser::getAccount, BizBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue());
|
|
queryWrapper.lambda().ne(BizUser::getAccount, BizBuildInEnum.BUILD_IN_USER_ACCOUNT.getValue());
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
queryWrapper.lambda().in(BizUser::getOrgId, loginUserDataScope);
|
|
queryWrapper.lambda().in(BizUser::getOrgId, loginUserDataScope);
|
|
} else {
|
|
} else {
|
|
queryWrapper.lambda().eq(BizUser::getId, StpUtil.getLoginIdAsString());
|
|
queryWrapper.lambda().eq(BizUser::getId, StpUtil.getLoginIdAsString());
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotEmpty(bizUserExportParam.getUserIds())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserExportParam.getUserIds())) {
|
|
queryWrapper.lambda().in(BizUser::getId, StrUtil.split(bizUserExportParam.getUserIds(), StrUtil.COMMA));
|
|
queryWrapper.lambda().in(BizUser::getId, StrUtil.split(bizUserExportParam.getUserIds(), StrUtil.COMMA));
|
|
} else {
|
|
} else {
|
|
if (ObjectUtil.isNotEmpty(bizUserExportParam.getSearchKey())) {
|
|
if (ObjectUtil.isNotEmpty(bizUserExportParam.getSearchKey())) {
|
|
@@ -423,7 +453,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
}
|
|
}
|
|
String fileName = "SNOWY系统B端人员信息清单.xlsx";
|
|
String fileName = "SNOWY系统B端人员信息清单.xlsx";
|
|
List<BizUser> bizUserList = this.list(queryWrapper);
|
|
List<BizUser> bizUserList = this.list(queryWrapper);
|
|
- if(ObjectUtil.isEmpty(bizUserList)) {
|
|
|
|
|
|
+ if (ObjectUtil.isEmpty(bizUserList)) {
|
|
throw new CommonException("无数据可导出");
|
|
throw new CommonException("无数据可导出");
|
|
}
|
|
}
|
|
transService.transBatch(bizUserList);
|
|
transService.transBatch(bizUserList);
|
|
@@ -432,11 +462,11 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
.map(bizUser -> {
|
|
.map(bizUser -> {
|
|
BizUserExportResult bizUserExportResult = new BizUserExportResult();
|
|
BizUserExportResult bizUserExportResult = new BizUserExportResult();
|
|
BeanUtil.copyProperties(bizUser, bizUserExportResult);
|
|
BeanUtil.copyProperties(bizUser, bizUserExportResult);
|
|
- bizUserExportResult.setGroupName(ObjectUtil.isNotEmpty(bizUserExportResult.getOrgName())?
|
|
|
|
- bizUserExportResult.getOrgName():"无组织");
|
|
|
|
|
|
+ bizUserExportResult.setGroupName(ObjectUtil.isNotEmpty(bizUserExportResult.getOrgName()) ?
|
|
|
|
+ bizUserExportResult.getOrgName() : "无组织");
|
|
// 状态枚举转为文字
|
|
// 状态枚举转为文字
|
|
bizUserExportResult.setUserStatus(bizUserExportResult.getUserStatus()
|
|
bizUserExportResult.setUserStatus(bizUserExportResult.getUserStatus()
|
|
- .equalsIgnoreCase(BizUserStatusEnum.ENABLE.getValue())?"正常":"停用");
|
|
|
|
|
|
+ .equalsIgnoreCase(BizUserStatusEnum.ENABLE.getValue()) ? "正常" : "停用");
|
|
// 将base64转为byte数组
|
|
// 将base64转为byte数组
|
|
if (ObjectUtil.isNotEmpty(bizUser.getAvatar())) {
|
|
if (ObjectUtil.isNotEmpty(bizUser.getAvatar())) {
|
|
bizUserExportResult.setAvatar(ImgUtil.toBytes(ImgUtil.toImage(StrUtil
|
|
bizUserExportResult.setAvatar(ImgUtil.toBytes(ImgUtil.toImage(StrUtil
|
|
@@ -498,7 +528,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
WriteCellData<?> cellData = context.getFirstCellData();
|
|
WriteCellData<?> cellData = context.getFirstCellData();
|
|
WriteCellStyle writeCellStyle = cellData.getOrCreateStyle();
|
|
WriteCellStyle writeCellStyle = cellData.getOrCreateStyle();
|
|
Integer rowIndex = context.getRowIndex();
|
|
Integer rowIndex = context.getRowIndex();
|
|
- if(rowIndex == 0) {
|
|
|
|
|
|
+ if (rowIndex == 0) {
|
|
WriteFont headWriteFont = new WriteFont();
|
|
WriteFont headWriteFont = new WriteFont();
|
|
headWriteFont.setFontName("宋体");
|
|
headWriteFont.setFontName("宋体");
|
|
headWriteFont.setBold(true);
|
|
headWriteFont.setBold(true);
|
|
@@ -511,7 +541,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
.registerWriteHandler(new AbstractRowHeightStyleStrategy() {
|
|
.registerWriteHandler(new AbstractRowHeightStyleStrategy() {
|
|
@Override
|
|
@Override
|
|
protected void setHeadColumnHeight(Row row, int relativeRowIndex) {
|
|
protected void setHeadColumnHeight(Row row, int relativeRowIndex) {
|
|
- if(relativeRowIndex == 0) {
|
|
|
|
|
|
+ if (relativeRowIndex == 0) {
|
|
// 表头第一行
|
|
// 表头第一行
|
|
row.setHeightInPoints(34);
|
|
row.setHeightInPoints(34);
|
|
} else {
|
|
} else {
|
|
@@ -519,6 +549,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
row.setHeightInPoints(30);
|
|
row.setHeightInPoints(30);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
protected void setContentColumnHeight(Row row, int relativeRowIndex) {
|
|
protected void setContentColumnHeight(Row row, int relativeRowIndex) {
|
|
// 内容行
|
|
// 内容行
|
|
@@ -551,7 +582,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
// 构造填充的参数
|
|
// 构造填充的参数
|
|
Map<String, Object> map = BeanUtil.beanToMap(bizUser);
|
|
Map<String, Object> map = BeanUtil.beanToMap(bizUser);
|
|
String avatarBase64;
|
|
String avatarBase64;
|
|
- if(ObjectUtil.isNotEmpty(bizUser.getAvatar())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUser.getAvatar())) {
|
|
avatarBase64 = bizUser.getAvatar();
|
|
avatarBase64 = bizUser.getAvatar();
|
|
} else {
|
|
} else {
|
|
avatarBase64 = CommonAvatarUtil.generateImg(bizUser.getName());
|
|
avatarBase64 = CommonAvatarUtil.generateImg(bizUser.getName());
|
|
@@ -560,11 +591,11 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
ImageEntity imageEntity = new ImageEntity(ImgUtil.toBytes(ImgUtil.toImage(StrUtil
|
|
ImageEntity imageEntity = new ImageEntity(ImgUtil.toBytes(ImgUtil.toImage(StrUtil
|
|
.split(avatarBase64, StrUtil.COMMA).get(1)), ImgUtil.IMAGE_TYPE_PNG), 120, 160);
|
|
.split(avatarBase64, StrUtil.COMMA).get(1)), ImgUtil.IMAGE_TYPE_PNG), 120, 160);
|
|
map.put("avatar", imageEntity);
|
|
map.put("avatar", imageEntity);
|
|
- if(ObjectUtil.isNotEmpty(bizUser.getBirthday())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUser.getBirthday())) {
|
|
try {
|
|
try {
|
|
// 年龄
|
|
// 年龄
|
|
long age = cn.hutool.core.date.DateUtil.betweenYear(cn.hutool.core.date.DateUtil.parseDate(bizUser.getBirthday()), DateTime.now(), true);
|
|
long age = cn.hutool.core.date.DateUtil.betweenYear(cn.hutool.core.date.DateUtil.parseDate(bizUser.getBirthday()), DateTime.now(), true);
|
|
- if(age != 0) {
|
|
|
|
|
|
+ if (age != 0) {
|
|
map.put("age", age + "岁");
|
|
map.put("age", age + "岁");
|
|
}
|
|
}
|
|
} catch (Exception ignored) {
|
|
} catch (Exception ignored) {
|
|
@@ -587,10 +618,10 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
CommonResponseUtil.renderError(response, "导出失败");
|
|
CommonResponseUtil.renderError(response, "导出失败");
|
|
} finally {
|
|
} finally {
|
|
// 删除临时文件
|
|
// 删除临时文件
|
|
- if(ObjectUtil.isNotEmpty(destTemplateFile)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(destTemplateFile)) {
|
|
FileUtil.del(destTemplateFile);
|
|
FileUtil.del(destTemplateFile);
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotEmpty(resultFile)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(resultFile)) {
|
|
FileUtil.del(resultFile);
|
|
FileUtil.del(resultFile);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -599,7 +630,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
@Override
|
|
@Override
|
|
public BizUser queryEntity(String id) {
|
|
public BizUser queryEntity(String id) {
|
|
BizUser bizUser = this.getById(id);
|
|
BizUser bizUser = this.getById(id);
|
|
- if(ObjectUtil.isEmpty(bizUser)) {
|
|
|
|
|
|
+ if (ObjectUtil.isEmpty(bizUser)) {
|
|
throw new CommonException("人员不存在,id值为:{}", id);
|
|
throw new CommonException("人员不存在,id值为:{}", id);
|
|
}
|
|
}
|
|
return bizUser;
|
|
return bizUser;
|
|
@@ -614,7 +645,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
// 定义机构集合
|
|
// 定义机构集合
|
|
Set<BizOrg> bizOrgSet = CollectionUtil.newHashSet();
|
|
Set<BizOrg> bizOrgSet = CollectionUtil.newHashSet();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
// 获取所有机构
|
|
// 获取所有机构
|
|
List<BizOrg> allOrgList = bizOrgService.list();
|
|
List<BizOrg> allOrgList = bizOrgService.list();
|
|
loginUserDataScope.forEach(orgId -> bizOrgSet.addAll(bizOrgService.getParentListById(allOrgList, orgId, true)));
|
|
loginUserDataScope.forEach(orgId -> bizOrgSet.addAll(bizOrgService.getParentListById(allOrgList, orgId, true)));
|
|
@@ -626,7 +657,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
lambdaQueryWrapper.orderByAsc(BizOrg::getSortCode);
|
|
lambdaQueryWrapper.orderByAsc(BizOrg::getSortCode);
|
|
List<BizOrg> bizOrgList = bizOrgService.list(lambdaQueryWrapper);
|
|
List<BizOrg> bizOrgList = bizOrgService.list(lambdaQueryWrapper);
|
|
List<TreeNode<String>> treeNodeList = bizOrgList.stream().map(bizOrg ->
|
|
List<TreeNode<String>> treeNodeList = bizOrgList.stream().map(bizOrg ->
|
|
- new TreeNode<>(bizOrg.getId(), bizOrg.getParentId(), bizOrg.getName(), bizOrg.getSortCode()))
|
|
|
|
|
|
+ new TreeNode<>(bizOrg.getId(), bizOrg.getParentId(), bizOrg.getName(), bizOrg.getSortCode()))
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
return TreeUtil.build(treeNodeList, "0");
|
|
return TreeUtil.build(treeNodeList, "0");
|
|
}
|
|
}
|
|
@@ -636,7 +667,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
LambdaQueryWrapper<BizOrg> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<BizOrg> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
lambdaQueryWrapper.in(BizOrg::getId, loginUserDataScope);
|
|
lambdaQueryWrapper.in(BizOrg::getId, loginUserDataScope);
|
|
} else {
|
|
} else {
|
|
return new Page<>();
|
|
return new Page<>();
|
|
@@ -644,10 +675,10 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
// 查询部分字段
|
|
// 查询部分字段
|
|
lambdaQueryWrapper.select(BizOrg::getId, BizOrg::getParentId, BizOrg::getName,
|
|
lambdaQueryWrapper.select(BizOrg::getId, BizOrg::getParentId, BizOrg::getName,
|
|
BizOrg::getCategory, BizOrg::getSortCode);
|
|
BizOrg::getCategory, BizOrg::getSortCode);
|
|
- if(ObjectUtil.isNotEmpty(bizUserSelectorOrgListParam.getParentId())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserSelectorOrgListParam.getParentId())) {
|
|
lambdaQueryWrapper.eq(BizOrg::getParentId, bizUserSelectorOrgListParam.getParentId());
|
|
lambdaQueryWrapper.eq(BizOrg::getParentId, bizUserSelectorOrgListParam.getParentId());
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotEmpty(bizUserSelectorOrgListParam.getSearchKey())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserSelectorOrgListParam.getSearchKey())) {
|
|
lambdaQueryWrapper.like(BizOrg::getName, bizUserSelectorOrgListParam.getSearchKey());
|
|
lambdaQueryWrapper.like(BizOrg::getName, bizUserSelectorOrgListParam.getSearchKey());
|
|
}
|
|
}
|
|
lambdaQueryWrapper.orderByAsc(BizOrg::getSortCode);
|
|
lambdaQueryWrapper.orderByAsc(BizOrg::getSortCode);
|
|
@@ -659,7 +690,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
LambdaQueryWrapper<BizPosition> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<BizPosition> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
lambdaQueryWrapper.in(BizPosition::getOrgId, loginUserDataScope);
|
|
lambdaQueryWrapper.in(BizPosition::getOrgId, loginUserDataScope);
|
|
} else {
|
|
} else {
|
|
return new Page<>();
|
|
return new Page<>();
|
|
@@ -667,10 +698,10 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
// 查询部分字段
|
|
// 查询部分字段
|
|
lambdaQueryWrapper.select(BizPosition::getId, BizPosition::getOrgId, BizPosition::getName,
|
|
lambdaQueryWrapper.select(BizPosition::getId, BizPosition::getOrgId, BizPosition::getName,
|
|
BizPosition::getCategory, BizPosition::getSortCode);
|
|
BizPosition::getCategory, BizPosition::getSortCode);
|
|
- if(ObjectUtil.isNotEmpty(bizUserSelectorPositionParam.getOrgId())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserSelectorPositionParam.getOrgId())) {
|
|
lambdaQueryWrapper.eq(BizPosition::getOrgId, bizUserSelectorPositionParam.getOrgId());
|
|
lambdaQueryWrapper.eq(BizPosition::getOrgId, bizUserSelectorPositionParam.getOrgId());
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotEmpty(bizUserSelectorPositionParam.getSearchKey())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserSelectorPositionParam.getSearchKey())) {
|
|
lambdaQueryWrapper.like(BizPosition::getName, bizUserSelectorPositionParam.getSearchKey());
|
|
lambdaQueryWrapper.like(BizPosition::getName, bizUserSelectorPositionParam.getSearchKey());
|
|
}
|
|
}
|
|
lambdaQueryWrapper.orderByAsc(BizPosition::getSortCode);
|
|
lambdaQueryWrapper.orderByAsc(BizPosition::getSortCode);
|
|
@@ -682,9 +713,9 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
public Page<BizUserRoleResult> roleSelector(BizUserSelectorRoleParam bizUserSelectorRoleParam) {
|
|
public Page<BizUserRoleResult> roleSelector(BizUserSelectorRoleParam bizUserSelectorRoleParam) {
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
- if(ObjectUtil.isNotEmpty(bizUserSelectorRoleParam.getOrgId())) {
|
|
|
|
- if(loginUserDataScope.contains(bizUserSelectorRoleParam.getOrgId())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserSelectorRoleParam.getOrgId())) {
|
|
|
|
+ if (loginUserDataScope.contains(bizUserSelectorRoleParam.getOrgId())) {
|
|
return BeanUtil.toBean(sysRoleApi.roleSelector(bizUserSelectorRoleParam.getOrgId(), bizUserSelectorRoleParam.getCategory(),
|
|
return BeanUtil.toBean(sysRoleApi.roleSelector(bizUserSelectorRoleParam.getOrgId(), bizUserSelectorRoleParam.getCategory(),
|
|
bizUserSelectorRoleParam.getSearchKey(), loginUserDataScope, true), Page.class);
|
|
bizUserSelectorRoleParam.getSearchKey(), loginUserDataScope, true), Page.class);
|
|
} else {
|
|
} else {
|
|
@@ -710,7 +741,7 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
LambdaQueryWrapper<BizUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
LambdaQueryWrapper<BizUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
// 校验数据范围
|
|
// 校验数据范围
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
List<String> loginUserDataScope = StpLoginUserUtil.getLoginUserDataScope();
|
|
- if(ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(loginUserDataScope)) {
|
|
lambdaQueryWrapper.in(BizUser::getOrgId, loginUserDataScope);
|
|
lambdaQueryWrapper.in(BizUser::getOrgId, loginUserDataScope);
|
|
} else {
|
|
} else {
|
|
return new Page<>();
|
|
return new Page<>();
|
|
@@ -728,10 +759,93 @@ public class BizUserServiceImpl extends ServiceImpl<BizUserMapper, BizUser> impl
|
|
return new Page<>();
|
|
return new Page<>();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if(ObjectUtil.isNotEmpty(bizUserSelectorUserParam.getSearchKey())) {
|
|
|
|
|
|
+ if (ObjectUtil.isNotEmpty(bizUserSelectorUserParam.getSearchKey())) {
|
|
lambdaQueryWrapper.like(BizUser::getName, bizUserSelectorUserParam.getSearchKey());
|
|
lambdaQueryWrapper.like(BizUser::getName, bizUserSelectorUserParam.getSearchKey());
|
|
}
|
|
}
|
|
|
|
+ //排除会员
|
|
|
|
+ lambdaQueryWrapper.ne(BizUser::getUserType, 3);
|
|
lambdaQueryWrapper.orderByAsc(BizUser::getSortCode);
|
|
lambdaQueryWrapper.orderByAsc(BizUser::getSortCode);
|
|
return this.page(CommonPageRequest.defaultPage(), lambdaQueryWrapper);
|
|
return this.page(CommonPageRequest.defaultPage(), lambdaQueryWrapper);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
|
+ public void wxRegister(WxUserRegisterParam wxUserRegisterParam) {
|
|
|
|
+ // 校验短信验证码
|
|
|
|
+ String messageCode = commonCacheOperator.get(wxUserRegisterParam.getPhone()) + "";
|
|
|
|
+ if (ObjectUtil.isEmpty(messageCode)) {
|
|
|
|
+ throw new CommonException("验证码不存在");
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.notEqual(messageCode, wxUserRegisterParam.getMessageCode())) {
|
|
|
|
+ throw new CommonException("验证码错误");
|
|
|
|
+ }
|
|
|
|
+// //校验通过删除缓存
|
|
|
|
+// commonCacheOperator.remove(wxUserRegisterParam.getPhone());
|
|
|
|
+
|
|
|
|
+ String roleId = "";
|
|
|
|
+ // 保存用户信息
|
|
|
|
+ BizUser bizUser = new BizUser();
|
|
|
|
+ if (ObjectUtil.equal(wxUserRegisterParam.getRoleType(), "2")) {
|
|
|
|
+ if (ObjectUtil.isEmpty(wxUserRegisterParam.getOrgCode())) {
|
|
|
|
+ throw new CommonException("门店编码不能为空");
|
|
|
|
+ }
|
|
|
|
+ //校验门店编码是否正确
|
|
|
|
+ BizOrg bizOrg = bizOrgService.queryByOrgCode(wxUserRegisterParam.getOrgCode());
|
|
|
|
+ if (ObjectUtil.isNull(bizOrg)) {
|
|
|
|
+ throw new CommonException("门店编码错误");
|
|
|
|
+ }
|
|
|
|
+ // 门店角色
|
|
|
|
+ bizUser.setUserType(2);
|
|
|
|
+ //门店id
|
|
|
|
+ bizUser.setOrgId(bizOrg.getId());
|
|
|
|
+ roleId = "1886699979674595330";
|
|
|
|
+ } else {
|
|
|
|
+ //会员角色
|
|
|
|
+ bizUser.setUserType(3);
|
|
|
|
+ //门店id 挂载最外层
|
|
|
|
+ bizUser.setOrgId("1543842934270394368");
|
|
|
|
+ roleId = "1886674709466906625";
|
|
|
|
+ }
|
|
|
|
+ // 校验推荐人
|
|
|
|
+ if (ObjectUtil.isNotEmpty(wxUserRegisterParam.getReferralCode())) {
|
|
|
|
+ BizUser referralUser = baseMapper.selectOne(new LambdaQueryWrapper<BizUser>()
|
|
|
|
+ .eq(BizUser::getUserReferralCode, wxUserRegisterParam.getReferralCode())
|
|
|
|
+ .last("limit 1"));
|
|
|
|
+ if (ObjectUtil.isNull(referralUser)) {
|
|
|
|
+ throw new CommonException("推荐人不存在");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 校验openId或者手机号是否存在
|
|
|
|
+ if (ObjectUtil.isNull(baseMapper.selectOne(new LambdaQueryWrapper<BizUser>()
|
|
|
|
+ .eq(BizUser::getOpenId, wxUserRegisterParam.getOpenId())
|
|
|
|
+ .or()
|
|
|
|
+ .eq(BizUser::getAccount, wxUserRegisterParam.getPhone())
|
|
|
|
+ .last("limit 1")))) {
|
|
|
|
+ throw new CommonException("该手机号已注册,请勿重复注册");
|
|
|
|
+ }
|
|
|
|
+ bizUser.setAccount(wxUserRegisterParam.getPhone());
|
|
|
|
+ bizUser.setPhone(CommonCryptogramUtil.doSm4CbcEncrypt(wxUserRegisterParam.getPhone()));
|
|
|
|
+ // 设置默认密码
|
|
|
|
+ bizUser.setPassword(CommonCryptogramUtil.doHashValue(devConfigApi.getValueByKey(SNOWY_SYS_DEFAULT_PASSWORD_KEY)));
|
|
|
|
+ // 设置状态
|
|
|
|
+ bizUser.setUserStatus("ENABLE");
|
|
|
|
+ //生成推荐码
|
|
|
|
+ bizUser.setUserReferralCode(DateUtil.format(DateUtil.date(), DatePattern.PURE_DATETIME_PATTERN) + RandomUtil.randomNumbers(4));
|
|
|
|
+ bizUser.setName(wxUserRegisterParam.getName());
|
|
|
|
+ this.save(bizUser);
|
|
|
|
+ sysRoleApi.grantUserRole(bizUser.getId(), roleId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void smsSend(SmsSendParam smsSendParam) {
|
|
|
|
+ // 查询缓存是否存在
|
|
|
|
+ String messageCode = commonCacheOperator.get(smsSendParam.getPhone()) + "";
|
|
|
|
+ if (ObjectUtil.isNotEmpty(messageCode)) {
|
|
|
|
+ throw new CommonException("请勿重复发送");
|
|
|
|
+ }
|
|
|
|
+ String code = RandomUtil.randomNumbers(5);
|
|
|
|
+ //发送短信
|
|
|
|
+ devSmsApi.sendSmsAliyun(smsSendParam.getPhone(), null, "SMS_465365543", "{\"code\":\"" + code + "\"}");
|
|
|
|
+ commonCacheOperator.put(smsSendParam.getPhone(), code, 300);
|
|
|
|
+ }
|
|
}
|
|
}
|