org.jeecg.common.system.vo.SysUserCacheInfo Java Examples
The following examples show how to use
org.jeecg.common.system.vo.SysUserCacheInfo.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SysUserServiceImpl.java From jeecg-boot with Apache License 2.0 | 5 votes |
@Override public SysUserCacheInfo getCacheUser(String username) { SysUserCacheInfo info = new SysUserCacheInfo(); info.setOneDepart(true); // SysUser user = userMapper.getUserByName(username); // info.setSysUserCode(user.getUsername()); // info.setSysUserName(user.getRealname()); LoginUser user = sysBaseAPI.getUserByName(username); if(user!=null) { info.setSysUserCode(user.getUsername()); info.setSysUserName(user.getRealname()); info.setSysOrgCode(user.getOrgCode()); } //多部门支持in查询 List<SysDepart> list = sysDepartMapper.queryUserDeparts(user.getId()); List<String> sysMultiOrgCode = new ArrayList<String>(); if(list==null || list.size()==0) { //当前用户无部门 //sysMultiOrgCode.add("0"); }else if(list.size()==1) { sysMultiOrgCode.add(list.get(0).getOrgCode()); }else { info.setOneDepart(false); for (SysDepart dpt : list) { sysMultiOrgCode.add(dpt.getOrgCode()); } } info.setSysMultiOrgCode(sysMultiOrgCode); return info; }
Example #2
Source File: PermissionDataAspect.java From jeecg-cloud with Apache License 2.0 | 5 votes |
private void authDataHandler(HttpServletRequest request, String component) { List<SysPermission> currentSyspermission = null; if(oConvertUtils.isNotEmpty(component)) { //1.通过注解属性pageComponent 获取菜单 currentSyspermission = sysUserRemoteApi.queryComponentPermission(component); }else { String requestMethod = request.getMethod(); String requestPath = request.getRequestURI().substring(request.getContextPath().length()); requestPath = filterUrl(requestPath); log.info("拦截请求 >> "+requestPath+";请求类型 >> "+requestMethod); currentSyspermission = sysUserRemoteApi.queryRequestPermission(requestMethod, requestPath); } //3.通过用户名+菜单ID 找到权限配置信息 放到request中去 if(currentSyspermission!=null && currentSyspermission.size()>0) { String username = JwtUtil.getUserNameByToken(request); List<SysPermissionDataRuleModel> dataRules = new ArrayList<SysPermissionDataRuleModel>(); for (SysPermission sysPermission : currentSyspermission) { // update-begin--Author:scott Date:20191119 for:数据权限规则编码不规范,项目存在相同包名和类名 #722 List<SysPermissionDataRule> temp = sysUserRemoteApi.queryUserDataRule(username, sysPermission.getId()); if(temp!=null && temp.size()>0) { //dataRules.addAll(temp); dataRules = oConvertUtils.entityListToModelList(temp,SysPermissionDataRuleModel.class); } // update-end--Author:scott Date:20191119 for:数据权限规则编码不规范,项目存在相同包名和类名 #722 } if(dataRules!=null && dataRules.size()>0) { JeecgDataAutorUtils.installDataSearchConditon(request, dataRules); SysUserCacheInfo userinfo = sysUserRemoteApi.getCacheUser(username); JeecgDataAutorUtils.installUserInfo(request, userinfo); } } }
Example #3
Source File: SysUserServiceImpl.java From jeecg-cloud with Apache License 2.0 | 5 votes |
@Override public SysUserCacheInfo getCacheUser(String username) { SysUserCacheInfo info = new SysUserCacheInfo(); info.setOneDepart(true); // SysUser user = userMapper.getUserByName(username); // info.setSysUserCode(user.getUsername()); // info.setSysUserName(user.getRealname()); LoginUser user = sysBaseAPI.getUserByName(username); if(user!=null) { info.setSysUserCode(user.getUsername()); info.setSysUserName(user.getRealname()); info.setSysOrgCode(user.getOrgCode()); } //多部门支持in查询 List<SysDepart> list = sysDepartMapper.queryUserDeparts(user.getId()); List<String> sysMultiOrgCode = new ArrayList<String>(); if(list==null || list.size()==0) { //当前用户无部门 //sysMultiOrgCode.add("0"); }else if(list.size()==1) { sysMultiOrgCode.add(list.get(0).getOrgCode()); }else { info.setOneDepart(false); for (SysDepart dpt : list) { sysMultiOrgCode.add(dpt.getOrgCode()); } } info.setSysMultiOrgCode(sysMultiOrgCode); return info; }
Example #4
Source File: SysUserServiceImpl.java From teaching with Apache License 2.0 | 5 votes |
@Override public SysUserCacheInfo getCacheUser(String username) { SysUserCacheInfo info = new SysUserCacheInfo(); info.setOneDepart(true); // SysUser user = userMapper.getUserByName(username); // info.setSysUserCode(user.getUsername()); // info.setSysUserName(user.getRealname()); LoginUser user = sysBaseAPI.getUserByName(username); if(user!=null) { info.setSysUserCode(user.getUsername()); info.setSysUserName(user.getRealname()); info.setSysOrgCode(user.getOrgCode()); } //多部门支持in查询 List<SysDepart> list = sysDepartMapper.queryUserDeparts(user.getId()); List<String> sysMultiOrgCode = new ArrayList<String>(); if(list==null || list.size()==0) { //当前用户无部门 //sysMultiOrgCode.add("0"); }else if(list.size()==1) { sysMultiOrgCode.add(list.get(0).getOrgCode()); }else { info.setOneDepart(false); for (SysDepart dpt : list) { sysMultiOrgCode.add(dpt.getOrgCode()); } } info.setSysMultiOrgCode(sysMultiOrgCode); return info; }
Example #5
Source File: SysUserServiceImpl.java From jeecg-boot-with-activiti with MIT License | 5 votes |
@Override public SysUserCacheInfo getCacheUser(String username) { SysUserCacheInfo info = new SysUserCacheInfo(); info.setOneDepart(true); // SysUser user = userMapper.getUserByName(username); // info.setSysUserCode(user.getUsername()); // info.setSysUserName(user.getRealname()); LoginUser user = sysBaseAPI.getUserByName(username); if(user!=null) { info.setSysUserCode(user.getUsername()); info.setSysUserName(user.getRealname()); info.setSysOrgCode(user.getOrgCode()); } //多部门支持in查询 List<SysDepart> list = sysDepartMapper.queryUserDeparts(user.getId()); List<String> sysMultiOrgCode = new ArrayList<String>(); if(list==null || list.size()==0) { //当前用户无部门 //sysMultiOrgCode.add("0"); }else if(list.size()==1) { sysMultiOrgCode.add(list.get(0).getOrgCode()); }else { info.setOneDepart(false); for (SysDepart dpt : list) { sysMultiOrgCode.add(dpt.getOrgCode()); } } info.setSysMultiOrgCode(sysMultiOrgCode); return info; }
Example #6
Source File: SysUserRemoteApiFallbackImpl.java From jeecg-cloud with Apache License 2.0 | 4 votes |
@Override public SysUserCacheInfo getCacheUser(String username) { return null; }
Example #7
Source File: JwtUtil.java From jeecg-boot with Apache License 2.0 | 4 votes |
/** * 从当前用户中获取变量 * @param key * @param user * @return */ //TODO 急待改造 sckjkdsjsfjdk public static String getUserSystemData(String key,SysUserCacheInfo user) { if(user==null) { user = JeecgDataAutorUtils.loadUserInfo(); } //#{sys_user_code}% // 获取登录用户信息 LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String moshi = ""; if(key.indexOf("}")!=-1){ moshi = key.substring(key.indexOf("}")+1); } String returnValue = null; //针对特殊标示处理#{sysOrgCode},判断替换 if (key.contains("#{")) { key = key.substring(2,key.indexOf("}")); } else { key = key; } //替换为系统登录用户帐号 if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_CODE_TABLE)) { if(user==null) { returnValue = sysUser.getUsername(); }else { returnValue = user.getSysUserCode(); } } //替换为系统登录用户真实名字 else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_NAME_TABLE)) { if(user==null) { returnValue = sysUser.getRealname(); }else { returnValue = user.getSysUserName(); } } //替换为系统用户登录所使用的机构编码 else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) { if(user==null) { returnValue = sysUser.getOrgCode(); }else { returnValue = user.getSysOrgCode(); } } //替换为系统用户所拥有的所有机构编码 else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) { if(user.isOneDepart()) { returnValue = user.getSysMultiOrgCode().get(0); }else { returnValue = Joiner.on(",").join(user.getSysMultiOrgCode()); } } //替换为当前系统时间(年月日) else if (key.equals(DataBaseConstant.SYS_DATE)|| key.toLowerCase().equals(DataBaseConstant.SYS_DATE_TABLE)) { returnValue = user.getSysDate(); } //替换为当前系统时间(年月日时分秒) else if (key.equals(DataBaseConstant.SYS_TIME)|| key.toLowerCase().equals(DataBaseConstant.SYS_TIME_TABLE)) { returnValue = user.getSysTime(); } //流程状态默认值(默认未发起) else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.toLowerCase().equals(DataBaseConstant.BPM_STATUS_TABLE)) { returnValue = "1"; } if(returnValue!=null){returnValue = returnValue + moshi;} return returnValue; }
Example #8
Source File: JeecgDataAutorUtils.java From jeecg-boot with Apache License 2.0 | 4 votes |
public static synchronized void installUserInfo(HttpServletRequest request, SysUserCacheInfo userinfo) { request.setAttribute(SYS_USER_INFO, userinfo); }
Example #9
Source File: JwtUtil.java From teaching with Apache License 2.0 | 4 votes |
/** * 从当前用户中获取变量 * @param key * @param user * @return */ //TODO 急待改造 sckjkdsjsfjdk public static String getUserSystemData(String key,SysUserCacheInfo user) { if(user==null) { user = JeecgDataAutorUtils.loadUserInfo(); } //#{sys_user_code}% // 获取登录用户信息 LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String moshi = ""; if(key.indexOf("}")!=-1){ moshi = key.substring(key.indexOf("}")+1); } String returnValue = null; //针对特殊标示处理#{sysOrgCode},判断替换 if (key.contains("#{")) { key = key.substring(2,key.indexOf("}")); } else { key = key; } //替换为系统登录用户帐号 if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) { if(user==null) { returnValue = sysUser.getUsername(); }else { returnValue = user.getSysUserCode(); } } //替换为系统登录用户真实名字 else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)) { if(user==null) { returnValue = sysUser.getRealname(); }else { returnValue = user.getSysUserName(); } } //替换为系统用户登录所使用的机构编码 else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) { if(user==null) { returnValue = sysUser.getOrgCode(); }else { returnValue = user.getSysOrgCode(); } } //替换为系统用户所拥有的所有机构编码 else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) { if(user.isOneDepart()) { returnValue = user.getSysMultiOrgCode().get(0); }else { returnValue = Joiner.on(",").join(user.getSysMultiOrgCode()); } } //替换为当前系统时间(年月日) else if (key.equals(DataBaseConstant.SYS_DATE)|| key.equals(DataBaseConstant.SYS_DATE_TABLE)) { returnValue = user.getSysDate(); } //替换为当前系统时间(年月日时分秒) else if (key.equals(DataBaseConstant.SYS_TIME)|| key.equals(DataBaseConstant.SYS_TIME_TABLE)) { returnValue = user.getSysTime(); } //流程状态默认值(默认未发起) else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.equals(DataBaseConstant.BPM_STATUS_TABLE)) { returnValue = "1"; } if(returnValue!=null){returnValue = returnValue + moshi;} return returnValue; }
Example #10
Source File: JeecgDataAutorUtils.java From teaching with Apache License 2.0 | 4 votes |
public static synchronized void installUserInfo(HttpServletRequest request, SysUserCacheInfo userinfo) { request.setAttribute(SYS_USER_INFO, userinfo); }
Example #11
Source File: JwtUtil.java From jeecg-boot-with-activiti with MIT License | 4 votes |
/** * 从当前用户中获取变量 * @param key * @param user * @return */ //TODO 急待改造 sckjkdsjsfjdk public static String getUserSystemData(String key,SysUserCacheInfo user) { if(user==null) { user = JeecgDataAutorUtils.loadUserInfo(); } //#{sys_user_code}% // 获取登录用户信息 LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); String moshi = ""; if(key.indexOf("}")!=-1){ moshi = key.substring(key.indexOf("}")+1); } String returnValue = null; //针对特殊标示处理#{sysOrgCode},判断替换 if (key.contains("#{")) { key = key.substring(2,key.indexOf("}")); } else { key = key; } //替换为系统登录用户帐号 if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.equals(DataBaseConstant.SYS_USER_CODE_TABLE)) { if(user==null) { returnValue = sysUser.getUsername(); }else { returnValue = user.getSysUserCode(); } } //替换为系统登录用户真实名字 else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.equals(DataBaseConstant.SYS_USER_NAME_TABLE)) { if(user==null) { returnValue = sysUser.getRealname(); }else { returnValue = user.getSysUserName(); } } //替换为系统用户登录所使用的机构编码 else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) { if(user==null) { returnValue = sysUser.getOrgCode(); }else { returnValue = user.getSysOrgCode(); } } //替换为系统用户所拥有的所有机构编码 else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) { if(user.isOneDepart()) { returnValue = user.getSysMultiOrgCode().get(0); }else { returnValue = Joiner.on(",").join(user.getSysMultiOrgCode()); } } //替换为当前系统时间(年月日) else if (key.equals(DataBaseConstant.SYS_DATE)|| key.equals(DataBaseConstant.SYS_DATE_TABLE)) { returnValue = user.getSysDate(); } //替换为当前系统时间(年月日时分秒) else if (key.equals(DataBaseConstant.SYS_TIME)|| key.equals(DataBaseConstant.SYS_TIME_TABLE)) { returnValue = user.getSysTime(); } //流程状态默认值(默认未发起) else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.equals(DataBaseConstant.BPM_STATUS_TABLE)) { returnValue = "1"; } if(returnValue!=null){returnValue = returnValue + moshi;} return returnValue; }
Example #12
Source File: JeecgDataAutorUtils.java From jeecg-boot-with-activiti with MIT License | 4 votes |
public static synchronized void installUserInfo(HttpServletRequest request, SysUserCacheInfo userinfo) { request.setAttribute(SYS_USER_INFO, userinfo); }
Example #13
Source File: JwtUtil.java From jeecg-cloud with Apache License 2.0 | 4 votes |
/** * 从当前用户中获取变量 * @param key * @param user * @return */ //TODO 急待改造 sckjkdsjsfjdk public static String getUserSystemData(String key,SysUserCacheInfo user) { if(user==null) { user = JeecgDataAutorUtils.loadUserInfo(); } //#{sys_user_code}% // 获取登录用户信息 LoginUser sysUser = JwtUtil.getLoginUser(); String moshi = ""; if(key.indexOf("}")!=-1){ moshi = key.substring(key.indexOf("}")+1); } String returnValue = null; //针对特殊标示处理#{sysOrgCode},判断替换 if (key.contains("#{")) { key = key.substring(2,key.indexOf("}")); } else { key = key; } //替换为系统登录用户帐号 if (key.equals(DataBaseConstant.SYS_USER_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_CODE_TABLE)) { if(user==null) { returnValue = sysUser.getUsername(); }else { returnValue = user.getSysUserCode(); } } //替换为系统登录用户真实名字 else if (key.equals(DataBaseConstant.SYS_USER_NAME)|| key.toLowerCase().equals(DataBaseConstant.SYS_USER_NAME_TABLE)) { if(user==null) { returnValue = sysUser.getRealname(); }else { returnValue = user.getSysUserName(); } } //替换为系统用户登录所使用的机构编码 else if (key.equals(DataBaseConstant.SYS_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_ORG_CODE_TABLE)) { if(user==null) { returnValue = sysUser.getOrgCode(); }else { returnValue = user.getSysOrgCode(); } } //替换为系统用户所拥有的所有机构编码 else if (key.equals(DataBaseConstant.SYS_MULTI_ORG_CODE)|| key.toLowerCase().equals(DataBaseConstant.SYS_MULTI_ORG_CODE_TABLE)) { if(user.isOneDepart()) { returnValue = user.getSysMultiOrgCode().get(0); }else { returnValue = Joiner.on(",").join(user.getSysMultiOrgCode()); } } //替换为当前系统时间(年月日) else if (key.equals(DataBaseConstant.SYS_DATE)|| key.toLowerCase().equals(DataBaseConstant.SYS_DATE_TABLE)) { returnValue = user.getSysDate(); } //替换为当前系统时间(年月日时分秒) else if (key.equals(DataBaseConstant.SYS_TIME)|| key.toLowerCase().equals(DataBaseConstant.SYS_TIME_TABLE)) { returnValue = user.getSysTime(); } //流程状态默认值(默认未发起) else if (key.equals(DataBaseConstant.BPM_STATUS)|| key.toLowerCase().equals(DataBaseConstant.BPM_STATUS_TABLE)) { returnValue = "1"; } if(returnValue!=null){returnValue = returnValue + moshi;} return returnValue; }
Example #14
Source File: JeecgDataAutorUtils.java From jeecg-cloud with Apache License 2.0 | 4 votes |
public static synchronized void installUserInfo(HttpServletRequest request, SysUserCacheInfo userinfo) { request.setAttribute(SYS_USER_INFO, userinfo); }
Example #15
Source File: JeecgDataAutorUtils.java From jeecg-boot-with-activiti with MIT License | 2 votes |
public static synchronized SysUserCacheInfo loadUserInfo() { return (SysUserCacheInfo) SpringContextUtils.getHttpServletRequest().getAttribute(SYS_USER_INFO); }
Example #16
Source File: ISysUserService.java From jeecg-boot-with-activiti with MIT License | 2 votes |
/** * 查询用户信息包括 部门信息 * @param username * @return */ public SysUserCacheInfo getCacheUser(String username);
Example #17
Source File: JeecgDataAutorUtils.java From teaching with Apache License 2.0 | 2 votes |
public static synchronized SysUserCacheInfo loadUserInfo() { return (SysUserCacheInfo) SpringContextUtils.getHttpServletRequest().getAttribute(SYS_USER_INFO); }
Example #18
Source File: JeecgDataAutorUtils.java From jeecg-cloud with Apache License 2.0 | 2 votes |
public static synchronized SysUserCacheInfo loadUserInfo() { return (SysUserCacheInfo) SpringContextUtils.getHttpServletRequest().getAttribute(SYS_USER_INFO); }
Example #19
Source File: ISysUserService.java From teaching with Apache License 2.0 | 2 votes |
/** * 查询用户信息包括 部门信息 * @param username * @return */ public SysUserCacheInfo getCacheUser(String username);
Example #20
Source File: ISysUserService.java From jeecg-cloud with Apache License 2.0 | 2 votes |
/** * 查询用户信息包括 部门信息 * @param username * @return */ public SysUserCacheInfo getCacheUser(String username);
Example #21
Source File: JeecgDataAutorUtils.java From jeecg-boot with Apache License 2.0 | 2 votes |
public static synchronized SysUserCacheInfo loadUserInfo() { return (SysUserCacheInfo) SpringContextUtils.getHttpServletRequest().getAttribute(SYS_USER_INFO); }
Example #22
Source File: SysUserController.java From jeecg-cloud with Apache License 2.0 | 2 votes |
/** * 根据username获取用户信息 * @param username * @return */ @GetMapping(value = "getCacheUser") public SysUserCacheInfo getCacheUser(@RequestParam(name="username") String username){ return sysUserService.getCacheUser(username); }
Example #23
Source File: SysUserRemoteApi.java From jeecg-cloud with Apache License 2.0 | 2 votes |
/** * 根据用户名获取用户信息 * @param username * @return */ @GetMapping("/sys/user/getCacheUser") SysUserCacheInfo getCacheUser(@RequestParam("username") String username);
Example #24
Source File: ISysUserService.java From jeecg-boot with Apache License 2.0 | 2 votes |
/** * 查询用户信息包括 部门信息 * @param username * @return */ public SysUserCacheInfo getCacheUser(String username);