From 08eefab8f0b04018dc62928ec2191bcae9d3e7d0 Mon Sep 17 00:00:00 2001
From: huanghongfa <huanghongfa123456>
Date: 星期五, 15 十月 2021 16:25:01 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/test' into test

---
 springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbServiceTeamServiceImpl.java |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbServiceTeamServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbServiceTeamServiceImpl.java
index 308531c..5a061e1 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbServiceTeamServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_partybuilding/src/main/java/com/panzhihua/service_dangjian/service/impl/ComPbServiceTeamServiceImpl.java
@@ -4,8 +4,13 @@
 
 import javax.annotation.Resource;
 
+import com.alibaba.fastjson.JSONObject;
+import com.panzhihua.common.constants.SecurityConstants;
+import com.panzhihua.common.constants.TokenConstant;
+import com.panzhihua.common.model.vos.LoginUserInfoVO;
 import org.springframework.beans.BeanUtils;
 import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.data.redis.core.ValueOperations;
 import org.springframework.stereotype.Service;
 import org.springframework.util.ObjectUtils;
 
@@ -23,6 +28,8 @@
 import com.panzhihua.service_dangjian.service.ComPbServiceTeamService;
 
 import lombok.extern.slf4j.Slf4j;
+
+import static java.util.Objects.nonNull;
 
 /**
  * @program: springcloud_k8s_panzhihuazhihuishequ
@@ -52,11 +59,25 @@
         ComPbServiceTeamDO comPbServiceTeamDO = new ComPbServiceTeamDO();
         BeanUtils.copyProperties(comPbServiceTeamDTO, comPbServiceTeamDO);
         comPbServiceTeamDO.setIsReg(2);
-        if (comPbMemberRoleDAO.getSysUserByPhoneCount(comPbServiceTeamDTO.getPhone()) > 0) {
+        Long userId = comPbMemberRoleDAO.getSysUserIdByPhone(comPbServiceTeamDTO.getPhone());
+        if (nonNull(userId)) {
             comPbServiceTeamDO.setIsReg(1);
         }
         int insert = comPbServiceTeamDAO.insert(comPbServiceTeamDO);
         if (insert > 0) {
+            if (nonNull(userId)) {
+                String userKey = UserConstants.LOGIN_USER_INFO + userId;
+                Boolean hasKeyLoginUserInfo = stringRedisTemplate.hasKey(userKey);
+                if (hasKeyLoginUserInfo) {
+                    ValueOperations<String, String> valueOperations = stringRedisTemplate.opsForValue();
+                    String userInfo = valueOperations.get(userKey);
+                    LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(userInfo, LoginUserInfoVO.class);
+                    loginUserInfoVO.setIsmemberrole(1);
+                    loginUserInfoVO.setIsCommunityWorker(1);
+                    userInfo = JSONObject.toJSONString(loginUserInfoVO);
+                    valueOperations.set(userKey, userInfo, TokenConstant.EXPIRETIME_REFRESH * 60 * 60 * 1000);
+                }
+            }
             return R.ok();
         }
         return R.fail();

--
Gitblit v1.7.1