guoshilong
2023-06-21 4bdde4f8171028442dd2d1da6f0be715cd676853
skjcmanager/skjcmanager-auth/src/main/java/cn/gistack/auth/service/BladeUserDetailsServiceImpl.java
@@ -17,6 +17,8 @@
package cn.gistack.auth.service;
import cn.gistack.auth.constant.AuthConstant;
import cn.gistack.sm.collect.feign.ICollectClient;
import cn.gistack.sm.collect.feign.ICollectClientFallback;
import cn.gistack.sm.sjztmd.entity.AttResManagePerson;
import cn.gistack.sm.sjztmd.feign.IAttResManagePersonClient;
import cn.gistack.system.entity.Dept;
@@ -66,6 +68,8 @@
   private final BladeRedis bladeRedis;
   private final JwtProperties jwtProperties;
   private final ICollectClient collectClient;
   @Override
   @SneakyThrows
@@ -157,11 +161,18 @@
            deptStr = userInfo.getUser().getDeptId();
         }
         R<Dept> deptRes = sysClient.getDept(Long.valueOf(deptStr));
         if (StringUtil.isBlank(deptRes.getData().getAdCode()))
         if (StringUtil.isBlank(deptRes.getData().getAdCode())) {
            // 部门为空
            throw new UserDeniedAuthorizationException("没有找到有效组织机构~");
         else
//            throw new UserDeniedAuthorizationException("没有找到有效组织机构~");
            userInfo.getDetail().set("adCodeBase", "");
            userInfo.getDetail().set("parentDept",0);
         } else {
            userInfo.getDetail().set("adCodeBase",attResManagePersonClient.getAdBaseById(deptRes.getData().getAdCode()).getData());
            userInfo.getDetail().set("parentDept",deptRes.getData().getParentId());
         }
         String collectResIds = collectClient.getMyCollect(user.getId().toString());
         userInfo.getDetail().set("collect",collectResIds);
         return new BladeUserDetails(user.getId(),
            user.getTenantId(), StringPool.EMPTY, user.getName(), user.getRealName(), user.getDeptId(), user.getPostId(), user.getRoleId(), Func.join(userInfo.getRoles()), Func.toStr(user.getAvatar(), TokenUtil.DEFAULT_AVATAR),