From b5a4aacae2360527ce605fa7d6cbf5d7ac6282d3 Mon Sep 17 00:00:00 2001 From: Forget <1771761586@qq.com> Date: Mon, 10 May 2021 10:32:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0torna=20=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E4=BD=9C=E8=80=85=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/power/doc/builder/TornaBuilder.java | 1 + .../java/com/power/doc/builder/rpc/RpcTornaBuilder.java | 5 +++-- src/main/java/com/power/doc/model/torna/TornaApi.java | 9 +++++++++ src/test/java/com/power/doc/ApiDocTest.java | 5 +++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/power/doc/builder/TornaBuilder.java b/src/main/java/com/power/doc/builder/TornaBuilder.java index abbe051..6529180 100644 --- a/src/main/java/com/power/doc/builder/TornaBuilder.java +++ b/src/main/java/com/power/doc/builder/TornaBuilder.java @@ -90,6 +90,7 @@ public class TornaBuilder { */ public static void buildTorna(List apiDocs, ApiConfig apiConfig) { TornaApi tornaApi = new TornaApi(); + tornaApi.setAuthor(StringUtil.isEmpty(apiConfig.getAuthor()) ? System.getProperty("user.name") : apiConfig.getAuthor()); Apis api; List apisList = new ArrayList<>(); //添加接口数据 diff --git a/src/main/java/com/power/doc/builder/rpc/RpcTornaBuilder.java b/src/main/java/com/power/doc/builder/rpc/RpcTornaBuilder.java index 6b4cf8b..6822400 100644 --- a/src/main/java/com/power/doc/builder/rpc/RpcTornaBuilder.java +++ b/src/main/java/com/power/doc/builder/rpc/RpcTornaBuilder.java @@ -2,6 +2,7 @@ package com.power.doc.builder.rpc; import com.google.gson.Gson; import com.power.common.util.OkHttp3Util; +import com.power.common.util.StringUtil; import com.power.doc.builder.ProjectDocConfigBuilder; import com.power.doc.constants.TornaConstants; import com.power.doc.model.ApiConfig; @@ -52,9 +53,9 @@ public class RpcTornaBuilder { List apiDocList = docBuildTemplate.getApiData(configBuilder); buildTorna(apiDocList, config); } - public static void buildTorna(List apiDocs, ApiConfig apiConfig) { TornaApi tornaApi = new TornaApi(); + tornaApi.setAuthor(StringUtil.isEmpty(apiConfig.getAuthor()) ? System.getProperty("user.name") : apiConfig.getAuthor()); Apis api; List apisList = new ArrayList<>(); //添加接口数据 @@ -64,7 +65,7 @@ public class RpcTornaBuilder { TornaUtil.setDebugEnv(apiConfig,tornaApi); api.setItems(buildDubboApis(a.getList())); api.setIsFolder(TornaConstants.YES); - api.setAuthor(apiConfig.getAuthor()); + api.setAuthor(a.getAuthor()); api.setDubboInfo(new DubboInfo().builder() .setAuthor(a.getAuthor()) .setProtocol(a.getProtocol()) diff --git a/src/main/java/com/power/doc/model/torna/TornaApi.java b/src/main/java/com/power/doc/model/torna/TornaApi.java index a10a9e9..d269bcd 100644 --- a/src/main/java/com/power/doc/model/torna/TornaApi.java +++ b/src/main/java/com/power/doc/model/torna/TornaApi.java @@ -40,6 +40,15 @@ public class TornaApi { */ List debugEnvs; List apis; + String author; + + public String getAuthor() { + return author; + } + + public void setAuthor(String author) { + this.author = author; + } public List getDebugEnvs() { return debugEnvs; diff --git a/src/test/java/com/power/doc/ApiDocTest.java b/src/test/java/com/power/doc/ApiDocTest.java index a6fdd60..56c3a80 100644 --- a/src/test/java/com/power/doc/ApiDocTest.java +++ b/src/test/java/com/power/doc/ApiDocTest.java @@ -35,11 +35,12 @@ public class ApiDocTest { ApiConfig config = new ApiConfig(); config.setServerUrl("http://127.0.0.1:8899"); //config.setStrict(true); - config.setOpenUrl("http://127.0.0.1:8899/api"); + config.setOpenUrl("http://demo.torna.cn/api"); config.setAppKey("20201216788835306945118208"); - config.setAppToken("c16931fa6590483fb7a4e85340fcbfef"); + config.setAppToken("258e853573d44ef4a3e2caebdcafbc0f"); config.setSecret("W.ZyGMOB9Q0UqujVxnfi@.I#V&tUUYZR"); config.setDebugEnvName("测试环境"); + config.setAuthor("test"); config.setDebugEnvUrl("http://127.0.0.1"); //config.setTornaDebug(true);