Эх сурвалжийг харах

拦截器获取用户认证信息

vincent 3 жил өмнө
parent
commit
c513f45e63

+ 2 - 2
server/src/main/java/edp/davinci/controller/DataScreeningController.java

@@ -79,11 +79,11 @@ public class DataScreeningController extends BaseController
 
         // 行业分类饼图
         Map<String, List<ViewExt>> mapIndustry = viewList.stream().collect(Collectors.groupingBy(ViewExt::getIndustry));
-        result.put("industrys", mapIndustry);
+        result.put("industryData", mapIndustry);
 
         // 数据资源来源部门柱状图
         Map<String, List<ViewExt>> mapOriginDept = viewList.stream().collect(Collectors.groupingBy(ViewExt::getOriginDept));
-        result.put("originDept", mapOriginDept);
+        result.put("originDeptData", mapOriginDept);
 
         return ResponseEntity.status(HttpStatus.OK).body(result);
     }

+ 5 - 2
server/src/main/java/edp/davinci/core/inteceptor/AuthenticationInterceptor.java

@@ -156,8 +156,11 @@ public class AuthenticationInterceptor implements HandlerInterceptor
                 return false;
             }
             JSONObject userinfoObject = (JSONObject) JSONObject.toJSON(redisMap);
-            String username = userinfoObject.getString("username");
-            User user = userService.getByUsername(username);
+            JSONObject userInfo = userinfoObject.getJSONObject("userInfo");
+            if(null == userinfoObject){
+                log.debug("{} : userinfoObject is null", userinfoObject.toJSONString());
+            }
+            User user = userService.getByUsername(userInfo.getString("username"));
             if (null == user)
             {
                 if (!request.getServletPath().endsWith("/download/page"))