张天森
2022-09-24 3c886051f6752b768f45fe12399fcbaf947f725a
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("账户名已存在");