Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c3e7bf72fe | ||
|
|
a82829002a | ||
|
|
1f723b5d0f | ||
|
|
08a963c4b7 | ||
|
|
66ae66b8a9 | ||
|
|
71eb72d726 | ||
|
|
98ac3c67c1 | ||
|
|
7de1c37d6b | ||
|
|
07de9eec98 | ||
|
|
4b596e99bb | ||
|
|
9d36a4a32a | ||
|
|
c4726941ea | ||
|
|
144adfe73f | ||
|
|
247ec55b17 | ||
|
|
e2c5c6975f | ||
|
|
9fc6541e98 | ||
|
|
7dba9ac173 | ||
|
|
3f014418e1 | ||
|
|
43967bc23e | ||
|
|
f723545a4d | ||
|
|
1d58118f09 | ||
|
|
a500133701 | ||
|
|
bde25f0648 | ||
|
|
bf13f081c0 | ||
|
|
c6f757c4b6 | ||
|
|
5d32a3b922 | ||
|
|
ecb68c004c | ||
|
|
bbf1a316df | ||
|
|
13b4abe868 | ||
|
|
1b1cbbce1f | ||
|
|
77868a7e89 | ||
|
|
58a02b8e60 | ||
|
|
8b560699b3 | ||
|
|
a2293e35a4 | ||
|
|
7fea324219 | ||
|
|
559c6bd5f5 | ||
|
|
8e1dfc48ca | ||
|
|
5807c4fbc4 | ||
|
|
e50176b3bb | ||
|
|
0f6625e1e1 | ||
|
|
c46062d83b | ||
|
|
2e34bf9bb6 | ||
|
|
1fe4d032e6 | ||
|
|
5a5b336baf | ||
|
|
ae5140b543 | ||
|
|
4392f94d74 | ||
|
|
70ff088a9d | ||
|
|
26dc08a737 | ||
|
|
e2c152a569 | ||
|
|
983d5dde8c | ||
|
|
1e90bafe81 | ||
|
|
0130aeb741 | ||
|
|
9e8d1a7c74 | ||
|
|
0b4785cde6 | ||
|
|
50b34866ba | ||
|
|
626cdcf3d0 | ||
|
|
14df0da7f4 | ||
|
|
97220987a2 | ||
|
|
a27438aa01 | ||
|
|
2f189d9ecd | ||
|
|
7a21a5dcf2 | ||
|
|
0e8ea85805 | ||
|
|
78cf5d95e5 | ||
|
|
3d6c83a11b | ||
|
|
df01e93c64 | ||
|
|
987eb9cd2a | ||
|
|
1be0e0d389 | ||
|
|
c4716c45e6 | ||
|
|
dffcf2932c | ||
|
|
97a248a16f | ||
|
|
ecf0b97493 | ||
|
|
5341f0d33a | ||
|
|
917ce765e5 | ||
|
|
db64f8b31d | ||
|
|
c70baad0f6 | ||
|
|
7fd6fd5313 |
@@ -1,5 +1,5 @@
|
||||
<p align="center">
|
||||
<img src="https://i.imgtg.com/2023/02/10/crIMY.png" width="45%">
|
||||
<img src="assets/logo/logo-text-vertical.png" width="45%">
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href='https://gitee.com/dromara/neutrino-proxy/stargazers'><img src='https://gitee.com/dromara/neutrino-proxy/badge/star.svg?theme=dark' alt='star'></img></a>
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# 1、简介
|
||||
- 中微子代理(neutrino-proxy)是一个基于netty的、开源的java内网穿透项目。
|
||||
- 技术栈:Solon、MybatisPlus
|
||||
- 技术栈:Solon、MybatisPlus、Netty
|
||||
- 遵循MIT许可,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
|
||||
|
||||
# 2、名称由来
|
||||
@@ -19,11 +19,11 @@
|
||||
因此以中微子命名,寓意着中微子代理拥有中微子"安全"、"快速"、"穿透力强"的特点。
|
||||
|
||||
# 3、运行示例
|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
# 4、项目结构
|
||||
- neutrino-proxy
|
||||
@@ -103,7 +103,7 @@ proxy:
|
||||
ssl-enable: false
|
||||
```
|
||||
## 5.5、代理示意图
|
||||

|
||||

|
||||
|
||||
## 5.6、启动客户端
|
||||
### 5.6.1、启动参数直接指定配置
|
||||
@@ -148,12 +148,46 @@ neutrino.proxy.client.license-key=b0a907332b474b25897c4dcb31fc7eb6
|
||||
- 微信: yuyunshize
|
||||
- Gitee: https://gitee.com/asgc/neutrino-proxy
|
||||
|
||||
# 10、贡献者列表
|
||||
<p>
|
||||
<a href="https://gitee.com/zcans" target="_blank">
|
||||
<img src="assets/developer/zcans.png" width="12%">
|
||||
</a>
|
||||
<a href="https://gitee.com/bmlt" target="_blank">
|
||||
<img src="assets/developer/jiuye.png" width="12%">
|
||||
</a>
|
||||
<a href="https://gitee.com/wangke666" target="_blank">
|
||||
<img src="assets/developer/keke.png" width="12%">
|
||||
</a>
|
||||
<a href="https://gitee.com/xue-fangming" target="_blank">
|
||||
<img src="assets/developer/fangming.png" width="12%">
|
||||
</a>
|
||||
<a href="https://gitee.com/y0hanes" target="_blank">
|
||||
<img src="assets/developer/yohanes.png" width="12%">
|
||||
</a>
|
||||
<a href="https://gitee.com/noear_admin" target="_blank">
|
||||
<img src="assets/developer/near.png" width="12%">
|
||||
</a>
|
||||
<a href="https://gitee.com/westboy" target="_blank">
|
||||
<img src="assets/developer/westboy.jpg" width="12%">
|
||||
</a>
|
||||
<a href="https://gitee.com/liugddx" target="_blank">
|
||||
<img src="assets/developer/liugddx.png" width="12%">
|
||||
</a>
|
||||
<a href="https://gitee.com/DianZiFaPiao" target="_blank">
|
||||
<img src="assets/developer/tan90.png" width="12%">
|
||||
</a>
|
||||
<a href="https://gitee.com/dearsny" target="_blank">
|
||||
<img src="assets/developer/pingon.png" width="12%">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
# ❤️ 感谢
|
||||
* [Solon](https://gitee.com/noear/solon?from=NeutrinoProxy)
|
||||
* [Hutool](https://hutool.cn?from=NeutrinoProxy)
|
||||
* [JetBrains](https://www.jetbrains.com?from=NeutrinoProxy)
|
||||
|
||||

|
||||

|
||||
|
||||
# 📚 Dromara 成员项目
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
安卓客户端项目
|
||||
|
After Width: | Height: | Size: 135 KiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
After Width: | Height: | Size: 1.0 KiB |
|
After Width: | Height: | Size: 833 B |
|
After Width: | Height: | Size: 858 KiB |
|
After Width: | Height: | Size: 444 KiB |
|
After Width: | Height: | Size: 736 B |
|
After Width: | Height: | Size: 161 KiB |
|
After Width: | Height: | Size: 597 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 440 KiB |
|
Before Width: | Height: | Size: 521 KiB After Width: | Height: | Size: 521 KiB |
|
After Width: | Height: | Size: 502 KiB |
|
After Width: | Height: | Size: 441 KiB |
|
After Width: | Height: | Size: 435 KiB |
|
After Width: | Height: | Size: 449 KiB |
|
After Width: | Height: | Size: 394 KiB |
|
After Width: | Height: | Size: 327 KiB |
|
After Width: | Height: | Size: 427 KiB |
|
Before Width: | Height: | Size: 183 KiB After Width: | Height: | Size: 183 KiB |
|
After Width: | Height: | Size: 312 KiB |
|
After Width: | Height: | Size: 354 KiB |
|
After Width: | Height: | Size: 495 KiB |
|
After Width: | Height: | Size: 328 KiB |
|
After Width: | Height: | Size: 315 KiB |
|
After Width: | Height: | Size: 311 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
@@ -0,0 +1,44 @@
|
||||
#!/bin/sh
|
||||
# 中微子代理管理后台编译打包脚本,基础参数请自行修改
|
||||
|
||||
#环境
|
||||
env=dev
|
||||
nvmDir=$HOME/.nvm
|
||||
nodeVersion=v13.12.0
|
||||
deployDir="deploy"
|
||||
serverDeployDir=$deployDir"/server"
|
||||
adminDeployDir=$serverDeployDir"/neutrino-proxy-admin"
|
||||
giteePagesDir=$deployDir"/gitee-pages"
|
||||
|
||||
#设置nvm生效
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
||||
# This loads nvm
|
||||
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
|
||||
|
||||
#初始化文件夹
|
||||
cd ..
|
||||
rm -rf $adminDeployDir
|
||||
if [ ! -d "$deployDir" ];then
|
||||
mkdir $deployDir
|
||||
fi
|
||||
if [ ! -d "$serverDeployDir" ];then
|
||||
mkdir $serverDeployDir
|
||||
fi
|
||||
if [ ! -d "$adminDeployDir" ];then
|
||||
mkdir $adminDeployDir
|
||||
fi
|
||||
#切node版本
|
||||
nvm use $nodeVersion
|
||||
#进入admin项目目录
|
||||
cd ./neutrino-proxy-admin
|
||||
#删除之前的build
|
||||
rm -rf ./dist
|
||||
#安装依赖
|
||||
npm i
|
||||
#编译
|
||||
npm run build:$env
|
||||
#拷贝
|
||||
cd ..
|
||||
cp -rf ./neutrino-proxy-admin/dist $adminDeployDir/
|
||||
cp -rf ./neutrino-proxy-admin/dist/ $giteePagesDir
|
||||
@@ -8,6 +8,7 @@ nodeVersion=v13.12.0
|
||||
deployDir="deploy"
|
||||
serverDeployDir=$deployDir"/server"
|
||||
adminDeployDir=$serverDeployDir"/neutrino-proxy-admin"
|
||||
giteePagesDir=$deployDir"/gitee-pages"
|
||||
|
||||
#设置nvm生效
|
||||
export NVM_DIR="$HOME/.nvm"
|
||||
@@ -39,4 +40,5 @@ npm i
|
||||
npm run build:$env
|
||||
#拷贝
|
||||
cd ..
|
||||
cp -rf ./neutrino-proxy-admin/dist $adminDeployDir
|
||||
cp -rf ./neutrino-proxy-admin/dist $adminDeployDir/
|
||||
cp -rf ./neutrino-proxy-admin/dist/ $giteePagesDir
|
||||
@@ -11,13 +11,13 @@ clientDeployDir=$deployDir"/client"
|
||||
#切到项目根目录
|
||||
cd ..
|
||||
#初始化文件夹
|
||||
rm -rf $clientDeployDir
|
||||
if [ ! -d "$deployDir" ];then
|
||||
mkdir $deployDir
|
||||
fi
|
||||
if [ ! -d "$clientDeployDir" ];then
|
||||
mkdir $clientDeployDir
|
||||
fi
|
||||
rm -rf $clientDeployDir/neutrino-proxy-client.jar
|
||||
#客户端打包
|
||||
mvn clean install -U -pl neutrino-proxy-client -am -Dmaven.test.skip=true
|
||||
# 拷贝到deploy目录下
|
||||
|
||||
@@ -11,13 +11,14 @@ serverDeployDir=$deployDir"/server"
|
||||
#切到项目根目录
|
||||
cd ..
|
||||
#初始化文件夹
|
||||
rm -rf $serverDeployDir
|
||||
if [ ! -d "$deployDir" ];then
|
||||
mkdir $deployDir
|
||||
fi
|
||||
if [ ! -d "$serverDeployDir" ];then
|
||||
mkdir $serverDeployDir
|
||||
fi
|
||||
rm -rf $serverDeployDir/neutrino-proxy-server.jar
|
||||
|
||||
#客户端打包
|
||||
mvn clean install -U -pl neutrino-proxy-server -am -Dmaven.test.skip=true
|
||||
# 拷贝到deploy目录下
|
||||
|
||||
@@ -0,0 +1,200 @@
|
||||
## 1、关于作者
|
||||
- dromara开源组织成员,[dromara/neutrino-proxy](https://gitee.com/asgc/neutrino-proxy)项目作者
|
||||
- 名称:傲世孤尘、雨韵诗泽
|
||||
- 名言:
|
||||
- 扎根土壤,心向太阳。积蓄能量,绽放微光。
|
||||
- 拘浊酒邀明月,借赤日暖苍穹。喻万物为星斗,化沧海成诗篇。
|
||||
- 还生命以坦然,遗沧海以一笑。
|
||||
- 微信号:yuyunshize
|
||||
- Gitee: https://gitee.com/asgc
|
||||
|
||||
## 2、项目简介
|
||||
- [中微子代理(neutrino-proxy)](https://gitee.com/asgc/neutrino-proxy) 是一款基于netty的内网穿透神器。该项目采用最为宽松的MIT协议,因此您可以对它进行复制、修改、传播并用于任何个人或商业行为。
|
||||
- 演示环境:
|
||||
- 地址:http://103.163.47.16:9527
|
||||
- 账号:visitor/123456
|
||||
- 该开源版本针对开发者个人,不提供任何付费服务。上面提供的地址、账号仅用于演示,已提供现成的license供大家测试。
|
||||
- 市面上基于内网穿透的常见产品有:花生壳、TeamView、cpolar等。
|
||||
- 该项目的目标是打开内网穿透功能黑盒,让更多感兴趣的朋友能更简单、低成本的掌握内网穿透技术。
|
||||
- 学习、使用过程中,有任何问题都可以通过微信(通过上面的微信号,或扫描结尾的二维码)与笔者联系。同时,若该项目对您有所帮助,也请大家不吝转发推荐。
|
||||
|
||||
## 3、目录&文件说明
|
||||
```
|
||||
├── data.db 'sqlite数据库文件。若未配置mysql,默认使用sqlite,项目首次启动会自动初始化sqlite数据库。
|
||||
├── docs '项目相关的一些文档
|
||||
├── ├── Aop.MD '框架层Aop机制、使用说明
|
||||
├── └── Channel.MD '内网穿透实现原理、代理实现流程说明
|
||||
├── lib '项目开启了将自动生成的类保存到本地后,运行过程中动态生成的类自动保存到此处,方便学习、调试
|
||||
├── neutrino-core '一套手写的基于netty的框架,相当于简易版的SpringBoot + Mybatis + xxljob,计划后期分离为单独开源项目维护
|
||||
├── neutrino-proxy-admin '基于vue-element-admin开发的一个管理系统,用于可视化操作端口映射、代理数据实时监控
|
||||
├── neutrino-proxy-client '基于netty的代理客户端,用于和服务端交互、转发内网数据
|
||||
├── neutrino-proxy-core '代理相关的公共代码(协议、常量)
|
||||
├── neutrino-proxy-server '基于netty的代理服务端,用于和客户段交互,将客户端转发的内网数据转发至外网端口
|
||||
└── todolist.MD '近期的开发计划
|
||||
```
|
||||
|
||||
## 4、项目亮点
|
||||
- 性能:基于netty,天然拥有netty的高性能优势
|
||||
- 学习:除netty之外,只依赖了最基本的日志、数据库驱动/连接池、json等jar包,代理层代码量非常精简。极其适合java初学者用来学习和掌握Web框架底层原理、内网穿透实现机制。
|
||||
- 调试:只需要安装jdk8,甚至连数据库都无需考虑,即可直接在本地运行服务端+客户端,调试代理流程。尽可能减少前期步骤,确保大家能更快上手。
|
||||
- 测试:针对框架层封装(如:AOP、Web容器、ORM、调度管理等),提供了丰富的测试代码。
|
||||
|
||||
## 5、运行环境
|
||||
以下版本均为笔者开发时实际的使用版本
|
||||
|
||||
- `Node`:v13.12.0
|
||||
- `Java`:1.8.0_351
|
||||
- `Mysql`:8.0.31 (非必需,使用sqlite则无需考虑数据库)
|
||||
- `Nginx`:1.21.4 (非必需,可直接使用服务端项目提供的静态资源服务)
|
||||
|
||||
## 6、使用方法
|
||||
### 6.1、打包
|
||||
可直接前往[Gitee仓库发行版页面](https://gitee.com/dromara/neutrino-proxy/releases)下载所需版本已打好的包。
|
||||
若需手动打包,则可参照下面的执行命令:
|
||||
```sh
|
||||
# 服务端打包
|
||||
mvn clean install -U -pl neutrino-proxy-server -am -Dmaven.test.skip=true
|
||||
|
||||
# 客户端打包
|
||||
clean install -U -pl neutrino-proxy-client -am -Dmaven.test.skip=true
|
||||
|
||||
# 管理后台前端项目打包(本地环境,local改为dev则为dev环境,同时需要修改config目录下面的环境配置)
|
||||
npm run build:local
|
||||
```
|
||||
|
||||
### 6.2、部署
|
||||
#### 6.2.1、服务端部署
|
||||
使用常规的jar包部署方式即可,如:java -jar xxxx
|
||||
|
||||
#### 6.2.2、管理后台部署
|
||||
Nginx方式部署(推荐):
|
||||
|
||||
```
|
||||
server {
|
||||
listen 9527;
|
||||
server_name localhost;
|
||||
|
||||
#开启gzip
|
||||
gzip on;
|
||||
#低于1kb的资源不压缩
|
||||
gzip_min_length 1k;
|
||||
#压缩级别1-9,越大压缩率越高,同时消耗cpu资源也越多,建议设置在5左右。
|
||||
gzip_comp_level 5;
|
||||
#需要压缩哪些响应类型的资源,多个空格隔开。不建议压缩图片.
|
||||
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
|
||||
#配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
#是否添加“Vary: Accept-Encoding”响应头
|
||||
gzip_vary on;
|
||||
|
||||
location / {
|
||||
root /work/projects/neutrino-proxy-server/neutrino-proxy-admin/dist;
|
||||
try_files $uri $uri/ /index.html;
|
||||
add_header Last-Modified $date_gmt;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
在没有Nginx时,为了快速体验代理效果,可直接使用服务端项目提供的静态资源服务。
|
||||
直接将`neutrino-proxy-admin`打包后的文件解压放在`neutrino-proxy-server.jar`同级别目录下即可。
|
||||
例如:服务端配置的web端口为8080,则访问http://服务端IP:8080, 则会直接解析渲染`neutrino-proxy-server.jar`同级别目录下`neutrino-proxy-admin/dist/index.html`。
|
||||
|
||||
需要注意的是,使用服务端自带的静态资源服务时,由于框架目前未支持缓存、gzip压缩,所以访问速度没有使用nginx快,正式使用推荐用nginx。
|
||||
|
||||
### 6.3、配置
|
||||
#### 6.3.1、配置端口池
|
||||
端口池的作用是将代理服务需要对外暴露的端口进行集中管理,方便安全组设置时统一操作。
|
||||
|
||||
本项目为了简化首次配置,默认初始化数据会将9101~9120的所有端口加入端口池。
|
||||
可以在服务端项目sql配置(port_pool.data.sql文件)中自行修改初始化数据,也可以运行后在端口池管理页面手动维护。
|
||||
|
||||
首次使用如果为了快速体验,建议直接使用默认端口池,则无需任何配置。
|
||||
|
||||
#### 6.3.2、配置用户
|
||||
用户是登录管理后台的身份主体,同时也是持有license的身份主体,用于支持代理连接的合法性认证。
|
||||
|
||||
本项目为了简化首次配置,默认初始化admin、visitor两个用户,默认密码为123456。
|
||||
可以在服务端项目sql配置(user.data.sql文件)中自行修改初始化数据,也可以运行后在用户管理页面手动维护。
|
||||
|
||||
首次使用如果为了快速体验,建议直接使用默认用户,则无需任何配置。
|
||||
|
||||
#### 6.3.3、配置License
|
||||
License是客户端连接代理服务端时所需要的唯一合法凭证,一个License同时只能被一个客户端使用。
|
||||
|
||||
本项目为了简化首次配置,默认为每个用户初始化了一些license。
|
||||
可以在服务端项目sql配置(license.data.sql文件)中自行修改初始化数据,也可以运行后在License管理页面手动维护。
|
||||
|
||||
首次使用如果为了快速体验,建议直接使用默认License,则无需任何配置。
|
||||
|
||||
#### 6.3.4、配置端口映射
|
||||
端口映射是代理的基本单元,一个外网端口在同一时刻被唯一的映射到一个内网IP+端口。所有流出该外网端口的流量都转发自对应的内网端口,同理所有流入该外网端口的流量都会转发到对应的内网端口。
|
||||
|
||||
本项目为了简化首次配置,默认为每个用户初始化了一些端口映射。可以在服务端项目sql配置(port_mapping.data.sql文件)中自行修改初始化数据,也可以运行后在端口映射管理页面手动维护。
|
||||
|
||||
首次使用如果为了快速体验,建议直接使用默认端口映射,则无需任何配置。
|
||||
|
||||
|
||||
### 6.4、开启代理
|
||||
上述步骤完成后,就可以开始代理自己的局域网设备了。
|
||||
|
||||
比如现在有一个license:a123456,该license配置了一个或多个端口映射,其中包含9010到localhost:8080的映射(localhost表示代理客户端所在主机的端口,可以换成客户端所在局域网的任何IP)。此时修改客户端配置的服务端ip、license等启动客户端,就可以开启代理了,端口映射管理对应的记录在线状态为"在线"则证明代理成功建立。
|
||||
|
||||
该license配置也可以通过客户端启动参数、启动后引导式输入、外置配置提供,为了简化首次体验门槛,这里直接提供一个外置配置模版:
|
||||
```json
|
||||
{
|
||||
"jksPath":"classpath:/test.jks",
|
||||
"licenseKey":"b0a907332b474b25897c4dcb31fc7eb6",
|
||||
"serverIp":"localhost",
|
||||
"serverPort":9002,
|
||||
"sslEnable":true
|
||||
}
|
||||
```
|
||||
|
||||
修改上述json中的licenseKey,serverIp、serverPort、sslEnabled后,保存文件命名为`.neutrino-proxy-client.json`,放在客户端当前目录下(jar包启动时,放在jar包同级别目录下。idea启动时,放在项目根目录下),然后直接启动客户端。
|
||||
|
||||
此时通过访问外网ip+端口,可以成功访问内网服务。通过此方式,可以代理任何基于TCP之上的协议,如:socket、websocket、http、ftp、ssh等。
|
||||
|
||||
## 7、开发&调试
|
||||
篇幅所限,此处不便赘述管理后台相关的开发,有vue基础的童鞋基本都可以自行开发。服务端的初始化数据足够调试工作,开发过程无需单独在管理页面操作。
|
||||
|
||||
与SpringBoot项目类似,客户端、服务端项目均由一个入口类完成整个项目的启动,分别为`ProxyClient`、`ProxyServer`。
|
||||
|
||||
内置配置采用yml风格,主要涉及Http端口、静态资源路径、协议参数、代理服务端端口、jks证书、数据源、license等。
|
||||
整个项目基于`neutrino-core`,风格类似于SpringBoot。笔者不喜欢因过分炫技而引入过多花式操作,因为项目的定位是个人开发者,且满足使用的同时兼顾学习其原理的需求。基本使用方式与SpringBoot类似,尽可能降低首次学习成本。
|
||||
|
||||
`neutrino-core`项目test目录下包含众多核心封装的测试代码,通过调试这些代码,能尽可能减少大家学习的障碍。
|
||||
|
||||
## 8、运行截图
|
||||
License管理:
|
||||
<img src="./license1.png" width="100%"/>
|
||||
|
||||
端口映射管理:
|
||||
<img src="./port-mapping1.png" width="100%"/>
|
||||
|
||||
端口池管理:
|
||||
<img src="./port-pool1.png" width="100%"/>
|
||||
|
||||
用户管理:
|
||||
<img src="./user-manager1.png" width="100%"/>
|
||||
|
||||
## 9、迭代进度&未来计划
|
||||
从`2022-06-16` 第一个完整可用版本发布(无管理后台、无DB,纯配置实现)起,该项目已具备完整的内网穿透功能。经过后续的不断重构,初步完成了以下迭代:
|
||||
- 使用sqlite取代纯配置,增加管理后台界面。解决修改端口映射需要重新打包的问题。
|
||||
- 增加mysql支持。初学时,直接默认使用sqlite,可以专注于学习代理相关细节而不必额外安装、配置数据库。有了自己的服务器后,可配置使用mysql,完全兼容。
|
||||
- 增加端口池管理。方便服务器统一设置安全组,避免暴露的外网端口杂乱无章。
|
||||
- 集成调度管理。个人版项目自带调度管理,降低学习、使用成本。无需部署、接入其他调度服务。
|
||||
- 增加简单的游客权限限制。个人版项目无需权限管理,但是为了演示需要,同时避免游客篡改管理员数据。
|
||||
- 封装一套类似于SpringBoot + Mybatis的简化框架,用于支撑上层代理项目,减少外部依赖,为后期孵化一个开源框架做准备。
|
||||
|
||||
由于笔者工作之余才能进行开发,可投入时间不固定。截至目前(2023-02),该项目2.0版本仍未发布,基于此未来的计划如下:
|
||||
- 完成2.0版本发布(还剩下报表管理、首页图表功能)。
|
||||
- 底层框架全部重构。
|
||||
- 分离出一个开源框架项目,并持续维护。
|
||||
- 思考或着手基于内网穿透的产品开发,包括但不限于内网穿透SaaS服务、堡垒机。
|
||||
|
||||
## 10、联系我们
|
||||
笔者时间、能力有限,且开源项目非一朝一夕之事,存在众多问题亦在所难免。使用、学习过程中有任何问题欢迎大家与我联系。
|
||||
|
||||
对项目有什么想法或者建议,可以加我微信拉交流群,或者创建[issues](https://gitee.com/dromara/neutrino-proxy/issues),一起完善项目
|
||||
|
||||
<img src="MyWeChatQRCode.jpeg" width="100%"/>
|
||||
|
After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 276 KiB After Width: | Height: | Size: 276 KiB |
|
Before Width: | Height: | Size: 216 KiB After Width: | Height: | Size: 216 KiB |
|
Before Width: | Height: | Size: 425 KiB After Width: | Height: | Size: 425 KiB |
|
Before Width: | Height: | Size: 202 KiB After Width: | Height: | Size: 202 KiB |
@@ -0,0 +1,8 @@
|
||||
# 管理后台问题汇总
|
||||
## 问题1...
|
||||
> 描述、解决方式
|
||||
|
||||
# 代理服务端问题汇总
|
||||
|
||||
|
||||
# 代理客户端问题汇总
|
||||
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 3.1 KiB |
@@ -14,6 +14,12 @@ export function licenseList() {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
export function licenseAuthList() {
|
||||
return request({
|
||||
url: '/license/auth-list',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function createLicense(data) {
|
||||
return request({
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
import request from '@/utils/request'
|
||||
|
||||
export function fetchList(query) {
|
||||
return request({
|
||||
url: '/port-group/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function portGroupList() {
|
||||
return request({
|
||||
url: '/port-group/list',
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function updateEnableStatus(id, enable) {
|
||||
return request({
|
||||
url: '/port-group/update/enable-status',
|
||||
method: 'post',
|
||||
data: {
|
||||
id: id,
|
||||
enable: enable
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function createPortGroup(data) {
|
||||
return request({
|
||||
url: '/port-group/create',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteGroup(id) {
|
||||
return request({
|
||||
url: '/port-group/delete',
|
||||
method: 'post',
|
||||
params: {
|
||||
id: id
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -14,6 +14,15 @@ export function portPoolList() {
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
export function availablePortList(licenseId) {
|
||||
return request({
|
||||
url: '/port-pool/get-available-port-list',
|
||||
method: 'get',
|
||||
params: {
|
||||
licenseId: licenseId
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export function updateEnableStatus(id, enable) {
|
||||
return request({
|
||||
@@ -34,6 +43,14 @@ export function createPortPool(data) {
|
||||
})
|
||||
}
|
||||
|
||||
export function updatePortPool(data) {
|
||||
return request({
|
||||
url: '/port-pool/update',
|
||||
method: 'post',
|
||||
data
|
||||
})
|
||||
}
|
||||
|
||||
export function deletePortPool(id) {
|
||||
return request({
|
||||
url: '/port-pool/delete',
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
import request from '@/utils/request'
|
||||
export function fetchUserFlowReportList(query) {
|
||||
return request({
|
||||
url: '/report/user/flow-report/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchLicenseFlowReportList(query) {
|
||||
return request({
|
||||
url: '/report/license/flow-report/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchUserFlowMonthReportList(query) {
|
||||
return request({
|
||||
url: '/report/user/flow-month-report/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function fetchLicenseFlowMonthReportList(query) {
|
||||
return request({
|
||||
url: '/report/license/flow-month-report/page',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
|
||||
export function homeData(query) {
|
||||
return request({
|
||||
url: '/report/home/data-view',
|
||||
method: 'get',
|
||||
params: query
|
||||
})
|
||||
}
|
||||
@@ -48,6 +48,7 @@ export default {
|
||||
user: '用户管理',
|
||||
system: '系统管理',
|
||||
portPool: '端口池管理',
|
||||
portGroup: '端口分组管理',
|
||||
proxy: '代理配置',
|
||||
license: 'License管理',
|
||||
portMapping: '端口映射',
|
||||
@@ -55,7 +56,12 @@ export default {
|
||||
jobLog: '调度日志',
|
||||
log: '日志管理',
|
||||
loginLog: '登录日志',
|
||||
clientConnectLog: '客户端连接日志'
|
||||
clientConnectLog: '客户端连接日志',
|
||||
report: '报表管理',
|
||||
userFlowReport: '用户流量报表',
|
||||
licenseFlowReport: 'License流量报表',
|
||||
userFlowMonthReport: '用户流量月度明细',
|
||||
licenseFlowMonthReport: 'License流量月度明细'
|
||||
},
|
||||
navbar: {
|
||||
logOut: '退出登录',
|
||||
@@ -118,6 +124,11 @@ export default {
|
||||
confirm: '确 定',
|
||||
userId: '用户ID',
|
||||
userName: '用户名',
|
||||
group: '分组',
|
||||
groupName: '分组名称',
|
||||
groupPossessor: '分组所属',
|
||||
possessorType: '所属类',
|
||||
possessorId: '分组所属',
|
||||
license: 'License',
|
||||
createTime: '创建时间',
|
||||
updateTime: '更新时间',
|
||||
@@ -147,7 +158,10 @@ export default {
|
||||
msg: '消息',
|
||||
outcome: '结果',
|
||||
err: '异常信息',
|
||||
resetKey: '重置Key'
|
||||
resetKey: '重置Key',
|
||||
upFlow: '上行流量',
|
||||
downFlow: '下行流量',
|
||||
totalFlow: '总流量'
|
||||
},
|
||||
button: {
|
||||
lookOver: '查看'
|
||||
|
||||
@@ -75,10 +75,27 @@ export const asyncRouterMap = [
|
||||
},
|
||||
children: [
|
||||
{ path: 'user', component: _import('system/user'), name: 'user', meta: { title: 'user' }},
|
||||
{ path: 'portGroup', component: _import('system/portGroup'), name: 'portGroup', meta: { title: 'portGroup' }},
|
||||
{ path: 'portPool', component: _import('system/portPool'), name: 'portPool', meta: { title: 'portPool' }},
|
||||
{ path: 'jobManager', component: _import('system/jobManager'), name: 'jobManager', meta: { title: 'jobManager' }}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/report',
|
||||
component: Layout,
|
||||
redirect: 'noredirect',
|
||||
name: 'report',
|
||||
meta: {
|
||||
title: 'report',
|
||||
icon: 'component'
|
||||
},
|
||||
children: [
|
||||
{ path: 'userFlowReport', component: _import('report/userFlowReport'), name: 'userFlowReport', meta: { title: 'userFlowReport' }},
|
||||
{ path: 'licenseFlowReport', component: _import('report/licenseFlowReport'), name: 'licenseFlowReport', meta: { title: 'licenseFlowReport' }},
|
||||
{ path: 'userFlowMonthReport', component: _import('report/userFlowMonthReport'), name: 'userFlowMonthReport', meta: { title: 'userFlowMonthReport' }},
|
||||
{ path: 'licenseFlowMonthReport', component: _import('report/licenseFlowMonthReport'), name: 'licenseFlowMonthReport', meta: { title: 'licenseFlowMonthReport' }}
|
||||
]
|
||||
},
|
||||
{
|
||||
path: '/log',
|
||||
component: Layout,
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
const SIZE_UNINTS = ['B', 'KB', 'MB', 'GB', 'TB']
|
||||
const SIZE_SYSTEM = 1024
|
||||
/**
|
||||
* 根据字节数获取大小描述
|
||||
* 1、小于1024字节的以B为单位
|
||||
* 2、小于1024KB的以KB为单位
|
||||
* 3、小于1024M的以MB为单位
|
||||
* 4、小于1024G的以GB为单位
|
||||
* 5、其他以TB为单位
|
||||
*/
|
||||
export function getSizeDescByByteCount(byteCount) {
|
||||
if (byteCount <= 0) {
|
||||
return '0B'
|
||||
}
|
||||
|
||||
let res = byteCount
|
||||
let index = 0
|
||||
while (index < SIZE_UNINTS.length && res >= SIZE_SYSTEM) {
|
||||
res /= SIZE_SYSTEM
|
||||
index++
|
||||
}
|
||||
|
||||
if (index >= SIZE_UNINTS.length) {
|
||||
index = SIZE_UNINTS.length - 1
|
||||
res *= 1024
|
||||
}
|
||||
|
||||
return parseFloat(res.toFixed(2)) + SIZE_UNINTS[index]
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
let that = null
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -22,14 +23,14 @@ export default {
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '250px'
|
||||
default: '220px'
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
upload: 90, // 上行
|
||||
download: 100, // 下行
|
||||
upFlowBytes: 0, // 上行
|
||||
downFlowBytes: 0, // 下行
|
||||
text: '今日流量'
|
||||
}
|
||||
}
|
||||
@@ -41,6 +42,7 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
that = this
|
||||
this.initChart()
|
||||
},
|
||||
beforeDestroy() {
|
||||
@@ -57,7 +59,7 @@ export default {
|
||||
const option = {
|
||||
title: {
|
||||
text: this.data.text,
|
||||
subtext: '上行:' + this.data.upload + '\n\n' + '下行:' + this.data.download,
|
||||
subtext: '上行:' + this.data.upFlowDesc + '\n\n' + '下行:' + this.data.downFlowDesc + '\n\n' + '汇总:' + this.data.totalFlowDesc,
|
||||
textStyle: {
|
||||
fontSize: 18,
|
||||
fontWeight: 800,
|
||||
@@ -65,7 +67,10 @@ export default {
|
||||
}
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'item'
|
||||
trigger: 'item',
|
||||
formatter: function(value) {
|
||||
return `${value.seriesName} <br/>${value.marker} : ${value.name} ${value.name === '上行' ? that.data.upFlowDesc : that.data.downFlowDesc}`
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: ['上行', '下行'],
|
||||
@@ -77,7 +82,7 @@ export default {
|
||||
name: this.data.text,
|
||||
type: 'pie',
|
||||
radius: [45, 65],
|
||||
center: ['50%', '58%'],
|
||||
center: ['60%', '60%'],
|
||||
// 隐藏指示线
|
||||
labelLine: {
|
||||
normal: {
|
||||
@@ -93,30 +98,30 @@ export default {
|
||||
},
|
||||
data: [
|
||||
{
|
||||
value: this.data.upload,
|
||||
value: this.data.upFlowBytes,
|
||||
name: '上行',
|
||||
lineStyle: {
|
||||
normal: {
|
||||
color: '#2B81B1'
|
||||
color: '#63b2ee'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#2B81B1'
|
||||
color: '#63b2ee'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
value: this.data.download,
|
||||
value: this.data.downFlowBytes,
|
||||
name: '下行',
|
||||
lineStyle: {
|
||||
normal: {
|
||||
color: '#dbebf7'
|
||||
color: '#76da91'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#dbebf7'
|
||||
color: '#76da91'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,14 +20,14 @@ export default {
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '250px'
|
||||
default: '220px'
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
onLine: 90, // 进度条最大值
|
||||
total: 100 // 当前进度
|
||||
onlineCount: 0, // 进度条最大值
|
||||
totalCount: 0 // 当前进度
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ export default {
|
||||
const option = {
|
||||
title: {
|
||||
text: 'License统计',
|
||||
subtext: '在线数:' + this.data.onLine + '\n\n' + '离线数:' + (this.data.total - this.data.onLine),
|
||||
subtext: '在线数量:' + this.data.onlineCount + '\n\n' + '离线数量:' + (this.data.totalCount - this.data.onlineCount) + '\n\n' + '汇总数量:' + this.data.totalCount,
|
||||
textStyle: {
|
||||
fontSize: 18,
|
||||
fontWeight: 800,
|
||||
@@ -75,7 +75,7 @@ export default {
|
||||
name: 'License',
|
||||
type: 'pie',
|
||||
radius: [45, 65],
|
||||
center: ['50%', '58%'],
|
||||
center: ['60%', '60%'],
|
||||
avoidLabelOverlap: false,
|
||||
// 隐藏指示线
|
||||
labelLine: {
|
||||
@@ -103,29 +103,29 @@ export default {
|
||||
// value当前进度 + 颜色
|
||||
{
|
||||
name: '在线数',
|
||||
value: this.data.onLine,
|
||||
value: this.data.onlineCount,
|
||||
lineStyle: {
|
||||
normal: {
|
||||
color: '#2B81B1'
|
||||
color: '#63b2ee'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#2B81B1'
|
||||
color: '#63b2ee'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '离线数',
|
||||
value: this.data.total - this.data.onLine,
|
||||
value: this.data.totalCount - this.data.onlineCount,
|
||||
lineStyle: {
|
||||
normal: {
|
||||
color: '#dbebf7'
|
||||
color: '#76da91'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#dbebf7'
|
||||
color: '#76da91'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,14 +18,14 @@ export default {
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '250px'
|
||||
default: '220px'
|
||||
},
|
||||
data: {
|
||||
type: Object,
|
||||
default: () => {
|
||||
return {
|
||||
onLine: 90, // 进度条最大值
|
||||
total: 100 // 当前进度
|
||||
onlineCount: 0, // 进度条最大值
|
||||
totalCount: 0 // 当前进度
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,7 @@ export default {
|
||||
const option = {
|
||||
title: {
|
||||
text: '端口映射统计',
|
||||
subtext: '在线数:' + this.data.onLine + '\n\n' + '离线数:' + (this.data.total - this.data.onLine),
|
||||
subtext: '在线数量:' + this.data.onlineCount + '\n\n' + '离线数量:' + (this.data.totalCount - this.data.onlineCount) + '\n\n' + '汇总数量:' + this.data.totalCount,
|
||||
textStyle: {
|
||||
fontSize: 18,
|
||||
fontWeight: 800,
|
||||
@@ -73,7 +73,7 @@ export default {
|
||||
name: '端口映射',
|
||||
type: 'pie',
|
||||
radius: [45, 65],
|
||||
center: ['50%', '58%'],
|
||||
center: ['60%', '60%'],
|
||||
avoidLabelOverlap: false,
|
||||
// 隐藏指示线
|
||||
labelLine: {
|
||||
@@ -92,29 +92,29 @@ export default {
|
||||
// value当前进度 + 颜色
|
||||
{
|
||||
name: '在线数',
|
||||
value: this.data.onLine,
|
||||
value: this.data.onlineCount,
|
||||
lineStyle: {
|
||||
normal: {
|
||||
color: '#2B81B1'
|
||||
color: '#63b2ee'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#2B81B1'
|
||||
color: '#63b2ee'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '离线数',
|
||||
value: this.data.total - this.data.onLine,
|
||||
value: this.data.totalCount - this.data.onlineCount,
|
||||
lineStyle: {
|
||||
normal: {
|
||||
color: '#dbebf7'
|
||||
color: '#76da91'
|
||||
}
|
||||
},
|
||||
itemStyle: {
|
||||
normal: {
|
||||
color: '#dbebf7'
|
||||
color: '#76da91'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
<script>
|
||||
import echarts from 'echarts'
|
||||
require('echarts/theme/macarons') // echarts theme
|
||||
import { getSizeDescByByteCount } from '@/utils/utils'
|
||||
let that = null
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -26,16 +28,17 @@ export default {
|
||||
},
|
||||
height: {
|
||||
type: String,
|
||||
default: '450px'
|
||||
default: '500px'
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
chartDom: null,
|
||||
colorList: ['#2B81B1', '#75ddfa', '#53a7e3', '#029fe8', '#015dae']
|
||||
colorList: ['#63b2ee', '#76da91', '#f8cb7f', '#f89588', '#7cd6cf', '#9192ab', '#7898e1', '#7898e1']
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
that = this
|
||||
this.initChart()
|
||||
},
|
||||
beforeDestroy() {
|
||||
@@ -51,7 +54,7 @@ export default {
|
||||
this.myChart = echarts.init(this.chartDom)
|
||||
const seriesList = []
|
||||
const legendList = []
|
||||
this.data.list.forEach((item, index) => {
|
||||
this.data.list && this.data.list.forEach((item, index) => {
|
||||
seriesList.push({
|
||||
name: item.name,
|
||||
type: 'line',
|
||||
@@ -71,25 +74,34 @@ export default {
|
||||
normal: {
|
||||
color: this.colorList[index]
|
||||
}
|
||||
}
|
||||
},
|
||||
smooth: true
|
||||
})
|
||||
legendList.push(item.name)
|
||||
})
|
||||
|
||||
const option = {
|
||||
title: {
|
||||
text: this.data.text + '折线图',
|
||||
text: this.data.text,
|
||||
subtext: this.data.subtext || ''
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis'
|
||||
trigger: 'axis',
|
||||
formatter: function(value) {
|
||||
let title = that.data.text + '<br/>'
|
||||
value.forEach(item => {
|
||||
title = title + item.marker + item.seriesName + ' : ' + that.data.list[item.seriesIndex].label[item.dataIndex] + '<br/>'
|
||||
})
|
||||
return title
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
data: legendList,
|
||||
left: 'right'
|
||||
},
|
||||
grid: {
|
||||
left: '2%',
|
||||
right: '2%',
|
||||
left: '0',
|
||||
right: '3%',
|
||||
bottom: '2%',
|
||||
containLabel: true
|
||||
},
|
||||
@@ -99,7 +111,12 @@ export default {
|
||||
data: this.data.title
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value'
|
||||
type: 'value',
|
||||
axisLabel: {
|
||||
formatter: function(value) {
|
||||
return getSizeDescByByteCount(value)
|
||||
}
|
||||
}
|
||||
},
|
||||
series: seriesList
|
||||
}
|
||||
|
||||
@@ -1,40 +1,32 @@
|
||||
<template>
|
||||
<div class="dashboard-editor">
|
||||
<div class="log-div">
|
||||
|
||||
</div>
|
||||
<div class="container">
|
||||
<el-row class="line-chart" :gutter="16">
|
||||
<el-col :span="12">
|
||||
<el-card>
|
||||
<traffic-sum-chart :data="echartsData.trafficSumChart" :chartId="'traffic-sum-div1'"/>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="12">
|
||||
<el-card>
|
||||
<traffic-sum-chart :data="echartsData.trafficSumChart2"/>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="pie-chart" :gutter="16">
|
||||
<el-col :span="6">
|
||||
<el-card class="box-card">
|
||||
<license-chart :data="echartsData.licenseChart"/>
|
||||
<license-chart :data="licenseChart" v-if="licenseChart"/>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card class="box-card">
|
||||
<port-mapping-chart :data="echartsData.portMappingChart"/>
|
||||
<port-mapping-chart :data="portMappingChart" v-if="portMappingChart"/>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card class="box-card">
|
||||
<daily-traffic-chart :data="echartsData.dailyTrafficChart" :chartId="'daily-traffic-div'"/>
|
||||
<daily-traffic-chart :data="dailyTrafficChart" :chartId="'daily-traffic-div'" v-if="dailyTrafficChart"/>
|
||||
</el-card>
|
||||
</el-col>
|
||||
<el-col :span="6">
|
||||
<el-card class="box-card">
|
||||
<daily-traffic-chart :data="echartsData.historyTrafficChart" :chartId="'history-traffic-div'"/>
|
||||
<daily-traffic-chart :data="historyTrafficChart" :chartId="'history-traffic-div'" v-if="historyTrafficChart"/>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<el-row class="line-chart" :gutter="16">
|
||||
<el-col :span="24">
|
||||
<el-card>
|
||||
<traffic-sum-chart :data="trafficSumChart" :chartId="'traffic-sum-div1'" v-if="trafficSumChart"/>
|
||||
</el-card>
|
||||
</el-col>
|
||||
</el-row>
|
||||
@@ -48,69 +40,69 @@ import LicenseChart from './components/LicenseChart'
|
||||
import PortMappingChart from './components/PortMappingChart'
|
||||
import DailyTrafficChart from './components/DailyTrafficChart'
|
||||
import TrafficSumChart from './components/TrafficSumChart'
|
||||
|
||||
const echartsData = {
|
||||
licenseChart: {
|
||||
total: 100,
|
||||
onLine: 80
|
||||
},
|
||||
portMappingChart: {
|
||||
total: 100,
|
||||
onLine: 25
|
||||
},
|
||||
dailyTrafficChart: {
|
||||
upload: 300,
|
||||
download: 680,
|
||||
text: '今日流量'
|
||||
},
|
||||
historyTrafficChart: {
|
||||
upload: 4100,
|
||||
download: 9520,
|
||||
text: '历史流量'
|
||||
},
|
||||
trafficSumChart: {
|
||||
text: '今日流量',
|
||||
subtext: '当日0-24时',
|
||||
title: ['1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00'],
|
||||
list: [
|
||||
{
|
||||
name: '上行',
|
||||
value: [120, 132, 101, 134, 90, 230, 210]
|
||||
},
|
||||
{
|
||||
name: '下行',
|
||||
value: [112, 333, 150, 60, 99, 50, 102]
|
||||
}
|
||||
]
|
||||
},
|
||||
trafficSumChart2: {
|
||||
text: '历史流量',
|
||||
title: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月', '9月', '10月', '11月', '12月'],
|
||||
list: [
|
||||
{
|
||||
name: '上行',
|
||||
value: [132, 101, 134, 90, 120, 132, 101, 134, 90, 230, 210, 120]
|
||||
},
|
||||
{
|
||||
name: '下行',
|
||||
value: [111, 0, 50, 101, 134, 90, 230, 120, 132, 101, 60, 20]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
import { homeData } from '@/api/report'
|
||||
|
||||
export default {
|
||||
name: 'dashboard-admin',
|
||||
components: { TrafficSumChart, DailyTrafficChart, PortMappingChart, LicenseChart },
|
||||
data() {
|
||||
return {
|
||||
echartsData: echartsData
|
||||
licenseChart: undefined,
|
||||
portMappingChart: undefined,
|
||||
dailyTrafficChart: undefined,
|
||||
historyTrafficChart: undefined,
|
||||
trafficSumChart: undefined
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getHomeData()
|
||||
},
|
||||
mounted() {
|
||||
},
|
||||
methods: {
|
||||
|
||||
getHomeData() {
|
||||
homeData().then(res => {
|
||||
this.licenseChart = res.data.data.license
|
||||
this.portMappingChart = res.data.data.portMapping
|
||||
this.dailyTrafficChart = Object.assign(res.data.data.todayFlow, { text: '今日流量' })
|
||||
this.historyTrafficChart = Object.assign(res.data.data.totalFlow, { text: '流量汇总' })
|
||||
this.trafficSumChart = this.getChartData(res.data.data.last7dFlow)
|
||||
})
|
||||
},
|
||||
getChartData(last7dFlow) {
|
||||
const title = []
|
||||
const downFlowDesc = []
|
||||
const totalFlowDesc = []
|
||||
const upFlowDesc = []
|
||||
last7dFlow.dataList.forEach(item => {
|
||||
title.push(item.dateStr)
|
||||
totalFlowDesc.push(item.totalFlowDesc)
|
||||
downFlowDesc.push(item.downFlowDesc)
|
||||
upFlowDesc.push(item.upFlowDesc)
|
||||
})
|
||||
const list = []
|
||||
last7dFlow.seriesList.forEach(item => {
|
||||
let label = []
|
||||
if (item.seriesName.indexOf('上') > -1) {
|
||||
label = upFlowDesc
|
||||
} else if (item.seriesName.indexOf('下') > -1) {
|
||||
label = downFlowDesc
|
||||
} else if (item.seriesName.indexOf('总') > -1) {
|
||||
label = totalFlowDesc
|
||||
}
|
||||
list.push({
|
||||
name: item.seriesName,
|
||||
value: item.seriesData,
|
||||
label: label
|
||||
})
|
||||
})
|
||||
return {
|
||||
text: '流量监控',
|
||||
subtext: `最近${last7dFlow.dataList.length || 0}天流量监控`,
|
||||
title: title,
|
||||
list: list
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -127,9 +119,9 @@ export default {
|
||||
flex: 0 0 auto;
|
||||
}
|
||||
.pie-chart{
|
||||
padding-top: 16px;
|
||||
padding-bottom: 16px;
|
||||
.el-card{
|
||||
min-height: 300px;
|
||||
min-height: 250px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.licenseId" placeholder="请选择license" clearable style="margin-right:10px">
|
||||
<el-option v-for="item in licenseList" :key="item.key" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
<el-button type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
</div>
|
||||
|
||||
@@ -48,8 +51,8 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.currentPage"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -66,6 +69,7 @@
|
||||
|
||||
<script>
|
||||
import { fetchList } from '@/api/clientConnectLog'
|
||||
import { licenseList } from '@/api/license'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
|
||||
export default {
|
||||
@@ -80,12 +84,13 @@ export default {
|
||||
total: null,
|
||||
listLoading: false,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
current: 1,
|
||||
size: 10,
|
||||
jobId: undefined
|
||||
},
|
||||
dialogVisible: false,
|
||||
selectRow: {}
|
||||
selectRow: {},
|
||||
licenseList: []
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -112,6 +117,7 @@ export default {
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getLicenseList()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
@@ -123,6 +129,11 @@ export default {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getLicenseList() {
|
||||
licenseList().then(response => {
|
||||
this.licenseList = response.data.data
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
|
||||
@@ -46,8 +46,8 @@
|
||||
</el-table-column>-->
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.currentPage"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -79,8 +79,8 @@ export default {
|
||||
total: null,
|
||||
listLoading: false,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
current: 1,
|
||||
size: 10,
|
||||
jobId: undefined
|
||||
},
|
||||
jobList: [],
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.userId" placeholder="请选择用户" clearable>
|
||||
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
</div>
|
||||
|
||||
@@ -28,8 +31,8 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.currentPage"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
@@ -37,6 +40,7 @@
|
||||
|
||||
<script>
|
||||
import { fetchList } from '@/api/loginLog'
|
||||
import { userList } from '@/api/user'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
|
||||
export default {
|
||||
@@ -51,10 +55,11 @@ export default {
|
||||
total: null,
|
||||
listLoading: false,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
jobId: undefined
|
||||
}
|
||||
current: 1,
|
||||
size: 10,
|
||||
userId: null
|
||||
},
|
||||
userList: []
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -98,13 +103,11 @@ export default {
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getDataList()
|
||||
},
|
||||
activated() {
|
||||
if (this.$route.query.jobId) {
|
||||
this.listQuery.jobId = this.$route.query.jobId
|
||||
console.log(this.listQuery.jobId, this.$route.query.jobId)
|
||||
this.getList()
|
||||
}
|
||||
this.getUserList()
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
@@ -115,6 +118,22 @@ export default {
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getUserList() {
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
})
|
||||
},
|
||||
getDataList() {
|
||||
const loginName = this.$store.state.user.loginName
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
const curUser = this.userList.find((val) => val.loginName === loginName)
|
||||
if (curUser) {
|
||||
this.listQuery.userId = curUser.id
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
|
||||
@@ -1,6 +1,15 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.userId" placeholder="请选择用户" clearable>
|
||||
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-select v-model="listQuery.isOnline" placeholder="请选择在线状态" clearable>
|
||||
<el-option v-for="item in selectObj.onlineOptions" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable>
|
||||
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value"/>
|
||||
</el-select>
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
|
||||
</div>
|
||||
@@ -60,8 +69,8 @@
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.currentPage"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -132,11 +141,11 @@
|
||||
total: null,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
importance: undefined,
|
||||
title: undefined,
|
||||
type: undefined
|
||||
current: 1,
|
||||
size: 10,
|
||||
enable: undefined,
|
||||
isOnline: undefined,
|
||||
userId: null
|
||||
},
|
||||
importanceOptions: [1, 2, 3],
|
||||
calendarTypeOptions,
|
||||
@@ -165,7 +174,11 @@
|
||||
userId: [{ required: true, message: '请选择用户', trigger: 'blur' }],
|
||||
name: [{ required: true, message: 'License名称不能为空', trigger: 'blur' }]
|
||||
},
|
||||
downloadLoading: false
|
||||
downloadLoading: false,
|
||||
selectObj: {
|
||||
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
|
||||
onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }]
|
||||
}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
@@ -195,8 +208,7 @@
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getUserList()
|
||||
this.getDataList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
@@ -212,6 +224,17 @@
|
||||
this.userList = response.data.data
|
||||
})
|
||||
},
|
||||
getDataList() {
|
||||
const loginName = this.$store.state.user.loginName
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
const curUser = this.userList.find((val) => val.loginName === loginName)
|
||||
if (curUser) {
|
||||
this.listQuery.userId = curUser.id
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
|
||||
@@ -1,95 +1,108 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
|
||||
<div class="filter-container" style="display:flex">
|
||||
<el-select v-model="listQuery.userId" placeholder="请选择用户" clearable style="margin-right:10px">
|
||||
<el-option v-for="item in userList" :key="item.loginName" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
<el-select v-model="listQuery.licenseId" placeholder="请选择license" clearable style="margin-right:10px">
|
||||
<el-option v-for="item in licenseList" :key="item.key" :label="item.name" :value="item.id" />
|
||||
</el-select>
|
||||
<el-input v-model="listQuery.serverPort" type="text" style="width:150px;margin-right:10px" class="filter-item"
|
||||
placeholder="请输入服务端端口" :maxlength="5" show-word-limit />
|
||||
<el-select v-model="listQuery.isOnline" placeholder="请选择在线状态" clearable style="width:145px;margin-right:10px">
|
||||
<el-option v-for="item in selectObj.onlineOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-select v-model="listQuery.enable" placeholder="请选择启用状态" clearable style="width:145px;margin-right:10px">
|
||||
<el-option v-for="item in selectObj.statusOptions" :key="item.value" :label="item.label" :value="item.value" />
|
||||
</el-select>
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{
|
||||
$t('table.search') }}</el-button>
|
||||
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary"
|
||||
icon="el-icon-edit">{{ $t('table.add') }}</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row
|
||||
style="width: 100%">
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit
|
||||
highlight-current-row style="width: 100%">
|
||||
<el-table-column align="center" :label="$t('table.id')" width="50">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.id}}</span>
|
||||
<span>{{ scope.row.id }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.userName')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.userName}}</span>
|
||||
<span>{{ scope.row.userName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.licenseName')" width="150">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.licenseName}}</span>
|
||||
<span>{{ scope.row.licenseName }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.serverPort')" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.serverPort}}</span>
|
||||
<span>{{ scope.row.serverPort }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.proxyClient')" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.clientIp}}:{{scope.row.clientPort}}</span>
|
||||
<span>{{ scope.row.clientIp }}:{{ scope.row.clientPort }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" align="center" :label="$t('table.createTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||
<span>{{ scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" align="center" :label="$t('table.updateTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||
<span>{{ scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.enable | statusFilter">{{scope.row.enable | statusName}}</el-tag>
|
||||
<el-tag :type="scope.row.enable | statusFilter">{{ scope.row.enable | statusName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column class-name="status-col" :label="$t('table.isOnline')" width="100">
|
||||
<template slot-scope="scope">
|
||||
<el-tag :type="scope.row.isOnline | statusFilter">{{scope.row.isOnline | isOnlineName}}</el-tag>
|
||||
<el-tag :type="scope.row.isOnline | statusFilter">{{ scope.row.isOnline | isOnlineName }}</el-tag>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.actions')" width="230" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{$t('table.edit')}}</el-button>
|
||||
<el-button v-if="scope.row.enable =='1'" size="mini" type="danger" @click="handleModifyStatus(scope.row,2)">{{$t('table.disable')}}</el-button>
|
||||
<el-button v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row,1)">{{$t('table.enable')}}</el-button>
|
||||
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{ $t('table.edit') }}</el-button>
|
||||
<el-button v-if="scope.row.enable == '1'" size="mini" type="danger" @click="handleModifyStatus(scope.row, 2)">{{
|
||||
$t('table.disable') }}</el-button>
|
||||
<el-button v-if="scope.row.enable == '2'" size="mini" type="success"
|
||||
@click="handleModifyStatus(scope.row, 1)">{{ $t('table.enable') }}</el-button>
|
||||
<!-- <el-button size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>-->
|
||||
<ButtonPopover @handleCommitClick="handleDelete2(scope.row)" style="margin-left: 10px"/>
|
||||
<ButtonPopover @handleCommitClick="handleDelete2(scope.row)" style="margin-left: 10px" />
|
||||
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.currentPage"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-pageInfo.sync="listQuery.current" :pageInfo-sizes="[10, 20, 30, 50]" :pageInfo-size="listQuery.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="120px" style='width: 400px; margin-left:50px;'>
|
||||
<!-- <el-form-item :label="$t('License')" prop="licenseId">-->
|
||||
<!-- <el-select style="width: 280px;" class="filter-item" v-model="temp.licenseId" placeholder="请选择" :disabled="dialogStatus=='update'">-->
|
||||
<!-- <el-option v-for="item in licenseList" :key="item.id" :label="item.name" :value="item.id">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="120px"
|
||||
style='width: 400px; margin-left:50px;'>
|
||||
<!-- <el-form-item :label="$t('License')" prop="licenseId">-->
|
||||
<!-- <el-select style="width: 280px;" class="filter-item" v-model="temp.licenseId" placeholder="请选择" :disabled="dialogStatus=='update'">-->
|
||||
<!-- <el-option v-for="item in licenseList" :key="item.id" :label="item.name" :value="item.id">-->
|
||||
<!-- </el-option>-->
|
||||
<!-- </el-select>-->
|
||||
<!-- </el-form-item>-->
|
||||
|
||||
<el-form-item :label="$t('License')" prop="licenseId">
|
||||
<DropdownTable
|
||||
v-model="temp.licenseId"
|
||||
:name.sync="temp.licenseName"
|
||||
:tableData= "licenseList"
|
||||
@selectedData="selectedFeeItem"
|
||||
placeholder="请选择"
|
||||
:width="280"
|
||||
:disabled="dialogStatus==='update'"
|
||||
/>
|
||||
<!-- <DropdownTable
|
||||
<DropdownTable v-model="temp.licenseId" :name.sync="temp.licenseName" :tableData="licenseAuthList"
|
||||
@selectedData="selectedFeeItem" placeholder="请选择" :width="280" :disabled="dialogStatus === 'update'" />
|
||||
<!-- <DropdownTable
|
||||
:columns="countryColumns"
|
||||
:data="licenseList"
|
||||
v-model="temp.licenseId"
|
||||
@@ -114,9 +127,11 @@
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
|
||||
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{$t('table.confirm')}}</el-button>
|
||||
<el-button v-else type="primary" @click="updateData">{{$t('table.confirm')}}</el-button>
|
||||
<el-button @click="
|
||||
dialogFormVisible = false">{{ $t('table.cancel') }}</el-button>
|
||||
<el-button v-if="dialogStatus == 'create'" type="primary" @click="createData">{{ $t('table.confirm')
|
||||
}}</el-button>
|
||||
<el-button v-else type="primary" @click="updateData">{{ $t('table.confirm') }}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
@@ -126,7 +141,7 @@
|
||||
<el-table-column prop="pv" label="Pv"> </el-table-column>
|
||||
</el-table>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="dialogPvVisible = false">{{$t('table.confirm')}}</el-button>
|
||||
<el-button type="primary" @click="dialogPvVisible = false">{{ $t('table.confirm') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
@@ -134,251 +149,283 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchList, createUserPortMapping, updateUserPortMapping, updateEnableStatus, deletePortMapping } from '@/api/portMapping'
|
||||
import { portPoolList } from '@/api/portPool'
|
||||
import { licenseList } from '@/api/license'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
import { parseTime } from '@/utils'
|
||||
import ButtonPopover from '../../components/Button/buttonPopover'
|
||||
import DropdownTable from '../../components/Dropdown/DropdownTable'
|
||||
import { fetchList, createUserPortMapping, updateUserPortMapping, updateEnableStatus, deletePortMapping } from '@/api/portMapping'
|
||||
import { portPoolList, availablePortList } from '@/api/portPool'
|
||||
import { licenseList, licenseAuthList } from '@/api/license'
|
||||
import { userList } from '@/api/user'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
import { parseTime } from '@/utils'
|
||||
import ButtonPopover from '../../components/Button/buttonPopover'
|
||||
import DropdownTable from '../../components/Dropdown/DropdownTable'
|
||||
|
||||
const calendarTypeOptions = [
|
||||
{ key: 'CN', display_name: 'China' },
|
||||
{ key: 'US', display_name: 'USA' },
|
||||
{ key: 'JP', display_name: 'Japan' },
|
||||
{ key: 'EU', display_name: 'Eurozone' }
|
||||
]
|
||||
const calendarTypeOptions = [
|
||||
{ key: 'CN', display_name: 'China' },
|
||||
{ key: 'US', display_name: 'USA' },
|
||||
{ key: 'JP', display_name: 'Japan' },
|
||||
{ key: 'EU', display_name: 'Eurozone' }
|
||||
]
|
||||
|
||||
// arr to obj ,such as { CN : "China", US : "USA" }
|
||||
const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
|
||||
acc[cur.key] = cur.display_name
|
||||
return acc
|
||||
}, {})
|
||||
// arr to obj ,such as { CN : "China", US : "USA" }
|
||||
const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
|
||||
acc[cur.key] = cur.display_name
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
export default {
|
||||
name: 'complexTable',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
components: {
|
||||
DropdownTable,
|
||||
ButtonPopover
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: null,
|
||||
total: null,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
importance: undefined,
|
||||
title: undefined,
|
||||
type: undefined
|
||||
},
|
||||
importanceOptions: [1, 2, 3],
|
||||
calendarTypeOptions,
|
||||
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
|
||||
statusOptions: ['published', 'draft', 'deleted'],
|
||||
licenseList: [],
|
||||
serverPortList: [],
|
||||
showReviewer: false,
|
||||
temp: {
|
||||
id: undefined,
|
||||
licenseId: undefined,
|
||||
licenseName: undefined,
|
||||
serverPort: undefined,
|
||||
clientIp: undefined,
|
||||
clientPort: undefined
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '新建'
|
||||
},
|
||||
dialogPvVisible: false,
|
||||
pvData: [],
|
||||
rules: {
|
||||
licenseId: [{ required: true, message: '请选择License', trigger: 'blur,change' }],
|
||||
serverPort: [{ required: true, message: '请输入服务端端口', trigger: 'blur' }],
|
||||
clientIp: [{ required: true, message: '请输入客户端IP', trigger: 'blur' }],
|
||||
clientPort: [{ required: true, message: '请输入客户端端口', trigger: 'blur' }]
|
||||
},
|
||||
downloadLoading: false,
|
||||
countryColumns: [
|
||||
{ prop: 'userName', label: '用户名', align: 'center' },
|
||||
{ prop: 'name', label: 'License', align: 'center' }
|
||||
]
|
||||
export default {
|
||||
name: 'complexTable',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
components: {
|
||||
DropdownTable,
|
||||
ButtonPopover
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: null,
|
||||
total: null,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
importance: undefined,
|
||||
title: undefined,
|
||||
type: undefined,
|
||||
userId: undefined,
|
||||
license: undefined,
|
||||
port: undefined,
|
||||
isOnline: undefined,
|
||||
enable: undefined
|
||||
|
||||
},
|
||||
importanceOptions: [1, 2, 3],
|
||||
calendarTypeOptions,
|
||||
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
|
||||
statusOptions: ['published', 'draft', 'deleted'],
|
||||
userList: [],
|
||||
licenseList: [],
|
||||
licenseAuthList: [],
|
||||
serverPortList: [],
|
||||
showReviewer: false,
|
||||
temp: {
|
||||
id: undefined,
|
||||
licenseId: undefined,
|
||||
licenseName: undefined,
|
||||
serverPort: undefined,
|
||||
clientIp: undefined,
|
||||
clientPort: undefined
|
||||
},
|
||||
selectObj: {
|
||||
statusOptions: [{ label: '启用', value: 1 }, { label: '禁用', value: 2 }],
|
||||
onlineOptions: [{ label: '在线', value: 1 }, { label: '离线', value: 2 }]
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '新建'
|
||||
},
|
||||
dialogPvVisible: false,
|
||||
pvData: [],
|
||||
rules: {
|
||||
licenseId: [{ required: true, message: '请选择License', trigger: 'blur,change' }],
|
||||
serverPort: [{ required: true, message: '请输入服务端端口', trigger: 'blur' }],
|
||||
clientIp: [{ required: true, message: '请输入客户端IP', trigger: 'blur' }],
|
||||
clientPort: [{ required: true, message: '请输入客户端端口', trigger: 'blur' }]
|
||||
},
|
||||
downloadLoading: false,
|
||||
countryColumns: [
|
||||
{ prop: 'userName', label: '用户名', align: 'center' },
|
||||
{ prop: 'name', label: 'License', align: 'center' }
|
||||
]
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
statusName(status) {
|
||||
const statusMap = {
|
||||
1: '启用',
|
||||
2: '禁用'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
filters: {
|
||||
statusName(status) {
|
||||
const statusMap = {
|
||||
1: '启用',
|
||||
2: '禁用'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
isOnlineName(isOnline) {
|
||||
const isOnlineMap = {
|
||||
1: '在线',
|
||||
2: '离线'
|
||||
}
|
||||
return isOnlineMap[isOnline]
|
||||
},
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
typeFilter(type) {
|
||||
return calendarTypeKeyValue[type]
|
||||
isOnlineName(isOnline) {
|
||||
const isOnlineMap = {
|
||||
1: '在线',
|
||||
2: '离线'
|
||||
}
|
||||
return isOnlineMap[isOnline]
|
||||
},
|
||||
created() {
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
typeFilter(type) {
|
||||
return calendarTypeKeyValue[type]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getDataList()
|
||||
this.getLicenseList()
|
||||
this.getLicenseAuthList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchList(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getDataList() {
|
||||
const loginName = this.$store.state.user.loginName
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
const curUser = this.userList.find((val) => val.loginName === loginName)
|
||||
if (curUser) {
|
||||
this.listQuery.userId = curUser.id
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
getPortPoolList() {
|
||||
portPoolList().then(response => {
|
||||
this.serverPortList = response.data.data
|
||||
})
|
||||
},
|
||||
getAvailablePortList(licenseId) {
|
||||
availablePortList(licenseId).then(response => {
|
||||
this.serverPortList = response.data.data
|
||||
})
|
||||
},
|
||||
getAllUserList() {
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
})
|
||||
},
|
||||
getLicenseList() {
|
||||
licenseList().then(response => {
|
||||
this.licenseList = response.data.data
|
||||
})
|
||||
},
|
||||
getLicenseAuthList() {
|
||||
licenseAuthList().then(response => {
|
||||
this.licenseAuthList = response.data.data
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
this.getPortPoolList()
|
||||
this.getLicenseList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchList(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getPortPoolList() {
|
||||
portPoolList().then(response => {
|
||||
this.serverPortList = response.data.data
|
||||
})
|
||||
},
|
||||
getLicenseList() {
|
||||
licenseList().then(response => {
|
||||
this.licenseList = response.data.data
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.size = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
handleModifyStatus(row, enable) {
|
||||
console.log('route', this.$route)
|
||||
updateEnableStatus(row.id, enable).then(response => {
|
||||
if (response.data.data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
resetTemp() {
|
||||
this.temp = {
|
||||
id: undefined,
|
||||
licenseId: undefined,
|
||||
licenseName: undefined,
|
||||
serverPort: undefined,
|
||||
clientIp: undefined,
|
||||
clientPort: undefined
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.size = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
handleModifyStatus(row, enable) {
|
||||
console.log('route', this.$route)
|
||||
updateEnableStatus(row.id, enable).then(response => {
|
||||
if (response.data.data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
},
|
||||
handleCreate() {
|
||||
this.resetTemp()
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
createData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
createUserPortMapping(this.temp).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '创建成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.temp = Object.assign({}, row) // copy obj
|
||||
this.temp.timestamp = new Date(this.temp.timestamp)
|
||||
this.dialogStatus = 'update'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
updateData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const tempData = Object.assign({}, this.temp)
|
||||
updateUserPortMapping(tempData).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
// this.$message({
|
||||
// message: '操作成功',
|
||||
// type: 'success'
|
||||
// })
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '更新成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
selectedFeeItem(row, list) {
|
||||
this.temp.licenseId = row.id
|
||||
this.temp.licenseName = row.name
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deletePortMapping(row.id).then(response => {
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
resetTemp() {
|
||||
this.temp = {
|
||||
id: undefined,
|
||||
licenseId: undefined,
|
||||
licenseName: undefined,
|
||||
serverPort: undefined,
|
||||
clientIp: '127.0.0.1',
|
||||
clientPort: undefined,
|
||||
userId: undefined
|
||||
}
|
||||
this.serverPortList = []
|
||||
},
|
||||
handleCreate() {
|
||||
this.resetTemp()
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
createData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
createUserPortMapping(this.temp).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '删除成功',
|
||||
message: '创建成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}).catch(() => {})
|
||||
},
|
||||
handleDelete2(row) {
|
||||
}
|
||||
})
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.temp = Object.assign({}, row) // copy obj
|
||||
this.temp.timestamp = new Date(this.temp.timestamp)
|
||||
this.dialogStatus = 'update'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
this.getAvailablePortList(row.licenseId)
|
||||
},
|
||||
updateData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const tempData = Object.assign({}, this.temp)
|
||||
updateUserPortMapping(tempData).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
// this.$message({
|
||||
// message: '操作成功',
|
||||
// type: 'success'
|
||||
// })
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '更新成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
selectedFeeItem(row, list) {
|
||||
if (this.temp.licenseId !== row.id) {
|
||||
this.temp.licenseId = row.id
|
||||
this.temp.licenseName = row.name
|
||||
this.getAvailablePortList(row.id)
|
||||
this.temp.serverPort = null
|
||||
}
|
||||
},
|
||||
handleDelete(row) {
|
||||
this.$confirm('确定要删除吗?', '提示', {
|
||||
confirmButtonText: '确定',
|
||||
cancelButtonText: '取消',
|
||||
type: 'warning'
|
||||
}).then(() => {
|
||||
deletePortMapping(row.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
@@ -390,26 +437,40 @@
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDownload() {
|
||||
this.downloadLoading = true
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
|
||||
const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
|
||||
const data = this.formatJson(filterVal, this.list)
|
||||
excel.export_json_to_excel(tHeader, data, 'table-list')
|
||||
this.downloadLoading = false
|
||||
})
|
||||
},
|
||||
formatJson(filterVal, jsonData) {
|
||||
return jsonData.map(v => filterVal.map(j => {
|
||||
if (j === 'timestamp') {
|
||||
return parseTime(v[j])
|
||||
} else {
|
||||
return v[j]
|
||||
}
|
||||
}))
|
||||
}
|
||||
}).catch(() => { })
|
||||
},
|
||||
handleDelete2(row) {
|
||||
deletePortMapping(row.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDownload() {
|
||||
this.downloadLoading = true
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
|
||||
const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
|
||||
const data = this.formatJson(filterVal, this.list)
|
||||
excel.export_json_to_excel(tHeader, data, 'table-list')
|
||||
this.downloadLoading = false
|
||||
})
|
||||
},
|
||||
formatJson(filterVal, jsonData) {
|
||||
return jsonData.map(v => filterVal.map(j => {
|
||||
if (j === 'timestamp') {
|
||||
return parseTime(v[j])
|
||||
} else {
|
||||
return v[j]
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -0,0 +1,149 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.userId" placeholder="请选择用户" clearable>
|
||||
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-select v-model="listQuery.licenseId" placeholder="请选择License" clearable>
|
||||
<el-option v-for="item in licenseList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-button type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column type="index" width="100" :label="$t('table.id')"></el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.userName')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.userName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.licenseName')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.licenseName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.upFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.upFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.downFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.downFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.totalFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.totalFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" align="center" :label="$t('table.date')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.date | parseTime('{y}-{m}')}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchLicenseFlowMonthReportList } from '@/api/report'
|
||||
import { userList } from '@/api/user'
|
||||
import waves from '@/directive/waves'
|
||||
import { licenseList } from '@/api/license'
|
||||
|
||||
export default {
|
||||
name: 'licenseFlowMonthReport',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: null,
|
||||
total: null,
|
||||
listLoading: false,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
userId: undefined,
|
||||
licenseId: undefined
|
||||
},
|
||||
userList: [],
|
||||
licenseList: [],
|
||||
dialogVisible: false,
|
||||
selectRow: {}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getUserList()
|
||||
this.getLicenseList()
|
||||
},
|
||||
activated() {
|
||||
this.getUserList()
|
||||
this.getLicenseList()
|
||||
if (this.$route.query.userId) {
|
||||
this.listQuery.userId = this.$route.query.userId
|
||||
}
|
||||
if (this.$route.query.licenseId) {
|
||||
this.listQuery.licenseId = this.$route.query.licenseId
|
||||
}
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchLicenseFlowMonthReportList(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getUserList() {
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
})
|
||||
},
|
||||
getLicenseList() {
|
||||
licenseList().then(response => {
|
||||
this.licenseList = response.data.data
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.size = val
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
handleShowClick(row) {
|
||||
console.log(row)
|
||||
},
|
||||
handleLookOver(row) {
|
||||
this.selectRow = row
|
||||
this.dialogVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.job-msg-div{
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,136 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.userId" placeholder="请选择用户" clearable>
|
||||
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-button type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column type="index" width="100" :label="$t('table.id')"></el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.userName')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.userName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.licenseName')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.licenseName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.upFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.upFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.downFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.downFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.totalFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.totalFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.actions')" min-width="230" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" @click="handleFlowMonthReportClick(scope.row)">流量月度明细</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchLicenseFlowReportList } from '@/api/report'
|
||||
import { userList } from '@/api/user'
|
||||
import waves from '@/directive/waves'
|
||||
|
||||
export default {
|
||||
name: 'licenseFlowReport',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: null,
|
||||
total: null,
|
||||
listLoading: false,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
jobId: undefined
|
||||
},
|
||||
userList: [],
|
||||
dialogVisible: false,
|
||||
selectRow: {}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getUserList()
|
||||
},
|
||||
activated() {
|
||||
this.getUserList()
|
||||
if (this.$route.query.jobId) {
|
||||
this.listQuery.jobId = this.$route.query.jobId
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchLicenseFlowReportList(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getUserList() {
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.size = val
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
handleShowClick(row) {
|
||||
console.log(row)
|
||||
},
|
||||
handleLookOver(row) {
|
||||
this.selectRow = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
handleFlowMonthReportClick(row) {
|
||||
this.$router.push({ path: '/report/licenseFlowMonthReport', query: { userId: row.userId, licenseId: row.licenseId }})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.job-msg-div{
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,128 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.userId" placeholder="请选择用户" clearable>
|
||||
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-button type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column type="index" width="100" :label="$t('table.id')"></el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.userName')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.userName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.upFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.upFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.downFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.downFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.totalFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.totalFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="150px" align="center" :label="$t('table.date')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.date | parseTime('{y}-{m}')}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchUserFlowMonthReportList } from '@/api/report'
|
||||
import { userList } from '@/api/user'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
|
||||
export default {
|
||||
name: 'userFlowMonthReport',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: null,
|
||||
total: null,
|
||||
listLoading: false,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
userId: undefined
|
||||
},
|
||||
userList: [],
|
||||
dialogVisible: false,
|
||||
selectRow: {}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getUserList()
|
||||
},
|
||||
activated() {
|
||||
this.getUserList()
|
||||
if (this.$route.query.userId) {
|
||||
this.listQuery.userId = this.$route.query.userId
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchUserFlowMonthReportList(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getUserList() {
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.size = val
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
handleShowClick(row) {
|
||||
console.log(row)
|
||||
},
|
||||
handleLookOver(row) {
|
||||
this.selectRow = row
|
||||
this.dialogVisible = true
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.job-msg-div{
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -0,0 +1,135 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.userId" placeholder="请选择用户" clearable>
|
||||
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-button type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column type="index" width="100" :label="$t('table.id')"></el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.userName')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.userName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.upFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.upFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.downFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.downFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.totalFlow')" min-width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.totalFlowDesc}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.actions')" min-width="230" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button size="mini" type="text" @click="handleFlowMonthReportClick(scope.row)">流量月度明细</el-button>
|
||||
<el-button size="mini" type="text" @click="handleLicenseFlowMonthReportClick(scope.row)">License流量月度明细</el-button>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchUserFlowReportList } from '@/api/report'
|
||||
import { userList } from '@/api/user'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
|
||||
export default {
|
||||
name: 'userFlowReport',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: null,
|
||||
total: null,
|
||||
listLoading: false,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
userId: undefined
|
||||
},
|
||||
userList: [],
|
||||
dialogVisible: false,
|
||||
selectRow: {}
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getUserList()
|
||||
},
|
||||
activated() {
|
||||
this.getUserList()
|
||||
if (this.$route.query.userId) {
|
||||
this.listQuery.userId = this.$route.query.userId
|
||||
this.getList()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchUserFlowReportList(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getUserList() {
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.size = val
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
handleShowClick(row) {
|
||||
console.log(row)
|
||||
},
|
||||
handleLookOver(row) {
|
||||
this.selectRow = row
|
||||
this.dialogVisible = true
|
||||
},
|
||||
handleFlowMonthReportClick(row) {
|
||||
this.$router.push({ path: '/report/userFlowMonthReport', query: { userId: row.userId }})
|
||||
},
|
||||
handleLicenseFlowMonthReportClick(row) {
|
||||
this.$router.push({ path: '/report/licenseFlowMonthReport', query: { userId: row.userId }})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.job-msg-div{
|
||||
max-height: 400px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
</style>
|
||||
@@ -51,8 +51,8 @@
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.currentPage"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -114,8 +114,8 @@
|
||||
total: null,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
current: 1,
|
||||
size: 10,
|
||||
importance: undefined,
|
||||
title: undefined,
|
||||
type: undefined
|
||||
|
||||
@@ -0,0 +1,346 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">
|
||||
{{ $t('table.search') }}
|
||||
</el-button>
|
||||
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary"
|
||||
icon="el-icon-edit">{{ $t('table.add') }}
|
||||
</el-button>
|
||||
</div>
|
||||
|
||||
<el-table :key='tableKey' :data="list" v-loading="listLoading" element-loading-text="给我一点时间" border fit
|
||||
highlight-current-row
|
||||
style="width: 100%">
|
||||
<el-table-column align="center" :label="$t('table.id')" width="120">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.id }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.groupName')" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.name }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.groupPossessor')" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.possessorType == 1 ? "用户:" : (scope.row.possessorType == 2 ? "License:" : "全局") }} {{ scope.row.possessor }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="200" align="center" :label="$t('table.createTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="200" align="center" :label="$t('table.updateTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{ scope.row.updateTime | parseTime('{y}-{m}-{d} {h}:{i}') }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<!-- <el-table-column class-name="status-col" :label="$t('table.enableStatus')" width="150">-->
|
||||
<!-- <template slot-scope="scope">-->
|
||||
<!-- <el-tag :type="scope.row.enable | statusFilter">{{ scope.row.enable | statusName }}</el-tag>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-table-column>-->
|
||||
<el-table-column align="center" :label="$t('table.actions')" width="250" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<!-- <el-button v-if="scope.row.enable =='1'" size="mini" type="danger" @click="handleModifyStatus(scope.row,2)">-->
|
||||
<!-- {{ $t('table.disable') }}-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row,1)">-->
|
||||
<!-- {{ $t('table.enable') }}-->
|
||||
<!-- </el-button>-->
|
||||
<!-- <el-button v-if="scope.row.status!='deleted'" size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>-->
|
||||
<ButtonPopover @handleCommitClick="handleDelete(scope.row)" style="margin-left: 10px"/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange"
|
||||
:current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size"
|
||||
layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="70px"
|
||||
style='width: 400px; margin-left:50px;'>
|
||||
<el-form-item style="width: 350px" class="filter-item" :label="$t('table.groupName')" prop="name">
|
||||
<el-input v-model="temp.name"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('table.possessorType')" prop="possessorType">
|
||||
<el-select style="width: 280px" class="filter-item" v-model="temp.possessorType" placeholder="请选择"
|
||||
:disabled="dialogStatus=='update'">
|
||||
<el-option v-for="item in possessorTypeList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
|
||||
<el-form-item v-show="temp.possessorType==1" :label="$t('table.userName')" prop="possessorId">
|
||||
<el-select style="width: 280px" class="filter-item" v-model="temp.possessorId" placeholder="请选择"
|
||||
:disabled="dialogStatus=='update'">
|
||||
<el-option v-for="item in userList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item v-show="temp.possessorType==2" :label="$t('table.license')" prop="possessorId">
|
||||
<el-select style="width: 280px" class="filter-item" v-model="temp.possessorId" placeholder="请选择"
|
||||
:disabled="dialogStatus=='update'">
|
||||
<el-option v-for="item in licenseList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">{{ $t('table.cancel') }}</el-button>
|
||||
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{ $t('table.confirm') }}
|
||||
</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog title="Reading statistics" :visible.sync="dialogPvVisible">
|
||||
<el-table :data="pvData" border fit highlight-current-row style="width: 100%">
|
||||
<el-table-column prop="key" label="Channel"></el-table-column>
|
||||
<el-table-column prop="pv" label="Pv"></el-table-column>
|
||||
</el-table>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button type="primary" @click="dialogPvVisible = false">{{ $t('table.confirm') }}</el-button>
|
||||
</span>
|
||||
</el-dialog>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchList, updateEnableStatus, createPortGroup, deleteGroup } from '@/api/portGroup'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
import { parseTime } from '@/utils'
|
||||
import { userList } from '@/api/user'
|
||||
import ButtonPopover from '../../components/Button/buttonPopover'
|
||||
import { licenseList } from '../../api/license'
|
||||
|
||||
const calendarTypeOptions = [
|
||||
{ key: 'CN', display_name: 'China' },
|
||||
{ key: 'US', display_name: 'USA' },
|
||||
{ key: 'JP', display_name: 'Japan' },
|
||||
{ key: 'EU', display_name: 'Eurozone' }
|
||||
]
|
||||
|
||||
// arr to obj ,such as { CN : "China", US : "USA" }
|
||||
const calendarTypeKeyValue = calendarTypeOptions.reduce((acc, cur) => {
|
||||
acc[cur.key] = cur.display_name
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
export default {
|
||||
name: 'complexTable',
|
||||
directives: {
|
||||
waves
|
||||
},
|
||||
components: {
|
||||
ButtonPopover
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
tableKey: 0,
|
||||
list: null,
|
||||
total: null,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
current: 1,
|
||||
size: 10,
|
||||
importance: undefined,
|
||||
title: undefined,
|
||||
type: undefined
|
||||
},
|
||||
importanceOptions: [1, 2, 3],
|
||||
calendarTypeOptions,
|
||||
sortOptions: [{ label: 'ID Ascending', key: '+id' }, { label: 'ID Descending', key: '-id' }],
|
||||
statusOptions: ['published', 'draft', 'deleted'],
|
||||
showReviewer: false,
|
||||
userList: [],
|
||||
licenseList: [],
|
||||
possessorTypeList: [
|
||||
{
|
||||
'id': 1,
|
||||
'name': '用户'
|
||||
},
|
||||
{
|
||||
'id': 2,
|
||||
'name': '通道'
|
||||
}
|
||||
],
|
||||
temp: {
|
||||
name: '',
|
||||
possessorType: 1,
|
||||
possessorId: 1
|
||||
|
||||
},
|
||||
dialogFormVisible: false,
|
||||
dialogStatus: '',
|
||||
textMap: {
|
||||
update: '编辑',
|
||||
create: '新建'
|
||||
},
|
||||
dialogPvVisible: false,
|
||||
pvData: [],
|
||||
rules: {
|
||||
port: [{ required: true, message: '端口必填', trigger: 'blur' }]
|
||||
},
|
||||
downloadLoading: false
|
||||
}
|
||||
},
|
||||
filters: {
|
||||
statusName(status) {
|
||||
const statusMap = {
|
||||
1: '启用',
|
||||
2: '禁用'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
statusFilter(status) {
|
||||
const statusMap = {
|
||||
1: 'success',
|
||||
2: 'danger'
|
||||
}
|
||||
return statusMap[status]
|
||||
},
|
||||
typeFilter(type) {
|
||||
return calendarTypeKeyValue[type]
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
this.getUserList()
|
||||
this.getLicenseList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
this.listLoading = true
|
||||
fetchList(this.listQuery).then(response => {
|
||||
this.list = response.data.data.records
|
||||
this.total = response.data.data.total
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getUserList() {
|
||||
userList().then(response => {
|
||||
this.userList = response.data.data
|
||||
})
|
||||
},
|
||||
getLicenseList() {
|
||||
licenseList().then(response => {
|
||||
this.licenseList = response.data.data
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
},
|
||||
handleSizeChange(val) {
|
||||
this.listQuery.size = val
|
||||
this.getList()
|
||||
},
|
||||
handleCurrentChange(val) {
|
||||
this.listQuery.current = val
|
||||
this.getList()
|
||||
},
|
||||
handleModifyStatus(row, enable) {
|
||||
console.log('route', this.$route)
|
||||
updateEnableStatus(row.id, enable).then(response => {
|
||||
if (response.data.data.code === 0) {
|
||||
this.$message({
|
||||
message: '操作成功',
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
this.getList()
|
||||
})
|
||||
},
|
||||
resetTemp() {
|
||||
this.temp = {
|
||||
id: undefined,
|
||||
importance: 1,
|
||||
remark: '',
|
||||
timestamp: new Date(),
|
||||
title: '',
|
||||
status: 'published',
|
||||
type: ''
|
||||
}
|
||||
},
|
||||
handleCreate() {
|
||||
this.resetTemp()
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
createData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
createPortGroup(this.temp).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.dialogFormVisible = false
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '创建成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleUpdate(row) {
|
||||
this.temp = Object.assign({}, row) // copy obj
|
||||
this.temp.timestamp = new Date(this.temp.timestamp)
|
||||
this.dialogStatus = 'update'
|
||||
this.dialogFormVisible = true
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
deleteGroup(row.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '删除成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDownload() {
|
||||
this.downloadLoading = true
|
||||
import('@/vendor/Export2Excel').then(excel => {
|
||||
const tHeader = ['timestamp', 'title', 'type', 'importance', 'status']
|
||||
const filterVal = ['timestamp', 'title', 'type', 'importance', 'status']
|
||||
const data = this.formatJson(filterVal, this.list)
|
||||
excel.export_json_to_excel(tHeader, data, 'table-list')
|
||||
this.downloadLoading = false
|
||||
})
|
||||
},
|
||||
formatJson(filterVal, jsonData) {
|
||||
return jsonData.map(v => filterVal.map(j => {
|
||||
if (j === 'timestamp') {
|
||||
return parseTime(v[j])
|
||||
} else {
|
||||
return v[j]
|
||||
}
|
||||
}))
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,6 +1,9 @@
|
||||
<template>
|
||||
<div class="app-container calendar-list-container">
|
||||
<div class="filter-container">
|
||||
<el-select v-model="listQuery.groupId" placeholder="请选择端口池分组" clearable>
|
||||
<el-option v-for="item in portGroupList" :key="item.id" :label="item.name" :value="item.id"/>
|
||||
</el-select>
|
||||
<el-button class="filter-item" type="primary" v-waves icon="el-icon-search" @click="handleFilter">{{$t('table.search')}}</el-button>
|
||||
<el-button class="filter-item" style="margin-left: 10px;" @click="handleCreate" type="primary" icon="el-icon-edit">{{$t('table.add')}}</el-button>
|
||||
</div>
|
||||
@@ -17,6 +20,11 @@
|
||||
<span>{{scope.row.port}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.groupName')" width="200">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.groupName}}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column width="200" align="center" :label="$t('table.createTime')">
|
||||
<template slot-scope="scope">
|
||||
<span>{{scope.row.createTime | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
|
||||
@@ -34,6 +42,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="$t('table.actions')" width="250" class-name="small-padding fixed-width">
|
||||
<template slot-scope="scope">
|
||||
<el-button type="primary" size="mini" @click="handleUpdate(scope.row)">{{$t('table.edit')}}</el-button>
|
||||
<el-button v-if="scope.row.enable =='1'" size="mini" type="danger" @click="handleModifyStatus(scope.row,2)">{{$t('table.disable')}}</el-button>
|
||||
<el-button v-if="scope.row.enable =='2'" size="mini" type="success" @click="handleModifyStatus(scope.row,1)">{{$t('table.enable')}}</el-button>
|
||||
<!-- <el-button v-if="scope.row.status!='deleted'" size="mini" type="danger" @click="handleDelete(scope.row,'deleted')">{{$t('table.delete')}}</el-button>-->
|
||||
@@ -43,20 +52,29 @@
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.currentPage"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
<el-dialog :title="textMap[dialogStatus]" :visible.sync="dialogFormVisible">
|
||||
<el-form :rules="rules" ref="dataForm" :model="temp" label-position="left" label-width="70px" style='width: 400px; margin-left:50px;'>
|
||||
<el-form-item :label="$t('table.port')" prop="port">
|
||||
<el-input v-model="temp.port"></el-input>
|
||||
<el-input v-model="temp.port" :disabled="dialogStatus=='update'"></el-input>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item :label="$t('table.group')" prop="group">
|
||||
<el-select style="width: 330px" class="filter-item" v-model="temp.groupId">
|
||||
<el-option v-for="item in portGroupList" :key="item.id" :label="item.name" :value="item.id">
|
||||
</el-option>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
|
||||
</el-form>
|
||||
<div slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogFormVisible = false">{{$t('table.cancel')}}</el-button>
|
||||
<el-button v-if="dialogStatus=='create'" type="primary" @click="createData">{{$t('table.confirm')}}</el-button>
|
||||
<el-button v-else type="primary" @click="updateData">{{$t('table.confirm')}}</el-button>
|
||||
</div>
|
||||
</el-dialog>
|
||||
|
||||
@@ -74,7 +92,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { fetchList, updateEnableStatus, createPortPool, deletePortPool } from '@/api/portPool'
|
||||
import { fetchList, updateEnableStatus, createPortPool, deletePortPool, updatePortPool } from '@/api/portPool'
|
||||
import { portGroupList } from '@/api/portGroup'
|
||||
import waves from '@/directive/waves' // 水波纹指令
|
||||
import { parseTime } from '@/utils'
|
||||
import ButtonPopover from '../../components/Button/buttonPopover'
|
||||
@@ -107,11 +126,9 @@
|
||||
total: null,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
importance: undefined,
|
||||
title: undefined,
|
||||
type: undefined
|
||||
current: 1,
|
||||
size: 10,
|
||||
groupId: undefined
|
||||
},
|
||||
importanceOptions: [1, 2, 3],
|
||||
calendarTypeOptions,
|
||||
@@ -119,6 +136,7 @@
|
||||
statusOptions: ['published', 'draft', 'deleted'],
|
||||
showReviewer: false,
|
||||
temp: {
|
||||
groupId: 1,
|
||||
id: undefined,
|
||||
importance: 1,
|
||||
remark: '',
|
||||
@@ -133,6 +151,7 @@
|
||||
update: '编辑',
|
||||
create: '新建'
|
||||
},
|
||||
portGroupList: [],
|
||||
dialogPvVisible: false,
|
||||
pvData: [],
|
||||
rules: {
|
||||
@@ -161,7 +180,9 @@
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getList()
|
||||
// eslint-disable-next-line no-sequences
|
||||
this.getList(),
|
||||
this.getPortGroupList()
|
||||
},
|
||||
methods: {
|
||||
getList() {
|
||||
@@ -172,6 +193,11 @@
|
||||
this.listLoading = false
|
||||
})
|
||||
},
|
||||
getPortGroupList() {
|
||||
portGroupList().then(response => {
|
||||
this.portGroupList = response.data.data
|
||||
})
|
||||
},
|
||||
handleFilter() {
|
||||
this.listQuery.current = 1
|
||||
this.getList()
|
||||
@@ -204,13 +230,15 @@
|
||||
timestamp: new Date(),
|
||||
title: '',
|
||||
status: 'published',
|
||||
type: ''
|
||||
type: '',
|
||||
groupId: 1
|
||||
}
|
||||
},
|
||||
handleCreate() {
|
||||
this.resetTemp()
|
||||
this.dialogStatus = 'create'
|
||||
this.dialogFormVisible = true
|
||||
this.temp.groupId = 1
|
||||
this.$nextTick(() => {
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
@@ -242,6 +270,25 @@
|
||||
this.$refs['dataForm'].clearValidate()
|
||||
})
|
||||
},
|
||||
updateData() {
|
||||
this.$refs['dataForm'].validate((valid) => {
|
||||
if (valid) {
|
||||
const tempData = Object.assign({}, this.temp)
|
||||
updatePortPool(tempData).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
this.$notify({
|
||||
title: '成功',
|
||||
message: '更新成功',
|
||||
type: 'success',
|
||||
duration: 2000
|
||||
})
|
||||
this.dialogFormVisible = false
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
handleDelete(row) {
|
||||
deletePortPool(row.id).then(response => {
|
||||
if (response.data.code === 0) {
|
||||
|
||||
@@ -50,8 +50,8 @@
|
||||
</el-table>
|
||||
|
||||
<div class="pagination-container">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.currentPage"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
<el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-pageInfo.sync="listQuery.current"
|
||||
:pageInfo-sizes="[10,20,30, 50]" :pageInfo-size="listQuery.size" layout="total, sizes, prev, pager, next, jumper" :total="total">
|
||||
</el-pagination>
|
||||
</div>
|
||||
|
||||
@@ -128,8 +128,8 @@
|
||||
total: null,
|
||||
listLoading: true,
|
||||
listQuery: {
|
||||
currentPage: 1,
|
||||
pageSize: 10,
|
||||
current: 1,
|
||||
size: 10,
|
||||
importance: undefined,
|
||||
title: undefined,
|
||||
type: undefined
|
||||
|
||||
@@ -51,6 +51,16 @@
|
||||
<!-- </plugins>-->
|
||||
<!-- </build>-->
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.basedir}/src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
|
||||
<excludes>
|
||||
<exclude>app-*.yml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
|
||||
@@ -38,5 +38,6 @@ public class ProxyConfig {
|
||||
private Boolean sslEnable;
|
||||
private Integer obtainLicenseInterval;
|
||||
private String licenseKey;
|
||||
private Integer threadCount;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class ProxyClientService {
|
||||
public void init() {
|
||||
this.reconnectExecutor.scheduleWithFixedDelay(this::reconnect, 0, RECONNECT_INTERVAL_SECONDS, TimeUnit.SECONDS);
|
||||
|
||||
NioEventLoopGroup workerGroup = new NioEventLoopGroup();
|
||||
NioEventLoopGroup workerGroup = new NioEventLoopGroup(proxyConfig.getClient().getThreadCount());
|
||||
realServerBootstrap.group(workerGroup);
|
||||
realServerBootstrap.channel(NioSocketChannel.class);
|
||||
realServerBootstrap.handler(new ChannelInitializer<SocketChannel>() {
|
||||
|
||||
@@ -13,6 +13,7 @@ neutrino:
|
||||
write-idle-time: 8
|
||||
all-idle-time-seconds: 0
|
||||
client:
|
||||
thread-count: 50
|
||||
key-store-password: 123456
|
||||
jks-path: classpath:/test.jks
|
||||
server-ip: localhost
|
||||
|
||||
@@ -286,7 +286,7 @@ public class DateUtil {
|
||||
public static Date getHourBegin(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
setCalender(calendar, calendar.get(Calendar.HOUR), 0, 0, 0);
|
||||
setCalender(calendar, calendar.get(Calendar.HOUR_OF_DAY), 0, 0, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ public class DateUtil {
|
||||
public static Date getHourEnd(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
setCalender(calendar, calendar.get(Calendar.HOUR), 59, 59, 999);
|
||||
setCalender(calendar, calendar.get(Calendar.HOUR_OF_DAY), 59, 59, 999);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -83,10 +83,21 @@
|
||||
<!-- </build>-->
|
||||
|
||||
<build>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>${project.basedir}/src/main/resources</directory>
|
||||
<filtering>false</filtering>
|
||||
|
||||
<excludes>
|
||||
<exclude>app-*.yml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<finalName>${artifactId}</finalName>
|
||||
<archive>
|
||||
|
||||
@@ -45,7 +45,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DBInitialize implements EventListener<AppLoadEndEvent> {
|
||||
private static List<String> initDataTableNameList = Lists.newArrayList("user", "license", "port_pool", "port_mapping", "job_info");
|
||||
private static List<String> initDataTableNameList = Lists.newArrayList("user", "license", "port_group", "port_pool", "port_mapping", "job_info");
|
||||
@Inject
|
||||
private DbConfig dbConfig;
|
||||
|
||||
|
||||
@@ -42,6 +42,8 @@ public class ProxyConfig {
|
||||
private String keyStorePassword;
|
||||
private String keyManagerPassword;
|
||||
private String jksPath;
|
||||
private Integer bossThreadCount;
|
||||
private Integer workThreadCount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,13 +35,13 @@ public class ProxyConfiguration implements LifecycleBean {
|
||||
}
|
||||
|
||||
@Bean("serverBossGroup")
|
||||
public NioEventLoopGroup serverBossGroup() {
|
||||
return new NioEventLoopGroup();
|
||||
public NioEventLoopGroup serverBossGroup(@Inject ProxyConfig proxyConfig) {
|
||||
return new NioEventLoopGroup(proxyConfig.getServer().getBossThreadCount());
|
||||
}
|
||||
|
||||
@Bean("serverWorkerGroup")
|
||||
public NioEventLoopGroup serverWorkerGroup() {
|
||||
return new NioEventLoopGroup();
|
||||
public NioEventLoopGroup serverWorkerGroup(@Inject ProxyConfig proxyConfig) {
|
||||
return new NioEventLoopGroup(proxyConfig.getServer().getWorkThreadCount());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package fun.asgc.neutrino.proxy.server.constant;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/18
|
||||
*/
|
||||
public interface Constants {
|
||||
/**
|
||||
* 默认的端口分组ID
|
||||
*/
|
||||
int DEFAULT_PORT_GROUP_ID = 1;
|
||||
/**
|
||||
* 首页流量监控展示天数
|
||||
*/
|
||||
int HOME_FLOW_DAYS = 15;
|
||||
}
|
||||
@@ -57,6 +57,10 @@ public enum ExceptionConstant {
|
||||
// 调度管理(15000)
|
||||
JOB_INFO_NOT_EXIST(15000, "调度管理记录不存在"),
|
||||
SYSTEM_ERROR(500, "系统异常"),
|
||||
|
||||
PORT_GROUP_NAME_ALREADY_EXIST(16000,"端口分组名称[{}]已经存在"),
|
||||
PORT_GROUP_NAME_DOES_NOT_EXIST(16001,"端口分组不存在"),
|
||||
DEFAULT_GROUP_FORBID_DELETE(16002,"默认分组禁止删除")
|
||||
;
|
||||
|
||||
private int code;
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package fun.asgc.neutrino.proxy.server.constant;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 端口池分组枚举类型
|
||||
* @author Yohanes
|
||||
* @date 2023/03/17
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum PoolGroupEnum {
|
||||
GLOBAL(0, "全局"),
|
||||
USER(1, "用户"),
|
||||
LICENSE(2, "License");
|
||||
|
||||
private Integer status;
|
||||
private String desc;
|
||||
|
||||
}
|
||||
@@ -23,8 +23,8 @@ package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.ClientConnectRecordListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.ClientConnectRecordListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.log.ClientConnectRecordListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.log.ClientConnectRecordListRes;
|
||||
import fun.asgc.neutrino.proxy.server.service.ClientConnectRecordService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.Authorization;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LoginReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.LoginRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.LoginReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.LoginRes;
|
||||
import fun.asgc.neutrino.proxy.server.service.UserService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import org.noear.solon.annotation.*;
|
||||
|
||||
@@ -24,14 +24,14 @@ package fun.asgc.neutrino.proxy.server.controller;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.Authorization;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoExecuteReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoUpdateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoExecuteRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoUpdateEnableStatusRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoUpdateRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.JobInfoExecuteReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.JobInfoListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.JobInfoUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.JobInfoUpdateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.JobInfoExecuteRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.JobInfoListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.JobInfoUpdateEnableStatusRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.JobInfoUpdateRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobInfoDO;
|
||||
import fun.asgc.neutrino.proxy.server.service.JobInfoService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
|
||||
@@ -23,8 +23,8 @@ package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobLogListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobLogListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.log.JobLogListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.log.JobLogListRes;
|
||||
import fun.asgc.neutrino.proxy.server.service.JobLogService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -24,8 +24,8 @@ package fun.asgc.neutrino.proxy.server.controller;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.Authorization;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.proxy.*;
|
||||
import fun.asgc.neutrino.proxy.server.service.LicenseService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import org.noear.solon.annotation.*;
|
||||
@@ -56,6 +56,11 @@ public class LicenseController {
|
||||
return licenseService.list(req);
|
||||
}
|
||||
|
||||
@Mapping("/auth-list")
|
||||
public List<LicenseListRes> queryCurUserLicense(LicenseListReq req) {
|
||||
return licenseService.queryCurUserLicense(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/create")
|
||||
@Authorization(onlyAdmin = true)
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.Authorization;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.PortGroupCreateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.PortGroupDeleteReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.PortGroupListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.PortGroupUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.PortGroupCreateRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.PortGroupListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.PortGroupUpdateEnableStatusRes;
|
||||
import fun.asgc.neutrino.proxy.server.service.PortGroupService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import org.noear.solon.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 端口分组控制层
|
||||
*/
|
||||
@Mapping("/port-group")
|
||||
@Controller
|
||||
public class PortGroupController {
|
||||
|
||||
@Inject
|
||||
private PortGroupService portGroupService;
|
||||
|
||||
@Post
|
||||
@Mapping("/create")
|
||||
public PortGroupCreateRes create(PortGroupCreateReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotEmpty(req.getName(), "name");
|
||||
ParamCheckUtil.checkNotNull(req.getPossessorType(), "possessorType");
|
||||
ParamCheckUtil.checkNotNull(req.getPossessorId(), "possessorId");
|
||||
|
||||
return portGroupService.create(req);
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/page")
|
||||
public PageInfo<PortGroupListRes> page(PageQuery pageQuery, PortGroupListReq req) {
|
||||
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
|
||||
return portGroupService.page(pageQuery, req);
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/list")
|
||||
public List<PortGroupListRes> list(PortGroupListReq req) {
|
||||
return portGroupService.list(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/update/enable-status")
|
||||
public PortGroupUpdateEnableStatusRes updateEnableStatus(PortGroupUpdateEnableStatusReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotNull(req.getEnable(), "enable");
|
||||
|
||||
return portGroupService.updateEnableStatus(req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/delete")
|
||||
@Authorization(onlyAdmin = true)
|
||||
public void delete(PortGroupDeleteReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
|
||||
portGroupService.delete(req.getId());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -2,10 +2,11 @@ package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.proxy.*;
|
||||
import fun.asgc.neutrino.proxy.server.service.PortMappingService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.noear.solon.annotation.*;
|
||||
|
||||
/**
|
||||
@@ -33,8 +34,11 @@ public class PortMappingController {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getLicenseId(), "licenseId");
|
||||
ParamCheckUtil.checkNotNull(req.getServerPort(), "serverPort");
|
||||
ParamCheckUtil.checkNotEmpty(req.getClientIp(), "clientIp");
|
||||
ParamCheckUtil.checkNotNull(req.getClientPort(), "clientPort");
|
||||
if (StringUtils.isBlank(req.getClientIp())) {
|
||||
// 没传客户端ip,默认为127.0.0.1
|
||||
req.setClientIp("127.0.0.1");
|
||||
}
|
||||
|
||||
return portMappingService.create(req);
|
||||
}
|
||||
|
||||
@@ -24,13 +24,8 @@ package fun.asgc.neutrino.proxy.server.controller;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.Authorization;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortPoolCreateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortPoolDeleteReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortPoolListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortPoolUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.PortPoolCreateRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.PortPoolListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.PortPoolUpdateEnableStatusRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.*;
|
||||
import fun.asgc.neutrino.proxy.server.service.PortPoolService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import org.noear.solon.annotation.*;
|
||||
@@ -56,6 +51,15 @@ public class PortPoolController {
|
||||
return portPoolService.page(pageQuery, req);
|
||||
}
|
||||
|
||||
@Post
|
||||
@Mapping("/update")
|
||||
public PortPoolUpdateRes update(PortPoolUpdateReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getId(), "id");
|
||||
ParamCheckUtil.checkNotNull(req.getGroupId(), "groupId");
|
||||
return portPoolService.update(req);
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/list")
|
||||
public List<PortPoolListRes> list(PortPoolListReq req) {
|
||||
@@ -68,6 +72,7 @@ public class PortPoolController {
|
||||
public PortPoolCreateRes create(PortPoolCreateReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getPort(), "port");
|
||||
ParamCheckUtil.checkNotNull(req.getGroupId(), "groupId");
|
||||
|
||||
return portPoolService.create(req);
|
||||
}
|
||||
@@ -92,4 +97,28 @@ public class PortPoolController {
|
||||
|
||||
portPoolService.delete(req.getId());
|
||||
}
|
||||
|
||||
@Get
|
||||
@Mapping("/get-available-port-list")
|
||||
public List<PortPoolListRes> getAvailablePortList(AvailablePortListReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getLicenseId(), "licenseId");
|
||||
return portPoolService.getAvailablePortList(req);
|
||||
}
|
||||
|
||||
|
||||
@Get
|
||||
@Mapping("/get-by-group")
|
||||
public List<PortPoolListRes> portListByGroupId(String groupId) {
|
||||
return portPoolService.portListByGroupId(groupId);
|
||||
}
|
||||
|
||||
@Put
|
||||
@Mapping("/update-group")
|
||||
public PortPoolUpdateGroupRes updateGroup(PortPoolUpdateGroupReq req) {
|
||||
ParamCheckUtil.checkNotNull(req, "req");
|
||||
ParamCheckUtil.checkNotNull(req.getGroupId(), "groupId");
|
||||
ParamCheckUtil.checkNotEmpty(req.getPortIdList(), "portIdList");
|
||||
return portPoolService.updateGroup(req);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,11 +2,11 @@ package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LicenseFlowReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.UserFlowReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.LicenseFlowReportRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.ReportDataViewRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.UserFlowReportRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.report.LicenseFlowMonthReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.report.LicenseFlowReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.report.UserFlowMonthReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.report.UserFlowReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.report.*;
|
||||
import fun.asgc.neutrino.proxy.server.service.ReportService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import org.noear.solon.annotation.Controller;
|
||||
@@ -27,27 +27,13 @@ public class ReportController {
|
||||
private ReportService reportService;
|
||||
|
||||
/**
|
||||
* 数据一览:
|
||||
* 在线用户数 查询token有效的用户ID数
|
||||
* 在线Client数 查询license表,状态为在线的数量
|
||||
* 今日流量 上行/下行/总计
|
||||
* 历史流量 上行/下行/总计
|
||||
*
|
||||
* 1、点击在线用户数:下方展示在线的用户列表,带分页
|
||||
* 2、点击在线client数:下方展示在线的license列表,带分页
|
||||
* 3、点击今日流量:下方展示今日的流量折线图(小时)。 筛选项:全部/用户列表
|
||||
* 4、点击历史流量:下方展示历史流量折线图。筛选项:日/月 日期选择:日(展示最近30天,最多跨30日),月(展示最近12个月,最多跨12个月)
|
||||
* 首页数据一览
|
||||
* @return
|
||||
*/
|
||||
@Get
|
||||
@Mapping("/data-view")
|
||||
public ReportDataViewRes dataView() {
|
||||
return new ReportDataViewRes()
|
||||
.setUserOnlineNumber(2).setEnableUserNumber(3).setUserNumber(5)
|
||||
.setLicenseNumber(3).setEnableLicenseNumber(6).setLicenseNumber(6)
|
||||
.setServerPortOnlineNumber(3).setEnableServerPortNumber(5).setServerPortNumber(6)
|
||||
.setTotalUpstreamFlow("23K").setTotalDownwardFlow("47M")
|
||||
;
|
||||
@Mapping("/home/data-view")
|
||||
public HomeDataView homeDataView() {
|
||||
return reportService.homeDataView();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,4 +63,32 @@ public class ReportController {
|
||||
|
||||
return reportService.licenseFlowReportPage(pageQuery, req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户流量报表月度明细
|
||||
* @param pageQuery
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@Get
|
||||
@Mapping("/user/flow-month-report/page")
|
||||
public PageInfo<UserFlowMonthReportRes> userFlowMonthReportPage(PageQuery pageQuery, UserFlowMonthReportReq req) {
|
||||
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
|
||||
|
||||
return reportService.userFlowMonthReportPage(pageQuery, req);
|
||||
}
|
||||
|
||||
/**
|
||||
* license流量报表月度明细
|
||||
* @param pageQuery
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@Get
|
||||
@Mapping("/license/flow-month-report/page")
|
||||
public PageInfo<LicenseFlowMonthReportRes> licenseFlowMonthReportPage(PageQuery pageQuery, LicenseFlowMonthReportReq req) {
|
||||
ParamCheckUtil.checkNotNull(pageQuery, "pageQuery");
|
||||
|
||||
return reportService.licenseFlowMonthReportPage(pageQuery, req);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.Authorization;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.SystemContextHolder;
|
||||
import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.*;
|
||||
import fun.asgc.neutrino.proxy.server.dal.UserMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.UserDO;
|
||||
import fun.asgc.neutrino.proxy.server.service.UserService;
|
||||
|
||||
@@ -23,8 +23,8 @@ package fun.asgc.neutrino.proxy.server.controller;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.UserLoginRecordListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.UserLoginRecordListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.log.UserLoginRecordListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.log.UserLoginRecordListRes;
|
||||
import fun.asgc.neutrino.proxy.server.service.UserLoginRecordService;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import org.noear.solon.annotation.Controller;
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Data
|
||||
public class LicenseFlowReportReq {
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Data
|
||||
public class UserFlowReportReq {
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -29,5 +29,8 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class ClientConnectRecordListReq {
|
||||
|
||||
/**
|
||||
* licenseId
|
||||
*/
|
||||
private Integer licenseId;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -30,5 +30,8 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class UserLoginRecordListReq {
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -31,4 +31,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class LicenseListReq {
|
||||
|
||||
private Integer userId;
|
||||
private Integer isOnline;
|
||||
private Integer enable;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,8 +19,9 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.constant.OnlineStatusEnum;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
@@ -30,5 +31,27 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class PortMappingListReq {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* licenseId
|
||||
*/
|
||||
private Integer licenseId;
|
||||
/**
|
||||
* 服务端口号
|
||||
*/
|
||||
private Integer serverPort;
|
||||
|
||||
/**
|
||||
* 是否在线
|
||||
* {@link OnlineStatusEnum}
|
||||
*/
|
||||
private Integer isOnline;
|
||||
/**
|
||||
* 启用状态
|
||||
* {@link fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum}
|
||||
*/
|
||||
private Integer enable;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.report;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Data
|
||||
public class LicenseFlowMonthReportReq {
|
||||
private Integer userId;
|
||||
private Integer licenseId;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.report;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Data
|
||||
public class LicenseFlowReportReq {
|
||||
private Integer userId;
|
||||
private Integer licenseId;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.report;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Data
|
||||
public class UserFlowMonthReportReq {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.report;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Data
|
||||
public class UserFlowReportReq {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 获取可用端口请求
|
||||
*/
|
||||
@Data
|
||||
public class AvailablePortListReq {
|
||||
|
||||
/**
|
||||
* licenseId
|
||||
*/
|
||||
private Integer licenseId;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 端口分组创建请求
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class PortGroupCreateReq {
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String name ;
|
||||
|
||||
/**
|
||||
* 所有者类型 (0、全局共享 1、用户所有 2License所有)
|
||||
*/
|
||||
private Integer possessorType ;
|
||||
|
||||
/**
|
||||
* 所有者id(当type为0时 固定为-1、当type为1时为用户id 、当type为2时为licenseid)
|
||||
*/
|
||||
private Integer possessorId ;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 删除端口分组请求
|
||||
*/
|
||||
@Data
|
||||
public class PortGroupDeleteReq {
|
||||
private Integer id;
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 端口分组查询请求
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Data
|
||||
public class PortGroupListReq {
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String name ;
|
||||
|
||||
/**
|
||||
* 所有者类型 (0、全局共享 1、用户所有 2License所有)
|
||||
*/
|
||||
private Integer possessorType ;
|
||||
|
||||
/**
|
||||
* 所有者id(当type为0时 固定为-1、当type为1时为用户id 、当type为2时为licenseid)
|
||||
*/
|
||||
private Integer possessorId ;
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 修改端口分组请求
|
||||
*/
|
||||
@Data
|
||||
public class PortGroupUpdateEnableStatusReq {
|
||||
|
||||
private Integer id;
|
||||
private Integer enable;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -31,4 +31,6 @@ import lombok.Data;
|
||||
@Data
|
||||
public class PortPoolCreateReq {
|
||||
private Integer port;
|
||||
|
||||
private Integer groupId;
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -30,5 +30,8 @@ import lombok.Data;
|
||||
*/
|
||||
@Data
|
||||
public class PortPoolListReq {
|
||||
|
||||
/**
|
||||
* 分组ID
|
||||
*/
|
||||
private Integer groupId;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 批量修改端口分组请求
|
||||
*/
|
||||
@Data
|
||||
public class PortPoolUpdateGroupReq {
|
||||
|
||||
private String groupId;
|
||||
|
||||
private List<Integer> portIdList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/25
|
||||
*/
|
||||
@Data
|
||||
public class PortPoolUpdateReq {
|
||||
private Integer id;
|
||||
|
||||
private Integer groupId;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
/**
|
||||
* 用户列表请求
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.req;
|
||||
package fun.asgc.neutrino.proxy.server.controller.req.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,78 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Data
|
||||
public class LicenseFlowReportRes {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* licenseId
|
||||
*/
|
||||
private Integer licenseId;
|
||||
/**
|
||||
* license名称
|
||||
*/
|
||||
private String licenseName;
|
||||
/**
|
||||
* 写入字节数
|
||||
*/
|
||||
private Long writeBytes;
|
||||
/**
|
||||
* 读取字节数
|
||||
*/
|
||||
private Long readBytes;
|
||||
/**
|
||||
* 写入流量描述
|
||||
*/
|
||||
private String writeFlowStr;
|
||||
/**
|
||||
* 读取流量描述
|
||||
*/
|
||||
private String readFlowStr;
|
||||
/**
|
||||
* 流量描述
|
||||
*/
|
||||
private String flowStr;
|
||||
/**
|
||||
* 报表时间
|
||||
*/
|
||||
private Date date;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -1,57 +0,0 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/9/12
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class ReportDataViewRes {
|
||||
/**
|
||||
* 在线用户数
|
||||
*/
|
||||
private Integer userOnlineNumber;
|
||||
/**
|
||||
* 启用用户数
|
||||
*/
|
||||
private Integer enableUserNumber;
|
||||
/**
|
||||
* 用户总数
|
||||
*/
|
||||
private Integer userNumber;
|
||||
/**
|
||||
* 在线license数
|
||||
*/
|
||||
private Integer licenseOnlineNumber;
|
||||
/**
|
||||
* 启用license数
|
||||
*/
|
||||
private Integer enableLicenseNumber;
|
||||
/**
|
||||
* license总数
|
||||
*/
|
||||
private Integer licenseNumber;
|
||||
/**
|
||||
* 服务端口在线数
|
||||
*/
|
||||
private Integer serverPortOnlineNumber;
|
||||
/**
|
||||
* 启用服务端口数
|
||||
*/
|
||||
private Integer enableServerPortNumber;
|
||||
/**
|
||||
* 总的服务端口数
|
||||
*/
|
||||
private Integer serverPortNumber;
|
||||
/**
|
||||
* 累计上行流量
|
||||
*/
|
||||
private String totalUpstreamFlow;
|
||||
/**
|
||||
* 累计下行流量
|
||||
*/
|
||||
private String totalDownwardFlow;
|
||||
}
|
||||
@@ -1,78 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Data
|
||||
public class UserFlowReportRes {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 历史写入字节数
|
||||
*/
|
||||
private Long historyWriteBytes;
|
||||
/**
|
||||
* 历史读取字节数
|
||||
*/
|
||||
private Long historyReadBytes;
|
||||
/**
|
||||
* 写入字节数
|
||||
*/
|
||||
private Long writeBytes;
|
||||
/**
|
||||
* 读取字节数
|
||||
*/
|
||||
private Long readBytes;
|
||||
/**
|
||||
* 写入流量描述
|
||||
*/
|
||||
private String writeFlowStr;
|
||||
/**
|
||||
* 读取流量描述
|
||||
*/
|
||||
private String readFlowStr;
|
||||
/**
|
||||
* 流量描述
|
||||
*/
|
||||
private String flowStr;
|
||||
/**
|
||||
* 报表时间
|
||||
*/
|
||||
private Date date;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.log;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.proxy;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.constant.OnlineStatusEnum;
|
||||
import lombok.Data;
|
||||
@@ -1,4 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.proxy;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.constant.OnlineStatusEnum;
|
||||
import lombok.Data;
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.proxy;
|
||||
|
||||
/**
|
||||
* 更新启用状态响应
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.proxy;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.proxy;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.constant.OnlineStatusEnum;
|
||||
import lombok.Data;
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.proxy;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.constant.OnlineStatusEnum;
|
||||
import lombok.Data;
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.proxy;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,208 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.report;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/26
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class HomeDataView {
|
||||
|
||||
/**
|
||||
* licenses数据
|
||||
*/
|
||||
private License license;
|
||||
|
||||
/**
|
||||
* 端口映射
|
||||
*/
|
||||
private PortMapping portMapping;
|
||||
|
||||
/**
|
||||
* 今日流量
|
||||
*/
|
||||
private TodayFlow todayFlow;
|
||||
|
||||
/**
|
||||
* 总流量
|
||||
*/
|
||||
private TotalFlow totalFlow;
|
||||
|
||||
/**
|
||||
* 最近7日流量
|
||||
*/
|
||||
private Last7dFlow last7dFlow;
|
||||
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public static class License {
|
||||
/**
|
||||
* 总数
|
||||
*/
|
||||
private Integer totalCount;
|
||||
/**
|
||||
* 在线数
|
||||
*/
|
||||
private Integer onlineCount;
|
||||
/**
|
||||
* 离线数
|
||||
*/
|
||||
private Integer offlineCount;
|
||||
}
|
||||
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public static class PortMapping {
|
||||
/**
|
||||
* 总数
|
||||
*/
|
||||
private Integer totalCount;
|
||||
/**
|
||||
* 在线数
|
||||
*/
|
||||
private Integer onlineCount;
|
||||
/**
|
||||
* 离线数
|
||||
*/
|
||||
private Integer offlineCount;
|
||||
}
|
||||
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public static class TodayFlow {
|
||||
/**
|
||||
* 上行流量字节数
|
||||
*/
|
||||
private Long upFlowBytes;
|
||||
/**
|
||||
* 下行流量字节数
|
||||
*/
|
||||
private Long downFlowBytes;
|
||||
/**
|
||||
* 总流量字节数
|
||||
*/
|
||||
private Long totalFlowBytes;
|
||||
/**
|
||||
* 上行流量描述
|
||||
*/
|
||||
private String upFlowDesc;
|
||||
/**
|
||||
* 下行流量描述
|
||||
*/
|
||||
private String downFlowDesc;
|
||||
/**
|
||||
* 总流量描述
|
||||
*/
|
||||
private String totalFlowDesc;
|
||||
}
|
||||
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public static class TotalFlow {
|
||||
/**
|
||||
* 上行流量字节数
|
||||
*/
|
||||
private Long upFlowBytes;
|
||||
/**
|
||||
* 下行流量字节数
|
||||
*/
|
||||
private Long downFlowBytes;
|
||||
/**
|
||||
* 总流量字节数
|
||||
*/
|
||||
private Long totalFlowBytes;
|
||||
/**
|
||||
* 上行流量描述
|
||||
*/
|
||||
private String upFlowDesc;
|
||||
/**
|
||||
* 下行流量描述
|
||||
*/
|
||||
private String downFlowDesc;
|
||||
/**
|
||||
* 总流量描述
|
||||
*/
|
||||
private String totalFlowDesc;
|
||||
}
|
||||
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public static class Last7dFlow {
|
||||
/**
|
||||
* 最近7日流量数据
|
||||
*/
|
||||
private List<SingleDayFlow> dataList;
|
||||
/**
|
||||
* x轴日期
|
||||
*/
|
||||
private List<String> xDate;
|
||||
/**
|
||||
* 图例(上行流量、下行流量、总流量)
|
||||
*/
|
||||
private List<String> legendData;
|
||||
/**
|
||||
* 折线列表
|
||||
*/
|
||||
private List<Series> seriesList;
|
||||
}
|
||||
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public static class SingleDayFlow {
|
||||
/**
|
||||
* 日期字符串
|
||||
*/
|
||||
private String dateStr;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private Date date;
|
||||
/**
|
||||
* 上行流量字节数
|
||||
*/
|
||||
private Long upFlowBytes;
|
||||
/**
|
||||
* 下行流量字节数
|
||||
*/
|
||||
private Long downFlowBytes;
|
||||
/**
|
||||
* 总流量字节数
|
||||
*/
|
||||
private Long totalFlowBytes;
|
||||
/**
|
||||
* 上行流量描述
|
||||
*/
|
||||
private String upFlowDesc;
|
||||
/**
|
||||
* 下行流量描述
|
||||
*/
|
||||
private String downFlowDesc;
|
||||
/**
|
||||
* 总流量描述
|
||||
*/
|
||||
private String totalFlowDesc;
|
||||
}
|
||||
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public static class Series {
|
||||
/**
|
||||
* 此处目前固定为:line
|
||||
*/
|
||||
private String seriesType;
|
||||
/**
|
||||
* 名称:上行流量、下行流量、总流量
|
||||
*/
|
||||
private String seriesName;
|
||||
/**
|
||||
* y值序列
|
||||
*/
|
||||
private List<Long> seriesData;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.report;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class LicenseFlowMonthReportRes {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* licenseId
|
||||
*/
|
||||
private Integer licenseId;
|
||||
/**
|
||||
* license名称
|
||||
*/
|
||||
private String licenseName;
|
||||
/**
|
||||
* 上行流量字节数
|
||||
*/
|
||||
private Long upFlowBytes;
|
||||
/**
|
||||
* 下行流量字节数
|
||||
*/
|
||||
private Long downFlowBytes;
|
||||
/**
|
||||
* 总流量字节数
|
||||
*/
|
||||
private Long totalFlowBytes;
|
||||
/**
|
||||
* 上行流量描述
|
||||
*/
|
||||
private String upFlowDesc;
|
||||
/**
|
||||
* 下行流量描述
|
||||
*/
|
||||
private String downFlowDesc;
|
||||
/**
|
||||
* 总流量描述
|
||||
*/
|
||||
private String totalFlowDesc;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private Date date;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.report;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class LicenseFlowReportRes {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* licenseId
|
||||
*/
|
||||
private Integer licenseId;
|
||||
/**
|
||||
* license名称
|
||||
*/
|
||||
private String licenseName;
|
||||
/**
|
||||
* 上行流量字节数
|
||||
*/
|
||||
private Long upFlowBytes;
|
||||
/**
|
||||
* 下行流量字节数
|
||||
*/
|
||||
private Long downFlowBytes;
|
||||
/**
|
||||
* 总流量字节数
|
||||
*/
|
||||
private Long totalFlowBytes;
|
||||
/**
|
||||
* 上行流量描述
|
||||
*/
|
||||
private String upFlowDesc;
|
||||
/**
|
||||
* 下行流量描述
|
||||
*/
|
||||
private String downFlowDesc;
|
||||
/**
|
||||
* 总流量描述
|
||||
*/
|
||||
private String totalFlowDesc;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.report;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class UserFlowMonthReportRes {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 上行流量字节数
|
||||
*/
|
||||
private Long upFlowBytes;
|
||||
/**
|
||||
* 下行流量字节数
|
||||
*/
|
||||
private Long downFlowBytes;
|
||||
/**
|
||||
* 总流量字节数
|
||||
*/
|
||||
private Long totalFlowBytes;
|
||||
/**
|
||||
* 上行流量描述
|
||||
*/
|
||||
private String upFlowDesc;
|
||||
/**
|
||||
* 下行流量描述
|
||||
*/
|
||||
private String downFlowDesc;
|
||||
/**
|
||||
* 总流量描述
|
||||
*/
|
||||
private String totalFlowDesc;
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private Date date;
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.report;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2022/12/21
|
||||
*/
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
public class UserFlowReportRes {
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Integer userId;
|
||||
/**
|
||||
* 用户名称
|
||||
*/
|
||||
private String userName;
|
||||
/**
|
||||
* 上行流量字节数
|
||||
*/
|
||||
private Long upFlowBytes;
|
||||
/**
|
||||
* 下行流量字节数
|
||||
*/
|
||||
private Long downFlowBytes;
|
||||
/**
|
||||
* 总流量字节数
|
||||
*/
|
||||
private Long totalFlowBytes;
|
||||
/**
|
||||
* 上行流量描述
|
||||
*/
|
||||
private String upFlowDesc;
|
||||
/**
|
||||
* 下行流量描述
|
||||
*/
|
||||
private String downFlowDesc;
|
||||
/**
|
||||
* 总流量描述
|
||||
*/
|
||||
private String totalFlowDesc;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AvailablePortListRes {
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -0,0 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
public class PortGroupCreateRes {
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class PortGroupListRes {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 所有者类型 (0、全局共享 1、用户所有 2License所有)
|
||||
*/
|
||||
private Integer possessorType;
|
||||
|
||||
/**
|
||||
* 所有者id(当type为0时 固定为-1、当type为1时为用户id 、当type为2时为licenseid)
|
||||
*/
|
||||
private Integer possessorId;
|
||||
|
||||
/**
|
||||
* 是否启用(1、启用 2、禁用)
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 来源
|
||||
*/
|
||||
private String possessor;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PortGroupUpdateEnableStatusRes {
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -49,4 +49,18 @@ public class PortPoolListRes {
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 分组类型
|
||||
*/
|
||||
private Integer possessorType;
|
||||
|
||||
/**
|
||||
* 分组
|
||||
*/
|
||||
private String groupName;
|
||||
/**
|
||||
* 分组ID
|
||||
*/
|
||||
private Integer groupId;
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
public class PortPoolUpdateGroupRes {
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/25
|
||||
*/
|
||||
@Data
|
||||
public class PortPoolUpdateRes {
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -1,4 +1,4 @@
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -19,7 +19,7 @@
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.controller.res;
|
||||
package fun.asgc.neutrino.proxy.server.controller.res.system;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -33,7 +33,7 @@ import java.util.List;
|
||||
public interface FlowReportDayMapper extends BaseMapper<FlowReportDayDO> {
|
||||
default void clean(Date date) {
|
||||
this.delete(new LambdaQueryWrapper<FlowReportDayDO>()
|
||||
.lt(FlowReportDayDO::getCreateTime, date)
|
||||
.lt(FlowReportDayDO::getDate, date)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -45,8 +45,8 @@ public interface FlowReportDayMapper extends BaseMapper<FlowReportDayDO> {
|
||||
|
||||
default List<FlowReportDayDO> findListByDateRange(Date startDate, Date endDate) {
|
||||
return this.selectList(new LambdaQueryWrapper<FlowReportDayDO>()
|
||||
.le(FlowReportDayDO::getDate, startDate)
|
||||
.gt(FlowReportDayDO::getDate, endDate)
|
||||
.ge(FlowReportDayDO::getDate, startDate)
|
||||
.le(FlowReportDayDO::getDate, endDate)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.List;
|
||||
public interface FlowReportHourMapper extends BaseMapper<FlowReportHourDO> {
|
||||
default void clean(Date date) {
|
||||
this.delete(new LambdaQueryWrapper<FlowReportHourDO>()
|
||||
.lt(FlowReportHourDO::getCreateTime, date)
|
||||
.lt(FlowReportHourDO::getDate, date)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.Set;
|
||||
public interface FlowReportMinuteMapper extends BaseMapper<FlowReportMinuteDO> {
|
||||
default void clean(Date date) {
|
||||
this.delete(new LambdaQueryWrapper<FlowReportMinuteDO>()
|
||||
.lt(FlowReportMinuteDO::getCreateTime, date)
|
||||
.lt(FlowReportMinuteDO::getDate, date)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* <p>
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* <p>
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* <p>
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
@@ -39,83 +39,88 @@ import java.util.Set;
|
||||
@Mapper
|
||||
public interface LicenseMapper extends BaseMapper<LicenseDO> {
|
||||
|
||||
default List<LicenseDO> listAll() {
|
||||
return this.selectList(new LambdaQueryWrapper<>());
|
||||
}
|
||||
default List<LicenseDO> listAll() {
|
||||
return this.selectList(new LambdaQueryWrapper<>());
|
||||
}
|
||||
|
||||
default List<LicenseDO> listByUserId(Integer userId) {
|
||||
return this.selectList(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getUserId, userId)
|
||||
);
|
||||
}
|
||||
default List<LicenseDO> listByUserId(Integer userId) {
|
||||
return this.selectList(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getUserId, userId)
|
||||
);
|
||||
}
|
||||
|
||||
default void updateEnableStatus(Integer id, Integer enable, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, id)
|
||||
.set(LicenseDO::getEnable, enable)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
default LicenseDO queryById(Integer licenseId) {
|
||||
return this.selectOne(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, licenseId));
|
||||
}
|
||||
|
||||
default void updateOnlineStatus(Integer id, Integer isOnline, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, id)
|
||||
.set(LicenseDO::getIsOnline, isOnline)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
default void updateEnableStatus(Integer id, Integer enable, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, id)
|
||||
.set(LicenseDO::getEnable, enable)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
|
||||
default void updateOnlineStatus(Integer isOnline, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.set(LicenseDO::getIsOnline, updateTime)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
default void updateOnlineStatus(Integer id, Integer isOnline, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, id)
|
||||
.set(LicenseDO::getIsOnline, isOnline)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
|
||||
default void reset(Integer id, String key, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, id)
|
||||
.set(LicenseDO::getKey, key)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
default void updateOnlineStatus(Integer isOnline, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.set(LicenseDO::getIsOnline, updateTime)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
|
||||
default LicenseDO findById(Integer id) {
|
||||
return this.selectById(id);
|
||||
}
|
||||
default void reset(Integer id, String key, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, id)
|
||||
.set(LicenseDO::getKey, key)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
|
||||
default void update(Integer id, String name, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, id)
|
||||
.set(LicenseDO::getName, name)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
default LicenseDO findById(Integer id) {
|
||||
return this.selectById(id);
|
||||
}
|
||||
|
||||
default List<LicenseDO> findByIds(Set<Integer> ids) {
|
||||
return selectBatchIds(ids);
|
||||
}
|
||||
default void update(Integer id, String name, Date updateTime) {
|
||||
this.update(null, new LambdaUpdateWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getId, id)
|
||||
.set(LicenseDO::getName, name)
|
||||
.set(LicenseDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
|
||||
default LicenseDO checkRepeat(Integer userId, String name) {
|
||||
return this.selectOne(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getUserId, userId)
|
||||
.eq(LicenseDO::getName, name)
|
||||
.last("limit 1")
|
||||
);
|
||||
}
|
||||
default List<LicenseDO> findByIds(Set<Integer> ids) {
|
||||
return selectBatchIds(ids);
|
||||
}
|
||||
|
||||
default LicenseDO checkRepeat(Integer userId, String name, Set<Integer> excludeIds) {
|
||||
return this.selectOne(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getUserId, userId)
|
||||
.eq(LicenseDO::getName, name)
|
||||
.notIn(LicenseDO::getId, excludeIds)
|
||||
.last("limit 1")
|
||||
);
|
||||
}
|
||||
default LicenseDO checkRepeat(Integer userId, String name) {
|
||||
return this.selectOne(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getUserId, userId)
|
||||
.eq(LicenseDO::getName, name)
|
||||
.last("limit 1")
|
||||
);
|
||||
}
|
||||
|
||||
default LicenseDO findByKey(String licenseKey) {
|
||||
return selectOne(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getKey, licenseKey)
|
||||
);
|
||||
}
|
||||
default LicenseDO checkRepeat(Integer userId, String name, Set<Integer> excludeIds) {
|
||||
return this.selectOne(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getUserId, userId)
|
||||
.eq(LicenseDO::getName, name)
|
||||
.notIn(LicenseDO::getId, excludeIds)
|
||||
.last("limit 1")
|
||||
);
|
||||
}
|
||||
|
||||
default LicenseDO findByKey(String licenseKey) {
|
||||
return selectOne(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getKey, licenseKey)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package fun.asgc.neutrino.proxy.server.dal;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.PortGroupListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.PortGroupListRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.PortGroupDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Mapper
|
||||
public interface PortGroupMapper extends BaseMapper<PortGroupDO> {
|
||||
|
||||
List<PortGroupListRes> selectPortGroupListResList(PortGroupListReq res);
|
||||
|
||||
|
||||
default void updateEnableStatus(Integer id, Integer enable, Date now){
|
||||
this.update(null, Wrappers.lambdaUpdate(PortGroupDO.class)
|
||||
.eq(PortGroupDO::getId,id)
|
||||
.set(PortGroupDO::getEnable,enable)
|
||||
.set(PortGroupDO::getUpdateTime,now)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.PortMappingListReq;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.PortMappingDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -82,4 +84,6 @@ public interface PortMappingMapper extends BaseMapper<PortMappingDO> {
|
||||
.set(PortMappingDO::getUpdateTime, updateTime)
|
||||
);
|
||||
}
|
||||
|
||||
List<PortMappingDO> selectPortMappingByCondition(@Param("req") PortMappingListReq req);
|
||||
}
|
||||
|
||||
@@ -24,10 +24,14 @@ package fun.asgc.neutrino.proxy.server.dal;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.PortPoolListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.PortPoolListRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.PortPoolDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -53,4 +57,15 @@ public interface PortPoolMapper extends BaseMapper<PortPoolDO> {
|
||||
default PortPoolDO findById(Integer id) {
|
||||
return this.selectById(id);
|
||||
}
|
||||
|
||||
default List<PortPoolDO> getByGroupId(String groupId){
|
||||
return this.selectList(
|
||||
new LambdaQueryWrapper<PortPoolDO>()
|
||||
.eq(PortPoolDO::getGroupId, groupId)
|
||||
);
|
||||
}
|
||||
|
||||
List<PortPoolListRes> selectResList(@Param("req") PortPoolListReq req);
|
||||
|
||||
List<PortPoolListRes> getAvailablePortList(@Param("licenseId") Integer licenseId,@Param("userId") Integer userId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
package fun.asgc.neutrino.proxy.server.dal;
|
||||
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.report.*;
|
||||
import fun.asgc.neutrino.proxy.server.service.bo.FlowBO;
|
||||
import fun.asgc.neutrino.proxy.server.service.bo.SingleDayFlowBO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/19
|
||||
*/
|
||||
@Mapper
|
||||
public interface ReportMapper {
|
||||
/**
|
||||
* 基于用户维度的流量报表
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<UserFlowReportRes> userFlowReportList(@Param("userId") Integer userId, @Param("curMonthBeginDate") Date curMonthBeginDate, @Param("curDayBeginDate") Date curDayBeginDate, @Param("curDate") Date curDate);
|
||||
/**
|
||||
* 基于License维度的流量报表
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<LicenseFlowReportRes> licenseFLowReportList(@Param("userId") Integer userId, @Param("curMonthBeginDate") Date curMonthBeginDate, @Param("curDayBeginDate") Date curDayBeginDate, @Param("curDate") Date curDate);
|
||||
|
||||
/**
|
||||
* 用户流量月度明细
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<UserFlowMonthReportRes> userFlowMonthReportList(@Param("userId") Integer userId, @Param("curMonthBeginDate") Date curMonthBeginDate, @Param("curDayBeginDate") Date curDayBeginDate, @Param("curDate") Date curDate);
|
||||
/**
|
||||
* License流量月度明细
|
||||
* @param userId
|
||||
* @return
|
||||
*/
|
||||
List<LicenseFlowMonthReportRes> licenseFLowMonthReportList(@Param("userId") Integer userId, @Param("licenseId") Integer licenseId, @Param("curMonthBeginDate") Date curMonthBeginDate, @Param("curDayBeginDate") Date curDayBeginDate, @Param("curDate") Date curDate);
|
||||
|
||||
/**
|
||||
* 首页 - 今日流量
|
||||
* @param curDayBeginDate
|
||||
* @param curDate
|
||||
* @return
|
||||
*/
|
||||
FlowBO homeTodayFlow(@Param("curDayBeginDate") Date curDayBeginDate, @Param("curDate") Date curDate);
|
||||
|
||||
/**
|
||||
* 首页 - 总流量
|
||||
* @param curMonthBeginDate
|
||||
* @param curDayBeginDate
|
||||
* @param curDate
|
||||
* @return
|
||||
*/
|
||||
FlowBO homeTotalFlow(@Param("curMonthBeginDate") Date curMonthBeginDate, @Param("curDayBeginDate") Date curDayBeginDate, @Param("curDate") Date curDate);
|
||||
|
||||
/**
|
||||
* 首页最近7日流量
|
||||
* @param beginDate
|
||||
* @param curDayBeginDate
|
||||
* @param curDate
|
||||
* @return
|
||||
*/
|
||||
List<SingleDayFlowBO> homeLast7dFlowList(@Param("beginDate") Date beginDate, @Param("curDayBeginDate") Date curDayBeginDate, @Param("curDate") Date curDate);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package fun.asgc.neutrino.proxy.server.dal.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 端口组
|
||||
*/
|
||||
@ToString
|
||||
@Accessors(chain = true)
|
||||
@Data
|
||||
@TableName("port_group")
|
||||
public class PortGroupDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 分组名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 所有者类型 (0、全局共享 1、用户所有 2License所有)
|
||||
*/
|
||||
private Integer possessorType;
|
||||
|
||||
/**
|
||||
* 所有者id(当type为0时 固定为-1、当type为1时为用户id 、当type为2时为licenseid)
|
||||
*/
|
||||
private Integer possessorId;
|
||||
|
||||
/**
|
||||
* 是否启用(1、启用 2、禁用)
|
||||
*/
|
||||
private Integer enable;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
}
|
||||
@@ -42,6 +42,12 @@ import java.util.Date;
|
||||
public class PortPoolDO {
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 分组id
|
||||
*/
|
||||
private Integer groupId;
|
||||
|
||||
/**
|
||||
* 端口
|
||||
*/
|
||||
|
||||
@@ -33,6 +33,7 @@ import fun.asgc.neutrino.proxy.server.service.FlowReportService;
|
||||
import fun.asgc.solon.extend.job.IJobHandler;
|
||||
import fun.asgc.solon.extend.job.annotation.JobHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
@@ -60,7 +61,7 @@ public class FlowReportForDayJob implements IJobHandler {
|
||||
@Override
|
||||
public void execute(String param) throws Exception {
|
||||
Date now = new Date();
|
||||
String dateStr = DateUtil.format(DateUtil.addDate(now, Calendar.DATE, -1), "yyyy-MM-dd");
|
||||
String dateStr = getDateStr(now, param); // DateUtil.format(DateUtil.addDate(now, Calendar.DATE, -1), "yyyy-MM-dd");
|
||||
Date date = DateUtil.parse(dateStr, "yyyy-MM-dd");
|
||||
Date startHourDate = DateUtil.getDayBegin(date);
|
||||
Date endHourDate = DateUtil.getDayEnd(date);
|
||||
@@ -99,4 +100,16 @@ public class FlowReportForDayJob implements IJobHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private String getDateStr(Date now, String params) {
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
try {
|
||||
// 参数格式错误则取当前时间
|
||||
DateUtil.parse(params, "yyyy-MM-dd");
|
||||
return params;
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return DateUtil.format(DateUtil.addDate(now, Calendar.DATE, -1), "yyyy-MM-dd");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import fun.asgc.neutrino.proxy.server.service.FlowReportService;
|
||||
import fun.asgc.solon.extend.job.IJobHandler;
|
||||
import fun.asgc.solon.extend.job.annotation.JobHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
@@ -36,7 +37,7 @@ public class FlowReportForHourJob implements IJobHandler {
|
||||
@Override
|
||||
public void execute(String param) throws Exception {
|
||||
Date now = new Date();
|
||||
String dateStr = DateUtil.format(DateUtil.addDate(now, Calendar.HOUR, -1), "yyyy-MM-dd HH");
|
||||
String dateStr = getDateStr(now, param); // DateUtil.format(DateUtil.addDate(now, Calendar.HOUR, -1), "yyyy-MM-dd HH");
|
||||
Date date = DateUtil.parse(dateStr, "yyyy-MM-dd HH");
|
||||
Date startHourDate = DateUtil.getHourBegin(date);
|
||||
Date endHourDate = DateUtil.getHourEnd(date);
|
||||
@@ -75,4 +76,17 @@ public class FlowReportForHourJob implements IJobHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private String getDateStr(Date now, String params) {
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
try {
|
||||
// 参数格式错误则取当前时间
|
||||
DateUtil.parse(params, "yyyy-MM-dd HH");
|
||||
return params;
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return DateUtil.format(DateUtil.addDate(now, Calendar.HOUR, -1), "yyyy-MM-dd HH");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import fun.asgc.neutrino.proxy.server.service.FlowReportService;
|
||||
import fun.asgc.solon.extend.job.IJobHandler;
|
||||
import fun.asgc.solon.extend.job.annotation.JobHandler;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
@@ -38,7 +39,7 @@ public class FlowReportForMonthJob implements IJobHandler {
|
||||
@Override
|
||||
public void execute(String param) throws Exception {
|
||||
Date now = new Date();
|
||||
String dateStr = DateUtil.format(DateUtil.addDate(now, Calendar.MONTH, -1), "yyyy-MM");
|
||||
String dateStr = getDateStr(now, param); // DateUtil.format(DateUtil.addDate(now, Calendar.MONTH, -1), "yyyy-MM");
|
||||
Date date = DateUtil.parse(dateStr, "yyyy-MM");
|
||||
Date startDayDate = DateUtil.getMonthBegin(date);
|
||||
Date endEndDate = DateUtil.getMonthEnd(date);
|
||||
@@ -77,4 +78,16 @@ public class FlowReportForMonthJob implements IJobHandler {
|
||||
}
|
||||
}
|
||||
|
||||
private String getDateStr(Date now, String params) {
|
||||
if (StringUtils.isNotBlank(params)) {
|
||||
try {
|
||||
// 参数格式错误则取当前时间
|
||||
DateUtil.parse(params, "yyyy-MM");
|
||||
return params;
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
return DateUtil.format(DateUtil.addDate(now, Calendar.MONTH, -1), "yyyy-MM");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ import com.github.pagehelper.PageHelper;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.SystemContextHolder;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.ClientConnectRecordListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.ClientConnectRecordListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.log.ClientConnectRecordListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.log.ClientConnectRecordListRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.ClientConnectRecordMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.LicenseMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.UserMapper;
|
||||
@@ -51,6 +51,7 @@ public class ClientConnectRecordService {
|
||||
public PageInfo<ClientConnectRecordListRes> page(PageQuery pageQuery, ClientConnectRecordListReq req) {
|
||||
Page<ClientConnectRecordListRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
List<ClientConnectRecordDO> list = clientConnectRecordMapper.selectList(new LambdaQueryWrapper<ClientConnectRecordDO>()
|
||||
.eq(null != req.getLicenseId(), ClientConnectRecordDO::getLicenseId, req.getLicenseId())
|
||||
.orderByDesc(ClientConnectRecordDO::getId)
|
||||
);
|
||||
List<ClientConnectRecordListRes> respList = mapperFacade.mapAsList(list, ClientConnectRecordListRes.class);
|
||||
|
||||
@@ -9,14 +9,14 @@ import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoExecuteReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobInfoUpdateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoExecuteRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoUpdateEnableStatusRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobInfoUpdateRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.JobInfoExecuteReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.JobInfoListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.JobInfoUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.JobInfoUpdateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.JobInfoExecuteRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.JobInfoListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.JobInfoUpdateEnableStatusRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.JobInfoUpdateRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.JobInfoMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobInfoDO;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
|
||||
@@ -26,8 +26,8 @@ import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.JobLogListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.JobLogListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.log.JobLogListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.log.JobLogListRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.JobLogMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.JobLogDO;
|
||||
import fun.asgc.solon.extend.job.IJobCallback;
|
||||
|
||||
@@ -12,11 +12,11 @@ import fun.asgc.neutrino.proxy.server.base.rest.SystemContextHolder;
|
||||
import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.constant.OnlineStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LicenseCreateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LicenseListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LicenseUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LicenseUpdateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.LicenseCreateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.LicenseListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.LicenseUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.LicenseUpdateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.proxy.*;
|
||||
import fun.asgc.neutrino.proxy.server.dal.LicenseMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.UserMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.LicenseDO;
|
||||
@@ -24,6 +24,7 @@ import fun.asgc.neutrino.proxy.server.dal.entity.UserDO;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import ma.glasnost.orika.MapperFacade;
|
||||
import org.apache.ibatis.solon.annotation.Db;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.Lifecycle;
|
||||
@@ -51,7 +52,10 @@ public class LicenseService implements Lifecycle {
|
||||
public PageInfo<LicenseListRes> page(PageQuery pageQuery, LicenseListReq req) {
|
||||
Page<LicenseListRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
List<LicenseDO> list = licenseMapper.selectList(new LambdaQueryWrapper<LicenseDO>()
|
||||
.orderByAsc(LicenseDO::getId)
|
||||
.eq(req.getUserId() != null, LicenseDO::getUserId, req.getUserId())
|
||||
.eq(req.getIsOnline() != null, LicenseDO::getIsOnline, req.getIsOnline())
|
||||
.eq(req.getEnable() != null, LicenseDO::getEnable, req.getEnable())
|
||||
.orderByAsc(Arrays.asList(LicenseDO::getUserId, LicenseDO::getId))
|
||||
);
|
||||
List<LicenseListRes> respList = mapperFacade.mapAsList(list, LicenseListRes.class);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
@@ -74,8 +78,14 @@ public class LicenseService implements Lifecycle {
|
||||
|
||||
public List<LicenseListRes> list(LicenseListReq req) {
|
||||
List<LicenseDO> list = licenseMapper.selectList(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getEnable, EnableStatusEnum.ENABLE.getStatus())
|
||||
.eq(null != req.getEnable(), LicenseDO::getEnable, req.getEnable())
|
||||
);
|
||||
List<LicenseListRes> licenseList = assembleConvertLicenses(list);
|
||||
return licenseList;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private List<LicenseListRes> assembleConvertLicenses(List<LicenseDO> list) {
|
||||
List<LicenseListRes> licenseList = mapperFacade.mapAsList(list, LicenseListRes.class);
|
||||
if (!CollectionUtil.isEmpty(licenseList)) {
|
||||
Set<Integer> userIds = licenseList.stream().map(LicenseListRes::getUserId).collect(Collectors.toSet());
|
||||
@@ -217,4 +227,20 @@ public class LicenseService implements Lifecycle {
|
||||
public void stop() throws Throwable {
|
||||
licenseMapper.updateOnlineStatus(OnlineStatusEnum.OFFLINE.getStatus(), new Date());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询当前角色下的license,若为管理员 则返回全部license
|
||||
*/
|
||||
public List<LicenseListRes> queryCurUserLicense(LicenseListReq req) {
|
||||
if(SystemContextHolder.isAdmin()){
|
||||
return this.list(req);
|
||||
}
|
||||
|
||||
List<LicenseDO> list = licenseMapper.selectList(new LambdaQueryWrapper<LicenseDO>()
|
||||
.eq(LicenseDO::getEnable, EnableStatusEnum.ENABLE.getStatus())
|
||||
.eq(LicenseDO::getUserId,SystemContextHolder.getUserId())
|
||||
);
|
||||
List<LicenseListRes> licenseList = assembleConvertLicenses(list);
|
||||
return licenseList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package fun.asgc.neutrino.proxy.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.ServiceException;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.SystemContextHolder;
|
||||
import fun.asgc.neutrino.proxy.server.constant.Constants;
|
||||
import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.PortGroupCreateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.PortGroupListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.PortGroupUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.PortGroupCreateRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.PortGroupListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.PortGroupUpdateEnableStatusRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.PortGroupMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.PortPoolMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.PortGroupDO;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.PortPoolDO;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import ma.glasnost.orika.MapperFacade;
|
||||
import org.apache.ibatis.solon.annotation.Db;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 端口分组服务
|
||||
*/
|
||||
@Component
|
||||
public class PortGroupService {
|
||||
|
||||
@Inject
|
||||
private MapperFacade mapperFacade;
|
||||
|
||||
@Db
|
||||
private PortGroupMapper portGroupMapper;
|
||||
|
||||
@Db
|
||||
private PortPoolMapper portPoolMapper;
|
||||
|
||||
public PortGroupCreateRes create(PortGroupCreateReq req) {
|
||||
PortGroupDO portGroupDO = portGroupMapper.selectOne(Wrappers.lambdaQuery(PortGroupDO.class)
|
||||
.eq(PortGroupDO::getName, req.getName()));
|
||||
if (Objects.nonNull(portGroupDO)) {
|
||||
throw ServiceException.create(ExceptionConstant.PORT_GROUP_NAME_ALREADY_EXIST, req.getName());
|
||||
}
|
||||
Date now = new Date();
|
||||
portGroupDO = new PortGroupDO();
|
||||
portGroupDO.setName(req.getName());
|
||||
portGroupDO.setPossessorType(req.getPossessorType());
|
||||
portGroupDO.setPossessorId(req.getPossessorId());
|
||||
portGroupDO.setEnable(EnableStatusEnum.ENABLE.getStatus());
|
||||
portGroupDO.setCreateTime(now);
|
||||
portGroupDO.setUpdateTime(now);
|
||||
portGroupMapper.insert(portGroupDO);
|
||||
return new PortGroupCreateRes();
|
||||
}
|
||||
|
||||
public PageInfo<PortGroupListRes> page(PageQuery pageQuery, PortGroupListReq req) {
|
||||
Page<PortGroupListRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
List<PortGroupListRes> list = portGroupMapper.selectPortGroupListResList(req);
|
||||
|
||||
return PageInfo.of(list, result.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
|
||||
public List<PortGroupListRes> list(PortGroupListReq req) {
|
||||
List<PortGroupListRes> list = portGroupMapper.selectPortGroupListResList(req);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public PortGroupUpdateEnableStatusRes updateEnableStatus(PortGroupUpdateEnableStatusReq req) {
|
||||
PortGroupDO portGroupDO = portGroupMapper.selectById(req.getId());
|
||||
ParamCheckUtil.checkNotNull(portGroupDO, ExceptionConstant.PORT_GROUP_NAME_DOES_NOT_EXIST);
|
||||
if (!SystemContextHolder.isAdmin()) {
|
||||
ParamCheckUtil.checkExpression(false, ExceptionConstant.NO_PERMISSION_VISIT);
|
||||
}
|
||||
portGroupMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
|
||||
return new PortGroupUpdateEnableStatusRes();
|
||||
}
|
||||
|
||||
public void delete(Integer id) {
|
||||
if (id == Constants.DEFAULT_PORT_GROUP_ID) {
|
||||
throw ServiceException.create(ExceptionConstant.DEFAULT_GROUP_FORBID_DELETE);
|
||||
}
|
||||
PortGroupDO portGroupDO = portGroupMapper.selectById(id);
|
||||
//检验分组是否存在
|
||||
ParamCheckUtil.checkNotNull(portGroupDO, ExceptionConstant.PORT_GROUP_NAME_DOES_NOT_EXIST);
|
||||
//删除
|
||||
portGroupMapper.deleteById(id);
|
||||
//修改绑定此分组的端口到默认分组
|
||||
portPoolMapper.update(null, Wrappers.lambdaUpdate(PortPoolDO.class)
|
||||
.eq(PortPoolDO::getGroupId, portGroupDO.getId())
|
||||
.set(PortPoolDO::getGroupId, Constants.DEFAULT_PORT_GROUP_ID)
|
||||
.set(PortPoolDO::getUpdateTime, new Date())
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package fun.asgc.neutrino.proxy.server.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@@ -12,11 +11,11 @@ import fun.asgc.neutrino.proxy.server.base.rest.SystemContextHolder;
|
||||
import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.constant.OnlineStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortMappingCreateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortMappingListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortMappingUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortMappingUpdateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.PortMappingCreateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.PortMappingListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.PortMappingUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.proxy.PortMappingUpdateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.proxy.*;
|
||||
import fun.asgc.neutrino.proxy.server.dal.LicenseMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.PortMappingMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.PortPoolMapper;
|
||||
@@ -32,10 +31,7 @@ import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
import org.noear.solon.core.Lifecycle;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -59,15 +55,18 @@ public class PortMappingService implements Lifecycle {
|
||||
@Inject
|
||||
private VisitorChannelService visitorChannelService;
|
||||
|
||||
@Inject
|
||||
private PortPoolService portPoolService;
|
||||
|
||||
public PageInfo<PortMappingListRes> page(PageQuery pageQuery, PortMappingListReq req) {
|
||||
Page<PortMappingListRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
List<PortMappingDO> list = portMappingMapper.selectList(new LambdaQueryWrapper<PortMappingDO>()
|
||||
.orderByAsc(PortMappingDO::getId)
|
||||
);
|
||||
|
||||
List<PortMappingDO> list = portMappingMapper.selectPortMappingByCondition(req);
|
||||
List<PortMappingListRes> respList = mapperFacade.mapAsList(list, PortMappingListRes.class);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return PageInfo.of(respList, result.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
|
||||
Set<Integer> licenseIds = respList.stream().map(PortMappingListRes::getLicenseId).collect(Collectors.toSet());
|
||||
List<LicenseDO> licenseList = licenseMapper.findByIds(licenseIds);
|
||||
if (CollectionUtil.isEmpty(licenseList)) {
|
||||
@@ -77,6 +76,7 @@ public class PortMappingService implements Lifecycle {
|
||||
List<UserDO> userList = userMapper.findByIds(userIds);
|
||||
Map<Integer, LicenseDO> licenseMap = licenseList.stream().collect(Collectors.toMap(LicenseDO::getId, Function.identity()));
|
||||
Map<Integer, UserDO> userMap = userList.stream().collect(Collectors.toMap(UserDO::getId, Function.identity()));
|
||||
|
||||
respList.forEach(item -> {
|
||||
LicenseDO license = licenseMap.get(item.getLicenseId());
|
||||
if (null == license) {
|
||||
@@ -90,6 +90,11 @@ public class PortMappingService implements Lifecycle {
|
||||
}
|
||||
item.setUserName(user.getName());
|
||||
});
|
||||
//sorted [userId asc] [licenseId asc] [createTime asc]
|
||||
respList = respList.stream().sorted(Comparator.comparing(PortMappingListRes::getUserId)
|
||||
.thenComparing(PortMappingListRes::getLicenseId)
|
||||
.thenComparing(PortMappingListRes::getCreateTime))
|
||||
.collect(Collectors.toList());
|
||||
return PageInfo.of(respList, result.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
|
||||
@@ -97,7 +102,7 @@ public class PortMappingService implements Lifecycle {
|
||||
LicenseDO licenseDO = licenseMapper.findById(req.getLicenseId());
|
||||
ParamCheckUtil.checkNotNull(licenseDO, ExceptionConstant.LICENSE_NOT_EXIST);
|
||||
if (!SystemContextHolder.isAdmin()) {
|
||||
// 临时处理,如果当前用户不是管理院,则操作userId不能为1
|
||||
// 临时处理,如果当前用户不是管理员,则操作userId不能为1
|
||||
ParamCheckUtil.checkExpression(!licenseDO.getUserId().equals(1), ExceptionConstant.NO_PERMISSION_VISIT);
|
||||
}
|
||||
PortPoolDO portPoolDO = portPoolMapper.findByPort(req.getServerPort());
|
||||
|
||||
@@ -1,41 +1,22 @@
|
||||
/**
|
||||
* Copyright (c) 2022 aoshiguchen
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
package fun.asgc.neutrino.proxy.server.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.ServiceException;
|
||||
import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortPoolCreateReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortPoolListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.PortPoolUpdateEnableStatusReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.PortPoolCreateRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.PortPoolListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.PortPoolUpdateEnableStatusRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.*;
|
||||
import fun.asgc.neutrino.proxy.server.dal.LicenseMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.PortGroupMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.PortMappingMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.PortPoolMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.PortPoolDO;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.*;
|
||||
import fun.asgc.neutrino.proxy.server.util.ParamCheckUtil;
|
||||
import ma.glasnost.orika.MapperFacade;
|
||||
import org.apache.ibatis.solon.annotation.Db;
|
||||
@@ -44,6 +25,8 @@ import org.noear.solon.annotation.Inject;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -59,59 +42,114 @@ public class PortPoolService {
|
||||
@Inject
|
||||
private VisitorChannelService visitorChannelService;
|
||||
|
||||
public PageInfo<PortPoolListRes> page(PageQuery pageQuery, PortPoolListReq req) {
|
||||
Page<PortPoolListRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
List<PortPoolDO> list = portPoolMapper.selectList(new LambdaQueryWrapper<PortPoolDO>()
|
||||
.orderByAsc(PortPoolDO::getId)
|
||||
);
|
||||
List<PortPoolListRes> respList = mapperFacade.mapAsList(list, PortPoolListRes.class);
|
||||
return PageInfo.of(respList, result.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
@Db
|
||||
private PortGroupMapper portGroupMapper;
|
||||
@Db
|
||||
private PortMappingMapper portMappingMapper;
|
||||
@Db
|
||||
private LicenseMapper licenseMapper;
|
||||
|
||||
public List<PortPoolListRes> list(PortPoolListReq req) {
|
||||
List<PortPoolDO> list = portPoolMapper.selectList(new LambdaQueryWrapper<PortPoolDO>()
|
||||
.eq(PortPoolDO::getEnable, EnableStatusEnum.ENABLE.getStatus())
|
||||
);
|
||||
return mapperFacade.mapAsList(list, PortPoolListRes.class);
|
||||
}
|
||||
public PageInfo<PortPoolListRes> page(PageQuery pageQuery, PortPoolListReq req) {
|
||||
Page<PortPoolListRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
|
||||
public PortPoolCreateRes create(PortPoolCreateReq req) {
|
||||
PortPoolDO oldPortPoolDO = portPoolMapper.findByPort(req.getPort());
|
||||
ParamCheckUtil.checkMustNull(oldPortPoolDO, ExceptionConstant.PORT_CANNOT_REPEAT);
|
||||
List<PortPoolListRes> list = portPoolMapper.selectResList(req);
|
||||
return PageInfo.of(list, result.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
public List<PortPoolListRes> list(PortPoolListReq req) {
|
||||
List<PortPoolDO> list = portPoolMapper.selectList(new LambdaQueryWrapper<PortPoolDO>()
|
||||
.eq(PortPoolDO::getEnable, EnableStatusEnum.ENABLE.getStatus())
|
||||
);
|
||||
return mapperFacade.mapAsList(this.filterUsedPorts(list), PortPoolListRes.class);
|
||||
}
|
||||
|
||||
portPoolMapper.insert(new PortPoolDO()
|
||||
.setPort(req.getPort())
|
||||
.setEnable(EnableStatusEnum.ENABLE.getStatus())
|
||||
.setCreateTime(now)
|
||||
.setUpdateTime(now)
|
||||
);
|
||||
// 更新visitorChannel
|
||||
visitorChannelService.updateVisitorChannelByPortPool(req.getPort(), EnableStatusEnum.ENABLE.getStatus());
|
||||
private List<PortPoolDO> filterUsedPorts(List<PortPoolDO> list) {
|
||||
//Gets the used ports
|
||||
List<PortMappingDO> usePorts = portMappingMapper.selectList(new LambdaQueryWrapper<PortMappingDO>().orderByAsc(PortMappingDO::getId));
|
||||
|
||||
return new PortPoolCreateRes();
|
||||
}
|
||||
List<Integer> serverPorts = usePorts.stream().map(item -> item.getServerPort()).collect(Collectors.toList());
|
||||
|
||||
public PortPoolUpdateEnableStatusRes updateEnableStatus(PortPoolUpdateEnableStatusReq req) {
|
||||
PortPoolDO portPoolDO = portPoolMapper.findById(req.getId());
|
||||
ParamCheckUtil.checkNotNull(portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
|
||||
portPoolMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
|
||||
return list.stream().filter(item -> !serverPorts.contains(item.getPort())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 更新visitorChannel
|
||||
visitorChannelService.updateVisitorChannelByPortPool(portPoolDO.getPort(), req.getEnable());
|
||||
public PortPoolUpdateRes update(PortPoolUpdateReq req) {
|
||||
portPoolMapper.update(null, new LambdaUpdateWrapper<PortPoolDO>()
|
||||
.eq(PortPoolDO::getId, req.getId())
|
||||
.set(PortPoolDO::getGroupId, req.getGroupId())
|
||||
.set(PortPoolDO::getUpdateTime, new Date())
|
||||
);
|
||||
|
||||
return new PortPoolUpdateEnableStatusRes();
|
||||
}
|
||||
return new PortPoolUpdateRes();
|
||||
}
|
||||
|
||||
public void delete(Integer id) {
|
||||
PortPoolDO portPoolDO = portPoolMapper.findById(id);
|
||||
ParamCheckUtil.checkNotNull(portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
|
||||
public PortPoolCreateRes create(PortPoolCreateReq req) {
|
||||
PortPoolDO oldPortPoolDO = portPoolMapper.findByPort(req.getPort());
|
||||
ParamCheckUtil.checkMustNull(oldPortPoolDO, ExceptionConstant.PORT_CANNOT_REPEAT);
|
||||
PortGroupDO portGroupDO = portGroupMapper.selectById(req.getGroupId());
|
||||
ParamCheckUtil.checkNotNull(portGroupDO, ExceptionConstant.PORT_GROUP_NAME_DOES_NOT_EXIST);
|
||||
|
||||
portPoolMapper.deleteById(id);
|
||||
Date now = new Date();
|
||||
|
||||
// 更新visitorChannel
|
||||
visitorChannelService.updateVisitorChannelByPortPool(portPoolDO.getPort(), EnableStatusEnum.DISABLE.getStatus());
|
||||
}
|
||||
portPoolMapper.insert(new PortPoolDO()
|
||||
.setPort(req.getPort())
|
||||
.setGroupId(req.getGroupId())
|
||||
.setEnable(EnableStatusEnum.ENABLE.getStatus())
|
||||
.setCreateTime(now)
|
||||
.setUpdateTime(now)
|
||||
);
|
||||
// 更新visitorChannel
|
||||
visitorChannelService.updateVisitorChannelByPortPool(req.getPort(), EnableStatusEnum.ENABLE.getStatus());
|
||||
|
||||
return new PortPoolCreateRes();
|
||||
}
|
||||
|
||||
public PortPoolUpdateEnableStatusRes updateEnableStatus(PortPoolUpdateEnableStatusReq req) {
|
||||
PortPoolDO portPoolDO = portPoolMapper.findById(req.getId());
|
||||
ParamCheckUtil.checkNotNull(portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
|
||||
portPoolMapper.updateEnableStatus(req.getId(), req.getEnable(), new Date());
|
||||
|
||||
// 更新visitorChannel
|
||||
visitorChannelService.updateVisitorChannelByPortPool(portPoolDO.getPort(), req.getEnable());
|
||||
|
||||
return new PortPoolUpdateEnableStatusRes();
|
||||
}
|
||||
|
||||
public void delete(Integer id) {
|
||||
PortPoolDO portPoolDO = portPoolMapper.findById(id);
|
||||
ParamCheckUtil.checkNotNull(portPoolDO, ExceptionConstant.PORT_NOT_EXIST);
|
||||
|
||||
portPoolMapper.deleteById(id);
|
||||
|
||||
// 更新visitorChannel
|
||||
visitorChannelService.updateVisitorChannelByPortPool(portPoolDO.getPort(), EnableStatusEnum.DISABLE.getStatus());
|
||||
}
|
||||
|
||||
public List<PortPoolListRes> portListByGroupId(String groupId) {
|
||||
List<PortPoolDO> portPoolDOList = portPoolMapper.getByGroupId(groupId);
|
||||
List<PortPoolListRes> portPoolListReList = mapperFacade.mapAsList(portPoolDOList, PortPoolListRes.class);
|
||||
return portPoolListReList;
|
||||
}
|
||||
|
||||
public PortPoolUpdateGroupRes updateGroup(PortPoolUpdateGroupReq req) {
|
||||
PortGroupDO portGroupDO = portGroupMapper.selectById(req.getGroupId());
|
||||
if (Objects.isNull(portGroupDO)) {
|
||||
throw ServiceException.create(ExceptionConstant.PARAMS_INVALID);
|
||||
}
|
||||
portPoolMapper.update(null, Wrappers.lambdaUpdate(PortPoolDO.class)
|
||||
.in(PortPoolDO::getId, req.getPortIdList())
|
||||
.set(PortPoolDO::getGroupId, req.getGroupId())
|
||||
.set(PortPoolDO::getUpdateTime, new Date())
|
||||
);
|
||||
return new PortPoolUpdateGroupRes();
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理员: 全局端口 + 当前选择的用户独占端口 + 当前选择license独占端口
|
||||
* 游客:全局端口 + 当前选择用户独占端口 + 当前选择license独占端口
|
||||
* 非管理员身份时:下拉选择license,只能选当前用户下的LICENSE
|
||||
*/
|
||||
public List<PortPoolListRes> getAvailablePortList(AvailablePortListReq req) {
|
||||
LicenseDO licenseDO = licenseMapper.queryById(req.getLicenseId());
|
||||
return portPoolMapper.getAvailablePortList(req.getLicenseId(), licenseDO.getUserId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,37 @@
|
||||
package fun.asgc.neutrino.proxy.server.service;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.google.common.collect.Lists;
|
||||
import fun.asgc.neutrino.proxy.core.util.DateUtil;
|
||||
import fun.asgc.neutrino.proxy.server.base.db.DbConfig;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.LicenseFlowReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.UserFlowReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.LicenseFlowReportRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.UserFlowReportRes;
|
||||
import fun.asgc.neutrino.proxy.server.constant.Constants;
|
||||
import fun.asgc.neutrino.proxy.server.constant.OnlineStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.report.LicenseFlowMonthReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.report.LicenseFlowReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.report.UserFlowMonthReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.report.UserFlowReportReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.report.*;
|
||||
import fun.asgc.neutrino.proxy.server.dal.LicenseMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.PortMappingMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.ReportMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.LicenseDO;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.PortMappingDO;
|
||||
import fun.asgc.neutrino.proxy.server.service.bo.FlowBO;
|
||||
import fun.asgc.neutrino.proxy.server.service.bo.SingleDayFlowBO;
|
||||
import fun.asgc.neutrino.proxy.server.util.FormatUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import ma.glasnost.orika.MapperFacade;
|
||||
import org.apache.ibatis.solon.annotation.Db;
|
||||
import org.noear.solon.annotation.Component;
|
||||
import org.noear.solon.annotation.Inject;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
@@ -16,6 +40,59 @@ import org.noear.solon.annotation.Component;
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ReportService {
|
||||
@Inject
|
||||
private MapperFacade mapperFacade;
|
||||
@Db
|
||||
private ReportMapper reportMapper;
|
||||
@Db
|
||||
private LicenseMapper licenseMapper;
|
||||
@Db
|
||||
private PortMappingMapper portMappingMapper;
|
||||
@Inject
|
||||
private DbConfig dbConfig;
|
||||
|
||||
/**
|
||||
* 首页图表
|
||||
* @return
|
||||
*/
|
||||
public HomeDataView homeDataView() {
|
||||
HomeDataView homeDataView = new HomeDataView();
|
||||
homeDataView.setLicense(new HomeDataView.License().setTotalCount(0).setOnlineCount(0));
|
||||
homeDataView.setPortMapping(new HomeDataView.PortMapping().setTotalCount(0).setOnlineCount(0));
|
||||
homeDataView.setTodayFlow(new HomeDataView.TodayFlow().setUpFlowBytes(0L).setDownFlowBytes(0L));
|
||||
homeDataView.setTotalFlow(new HomeDataView.TotalFlow().setUpFlowBytes(0L).setDownFlowBytes(0L));
|
||||
|
||||
// 查询license列表
|
||||
List<LicenseDO> licenseDOList = licenseMapper.listAll();
|
||||
if (CollectionUtil.isNotEmpty(licenseDOList)) {
|
||||
homeDataView.getLicense().setTotalCount(licenseDOList.size());
|
||||
homeDataView.getLicense().setOnlineCount((int)licenseDOList.stream().filter(e -> OnlineStatusEnum.ONLINE.getStatus().equals(e.getIsOnline())).count());
|
||||
}
|
||||
// 查询端口映射列表
|
||||
List<PortMappingDO> portMappingDOList = portMappingMapper.selectList(new LambdaQueryWrapper<>());
|
||||
if (CollectionUtil.isNotEmpty(portMappingDOList)) {
|
||||
homeDataView.getPortMapping().setTotalCount(portMappingDOList.size());
|
||||
homeDataView.getPortMapping().setOnlineCount((int)portMappingDOList.stream().filter(e -> OnlineStatusEnum.ONLINE.getStatus().equals(e.getIsOnline())).count());
|
||||
}
|
||||
// 今日流量
|
||||
Date now = new Date();
|
||||
FlowBO todayFlow = reportMapper.homeTodayFlow(DateUtil.getDayBegin(now), now);
|
||||
homeDataView.setTodayFlow(mapperFacade.map(todayFlow, HomeDataView.TodayFlow.class));
|
||||
|
||||
// 总流量
|
||||
FlowBO totalFlow = reportMapper.homeTotalFlow(DateUtil.getMonthBegin(now), DateUtil.getDayBegin(now), now);
|
||||
homeDataView.setTotalFlow(mapperFacade.map(totalFlow, HomeDataView.TotalFlow.class));
|
||||
|
||||
// 最近n日流量
|
||||
Integer days = Constants.HOME_FLOW_DAYS;
|
||||
List<SingleDayFlowBO> last7dFlowList = reportMapper.homeLast7dFlowList(DateUtil.getDayBegin(DateUtil.addDate(now, Calendar.DATE, -(days - 1))), DateUtil.getDayBegin(now), now);
|
||||
homeDataView.setLast7dFlow(new HomeDataView.Last7dFlow());
|
||||
homeDataView.getLast7dFlow().setDataList(mapperFacade.mapAsList(last7dFlowList, HomeDataView.SingleDayFlow.class));
|
||||
|
||||
// 数据处理
|
||||
fillHomeDataView(homeDataView, now);
|
||||
return homeDataView;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户流量报表分页
|
||||
@@ -24,8 +101,11 @@ public class ReportService {
|
||||
* @return
|
||||
*/
|
||||
public PageInfo<UserFlowReportRes> userFlowReportPage(PageQuery pageQuery, UserFlowReportReq req) {
|
||||
// TODO
|
||||
return null;
|
||||
Page<UserFlowReportRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
Date now = new Date();
|
||||
List<UserFlowReportRes> list = reportMapper.userFlowReportList(req.getUserId(), DateUtil.getMonthBegin(now), DateUtil.getDayBegin(now), now);
|
||||
fillUserFlowReport(list);
|
||||
return PageInfo.of(list, result.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -35,7 +115,239 @@ public class ReportService {
|
||||
* @return
|
||||
*/
|
||||
public PageInfo<LicenseFlowReportRes> licenseFlowReportPage(PageQuery pageQuery, LicenseFlowReportReq req) {
|
||||
// TODO
|
||||
return null;
|
||||
Page<LicenseFlowReportRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
Date now = new Date();
|
||||
List<LicenseFlowReportRes> list = reportMapper.licenseFLowReportList(req.getUserId(), DateUtil.getMonthBegin(now), DateUtil.getDayBegin(now), now);
|
||||
fillLicenseFlowReport(list);
|
||||
return PageInfo.of(list, result.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户流量月度明细
|
||||
* @param pageQuery
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
public PageInfo<UserFlowMonthReportRes> userFlowMonthReportPage(PageQuery pageQuery, UserFlowMonthReportReq req) {
|
||||
Page<UserFlowMonthReportRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
Date now = new Date();
|
||||
List<UserFlowMonthReportRes> list = reportMapper.userFlowMonthReportList(req.getUserId(), DateUtil.getMonthBegin(now), DateUtil.getDayBegin(now), now);
|
||||
fillUserFlowMonthReport(list);
|
||||
return PageInfo.of(list, result.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
|
||||
/**
|
||||
* license流量月度明细
|
||||
* @param pageQuery
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
public PageInfo<LicenseFlowMonthReportRes> licenseFlowMonthReportPage(PageQuery pageQuery, LicenseFlowMonthReportReq req) {
|
||||
Page<LicenseFlowMonthReportRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
Date now = new Date();
|
||||
List<LicenseFlowMonthReportRes> list = reportMapper.licenseFLowMonthReportList(req.getUserId(), req.getLicenseId(), DateUtil.getMonthBegin(now), DateUtil.getDayBegin(now), now);
|
||||
fillLicenseFlowMonthReport(list);
|
||||
return PageInfo.of(list, result.getTotal(), pageQuery.getCurrent(), pageQuery.getSize());
|
||||
}
|
||||
|
||||
private void fillUserFlowReport(List<UserFlowReportRes> list) {
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (UserFlowReportRes item : list) {
|
||||
long upFlowBytes = (null == item.getUpFlowBytes()) ? 0 : item.getUpFlowBytes();
|
||||
long downFlowBytes = (null == item.getDownFlowBytes()) ? 0 : item.getDownFlowBytes();
|
||||
long totalFlowBytes = upFlowBytes + downFlowBytes;
|
||||
item.setUpFlowBytes(upFlowBytes);
|
||||
item.setDownFlowBytes(downFlowBytes);
|
||||
item.setTotalFlowBytes(totalFlowBytes);
|
||||
item.setUpFlowDesc(FormatUtil.getSizeDescByByteCount(upFlowBytes));
|
||||
item.setDownFlowDesc(FormatUtil.getSizeDescByByteCount(downFlowBytes));
|
||||
item.setTotalFlowDesc(FormatUtil.getSizeDescByByteCount(totalFlowBytes));
|
||||
}
|
||||
}
|
||||
|
||||
private void fillLicenseFlowReport(List<LicenseFlowReportRes> list) {
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (LicenseFlowReportRes item : list) {
|
||||
long upFlowBytes = (null == item.getUpFlowBytes()) ? 0 : item.getUpFlowBytes();
|
||||
long downFlowBytes = (null == item.getDownFlowBytes()) ? 0 : item.getDownFlowBytes();
|
||||
long totalFlowBytes = upFlowBytes + downFlowBytes;
|
||||
item.setUpFlowBytes(upFlowBytes);
|
||||
item.setDownFlowBytes(downFlowBytes);
|
||||
item.setTotalFlowBytes(totalFlowBytes);
|
||||
item.setUpFlowDesc(FormatUtil.getSizeDescByByteCount(upFlowBytes));
|
||||
item.setDownFlowDesc(FormatUtil.getSizeDescByByteCount(downFlowBytes));
|
||||
item.setTotalFlowDesc(FormatUtil.getSizeDescByByteCount(totalFlowBytes));
|
||||
}
|
||||
}
|
||||
|
||||
private void fillUserFlowMonthReport(List<UserFlowMonthReportRes> list) {
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (UserFlowMonthReportRes item : list) {
|
||||
long upFlowBytes = (null == item.getUpFlowBytes()) ? 0 : item.getUpFlowBytes();
|
||||
long downFlowBytes = (null == item.getDownFlowBytes()) ? 0 : item.getDownFlowBytes();
|
||||
long totalFlowBytes = upFlowBytes + downFlowBytes;
|
||||
item.setUpFlowBytes(upFlowBytes);
|
||||
item.setDownFlowBytes(downFlowBytes);
|
||||
item.setTotalFlowBytes(totalFlowBytes);
|
||||
item.setUpFlowDesc(FormatUtil.getSizeDescByByteCount(upFlowBytes));
|
||||
item.setDownFlowDesc(FormatUtil.getSizeDescByByteCount(downFlowBytes));
|
||||
item.setTotalFlowDesc(FormatUtil.getSizeDescByByteCount(totalFlowBytes));
|
||||
}
|
||||
}
|
||||
|
||||
private void fillLicenseFlowMonthReport(List<LicenseFlowMonthReportRes> list) {
|
||||
if (CollectionUtil.isEmpty(list)) {
|
||||
return;
|
||||
}
|
||||
for (LicenseFlowMonthReportRes item : list) {
|
||||
long upFlowBytes = (null == item.getUpFlowBytes()) ? 0 : item.getUpFlowBytes();
|
||||
long downFlowBytes = (null == item.getDownFlowBytes()) ? 0 : item.getDownFlowBytes();
|
||||
long totalFlowBytes = upFlowBytes + downFlowBytes;
|
||||
item.setUpFlowBytes(upFlowBytes);
|
||||
item.setDownFlowBytes(downFlowBytes);
|
||||
item.setTotalFlowBytes(totalFlowBytes);
|
||||
item.setUpFlowDesc(FormatUtil.getSizeDescByByteCount(upFlowBytes));
|
||||
item.setDownFlowDesc(FormatUtil.getSizeDescByByteCount(downFlowBytes));
|
||||
item.setTotalFlowDesc(FormatUtil.getSizeDescByByteCount(totalFlowBytes));
|
||||
}
|
||||
}
|
||||
|
||||
private void fillHomeDataView(HomeDataView homeDataView, Date now) {
|
||||
if (null == homeDataView) {
|
||||
return;
|
||||
}
|
||||
// License
|
||||
if (null == homeDataView.getLicense()) {
|
||||
homeDataView.setLicense(new HomeDataView.License());
|
||||
}
|
||||
if (null == homeDataView.getLicense().getTotalCount()) {
|
||||
homeDataView.getLicense().setTotalCount(0);
|
||||
}
|
||||
if (null == homeDataView.getLicense().getOnlineCount()) {
|
||||
homeDataView.getLicense().setOnlineCount(0);
|
||||
}
|
||||
homeDataView.getLicense().setOfflineCount(homeDataView.getLicense().getTotalCount() - homeDataView.getLicense().getOnlineCount());
|
||||
|
||||
// PortMapping
|
||||
if (null == homeDataView.getPortMapping()) {
|
||||
homeDataView.setPortMapping(new HomeDataView.PortMapping());
|
||||
}
|
||||
if (null == homeDataView.getPortMapping().getTotalCount()) {
|
||||
homeDataView.getPortMapping().setTotalCount(0);
|
||||
}
|
||||
if (null == homeDataView.getPortMapping().getOnlineCount()) {
|
||||
homeDataView.getPortMapping().setOnlineCount(0);
|
||||
}
|
||||
homeDataView.getPortMapping().setOfflineCount(homeDataView.getPortMapping().getTotalCount() - homeDataView.getPortMapping().getOnlineCount());
|
||||
|
||||
// TodayFlow
|
||||
if (null == homeDataView.getTodayFlow()) {
|
||||
homeDataView.setTodayFlow(new HomeDataView.TodayFlow());
|
||||
}
|
||||
if (null == homeDataView.getTodayFlow().getUpFlowBytes()) {
|
||||
homeDataView.getTodayFlow().setUpFlowBytes(0L);
|
||||
}
|
||||
if (null == homeDataView.getTodayFlow().getDownFlowBytes()) {
|
||||
homeDataView.getTodayFlow().setDownFlowBytes(0L);
|
||||
}
|
||||
homeDataView.getTodayFlow().setTotalFlowBytes(homeDataView.getTodayFlow().getUpFlowBytes() + homeDataView.getTodayFlow().getDownFlowBytes());
|
||||
homeDataView.getTodayFlow().setUpFlowDesc(FormatUtil.getSizeDescByByteCount(homeDataView.getTodayFlow().getUpFlowBytes()));
|
||||
homeDataView.getTodayFlow().setDownFlowDesc(FormatUtil.getSizeDescByByteCount(homeDataView.getTodayFlow().getDownFlowBytes()));
|
||||
homeDataView.getTodayFlow().setTotalFlowDesc(FormatUtil.getSizeDescByByteCount(homeDataView.getTodayFlow().getTotalFlowBytes()));
|
||||
|
||||
// TotalFlow
|
||||
if (null == homeDataView.getTotalFlow()) {
|
||||
homeDataView.setTotalFlow(new HomeDataView.TotalFlow());
|
||||
}
|
||||
if (null == homeDataView.getTotalFlow().getUpFlowBytes()) {
|
||||
homeDataView.getTotalFlow().setUpFlowBytes(0L);
|
||||
}
|
||||
if (null == homeDataView.getTotalFlow().getDownFlowBytes()) {
|
||||
homeDataView.getTotalFlow().setDownFlowBytes(0L);
|
||||
}
|
||||
homeDataView.getTotalFlow().setTotalFlowBytes(homeDataView.getTotalFlow().getUpFlowBytes() + homeDataView.getTotalFlow().getDownFlowBytes());
|
||||
homeDataView.getTotalFlow().setUpFlowDesc(FormatUtil.getSizeDescByByteCount(homeDataView.getTotalFlow().getUpFlowBytes()));
|
||||
homeDataView.getTotalFlow().setDownFlowDesc(FormatUtil.getSizeDescByByteCount(homeDataView.getTotalFlow().getDownFlowBytes()));
|
||||
homeDataView.getTotalFlow().setTotalFlowDesc(FormatUtil.getSizeDescByByteCount(homeDataView.getTotalFlow().getTotalFlowBytes()));
|
||||
|
||||
// 最近N日流量
|
||||
Integer days = Constants.HOME_FLOW_DAYS;
|
||||
HomeDataView.Last7dFlow last7dFlow = homeDataView.getLast7dFlow();
|
||||
if (null == last7dFlow) {
|
||||
last7dFlow = new HomeDataView.Last7dFlow();
|
||||
homeDataView.setLast7dFlow(last7dFlow);
|
||||
}
|
||||
if (null == last7dFlow.getDataList()) {
|
||||
last7dFlow.setDataList(Collections.emptyList());
|
||||
}
|
||||
// 数据列表
|
||||
Set<String> existDateStrList = new HashSet<>();
|
||||
if (CollectionUtil.isNotEmpty(last7dFlow.getDataList())) {
|
||||
for (HomeDataView.SingleDayFlow singleDayFlow : last7dFlow.getDataList()) {
|
||||
if (null == singleDayFlow.getUpFlowBytes()) {
|
||||
singleDayFlow.setUpFlowBytes(0L);
|
||||
}
|
||||
if (null == singleDayFlow.getDownFlowBytes()) {
|
||||
singleDayFlow.setDownFlowBytes(0L);
|
||||
}
|
||||
singleDayFlow.setTotalFlowBytes(singleDayFlow.getUpFlowBytes() + singleDayFlow.getDownFlowBytes());
|
||||
singleDayFlow.setUpFlowDesc(FormatUtil.getSizeDescByByteCount(singleDayFlow.getUpFlowBytes()));
|
||||
singleDayFlow.setDownFlowDesc(FormatUtil.getSizeDescByByteCount(singleDayFlow.getDownFlowBytes()));
|
||||
singleDayFlow.setTotalFlowDesc(FormatUtil.getSizeDescByByteCount(singleDayFlow.getTotalFlowBytes()));
|
||||
singleDayFlow.setDateStr(DateUtil.format(singleDayFlow.getDate(), "yyyy-MM-dd"));
|
||||
existDateStrList.add(singleDayFlow.getDateStr());
|
||||
}
|
||||
}
|
||||
// 获取最近7天的日期字符串列表。防止因统计数据缺失,造成图表展示错误的问题,缺失的日期数据,自动填充0
|
||||
List<String> dateList = DateUtil.getBetweenTimes(DateUtil.format(DateUtil.addDate(now, Calendar.DATE, -(days - 1)), "yyyy-MM-dd"), DateUtil.format(now, "yyyy-MM-dd"));
|
||||
for (String dateStr : dateList) {
|
||||
if (existDateStrList.contains(dateStr)) {
|
||||
continue;
|
||||
}
|
||||
last7dFlow.getDataList().add(new HomeDataView.SingleDayFlow()
|
||||
.setDate(DateUtil.parse(dateStr, "yyyy-MM-dd"))
|
||||
.setDateStr(dateStr)
|
||||
.setUpFlowBytes(0L)
|
||||
.setUpFlowDesc("0B")
|
||||
.setDownFlowBytes(0L)
|
||||
.setDownFlowDesc("0B")
|
||||
.setTotalFlowBytes(0L)
|
||||
.setTotalFlowDesc("0B")
|
||||
);
|
||||
}
|
||||
|
||||
// 按日期升序
|
||||
Collections.sort(last7dFlow.getDataList(), Comparator.comparing(HomeDataView.SingleDayFlow::getDate));
|
||||
// x轴日期
|
||||
last7dFlow.setXDate(last7dFlow.getDataList().stream().map(HomeDataView.SingleDayFlow::getDateStr).collect(Collectors.toList()));
|
||||
// 图例
|
||||
last7dFlow.setLegendData(Lists.newArrayList("上行流量", "下行流量", "总流量"));
|
||||
// 折线图
|
||||
List<HomeDataView.Series> seriesList = Lists.newArrayList();
|
||||
last7dFlow.setSeriesList(seriesList);
|
||||
// 上行流量折线
|
||||
seriesList.add(new HomeDataView.Series()
|
||||
.setSeriesType("line")
|
||||
.setSeriesName(last7dFlow.getLegendData().get(0))
|
||||
.setSeriesData(last7dFlow.getDataList().stream().map(HomeDataView.SingleDayFlow::getUpFlowBytes).collect(Collectors.toList()))
|
||||
);
|
||||
// 下行流量折线
|
||||
seriesList.add(new HomeDataView.Series()
|
||||
.setSeriesType("line")
|
||||
.setSeriesName(last7dFlow.getLegendData().get(1))
|
||||
.setSeriesData(last7dFlow.getDataList().stream().map(HomeDataView.SingleDayFlow::getDownFlowBytes).collect(Collectors.toList()))
|
||||
);
|
||||
// 总流量折线
|
||||
seriesList.add(new HomeDataView.Series()
|
||||
.setSeriesType("line")
|
||||
.setSeriesName(last7dFlow.getLegendData().get(2))
|
||||
.setSeriesData(last7dFlow.getDataList().stream().map(HomeDataView.SingleDayFlow::getTotalFlowBytes).collect(Collectors.toList()))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageInfo;
|
||||
import fun.asgc.neutrino.proxy.server.base.page.PageQuery;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.UserLoginRecordListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.UserLoginRecordListRes;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.log.UserLoginRecordListReq;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.log.UserLoginRecordListRes;
|
||||
import fun.asgc.neutrino.proxy.server.dal.UserLoginRecordMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.UserMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.entity.UserDO;
|
||||
@@ -41,6 +41,7 @@ public class UserLoginRecordService {
|
||||
public PageInfo<UserLoginRecordListRes> page(PageQuery pageQuery, UserLoginRecordListReq req) {
|
||||
Page<UserLoginRecordListRes> result = PageHelper.startPage(pageQuery.getCurrent(), pageQuery.getSize());
|
||||
List<UserLoginRecordDO> list = userLoginRecordMapper.selectList(new LambdaQueryWrapper<UserLoginRecordDO>()
|
||||
.eq(null != req.getUserId(), UserLoginRecordDO::getUserId, req.getUserId())
|
||||
.orderByDesc(UserLoginRecordDO::getCreateTime)
|
||||
);
|
||||
List<UserLoginRecordListRes> respList = mapperFacade.mapAsList(list, UserLoginRecordListRes.class);
|
||||
|
||||
@@ -11,8 +11,8 @@ import fun.asgc.neutrino.proxy.server.base.rest.ServiceException;
|
||||
import fun.asgc.neutrino.proxy.server.base.rest.SystemContextHolder;
|
||||
import fun.asgc.neutrino.proxy.server.constant.EnableStatusEnum;
|
||||
import fun.asgc.neutrino.proxy.server.constant.ExceptionConstant;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.req.system.*;
|
||||
import fun.asgc.neutrino.proxy.server.controller.res.system.*;
|
||||
import fun.asgc.neutrino.proxy.server.dal.UserLoginRecordMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.UserMapper;
|
||||
import fun.asgc.neutrino.proxy.server.dal.UserTokenMapper;
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package fun.asgc.neutrino.proxy.server.service.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/26
|
||||
*/
|
||||
@Data
|
||||
public class FlowBO {
|
||||
/**
|
||||
* 上行流量字节数
|
||||
*/
|
||||
private Long upFlowBytes;
|
||||
/**
|
||||
* 下行流量字节数
|
||||
*/
|
||||
private Long downFlowBytes;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package fun.asgc.neutrino.proxy.server.service.bo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 单日流量
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/26
|
||||
*/
|
||||
@Data
|
||||
public class SingleDayFlowBO {
|
||||
/**
|
||||
* 日期
|
||||
*/
|
||||
private Date date;
|
||||
/**
|
||||
* 上行流量字节数
|
||||
*/
|
||||
private Long upFlowBytes;
|
||||
/**
|
||||
* 下行流量字节数
|
||||
*/
|
||||
private Long downFlowBytes;
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package fun.asgc.neutrino.proxy.server.util;
|
||||
|
||||
/**
|
||||
* @author: aoshiguchen
|
||||
* @date: 2023/3/19
|
||||
*/
|
||||
public class FormatUtil {
|
||||
private static final String[] SIZE_UNINTS = {"B", "KB", "MB", "GB", "TB"};
|
||||
private static final int SIZE_SYSTEM = 1024;
|
||||
/**
|
||||
* 根据字节数获取大小描述
|
||||
* 1、小于1024字节的以B为单位
|
||||
* 2、小于1024KB的以KB为单位
|
||||
* 3、小于1024M的以MB为单位
|
||||
* 4、小于1024G的以GB为单位
|
||||
* 5、其他以TB为单位
|
||||
* @param byteCount
|
||||
* @return
|
||||
*/
|
||||
public static String getSizeDescByByteCount(long byteCount){
|
||||
if(byteCount <= 0){
|
||||
return "0B";
|
||||
}
|
||||
|
||||
double res = byteCount;
|
||||
int index = 0;
|
||||
while (index < SIZE_UNINTS.length && res >= SIZE_SYSTEM){
|
||||
res /= SIZE_SYSTEM;
|
||||
index++;
|
||||
}
|
||||
|
||||
if(index >= SIZE_UNINTS.length){
|
||||
index = SIZE_UNINTS.length - 1;
|
||||
res *= 1024;
|
||||
}
|
||||
|
||||
return trimZero(String.format("%.2f", res)) + SIZE_UNINTS[index];
|
||||
}
|
||||
|
||||
private static String trimZero(String s) {
|
||||
if (s.indexOf(".") > 0) {
|
||||
// 去掉多余的0
|
||||
s = s.replaceAll("0+?$", "");
|
||||
// 如最后一位是.则去掉
|
||||
s = s.replaceAll("[.]$", "");
|
||||
}
|
||||
return s;
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ neutrino:
|
||||
write-idle-time: 10
|
||||
all-idle-time-seconds: 0
|
||||
server:
|
||||
boss-thread-count: 10
|
||||
work-thread-count: 60
|
||||
port: 9000
|
||||
ssl-port: 9002
|
||||
key-store-password: 123456
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="fun.asgc.neutrino.proxy.server.dal.PortGroupMapper">
|
||||
|
||||
<select id="selectPortGroupListResList" resultType="fun.asgc.neutrino.proxy.server.controller.res.system.PortGroupListRes">
|
||||
SELECT g.*,
|
||||
CASE
|
||||
WHEN g.possessor_type = 1 THEN
|
||||
u.`name`
|
||||
WHEN g.possessor_type = 2 THEN
|
||||
l.`name`
|
||||
ELSE ''
|
||||
END possessor
|
||||
FROM port_group g
|
||||
LEFT JOIN `user` u ON g.possessor_id = u.id
|
||||
LEFT JOIN license l ON g.possessor_id = l.id
|
||||
ORDER BY g.id
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="fun.asgc.neutrino.proxy.server.dal.PortMappingMapper">
|
||||
|
||||
<select id="selectPortMappingByCondition" resultType="fun.asgc.neutrino.proxy.server.dal.entity.PortMappingDO">
|
||||
SELECT pm.* from port_mapping pm left join license on pm.license_id = license.`id`
|
||||
<where>
|
||||
<if test="req.userId != null">
|
||||
AND license.user_id = #{req.userId}
|
||||
</if>
|
||||
<if test="req.licenseId != null">
|
||||
AND pm.license_id = #{req.licenseId}
|
||||
</if>
|
||||
<if test="req.serverPort != null">
|
||||
AND pm.server_port = #{req.serverPort}
|
||||
</if>
|
||||
<if test="req.isOnline != null">
|
||||
AND pm.is_online = #{req.isOnline}
|
||||
</if>
|
||||
<if test="req.enable != null">
|
||||
AND pm.enable = #{req.enable}
|
||||
</if>
|
||||
</where>
|
||||
order by pm.id asc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,37 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="fun.asgc.neutrino.proxy.server.dal.PortPoolMapper">
|
||||
|
||||
<select id="selectResList" resultType="fun.asgc.neutrino.proxy.server.controller.res.system.PortPoolListRes">
|
||||
SELECT p.*,
|
||||
g.possessor_type,
|
||||
g.`name` group_name
|
||||
FROM port_pool p
|
||||
LEFT JOIN port_group g ON p.group_id = g.id
|
||||
<where>
|
||||
<if test="req.groupId != null">
|
||||
AND p.group_id = #{req.groupId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY p.id
|
||||
</select>
|
||||
|
||||
<select id="getAvailablePortList" resultType="fun.asgc.neutrino.proxy.server.controller.res.system.PortPoolListRes">
|
||||
SELECT
|
||||
*
|
||||
FROM
|
||||
port_pool
|
||||
WHERE
|
||||
`port` NOT IN ( SELECT server_port FROM port_mapping )
|
||||
AND group_id IN (
|
||||
SELECT
|
||||
id
|
||||
FROM
|
||||
port_group
|
||||
WHERE
|
||||
possessor_type = 0
|
||||
OR ( possessor_type = 1 AND possessor_id = #{userId,jdbcType=INTEGER} )
|
||||
OR ( possessor_type = 2 AND possessor_id = #{licenseId,jdbcType=INTEGER} )
|
||||
)
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,250 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="fun.asgc.neutrino.proxy.server.dal.ReportMapper">
|
||||
|
||||
<select id="userFlowReportList" resultType="fun.asgc.neutrino.proxy.server.controller.res.report.UserFlowReportRes">
|
||||
SELECT
|
||||
u.id AS 'userId',
|
||||
u.name AS 'userName',
|
||||
SUM(IFNULL(frm.write_bytes,0) + IFNULL(frd.write_bytes,0) + IFNULL(frm2.write_bytes,0)) AS 'upFlowBytes',
|
||||
SUM(IFNULL(frm.read_bytes,0) + IFNULL(frd.read_bytes,0) + IFNULL(frm2.read_bytes,0)) AS 'downFlowBytes',
|
||||
IFNULL(SUM(frm.write_bytes),0) monthWriteBytes,
|
||||
IFNULL(SUM(frm.read_bytes),0) monthReadBytes,
|
||||
IFNULL(SUM(frd.write_bytes),0) dayWriteBytes,
|
||||
IFNULL(SUM(frd.read_bytes),0) dayReadBytes,
|
||||
IFNULL(SUM(frm2.write_bytes),0) minuteWriteBytes,
|
||||
IFNULL(SUM(frm2.read_bytes),0) minuteReadBytes
|
||||
FROM `user` u
|
||||
LEFT JOIN (SELECT user_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_month GROUP BY user_id) frm ON u.id = frm.user_id
|
||||
LEFT JOIN (SELECT user_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_day
|
||||
WHERE date >= #{curMonthBeginDate} AND date <= #{curDayBeginDate}
|
||||
GROUP BY user_id) frd ON u.id = frd.user_id
|
||||
LEFT JOIN (SELECT user_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_minute
|
||||
WHERE date >= #{curDayBeginDate} AND date <= #{curDate}
|
||||
GROUP BY user_id) frm2 ON u.id = frm2.user_id
|
||||
<where>
|
||||
<if test="userId != null">
|
||||
AND u.id = #{userId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY u.id
|
||||
</select>
|
||||
|
||||
<select id="licenseFLowReportList" resultType="fun.asgc.neutrino.proxy.server.controller.res.report.LicenseFlowReportRes">
|
||||
SELECT
|
||||
l.id AS 'licenseId',
|
||||
l.name AS 'licenseName',
|
||||
u.id AS 'userId',
|
||||
u.name AS 'userName',
|
||||
SUM(IFNULL(frm.write_bytes,0) + IFNULL(frd.write_bytes,0) + IFNULL(frm2.write_bytes,0)) AS 'upFlowBytes',
|
||||
SUM(IFNULL(frm.read_bytes,0) + IFNULL(frd.read_bytes,0) + IFNULL(frm2.read_bytes,0)) AS 'downFlowBytes',
|
||||
IFNULL(SUM(frm.write_bytes),0) monthWriteBytes,
|
||||
IFNULL(SUM(frm.read_bytes),0) monthReadBytes,
|
||||
IFNULL(SUM(frd.write_bytes),0) dayWriteBytes,
|
||||
IFNULL(SUM(frd.read_bytes),0) dayReadBytes,
|
||||
IFNULL(SUM(frm2.write_bytes),0) minuteWriteBytes,
|
||||
IFNULL(SUM(frm2.read_bytes),0) minuteReadBytes
|
||||
FROM `license` l
|
||||
LEFT JOIN `user` u ON l.user_id = u.id
|
||||
LEFT JOIN (SELECT license_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_month GROUP BY license_id) frm ON l.id = frm.license_id
|
||||
LEFT JOIN (SELECT license_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_day
|
||||
WHERE date >= #{curMonthBeginDate} AND #{curDayBeginDate}
|
||||
GROUP BY license_id) frd ON l.id = frd.license_id
|
||||
LEFT JOIN (SELECT license_id,sum(write_bytes) write_bytes,sum(read_bytes) read_bytes from flow_report_minute
|
||||
WHERE date >= #{curDayBeginDate} AND date <= #{curDate}
|
||||
GROUP BY license_id)frm2 ON l.id = frm2.license_id
|
||||
<where>
|
||||
<if test="userId != null">
|
||||
AND u.id = #{userId}
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY l.id
|
||||
</select>
|
||||
|
||||
<select id="userFlowMonthReportList" resultType="fun.asgc.neutrino.proxy.server.controller.res.report.UserFlowMonthReportRes">
|
||||
SELECT
|
||||
T2.user_id,
|
||||
u.name AS 'userName',
|
||||
T2.date,
|
||||
T2.upFlowBytes,
|
||||
T2.downFlowBytes
|
||||
FROM (
|
||||
|
||||
(
|
||||
SELECT
|
||||
frm.user_id,
|
||||
frm.date,
|
||||
IFNULL(SUM(frm.write_bytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(frm.read_bytes),0) AS 'downFlowBytes'
|
||||
FROM flow_report_month frm
|
||||
GROUP BY frm.user_id,frm.date
|
||||
)
|
||||
UNION ALL
|
||||
(
|
||||
SELECT
|
||||
T1.user_id,
|
||||
#{curMonthBeginDate} AS 'date',
|
||||
IFNULL(SUM(T1.upFlowBytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(T1.downFlowBytes),0) AS 'downFlowBytes'
|
||||
FROM (
|
||||
(
|
||||
SELECT
|
||||
frd.user_id,
|
||||
frd.license_id,
|
||||
frd.write_bytes AS 'upFlowBytes',
|
||||
frd.read_bytes AS 'downFlowBytes',
|
||||
frd.date
|
||||
FROM flow_report_day frd
|
||||
WHERE frd.date >= #{curMonthBeginDate} AND frd.date <= #{curDayBeginDate}
|
||||
)
|
||||
UNION ALL
|
||||
(
|
||||
SELECT
|
||||
frm.user_id,
|
||||
frm.license_id,
|
||||
IFNULL(SUM(frm.write_bytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(frm.read_bytes),0) AS 'downFlowBytes',
|
||||
#{curDayBeginDate} AS 'date'
|
||||
FROM flow_report_minute frm
|
||||
WHERE frm.date >= #{curDayBeginDate} AND frm.date <= #{curDate}
|
||||
GROUP BY frm.user_id,frm.license_id
|
||||
)
|
||||
) T1
|
||||
GROUP BY T1.user_id
|
||||
)
|
||||
) T2
|
||||
LEFT JOIN `user` u ON u.id = T2.user_id
|
||||
<where>
|
||||
<if test="userId != null">
|
||||
AND u.id = #{userId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY T2.user_id ASC,T2.date DESC
|
||||
</select>
|
||||
|
||||
<select id="licenseFLowMonthReportList" resultType="fun.asgc.neutrino.proxy.server.controller.res.report.LicenseFlowMonthReportRes">
|
||||
SELECT
|
||||
T2.user_id,
|
||||
u.name AS 'userName',
|
||||
T2.license_id,
|
||||
l.`name` AS 'licenseName',
|
||||
T2.date,
|
||||
T2.upFlowBytes,
|
||||
T2.downFlowBytes
|
||||
FROM (
|
||||
|
||||
(
|
||||
SELECT
|
||||
frm.user_id,
|
||||
frm.license_id,
|
||||
frm.date,
|
||||
IFNULL(SUM(frm.write_bytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(frm.read_bytes),0) AS 'downFlowBytes'
|
||||
FROM flow_report_month frm
|
||||
GROUP BY frm.user_id,frm.license_id,frm.date
|
||||
)
|
||||
UNION ALL
|
||||
(
|
||||
SELECT
|
||||
T1.user_id,
|
||||
T1.license_id,
|
||||
#{curMonthBeginDate} AS 'date',
|
||||
IFNULL(SUM(T1.upFlowBytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(T1.downFlowBytes),0) AS 'downFlowBytes'
|
||||
FROM (
|
||||
(
|
||||
SELECT
|
||||
frd.user_id,
|
||||
frd.license_id,
|
||||
frd.write_bytes AS 'upFlowBytes',
|
||||
frd.read_bytes AS 'downFlowBytes',
|
||||
frd.date
|
||||
FROM flow_report_day frd
|
||||
WHERE frd.date >= #{curMonthBeginDate} AND frd.date <= #{curDayBeginDate}
|
||||
)
|
||||
UNION ALL
|
||||
(
|
||||
SELECT
|
||||
frm.user_id,
|
||||
frm.license_id,
|
||||
IFNULL(SUM(frm.write_bytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(frm.read_bytes),0) AS 'downFlowBytes',
|
||||
#{curDayBeginDate} AS 'date'
|
||||
FROM flow_report_minute frm
|
||||
WHERE frm.date >= #{curDayBeginDate} AND frm.date <= #{curDate}
|
||||
GROUP BY frm.user_id,frm.license_id
|
||||
)
|
||||
) T1
|
||||
GROUP BY T1.user_id,T1.license_id
|
||||
)
|
||||
) T2
|
||||
LEFT JOIN `user` u ON u.id = T2.user_id
|
||||
LEFT JOIN `license` l ON l.id = T2.license_id
|
||||
<where>
|
||||
<if test="userId != null">
|
||||
AND u.id = #{userId}
|
||||
</if>
|
||||
<if test="licenseId != null">
|
||||
AND l.id = #{licenseId}
|
||||
</if>
|
||||
</where>
|
||||
ORDER BY T2.user_id ASC,T2.license_id,T2.date DESC
|
||||
</select>
|
||||
|
||||
<select id="homeTodayFlow" resultType="fun.asgc.neutrino.proxy.server.service.bo.FlowBO">
|
||||
SELECT
|
||||
IFNULL(SUM(frm.write_bytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(frm.read_bytes),0) AS 'downFlowBytes'
|
||||
FROM flow_report_minute frm
|
||||
WHERE frm.date >= #{curDayBeginDate} AND frm.date <= #{curDate}
|
||||
</select>
|
||||
|
||||
<select id="homeTotalFlow" resultType="fun.asgc.neutrino.proxy.server.service.bo.FlowBO">
|
||||
SELECT
|
||||
IFNULL(SUM(T.upFlowBytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(T.downFlowBytes),0) AS 'downFlowBytes'
|
||||
FROM (
|
||||
(
|
||||
SELECT
|
||||
IFNULL(SUM(frm.write_bytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(frm.read_bytes),0) AS 'downFlowBytes'
|
||||
FROM flow_report_month frm
|
||||
) UNION ALL (
|
||||
SELECT
|
||||
IFNULL(SUM(frd.write_bytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(frd.read_bytes),0) AS 'downFlowBytes'
|
||||
FROM flow_report_day frd
|
||||
WHERE frd.date >= #{curMonthBeginDate} AND frd.date <= #{curDayBeginDate}
|
||||
) UNION ALL (
|
||||
SELECT
|
||||
IFNULL(SUM(frm.write_bytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(frm.read_bytes),0) AS 'downFlowBytes'
|
||||
FROM flow_report_minute frm
|
||||
WHERE frm.date >= #{curDayBeginDate} AND frm.date <= #{curDate}
|
||||
)
|
||||
) T
|
||||
</select>
|
||||
|
||||
<select id="homeLast7dFlowList" resultType="fun.asgc.neutrino.proxy.server.service.bo.SingleDayFlowBO">
|
||||
SELECT
|
||||
T.*
|
||||
FROM (
|
||||
(
|
||||
SELECT
|
||||
frd.date,
|
||||
IFNULL(SUM(frd.write_bytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(frd.read_bytes),0) AS 'downFlowBytes'
|
||||
FROM flow_report_day frd
|
||||
WHERE frd.date >= #{beginDate} AND frd.date <= #{curDayBeginDate}
|
||||
GROUP BY frd.date
|
||||
) UNION ALL (
|
||||
SELECT
|
||||
#{curDayBeginDate} AS 'date',
|
||||
IFNULL(SUM(frm.write_bytes),0) AS 'upFlowBytes',
|
||||
IFNULL(SUM(frm.read_bytes),0) AS 'downFlowBytes'
|
||||
FROM flow_report_minute frm
|
||||
WHERE frm.date >= #{curDayBeginDate} AND frm.date <= #{curDate}
|
||||
)
|
||||
) T
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -29,6 +29,7 @@ CREATE TABLE IF NOT EXISTS `user_token` (
|
||||
#端口池
|
||||
CREATE TABLE IF NOT EXISTS `port_pool` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`group_id` int NOT NULL DEFAULT 1 COMMENT '分组ID',
|
||||
`port` int NOT NULL COMMENT '端口',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
@@ -37,6 +38,18 @@ CREATE TABLE IF NOT EXISTS `port_pool` (
|
||||
KEY `I_port_pool_port` (`port`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
#端口分组
|
||||
CREATE TABLE IF NOT EXISTS `port_group` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`name` varchar(255) NOT NULL COMMENT '分组名称',
|
||||
`possessor_type` int NOT NULL DEFAULT '0' COMMENT '所有者类型 (0、全局共享 1、用户所有 2License所有) ',
|
||||
`possessor_id` int NOT NULL DEFAULT '-1' COMMENT '所有者id(当type为0时 固定为-1、当type为1时为用户id 、当type为2时为licenseid)',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='端口分组';
|
||||
|
||||
#############################代理配置相关表#############################
|
||||
#license表
|
||||
CREATE TABLE IF NOT EXISTS `license` (
|
||||
@@ -66,7 +79,6 @@ CREATE TABLE IF NOT EXISTS `port_mapping` (
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `I_port_mapping_server_port` (`server_port`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
|
||||
|
||||
#############################日志管理相关表#############################
|
||||
#用户登录记录表
|
||||
CREATE TABLE IF NOT EXISTS `user_login_record` (
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#port_group
|
||||
INSERT INTO `port_group`(`id`,`name`,`possessor_type`,`possessor_id`,`enable`,`create_time`,`update_time`) VALUES
|
||||
(1, '全局(默认)', 0, -1, 1, now(), now());
|
||||
@@ -1,41 +1,41 @@
|
||||
#端口池
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(1, 9101, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(2, 9102, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(3, 9103, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(4, 9104, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(5, 9105, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(6, 9106, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(7, 9107, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(8, 9108, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(9, 9109, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(10, 9110, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(11, 9111, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(12, 9112, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(13, 9113, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(14, 9114, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(15, 9115, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(16, 9116, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(17, 9117, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(18, 9118, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(19, 9119, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(20, 9120, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(1, 1, 9101, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(2, 1, 9102, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(3, 1, 9103, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(4, 1, 9104, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(5, 1, 9105, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(6, 1, 9106, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(7, 1, 9107, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(8, 1, 9108, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(9, 1, 9109, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(10, 1, 9110, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(11, 1, 9111, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(12, 1, 9112, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(13, 1, 9113, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(14, 1, 9114, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(15, 1, 9115, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(16, 1, 9116, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(17, 1, 9117, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(18, 1, 9118, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(19, 1, 9119, 1, now(), now());
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(20, 1, 9120, 1, now(), now());
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
ALTER TABLE port_pool ADD group_id INT NOT NULL DEFAULT 1 COMMENT "分组ID";
|
||||
|
||||
#端口分组
|
||||
CREATE TABLE IF NOT EXISTS `port_group` (
|
||||
`id` int NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`name` varchar(255) NOT NULL COMMENT '分组名称',
|
||||
`possessor_type` int NOT NULL DEFAULT '0' COMMENT '所有者类型 (0、全局共享 1、用户所有 2License所有) ',
|
||||
`possessor_id` int NOT NULL DEFAULT '-1' COMMENT '所有者id(当type为0时 固定为-1、当type为1时为用户id 、当type为2时为licenseid)',
|
||||
`enable` int NOT NULL COMMENT '是否启用(1、启用 2、禁用)',
|
||||
`create_time` datetime(3) NOT NULL COMMENT '创建时间',
|
||||
`update_time` datetime(3) NOT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='端口分组';
|
||||
@@ -27,6 +27,7 @@ CREATE INDEX IF NOT EXISTS I_user_token_expiration_time ON user_token(expiration
|
||||
#端口池
|
||||
CREATE TABLE IF NOT EXISTS `port_pool` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
`group_id` INTEGER NOT NULL DEFAULT 1,
|
||||
`port` INTEGER NOT NULL,
|
||||
`enable` INTEGER(2) NOT NULL,
|
||||
`update_time` INTEGER(20) NOT NULL,
|
||||
@@ -34,6 +35,16 @@ CREATE TABLE IF NOT EXISTS `port_pool` (
|
||||
);
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS I_port_pool_port ON port_pool (port ASC);
|
||||
|
||||
#端口分组
|
||||
CREATE TABLE IF NOT EXISTS `port_group` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`possessor_type` INTEGER NOT NULL DEFAULT '0',
|
||||
`possessor_id` INTEGER NOT NULL DEFAULT '-1',
|
||||
`enable` INTEGER NOT NULL,
|
||||
`create_time` datetime(3) NOT NULL,
|
||||
`update_time` datetime(3) NOT NULL
|
||||
);
|
||||
#############################代理配置相关表#############################
|
||||
#license表
|
||||
CREATE TABLE IF NOT EXISTS `license` (
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
#port_group
|
||||
INSERT INTO `port_group`(`id`,`name`,`possessor_type`,`possessor_id`,`enable`,`create_time`,`update_time`) VALUES
|
||||
(1, '全局(默认)', 0, -1, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
@@ -1,41 +1,41 @@
|
||||
#端口池
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(1, 9101, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(2, 9102, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(3, 9103, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(4, 9104, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(5, 9105, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(6, 9106, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(7, 9107, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(8, 9108, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(9, 9109, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(10, 9110, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(11, 9111, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(12, 9112, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(13, 9113, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(14, 9114, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(15, 9115, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(16, 9116, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(17, 9117, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(18, 9118, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(19, 9119, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(20, 9120, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(1, 1, 9101, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(2, 1, 9102, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(3, 1, 9103, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(4, 1, 9104, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(5, 1, 9105, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(6, 1, 9106, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(7, 1, 9107, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(8, 1, 9108, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(9, 1, 9109, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(10, 1, 9110, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(11, 1, 9111, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(12, 1, 9112, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(13, 1, 9113, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(14, 1, 9114, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(15, 1, 9115, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(16, 1, 9116, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(17, 1, 9117, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(18, 1, 9118, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(19, 1, 9119, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
INSERT INTO port_pool(`id`, `group_id`, `port`, `enable`, `create_time`, `update_time`) VALUES
|
||||
(20, 1, 9120, 1, STRFTIME('%s000', 'NOW'), STRFTIME('%s000', 'NOW'));
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
ALTER TABLE port_pool ADD group_id INTEGER NOT NULL DEFAULT 1;
|
||||
|
||||
#端口分组
|
||||
CREATE TABLE IF NOT EXISTS `port_group` (
|
||||
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
|
||||
`name` VARCHAR(255) NOT NULL,
|
||||
`possessor_type` INTEGER NOT NULL DEFAULT '0',
|
||||
`possessor_id` INTEGER NOT NULL DEFAULT '-1',
|
||||
`enable` INTEGER NOT NULL,
|
||||
`create_time` datetime(3) NOT NULL,
|
||||
`update_time` datetime(3) NOT NULL
|
||||
);
|
||||
@@ -4,236 +4,244 @@ const htmlModules = require('./config/htmlModules.js');
|
||||
|
||||
module.exports = {
|
||||
|
||||
theme: 'vdoing', // 使用依赖包主题
|
||||
// theme: require.resolve('../../vdoing'), // 使用本地主题 (先将vdoing主题文件下载到本地:https://github.com/xugaoyi/vuepress-theme-vdoing)
|
||||
theme: 'vdoing', // 使用依赖包主题
|
||||
// theme: require.resolve('../../vdoing'), // 使用本地主题 (先将vdoing主题文件下载到本地:https://github.com/xugaoyi/vuepress-theme-vdoing)
|
||||
|
||||
title: "中微子代理",
|
||||
description: '一个基于VuePress的 知识管理&博客 主题',
|
||||
// base: '/', // 默认'/'。如果你想将你的网站部署到如 https://foo.github.io/bar/,那么 base 应该被设置成 "/bar/",(否则页面将失去样式等文件)
|
||||
head: [ // 注入到页面<head> 中的标签,格式[tagName, { attrName: attrValue }, innerHTML?]
|
||||
['link', { rel: 'icon', href: '/img/favicon.ico' }], //favicons,资源放在public文件夹
|
||||
['meta', { name: 'keywords', content: 'vuepress,theme,blog,vdoing' }],
|
||||
['meta', { name: 'theme-color', content: '#11a8cd' }], // 移动浏览器主题颜色
|
||||
title: "中微子代理",
|
||||
description: '一个基于 netty 的、开源的 java 内网穿透项目',
|
||||
base: '/neutrino-proxy-vuepress/', // 默认'/'。如果你想将你的网站部署到如 https://foo.github.io/bar/,那么 base 应该被设置成 "/bar/",(否则页面将失去样式等文件)
|
||||
head: [ // 注入到页面<head> 中的标签,格式[tagName, { attrName: attrValue }, innerHTML?]
|
||||
['link', {rel: 'icon', href: '/img/favicon.ico'}], //favicons,资源放在public文件夹
|
||||
['meta', {name: 'keywords', content: 'vuepress,theme,blog,vdoing'}],
|
||||
['meta', {name: 'theme-color', content: '#11a8cd'}], // 移动浏览器主题颜色
|
||||
|
||||
['meta', { name: 'wwads-cn-verify', content: '6c4b761a28b734fe93831e3fb400ce87' }], // 广告相关,你可以去掉
|
||||
['script', { src: 'https://cdn.wwads.cn/js/makemoney.js', type: 'text/javascript' }], // 广告相关,你可以去掉
|
||||
],
|
||||
// ['meta', { name: 'wwads-cn-verify', content: '6c4b761a28b734fe93831e3fb400ce87' }], // 广告相关,你可以去掉
|
||||
// ['script', { src: 'https://cdn.wwads.cn/js/makemoney.js', type: 'text/javascript' }], // 广告相关,你可以去掉
|
||||
],
|
||||
|
||||
// 主题配置
|
||||
themeConfig: {
|
||||
// nav: [
|
||||
// { text: '首页', link: '/' },
|
||||
// {
|
||||
// text: '指南', link: '/pages/a2f161/', items: [
|
||||
// { text: '主题初衷与诞生', link: '/pages/52d5c3/' },
|
||||
// { text: '介绍', link: '/pages/a2f161/' },
|
||||
// { text: '快速上手', link: '/pages/793dcb/' },
|
||||
// { text: '目录结构', link: '/pages/2f674a/' },
|
||||
// { text: '核心配置和约定', link: '/pages/33d574/' },
|
||||
// { text: '自动生成front matter', link: '/pages/088c16/' },
|
||||
// { text: 'Markdown 容器', link: '/pages/d0d7eb/' },
|
||||
// { text: 'Markdown 中使用组件', link: '/pages/197691/' },
|
||||
// {
|
||||
// text: '相关文章', items: [
|
||||
// { text: '使目录栏支持h2~h6标题', link: '/pages/8dfab5/' },
|
||||
// { text: '如何让你的笔记更有表现力', link: '/pages/dd027d/' },
|
||||
// { text: '批量操作front matter工具', link: '/pages/2b8e22/' },
|
||||
// { text: '部署', link: '/pages/0fc1d2/' },
|
||||
// { text: '关于写文章和H1标题', link: '/pages/9ae0bd/' },
|
||||
// { text: '关于博客搭建与管理', link: '/pages/26997d/' },
|
||||
// { text: '在线编辑和新增文章的方法', link: '/pages/c5a54d/' },
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// text: '配置', link: '/pages/a20ce8/', items: [
|
||||
// { text: '主题配置', link: '/pages/a20ce8/' },
|
||||
// { text: '首页配置', link: '/pages/f14bdb/' },
|
||||
// { text: 'front matter配置', link: '/pages/3216b0/' },
|
||||
// { text: '目录页配置', link: '/pages/54651a/' },
|
||||
// { text: '添加摘要', link: '/pages/1cc523/' },
|
||||
// { text: '修改主题颜色和样式', link: '/pages/f51918/' },
|
||||
// { text: '评论栏', link: '/pages/ce175c/' },
|
||||
// ]
|
||||
// },
|
||||
// { text: '资源', link: '/pages/db78e2/' },
|
||||
// { text: '案例', link: '/pages/5d571c/' },
|
||||
// { text: '问答', link: '/pages/9cc27d/' },
|
||||
// { text: '赞助', link: '/pages/1b12ed/' },
|
||||
// ],
|
||||
nav: [
|
||||
{ text: '首页', link: '/' },
|
||||
{
|
||||
text: '使用教程', link: '/pages/a2f161/', items: [
|
||||
{ text: '主题初衷与诞生', link: '/pages/52d5c3/' },
|
||||
{ text: '介绍', link: '/pages/a2f161/' },
|
||||
{ text: '快速上手', link: '/pages/793dcb/' },
|
||||
{ text: '目录结构', link: '/pages/2f674a/' },
|
||||
{ text: '核心配置和约定', link: '/pages/33d574/' },
|
||||
{ text: '自动生成front matter', link: '/pages/088c16/' },
|
||||
{ text: 'Markdown 容器', link: '/pages/d0d7eb/' },
|
||||
{ text: 'Markdown 中使用组件', link: '/pages/197691/' }
|
||||
// 主题配置
|
||||
themeConfig: {
|
||||
// nav: [
|
||||
// { text: '首页', link: '/' },
|
||||
// {
|
||||
// text: '指南', link: '/pages/a2f161/', items: [
|
||||
// { text: '主题初衷与诞生', link: '/pages/52d5c3/' },
|
||||
// { text: '介绍', link: '/pages/a2f161/' },
|
||||
// { text: '快速上手', link: '/pages/793dcb/' },
|
||||
// { text: '目录结构', link: '/pages/2f674a/' },
|
||||
// { text: '核心配置和约定', link: '/pages/33d574/' },
|
||||
// { text: '自动生成front matter', link: '/pages/088c16/' },
|
||||
// { text: 'Markdown 容器', link: '/pages/d0d7eb/' },
|
||||
// { text: 'Markdown 中使用组件', link: '/pages/197691/' },
|
||||
// {
|
||||
// text: '相关文章', items: [
|
||||
// { text: '使目录栏支持h2~h6标题', link: '/pages/8dfab5/' },
|
||||
// { text: '如何让你的笔记更有表现力', link: '/pages/dd027d/' },
|
||||
// { text: '批量操作front matter工具', link: '/pages/2b8e22/' },
|
||||
// { text: '部署', link: '/pages/0fc1d2/' },
|
||||
// { text: '关于写文章和H1标题', link: '/pages/9ae0bd/' },
|
||||
// { text: '关于博客搭建与管理', link: '/pages/26997d/' },
|
||||
// { text: '在线编辑和新增文章的方法', link: '/pages/c5a54d/' },
|
||||
// ]
|
||||
// }
|
||||
// ]
|
||||
// },
|
||||
// {
|
||||
// text: '配置', link: '/pages/a20ce8/', items: [
|
||||
// { text: '主题配置', link: '/pages/a20ce8/' },
|
||||
// { text: '首页配置', link: '/pages/f14bdb/' },
|
||||
// { text: 'front matter配置', link: '/pages/3216b0/' },
|
||||
// { text: '目录页配置', link: '/pages/54651a/' },
|
||||
// { text: '添加摘要', link: '/pages/1cc523/' },
|
||||
// { text: '修改主题颜色和样式', link: '/pages/f51918/' },
|
||||
// { text: '评论栏', link: '/pages/ce175c/' },
|
||||
// ]
|
||||
// },
|
||||
// { text: '资源', link: '/pages/db78e2/' },
|
||||
// { text: '案例', link: '/pages/5d571c/' },
|
||||
// { text: '问答', link: '/pages/9cc27d/' },
|
||||
// { text: '赞助', link: '/pages/1b12ed/' },
|
||||
// ],
|
||||
nav: [
|
||||
{text: '首页', link: '/'},
|
||||
{
|
||||
text: '快速使用', link: '/pages/793dcb/', items: [
|
||||
{text: '快速上手', link: '/pages/793dcb/'},
|
||||
{text: '目录结构', link: '/pages/2f674a/'},
|
||||
{text: 'Markdown 容器', link: '/pages/d0d7eb/'},
|
||||
{text: 'Markdown 中使用组件', link: '/pages/197691/'},
|
||||
{
|
||||
text: '相关文章', items: [
|
||||
{text: '使目录栏支持h2~h6标题', link: '/pages/8dfab5/'},
|
||||
{text: '如何让你的笔记更有表现力', link: '/pages/dd027d/'},
|
||||
{text: '批量操作front matter工具', link: '/pages/2b8e22/'},
|
||||
{text: '部署', link: '/pages/0fc1d2/'},
|
||||
{text: '关于写文章和H1标题', link: '/pages/9ae0bd/'},
|
||||
{text: '关于博客搭建与管理', link: '/pages/26997d/'},
|
||||
{text: '在线编辑和新增文章的方法', link: '/pages/c5a54d/'},
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
text: '常见问题', link: '/pages/a20ce8/', items: [
|
||||
{text: '主题配置', link: '/pages/a20ce8/'},
|
||||
{text: '首页配置', link: '/pages/f14bdb/'},
|
||||
{text: 'front matter配置', link: '/pages/3216b0/'},
|
||||
{text: '目录页配置', link: '/pages/54651a/'},
|
||||
{text: '添加摘要', link: '/pages/1cc523/'},
|
||||
{text: '修改主题颜色和样式', link: '/pages/f51918/'},
|
||||
{text: '评论栏', link: '/pages/ce175c/'},
|
||||
]
|
||||
},
|
||||
{text: '演示', link: '/pages/db78e2/'},
|
||||
{text: '案例', link: '/pages/5d571c/'},
|
||||
{text: '最近更新', link: '/pages/9cc27d/'},
|
||||
{text: '关于我们', link: '/pages/1b12ed/'},
|
||||
],
|
||||
sidebarDepth: 2, // 侧边栏显示深度,默认1,最大2(显示到h3标题)
|
||||
logo: '/img/logo.png', // 导航栏logo
|
||||
// repo: 'aoshiguchen/neutrino-proxy', // 导航栏右侧生成Github链接
|
||||
repo: 'https://gitee.com/dromara/neutrino-proxy', // 导航栏右侧生成Github链接
|
||||
repoLabel: 'Gitee地址',
|
||||
searchMaxSuggestions: 10, // 搜索结果显示最大数
|
||||
lastUpdated: '上次更新', // 更新的时间,及前缀文字 string | boolean (取值为git提交时间)
|
||||
|
||||
// docsDir: 'docs', // 编辑的文件夹
|
||||
// editLinks: true, // 编辑链接
|
||||
// editLinkText: '编辑',
|
||||
|
||||
// 以下配置是Vdoing主题改动的和新增的配置
|
||||
sidebar: {mode: 'structuring', collapsable: false}, // 侧边栏 'structuring' | { mode: 'structuring', collapsable: Boolean} | 'auto' | 自定义 温馨提示:目录页数据依赖于结构化的侧边栏数据,如果你不设置为'structuring',将无法使用目录页
|
||||
|
||||
// sidebarOpen: false, // 初始状态是否打开侧边栏,默认true
|
||||
updateBar: { // 最近更新栏
|
||||
showToArticle: false, // 显示到文章页底部,默认true
|
||||
// moreArticle: '/archives' // “更多文章”跳转的页面,默认'/archives'
|
||||
},
|
||||
// titleBadge: false, // 文章标题前的图标是否显示,默认true
|
||||
// titleBadgeIcons: [ // 文章标题前图标的地址,默认主题内置图标
|
||||
// '图标地址1',
|
||||
// '图标地址2'
|
||||
// ],
|
||||
|
||||
pageStyle: 'line', // 页面风格,可选值:'card'卡片 | 'line' 线(未设置bodyBgImg时才生效), 默认'card'。 说明:card时背景显示灰色衬托出卡片样式,line时背景显示纯色,并且部分模块带线条边框
|
||||
|
||||
// contentBgStyle: 1,
|
||||
|
||||
category: false, // 是否打开分类功能,默认true。 如打开,会做的事情有:1. 自动生成的frontmatter包含分类字段 2.页面中显示与分类相关的信息和模块 3.自动生成分类页面(在@pages文件夹)。如关闭,则反之。
|
||||
tag: false, // 是否打开标签功能,默认true。 如打开,会做的事情有:1. 自动生成的frontmatter包含标签字段 2.页面中显示与标签相关的信息和模块 3.自动生成标签页面(在@pages文件夹)。如关闭,则反之。
|
||||
// archive: false, // 是否打开归档功能,默认true。 如打开,会做的事情有:1.自动生成归档页面(在@pages文件夹)。如关闭,则反之。
|
||||
|
||||
author: { // 文章默认的作者信息,可在md文件中单独配置此信息 String | {name: String, href: String}
|
||||
name: '傲世孤尘', // 必需
|
||||
href: 'https://gitee.com/dromara/neutrino-proxy' // 可选的
|
||||
},
|
||||
social: { // 社交图标,显示于博主信息栏和页脚栏
|
||||
// iconfontCssFile: '//at.alicdn.com/t/font_1678482_u4nrnp8xp6g.css', // 可选,阿里图标库在线css文件地址,对于主题没有的图标可自由添加
|
||||
icons: [
|
||||
{
|
||||
iconClass: 'icon-youjian',
|
||||
title: '发邮件',
|
||||
link: 'mailto:[email protected]'
|
||||
},
|
||||
{
|
||||
iconClass: 'icon-gitee',
|
||||
title: 'Gitee',
|
||||
link: 'https://gitee.com/dromara/neutrino-proxy'
|
||||
},
|
||||
{
|
||||
iconClass: 'icon-github',
|
||||
title: 'Github',
|
||||
link: 'https://github.com/aoshiguchen/neutrino-proxy'
|
||||
}
|
||||
]
|
||||
},
|
||||
footer: { // 页脚信息
|
||||
createYear: 2023, // 博客创建年份
|
||||
copyrightInfo: '傲世孤尘 | MIT License', // 博客版权信息,支持a标签
|
||||
},
|
||||
htmlModules,
|
||||
},
|
||||
|
||||
// 插件
|
||||
plugins: [
|
||||
// [require('./plugins/love-me'), { // 鼠标点击爱心特效
|
||||
// color: '#11a8cd', // 爱心颜色,默认随机色
|
||||
// excludeClassName: 'theme-vdoing-content' // 要排除元素的class, 默认空''
|
||||
// }],
|
||||
|
||||
['fulltext-search'], // 全文搜索
|
||||
|
||||
// ['thirdparty-search', { // 可以添加第三方搜索链接的搜索框(原官方搜索框的参数仍可用)
|
||||
// thirdparty: [ // 可选,默认 []
|
||||
// {
|
||||
// title: '在GitHub中搜索',
|
||||
// frontUrl: 'https://github.com/search?q=', // 搜索链接的前面部分
|
||||
// behindUrl: '' // 搜索链接的后面部分,可选,默认 ''
|
||||
// },
|
||||
// {
|
||||
// title: '在npm中搜索',
|
||||
// frontUrl: 'https://www.npmjs.com/search?q=',
|
||||
// },
|
||||
// {
|
||||
// title: '在Bing中搜索',
|
||||
// frontUrl: 'https://cn.bing.com/search?q='
|
||||
// }
|
||||
// ]
|
||||
// }],
|
||||
|
||||
[
|
||||
'vuepress-plugin-baidu-tongji', // 百度统计
|
||||
{
|
||||
hm: baiduCode || '01293bffa6c3962016c08ba685c79d78'
|
||||
}
|
||||
],
|
||||
|
||||
['one-click-copy', { // 代码块复制按钮
|
||||
copySelector: ['div[class*="language-"] pre', 'div[class*="aside-code"] aside'], // String or Array
|
||||
copyMessage: '复制成功', // default is 'Copy successfully and then paste it for use.'
|
||||
duration: 1000, // prompt message display time.
|
||||
showInMobile: false // whether to display on the mobile side, default: false.
|
||||
}],
|
||||
['demo-block', { // demo演示模块 https://github.com/xiguaxigua/vuepress-plugin-demo-block
|
||||
settings: {
|
||||
// jsLib: ['http://xxx'], // 在线示例(jsfiddle, codepen)中的js依赖
|
||||
// cssLib: ['http://xxx'], // 在线示例中的css依赖
|
||||
// vue: 'https://fastly.jsdelivr.net/npm/vue/dist/vue.min.js', // 在线示例中的vue依赖
|
||||
jsfiddle: false, // 是否显示 jsfiddle 链接
|
||||
codepen: true, // 是否显示 codepen 链接
|
||||
horizontal: false // 是否展示为横向样式
|
||||
}
|
||||
}],
|
||||
[
|
||||
'vuepress-plugin-zooming', // 放大图片
|
||||
{
|
||||
selector: '.theme-vdoing-content img:not(.no-zoom)',
|
||||
options: {
|
||||
bgColor: 'rgba(0,0,0,0.6)'
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
'@vuepress/last-updated', // "上次更新"时间格式
|
||||
{
|
||||
transformer: (timestamp, lang) => {
|
||||
const dayjs = require('dayjs') // https://day.js.org/
|
||||
return dayjs(timestamp).format('YYYY/MM/DD, HH:mm:ss')
|
||||
},
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
text: '常见问题', link: '/pages/a20ce8/', items: [
|
||||
{ text: '主题配置', link: '/pages/a20ce8/' },
|
||||
{ text: '首页配置', link: '/pages/f14bdb/' },
|
||||
{ text: 'front matter配置', link: '/pages/3216b0/' },
|
||||
{ text: '目录页配置', link: '/pages/54651a/' },
|
||||
{ text: '添加摘要', link: '/pages/1cc523/' },
|
||||
{ text: '修改主题颜色和样式', link: '/pages/f51918/' },
|
||||
{ text: '评论栏', link: '/pages/ce175c/' },
|
||||
]
|
||||
},
|
||||
{ text: '演示', link: '/pages/db78e2/' },
|
||||
{ text: '案例', link: '/pages/5d571c/' },
|
||||
{ text: '最近更新', link: '/pages/9cc27d/' },
|
||||
{ text: '仓库地址', link: '/pages/1b12ed/' },
|
||||
],
|
||||
sidebarDepth: 2, // 侧边栏显示深度,默认1,最大2(显示到h3标题)
|
||||
logo: '/img/logo.png', // 导航栏logo
|
||||
repo: 'xugaoyi/vuepress-theme-vdoing', // 导航栏右侧生成Github链接
|
||||
// repo: 'https://gitee.com/dromara/neutrino-proxy', // 导航栏右侧生成Github链接
|
||||
searchMaxSuggestions: 10, // 搜索结果显示最大数
|
||||
lastUpdated: '上次更新', // 更新的时间,及前缀文字 string | boolean (取值为git提交时间)
|
||||
|
||||
// docsDir: 'docs', // 编辑的文件夹
|
||||
// editLinks: true, // 编辑链接
|
||||
// editLinkText: '编辑',
|
||||
|
||||
// 以下配置是Vdoing主题改动的和新增的配置
|
||||
sidebar: { mode: 'structuring', collapsable: false }, // 侧边栏 'structuring' | { mode: 'structuring', collapsable: Boolean} | 'auto' | 自定义 温馨提示:目录页数据依赖于结构化的侧边栏数据,如果你不设置为'structuring',将无法使用目录页
|
||||
|
||||
// sidebarOpen: false, // 初始状态是否打开侧边栏,默认true
|
||||
updateBar: { // 最近更新栏
|
||||
showToArticle: false, // 显示到文章页底部,默认true
|
||||
// moreArticle: '/archives' // “更多文章”跳转的页面,默认'/archives'
|
||||
},
|
||||
// titleBadge: false, // 文章标题前的图标是否显示,默认true
|
||||
// titleBadgeIcons: [ // 文章标题前图标的地址,默认主题内置图标
|
||||
// '图标地址1',
|
||||
// '图标地址2'
|
||||
// ],
|
||||
|
||||
pageStyle: 'line', // 页面风格,可选值:'card'卡片 | 'line' 线(未设置bodyBgImg时才生效), 默认'card'。 说明:card时背景显示灰色衬托出卡片样式,line时背景显示纯色,并且部分模块带线条边框
|
||||
|
||||
// contentBgStyle: 1,
|
||||
|
||||
category: false, // 是否打开分类功能,默认true。 如打开,会做的事情有:1. 自动生成的frontmatter包含分类字段 2.页面中显示与分类相关的信息和模块 3.自动生成分类页面(在@pages文件夹)。如关闭,则反之。
|
||||
tag: false, // 是否打开标签功能,默认true。 如打开,会做的事情有:1. 自动生成的frontmatter包含标签字段 2.页面中显示与标签相关的信息和模块 3.自动生成标签页面(在@pages文件夹)。如关闭,则反之。
|
||||
// archive: false, // 是否打开归档功能,默认true。 如打开,会做的事情有:1.自动生成归档页面(在@pages文件夹)。如关闭,则反之。
|
||||
|
||||
author: { // 文章默认的作者信息,可在md文件中单独配置此信息 String | {name: String, href: String}
|
||||
name: 'Evan Xu', // 必需
|
||||
href: 'https://github.com/xugaoyi' // 可选的
|
||||
},
|
||||
social: { // 社交图标,显示于博主信息栏和页脚栏
|
||||
// iconfontCssFile: '//at.alicdn.com/t/font_1678482_u4nrnp8xp6g.css', // 可选,阿里图标库在线css文件地址,对于主题没有的图标可自由添加
|
||||
icons: [
|
||||
{
|
||||
iconClass: 'icon-youjian',
|
||||
title: '发邮件',
|
||||
link: 'mailto:[email protected]'
|
||||
},
|
||||
{
|
||||
iconClass: 'icon-gitee',
|
||||
title: 'Gitee',
|
||||
link: 'https://gitee.com/dromara/neutrino-proxy'
|
||||
},
|
||||
{
|
||||
iconClass: 'icon-github',
|
||||
title: 'Github',
|
||||
link: 'https://github.com/aoshiguchen/neutrino-proxy'
|
||||
}
|
||||
]
|
||||
},
|
||||
footer: { // 页脚信息
|
||||
createYear: 2023, // 博客创建年份
|
||||
copyrightInfo: '傲世孤尘 | MIT License', // 博客版权信息,支持a标签
|
||||
},
|
||||
htmlModules,
|
||||
},
|
||||
|
||||
// 插件
|
||||
plugins: [
|
||||
// [require('./plugins/love-me'), { // 鼠标点击爱心特效
|
||||
// color: '#11a8cd', // 爱心颜色,默认随机色
|
||||
// excludeClassName: 'theme-vdoing-content' // 要排除元素的class, 默认空''
|
||||
// }],
|
||||
|
||||
['fulltext-search'], // 全文搜索
|
||||
|
||||
// ['thirdparty-search', { // 可以添加第三方搜索链接的搜索框(原官方搜索框的参数仍可用)
|
||||
// thirdparty: [ // 可选,默认 []
|
||||
// {
|
||||
// title: '在GitHub中搜索',
|
||||
// frontUrl: 'https://github.com/search?q=', // 搜索链接的前面部分
|
||||
// behindUrl: '' // 搜索链接的后面部分,可选,默认 ''
|
||||
// },
|
||||
// {
|
||||
// title: '在npm中搜索',
|
||||
// frontUrl: 'https://www.npmjs.com/search?q=',
|
||||
// },
|
||||
// {
|
||||
// title: '在Bing中搜索',
|
||||
// frontUrl: 'https://cn.bing.com/search?q='
|
||||
// }
|
||||
// ]
|
||||
// }],
|
||||
|
||||
[
|
||||
'vuepress-plugin-baidu-tongji', // 百度统计
|
||||
{
|
||||
hm: baiduCode || '01293bffa6c3962016c08ba685c79d78'
|
||||
}
|
||||
],
|
||||
|
||||
['one-click-copy', { // 代码块复制按钮
|
||||
copySelector: ['div[class*="language-"] pre', 'div[class*="aside-code"] aside'], // String or Array
|
||||
copyMessage: '复制成功', // default is 'Copy successfully and then paste it for use.'
|
||||
duration: 1000, // prompt message display time.
|
||||
showInMobile: false // whether to display on the mobile side, default: false.
|
||||
}],
|
||||
['demo-block', { // demo演示模块 https://github.com/xiguaxigua/vuepress-plugin-demo-block
|
||||
settings: {
|
||||
// jsLib: ['http://xxx'], // 在线示例(jsfiddle, codepen)中的js依赖
|
||||
// cssLib: ['http://xxx'], // 在线示例中的css依赖
|
||||
// vue: 'https://fastly.jsdelivr.net/npm/vue/dist/vue.min.js', // 在线示例中的vue依赖
|
||||
jsfiddle: false, // 是否显示 jsfiddle 链接
|
||||
codepen: true, // 是否显示 codepen 链接
|
||||
horizontal: false // 是否展示为横向样式
|
||||
}
|
||||
}],
|
||||
[
|
||||
'vuepress-plugin-zooming', // 放大图片
|
||||
{
|
||||
selector: '.theme-vdoing-content img:not(.no-zoom)',
|
||||
options: {
|
||||
bgColor: 'rgba(0,0,0,0.6)'
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
'@vuepress/last-updated', // "上次更新"时间格式
|
||||
{
|
||||
transformer: (timestamp, lang) => {
|
||||
const dayjs = require('dayjs') // https://day.js.org/
|
||||
return dayjs(timestamp).format('YYYY/MM/DD, HH:mm:ss')
|
||||
},
|
||||
}
|
||||
markdown: {
|
||||
// lineNumbers: true,
|
||||
extractHeaders: ['h2', 'h3', 'h4', 'h5', 'h6'], // 提取标题到侧边栏的级别,默认['h2', 'h3']
|
||||
},
|
||||
|
||||
// 监听文件变化并重新构建
|
||||
extraWatchFiles: [
|
||||
'.vuepress/config.js',
|
||||
'.vuepress/config/htmlModules.js',
|
||||
]
|
||||
],
|
||||
|
||||
markdown: {
|
||||
// lineNumbers: true,
|
||||
extractHeaders: ['h2', 'h3', 'h4', 'h5', 'h6'], // 提取标题到侧边栏的级别,默认['h2', 'h3']
|
||||
},
|
||||
|
||||
// 监听文件变化并重新构建
|
||||
extraWatchFiles: [
|
||||
'.vuepress/config.js',
|
||||
'.vuepress/config/htmlModules.js',
|
||||
]
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ module.exports = {
|
||||
</style>
|
||||
`,
|
||||
// 赞助商广告
|
||||
sidebarT: `<a href="http://apifox.cn/a103xugaoyi" target="_blank"><img src="https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/431669861564_.2470ykdcpbds.jpg" alt="npm" class="no-zoom" style="width: 100%;border-radius: 2px;"></a>`,
|
||||
// sidebarT: `<a href="http://apifox.cn/a103xugaoyi" target="_blank"><img src="https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/431669861564_.2470ykdcpbds.jpg" alt="npm" class="no-zoom" style="width: 100%;border-radius: 2px;"></a>`,
|
||||
|
||||
|
||||
// windowRB: `
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/**
|
||||
* to主题使用者:你可以去掉本文件的所有代码
|
||||
*/
|
||||
export default ({
|
||||
Vue, // VuePress 正在使用的 Vue 构造函数
|
||||
options, // 附加到根实例的一些选项
|
||||
router, // 当前应用的路由实例
|
||||
siteData, // 站点元数据
|
||||
isServer // 当前应用配置是处于 服务端渲染 还是 客户端
|
||||
}) => {
|
||||
|
||||
// 用于监控在路由变化时检查广告拦截器 (to主题使用者:你可以去掉本文件的所有代码)
|
||||
if (!isServer) {
|
||||
router.afterEach(() => {
|
||||
//check if wwads' fire function was blocked after document is ready with 3s timeout (waiting the ad loading)
|
||||
docReady(function () {
|
||||
setTimeout(function () {
|
||||
if (window._AdBlockInit === undefined) {
|
||||
ABDetected();
|
||||
}
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
// 删除事件改为隐藏事件
|
||||
setTimeout(() => {
|
||||
const pageAD = document.querySelector('.page-wwads');
|
||||
if (!pageAD) return;
|
||||
const btnEl = pageAD.querySelector('.wwads-hide');
|
||||
if (btnEl) {
|
||||
btnEl.onclick = () => {
|
||||
pageAD.style.display = 'none';
|
||||
}
|
||||
}
|
||||
// 显示广告模块
|
||||
if (pageAD.style.display === 'none') {
|
||||
pageAD.style.display = 'flex';
|
||||
}
|
||||
}, 900);
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ABDetected() {
|
||||
const h = "<style>.wwads-horizontal,.wwads-vertical{background-color:#f4f8fa;padding:5px;min-height:120px;margin-top:20px;box-sizing:border-box;border-radius:3px;font-family:sans-serif;display:flex;min-width:150px;position:relative;overflow:hidden;}.wwads-horizontal{flex-wrap:wrap;justify-content:center}.wwads-vertical{flex-direction:column;align-items:center;padding-bottom:32px}.wwads-horizontal a,.wwads-vertical a{text-decoration:none}.wwads-horizontal .wwads-img,.wwads-vertical .wwads-img{margin:5px}.wwads-horizontal .wwads-content,.wwads-vertical .wwads-content{margin:5px}.wwads-horizontal .wwads-content{flex:130px}.wwads-vertical .wwads-content{margin-top:10px}.wwads-horizontal .wwads-text,.wwads-content .wwads-text{font-size:14px;line-height:1.4;color:#0e1011;-webkit-font-smoothing:antialiased}.wwads-horizontal .wwads-poweredby,.wwads-vertical .wwads-poweredby{display:block;font-size:11px;color:#a6b7bf;margin-top:1em}.wwads-vertical .wwads-poweredby{position:absolute;left:10px;bottom:10px}.wwads-horizontal .wwads-poweredby span,.wwads-vertical .wwads-poweredby span{transition:all 0.2s ease-in-out;margin-left:-1em}.wwads-horizontal .wwads-poweredby span:first-child,.wwads-vertical .wwads-poweredby span:first-child{opacity:0}.wwads-horizontal:hover .wwads-poweredby span,.wwads-vertical:hover .wwads-poweredby span{opacity:1;margin-left:0}.wwads-horizontal .wwads-hide,.wwads-vertical .wwads-hide{position:absolute;right:-23px;bottom:-23px;width:46px;height:46px;border-radius:23px;transition:all 0.3s ease-in-out;cursor:pointer;}.wwads-horizontal .wwads-hide:hover,.wwads-vertical .wwads-hide:hover{background:rgb(0 0 0 /0.05)}.wwads-horizontal .wwads-hide svg,.wwads-vertical .wwads-hide svg{position:absolute;left:10px;top:10px;fill:#a6b7bf}.wwads-horizontal .wwads-hide:hover svg,.wwads-vertical .wwads-hide:hover svg{fill:#3E4546}</style><a href='https://wwads.cn/page/whitelist-wwads' class='wwads-img' target='_blank' rel='nofollow'><img src='https://fastly.jsdelivr.net/gh/xugaoyi/image_store@master/blog/wwads.2a3pidhlh4ys.webp' width='130'></a><div class='wwads-content'><a href='https://wwads.cn/page/whitelist-wwads' class='wwads-text' target='_blank' rel='nofollow'>为了本站的长期运营,请将我们的网站加入广告拦截器的白名单,感谢您的支持!<span style='color: #11a8cd'>如何添加白名单?</span></a><a href='https://wwads.cn/page/end-user-privacy' class='wwads-poweredby' title='万维广告 ~ 让广告更优雅,且有用' target='_blank'><span>广告</span></a></div><a class='wwads-hide' onclick='parentNode.remove()' title='隐藏广告'><svg xmlns='http://www.w3.org/2000/svg' width='6' height='7'><path d='M.879.672L3 2.793 5.121.672a.5.5 0 11.707.707L3.708 3.5l2.12 2.121a.5.5 0 11-.707.707l-2.12-2.12-2.122 2.12a.5.5 0 11-.707-.707l2.121-2.12L.172 1.378A.5.5 0 01.879.672z'></path></svg></a>";
|
||||
const wwadsEl = document.getElementsByClassName("wwads-cn");
|
||||
const wwadsContentEl = document.querySelector('.wwads-content');
|
||||
if (wwadsEl[0] && !wwadsContentEl) {
|
||||
wwadsEl[0].innerHTML = h;
|
||||
}
|
||||
};
|
||||
|
||||
//check document ready
|
||||
function docReady(t) {
|
||||
"complete" === document.readyState ||
|
||||
"interactive" === document.readyState
|
||||
? setTimeout(t, 1)
|
||||
: document.addEventListener("DOMContentLoaded", t);
|
||||
}
|
||||
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 521 KiB |
|
After Width: | Height: | Size: 276 KiB |
|
After Width: | Height: | Size: 183 KiB |
|
After Width: | Height: | Size: 216 KiB |
|
After Width: | Height: | Size: 425 KiB |
|
After Width: | Height: | Size: 202 KiB |
@@ -0,0 +1,150 @@
|
||||
---
|
||||
title: 快速上手
|
||||
date: 2020-05-11 13:54:40
|
||||
permalink: /pages/793dcb
|
||||
article: false
|
||||
---
|
||||
|
||||
## 1. 打包
|
||||
可直接前往Gitee仓库发行版页面下载所需版本已打好的包。若需手动打包,则可参照下面的执行命令:
|
||||
```text
|
||||
# 服务端打包
|
||||
mvn clean install -U -pl neutrino-proxy-server -am -Dmaven.test.skip=true
|
||||
|
||||
# 客户端打包
|
||||
clean install -U -pl neutrino-proxy-client -am -Dmaven.test.skip=true
|
||||
|
||||
# 管理后台前端项目打包(本地环境,local改为dev则为dev环境,同时需要修改config目录下面的环境配置)
|
||||
npm run build:local
|
||||
```
|
||||
|
||||
## 2. 部署
|
||||
### 2.2 服务端部署
|
||||
- 使用常规的jar包部署方式即可,如:java -jar xxxx
|
||||
### 2.4 管理后台部署
|
||||
- Nginx方式部署(推荐):
|
||||
```conf
|
||||
server {
|
||||
listen 9527;
|
||||
server_name localhost;
|
||||
|
||||
#开启gzip
|
||||
gzip on;
|
||||
#低于1kb的资源不压缩
|
||||
gzip_min_length 1k;
|
||||
#压缩级别1-9,越大压缩率越高,同时消耗cpu资源也越多,建议设置在5左右。
|
||||
gzip_comp_level 5;
|
||||
#需要压缩哪些响应类型的资源,多个空格隔开。不建议压缩图片.
|
||||
gzip_types text/plain application/javascript application/x-javascript text/javascript text/xml text/css;
|
||||
#配置禁用gzip条件,支持正则。此处表示ie6及以下不启用gzip(因为ie低版本不支持)
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
#是否添加“Vary: Accept-Encoding”响应头
|
||||
gzip_vary on;
|
||||
|
||||
location / {
|
||||
root /work/projects/neutrino-proxy-server/neutrino-proxy-admin/dist;
|
||||
try_files $uri $uri/ /index.html;
|
||||
add_header Last-Modified $date_gmt;
|
||||
}
|
||||
}
|
||||
````
|
||||
- 无nginx时
|
||||
在没有Nginx时,为了快速体验代理效果,可直接使用服务端项目提供的静态资源服务。直接将neutrino-proxy-admin打包后的文件解压放在neutrino-proxy-server.jar同级别目录下即可。例如:服务端配置的web端口为8080,则访问http://服务端IP:8080, 则会直接解析渲染neutrino-proxy-server.jar同级别目录下neutrino-proxy-admin/dist/index.html。
|
||||
|
||||
::: warning
|
||||
需要注意的是,使用服务端自带的静态资源服务时,由于框架目前未支持缓存、gzip压缩,所以访问速度没有使用nginx快,正式使用推荐用nginx。
|
||||
:::
|
||||
|
||||
## 3.配置
|
||||
|
||||
### 3.1 配置端口池
|
||||
端口池的作用是将代理服务需要对外暴露的端口进行集中管理,方便安全组设置时统一操作。
|
||||
|
||||
本项目为了简化首次配置,默认初始化数据会将9101~9120的所有端口加入端口池。可以在服务端项目sql配置(port_pool.data.sql文件)中自行修改初始化数据,也可以运行后在端口池管理页面手动维护。
|
||||
|
||||
首次使用如果为了快速体验,建议直接使用默认端口池,则无需任何配置。
|
||||
|
||||
### 3.2 配置License
|
||||
License是客户端连接代理服务端时所需要的唯一合法凭证,一个License同时只能被一个客户端使用。
|
||||
|
||||
本项目为了简化首次配置,默认为每个用户初始化了一些license。可以在服务端项目sql配置(license.data.sql文件)中自行修改初始化数据,也可以运行后在License管理页面手动维护。
|
||||
|
||||
首次使用如果为了快速体验,建议直接使用默认License,则无需任何配置。
|
||||
|
||||
### 3.3 配置端口映射
|
||||
端口映射是代理的基本单元,一个外网端口在同一时刻被唯一的映射到一个内网IP+端口。所有流出该外网端口的流量都转发自对应的内网端口,同理所有流入该外网端口的流量都会转发到对应的内网端口。
|
||||
|
||||
本项目为了简化首次配置,默认为每个用户初始化了一些端口映射。可以在服务端项目sql配置(port_mapping.data.sql文件)中自行修改初始化数据,也可以运行后在端口映射管理页面手动维护。
|
||||
|
||||
首次使用如果为了快速体验,建议直接使用默认端口映射,则无需任何配置。
|
||||
|
||||
### 3.4 开启代理
|
||||
上述步骤完成后,就可以开始代理自己的局域网设备了。
|
||||
|
||||
比如现在有一个license:a123456,该license配置了一个或多个端口映射,其中包含9010到localhost:8080的映射(localhost表示代理客户端所在主机的端口,可以换成客户端所在局域网的任何IP)。此时修改客户端配置的服务端ip、license等启动客户端,就可以开启代理了,端口映射管理对应的记录在线状态为"在线"则证明代理成功建立。
|
||||
|
||||
该license配置也可以通过客户端启动参数、启动后引导式输入、外置配置提供,为了简化首次体验门槛,这里直接提供一个外置配置模版:
|
||||
```json
|
||||
{
|
||||
"jksPath":"classpath:/test.jks",
|
||||
"licenseKey":"b0a907332b474b25897c4dcb31fc7eb6",
|
||||
"serverIp":"localhost",
|
||||
"serverPort":9002,
|
||||
"sslEnable":true
|
||||
}
|
||||
```
|
||||
修改上述json中的licenseKey,serverIp、serverPort、sslEnabled后,保存文件命名为<font color="#9b6e23">.neutrino-proxy-client.json</font>,放在客户端当前目录下(jar包启动时,放在jar包同级别目录下。idea启动时,放在项目根目录下),然后直接启动客户端。
|
||||
|
||||
此时通过访问外网ip+端口,可以成功访问内网服务。通过此方式,可以代理任何基于TCP之上的协议,如:socket、websocket、http、ftp、ssh等。
|
||||
|
||||
## 4.开发&调试
|
||||
篇幅所限,此处不便赘述管理后台相关的开发,有vue基础的童鞋基本都可以自行开发。服务端的初始化数据足够调试工作,开发过程无需单独在管理页面操作。
|
||||
|
||||
与SpringBoot项目类似,客户端、服务端项目均由一个入口类完成整个项目的启动,分别为ProxyClient、ProxyServer。
|
||||
|
||||
内置配置采用yml风格,主要涉及Http端口、静态资源路径、协议参数、代理服务端端口、jks证书、数据源、license等。整个项目基于neutrino-core,风格类似于SpringBoot。笔者不喜欢因过分炫技而引入过多花式操作,因为项目的定位是个人开发者,且满足使用的同时兼顾学习其原理的需求。基本使用方式与SpringBoot类似,尽可能降低首次学习成本。
|
||||
|
||||
neutrino-core项目test目录下包含众多核心封装的测试代码,通过调试这些代码,能尽可能减少大家学习的障碍。
|
||||
|
||||
|
||||
## 5.运行截图
|
||||
### 用户管理
|
||||
<img :src="$withBase('/img/run-example/user-manager1.png')"></img>
|
||||
### 端口池管理
|
||||
<img :src="$withBase('/img/run-example/port-pool1.png')"></img>
|
||||
### License管理
|
||||
<img :src="$withBase('/img/run-example/license1.png')"></img>
|
||||
### 端口映射管理
|
||||
<img :src="$withBase('/img/run-example/port-mapping1.png')"></img>
|
||||
### 客户端启动示例
|
||||
<img :src="$withBase('/img/run-example/client-run1.png')"></img>
|
||||
|
||||
<!--
|
||||
## 4.开发&调试
|
||||
|
||||
::: tip
|
||||
1. 不建议在原默认vuepress项目上单独安装使用本主题包,而是clone我的整个项目再替换你自己的内容即可。
|
||||
2. 修改`config.js`配置后需要重新启动项目才会生效。
|
||||
3. 更多关于项目上手的问题,请查阅 [问答](/pages/9cc27d/)。
|
||||
:::
|
||||
|
||||
|
||||
## 版本升级
|
||||
|
||||
主题的版本会不定期更新,你只需更新npm主题包即可:
|
||||
```sh
|
||||
npm update vuepress-theme-vdoing
|
||||
```
|
||||
|
||||
::: tip
|
||||
1. 如更新后没起作用或报错,尝试把`node_modules`文件夹删除再`npm i`重新安装。
|
||||
2. 在.vuepress/config.js中,设置`theme: 'vdoing'`才是使用npm主题依赖包:
|
||||
```js
|
||||
// config.js
|
||||
module.exports = {
|
||||
theme: 'vdoing', // npm主题依赖包
|
||||
// theme: require.resolve('../../vdoing'), // 使用本地主题包
|
||||
}
|
||||
```
|
||||
:::
|
||||
-->
|
||||
@@ -6,28 +6,20 @@ article: false
|
||||
---
|
||||
|
||||
```
|
||||
.
|
||||
├── .github (可选,GitHub 相关文件)
|
||||
│ ├── workflows
|
||||
│ │ ├── baiduPush.yml (可选,百度定时自动推送)
|
||||
│ │ └── ci.yml (可选,自动部署)
|
||||
├── docs (必须,不要修改文件夹名称)
|
||||
│ ├── .vuepress (同官方,查看:https://vuepress.vuejs.org/zh/guide/directory-structure.html#目录结构)
|
||||
│ ├── @pages (可选,自动生成的文件夹,存放分类页、标签页、归档页)
|
||||
│ ├── _posts (可选,专门存放碎片化博客文章的文件夹)
|
||||
│ ├── <结构化目录>
|
||||
│ └── index.md (首页)
|
||||
├── vdoing (可选,本地的vdoing主题)
|
||||
├── utils (可选,vdoing主题使用的node工具)
|
||||
│ ├── modules
|
||||
│ ├── config.yml (可选,批量操作front matter配置)
|
||||
│ ├── editFrontmatter.js (可选,批量操作front matter工具)
|
||||
├── baiduPush.sh (可选,百度推送命令脚本)
|
||||
├── deploy.sh (可选,部署命令脚本)
|
||||
│
|
||||
└── package.json
|
||||
|
||||
├── data.db (sqlite数据库文件。若未配置mysql,默认使用sqlite,项目首次启动会自动初始化sqlite数据库。)
|
||||
├── docs (项目相关的一些文档)
|
||||
├── ├── Aop.MD (框架层Aop机制、使用说明)
|
||||
├── └── Channel.MD (内网穿透实现原理、代理实现流程说明)
|
||||
├── lib (项目开启了将自动生成的类保存到本地后,运行过程中动态生成的类自动保存到此处,方便学习、调试)
|
||||
├── neutrino-core (一套手写的基于netty的框架,相当于简易版的SpringBoot + Mybatis + xxljob,计划后期分离为单独开源项目维护)
|
||||
├── neutrino-proxy-admin (基于vue-element-admin开发的一个管理系统,用于可视化操作端口映射、代理数据实时监控)
|
||||
├── neutrino-proxy-client (基于netty的代理客户端,用于和服务端交互、转发内网数据)
|
||||
├── neutrino-proxy-core (代理相关的公共代码(协议、常量))
|
||||
├── neutrino-proxy-server (基于netty的代理服务端,用于和客户段交互,将客户端转发的内网数据转发至外网端口)
|
||||
└── todolist.MD (近期的开发计划)
|
||||
```
|
||||
|
||||
<!--
|
||||
* `docs` 文件夹名称请不要修改
|
||||
|
||||
* `docs/.vuepress` 用于存放全局的配置、样式、静态资源等,同官方,查看 [详情](https://vuepress.vuejs.org/zh/guide/directory-structure.html#目录结构)
|
||||
@@ -69,6 +61,7 @@ article: false
|
||||
**注意**:主题的后续维护升级只对npm主题包负责,就是说你使用本地主题就等于放弃了后续的升级服务。因此,建议能在`docs/.vuepress/`内配置和修改的,就尽量不要改动主题内部代码。
|
||||
|
||||
---
|
||||
-->
|
||||
|
||||
::: tip 提示
|
||||
为了方便您更快的学习和使用本主题,我在代码当中添加了比较多的注释说明。
|
||||
@@ -1,39 +0,0 @@
|
||||
---
|
||||
title: 主题初衷与诞生
|
||||
date: 2020-05-11 13:59:38
|
||||
permalink: /pages/52d5c3
|
||||
article: false
|
||||
---
|
||||
|
||||
这个主题的初衷是打造一个好用的、面向程序员的`知识管理工具`。
|
||||
|
||||
对于程序员来说,繁杂的知识体系难免会有遗忘的地方。如果有一个方便好用的知识管理工具,可以帮助我们很好的管理知识,并能够快速地把遗忘的知识点找回来。
|
||||
|
||||
## Markdown
|
||||
最初接触[Markdown](https://xugaoyi.com/pages/ad247c4332211551/)的时候,我就被它简洁的语法干净的文本结构吸引住,它的代码块和兼容`html`标签的能力更是让我爱上它,很高兴找到了一个高效记录学习笔记的工具。
|
||||
|
||||
## 知识管理
|
||||
在一段学习的日子里,我尝试过用`txt`记录笔记、云笔记、`Markdown`笔记,并把`Markdown`文件上传到`github`进行管理,但总感觉还是不够方便...直到我发现了`VuePress`,它似乎可以管理我的学习笔记,并且把站点部署到`github pages`不就是一个在线的云笔记网站了吗
|
||||
|
||||
## VuePress
|
||||
[VuePress](https://vuepress.vuejs.org/zh/)是一个 Vue 驱动的静态网站生成器,正是以`Markdown`为中心的项目结构,它简洁至上的理念正合我心。对于我这个对Vue还算有一些了解的前端,迫不及待的想去使用它来搭建一个我的云笔记网站。
|
||||
|
||||
## 知识管理&博客主题-Vdoing的诞生
|
||||
我以前的一个领导和我们说过一个好的知识管理可以帮助我们提高开发质量和开发效率,下面这张图就是他想传达的,我表示赞同:
|
||||

|
||||
|
||||
什么是一个好用的知识管理工具呢?其实我也在不断的寻找和思考中。不过我觉得它至少要结构清晰、管理方便,在查找知识点的过程中可以快速的找到,正像上图所说的要在15秒内找到一个知识点,在添加内容的时候可以很方便的添加,并且保证结构清晰。
|
||||
|
||||
VuePress的官方默认主题是专门为写文档而生的,和我心目中的知识库有一些差距,比如在满足结构清晰这点上,每添加一个内容就得手动的添加侧边栏数据,还有在满足15秒内找到一个知识点上还是不够好,因此我觉得需要做一些改造。
|
||||
|
||||
在知识管理方面,有三种典型的知识形态:
|
||||
|
||||
> * 结构化:看重知识的条理性和实用性,有一定专业背景才能看懂
|
||||
> * 碎片化:描述具体的知识点,通俗易懂
|
||||
> * 体系化:对某一领域的完整解读,通常是某类知识的专业之作
|
||||
|
||||
从这三种知识形态出发,我给主题添加了自动生成结构化侧边栏、目录页、面包屑等等。在满足了结构化之后,写博客应该算得上是一种碎片化的形态,我就给主题添加了分类、标签、归档等等。在满足更方便添加内容上,有了自动生成front matter、批量操作front matter等,更多关于主题的知识从开始使用它去探索吧~~
|
||||
|
||||
### 主题名称
|
||||
|
||||
Vdoing,中文大概是维度的意思。起这个名的原因,首先是我看过一个视频《尤雨溪创立vue的心路历程》[B站传送](https://b23.tv/xI9ONW) [youtube传送](https://www.youtube.com/watch?v=OrxmtDw4pVI),里面有讲到vue起名的故事,一开始想起的名其实是Seed.js,但是在npm上被占用了,然后发现vue是一个挺酷的一个词,才决定用vue。发现大佬起名可以这么酷。再者,这个主题我想它可以多维度的快速寻找一个知识点,要么就叫维度吧,那英文名就用Vdoing好了...
|
||||
@@ -1,73 +0,0 @@
|
||||
---
|
||||
title: 介绍
|
||||
date: 2020-05-11 13:54:03
|
||||
permalink: /pages/a2f161
|
||||
article: false
|
||||
---
|
||||
|
||||
|
||||
Vdoing是[VuePress v1.x](https://vuepress.vuejs.org/zh/)的一个主题,是在[默认主题](https://vuepress.vuejs.org/zh/theme/option-api.html)基础上做的修改和扩展,很多配置仍然沿用[官方配置](https://vuepress.vuejs.org/zh/config/)。使用本主题可以很方便的搭建一个结构化的知识库或博客。
|
||||
|
||||
这个主题的初衷是打造一个好用的、面向程序员的知识管理工具:
|
||||
[**主题初衷与诞生**。](/pages/52d5c3/)
|
||||
|
||||
::: warning 注意
|
||||
1. Node请使用`v14.17.x`或以上版本
|
||||
2. 在使用本主题前,要求你至少会VuePress v1.x的基本使用和默认主题的基本配置,然后再查看本文档。
|
||||
3. 本文档仅负责介绍Vdoing主题对默认主题的扩展部分,更多配置请移步 [VuePress v1.x文档](https://vuepress.vuejs.org/zh/)
|
||||
:::
|
||||
|
||||
## 特性
|
||||
* **知识管理**
|
||||
|
||||
包含三种典型的知识管理形态:结构化、碎片化、体系化。轻松打造属于你自己的知识管理平台。
|
||||
|
||||
* **结构化**
|
||||
|
||||
自动生成侧边栏、目录页、索引页、面包屑等,轻松构建一个结构化知识库。
|
||||
|
||||
* **碎片化&个性化**
|
||||
|
||||
博客功能提供一种知识的碎片化形态,并提供个性化的博客配置。
|
||||
|
||||
* **简洁高效**
|
||||
|
||||
以 Markdown 为中心的项目结构,内置自动化工具,以更少的配置完成更多的事。配合多维索引快速定位每个知识点。
|
||||
|
||||
* **沉浸式阅读体验**
|
||||
|
||||
专为阅读设计的UI,配合多种颜色模式、可关闭的侧边栏和导航栏,带给你一种沉浸式阅读体验。
|
||||
|
||||
|
||||
|
||||
## 扩展功能
|
||||
相较于默认主题,添加的功能内容主要有:
|
||||
|
||||
* 添加方便管理学习笔记和技术文档的`自动生成结构化侧边栏`、`自动生成front matter`、`目录页`、`扩展的搜索框插件`、`面包屑`、`快捷翻页按钮` 等,让你快速定位到任何你想要找的内容。
|
||||
|
||||
* 添加博客相关的 `文章信息栏(作者与创建时间)`、`最近更新栏` 、`博主信息栏`、`页脚版权栏`、`分类功能+分类页`、`标签功能+标签页`、`归档页`、`评论插件`等。
|
||||
|
||||
* 方便好用的 `Markdown 容器`。
|
||||
|
||||
* 首页`文章列表`、`个性化配置`和`样式美化`等。
|
||||
|
||||
* 多种颜色模式供用户选择:`跟随系统`、`浅色模式`、`深色模式`、`阅读模式`
|
||||
|
||||
* 提高搬砖效率的辅助工具: `批量操作front matter工具`
|
||||
|
||||
* ...
|
||||
|
||||
## 安利
|
||||
* 拥有它你就同时拥有了一个专属你个人的在线知识库(云笔记)、博客、文档库、Demo库、一站式技术搜索工具,内容全部采用Markdown编写,简单高效,各种代码随便贴。
|
||||
* 你可以在`.md`文件中写html、css、js、甚至是vue组件代码,[markdown天然的就支持vue组件](https://v1.vuepress.vuejs.org/zh/guide/using-vue.html),魔改页面什么的不要太简单。
|
||||
* 相当多的程序员喜欢深色模式,还有的视力也不太好(🤓),我们有浅色、深色和阅读模式,更有跟随系统自动响应深浅色模式功能,想怎么换就怎么换。
|
||||
|
||||
> 点击右下角换肤按钮
|
||||
* 当你习惯用vdoing主题后,在别处看文档发现是markdown编写的,但所在站点的目录、导航、主题等某个地方用起来不是很爽,你都可以把文档拷贝或把整个专栏下载(如支持下载的话)下来放到vdoing主题,vdoing的自动化工具助你生成一个结构清晰的、拥有目录、页面导航的,而且有多种颜色模式的文档站。让你更专注于内容的学习。
|
||||
|
||||
> 参考我博客中的[文档专栏](https://xugaoyi.com/note/typescript-axios/)
|
||||
* 如果你想和更多的人分享你的文章,那么这款seo友好的主题是一个很不错的选择,更有为了加快百度收录而定制的每天定时[百度推送程序](https://xugaoyi.com/pages/f44d2f9ad04ab8d3/)。
|
||||
|
||||
> 参考我的博客[收录情况](https://www.baidu.com/s?word=site%3Axugaoyi.com)。
|
||||
|
||||
别犹豫了,赶快上手吧
|
||||
@@ -1,110 +0,0 @@
|
||||
---
|
||||
title: 快速上手
|
||||
date: 2020-05-11 13:54:40
|
||||
permalink: /pages/793dcb
|
||||
article: false
|
||||
---
|
||||
|
||||
## 安装和启动
|
||||
|
||||
<code-group>
|
||||
<code-block title="知识库兼博客风格预设配置" active>
|
||||
|
||||
```bash
|
||||
# clone the project
|
||||
git clone https://github.com/xugaoyi/vuepress-theme-vdoing.git
|
||||
|
||||
# enter the project directory
|
||||
cd vuepress-theme-vdoing
|
||||
|
||||
# install dependency 注意:如安装不成功请关闭淘宝源。
|
||||
npm install # or yarn install
|
||||
|
||||
# develop
|
||||
npm run dev # or yarn dev
|
||||
```
|
||||
</code-block>
|
||||
|
||||
<code-block title="文档风格预设配置">
|
||||
|
||||
```bash
|
||||
# clone the project
|
||||
git clone https://github.com/xugaoyi/vuepress-theme-vdoing-doc.git
|
||||
|
||||
# enter the project directory
|
||||
cd vuepress-theme-vdoing-doc
|
||||
|
||||
# install dependency 注意:如安装不成功请关闭淘宝源。
|
||||
npm install # or yarn install
|
||||
|
||||
# develop
|
||||
npm run dev # or yarn dev
|
||||
```
|
||||
> 仓库地址: <https://github.com/xugaoyi/vuepress-theme-vdoing-doc>
|
||||
|
||||
</code-block>
|
||||
|
||||
<code-block title="简洁模板预设配置(社区提供)">
|
||||
|
||||
```bash
|
||||
# clone the project
|
||||
git clone https://github.com/u2sb/vuepress-theme-vdoing-template.git
|
||||
|
||||
# enter the project directory
|
||||
cd vuepress-theme-vdoing-template
|
||||
|
||||
# install dependency 注意:如安装不成功请关闭淘宝源。
|
||||
npm install # or yarn install
|
||||
|
||||
# develop
|
||||
npm run dev # or yarn dev
|
||||
```
|
||||
> 仓库地址: <https://github.com/u2sb/vuepress-theme-vdoing-template>
|
||||
|
||||
</code-block>
|
||||
</code-group>
|
||||
|
||||
::: warning
|
||||
Node请使用`v14.17.x`或以上版本
|
||||
:::
|
||||
|
||||
## 使用Vdoing主题
|
||||
|
||||
1. 安装最新的Vdoing主题包:
|
||||
```sh
|
||||
npm install vuepress-theme-vdoing -D
|
||||
```
|
||||
|
||||
2. 在`.vuepress/config.js`中配置使用主题:
|
||||
```js
|
||||
// config.js
|
||||
module.exports = {
|
||||
theme: 'vdoing'
|
||||
}
|
||||
```
|
||||
|
||||
::: tip
|
||||
1. 不建议在原默认vuepress项目上单独安装使用本主题包,而是clone我的整个项目再替换你自己的内容即可。
|
||||
2. 修改`config.js`配置后需要重新启动项目才会生效。
|
||||
3. 更多关于项目上手的问题,请查阅 [问答](/pages/9cc27d/)。
|
||||
:::
|
||||
|
||||
|
||||
## 版本升级
|
||||
|
||||
主题的版本会不定期更新,你只需更新npm主题包即可:
|
||||
```sh
|
||||
npm update vuepress-theme-vdoing
|
||||
```
|
||||
|
||||
::: tip
|
||||
1. 如更新后没起作用或报错,尝试把`node_modules`文件夹删除再`npm i`重新安装。
|
||||
2. 在.vuepress/config.js中,设置`theme: 'vdoing'`才是使用npm主题依赖包:
|
||||
```js
|
||||
// config.js
|
||||
module.exports = {
|
||||
theme: 'vdoing', // npm主题依赖包
|
||||
// theme: require.resolve('../../vdoing'), // 使用本地主题包
|
||||
}
|
||||
```
|
||||
:::
|
||||
@@ -1,107 +0,0 @@
|
||||
---
|
||||
title: 构建结构化站点的核心配置和约定
|
||||
date: 2020-05-12 11:01:21
|
||||
permalink: /pages/33d574
|
||||
article: false
|
||||
---
|
||||
|
||||
本主题遵循“**约定优于配置**”原则,如果你想构建一个结构化的站点,需要遵循下面这些约定,约定可以为你省去很多配置,轻松拥有一个结构清晰的站点。
|
||||
|
||||
|
||||
|
||||
你需要在`config.js`中有如下配置:
|
||||
|
||||
```js
|
||||
// config.js
|
||||
module.exports = {
|
||||
themeConfig: {
|
||||
sidebar: 'structuring' // 'structuring' | { mode: 'structuring', collapsable: Boolean} | 'auto' | 自定义
|
||||
}
|
||||
}
|
||||
```
|
||||
在运行开发服务`npm run dev`或打包`npm run build`时主题内部将会按照目录约定自动生成一个结构化的**侧边栏、目录页、面包屑等**数据。
|
||||
|
||||
在源目录(一般是`docs`)文件夹中,除了`.vuepress`、`@pages`、`_posts`、``index.md 或 README.md``之外的**文件夹**将会为其生成对应的侧边栏。生成的顺序取自序号,标题取自文件(夹)名称。
|
||||
|
||||
### 命名约定
|
||||
|
||||
* 无论是**文件**还是**文件夹**,请为其名称添加上正确的**正整数序号**和`.`,从`00`或`01`开始累计,如`01.文件夹`、`02.文件.md`,我们将会按照序号的顺序来决定其在侧边栏当中的顺序。
|
||||
* 同一级别目录别内即使只有一个文件或文件夹也要为其加上序号。
|
||||
<!-- * 文件或文件夹名称中间不能出现多余的点`.`,如`01.我是.名称.md`中间出现`.`将会导致解析错误。 -->
|
||||
|
||||
::: tip 提示
|
||||
|
||||
序号只是用于决定先后顺序,并不一定需要连着,如`01、02、03...`,实际工作中可能会在两个文章中间插入一篇新的文章,因此为了方便可以采用间隔序号`10、20、30...`,后面如果需要在`10`和`20`中间插入一篇新文章,可以给定序号`15`。
|
||||
|
||||
:::
|
||||
|
||||
### 级别说明
|
||||
|
||||
源目录(一般是`docs`)底下的级别现在我们称之为`一级目录`,`一级目录`的下一级为`二级目录`,以此类推,最多只能到`四级目录`。
|
||||
|
||||
* **一级目录**
|
||||
1. `.vuepress`、`@pages`、`_posts`、`index.md 或 README.md` 这些文件(文件夹)不参与数据生成。
|
||||
2. 序号非必须。(如一些专栏,可以不用序号)
|
||||
* **二级目录**
|
||||
1. 该级别下可以同时放文件夹和`.md`文件,但是两者序号要连贯(参考下面的例子中的`其他`)。
|
||||
2. 必须有序号
|
||||
* **三级目录**
|
||||
- (同上)
|
||||
* **四级目录** <Badge text="v1.6.0 +"/>
|
||||
1. 该级别下**只能**放`.md`文件。
|
||||
2. 必须有序号
|
||||
|
||||
所有级别内至少有一个文件或文件夹。
|
||||
|
||||
### 目录结构例子
|
||||
|
||||
```html
|
||||
.
|
||||
├── docs
|
||||
│ │ (不参与数据生成)
|
||||
│ ├── .vuepress
|
||||
│ ├── @pages
|
||||
│ ├── _posts
|
||||
│ ├── index.md
|
||||
│ │
|
||||
│ │ (以下部分参与数据生成)
|
||||
│ ├── 《JavaScript教程》专栏 (一级目录)
|
||||
│ │ ├── 01.章节1 (二级目录)
|
||||
│ │ | ├── 01.js1.md (三级目录-文件)
|
||||
│ │ | ├── 02.js2.md
|
||||
│ │ | └── 03.js3.md
|
||||
│ │ └── 02.章节2 (二级目录)
|
||||
│ │ | ├── 01.jsa.md
|
||||
│ │ | ├── 02.小节 (三级目录)
|
||||
│ │ | | └── 01.jsxx.md (四级目录-文件)
|
||||
│ ├── 01.前端
|
||||
│ │ ├── 01.JavaScript
|
||||
│ │ | ├── 01.js1.md
|
||||
│ │ | ├── 02.js2.md
|
||||
│ │ | └── 03.js3.md
|
||||
│ │ └── 02.vue
|
||||
│ │ | ├── 01.vue1.md
|
||||
│ │ | └── 02.vue2.md
|
||||
│ ├── 02.其他
|
||||
│ │ ├── 01.学习
|
||||
│ │ | ├── 01.xxa.md
|
||||
│ │ | └── 02.xxb.md
|
||||
│ │ ├── 02.学习笔记
|
||||
│ │ | ├── 01.xxa.md
|
||||
│ │ | └── 02.xxb.md
|
||||
│ │ ├── 03.文件x.md
|
||||
│ │ └── 04.文件xx.md
|
||||
│ └── 03.关于我
|
||||
│ │ └── 01.关于我.md
|
||||
. .
|
||||
```
|
||||
|
||||
### 如何知道侧边栏数据有没有正确生成?
|
||||
在运行开发服务时(`npm run dev`),在命令行查看打印记录,如果正确生成会有这样的`绿色`提示记录:
|
||||
```bash
|
||||
tip: add sidebar data. 侧边栏数据添加成功。
|
||||
```
|
||||
如果有未按约定的文件,会有`黄色`警告记录,如:
|
||||
```bash
|
||||
warning: 该文件'xxx'序号出错,请填写正确的序号。
|
||||
```
|
||||
@@ -1,108 +0,0 @@
|
||||
---
|
||||
title: 自动生成front matter
|
||||
date: 2020-05-12 11:46:37
|
||||
permalink: /pages/088c16
|
||||
article: false
|
||||
---
|
||||
|
||||
当你没有给`.md`文件的[front matter](https://vuepress.vuejs.org/zh/guide/frontmatter.html)指定标题(`title`)、时间(`date`)、永久链接(`permalink`)、分类(`categories`)、标签(`tags`)、主题配置中[extendFrontmatter](/pages/a20ce8/#extendfrontmatte)配置的字段时,在运行开发服务`npm run dev`或打包`npm run build`时将自动为你生成这些数据,你也可以自己手动设置这些数据,当你手动设置之后,相应的数据就不会再自动生成。
|
||||
|
||||
|
||||
|
||||
### 生成示例
|
||||
|
||||
```yaml
|
||||
---
|
||||
title: 《JavaScript教程》笔记
|
||||
date: 2020-01-12 11:51:53
|
||||
permalink: /pages/d8cae9
|
||||
categories:
|
||||
- 前端
|
||||
- JavaScript
|
||||
tags:
|
||||
-
|
||||
---
|
||||
```
|
||||
|
||||
### title
|
||||
|
||||
* 类型: `string`
|
||||
|
||||
* 默认:`.md`文件的名称
|
||||
|
||||
当前页面的标题
|
||||
|
||||
|
||||
|
||||
### date
|
||||
* 类型: `string`
|
||||
* 格式:`YYYY-MM-DD HH:MM:SS`
|
||||
* 默认:`.md`文件在系统中创建的时间
|
||||
|
||||
当前页面的创建时间,如需手动添加或修改该字段时请按照格式添加或修改
|
||||
|
||||
|
||||
|
||||
### permalink
|
||||
* 类型: `string`
|
||||
* 默认:`/pages/`+ 6位字母加数字的随机码
|
||||
|
||||
当前页面的永久链接
|
||||
|
||||
> Q:自动生成front matter为什么要包含永久链接?
|
||||
>
|
||||
> A:使用永久链接是出于以下几点考虑:
|
||||
>
|
||||
> * 在config.js配置nav时使用永久链接,就不会因为文件的路径或名称的改变而改变。
|
||||
>* 对于博客而言,当别人收藏了你的文章,在未来的时间里都可以通过永久链接来访问到。
|
||||
>* 主题中的目录页需要通过永久链接来访问文章。
|
||||
|
||||
|
||||
### categories
|
||||
|
||||
* 类型: `array`
|
||||
* 默认:
|
||||
* `.md`所在的文件夹名称。
|
||||
* 如果`.md`文件所在的目录是`三级目录`,则会有两个分类值,分别是`二级目录`和`一级目录`的文件夹名称。如果在`四级目录`,则再多一个`三级目录`的文件夹名称分类。([级别说明](/pages/33d574/#级别说明))
|
||||
* 如果`.md`文件所在的目录是`_posts`,则默认值是`随笔`,这个默认值可以在`config.js`中修改,参考:[config.js配置](/pages/a20ce8/#碎片化博文默认分类值)
|
||||
* 如果在 [config.js配置](/pages/a20ce8/#category) 设置了`category: false` 将不会自动生成该字段
|
||||
|
||||
当前页面的分类
|
||||
|
||||
|
||||
|
||||
### tags
|
||||
|
||||
* 类型: `array`
|
||||
* 默认:空数组
|
||||
* 如果在 [config.js配置]() 设置了`tag: false` 将不会自动生成该字段
|
||||
|
||||
当前页面的标签,默认值是空数组,自动生成该字段只是为了方便后面添加标签值。
|
||||
|
||||
|
||||
### 扩展自动生成front matter
|
||||
|
||||
当在主题配置中配置了`extendFrontmatter`时,将在自动生成front matter时添加相应配置的字段和数据。详见:[extendFrontmatter](/pages/a20ce8/#extendfrontmatter)
|
||||
|
||||
### 碎片化文章‘分类’的自动生成规则 <Badge text="v1.12.5+"/>
|
||||
|
||||
> 碎片化文章即放在_posts文件夹的文章,里面的`.md`文件不需要遵循命名约定,不会生成结构化侧边栏和目录页。
|
||||
|
||||
当文章在_posts根目录时,分类获取 `themeConfig.categoryText` 的值,如`_posts/foo.md` ,则`foo.md`文件的分类会生成为:
|
||||
|
||||
```yaml
|
||||
categories:
|
||||
- 随笔
|
||||
```
|
||||
|
||||
> categoryText的默认值是‘随笔’,可在themeConfig修改,详见[categorytext](/pages/a20ce8/#categorytext)。
|
||||
|
||||
当文章在非_posts根目录时,获取父文件夹的名称作为分类,如
|
||||
|
||||
`_posts/想法/奇思妙想/foo.md` ,则`foo.md`文件的分类会生成为:
|
||||
|
||||
```yaml
|
||||
categories:
|
||||
- 想法
|
||||
- 奇思妙想
|
||||
```
|
||||
@@ -0,0 +1,13 @@
|
||||
---
|
||||
title: 演示环境
|
||||
date: 2020-05-12 15:10:15
|
||||
permalink: /pages/db78e2
|
||||
article: false
|
||||
---
|
||||
|
||||
### 演示环境
|
||||
可使用分配好的游客license试用。服务器带宽较低,仅供学习使用!
|
||||
|
||||
管理后台地址:<a href="http://103.163.47.16:9527" target="_blank">http://103.163.47.16:9527</a>
|
||||
|
||||
游客账号:visitor/123456
|
||||
@@ -1,208 +0,0 @@
|
||||
---
|
||||
title: 资源
|
||||
date: 2020-05-12 15:10:15
|
||||
permalink: /pages/db78e2
|
||||
article: false
|
||||
---
|
||||
|
||||
## 插件推荐
|
||||
|
||||
* [vuepress-plugin-fulltext-search](https://github.com/leo-buneev/vuepress-plugin-fulltext-search) 全文搜索
|
||||
|
||||
* [vuepress-plugin-thirdparty-search](https://github.com/xugaoyi/vuepress-plugin-thirdparty-search) 可以添加第三方搜索链接的搜索框
|
||||
|
||||
* [vuepress-plugin-one-click-copy](https://www.npmjs.com/package/vuepress-plugin-one-click-copy) 代码块一键复制
|
||||
|
||||
* [vuepress-plugin-comment](https://github.com/dongyuanxin/vuepress-plugin-comment) 评论区
|
||||
|
||||
* [vuepress-plugin-vssue](https://vssue.js.org/) 评论区(单页)
|
||||
|
||||
* [vuepress-plugin-vssue-global](https://github.com/u2sb/vuepress-plugin-vssue-global) 评论区(全局)
|
||||
|
||||
* [vuepress-plugin-smplayer](https://github.com/u2sb/vuepress-plugin-smplayer) 播放器
|
||||
|
||||
* [vuepress-plugin-flowchart](https://www.npmjs.com/package/vuepress-plugin-flowchart) 流程图
|
||||
|
||||
* [vuepress-plugin-mathjax](https://www.npmjs.com/package/vuepress-plugin-mathjax) 数学公式
|
||||
|
||||
* [vuepress-plugin-tabs](https://www.npmjs.com/package/vuepress-plugin-tabs/) 选项卡
|
||||
|
||||
* [vuepress-plugin-element-ui](https://www.npmjs.com/package/vuepress-plugin-element-ui/) Element UI
|
||||
|
||||
* [花里胡哨的插件](https://moefyit.github.io/moefy-vuepress/) 鼠标点击特效、背景彩带、音乐播放器等花里胡哨的插件
|
||||
|
||||
**更多插件...**
|
||||
|
||||
- [Awesome VuePress](https://github.com/vuepressjs/awesome-vuepress)
|
||||
|
||||
- [在npm中搜索"vuepress–plugin"](https://www.npmjs.com/search?q=vuepress%E2%80%93plugin)
|
||||
|
||||
|
||||
## 社区优秀解决方案
|
||||
|
||||
### [1. 站点信息模块](https://notes.youngkbt.cn/about/website/info/)
|
||||
在首页添加`站点信息模块`,效果:
|
||||
|
||||

|
||||
|
||||
在文章页添加`文章字数`、`阅读时间`、`浏览量`,效果:
|
||||
|
||||

|
||||
|
||||
### [2. 私密文章功能](https://notes.youngkbt.cn/about/website/private/)
|
||||
|
||||
当大家想要「云端备份」文章到博客时,又不希望别人看到,该功能能满足你。
|
||||
|
||||
### [3. 首页大图模块](https://notes.youngkbt.cn/about/website/index-big-img/)
|
||||
|
||||
喜欢首页大图模式的朋友可以参考此教程。
|
||||
|
||||
### [4. 优雅的全文搜索方案](https://wiki.eryajf.net/pages/dfc792/#%E5%89%8D%E8%A8%80)
|
||||
|
||||
|
||||
|
||||
## 文章管理和发布
|
||||
|
||||
使用 [此插件 src-sy-post-publisher](https://github.com/terwer/src-sy-post-publisher) 发布[思源笔记](https://b3log.org/siyuan/)的文章到Vuepress等平台。
|
||||
|
||||
## 图标&配图
|
||||
|
||||
说明:以下图标**非主题内置**,你可以选择喜欢的图标右键保存或到图标库下载。更多图标:[阿里图标库](https://www.iconfont.cn/home/index)
|
||||
|
||||
### 静态图标
|
||||
<table class="icons-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/编程.png" width=60>
|
||||
<p class="name">编程</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/服务器.png" width=60>
|
||||
<p class="name">服务器</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/机器学习.png" width=60>
|
||||
<p class="name">机器学习</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/计算机网络.png" width=60>
|
||||
<p class="name">计算机网络</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/面向对象.png" width=60>
|
||||
<p class="name">面向对象</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/软件开发.png" width=60>
|
||||
<p class="name">软件开发</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/数据结构.png" width=60>
|
||||
<p class="name">数据结构</p>
|
||||
</td>
|
||||
</tr><tr></tr>
|
||||
<tr>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/数据库.png" width=60>
|
||||
<p class="name">数据库</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/思维导图.png" width=60>
|
||||
<p class="name">思维导图</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/算法.png" width=60>
|
||||
<p class="name">算法</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/网络技术.png" width=60>
|
||||
<p class="name">网络技术</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/系统.png" width=60>
|
||||
<p class="name">系统</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/系统分析.png" width=60>
|
||||
<p class="name">系统分析</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/png/项目管理.png" width=60>
|
||||
<p class="name">项目管理</p>
|
||||
</td>
|
||||
</tr><tr></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<style>
|
||||
.icons-table td{
|
||||
padding: 1em;
|
||||
}
|
||||
.icons-table p.name{
|
||||
font-size: 14px;
|
||||
margin: 10px 0 0 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
### 萌系图标
|
||||
|
||||
- [猫咪系列](https://www.iconfont.cn/collections/detail?spm=a313x.7781069.1998910419.dc64b3430&cid=37776)
|
||||
</br>
|
||||
- [数码宝贝](https://www.iconfont.cn/collections/detail?spm=a313x.7781069.1998910419.dc64b3430&cid=38124)
|
||||

|
||||
- [水果系列](https://www.iconfont.cn/collections/detail?spm=a313x.7781069.1998910419.dc64b3430&cid=38124)
|
||||

|
||||
|
||||
|
||||
### 动态图标
|
||||
<table class="icons-table">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/gif/猫1.gif" width=60>
|
||||
<p class="name">猫1</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/gif/猫2.gif" width=60>
|
||||
<p class="name">猫2</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/gif/猫3.gif" width=60>
|
||||
<p class="name">猫3</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img src="/img/gif/猫4.gif" width=60>
|
||||
<p class="name">猫4</p>
|
||||
</td>
|
||||
</tr><tr></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
### 插画
|
||||
[免费插画](https://undraw.co/illustrations)</br>
|
||||
[2D/3D/手绘插画](https://storytale.io/)</br>
|
||||
[阿里插画库](https://www.iconfont.cn/illustrations/index)</br>
|
||||
|
||||
### 配图
|
||||
[可画-文章配图](https://www.canva.cn/)
|
||||
|
||||
### Logo
|
||||
[logo生成1](https://www.designevo.com/logo-maker/)</br>
|
||||
[logo生成2](https://instantlogodesign.com/)
|
||||
|
||||
### Emoji表情
|
||||
[Emoji百科](https://emojipedia.org/)
|
||||
|
||||
::: tip 小技巧
|
||||
在任意输入框快速打开emoji表情方法:</br>
|
||||
Windows系统下按<kbd>Win</kbd> + <kbd>.</kbd></br>
|
||||
Mac系统下按<kbd>Control</kbd> + <kbd>Command</kbd> + <kbd>空格</kbd>
|
||||
:::
|
||||
|
||||
## 共享资源
|
||||
如果您有不错的资源,欢迎在 [资源分享区](https://github.com/xugaoyi/vuepress-theme-vdoing/discussions/categories/%E8%B5%84%E6%BA%90%E5%88%86%E4%BA%AB) 留言。
|
||||
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="http://apifox.cn/a103xugaoyi" target="_blank"><img src="/img/Apifox-860x320.png" alt="npm" class="no-zoom" style="width: 100%;border-radius: 2px;"></a>
|
||||
@@ -128,20 +128,42 @@ postList: none
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="middle">
|
||||
<img :src="$withBase('/img/qrcode/wxq.png')" class="no-zoom" style="width:120px;margin: 10px;">
|
||||
<p>中微子 微信群(添加我微信备注"进群")</p>
|
||||
</td>
|
||||
<!--
|
||||
<td align="center" valign="middle">
|
||||
<img src="https://cdn.staticaly.com/gh/xugaoyi/blog-gitalk-comment@master/img/0.4pp7r95mdai0.jpeg" class="no-zoom" style="width:120px;margin: 10px;">
|
||||
<p>vdoing微信群(添加我微信备注"进群")</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<img :src="$withBase('/img/qrcode/qqq.webp')" alt="群号: 694387113" class="no-zoom" style="width:120px;margin: 10px;">
|
||||
<p>vdoing QQ群: 694387113</p>
|
||||
</td>
|
||||
-->
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<br/>
|
||||
|
||||
## 🧬贡献代码的步骤
|
||||
## 🏗️添砖加瓦
|
||||
|
||||
### 🎋分支说明
|
||||
|
||||
neutrino-proxy主要的源码分为两个分支,功能如下:
|
||||
|
||||
| 分支 | 作用 |
|
||||
|---|---------------------------------------------------------------|
|
||||
| master | 主分支,不接收任何pr或修改 |
|
||||
| feature/1.7.1 | 开发分支,默认为下个版本的SNAPSHOT版本,接受修改或pr |
|
||||
|
||||
### 🐞提供bug反馈或建议
|
||||
|
||||
提交问题反馈请说明正在使用环境以及相关问题
|
||||
|
||||
- [Gitee issue](https://gitee.com/dromara/neutrino-proxy/issues)
|
||||
|
||||
[//]: # (- [Github issue](https://github.com/dromara/hutool/issues))
|
||||
|
||||
|
||||
### 🧬贡献代码的步骤
|
||||
|
||||
贡献代码注意事项:
|
||||
1. 在Gitee或者Github上fork项目到自己的repo,fork,一定要把项目fork一份。
|
||||
|
||||
@@ -1,51 +1,29 @@
|
||||
# 功能点
|
||||
- 用户流量报表
|
||||
- 弹框展示月度明细
|
||||
- 弹框展示今日流量明细
|
||||
- License流量报表
|
||||
- 弹框展示月度明细
|
||||
- 弹框展示今日流量明细
|
||||
- 首页图表📈
|
||||
- 1、License在线数
|
||||
- 2、端口映射在线数
|
||||
- 3、今日流量(上行、下行)
|
||||
- 4、历史流量(上行、下行)
|
||||
- 点击1~4 切换列表
|
||||
- 在线License列表
|
||||
- 用户名
|
||||
- License名称
|
||||
- LicenseKey
|
||||
- 在线端口映射列表
|
||||
- 用户名
|
||||
- License名称
|
||||
- 服务端口
|
||||
- 代理客户端
|
||||
- 今日24小时流量列表(按小时到排序)
|
||||
- 用户名
|
||||
- License名称
|
||||
- 时间
|
||||
- 流量
|
||||
- 历史流量列表(取最近12个月按月到排序)
|
||||
- 用户名
|
||||
- License名称
|
||||
- 时间
|
||||
- 流量
|
||||
- 今日流量折线图(上行、下行、总流量,按分钟统计0~24小时)
|
||||
# 1.x剩余规划
|
||||
- [ ] 参考鹊桥,增加对域名的支持
|
||||
- [ ] 官网上线
|
||||
|
||||
# Bug
|
||||
- windows环境下直接运行发布版的jar包,日志输出乱码
|
||||
- 部份用户windows环境下启动客户端,扫描类个数为0个
|
||||
- 代理mysql时,使用未开启远程访问的账号走代理访问mysql,代理客户端出现断开现象
|
||||
|
||||
# 2.x规划
|
||||
- 全面重构:底层更换为Solon + Mybatis Plus
|
||||
- 规范协议:代理协议规范化,方便后续更好扩展、支持不同语言客户端接入
|
||||
- 端口池优化:支持为license设置独占端口。方便后续开发jetbrains插件、solon插件
|
||||
- 精细化控制:支持针对用户限速、限流
|
||||
- 参考鹊桥,增加对域名的支持
|
||||
- MGT增加服务端维护
|
||||
- 支持调整服务端端口
|
||||
- 支持重启
|
||||
- 支持查看服务端日志
|
||||
- 支持证书上传下载
|
||||
- 支持客户端版本管理
|
||||
- 支持原生编译
|
||||
- 插件开发
|
||||
- [ ] neutrino-proxy-solon-plugin
|
||||
- [ ] neutrino-proxy-jetbrains-plugin
|
||||
- [ ] neutrino-proxy-starter (SpringBoot)
|
||||
- 基础优化
|
||||
- [ ] 支持批量端口映射
|
||||
- [ ] 代理协议规范化,方便后续更好扩展、支持不同语言客户端接入
|
||||
- 监控运维
|
||||
- [ ] 监控服务端状态
|
||||
- [ ] 支持调整服务端端口、证书
|
||||
- [ ] 服务端版本、协议版本、客户端版本管理
|
||||
- [ ] 服务端日志
|
||||
- client+计划启动
|
||||
- [ ] 安卓客户端
|
||||
- [ ] 基于electron-egg的多平台客户端
|
||||
|
||||
# 3.x规划
|
||||
- [ ] 支持针对用户限速、限流
|
||||
- [ ] 支持P2P穿透
|
||||
- [ ] 支持原生编译
|
||||