From 7f78d7723540f10b746ae24d329e867b1c069d53 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9A=AE=E5=85=89=EF=BC=9A=E5=9F=8E=E4=B8=AD=E5=9F=8E?=
<806783409@qq.com>
Date: Mon, 18 Feb 2019 20:27:50 +0800
Subject: [PATCH] =?UTF-8?q?dubbo=E5=8F=82=E6=95=B0=E8=87=AA=E5=8A=A8?=
=?UTF-8?q?=E8=8E=B7=E5=8F=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 4 +
.../src/main/resources/doc-db.html | 2 +
.../resources/webjars/doc-db/js/doc-db.js | 2 +
zyplayer-doc-dubbo/pom.xml | 2 +
.../doc/dubbo/controller/DubboController.java | 98 +++++++++++++++-
.../controller/param/DubboRequestParam.java | 12 +-
.../src/main/resources/doc-dubbo.html | 105 +++++++++++-------
.../resources/sql/zyplayer_doc_manage.sql | 2 +-
.../src/main/webapp/static/manage/home.html | 4 +
.../src/main/resources/document.html | 2 +
.../src/main/resources/open-doc.html | 2 +
.../main/resources/webjars/mg-ui/js/mg-ui.js | 2 +
.../resources/webjars/open-doc/js/mg-ui.js | 2 +
13 files changed, 188 insertions(+), 51 deletions(-)
diff --git a/README.md b/README.md
index 26aa1dcc..59db2261 100644
--- a/README.md
+++ b/README.md
@@ -72,6 +72,10 @@ http://127.0.0.1:8082/zyplayer-doc-manage/static/manage/home.html
4. 支持文档查找、文档编辑、在线调试接口
+5. 自动获取参数列表需要指定的类存在,所以请在 pom.xml -> dependencies 最后加上服务所在的包,后端才能通过Class.forName("xx");来找到参数列表,减少录入成本
+
+6. 数组或List参数,调试参数录入格式例:[1,2] ,后端通过JSON工具转成指定类型,有不支持的类型时欢迎反馈
+
##### 四、zyplayer-doc-manage
1. 整合了上面两个功能到此项目,较少熟悉成本,`git clone`下来即可运行
diff --git a/zyplayer-doc-db/src/main/resources/doc-db.html b/zyplayer-doc-db/src/main/resources/doc-db.html
index c2137a14..4d946895 100644
--- a/zyplayer-doc-db/src/main/resources/doc-db.html
+++ b/zyplayer-doc-db/src/main/resources/doc-db.html
@@ -3,6 +3,8 @@
+
+
数据库文档
diff --git a/zyplayer-doc-db/src/main/resources/webjars/doc-db/js/doc-db.js b/zyplayer-doc-db/src/main/resources/webjars/doc-db/js/doc-db.js
index db42554a..2b77f508 100644
--- a/zyplayer-doc-db/src/main/resources/webjars/doc-db/js/doc-db.js
+++ b/zyplayer-doc-db/src/main/resources/webjars/doc-db/js/doc-db.js
@@ -8,6 +8,8 @@ var pageConfig = {
var tableRelationCharts;
$(document).ready(function(){
+ // 无论发布在哪、如何修改源码,请勿删除本行原作者信息,感谢
+ console.log("%c项目信息:\n开发者列表:暮光:城中城\n项目地址:https://gitee.com/zyplayer/zyplayer-doc","color:red");
$('select.chosen-select').chosen({
no_results_text: '没有找到', // 当检索时没有找到匹配项时显示的提示文本
disable_search_threshold: 0, // 10 个以下的选择项则不显示检索框
diff --git a/zyplayer-doc-dubbo/pom.xml b/zyplayer-doc-dubbo/pom.xml
index d5b94dad..6337cb2b 100644
--- a/zyplayer-doc-dubbo/pom.xml
+++ b/zyplayer-doc-dubbo/pom.xml
@@ -128,6 +128,8 @@
spring-context-support
1.0.2
+
+
diff --git a/zyplayer-doc-dubbo/src/main/java/com/zyplayer/doc/dubbo/controller/DubboController.java b/zyplayer-doc-dubbo/src/main/java/com/zyplayer/doc/dubbo/controller/DubboController.java
index b3081cbe..e50687b8 100644
--- a/zyplayer-doc-dubbo/src/main/java/com/zyplayer/doc/dubbo/controller/DubboController.java
+++ b/zyplayer-doc-dubbo/src/main/java/com/zyplayer/doc/dubbo/controller/DubboController.java
@@ -26,8 +26,12 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
import java.net.URLDecoder;
import java.util.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@@ -84,11 +88,48 @@ public class DubboController {
dubboNodeInfo.setIp(param.getIp());
dubboNodeInfo.setPort(param.getPort());
dubboNodeInfo.setInterfaceX(param.getService());
- String[] paramTypes = Optional.ofNullable(param.getParamTypes()).orElse(new String[]{});
- Object[] params = Optional.ofNullable(param.getParams()).orElse(new Object[]{});
+ String paramTypeStr = Optional.ofNullable(param.getParamTypes()).orElse("");
+ String paramsStr = Optional.ofNullable(param.getParams()).orElse("");
+ List typeList = JSON.parseArray(paramTypeStr, String.class);
+ List paramList = JSON.parseArray(paramsStr, String.class);
+ List queryTypeList = new LinkedList<>();
+ List