Compare commits
154 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7edfe5aa8 | ||
|
|
9a60cfe6e3 | ||
|
|
0821d59437 | ||
|
|
aaf3c811a8 | ||
|
|
8b81f78b29 | ||
|
|
e2a8c46afb | ||
|
|
c176bd7577 | ||
|
|
ab92d6958b | ||
|
|
bca4ba34e1 | ||
|
|
52a01581d4 | ||
|
|
9dfb8f9ac6 | ||
|
|
a2553097bd | ||
|
|
6eda8f48c7 | ||
|
|
1c747054bb | ||
|
|
189e96ff42 | ||
|
|
928c79b747 | ||
|
|
ffa6d669ba | ||
|
|
f86ad19afd | ||
|
|
52dce6338f | ||
|
|
22a73b445a | ||
|
|
af645464e4 | ||
|
|
66a6378056 | ||
|
|
865c14d95b | ||
|
|
f587f7c54b | ||
|
|
91aef6f9f4 | ||
|
|
4408525b45 | ||
|
|
aae8a9994a | ||
|
|
f9fb9c2f70 | ||
|
|
b32c9a8f9e | ||
|
|
80d525b735 | ||
|
|
b432e9fa17 | ||
|
|
ce84b4fee9 | ||
|
|
08df1de2e6 | ||
|
|
085b76f4b4 | ||
|
|
5bdf1ec0c6 | ||
|
|
157d06bf8d | ||
|
|
1ba75d3e29 | ||
|
|
4254f73603 | ||
|
|
cabc693119 | ||
|
|
265ad08d3e | ||
|
|
92ac2261be | ||
|
|
8c6314de27 | ||
|
|
2f1770dcbc | ||
|
|
339a29e739 | ||
|
|
4487c138b2 | ||
|
|
e99fe3bf65 | ||
|
|
42ad4916a0 | ||
|
|
e07cef459d | ||
|
|
95f0e26f82 | ||
|
|
d3ed4e8334 | ||
|
|
7b4c1ae455 | ||
|
|
9fcdfb7758 | ||
|
|
c8f570fa6a | ||
|
|
59ecaf4477 | ||
|
|
3a695ebd1a | ||
|
|
395090e958 | ||
|
|
1d999710bb | ||
|
|
2632fbe1e4 | ||
|
|
7e57dbaade | ||
|
|
5cb267fba6 | ||
|
|
9267aed477 | ||
|
|
28bcbfd379 | ||
|
|
59764b69b8 | ||
|
|
b82f6ae2e0 | ||
|
|
27c0d8e50a | ||
|
|
04b4794f92 | ||
|
|
3b2abbf19f | ||
|
|
fa725edd90 | ||
|
|
c05bc7be80 | ||
|
|
74d5de9c7f | ||
|
|
1dece8845d | ||
|
|
51f74f60c3 | ||
|
|
83ca189598 | ||
|
|
862d637075 | ||
|
|
7942262eef | ||
|
|
783de18e50 | ||
|
|
3e673c14b7 | ||
|
|
1d5c57d516 | ||
|
|
eda81c36bc | ||
|
|
3d774f43bb | ||
|
|
e509431340 | ||
|
|
77ff6722ab | ||
|
|
ddbadcd1e8 | ||
|
|
03dff7620e | ||
|
|
6da66fac7c | ||
|
|
5abe56caad | ||
|
|
a30d9318da | ||
|
|
da9146f75f | ||
|
|
01ab1d6079 | ||
|
|
1d5e0e2bf1 | ||
|
|
dcbb2b4ac8 | ||
|
|
b1fefdeba7 | ||
|
|
694f847f1d | ||
|
|
9e3f479b3e | ||
|
|
40a3db911d | ||
|
|
50a1f794c2 | ||
|
|
089fab958d | ||
|
|
c56613bc63 | ||
|
|
206f410573 | ||
|
|
9992ca9183 | ||
|
|
8fa04b9973 | ||
|
|
dcf487d55c | ||
|
|
477fef11d3 | ||
|
|
ff5434a173 | ||
|
|
da5e0e5017 | ||
|
|
09d6ccca57 | ||
|
|
2fab0d6a80 | ||
|
|
4dec5b73f4 | ||
|
|
58976dc829 | ||
|
|
744e877309 | ||
|
|
f270a9bb12 | ||
|
|
e0e59cc82e | ||
|
|
a153809649 | ||
|
|
13d6f3ca8b | ||
|
|
8a3f40c394 | ||
|
|
b252eeb33b | ||
|
|
91e7b0eb33 | ||
|
|
7c8a1e7ebc | ||
|
|
0f72acc973 | ||
|
|
e66586c765 | ||
|
|
e949570c1a | ||
|
|
6cb2d76bfb | ||
|
|
2dfb089665 | ||
|
|
911410027d | ||
|
|
861762e005 | ||
|
|
8b106c4588 | ||
|
|
8767acf080 | ||
|
|
3fbc7e5b38 | ||
|
|
b7654611c7 | ||
|
|
64572e52ef | ||
|
|
bd2d08c9ff | ||
|
|
b8a1c8554e | ||
|
|
2e37d4db44 | ||
|
|
a5fcdea2fa | ||
|
|
dfb1e62074 | ||
|
|
d1918b14e2 | ||
|
|
7285947cb3 | ||
|
|
95ec165d49 | ||
|
|
e0289aa247 | ||
|
|
ccf4196f0e | ||
|
|
3048d203ff | ||
|
|
cec0e2d5c8 | ||
|
|
38b04972b6 | ||
|
|
974793cdff | ||
|
|
b05c2158de | ||
|
|
7405d3d711 | ||
|
|
23461e7337 | ||
|
|
d0fa28eebe | ||
|
|
08bdaabcf5 | ||
|
|
f602ccf2a4 | ||
|
|
942b25e9ce | ||
|
|
a01699bd12 | ||
|
|
5cd766762a | ||
|
|
85bbfd1233 |
66
.gitignore
vendored
66
.gitignore
vendored
@@ -1,5 +1,63 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
.idea
|
||||
*.iml
|
||||
|
||||
tmlog*.lck
|
||||
tmlog*.log
|
||||
dependency-reduced-pom.xml
|
||||
|
||||
/dist
|
||||
|
||||
######################################################################
|
||||
# Build Tools
|
||||
|
||||
.gradle
|
||||
/build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
######################################################################
|
||||
# IDE
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
nbproject/private/
|
||||
build/*
|
||||
nbbuild/
|
||||
zyplayer-doc-ui/dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
######################################################################
|
||||
# Others
|
||||
*.log
|
||||
*.xml.versionsBackup
|
||||
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
# rebel
|
||||
rebel.xml
|
||||
|
||||
### gradle构建 ###
|
||||
*.gradle
|
||||
|
||||
### office ###
|
||||
# 忽略office文件打开临时文件 #
|
||||
[~$]*.*
|
||||
tmlog.lck
|
||||
|
||||
114
README.md
114
README.md
@@ -1,56 +1,100 @@
|
||||
# zyplayer-doc
|
||||
|
||||
#### 项目介绍
|
||||
zyplayer-doc是一款在线文档工具,现有swagger 文档、dubbo文档、数据库文档、WIKI文档、ElasticSearch文档等,管理端具有人员管理、权限管理功能等功能。项目后端使用spring-boot、mybatis-plus等框架,前端使用zui、Vue、element-ui等框架。为开发者服务,欢迎有想法的一起来写,给个Star鼓励下呗!(您的一个Star是快速迭代的动力源泉!)
|
||||
# 项目介绍
|
||||
zyplayer-doc是一款前后端完全开源的在线文档工具,现有API接口文档(Swagger、OpenApi、自建接口)、WIKI文档、数据库文档(数据库表结构查看管理、SQL执行)、Dubbo文档。
|
||||
|
||||
体验地址:[http://doc.zyplayer.com](http://doc.zyplayer.com/zyplayer-doc-manage/) 账号:zyplayer 密码:123456
|
||||
|
||||
各模块的详细使用文档地址,可参考:
|
||||
[详细部署文档](http://doc.zyplayer.com/zyplayer-doc-manage/doc-wiki#/page/share/view?pageId=1&space=23f3f59a60824d21af9f7c3bbc9bc3cb)
|
||||
|
||||
欢迎有想法的一起来完善,如果觉得不错就给个Star鼓励下呗!作为给作者快速更新的动力!
|
||||
|
||||
欢迎加群讨论,QQ群号:466363173
|
||||
|
||||
体验地址:[http://doc.zyplayer.com](http://doc.zyplayer.com/zyplayer-doc-manage/) 需登录 账号:zyplayer 密码:123456 (未运行dubbo服务,不能体验dubbo文档调试)
|
||||
# 快速启动
|
||||
## 数据库依赖
|
||||
你得有一个MySQL数据库,建议版本号为:5.7.25,建库:zyplayer_doc_manage,再执行脚本建表:[全量建表语句.sql](https://gitee.com/zyplayer/zyplayer-doc/blob/master/zyplayer-doc-manage/src/main/resources/sql/全量建表语句.sql)
|
||||
|
||||
各模块的详细使用文档地址,部署必看:
|
||||
[http://doc.zyplayer.com/zyplayer-doc-manage/doc-wiki#/page/share/view?pageId=1&space=23f3f59a60824d21af9f7c3bbc9bc3cb](http://doc.zyplayer.com/zyplayer-doc-manage/doc-wiki#/page/share/view?pageId=1&space=23f3f59a60824d21af9f7c3bbc9bc3cb)
|
||||
## main方法启动
|
||||
1. 修改 zyplayer-doc/zyplayer-doc-manage/src/main/resources/application.yml 配置文件里面的数据库账号密码
|
||||
2. 执行 com.zyplayer.doc.manage.Application.main 方法启动项目,启动后访问:http://127.0.0.1:8083/zyplayer-doc-manage/
|
||||
|
||||
## jar方式启动
|
||||
1. 直接下载:直接下载编译好的jar打包文件,下载地址:https://pan.baidu.com/s/1yMmnle01XR4TDjo2hfvw-Q 提取码: 3adf,下载最新版后解压
|
||||
2. 自行编译:也可以自己动手编译,双击执行:zyplayer-doc\build.bat,将使用maven编译整个项目为可执行的jar文件,编译结果文件放在:zyplayer-doc\dist\version 文件夹下,如果电脑没有安装maven则需要先安装
|
||||
3. 修改第一步或第二步结果文件夹下的 application.yml 文件里面数据库帐号密码
|
||||
4. 双击第一步或第二步结果文件夹下的 startup.bat 启动项目,启动后访问:http://127.0.0.1:8083/zyplayer-doc-manage/
|
||||
|
||||
#### 模块介绍
|
||||
##### 一、zyplayer-doc-core
|
||||
> 一些核心、公用的类
|
||||
## Tomcat容器启动
|
||||
1. 直接下载编译好的war打包文件,下载地址:https://pan.baidu.com/s/1yMmnle01XR4TDjo2hfvw-Q 提取码: 3adf,下载最新版后解压
|
||||
2. 修改配置文件:zyplayer-doc.zip\apache-tomcat\webapps\zyplayer-doc-manage\WEB-INF\classes\application.yml 配置文件里面的数据库账号密码
|
||||
3. 双击tomcat\bin\startup.bat启动即可
|
||||
|
||||
##### 二、zyplayer-doc-manage 可以单独部署的文档管理后台
|
||||
> 集成了本项目内的各子模块,具有人员及权限管理功能,是各模块的协调模块
|
||||
默认登录账号:zyplayer 密码:123456
|
||||
|
||||
##### 三、zyplayer-doc-db 数据库文档
|
||||
> 支持MySQL、SQLServer、Oracle数据源,支持数据库表、字段文档查看修改,表文档导出,SQL执行、表数据预览、不同数据库之间的数据互导,支持多数据源管理。支持按人员、按数据源对用户授权,可给用户 库表注释查看、注释修改、SQL执行 粒度的授权。目标是取代Navicat,做一个开源免费的在线数据库管理工具。
|
||||
# 各模块介绍
|
||||
## zyplayer-doc-manage 文档管理后台
|
||||
1. 具有项目模块导航,人员及权限管理功能,分组管理等功能。
|
||||
2. 集成了本项目内的各个子模块功能,是各模块的协调管理模块。
|
||||
|
||||
##### 四、zyplayer-doc-wiki wiki文档工具
|
||||
> 在线管理公司、项目及任意形式的文档,文档支持按空间划分,在线编辑查看,支持附件上传下载,支持评论、点赞及权限设置等。参考学习了Atlassian Confluence文档工具进行开发,争取作为该软件的开源免费替代产品,同时作为内部文档管理工具最好的存在。
|
||||
## zyplayer-doc-db 数据库文档
|
||||
一款在线管理数据库的工具,你可以将所有的数据源统一管理到这里面,团队间的各成员就不必每人在自己电脑上装一个数据库管理软件,
|
||||
然后再添加数据源,可以统一修改数据库账号密码而不用群广播通知,新员工进入后对他使用到的数据源进行授权即可使用。
|
||||
|
||||
##### 五、zyplayer-doc-swagger,swagger的UI及整套解决方案
|
||||
> 支持swagger的文档展示,接口调试,文档导出等,解析速度快,界面设计走心。支持将所有的swagger文档进行统一管理,支持全局参数设置,请求参数缓存,下次自动填充等。目标是解决swagger官方文档查看及接口调试不方便的问题。
|
||||
1. 支持MySQL、Doris(MySQL协议)、SQLServer、Oracle、PostgreSQL、Hive、Impala数据源。
|
||||
2. 支持数据库表、字段文档查看修改,表文档导出、建表语句DDL导出、表数据导出。
|
||||
3. 支持SQL执行、表数据预览、不同数据库之间的数据互导,支持多数据源管理。
|
||||
4. 支持按人员、按数据源对用户授权,可给用户 库表注释查看、注释修改、SQL执行、函数修改等粒度的授权。
|
||||
5. 支持库函数和存储过程的增删改查,修改记录查询等。
|
||||
6. 目标是取代Navicat,做一个小而精的开源免费的在线数据库管理工具。
|
||||
|
||||
##### 六、zyplayer-doc-dubbo 将dubbo的文档在线化管理
|
||||
> 支持zookeeper、nacos的注册中心文档获取,支持在线调试接口
|
||||
## zyplayer-doc-wiki wiki文档工具
|
||||
1. 在线管理公司、项目及任意形式的文档
|
||||
2. 文档支持按空间划分,按人员分组授权,支持空间收藏和空间内的文档开放访问。
|
||||
3. 文档支持编辑、查看、评论、上传附件、历史版本查看、页面权限控制、文档搜索等功能。
|
||||
4. 文档编辑支持html富文本方式编辑和markdown的方式编辑。
|
||||
5. 本工具使用的开源工具有:vue、element-ui、mavon-editor、wangeditor等。
|
||||
6. 参考学习了Atlassian Confluence文档工具进行开发,争取作为该软件的开源免费替代产品,同时作为内部文档管理工具最好的存在。
|
||||
|
||||
##### 七、zyplayer-doc-grpc grpc文档工具
|
||||
> 用比较变态的方式实现了grpc的文档和在线调试功能,通过http的方式来请求grpc的接口
|
||||
## zyplayer-doc-api API接口文档管理工具
|
||||
一款支持统一管理Swagger文档、OpenApi文档、自建接口文档的管理工具,具有文档查看、接口请求、全局参数管理等功能,设计走心,前端代码使用最新技术构建,每一行代码都是全新手动敲出来的,超级简单明了,代码简洁美观可读性好、易维护。
|
||||
|
||||
> 默认未开启此功能,如需使用需要在zyplayer-doc-manage项目中开启@EnableDocGrpc注解
|
||||
1. 支持Swagger的文档展示,接口调试,解析速度快,界面设计走心。
|
||||
2. 支持将所有的Swagger文档、OpenApi文档、自建接口文档进行统一管理,支持全局参数设置,请求参数缓存,下次自动填充等。
|
||||
3. 目标是实现一个平台解决所有项目的接口文档统一管理。
|
||||
|
||||
##### 八、zyplayer-doc-es ElasticSearch文档工具
|
||||
> 支持ElasticSearch的文档查看和执行DSL查询的功能
|
||||
## zyplayer-doc-dubbo 将dubbo的文档在线化管理
|
||||
1. 支持zookeeper、nacos的注册中心文档获取,支持在线调试接口
|
||||
|
||||
##### 九、zyplayer-doc-ui
|
||||
> 前面各模块的前端UI源码
|
||||
## 其他
|
||||
1. zyplayer-doc-ui 前面各模块的前端UI源码
|
||||
2. zyplayer-doc-core 一些核心、公用的类
|
||||
3. zyplayer-doc-data 数据库层面的交互
|
||||
4. zyplayer-doc-grpc grpc文档工具
|
||||
5. zyplayer-doc-other 一些测试
|
||||
|
||||
#### 运行方式
|
||||
# 用爱发电
|
||||
如果您正在使用这个项目并感觉良好,或者是想支持我继续开发,您可以通过如下`任意`方式支持我:
|
||||
1. Star并分享 [zyplayer-doc](https://gitee.com/zyplayer/zyplayer-doc)
|
||||
2. 保留`关于页面`的项目链接
|
||||
3. 通过[一次性捐赠](http://doc.zyplayer.com/zyplayer-doc-manage/doc-wiki#/page/share/view?pageId=359&space=23f3f59a60824d21af9f7c3bbc9bc3cb) 支持,我会去买一杯咖啡或攒着去植发
|
||||
|
||||
1. 创建数据库:zyplayer_doc_manage,执行脚本:[zyplayer_doc_manage.1.0.6.sql](https://gitee.com/zyplayer/zyplayer-doc/blob/master/zyplayer-doc-manage/src/main/resources/sql/zyplayer_doc_manage.1.0.6.sql)
|
||||
|
||||
2. 修改zyplayer-doc-manage项目的application.yml配置文件里面的数据库账号密码
|
||||
|
||||
3. 启动zyplayer-doc-manage项目,访问地址:http://127.0.0.1:8083/zyplayer-doc-manage/
|
||||
|
||||
更多详细的使用部署文档:http://doc.zyplayer.com/zyplayer-doc-manage/doc-wiki#/page/share/view?pageId=1&space=23f3f59a60824d21af9f7c3bbc9bc3cb
|
||||
|
||||
#### 界面展示
|
||||
# 界面展示
|
||||
控制台页面
|
||||

|
||||
|
||||
数据库文档页面
|
||||

|
||||
|
||||
WIKI文档页面
|
||||

|
||||
|
||||
API文档主页面
|
||||

|
||||
|
||||
API文档查看页面
|
||||

|
||||
|
||||
API文档在线调试页面
|
||||

|
||||
|
||||
26
build.bat
Normal file
26
build.bat
Normal file
@@ -0,0 +1,26 @@
|
||||
@echo off
|
||||
|
||||
set dist_dir=dist
|
||||
|
||||
set app_name=zyplayer-doc
|
||||
|
||||
set version="1.1.0"
|
||||
|
||||
set build_folder=%app_name%-%version%
|
||||
|
||||
set target_dir=%dist_dir%\%build_folder%
|
||||
|
||||
call mvn clean package -Dmaven.test.skip=true
|
||||
|
||||
::copy files
|
||||
|
||||
rd /q /s %target_dir%
|
||||
|
||||
md %target_dir%
|
||||
|
||||
copy zyplayer-doc-manage\target\zyplayer-doc-manage.jar %target_dir%
|
||||
copy zyplayer-doc-manage\src\main\resources\application.yml %target_dir%
|
||||
|
||||
xcopy /e /y /q zyplayer-doc-other\script %target_dir%
|
||||
|
||||
pause
|
||||
30
build.sh
Normal file
30
build.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/bin/sh
|
||||
|
||||
dist_dir="dist"
|
||||
|
||||
app_name="zyplayer-doc"
|
||||
|
||||
version="1.1.0"
|
||||
|
||||
build_folder="${app_name}-${version}"
|
||||
|
||||
# 输出目录
|
||||
target_dir="$dist_dir/${build_folder}"
|
||||
|
||||
echo "开始构建服务端..."
|
||||
|
||||
mvn clean package -Dmaven.test.skip=true
|
||||
|
||||
# 复制文件
|
||||
if [ ! -d "$target_dir" ]; then
|
||||
mkdir -p $target_dir
|
||||
fi
|
||||
|
||||
rm -rf $target_dir/*
|
||||
|
||||
# 复制服务端资源
|
||||
cp -r zyplayer-doc-manage/target/zyplayer-doc-manage.jar $target_dir
|
||||
cp -r zyplayer-doc-manage/src/main/resources/application.yml $target_dir
|
||||
cp -r zyplayer-doc-other/script/* $target_dir
|
||||
|
||||
echo "服务端构建完毕,构建结果在${target_dir}文件夹下"
|
||||
208
pom.xml
208
pom.xml
@@ -4,30 +4,218 @@
|
||||
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.0.6</version>
|
||||
<version>1.1.0</version>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<name>zyplayer-doc</name>
|
||||
<description>定位为所有文档的管理项目,swagger文档、数据库文档、、、、等</description>
|
||||
<description>定位为所有文档的管理项目,swagger文档、数据库文档、WIKI文档、Dubbo文档等</description>
|
||||
|
||||
<properties>
|
||||
<skipTests>true</skipTests>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<fastjson.version>1.2.53</fastjson.version>
|
||||
<elasticsearch.version>7.2.0</elasticsearch.version>
|
||||
<zyplayer.doc.version>1.1.0</zyplayer.doc.version>
|
||||
<spring.boot.version>2.1.6.RELEASE</spring.boot.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>zyplayer-doc-db</module>
|
||||
<module>zyplayer-doc-manage</module>
|
||||
<module>zyplayer-doc-swagger</module>
|
||||
<module>zyplayer-doc-core</module>
|
||||
<module>zyplayer-doc-dubbo</module>
|
||||
<module>zyplayer-doc-db</module>
|
||||
<module>zyplayer-doc-api</module>
|
||||
<module>zyplayer-doc-wiki</module>
|
||||
<module>zyplayer-doc-dubbo</module>
|
||||
<module>zyplayer-doc-core</module>
|
||||
<module>zyplayer-doc-data</module>
|
||||
<module>zyplayer-doc-grpc</module>
|
||||
<module>zyplayer-doc-other</module>
|
||||
<module>zyplayer-doc-es</module>
|
||||
</modules>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-ldap</artifactId>
|
||||
<version>${spring.boot.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.47</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jtds</groupId>
|
||||
<artifactId>jtds</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>12.1.0.1-atlassian-hosted</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jgit</groupId>
|
||||
<artifactId>org.eclipse.jgit</artifactId>
|
||||
<version>5.8.1.202007141445-r</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.curator</groupId>
|
||||
<artifactId>curator-recipes</artifactId>
|
||||
<version>2.12.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.dubbo</groupId>
|
||||
<artifactId>dubbo</artifactId>
|
||||
<version>2.7.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.5.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>2.1.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.dozermapper</groupId>
|
||||
<artifactId>dozer-core</artifactId>
|
||||
<version>6.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.4.3.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>1.2.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
<version>2.3.28</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>2.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.78</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.6.6</version>
|
||||
</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>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-core</artifactId>
|
||||
<version>3.4.3.2</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-annotation</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-data</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-db</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-dubbo</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-api</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-wiki</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
</project>
|
||||
|
||||
@@ -1,15 +1,24 @@
|
||||
# update
|
||||
# 本文件用于已部署好的系统检测自己是否需要升级使用,怕有人担心安全一类的问题,所以不提供服务器接口来做
|
||||
lastVersion=1.0.6
|
||||
upgradeContent=1、数据库工具增加数据源时支持测试数据源,优化展示细节,特殊情况下页面卡死等问题;\
|
||||
2、数据库工具改为使用vue-cli打包,修改所有的请求方式,代码更加规范化;\
|
||||
3、数据库文档增加Word导出支持 #I1QU0R;\
|
||||
4、WIKI文档工具前端重构,代码更加规范化,优化查看编辑页展示及URL参数,无权限时不展示对应操作按钮;\
|
||||
5、WIKI文档工具增加删除评论功能 #I1KMTP;\
|
||||
6、WIKI文档工具开放地址首页展示优化 #I1KQUK;\
|
||||
7、WIKI文档工具重构开放文档页面,集成到同一项目内;\
|
||||
8、WIKI文档工具增加Markdown格式编辑方式和查看,增加快速打开开放文档地址;\
|
||||
9、WIKI文档工具增加消息提醒功能,增强文档互动的感知;
|
||||
upgradeUrl=https://gitee.com/zyplayer/zyplayer-doc/releases
|
||||
nextStep=1、WIKI文档优化
|
||||
lastVersion=1.1.0
|
||||
|
||||
upgradeContent=数据库模块:;\
|
||||
1、增加hive和impala数据源支持,可查看表结构、执行SQL查询数据;\
|
||||
2、框架优化,数据查询和层级更合理;\
|
||||
3、数据查看优化,执行器支持复制为insert、update、json格式;\
|
||||
4、数据库表数据导出支持,支持导出为为insert、update、json格式,可使用单个文件导出或zip压缩文件导出;\
|
||||
5、增加表关系图(简版,找到更好的ER图组件再替换);\
|
||||
6、将表字段、表结构、表关系图、表数据查看页面合并到一个页面,更加便于使用;\
|
||||
7、sqlserver数据库查询加强,数据查询、库表信息、数据导出等全功能支持;\
|
||||
8、优化SQL编辑器引入方式,优化自动提示,优化sqlserver表、字段注释获取和更新方式,数据查询时改为需指定数据库,便于库表检索提示;\
|
||||
9、SQL编辑器自动提示库、表、列逻辑优化,更加好用;\
|
||||
10、sql执行增加动态参数功能,SQL中可使用${xx}或#{xx}动态参数;\
|
||||
11、数据预览列表头移上去展示列说明;\
|
||||
12、自动打包至各模块的文件夹内,不再拷贝打包后的文件;\
|
||||
13、优化关于页面和项目升级提示;\
|
||||
wiki模块:;\
|
||||
1、wiki模块使用vant移动端框架支持手机端文档查看适配 #I2BC14;\
|
||||
2、wiki查看页面优化;
|
||||
|
||||
upgradeUrl=https://gitee.com/zyplayer/zyplayer-doc/releases
|
||||
nextStep=
|
||||
|
||||
|
||||
92
zyplayer-doc-api/pom.xml
Normal file
92
zyplayer-doc-api/pom.xml
Normal file
@@ -0,0 +1,92 @@
|
||||
<?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-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>zyplayer-doc-api</name>
|
||||
<description>zyplayer-doc-api是一款接口文档管理系统</description>
|
||||
<url>https://gitee.com/zyplayer/zyplayer-doc/zyplayer-doc</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.0</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<!-- 打包跳过单元测试 -->
|
||||
<skipTests>true</skipTests>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-data</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>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,130 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.zyplayer.doc.api.controller.vo.DocUserAuthVo;
|
||||
import com.zyplayer.doc.api.service.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.*;
|
||||
import com.zyplayer.doc.data.repository.support.consts.ApiAuthType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysModuleType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysType;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import com.zyplayer.doc.data.service.manage.AuthInfoService;
|
||||
import com.zyplayer.doc.data.service.manage.UserAuthService;
|
||||
import com.zyplayer.doc.data.service.manage.UserInfoService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* api权限控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年12月12日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/doc/auth")
|
||||
public class ApiDocAuthController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiDocAuthController.class);
|
||||
|
||||
@Resource
|
||||
UserAuthService userAuthService;
|
||||
@Resource
|
||||
AuthInfoService authInfoService;
|
||||
@Resource
|
||||
UserInfoService userInfoService;
|
||||
@Resource
|
||||
ApiDocService apiDocService;
|
||||
@Resource
|
||||
ApiDocAuthJudgeService apiDocAuthJudgeService;
|
||||
|
||||
@PostMapping("/list")
|
||||
public ResponseJson<Object> list(Long docId) {
|
||||
if (!apiDocAuthJudgeService.haveManageAuth(docId)) {
|
||||
return DocResponseJson.warn("没有此文档的操作权限");
|
||||
}
|
||||
List<UserAuth> authList = userAuthService.getModuleAuthList(DocSysType.API.getType(), DocSysModuleType.Api.DOC.getType(), docId);
|
||||
if (CollectionUtils.isEmpty(authList)) {
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
// 权限ID对应的权限名
|
||||
Collection<AuthInfo> authInfoList = authInfoService.listByIds(authList.stream().map(UserAuth::getAuthId).collect(Collectors.toSet()));
|
||||
Map<Long, String> authInfoMap = authInfoList.stream().collect(Collectors.toMap(AuthInfo::getId, AuthInfo::getAuthName));
|
||||
Collection<UserInfo> userInfoList = userInfoService.listByIds(authList.stream().map(UserAuth::getUserId).collect(Collectors.toSet()));
|
||||
Map<Long, UserInfo> userInfoMap = userInfoList.stream().collect(Collectors.toMap(UserInfo::getId, val -> val));
|
||||
// 返回结果组装
|
||||
List<DocUserAuthVo> authVoList = new LinkedList<>();
|
||||
for (UserAuth userAuth : authList) {
|
||||
UserInfo userInfo = userInfoMap.get(userAuth.getUserId());
|
||||
String authCode = authInfoMap.get(userAuth.getAuthId());
|
||||
DocUserAuthVo authVo = new DocUserAuthVo();
|
||||
authVo.setAuthType(ApiAuthType.typeOf(authCode).getType());
|
||||
authVo.setUserId(userAuth.getUserId());
|
||||
authVo.setUserNo(userInfo.getUserNo());
|
||||
authVo.setUserName(userInfo.getUserName());
|
||||
authVo.setEmail(userInfo.getEmail());
|
||||
authVo.setPhone(userInfo.getPhone());
|
||||
authVo.setSex(userInfo.getSex());
|
||||
authVoList.add(authVo);
|
||||
}
|
||||
return DocResponseJson.ok(authVoList);
|
||||
}
|
||||
|
||||
@PostMapping("/assign")
|
||||
public ResponseJson<Object> assign(Long docId, Long userId, Integer authType) {
|
||||
if (!apiDocAuthJudgeService.haveManageAuth(docId)) {
|
||||
return DocResponseJson.warn("没有此文档的操作权限");
|
||||
}
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
String authCode = ApiAuthType.typeOf(authType).getCode();
|
||||
AuthInfo authInfo = authInfoService.getByCode(authCode);
|
||||
List<UserAuth> userModuleAuthList = userAuthService.getUserModuleAuthList(userId, DocSysType.API.getType(), DocSysModuleType.Api.DOC.getType(), docId);
|
||||
if (CollectionUtils.isNotEmpty(userModuleAuthList)) {
|
||||
UserAuth userAuth = userModuleAuthList.remove(0);
|
||||
// 错误数据兼容移除
|
||||
if (userModuleAuthList.size() > 0) {
|
||||
List<Long> authIdList = userModuleAuthList.stream().map(UserAuth::getId).collect(Collectors.toList());
|
||||
userAuthService.removeByIds(authIdList);
|
||||
}
|
||||
userAuth.setAuthId(authInfo.getId());
|
||||
userAuth.setUpdateTime(new Date());
|
||||
userAuth.setUpdateUid(currentUser.getUserId());
|
||||
userAuthService.updateById(userAuth);
|
||||
} else {
|
||||
UserAuth userAuth = new UserAuth();
|
||||
userAuth.setUserId(userId);
|
||||
userAuth.setSysType(DocSysType.API.getType());
|
||||
userAuth.setSysModuleType(DocSysModuleType.Api.DOC.getType());
|
||||
userAuth.setSysModuleId(docId);
|
||||
userAuth.setAuthId(authInfo.getId());
|
||||
userAuth.setCreationTime(new Date());
|
||||
userAuth.setCreateUid(currentUser.getUserId());
|
||||
userAuth.setUpdateTime(new Date());
|
||||
userAuth.setUpdateUid(currentUser.getUserId());
|
||||
userAuth.setDelFlag(0);
|
||||
userAuthService.save(userAuth);
|
||||
}
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
public ResponseJson<Object> delete(Long docId, Long userId) {
|
||||
if (!apiDocAuthJudgeService.haveManageAuth(docId)) {
|
||||
return DocResponseJson.warn("没有此文档的操作权限");
|
||||
}
|
||||
userAuthService.deleteUserModuleAuth(userId, DocSysType.API.getType(), DocSysModuleType.Api.DOC.getType(), docId);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,219 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.zyplayer.doc.api.framework.utils.SwaggerDocUtil;
|
||||
import com.zyplayer.doc.api.service.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.api.service.SwaggerHttpRequestService;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.vo.ApiDocVo;
|
||||
import com.zyplayer.doc.data.repository.support.consts.ApiAuthType;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.swagger.web.SwaggerResource;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 文档控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/doc")
|
||||
public class ApiDocumentController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiDocumentController.class);
|
||||
|
||||
@Resource
|
||||
ApiDocAuthJudgeService apiDocAuthJudgeService;
|
||||
@Resource
|
||||
private ApiDocService apiDocService;
|
||||
@Resource
|
||||
private SwaggerHttpRequestService swaggerHttpRequestService;
|
||||
|
||||
/**
|
||||
* 获取所有的文档地址
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/list")
|
||||
public ResponseJson<List<ApiDocVo>> list(ApiDoc apiDoc, Integer pageNum, Integer pageSize) {
|
||||
IPage<ApiDocVo> docList = apiDocService.getApiDocList(apiDoc, pageNum, pageSize);
|
||||
return DocResponseJson.ok(docList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文档内容
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/detail")
|
||||
public ResponseJson<List<ApiDoc>> detail(Long id) {
|
||||
ApiDoc apiDoc = apiDocService.getById(id);
|
||||
if (!apiDocAuthJudgeService.haveDevelopAuth(apiDoc)) {
|
||||
return DocResponseJson.warn("没有此文档的查看权限");
|
||||
}
|
||||
ApiDocVo apiDocVo = new ApiDocVo();
|
||||
BeanUtil.copyProperties(apiDoc, apiDocVo);
|
||||
Integer authType = apiDocAuthJudgeService.haveManageAuth(apiDoc) ? ApiAuthType.MANAGE.getType() : ApiAuthType.DEVELOPER.getType();
|
||||
apiDocVo.setAuthType(authType);
|
||||
return DocResponseJson.ok(apiDocVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加文档
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/add")
|
||||
public ResponseJson<Object> add(HttpServletRequest request, ApiDoc apiDoc) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
apiDoc.setYn(1);
|
||||
apiDoc.setCreateTime(new Date());
|
||||
apiDoc.setCreateUserId(currentUser.getUserId());
|
||||
apiDoc.setCreateUserName(currentUser.getUsername());
|
||||
if (apiDoc.getId() == null) {
|
||||
apiDoc.setShareUuid(IdUtil.simpleUUID());
|
||||
} else {
|
||||
ApiDoc apiDocSel = apiDocService.getById(apiDoc.getId());
|
||||
if (apiDocSel == null) {
|
||||
return DocResponseJson.warn("未找到指定的文档记录信息");
|
||||
}
|
||||
if (!apiDocAuthJudgeService.haveManageAuth(apiDocSel)) {
|
||||
return DocResponseJson.warn("没有此文档的操作权限");
|
||||
}
|
||||
if (StringUtils.isBlank(apiDocSel.getShareUuid())) {
|
||||
apiDoc.setShareUuid(IdUtil.simpleUUID());
|
||||
}
|
||||
}
|
||||
// url类型
|
||||
if (Objects.equals(apiDoc.getDocType(), 1)) {
|
||||
// UI地址替换为文档json地址
|
||||
String docUrl = SwaggerDocUtil.replaceSwaggerResources(apiDoc.getDocUrl());
|
||||
if (SwaggerDocUtil.isSwaggerResources(docUrl)) {
|
||||
String swaggerDomain = SwaggerDocUtil.getSwaggerResourceDomain(docUrl);
|
||||
List<SwaggerResource> resourceList;
|
||||
try {
|
||||
String resourcesStr = swaggerHttpRequestService.requestSwaggerUrl(request, 0L, docUrl, swaggerDomain);
|
||||
resourceList = JSON.parseArray(resourcesStr, SwaggerResource.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return DocResponseJson.warn("解析文档地址失败:" + e.getMessage());
|
||||
}
|
||||
if (resourceList == null || resourceList.isEmpty()) {
|
||||
return DocResponseJson.warn("该地址未找到文档");
|
||||
}
|
||||
// 删除原有文档
|
||||
if (apiDoc.getId() != null) {
|
||||
apiDocService.removeById(apiDoc.getId());
|
||||
}
|
||||
// 存明细地址
|
||||
for (SwaggerResource resource : resourceList) {
|
||||
apiDoc.setId(null);
|
||||
apiDoc.setDocUrl(swaggerDomain + resource.getUrl());
|
||||
apiDoc.setName(resource.getName());
|
||||
apiDoc.setShareUuid(IdUtil.simpleUUID());
|
||||
apiDocService.save(apiDoc);
|
||||
}
|
||||
} else {
|
||||
apiDocService.saveOrUpdate(apiDoc);
|
||||
}
|
||||
} else if (Objects.equals(apiDoc.getDocType(), 2) || Objects.equals(apiDoc.getDocType(), 4)) {
|
||||
apiDocService.saveOrUpdate(apiDoc);
|
||||
} else {
|
||||
return DocResponseJson.warn("暂不支持的文档类型");
|
||||
}
|
||||
return DocResponseJson.ok(apiDoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改文档基本信息
|
||||
*
|
||||
* @return 无
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/update")
|
||||
public ResponseJson<List<ApiDoc>> update(ApiDoc apiDoc) {
|
||||
if (apiDoc.getId() == null) {
|
||||
return DocResponseJson.warn("请指定修改的记录ID");
|
||||
}
|
||||
// 基本信息可以改,删除需要管理员权限
|
||||
if (Objects.equals(apiDoc.getYn(), 0)) {
|
||||
if (!apiDocAuthJudgeService.haveManageAuth(apiDoc.getId())) {
|
||||
return DocResponseJson.warn("没有此文档的删除权限");
|
||||
}
|
||||
} else {
|
||||
if (!apiDocAuthJudgeService.haveDevelopAuth(apiDoc.getId())) {
|
||||
return DocResponseJson.warn("没有此文档的编辑权限");
|
||||
}
|
||||
}
|
||||
ApiDoc swaggerDocUp = new ApiDoc();
|
||||
swaggerDocUp.setId(apiDoc.getId());
|
||||
swaggerDocUp.setDocStatus(apiDoc.getDocStatus());
|
||||
swaggerDocUp.setShareInstruction(apiDoc.getShareInstruction());
|
||||
swaggerDocUp.setYn(apiDoc.getYn());
|
||||
apiDocService.updateById(swaggerDocUp);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
|
||||
@RequestMapping("/apis")
|
||||
public ResponseJson<List<ApiDoc>> resources() {
|
||||
List<ApiDoc> docList = apiDocService.getApiDocList();
|
||||
return DocResponseJson.ok(docList);
|
||||
}
|
||||
|
||||
@RequestMapping("/apis/detail")
|
||||
public ResponseJson<Object> detail(HttpServletRequest request, Long id) {
|
||||
ApiDoc apiDoc = apiDocService.getById(id);
|
||||
if (apiDoc == null) {
|
||||
return DocResponseJson.warn("文档不存在");
|
||||
}
|
||||
if (!apiDocAuthJudgeService.haveDevelopAuth(apiDoc)) {
|
||||
return DocResponseJson.warn("没有此文档的查看权限");
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 1)) {
|
||||
try {
|
||||
String docsDomain = SwaggerDocUtil.getV2ApiDocsDomain(apiDoc.getDocUrl());
|
||||
String contentStr = swaggerHttpRequestService.requestSwaggerUrl(request, apiDoc.getId(), apiDoc.getDocUrl(), docsDomain);
|
||||
return DocResponseJson.ok(contentStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return DocResponseJson.warn("请求文档失败");
|
||||
}
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 2) || Objects.equals(apiDoc.getDocType(), 4)) {
|
||||
return DocResponseJson.ok(apiDoc.getJsonContent());
|
||||
}
|
||||
return DocResponseJson.warn("暂不支持的文档类型");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.api.service.ApiDocAuthJudgeService;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiGlobalParam;
|
||||
import com.zyplayer.doc.data.service.manage.ApiGlobalParamService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 全局参数控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/global-param")
|
||||
public class ApiGlobalParamController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiGlobalParamController.class);
|
||||
|
||||
@Resource
|
||||
private ApiGlobalParamService apiGlobalParamService;
|
||||
@Resource
|
||||
ApiDocAuthJudgeService apiDocAuthJudgeService;
|
||||
|
||||
/**
|
||||
* 获取所有的全局参数
|
||||
*
|
||||
* @return 全局参数列表
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/list")
|
||||
public ResponseJson<List<ApiGlobalParam>> list(Long docId) {
|
||||
Long docIdNew = Optional.ofNullable(docId).orElse(0L);
|
||||
if (docIdNew > 0 && !apiDocAuthJudgeService.haveDevelopAuth(docIdNew)) {
|
||||
return DocResponseJson.warn("没有此文档的查看权限");
|
||||
}
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
QueryWrapper<ApiGlobalParam> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
queryWrapper.eq("doc_id", docIdNew);
|
||||
// 全局参数才按创建人来控制,文档的全局参数大家共用
|
||||
queryWrapper.eq(docIdNew == 0, "create_user_id", currentUser.getUserId());
|
||||
queryWrapper.orderByDesc("id");
|
||||
List<ApiGlobalParam> globalParamList = apiGlobalParamService.list(queryWrapper);
|
||||
return DocResponseJson.ok(globalParamList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改全局参数
|
||||
*
|
||||
* @return 无
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/update")
|
||||
public ResponseJson<List<ApiDoc>> update(ApiGlobalParam globalParam) {
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
globalParam.setDocId(Optional.ofNullable(globalParam.getDocId()).orElse(0L));
|
||||
// 新的文档ID是否有权限
|
||||
if (globalParam.getDocId() > 0 && !apiDocAuthJudgeService.haveDevelopAuth(globalParam.getDocId())) {
|
||||
return DocResponseJson.warn("没有此文档的查看权限");
|
||||
}
|
||||
if (globalParam.getId() == null) {
|
||||
globalParam.setYn(1);
|
||||
globalParam.setCreateTime(new Date());
|
||||
globalParam.setCreateUserId(currentUser.getUserId());
|
||||
globalParam.setCreateUserName(currentUser.getUsername());
|
||||
} else {
|
||||
ApiGlobalParam param = apiGlobalParamService.getById(globalParam.getId());
|
||||
if (param.getDocId() > 0) {
|
||||
// 已有的文档ID是否有权限
|
||||
if (!apiDocAuthJudgeService.haveDevelopAuth(param.getDocId())) {
|
||||
return DocResponseJson.warn("没有此文档的查看权限");
|
||||
}
|
||||
} else {
|
||||
if (!Objects.equals(param.getCreateUserId(), currentUser.getUserId())) {
|
||||
return DocResponseJson.warn("目标全局参数不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
QueryWrapper<ApiGlobalParam> wrapper = new QueryWrapper<>();
|
||||
wrapper.eq("yn", 1);
|
||||
wrapper.eq("param_key", globalParam.getParamKey());
|
||||
wrapper.eq("doc_id", globalParam.getDocId());
|
||||
// 全局参数才按创建人来控制,文档的全局参数大家共用
|
||||
wrapper.eq(globalParam.getDocId() == 0, "create_user_id", currentUser.getUserId());
|
||||
List<ApiGlobalParam> paramList = apiGlobalParamService.list(wrapper);
|
||||
if (CollectionUtils.isNotEmpty(paramList)) {
|
||||
if (paramList.size() > 1 || !Objects.equals(paramList.get(0).getId(), globalParam.getId())) {
|
||||
return DocResponseJson.warn("全局参数名称不能重复");
|
||||
}
|
||||
}
|
||||
apiGlobalParamService.saveOrUpdate(globalParam);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.api.controller.param.ProxyRequestParam;
|
||||
import com.zyplayer.doc.api.controller.vo.ProxyRequestResultVo;
|
||||
import com.zyplayer.doc.api.service.SwaggerHttpRequestService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 请求参数控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/proxy")
|
||||
public class ApiPoxyRequestController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiPoxyRequestController.class);
|
||||
|
||||
@Resource
|
||||
private SwaggerHttpRequestService swaggerHttpRequestService;
|
||||
|
||||
/**
|
||||
* 代理接口请求
|
||||
*
|
||||
* @return 请求参数
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/request")
|
||||
public ResponseJson<ProxyRequestResultVo> request(HttpServletRequest request, ProxyRequestParam requestParam) {
|
||||
ProxyRequestResultVo requestResult = swaggerHttpRequestService.proxyRequest(request, requestParam);
|
||||
return DocResponseJson.ok(requestResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 代理接口下载请求
|
||||
*
|
||||
* @return 请求参数
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/download")
|
||||
public ResponseJson<ProxyRequestResultVo> download(HttpServletRequest request, HttpServletResponse response, ProxyRequestParam requestParam) {
|
||||
swaggerHttpRequestService.proxyDownload(request, response, requestParam);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiRequestParam;
|
||||
import com.zyplayer.doc.data.service.manage.ApiRequestParamService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 请求参数控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/request-param")
|
||||
public class ApiRequestParamController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiRequestParamController.class);
|
||||
|
||||
@Resource
|
||||
private ApiRequestParamService apiRequestParamService;
|
||||
|
||||
/**
|
||||
* 获取所有的请求参数
|
||||
*
|
||||
* @return 请求参数
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/query")
|
||||
public ResponseJson<ApiRequestParam> query(String docUrl) {
|
||||
QueryWrapper<ApiRequestParam> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
queryWrapper.eq("doc_url", docUrl);
|
||||
ApiRequestParam requestParam = apiRequestParamService.getOne(queryWrapper);
|
||||
return DocResponseJson.ok(requestParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改请求参数
|
||||
*
|
||||
* @return 无
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/update")
|
||||
public ResponseJson<List<ApiDoc>> update(ApiRequestParam apiRequestParam) {
|
||||
QueryWrapper<ApiRequestParam> updateWrapper = new QueryWrapper<>();
|
||||
updateWrapper.eq("doc_url", apiRequestParam.getDocUrl());
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
apiRequestParam.setYn(1);
|
||||
apiRequestParam.setCreateTime(new Date());
|
||||
apiRequestParam.setCreateUserId(currentUser.getUserId());
|
||||
apiRequestParam.setCreateUserName(currentUser.getUsername());
|
||||
apiRequestParamService.update(apiRequestParam, updateWrapper);
|
||||
return DocResponseJson.ok();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.zyplayer.doc.api.framework.utils.SwaggerDocUtil;
|
||||
import com.zyplayer.doc.api.service.SwaggerHttpRequestService;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 文档控制器
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/doc-api/share")
|
||||
public class ApiShareDocumentController {
|
||||
private static Logger logger = LoggerFactory.getLogger(ApiShareDocumentController.class);
|
||||
|
||||
@Resource
|
||||
private ApiDocService swaggerDocService;
|
||||
@Resource
|
||||
private SwaggerHttpRequestService swaggerHttpRequestService;
|
||||
|
||||
/**
|
||||
* 获取文档内容
|
||||
*
|
||||
* @return 文档内容
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@ResponseBody
|
||||
@PostMapping(value = "/detail")
|
||||
public ResponseJson<List<ApiDoc>> detail(String shareUuid) {
|
||||
ApiDoc apiDoc = swaggerDocService.getByShareUuid(shareUuid);
|
||||
if (apiDoc == null) {
|
||||
return DocResponseJson.warn("文档不存在");
|
||||
}
|
||||
apiDoc.setDocUrl(null);
|
||||
apiDoc.setJsonContent(null);
|
||||
return DocResponseJson.ok(apiDoc);
|
||||
}
|
||||
|
||||
@RequestMapping("/apis/detail")
|
||||
public ResponseJson<Object> detail(HttpServletRequest request, String shareUuid) {
|
||||
ApiDoc apiDoc = swaggerDocService.getByShareUuid(shareUuid);
|
||||
if (apiDoc == null) {
|
||||
return DocResponseJson.warn("文档不存在");
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 1)) {
|
||||
try {
|
||||
String docsDomain = SwaggerDocUtil.getV2ApiDocsDomain(apiDoc.getDocUrl());
|
||||
String contentStr = swaggerHttpRequestService.requestSwaggerUrl(request, apiDoc.getId(), apiDoc.getDocUrl(), docsDomain);
|
||||
return DocResponseJson.ok(contentStr);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return DocResponseJson.warn("请求文档失败");
|
||||
}
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 2) || Objects.equals(apiDoc.getDocType(), 4)) {
|
||||
return DocResponseJson.ok(apiDoc.getJsonContent());
|
||||
}
|
||||
return DocResponseJson.warn("暂不支持的文档类型");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.zyplayer.doc.api.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.exception.ConfirmException;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import com.zyplayer.doc.api.controller.vo.SwaggerResourceVo;
|
||||
import com.zyplayer.doc.api.framework.utils.SwaggerDocUtil;
|
||||
import com.zyplayer.doc.api.service.SwaggerHttpRequestService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.MimeTypeUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import springfox.documentation.spring.web.json.Json;
|
||||
import springfox.documentation.swagger.web.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 承接了所有的ApiResourceController的接口
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年10月16日
|
||||
*/
|
||||
@AuthMan
|
||||
@RestController
|
||||
public class ApiSwaggerProxyController {
|
||||
|
||||
private static final String HAL_MEDIA_TYPE = "application/hal+json";
|
||||
|
||||
@Resource
|
||||
private ApiDocService apiDocService;
|
||||
@Resource
|
||||
private SwaggerHttpRequestService swaggerHttpRequestService;
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping("/swagger-resources")
|
||||
public List<SwaggerResourceVo> swaggerResources() {
|
||||
List<SwaggerResourceVo> resourceList = new LinkedList<>();
|
||||
QueryWrapper<ApiDoc> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("yn", 1);
|
||||
queryWrapper.eq("doc_status", 1);
|
||||
queryWrapper.eq("open_visit", 1);
|
||||
queryWrapper.in("doc_type", 1, 2);
|
||||
queryWrapper.orderByAsc("id");
|
||||
queryWrapper.select("id", "name", "rewrite_domain");
|
||||
List<ApiDoc> docList = apiDocService.list(queryWrapper);
|
||||
for (ApiDoc apiDoc : docList) {
|
||||
SwaggerResourceVo resource = new SwaggerResourceVo();
|
||||
resource.setUrl("/v2/api-docs?id=" + apiDoc.getId());
|
||||
resource.setName(apiDoc.getName());
|
||||
resource.setSwaggerVersion("2.0");
|
||||
resource.setRewriteDomain(apiDoc.getRewriteDomain());
|
||||
resourceList.add(resource);
|
||||
}
|
||||
return resourceList;
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/v2/api-docs", produces = {MimeTypeUtils.APPLICATION_JSON_VALUE, HAL_MEDIA_TYPE})
|
||||
public ResponseEntity<Object> content(HttpServletRequest request, Long id) {
|
||||
ApiDoc apiDoc = apiDocService.getById(id);
|
||||
if (apiDoc == null || !Objects.equals(apiDoc.getOpenVisit(), 1)) {
|
||||
throw new ConfirmException("文档不存在");
|
||||
}
|
||||
if (Objects.equals(apiDoc.getDocType(), 1)) {
|
||||
try {
|
||||
String docsDomain = SwaggerDocUtil.getV2ApiDocsDomain(apiDoc.getDocUrl());
|
||||
String contentStr = swaggerHttpRequestService.requestSwaggerUrl(request, apiDoc.getId(), apiDoc.getDocUrl(), docsDomain);
|
||||
return new ResponseEntity<>(new Json(contentStr), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return new ResponseEntity<>(DocResponseJson.warn("请求文档失败"), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
return new ResponseEntity<>(new Json(apiDoc.getJsonContent()), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/swagger-resources/configuration/security")
|
||||
public ResponseEntity<SecurityConfiguration> securityConfiguration() {
|
||||
SecurityConfiguration securityConfiguration = SecurityConfigurationBuilder.builder().build();
|
||||
return new ResponseEntity<>(securityConfiguration, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/swagger-resources/configuration/ui")
|
||||
public ResponseEntity<UiConfiguration> uiConfiguration() {
|
||||
UiConfiguration uiConfiguration = UiConfigurationBuilder.builder().build();
|
||||
return new ResponseEntity<>(uiConfiguration, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.zyplayer.doc.api.controller.param;
|
||||
|
||||
/**
|
||||
* 参数信息
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public class ParamData {
|
||||
private String code;
|
||||
private String value;
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.zyplayer.doc.api.controller.param;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 代理请求参数
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public class ProxyRequestParam {
|
||||
private String url;
|
||||
private String host;
|
||||
private String method;
|
||||
private String contentType;
|
||||
private String headerParam;
|
||||
private String cookieParam;
|
||||
private String formParam;
|
||||
private String formEncodeParam;
|
||||
private String bodyParam;
|
||||
|
||||
public List<ParamData> getHeaderParamData() {
|
||||
return JSON.parseArray(headerParam, ParamData.class);
|
||||
}
|
||||
|
||||
public List<ParamData> getCookieParamData() {
|
||||
return JSON.parseArray(cookieParam, ParamData.class);
|
||||
}
|
||||
|
||||
public List<ParamData> getFormParamData() {
|
||||
return JSON.parseArray(formParam, ParamData.class);
|
||||
}
|
||||
|
||||
public List<ParamData> getFormEncodeParamData() {
|
||||
return JSON.parseArray(formEncodeParam, ParamData.class);
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getHeaderParam() {
|
||||
return headerParam;
|
||||
}
|
||||
|
||||
public void setHeaderParam(String headerParam) {
|
||||
this.headerParam = headerParam;
|
||||
}
|
||||
|
||||
public String getCookieParam() {
|
||||
return cookieParam;
|
||||
}
|
||||
|
||||
public void setCookieParam(String cookieParam) {
|
||||
this.cookieParam = cookieParam;
|
||||
}
|
||||
|
||||
public String getFormParam() {
|
||||
return formParam;
|
||||
}
|
||||
|
||||
public void setFormParam(String formParam) {
|
||||
this.formParam = formParam;
|
||||
}
|
||||
|
||||
public String getFormEncodeParam() {
|
||||
return formEncodeParam;
|
||||
}
|
||||
|
||||
public void setFormEncodeParam(String formEncodeParam) {
|
||||
this.formEncodeParam = formEncodeParam;
|
||||
}
|
||||
|
||||
public String getBodyParam() {
|
||||
return bodyParam;
|
||||
}
|
||||
|
||||
public void setBodyParam(String bodyParam) {
|
||||
this.bodyParam = bodyParam;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public void setMethod(String method) {
|
||||
this.method = method;
|
||||
}
|
||||
|
||||
public String getContentType() {
|
||||
return contentType;
|
||||
}
|
||||
|
||||
public void setContentType(String contentType) {
|
||||
this.contentType = contentType;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* api文档地址Vo
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-25
|
||||
*/
|
||||
public class ApiDocVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文档类型 1=swagger url 2=swagger json 3=openapi url 4=openapi json 5=自建API分组
|
||||
*/
|
||||
private Integer docType;
|
||||
|
||||
/**
|
||||
* 文档URL地址
|
||||
*/
|
||||
private String docUrl;
|
||||
|
||||
/**
|
||||
* 文档json内容
|
||||
*/
|
||||
private String jsonContent;
|
||||
|
||||
/**
|
||||
* 重写的域名
|
||||
*/
|
||||
private String rewriteDomain;
|
||||
|
||||
/**
|
||||
* 是否开放访问 0=否 1=是
|
||||
*/
|
||||
private Integer openVisit;
|
||||
|
||||
/**
|
||||
* 状态 1=启用 2=禁用
|
||||
*/
|
||||
private Integer docStatus;
|
||||
|
||||
/**
|
||||
* 开放文档UUID
|
||||
*/
|
||||
private String shareUuid;
|
||||
|
||||
/**
|
||||
* 开放文档使用说明
|
||||
*/
|
||||
private String shareInstruction;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getDocType() {
|
||||
return docType;
|
||||
}
|
||||
|
||||
public void setDocType(Integer docType) {
|
||||
this.docType = docType;
|
||||
}
|
||||
|
||||
public String getDocUrl() {
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
public void setDocUrl(String docUrl) {
|
||||
this.docUrl = docUrl;
|
||||
}
|
||||
|
||||
public String getJsonContent() {
|
||||
return jsonContent;
|
||||
}
|
||||
|
||||
public void setJsonContent(String jsonContent) {
|
||||
this.jsonContent = jsonContent;
|
||||
}
|
||||
|
||||
public String getRewriteDomain() {
|
||||
return rewriteDomain;
|
||||
}
|
||||
|
||||
public void setRewriteDomain(String rewriteDomain) {
|
||||
this.rewriteDomain = rewriteDomain;
|
||||
}
|
||||
|
||||
public Integer getOpenVisit() {
|
||||
return openVisit;
|
||||
}
|
||||
|
||||
public void setOpenVisit(Integer openVisit) {
|
||||
this.openVisit = openVisit;
|
||||
}
|
||||
|
||||
public Integer getDocStatus() {
|
||||
return docStatus;
|
||||
}
|
||||
|
||||
public void setDocStatus(Integer docStatus) {
|
||||
this.docStatus = docStatus;
|
||||
}
|
||||
|
||||
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 Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiDoc{" +
|
||||
"id=" + id +
|
||||
", name=" + name +
|
||||
", docType=" + docType +
|
||||
", docUrl=" + docUrl +
|
||||
", jsonContent=" + jsonContent +
|
||||
", rewriteDomain=" + rewriteDomain +
|
||||
", openVisit=" + openVisit +
|
||||
", docStatus=" + docStatus +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
|
||||
public String getShareUuid() {
|
||||
return shareUuid;
|
||||
}
|
||||
|
||||
public void setShareUuid(String shareUuid) {
|
||||
this.shareUuid = shareUuid;
|
||||
}
|
||||
|
||||
public String getShareInstruction() {
|
||||
return shareInstruction;
|
||||
}
|
||||
|
||||
public void setShareInstruction(String shareInstruction) {
|
||||
this.shareInstruction = shareInstruction;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
/**
|
||||
* 用户权限返回值对象
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021年12月12日
|
||||
*/
|
||||
public class DocUserAuthVo {
|
||||
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
private Integer authType;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户编号,用于登录等
|
||||
*/
|
||||
private String userNo;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
/**
|
||||
* 邮箱
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 性别 0=女 1=男
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserNo() {
|
||||
return userNo;
|
||||
}
|
||||
|
||||
public void setUserNo(String userNo) {
|
||||
this.userNo = userNo;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
|
||||
public Integer getSex() {
|
||||
return sex;
|
||||
}
|
||||
|
||||
public void setSex(Integer sex) {
|
||||
this.sex = sex;
|
||||
}
|
||||
|
||||
public Integer getAuthType() {
|
||||
return authType;
|
||||
}
|
||||
|
||||
public void setAuthType(Integer authType) {
|
||||
this.authType = authType;
|
||||
}
|
||||
}
|
||||
@@ -1,38 +1,38 @@
|
||||
package com.zyplayer.doc.swagger.controller.vo;
|
||||
|
||||
/**
|
||||
* cookie返回值对象
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月21日
|
||||
*/
|
||||
public class HttpCookieVo {
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public HttpCookieVo() {
|
||||
|
||||
}
|
||||
|
||||
public HttpCookieVo(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
/**
|
||||
* cookie返回值对象
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月21日
|
||||
*/
|
||||
public class HttpCookieVo {
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public HttpCookieVo() {
|
||||
|
||||
}
|
||||
|
||||
public HttpCookieVo(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +1,29 @@
|
||||
package com.zyplayer.doc.swagger.controller.vo;
|
||||
|
||||
/**
|
||||
* header返回值对象
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月21日
|
||||
*/
|
||||
public class HttpHeaderVo {
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
/**
|
||||
* header返回值对象
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月21日
|
||||
*/
|
||||
public class HttpHeaderVo {
|
||||
private String name;
|
||||
private String value;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 代理请求结果
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public class ProxyRequestResultVo {
|
||||
private List<HttpCookieVo> cookies;
|
||||
private List<HttpHeaderVo> headers;
|
||||
private Integer status;
|
||||
private Long useTime;
|
||||
private Integer contentLength;
|
||||
private String data;
|
||||
private String errorMsg;
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getUseTime() {
|
||||
return useTime;
|
||||
}
|
||||
|
||||
public void setUseTime(Long useTime) {
|
||||
this.useTime = useTime;
|
||||
}
|
||||
|
||||
public String getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(String data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public List<HttpCookieVo> getCookies() {
|
||||
return cookies;
|
||||
}
|
||||
|
||||
public void setCookies(List<HttpCookieVo> cookies) {
|
||||
this.cookies = cookies;
|
||||
}
|
||||
|
||||
public List<HttpHeaderVo> getHeaders() {
|
||||
return headers;
|
||||
}
|
||||
|
||||
public void setHeaders(List<HttpHeaderVo> headers) {
|
||||
this.headers = headers;
|
||||
}
|
||||
|
||||
public String getErrorMsg() {
|
||||
return errorMsg;
|
||||
}
|
||||
|
||||
public void setErrorMsg(String errorMsg) {
|
||||
this.errorMsg = errorMsg;
|
||||
}
|
||||
|
||||
public Integer getContentLength() {
|
||||
return contentLength;
|
||||
}
|
||||
|
||||
public void setContentLength(Integer contentLength) {
|
||||
this.contentLength = contentLength;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
|
||||
package com.zyplayer.doc.api.controller.vo;
|
||||
|
||||
import com.google.common.collect.ComparisonChain;
|
||||
|
||||
/**
|
||||
* swagger资源信息
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public class SwaggerResourceVo implements Comparable<SwaggerResourceVo> {
|
||||
private String name;
|
||||
private String url;
|
||||
private String swaggerVersion;
|
||||
private String rewriteDomain;
|
||||
|
||||
public SwaggerResourceVo() {
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getLocation() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public void setLocation(String location) {
|
||||
this.url = location;
|
||||
}
|
||||
|
||||
public String getSwaggerVersion() {
|
||||
return this.swaggerVersion;
|
||||
}
|
||||
|
||||
public void setSwaggerVersion(String swaggerVersion) {
|
||||
this.swaggerVersion = swaggerVersion;
|
||||
}
|
||||
|
||||
public int compareTo(SwaggerResourceVo other) {
|
||||
return ComparisonChain.start().compare(this.swaggerVersion, other.swaggerVersion).compare(this.name, other.name).result();
|
||||
}
|
||||
|
||||
public String getRewriteDomain() {
|
||||
return rewriteDomain;
|
||||
}
|
||||
|
||||
public void setRewriteDomain(String rewriteDomain) {
|
||||
this.rewriteDomain = rewriteDomain;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zyplayer.doc.grpc.framework.config;
|
||||
package com.zyplayer.doc.api.framework.config;
|
||||
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -6,17 +6,18 @@ import org.springframework.context.annotation.Configuration;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 开启grpc的注解
|
||||
* 开启api接口文档模块注解
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019年3月31日
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Configuration
|
||||
@ComponentScan(basePackages = {
|
||||
"com.zyplayer.doc.grpc",
|
||||
"com.zyplayer.doc.api",
|
||||
})
|
||||
public @interface EnableDocGrpc {
|
||||
public @interface EnableDocApi {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.zyplayer.doc.api.framework.utils;
|
||||
|
||||
/**
|
||||
* swagger文档工具类
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public class SwaggerDocUtil {
|
||||
|
||||
public static String replaceSwaggerResources(String docUrl) {
|
||||
int htmlIndex = docUrl.indexOf("/swagger-ui.html");
|
||||
if (htmlIndex > 0) {
|
||||
docUrl = docUrl.substring(0, htmlIndex) + "/swagger-resources";
|
||||
}
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
public static boolean isSwaggerResources(String docUrl) {
|
||||
return docUrl.contains("/swagger-resources");
|
||||
}
|
||||
|
||||
public static String getSwaggerResourceDomain(String docUrl) {
|
||||
int index = docUrl.indexOf("/swagger-resources");
|
||||
if (index >= 0) {
|
||||
return docUrl.substring(0, index);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getV2ApiDocsDomain(String docUrl) {
|
||||
int index = docUrl.indexOf("/v2/api-docs");
|
||||
if (index >= 0) {
|
||||
return docUrl.substring(0, index);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public static String getDomainHost(String domain) {
|
||||
domain = domain.replace("http://", "");
|
||||
domain = domain.replace("https://", "");
|
||||
int index = domain.indexOf("/");
|
||||
if (index >= 0) {
|
||||
return domain.substring(0, index);
|
||||
}
|
||||
return domain;
|
||||
}
|
||||
|
||||
public static boolean isSwaggerLocation(String docUrl) {
|
||||
return docUrl.contains("/v2/api-docs");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.zyplayer.doc.api.service;
|
||||
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.AuthInfo;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserAuth;
|
||||
import com.zyplayer.doc.data.repository.support.consts.ApiAuthType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysModuleType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysType;
|
||||
import com.zyplayer.doc.data.service.manage.ApiDocService;
|
||||
import com.zyplayer.doc.data.service.manage.AuthInfoService;
|
||||
import com.zyplayer.doc.data.service.manage.UserAuthService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 判断文档权限
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-12
|
||||
*/
|
||||
@Service
|
||||
public class ApiDocAuthJudgeService {
|
||||
|
||||
@Resource
|
||||
UserAuthService userAuthService;
|
||||
@Resource
|
||||
AuthInfoService authInfoService;
|
||||
@Resource
|
||||
ApiDocService apiDocService;
|
||||
|
||||
/**
|
||||
* 判断当前用户是否有管理员权限
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-12
|
||||
*/
|
||||
public boolean haveManageAuth(Long docId) {
|
||||
ApiDoc apiDoc = apiDocService.getById(docId);
|
||||
return haveManageAuth(apiDoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前用户是否有管理员权限
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-12
|
||||
*/
|
||||
public boolean haveManageAuth(ApiDoc apiDoc) {
|
||||
if (apiDoc == null) {
|
||||
return false;
|
||||
}
|
||||
// 创建者
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
if (Objects.equals(apiDoc.getCreateUserId(), currentUser.getUserId())) {
|
||||
return true;
|
||||
}
|
||||
// 管理员
|
||||
AuthInfo authInfo = authInfoService.getByCode(ApiAuthType.MANAGE.getCode());
|
||||
List<UserAuth> userModuleAuthList = userAuthService.getUserModuleAuthList(currentUser.getUserId(), DocSysType.API.getType(), DocSysModuleType.Api.DOC.getType(), apiDoc.getId());
|
||||
return userModuleAuthList.stream().anyMatch(auth -> Objects.equals(auth.getAuthId(), authInfo.getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前用户是否有查看权限
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-12
|
||||
*/
|
||||
public boolean haveDevelopAuth(Long docId) {
|
||||
ApiDoc apiDoc = apiDocService.getById(docId);
|
||||
return haveDevelopAuth(apiDoc);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前用户是否有查看权限
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-12-12
|
||||
*/
|
||||
public boolean haveDevelopAuth(ApiDoc apiDoc) {
|
||||
if (apiDoc == null) {
|
||||
return false;
|
||||
}
|
||||
// 创建者
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
if (Objects.equals(apiDoc.getCreateUserId(), currentUser.getUserId())) {
|
||||
return true;
|
||||
}
|
||||
// 开发人员,存在则说明肯定是管理员或开发人员
|
||||
List<UserAuth> userModuleAuthList = userAuthService.getUserModuleAuthList(currentUser.getUserId(), DocSysType.API.getType(), DocSysModuleType.Api.DOC.getType(), apiDoc.getId());
|
||||
return CollectionUtils.isNotEmpty(userModuleAuthList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,252 @@
|
||||
package com.zyplayer.doc.api.service;
|
||||
|
||||
import cn.hutool.core.io.resource.BytesResource;
|
||||
import cn.hutool.core.io.resource.MultiResource;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.http.HttpUtil;
|
||||
import cn.hutool.http.Method;
|
||||
import com.zyplayer.doc.api.controller.ApiPoxyRequestController;
|
||||
import com.zyplayer.doc.api.controller.param.ProxyRequestParam;
|
||||
import com.zyplayer.doc.api.controller.vo.HttpCookieVo;
|
||||
import com.zyplayer.doc.api.controller.vo.HttpHeaderVo;
|
||||
import com.zyplayer.doc.api.controller.vo.ProxyRequestResultVo;
|
||||
import com.zyplayer.doc.api.framework.utils.SwaggerDocUtil;
|
||||
import com.zyplayer.doc.core.exception.ConfirmException;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiGlobalParam;
|
||||
import com.zyplayer.doc.data.service.manage.ApiGlobalParamService;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpCookie;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* swagger请求服务
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
@Service
|
||||
public class SwaggerHttpRequestService {
|
||||
private static Logger logger = LoggerFactory.getLogger(SwaggerHttpRequestService.class);
|
||||
|
||||
@Resource
|
||||
private ApiGlobalParamService apiGlobalParamService;
|
||||
|
||||
private static final Map<String, Method> requestMethodMap = Stream.of(Method.values()).collect(Collectors.toMap(val -> val.name().toLowerCase(), val -> val));
|
||||
|
||||
List<String> domainHeaderKeys = Arrays.asList("referer", "origin");
|
||||
List<String> needRequestHeaderKeys = Arrays.asList("user-agent");
|
||||
|
||||
/**
|
||||
* 请求真实的swagger文档内容
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public String requestSwaggerUrl(HttpServletRequest request, Long docId, String docUrl, String docDomain) {
|
||||
List<ApiGlobalParam> globalParamList = apiGlobalParamService.getGlobalParamList(docId);
|
||||
Map<String, Object> globalFormParamMap = globalParamList.stream().filter(item -> Objects.equals(item.getParamType(), 1))
|
||||
.collect(Collectors.toMap(ApiGlobalParam::getParamKey, ApiGlobalParam::getParamValue, (val1, val2) -> val1));
|
||||
Map<String, String> globalHeaderParamMap = globalParamList.stream().filter(item -> Objects.equals(item.getParamType(), 2))
|
||||
.collect(Collectors.toMap(ApiGlobalParam::getParamKey, ApiGlobalParam::getParamValue, (val1, val2) -> val1));
|
||||
Map<String, String> globalCookieParamMap = globalParamList.stream().filter(item -> Objects.equals(item.getParamType(), 3))
|
||||
.collect(Collectors.toMap(ApiGlobalParam::getParamKey, ApiGlobalParam::getParamValue, (val1, val2) -> val1));
|
||||
Map<String, String> requestHeaders = this.getHttpHeader(request, globalHeaderParamMap);
|
||||
if (StringUtils.isNotBlank(docDomain)) {
|
||||
domainHeaderKeys.forEach(key -> requestHeaders.put(key, docDomain));
|
||||
requestHeaders.put("host", SwaggerDocUtil.getDomainHost(docDomain));
|
||||
}
|
||||
// 执行请求
|
||||
String resultStr = HttpRequest.get(docUrl)
|
||||
.form(globalFormParamMap)
|
||||
.addHeaders(requestHeaders)
|
||||
.header("Accept", "application/json, text/javascript, */*; q=0.01")
|
||||
.cookie(this.getHttpCookie(request, globalCookieParamMap, null))
|
||||
.timeout(10000).execute().body();
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行代理请求
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public void proxyDownload(HttpServletRequest request, HttpServletResponse response, ProxyRequestParam requestParam) {
|
||||
try {
|
||||
HttpResponse httpResponse = this.getHttpResponse(request, requestParam);
|
||||
Map<String, List<String>> responseHeaders = httpResponse.headers();
|
||||
if (MapUtils.isNotEmpty(responseHeaders)) {
|
||||
for (Map.Entry<String, List<String>> httpHeader : responseHeaders.entrySet()) {
|
||||
response.addHeader(httpHeader.getKey(), String.join(";", httpHeader.getValue()));
|
||||
}
|
||||
}
|
||||
httpResponse.writeBody(response.getOutputStream(), true, null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行代理请求
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
public ProxyRequestResultVo proxyRequest(HttpServletRequest request, ProxyRequestParam requestParam) {
|
||||
ProxyRequestResultVo resultVo = new ProxyRequestResultVo();
|
||||
long startTime = System.currentTimeMillis();
|
||||
try {
|
||||
HttpResponse httpResponse = getHttpResponse(request, requestParam);
|
||||
resultVo.setData(httpResponse.body());
|
||||
resultVo.setStatus(httpResponse.getStatus());
|
||||
resultVo.setContentLength(httpResponse.bodyBytes().length);
|
||||
// 设置返回的cookies
|
||||
List<HttpCookie> responseCookies = httpResponse.getCookies();
|
||||
if (CollectionUtils.isNotEmpty(responseCookies)) {
|
||||
resultVo.setCookies(responseCookies.stream().map(val -> new HttpCookieVo(val.getName(), val.getValue())).collect(Collectors.toList()));
|
||||
}
|
||||
// 设置返回的headers
|
||||
Map<String, List<String>> responseHeaders = httpResponse.headers();
|
||||
if (MapUtils.isNotEmpty(responseHeaders)) {
|
||||
List<HttpHeaderVo> headerList = new ArrayList<>(responseHeaders.size());
|
||||
for (Map.Entry<String, List<String>> httpHeader : responseHeaders.entrySet()) {
|
||||
HttpHeaderVo vo = new HttpHeaderVo();
|
||||
vo.setName(httpHeader.getKey());
|
||||
vo.setValue(String.join(";", httpHeader.getValue()));
|
||||
headerList.add(vo);
|
||||
}
|
||||
resultVo.setHeaders(headerList);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
resultVo.setErrorMsg(e.getMessage());
|
||||
}
|
||||
resultVo.setUseTime(System.currentTimeMillis() - startTime);
|
||||
return resultVo;
|
||||
}
|
||||
|
||||
private HttpResponse getHttpResponse(HttpServletRequest request, ProxyRequestParam requestParam) {
|
||||
// 执行请求
|
||||
Method method = requestMethodMap.get(requestParam.getMethod());
|
||||
if (method == null) {
|
||||
throw new ConfirmException("不支持的请求方式:" + requestParam.getMethod());
|
||||
}
|
||||
HttpRequest httpRequest = HttpUtil.createRequest(method, requestParam.getUrl());
|
||||
// header获取
|
||||
Map<String, String> headerParam = new HashMap<>();
|
||||
requestParam.getHeaderParamData().forEach(item -> headerParam.put(item.getCode(), item.getValue()));
|
||||
Map<String, String> requestHeaders = this.getHttpHeader(request, headerParam);
|
||||
if (StringUtils.isNotBlank(requestParam.getHost())) {
|
||||
domainHeaderKeys.forEach(key -> requestHeaders.put(key, requestParam.getHost()));
|
||||
requestHeaders.put("host", SwaggerDocUtil.getDomainHost(requestParam.getHost()));
|
||||
}
|
||||
// http自带参数
|
||||
httpRequest.addHeaders(requestHeaders);
|
||||
// 用户输入的参数
|
||||
requestParam.getFormParamData().forEach(data -> httpRequest.form(data.getCode(), data.getValue()));
|
||||
requestParam.getFormEncodeParamData().forEach(data -> httpRequest.form(data.getCode(), data.getValue()));
|
||||
// 文件参数
|
||||
if (request instanceof StandardMultipartHttpServletRequest) {
|
||||
StandardMultipartHttpServletRequest multipartRequest = (StandardMultipartHttpServletRequest) request;
|
||||
Iterator<String> fileNames = multipartRequest.getFileNames();
|
||||
while (fileNames.hasNext()) {
|
||||
String fileName = fileNames.next();
|
||||
String originKey = fileName.replace("_file_", "");
|
||||
List<MultipartFile> fileList = multipartRequest.getFiles(fileName);
|
||||
try {
|
||||
if (fileList.size() > 1) {
|
||||
MultiResource multiResource = new MultiResource();
|
||||
for (MultipartFile file : fileList) {
|
||||
multiResource.add(new BytesResource(file.getBytes(), file.getOriginalFilename()));
|
||||
}
|
||||
httpRequest.form(originKey, multiResource);
|
||||
} else if (fileList.size() > 0) {
|
||||
MultipartFile multipartFile = fileList.get(0);
|
||||
httpRequest.form(originKey, multipartFile.getBytes(), multipartFile.getOriginalFilename());
|
||||
}
|
||||
} catch (IOException e) {
|
||||
logger.error("读取上传的文件失败", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
// cookie参数
|
||||
Map<String, String> cookieParam = new HashMap<>();
|
||||
String headerCookie = headerParam.getOrDefault("Cookie", headerParam.get("cookie"));
|
||||
requestParam.getCookieParamData().forEach(item -> cookieParam.put(item.getCode(), item.getValue()));
|
||||
httpRequest.cookie(this.getHttpCookie(request, cookieParam, headerCookie));
|
||||
if (StringUtils.isNotBlank(requestParam.getBodyParam())) {
|
||||
httpRequest.body(requestParam.getBodyParam());
|
||||
}
|
||||
// 强制设置类型,貌似不用刻意设置,如果写的application/json,参数是表单,传过去收不到值,先注释这个
|
||||
// if (StringUtils.isNotBlank(requestParam.getContentType())) {
|
||||
// httpRequest.contentType(requestParam.getContentType());
|
||||
// }
|
||||
// 执行请求
|
||||
return httpRequest.timeout(10000).execute();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取http的cookie
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
private List<HttpCookie> getHttpCookie(HttpServletRequest request, Map<String, String> globalCookieParamMap, String headerCookie) {
|
||||
List<HttpCookie> httpCookies = new LinkedList<>();
|
||||
if (request.getCookies() != null) {
|
||||
for (Cookie cookie : request.getCookies()) {
|
||||
httpCookies.add(new HttpCookie(cookie.getName(), cookie.getValue()));
|
||||
}
|
||||
}
|
||||
if (StringUtils.isNotBlank(headerCookie)) {
|
||||
Arrays.stream(headerCookie.split(";")).map(String::trim).forEach(cookie -> {
|
||||
String[] cookieArr = StringUtils.split(cookie, "=", 2);
|
||||
if (ArrayUtils.getLength(cookieArr) == 2) {
|
||||
httpCookies.add(new HttpCookie(cookieArr[0], cookieArr[1]));
|
||||
}
|
||||
});
|
||||
}
|
||||
if (MapUtils.isNotEmpty(globalCookieParamMap)) {
|
||||
globalCookieParamMap.forEach((key, value) -> httpCookies.add(new HttpCookie(key, value)));
|
||||
}
|
||||
return httpCookies;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取http的header
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-04
|
||||
*/
|
||||
private Map<String, String> getHttpHeader(HttpServletRequest request, Map<String, String> globalHeaderParamMap) {
|
||||
Map<String, String> headerParamMap = new HashMap<>();
|
||||
Enumeration<String> headerNames = request.getHeaderNames();
|
||||
while (headerNames.hasMoreElements()) {
|
||||
String headerName = StringUtils.lowerCase(headerNames.nextElement());
|
||||
if (needRequestHeaderKeys.contains(headerName)) {
|
||||
headerParamMap.put(headerName, request.getHeader(headerName));
|
||||
}
|
||||
}
|
||||
if (MapUtils.isNotEmpty(globalHeaderParamMap)) {
|
||||
headerParamMap.putAll(globalHeaderParamMap);
|
||||
}
|
||||
return headerParamMap;
|
||||
}
|
||||
}
|
||||
BIN
zyplayer-doc-api/src/main/resources/dist/api-logo.png
vendored
Normal file
BIN
zyplayer-doc-api/src/main/resources/dist/api-logo.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
4
zyplayer-doc-api/src/main/resources/dist/assets/ApiRequest.31257b7b.js
vendored
Normal file
4
zyplayer-doc-api/src/main/resources/dist/assets/ApiRequest.31257b7b.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/DocContent.2911adec.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocContent.2911adec.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/DocContent.4b703d6b.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocContent.4b703d6b.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/DocInfo.26704d18.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocInfo.26704d18.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{u as S,ar 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.948fa90f.js";import{m as B}from"./index.b99389a4.js";import{_ as C}from"./main.92a9e84b.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"),b=c("a-statistic"),k=c("a-card"),v=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(v,{key:0,span:6},{default:t(()=>[o(k,{size:"small"},{default:t(()=>[o(b,{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};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/DocInfo.86715416.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocInfo.86715416.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{u as S,ar as D,r,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 i,e as m,d as w}from"./vendor.948fa90f.js";import{m as M}from"./index.b99389a4.js";import{_ as B}from"./main.92a9e84b.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,b,I){const a=r("a-form-item"),h=r("a-divider"),v=r("a-statistic"),k=r("a-card"),y=r("a-col"),g=r("a-row"),x=r("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)):i("",!0),e.openApiDocInfo.contact.email?(t(),p(f,{key:1},[n(h,{type:"vertical"}),s(c(e.openApiDocInfo.contact.email),1)],64)):i("",!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)):i("",!0)]),_:1})):i("",!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})):i("",!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})):i("",!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(v,{title:d==="total"?"\u603B\u8BA1":d.toUpperCase()+"\u65B9\u6CD5",value:e.openApiMethodStatistic[d],suffix:"\u4E2A"},null,8,["title","value"])]),_:2},1024)]),_:2},1024)):i("",!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};
|
||||
15
zyplayer-doc-api/src/main/resources/dist/assets/DocManage.48af8c82.js
vendored
Normal file
15
zyplayer-doc-api/src/main/resources/dist/assets/DocManage.48af8c82.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/DocView.27a067fb.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocView.27a067fb.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{v as y,u as j,y as n,H as D,r as h,o as g,c as v,w as k,B as w,e as x}from"./vendor.948fa90f.js";import{D as I,o as _}from"./DocContent.4b703d6b.js";import{m as M}from"./index.b99389a4.js";import{_ as b}from"./main.92a9e84b.js";import"./logUtil.24f55f0f.js";const q={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){w.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.openApiDefinitions;o.value=_.getRequestParamList(e.parameters,f),r.value=_.getResponseParamList(e.responses,f)};return D(()=>{m()}),{docInfoShow:i,activePage:p,changePage:()=>{},isLoadSuccess:s,requestParamList:o,responseParamList:r}}},S=x("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:k(()=>[S]),_:1}))}var T=b(q,[["render",A]]);export{T as default};
|
||||
4
zyplayer-doc-api/src/main/resources/dist/assets/DocView.68d359d2.js
vendored
Normal file
4
zyplayer-doc-api/src/main/resources/dist/assets/DocView.68d359d2.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/DocView.96961405.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/DocView.96961405.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{v as L,u as y,y as a,H as j,r as g,o as h,c as v,w as D,B as k,e as x}from"./vendor.948fa90f.js";import{D as I,s as _}from"./DocContent.2911adec.js";import{m as M}from"./index.b99389a4.js";import{_ as q}from"./main.92a9e84b.js";import"./logUtil.24f55f0f.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};
|
||||
4
zyplayer-doc-api/src/main/resources/dist/assets/DocView.9ca442ee.js
vendored
Normal file
4
zyplayer-doc-api/src/main/resources/dist/assets/DocView.9ca442ee.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/EditGlobalParam.67e61140.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/EditGlobalParam.67e61140.js
vendored
Normal file
@@ -0,0 +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.6a6c45c1.js";import{P as S,Z as U,a3 as j,u as A,y as L,H 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 b,B as H,m as c}from"./vendor.948fa90f.js";import{_ as R}from"./main.92a9e84b.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){H.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"}},Z=c(" \u5237\u65B0"),J=c(" \u65B0\u5EFA"),Q={key:1},W={key:1},X=c("Form"),Y=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(()=>[Z]),_: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(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)):b("",!0),g.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",W,G(C),1))],64)):b("",!0),g.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(()=>[X]),_:1}),d(E,{value:2},{default:n(()=>[Y]),_: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})):b("",!0)],64))],64)):b("",!0),g.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)):b("",!0)]),_:1},8,["dataSource","columns","loading","scroll"])],64)}var _e=R(q,[["render",de]]);export{_e as E};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/GlobalLayout.4cd5c2be.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/GlobalLayout.4cd5c2be.js
vendored
Normal file
File diff suppressed because one or more lines are too long
6
zyplayer-doc-api/src/main/resources/dist/assets/GlobalLayout.52cccc9f.js
vendored
Normal file
6
zyplayer-doc-api/src/main/resources/dist/assets/GlobalLayout.52cccc9f.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/GlobalParam.8beb2f01.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/GlobalParam.8beb2f01.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import"./custom.6a6c45c1.js";import{E as o}from"./EditGlobalParam.67e61140.js";import{_ as r}from"./main.92a9e84b.js";import{r as t,o as e,c as s}from"./vendor.948fa90f.js";const c={components:{EditGlobalParam:o},setup(){return{}}};function m(n,p,l,i,d,_){const a=t("EditGlobalParam");return e(),s(a,{"dynamic-param":{docId:0}})}var G=r(c,[["render",m]]);export{G as default};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/SettingView.986995f2.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/SettingView.986995f2.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{_ as e}from"./main.92a9e84b.js";import{o as t,b as o}from"./vendor.948fa90f.js";const n={name:"SettingView",components:{},data(){return{}},computed:{},mounted(){},methods:{}};function r(a,s,c,m,i,p){return t(),o("div",null," \u5C55\u793A\u914D\u7F6E\u9875\u9762 ")}var _=e(n,[["render",r]]);export{_ as default};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/ShareHome.44e1cbbd.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/ShareHome.44e1cbbd.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{u as p,y as g,H as f,G as x,o as i,b as l,e as _,F as w,d as L,ax as N,ay as C,t as H,ar as I,r as m,a as v,w as u,c as S,k as b}from"./vendor.948fa90f.js";import{m as A}from"./index.b99389a4.js";import{_ as y}from"./main.92a9e84b.js";const T={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"})}}}},D={class:"navigation"},B={ref:"navigationRef",style:{display:"inline-block",width:"100%",height:"1px"}},M=["onClick"];function R(r,s,a,e,n,c){return i(),l("div",D,[_("div",B,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)},H(t.text),11,M))),256))],4)])}var V=y(T,[["render",R]]);const W={components:{Navigation:V},setup(){const r=p(),s=I(()=>r.state.apiDoc);let a=g();x(r.getters.getApiDoc,()=>{setTimeout(()=>{c(".share-instruction")},100)});const e=t=>A.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(),S(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})):b("",!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 P=y(W,[["render",z]]);export{P as default};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/api-logo.828bc7b1.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/api-logo.828bc7b1.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
var x=Object.defineProperty,O=Object.defineProperties;var E=Object.getOwnPropertyDescriptors;var L=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var b=(r,e,t)=>e in r?x(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,y=(r,e)=>{for(var t in e||(e={}))k.call(e,t)&&b(r,t,e[t]);if(L)for(var t of L(e))M.call(e,t)&&b(r,t,e[t]);return r},v=(r,e)=>O(r,E(e));import{_ as R}from"./main.92a9e84b.js";import{H as j,y as T,o as z,b as C,e as D}from"./vendor.948fa90f.js";const w=["get","head","post","put","patch","delete","options","trace"];function W(r){let e={},t={},o={},h=r.paths;return h?(Object.keys(h).forEach(n=>{let s=h[n];for(let a of w){if(!s[a]||!s[a].tags)continue;let p=a.toLowerCase();o[p]=(o[p]||0)+1,o.total=(o.total||0)+1,s[a].tags.forEach(c=>{let i=e[c];i||(i=e[c]={});let l=i[n];l||(l=i[n]={});let f=n+"."+a;l[a]=s[a],l[a].path=f,l[a].url=n,l[a].method=a,t[f]=s[a]})}}),{urlMethodMap:t,tagPathMap:e,methodStatistic:o}):{urlMethodMap:t,tagPathMap:e,methodStatistic:o}}function H(r,e,t,o){let h=[],n=1,s=r.tags||[];return s.length<=0&&Object.keys(e).forEach(a=>s.push({name:a})),s.forEach(a=>{let p=1,c=[],i=e[a.name];!i||(Object.keys(i).forEach(l=>{let f=1,d=i[l];Object.keys(d).forEach(g=>{let m=n+"_"+p+"_"+f,u=d[g];if(!I(l,u,t))return;u.treeId=m;let _=u.summary||u.path;c.push({title:_,key:m,isLeaf:!0,method:u.method,query:v(y({},o),{path:u.url,method:u.method})}),f++}),p++}),c.length>0&&h.push({title:a.name,key:n,children:c}),n++)}),[{key:"main",title:r.info.title||"Swagger\u63A5\u53E3\u6587\u6863",children:h}]}function I(r,e,t){if(!t||!r||(r=r.toLowerCase(),t=t.toLowerCase(),r.indexOf(t)>=0))return!0;let o=e.path+e.method+e.summary+e.description+e.tags;return o&&o.toLowerCase().indexOf(t)>=0}const $=["get","head","post","put","patch","delete","options","trace"];function V(r){let e={},t={},o={},h=r.paths;return h?(Object.keys(h).forEach(n=>{let s=h[n];for(let a of $){if(!s[a]||!s[a].tags)continue;let p=a.toLowerCase();o[p]=(o[p]||0)+1,o.total=(o.total||0)+1,s[a].tags.forEach(c=>{let i=e[c];i||(i=e[c]={});let l=i[n];l||(l=i[n]={});let f=n+"."+a;l[a]=s[a],l[a].path=f,l[a].url=n,l[a].method=a,t[f]=s[a]})}}),{urlMethodMap:t,tagPathMap:e,methodStatistic:o}):{urlMethodMap:t,tagPathMap:e,methodStatistic:o}}function G(r,e,t,o){let h=[],n=1,s=r.tags||[];return s.length<=0&&Object.keys(e).forEach(a=>s.push({name:a})),s.forEach(a=>{let p=1,c=[],i=e[a.name];!i||(Object.keys(i).forEach(l=>{let f=1,d=i[l];Object.keys(d).forEach(g=>{let m=n+"_"+p+"_"+f,u=d[g];if(!A(l,u,t))return;u.treeId=m;let _=u.summary||u.path;c.push({title:_,key:m,isLeaf:!0,method:u.method,query:v(y({},o),{path:u.url,method:u.method})}),f++}),p++}),c.length>0&&h.push({title:a.name,key:n,children:c}),n++)}),[{key:"main",title:r.info.title||"OpenApi\u63A5\u53E3\u6587\u6863",children:h}]}function A(r,e,t){if(!t||!r||(r=r.toLowerCase(),t=t.toLowerCase(),r.indexOf(t)>=0))return!0;let o=e.path+e.method+e.summary+e.description+e.tags;return o&&o.toLowerCase().indexOf(t)>=0}const B={emits:["update:value","change"],setup(r,{emit:e}){j(()=>{n()});let t=T(300),o=T(),h=T();const n=()=>{let s=o.value,a=h.value;s.onmousedown=p=>{let c=p.clientX;return s.style.background="#ccc",a.style.background="#aaa",s.left=s.offsetLeft,document.onmousemove=i=>{let l=i.clientX,f=c-l;(f<0&&t.value<600||f>0&&t.value>300)&&(c=l,t.value-=f,t.value<300&&(t.value=300),e("update:value",t.value),e("change",t.value))},document.onmouseup=()=>{s.style.background="#fafafa",a.style.background="#ccc",document.onmousemove=null,document.onmouseup=null},!1}};return{leftAsideWidth:t,leftResizeRef:o,leftResizeBarRef:h}}},P={ref:"leftResizeRef",class:"left-resize"},U={ref:"leftResizeBarRef"};function S(r,e,t,o,h,n){return z(),C("div",P,[D("i",U,"...",512)],512)}var J=R(B,[["render",S],["__scopeId","data-v-33303c20"]]),K="assets/api-logo.952f0c92.png";export{J as L,K as _,W as a,V as b,G as c,H as g};
|
||||
BIN
zyplayer-doc-api/src/main/resources/dist/assets/api-logo.952f0c92.png
vendored
Normal file
BIN
zyplayer-doc-api/src/main/resources/dist/assets/api-logo.952f0c92.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.7 KiB |
5
zyplayer-doc-api/src/main/resources/dist/assets/custom.6a6c45c1.js
vendored
Normal file
5
zyplayer-doc-api/src/main/resources/dist/assets/custom.6a6c45c1.js
vendored
Normal file
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 16 KiB After Width: | Height: | Size: 16 KiB |
1116
zyplayer-doc-api/src/main/resources/dist/assets/index.9cc8b401.js
vendored
Normal file
1116
zyplayer-doc-api/src/main/resources/dist/assets/index.9cc8b401.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1703
zyplayer-doc-api/src/main/resources/dist/assets/index.b99389a4.js
vendored
Normal file
1703
zyplayer-doc-api/src/main/resources/dist/assets/index.b99389a4.js
vendored
Normal file
File diff suppressed because one or more lines are too long
1
zyplayer-doc-api/src/main/resources/dist/assets/logUtil.24f55f0f.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/logUtil.24f55f0f.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
import{B as r}from"./vendor.948fa90f.js";var g={log(o,l,s){console.log(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+l,s)},logMessage(o,l,s){console.log(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+l,s),r.error(o+"-\u9047\u5230\u672A\u5904\u7406\u7684\u7C7B\u578B\uFF0C\u8BF7\u8054\u7CFB\u5F00\u53D1\u4EBA\u5458\u4FEE\u6539\uFF1A"+l)}};export{g as l};
|
||||
1
zyplayer-doc-api/src/main/resources/dist/assets/main.92a9e84b.js
vendored
Normal file
1
zyplayer-doc-api/src/main/resources/dist/assets/main.92a9e84b.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
zyplayer-doc-api/src/main/resources/dist/assets/style.a6d9edcc.css
vendored
Normal file
8
zyplayer-doc-api/src/main/resources/dist/assets/style.a6d9edcc.css
vendored
Normal file
File diff suppressed because one or more lines are too long
10
zyplayer-doc-api/src/main/resources/dist/assets/unitConvert.b04ed2a3.js
vendored
Normal file
10
zyplayer-doc-api/src/main/resources/dist/assets/unitConvert.b04ed2a3.js
vendored
Normal file
File diff suppressed because one or more lines are too long
161
zyplayer-doc-api/src/main/resources/dist/assets/vendor.948fa90f.js
vendored
Normal file
161
zyplayer-doc-api/src/main/resources/dist/assets/vendor.948fa90f.js
vendored
Normal file
File diff suppressed because one or more lines are too long
16
zyplayer-doc-api/src/main/resources/dist/doc-api.html
vendored
Normal file
16
zyplayer-doc-api/src/main/resources/dist/doc-api.html
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" href="api-logo.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>API文档管理</title>
|
||||
<script type="module" crossorigin src="assets/main.92a9e84b.js"></script>
|
||||
<link rel="modulepreload" href="assets/vendor.948fa90f.js">
|
||||
<link rel="stylesheet" href="assets/style.a6d9edcc.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -4,58 +4,42 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
<version>1.0.6</version>
|
||||
<name>zyplayer-doc-core</name>
|
||||
|
||||
<url>http://maven.apache.org</url>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
||||
<fastjson.version>1.2.61</fastjson.version>
|
||||
<pagehelper.version>4.1.6</pagehelper.version>
|
||||
<springfox.swagger.version>2.9.2</springfox.swagger.version>
|
||||
</properties>
|
||||
<parent>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>${springfox.swagger.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>${fastjson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
<version>4.1.8</version>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
</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>${pagehelper.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<version>3.0.6</version>
|
||||
<artifactId>mybatis-plus-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -2,11 +2,17 @@ package com.zyplayer.doc.core.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.METHOD,ElementType.TYPE})
|
||||
/**
|
||||
* 用户登录校验注解
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019年5月29日
|
||||
*/
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface AuthMan {
|
||||
String[] value() default {};
|
||||
String authUrl() default "common/authfailed";
|
||||
|
||||
boolean all() default false;
|
||||
}
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.zyplayer.doc.core.bean.swagger;
|
||||
|
||||
public class Contact {
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
package com.zyplayer.doc.core.bean.swagger;
|
||||
|
||||
public class Info {
|
||||
|
||||
private String description;
|
||||
private String version;
|
||||
private String title;
|
||||
private Contact contact;
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setContact(Contact contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
public Contact getContact() {
|
||||
return contact;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
package com.zyplayer.doc.core.bean.swagger;
|
||||
|
||||
public class Paths {
|
||||
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.zyplayer.doc.core.bean.swagger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SwaggerApiDocs {
|
||||
|
||||
private String swagger;
|
||||
private Info info;
|
||||
private String host;
|
||||
private String basePath;
|
||||
private List<String> tags;
|
||||
private Paths paths;
|
||||
|
||||
public void setSwagger(String swagger) {
|
||||
this.swagger = swagger;
|
||||
}
|
||||
|
||||
public String getSwagger() {
|
||||
return swagger;
|
||||
}
|
||||
|
||||
public void setInfo(Info info) {
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public Info getInfo() {
|
||||
return info;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public void setBasePath(String basePath) {
|
||||
this.basePath = basePath;
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public void setTags(List<String> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public List<String> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setPaths(Paths paths) {
|
||||
this.paths = paths;
|
||||
}
|
||||
|
||||
public Paths getPaths() {
|
||||
return paths;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,29 +2,32 @@ package com.zyplayer.doc.core.exception;
|
||||
|
||||
/**
|
||||
* 前端提示异常
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年12月8日
|
||||
*/
|
||||
public class ConfirmException extends RuntimeException {
|
||||
|
||||
|
||||
private static final long serialVersionUID = -7084066605197111614L;
|
||||
|
||||
|
||||
public ConfirmException() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
||||
public ConfirmException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
|
||||
public ConfirmException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
|
||||
public ConfirmException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
|
||||
public ConfirmException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zyplayer.doc.core.json;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -20,9 +21,11 @@ import java.util.Objects;
|
||||
*/
|
||||
public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
private static SerializeConfig mapping = new SerializeConfig();
|
||||
|
||||
static {
|
||||
mapping.put(Date.class, new SimpleDateFormatSerializer("yyyy-MM-dd HH:mm:ss"));
|
||||
}
|
||||
|
||||
@ApiModelProperty(value = "状态码")
|
||||
private Integer errCode;
|
||||
@ApiModelProperty(value = "返回值说明")
|
||||
@@ -37,46 +40,46 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
private Integer pageSize;
|
||||
@ApiModelProperty(value = "总页数")
|
||||
private Integer totalPage;
|
||||
|
||||
|
||||
public DocResponseJson() {
|
||||
this.errCode = 200;
|
||||
}
|
||||
|
||||
|
||||
public DocResponseJson(Object data) {
|
||||
this.setData(data);
|
||||
this.errCode = 200;
|
||||
}
|
||||
|
||||
|
||||
public DocResponseJson(int errCode, String errMsg) {
|
||||
super();
|
||||
this.errCode = errCode;
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
|
||||
public DocResponseJson(int errCode, String errMsg, Object data) {
|
||||
super();
|
||||
this.setData(data);
|
||||
this.errCode = errCode;
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
|
||||
|
||||
public DocResponseJson(Integer errCode) {
|
||||
super();
|
||||
this.errCode = errCode;
|
||||
}
|
||||
|
||||
|
||||
public Integer getErrCode() {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
|
||||
public void setErrCode(Integer errCode) {
|
||||
this.errCode = errCode;
|
||||
}
|
||||
|
||||
|
||||
public String getErrMsg() {
|
||||
return errMsg;
|
||||
}
|
||||
|
||||
|
||||
public void setErrMsg(String errMsg) {
|
||||
this.errMsg = errMsg;
|
||||
}
|
||||
@@ -138,13 +141,13 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 提示语
|
||||
*
|
||||
* @return
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月7日
|
||||
* @return
|
||||
*/
|
||||
public static <T> DocResponseJson<T> warn(String errMsg) {
|
||||
return new DocResponseJson<T>(300, errMsg);
|
||||
@@ -153,9 +156,9 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
/**
|
||||
* 错误
|
||||
*
|
||||
* @return
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月7日
|
||||
* @return
|
||||
*/
|
||||
public static <T> DocResponseJson<T> error(String errMsg) {
|
||||
return new DocResponseJson<T>(500, errMsg);
|
||||
@@ -164,31 +167,31 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
/**
|
||||
* 失败
|
||||
*
|
||||
* @return
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月7日
|
||||
* @return
|
||||
*/
|
||||
public static <T> DocResponseJson<T> failure(int errCode, String errMsg) {
|
||||
return new DocResponseJson<T>(errCode, errMsg);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 成功的返回方法
|
||||
*
|
||||
* @return
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月7日
|
||||
* @return
|
||||
*/
|
||||
public static <T> DocResponseJson<T> ok() {
|
||||
return new DocResponseJson<>();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 成功的返回方法
|
||||
*
|
||||
* @return
|
||||
* @author 暮光:城中城
|
||||
* @since 2018年8月7日
|
||||
* @return
|
||||
*/
|
||||
public static <T> DocResponseJson<T> ok(Object data) {
|
||||
if (data == null) {
|
||||
@@ -198,7 +201,7 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
responseJson.setData(data);
|
||||
return responseJson;
|
||||
}
|
||||
|
||||
|
||||
public String toJson() {
|
||||
return JSON.toJSONString(this, mapping);
|
||||
}
|
||||
@@ -215,6 +218,7 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public boolean isOk() {
|
||||
return Objects.equals(this.errCode, 200);
|
||||
}
|
||||
@@ -223,5 +227,5 @@ public class DocResponseJson<T> implements ResponseJson<T> {
|
||||
public String toString() {
|
||||
return "DefaultResponseJson [errCode=" + errCode + ", errMsg=" + errMsg + ", data=" + data + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,67 +1,18 @@
|
||||
package com.zyplayer.doc.core.json;
|
||||
|
||||
/**
|
||||
* http静态资源定义
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019年05月29日
|
||||
*/
|
||||
public class HttpConst {
|
||||
|
||||
/** 每页显示条数 **/
|
||||
public static final int PAGE_NUMBER = 50;
|
||||
/** 默认当前页 **/
|
||||
public static final int CURRENT_PAGE = 1;
|
||||
|
||||
/** 图片验证码 **/
|
||||
public static final String SESSION_VERIFY_CODE = "SESSION_VERIFY_CODE";
|
||||
/** 邮箱验证码 **/
|
||||
public static final String SESSION_EMAIL_CODE = "SESSION_EMAIL_CODE";
|
||||
/** 请求失败的原因 **/
|
||||
public static final String SESSION_FAIL_REASON = "SESSION_FAIL_REASON";
|
||||
/** operator */
|
||||
public static final String OPERATOR = "OPERATOR";
|
||||
|
||||
/** 分页-总条数 */
|
||||
public static final String PAGE_TOTAL = "PAGE_TOTAL";
|
||||
/** 分页-当前页数 */
|
||||
public static final String PAGE_NOWPAGE = "PAGE_NOWPAGE";
|
||||
/** 分页-总页数 */
|
||||
public static final String PAGE_PAGECOUNT = "PAGE_PAGECOUNT";
|
||||
/** 分页-每页多少条 */
|
||||
public static final String PAGE_SIZE = "PAGE_SIZE";
|
||||
|
||||
/** 会话连接 */
|
||||
/**
|
||||
* 会话连接
|
||||
*/
|
||||
public static final String ACCESS_TOKEN = "accessToken";
|
||||
/** 存在于ThreadLocal的http request */
|
||||
public static final String HTTP_SERVLET_REQUEST = "HTTP_SERVLET_REQUEST";
|
||||
/** 存在于ThreadLocal的HTTP_SESSION */
|
||||
public static final String HTTP_SESSION = "HTTP_SESSION";
|
||||
|
||||
/** 存于operator中权限的缓存头 **/
|
||||
public static final String AUTH_CACHE_HEAD = "AUTH_CACHE_HEAD_";
|
||||
/** 存于operator中的用户信息 **/
|
||||
public static final String CACHE_OPERATOR_USER_INFO = "USER_INFO";
|
||||
/** 存于operator中的城市信息 **/
|
||||
public static final String CACHE_OPERATOR_CITY_ID = "CITY_ID";
|
||||
/** 存于operator中的token绑定的访问信息,使得换一台电脑不能使用此token **/
|
||||
public static final String CACHE_OPERATOR_ACCESS_TOKEN_VALIDATE = "ACCESS_TOKEN_VALIDATE";
|
||||
/** 存于operator中的token信息 **/
|
||||
public static final String CACHE_OPERATOR_ACCESS_TOKEN = "accessToken";
|
||||
/** 存于operator中的微信sessionKey信息 **/
|
||||
public static final String CACHE_OPERATOR_SESSION_KEY = "sessionKey";
|
||||
|
||||
// 新版本使用的错误码
|
||||
/** 成功 **/
|
||||
public static final int SUCCESS = 200;
|
||||
/** 提示性状态 需要客户端配合展示 **/
|
||||
public static final int CONFIRM_CODE = 300;
|
||||
/** accessToken非法或过期,需要重新登录 **/
|
||||
/**
|
||||
* accessToken非法或过期,需要重新登录
|
||||
**/
|
||||
public static final int TOKEN_TIMEOUT = 400;
|
||||
/** 业务接口缺少参数,errMsg会返回错误信息 **/
|
||||
public static final int MISSING_PARAMETER = 401;
|
||||
/** API 未授权 **/
|
||||
public static final int UNAUTHORIZED = 402;
|
||||
/** 接口调用频率超限 **/
|
||||
public static final int CALL_FREQUENCY_GAUGE = 403;
|
||||
/** 微信未扫码登录异常 **/
|
||||
public static final int WX_NOT_LOGIN = 404;
|
||||
/** 请升级至新版使用此功能 **/
|
||||
public static final int NEED_UPGRADE = 405;
|
||||
/** 服务器端未知错误 **/
|
||||
public static final int OTHER_FAIL = 500;
|
||||
}
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
package com.zyplayer.doc.core.util;
|
||||
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
/**
|
||||
* 字符串操作类
|
||||
*/
|
||||
public final class StringUtil {
|
||||
|
||||
/**
|
||||
* 获取错误信息
|
||||
*
|
||||
* @param e
|
||||
* @return
|
||||
* @author 暮光:城中城
|
||||
*/
|
||||
public static String getException(Throwable e) {
|
||||
StringWriter sw = null;
|
||||
PrintWriter pw = null;
|
||||
try {
|
||||
sw = new StringWriter();
|
||||
pw = new PrintWriter(sw);
|
||||
e.printStackTrace(pw);
|
||||
pw.flush();
|
||||
sw.flush();
|
||||
return sw.toString();
|
||||
} finally {
|
||||
if (sw != null) {
|
||||
try {
|
||||
sw.close();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (pw != null) {
|
||||
try {
|
||||
pw.close();
|
||||
} catch (Exception e1) {
|
||||
e1.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.zyplayer.doc.core.util;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
public class ThreadLocalUtil {
|
||||
private static ThreadLocal<HttpServletRequest> request = new ThreadLocal<>();
|
||||
|
||||
public static void setHttpServletRequest(HttpServletRequest request) {
|
||||
ThreadLocalUtil.request.set(request);
|
||||
}
|
||||
|
||||
public static HttpServletRequest getHttpServletRequest() {
|
||||
return ThreadLocalUtil.request.get();
|
||||
}
|
||||
|
||||
public static void clean() {
|
||||
ThreadLocalUtil.request.remove();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.zyplayer.doc.core.util;
|
||||
|
||||
/**
|
||||
* zyplayer-doc版本号
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-06-06
|
||||
*/
|
||||
public class ZyplayerDocVersion {
|
||||
public static final String version = "1.1.0";
|
||||
}
|
||||
@@ -4,29 +4,14 @@
|
||||
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>
|
||||
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-data</artifactId>
|
||||
<version>1.0.6</version>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.1.6.RELEASE</version>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc</artifactId>
|
||||
<version>1.1.0</version>
|
||||
</parent>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<java.version>1.8</java.version>
|
||||
<mybatis.plus.boot.starter.version>3.0.6</mybatis.plus.boot.starter.version>
|
||||
<fastjson.version>1.2.53</fastjson.version>
|
||||
<velocity.engine.core.version>2.0</velocity.engine.core.version>
|
||||
<dozer.core.version>6.1.0</dozer.core.version>
|
||||
<alibaba.druid.version>1.1.9</alibaba.druid.version>
|
||||
<zyplayer.doc.version>1.0.6</zyplayer.doc.version>
|
||||
<elasticsearch.version>7.2.0</elasticsearch.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
@@ -44,68 +29,76 @@
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis.plus.boot.starter.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-generator</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid</artifactId>
|
||||
<version>${alibaba.druid.version}</version>
|
||||
</dependency>
|
||||
<!-- 数据库驱动 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.47</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jtds</groupId>
|
||||
<artifactId>jtds</artifactId>
|
||||
<version>1.3.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>12.1.0.1-atlassian-hosted</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</dependency>
|
||||
<!-- 按需开启对hive的支持,它依赖的包实在太多太大了-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.apache.hive</groupId>-->
|
||||
<!-- <artifactId>hive-jdbc</artifactId>-->
|
||||
<!-- <version>2.1.1</version>-->
|
||||
<!-- <exclusions>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>commons-logging</artifactId>-->
|
||||
<!-- <groupId>commons-logging</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>log4j</artifactId>-->
|
||||
<!-- <groupId>log4j</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>log4j-1.2-api</artifactId>-->
|
||||
<!-- <groupId>org.apache.logging.log4j</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>log4j-slf4j-impl</artifactId>-->
|
||||
<!-- <groupId>org.apache.logging.log4j</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>log4j-web</artifactId>-->
|
||||
<!-- <groupId>org.apache.logging.log4j</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- <exclusion>-->
|
||||
<!-- <artifactId>slf4j-log4j12</artifactId>-->
|
||||
<!-- <groupId>org.slf4j</groupId>-->
|
||||
<!-- </exclusion>-->
|
||||
<!-- </exclusions>-->
|
||||
<!-- </dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.github.dozermapper</groupId>
|
||||
<artifactId>dozer-core</artifactId>
|
||||
<version>${dozer.core.version}</version>
|
||||
</dependency>
|
||||
<!-- 在线文档解析页面 -->
|
||||
<!--zyplayer-doc-core-->
|
||||
<dependency>
|
||||
<groupId>com.zyplayer</groupId>
|
||||
<artifactId>zyplayer-doc-core</artifactId>
|
||||
<version>${zyplayer.doc.version}</version>
|
||||
</dependency>
|
||||
<!-- velocity 模板引擎, 默认 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.velocity</groupId>
|
||||
<artifactId>velocity-engine-core</artifactId>
|
||||
<version>${velocity.engine.core.version}</version>
|
||||
</dependency>
|
||||
<!-- freemarker 模板引擎 -->
|
||||
<dependency>
|
||||
<groupId>org.freemarker</groupId>
|
||||
<artifactId>freemarker</artifactId>
|
||||
</dependency>
|
||||
<!-- aspectj -->
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjtools</artifactId>
|
||||
</dependency>
|
||||
<!--elasticsearch-->
|
||||
<dependency>
|
||||
<groupId>org.elasticsearch.client</groupId>
|
||||
<artifactId>elasticsearch-rest-high-level-client</artifactId>
|
||||
<version>${elasticsearch.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
package com.zyplayer.doc.data.aspect;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.zyplayer.doc.core.annotation.AuthMan;
|
||||
import com.zyplayer.doc.core.json.DocResponseJson;
|
||||
import com.zyplayer.doc.core.json.HttpConst;
|
||||
import com.zyplayer.doc.core.json.ResponseJson;
|
||||
import com.zyplayer.doc.core.util.ThreadLocalUtil;
|
||||
import com.zyplayer.doc.data.config.security.DocUserDetails;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import com.zyplayer.doc.data.utils.BeanUtil;
|
||||
import org.aspectj.lang.ProceedingJoinPoint;
|
||||
import org.aspectj.lang.annotation.Around;
|
||||
import org.aspectj.lang.annotation.Aspect;
|
||||
import org.aspectj.lang.reflect.MethodSignature;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.Map;
|
||||
|
||||
@Aspect
|
||||
@Component
|
||||
public class AuthAspect {
|
||||
|
||||
@Around(value = "@annotation(com.zyplayer.doc.core.annotation.AuthMan) || @within(com.zyplayer.doc.core.annotation.AuthMan)")
|
||||
public Object authController(ProceedingJoinPoint pjp) throws Throwable {
|
||||
AuthMan authMan = BeanUtil.getAnnotation(pjp, AuthMan.class);
|
||||
ResponseBody responseBody = BeanUtil.getAnnotation(pjp, ResponseBody.class);
|
||||
RestController restController = BeanUtil.getAnnotation(pjp, RestController.class);
|
||||
boolean isResponseBody = (restController != null || responseBody != null);
|
||||
|
||||
Class<?> returnType = ((MethodSignature) pjp.getSignature()).getMethod().getReturnType();
|
||||
DocUserDetails currentUser = DocUserUtil.getCurrentUser();
|
||||
if (currentUser == null) {
|
||||
String reason = "你访问的内容需要登录,请登录后再试";
|
||||
if (isResponseBody) {
|
||||
return DocResponseJson.failure(HttpConst.TOKEN_TIMEOUT, reason);
|
||||
} else if (returnType.isAssignableFrom(ModelAndView.class)) {
|
||||
HttpServletRequest request = ThreadLocalUtil.getHttpServletRequest();
|
||||
StringBuffer requestURL = request.getRequestURL();
|
||||
String requestURLStr = URLEncoder.encode(requestURL.toString(), "utf-8");
|
||||
return new ModelAndView("redirect:#/user/login?redirect=" + requestURLStr);
|
||||
} else if (returnType.isAssignableFrom(Map.class)) {
|
||||
return Maps.newHashMap();
|
||||
}
|
||||
}
|
||||
// 判断权限是否足够
|
||||
boolean haveAuth = DocUserUtil.haveAuth(authMan.value());
|
||||
if (haveAuth) {
|
||||
return pjp.proceed();
|
||||
}
|
||||
String reasonStr = "没有操作权限,请联系管理员";
|
||||
if (isResponseBody) {
|
||||
Method method = ((MethodSignature) pjp.getSignature()).getMethod();
|
||||
if (method.getReturnType().equals(ResponseJson.class)) {
|
||||
return DocResponseJson.warn(reasonStr);
|
||||
} else {
|
||||
try {
|
||||
return Class.forName(method.getReturnType().getName()).newInstance();
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return authMan.authUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.zyplayer.doc.data.config;
|
||||
|
||||
import com.zyplayer.doc.core.json.HttpConst;
|
||||
import com.zyplayer.doc.data.config.security.DocUserUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 登录和跨域拦截器
|
||||
* @author 暮光:城中城
|
||||
* @since 2019年05月25日
|
||||
*/
|
||||
@Component
|
||||
public class DocLoginOriginInterceptor implements HandlerInterceptor {
|
||||
|
||||
@Value("${zyplayer.doc.manage.originDomainRegex:''}")
|
||||
private String originDomainRegex;
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object arg2, Exception arg3) {
|
||||
// 清理用户信息
|
||||
DocUserUtil.clean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object haddler, ModelAndView modelAndView) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 记录请求信息
|
||||
*/
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object obj) {
|
||||
// 指定域名可跨域访问
|
||||
if (StringUtils.isNotBlank(originDomainRegex)) {
|
||||
String origin = request.getHeader("Origin");
|
||||
if (StringUtils.isNotBlank(origin) && origin.toLowerCase().matches(originDomainRegex)) {
|
||||
response.setHeader("Access-Control-Allow-Origin", origin); // 允许访问的域
|
||||
response.setHeader("Access-Control-Allow-Methods", "HEAD,GET,POST,PUT,DELETE");// 允许GET、POST的外域请求
|
||||
response.setHeader("Access-Control-Allow-Credentials", "true"); // 允许请求带cookie到服务器
|
||||
response.setContentType("application/json; charset=utf-8"); // 设定JSON格式标准输出、及编码
|
||||
}
|
||||
}
|
||||
// 清理用户信息
|
||||
DocUserUtil.clean();
|
||||
// 设置token
|
||||
String accessToken = getCookieValueByRequest(request, HttpConst.ACCESS_TOKEN);
|
||||
DocUserUtil.setAccessToken(accessToken);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取cookie
|
||||
*
|
||||
* @param request
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static Cookie getCookieByRequest(HttpServletRequest request, String name) {
|
||||
if (StringUtils.isEmpty(name)) {
|
||||
return null;
|
||||
}
|
||||
Cookie[] cookies = request.getCookies();
|
||||
for (int i = 0; (cookies != null) && (i < cookies.length); i++) {
|
||||
Cookie cookie = cookies[i];
|
||||
if (name.equals(cookie.getName())) {
|
||||
return cookie;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取cookie值
|
||||
*
|
||||
* @param request
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String getCookieValueByRequest(HttpServletRequest request, String name) {
|
||||
Cookie cookie = getCookieByRequest(request, name);
|
||||
return cookie == null ? null : cookie.getValue();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.zyplayer.doc.data.config;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInterceptor;
|
||||
import com.zyplayer.doc.data.repository.support.interceptor.SqlLogInterceptor;
|
||||
import com.zyplayer.doc.data.utils.DruidDataSourceUtil;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -15,10 +15,12 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.sql.DataSource;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* mybatis plus数据库配置
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-02-16
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
@@ -30,14 +32,7 @@ public class MybatisPlusConfig {
|
||||
/**
|
||||
* MYSQL 分页
|
||||
**/
|
||||
private static final PageHelper MYSQL_PAGE_HELPER;
|
||||
|
||||
static {
|
||||
MYSQL_PAGE_HELPER = new PageHelper();
|
||||
Properties properties = new Properties();
|
||||
properties.setProperty("dialect", "mysql");
|
||||
MYSQL_PAGE_HELPER.setProperties(properties);
|
||||
}
|
||||
private static final PageInterceptor MYSQL_PAGE_HELPER = new PageInterceptor();
|
||||
|
||||
/**
|
||||
* 数据库配置
|
||||
@@ -56,18 +51,18 @@ public class MybatisPlusConfig {
|
||||
@Value("${zyplayer.doc.manage.datasource.password}")
|
||||
private String password;
|
||||
@Resource
|
||||
private PaginationInterceptor paginationInterceptor;
|
||||
private MybatisPlusInterceptor paginationInterceptor;
|
||||
|
||||
@Bean(name = "manageDatasource")
|
||||
public DataSource manageDatasource() throws Exception {
|
||||
return DruidDataSourceUtil.createDataSource(driverClassName, url, username, password);
|
||||
return DruidDataSourceUtil.createDataSource(driverClassName, url, username, password, false);
|
||||
}
|
||||
|
||||
@Bean(name = "manageSqlSessionFactory")
|
||||
public MybatisSqlSessionFactoryBean manageSqlSessionFactory() throws Exception {
|
||||
MybatisSqlSessionFactoryBean sqlSessionFactoryBean = new MybatisSqlSessionFactoryBean();
|
||||
sqlSessionFactoryBean.setDataSource(manageDatasource());
|
||||
sqlSessionFactoryBean.setPlugins(new Interceptor[]{SQL_LOG_INTERCEPTOR, MYSQL_PAGE_HELPER, paginationInterceptor});
|
||||
sqlSessionFactoryBean.setPlugins(SQL_LOG_INTERCEPTOR, MYSQL_PAGE_HELPER, paginationInterceptor);
|
||||
|
||||
PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
||||
sqlSessionFactoryBean.setMapperLocations(resolver.getResources("classpath:/mapper/manage/*Mapper.xml"));
|
||||
@@ -76,7 +71,9 @@ public class MybatisPlusConfig {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PaginationInterceptor paginationInterceptor() {
|
||||
return new PaginationInterceptor();
|
||||
public MybatisPlusInterceptor paginationInterceptor() {
|
||||
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
||||
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
||||
return mybatisPlusInterceptor;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
package com.zyplayer.doc.data.config.security;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 登录用户信息
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2018-12-02
|
||||
*/
|
||||
public class DocUserDetails {
|
||||
private Long userId;
|
||||
private String username;
|
||||
private String password;
|
||||
private boolean enabled;
|
||||
private Set<String> authorities;
|
||||
private List<UserAuthVo> userAuthList;
|
||||
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
@@ -41,12 +47,12 @@ public class DocUserDetails {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public Set<String> getAuthorities() {
|
||||
return authorities;
|
||||
public List<UserAuthVo> getUserAuthList() {
|
||||
return userAuthList;
|
||||
}
|
||||
|
||||
public void setAuthorities(Set<String> authorities) {
|
||||
this.authorities = authorities;
|
||||
public void setUserAuthList(List<UserAuthVo> userAuthList) {
|
||||
this.userAuthList = userAuthList;
|
||||
}
|
||||
|
||||
public DocUserDetails(Long userId, String username) {
|
||||
@@ -62,13 +68,13 @@ public class DocUserDetails {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
public DocUserDetails(Long userId, String username, String password, boolean enabled, Set<String> authorities) {
|
||||
public DocUserDetails(Long userId, String username, String password, boolean enabled, List<UserAuthVo> userAuthList) {
|
||||
super();
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.enabled = enabled;
|
||||
this.authorities = authorities;
|
||||
this.userAuthList = userAuthList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,7 +84,7 @@ public class DocUserDetails {
|
||||
", username='" + username + '\'' +
|
||||
", password='" + password + '\'' +
|
||||
", enabled=" + enabled +
|
||||
", authorities=" + authorities +
|
||||
", userAuthList=" + userAuthList +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,38 @@
|
||||
package com.zyplayer.doc.data.config.security;
|
||||
|
||||
import com.zyplayer.doc.data.utils.CachePrefix;
|
||||
import com.zyplayer.doc.data.utils.CacheUtil;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户工具类
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019年05月25日
|
||||
*/
|
||||
public class DocUserUtil {
|
||||
private static ThreadLocal<DocUserDetails> DOC_USER_DETAILS = new ThreadLocal<>();
|
||||
private static ThreadLocal<String> ACCESS_TOKEN = new ThreadLocal<>();
|
||||
private static final ThreadLocal<DocUserDetails> DOC_USER_DETAILS = new ThreadLocal<>();
|
||||
private static final ThreadLocal<String> ACCESS_TOKEN = new ThreadLocal<>();
|
||||
|
||||
public static void setAccessToken(String accessToken) {
|
||||
DocUserUtil.ACCESS_TOKEN.set(accessToken);
|
||||
}
|
||||
|
||||
public static boolean haveCustomAuth(String authName, String suffix) {
|
||||
return haveAuth(authName + suffix);
|
||||
public static boolean haveCustomAuth(String authName, Integer sysType, Integer sysModuleType, Long sysModuleId) {
|
||||
DocUserDetails currentUser = getCurrentUser();
|
||||
if (currentUser == null) {
|
||||
return false;
|
||||
}
|
||||
return currentUser.getUserAuthList().stream().anyMatch(auth ->
|
||||
Objects.equals(auth.getAuthCode(), authName)
|
||||
&& Objects.equals(auth.getSysType(), sysType)
|
||||
&& Objects.equals(auth.getSysModuleType(), sysModuleType)
|
||||
&& Objects.equals(auth.getSysModuleId(), sysModuleId)
|
||||
);
|
||||
}
|
||||
|
||||
public static boolean haveAuth(String... authNames) {
|
||||
@@ -24,8 +40,9 @@ public class DocUserUtil {
|
||||
if (currentUser == null) {
|
||||
return false;
|
||||
}
|
||||
Set<String> authCodeSet = currentUser.getUserAuthList().stream().map(UserAuthVo::getAuthCode).collect(Collectors.toSet());
|
||||
for (String authName : authNames) {
|
||||
if (!currentUser.getAuthorities().contains(authName)) {
|
||||
if (!authCodeSet.contains(authName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -54,6 +71,21 @@ public class DocUserUtil {
|
||||
public static void setCurrentUser(String accessToken, DocUserDetails docUser) {
|
||||
DOC_USER_DETAILS.set(docUser);
|
||||
CacheUtil.put(accessToken, docUser);
|
||||
CacheUtil.put(CachePrefix.LOGIN_USER_ID_TOKEN + docUser.getUserId(), accessToken);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前用户权限
|
||||
*/
|
||||
public static void setUserAuth(Long userId, List<UserAuthVo> userAuthList) {
|
||||
String userToken = CacheUtil.get(CachePrefix.LOGIN_USER_ID_TOKEN + userId);
|
||||
if (userToken != null) {
|
||||
DocUserDetails docUser = CacheUtil.get(userToken);
|
||||
if (docUser != null) {
|
||||
docUser.setUserAuthList(userAuthList);
|
||||
CacheUtil.put(userToken, docUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.zyplayer.doc.data.config.security;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserAuth;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysModuleType;
|
||||
import com.zyplayer.doc.data.repository.support.consts.DocSysType;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户权限表
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2019-05-31
|
||||
*/
|
||||
public class UserAuthVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public UserAuthVo() {
|
||||
|
||||
}
|
||||
|
||||
public UserAuthVo(UserAuth userAuth) {
|
||||
this.authId = userAuth.getAuthId();
|
||||
this.sysType = userAuth.getSysType();
|
||||
this.sysModuleType = userAuth.getSysModuleType();
|
||||
this.sysModuleId = userAuth.getSysModuleId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 权限ID
|
||||
*/
|
||||
private Long authId;
|
||||
|
||||
/**
|
||||
* 权限code
|
||||
*/
|
||||
private String authCode;
|
||||
|
||||
/**
|
||||
* 系统类型,{@link DocSysType}
|
||||
*/
|
||||
private Integer sysType;
|
||||
|
||||
/**
|
||||
* 系统模块类型,{@link DocSysModuleType}
|
||||
*/
|
||||
private Integer sysModuleType;
|
||||
|
||||
/**
|
||||
* 系统模块ID
|
||||
*/
|
||||
private Long sysModuleId;
|
||||
|
||||
public Long getAuthId() {
|
||||
return authId;
|
||||
}
|
||||
|
||||
public void setAuthId(Long authId) {
|
||||
this.authId = authId;
|
||||
}
|
||||
|
||||
public Integer getSysType() {
|
||||
return sysType;
|
||||
}
|
||||
|
||||
public void setSysType(Integer sysType) {
|
||||
this.sysType = sysType;
|
||||
}
|
||||
|
||||
public Integer getSysModuleType() {
|
||||
return sysModuleType;
|
||||
}
|
||||
|
||||
public void setSysModuleType(Integer sysModuleType) {
|
||||
this.sysModuleType = sysModuleType;
|
||||
}
|
||||
|
||||
public Long getSysModuleId() {
|
||||
return sysModuleId;
|
||||
}
|
||||
|
||||
public void setSysModuleId(Long sysModuleId) {
|
||||
this.sysModuleId = sysModuleId;
|
||||
}
|
||||
|
||||
public String getAuthCode() {
|
||||
return authCode;
|
||||
}
|
||||
|
||||
public void setAuthCode(String authCode) {
|
||||
this.authCode = authCode;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* api文档地址
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-25
|
||||
*/
|
||||
@TableName("api_doc")
|
||||
public class ApiDoc implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 文档名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文档类型 1=swagger url 2=swagger json 3=openapi url 4=openapi json 5=自建API分组
|
||||
*/
|
||||
private Integer docType;
|
||||
|
||||
/**
|
||||
* 文档URL地址
|
||||
*/
|
||||
private String docUrl;
|
||||
|
||||
/**
|
||||
* 文档json内容
|
||||
*/
|
||||
private String jsonContent;
|
||||
|
||||
/**
|
||||
* 重写的域名
|
||||
*/
|
||||
private String rewriteDomain;
|
||||
|
||||
/**
|
||||
* 是否开放访问 0=否 1=是
|
||||
*/
|
||||
private Integer openVisit;
|
||||
|
||||
/**
|
||||
* 状态 1=启用 2=禁用
|
||||
*/
|
||||
private Integer docStatus;
|
||||
|
||||
/**
|
||||
* 开放文档UUID
|
||||
*/
|
||||
private String shareUuid;
|
||||
|
||||
/**
|
||||
* 开放文档使用说明
|
||||
*/
|
||||
private String shareInstruction;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public Integer getDocType() {
|
||||
return docType;
|
||||
}
|
||||
|
||||
public void setDocType(Integer docType) {
|
||||
this.docType = docType;
|
||||
}
|
||||
public String getDocUrl() {
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
public void setDocUrl(String docUrl) {
|
||||
this.docUrl = docUrl;
|
||||
}
|
||||
public String getJsonContent() {
|
||||
return jsonContent;
|
||||
}
|
||||
|
||||
public void setJsonContent(String jsonContent) {
|
||||
this.jsonContent = jsonContent;
|
||||
}
|
||||
public String getRewriteDomain() {
|
||||
return rewriteDomain;
|
||||
}
|
||||
|
||||
public void setRewriteDomain(String rewriteDomain) {
|
||||
this.rewriteDomain = rewriteDomain;
|
||||
}
|
||||
public Integer getOpenVisit() {
|
||||
return openVisit;
|
||||
}
|
||||
|
||||
public void setOpenVisit(Integer openVisit) {
|
||||
this.openVisit = openVisit;
|
||||
}
|
||||
public Integer getDocStatus() {
|
||||
return docStatus;
|
||||
}
|
||||
|
||||
public void setDocStatus(Integer docStatus) {
|
||||
this.docStatus = docStatus;
|
||||
}
|
||||
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 Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiDoc{" +
|
||||
"id=" + id +
|
||||
", name=" + name +
|
||||
", docType=" + docType +
|
||||
", docUrl=" + docUrl +
|
||||
", jsonContent=" + jsonContent +
|
||||
", rewriteDomain=" + rewriteDomain +
|
||||
", openVisit=" + openVisit +
|
||||
", docStatus=" + docStatus +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
|
||||
public String getShareUuid() {
|
||||
return shareUuid;
|
||||
}
|
||||
|
||||
public void setShareUuid(String shareUuid) {
|
||||
this.shareUuid = shareUuid;
|
||||
}
|
||||
|
||||
public String getShareInstruction() {
|
||||
return shareInstruction;
|
||||
}
|
||||
|
||||
public void setShareInstruction(String shareInstruction) {
|
||||
this.shareInstruction = shareInstruction;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* api文档全局参数记录
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-25
|
||||
*/
|
||||
@TableName("api_global_param")
|
||||
public class ApiGlobalParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* api_doc主键ID
|
||||
*/
|
||||
private Long docId;
|
||||
|
||||
/**
|
||||
* 参数类型 1=form 2=header 3=cookie
|
||||
*/
|
||||
private Integer paramType;
|
||||
|
||||
/**
|
||||
* 参数名
|
||||
*/
|
||||
private String paramKey;
|
||||
|
||||
/**
|
||||
* 参数值
|
||||
*/
|
||||
private String paramValue;
|
||||
|
||||
/**
|
||||
* 状态 1=启用 2=禁用
|
||||
*/
|
||||
private Integer paramStatus;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Integer getParamType() {
|
||||
return paramType;
|
||||
}
|
||||
|
||||
public void setParamType(Integer paramType) {
|
||||
this.paramType = paramType;
|
||||
}
|
||||
public String getParamKey() {
|
||||
return paramKey;
|
||||
}
|
||||
|
||||
public void setParamKey(String paramKey) {
|
||||
this.paramKey = paramKey;
|
||||
}
|
||||
public String getParamValue() {
|
||||
return paramValue;
|
||||
}
|
||||
|
||||
public void setParamValue(String paramValue) {
|
||||
this.paramValue = paramValue;
|
||||
}
|
||||
public Integer getParamStatus() {
|
||||
return paramStatus;
|
||||
}
|
||||
|
||||
public void setParamStatus(Integer paramStatus) {
|
||||
this.paramStatus = paramStatus;
|
||||
}
|
||||
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 Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiGlobalParam{" +
|
||||
"id=" + id +
|
||||
", paramType=" + paramType +
|
||||
", paramKey=" + paramKey +
|
||||
", paramValue=" + paramValue +
|
||||
", paramStatus=" + paramStatus +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
|
||||
public Long getDocId() {
|
||||
return docId;
|
||||
}
|
||||
|
||||
public void setDocId(Long docId) {
|
||||
this.docId = docId;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文档请求参数记录
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-25
|
||||
*/
|
||||
@TableName("api_request_param")
|
||||
public class ApiRequestParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* api_doc主键ID
|
||||
*/
|
||||
private Long docId;
|
||||
|
||||
/**
|
||||
* 文档url
|
||||
*/
|
||||
private String docUrl;
|
||||
|
||||
/**
|
||||
* form参数
|
||||
*/
|
||||
private String formData;
|
||||
|
||||
/**
|
||||
* body参数
|
||||
*/
|
||||
private String bodyData;
|
||||
|
||||
/**
|
||||
* header参数
|
||||
*/
|
||||
private String headerData;
|
||||
|
||||
/**
|
||||
* cookie参数
|
||||
*/
|
||||
private String cookieData;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getDocId() {
|
||||
return docId;
|
||||
}
|
||||
|
||||
public void setDocId(Long docId) {
|
||||
this.docId = docId;
|
||||
}
|
||||
public String getDocUrl() {
|
||||
return docUrl;
|
||||
}
|
||||
|
||||
public void setDocUrl(String docUrl) {
|
||||
this.docUrl = docUrl;
|
||||
}
|
||||
public String getFormData() {
|
||||
return formData;
|
||||
}
|
||||
|
||||
public void setFormData(String formData) {
|
||||
this.formData = formData;
|
||||
}
|
||||
public String getBodyData() {
|
||||
return bodyData;
|
||||
}
|
||||
|
||||
public void setBodyData(String bodyData) {
|
||||
this.bodyData = bodyData;
|
||||
}
|
||||
public String getHeaderData() {
|
||||
return headerData;
|
||||
}
|
||||
|
||||
public void setHeaderData(String headerData) {
|
||||
this.headerData = headerData;
|
||||
}
|
||||
public String getCookieData() {
|
||||
return cookieData;
|
||||
}
|
||||
|
||||
public void setCookieData(String cookieData) {
|
||||
this.cookieData = cookieData;
|
||||
}
|
||||
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 Integer getYn() {
|
||||
return yn;
|
||||
}
|
||||
|
||||
public void setYn(Integer yn) {
|
||||
this.yn = yn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ApiRequestParam{" +
|
||||
"id=" + id +
|
||||
", docId=" + docId +
|
||||
", docUrl=" + docUrl +
|
||||
", formData=" + formData +
|
||||
", bodyData=" + bodyData +
|
||||
", headerData=" + headerData +
|
||||
", cookieData=" + cookieData +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", yn=" + yn +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -58,6 +58,11 @@ public class DbFavorite implements Serializable {
|
||||
* 是否有效 0=无效 1=有效
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
/**
|
||||
* 执行参数JSON
|
||||
*/
|
||||
private String paramJson;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
@@ -129,4 +134,12 @@ public class DbFavorite implements Serializable {
|
||||
public void setDatasourceId(Long datasourceId) {
|
||||
this.datasourceId = datasourceId;
|
||||
}
|
||||
|
||||
public String getParamJson() {
|
||||
return paramJson;
|
||||
}
|
||||
|
||||
public void setParamJson(String paramJson) {
|
||||
this.paramJson = paramJson;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
@@ -53,6 +53,11 @@ public class DbHistory implements Serializable {
|
||||
*/
|
||||
private Integer yn;
|
||||
|
||||
/**
|
||||
* 执行参数JSON
|
||||
*/
|
||||
private String paramJson;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -115,4 +120,12 @@ public class DbHistory implements Serializable {
|
||||
public void setDatasourceId(Long datasourceId) {
|
||||
this.datasourceId = datasourceId;
|
||||
}
|
||||
|
||||
public String getParamJson() {
|
||||
return paramJson;
|
||||
}
|
||||
|
||||
public void setParamJson(String paramJson) {
|
||||
this.paramJson = paramJson;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据库函数修改日志
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-04-26
|
||||
*/
|
||||
public class DbProcLog implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 数据源ID
|
||||
*/
|
||||
private Long datasourceId;
|
||||
|
||||
/**
|
||||
* 所属数据库
|
||||
*/
|
||||
private String procDb;
|
||||
|
||||
/**
|
||||
* 名字
|
||||
*/
|
||||
private String procName;
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private String procType;
|
||||
|
||||
/**
|
||||
* 函数创建SQL
|
||||
*/
|
||||
private String procBody;
|
||||
|
||||
/**
|
||||
* 保存状态 1=成功 2=失败
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getDatasourceId() {
|
||||
return datasourceId;
|
||||
}
|
||||
|
||||
public void setDatasourceId(Long datasourceId) {
|
||||
this.datasourceId = datasourceId;
|
||||
}
|
||||
public String getProcDb() {
|
||||
return procDb;
|
||||
}
|
||||
|
||||
public void setProcDb(String procDb) {
|
||||
this.procDb = procDb;
|
||||
}
|
||||
public String getProcName() {
|
||||
return procName;
|
||||
}
|
||||
|
||||
public void setProcName(String procName) {
|
||||
this.procName = procName;
|
||||
}
|
||||
public String getProcType() {
|
||||
return procType;
|
||||
}
|
||||
|
||||
public void setProcType(String procType) {
|
||||
this.procType = procType;
|
||||
}
|
||||
public String getProcBody() {
|
||||
return procBody;
|
||||
}
|
||||
|
||||
public void setProcBody(String procBody) {
|
||||
this.procBody = procBody;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DbProcLog{" +
|
||||
"id=" + id +
|
||||
", datasourceId=" + datasourceId +
|
||||
", procDb=" + procDb +
|
||||
", procName=" + procName +
|
||||
", procType=" + procType +
|
||||
", procBody=" + procBody +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
"}";
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 表关系
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-06-07
|
||||
*/
|
||||
public class DbTableRelation implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 数据源ID
|
||||
*/
|
||||
private Long datasourceId;
|
||||
|
||||
/**
|
||||
* 源库名
|
||||
*/
|
||||
private String startDbName;
|
||||
|
||||
/**
|
||||
* 源表名
|
||||
*/
|
||||
private String startTableName;
|
||||
|
||||
/**
|
||||
* 源字段名
|
||||
*/
|
||||
private String startColumnName;
|
||||
|
||||
/**
|
||||
* 目标库名
|
||||
*/
|
||||
private String endDbName;
|
||||
|
||||
/**
|
||||
* 目标表名
|
||||
*/
|
||||
private String endTableName;
|
||||
|
||||
/**
|
||||
* 目标字段名
|
||||
*/
|
||||
private String endColumnName;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getDatasourceId() {
|
||||
return datasourceId;
|
||||
}
|
||||
|
||||
public void setDatasourceId(Long datasourceId) {
|
||||
this.datasourceId = datasourceId;
|
||||
}
|
||||
public String getStartDbName() {
|
||||
return startDbName;
|
||||
}
|
||||
|
||||
public void setStartDbName(String startDbName) {
|
||||
this.startDbName = startDbName;
|
||||
}
|
||||
public String getStartTableName() {
|
||||
return startTableName;
|
||||
}
|
||||
|
||||
public void setStartTableName(String startTableName) {
|
||||
this.startTableName = startTableName;
|
||||
}
|
||||
public String getStartColumnName() {
|
||||
return startColumnName;
|
||||
}
|
||||
|
||||
public void setStartColumnName(String startColumnName) {
|
||||
this.startColumnName = startColumnName;
|
||||
}
|
||||
public String getEndDbName() {
|
||||
return endDbName;
|
||||
}
|
||||
|
||||
public void setEndDbName(String endDbName) {
|
||||
this.endDbName = endDbName;
|
||||
}
|
||||
public String getEndTableName() {
|
||||
return endTableName;
|
||||
}
|
||||
|
||||
public void setEndTableName(String endTableName) {
|
||||
this.endTableName = endTableName;
|
||||
}
|
||||
public String getEndColumnName() {
|
||||
return endColumnName;
|
||||
}
|
||||
|
||||
public void setEndColumnName(String endColumnName) {
|
||||
this.endColumnName = endColumnName;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "DbTableRelation{" +
|
||||
"id=" + id +
|
||||
", datasourceId=" + datasourceId +
|
||||
", startDbName=" + startDbName +
|
||||
", startTableName=" + startTableName +
|
||||
", startColumnName=" + startColumnName +
|
||||
", endDbName=" + endDbName +
|
||||
", endTableName=" + endTableName +
|
||||
", endColumnName=" + endColumnName +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -59,9 +59,19 @@ public class UserAuth implements Serializable {
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 自定义权限结尾
|
||||
* 系统类型,DocSysType
|
||||
*/
|
||||
private String authCustomSuffix;
|
||||
private Integer sysType;
|
||||
|
||||
/**
|
||||
* 系统模块类型,DocSysModuleType
|
||||
*/
|
||||
private Integer sysModuleType;
|
||||
|
||||
/**
|
||||
* 系统模块ID
|
||||
*/
|
||||
private Long sysModuleId;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
@@ -119,14 +129,31 @@ public class UserAuth implements Serializable {
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
public String getAuthCustomSuffix() {
|
||||
return authCustomSuffix;
|
||||
|
||||
public Integer getSysType() {
|
||||
return sysType;
|
||||
}
|
||||
|
||||
public void setAuthCustomSuffix(String authCustomSuffix) {
|
||||
this.authCustomSuffix = authCustomSuffix;
|
||||
|
||||
public void setSysType(Integer sysType) {
|
||||
this.sysType = sysType;
|
||||
}
|
||||
|
||||
|
||||
public Integer getSysModuleType() {
|
||||
return sysModuleType;
|
||||
}
|
||||
|
||||
public void setSysModuleType(Integer sysModuleType) {
|
||||
this.sysModuleType = sysModuleType;
|
||||
}
|
||||
|
||||
public Long getSysModuleId() {
|
||||
return sysModuleId;
|
||||
}
|
||||
|
||||
public void setSysModuleId(Long sysModuleId) {
|
||||
this.sysModuleId = sysModuleId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserAuth{" +
|
||||
@@ -138,7 +165,6 @@ public class UserAuth implements Serializable {
|
||||
", delFlag=" + delFlag +
|
||||
", creationTime=" + creationTime +
|
||||
", updateTime=" + updateTime +
|
||||
", authCustomSuffix=" + authCustomSuffix +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户组
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-02-08
|
||||
*/
|
||||
public class UserGroup implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组名
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 删除标记 0=正常 1=已删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
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 Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserGroup{" +
|
||||
"id=" + id +
|
||||
", name=" + name +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", delFlag=" + delFlag +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户组在各项目内的授权关系
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-02-09
|
||||
*/
|
||||
public class UserGroupAuth implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 群ID
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 授权数据的ID
|
||||
*/
|
||||
private Long dataId;
|
||||
|
||||
/**
|
||||
* 授权类型,依据各项目自己定义
|
||||
*/
|
||||
private Integer authType;
|
||||
|
||||
/**
|
||||
* 项目类型 1=WIKI模块 2=数据库模块
|
||||
*/
|
||||
private Integer projectType;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 删除标记 0=正常 1=已删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
public Long getDataId() {
|
||||
return dataId;
|
||||
}
|
||||
|
||||
public void setDataId(Long dataId) {
|
||||
this.dataId = dataId;
|
||||
}
|
||||
public Integer getProjectType() {
|
||||
return projectType;
|
||||
}
|
||||
|
||||
public void setProjectType(Integer projectType) {
|
||||
this.projectType = projectType;
|
||||
}
|
||||
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 Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserGroupAuth{" +
|
||||
"id=" + id +
|
||||
", groupId=" + groupId +
|
||||
", dataId=" + dataId +
|
||||
", projectType=" + projectType +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", delFlag=" + delFlag +
|
||||
"}";
|
||||
}
|
||||
|
||||
public Integer getAuthType() {
|
||||
return authType;
|
||||
}
|
||||
|
||||
public void setAuthType(Integer authType) {
|
||||
this.authType = authType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户和用户组关系表
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-02-08
|
||||
*/
|
||||
public class UserGroupRelation implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 群ID
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 删除标记 0=正常 1=已删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getGroupId() {
|
||||
return groupId;
|
||||
}
|
||||
|
||||
public void setGroupId(Long groupId) {
|
||||
this.groupId = groupId;
|
||||
}
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
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 Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserGroupRelation{" +
|
||||
"id=" + id +
|
||||
", groupId=" + groupId +
|
||||
", userId=" + userId +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", delFlag=" + delFlag +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户设置表
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-02-09
|
||||
*/
|
||||
public class UserSetting implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 设置的名字
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 设置的值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 删除标记 0=正常 1=已删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserSetting{" +
|
||||
"id=" + id +
|
||||
", userId=" + userId +
|
||||
", name=" + name +
|
||||
", value=" + value +
|
||||
", createTime=" + createTime +
|
||||
", delFlag=" + delFlag +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,11 @@ public class WikiPageFile implements Serializable {
|
||||
*/
|
||||
private Integer downloadNum;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
private Long fileSize;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
@@ -194,4 +199,12 @@ public class WikiPageFile implements Serializable {
|
||||
public void setDownloadNum(Integer downloadNum) {
|
||||
this.downloadNum = downloadNum;
|
||||
}
|
||||
|
||||
public Long getFileSize() {
|
||||
return fileSize;
|
||||
}
|
||||
|
||||
public void setFileSize(Long fileSize) {
|
||||
this.fileSize = fileSize;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2020-09-05
|
||||
*/
|
||||
public class WikiPageHistory implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 页面ID
|
||||
*/
|
||||
private Long pageId;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人名字
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 删除标记 0=正常 1=已删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
/**
|
||||
* git提交记录ID
|
||||
*/
|
||||
private String gitCommitId;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
public Long getPageId() {
|
||||
return pageId;
|
||||
}
|
||||
|
||||
public void setPageId(Long pageId) {
|
||||
this.pageId = pageId;
|
||||
}
|
||||
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 Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
public String getGitCommitId() {
|
||||
return gitCommitId;
|
||||
}
|
||||
|
||||
public void setGitCommitId(String gitCommitId) {
|
||||
this.gitCommitId = gitCommitId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WikiPageHistory{" +
|
||||
"id=" + id +
|
||||
", pageId=" + pageId +
|
||||
", createUserId=" + createUserId +
|
||||
", createUserName=" + createUserName +
|
||||
", createTime=" + createTime +
|
||||
", delFlag=" + delFlag +
|
||||
", gitCommitId=" + gitCommitId +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.zyplayer.doc.data.repository.manage.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户空间收藏记录表
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-02-09
|
||||
*/
|
||||
public class WikiSpaceFavorite implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键自增ID
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 空间ID
|
||||
*/
|
||||
private Long spaceId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 删除标记 0=正常 1=已删除
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
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 Long getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Integer getDelFlag() {
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public void setDelFlag(Integer delFlag) {
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "WikiSpaceFavorite{" +
|
||||
"id=" + id +
|
||||
", spaceId=" + spaceId +
|
||||
", userId=" + userId +
|
||||
", createTime=" + createTime +
|
||||
", delFlag=" + delFlag +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiDoc;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* api文档地址 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-25
|
||||
*/
|
||||
public interface ApiDocMapper extends BaseMapper<ApiDoc> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiGlobalParam;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* api文档全局参数记录 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-25
|
||||
*/
|
||||
public interface ApiGlobalParamMapper extends BaseMapper<ApiGlobalParam> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.ApiRequestParam;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 文档请求参数记录 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-11-25
|
||||
*/
|
||||
public interface ApiRequestParamMapper extends BaseMapper<ApiRequestParam> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbProcLog;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据库函数修改日志 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-04-26
|
||||
*/
|
||||
public interface DbProcLogMapper extends BaseMapper<DbProcLog> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.DbTableRelation;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 表关系 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-06-07
|
||||
*/
|
||||
public interface DbTableRelationMapper extends BaseMapper<DbTableRelation> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserGroupAuth;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户组在各项目内的授权关系 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-02-09
|
||||
*/
|
||||
public interface UserGroupAuthMapper extends BaseMapper<UserGroupAuth> {
|
||||
|
||||
@Select("select a.id from user_group_auth a join user_group_relation b on a.group_id=b.group_id and b.user_id=#{userId} " +
|
||||
"where a.project_type=#{projectType} and a.auth_type=#{authType} and a.data_id=#{spaceId} and b.del_flag=0")
|
||||
Long haveAuth(@Param("spaceId") Long spaceId, @Param("projectType") Integer projectType, @Param("authType") Integer authType, @Param("userId") Long userId);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.zyplayer.doc.data.repository.manage.mapper;
|
||||
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserGroup;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.zyplayer.doc.data.repository.manage.entity.UserInfo;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户组 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author 暮光:城中城
|
||||
* @since 2021-02-08
|
||||
*/
|
||||
public interface UserGroupMapper extends BaseMapper<UserGroup> {
|
||||
|
||||
@Select("select b.id, b.user_no, b.email, b.phone, b.sex, b.user_name, b.avatar from user_group_relation a join user_info b on b.id=a.user_id where a.group_id=#{groupId} and a.del_flag=0 and b.del_flag=0")
|
||||
List<UserInfo> groupUserList(@Param("groupId") Long groupId);
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user