From b932b837f29e6be3be8cac4cf768a208ea28c683 Mon Sep 17 00:00:00 2001
From: findyguo <12205921@qq.com>
Date: 星期四, 04 三月 2021 16:25:50 +0800
Subject: [PATCH] 留言新增

---
 springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/controller/BaseController.java |   13 ++++++++++---
 1 files changed, 10 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 1755b40..8639fc0 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
@@ -4,6 +4,7 @@
 import com.panzhihua.common.constants.Constants;
 import com.panzhihua.common.constants.TokenConstant;
 import com.panzhihua.common.constants.UserConstants;
+import com.panzhihua.common.exceptions.ServiceException;
 import com.panzhihua.common.exceptions.UnAuthenticationException;
 import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import com.panzhihua.common.utlis.AES;
@@ -49,6 +50,9 @@
     public Long getCommunityId(){
         LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
         Long communityId = loginUserInfo.getCommunityId();
+        if (null==communityId||0==communityId) {
+            throw  new ServiceException("用户未绑定社区");
+        }
         return communityId;
     }
 
@@ -59,6 +63,9 @@
     public Long getAreaId(){
         LoginUserInfoVO loginUserInfo = this.getLoginUserInfo();
         Long areaId = loginUserInfo.getAreaId();
+        if (null==areaId||0==areaId) {
+            throw  new ServiceException("用户未绑定社区");
+        }
         return areaId;
     }
 
@@ -84,11 +91,11 @@
         if (empty) {
             throw new UnAuthenticationException("获取登录人信息失败");
         }
-        log.info("userInfo【{}】",userInfo);
+//        log.info("userInfo【{}】",userInfo);
         byte[] bytes = AES.parseHexStr2Byte(userInfo);
-        log.info("bytes【{}】",bytes);
+//        log.info("bytes【{}】",bytes);
         byte[] decrypt = AES.decrypt(bytes, Constants.AES_KEY);
-        log.info("decrypt【{}】",decrypt);
+//        log.info("decrypt【{}】",decrypt);
         userInfo=new String(decrypt);
         LoginUserInfoVO loginUserInfoVO= JSONObject.parseObject(userInfo,LoginUserInfoVO.class);
         return loginUserInfoVO;

--
Gitblit v1.7.1