xucaiqin 1 mēnesi atpakaļ
vecāks
revīzija
4956b8effb

+ 1 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/RemoteSystemService.java

@@ -185,6 +185,7 @@ public interface RemoteSystemService {
      * @date: 2023/7/7
      */
     UserCacheResDto queryUserCacheById(Long userId);
+    UserResDto queryUserById(Long userId);
 
     /**
      * @desc: 从缓存查用户信息

+ 25 - 0
sckw-modules-api/sckw-system-api/src/main/java/com/sckw/system/api/model/dto/res/UserResDto.java

@@ -0,0 +1,25 @@
+package com.sckw.system.api.model.dto.res;
+
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author czh
+ * @desc 用户信息
+ * @date 2023/7/7
+ */
+@Data
+public class UserResDto implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 5711974940665217921L;
+
+
+    private Long id;
+    private Integer isMain;
+    private Integer systemType;
+    private Long entId;
+
+}

+ 13 - 5
sckw-modules/sckw-system/src/main/java/com/sckw/system/dubbo/RemoteSystemServiceImpl.java

@@ -1,12 +1,12 @@
 package com.sckw.system.dubbo;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.enums.EntTypeEnum;
-
 import com.sckw.core.utils.BeanUtils;
 import com.sckw.core.utils.CollectionUtils;
 import com.sckw.core.utils.FileUtils;
@@ -21,7 +21,6 @@ import com.sckw.system.model.*;
 import com.sckw.system.model.vo.res.FindAreaTreeResVo;
 import com.sckw.system.model.vo.res.KwsUserResVo;
 import com.sckw.system.repository.KwsEntTypeRepository;
-import com.sckw.system.repository.KwsEnterpriseRepository;
 import com.sckw.system.service.KwsUserService;
 import com.sckw.system.service.SysAreaService;
 import jakarta.annotation.Resource;
@@ -589,7 +588,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
 //                return userCacheResDto;
 //            }
 
-           // Long entId = kwsDeptResDtos.get(0).getEntId();
+            // Long entId = kwsDeptResDtos.get(0).getEntId();
             KwsEnterpriseResDto kwsEnterpriseResDto = remoteBaseService.queryEnterpriseById(kwsUser.getEntId());
             if (Objects.isNull(kwsEnterpriseResDto)) {
                 return userCacheResDto;
@@ -607,6 +606,15 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
         return JSONObject.parseObject(dictCache, UserCacheResDto.class);
     }
 
+    @Override
+    public UserResDto queryUserById(Long userId) {
+        KwsUser kwsUser = kwsUserService.selectByKey(userId);
+        if (Objects.nonNull(kwsUser)) {
+            return BeanUtil.toBean(kwsUser, UserResDto.class);
+        }
+        return null;
+    }
+
     @Override
     public List<UserCacheResDto> queryUserCacheByIds(List<Long> userIds) {
         if (CollectionUtils.isEmpty(userIds)) {
@@ -929,7 +937,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
     @Override
     public KwsRoleDto queryByRoleIdAndEntId(Long currentRoleId) {
         KwsRole kwsRole = kwsRoleDao.selectByKey(currentRoleId);
-        if (Objects.isNull(kwsRole)){
+        if (Objects.isNull(kwsRole)) {
             return new KwsRoleDto();
         }
         KwsRoleDto kwsRoleDto = new KwsRoleDto();
@@ -943,7 +951,7 @@ public class RemoteSystemServiceImpl implements RemoteSystemService {
     @Override
     public List<EntTypeResDto> queryEntTypeByIds(Set<Long> entIds) {
         List<KwsEntType> kwsEnterprises = kwsEntTypeRepository.queryByEntIds(entIds);
-        if (org.apache.commons.collections4.CollectionUtils.isEmpty(kwsEnterprises)){
+        if (org.apache.commons.collections4.CollectionUtils.isEmpty(kwsEnterprises)) {
             return List.of();
         }
         return kwsEnterprises.stream()