Quellcode durchsuchen

fix bug:全部关系总览页点击自动计算时传递给dmp-rwd的集团编码为空

lijie vor 3 Jahren
Ursprung
Commit
b7a1598d7e

+ 8 - 0
src/main/java/com/persagy/proxy/common/handler/AdmContextHandler.java

@@ -3,6 +3,7 @@ package com.persagy.proxy.common.handler;
 import cn.hutool.core.util.StrUtil;
 import com.persagy.dmp.common.constant.CommonConstant;
 import com.persagy.dmp.common.context.AppContext;
+import com.persagy.dmp.common.helper.SpringHelper;
 import org.springframework.web.servlet.ModelAndView;
 import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
 
@@ -16,6 +17,8 @@ import javax.servlet.http.HttpServletResponse;
  */
 public class AdmContextHandler extends HandlerInterceptorAdapter {
 
+    private final static String MIDDLEWARE_GROUP_CODE = "middleware.group.code";
+
     @Override
     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
         // 从header中获取上下文
@@ -42,6 +45,11 @@ public class AdmContextHandler extends HandlerInterceptorAdapter {
             userId = CommonConstant.DEFAULT_ID;
         }
         AppContext.getContext().setAccountId(userId);
+        // 无集团编码时,默认为配置的集团编码
+        String groupCode = request.getHeader("groupCode");
+        if(StrUtil.isBlank(groupCode)) {
+            AppContext.getContext().setGroupCode(SpringHelper.getString(MIDDLEWARE_GROUP_CODE));
+        }
     }
 
     @Override