From 3c886051f6752b768f45fe12399fcbaf947f725a Mon Sep 17 00:00:00 2001
From: 张天森 <1292933220@qq.com>
Date: 星期六, 24 九月 2022 10:29:12 +0800
Subject: [PATCH] update

---
 springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java |   45 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 44 insertions(+), 1 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
index c7413ea..3324a59 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_user/src/main/java/com/panzhihua/service_user/service/impl/UserServiceImpl.java
@@ -470,6 +470,28 @@
             }
         }
         loginUserInfoVO.setIsRealNamed(sysUserDO.getIdCard() != null);
+        //是否社区或街道后台
+        int countSocialOrg=userDao.countSocialOrg(sysUserDO.getUserId());
+        if(countSocialOrg>0){
+            loginUserInfoVO.setUserType(3);
+        }
+        else {
+            if(loginUserInfoVO.getStreetId()!=null){
+                loginUserInfoVO.setUserType(1);
+                loginUserInfoVO.setLevel(3);
+            }
+            else {
+                loginUserInfoVO.setUserType(2);
+                loginUserInfoVO.setLevel(4);
+            }
+        }
+        if (sysUserDO.getType().equals(11)){
+            loginUserInfoVO.setLevel(5);
+        }else if (sysUserDO.getType().equals(12)){
+            loginUserInfoVO.setLevel(2);
+        }else if (isNull(loginUserInfoVO.getLevel())){
+            loginUserInfoVO.setLevel(1);
+        }
         return R.ok(loginUserInfoVO);
     }
 
@@ -745,10 +767,19 @@
         else {
             if(loginUserInfoVO.getStreetId()!=null){
                 loginUserInfoVO.setUserType(1);
+                loginUserInfoVO.setLevel(3);
             }
             else {
                 loginUserInfoVO.setUserType(2);
+                loginUserInfoVO.setLevel(4);
             }
+        }
+        if (sysUserDO.getType().equals(11)){
+            loginUserInfoVO.setLevel(5);
+        }else if (sysUserDO.getType().equals(12)){
+            loginUserInfoVO.setLevel(2);
+        }else if (isNull(loginUserInfoVO.getLevel())){
+            loginUserInfoVO.setLevel(1);
         }
         return R.ok(loginUserInfoVO);
     }
@@ -3679,8 +3710,20 @@
             if (nonNull(administratorsUserVO.getImageUrl())){
                 sysUserDO.setImageUrl(administratorsUserVO.getImageUrl());
             }
-            sysUserDO.setType(administratorsUserVO.getType());
+            if (nonNull(administratorsUserVO.getType())){
+                sysUserDO.setType(administratorsUserVO.getType());
+            }
             userDao.insert(sysUserDO);
+            //分配权限
+            SysUserRoleDO sysUserRole=new SysUserRoleDO();
+            sysUserRole.setUserId(sysUserDO.getUserId());
+            if (sysUserDO.getType().equals(11)){
+                sysUserRole.setRoleId(Long.parseLong(UserConstants.SANSHUO_EXPERT_ROLE));
+            }else{
+                sysUserRole.setRoleId(Long.parseLong(UserConstants.SANSHUO_INDUSTRY_CENTER_ROLE));
+            }
+            //配置权限
+            sysUserRoleDAO.insert(sysUserRole);
             return R.ok();
         }
         return R.fail("账户名已存在");

--
Gitblit v1.7.1