|
@@ -18,8 +18,12 @@ 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.common.core.constant.CacheNames;
|
|
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.constant.UserConstants;
|
|
|
|
|
+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.utils.MapstructUtils;
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
import org.dromara.common.core.utils.SpringUtils;
|
|
import org.dromara.common.core.utils.SpringUtils;
|
|
|
import org.dromara.common.core.utils.StreamUtils;
|
|
import org.dromara.common.core.utils.StreamUtils;
|
|
@@ -73,7 +77,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
public TableDataInfo<SysUserVo> selectPageUserList(SysUserBo user, PageQuery pageQuery) {
|
|
public TableDataInfo<SysUserVo> selectPageUserList(SysUserBo user, PageQuery pageQuery) {
|
|
|
- Page<SysUserVo> page = baseMapper.selectPageUserList(pageQuery.build(), this.buildQueryWrapper(user));
|
|
|
|
|
|
|
+ Page<SysUserVo> page = baseMapper.selectVoPage(pageQuery.build(), this.buildQueryWrapper(user));
|
|
|
return TableDataInfo.build(page);
|
|
return TableDataInfo.build(page);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -91,24 +95,24 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
private Wrapper<SysUser> buildQueryWrapper(SysUserBo user) {
|
|
private Wrapper<SysUser> buildQueryWrapper(SysUserBo user) {
|
|
|
Map<String, Object> params = user.getParams();
|
|
Map<String, Object> params = user.getParams();
|
|
|
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
|
QueryWrapper<SysUser> wrapper = Wrappers.query();
|
|
|
- wrapper.eq("u.del_flag", UserConstants.USER_NORMAL)
|
|
|
|
|
- .eq(ObjectUtil.isNotNull(user.getUserId()), "u.user_id", user.getUserId())
|
|
|
|
|
- .like(StringUtils.isNotBlank(user.getUserName()), "u.user_name", user.getUserName())
|
|
|
|
|
- .like(StringUtils.isNotBlank(user.getRealName()), "u.real_name", user.getRealName())
|
|
|
|
|
- .eq(StringUtils.isNotBlank(user.getStatus()), "u.status", user.getStatus())
|
|
|
|
|
- .like(StringUtils.isNotBlank(user.getPhone()), "u.phone", user.getPhone())
|
|
|
|
|
|
|
+ wrapper.eq("del_flag", UserConstants.USER_NORMAL)
|
|
|
|
|
+ .eq(ObjectUtil.isNotNull(user.getUserId()), "user_id", user.getUserId())
|
|
|
|
|
+ .like(StringUtils.isNotBlank(user.getUserName()), "user_name", user.getUserName())
|
|
|
|
|
+ .like(StringUtils.isNotBlank(user.getRealName()), "real_name", user.getRealName())
|
|
|
|
|
+ .eq(StringUtils.isNotBlank(user.getStatus()), "status", user.getStatus())
|
|
|
|
|
+ .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,
|
|
|
- "u.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)
|
|
.select(SysDept::getDeptId)
|
|
|
.apply(DataBaseHelper.findInSet(user.getDeptId(), "ancestors")));
|
|
.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("u.dept_id", ids);
|
|
|
|
|
- }).orderByAsc("u.user_id");
|
|
|
|
|
|
|
+ w.in("dept_id", ids);
|
|
|
|
|
+ }).orderByAsc("user_id");
|
|
|
if (StringUtils.isNotBlank(user.getExcludeUserIds())) {
|
|
if (StringUtils.isNotBlank(user.getExcludeUserIds())) {
|
|
|
- wrapper.notIn("u.user_id", StringUtils.splitList(user.getExcludeUserIds()));
|
|
|
|
|
|
|
+ wrapper.notIn("user_id", StringUtils.splitList(user.getExcludeUserIds()));
|
|
|
}
|
|
}
|
|
|
return wrapper;
|
|
return wrapper;
|
|
|
}
|
|
}
|
|
@@ -247,7 +251,7 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
|
.eq(SysUser::getUserName, user.getUserName())
|
|
.eq(SysUser::getUserName, user.getUserName())
|
|
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
- return !exist;
|
|
|
|
|
|
|
+ return exist;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -257,10 +261,9 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public boolean checkPhoneUnique(SysUserBo user) {
|
|
public boolean checkPhoneUnique(SysUserBo user) {
|
|
|
- boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
|
|
|
|
|
+ return baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
|
.eq(SysUser::getPhone, user.getPhone())
|
|
.eq(SysUser::getPhone, user.getPhone())
|
|
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
- return !exist;
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -273,7 +276,19 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
boolean exist = baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
|
.eq(SysUser::getEmail, user.getEmail())
|
|
.eq(SysUser::getEmail, user.getEmail())
|
|
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
.ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
- return !exist;
|
|
|
|
|
|
|
+ return exist;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 校验学/工号是否唯一
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param user 用户信息
|
|
|
|
|
+ */
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public boolean checkUserNumbUnique(SysUserBo user) {
|
|
|
|
|
+ return baseMapper.exists(new LambdaQueryWrapper<SysUser>()
|
|
|
|
|
+ .eq(SysUser::getUserNumb, user.getUserNumb())
|
|
|
|
|
+ .ne(ObjectUtil.isNotNull(user.getUserId()), SysUser::getUserId, user.getUserId()));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -325,14 +340,23 @@ public class SysUserServiceImpl implements ISysUserService {
|
|
|
insertUserDept(user);
|
|
insertUserDept(user);
|
|
|
// 新增用户与角色管理
|
|
// 新增用户与角色管理
|
|
|
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("1".equals(autoUserAccount)){
|
|
|
|
|
- //
|
|
|
|
|
- //} else {
|
|
|
|
|
|
|
+ if(Constants.AUTO_USER_ACCOUNT.equals(autoUserAccount)){
|
|
|
|
|
+ //自动开通一卡通账户
|
|
|
|
|
+ remoteUserAccountBo.setAccountStatus("1");
|
|
|
|
|
+ R<String> result = remoteUserAccountService.openAccount(remoteUserAccountBo);
|
|
|
|
|
+ if(result.getCode()== HttpStatus.SUCCESS){
|
|
|
|
|
+ return rows;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ throw new UserException(result.getMsg());
|
|
|
|
|
+ }
|
|
|
|
|
+ } else {
|
|
|
|
|
+ //不自动开通
|
|
|
remoteUserAccountBo.setAccountStatus("0");
|
|
remoteUserAccountBo.setAccountStatus("0");
|
|
|
- //remoteUserAccountService.insertByBo(remoteUserAccountBo);
|
|
|
|
|
- //}
|
|
|
|
|
|
|
+ remoteUserAccountService.insertByBo(remoteUserAccountBo);
|
|
|
|
|
+ }
|
|
|
return rows;
|
|
return rows;
|
|
|
}
|
|
}
|
|
|
|
|
|