|
@@ -19,7 +19,10 @@ import org.dromara.backstage.api.RemotePtParameterService;
|
|
|
import org.dromara.backstage.api.RemoteUserAccountService;
|
|
import org.dromara.backstage.api.RemoteUserAccountService;
|
|
|
import org.dromara.backstage.api.domain.bo.RemoteUserAccountBo;
|
|
import org.dromara.backstage.api.domain.bo.RemoteUserAccountBo;
|
|
|
import org.dromara.backstage.api.domain.vo.RemoteUserAccountVo;
|
|
import org.dromara.backstage.api.domain.vo.RemoteUserAccountVo;
|
|
|
-import org.dromara.common.core.constant.*;
|
|
|
|
|
|
|
+import org.dromara.common.core.constant.CacheNames;
|
|
|
|
|
+import org.dromara.common.core.constant.Constants;
|
|
|
|
|
+import org.dromara.common.core.constant.HttpStatus;
|
|
|
|
|
+import org.dromara.common.core.constant.UserConstants;
|
|
|
import org.dromara.common.core.domain.R;
|
|
import org.dromara.common.core.domain.R;
|
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
import org.dromara.common.core.exception.ServiceException;
|
|
|
import org.dromara.common.core.exception.user.UserException;
|
|
import org.dromara.common.core.exception.user.UserException;
|
|
@@ -29,8 +32,10 @@ import org.dromara.common.core.utils.StreamUtils;
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
import org.dromara.common.encrypt.interceptor.MybatisDecryptInterceptor;
|
|
import org.dromara.common.encrypt.interceptor.MybatisDecryptInterceptor;
|
|
|
import org.dromara.common.encrypt.interceptor.MybatisEncryptInterceptor;
|
|
import org.dromara.common.encrypt.interceptor.MybatisEncryptInterceptor;
|
|
|
-import org.dromara.common.message.kafka.domain.KafkaHeader;
|
|
|
|
|
-import org.dromara.common.message.kafka.domain.KafkaMessage;
|
|
|
|
|
|
|
+import org.dromara.common.message.kafka.constant.EventTypeConstants;
|
|
|
|
|
+import org.dromara.common.message.kafka.constant.KafkaTopicConstants;
|
|
|
|
|
+import org.dromara.common.message.kafka.enums.EventSenderEnum;
|
|
|
|
|
+import org.dromara.common.message.kafka.producer.KafkaNormalProducer;
|
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
|
|
import org.dromara.common.mybatis.helper.DataBaseHelper;
|
|
import org.dromara.common.mybatis.helper.DataBaseHelper;
|
|
@@ -45,7 +50,6 @@ import org.dromara.system.domain.vo.SysRoleVo;
|
|
|
import org.dromara.system.domain.vo.SysUserExportVo;
|
|
import org.dromara.system.domain.vo.SysUserExportVo;
|
|
|
import org.dromara.system.domain.vo.SysUserVo;
|
|
import org.dromara.system.domain.vo.SysUserVo;
|
|
|
import org.dromara.system.mapper.*;
|
|
import org.dromara.system.mapper.*;
|
|
|
-import org.dromara.system.mq.KafkaNormalProducer;
|
|
|
|
|
import org.dromara.system.service.ISysUserService;
|
|
import org.dromara.system.service.ISysUserService;
|
|
|
import org.dromara.system.service.IUserDeptService;
|
|
import org.dromara.system.service.IUserDeptService;
|
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
import org.springframework.cache.annotation.CacheEvict;
|
|
@@ -98,7 +102,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private Wrapper<SysUser> buildQueryWrapper(SysUserBo user) {
|
|
private Wrapper<SysUser> buildQueryWrapper(SysUserBo user) {
|
|
|
- //手机号加密处理
|
|
|
|
|
|
|
+ // 手机号加密处理
|
|
|
MybatisEncryptInterceptor encryptInterceptor = SpringUtils.getBean(MybatisEncryptInterceptor.class);
|
|
MybatisEncryptInterceptor encryptInterceptor = SpringUtils.getBean(MybatisEncryptInterceptor.class);
|
|
|
user.setPhone(encryptInterceptor.encrypt(user.getPhone()));
|
|
user.setPhone(encryptInterceptor.encrypt(user.getPhone()));
|
|
|
|
|
|
|
@@ -112,11 +116,11 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
.eq(StringUtils.isNotBlank(user.getStatus()), "status", user.getStatus())
|
|
.eq(StringUtils.isNotBlank(user.getStatus()), "status", user.getStatus())
|
|
|
.like(StringUtils.isNotBlank(user.getPhone()), "phone", user.getPhone())
|
|
.like(StringUtils.isNotBlank(user.getPhone()), "phone", user.getPhone())
|
|
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
|
.between(params.get("beginTime") != null && params.get("endTime") != null,
|
|
|
- "create_time", params.get("beginTime"), params.get("endTime"))
|
|
|
|
|
|
|
+ "create_time", params.get("beginTime"), params.get("endTime"))
|
|
|
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
|
.and(ObjectUtil.isNotNull(user.getDeptId()), w -> {
|
|
|
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
|
List<SysDept> deptList = deptMapper.selectList(new LambdaQueryWrapper<SysDept>()
|
|
|
- .select(SysDept::getDeptId)
|
|
|
|
|
- .apply(DataBaseHelper.findInSet(user.getDeptId(), "ancestors")));
|
|
|
|
|
|
|
+ .select(SysDept::getDeptId)
|
|
|
|
|
+ .apply(DataBaseHelper.findInSet(user.getDeptId(), "ancestors")));
|
|
|
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
|
List<Long> ids = StreamUtils.toList(deptList, SysDept::getDeptId);
|
|
|
ids.add(user.getDeptId());
|
|
ids.add(user.getDeptId());
|
|
|
w.in("dept_id", ids);
|
|
w.in("dept_id", ids);
|
|
@@ -135,7 +139,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public TableDataInfo<SysUserVo> selectAllocatedList(SysUserBo user, PageQuery pageQuery) {
|
|
public TableDataInfo<SysUserVo> selectAllocatedList(SysUserBo user, PageQuery pageQuery) {
|
|
|
- //查询条件加密
|
|
|
|
|
|
|
+ // 查询条件加密
|
|
|
MybatisEncryptInterceptor encrypt = SpringUtils.getBean(MybatisEncryptInterceptor.class);
|
|
MybatisEncryptInterceptor encrypt = SpringUtils.getBean(MybatisEncryptInterceptor.class);
|
|
|
user.setPhone(encrypt.encrypt(user.getPhone()));
|
|
user.setPhone(encrypt.encrypt(user.getPhone()));
|
|
|
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
|
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
|
@@ -146,7 +150,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
.like(StringUtils.isNotBlank(user.getPhone()), "u.phone", user.getPhone())
|
|
.like(StringUtils.isNotBlank(user.getPhone()), "u.phone", user.getPhone())
|
|
|
.orderByAsc("u.user_id");
|
|
.orderByAsc("u.user_id");
|
|
|
Page<SysUserVo> page = baseMapper.selectAllocatedList(pageQuery.build(), wrapper);
|
|
Page<SysUserVo> page = baseMapper.selectAllocatedList(pageQuery.build(), wrapper);
|
|
|
- //返回数据解密
|
|
|
|
|
|
|
+ // 返回数据解密
|
|
|
MybatisDecryptInterceptor dencrypt = SpringUtils.getBean(MybatisDecryptInterceptor.class);
|
|
MybatisDecryptInterceptor dencrypt = SpringUtils.getBean(MybatisDecryptInterceptor.class);
|
|
|
page.getRecords().stream().forEach(item -> {
|
|
page.getRecords().stream().forEach(item -> {
|
|
|
item.setPhone(dencrypt.decrypt(item.getPhone()));
|
|
item.setPhone(dencrypt.decrypt(item.getPhone()));
|
|
@@ -163,7 +167,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public TableDataInfo<SysUserVo> selectUnallocatedList(SysUserBo user, PageQuery pageQuery) {
|
|
public TableDataInfo<SysUserVo> selectUnallocatedList(SysUserBo user, PageQuery pageQuery) {
|
|
|
List<Long> userIds = userRoleMapper.selectUserIdsByRoleId(user.getRoleId());
|
|
List<Long> userIds = userRoleMapper.selectUserIdsByRoleId(user.getRoleId());
|
|
|
- //查询条件加密
|
|
|
|
|
|
|
+ // 查询条件加密
|
|
|
MybatisEncryptInterceptor encrypt = SpringUtils.getBean(MybatisEncryptInterceptor.class);
|
|
MybatisEncryptInterceptor encrypt = SpringUtils.getBean(MybatisEncryptInterceptor.class);
|
|
|
user.setPhone(encrypt.encrypt(user.getPhone()));
|
|
user.setPhone(encrypt.encrypt(user.getPhone()));
|
|
|
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
|
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
|
@@ -174,7 +178,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
.like(StringUtils.isNotBlank(user.getPhone()), "u.phone", user.getPhone())
|
|
.like(StringUtils.isNotBlank(user.getPhone()), "u.phone", user.getPhone())
|
|
|
.orderByAsc("u.user_id");
|
|
.orderByAsc("u.user_id");
|
|
|
Page<SysUserVo> page = baseMapper.selectUnallocatedList(pageQuery.build(), wrapper);
|
|
Page<SysUserVo> page = baseMapper.selectUnallocatedList(pageQuery.build(), wrapper);
|
|
|
- //返回数据解密
|
|
|
|
|
|
|
+ // 返回数据解密
|
|
|
MybatisDecryptInterceptor dencrypt = SpringUtils.getBean(MybatisDecryptInterceptor.class);
|
|
MybatisDecryptInterceptor dencrypt = SpringUtils.getBean(MybatisDecryptInterceptor.class);
|
|
|
page.getRecords().stream().forEach(item -> {
|
|
page.getRecords().stream().forEach(item -> {
|
|
|
item.setPhone(dencrypt.decrypt(item.getPhone()));
|
|
item.setPhone(dencrypt.decrypt(item.getPhone()));
|
|
@@ -230,10 +234,10 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public List<SysUserVo> selectUserByIds(List<Long> userIds, Long deptId) {
|
|
public List<SysUserVo> selectUserByIds(List<Long> userIds, Long deptId) {
|
|
|
return baseMapper.selectUserList(new LambdaQueryWrapper<SysUser>()
|
|
return baseMapper.selectUserList(new LambdaQueryWrapper<SysUser>()
|
|
|
- .select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName)
|
|
|
|
|
- .eq(SysUser::getStatus, UserConstants.USER_NORMAL)
|
|
|
|
|
- .eq(ObjectUtil.isNotNull(deptId), SysUser::getDeptId, deptId)
|
|
|
|
|
- .in(CollUtil.isNotEmpty(userIds), SysUser::getUserId, userIds));
|
|
|
|
|
|
|
+ .select(SysUser::getUserId, SysUser::getUserName, SysUser::getNickName)
|
|
|
|
|
+ .eq(SysUser::getStatus, UserConstants.USER_NORMAL)
|
|
|
|
|
+ .eq(ObjectUtil.isNotNull(deptId), SysUser::getDeptId, deptId)
|
|
|
|
|
+ .in(CollUtil.isNotEmpty(userIds), SysUser::getUserId, userIds));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -275,8 +279,8 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public boolean checkUserNameUnique(SysUserBo user) {
|
|
public boolean checkUserNameUnique(SysUserBo user) {
|
|
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
|
- .eq(SysUser::getUserName, user.getUserName())
|
|
|
|
|
- .ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
|
|
|
|
+ .eq(SysUser::getUserName, user.getUserName())
|
|
|
|
|
+ .ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
return exist;
|
|
return exist;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -288,8 +292,8 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public boolean checkPhoneUnique(SysUserBo user) {
|
|
public boolean checkPhoneUnique(SysUserBo user) {
|
|
|
return baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
return baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
|
- .eq(SysUser::getPhone, user.getPhone())
|
|
|
|
|
- .ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
|
|
|
|
+ .eq(SysUser::getPhone, user.getPhone())
|
|
|
|
|
+ .ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -300,8 +304,8 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public boolean checkEmailUnique(SysUserBo user) {
|
|
public boolean checkEmailUnique(SysUserBo user) {
|
|
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
|
- .eq(SysUser::getEmail, user.getEmail())
|
|
|
|
|
- .ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
|
|
|
|
+ .eq(SysUser::getEmail, user.getEmail())
|
|
|
|
|
+ .ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
return exist;
|
|
return exist;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -313,8 +317,8 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public boolean checkUserNumbUnique(SysUserBo user) {
|
|
public boolean checkUserNumbUnique(SysUserBo user) {
|
|
|
return baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
return baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
|
- .eq(SysUser::getUserNumb, user.getUserNumb())
|
|
|
|
|
- .ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
|
|
|
|
+ .eq(SysUser::getUserNumb, user.getUserNumb())
|
|
|
|
|
+ .ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -367,11 +371,11 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
insertUserDept(user, user.getUserDeptBoList());
|
|
insertUserDept(user, user.getUserDeptBoList());
|
|
|
// 新增用户与角色管理
|
|
// 新增用户与角色管理
|
|
|
insertUserRole(user, false);
|
|
insertUserRole(user, false);
|
|
|
- //一卡通账户处理
|
|
|
|
|
|
|
+ // 一卡通账户处理
|
|
|
String autoUserAccount = remotePtParameterService.getPtParameterByKey("AUTO_CREATE_BAG");
|
|
String autoUserAccount = remotePtParameterService.getPtParameterByKey("AUTO_CREATE_BAG");
|
|
|
RemoteUserAccountBo remoteUserAccountBo = BeanUtil.copyProperties(user, RemoteUserAccountBo.class);
|
|
RemoteUserAccountBo remoteUserAccountBo = BeanUtil.copyProperties(user, RemoteUserAccountBo.class);
|
|
|
if (Constants.AUTO_USER_ACCOUNT.equals(autoUserAccount)) {
|
|
if (Constants.AUTO_USER_ACCOUNT.equals(autoUserAccount)) {
|
|
|
- //自动开通一卡通账户
|
|
|
|
|
|
|
+ // 自动开通一卡通账户
|
|
|
remoteUserAccountBo.setAccountStatus("1");
|
|
remoteUserAccountBo.setAccountStatus("1");
|
|
|
R<RemoteUserAccountBo> result = remoteUserAccountService.openAccount(remoteUserAccountBo);
|
|
R<RemoteUserAccountBo> result = remoteUserAccountService.openAccount(remoteUserAccountBo);
|
|
|
if (result.getCode() == HttpStatus.SUCCESS) {
|
|
if (result.getCode() == HttpStatus.SUCCESS) {
|
|
@@ -379,13 +383,13 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
user.setCardId(data.getCardId());
|
|
user.setCardId(data.getCardId());
|
|
|
user.setCardNo(data.getCardNo());
|
|
user.setCardNo(data.getCardNo());
|
|
|
user.setUserNo(data.getUserNo());
|
|
user.setUserNo(data.getUserNo());
|
|
|
- //return rows;
|
|
|
|
|
|
|
+ // return rows;
|
|
|
} else {
|
|
} else {
|
|
|
throw new UserException(result.getMsg());
|
|
throw new UserException(result.getMsg());
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- //不自动开通
|
|
|
|
|
- RemoteUserAccountVo accountVo= remoteUserAccountService.getUserAccountVoById(user.getUserId());
|
|
|
|
|
|
|
+ // 不自动开通
|
|
|
|
|
+ RemoteUserAccountVo accountVo = remoteUserAccountService.getUserAccountVoById(user.getUserId());
|
|
|
if (ObjectUtil.isEmpty(accountVo)) {
|
|
if (ObjectUtil.isEmpty(accountVo)) {
|
|
|
remoteUserAccountBo.setAccountStatus("0");
|
|
remoteUserAccountBo.setAccountStatus("0");
|
|
|
remoteUserAccountService.insertByBo(remoteUserAccountBo);
|
|
remoteUserAccountService.insertByBo(remoteUserAccountBo);
|
|
@@ -436,7 +440,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
|
SysUser sysUser = MapstructUtils.convert(user, SysUser.class);
|
|
|
// 防止错误更新后导致的数据误删除
|
|
// 防止错误更新后导致的数据误删除
|
|
|
int flag = baseMapper.updateById(sysUser);
|
|
int flag = baseMapper.updateById(sysUser);
|
|
|
- //更新对应的一卡通账户信息
|
|
|
|
|
|
|
+ // 更新对应的一卡通账户信息
|
|
|
remoteUserAccountService.updateByBo(BeanUtil.copyProperties(user, RemoteUserAccountBo.class));
|
|
remoteUserAccountService.updateByBo(BeanUtil.copyProperties(user, RemoteUserAccountBo.class));
|
|
|
sendCloudConsume(baseMapper.selectVoById(user.getUserId()));
|
|
sendCloudConsume(baseMapper.selectVoById(user.getUserId()));
|
|
|
return flag;
|
|
return flag;
|
|
@@ -468,9 +472,9 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public int updateUserStatus(Long userId, String status) {
|
|
public int updateUserStatus(Long userId, String status) {
|
|
|
return baseMapper.update(null,
|
|
return baseMapper.update(null,
|
|
|
- new LambdaUpdateWrapper<SysUser>()
|
|
|
|
|
- .set(SysUser::getStatus, status)
|
|
|
|
|
- .eq(SysUser::getUserId, userId));
|
|
|
|
|
|
|
+ new LambdaUpdateWrapper<SysUser>()
|
|
|
|
|
+ .set(SysUser::getStatus, status)
|
|
|
|
|
+ .eq(SysUser::getUserId, userId));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -483,12 +487,12 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public int updateUserProfile(SysUserBo user) {
|
|
public int updateUserProfile(SysUserBo user) {
|
|
|
return baseMapper.update(null,
|
|
return baseMapper.update(null,
|
|
|
- new LambdaUpdateWrapper<SysUser>()
|
|
|
|
|
- .set(ObjectUtil.isNotNull(user.getNickName()), SysUser::getNickName, user.getNickName())
|
|
|
|
|
- .set(SysUser::getPhone, user.getPhone())
|
|
|
|
|
- .set(SysUser::getEmail, user.getEmail())
|
|
|
|
|
- .set(SysUser::getSex, user.getSex())
|
|
|
|
|
- .eq(SysUser::getUserId, user.getUserId()));
|
|
|
|
|
|
|
+ new LambdaUpdateWrapper<SysUser>()
|
|
|
|
|
+ .set(ObjectUtil.isNotNull(user.getNickName()), SysUser::getNickName, user.getNickName())
|
|
|
|
|
+ .set(SysUser::getPhone, user.getPhone())
|
|
|
|
|
+ .set(SysUser::getEmail, user.getEmail())
|
|
|
|
|
+ .set(SysUser::getSex, user.getSex())
|
|
|
|
|
+ .eq(SysUser::getUserId, user.getUserId()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -501,9 +505,9 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public boolean updateUserAvatar(Long userId, Long avatar) {
|
|
public boolean updateUserAvatar(Long userId, Long avatar) {
|
|
|
return baseMapper.update(null,
|
|
return baseMapper.update(null,
|
|
|
- new LambdaUpdateWrapper<SysUser>()
|
|
|
|
|
- .set(SysUser::getAvatar, avatar)
|
|
|
|
|
- .eq(SysUser::getUserId, userId)) > 0;
|
|
|
|
|
|
|
+ new LambdaUpdateWrapper<SysUser>()
|
|
|
|
|
+ .set(SysUser::getAvatar, avatar)
|
|
|
|
|
+ .eq(SysUser::getUserId, userId)) > 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -516,9 +520,9 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public int resetUserPwd(Long userId, String password) {
|
|
public int resetUserPwd(Long userId, String password) {
|
|
|
return baseMapper.update(null,
|
|
return baseMapper.update(null,
|
|
|
- new LambdaUpdateWrapper<SysUser>()
|
|
|
|
|
- .set(SysUser::getPassword, password)
|
|
|
|
|
- .eq(SysUser::getUserId, userId));
|
|
|
|
|
|
|
+ new LambdaUpdateWrapper<SysUser>()
|
|
|
|
|
+ .set(SysUser::getPassword, password)
|
|
|
|
|
+ .eq(SysUser::getUserId, userId));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -650,7 +654,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public String selectUserNameById(Long userId) {
|
|
public String selectUserNameById(Long userId) {
|
|
|
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
|
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
|
|
- .select(SysUser::getUserName).eq(SysUser::getUserId, userId));
|
|
|
|
|
|
|
+ .select(SysUser::getUserName).eq(SysUser::getUserId, userId));
|
|
|
return ObjectUtil.isNull(sysUser) ? null : sysUser.getUserName();
|
|
return ObjectUtil.isNull(sysUser) ? null : sysUser.getUserName();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -664,7 +668,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Cacheable(cacheNames = CacheNames.SYS_NICKNAME, key = "#userId")
|
|
@Cacheable(cacheNames = CacheNames.SYS_NICKNAME, key = "#userId")
|
|
|
public String selectNicknameById(Long userId) {
|
|
public String selectNicknameById(Long userId) {
|
|
|
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
|
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
|
|
- .select(SysUser::getNickName).eq(SysUser::getUserId, userId));
|
|
|
|
|
|
|
+ .select(SysUser::getNickName).eq(SysUser::getUserId, userId));
|
|
|
return ObjectUtil.isNull(sysUser) ? null : sysUser.getNickName();
|
|
return ObjectUtil.isNull(sysUser) ? null : sysUser.getNickName();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -689,7 +693,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public String selectPhonenumberById(Long userId) {
|
|
public String selectPhonenumberById(Long userId) {
|
|
|
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
|
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
|
|
- .select(SysUser::getPhone).eq(SysUser::getUserId, userId));
|
|
|
|
|
|
|
+ .select(SysUser::getPhone).eq(SysUser::getUserId, userId));
|
|
|
return ObjectUtil.isNull(sysUser) ? null : sysUser.getPhone();
|
|
return ObjectUtil.isNull(sysUser) ? null : sysUser.getPhone();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -702,7 +706,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public String selectEmailById(Long userId) {
|
|
public String selectEmailById(Long userId) {
|
|
|
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
|
SysUser sysUser = baseMapper.selectOne(new LambdaQueryWrapper<SysUser>()
|
|
|
- .select(SysUser::getEmail).eq(SysUser::getUserId, userId));
|
|
|
|
|
|
|
+ .select(SysUser::getEmail).eq(SysUser::getUserId, userId));
|
|
|
return ObjectUtil.isNull(sysUser) ? null : sysUser.getEmail();
|
|
return ObjectUtil.isNull(sysUser) ? null : sysUser.getEmail();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -715,7 +719,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public SysUserVo selectUserVoByOtherId(String otherId) {
|
|
public SysUserVo selectUserVoByOtherId(String otherId) {
|
|
|
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysUser>()
|
|
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysUser>()
|
|
|
- .eq(SysUser::getOtherId, otherId));
|
|
|
|
|
|
|
+ .eq(SysUser::getOtherId, otherId));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -728,13 +732,13 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
@Override
|
|
@Override
|
|
|
public SysUserVo selectUserVoByUserName(String userName) {
|
|
public SysUserVo selectUserVoByUserName(String userName) {
|
|
|
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysUser>()
|
|
return baseMapper.selectVoOne(new LambdaQueryWrapper<SysUser>()
|
|
|
- .eq(SysUser::getUserName, userName));
|
|
|
|
|
|
|
+ .eq(SysUser::getUserName, userName));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private void insertUserDept(SysUserBo bo, List<UserDeptBo> userDeptBoList) {
|
|
private void insertUserDept(SysUserBo bo, List<UserDeptBo> userDeptBoList) {
|
|
|
- //将已有的人员部门关系设置成非主部门
|
|
|
|
|
|
|
+ // 将已有的人员部门关系设置成非主部门
|
|
|
userDeptService.updateMainDeptByUserId(bo.getUserId());
|
|
userDeptService.updateMainDeptByUserId(bo.getUserId());
|
|
|
- //设置当前部门为主部门
|
|
|
|
|
|
|
+ // 设置当前部门为主部门
|
|
|
UserDeptBo justUserDeptBo = new UserDeptBo();
|
|
UserDeptBo justUserDeptBo = new UserDeptBo();
|
|
|
justUserDeptBo.setUserId(bo.getUserId());
|
|
justUserDeptBo.setUserId(bo.getUserId());
|
|
|
justUserDeptBo.setDeptId(bo.getDeptId());
|
|
justUserDeptBo.setDeptId(bo.getDeptId());
|
|
@@ -742,11 +746,11 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
justUserDeptBo.setMainDept("Y");
|
|
justUserDeptBo.setMainDept("Y");
|
|
|
|
|
|
|
|
userDeptService.setUserDeptPost(justUserDeptBo);
|
|
userDeptService.setUserDeptPost(justUserDeptBo);
|
|
|
- //如果有多部门,设置多部门
|
|
|
|
|
|
|
+ // 如果有多部门,设置多部门
|
|
|
if (CollectionUtil.isNotEmpty(userDeptBoList)) {
|
|
if (CollectionUtil.isNotEmpty(userDeptBoList)) {
|
|
|
- //排除主部门
|
|
|
|
|
|
|
+ // 排除主部门
|
|
|
List<UserDeptBo> userDeptList = userDeptBoList.stream()
|
|
List<UserDeptBo> userDeptList = userDeptBoList.stream()
|
|
|
- .filter(p -> ObjectUtil.notEqual(bo.getDeptId(), p.getDeptId())).toList();
|
|
|
|
|
|
|
+ .filter(p -> ObjectUtil.notEqual(bo.getDeptId(), p.getDeptId())).toList();
|
|
|
if (CollectionUtil.isNotEmpty(userDeptList)) {
|
|
if (CollectionUtil.isNotEmpty(userDeptList)) {
|
|
|
userDeptList.forEach(userDeptBo -> {
|
|
userDeptList.forEach(userDeptBo -> {
|
|
|
userDeptBo.setUserId(bo.getUserId());
|
|
userDeptBo.setUserId(bo.getUserId());
|
|
@@ -761,17 +765,17 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
private void sendCloudConsume(SysUserVo vo) {
|
|
private void sendCloudConsume(SysUserVo vo) {
|
|
|
String pushData = remotePtParameterService.getPtParameterByKey("PUSH_MQ_DATA");
|
|
String pushData = remotePtParameterService.getPtParameterByKey("PUSH_MQ_DATA");
|
|
|
if (ObjectUtil.isNotEmpty(pushData) && ObjectUtil.equals(pushData, "1")) {
|
|
if (ObjectUtil.isNotEmpty(pushData) && ObjectUtil.equals(pushData, "1")) {
|
|
|
- KafkaMessage<SysUserVo> message = new KafkaMessage<>();
|
|
|
|
|
- KafkaHeader header = message.getHeader();
|
|
|
|
|
- header.setTimestamp(System.currentTimeMillis());
|
|
|
|
|
- header.setEventId(CloudMqEventConstants.USER);
|
|
|
|
|
- header.setEventType(CloudMqEventConstants.USER);
|
|
|
|
|
- header.setSender(CloudMqEventConstants.SENDER);
|
|
|
|
|
-
|
|
|
|
|
- message.setHeader(header);
|
|
|
|
|
- message.setBody(vo);
|
|
|
|
|
-
|
|
|
|
|
- kafkaNormalProducer.sendKafkaMessage(CloudMqEventConstants.TOPIC, message);
|
|
|
|
|
|
|
+ // KafkaMessage<Object> message = new KafkaMessage<>();
|
|
|
|
|
+ // KafkaHeader header = message.getHeader();
|
|
|
|
|
+ // header.setTimestamp(System.currentTimeMillis());
|
|
|
|
|
+ // header.setEventId(CloudMqEventConstants.USER);
|
|
|
|
|
+ // header.setEventType(CloudMqEventConstants.USER);
|
|
|
|
|
+ // header.setSender(CloudMqEventConstants.SENDER);
|
|
|
|
|
+ //
|
|
|
|
|
+ // message.setHeader(header);
|
|
|
|
|
+ // message.setBody(vo);
|
|
|
|
|
+ // String topic, String eventId, String eventType, String sender, Object data
|
|
|
|
|
+ kafkaNormalProducer.sendKafkaMessage(KafkaTopicConstants.NORMAL_TOPIC, EventTypeConstants.USER, EventSenderEnum.SYSTEM.code(), vo);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|