|
|
|
@ -7,12 +7,12 @@ import cn.estsh.i3plus.core.api.iservice.busi.ISysUserService;
|
|
|
|
|
import cn.estsh.i3plus.core.apiservice.dao.IUserPermissionDao;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.convert.ConvertBean;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.EncryptTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.StringTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.PagerHelper;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.enumutil.ImppEnumUtil;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.shirotoken.UserToken;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.tool.HqlPack;
|
|
|
|
|
import cn.estsh.i3plus.pojo.platform.bean.*;
|
|
|
|
@ -22,6 +22,9 @@ import cn.estsh.impp.framework.boot.auth.AuthUtil;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionBuilder;
|
|
|
|
|
import cn.estsh.impp.framework.boot.exception.ImppExceptionEnum;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import org.apache.commons.collections.ListUtils;
|
|
|
|
|
import org.apache.commons.lang3.ArrayUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.shiro.authc.AuthenticationException;
|
|
|
|
|
import org.apache.shiro.authc.CredentialsException;
|
|
|
|
|
import org.apache.shiro.authc.UnknownAccountException;
|
|
|
|
@ -72,7 +75,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
private SysFileRepository sysFileRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysDepartmentRepository sysDepartmentRDao;
|
|
|
|
|
private SysDepartmentRepository departmentRDao;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private SysPositionRepository sysPositionRDao;
|
|
|
|
@ -315,10 +318,58 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "查询用户ID 集合",notes = "根据部门Id 查询用户ID集合")
|
|
|
|
|
public List<Long> findSysUserIdListByDepartmentId(List<Long> idList) {
|
|
|
|
|
List<Long> result = new ArrayList<>();
|
|
|
|
|
if(idList != null){
|
|
|
|
|
StringBuffer hqlWhere = new StringBuffer();
|
|
|
|
|
HqlPack.getInPack(StringUtils.join(idList, ","), "departmentId", hqlWhere);
|
|
|
|
|
List<SysRefUserDepartment> list = refUserDepartmentRDao.findByHqlWhere(hqlWhere.toString());
|
|
|
|
|
if(list != null && list.size() > 0){
|
|
|
|
|
for (SysRefUserDepartment ref : list) {
|
|
|
|
|
result.add(ref.getUserId());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "账号分页查询", notes = "组合查询")
|
|
|
|
|
public ListPager<SysUser> querySysUserByPager(SysUser user, Pager pager) {
|
|
|
|
|
LOGGER.debug("系统用户 SysUser find user :{} page :{}", user, pager);
|
|
|
|
|
|
|
|
|
|
// 角色查询
|
|
|
|
|
if(user.getRoleId() != null){
|
|
|
|
|
List<Long> ids = findSysUserIdListByRoleId(Long.parseLong(user.getRoleId()));
|
|
|
|
|
user.setRoleIdList(StringTool.getListString(ids));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Long> departmentIdList = new ArrayList<>();
|
|
|
|
|
if(user.getOrganizeId() != null){
|
|
|
|
|
|
|
|
|
|
// 查出所有组织 ID 集合
|
|
|
|
|
SysOrganize parent = coreTreeService.getSysOrganizeTreeById(user.getOrganizeId());
|
|
|
|
|
List<Long> childIds = coreTreeService.findSysOrganizeChildIds(parent);
|
|
|
|
|
|
|
|
|
|
// 查询所有部门 ID 集合
|
|
|
|
|
if(childIds != null && childIds.size() > 0){
|
|
|
|
|
for (Long organizeId : childIds) {
|
|
|
|
|
List<Long> ids = coreTreeService.findSysDepartmentIdByOrganizeId(organizeId);
|
|
|
|
|
departmentIdList.addAll(ids);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 封装部门 ID 信息
|
|
|
|
|
if(user.getDepartmentId() != null){
|
|
|
|
|
SysDepartment department = departmentRDao.getById(user.getDepartmentId());
|
|
|
|
|
departmentIdList.addAll(coreTreeService.findSysDepartmentChildIds(department));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<Long> idList = findSysUserIdListByDepartmentId(departmentIdList);
|
|
|
|
|
user.setDepartmentIdList(StringTool.getListString(idList));
|
|
|
|
|
|
|
|
|
|
//生成hql查询语句
|
|
|
|
|
String hqlPack = CoreHqlPack.packHqlSysUser(user);
|
|
|
|
|
pager = PagerHelper.getPager(pager, sysUserRDao.findByHqlWhereCount(hqlPack));
|
|
|
|
@ -626,7 +677,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
|
|
|
|
|
personnelService.findSysRefUserInfoDepartmentById(userInfo.id);
|
|
|
|
|
|
|
|
|
|
userInfo.setDepartment(sysDepartmentRDao.getById(userInfo.getDepartmentId()));
|
|
|
|
|
userInfo.setDepartment(departmentRDao.getById(userInfo.getDepartmentId()));
|
|
|
|
|
userInfo.setDepartmentList(personnelService.findSysUserInfoDepartmentByInfoId(userInfo.getId()));
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Department information Error userId : {} Exception Message : {} " ,userInfo.getId(),e.getMessage());
|
|
|
|
@ -643,7 +694,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", user.getId());
|
|
|
|
|
|
|
|
|
|
user.setDepartment(sysDepartmentRDao.getById(user.getDepartmentId()));
|
|
|
|
|
user.setDepartment(departmentRDao.getById(user.getDepartmentId()));
|
|
|
|
|
user.setDepartmentList(personnelService.findSysUserDepartmentByInfoId(user.id));
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Department information Error userId : {} Exception Message : {} " ,user.getId(),e.getMessage());
|
|
|
|
|