|
|
|
@ -1,12 +1,12 @@
|
|
|
|
|
package cn.estsh.i3plus.core.apiservice.serviceimpl.busi;
|
|
|
|
|
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ICoreTreeService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.IPersonnelService;
|
|
|
|
|
import cn.estsh.i3plus.core.api.iservice.busi.ISysUserInfoService;
|
|
|
|
|
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.SerializeTool;
|
|
|
|
|
import cn.estsh.i3plus.platform.common.tool.TimeTool;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.bean.ListPager;
|
|
|
|
|
import cn.estsh.i3plus.pojo.base.common.Pager;
|
|
|
|
@ -22,7 +22,6 @@ 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.lang3.StringUtils;
|
|
|
|
|
import org.apache.shiro.authc.AuthenticationException;
|
|
|
|
|
import org.apache.shiro.authc.CredentialsException;
|
|
|
|
|
import org.apache.shiro.authc.UnknownAccountException;
|
|
|
|
@ -31,7 +30,6 @@ import org.slf4j.LoggerFactory;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -91,6 +89,9 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private ICoreTreeService coreTreeService;
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
private IPersonnelService personnelService;
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@ApiOperation(value = "用户登录", notes = "用户登录功能实现")
|
|
|
|
|
public SessionUser queryUserLogin(String loginName, String password, String languageCode) throws AuthenticationException {
|
|
|
|
@ -475,13 +476,16 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
throw new UnknownAccountException("用户信息不存在");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
packSysUserRole(sessionUser,user); //封装用户角色信息
|
|
|
|
|
packSysUserMenu(sessionUser,user); //封装用户功能信息
|
|
|
|
|
packSysUserRole(user); //封装用户角色信息
|
|
|
|
|
packSysUserMenu(user); //封装用户功能信息
|
|
|
|
|
// packSysUserMenuTree(sessionUser, user); //封装用户功能Tree信息
|
|
|
|
|
packSysUserDepartment(user); //封装用户部门信息
|
|
|
|
|
packSysUserOrganize(user); //封装用户组织信息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
packSysUserDepartment(sessionUser,userInfo); //封装用户部门信息
|
|
|
|
|
packSysUserPosition(sessionUser,userInfo); //封装用户岗位信息
|
|
|
|
|
packSysUserOrganize(userInfo); //封装用户组织信息
|
|
|
|
|
packSysUserInfoDepartment(userInfo); //封装用户部门信息
|
|
|
|
|
packSysUserInfoPosition(userInfo); //封装用户岗位信息
|
|
|
|
|
packSysUserInfoOrganize(userInfo); //封装用户组织信息
|
|
|
|
|
|
|
|
|
|
// userInfo.setUser(user);
|
|
|
|
|
sessionUser.setUserName(userInfo.getName());
|
|
|
|
@ -502,7 +506,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserRole(SessionUser sessionUser, SysUser user){
|
|
|
|
|
public void packSysUserRole(SysUser user){
|
|
|
|
|
List<SysRole> roleList = null;
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", user.getUserInfoId());
|
|
|
|
@ -514,7 +518,6 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
user.setRoleList(roleList);
|
|
|
|
|
sessionUser.setUser(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -523,7 +526,7 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserMenu(SessionUser sessionUser, SysUser user){
|
|
|
|
|
public void packSysUserMenu(SysUser user){
|
|
|
|
|
List<SysMenu> list = null;
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", user.getUserInfoId());
|
|
|
|
@ -535,7 +538,6 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
user.setMenuList(list);
|
|
|
|
|
sessionUser.setUser(user);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// /**
|
|
|
|
@ -567,15 +569,17 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 部门信息封装
|
|
|
|
|
* @param sessionUser
|
|
|
|
|
* @param userInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserDepartment(SessionUser sessionUser, SysUserInfo userInfo){
|
|
|
|
|
public void packSysUserInfoDepartment(SysUserInfo userInfo){
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", userInfo.getId());
|
|
|
|
|
userInfo.setDepartmentList(userPermissionDao.findDepartmentByUser(userInfo));
|
|
|
|
|
|
|
|
|
|
personnelService.findSysRefUserInfoDepartmentById(userInfo.id);
|
|
|
|
|
|
|
|
|
|
userInfo.setDepartment(sysDepartmentRDao.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());
|
|
|
|
|
e.printStackTrace();
|
|
|
|
@ -583,12 +587,28 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 部门信息封装
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserDepartment(SysUser user){
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", user.getId());
|
|
|
|
|
|
|
|
|
|
user.setDepartment(sysDepartmentRDao.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());
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 岗位信息封装
|
|
|
|
|
* @param sessionUser
|
|
|
|
|
* @param userInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserPosition(SessionUser sessionUser, SysUserInfo userInfo){
|
|
|
|
|
public void packSysUserInfoPosition(SysUserInfo userInfo){
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", userInfo.getId());
|
|
|
|
|
userInfo.setPositionList(userPermissionDao.findPositionByUser(userInfo));
|
|
|
|
@ -603,29 +623,32 @@ public class SysUserService implements ISysUserService {
|
|
|
|
|
* @param userInfo
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserOrganize(SysUserInfo userInfo){
|
|
|
|
|
public void packSysUserInfoOrganize(SysUserInfo userInfo){
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", userInfo.getId());
|
|
|
|
|
userInfo.setOrganize(organizeRDao.getById(userInfo.getOrganizeId()));
|
|
|
|
|
|
|
|
|
|
List<SysDepartment> departmentList = userInfo.getDepartmentList();
|
|
|
|
|
if(departmentList != null && departmentList.size() > 0){
|
|
|
|
|
Long[] ids = new Long[departmentList.size()];
|
|
|
|
|
for (int i = 0; i < departmentList.size(); i++) {
|
|
|
|
|
ids[i] = departmentList.get(i).getOrganizeId();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String strWhere = CoreHqlPack.packHqlSysOrganize(ids, ImppEnumUtil.ORGANIZE_YTPE.TYPE_FACTORY.getValue());
|
|
|
|
|
List<SysOrganize> organizeList = organizeRDao.findByHqlWhere(strWhere);
|
|
|
|
|
|
|
|
|
|
userInfo.setOrganizeList(organizeList);
|
|
|
|
|
}
|
|
|
|
|
userInfo.setOrganizeList(personnelService.findSysUserInfoOrganize(userInfo.getId()));;
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Organize information Error userId : {} Exception Message : {} " ,userInfo.getId(),e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 封装用户 组织信息封装
|
|
|
|
|
* @param user
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public void packSysUserOrganize(SysUser user){
|
|
|
|
|
try {
|
|
|
|
|
LOGGER.debug("平台用户 SYS_USER user id :{}", user.getId());
|
|
|
|
|
user.setOrganize(organizeRDao.getById(user.getOrganizeId()));
|
|
|
|
|
user.setOrganizeList(personnelService.findSysUserOrganize(user.getId()));;
|
|
|
|
|
}catch (Exception e){
|
|
|
|
|
LOGGER.error(" SysUser Peck Organize information Error userId : {} Exception Message : {} " ,user.getId(),e.getMessage());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 获取集合中的Root Id
|
|
|
|
|
* @param menus
|
|
|
|
|
* @return
|
|
|
|
|