删除不需要的代码,优化结构

This commit is contained in:
暮光:城中城
2022-12-07 20:21:18 +08:00
parent e82937297b
commit c62d733869
215 changed files with 334 additions and 57771 deletions

View File

@@ -1,7 +1,7 @@
# zyplayer-doc # zyplayer-doc
# 项目介绍 # 项目介绍
zyplayer-doc是一款前后端完全开源的在线文档工具现有API接口文档Swagger、OpenApi、自建接口、WIKI文档、数据库文档数据库表结构查看管理、SQL执行、Dubbo文档 zyplayer-doc是一款前后端完全开源的在线文档工具现有API接口文档Swagger、OpenApi、自建接口、WIKI文档、数据库文档数据库表结构查看管理、SQL执行
体验地址:[http://doc.zyplayer.com](http://doc.zyplayer.com/) 账号zyplayer 密码123456 体验地址:[http://doc.zyplayer.com](http://doc.zyplayer.com/) 账号zyplayer 密码123456
@@ -64,14 +64,10 @@ zyplayer-doc是一款前后端完全开源的在线文档工具现有API接
2. 支持将所有的Swagger文档、OpenApi文档、自建接口文档进行统一管理支持全局参数设置请求参数缓存下次自动填充等。 2. 支持将所有的Swagger文档、OpenApi文档、自建接口文档进行统一管理支持全局参数设置请求参数缓存下次自动填充等。
3. 目标是实现一个平台解决所有项目的接口文档统一管理。 3. 目标是实现一个平台解决所有项目的接口文档统一管理。
## zyplayer-doc-dubbo 将dubbo的文档在线化管理
1. 支持zookeeper、nacos的注册中心文档获取支持在线调试接口
## 其他 ## 其他
1. zyplayer-doc-ui 前面各模块的前端UI源码 1. zyplayer-doc-ui 前面各模块的前端UI源码
2. zyplayer-doc-core 一些核心、公用的类 2. zyplayer-doc-core 一些核心、公用的类
3. zyplayer-doc-data 数据库层面的交互 3. zyplayer-doc-data 数据库层面的交互
4. zyplayer-doc-grpc grpc文档工具
5. zyplayer-doc-other 一些测试 5. zyplayer-doc-other 一些测试
# 用爱发电 # 用爱发电

45
pom.xml
View File

@@ -8,7 +8,7 @@
<packaging>pom</packaging> <packaging>pom</packaging>
<name>zyplayer-doc</name> <name>zyplayer-doc</name>
<description>定位为所有文档的管理项目swagger文档、数据库文档、WIKI文档、Dubbo文档</description> <description>定位为所有文档的管理项目swagger文档、数据库文档、WIKI文档等</description>
<properties> <properties>
<skipTests>true</skipTests> <skipTests>true</skipTests>
@@ -27,7 +27,6 @@
<module>zyplayer-doc-db</module> <module>zyplayer-doc-db</module>
<module>zyplayer-doc-api</module> <module>zyplayer-doc-api</module>
<module>zyplayer-doc-wiki</module> <module>zyplayer-doc-wiki</module>
<module>zyplayer-doc-dubbo</module>
<module>zyplayer-doc-core</module> <module>zyplayer-doc-core</module>
<module>zyplayer-doc-data</module> <module>zyplayer-doc-data</module>
<module>zyplayer-doc-other</module> <module>zyplayer-doc-other</module>
@@ -75,11 +74,11 @@
<artifactId>jtds</artifactId> <artifactId>jtds</artifactId>
<version>1.3.1</version> <version>1.3.1</version>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>com.oracle</groupId> <!-- <groupId>com.oracle</groupId>-->
<artifactId>ojdbc6</artifactId> <!-- <artifactId>ojdbc6</artifactId>-->
<version>12.1.0.1-atlassian-hosted</version> <!-- <version>12.1.0.1-atlassian-hosted</version>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
@@ -106,9 +105,14 @@
<version>2.12.0</version> <version>2.12.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.dubbo</groupId> <groupId>commons-collections</groupId>
<artifactId>dubbo</artifactId> <artifactId>commons-collections</artifactId>
<version>2.7.0</version> <version>3.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.mybatis</groupId> <groupId>org.mybatis</groupId>
@@ -120,11 +124,6 @@
<artifactId>easyexcel</artifactId> <artifactId>easyexcel</artifactId>
<version>2.1.4</version> <version>2.1.4</version>
</dependency> </dependency>
<dependency>
<groupId>com.github.dozermapper</groupId>
<artifactId>dozer-core</artifactId>
<version>6.5.2</version>
</dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
@@ -165,22 +164,11 @@
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>5.6.6</version> <version>5.6.6</version>
</dependency> </dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>5.3.0</version>
</dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-core</artifactId> <artifactId>mybatis-plus-core</artifactId>
<version>3.4.3.2</version> <version>3.4.3.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.zyplayer</groupId> <groupId>com.zyplayer</groupId>
<artifactId>zyplayer-doc-annotation</artifactId> <artifactId>zyplayer-doc-annotation</artifactId>
@@ -201,11 +189,6 @@
<artifactId>zyplayer-doc-db</artifactId> <artifactId>zyplayer-doc-db</artifactId>
<version>${zyplayer.doc.version}</version> <version>${zyplayer.doc.version}</version>
</dependency> </dependency>
<dependency>
<groupId>com.zyplayer</groupId>
<artifactId>zyplayer-doc-dubbo</artifactId>
<version>${zyplayer.doc.version}</version>
</dependency>
<dependency> <dependency>
<groupId>com.zyplayer</groupId> <groupId>com.zyplayer</groupId>
<artifactId>zyplayer-doc-api</artifactId> <artifactId>zyplayer-doc-api</artifactId>

View File

@@ -20,7 +20,7 @@ import com.zyplayer.doc.data.service.common.ApiDocAuthJudgeService;
import com.zyplayer.doc.data.service.manage.ApiCustomNodeService; import com.zyplayer.doc.data.service.manage.ApiCustomNodeService;
import com.zyplayer.doc.data.service.manage.ApiCustomRequestService; import com.zyplayer.doc.data.service.manage.ApiCustomRequestService;
import com.zyplayer.doc.data.service.manage.ApiDocService; import com.zyplayer.doc.data.service.manage.ApiDocService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

View File

@@ -17,8 +17,8 @@ import com.zyplayer.doc.data.repository.manage.entity.ApiGlobalParam;
import com.zyplayer.doc.data.service.manage.ApiGlobalParamService; import com.zyplayer.doc.data.service.manage.ApiGlobalParamService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@@ -0,0 +1 @@
import{u as S,a9 as w,r as c,o as a,c as l,w as t,a as o,m as g,t as n,b as i,F as f,k as s,e as m,d as M}from"./vendor.160e93e4.js";import{m as B}from"./index.755e9586.js";import{_ as C}from"./main.44472edc.js";const N={setup(){const _=S(),D=w(()=>_.state.swaggerDoc),u=w(()=>_.state.swaggerDoc.info),e=w(()=>_.state.swaggerMethodStatistic);return{swaggerDoc:D,swaggerDocInfo:u,swaggerMethodStatistic:e,getDescription:I=>B.exports.markdownIt.render(I||"")}}},V=["href"],j=["href"],L=["href"],O=["innerHTML"],T={key:1,style:{"text-align":"center"}};function E(_,D,u,e,p,I){const r=c("a-form-item"),h=c("a-divider"),v=c("a-statistic"),k=c("a-card"),b=c("a-col"),y=c("a-row"),x=c("a-form");return a(),l(k,null,{default:t(()=>[e.swaggerDocInfo?(a(),l(x,{key:0,"label-col":{span:4},"wrapper-col":{span:20}},{default:t(()=>[o(r,{label:"\u6807\u9898"},{default:t(()=>[g(n(e.swaggerDocInfo.title),1)]),_:1}),o(r,{label:"\u7248\u672C"},{default:t(()=>[g(n(e.swaggerDocInfo.version),1)]),_:1}),e.swaggerDocInfo.contact?(a(),l(r,{key:0,label:"\u4F5C\u8005"},{default:t(()=>[e.swaggerDocInfo.contact.name?(a(),i(f,{key:0},[g(n(e.swaggerDocInfo.contact.name),1)],64)):s("",!0),e.swaggerDocInfo.contact.email?(a(),i(f,{key:1},[o(h,{type:"vertical"}),g(n(e.swaggerDocInfo.contact.email),1)],64)):s("",!0),e.swaggerDocInfo.contact.url?(a(),i(f,{key:2},[o(h,{type:"vertical"}),m("a",{href:e.swaggerDocInfo.contact.url,target:"_blank"},n(e.swaggerDocInfo.contact.url),9,V)],64)):s("",!0)]),_:1})):s("",!0),o(r,{label:"host"},{default:t(()=>[g(n(e.swaggerDoc.host),1)]),_:1}),e.swaggerDocInfo.license?(a(),l(r,{key:1,label:"\u8BB8\u53EF\u8BC1"},{default:t(()=>[m("a",{href:e.swaggerDocInfo.license.url,target:"_blank"},n(e.swaggerDocInfo.license.name),9,j)]),_:1})):s("",!0),e.swaggerDocInfo.termsOfService?(a(),l(r,{key:2,label:"\u670D\u52A1\u6761\u6B3E"},{default:t(()=>[m("a",{href:e.swaggerDocInfo.termsOfService,target:"_blank"},n(e.swaggerDocInfo.termsOfService),9,L)]),_:1})):s("",!0),o(r,{label:"\u6587\u6863\u8BF4\u660E"},{default:t(()=>[m("div",{class:"markdown-body",innerHTML:e.getDescription(e.swaggerDocInfo.description)},null,8,O)]),_:1}),o(r,{label:"\u63A5\u53E3\u7EDF\u8BA1"},{default:t(()=>[o(y,{gutter:[16,16]},{default:t(()=>[(a(),i(f,null,M(["get","post","put","delete","head","patch","options","trace","total"],d=>(a(),i(f,null,[e.swaggerMethodStatistic[d]?(a(),l(b,{key:0,span:6},{default:t(()=>[o(k,{size:"small"},{default:t(()=>[o(v,{title:d==="total"?"\u603B\u8BA1":d.toUpperCase()+"\u65B9\u6CD5",value:e.swaggerMethodStatistic[d],suffix:"\u4E2A"},null,8,["title","value"])]),_:2},1024)]),_:2},1024)):s("",!0)],64))),64))]),_:1})]),_:1})]),_:1})):(a(),i("div",T,"\u6682\u65E0\u6587\u6863\u4FE1\u606F\uFF0C\u8BF7\u5148\u9009\u62E9\u6587\u6863"))]),_:1})}var U=C(N,[["render",E]]);export{U as default};

View File

@@ -1 +1 @@
import{u as S,a9 as D,r as i,o as t,c as l,w as o,a as n,m as s,t as c,b as p,F as f,k as r,e as m,d as w}from"./vendor.627eef95.js";import{m as M}from"./index.a17fca00.js";import{_ as B}from"./main.54fae6aa.js";const C={setup(){const _=S(),A=D(()=>_.state.openApiDoc),u=D(()=>_.state.openApiDoc.info),e=D(()=>_.state.openApiMethodStatistic);return{openApiDoc:A,openApiDocInfo:u,openApiMethodStatistic:e,getDescription:I=>M.exports.markdownIt.render(I||"")}}},N=["href"],V=["href"],j=["href"],L=["innerHTML"],O={key:1,style:{"text-align":"center"}};function T(_,A,u,e,v,I){const a=i("a-form-item"),h=i("a-divider"),b=i("a-statistic"),k=i("a-card"),y=i("a-col"),g=i("a-row"),x=i("a-form");return t(),l(k,null,{default:o(()=>[e.openApiDocInfo?(t(),l(x,{key:0,"label-col":{span:4},"wrapper-col":{span:20}},{default:o(()=>[n(a,{label:"\u6807\u9898"},{default:o(()=>[s(c(e.openApiDocInfo.title),1)]),_:1}),n(a,{label:"\u7248\u672C"},{default:o(()=>[s(c(e.openApiDocInfo.version),1)]),_:1}),e.openApiDocInfo.contact?(t(),l(a,{key:0,label:"\u4F5C\u8005"},{default:o(()=>[e.openApiDocInfo.contact.name?(t(),p(f,{key:0},[s(c(e.openApiDocInfo.contact.name),1)],64)):r("",!0),e.openApiDocInfo.contact.email?(t(),p(f,{key:1},[n(h,{type:"vertical"}),s(c(e.openApiDocInfo.contact.email),1)],64)):r("",!0),e.openApiDocInfo.contact.url?(t(),p(f,{key:2},[n(h,{type:"vertical"}),m("a",{href:e.openApiDocInfo.contact.url,target:"_blank"},c(e.openApiDocInfo.contact.url),9,N)],64)):r("",!0)]),_:1})):r("",!0),n(a,{label:"host"},{default:o(()=>[s(c(e.openApiDoc.host),1)]),_:1}),e.openApiDocInfo.license?(t(),l(a,{key:1,label:"\u8BB8\u53EF\u8BC1"},{default:o(()=>[m("a",{href:e.openApiDocInfo.license.url,target:"_blank"},c(e.openApiDocInfo.license.name),9,V)]),_:1})):r("",!0),e.openApiDocInfo.termsOfService?(t(),l(a,{key:2,label:"\u670D\u52A1\u6761\u6B3E"},{default:o(()=>[m("a",{href:e.openApiDocInfo.termsOfService,target:"_blank"},c(e.openApiDocInfo.termsOfService),9,j)]),_:1})):r("",!0),n(a,{label:"\u6587\u6863\u8BF4\u660E"},{default:o(()=>[m("div",{class:"markdown-body",innerHTML:e.getDescription(e.openApiDocInfo.description)},null,8,L)]),_:1}),n(a,{label:"\u63A5\u53E3\u7EDF\u8BA1"},{default:o(()=>[n(g,{gutter:[16,16]},{default:o(()=>[(t(),p(f,null,w(["get","post","put","delete","head","patch","options","trace","total"],d=>(t(),p(f,null,[e.openApiMethodStatistic[d]?(t(),l(y,{key:0,span:6},{default:o(()=>[n(k,{size:"small"},{default:o(()=>[n(b,{title:d==="total"?"\u603B\u8BA1":d.toUpperCase()+"\u65B9\u6CD5",value:e.openApiMethodStatistic[d],suffix:"\u4E2A"},null,8,["title","value"])]),_:2},1024)]),_:2},1024)):r("",!0)],64))),64))]),_:1})]),_:1})]),_:1})):(t(),p("div",O,"\u6682\u65E0\u6587\u6863\u4FE1\u606F\uFF0C\u8BF7\u5148\u9009\u62E9\u6587\u6863"))]),_:1})}var z=B(C,[["render",T]]);export{z as default}; import{u as S,a9 as D,r as i,o as t,c as l,w as o,a as n,m as s,t as c,b as p,F as f,k as r,e as m,d as w}from"./vendor.160e93e4.js";import{m as M}from"./index.755e9586.js";import{_ as B}from"./main.44472edc.js";const C={setup(){const _=S(),A=D(()=>_.state.openApiDoc),u=D(()=>_.state.openApiDoc.info),e=D(()=>_.state.openApiMethodStatistic);return{openApiDoc:A,openApiDocInfo:u,openApiMethodStatistic:e,getDescription:I=>M.exports.markdownIt.render(I||"")}}},N=["href"],V=["href"],j=["href"],L=["innerHTML"],O={key:1,style:{"text-align":"center"}};function T(_,A,u,e,v,I){const a=i("a-form-item"),h=i("a-divider"),b=i("a-statistic"),k=i("a-card"),y=i("a-col"),g=i("a-row"),x=i("a-form");return t(),l(k,null,{default:o(()=>[e.openApiDocInfo?(t(),l(x,{key:0,"label-col":{span:4},"wrapper-col":{span:20}},{default:o(()=>[n(a,{label:"\u6807\u9898"},{default:o(()=>[s(c(e.openApiDocInfo.title),1)]),_:1}),n(a,{label:"\u7248\u672C"},{default:o(()=>[s(c(e.openApiDocInfo.version),1)]),_:1}),e.openApiDocInfo.contact?(t(),l(a,{key:0,label:"\u4F5C\u8005"},{default:o(()=>[e.openApiDocInfo.contact.name?(t(),p(f,{key:0},[s(c(e.openApiDocInfo.contact.name),1)],64)):r("",!0),e.openApiDocInfo.contact.email?(t(),p(f,{key:1},[n(h,{type:"vertical"}),s(c(e.openApiDocInfo.contact.email),1)],64)):r("",!0),e.openApiDocInfo.contact.url?(t(),p(f,{key:2},[n(h,{type:"vertical"}),m("a",{href:e.openApiDocInfo.contact.url,target:"_blank"},c(e.openApiDocInfo.contact.url),9,N)],64)):r("",!0)]),_:1})):r("",!0),n(a,{label:"host"},{default:o(()=>[s(c(e.openApiDoc.host),1)]),_:1}),e.openApiDocInfo.license?(t(),l(a,{key:1,label:"\u8BB8\u53EF\u8BC1"},{default:o(()=>[m("a",{href:e.openApiDocInfo.license.url,target:"_blank"},c(e.openApiDocInfo.license.name),9,V)]),_:1})):r("",!0),e.openApiDocInfo.termsOfService?(t(),l(a,{key:2,label:"\u670D\u52A1\u6761\u6B3E"},{default:o(()=>[m("a",{href:e.openApiDocInfo.termsOfService,target:"_blank"},c(e.openApiDocInfo.termsOfService),9,j)]),_:1})):r("",!0),n(a,{label:"\u6587\u6863\u8BF4\u660E"},{default:o(()=>[m("div",{class:"markdown-body",innerHTML:e.getDescription(e.openApiDocInfo.description)},null,8,L)]),_:1}),n(a,{label:"\u63A5\u53E3\u7EDF\u8BA1"},{default:o(()=>[n(g,{gutter:[16,16]},{default:o(()=>[(t(),p(f,null,w(["get","post","put","delete","head","patch","options","trace","total"],d=>(t(),p(f,null,[e.openApiMethodStatistic[d]?(t(),l(y,{key:0,span:6},{default:o(()=>[n(k,{size:"small"},{default:o(()=>[n(b,{title:d==="total"?"\u603B\u8BA1":d.toUpperCase()+"\u65B9\u6CD5",value:e.openApiMethodStatistic[d],suffix:"\u4E2A"},null,8,["title","value"])]),_:2},1024)]),_:2},1024)):r("",!0)],64))),64))]),_:1})]),_:1})]),_:1})):(t(),p("div",O,"\u6682\u65E0\u6587\u6863\u4FE1\u606F\uFF0C\u8BF7\u5148\u9009\u62E9\u6587\u6863"))]),_:1})}var z=B(C,[["render",T]]);export{z as default};

View File

@@ -1 +0,0 @@
import{u as S,a9 as w,r as c,o as t,c as l,w as a,a as o,m as g,t as n,b as i,F as f,k as s,e as m,d as M}from"./vendor.627eef95.js";import{m as B}from"./index.a17fca00.js";import{_ as C}from"./main.54fae6aa.js";const N={setup(){const _=S(),D=w(()=>_.state.swaggerDoc),u=w(()=>_.state.swaggerDoc.info),e=w(()=>_.state.swaggerMethodStatistic);return{swaggerDoc:D,swaggerDocInfo:u,swaggerMethodStatistic:e,getDescription:I=>B.exports.markdownIt.render(I||"")}}},V=["href"],j=["href"],L=["href"],O=["innerHTML"],T={key:1,style:{"text-align":"center"}};function E(_,D,u,e,p,I){const r=c("a-form-item"),h=c("a-divider"),v=c("a-statistic"),k=c("a-card"),b=c("a-col"),y=c("a-row"),x=c("a-form");return t(),l(k,null,{default:a(()=>[e.swaggerDocInfo?(t(),l(x,{key:0,"label-col":{span:4},"wrapper-col":{span:20}},{default:a(()=>[o(r,{label:"\u6807\u9898"},{default:a(()=>[g(n(e.swaggerDocInfo.title),1)]),_:1}),o(r,{label:"\u7248\u672C"},{default:a(()=>[g(n(e.swaggerDocInfo.version),1)]),_:1}),e.swaggerDocInfo.contact?(t(),l(r,{key:0,label:"\u4F5C\u8005"},{default:a(()=>[e.swaggerDocInfo.contact.name?(t(),i(f,{key:0},[g(n(e.swaggerDocInfo.contact.name),1)],64)):s("",!0),e.swaggerDocInfo.contact.email?(t(),i(f,{key:1},[o(h,{type:"vertical"}),g(n(e.swaggerDocInfo.contact.email),1)],64)):s("",!0),e.swaggerDocInfo.contact.url?(t(),i(f,{key:2},[o(h,{type:"vertical"}),m("a",{href:e.swaggerDocInfo.contact.url,target:"_blank"},n(e.swaggerDocInfo.contact.url),9,V)],64)):s("",!0)]),_:1})):s("",!0),o(r,{label:"host"},{default:a(()=>[g(n(e.swaggerDoc.host),1)]),_:1}),e.swaggerDocInfo.license?(t(),l(r,{key:1,label:"\u8BB8\u53EF\u8BC1"},{default:a(()=>[m("a",{href:e.swaggerDocInfo.license.url,target:"_blank"},n(e.swaggerDocInfo.license.name),9,j)]),_:1})):s("",!0),e.swaggerDocInfo.termsOfService?(t(),l(r,{key:2,label:"\u670D\u52A1\u6761\u6B3E"},{default:a(()=>[m("a",{href:e.swaggerDocInfo.termsOfService,target:"_blank"},n(e.swaggerDocInfo.termsOfService),9,L)]),_:1})):s("",!0),o(r,{label:"\u6587\u6863\u8BF4\u660E"},{default:a(()=>[m("div",{class:"markdown-body",innerHTML:e.getDescription(e.swaggerDocInfo.description)},null,8,O)]),_:1}),o(r,{label:"\u63A5\u53E3\u7EDF\u8BA1"},{default:a(()=>[o(y,{gutter:[16,16]},{default:a(()=>[(t(),i(f,null,M(["get","post","put","delete","head","patch","options","trace","total"],d=>(t(),i(f,null,[e.swaggerMethodStatistic[d]?(t(),l(b,{key:0,span:6},{default:a(()=>[o(k,{size:"small"},{default:a(()=>[o(v,{title:d==="total"?"\u603B\u8BA1":d.toUpperCase()+"\u65B9\u6CD5",value:e.swaggerMethodStatistic[d],suffix:"\u4E2A"},null,8,["title","value"])]),_:2},1024)]),_:2},1024)):s("",!0)],64))),64))]),_:1})]),_:1})]),_:1})):(t(),i("div",T,"\u6682\u65E0\u6587\u6863\u4FE1\u606F\uFF0C\u8BF7\u5148\u9009\u62E9\u6587\u6863"))]),_:1})}var U=C(N,[["render",E]]);export{U as default};

View File

@@ -1,4 +1,4 @@
var de=Object.defineProperty,ie=Object.defineProperties;var le=Object.getOwnPropertyDescriptors;var J=Object.getOwnPropertySymbols;var se=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable;var G=(r,a,m)=>a in r?de(r,a,{enumerable:!0,configurable:!0,writable:!0,value:m}):r[a]=m,W=(r,a)=>{for(var m in a||(a={}))se.call(a,m)&&G(r,m,a[m]);if(J)for(var m of J(a))ce.call(a,m)&&G(r,m,a[m]);return r},K=(r,a)=>ie(r,le(a));import{z as C,g as H}from"./custom.e03d703e.js";import{a2 as re,I as ue,u as R,y as f,N as Q,W as j,r as i,o as c,c as p,B as A,D as Z,a3 as X,H as Y,O as _e,w as t,a as o,Q as $,b as L,e as D,t as ee,k,m as d,a4 as te,P as oe,F as N,T as me,V as he,a5 as pe,a6 as fe}from"./vendor.627eef95.js";import{a as F}from"./index.12ebc7b1.js";import{m as ge}from"./index.a17fca00.js";import{_ as M}from"./main.54fae6aa.js";import{E as ve}from"./EditGlobalParam.4ed84db8.js";const ye={components:{aceEditor:F,BranchesOutlined:re,mavonEditor:ge.exports.mavonEditor,InfoCircleOutlined:ue},props:{doc:{type:Object,required:!0}},setup(r,{emit:a}){R();let m=f({}),e=f("");Q(()=>r.doc,()=>{v()});const g=()=>e.value?{id:m.value.id,shareInstruction:e.value}:(A.error("\u8BF7\u8F93\u5165\u5F00\u653E\u6587\u6863\u7684\u8BF4\u660E"),!1),v=async()=>{m.value=r.doc,e.value=r.doc.shareInstruction},s=(u,_)=>{},l=(u,_)=>(A.error("\u6682\u4E0D\u652F\u6301\u56FE\u7247\u4E0A\u4F20"),!1);return j(()=>{v()}),{docEdit:m,shareInstruction:e,getDoc:g,editDoc:v,imageFilter:l,addMarkdownImage:s,toolbars:{bold:!0,italic:!0,header:!0,underline:!0,strikethrough:!0,mark:!0,superscript:!0,subscript:!0,quote:!0,ol:!0,ul:!0,link:!0,imagelink:!1,code:!0,table:!0,fullscreen:!0,readmodel:!0,undo:!0,redo:!0,trash:!0,save:!0,navigation:!1,alignleft:!0,aligncenter:!0,alignright:!0,subfield:!0,preview:!0}}}};function be(r,a,m,e,g,v){const s=i("mavon-editor");return c(),p(s,{ref:"mavonEditor",modelValue:e.shareInstruction,"onUpdate:modelValue":a[0]||(a[0]=l=>e.shareInstruction=l),toolbars:e.toolbars,externalLink:!1,onImgAdd:e.addMarkdownImage,imageFilter:e.imageFilter,style:{height:"calc(100vh - 80px)"},placeholder:"\u8BF7\u5F55\u5165\u5F00\u653E\u6587\u6863\u8BF4\u660E"},null,8,["modelValue","toolbars","onImgAdd","imageFilter"])}var ae=M(ye,[["render",be]]);const we={emits:["edit"],components:{aceEditor:F,EditShareInstruction:ae,DownOutlined:Z,LinkOutlined:X,EditOutlined:Y},props:{doc:{type:Object,required:!0}},setup(r,{emit:a}){const m=R();let e=f({}),g=f();Q(()=>r.doc,()=>{s()});const v=async()=>{g.value.validate().then(()=>{C.apiDocAdd(e.value).then(_=>{m.commit("addDocChangedNum")})}).catch(_=>{console.log("error",_)})},s=()=>{e.value=r.doc},l=async()=>(await g.value.validate(),e.value),u=_=>{_.shareUuid?_.openVisit!==1?A.warning("\u8BE5\u6587\u6863\u5C1A\u672A\u5F00\u542F\u5F00\u653E\u8BBF\u95EE\u529F\u80FD\uFF0C\u8BF7\u5728\u7F16\u8F91\u9875\u9009\u62E9\u5F00\u653E\u540E\u518D\u8BD5"):window.open(H()+"/doc-api#/share/home?uuid="+_.shareUuid):A.warning("\u8BF7\u5148\u4FDD\u5B58\u6587\u6863\u540E\u518D\u8BD5")};return j(()=>{s()}),{docEdit:e,newDocFormRef:g,handleNewDocOk:v,editDoc:s,getDoc:l,openShareViewWindow:u,newDocRules:{name:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u6863\u540D\u79F0",trigger:"change"}],docUrl:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u6863\u5730\u5740",trigger:"change"}],jsonContent:[{required:!0,message:"\u8BF7\u8F93\u5165JSON\u683C\u5F0F\u7684swagger\u6587\u6863\u5185\u5BB9",trigger:"change"}],docType:[{type:"number",required:!0,message:"\u8BF7\u9009\u62E9\u6587\u6863\u7C7B\u578B",trigger:"change"}],openVisit:[{type:"number",required:!0,message:"\u8BF7\u9009\u62E9\u662F\u5426\u5F00\u653E\u8BBF\u95EE",trigger:"change"}],docStatus:[{type:"number",required:!0,message:"\u8BF7\u9009\u62E9\u6587\u6863\u72B6\u6001",trigger:"change"}]},aceEditorConfig:{wrap:!0,autoScrollEditorIntoView:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0,minLines:10,maxLines:15},swaggerDocDemo:`{ var de=Object.defineProperty,ie=Object.defineProperties;var le=Object.getOwnPropertyDescriptors;var J=Object.getOwnPropertySymbols;var se=Object.prototype.hasOwnProperty,ce=Object.prototype.propertyIsEnumerable;var G=(r,a,m)=>a in r?de(r,a,{enumerable:!0,configurable:!0,writable:!0,value:m}):r[a]=m,W=(r,a)=>{for(var m in a||(a={}))se.call(a,m)&&G(r,m,a[m]);if(J)for(var m of J(a))ce.call(a,m)&&G(r,m,a[m]);return r},K=(r,a)=>ie(r,le(a));import{z as C,g as H}from"./custom.05b2559c.js";import{a2 as re,I as ue,u as R,y as f,N as Q,W as j,r as i,o as c,c as p,B as A,D as Z,a3 as X,H as Y,O as _e,w as t,a as o,Q as $,b as L,e as D,t as ee,k,m as d,a4 as te,P as oe,F as N,T as me,V as he,a5 as pe,a6 as fe}from"./vendor.160e93e4.js";import{a as F}from"./index.3d03ec9c.js";import{m as ge}from"./index.755e9586.js";import{_ as M}from"./main.44472edc.js";import{E as ve}from"./EditGlobalParam.37d64aca.js";const ye={components:{aceEditor:F,BranchesOutlined:re,mavonEditor:ge.exports.mavonEditor,InfoCircleOutlined:ue},props:{doc:{type:Object,required:!0}},setup(r,{emit:a}){R();let m=f({}),e=f("");Q(()=>r.doc,()=>{v()});const g=()=>e.value?{id:m.value.id,shareInstruction:e.value}:(A.error("\u8BF7\u8F93\u5165\u5F00\u653E\u6587\u6863\u7684\u8BF4\u660E"),!1),v=async()=>{m.value=r.doc,e.value=r.doc.shareInstruction},s=(u,_)=>{},l=(u,_)=>(A.error("\u6682\u4E0D\u652F\u6301\u56FE\u7247\u4E0A\u4F20"),!1);return j(()=>{v()}),{docEdit:m,shareInstruction:e,getDoc:g,editDoc:v,imageFilter:l,addMarkdownImage:s,toolbars:{bold:!0,italic:!0,header:!0,underline:!0,strikethrough:!0,mark:!0,superscript:!0,subscript:!0,quote:!0,ol:!0,ul:!0,link:!0,imagelink:!1,code:!0,table:!0,fullscreen:!0,readmodel:!0,undo:!0,redo:!0,trash:!0,save:!0,navigation:!1,alignleft:!0,aligncenter:!0,alignright:!0,subfield:!0,preview:!0}}}};function be(r,a,m,e,g,v){const s=i("mavon-editor");return c(),p(s,{ref:"mavonEditor",modelValue:e.shareInstruction,"onUpdate:modelValue":a[0]||(a[0]=l=>e.shareInstruction=l),toolbars:e.toolbars,externalLink:!1,onImgAdd:e.addMarkdownImage,imageFilter:e.imageFilter,style:{height:"calc(100vh - 80px)"},placeholder:"\u8BF7\u5F55\u5165\u5F00\u653E\u6587\u6863\u8BF4\u660E"},null,8,["modelValue","toolbars","onImgAdd","imageFilter"])}var ae=M(ye,[["render",be]]);const we={emits:["edit"],components:{aceEditor:F,EditShareInstruction:ae,DownOutlined:Z,LinkOutlined:X,EditOutlined:Y},props:{doc:{type:Object,required:!0}},setup(r,{emit:a}){const m=R();let e=f({}),g=f();Q(()=>r.doc,()=>{s()});const v=async()=>{g.value.validate().then(()=>{C.apiDocAdd(e.value).then(_=>{m.commit("addDocChangedNum")})}).catch(_=>{console.log("error",_)})},s=()=>{e.value=r.doc},l=async()=>(await g.value.validate(),e.value),u=_=>{_.shareUuid?_.openVisit!==1?A.warning("\u8BE5\u6587\u6863\u5C1A\u672A\u5F00\u542F\u5F00\u653E\u8BBF\u95EE\u529F\u80FD\uFF0C\u8BF7\u5728\u7F16\u8F91\u9875\u9009\u62E9\u5F00\u653E\u540E\u518D\u8BD5"):window.open(H()+"/doc-api#/share/home?uuid="+_.shareUuid):A.warning("\u8BF7\u5148\u4FDD\u5B58\u6587\u6863\u540E\u518D\u8BD5")};return j(()=>{s()}),{docEdit:e,newDocFormRef:g,handleNewDocOk:v,editDoc:s,getDoc:l,openShareViewWindow:u,newDocRules:{name:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u6863\u540D\u79F0",trigger:"change"}],docUrl:[{required:!0,message:"\u8BF7\u8F93\u5165\u6587\u6863\u5730\u5740",trigger:"change"}],jsonContent:[{required:!0,message:"\u8BF7\u8F93\u5165JSON\u683C\u5F0F\u7684swagger\u6587\u6863\u5185\u5BB9",trigger:"change"}],docType:[{type:"number",required:!0,message:"\u8BF7\u9009\u62E9\u6587\u6863\u7C7B\u578B",trigger:"change"}],openVisit:[{type:"number",required:!0,message:"\u8BF7\u9009\u62E9\u662F\u5426\u5F00\u653E\u8BBF\u95EE",trigger:"change"}],docStatus:[{type:"number",required:!0,message:"\u8BF7\u9009\u62E9\u6587\u6863\u72B6\u6001",trigger:"change"}]},aceEditorConfig:{wrap:!0,autoScrollEditorIntoView:!0,enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!0,minLines:10,maxLines:15},swaggerDocDemo:`{
"swagger": "2.0", "swagger": "2.0",
"info": {}, "info": {},
"host": "doc.zyplayer.com", "host": "doc.zyplayer.com",

View File

@@ -1 +1 @@
import{v as L,u as y,y as a,W as j,r as g,o as h,c as v,w as D,B as k,e as x}from"./vendor.627eef95.js";import{D as I,s as _}from"./DocContent.ba3e0502.js";import{m as M}from"./index.a17fca00.js";import{_ as q}from"./main.54fae6aa.js";import"./logUtil.8ec1c7d7.js";const S={components:{DocContent:I},setup(){const r=L(),s=y();let m=a("doc"),t=a([]),n=a([]),c=a({url:"",description:"",method:"",consumes:"",produces:""}),o=a(!1),i=0,l;const u=()=>{let P=r.query.path+"."+r.query.method;if(Object.keys(s.state.swaggerUrlMethodMap).length<=0){console.log("\u6587\u6863\u5C1A\u672A\u52A0\u8F7D\uFF0C\u7B49\u5F85\u52A0\u8F7D\u5B8C\u6210"),l||(l=setInterval(()=>{if(o.value||i++>50){clearInterval(l);return}Object.keys(s.state.swaggerUrlMethodMap).length>0&&(console.log("\u6587\u6863\u5185\u5BB9\u6539\u53D8\uFF0C\u91CD\u65B0\u52A0\u8F7D\u6587\u6863"),u())},1e3));return}let e=s.state.swaggerUrlMethodMap[P];if(!e){k.error("\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u7684\u6587\u6863");return}o.value=!0,s.commit("addTableName",{key:r.fullPath,val:e.summary});let d="",p="";e.consumes&&e.consumes.length>0&&(d=e.consumes.join(" ")),e.produces&&e.produces.length>0&&(p=e.produces.join(" "));let w=M.exports.markdownIt.render(e.description||e.summary||"");c.value={url:e.url,description:w,method:e.method||"",consumes:d,produces:p};let f=s.state.swaggerDefinitions;t.value=_.getRequestParamList(e.parameters,f),n.value=_.getResponseParamList(e.responses,f)};return j(()=>{u()}),{docInfoShow:c,activePage:m,changePage:()=>{},isLoadSuccess:o,requestParamList:t,responseParamList:n}}},C=x("div",{style:{padding:"20px 0",height:"100px"}},null,-1);function b(r,s,m,t,n,c){const o=g("DocContent"),i=g("a-spin");return t.isLoadSuccess?(h(),v(o,{key:0,docInfoShow:t.docInfoShow,requestParamList:t.requestParamList,responseParamList:t.responseParamList},null,8,["docInfoShow","requestParamList","responseParamList"])):(h(),v(i,{key:1,tip:"\u6587\u6863\u6570\u636E\u52A0\u8F7D\u4E2D..."},{default:D(()=>[C]),_:1}))}var V=q(S,[["render",b]]);export{V as default}; import{v as L,u as y,y as a,W as j,r as g,o as h,c as v,w as D,B as k,e as x}from"./vendor.160e93e4.js";import{D as I,s as _}from"./DocContent.644f8b84.js";import{m as M}from"./index.755e9586.js";import{_ as q}from"./main.44472edc.js";import"./logUtil.0b911694.js";const S={components:{DocContent:I},setup(){const r=L(),s=y();let m=a("doc"),t=a([]),n=a([]),c=a({url:"",description:"",method:"",consumes:"",produces:""}),o=a(!1),i=0,l;const u=()=>{let P=r.query.path+"."+r.query.method;if(Object.keys(s.state.swaggerUrlMethodMap).length<=0){console.log("\u6587\u6863\u5C1A\u672A\u52A0\u8F7D\uFF0C\u7B49\u5F85\u52A0\u8F7D\u5B8C\u6210"),l||(l=setInterval(()=>{if(o.value||i++>50){clearInterval(l);return}Object.keys(s.state.swaggerUrlMethodMap).length>0&&(console.log("\u6587\u6863\u5185\u5BB9\u6539\u53D8\uFF0C\u91CD\u65B0\u52A0\u8F7D\u6587\u6863"),u())},1e3));return}let e=s.state.swaggerUrlMethodMap[P];if(!e){k.error("\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u7684\u6587\u6863");return}o.value=!0,s.commit("addTableName",{key:r.fullPath,val:e.summary});let d="",p="";e.consumes&&e.consumes.length>0&&(d=e.consumes.join(" ")),e.produces&&e.produces.length>0&&(p=e.produces.join(" "));let w=M.exports.markdownIt.render(e.description||e.summary||"");c.value={url:e.url,description:w,method:e.method||"",consumes:d,produces:p};let f=s.state.swaggerDefinitions;t.value=_.getRequestParamList(e.parameters,f),n.value=_.getResponseParamList(e.responses,f)};return j(()=>{u()}),{docInfoShow:c,activePage:m,changePage:()=>{},isLoadSuccess:o,requestParamList:t,responseParamList:n}}},C=x("div",{style:{padding:"20px 0",height:"100px"}},null,-1);function b(r,s,m,t,n,c){const o=g("DocContent"),i=g("a-spin");return t.isLoadSuccess?(h(),v(o,{key:0,docInfoShow:t.docInfoShow,requestParamList:t.requestParamList,responseParamList:t.responseParamList},null,8,["docInfoShow","requestParamList","responseParamList"])):(h(),v(i,{key:1,tip:"\u6587\u6863\u6570\u636E\u52A0\u8F7D\u4E2D..."},{default:D(()=>[C]),_:1}))}var V=q(S,[["render",b]]);export{V as default};

View File

@@ -1 +1 @@
import{v as y,u as j,y as a,W as k,r as h,o as g,c as v,w,B as x,e as D}from"./vendor.627eef95.js";import{D as I,o as _}from"./DocContent.1017f7cb.js";import{m as M}from"./index.a17fca00.js";import{_ as q}from"./main.54fae6aa.js";import"./logUtil.8ec1c7d7.js";const C={components:{DocContent:I},setup(){const n=y(),t=j();let p=a("doc"),o=a([]),r=a([]),c=a({url:"",description:"",method:"",consumes:"",produces:""}),s=a(!1),i=0,l;const m=()=>{let P=n.query.path+"."+n.query.method;if(Object.keys(t.state.openApiUrlMethodMap).length<=0){console.log("\u6587\u6863\u5C1A\u672A\u52A0\u8F7D\uFF0C\u7B49\u5F85\u52A0\u8F7D\u5B8C\u6210"),l||(l=setInterval(()=>{if(s.value||i++>50){clearInterval(l);return}Object.keys(t.state.openApiUrlMethodMap).length>0&&(console.log("\u6587\u6863\u5185\u5BB9\u6539\u53D8\uFF0C\u91CD\u65B0\u52A0\u8F7D\u6587\u6863"),m())},1e3));return}let e=t.state.openApiUrlMethodMap[P];if(!e){x.error("\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u7684\u6587\u6863");return}s.value=!0,t.commit("addTableName",{key:n.fullPath,val:e.summary});let u="",d="";e.consumes&&e.consumes.length>0&&(u=e.consumes.join(" ")),e.produces&&e.produces.length>0&&(d=e.produces.join(" "));let L=M.exports.markdownIt.render(e.description||e.summary||"");c.value={url:e.url,description:L,method:e.method||"",consumes:u,produces:d};let f=t.state.openApiComponents;o.value=_.getRequestParamList(e.parameters,f),r.value=_.getResponseParamList(e.responses,f)};return k(()=>{m()}),{docInfoShow:c,activePage:p,changePage:()=>{},isLoadSuccess:s,requestParamList:o,responseParamList:r}}},S=D("div",{style:{padding:"20px 0",height:"100px"}},null,-1);function A(n,t,p,o,r,c){const s=h("DocContent"),i=h("a-spin");return o.isLoadSuccess?(g(),v(s,{key:0,docInfoShow:o.docInfoShow,requestParamList:o.requestParamList,responseParamList:o.responseParamList},null,8,["docInfoShow","requestParamList","responseParamList"])):(g(),v(i,{key:1,tip:"\u6587\u6863\u6570\u636E\u52A0\u8F7D\u4E2D..."},{default:w(()=>[S]),_:1}))}var T=q(C,[["render",A]]);export{T as default}; import{v as y,u as j,y as n,W as k,r as h,o as g,c as v,w,B as x,e as D}from"./vendor.160e93e4.js";import{D as I,o as _}from"./DocContent.f9d61560.js";import{m as M}from"./index.755e9586.js";import{_ as q}from"./main.44472edc.js";import"./logUtil.0b911694.js";const C={components:{DocContent:I},setup(){const a=y(),t=j();let p=n("doc"),o=n([]),r=n([]),i=n({url:"",description:"",method:"",consumes:"",produces:""}),s=n(!1),c=0,l;const m=()=>{let P=a.query.path+"."+a.query.method;if(Object.keys(t.state.openApiUrlMethodMap).length<=0){console.log("\u6587\u6863\u5C1A\u672A\u52A0\u8F7D\uFF0C\u7B49\u5F85\u52A0\u8F7D\u5B8C\u6210"),l||(l=setInterval(()=>{if(s.value||c++>50){clearInterval(l);return}Object.keys(t.state.openApiUrlMethodMap).length>0&&(console.log("\u6587\u6863\u5185\u5BB9\u6539\u53D8\uFF0C\u91CD\u65B0\u52A0\u8F7D\u6587\u6863"),m())},1e3));return}let e=t.state.openApiUrlMethodMap[P];if(!e){x.error("\u6CA1\u6709\u627E\u5230\u5BF9\u5E94\u7684\u6587\u6863");return}s.value=!0,t.commit("addTableName",{key:a.fullPath,val:e.summary});let u="",d="";e.consumes&&e.consumes.length>0&&(u=e.consumes.join(" ")),e.produces&&e.produces.length>0&&(d=e.produces.join(" "));let L=M.exports.markdownIt.render(e.description||e.summary||"");i.value={url:e.url,description:L,method:e.method||"",consumes:u,produces:d};let f=t.state.openApiComponents;o.value=_.getRequestParamList(e.parameters,f),r.value=_.getResponseParamList(e.responses,f)};return k(()=>{m()}),{docInfoShow:i,activePage:p,changePage:()=>{},isLoadSuccess:s,requestParamList:o,responseParamList:r}}},S=D("div",{style:{padding:"20px 0",height:"100px"}},null,-1);function A(a,t,p,o,r,i){const s=h("DocContent"),c=h("a-spin");return o.isLoadSuccess?(g(),v(s,{key:0,docInfoShow:o.docInfoShow,requestParamList:o.requestParamList,responseParamList:o.responseParamList},null,8,["docInfoShow","requestParamList","responseParamList"])):(g(),v(c,{key:1,tip:"\u6587\u6863\u6570\u636E\u52A0\u8F7D\u4E2D..."},{default:w(()=>[S]),_:1}))}var T=q(C,[["render",A]]);export{T as default};

View File

@@ -1 +1 @@
var K=Object.defineProperty;var I=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var B=(s,e,a)=>e in s?K(s,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[e]=a,x=(s,e)=>{for(var a in e||(e={}))N.call(e,a)&&B(s,a,e[a]);if(I)for(var a of I(e))O.call(e,a)&&B(s,a,e[a]);return s};import{z as V}from"./custom.e03d703e.js";import{P as S,a4 as U,R as j,u as A,y as L,W as F,r as m,o as l,b as u,e as z,a as d,w as n,F as f,c as k,t as G,k as g,B as R,m as c}from"./vendor.627eef95.js";import{_ as H}from"./main.54fae6aa.js";const q={components:{PlusOutlined:S,SearchOutlined:U,ReloadOutlined:j},props:{dynamicParam:{type:Object,required:!0}},setup(s){const e=A();let a=L([]),t=L(!1);const h=async()=>{i.value={},t.value=!0,V.docApiGlobalParamList(s.dynamicParam).then(o=>{setTimeout(()=>t.value=!1,500),a.value=o.data||[],e.commit("setGlobalParamOnChange",a.value,s.dynamicParam.id)})};let i=L({}),D=L();const p=()=>{i.value.isEdit&&v(i.value);let o={isEdit:!0,paramType:1};a.value.unshift(o),i.value=o,setTimeout(()=>{let r=document.getElementsByClassName("ant-table-body")[0];r.scrollTop=0},0)},P=o=>{i.value.isEdit&&v(i.value),o.isEdit=!0,i.value=x({},o)},v=o=>{o.isEdit=!1,o.id?a.value.forEach(r=>r.isEdit=!1):a.value=a.value.filter(r=>r!==o),i.value={}},E=o=>{if(!i.value.paramKey||!i.value.paramValue){R.error("\u53C2\u6570\u540D\u6216\u53C2\u6570\u503C\u4E0D\u80FD\u4E3A\u7A7A");return}let r=x(x({},s.dynamicParam),i.value);V.docApiGlobalParamUpdate(r).then(w=>{o.isEdit=!1,h()})},T=async o=>{V.docApiGlobalParamUpdate({id:o.id,yn:0}).then(r=>{h()})};return F(()=>{h()}),{docList:a,docListLoading:t,docEdit:i,tableRef:D,searchDocList:h,deleteDoc:T,editDoc:P,saveEditDoc:E,cancelEditDoc:v,addDocLine:p,docListColumns:[{title:"\u53C2\u6570\u540D\u79F0",dataIndex:"paramKey",width:250},{title:"\u53C2\u6570\u503C",dataIndex:"paramValue"},{title:"\u53C2\u6570\u4F4D\u7F6E",dataIndex:"paramType",width:120},{title:"\u64CD\u4F5C",dataIndex:"operation",fixed:"right",width:170}]}}},M={style:{"margin-bottom":"10px","text-align":"right"}},W=c(" \u5237\u65B0"),J=c(" \u65B0\u5EFA"),Q={key:1},X={key:1},Y=c("Form"),Z=c("Header"),$=c("Cookie"),ee=c("Form"),ae=c("Header"),te=c("Cookie"),oe=c("\u53D6\u6D88"),ne=c("\u4FDD\u5B58"),le=c("\u7F16\u8F91"),ie=c("\u5220\u9664");function de(s,e,a,t,h,i){const D=m("reload-outlined"),p=m("a-button"),P=m("plus-outlined"),v=m("a-input"),E=m("a-select-option"),T=m("a-select"),o=m("a-tag"),r=m("a-popconfirm"),w=m("a-table");return l(),u(f,null,[z("div",M,[d(p,{onClick:t.searchDocList,type:"primary"},{icon:n(()=>[d(D)]),default:n(()=>[W]),_:1},8,["onClick"]),d(p,{onClick:t.addDocLine},{icon:n(()=>[d(P)]),default:n(()=>[J]),_:1},8,["onClick"])]),d(w,{dataSource:t.docList,columns:t.docListColumns,size:"middle",id:"paramTable",loading:t.docListLoading,pagination:!1,scroll:{x:1e3,y:"calc(100vh - 240px)"}},{bodyCell:n(({column:b,text:C,record:y})=>[b.dataIndex==="paramKey"?(l(),u(f,{key:0},[y.isEdit?(l(),k(v,{key:0,placeholder:"\u8BF7\u8F93\u5165\u53C2\u6570\u540D\u79F0",value:t.docEdit.paramKey,"onUpdate:value":e[0]||(e[0]=_=>t.docEdit.paramKey=_)},null,8,["value"])):(l(),u("span",Q,G(C),1))],64)):g("",!0),b.dataIndex==="paramValue"?(l(),u(f,{key:1},[y.isEdit?(l(),k(v,{key:0,rows:1,placeholder:"\u8BF7\u8F93\u5165\u53C2\u6570\u503C",value:t.docEdit.paramValue,"onUpdate:value":e[1]||(e[1]=_=>t.docEdit.paramValue=_)},null,8,["value"])):(l(),u("span",X,G(C),1))],64)):g("",!0),b.dataIndex==="paramType"?(l(),u(f,{key:2},[y.isEdit?(l(),k(T,{key:0,placeholder:"\u53C2\u6570\u4F4D\u7F6E",value:t.docEdit.paramType,"onUpdate:value":e[2]||(e[2]=_=>t.docEdit.paramType=_),style:{width:"110px"}},{default:n(()=>[d(E,{value:1},{default:n(()=>[Y]),_:1}),d(E,{value:2},{default:n(()=>[Z]),_:1}),d(E,{value:3},{default:n(()=>[$]),_:1})]),_:1},8,["value"])):(l(),u(f,{key:1},[C===1?(l(),k(o,{key:0,color:"green"},{default:n(()=>[ee]),_:1})):C===2?(l(),k(o,{key:1,color:"pink"},{default:n(()=>[ae]),_:1})):C===3?(l(),k(o,{key:2,color:"pink"},{default:n(()=>[te]),_:1})):g("",!0)],64))],64)):g("",!0),b.dataIndex==="operation"?(l(),u(f,{key:3},[y.isEdit?(l(),u(f,{key:0},[d(p,{type:"link",onClick:_=>t.cancelEditDoc(y)},{default:n(()=>[oe]),_:2},1032,["onClick"]),d(p,{type:"link",onClick:_=>t.saveEditDoc(y)},{default:n(()=>[ne]),_:2},1032,["onClick"])],64)):(l(),u(f,{key:1},[d(p,{type:"link",onClick:_=>t.editDoc(y)},{default:n(()=>[le]),_:2},1032,["onClick"]),d(r,{title:"\u786E\u5B9A\u8981\u5220\u9664\u5417\uFF1F",onConfirm:_=>t.deleteDoc(y)},{default:n(()=>[d(p,{type:"link",danger:""},{default:n(()=>[ie]),_:1})]),_:2},1032,["onConfirm"])],64))],64)):g("",!0)]),_:1},8,["dataSource","columns","loading","scroll"])],64)}var _e=H(q,[["render",de]]);export{_e as E}; var K=Object.defineProperty;var I=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,O=Object.prototype.propertyIsEnumerable;var B=(s,e,a)=>e in s?K(s,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[e]=a,x=(s,e)=>{for(var a in e||(e={}))N.call(e,a)&&B(s,a,e[a]);if(I)for(var a of I(e))O.call(e,a)&&B(s,a,e[a]);return s};import{z as V}from"./custom.05b2559c.js";import{P as S,a4 as U,R as j,u as A,y as L,W as F,r as m,o as l,b as u,e as z,a as d,w as n,F as v,c as k,t as G,k as b,B as R,m as c}from"./vendor.160e93e4.js";import{_ as H}from"./main.44472edc.js";const q={components:{PlusOutlined:S,SearchOutlined:U,ReloadOutlined:j},props:{dynamicParam:{type:Object,required:!0}},setup(s){const e=A();let a=L([]),t=L(!1);const h=async()=>{i.value={},t.value=!0,V.docApiGlobalParamList(s.dynamicParam).then(o=>{setTimeout(()=>t.value=!1,500),a.value=o.data||[],e.commit("setGlobalParamOnChange",a.value,s.dynamicParam.id)})};let i=L({}),D=L();const p=()=>{i.value.isEdit&&f(i.value);let o={isEdit:!0,paramType:1};a.value.unshift(o),i.value=o,setTimeout(()=>{let r=document.getElementsByClassName("ant-table-body")[0];r.scrollTop=0},0)},P=o=>{i.value.isEdit&&f(i.value),o.isEdit=!0,i.value=x({},o)},f=o=>{o.isEdit=!1,o.id?a.value.forEach(r=>r.isEdit=!1):a.value=a.value.filter(r=>r!==o),i.value={}},E=o=>{if(!i.value.paramKey||!i.value.paramValue){R.error("\u53C2\u6570\u540D\u6216\u53C2\u6570\u503C\u4E0D\u80FD\u4E3A\u7A7A");return}let r=x(x({},s.dynamicParam),i.value);V.docApiGlobalParamUpdate(r).then(w=>{o.isEdit=!1,h()})},T=async o=>{V.docApiGlobalParamUpdate({id:o.id,yn:0}).then(r=>{h()})};return F(()=>{h()}),{docList:a,docListLoading:t,docEdit:i,tableRef:D,searchDocList:h,deleteDoc:T,editDoc:P,saveEditDoc:E,cancelEditDoc:f,addDocLine:p,docListColumns:[{title:"\u53C2\u6570\u540D\u79F0",dataIndex:"paramKey",width:250},{title:"\u53C2\u6570\u503C",dataIndex:"paramValue"},{title:"\u53C2\u6570\u4F4D\u7F6E",dataIndex:"paramType",width:120},{title:"\u64CD\u4F5C",dataIndex:"operation",fixed:"right",width:170}]}}},M={style:{"margin-bottom":"10px","text-align":"right"}},W=c(" \u5237\u65B0"),J=c(" \u65B0\u5EFA"),Q={key:1},X={key:1},Y=c("Form"),Z=c("Header"),$=c("Cookie"),ee=c("Form"),ae=c("Header"),te=c("Cookie"),oe=c("\u53D6\u6D88"),ne=c("\u4FDD\u5B58"),le=c("\u7F16\u8F91"),ie=c("\u5220\u9664");function de(s,e,a,t,h,i){const D=m("reload-outlined"),p=m("a-button"),P=m("plus-outlined"),f=m("a-input"),E=m("a-select-option"),T=m("a-select"),o=m("a-tag"),r=m("a-popconfirm"),w=m("a-table");return l(),u(v,null,[z("div",M,[d(p,{onClick:t.searchDocList,type:"primary"},{icon:n(()=>[d(D)]),default:n(()=>[W]),_:1},8,["onClick"]),d(p,{onClick:t.addDocLine},{icon:n(()=>[d(P)]),default:n(()=>[J]),_:1},8,["onClick"])]),d(w,{dataSource:t.docList,columns:t.docListColumns,size:"middle",id:"paramTable",loading:t.docListLoading,pagination:!1,scroll:{x:1e3,y:"calc(100vh - 240px)"}},{bodyCell:n(({column:g,text:C,record:y})=>[g.dataIndex==="paramKey"?(l(),u(v,{key:0},[y.isEdit?(l(),k(f,{key:0,placeholder:"\u8BF7\u8F93\u5165\u53C2\u6570\u540D\u79F0",value:t.docEdit.paramKey,"onUpdate:value":e[0]||(e[0]=_=>t.docEdit.paramKey=_)},null,8,["value"])):(l(),u("span",Q,G(C),1))],64)):b("",!0),g.dataIndex==="paramValue"?(l(),u(v,{key:1},[y.isEdit?(l(),k(f,{key:0,rows:1,placeholder:"\u8BF7\u8F93\u5165\u53C2\u6570\u503C",value:t.docEdit.paramValue,"onUpdate:value":e[1]||(e[1]=_=>t.docEdit.paramValue=_)},null,8,["value"])):(l(),u("span",X,G(C),1))],64)):b("",!0),g.dataIndex==="paramType"?(l(),u(v,{key:2},[y.isEdit?(l(),k(T,{key:0,placeholder:"\u53C2\u6570\u4F4D\u7F6E",value:t.docEdit.paramType,"onUpdate:value":e[2]||(e[2]=_=>t.docEdit.paramType=_),style:{width:"110px"}},{default:n(()=>[d(E,{value:1},{default:n(()=>[Y]),_:1}),d(E,{value:2},{default:n(()=>[Z]),_:1}),d(E,{value:3},{default:n(()=>[$]),_:1})]),_:1},8,["value"])):(l(),u(v,{key:1},[C===1?(l(),k(o,{key:0,color:"green"},{default:n(()=>[ee]),_:1})):C===2?(l(),k(o,{key:1,color:"pink"},{default:n(()=>[ae]),_:1})):C===3?(l(),k(o,{key:2,color:"pink"},{default:n(()=>[te]),_:1})):b("",!0)],64))],64)):b("",!0),g.dataIndex==="operation"?(l(),u(v,{key:3},[y.isEdit?(l(),u(v,{key:0},[d(p,{type:"link",onClick:_=>t.cancelEditDoc(y)},{default:n(()=>[oe]),_:2},1032,["onClick"]),d(p,{type:"link",onClick:_=>t.saveEditDoc(y)},{default:n(()=>[ne]),_:2},1032,["onClick"])],64)):(l(),u(v,{key:1},[d(p,{type:"link",onClick:_=>t.editDoc(y)},{default:n(()=>[le]),_:2},1032,["onClick"]),d(r,{title:"\u786E\u5B9A\u8981\u5220\u9664\u5417\uFF1F",onConfirm:_=>t.deleteDoc(y)},{default:n(()=>[d(p,{type:"link",danger:""},{default:n(()=>[ie]),_:1})]),_:2},1032,["onConfirm"])],64))],64)):b("",!0)]),_:1},8,["dataSource","columns","loading","scroll"])],64)}var _e=H(q,[["render",de]]);export{_e as E};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
import"./custom.e03d703e.js";import{E as o}from"./EditGlobalParam.4ed84db8.js";import{_ as r}from"./main.54fae6aa.js";import{r as e,o as t,c as s}from"./vendor.627eef95.js";const m={components:{EditGlobalParam:o},setup(){return{}}};function n(c,p,d,l,i,_){const a=e("EditGlobalParam");return t(),s(a,{"dynamic-param":{docId:0}})}var G=r(m,[["render",n]]);export{G as default};

View File

@@ -0,0 +1 @@
import"./custom.05b2559c.js";import{E as o}from"./EditGlobalParam.37d64aca.js";import{_ as r}from"./main.44472edc.js";import{r as t,o as e,c as s}from"./vendor.160e93e4.js";const c={components:{EditGlobalParam:o},setup(){return{}}};function m(n,p,d,l,i,_){const a=t("EditGlobalParam");return e(),s(a,{"dynamic-param":{docId:0}})}var G=r(c,[["render",m]]);export{G as default};

View File

@@ -0,0 +1 @@
import{_ as e}from"./main.44472edc.js";import{o as t,b as o}from"./vendor.160e93e4.js";const n={name:"SettingView",components:{},data(){return{}},computed:{},mounted(){},methods:{}};function r(a,s,c,m,d,i){return t(),o("div",null," \u5C55\u793A\u914D\u7F6E\u9875\u9762 ")}var u=e(n,[["render",r]]);export{u as default};

View File

@@ -1 +0,0 @@
import{_ as e}from"./main.54fae6aa.js";import{o as t,b as o}from"./vendor.627eef95.js";const n={name:"SettingView",components:{},data(){return{}},computed:{},mounted(){},methods:{}};function a(r,s,c,m,i,p){return t(),o("div",null," \u5C55\u793A\u914D\u7F6E\u9875\u9762 ")}var _=e(n,[["render",a]]);export{_ as default};

View File

@@ -1 +1 @@
import{u as p,y as g,W as f,N as x,o as i,b as l,e as _,F as w,d as L,af as N,ag as C,t as I,a9 as S,r as m,a as v,w as u,c as H,k as A}from"./vendor.627eef95.js";import{m as T}from"./index.a17fca00.js";import{_ as y}from"./main.54fae6aa.js";const D={props:{heading:{type:Array,default:[]}},setup(r){const s=p();let a=g("100px");f(()=>{window.onresize=()=>{n()},setTimeout(()=>{n()},100)}),x(s.getters.getLeftAsideWidth,()=>{n()});let e=g();const n=()=>{a.value=window.getComputedStyle(e.value,null).width};return{navigationRef:e,navigationWidth:a,headingItemClick:t=>{t.node.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})}}}},b={class:"navigation"},W={ref:"navigationRef",style:{display:"inline-block",width:"100%",height:"1px"}},B=["onClick"];function M(r,s,a,e,n,c){return i(),l("div",b,[_("div",W,null,512),_("div",{class:"navigation-heading",style:N({width:e.navigationWidth})},[(i(!0),l(w,null,L(a.heading,t=>(i(),l("div",{class:C("heading-item heading-"+t.level),onClick:o=>e.headingItemClick(t)},I(t.text),11,B))),256))],4)])}var R=y(D,[["render",M]]);const V={components:{Navigation:R},setup(){const r=p(),s=S(()=>r.state.apiDoc);let a=g();x(r.getters.getApiDoc,()=>{setTimeout(()=>{c(".share-instruction")},100)});const e=t=>T.exports.markdownIt.render(t||"");let n=g([]);const c=t=>{if(!document.querySelector(t))return[];let o=document.querySelector(t).querySelectorAll("h1,h2,h3,h4,h5,h6");if(o.length<=0)return[];let d=[];o.forEach(h=>{let k=h.innerHTML.replace(/^\s+/g,"").replace(/\s+$/g,"").replace(/<\/?[^>]+(>|$)/g,"");d.push({node:h,level:parseInt(h.tagName.replace(/[h]/i,""),10),text:k})}),n.value=d};return f(()=>{}),{apiDoc:s,navigationRef:a,navigationList:n,markdownToHtml:e}}},$={key:0},j=["innerHTML"],q={key:1,style:{"text-align":"center"}};function z(r,s,a,e,n,c){const t=m("Navigation"),o=m("a-col"),d=m("a-row");return e.apiDoc.shareInstruction?(i(),l("div",$,[v(d,null,{default:u(()=>[e.navigationList.length>0?(i(),H(o,{key:0,xs:0,sm:4,md:4,lg:6,xl:6},{default:u(()=>[v(t,{ref:"navigationRef",heading:e.navigationList},null,8,["heading"])]),_:1})):A("",!0),v(o,{xs:24,sm:e.navigationList.length>0?20:24,md:e.navigationList.length>0?20:24,lg:e.navigationList.length>0?18:24,xl:e.navigationList.length>0?18:24},{default:u(()=>[_("div",{class:"markdown-body share-instruction",innerHTML:e.markdownToHtml(e.apiDoc.shareInstruction),style:{margin:"0 auto","max-width":"1000px"}},null,8,j)]),_:1},8,["sm","md","lg","xl"])]),_:1})])):(i(),l("div",q,"\u6B22\u8FCE\u8BBF\u95EE\u5F00\u653EAPI\u6587\u6863"))}var G=y(V,[["render",z]]);export{G as default}; import{u as p,y as g,W as f,N as x,o as i,b as l,e as _,F as w,d as L,af as N,ag as C,t as I,a9 as S,r as m,a as v,w as u,c as H,k as A}from"./vendor.160e93e4.js";import{m as T}from"./index.755e9586.js";import{_ as y}from"./main.44472edc.js";const D={props:{heading:{type:Array,default:[]}},setup(r){const s=p();let a=g("100px");f(()=>{window.onresize=()=>{n()},setTimeout(()=>{n()},100)}),x(s.getters.getLeftAsideWidth,()=>{n()});let e=g();const n=()=>{a.value=window.getComputedStyle(e.value,null).width};return{navigationRef:e,navigationWidth:a,headingItemClick:t=>{t.node.scrollIntoView({behavior:"smooth",block:"start",inline:"nearest"})}}}},b={class:"navigation"},W={ref:"navigationRef",style:{display:"inline-block",width:"100%",height:"1px"}},B=["onClick"];function M(r,s,a,e,n,c){return i(),l("div",b,[_("div",W,null,512),_("div",{class:"navigation-heading",style:N({width:e.navigationWidth})},[(i(!0),l(w,null,L(a.heading,t=>(i(),l("div",{class:C("heading-item heading-"+t.level),onClick:o=>e.headingItemClick(t)},I(t.text),11,B))),256))],4)])}var R=y(D,[["render",M]]);const V={components:{Navigation:R},setup(){const r=p(),s=S(()=>r.state.apiDoc);let a=g();x(r.getters.getApiDoc,()=>{setTimeout(()=>{c(".share-instruction")},100)});const e=t=>T.exports.markdownIt.render(t||"");let n=g([]);const c=t=>{if(!document.querySelector(t))return[];let o=document.querySelector(t).querySelectorAll("h1,h2,h3,h4,h5,h6");if(o.length<=0)return[];let d=[];o.forEach(h=>{let k=h.innerHTML.replace(/^\s+/g,"").replace(/\s+$/g,"").replace(/<\/?[^>]+(>|$)/g,"");d.push({node:h,level:parseInt(h.tagName.replace(/[h]/i,""),10),text:k})}),n.value=d};return f(()=>{}),{apiDoc:s,navigationRef:a,navigationList:n,markdownToHtml:e}}},$={key:0},j=["innerHTML"],q={key:1,style:{"text-align":"center"}};function z(r,s,a,e,n,c){const t=m("Navigation"),o=m("a-col"),d=m("a-row");return e.apiDoc.shareInstruction?(i(),l("div",$,[v(d,null,{default:u(()=>[e.navigationList.length>0?(i(),H(o,{key:0,xs:0,sm:4,md:4,lg:6,xl:6},{default:u(()=>[v(t,{ref:"navigationRef",heading:e.navigationList},null,8,["heading"])]),_:1})):A("",!0),v(o,{xs:24,sm:e.navigationList.length>0?20:24,md:e.navigationList.length>0?20:24,lg:e.navigationList.length>0?18:24,xl:e.navigationList.length>0?18:24},{default:u(()=>[_("div",{class:"markdown-body share-instruction",innerHTML:e.markdownToHtml(e.apiDoc.shareInstruction),style:{margin:"0 auto","max-width":"1000px"}},null,8,j)]),_:1},8,["sm","md","lg","xl"])]),_:1})])):(i(),l("div",q,"\u6B22\u8FCE\u8BBF\u95EE\u5F00\u653EAPI\u6587\u6863"))}var G=y(V,[["render",z]]);export{G as default};

View File

@@ -1 +1 @@
var E=Object.defineProperty,I=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable;var x=(r,e,t)=>e in r?E(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,m=(r,e)=>{for(var t in e||(e={}))b.call(e,t)&&x(r,t,e[t]);if(L)for(var t of L(e))D.call(e,t)&&x(r,t,e[t]);return r},_=(r,e)=>I(r,O(e));import{_ as k}from"./main.54fae6aa.js";import{W as M,y as v,o as j,b as z,e as R}from"./vendor.627eef95.js";const A=["get","head","post","put","patch","delete","options","trace"];function q(r){let e={},t={},n={},h=r.paths;return h?(Object.keys(h).forEach(o=>{let l=h[o];for(let a of A){if(!l[a]||!l[a].tags)continue;let i=a.toLowerCase();n[i]=(n[i]||0)+1,n.total=(n.total||0)+1,l[a].tags.forEach(f=>{let d=e[f];d||(d=e[f]={});let s=d[o];s||(s=d[o]={});let c=o+"."+a;s[a]=l[a],s[a].path=c,s[a].url=o,s[a].method=a,t[c]=l[a]})}}),{urlMethodMap:t,tagPathMap:e,methodStatistic:n}):{urlMethodMap:t,tagPathMap:e,methodStatistic:n}}function G(r,e,t,n){let h=[],o=1,l=r.tags||[];return l.length<=0&&Object.keys(e).forEach(a=>l.push({name:a})),l.forEach(a=>{let i=1,f=[],d=e[a.name];!d||(Object.keys(d).forEach(s=>{let c=1,p=d[s];Object.keys(p).forEach(y=>{let g=o+"_"+i+"_"+c,u=p[y];if(!$(s,u,t))return;u.treeId=g;let T=u.summary||u.path;f.push({title:T,key:g,isLeaf:!0,method:u.method,query:_(m({},n),{path:u.url,method:u.method})}),c++}),i++}),f.length>0&&h.push({title:a.name,key:o,children:f}),o++)}),[{key:"main",title:r.info.title||"Swagger\u63A5\u53E3\u6587\u6863",children:h}]}function $(r,e,t){if(!t||!r||(r=r.toLowerCase(),t=t.toLowerCase(),r.indexOf(t)>=0))return!0;let n=e.path+e.method+e.summary+e.description+e.tags;return n&&n.toLowerCase().indexOf(t)>=0}const P=["get","head","post","put","patch","delete","options","trace"];function H(r){let e={},t={},n={},h=r.paths;return h?(Object.keys(h).forEach(o=>{let l=h[o];for(let a of P){if(!l[a]||!l[a].tags)continue;let i=a.toLowerCase();n[i]=(n[i]||0)+1,n.total=(n.total||0)+1,l[a].tags.forEach(f=>{let d=e[f];d||(d=e[f]={});let s=d[o];s||(s=d[o]={});let c=o+"."+a;s[a]=l[a],s[a].path=c,s[a].url=o,s[a].method=a,t[c]=l[a]})}}),{urlMethodMap:t,tagPathMap:e,methodStatistic:n}):{urlMethodMap:t,tagPathMap:e,methodStatistic:n}}function J(r,e,t,n){let h=[],o=1,l=r.tags||[];return l.length<=0&&Object.keys(e).forEach(a=>l.push({name:a})),l.forEach(a=>{let i=1,f=[],d=e[a.name];!d||(Object.keys(d).forEach(s=>{let c=1,p=d[s];Object.keys(p).forEach(y=>{let g=o+"_"+i+"_"+c,u=p[y];if(!B(s,u,t))return;u.treeId=g;let T=u.summary||u.path;f.push({title:T,key:g,isLeaf:!0,method:u.method,query:_(m({},n),{path:u.url,method:u.method})}),c++}),i++}),f.length>0&&h.push({title:a.name,key:o,children:f}),o++)}),[{key:"main",title:r.info.title||"OpenApi\u63A5\u53E3\u6587\u6863",children:h}]}function B(r,e,t){if(!t||!r||(r=r.toLowerCase(),t=t.toLowerCase(),r.indexOf(t)>=0))return!0;let n=e.path+e.method+e.summary+e.description+e.tags;return n&&n.toLowerCase().indexOf(t)>=0}function K(r,e,t,n){let h=r[0],o=C(h,e,t,n,1);return[{key:"main",isLeaf:!1,title:h.name||"\u81EA\u5EFAAPI\u63A5\u53E3\u6587\u6863",children:o}]}function C(r,e,t,n,h){let o=[];if(!r)return o;let l=1,a=1;return r.children&&r.children.length>0&&r.children.forEach(i=>{n.originNodeMap[i.nodeId]=i;let f=h+"_"+l+"_"+a;if(i.nodeType===1)o.push({title:i.nodeName,key:f,isLeaf:!0,method:i.method,nodeId:i.nodeId,query:_(m({},t),{nodeId:i.nodeId})}),a++;else{let d=C(i,e,t,n,f),s=U(i,e);(d.length>0||s)&&(o.push({title:i.nodeName,key:f,nodeId:i.nodeId,isLeaf:!1,editing:!1,titleEditing:i.nodeName,children:d}),a++)}}),l++,o}function U(r,e){if(!e||!r)return!0;e=e.toLowerCase();let t=r.name;return t&&t.toLowerCase().indexOf(e)>=0}const w={emits:["update:value","change"],setup(r,{emit:e}){M(()=>{o()});let t=v(300),n=v(),h=v();const o=()=>{let l=n.value,a=h.value;l.onmousedown=i=>{let f=i.clientX;return l.style.background="#ccc",a.style.background="#aaa",l.left=l.offsetLeft,document.onmousemove=d=>{let s=d.clientX,c=f-s;(c<0&&t.value<600||c>0&&t.value>300)&&(f=s,t.value-=c,t.value<300&&(t.value=300),e("update:value",t.value),e("change",t.value))},document.onmouseup=()=>{l.style.background="#fafafa",a.style.background="#ccc",document.onmousemove=null,document.onmouseup=null},!1}};return{leftAsideWidth:t,leftResizeRef:n,leftResizeBarRef:h}}},F={ref:"leftResizeRef",class:"left-resize"},S={ref:"leftResizeBarRef"};function X(r,e,t,n,h,o){return j(),z("div",F,[R("i",S,"...",512)],512)}var Q=k(w,[["render",X],["__scopeId","data-v-33303c20"]]),Y="assets/api-logo.952f0c92.png";export{Q as L,Y as _,q as a,H as b,J as c,K as d,G as g}; var E=Object.defineProperty,I=Object.defineProperties;var O=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var b=Object.prototype.hasOwnProperty,D=Object.prototype.propertyIsEnumerable;var x=(r,e,t)=>e in r?E(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,m=(r,e)=>{for(var t in e||(e={}))b.call(e,t)&&x(r,t,e[t]);if(L)for(var t of L(e))D.call(e,t)&&x(r,t,e[t]);return r},_=(r,e)=>I(r,O(e));import{_ as k}from"./main.44472edc.js";import{W as M,y as v,o as j,b as z,e as R}from"./vendor.160e93e4.js";const A=["get","head","post","put","patch","delete","options","trace"];function q(r){let e={},t={},n={},h=r.paths;return h?(Object.keys(h).forEach(o=>{let l=h[o];for(let a of A){if(!l[a]||!l[a].tags)continue;let i=a.toLowerCase();n[i]=(n[i]||0)+1,n.total=(n.total||0)+1,l[a].tags.forEach(f=>{let d=e[f];d||(d=e[f]={});let s=d[o];s||(s=d[o]={});let c=o+"."+a;s[a]=l[a],s[a].path=c,s[a].url=o,s[a].method=a,t[c]=l[a]})}}),{urlMethodMap:t,tagPathMap:e,methodStatistic:n}):{urlMethodMap:t,tagPathMap:e,methodStatistic:n}}function G(r,e,t,n){let h=[],o=1,l=r.tags||[];return l.length<=0&&Object.keys(e).forEach(a=>l.push({name:a})),l.forEach(a=>{let i=1,f=[],d=e[a.name];!d||(Object.keys(d).forEach(s=>{let c=1,p=d[s];Object.keys(p).forEach(y=>{let g=o+"_"+i+"_"+c,u=p[y];if(!$(s,u,t))return;u.treeId=g;let T=u.summary||u.path;f.push({title:T,key:g,isLeaf:!0,method:u.method,query:_(m({},n),{path:u.url,method:u.method})}),c++}),i++}),f.length>0&&h.push({title:a.name,key:o,children:f}),o++)}),[{key:"main",title:r.info.title||"Swagger\u63A5\u53E3\u6587\u6863",children:h}]}function $(r,e,t){if(!t||!r||(r=r.toLowerCase(),t=t.toLowerCase(),r.indexOf(t)>=0))return!0;let n=e.path+e.method+e.summary+e.description+e.tags;return n&&n.toLowerCase().indexOf(t)>=0}const P=["get","head","post","put","patch","delete","options","trace"];function H(r){let e={},t={},n={},h=r.paths;return h?(Object.keys(h).forEach(o=>{let l=h[o];for(let a of P){if(!l[a]||!l[a].tags)continue;let i=a.toLowerCase();n[i]=(n[i]||0)+1,n.total=(n.total||0)+1,l[a].tags.forEach(f=>{let d=e[f];d||(d=e[f]={});let s=d[o];s||(s=d[o]={});let c=o+"."+a;s[a]=l[a],s[a].path=c,s[a].url=o,s[a].method=a,t[c]=l[a]})}}),{urlMethodMap:t,tagPathMap:e,methodStatistic:n}):{urlMethodMap:t,tagPathMap:e,methodStatistic:n}}function J(r,e,t,n){let h=[],o=1,l=r.tags||[];return l.length<=0&&Object.keys(e).forEach(a=>l.push({name:a})),l.forEach(a=>{let i=1,f=[],d=e[a.name];!d||(Object.keys(d).forEach(s=>{let c=1,p=d[s];Object.keys(p).forEach(y=>{let g=o+"_"+i+"_"+c,u=p[y];if(!B(s,u,t))return;u.treeId=g;let T=u.summary||u.path;f.push({title:T,key:g,isLeaf:!0,method:u.method,query:_(m({},n),{path:u.url,method:u.method})}),c++}),i++}),f.length>0&&h.push({title:a.name,key:o,children:f}),o++)}),[{key:"main",title:r.info.title||"OpenApi\u63A5\u53E3\u6587\u6863",children:h}]}function B(r,e,t){if(!t||!r||(r=r.toLowerCase(),t=t.toLowerCase(),r.indexOf(t)>=0))return!0;let n=e.path+e.method+e.summary+e.description+e.tags;return n&&n.toLowerCase().indexOf(t)>=0}function K(r,e,t,n){let h=r[0],o=C(h,e,t,n,1);return[{key:"main",isLeaf:!1,title:h.name||"\u81EA\u5EFAAPI\u63A5\u53E3\u6587\u6863",children:o}]}function C(r,e,t,n,h){let o=[];if(!r)return o;let l=1,a=1;return r.children&&r.children.length>0&&r.children.forEach(i=>{n.originNodeMap[i.nodeId]=i;let f=h+"_"+l+"_"+a;if(i.nodeType===1)o.push({title:i.nodeName,key:f,isLeaf:!0,method:i.method,nodeId:i.nodeId,query:_(m({},t),{nodeId:i.nodeId})}),a++;else{let d=C(i,e,t,n,f),s=U(i,e);(d.length>0||s)&&(o.push({title:i.nodeName,key:f,nodeId:i.nodeId,isLeaf:!1,editing:!1,titleEditing:i.nodeName,children:d}),a++)}}),l++,o}function U(r,e){if(!e||!r)return!0;e=e.toLowerCase();let t=r.name;return t&&t.toLowerCase().indexOf(e)>=0}const w={emits:["update:value","change"],setup(r,{emit:e}){M(()=>{o()});let t=v(300),n=v(),h=v();const o=()=>{let l=n.value,a=h.value;l.onmousedown=i=>{let f=i.clientX;return l.style.background="#ccc",a.style.background="#aaa",l.left=l.offsetLeft,document.onmousemove=d=>{let s=d.clientX,c=f-s;(c<0&&t.value<600||c>0&&t.value>300)&&(f=s,t.value-=c,t.value<300&&(t.value=300),e("update:value",t.value),e("change",t.value))},document.onmouseup=()=>{l.style.background="#fafafa",a.style.background="#ccc",document.onmousemove=null,document.onmouseup=null},!1}};return{leftAsideWidth:t,leftResizeRef:n,leftResizeBarRef:h}}},F={ref:"leftResizeRef",class:"left-resize"},S={ref:"leftResizeBarRef"};function X(r,e,t,n,h,o){return j(),z("div",F,[R("i",S,"...",512)],512)}var Q=k(w,[["render",X],["__scopeId","data-v-33303c20"]]),Y="assets/api-logo.952f0c92.png";export{Q as L,Y as _,q as a,H as b,J as c,K as d,G as g};

View File

@@ -1 +1 @@
import{B as s}from"./vendor.627eef95.js";var g={log(o,e,l){console.log(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+e,l)},logMessage(o,e,l){console.log(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+e,l),s.error(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+e)}};export{g as l}; import{B as s}from"./vendor.160e93e4.js";var g={log(o,e,l){console.log(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+e,l)},logMessage(o,e,l){console.log(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+e,l),s.error(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+e)}};export{g as l};

View File

@@ -5,8 +5,8 @@
<link rel="icon" href="api-logo.png" /> <link rel="icon" href="api-logo.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>API文档管理</title> <title>API文档管理</title>
<script type="module" crossorigin src="assets/main.54fae6aa.js"></script> <script type="module" crossorigin src="assets/main.44472edc.js"></script>
<link rel="modulepreload" href="assets/vendor.627eef95.js"> <link rel="modulepreload" href="assets/vendor.160e93e4.js">
<link rel="stylesheet" href="assets/style.9e577f5e.css"> <link rel="stylesheet" href="assets/style.9e577f5e.css">
</head> </head>
<body> <body>

View File

@@ -30,12 +30,8 @@
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>commons-lang</groupId> <groupId>org.apache.commons</groupId>
<artifactId>commons-lang</artifactId> <artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>

View File

@@ -5,8 +5,6 @@ import com.alibaba.fastjson.annotation.JSONField;
import com.alibaba.fastjson.serializer.SerializeConfig; import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer; import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiModelProperty;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@@ -26,19 +24,12 @@ public class DocResponseJson<T> implements ResponseJson<T> {
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss")); mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
} }
@ApiModelProperty(value = "状态码")
private Integer errCode; private Integer errCode;
@ApiModelProperty(value = "返回值说明")
private String errMsg; private String errMsg;
@ApiModelProperty(value = "返回数据")
private Object data; private Object data;
@ApiModelProperty(value = "总数")
private Long total; private Long total;
@ApiModelProperty(value = "当前页数")
private Integer pageNum; private Integer pageNum;
@ApiModelProperty(value = "每页条数")
private Integer pageSize; private Integer pageSize;
@ApiModelProperty(value = "总页数")
private Integer totalPage; private Integer totalPage;
public DocResponseJson() { public DocResponseJson() {
@@ -122,14 +113,7 @@ public class DocResponseJson<T> implements ResponseJson<T> {
public void setData(Object data) { public void setData(Object data) {
if (null != data) { if (null != data) {
if (data instanceof PageInfo) { if (data instanceof IPage) {
PageInfo<?> pageInfo = (PageInfo<?>) data;
this.data = pageInfo.getList();
this.total = pageInfo.getTotal();
this.pageNum = pageInfo.getPageNum();
this.pageSize = pageInfo.getPageSize();
this.totalPage = pageInfo.getPages();
} else if (data instanceof IPage) {
IPage<?> iPage = (IPage<?>) data; IPage<?> iPage = (IPage<?>) data;
this.data = iPage.getRecords(); this.data = iPage.getRecords();
this.total = iPage.getTotal(); this.total = iPage.getTotal();

View File

@@ -30,6 +30,14 @@
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-generator</artifactId> <artifactId>mybatis-plus-generator</artifactId>
@@ -47,14 +55,14 @@
<groupId>net.sourceforge.jtds</groupId> <groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId> <artifactId>jtds</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
</dependency>
<dependency> <dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
</dependency> </dependency>
<!-- <dependency>-->
<!-- <groupId>com.oracle</groupId>-->
<!-- <artifactId>ojdbc6</artifactId>-->
<!-- </dependency>-->
<!-- 按需开启对hive的支持它依赖的包实在太多太大了--> <!-- 按需开启对hive的支持它依赖的包实在太多太大了-->
<!-- <dependency>--> <!-- <dependency>-->
<!-- <groupId>org.apache.hive</groupId>--> <!-- <groupId>org.apache.hive</groupId>-->
@@ -87,10 +95,6 @@
<!-- </exclusion>--> <!-- </exclusion>-->
<!-- </exclusions>--> <!-- </exclusions>-->
<!-- </dependency>--> <!-- </dependency>-->
<dependency>
<groupId>com.github.dozermapper</groupId>
<artifactId>dozer-core</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.zyplayer</groupId> <groupId>com.zyplayer</groupId>
<artifactId>zyplayer-doc-core</artifactId> <artifactId>zyplayer-doc-core</artifactId>

View File

@@ -3,7 +3,6 @@ package com.zyplayer.doc.data.config;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.github.pagehelper.PageInterceptor;
import com.zyplayer.doc.data.repository.support.interceptor.SqlLogInterceptor; import com.zyplayer.doc.data.repository.support.interceptor.SqlLogInterceptor;
import com.zyplayer.doc.data.utils.DruidDataSourceUtil; import com.zyplayer.doc.data.utils.DruidDataSourceUtil;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
@@ -29,10 +28,6 @@ public class MybatisPlusConfig {
* sql日志 * sql日志
**/ **/
private static final SqlLogInterceptor SQL_LOG_INTERCEPTOR = new SqlLogInterceptor(); private static final SqlLogInterceptor SQL_LOG_INTERCEPTOR = new SqlLogInterceptor();
/**
* MYSQL 分页
**/
private static final PageInterceptor MYSQL_PAGE_HELPER = new PageInterceptor();
/** /**
* 数据库配置 * 数据库配置
@@ -62,7 +57,7 @@ public class MybatisPlusConfig {
public MybatisSqlSessionFactoryBean manageSqlSessionFactory() throws Exception { public MybatisSqlSessionFactoryBean manageSqlSessionFactory() throws Exception {
MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean(); MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
sqlSessionFactoryBean.setDataSource(manageDatasource()); sqlSessionFactoryBean.setDataSource(manageDatasource());
sqlSessionFactoryBean.setPlugins(SQL_LOG_INTERCEPTOR, MYSQL_PAGE_HELPER, paginationInterceptor); sqlSessionFactoryBean.setPlugins(SQL_LOG_INTERCEPTOR, paginationInterceptor);
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mapper/manage/*Mapper.xml")); sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mapper/manage/*Mapper.xml"));

View File

@@ -19,9 +19,11 @@ public interface WikiPageMapper extends BaseMapper<WikiPage> {
@Update("update wiki_page set zan_num=zan_num + #{numAdd} where id=#{id}") @Update("update wiki_page set zan_num=zan_num + #{numAdd} where id=#{id}")
void updateZanNum(@Param("id") Long id, @Param("numAdd") Integer numAdd); void updateZanNum(@Param("id") Long id, @Param("numAdd") Integer numAdd);
@Update("update wiki_page set seq_no=seq_no + 1 where parent_id=#{parentId} and seq_no >= #{afterSeq} and del_flag=0") @Update("update wiki_page set seq_no=seq_no + 1 where space_id = #{spaceId} and parent_id=#{parentId} and seq_no >= #{afterSeq} and del_flag=0")
void updateAfterSeq(@Param("parentId") Long parentId, @Param("afterSeq") Integer afterSeq); void updateAfterSeq(@Param("spaceId") Long spaceId, @Param("parentId") Long parentId, @Param("afterSeq") Integer afterSeq);
@Select("select max(seq_no) from wiki_page where parent_id=#{parentId} and del_flag=0") @Select("select max(seq_no) from wiki_page where space_id = #{spaceId} and parent_id=#{parentId} and del_flag=0")
Integer getLastSeq(@Param("parentId") Long parentId); Integer getLastSeq(@Param("spaceId") Long spaceId, @Param("parentId") Long parentId);
void updateChildrenSeq(@Param("spaceId") Long spaceId, @Param("parentId") Long parentId);
} }

View File

@@ -1,5 +1,6 @@
package com.zyplayer.doc.data.service.common; package com.zyplayer.doc.data.service.common;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.zyplayer.doc.core.exception.ConfirmException; import com.zyplayer.doc.core.exception.ConfirmException;
import com.zyplayer.doc.data.config.security.DocUserDetails; import com.zyplayer.doc.data.config.security.DocUserDetails;
import com.zyplayer.doc.data.config.security.DocUserUtil; import com.zyplayer.doc.data.config.security.DocUserUtil;
@@ -12,7 +13,6 @@ import com.zyplayer.doc.data.repository.support.consts.DocSysType;
import com.zyplayer.doc.data.service.manage.ApiDocService; import com.zyplayer.doc.data.service.manage.ApiDocService;
import com.zyplayer.doc.data.service.manage.AuthInfoService; import com.zyplayer.doc.data.service.manage.AuthInfoService;
import com.zyplayer.doc.data.service.manage.UserAuthService; import com.zyplayer.doc.data.service.manage.UserAuthService;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;

View File

@@ -1,246 +0,0 @@
package com.zyplayer.doc.data.service.elasticsearch.entity;
import com.zyplayer.doc.data.service.elasticsearch.support.Document;
import java.util.Date;
/**
* wiki文档搜索
*
* @author 暮光:城中城
* @since 2019-07-07
*/
@Document(indexName = "zyplayer_doc_wiki", indexType = "_doc")
public class EsWikiPage {
private Long id;
/**
* 空间ID
*/
private Long spaceId;
/**
* 名字
*/
private String name;
/**
* 父ID
*/
private Long parentId;
/**
* 节点类型 0=有子节点 1=终节点
*/
private Integer nodeType;
/**
* 赞的数量
*/
private Integer zanNum;
/**
* 编辑类型 0=可编辑 1=不允许编辑
*/
private Integer editType;
/**
* 创建人ID
*/
private Long createUserId;
/**
* 创建人名字
*/
private String createUserName;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改人ID
*/
private Long updateUserId;
/**
* 修改人名字
*/
private String updateUserName;
/**
* 修改时间
*/
private Date updateTime;
/**
* 0=有效 1=删除
*/
private Integer delFlag;
/**
* 阅读数
*/
private Integer viewNum;
/**
* 顺序
*/
private Integer seqNo;
/**
* 内容
*/
private String content;
/**
* 预览内容
*/
private String preview;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getSpaceId() {
return spaceId;
}
public void setSpaceId(Long spaceId) {
this.spaceId = spaceId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Long getParentId() {
return parentId;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Integer getNodeType() {
return nodeType;
}
public void setNodeType(Integer nodeType) {
this.nodeType = nodeType;
}
public Integer getZanNum() {
return zanNum;
}
public void setZanNum(Integer zanNum) {
this.zanNum = zanNum;
}
public Integer getEditType() {
return editType;
}
public void setEditType(Integer editType) {
this.editType = editType;
}
public Long getCreateUserId() {
return createUserId;
}
public void setCreateUserId(Long createUserId) {
this.createUserId = createUserId;
}
public String getCreateUserName() {
return createUserName;
}
public void setCreateUserName(String createUserName) {
this.createUserName = createUserName;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(Long updateUserId) {
this.updateUserId = updateUserId;
}
public String getUpdateUserName() {
return updateUserName;
}
public void setUpdateUserName(String updateUserName) {
this.updateUserName = updateUserName;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Integer getDelFlag() {
return delFlag;
}
public void setDelFlag(Integer delFlag) {
this.delFlag = delFlag;
}
public Integer getViewNum() {
return viewNum;
}
public void setViewNum(Integer viewNum) {
this.viewNum = viewNum;
}
public Integer getSeqNo() {
return seqNo;
}
public void setSeqNo(Integer seqNo) {
this.seqNo = seqNo;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getPreview() {
return preview;
}
public void setPreview(String preview) {
this.preview = preview;
}
}

View File

@@ -1,25 +0,0 @@
//package com.zyplayer.doc.data.service.elasticsearch.service;
//
//import com.zyplayer.doc.data.service.elasticsearch.entity.EsWikiPage;
//import com.zyplayer.doc.data.service.elasticsearch.support.EsAbstractService;
//import org.springframework.stereotype.Service;
//
///**
// * wiki文档搜索
// *
// * @author 暮光:城中城
// * @since 2019-07-07
// */
//@Service
//public class EsWikiPageService extends EsAbstractService<EsWikiPage> {
//
// @Override
// public Class<EsWikiPage> getObjClass() {
// return EsWikiPage.class;
// }
//
// @Override
// public String getPrimaryKey(EsWikiPage tableIndex) {
// return String.valueOf(tableIndex.getId());
// }
//}

View File

@@ -1,17 +0,0 @@
package com.zyplayer.doc.data.service.elasticsearch.support;
import java.lang.annotation.*;
/**
* es文档定义
* @author 暮光:城中城
* @since 2019-07-07
*/
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE})
public @interface Document {
String indexName();
String indexType();
}

View File

@@ -1,73 +0,0 @@
//package com.zyplayer.doc.data.service.elasticsearch.support;
//
//import org.apache.http.HttpHost;
//import org.elasticsearch.client.RestClient;
//import org.elasticsearch.client.RestHighLevelClient;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//
//import java.util.LinkedList;
//import java.util.List;
//import java.util.Map;
//import java.util.Objects;
//import java.util.concurrent.ConcurrentHashMap;
//
///**
// * 开启es客户端
// *
// * @author 暮光:城中城
// * @since 2019-07-07
// */
//@Configuration
//public class ElasticSearchUtil {
// private static Logger logger = LoggerFactory.getLogger(ElasticSearchUtil.class);
//
// @Value(value = "${zyplayer.doc.manage.elasticsearch.hostPort:}")
// private String hostAndPort;
// @Value(value = "${zyplayer.doc.manage.elasticsearch.scheme:}")
// private String esScheme;
// @Value("${zyplayer.doc.manage.elasticsearch.open:}")
// private String elasticsearchOpen;
//
// private static final Object createLock = new Object();
// private static Map<String, RestHighLevelClient> restClientMap = new ConcurrentHashMap<>();
//
// public boolean isOpen() {
// return Objects.equals("true", elasticsearchOpen);
// }
//
// public RestHighLevelClient getEsClient() {
// if (!this.isOpen()) {
// return null;
// }
// return this.getEsClient(hostAndPort, esScheme);
// }
//
// public RestHighLevelClient getEsClient(String hostPort, String scheme) {
// String mapKey = scheme + "_" + hostPort;
// RestHighLevelClient restClient = restClientMap.get(mapKey);
// if (restClient == null) {
// synchronized (createLock) {
// restClient = restClientMap.get(mapKey);
// if (restClient == null) {
// try {
// // rest请求客户端
// // 例10.16.32.12:9200,10.16.32.12:9201
// List<HttpHost> hostPortList = new LinkedList<>();
// for (String hostPortStr : hostPort.split(",")) {
// String[] splitArr = hostPortStr.split(":");
// hostPortList.add(new HttpHost(splitArr[0], Integer.valueOf(splitArr[1]), scheme));
// }
// restClient = new RestHighLevelClient(RestClient.builder(hostPortList.toArray(new HttpHost[]{})));
// restClientMap.put(mapKey, restClient);
// } catch (Exception e) {
// logger.error("创建es客户端失败", e);
// }
// }
// }
// }
// return restClient;
// }
//}

View File

@@ -1,217 +0,0 @@
//package com.zyplayer.doc.data.service.elasticsearch.support;
//
//import com.alibaba.fastjson.JSON;
//import org.apache.commons.collections.CollectionUtils;
//import org.apache.commons.lang3.StringUtils;
//import org.dozer.Mapper;
//import org.elasticsearch.action.DocWriteResponse;
//import org.elasticsearch.action.delete.DeleteRequest;
//import org.elasticsearch.action.delete.DeleteResponse;
//import org.elasticsearch.action.search.SearchRequest;
//import org.elasticsearch.action.search.SearchResponse;
//import org.elasticsearch.action.update.UpdateRequest;
//import org.elasticsearch.action.update.UpdateResponse;
//import org.elasticsearch.client.RequestOptions;
//import org.elasticsearch.client.RestHighLevelClient;
//import org.elasticsearch.common.text.Text;
//import org.elasticsearch.common.unit.TimeValue;
//import org.elasticsearch.common.xcontent.XContentType;
//import org.elasticsearch.index.query.BoolQueryBuilder;
//import org.elasticsearch.index.query.QueryBuilder;
//import org.elasticsearch.index.query.QueryBuilders;
//import org.elasticsearch.rest.RestStatus;
//import org.elasticsearch.search.SearchHit;
//import org.elasticsearch.search.builder.SearchSourceBuilder;
//import org.elasticsearch.search.fetch.subphase.highlight.HighlightBuilder;
//import org.elasticsearch.search.fetch.subphase.highlight.HighlightField;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//
//import javax.annotation.Resource;
//import java.io.IOException;
//import java.util.HashMap;
//import java.util.LinkedList;
//import java.util.List;
//import java.util.Map;
//import java.util.concurrent.TimeUnit;
//
///**
// * es抽象类
// *
// * @author 暮光:城中城
// * @since 2019-07-07
// */
//public abstract class EsAbstractService<T> {
// private static final Logger logger = LoggerFactory.getLogger(EsAbstractService.class);
//
// @Resource
// private ElasticSearchUtil elasticSearchUtil;
// @Resource
// private Mapper mapper;
//
// public abstract Class<T> getObjClass();
//
// public abstract String getPrimaryKey(T table);
//
// private String getIndexName() {
// Document annotation = this.getObjClass().getAnnotation(Document.class);
// return annotation.indexName();
// }
//
// private String getIndexType() {
// Document annotation = this.getObjClass().getAnnotation(Document.class);
// return annotation.indexType();
// }
//
// public boolean isOpen() {
// return elasticSearchUtil.isOpen();
// }
//
// public boolean upsert(T table) {
// String pk = getPrimaryKey(table);
// UpdateRequest request = new UpdateRequest(this.getIndexName(), pk);
// request.timeout(TimeValue.timeValueMinutes(2));
// request.doc(JSON.toJSONString(table), XContentType.JSON);
// request.docAsUpsert(true);
// RestHighLevelClient esClient = elasticSearchUtil.getEsClient();
// try {
// UpdateResponse updateResponse = esClient.update(request, RequestOptions.DEFAULT);
// return updateResponse.status() == RestStatus.OK;
// } catch (IOException e) {
// e.printStackTrace();
// }
// return false;
// }
//
// public void delete(T table) {
// String pk = getPrimaryKey(table);
// RestHighLevelClient esClient = elasticSearchUtil.getEsClient();
// DeleteRequest request = new DeleteRequest(this.getIndexName(), pk);
// request.timeout(TimeValue.timeValueMinutes(2));
// try {
// DeleteResponse deleteResponse = esClient.delete(request, RequestOptions.DEFAULT);
// if (deleteResponse.getResult() == DocWriteResponse.Result.NOT_FOUND) {
// logger.warn("ElasticSearch delete index id: {} but not found!", pk);
// } else {
// logger.warn("ElasticSearch delete index id: {}", pk);
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// }
//
// /**
// * 多条件 模糊查询查询前100条
// *
// * @param condition 查询条件
// */
// public List<T> getDataByCondition(List<EsQueryColumn> condition) {
// return getDataByCondition(condition, null, 0, 100).getData();
// }
//
// /**
// * 多条件 模糊查询
// *
// * @param condition 查询条件
// * @param startIndex 开始行
// * @param pageSize 每页数量
// */
// public EsPage<T> getDataByCondition(List<EsQueryColumn> condition, String[] fields, Integer startIndex, Integer pageSize) {
// BoolQueryBuilder boolQueryBuilder = QueryBuilders.boolQuery();
// // 组装条件
// for (EsQueryColumn column : condition) {
// if (StringUtils.isBlank(column.getValue())) {
// if (CollectionUtils.isEmpty(column.getValues())) {
// continue;
// }
// for (Object value : column.getValues()) {
// if (column.getType() == 0) {
// boolQueryBuilder.must(QueryBuilders.wildcardQuery(column.getKey(), value.toString()));
// } else if (column.getType() == 1) {
// boolQueryBuilder.must(QueryBuilders.termQuery(column.getKey(), value));
// }
// }
// } else {
// if (column.getType() == 0) {
// boolQueryBuilder.must(QueryBuilders.wildcardQuery(column.getKey(), column.getValue()));
// } else if (column.getType() == 1) {
// boolQueryBuilder.must(QueryBuilders.termQuery(column.getKey(), column.getValue()));
// }
// }
// }
// condition.forEach(val -> {
// if (StringUtils.isNotBlank(val.getValue())) {
// if (val.getType() == 0) {
// boolQueryBuilder.must(QueryBuilders.wildcardQuery(val.getKey(), val.getValue()));
// } else if (val.getType() == 1) {
// boolQueryBuilder.must(QueryBuilders.termQuery(val.getKey(), val.getValue()));
// }
// }
// });
// return this.getDataByQuery(boolQueryBuilder, fields, startIndex, pageSize);
// }
//
// /**
// * 多条件 模糊查询
// *
// * @param queryBuilders 查询条件
// * @param startIndex 开始行
// * @param pageSize 每页数量
// */
// public EsPage<T> getDataByQuery(QueryBuilder queryBuilders, String[] fields, Integer startIndex, Integer pageSize) {
// // 设置高亮标签
// HighlightBuilder highlightBuilder = new HighlightBuilder();
// highlightBuilder.preTags("<span style=\"color:red\">");
// highlightBuilder.postTags("</span>");
// highlightBuilder.field("*");
// // 组装条件
// SearchSourceBuilder sourceBuilder = new SearchSourceBuilder();
// sourceBuilder.query(queryBuilders)
// .highlighter(highlightBuilder).from(startIndex).size(pageSize)
// .timeout(new TimeValue(60, TimeUnit.SECONDS));
// // 查询指定字段
// if (fields != null && fields.length > 0) {
// sourceBuilder.fetchSource(fields, new String[]{});
// }
// // 组装请求
// SearchRequest searchRequest = new SearchRequest();
// searchRequest.indices(this.getIndexName());
// searchRequest.source(sourceBuilder);
// RestHighLevelClient esClient = elasticSearchUtil.getEsClient();
// try {
// SearchResponse response = esClient.search(searchRequest, RequestOptions.DEFAULT);
// return responseToList(response);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return null;
// }
//
// public EsPage<T> responseToList(SearchResponse response) {
// List<T> tableList = new LinkedList<>();
// for (SearchHit searchHit : response.getHits().getHits()) {
// // 获取表ID和表类型
// Map<String, Object> sourceMap = searchHit.getSourceAsMap();
// if (sourceMap == null) {
// sourceMap = new HashMap<>();
// }
// // 获取高亮文本
// Map<String, HighlightField> highlightFieldMap = searchHit.getHighlightFields();
// for (String key : highlightFieldMap.keySet()) {
// HighlightField hf = highlightFieldMap.get(key);
// StringBuilder fragments = new StringBuilder();
// for (Text text : hf.getFragments()) {
// fragments.append(text.toString());
// }
// sourceMap.put(key, fragments.toString());
// }
// T table = mapper.map(sourceMap, this.getObjClass());
// tableList.add(table);
// }
// EsPage<T> esPage = new EsPage<>();
// esPage.setTotal(response.getHits().getTotalHits().value);
// esPage.setData(tableList);
// return esPage;
// }
//
//}

View File

@@ -1,29 +0,0 @@
package com.zyplayer.doc.data.service.elasticsearch.support;
import java.util.List;
/**
* es分页结果
* @author 暮光:城中城
* @since 2019-07-07
*/
public class EsPage<T> {
private Long total;
private List<T> data;
public Long getTotal() {
return total;
}
public void setTotal(Long total) {
this.total = total;
}
public List<T> getData() {
return data;
}
public void setData(List<T> data) {
this.data = data;
}
}

View File

@@ -1,76 +0,0 @@
package com.zyplayer.doc.data.service.elasticsearch.support;
import java.util.List;
/**
* es查询字段封装
* @author 暮光:城中城
* @since 2019-07-07
*/
public class EsQueryColumn {
private String key;
private String value;
private List<Object> values;
// 类型0=分词搜索 1=不分词
private int type;
public EsQueryColumn(String key, String value) {
this(key, value, 0);
}
public EsQueryColumn(String key, String value, int type) {
this.key = key;
this.value = value;
this.type = type;
}
public EsQueryColumn(String key, List<Object> values, int type) {
this.key = key;
this.values = values;
this.type = type;
}
public static EsQueryColumn like(String key, String value){
return new EsQueryColumn(key, value, 0);
}
public static EsQueryColumn must(String key, String value){
return new EsQueryColumn(key, value, 1);
}
public static EsQueryColumn in(String key, List<Object> values){
return new EsQueryColumn(key, values, 1);
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public List<Object> getValues() {
return values;
}
public void setValues(List<Object> values) {
this.values = values;
}
}

View File

@@ -9,7 +9,7 @@ import com.zyplayer.doc.data.repository.manage.entity.DbTableRelation;
import com.zyplayer.doc.data.repository.manage.mapper.DbTableRelationMapper; import com.zyplayer.doc.data.repository.manage.mapper.DbTableRelationMapper;
import com.zyplayer.doc.data.repository.manage.param.TableRelationParam; import com.zyplayer.doc.data.repository.manage.param.TableRelationParam;
import com.zyplayer.doc.data.service.manage.DbTableRelationService; import com.zyplayer.doc.data.service.manage.DbTableRelationService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;

View File

@@ -27,8 +27,8 @@ import com.zyplayer.doc.db.framework.json.DocDbResponseJson;
import com.zyplayer.doc.db.framework.utils.PoiUtil; import com.zyplayer.doc.db.framework.utils.PoiUtil;
import com.zyplayer.doc.db.service.database.DatabaseServiceFactory; import com.zyplayer.doc.db.service.database.DatabaseServiceFactory;
import com.zyplayer.doc.db.service.database.DbBaseService; import com.zyplayer.doc.db.service.database.DbBaseService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;

View File

@@ -21,8 +21,8 @@ import com.zyplayer.doc.db.service.database.DatabaseServiceFactory;
import com.zyplayer.doc.db.service.database.DbBaseService; import com.zyplayer.doc.db.service.database.DbBaseService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils; import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
@@ -170,7 +170,7 @@ public class DbDataViewController {
return sqlExecutor.execute(executeParam); return sqlExecutor.execute(executeParam);
} catch (Exception e) { } catch (Exception e) {
logger.error("执行出错", e); logger.error("执行出错", e);
return ExecuteResult.error(ExceptionUtils.getFullStackTrace(e), executeSql); return ExecuteResult.error(ExceptionUtils.getStackTrace(e), executeSql);
} }
} }
} }

View File

@@ -15,9 +15,9 @@ import com.zyplayer.doc.db.framework.configuration.DatasourceUtil;
import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean; import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean;
import com.zyplayer.doc.db.framework.db.bean.DatabaseRegistrationBean; import com.zyplayer.doc.db.framework.db.bean.DatabaseRegistrationBean;
import com.zyplayer.doc.db.framework.json.DocDbResponseJson; import com.zyplayer.doc.db.framework.json.DocDbResponseJson;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@@ -88,7 +88,7 @@ public class DbDatasourceController {
return DocDbResponseJson.warn(e.getMessage()); return DocDbResponseJson.warn(e.getMessage());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
return DocDbResponseJson.warn(ExceptionUtils.getFullStackTrace(e)); return DocDbResponseJson.warn(ExceptionUtils.getStackTrace(e));
} }
return DocDbResponseJson.ok(); return DocDbResponseJson.ok();
} }

View File

@@ -20,7 +20,7 @@ import com.zyplayer.doc.db.framework.db.mapper.base.ExecuteResult;
import com.zyplayer.doc.db.framework.json.DocDbResponseJson; import com.zyplayer.doc.db.framework.json.DocDbResponseJson;
import com.zyplayer.doc.db.service.database.DatabaseServiceFactory; import com.zyplayer.doc.db.service.database.DatabaseServiceFactory;
import com.zyplayer.doc.db.service.database.DbBaseService; import com.zyplayer.doc.db.service.database.DbBaseService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

View File

@@ -25,7 +25,7 @@ import com.zyplayer.doc.db.framework.utils.JSONUtil;
import com.zyplayer.doc.db.framework.utils.SqlLogUtil; import com.zyplayer.doc.db.framework.utils.SqlLogUtil;
import com.zyplayer.doc.db.service.database.DatabaseServiceFactory; import com.zyplayer.doc.db.service.database.DatabaseServiceFactory;
import com.zyplayer.doc.db.service.database.DbBaseService; import com.zyplayer.doc.db.service.database.DbBaseService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;

View File

@@ -16,7 +16,7 @@ import com.zyplayer.doc.db.service.common.ExecuteAuthService;
import com.zyplayer.doc.db.service.database.DatabaseServiceFactory; import com.zyplayer.doc.db.service.database.DatabaseServiceFactory;
import com.zyplayer.doc.db.service.database.DbBaseService; import com.zyplayer.doc.db.service.database.DbBaseService;
import com.zyplayer.doc.db.service.download.BaseDownloadService; import com.zyplayer.doc.db.service.download.BaseDownloadService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;

View File

@@ -20,7 +20,7 @@ import com.zyplayer.doc.db.service.database.DatabaseServiceFactory;
import com.zyplayer.doc.db.service.database.DbBaseService; import com.zyplayer.doc.db.service.database.DbBaseService;
import com.zyplayer.doc.db.service.download.BaseDownloadService; import com.zyplayer.doc.db.service.download.BaseDownloadService;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;

View File

@@ -4,7 +4,7 @@ import com.alibaba.druid.pool.DruidPooledConnection;
import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean; import com.zyplayer.doc.db.framework.db.bean.DatabaseFactoryBean;
import com.zyplayer.doc.db.framework.db.bean.DatabaseRegistrationBean; import com.zyplayer.doc.db.framework.db.bean.DatabaseRegistrationBean;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.mapping.ParameterMapping; import org.apache.ibatis.mapping.ParameterMapping;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@@ -12,7 +12,7 @@ import net.sf.jsqlparser.schema.Column;
import net.sf.jsqlparser.statement.Statement; import net.sf.jsqlparser.statement.Statement;
import net.sf.jsqlparser.statement.insert.Insert; import net.sf.jsqlparser.statement.insert.Insert;
import net.sf.jsqlparser.statement.select.*; import net.sf.jsqlparser.statement.select.*;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.builder.SqlSourceBuilder; import org.apache.ibatis.builder.SqlSourceBuilder;
import org.apache.ibatis.builder.StaticSqlSource; import org.apache.ibatis.builder.StaticSqlSource;
import org.apache.ibatis.mapping.BoundSql; import org.apache.ibatis.mapping.BoundSql;

View File

@@ -20,8 +20,8 @@ import com.zyplayer.doc.db.framework.db.mapper.base.ExecuteResult;
import com.zyplayer.doc.db.framework.db.mapper.base.ExecuteType; import com.zyplayer.doc.db.framework.db.mapper.base.ExecuteType;
import com.zyplayer.doc.db.framework.db.mapper.base.SqlExecutor; import com.zyplayer.doc.db.framework.db.mapper.base.SqlExecutor;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.commons.lang3.exception.ExceptionUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -174,7 +174,7 @@ public class TransferDataServer {
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("SQL执行出错", e); logger.error("SQL执行出错", e);
String executeInfo = String.format("[%s] 处理出错:%s", DateTime.now().toString(), ExceptionUtils.getFullStackTrace(e)); String executeInfo = String.format("[%s] 处理出错:%s", DateTime.now().toString(), ExceptionUtils.getStackTrace(e));
dbTransferTaskService.addExecuteInfo(transferTask.getId(), TransferTaskStatus.ERROR.getCode(), executeInfo); dbTransferTaskService.addExecuteInfo(transferTask.getId(), TransferTaskStatus.ERROR.getCode(), executeInfo);
} }
} }

View File

@@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig; import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer; import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.pagehelper.PageInfo;
import com.zyplayer.doc.core.json.ResponseJson; import com.zyplayer.doc.core.json.ResponseJson;
import io.swagger.annotations.ApiModelProperty;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
@@ -23,13 +21,9 @@ public class DocDbResponseJson implements ResponseJson {
static { static {
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss")); mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
} }
@ApiModelProperty(value = "状态码")
private Integer errCode; private Integer errCode;
@ApiModelProperty(value = "返回值说明")
private String errMsg; private String errMsg;
@ApiModelProperty(value = "返回数据")
private Object data; private Object data;
@ApiModelProperty(value = "总数")
private Long total; private Long total;
public DocDbResponseJson() { public DocDbResponseJson() {
@@ -81,11 +75,7 @@ public class DocDbResponseJson implements ResponseJson {
public void setData(Object data) { public void setData(Object data) {
if (null != data) { if (null != data) {
if (data instanceof PageInfo) { if (data instanceof IPage) {
PageInfo<?> pageInfo = (PageInfo<?>) data;
this.data = pageInfo.getList();
this.total = pageInfo.getTotal();
} else if (data instanceof IPage) {
IPage<?> iPage = (IPage<?>) data; IPage<?> iPage = (IPage<?>) data;
this.data = iPage.getRecords(); this.data = iPage.getRecords();
this.total = iPage.getTotal(); this.total = iPage.getTotal();

View File

@@ -10,7 +10,7 @@ import com.zyplayer.doc.core.util.ZyplayerDocVersion;
import com.zyplayer.doc.db.controller.vo.DatabaseExportVo; import com.zyplayer.doc.db.controller.vo.DatabaseExportVo;
import com.zyplayer.doc.db.controller.vo.TableColumnVo; import com.zyplayer.doc.db.controller.vo.TableColumnVo;
import com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto; import com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.xwpf.usermodel.*; import org.apache.poi.xwpf.usermodel.*;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTblWidth;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth; import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTblWidth;

View File

@@ -24,7 +24,7 @@ import com.zyplayer.doc.db.framework.db.mapper.base.ExecuteResult;
import com.zyplayer.doc.db.framework.db.mapper.base.SqlExecutor; import com.zyplayer.doc.db.framework.db.mapper.base.SqlExecutor;
import com.zyplayer.doc.db.service.download.BaseDownloadService; import com.zyplayer.doc.db.service.download.BaseDownloadService;
import com.zyplayer.doc.db.service.download.DownloadService; import com.zyplayer.doc.db.service.download.DownloadService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

View File

@@ -12,7 +12,7 @@ import com.zyplayer.doc.db.framework.db.mapper.base.ExecuteResult;
import com.zyplayer.doc.db.framework.db.mapper.base.ExecuteType; import com.zyplayer.doc.db.framework.db.mapper.base.ExecuteType;
import com.zyplayer.doc.db.framework.db.mapper.mysql.MysqlMapper; import com.zyplayer.doc.db.framework.db.mapper.mysql.MysqlMapper;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List; import java.util.List;

View File

@@ -6,7 +6,7 @@ import com.zyplayer.doc.db.framework.db.dto.TableColumnDescDto;
import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum; import com.zyplayer.doc.db.framework.db.enums.DatabaseProductEnum;
import com.zyplayer.doc.db.framework.db.mapper.sqlserver.SqlServerMapper; import com.zyplayer.doc.db.framework.db.mapper.sqlserver.SqlServerMapper;
import com.zyplayer.doc.db.service.download.SqlserverDownloadService; import com.zyplayer.doc.db.service.download.SqlserverDownloadService;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;

View File

@@ -1 +1 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon-db.png><title>数据库文档管理</title><link href=css/chunk-vendors.8924efc6.css rel=preload as=style><link href=css/index.2a7107f3.css rel=preload as=style><link href=js/chunk-vendors.d7df6d0f.js rel=preload as=script><link href=js/index.8f03b771.js rel=preload as=script><link href=css/chunk-vendors.8924efc6.css rel=stylesheet><link href=css/index.2a7107f3.css rel=stylesheet></head><body><noscript><strong>We're sorry but zyplayer-db-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.d7df6d0f.js></script><script src=js/index.8f03b771.js></script></body></html> <!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon-db.png><title>数据库文档管理</title><link href=css/chunk-vendors.8924efc6.css rel=preload as=style><link href=css/index.ba19e721.css rel=preload as=style><link href=js/chunk-vendors.ecfb4a1c.js rel=preload as=script><link href=js/index.b96a3f18.js rel=preload as=script><link href=css/chunk-vendors.8924efc6.css rel=stylesheet><link href=css/index.ba19e721.css rel=stylesheet></head><body><noscript><strong>We're sorry but zyplayer-db-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.ecfb4a1c.js></script><script src=js/index.b96a3f18.js></script></body></html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,30 +0,0 @@
# zyplayer-doc-dubbo
#### 项目介绍
dubbo文档的管理项目支持文档自动扫描文档展示和修改支持参数自动扫描获取接口在线调试
#### 软件架构
后端使用spring boot前端使用vue、element-ui、JQuery等
#### 安装教程
1. `zyplayer-doc-manage` -> `application.yml` -> `zyplayer.dubbo.zookeeper.url` 配置zookeeper地址
2. `zyplayer-doc-manage` -> `application.yml` -> `zyplayer.dubbo.nacos.url` 配置nacos服务地址
3. 默认找zookeeper未配置再找nacos的配置访问地址http://127.0.0.1:8082/zyplayer-doc-manage/doc-dubbo.html
4. 支持文档查找、文档编辑、在线调试接口
5. 自动获取参数列表需要指定的类存在,所以请在 pom.xml -> dependencies 最后加上服务所在的包后端才能通过Class.forName("xx");来找到参数列表,减少录入成本
6. 数组或List参数调试参数录入格式例[1,2] 后端通过JSON工具转成指定类型有不支持的类型时欢迎反馈
#### 文档JAR上传说明
为了达到获取服务的类的方法信息尝试过很多方式:
1. 比如在dubbo文档项目内这样每次依赖的jar升级都需要重新发版
2. 比如自动下载远程仓库或读取本地仓库的jar来获取类但这样如果jar包里依赖了另外的jar则不可行了需要解析整个maven依赖树复杂度高
3. 当前找到的最合适的方式就是一个模块依赖所有需要的jar然后打包后传上去这样所有的依赖都在此包里了也不需要重新发版
> 如果你有更好的建议欢迎提出来探讨,非常乐意接受更加方便的建议!
所以您需要做的是:
1. 将所有dubbo接口依赖放到 zyplayer-doc/zyplayer-doc-other/zyplayer-doc-dubbo-libs/pom.xml 的\<dependencies>中
2. 打包此模块mvn package
3. 将文件 ./zyplayer-doc-dubbo-libs/target/zyplayer-doc-dubbo-libs-x.x.x.jar 在您的dubbo文档页面上传
> 这样每次点击方法时将读取此JAR找到类和方法信息来展示

View File

@@ -1,102 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>zyplayer-doc-dubbo</artifactId>
<packaging>jar</packaging>
<name>zyplayer-doc-dubbo</name>
<description>dubbo文档工具</description>
<url>https://gitee.com/zyplayer/zyplayer-doc/zyplayer-doc-dubbo</url>
<developers>
<developer>
<id>zyplayer</id>
<name>暮光:城中城</name>
<email>806783409@qq.com</email>
<roles>
<role>Java Development Engineer</role>
</roles>
<timezone>2018-05-22 16:06:06</timezone>
</developer>
</developers>
<parent>
<groupId>com.zyplayer</groupId>
<artifactId>zyplayer-doc</artifactId>
<version>1.1.1</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>com.zyplayer</groupId>
<artifactId>zyplayer-doc-core</artifactId>
</dependency>
<dependency>
<groupId>com.zyplayer</groupId>
<artifactId>zyplayer-doc-annotation</artifactId>
</dependency>
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-recipes</artifactId>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
</dependency>
<!-- 业务包 -->
</dependencies>
<licenses>
<license>
<name>The Apache Software License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<scm>
<connection>scm:git@git.oschina.net:zyplayer/zyplayer-doc.git</connection>
<developerConnection>scm:git@git.oschina.net:zyplayer/zyplayer-doc.git</developerConnection>
<url>git@git.oschina.net:zyplayer/zyplayer-doc.git</url>
</scm>
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>snapshots</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<resources>
<resource>
<directory>src/main/resources/dist</directory>
<targetPath>META-INF/resources/</targetPath>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/webapp</directory>
<includes>
<include>**/*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project>

View File

@@ -1,307 +0,0 @@
package com.zyplayer.doc.dubbo.controller;
import com.alibaba.fastjson.JSON;
import com.zyplayer.doc.core.annotation.AuthMan;
import com.zyplayer.doc.core.json.DocResponseJson;
import com.zyplayer.doc.dubbo.controller.param.DubboRequestParam;
import com.zyplayer.doc.dubbo.controller.vo.DubboInfoVo;
import com.zyplayer.doc.dubbo.framework.bean.DubboDocInfo;
import com.zyplayer.doc.dubbo.framework.bean.DubboInfo;
import com.zyplayer.doc.dubbo.framework.bean.ReferenceConfigHolder;
import com.zyplayer.doc.dubbo.framework.constant.DubboDocConst;
import com.zyplayer.doc.dubbo.framework.constant.StorageKeys;
import com.zyplayer.doc.dubbo.framework.service.ClassLoadService;
import com.zyplayer.doc.dubbo.framework.service.MgDubboStorageService;
import com.zyplayer.doc.dubbo.framework.service.NacosDocService;
import com.zyplayer.doc.dubbo.framework.service.ZookeeperDocService;
import org.apache.commons.lang.StringUtils;
import org.apache.dubbo.common.utils.CollectionUtils;
import org.apache.dubbo.rpc.service.GenericService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* 文档控制器
*
* @author 暮光:城中城
* @since 2019年2月10日
*/
@AuthMan
@RestController
@RequestMapping("/zyplayer-doc-dubbo/doc-dubbo")
public class DubboController {
private static Logger logger = LoggerFactory.getLogger(DubboController.class);
@Value("${zyplayer.doc.dubbo.doc-lib-path}")
private String zyplayerDocDubboLibPath;
@Resource
private MgDubboStorageService mgDubboStorageService;
@Resource
private ZookeeperDocService zookeeperDocService;
@Resource
private NacosDocService nacosDocService;
@Resource
ClassLoadService classLoadService;
/**
* 重新获取所有的服务列表
*
* @author 暮光:城中城
* @since 2019年2月10日
**/
@PostMapping(value = "/reloadService")
public DocResponseJson loadService() {
List<DubboInfo> providerList;
try {
if (!zookeeperDocService.isEnable()) {
if (!nacosDocService.isEnable()) {
return DocResponseJson.warn("zyplayer.doc.dubbo.zookeeper.url、zyplayer.doc.dubbo.nacos.url 参数均未配置");
}
logger.info("zookeeper参数未配置使用nacos配置");
providerList = nacosDocService.getDubboInfoByNacos();
} else {
providerList = zookeeperDocService.getDubboInfoByZookeeper();
}
mgDubboStorageService.put(StorageKeys.DUBBO_SERVICE_LIST, JSON.toJSONString(providerList));
} catch (Exception e) {
e.printStackTrace();
return DocResponseJson.warn("获取服务列表失败:" + e.getMessage());
}
return DocResponseJson.ok();
}
/**
* 请求执行服务
*
* @author 暮光:城中城
* @since 2019年2月10日
**/
@PostMapping(value = "/request")
public DocResponseJson request(DubboRequestParam param) {
DubboInfo.DubboNodeInfo dubboNodeInfo = new DubboInfo.DubboNodeInfo();
dubboNodeInfo.setIp(param.getIp());
dubboNodeInfo.setPort(param.getPort());
dubboNodeInfo.setInterfaceX(param.getService());
dubboNodeInfo.setVersion(param.getVersion());
dubboNodeInfo.setGroup(param.getGroup());
String paramTypeStr = Optional.ofNullable(param.getParamTypes()).orElse("");
String paramsStr = Optional.ofNullable(param.getParams()).orElse("");
List<String> typeList = JSON.parseArray(paramTypeStr, String.class);
List<String> paramList = JSON.parseArray(paramsStr, String.class);
List<String> queryTypeList = new LinkedList<>();
List<Object> queryParamList = new LinkedList<>();
for (int i = 0; i < paramList.size(); i++) {
String typeStr = typeList.get(i);
String paramStr = paramList.get(i);
try {
if (typeStr.endsWith("[]")) {
String type = typeStr.substring(0, typeStr.length() - 2);
Class<?> aClass = classLoadService.loadClass(type);
List<?> objects = JSON.parseArray(paramStr, aClass);
queryTypeList.add(typeStr);
queryParamList.add(objects);
} else if (typeStr.matches("java\\.util\\.List<.+>")) {
Pattern pattern = Pattern.compile("java\\.util\\.List<(.+)>");
Matcher matcher = pattern.matcher(typeStr);
if (matcher.find()) {
String group = matcher.group(1);
Class<?> aClass = classLoadService.loadClass(group);
List<?> objects = JSON.parseArray(paramStr, aClass);
queryParamList.add(objects);
queryTypeList.add("java.util.List");
}
} else {
Class<?> aClass = classLoadService.loadClass(typeStr);
Object object = JSON.parseObject(paramStr, aClass);
queryParamList.add(object);
queryTypeList.add(typeStr);
}
} catch (Exception e) {
// 未找到对应类型,请手动引入项目包
logger.warn("未找到对应类型,请手动引入项目包:{}", typeStr);
queryParamList.add(paramStr);
queryTypeList.add(typeStr);
}
}
try {
GenericService bean = ReferenceConfigHolder.getBean(dubboNodeInfo);
if (bean == null) {
return DocResponseJson.warn("操作失败获取dubbo服务失败");
}
Object result = bean.$invoke(param.getMethod(), queryTypeList.toArray(new String[]{}), queryParamList.toArray());
return DocResponseJson.ok(result);
} catch (Exception e) {
e.printStackTrace();
return DocResponseJson.warn("操作失败," + e.getMessage());
}
}
/**
* 获取文档列表
*
* @author 暮光:城中城
* @since 2019年2月10日
**/
@PostMapping(value = "/getDocList")
public DocResponseJson getDocList() {
String dubboServiceList = mgDubboStorageService.get(StorageKeys.DUBBO_SERVICE_LIST);
if (StringUtils.isBlank(dubboServiceList)) {
return DocResponseJson.ok();
}
DubboInfoVo dubboInfoVo = new DubboInfoVo();
List<DubboInfo> providerList = JSON.parseArray(dubboServiceList, DubboInfo.class);
dubboInfoVo.setServerList(providerList);
// TODO 感觉不该在这里返回,应该每次点击的时候去包里面重新找一次文档
// 但是这样的话只存了一个大的json容易出现覆盖问题看来还得分接口方法一条一条记录的存才能针对方法来修改
String dubboServiceDoc = mgDubboStorageService.get(StorageKeys.DUBBO_SERVICE_DOC);
if (StringUtils.isNotBlank(dubboServiceDoc)) {
List<DubboDocInfo> docInfoList = JSON.parseArray(dubboServiceDoc, DubboDocInfo.class);
Map<String, DubboDocInfo> docInfoMap = docInfoList.stream().collect(Collectors.toMap(DubboDocInfo::getFunction, val -> val));
dubboInfoVo.setDocMap(docInfoMap);
}
return DocResponseJson.ok(dubboInfoVo);
}
/**
* 获取文档详情,依据类名生成
*
* @author 暮光:城中城
* @since 2019年2月10日
**/
@PostMapping(value = "/findDocInfo")
public DocResponseJson findDocInfo(DubboRequestParam param) {
DubboDocInfo definition = zookeeperDocService.getDefinitionByJar(param);
if (definition == null) {
definition = zookeeperDocService.getDefinitionByMetadata(param);
}
if (definition == null) {
return DocResponseJson.warn("未找到指定类请引入相关包或开启metadata类名" + param.getService());
}
Map<String, DubboDocInfo> docInfoMap = new HashMap<>();
String dubboServiceDoc = mgDubboStorageService.get(StorageKeys.DUBBO_SERVICE_DOC);
if (StringUtils.isNotBlank(dubboServiceDoc)) {
List<DubboDocInfo> docInfoList = JSON.parseArray(dubboServiceDoc, DubboDocInfo.class);
docInfoMap = docInfoList.stream().collect(Collectors.toMap(DubboDocInfo::getFunction, val -> val));
}
String function = param.getService() + "." + param.getMethod();
DubboDocInfo dubboDocInfo = docInfoMap.get(function);
if (dubboDocInfo == null) {
dubboDocInfo = new DubboDocInfo();
dubboDocInfo.setParams(definition.getParams());
dubboDocInfo.setResultType(definition.getResultType());
dubboDocInfo.setService(param.getService());
dubboDocInfo.setMethod(param.getMethod());
dubboDocInfo.setFunction(function);
dubboDocInfo.setVersion(1);
docInfoMap.put(function, dubboDocInfo);
} else {
// 根据参数顺序,把之前写的参数说明放到新的上面去
if (CollectionUtils.isNotEmpty(definition.getParams()) && CollectionUtils.isNotEmpty(dubboDocInfo.getParams())) {
for (int i = 0; i < definition.getParams().size() && i < dubboDocInfo.getParams().size(); i++) {
DubboDocInfo.DubboDocParam dubboDocNew = definition.getParams().get(i);
DubboDocInfo.DubboDocParam dubboDocOld = dubboDocInfo.getParams().get(i);
dubboDocNew.setParamDesc(StringUtils.defaultIfBlank(dubboDocOld.getParamDesc(), dubboDocNew.getParamDesc()));
}
}
dubboDocInfo.setParams(definition.getParams());
dubboDocInfo.setResultType(definition.getResultType());
}
List<DubboDocInfo> docInfoList = new ArrayList<>(docInfoMap.values());
mgDubboStorageService.put(StorageKeys.DUBBO_SERVICE_DOC, JSON.toJSONString(docInfoList));
return DocResponseJson.ok(dubboDocInfo);
}
/**
* 保存文档
*
* @author 暮光:城中城
* @since 2019年2月10日
**/
@PostMapping(value = "/saveDoc")
public DocResponseJson saveDoc(DubboDocInfo param, String paramsJson) {
String dubboServiceDoc = mgDubboStorageService.get(StorageKeys.DUBBO_SERVICE_DOC);
Map<String, DubboDocInfo> docInfoMap = new HashMap<>();
if (StringUtils.isNotBlank(dubboServiceDoc)) {
List<DubboDocInfo> docInfoList = JSON.parseArray(dubboServiceDoc, DubboDocInfo.class);
docInfoMap = docInfoList.stream().collect(Collectors.toMap(DubboDocInfo::getFunction, val -> val));
}
String function = param.getService() + "." + param.getMethod();
DubboDocInfo dubboDocInfo = docInfoMap.get(function);
if (dubboDocInfo != null) {
Integer newVersion = Optional.ofNullable(param.getVersion()).orElse(1);
Integer oldVersion = Optional.ofNullable(dubboDocInfo.getVersion()).orElse(1);
if (oldVersion > newVersion) {
return DocResponseJson.warn("已有用户在您之前修改过文档,请刷新后再修改");
}
param.setVersion(oldVersion + 1);
if (StringUtils.isEmpty(param.getExplain())) {
param.setExplain(dubboDocInfo.getExplain());
}
if (StringUtils.isEmpty(param.getResult())) {
param.setResult(dubboDocInfo.getResult());
}
param.setParams(dubboDocInfo.getParams());
} else {
param.setVersion(1);
}
if (StringUtils.isNotBlank(paramsJson)) {
param.setParams(JSON.parseArray(paramsJson, DubboDocInfo.DubboDocParam.class));
}
param.setFunction(function);
docInfoMap.put(function, param);
List<DubboDocInfo> docInfoList = new ArrayList<>(docInfoMap.values());
mgDubboStorageService.put(StorageKeys.DUBBO_SERVICE_DOC, JSON.toJSONString(docInfoList));
return DocResponseJson.ok(param);
}
/**
* 上传文档jar
*
* @author 暮光:城中城
* @since 2020年10月08日
**/
@PostMapping(value = "/uploadDocJar")
public DocResponseJson uploadDocJar(@RequestParam("file") MultipartFile file) {
File newFileDir = new File(zyplayerDocDubboLibPath);
if (!newFileDir.exists() && !newFileDir.mkdirs()) {
return DocResponseJson.warn("创建文件夹失败");
}
String fileSuffix = null;
String fileName = file.getOriginalFilename();
if (fileName != null) {
fileSuffix = fileName.substring(fileName.lastIndexOf("."));
}
if (!Objects.equals(".jar", fileSuffix)) {
return DocResponseJson.warn("仅支持jar后缀的文件格式上传");
}
try {
classLoadService.closeClassLoad(() -> {
File docJarFile = new File(zyplayerDocDubboLibPath + "/" + DubboDocConst.DUBBO_DOC_LIB_NAME);
if (docJarFile.exists()) {
docJarFile.delete();
}
file.transferTo(docJarFile);
});
} catch (Exception e) {
e.printStackTrace();
return DocResponseJson.warn("保存文件失败:" + e.getMessage());
}
return DocResponseJson.ok();
}
}

View File

@@ -1,91 +0,0 @@
package com.zyplayer.doc.dubbo.controller.param;
/**
* 请求参数对象
*
* @author 暮光:城中城
* @since 2019年2月10日
*/
public class DubboRequestParam {
private String application;
private String service;
private String method;
private String ip;
private Integer port;
private String version;
private String group;
private String paramTypes;
private String params;
public String getParamTypes() {
return paramTypes;
}
public void setParamTypes(String paramTypes) {
this.paramTypes = paramTypes;
}
public String getService() {
return service;
}
public void setService(String service) {
this.service = service;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public String getParams() {
return params;
}
public void setParams(String params) {
this.params = params;
}
public String getApplication() {
return application;
}
public void setApplication(String application) {
this.application = application;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getGroup() {
return group;
}
public void setGroup(String group) {
this.group = group;
}
}

View File

@@ -1,34 +0,0 @@
package com.zyplayer.doc.dubbo.controller.vo;
import com.zyplayer.doc.dubbo.framework.bean.DubboDocInfo;
import com.zyplayer.doc.dubbo.framework.bean.DubboInfo;
import java.util.List;
import java.util.Map;
/**
* dubbo信息对象
*
* @author 暮光:城中城
* @since 2019年1月10日
**/
public class DubboInfoVo {
private List<DubboInfo> serverList;
private Map<String, DubboDocInfo> docMap;
public List<DubboInfo> getServerList() {
return serverList;
}
public void setServerList(List<DubboInfo> serverList) {
this.serverList = serverList;
}
public Map<String, DubboDocInfo> getDocMap() {
return docMap;
}
public void setDocMap(Map<String, DubboDocInfo> docMap) {
this.docMap = docMap;
}
}

View File

@@ -1,32 +0,0 @@
package com.zyplayer.doc.dubbo.controller.vo;
import java.util.List;
/**
* nacos服务信息对象
*
* @author 暮光:城中城
* @since 2019年1月10日
**/
public class NacosServiceInfoVo {
private int count;
private List<NacosServiceListVo> serviceList;
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public List<NacosServiceListVo> getServiceList() {
return serviceList;
}
public void setServiceList(List<NacosServiceListVo> serviceList) {
this.serviceList = serviceList;
}
}

View File

@@ -1,46 +0,0 @@
package com.zyplayer.doc.dubbo.controller.vo;
/**
* nacos服务列表信息
*
* @author 暮光:城中城
* @since 2019年1月10日
**/
public class NacosServiceListVo {
private String name;
private int clusterCount;
private int ipCount;
private int healthyInstanceCount;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getClusterCount() {
return clusterCount;
}
public void setClusterCount(int clusterCount) {
this.clusterCount = clusterCount;
}
public int getIpCount() {
return ipCount;
}
public void setIpCount(int ipCount) {
this.ipCount = ipCount;
}
public int getHealthyInstanceCount() {
return healthyInstanceCount;
}
public void setHealthyInstanceCount(int healthyInstanceCount) {
this.healthyInstanceCount = healthyInstanceCount;
}
}

View File

@@ -1,131 +0,0 @@
package com.zyplayer.doc.dubbo.framework.bean;
import java.util.List;
/**
* 请求参数对象
*
* @author 暮光:城中城
* @since 2019年2月10日
*/
public class DubboDocInfo {
private String service;
private String method;
private String function;
private String explain;
private String result;
private String resultType;
private Integer version;
private List<DubboDocParam> params;
public static class DubboDocParam {
private String paramName;
private String paramType;
private String paramDesc;
private Object paramValue;
private Integer required;
public String getParamName() {
return paramName;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public String getParamType() {
return paramType;
}
public void setParamType(String paramType) {
this.paramType = paramType;
}
public String getParamDesc() {
return paramDesc;
}
public void setParamDesc(String paramDesc) {
this.paramDesc = paramDesc;
}
public Object getParamValue() {
return paramValue;
}
public void setParamValue(Object paramValue) {
this.paramValue = paramValue;
}
public Integer getRequired() {
return required;
}
public void setRequired(Integer required) {
this.required = required;
}
}
public Integer getVersion() {
return version;
}
public void setVersion(Integer version) {
this.version = version;
}
public String getService() {
return service;
}
public void setService(String service) {
this.service = service;
}
public String getMethod() {
return method;
}
public void setMethod(String method) {
this.method = method;
}
public String getExplain() {
return explain;
}
public void setExplain(String explain) {
this.explain = explain;
}
public List<DubboDocParam> getParams() {
return params;
}
public void setParams(List<DubboDocParam> params) {
this.params = params;
}
public String getFunction() {
return function;
}
public void setFunction(String function) {
this.function = function;
}
public String getResult() {
return result;
}
public void setResult(String result) {
this.result = result;
}
public String getResultType() {
return resultType;
}
public void setResultType(String resultType) {
this.resultType = resultType;
}
}

View File

@@ -1,101 +0,0 @@
package com.zyplayer.doc.dubbo.framework.bean;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.List;
/**
* dubbo信息
*
* @author 暮光:城中城
* @since 2019年1月10日
**/
public class DubboInfo {
@JSONField(name = "interface")
private String interfaceX;
private List<DubboNodeInfo> nodeList;
public static class DubboNodeInfo {
private Integer port;
private String ip;
@JSONField(name = "interface")
private String interfaceX;
private String[] methods;
private String application;
private String version;
private String group;
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getInterfaceX() {
return interfaceX;
}
public void setInterfaceX(String interfaceX) {
this.interfaceX = interfaceX;
}
public String[] getMethods() {
return methods;
}
public void setMethods(String[] methods) {
this.methods = methods;
}
public String getApplication() {
return application;
}
public void setApplication(String application) {
this.application = application;
}
public String getVersion() {
return version;
}
public void setVersion(String version) {
this.version = version;
}
public String getGroup() {
return group;
}
public void setGroup(String group) {
this.group = group;
}
}
public List<DubboNodeInfo> getNodeList() {
return nodeList;
}
public void setNodeList(List<DubboNodeInfo> nodeList) {
this.nodeList = nodeList;
}
public String getInterfaceX() {
return interfaceX;
}
public void setInterfaceX(String interfaceX) {
this.interfaceX = interfaceX;
}
}

View File

@@ -1,87 +0,0 @@
package com.zyplayer.doc.dubbo.framework.bean;
import java.util.List;
/**
* 请求参数对象
*
* @author 暮光:城中城
* @since 2019年2月10日
*/
public class DubboResponseInfo {
private String name;
private String type;
private String desc;
private Object value;
private String interfaceType;
private DubboResponseInfo keyInfo;
private List<DubboResponseInfo> params;
public DubboResponseInfo(String type) {
this.type = type;
}
public DubboResponseInfo(String name, String type, String desc, Object value) {
this.name = name;
this.type = type;
this.desc = desc;
this.value = value;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public Object getValue() {
return value;
}
public void setValue(Object value) {
this.value = value;
}
public List<DubboResponseInfo> getParams() {
return params;
}
public void setParams(List<DubboResponseInfo> params) {
this.params = params;
}
public DubboResponseInfo getKeyInfo() {
return keyInfo;
}
public void setKeyInfo(DubboResponseInfo keyInfo) {
this.keyInfo = keyInfo;
}
public String getInterfaceType() {
return interfaceType;
}
public void setInterfaceType(String interfaceType) {
this.interfaceType = interfaceType;
}
}

View File

@@ -1,11 +0,0 @@
package com.zyplayer.doc.dubbo.framework.bean;
/**
* 接口类型
*
* @author 暮光:城中城
* @since 2019年1月10日
**/
public enum InterfaceType {
map, list, set, arr
}

View File

@@ -1,335 +0,0 @@
package com.zyplayer.doc.dubbo.framework.bean;
import com.alibaba.fastjson.annotation.JSONField;
import java.util.List;
/**
* nacos中dubbo的信息
*
* @author 暮光:城中城
* @since 2019年1月10日
**/
public class NacosDubboInfo {
/**
* metadata : {}
* dom : providers:com.zyplayer.dubbo.service.UserService
* cacheMillis : 10000
* useSpecifiedURL : false
* hosts : [{"valid":true,"marked":false,"metadata":{"side":"provider","protocol":"dubbo","application":"dubbo-provider","methods":"getUserDetail,getUserList","dubbo":"2.0.2","pid":"8164","interface":"com.zyplayer.dubbo.service.UserService","category":"providers","generic":"false","anyhost":"true","bean.name":"ServiceBean:com.zyplayer.dubbo.service.UserService","timestamp":"1549953970871"},"instanceId":"127.0.0.1#22223#DEFAULT#providers:com.zyplayer.dubbo.service.UserService","port":22223,"ip":"127.0.0.1","clusterName":"DEFAULT","weight":1,"serviceName":"providers:com.zyplayer.dubbo.service.UserService","enabled":true}]
* checksum : 2489ae2874f2f490caf7d6195192d6c71549954548862
* lastRefTime : 1549954548862
* env :
* clusters :
*/
private MetadataBean metadata;
private String dom;
private int cacheMillis;
private boolean useSpecifiedURL;
private String checksum;
private long lastRefTime;
private String env;
private String clusters;
private List<HostsBean> hosts;
public MetadataBean getMetadata() {
return metadata;
}
public void setMetadata(MetadataBean metadata) {
this.metadata = metadata;
}
public String getDom() {
return dom;
}
public void setDom(String dom) {
this.dom = dom;
}
public int getCacheMillis() {
return cacheMillis;
}
public void setCacheMillis(int cacheMillis) {
this.cacheMillis = cacheMillis;
}
public boolean isUseSpecifiedURL() {
return useSpecifiedURL;
}
public void setUseSpecifiedURL(boolean useSpecifiedURL) {
this.useSpecifiedURL = useSpecifiedURL;
}
public String getChecksum() {
return checksum;
}
public void setChecksum(String checksum) {
this.checksum = checksum;
}
public long getLastRefTime() {
return lastRefTime;
}
public void setLastRefTime(long lastRefTime) {
this.lastRefTime = lastRefTime;
}
public String getEnv() {
return env;
}
public void setEnv(String env) {
this.env = env;
}
public String getClusters() {
return clusters;
}
public void setClusters(String clusters) {
this.clusters = clusters;
}
public List<HostsBean> getHosts() {
return hosts;
}
public void setHosts(List<HostsBean> hosts) {
this.hosts = hosts;
}
public static class MetadataBean {
}
public static class HostsBean {
/**
* valid : true
* marked : false
* metadata : {"side":"provider","protocol":"dubbo","application":"dubbo-provider","methods":"getUserDetail,getUserList","dubbo":"2.0.2","pid":"8164","interface":"com.zyplayer.dubbo.service.UserService","category":"providers","generic":"false","anyhost":"true","bean.name":"ServiceBean:com.zyplayer.dubbo.service.UserService","timestamp":"1549953970871"}
* instanceId : 127.0.0.1#22223#DEFAULT#providers:com.zyplayer.dubbo.service.UserService
* port : 22223
* ip : 127.0.0.1
* clusterName : DEFAULT
* weight : 1
* serviceName : providers:com.zyplayer.dubbo.service.UserService
* enabled : true
*/
private boolean valid;
private boolean marked;
private MetadataBeanX metadata;
private String instanceId;
private int port;
private String ip;
private String clusterName;
private int weight;
private String serviceName;
private boolean enabled;
public boolean isValid() {
return valid;
}
public void setValid(boolean valid) {
this.valid = valid;
}
public boolean isMarked() {
return marked;
}
public void setMarked(boolean marked) {
this.marked = marked;
}
public MetadataBeanX getMetadata() {
return metadata;
}
public void setMetadata(MetadataBeanX metadata) {
this.metadata = metadata;
}
public String getInstanceId() {
return instanceId;
}
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getClusterName() {
return clusterName;
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
public String getServiceName() {
return serviceName;
}
public void setServiceName(String serviceName) {
this.serviceName = serviceName;
}
public boolean isEnabled() {
return enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
public static class MetadataBeanX {
/**
* side : provider
* protocol : dubbo
* application : dubbo-provider
* methods : getUserDetail,getUserList
* dubbo : 2.0.2
* pid : 8164
* interface : com.zyplayer.dubbo.service.UserService
* category : providers
* generic : false
* anyhost : true
* bean.name : ServiceBean:com.zyplayer.dubbo.service.UserService
* timestamp : 1549953970871
*/
private String side;
private String protocol;
private String application;
private String methods;
private String dubbo;
private String pid;
@JSONField(name = "interface")
private String interfaceX;
private String category;
private String generic;
private String anyhost;
private String timestamp;
public String getSide() {
return side;
}
public void setSide(String side) {
this.side = side;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public String getApplication() {
return application;
}
public void setApplication(String application) {
this.application = application;
}
public String getMethods() {
return methods;
}
public void setMethods(String methods) {
this.methods = methods;
}
public String getDubbo() {
return dubbo;
}
public void setDubbo(String dubbo) {
this.dubbo = dubbo;
}
public String getPid() {
return pid;
}
public void setPid(String pid) {
this.pid = pid;
}
public String getInterfaceX() {
return interfaceX;
}
public void setInterfaceX(String interfaceX) {
this.interfaceX = interfaceX;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getGeneric() {
return generic;
}
public void setGeneric(String generic) {
this.generic = generic;
}
public String getAnyhost() {
return anyhost;
}
public void setAnyhost(String anyhost) {
this.anyhost = anyhost;
}
public String getTimestamp() {
return timestamp;
}
public void setTimestamp(String timestamp) {
this.timestamp = timestamp;
}
}
}
}

View File

@@ -1,54 +0,0 @@
package com.zyplayer.doc.dubbo.framework.bean;
import org.apache.commons.lang.StringUtils;
import org.apache.dubbo.config.ApplicationConfig;
import org.apache.dubbo.config.ReferenceConfig;
import org.apache.dubbo.rpc.service.GenericService;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* 引用配置信息
*
* @author 暮光:城中城
* @since 2019年1月10日
**/
public class ReferenceConfigHolder {
private static Map<String, ReferenceConfig> referenceConfigMap = new ConcurrentHashMap<>();
public static GenericService getBean(DubboInfo.DubboNodeInfo dubboNodeInfo) {
String url = "dubbo://" + dubboNodeInfo.getIp() + ":" + dubboNodeInfo.getPort();
String referenceKey = url + "_" + StringUtils.defaultIfBlank(dubboNodeInfo.getVersion(), "0") + "_" + StringUtils.defaultIfBlank(dubboNodeInfo.getGroup(), "0");
ReferenceConfig referenceConfig = referenceConfigMap.get(referenceKey);
if (referenceConfig != null && referenceConfig.get() == null) {
referenceConfig.destroy();
referenceConfig = null;
}
if (referenceConfig == null) {
synchronized (ReferenceConfigHolder.class) {
ApplicationConfig application = new ApplicationConfig();
application.setName("zyplayer-doc-consume");
// 参考http://dubbo.apache.org/zh-cn/docs/user/configuration/api.html
// 此实例很重,封装了与注册中心的连接以及与提供者的连接,请自行缓存,否则可能造成内存和连接泄漏
referenceConfig = new ReferenceConfig<>();
// 如果点对点直连可以用reference.setUrl()指定目标地址设置url后将绕过注册中心
// 其中协议对应provider.setProtocol()的值端口对应provider.setPort()的值,
// 路径对应service.setPath()的值如果未设置path缺省path为接口名
referenceConfig.setUrl(url);
String groupAppend = StringUtils.isNotBlank(dubboNodeInfo.getGroup()) ? dubboNodeInfo.getGroup() + "/" : "";
referenceConfig.setInterface(groupAppend + dubboNodeInfo.getInterfaceX());
referenceConfig.setGeneric(true);
referenceConfig.setApplication(application);
referenceConfig.setTimeout(5000);
referenceConfig.setVersion(dubboNodeInfo.getVersion());
referenceConfig.setGroup(dubboNodeInfo.getGroup());
referenceConfigMap.put(referenceKey, referenceConfig);
}
}
// 本项目没有dubbo里面申明的类快放弃时看源码发现可以设置generic返回一个GenericService对象通过$invoke去操作具体方法感觉又打开了一扇大门
// 本项目选择的不入侵的方式管理文档,所以文档里面就必须手动加参数,写文档那些了
return (GenericService) referenceConfig.get();
}
}

View File

@@ -1,23 +0,0 @@
package com.zyplayer.doc.dubbo.framework.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import java.lang.annotation.*;
/**
* 开启dubbo模块注解
*
* @author 暮光:城中城
* @since 2019年2月12日
**/
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Configuration
@ComponentScan(basePackages = {
"com.zyplayer.doc.dubbo",
})
public @interface EnableDocDubbo {
}

View File

@@ -1,45 +0,0 @@
package com.zyplayer.doc.dubbo.framework.constant;
import org.apache.commons.lang.StringUtils;
import java.util.HashSet;
import java.util.Set;
/**
* 基本数据类型
*
* @author 暮光:城中城
* @since 2020年10月31日
**/
public class BaseType {
private static final Set<String> baseType = new HashSet<String>() {{
add("java.lang.Boolean");
add("java.lang.Character");
add("java.lang.Byte");
add("java.lang.Short");
add("java.lang.Integer");
add("java.lang.Long");
add("java.lang.Float");
add("java.lang.Double");
add("java.lang.String");
add("java.lang.Void");
add("boolean");
add("char");
add("byte");
add("short");
add("int");
add("long");
add("float");
add("double");
add("void");
}};
public static boolean isBaseType(String type) {
if (type == null || StringUtils.startsWith(type, "java.lang")) {
return true;
}
return baseType.contains(type);
}
}

View File

@@ -1,13 +0,0 @@
package com.zyplayer.doc.dubbo.framework.constant;
/**
* dubbo静态类
*
* @author 暮光:城中城
* @since 2020年11月18日
*/
public class DubboDocConst {
/**上传的文档jar文件名*/
public static final String DUBBO_DOC_LIB_NAME = "zyplayer-doc-dubbo-libs.jar";
}

View File

@@ -1,13 +0,0 @@
package com.zyplayer.doc.dubbo.framework.constant;
/**
* 存储数据的KEY常量类
*
* @author 暮光:城中城
* @since 2018年8月21日
*/
public class StorageKeys {
// 所有文档地址
public static final String DUBBO_SERVICE_DOC = "dubbo-service-doc";
public static final String DUBBO_SERVICE_LIST = "dubbo-service-list";
}

View File

@@ -1,313 +0,0 @@
package com.zyplayer.doc.dubbo.framework.service;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSON;
import com.zyplayer.doc.annotation.DocMethod;
import com.zyplayer.doc.annotation.DocParam;
import com.zyplayer.doc.core.exception.ConfirmException;
import com.zyplayer.doc.dubbo.framework.bean.DubboResponseInfo;
import com.zyplayer.doc.dubbo.framework.bean.InterfaceType;
import com.zyplayer.doc.dubbo.framework.constant.BaseType;
import com.zyplayer.doc.dubbo.framework.constant.DubboDocConst;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.lang.reflect.*;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.*;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
/**
* 类加载服务
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
@Service
public class ClassLoadService {
private static Logger logger = LoggerFactory.getLogger(ClassLoadService.class);
@Value("${zyplayer.doc.dubbo.doc-lib-path}")
private String zyplayerDocDubboLibPath;
private URLClassLoader docClassLoader;
/**
* 获取文档jar类加载器
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
private URLClassLoader getDocClassLoader() throws Exception {
if (docClassLoader != null) {
return docClassLoader;
}
if (!FileUtil.isFile(zyplayerDocDubboLibPath + "/" + DubboDocConst.DUBBO_DOC_LIB_NAME)) {
throw new ConfirmException("请先上传文档JAR");
}
synchronized (ClassLoadService.class) {
// file:D:/maven/repository/com/zyplayer/dubbo-api/1.0/dubbo-api-1.0.jar
if (docClassLoader == null) {
URL fileUrl = new URL("file:/" + zyplayerDocDubboLibPath + "/" + DubboDocConst.DUBBO_DOC_LIB_NAME);
docClassLoader = new URLClassLoader(new URL[]{fileUrl}, Thread.currentThread().getContextClassLoader());
}
}
return docClassLoader;
}
/**
* 关闭类加载器callback中可对文件进行覆盖上传
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
public void closeClassLoad(ClassLoaderCallback callback) throws Exception {
synchronized (ClassLoadService.class) {
try {
if (docClassLoader != null) {
docClassLoader.close();
}
} catch (Exception e) {
logger.error("关闭类加载器失败", e);
}
docClassLoader = null;
if (callback != null) {
// callback方式防止刚close马上又被别人new出来了
// callback主要是删除文件如果文件被加载了应该删除和创建不了我没测理论上会是这样
callback.callback();
}
}
}
/**
* 加载类
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
public Class<?> loadClass(String serverName) throws Exception {
try {
return this.getDocClassLoader().loadClass(serverName);
} catch (Exception e) {
// 失败之后先关闭再去加载一次
this.closeClassLoad(null);
return this.getDocClassLoader().loadClass(serverName);
}
}
// public static void main(String[] args) throws Exception {
// String serviceName = "com.zyplayer.dubbo.service.AnnotateService";
// String jarGroup = "com.zyplayer";
// String jarArtifact = "dubbo-api";
// String jarVersion = "1.0";
// String basePath = "file:D:/maven/repository";
//// String basePath = "http://nexus.zyplayer.com:8081/nexus/content/groups/public";
// new ClassLoadService().loadServerMethod(serviceName, basePath, jarGroup, jarArtifact, jarVersion);
// }
// public static void main(String[] args) throws Exception {
// String serviceName = "com.zyplayer.data.service.dubbo.DataIndicatorsService";
// String jarGroup = "com.zyplayer.data";
// String jarArtifact = "data-api-client";
// String jarVersion = "1.1.1.SNAPSHOTS";
// String basePath = "http://nexus.zyplayer.com:8081/nexus/content/groups/public";
// new ClassLoadService().loadServerMethod(serviceName, basePath, jarGroup, jarArtifact, jarVersion);
// }
public void loadServerMethod(String serverName) throws Exception {
// jar:file:D:/maven/repository/com/zyplayer/dubbo-api/1.0/dubbo-api-1.0.jar!/
String docJarFileUrl = "file:/" + zyplayerDocDubboLibPath + "/" + DubboDocConst.DUBBO_DOC_LIB_NAME;
URL jarUrl = new URL("jar:" + docJarFileUrl + "!/");
JarFile jar = ((JarURLConnection) jarUrl.openConnection()).getJarFile();
JarEntry jarEntry = jar.getJarEntry(serverName.replaceAll("\\.", "/") + ".class");
if (jarEntry == null) {
logger.info("未找到类");
return;
}
URL fileUrl = new URL(docJarFileUrl);
URLClassLoader classLoader = new URLClassLoader(new URL[]{fileUrl}, Thread.currentThread().getContextClassLoader());
Class<?> clazz = classLoader.loadClass(serverName);
Method[] methods = clazz.getMethods();
for (Method method : methods) {
Map<String, String> docParamMap = new HashMap<>();
DocParam[] annotation = method.getAnnotationsByType(DocParam.class);
if (annotation != null) {
for (DocParam docParam : annotation) {
docParamMap.put(docParam.name(), docParam.value());
}
}
String methodDesc = null;
Class<?> returnType = method.getReturnType();
DubboResponseInfo responseInfo = this.getInfoByClass(classLoader, returnType, 0);
DocMethod docMethod = method.getAnnotation(DocMethod.class);
if (docMethod != null) {
methodDesc = docMethod.value();
responseInfo.setDesc(docMethod.response());
}
String methodName = method.getName();
Type[] parameterTypes = method.getGenericParameterTypes();
Parameter[] parameters = method.getParameters();
List<DubboResponseInfo> paramList = new LinkedList<>();
for (int i = 0; i < parameterTypes.length; i++) {
DubboResponseInfo responseInfoParam = this.getInfoByType(classLoader, parameterTypes[i], parameters[i].getType(), 0);
String desc = docParamMap.get(parameters[i].getName());
if (StringUtils.isNotBlank(desc)) {
responseInfoParam.setDesc(desc);
}
responseInfoParam.setName(parameters[i].getName());
paramList.add(responseInfoParam);
}
logger.info("methodName{}methodDesc{}paramList{}responseInfo{}", methodName, methodDesc, JSON.toJSONString(paramList), JSON.toJSONString(responseInfo));
}
}
private DubboResponseInfo getInfoByType(URLClassLoader classLoader, String resultType, Integer recursion) {
DubboResponseInfo dubboResponseInfo = new DubboResponseInfo(resultType);
if (BaseType.isBaseType(resultType)) {
return dubboResponseInfo;
}
try {
Class<?> clazz = classLoader.loadClass(resultType);
DubboResponseInfo responseInfo = this.getInfoByClass(classLoader, clazz, recursion);
if (responseInfo.getDesc() == null) {
responseInfo.setDesc(dubboResponseInfo.getDesc());
}
return responseInfo;
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return dubboResponseInfo;
}
private DubboResponseInfo getInfoByType(URLClassLoader classLoader, Type type, Class<?> typeClazz, Integer recursion) throws Exception {
String typeName = type.getTypeName();
DubboResponseInfo dubboResponseInfo = new DubboResponseInfo(typeName);
dubboResponseInfo.setName(type.getTypeName());
if (BaseType.isBaseType(typeName)) {
return dubboResponseInfo;
}
Class<?> clazz = null;
if (typeClazz.isArray()) {
dubboResponseInfo.setInterfaceType(InterfaceType.arr.name());
clazz = typeClazz.getComponentType();
} else if (typeClazz.isAssignableFrom(Map.class)) {
dubboResponseInfo.setInterfaceType(InterfaceType.map.name());
if (type instanceof ParameterizedType) {
Type[] actualTypeArguments = ((ParameterizedType) type).getActualTypeArguments();
Class<?> clazzKey = classLoader.loadClass(actualTypeArguments[0].getTypeName());
dubboResponseInfo.setKeyInfo(this.getInfoByClass(classLoader, clazzKey, recursion));
clazz = classLoader.loadClass(actualTypeArguments[1].getTypeName());
}
} else if (typeClazz.isAssignableFrom(List.class) || typeClazz.isAssignableFrom(Set.class)) {
if (type instanceof ParameterizedType) {
String typeNameSub = ((ParameterizedType) type).getActualTypeArguments()[0].getTypeName();
clazz = classLoader.loadClass(typeNameSub);
}
if (typeClazz.isAssignableFrom(List.class)) {
dubboResponseInfo.setInterfaceType(InterfaceType.list.name());
} else if (typeClazz.isAssignableFrom(Set.class)) {
dubboResponseInfo.setInterfaceType(InterfaceType.set.name());
}
} else {
clazz = classLoader.loadClass(typeName);
}
if (clazz != null) {
DubboResponseInfo responseInfo = this.getInfoByClass(classLoader, clazz, recursion);
responseInfo.setName(typeName);
// 字段注释 优先于 类上的注释
if (StringUtils.isNotBlank(dubboResponseInfo.getDesc())) {
responseInfo.setDesc(dubboResponseInfo.getDesc());
}
responseInfo.setKeyInfo(dubboResponseInfo.getKeyInfo());
responseInfo.setInterfaceType(dubboResponseInfo.getInterfaceType());
return responseInfo;
}
return dubboResponseInfo;
}
private DubboResponseInfo getInfoByField(URLClassLoader classLoader, Field field, Integer recursion) throws Exception {
String typeName = field.getType().getTypeName();
DubboResponseInfo dubboResponseInfo = new DubboResponseInfo(typeName);
dubboResponseInfo.setName(field.getName());
DocParam docResponse = field.getAnnotation(DocParam.class);
if (docResponse != null) {
dubboResponseInfo.setDesc(docResponse.value());
}
if (BaseType.isBaseType(typeName)) {
return dubboResponseInfo;
}
Class<?> clazz = null;
if (field.getType().isArray()) {
dubboResponseInfo.setInterfaceType(InterfaceType.arr.name());
clazz = field.getType().getComponentType();
} else if (field.getType().isAssignableFrom(Map.class)) {
dubboResponseInfo.setInterfaceType(InterfaceType.map.name());
Type genericType = field.getGenericType();
if (genericType instanceof ParameterizedType) {
Type[] actualTypeArguments = ((ParameterizedType) genericType).getActualTypeArguments();
Class<?> clazzKey = classLoader.loadClass(actualTypeArguments[0].getTypeName());
dubboResponseInfo.setKeyInfo(this.getInfoByClass(classLoader, clazzKey, recursion));
clazz = classLoader.loadClass(actualTypeArguments[1].getTypeName());
}
} else if (field.getType().isAssignableFrom(List.class) || field.getType().isAssignableFrom(Set.class)) {
Type genericType = field.getGenericType();
if (genericType instanceof ParameterizedType) {
String typeNameSub = ((ParameterizedType) genericType).getActualTypeArguments()[0].getTypeName();
clazz = classLoader.loadClass(typeNameSub);
}
if (field.getType().isAssignableFrom(List.class)) {
dubboResponseInfo.setInterfaceType(InterfaceType.list.name());
} else if (field.getType().isAssignableFrom(Set.class)) {
dubboResponseInfo.setInterfaceType(InterfaceType.set.name());
}
} else {
clazz = classLoader.loadClass(typeName);
}
if (clazz != null) {
DubboResponseInfo responseInfo = this.getInfoByClass(classLoader, clazz, recursion);
responseInfo.setName(field.getName());
// 字段注释 优先于 类上的注释
if (StringUtils.isNotBlank(dubboResponseInfo.getDesc())) {
responseInfo.setDesc(dubboResponseInfo.getDesc());
}
responseInfo.setKeyInfo(dubboResponseInfo.getKeyInfo());
responseInfo.setInterfaceType(dubboResponseInfo.getInterfaceType());
return responseInfo;
}
return dubboResponseInfo;
}
private DubboResponseInfo getInfoByClass(URLClassLoader classLoader, Class<?> clazz, Integer recursion) {
DubboResponseInfo dubboResponseInfo = new DubboResponseInfo(clazz.getTypeName());
DocParam docResponse = clazz.getAnnotation(DocParam.class);
if (docResponse != null) {
dubboResponseInfo.setDesc(docResponse.value());
}
if (BaseType.isBaseType(clazz.getTypeName())) {
return dubboResponseInfo;
}
recursion++;
// 默认最大支持3个层级感觉已经满足了
if (recursion > 3) {
return dubboResponseInfo;
}
List<DubboResponseInfo> paramList = new LinkedList<>();
Field[] fieldArr = clazz.getDeclaredFields();
for (Field field : fieldArr) {
try {
field.setAccessible(true);
paramList.add(this.getInfoByField(classLoader, field, recursion));
} catch (Exception e) {
e.printStackTrace();
}
}
dubboResponseInfo.setParams(paramList);
return dubboResponseInfo;
}
}

View File

@@ -1,18 +0,0 @@
package com.zyplayer.doc.dubbo.framework.service;
/**
* classloader回调接口类
*
* @author 暮光:城中城
* @since 2018年8月19日
*/
public interface ClassLoaderCallback {
/**
* 回调
*
* @author 暮光:城中城
* @since 2020年10月08日
*/
void callback() throws Exception;
}

View File

@@ -1,48 +0,0 @@
package com.zyplayer.doc.dubbo.framework.service;
import java.io.Serializable;
/**
* 数据类型
*
* @author 暮光:城中城
* @since 2018-11-27
*/
public class MgDubboStorage implements Serializable {
private static final long serialVersionUID = 1L;
private String key;
private String value;
public MgDubboStorage() {
}
public MgDubboStorage(String key, String value) {
this.key = key;
this.value = value;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}

View File

@@ -1,53 +0,0 @@
package com.zyplayer.doc.dubbo.framework.service;
import java.util.List;
/**
* 实现此类才能使用服务器端的存贮功能
* dubbo的文档需要手动写的比较重要所以重起一个存储service实现类尽量操作另外的库
*
* @author 暮光:城中城
* @since 2018年8月19日
*/
public interface MgDubboStorageService {
/**
* 获取存储的值
*
* @param key 参数
* @return 值
* @author 暮光:城中城
* @since 2018年8月19日
*/
String get(String key);
/**
* 模糊获取存储的值
*
* @param key 参数
* @param value 值
* @return 值
* @author 暮光:城中城
* @since 2018年8月19日
*/
List<MgDubboStorage> like(String key, String value);
/**
* 存储数据
*
* @param key 参数
* @param value 值
* @author 暮光:城中城
* @since 2018年8月19日
*/
void put(String key, String value);
/**
* 删除数据
*
* @param key 参数
* @author 暮光:城中城
* @since 2018年8月19日
*/
void remove(String key);
}

View File

@@ -1,79 +0,0 @@
package com.zyplayer.doc.dubbo.framework.service;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSON;
import com.zyplayer.doc.dubbo.controller.vo.NacosServiceInfoVo;
import com.zyplayer.doc.dubbo.controller.vo.NacosServiceListVo;
import com.zyplayer.doc.dubbo.framework.bean.DubboInfo;
import com.zyplayer.doc.dubbo.framework.bean.NacosDubboInfo;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.LinkedList;
import java.util.List;
/**
* nacos方式加载文档服务
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
@Service
public class NacosDocService {
@Value("${zyplayer.doc.dubbo.nacos.url:}")
private String nacosUrl;
// @Value("${zyplayer.doc.dubbo.nacos.service:}")
// private String nacosService;
/**
* 是否开启nacos文档
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
public boolean isEnable() {
return StringUtils.isNotBlank(nacosUrl);
}
/**
* 通过nacos方式获取所有服务
*
* @author 暮光:城中城
* @since 2019年2月10日
**/
public List<DubboInfo> getDubboInfoByNacos() {
List<DubboInfo> providerList = new LinkedList<>();
// 获取所有的服务列表
String serviceListStr = HttpUtil.get(nacosUrl + "/v1/ns/catalog/services?withInstances=false&pageNo=1&pageSize=100000");
NacosServiceInfoVo nacosServiceInfoVo = JSON.parseObject(serviceListStr, NacosServiceInfoVo.class);
if (nacosServiceInfoVo == null || nacosServiceInfoVo.getServiceList().isEmpty()) {
return providerList;
}
for (NacosServiceListVo service : nacosServiceInfoVo.getServiceList()) {
String serviceName = service.getName();
String resultStr = HttpUtil.get(nacosUrl + "/v1/ns/instance/list?serviceName=" + serviceName);
NacosDubboInfo dubboInstance = JSON.parseObject(resultStr, NacosDubboInfo.class);
List<NacosDubboInfo.HostsBean> hosts = dubboInstance.getHosts();
DubboInfo dubboInfo = new DubboInfo();
List<DubboInfo.DubboNodeInfo> nodeList = new LinkedList<>();
for (NacosDubboInfo.HostsBean host : hosts) {
DubboInfo.DubboNodeInfo dubboNodeInfo = new DubboInfo.DubboNodeInfo();
dubboNodeInfo.setIp(host.getIp());
dubboNodeInfo.setPort(host.getPort());
dubboNodeInfo.setInterfaceX(host.getMetadata().getInterfaceX());
dubboNodeInfo.setMethods(host.getMetadata().getMethods().split(","));
dubboNodeInfo.setApplication(host.getMetadata().getApplication());
nodeList.add(dubboNodeInfo);
}
if (serviceName.contains(":")) {
serviceName = serviceName.substring(serviceName.indexOf(":") + 1);
}
dubboInfo.setInterfaceX(serviceName);
dubboInfo.setNodeList(nodeList);
providerList.add(dubboInfo);
}
return providerList;
}
}

View File

@@ -1,242 +0,0 @@
package com.zyplayer.doc.dubbo.framework.service;
import com.alibaba.fastjson.JSON;
import com.zyplayer.doc.dubbo.controller.param.DubboRequestParam;
import com.zyplayer.doc.dubbo.framework.bean.DubboDocInfo;
import com.zyplayer.doc.dubbo.framework.bean.DubboInfo;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.curator.RetryPolicy;
import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.CuratorFrameworkFactory;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.apache.dubbo.common.Constants;
import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.utils.UrlUtils;
import org.apache.dubbo.metadata.definition.model.FullServiceDefinition;
import org.apache.dubbo.metadata.definition.model.MethodDefinition;
import org.apache.dubbo.metadata.identifier.MetadataIdentifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.lang.reflect.Method;
import java.lang.reflect.Parameter;
import java.lang.reflect.Type;
import java.net.URLDecoder;
import java.util.*;
import java.util.stream.Collectors;
/**
* zookeeper方式加载文档服务
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
@Service
public class ZookeeperDocService {
@Value("${zyplayer.doc.dubbo.zookeeper.url:}")
private String serviceZookeeperUrl;
@Value("${zyplayer.doc.dubbo.zookeeper.metadata-url:}")
private String metadataZookeeperUrl;
@Resource
ClassLoadService classLoadService;
private CuratorFramework serverClient;
private CuratorFramework metadataClient;
private final static String DEFAULT_ROOT = "dubbo";
private final static String METADATA_NODE_NAME = "service.data";
private String root;
/**
* zookeeper初始化
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
@PostConstruct
private void init() {
// 初始化zk注册中心连接
if (StringUtils.isNotBlank(serviceZookeeperUrl)) {
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
serverClient = CuratorFrameworkFactory.newClient(serviceZookeeperUrl, retryPolicy);
serverClient.start();
}
// 初始化zk注册中心元数据信息
if (StringUtils.isNotBlank(metadataZookeeperUrl)) {
URL url = UrlUtils.parseURL(metadataZookeeperUrl, Collections.emptyMap());
String group = url.getParameter(Constants.GROUP_KEY, DEFAULT_ROOT);
if (!group.startsWith(Constants.PATH_SEPARATOR)) {
group = Constants.PATH_SEPARATOR + group;
}
this.root = group;
RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3);
metadataClient = CuratorFrameworkFactory.newClient(metadataZookeeperUrl, retryPolicy);
metadataClient.start();
}
}
/**
* 是否启用了zk文档
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
public boolean isEnable() {
return StringUtils.isNotBlank(serviceZookeeperUrl);
}
/**
* 通过Zookeeper方式获取所有服务
*
* @author 暮光:城中城
* @since 2019年2月10日
**/
public List<DubboInfo> getDubboInfoByZookeeper() throws Exception {
if (serverClient == null) {
return null;
}
List<String> dubboList = serverClient.getChildren().forPath("/dubbo");
if (dubboList == null || dubboList.isEmpty()) {
return Collections.emptyList();
}
List<DubboInfo> providerList = new LinkedList<>();
for (String dubboStr : dubboList) {
String path = "/dubbo/" + dubboStr + "/providers";
if (serverClient.checkExists().forPath(path) == null) {
continue;
}
List<String> providers = serverClient.getChildren().forPath(path);
List<DubboInfo.DubboNodeInfo> nodeList = providers.stream().map(val -> {
String tempStr = val;
try {
tempStr = URLDecoder.decode(val, "utf-8");
} catch (Exception e) {
e.printStackTrace();
}
// IP和端口
String ipPort = tempStr.substring(tempStr.indexOf("://") + 3);
ipPort = ipPort.substring(0, ipPort.indexOf("/"));
String[] ipPortArr = ipPort.split(":");
// 参数
Map<String, String> paramMap = new HashMap<>();
String params = tempStr.substring(tempStr.indexOf("?") + 1);
String[] paramsArr = params.split("&");
for (String param : paramsArr) {
String[] split = param.split("=");
paramMap.put(split[0], split[1]);
}
DubboInfo.DubboNodeInfo dubboNodeInfo = new DubboInfo.DubboNodeInfo();
dubboNodeInfo.setIp(ipPortArr[0]);
dubboNodeInfo.setPort(NumberUtils.toInt(ipPortArr[1]));
dubboNodeInfo.setInterfaceX(paramMap.get("interface"));
dubboNodeInfo.setMethods(paramMap.get("methods").split(","));
dubboNodeInfo.setApplication(paramMap.get("application"));
dubboNodeInfo.setVersion(paramMap.get("version"));
dubboNodeInfo.setGroup(paramMap.get("group"));
return dubboNodeInfo;
}).collect(Collectors.toList());
DubboInfo dubboInfo = new DubboInfo();
dubboInfo.setInterfaceX(dubboStr);
dubboInfo.setNodeList(nodeList);
providerList.add(dubboInfo);
}
return providerList;
}
/**
* 通过zk中的meta信息获取文档
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
public DubboDocInfo getDefinitionByMetadata(DubboRequestParam param) {
if (metadataClient == null) {
return null;
}
try {
String path = getNodePath(param.getService(), null, null, param.getApplication());
if (metadataClient.checkExists().forPath(path) == null) {
return null;
}
String resultType = null;
String metadata = new String(metadataClient.getData().forPath(path));
FullServiceDefinition definition = JSON.parseObject(metadata, FullServiceDefinition.class);
List<DubboDocInfo.DubboDocParam> paramList = new LinkedList<>();
for (MethodDefinition method : definition.getMethods()) {
if (Objects.equals(method.getName(), param.getMethod())) {
String[] parameterTypes = method.getParameterTypes();
resultType = method.getReturnType();
for (int i = 0; i < parameterTypes.length; i++) {
DubboDocInfo.DubboDocParam docParam = new DubboDocInfo.DubboDocParam();
docParam.setParamType(parameterTypes[i]);
docParam.setParamName("arg" + i);
paramList.add(docParam);
}
}
}
DubboDocInfo dubboDocInfo = new DubboDocInfo();
dubboDocInfo.setParams(paramList);
dubboDocInfo.setResultType(resultType);
return dubboDocInfo;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 通过jar方式获取文档
*
* @author 暮光:城中城
* @since 2020年11月08日
*/
public DubboDocInfo getDefinitionByJar(DubboRequestParam param) {
String resultType = null;
List<DubboDocInfo.DubboDocParam> paramList = new LinkedList<>();
try {
Class clazz = classLoadService.loadClass(param.getService());
Method[] methods = clazz.getMethods();
for (Method method : methods) {
String methodName = method.getName();
if (methodName.equals(param.getMethod())) {
resultType = method.getGenericReturnType().getTypeName();
Type[] parameterTypes = method.getGenericParameterTypes();
Parameter[] parameters = method.getParameters();
for (int i = 0; i < parameterTypes.length; i++) {
DubboDocInfo.DubboDocParam docParam = new DubboDocInfo.DubboDocParam();
docParam.setParamName(parameters[i].getName());
docParam.setParamType(parameterTypes[i].getTypeName());
paramList.add(docParam);
}
}
}
} catch (Exception e) {
e.printStackTrace();
return null;
}
DubboDocInfo dubboDocInfo = new DubboDocInfo();
dubboDocInfo.setParams(paramList);
dubboDocInfo.setResultType(resultType);
return dubboDocInfo;
}
private String toRootDir() {
if (Objects.isNull(root)) {
return Constants.PATH_SEPARATOR;
}
if (Objects.equals(Constants.PATH_SEPARATOR, root)) {
return root;
}
return root + Constants.PATH_SEPARATOR;
}
private String getNodePath(String serviceInterface, String version, String group, String application) {
MetadataIdentifier metadataIdentifier = new MetadataIdentifier(serviceInterface, version, group, Constants.PROVIDER_SIDE, application);
return toRootDir() + metadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.PATH) + Constants.PATH_SEPARATOR + METADATA_NODE_NAME;
}
}

View File

@@ -1,62 +0,0 @@
一些地址:
http://127.0.0.1:8082/zyplayer-doc-manage/zyplayer-doc-dubbo/doc-dubbo/getList
http://127.0.0.1.56:8848/nacos/index.html
zookeeper 格式:
路劲ls /dubbo/com.zyplayer.dubbo.service.UserService/providers
格式:
dubbo://127.0.0.1:22223/com.zyplayer.dubbo.service.UserService
?anyhost=true
&application=dubbo-provider
&bean.name=ServiceBean:com.zyplayer.dubbo.service.UserService
&dubbo=2.0.2
&generic=false
&interface=com.zyplayer.dubbo.service.UserService
&methods=getUserDetail,getUserList
&pid=36580
&side=provider
&timestamp=1549955979708
nacos 格式:
文档https://nacos.io/zh-cn/docs/open-API.html
请求地址http://127.0.0.1:8848/nacos/v1/ns/instance/list?serviceName=providers:com.zyplayer.dubbo.service.UserService
格式:
{
"metadata": {},
"dom": "providers:com.zyplayer.dubbo.service.UserService",
"cacheMillis": 10000,
"useSpecifiedURL": false,
"hosts": [{
"valid": true,
"marked": false,
"metadata": {
"side": "provider",
"protocol": "dubbo",
"application": "dubbo-provider",
"methods": "getUserDetail,getUserList",
"dubbo": "2.0.2",
"pid": "8164",
"interface": "com.zyplayer.dubbo.service.UserService",
"category": "providers",
"generic": "false",
"anyhost": "true",
"bean.name": "ServiceBean:com.zyplayer.dubbo.service.UserService",
"timestamp": "1549953970871"
},
"instanceId": "127.0.0.1#22223#DEFAULT#providers:com.zyplayer.dubbo.service.UserService",
"port": 22223,
"ip": "127.0.0.1",
"clusterName": "DEFAULT",
"weight": 1.0,
"serviceName": "providers:com.zyplayer.dubbo.service.UserService",
"enabled": true
}],
"checksum": "2489ae2874f2f490caf7d6195192d6c71549955797122",
"lastRefTime": 1549955797122,
"env": "",
"clusters": ""
}

File diff suppressed because one or more lines are too long

View File

@@ -1 +0,0 @@
.about-zyplayer-doc{text-align:left;line-height:normal}.about-zyplayer-doc .el-dialog__body{padding:20px}.header-right-user-name{color:#fff;padding-right:5px}.el-menu-vertical{border-right:0}.el-menu-vertical,.el-menu-vertical .el-menu{background:#fafafa}.el-header{background-color:#409eff;color:#333;line-height:40px;text-align:right;height:40px!important}body,html{margin:0;padding:0}#app,.el-container,.el-menu,body,html{height:100%}.el-menu{-webkit-box-sizing:border-box;box-sizing:border-box;border-right:0}.el-menu,.el-tree{margin-right:3px}.el-tree-node__content{padding-right:20px}.el-header{background-color:#1d4e89!important}.el-button-group>.el-button:first-child{padding:0!important;border:0}.login-container{border-radius:5px;-moz-border-radius:5px;background-clip:padding-box;margin:0 auto;width:350px;padding:35px 35px 15px 35px;background:#fff;border:1px solid #eaeaea;-webkit-box-shadow:0 0 25px #cac6c6;box-shadow:0 0 25px #cac6c6}.title{margin:0 auto 40px auto;text-align:center;color:#505458}.remember{margin:0 0 35px 0}.my-info-vue .box-card{margin:10px}.dubbo-doc-view{padding:0 10px}.dubbo-doc-view .el-tabs--border-card>.el-tabs__content{height:calc(100vh - 180px);overflow-y:auto}.dubbo-doc-view .request-result pre{margin:0}

View File

@@ -1 +0,0 @@
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=favicon-dubbo.png><title>DUBBO文档管理</title><link href=css/chunk-vendors.7be40bfc.css rel=preload as=style><link href=css/index.54c7a141.css rel=preload as=style><link href=js/chunk-vendors.3d65a5e1.js rel=preload as=script><link href=js/index.b5ddc7bd.js rel=preload as=script><link href=css/chunk-vendors.7be40bfc.css rel=stylesheet><link href=css/index.54c7a141.css rel=stylesheet></head><body><noscript><strong>We're sorry but zyplayer-dubbo-ui doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=js/chunk-vendors.3d65a5e1.js></script><script src=js/index.b5ddc7bd.js></script></body></html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -6,7 +6,7 @@
<packaging>war</packaging> <packaging>war</packaging>
<name>zyplayer-doc-manage</name> <name>zyplayer-doc-manage</name>
<description>定位为所有文档的管理项目API接口文档、dubbo文档、数据库文档、、、、等</description> <description>定位为所有文档的管理项目API接口文档、数据库文档、、、、等</description>
<parent> <parent>
<groupId>com.zyplayer</groupId> <groupId>com.zyplayer</groupId>
@@ -45,10 +45,6 @@
<groupId>com.zyplayer</groupId> <groupId>com.zyplayer</groupId>
<artifactId>zyplayer-doc-db</artifactId> <artifactId>zyplayer-doc-db</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.zyplayer</groupId>
<artifactId>zyplayer-doc-dubbo</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.zyplayer</groupId> <groupId>com.zyplayer</groupId>
<artifactId>zyplayer-doc-wiki</artifactId> <artifactId>zyplayer-doc-wiki</artifactId>

Some files were not shown because too many files have changed in this diff Show More