Jelajahi Sumber

fix: 更新环境

杨鑫 1 tahun lalu
induk
melakukan
1f3cbbfafc

+ 7 - 0
src/main/java/com/zhiqiyun/open/core/models/user/OauthInfo.java

@@ -48,6 +48,8 @@ public class OauthInfo implements Serializable {
      */
     private String avatar;
 
+    private String openKey;
+
     /**
      * 用户权限
      */
@@ -92,4 +94,9 @@ public class OauthInfo implements Serializable {
         this.refreshToken = refreshToken;
         return this;
     }
+
+    public OauthInfo setOpenKey(String openKey) {
+        this.openKey = openKey;
+        return this;
+    }
 }

+ 1 - 0
src/main/java/com/zhiqiyun/open/core/models/user/UserBaseInfo.java

@@ -27,6 +27,7 @@ public class UserBaseInfo implements Serializable {
     private Gender gender;
     private Date registerTime;
     private String registerIp;
+    private String openKey;
 
     private UserState state;
 }

+ 20 - 8
src/main/java/com/zhiqiyun/open/mvc/controller/AppKeyInfoController.java

@@ -1,5 +1,7 @@
 package com.zhiqiyun.open.mvc.controller;
 
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.OrderItem;
@@ -11,14 +13,18 @@ import com.zhiqiyun.open.annotation.Permission;
 import com.zhiqiyun.open.core.enmus.YN;
 import com.zhiqiyun.open.core.models.app.ApiRequestLog;
 import com.zhiqiyun.open.core.models.app.AppKeyInfo;
+import com.zhiqiyun.open.core.models.user.OauthInfo;
 import com.zhiqiyun.open.core.service.ApiRequestLogService;
 import com.zhiqiyun.open.core.service.AppKeyInfoService;
+import com.zhiqiyun.open.core.service.OauthService;
 import com.zhiqiyun.open.core.service.SequenceService;
 import com.zhiqiyun.open.mvc.Result;
 import com.zhiqiyun.open.mvc.params.QueryApiRequestLogParams;
 import com.zhiqiyun.open.mvc.params.QueryAppKeyInfoParams;
 import com.zhiqiyun.open.mvc.params.SaveAppKeyInfoParam;
 import com.zhiqiyun.open.utils.DateUtil;
+import com.zhiqiyun.open.utils.ServletContext;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -27,12 +33,12 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import javax.validation.Valid;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
+import java.util.stream.Collectors;
 
+@Slf4j
 @RestController
 @RequestMapping("/appKey")
 public class AppKeyInfoController {
@@ -49,11 +55,20 @@ public class AppKeyInfoController {
     @Autowired
     private RouterService routerService;
 
+    @Resource
+    private OauthService oauthService;
+
     @Permission(value = "app.key.find", tags = "查询AppKey")
     @PostMapping("/findPage")
     public Result findPage(@RequestBody QueryAppKeyInfoParams params) {
-
         QueryWrapper<AppKeyInfo> queryWrapper = new QueryWrapper<>();
+        String accessToken = ServletContext.getAccessToken();
+        OauthInfo oauthInfo = this.oauthService.getAuth(accessToken);
+        log.info("当前用户信息:{}", JSONObject.toJSONString(oauthInfo));
+        if (StrUtil.isNotBlank(oauthInfo.getOpenKey())) {
+            queryWrapper.in("id", Arrays.stream(oauthInfo.getOpenKey().split(","))
+                    .map(Long::parseLong).collect(Collectors.toList()));
+        }
         if (params.getId() != null) {
             queryWrapper.eq("id", params.getId());
         }
@@ -63,12 +78,9 @@ public class AppKeyInfoController {
         if (StringUtils.isNotBlank(params.getRemark())) {
             queryWrapper.like("remark", params.getRemark());
         }
-
         Page<AppKeyInfo> page = params.getPage();
         page.addOrder(OrderItem.desc("created_time"));
-
         Page<AppKeyInfo> resultData = this.appKeyInfoService.page(page, queryWrapper);
-
         return Result.instance(Result.Code.SUCCESS).setData(resultData);
     }
 

+ 1 - 0
src/main/java/com/zhiqiyun/open/mvc/controller/OauthController.java

@@ -122,6 +122,7 @@ public class OauthController {
                             .setAvatar(userBaseInfo.getAvatar())
                             .setLoginTime(DateUtil.current())
                             .setGender(userBaseInfo.getGender())
+                            .setOpenKey(userBaseInfo.getOpenKey())
                             .setAuthorities(listAuthorities);
 
                     this.oauthService.setAuth(accessToken, oauthInfo);

+ 1 - 0
src/main/java/com/zhiqiyun/open/mvc/controller/UserInfoController.java

@@ -94,6 +94,7 @@ public class UserInfoController {
             dataMap.put("avatar", info.getAvatar());
             dataMap.put("state", info.getState());
             dataMap.put("gender", info.getGender());
+            dataMap.put("openKey", info.getOpenKey());
             List<UserLoginAccount> loginAccounts = this.userBaseInfoService.findLoginAccounts(info.getId());
             for (UserLoginAccount account : loginAccounts) {
                 if (account.getAccountType() == null) {

File diff ditekan karena terlalu besar
+ 0 - 0
src/main/resources/public/index.html


+ 0 - 0
src/main/resources/public/static/css/chunk-95baa5f2.cb8af80d.css → src/main/resources/public/static/css/chunk-9088c4fa.cb8af80d.css


+ 0 - 0
src/main/resources/public/static/css/chunk-2977f2fe.611b2609.css → src/main/resources/public/static/css/chunk-93760fd8.611b2609.css


File diff ditekan karena terlalu besar
+ 0 - 0
src/main/resources/public/static/js/app.1bc7d20b.js


File diff ditekan karena terlalu besar
+ 0 - 0
src/main/resources/public/static/js/chunk-1cb76e6f.34967a48.js


File diff ditekan karena terlalu besar
+ 0 - 0
src/main/resources/public/static/js/chunk-1e9265aa.c44a9cb5.js


File diff ditekan karena terlalu besar
+ 0 - 0
src/main/resources/public/static/js/chunk-2b87b673.49b457cd.js


File diff ditekan karena terlalu besar
+ 0 - 0
src/main/resources/public/static/js/chunk-3a4d10cc.cd8dd5cf.js


File diff ditekan karena terlalu besar
+ 0 - 0
src/main/resources/public/static/js/chunk-9088c4fa.0bfe2f45.js


File diff ditekan karena terlalu besar
+ 0 - 0
src/main/resources/public/static/js/chunk-93760fd8.644cc829.js


File diff ditekan karena terlalu besar
+ 0 - 0
src/main/resources/public/static/js/chunk-95baa5f2.87801c52.js


File diff ditekan karena terlalu besar
+ 0 - 0
src/main/resources/public/static/js/chunk-e5f2c62a.8a1a5e1f.js


Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini