From 18810e50d448388ec6849d2b7745b19190daf064 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期三, 26 二月 2025 02:10:59 +0800 Subject: [PATCH] 三个身边代码提交 --- springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/controller/BaseController.java | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/controller/BaseController.java b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/controller/BaseController.java index 963b4e3..ad2c431 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/controller/BaseController.java +++ b/springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/controller/BaseController.java @@ -1,8 +1,10 @@ package com.panzhihua.common.controller; import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; import com.panzhihua.common.model.vos.community.ComActVO; +import com.panzhihua.common.model.vos.sangeshenbian.SystemUserVo; import com.panzhihua.common.utlis.StringUtils; import org.springframework.util.ObjectUtils; import org.springframework.web.context.request.RequestContextHolder; @@ -44,6 +46,14 @@ */ public HttpServletRequest getRequest() { return ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest(); + } + + + /** + * 获取request对象 + */ + public HttpServletResponse getResponse() { + return ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse(); } /** @@ -191,5 +201,23 @@ LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class); return loginUserInfoVO; } + /** + * 获取三个身边管理后台登录用户信息 + * @return + */ + @SneakyThrows + public SystemUserVo getLoginUserInfoSanGeShenBian() { + HttpServletRequest request = this.getRequest(); + String userInfo = request.getHeader(TokenConstant.TOKEN_USERINFO); + boolean empty = ObjectUtils.isEmpty(userInfo); + if (empty) { + return null; + } + byte[] bytes = AES.parseHexStr2Byte(userInfo); + byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY); + userInfo = new String(decrypt); + SystemUserVo loginUserInfoVO = JSONObject.parseObject(userInfo, SystemUserVo.class); + return loginUserInfoVO; + } } -- Gitblit v1.7.1