From bbda2ee1af4e86d76f93e00386d77efb56c60d5f Mon Sep 17 00:00:00 2001
From: puhanshu <a9236326>
Date: 星期六, 23 七月 2022 15:42:06 +0800
Subject: [PATCH] bug修改

---
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/controller/BaseController.java |   50 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 47 insertions(+), 3 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 81ce29e..c0a9cc3 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
@@ -2,6 +2,8 @@
 
 import javax.servlet.http.HttpServletRequest;
 
+import com.panzhihua.common.model.vos.community.ComActVO;
+import com.panzhihua.common.utlis.StringUtils;
 import org.springframework.util.ObjectUtils;
 import org.springframework.web.context.request.RequestContextHolder;
 import org.springframework.web.context.request.ServletRequestAttributes;
@@ -16,6 +18,9 @@
 
 import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.isNull;
+import static org.apache.commons.lang3.StringUtils.isBlank;
 
 /**
  * @program: springcloud_k8s_panzhihuazhihuishequ
@@ -60,7 +65,7 @@
     public Long getCommunityId() {
         LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
         Long communityId = loginUserInfo.getCommunityId();
-        if (null == communityId || 0 == communityId) {
+        if (null == communityId) {
             throw new ServiceException("用户未绑定社区");
         }
         return communityId;
@@ -89,11 +94,38 @@
     public Long getAreaId() {
         LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
         Long areaId = loginUserInfo.getAreaId();
-        if (null == areaId || 0 == areaId) {
-            throw new ServiceException("用户未绑定社区");
+        if (null == areaId) {
+            throw new ServiceException("用户未绑定小区");
         }
         return areaId;
     }
+    /**
+     * 获取登录对象所在区域编码
+     *
+     * @return
+     */
+    public String getAreaCode() {
+        String appid = this.getRequest().getHeader("appid");
+        if(StringUtils.isNotEmpty(appid)){
+            if(appid.equals("wx08932ba29546ff82")){
+                return "510411";
+            }
+            else if(appid.equals("wx50d8c395af50481b")){
+                return "510402";
+            }
+            else {
+                return "510423";
+            }
+        } else {
+            LoginUserInfoVO loginUserInfoVO=this.getLoginUserInfo();
+            ComActVO comActVO=loginUserInfoVO.getComActVO();
+            if(isNull(comActVO) || isBlank(comActVO.getAreaCode())){
+                return "510423";
+            }
+            return comActVO.getAreaCode();
+        }
+    }
+
 
     /**
      * 获取登录token
@@ -106,6 +138,18 @@
         return header;
     }
 
+    public String getAppId(){
+        String appid = this.getRequest().getHeader("appid");
+        if(StringUtils.isEmpty(appid)){
+            return "wx0cef797390444b75";
+        }
+        return appid;
+    }
+
+    public String getAppSecret(){
+        LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
+        return loginUserInfo.getAppSecret();
+    }
     /**
      * 获取登录对象所有信息
      *

--
Gitblit v1.7.1