Compare commits
No commits in common. "master" and "master" have entirely different histories.
|
@ -0,0 +1 @@
|
|||
custom: http://doc.ruoyi.vip/ruoyi-cloud/other/donate.html
|
|
@ -47,3 +47,4 @@ nbdist/
|
|||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
||||
/ruoyi-react/
|
||||
|
|
36
README.md
36
README.md
|
@ -1,36 +0,0 @@
|
|||
## 系统模块
|
||||
|
||||
~~~
|
||||
com.microservices
|
||||
├── microservices-ui // 前端框架
|
||||
├── microservices-gateway // 网关模块
|
||||
├── microservices-auth // 认证中心
|
||||
├── microservices-api // 接口模块
|
||||
│ └── microservices-api-system // 系统接口
|
||||
├── microservices-common // 通用模块
|
||||
│ └── microservices-common-async // 异步线程池配置
|
||||
│ └── microservices-common-core // 核心模块
|
||||
│ └── microservices-common-datascope // 权限范围
|
||||
│ └── microservices-common-datasource // 多数据源
|
||||
│ └── microservices-common-httpClient // http调用
|
||||
│ └── microservices-common-log // 日志记录
|
||||
│ └── microservices-common-redis // 缓存服务
|
||||
│ └── microservices-common-seata // seata分布式事务
|
||||
│ └── microservices-common-security // 安全模块
|
||||
│ └── microservices-common-swagger // 系统接口
|
||||
├── microservices-modules // 业务模块
|
||||
│ └── microservices-cms // 内容管理模块
|
||||
│ └── microservices-dms // 数据管理体系模块
|
||||
│ └── microservices-dss // 数据统计系统模块
|
||||
│ └── microservices-file // 文件服务
|
||||
│ └── microservices-gen // 代码生成
|
||||
│ └── microservices-job // 定时任务
|
||||
│ └── microservices-pms // 项目管理系统模块
|
||||
│ └── microservices-system // 系统模块
|
||||
│ └── microservices-wiki // Wiki模块
|
||||
│ └── microservices-zone // 特色专区系统模块
|
||||
├── microservices-visual // 图形化管理模块
|
||||
│ └── microservices-visual-monitor // 监控中心
|
||||
├──pom.xml // 公共依赖
|
||||
~~~
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 清理工程target生成路径。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
cd %~dp0
|
||||
|
||||
cd ..
|
||||
call mvn clean
|
||||
|
||||
pause
|
|
@ -0,0 +1,12 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 打包Web工程,生成war/jar包文件。
|
||||
echo.
|
||||
|
||||
%~d0
|
||||
cd %~dp0
|
||||
|
||||
cd ..
|
||||
call mvn clean package -Dmaven.test.skip=true
|
||||
|
||||
pause
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 使用Jar命令运行Auth工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../ruoyi-auth/target
|
||||
|
||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-auth.jar
|
||||
|
||||
cd bin
|
||||
pause
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 使用Jar命令运行Gateway工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../ruoyi-gateway/target
|
||||
|
||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-gateway.jar
|
||||
|
||||
cd bin
|
||||
pause
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 使用Jar命令运行Modules-File工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../ruoyi-modules/ruoyi-file/target
|
||||
|
||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-file.jar
|
||||
|
||||
cd bin
|
||||
pause
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 使用Jar命令运行Modules-Gen工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../ruoyi-modules/ruoyi-gen/target
|
||||
|
||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-gen.jar
|
||||
|
||||
cd bin
|
||||
pause
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 使用Jar命令运行Modules-Job工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../ruoyi-modules/ruoyi-job/target
|
||||
|
||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-job.jar
|
||||
|
||||
cd bin
|
||||
pause
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 使用Jar命令运行Modules-System工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../ruoyi-modules/ruoyi-system/target
|
||||
|
||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-modules-system.jar
|
||||
|
||||
cd bin
|
||||
pause
|
|
@ -0,0 +1,14 @@
|
|||
@echo off
|
||||
echo.
|
||||
echo [信息] 使用Jar命令运行Monitor工程。
|
||||
echo.
|
||||
|
||||
cd %~dp0
|
||||
cd ../ruoyi-visual/ruoyi-monitor/target
|
||||
|
||||
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
|
||||
|
||||
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar ruoyi-visual-monitor.jar
|
||||
|
||||
cd bin
|
||||
pause
|
|
@ -0,0 +1,63 @@
|
|||
## 部署环境
|
||||
deploy_env=test
|
||||
## 基础镜像版本
|
||||
base_image_version=1.0.0
|
||||
## Nacos数据库连接
|
||||
nacos_db_url=gitlink-mysql:3306
|
||||
nacos_db_name=gitlink-nacos-config
|
||||
nacos_db_username=root
|
||||
nacos_db_password=Trust_#%01
|
||||
## 连接Nacos配置
|
||||
nacos_ip=gitlink-nacos
|
||||
nacos_port=8848
|
||||
## 连接Redis配置
|
||||
redis_ip=gitlink-redis
|
||||
redis_port=6379
|
||||
## 业务库数据源配置
|
||||
mysql_root_password=Trust_#%01
|
||||
db_url=gitlink-mysql:3306
|
||||
db_name=ruoyi-gitlink
|
||||
db_username=root
|
||||
db_password=Trust_#%01
|
||||
mapping_mysql_port=24306
|
||||
## GitLink库数据源配置
|
||||
gitlink_db_url=173.15.15.82:23306
|
||||
gitlink_db_name=test-gitlink-user
|
||||
gitlink_db_username=root
|
||||
gitlink_db_password=123456
|
||||
## 文件服务访问地址
|
||||
file_url=http://173.15.15.82:24080/file
|
||||
# 容器内文件上传路径
|
||||
file_path=/home/gitlink/uploadPath
|
||||
## 内容管理系统配置
|
||||
# 自动提取概要最大长度
|
||||
cms_summaryMaxLength=100
|
||||
# 特色专区项目组织名称
|
||||
cms_gitLinkOrganization=prefecture
|
||||
# GitLink访问地址
|
||||
cms_gitLinkUrl=https://testforgeplus.trustie.net/
|
||||
## skywalking配置
|
||||
skywalking_backend_service=111.8.36.180:95
|
||||
## Docker数据路径
|
||||
docker_data=/data/docker-data
|
||||
## Nacos映射端口
|
||||
mapping_nacos_port=24848
|
||||
## Redis映射端口
|
||||
mapping_redis_port=24379
|
||||
## Gateway映射端口
|
||||
mapping_gateway_port=24080
|
||||
## 邀请链接有效时长(单位:天)
|
||||
invitationLinkExpirationTime=10
|
||||
## 邀请确认页面
|
||||
invitationPagePath=/index
|
||||
## 消息模板
|
||||
messageTemplate=1428
|
||||
## 专区管理地址
|
||||
zoneAdminUrl=http://127.0.0.1/zone/list
|
||||
## 项目聚合中,GitLink项目Id
|
||||
gitlinkProjectId=546714
|
||||
## 会员聚合中,gitlink用户名
|
||||
gitLinkUserName1=floraachy
|
||||
gitLinkUserName2=innov
|
||||
gitLinkUserName3=ttt77777
|
||||
gitLinkUserName4=OTTO
|
|
@ -0,0 +1,323 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 获取当前路径
|
||||
orgin_path=`pwd`
|
||||
current_env=$1
|
||||
server_name=$3
|
||||
|
||||
|
||||
# 使用说明,用来提示输入参数
|
||||
usage() {
|
||||
echo -e "\e[91m错误:必须传入环境参数 \e[0m"
|
||||
echo "Usage: sh auto_redeploy.sh [test|prod] [modules|zone_front]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
check_success(){
|
||||
# 打印提示信息
|
||||
echo "服务开始启动,监听服务是否启动完成,容器名称:$1"
|
||||
# 开始监听容器日志
|
||||
docker logs -f $1 | while read -r log_line
|
||||
do
|
||||
# 检查日志中是否包含"启动成功"
|
||||
if [ -n "$(echo "$log_line" | grep "启动成功")" ]; then
|
||||
# 打印包含"启动成功"的日志
|
||||
echo "$log_line"
|
||||
# 获取docker logs进程ID并终止
|
||||
logs_pid=$(pgrep -P $$ -o -f "docker logs -f $1")
|
||||
[ -n "$logs_pid" ] && kill "$logs_pid"
|
||||
break
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
modules(){
|
||||
echo "拉取最新代码"
|
||||
git pull
|
||||
|
||||
echo "进行Maven编译"
|
||||
./build.sh "$current_env" build_maven
|
||||
|
||||
echo "拷贝Jar包"
|
||||
./copy.sh "$current_env" copy_jar
|
||||
|
||||
echo "生成Dockerfile"
|
||||
./build.sh "$current_env" gen_dockerfile
|
||||
|
||||
echo "重新编译modules"
|
||||
./deploy.sh "$current_env" build_modules
|
||||
|
||||
echo "停止modules服务"
|
||||
./deploy.sh "$current_env" stop_modules
|
||||
|
||||
echo "删除已停止的服务"
|
||||
./deploy.sh "$current_env" rm
|
||||
|
||||
echo "启动modules服务"
|
||||
./deploy.sh "$current_env" modules
|
||||
|
||||
check_success gitlink-auth
|
||||
check_success gitlink-gateway
|
||||
check_success gitlink-modules-cms
|
||||
check_success gitlink-modules-system
|
||||
check_success gitlink-modules-file
|
||||
check_success gitlink-modules-zone
|
||||
}
|
||||
|
||||
zone_front(){
|
||||
echo "自动部署前端"
|
||||
echo "进行前端编译"
|
||||
./build.sh "$current_env" build_zone_front
|
||||
echo "拷贝前端文件"
|
||||
./copy.sh "$current_env" copy_zone_front
|
||||
docker restart gitlink-nginx
|
||||
}
|
||||
zone(){
|
||||
echo "拉取最新代码"
|
||||
git pull
|
||||
|
||||
echo "进行Maven编译"
|
||||
./build.sh "$current_env" build_maven ruoyi-modules/ruoyi-zone
|
||||
|
||||
echo "拷贝Jar包"
|
||||
./copy.sh "$current_env" copy_zone
|
||||
|
||||
echo "重新编译modules"
|
||||
./deploy.sh "$current_env" build_modules gitlink-modules-zone
|
||||
|
||||
echo "停止modules服务"
|
||||
./deploy.sh "$current_env" stop_modules gitlink-modules-zone
|
||||
|
||||
sleep 2
|
||||
echo "检查zone服务是否已停止"
|
||||
docker ps -a|grep "gitlink-modules-zone"
|
||||
|
||||
echo "删除已停止的服务"
|
||||
./deploy.sh "$current_env" rm gitlink-modules-zone
|
||||
|
||||
echo "启动modules服务"
|
||||
./deploy.sh "$current_env" modules gitlink-modules-zone
|
||||
|
||||
check_success gitlink-modules-zone
|
||||
|
||||
}
|
||||
file(){
|
||||
echo "拉取最新代码"
|
||||
git pull
|
||||
|
||||
echo "进行Maven编译"
|
||||
./build.sh "$current_env" build_maven ruoyi-modules/ruoyi-file
|
||||
|
||||
echo "拷贝Jar包"
|
||||
./copy.sh "$current_env" copy_file
|
||||
|
||||
echo "重新编译modules"
|
||||
./deploy.sh "$current_env" build_modules gitlink-modules-file
|
||||
|
||||
echo "停止modules服务"
|
||||
./deploy.sh "$current_env" stop_modules gitlink-modules-file
|
||||
|
||||
sleep 2
|
||||
echo "检查file服务是否已停止"
|
||||
docker ps -a|grep "gitlink-modules-file"
|
||||
|
||||
echo "删除已停止的服务"
|
||||
./deploy.sh "$current_env" rm gitlink-modules-file
|
||||
|
||||
echo "启动modules服务"
|
||||
./deploy.sh "$current_env" modules gitlink-modules-file
|
||||
|
||||
check_success gitlink-modules-file
|
||||
}
|
||||
system(){
|
||||
echo "拉取最新代码"
|
||||
git pull
|
||||
|
||||
echo "进行Maven编译"
|
||||
./build.sh "$current_env" build_maven ruoyi-modules/ruoyi-system
|
||||
|
||||
echo "拷贝Jar包"
|
||||
./copy.sh "$current_env" copy_system
|
||||
|
||||
echo "重新编译modules"
|
||||
./deploy.sh "$current_env" build_modules gitlink-modules-system
|
||||
|
||||
echo "停止modules服务"
|
||||
./deploy.sh "$current_env" stop_modules gitlink-modules-system
|
||||
|
||||
sleep 2
|
||||
echo "检查system服务是否已停止"
|
||||
docker ps -a|grep "gitlink-modules-system"
|
||||
|
||||
echo "删除已停止的服务"
|
||||
./deploy.sh "$current_env" rm gitlink-modules-system
|
||||
|
||||
echo "启动modules服务"
|
||||
./deploy.sh "$current_env" modules gitlink-modules-system
|
||||
|
||||
check_success gitlink-modules-system
|
||||
|
||||
}
|
||||
cms(){
|
||||
echo "拉取最新代码"
|
||||
git pull
|
||||
|
||||
echo "进行Maven编译"
|
||||
./build.sh "$current_env" build_maven ruoyi-modules/ruoyi-cms
|
||||
|
||||
echo "拷贝Jar包"
|
||||
./copy.sh "$current_env" copy_cms
|
||||
|
||||
echo "重新编译modules"
|
||||
./deploy.sh "$current_env" build_modules gitlink-modules-cms
|
||||
|
||||
echo "停止modules服务"
|
||||
./deploy.sh "$current_env" stop_modules gitlink-modules-cms
|
||||
|
||||
sleep 2
|
||||
echo "检查cms服务是否已停止"
|
||||
docker ps -a|grep "gitlink-modules-cms"
|
||||
|
||||
echo "删除已停止的服务"
|
||||
./deploy.sh "$current_env" rm gitlink-modules-cms
|
||||
|
||||
echo "启动modules服务"
|
||||
./deploy.sh "$current_env" modules gitlink-modules-cms
|
||||
|
||||
check_success gitlink-modules-cms
|
||||
|
||||
}
|
||||
gateway(){
|
||||
echo "拉取最新代码"
|
||||
git pull
|
||||
|
||||
echo "进行Maven编译"
|
||||
./build.sh "$current_env" build_maven ruoyi-gateway
|
||||
|
||||
echo "拷贝Jar包"
|
||||
./copy.sh "$current_env" copy_gateway
|
||||
|
||||
echo "重新编译modules"
|
||||
./deploy.sh "$current_env" build_modules gitlink-gateway
|
||||
|
||||
echo "停止modules服务"
|
||||
./deploy.sh "$current_env" stop_modules gitlink-gateway
|
||||
|
||||
sleep 2
|
||||
echo "检查gateway服务是否已停止"
|
||||
docker ps -a|grep "gitlink-gateway"
|
||||
|
||||
echo "删除已停止的服务"
|
||||
./deploy.sh "$current_env" rm gitlink-gateway
|
||||
|
||||
echo "启动modules服务"
|
||||
./deploy.sh "$current_env" modules gitlink-gateway
|
||||
|
||||
check_success gitlink-gateway
|
||||
|
||||
}
|
||||
auth(){
|
||||
echo "拉取最新代码"
|
||||
git pull
|
||||
|
||||
echo "进行Maven编译"
|
||||
./build.sh "$current_env" build_maven ruoyi-auth
|
||||
|
||||
echo "拷贝Jar包"
|
||||
./copy.sh "$current_env" copy_auth
|
||||
|
||||
echo "重新编译modules"
|
||||
./deploy.sh "$current_env" build_modules gitlink-auth
|
||||
|
||||
echo "停止modules服务"
|
||||
./deploy.sh "$current_env" stop_modules gitlink-auth
|
||||
|
||||
sleep 2
|
||||
echo "检查auth服务是否已停止"
|
||||
docker ps -a|grep "gitlink-auth"
|
||||
|
||||
echo "删除已停止的服务"
|
||||
./deploy.sh "$current_env" rm gitlink-auth
|
||||
|
||||
echo "启动modules服务"
|
||||
./deploy.sh "$current_env" modules gitlink-auth
|
||||
|
||||
check_success gitlink-auth
|
||||
|
||||
}
|
||||
pms(){
|
||||
echo "拉取最新代码"
|
||||
git pull
|
||||
|
||||
echo "进行Maven编译"
|
||||
./build.sh "$current_env" build_maven ruoyi-modules/ruoyi-pms
|
||||
|
||||
echo "拷贝Jar包"
|
||||
./copy.sh "$current_env" copy_pms
|
||||
|
||||
echo "重新编译modules"
|
||||
./deploy.sh "$current_env" build_modules gitlink-modules-pms
|
||||
|
||||
echo "停止modules服务"
|
||||
./deploy.sh "$current_env" stop_modules gitlink-modules-pms
|
||||
|
||||
sleep 2
|
||||
echo "检查pms服务是否已停止"
|
||||
docker ps -a|grep "gitlink-modules-pms"
|
||||
|
||||
echo "删除已停止的服务"
|
||||
./deploy.sh "$current_env" rm gitlink-modules-pms
|
||||
|
||||
echo "启动modules服务"
|
||||
./deploy.sh "$current_env" modules gitlink-modules-pms
|
||||
|
||||
check_success gitlink-modules-pms
|
||||
|
||||
}
|
||||
|
||||
case "$current_env" in
|
||||
"test")
|
||||
# 获取测试环境配置文件中的安装信息
|
||||
. ./test_config.profile
|
||||
;;
|
||||
"prod")
|
||||
. ./prod_config.profile
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
# 根据输入参数,选择执行对应方法,不输入则执行使用说明
|
||||
case "$2" in
|
||||
"modules")
|
||||
modules
|
||||
;;
|
||||
"zone_front")
|
||||
zone_front
|
||||
;;
|
||||
"zone")
|
||||
zone
|
||||
;;
|
||||
"system")
|
||||
system
|
||||
;;
|
||||
"cms")
|
||||
cms
|
||||
;;
|
||||
"pms")
|
||||
pms
|
||||
;;
|
||||
"file")
|
||||
file
|
||||
;;
|
||||
"gateway")
|
||||
gateway
|
||||
;;
|
||||
"auth")
|
||||
auth
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,247 @@
|
|||
#!/bin/sh
|
||||
|
||||
# 获取当前路径
|
||||
orgin_path=`pwd`
|
||||
server_name=$3
|
||||
env=$1
|
||||
|
||||
# 使用说明,用来提示输入参数
|
||||
usage() {
|
||||
echo -e "\e[91m错误:必须传入环境和方法两个参数 \e[0m"
|
||||
echo "Usage: sh build.sh [test|prod] [build_base_image|gen_nacos_config|gen_nginx_config|gen_nacos_sql|gen_gitlink_sql|gen_docker_compose|gen_dockerfile|build_maven|build_zone_front]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 编译基础镜像
|
||||
build_base_image(){
|
||||
cd "${orgin_path}"/gitlink/base
|
||||
docker build -t gitlink-java:"${base_image_version}" .
|
||||
}
|
||||
|
||||
gen_nginx_config(){
|
||||
# 修改nacos配置
|
||||
cd "${orgin_path}"/nginx/conf
|
||||
# 删除历史配置文件
|
||||
rm -f nginx.conf
|
||||
cp default_nginx.conf nginx.conf
|
||||
# 替换配置
|
||||
sed -i "s|#mapping_gateway_port|${mapping_gateway_port}|g" nginx.conf
|
||||
sed -i "s|#mapping_nacos_port|${mapping_nacos_port}|g" nginx.conf
|
||||
}
|
||||
|
||||
gen_nacos_sql(){
|
||||
# 修改nacos SQL
|
||||
cd "${orgin_path}"/nacos/sql
|
||||
# 删除历史sql
|
||||
rm -f gitlink-nacos-config.sql
|
||||
cp default_gitlink-nacos-config.sql gitlink-nacos-config.sql
|
||||
# 替换配置
|
||||
sed -i "s|#redis_ip|${redis_ip}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#redis_port|${redis_port}|g" gitlink-nacos-config.sql
|
||||
|
||||
sed -i "s|#db_url|${db_url}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#db_name|${db_name}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#db_username|${db_username}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#db_password|${db_password}|g" gitlink-nacos-config.sql
|
||||
|
||||
sed -i "s|#gitlink_db_url|${gitlink_db_url}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitlink_db_name|${gitlink_db_name}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitlink_db_username|${gitlink_db_username}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitlink_db_password|${gitlink_db_password}|g" gitlink-nacos-config.sql
|
||||
|
||||
sed -i "s|#file_url|${file_url}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#file_path|${file_path}|g" gitlink-nacos-config.sql
|
||||
|
||||
sed -i "s|#cms_summaryMaxLength|${cms_summaryMaxLength}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#cms_gitLinkOrganization|${cms_gitLinkOrganization}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#cms_gitLinkUrl|${cms_gitLinkUrl}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#cmsDetailPath|${cmsDetailPath}|g" gitlink-nacos-config.sql
|
||||
|
||||
sed -i "s|#invitationLinkExpirationTime|${invitationLinkExpirationTime}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#invitationPagePath|${invitationPagePath}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#messageTemplate|${messageTemplate}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#memberMessageTemplate|${memberMessageTemplate}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#zoneAdminUrl|${zoneAdminUrl}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#zoneHomepagePath|${zoneHomepagePath}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#zoneMemberPath|${zoneMemberPath}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#zoneConfigurationUrl|${zoneConfigurationUrl}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#docManageUrl|${docManageUrl}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#resourceManageUrl|${resourceManageUrl}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitlinkProjectId|${gitlinkProjectId}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitLinkUserName1|${gitLinkUserName1}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitLinkUserName2|${gitLinkUserName2}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitLinkUserName3|${gitLinkUserName3}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitLinkUserName4|${gitLinkUserName4}|g" gitlink-nacos-config.sql
|
||||
|
||||
sed -i "s|#gatewayUrl|${gatewayUrl}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitlinkAdminUsername|${gitlinkAdminUsername}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitlinkAdminPassword|${gitlinkAdminPassword}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitlinkClientId|${gitlinkClientId}|g" gitlink-nacos-config.sql
|
||||
sed -i "s|#gitlinkClientSecret|${gitlinkClientSecret}|g" gitlink-nacos-config.sql
|
||||
|
||||
sed -i "1 i DROP DATABASE IF EXISTS \`${nacos_db_name}\`;" gitlink-nacos-config.sql
|
||||
sed -i "2 i CREATE DATABASE \`${nacos_db_name}\` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" gitlink-nacos-config.sql
|
||||
sed -i "3 i USE \`${nacos_db_name}\`;" gitlink-nacos-config.sql
|
||||
|
||||
}
|
||||
|
||||
gen_gitlink_sql(){
|
||||
# 修改nacos SQL
|
||||
cd "${orgin_path}"/gitlink/sql
|
||||
# 删除历史sql
|
||||
rm -f ruoyi-gitlink.sql
|
||||
cp init-ruoyi-gitlink.sql ruoyi-gitlink.sql
|
||||
# 替换配置
|
||||
|
||||
sed -i "1 i DROP DATABASE IF EXISTS \`${db_name}\`;" ruoyi-gitlink.sql
|
||||
sed -i "2 i CREATE DATABASE \`${db_name}\` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;" ruoyi-gitlink.sql
|
||||
sed -i "3 i USE \`${db_name}\`;" ruoyi-gitlink.sql
|
||||
}
|
||||
|
||||
gen_docker_compose(){
|
||||
# 替换docker-compose配置
|
||||
cd "${orgin_path}"
|
||||
# 删除历史docker-compose
|
||||
rm -f docker-compose.yml
|
||||
cp default_docker-compose.yml docker-compose.yml
|
||||
sed -i "s|#docker_data|${docker_data}|g" docker-compose.yml
|
||||
sed -i "s|#file_path|${file_path}|g" docker-compose.yml
|
||||
sed -i "s|#mapping_nacos_port|${mapping_nacos_port}|g" docker-compose.yml
|
||||
sed -i "s|#mapping_redis_port|${mapping_redis_port}|g" docker-compose.yml
|
||||
sed -i "s|#mapping_gateway_port|${mapping_gateway_port}|g" docker-compose.yml
|
||||
sed -i "s|#db_password|${db_password}|g" docker-compose.yml
|
||||
sed -i "s|#db_name|${db_name}|g" docker-compose.yml
|
||||
sed -i "s|#mapping_mysql_port|${mapping_mysql_port}|g" docker-compose.yml
|
||||
# Nacos配置
|
||||
sed -i "s|#NACOS_MYSQL_SERVICE_HOST|${NACOS_MYSQL_SERVICE_HOST}|g" docker-compose.yml
|
||||
sed -i "s|#NACOS_SPRING_DATASOURCE_PLATFORM|${NACOS_SPRING_DATASOURCE_PLATFORM}|g" docker-compose.yml
|
||||
sed -i "s|#NACOS_MYSQL_SERVICE_PORT|${NACOS_MYSQL_SERVICE_PORT}|g" docker-compose.yml
|
||||
sed -i "s|#NACOS_MYSQL_SERVICE_DB_NAME|${NACOS_MYSQL_SERVICE_DB_NAME}|g" docker-compose.yml
|
||||
sed -i "s|#NACOS_MYSQL_SERVICE_USER|${NACOS_MYSQL_SERVICE_USER}|g" docker-compose.yml
|
||||
sed -i "s|#NACOS_MYSQL_SERVICE_PASSWORD|${NACOS_MYSQL_SERVICE_PASSWORD}|g" docker-compose.yml
|
||||
sed -i "s|#NACOS_AUTH_ENABLE|${NACOS_AUTH_ENABLE}|g" docker-compose.yml
|
||||
sed -i "s|#NACOS_AUTH_TOKEN|${NACOS_AUTH_TOKEN}|g" docker-compose.yml
|
||||
sed -i "s|#NACOS_AUTH_IDENTITY_KEY|${NACOS_AUTH_IDENTITY_KEY}|g" docker-compose.yml
|
||||
sed -i "s|#NACOS_AUTH_IDENTITY_VALUE|${NACOS_AUTH_IDENTITY_VALUE}|g" docker-compose.yml
|
||||
}
|
||||
|
||||
gen_dockerfile(){
|
||||
# 替换auth dockerfile配置
|
||||
cd "${orgin_path}"/gitlink/auth
|
||||
replace_dockerfile_config
|
||||
# 替换gateway dockerfile配置
|
||||
cd "${orgin_path}"/gitlink/gateway
|
||||
replace_dockerfile_config
|
||||
# 替换cms dockerfile配置
|
||||
cd "${orgin_path}"/gitlink/modules/cms
|
||||
replace_dockerfile_config
|
||||
# 替换zone dockerfile配置
|
||||
cd "${orgin_path}"/gitlink/modules/zone
|
||||
replace_dockerfile_config
|
||||
# 替换file dockerfile配置
|
||||
cd "${orgin_path}"/gitlink/modules/file
|
||||
replace_dockerfile_config
|
||||
# 替换job dockerfile配置
|
||||
cd "${orgin_path}"/gitlink/modules/job
|
||||
replace_dockerfile_config
|
||||
# 替换system dockerfile配置
|
||||
cd "${orgin_path}"/gitlink/modules/system
|
||||
replace_dockerfile_config
|
||||
}
|
||||
|
||||
replace_dockerfile_config(){
|
||||
# 删除历史docker-compose
|
||||
rm -f dockerfile
|
||||
cp default_dockerfile dockerfile
|
||||
sed -i "s|#skywalking_backend_service|${skywalking_backend_service}|g" dockerfile
|
||||
sed -i "s|#nacos_ip|${nacos_ip}|g" dockerfile
|
||||
sed -i "s|#nacos_port|${nacos_port}|g" dockerfile
|
||||
sed -i "s|#nacos_username|${nacos_username}|g" dockerfile
|
||||
sed -i "s|#nacos_password|${nacos_password}|g" dockerfile
|
||||
sed -i "s|#base_image_version|${base_image_version}|g" dockerfile
|
||||
sed -i "s|#deploy_env|${deploy_env}|g" dockerfile
|
||||
sed -i "s|#nacos_username|${nacos_username}|g" dockerfile
|
||||
sed -i "s|#nacos_password|${nacos_password}|g" dockerfile
|
||||
}
|
||||
|
||||
# 微服务模块编译
|
||||
build_maven(){
|
||||
cd "${orgin_path}"/..
|
||||
if [ -z "$server_name" ]; then
|
||||
mvn clean
|
||||
mvn package install -DskipTests
|
||||
else
|
||||
mvn clean install -pl "$server_name" -am
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# 微服务模块编译
|
||||
build_zone_front(){
|
||||
cd "${orgin_path}"/..
|
||||
#判断前端项目文件夹是否已创建
|
||||
if [ ! -d "ruoyi-react" ]; then
|
||||
git clone git@code.gitlink.org.cn:Gitlink/ruoyi-react.git
|
||||
fi
|
||||
cd ./ruoyi-react
|
||||
if [ "$env" = 'test' ]; then
|
||||
echo "切换到develop分支"
|
||||
git checkout develop
|
||||
git branch --set-upstream-to=origin/develop develop
|
||||
else
|
||||
echo "切换到master分支"
|
||||
git checkout master
|
||||
fi
|
||||
git pull
|
||||
npm config set registry https://registry.npmmirror.com
|
||||
npm install
|
||||
npm run build
|
||||
}
|
||||
|
||||
case "$env" in
|
||||
"test")
|
||||
# 获取测试环境配置文件中的安装信息
|
||||
. ./test_config.profile
|
||||
;;
|
||||
"prod")
|
||||
. ./prod_config.profile
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
# 根据输入参数,选择执行对应方法,不输入则执行使用说明
|
||||
case "$2" in
|
||||
"build_base_image")
|
||||
build_base_image
|
||||
;;
|
||||
"gen_gitlink_sql")
|
||||
gen_gitlink_sql
|
||||
;;
|
||||
"gen_nacos_sql")
|
||||
gen_nacos_sql
|
||||
;;
|
||||
"gen_nginx_config")
|
||||
gen_nginx_config
|
||||
;;
|
||||
"gen_docker_compose")
|
||||
gen_docker_compose
|
||||
;;
|
||||
"gen_dockerfile")
|
||||
gen_dockerfile
|
||||
;;
|
||||
"build_maven")
|
||||
build_maven
|
||||
;;
|
||||
"build_zone_front")
|
||||
build_zone_front
|
||||
;;
|
||||
"test")
|
||||
test1
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
|
@ -0,0 +1,144 @@
|
|||
#!/bin/sh
|
||||
current_env=$1
|
||||
# 复制项目的文件到对应docker路径,便于一键生成镜像。
|
||||
usage() {
|
||||
echo "Usage: sh copy.sh [test|prod] [copy_jar|copy_config|copy_sql|copy_zone_front|copy_all]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
copy_gateway(){
|
||||
echo "begin copy ruoyi-gateway "
|
||||
cp ../ruoyi-gateway/target/ruoyi-gateway.jar ./gitlink/gateway/jar
|
||||
}
|
||||
copy_auth(){
|
||||
echo "begin copy ruoyi-auth "
|
||||
cp ../ruoyi-auth/target/ruoyi-auth.jar ./gitlink/auth/jar
|
||||
}
|
||||
copy_system(){
|
||||
echo "begin copy ruoyi-modules-system "
|
||||
cp ../ruoyi-modules/ruoyi-system/target/ruoyi-modules-system.jar ./gitlink/modules/system/jar
|
||||
}
|
||||
copy_cms(){
|
||||
echo "begin copy ruoyi-modules-cms "
|
||||
cp ../ruoyi-modules/ruoyi-cms/target/ruoyi-modules-cms.jar ./gitlink/modules/cms/jar
|
||||
}
|
||||
copy_zone(){
|
||||
echo "begin copy ruoyi-modules-zone "
|
||||
cp ../ruoyi-modules/ruoyi-zone/target/ruoyi-modules-zone.jar ./gitlink/modules/zone/jar
|
||||
}
|
||||
copy_file(){
|
||||
echo "begin copy ruoyi-modules-file "
|
||||
cp ../ruoyi-modules/ruoyi-file/target/ruoyi-modules-file.jar ./gitlink/modules/file/jar
|
||||
}
|
||||
copy_job(){
|
||||
echo "begin copy ruoyi-modules-job "
|
||||
cp ../ruoyi-modules/ruoyi-job/target/ruoyi-modules-job.jar ./gitlink/modules/job/jar
|
||||
}
|
||||
|
||||
|
||||
copy_jar(){
|
||||
# copy jar
|
||||
copy_gateway
|
||||
copy_auth
|
||||
copy_system
|
||||
copy_cms
|
||||
copy_zone
|
||||
copy_file
|
||||
copy_job
|
||||
copy_config
|
||||
copy_sql
|
||||
}
|
||||
copy_config(){
|
||||
# copy 配置文件
|
||||
echo "begin copy config file "
|
||||
rm -f "${docker_data}"/gitlink/nacos/conf/application.properties
|
||||
mkdir -p "${docker_data}"/gitlink/nacos/conf/
|
||||
cp ./nacos/conf/application.properties "${docker_data}"/gitlink/nacos/conf/application.properties
|
||||
|
||||
rm -f "${docker_data}"/gitlink/redis/conf/redis.conf
|
||||
mkdir -p "${docker_data}"/gitlink/redis/conf/
|
||||
cp ./redis/conf/redis.conf "${docker_data}"/gitlink/redis/conf/redis.conf
|
||||
|
||||
rm -f "${docker_data}"/gitlink/nginx/conf/nginx.conf
|
||||
mkdir -p "${docker_data}"/gitlink/nginx/conf/
|
||||
cp ./nginx/conf/nginx.conf "${docker_data}"/gitlink/nginx/conf/nginx.conf
|
||||
}
|
||||
copy_sql(){
|
||||
# copy sql
|
||||
echo "begin copy sql file "
|
||||
rm -f "${docker_data}"/gitlink/mysql/ruoyi-gitlink.sql
|
||||
mkdir -p "${docker_data}"/gitlink/mysql/
|
||||
cp ./gitlink/sql/ruoyi-gitlink.sql "${docker_data}"/gitlink/mysql/ruoyi-gitlink.sql
|
||||
|
||||
rm -f "${docker_data}"/gitlink/mysql/gitlink-nacos-config.sql
|
||||
mkdir -p "${docker_data}"/gitlink/mysql/
|
||||
cp ./nacos/sql/gitlink-nacos-config.sql "${docker_data}"/gitlink/mysql/gitlink-nacos-config.sql
|
||||
}
|
||||
copy_zone_front(){
|
||||
# copy 前端文件
|
||||
echo "begin copy zone front file "
|
||||
rm -rf "${docker_data}"/gitlink/nginx/html/zone_admin
|
||||
mkdir -p "${docker_data}"/gitlink/nginx/html/
|
||||
cp -r ../ruoyi-react/dist "${docker_data}"/gitlink/nginx/html/zone_admin
|
||||
}
|
||||
copy_all(){
|
||||
copy_jar
|
||||
copy_zone_front
|
||||
}
|
||||
|
||||
case "$current_env" in
|
||||
"test")
|
||||
# 获取测试环境配置文件中的安装信息
|
||||
. ./test_config.profile
|
||||
;;
|
||||
"prod")
|
||||
. ./prod_config.profile
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
# 根据输入参数,选择执行对应方法,不输入则执行使用说明
|
||||
case "$2" in
|
||||
"copy_gateway")
|
||||
copy_gateway
|
||||
;;
|
||||
"copy_auth")
|
||||
copy_auth
|
||||
;;
|
||||
"copy_system")
|
||||
copy_system
|
||||
;;
|
||||
"copy_cms")
|
||||
copy_cms
|
||||
;;
|
||||
"copy_zone")
|
||||
copy_zone
|
||||
;;
|
||||
"copy_file")
|
||||
copy_file
|
||||
;;
|
||||
"copy_job")
|
||||
copy_job
|
||||
;;
|
||||
"copy_jar")
|
||||
copy_jar
|
||||
;;
|
||||
"copy_config")
|
||||
copy_config
|
||||
;;
|
||||
"copy_sql")
|
||||
copy_sql
|
||||
;;
|
||||
"copy_zone_front")
|
||||
copy_zone_front
|
||||
;;
|
||||
"copy_all")
|
||||
copy_all
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
|
@ -0,0 +1,222 @@
|
|||
version: '3.8'
|
||||
services:
|
||||
gitlink-mysql:
|
||||
image: mysql:5.7
|
||||
container_name: gitlink-mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=#db_password
|
||||
- MYSQL_DATABASE=#db_name
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- #docker_data/gitlink/mysql/data:/var/lib/mysql
|
||||
- #docker_data/gitlink/mysql/ruoyi-gitlink.sql:/docker-entrypoint-initdb.d/0001.sql
|
||||
- #docker_data/gitlink/mysql/gitlink-nacos-config.sql:/docker-entrypoint-initdb.d/0002.sql
|
||||
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
ports:
|
||||
- "#mapping_mysql_port:3306"
|
||||
restart: always
|
||||
gitlink-nacos:
|
||||
container_name: gitlink-nacos
|
||||
image: nacos/nacos-server:v2.3.1
|
||||
build:
|
||||
context: ./nacos
|
||||
environment:
|
||||
- MODE=standalone
|
||||
- TZ=Asia/Shanghai
|
||||
- NACOS_AUTH_ENABLE=#NACOS_AUTH_ENABLE
|
||||
- SPRING_DATASOURCE_PLATFORM=#NACOS_SPRING_DATASOURCE_PLATFORM
|
||||
- MYSQL_SERVICE_HOST=#NACOS_MYSQL_SERVICE_HOST
|
||||
- MYSQL_SERVICE_PORT=#NACOS_MYSQL_SERVICE_PORT
|
||||
- MYSQL_SERVICE_DB_NAME=#NACOS_MYSQL_SERVICE_DB_NAME
|
||||
- MYSQL_SERVICE_USER=#NACOS_MYSQL_SERVICE_USER
|
||||
- MYSQL_SERVICE_PASSWORD=#NACOS_MYSQL_SERVICE_PASSWORD
|
||||
- NACOS_AUTH_TOKEN=#NACOS_AUTH_TOKEN
|
||||
- NACOS_AUTH_IDENTITY_KEY=#NACOS_AUTH_IDENTITY_KEY
|
||||
- NACOS_AUTH_IDENTITY_VALUE=#NACOS_AUTH_IDENTITY_VALUE
|
||||
volumes:
|
||||
- #docker_data/gitlink/nacos/logs/:/home/nacos/logs
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 1500m
|
||||
links:
|
||||
- gitlink-mysql
|
||||
depends_on:
|
||||
- gitlink-mysql
|
||||
restart: always
|
||||
gitlink-redis:
|
||||
container_name: gitlink-redis
|
||||
image: redis:5.0
|
||||
build:
|
||||
context: ./redis
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- "#mapping_redis_port:6379"
|
||||
volumes:
|
||||
- #docker_data/gitlink/redis/conf/redis.conf:/home/gitlink/redis/redis.conf
|
||||
- #docker_data/gitlink/redis/data:/data
|
||||
command: redis-server /home/gitlink/redis/redis.conf
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 100m
|
||||
restart: always
|
||||
gitlink-nginx:
|
||||
container_name: gitlink-nginx
|
||||
image: nginx
|
||||
build:
|
||||
context: ./nginx
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- "#mapping_gateway_port:#mapping_gateway_port"
|
||||
- "#mapping_nacos_port:8848"
|
||||
volumes:
|
||||
- #docker_data/gitlink/nginx/html/:/home/gitlink/projects/
|
||||
- #docker_data/gitlink/nginx/conf/nginx.conf:/etc/nginx/nginx.conf
|
||||
- #docker_data/gitlink/nginx/logs:/var/log/nginx
|
||||
- #docker_data/gitlink/nginx/conf.d:/etc/nginx/conf.d
|
||||
depends_on:
|
||||
- gitlink-gateway
|
||||
links:
|
||||
- gitlink-gateway
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 100m
|
||||
restart: always
|
||||
gitlink-gateway:
|
||||
container_name: gitlink-gateway
|
||||
build:
|
||||
context: gitlink/gateway
|
||||
dockerfile: dockerfile
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- #docker_data/gitlink/logs:/home/gitlink/logs
|
||||
depends_on:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
links:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 700m
|
||||
restart: always
|
||||
gitlink-auth:
|
||||
container_name: gitlink-auth
|
||||
build:
|
||||
context: gitlink/auth
|
||||
dockerfile: dockerfile
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- #docker_data/gitlink/logs:/home/gitlink/logs
|
||||
depends_on:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
links:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 700m
|
||||
restart: always
|
||||
gitlink-modules-system:
|
||||
container_name: gitlink-modules-system
|
||||
build:
|
||||
context: gitlink/modules/system
|
||||
dockerfile: dockerfile
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- #docker_data/gitlink/logs:/home/gitlink/logs
|
||||
depends_on:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
links:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 700m
|
||||
restart: always
|
||||
gitlink-modules-cms:
|
||||
container_name: gitlink-modules-cms
|
||||
build:
|
||||
context: gitlink/modules/cms
|
||||
dockerfile: dockerfile
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- #docker_data/gitlink/uploadPath:#file_path
|
||||
- #docker_data/gitlink/logs:/home/gitlink/logs
|
||||
depends_on:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
links:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 700m
|
||||
restart: always
|
||||
gitlink-modules-zone:
|
||||
container_name: gitlink-modules-zone
|
||||
build:
|
||||
context: gitlink/modules/zone
|
||||
dockerfile: dockerfile
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- #docker_data/gitlink/logs:/home/gitlink/logs
|
||||
depends_on:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
links:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 700m
|
||||
restart: always
|
||||
gitlink-modules-file:
|
||||
container_name: gitlink-modules-file
|
||||
build:
|
||||
context: gitlink/modules/file
|
||||
dockerfile: dockerfile
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
volumes:
|
||||
- #docker_data/gitlink/uploadPath:#file_path
|
||||
- #docker_data/gitlink/logs:/home/gitlink/logs
|
||||
depends_on:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
links:
|
||||
- gitlink-redis
|
||||
- gitlink-nacos
|
||||
- gitlink-mysql
|
||||
deploy:
|
||||
resources:
|
||||
limits:
|
||||
memory: 700m
|
||||
restart: always
|
|
@ -0,0 +1,148 @@
|
|||
#!/bin/sh
|
||||
|
||||
server_name=$3
|
||||
|
||||
# 使用说明,用来提示输入参数
|
||||
usage() {
|
||||
echo -e "\e[91m错误:必须传入环境和方法两个参数 \e[0m"
|
||||
echo "Usage: sh deploy.sh [test|prod] [port|build_base|mysql|base|build_modules|modules|build_nginx|nginx|stop|rm]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# 开启所需端口
|
||||
port(){
|
||||
firewall-cmd --add-port=80/tcp --permanent
|
||||
firewall-cmd --add-port=8080/tcp --permanent
|
||||
firewall-cmd --add-port=8848/tcp --permanent
|
||||
firewall-cmd --add-port=9848/tcp --permanent
|
||||
firewall-cmd --add-port=9849/tcp --permanent
|
||||
firewall-cmd --add-port=6379/tcp --permanent
|
||||
firewall-cmd --add-port=3306/tcp --permanent
|
||||
firewall-cmd --add-port=9110/tcp --permanent
|
||||
firewall-cmd --add-port=9112/tcp --permanent
|
||||
firewall-cmd --add-port=9113/tcp --permanent
|
||||
firewall-cmd --add-port=9114/tcp --permanent
|
||||
firewall-cmd --add-port=9115/tcp --permanent
|
||||
firewall-cmd --add-port=9116/tcp --permanent
|
||||
service firewalld restart
|
||||
}
|
||||
|
||||
mysql(){
|
||||
docker-compose --compatibility up -d gitlink-mysql
|
||||
}
|
||||
|
||||
# 编译基础环境(必须)
|
||||
build_base(){
|
||||
docker-compose build --no-cache gitlink-redis gitlink-nacos
|
||||
}
|
||||
|
||||
# 启动基础环境(必须)
|
||||
base(){
|
||||
docker-compose --compatibility up -d gitlink-redis gitlink-nacos
|
||||
}
|
||||
|
||||
# 编译程序模块(必须)
|
||||
build_modules(){
|
||||
if [ -z "$server_name" ]; then
|
||||
docker-compose build --no-cache gitlink-gateway gitlink-auth gitlink-modules-system gitlink-modules-cms gitlink-modules-zone gitlink-modules-file
|
||||
else
|
||||
docker-compose build --no-cache "$server_name"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# 启动程序模块(必须)
|
||||
modules(){
|
||||
if [ -z "$server_name" ]; then
|
||||
docker-compose --compatibility up -d gitlink-gateway gitlink-auth gitlink-modules-system gitlink-modules-cms gitlink-modules-zone gitlink-modules-file
|
||||
else
|
||||
docker-compose --compatibility up -d "$server_name"
|
||||
fi
|
||||
}
|
||||
|
||||
# 编译前端运行环境(必须)
|
||||
build_nginx(){
|
||||
docker-compose build --no-cache gitlink-nginx
|
||||
}
|
||||
|
||||
# 启动前端运行环境(必须)
|
||||
nginx(){
|
||||
docker-compose --compatibility up -d gitlink-nginx
|
||||
}
|
||||
|
||||
# 关闭所有环境/模块
|
||||
stop(){
|
||||
docker-compose stop
|
||||
}
|
||||
# 关闭所有环境/模块
|
||||
stop_modules(){
|
||||
if [ -z "$server_name" ]; then
|
||||
docker-compose stop gitlink-gateway gitlink-auth gitlink-modules-system gitlink-modules-cms gitlink-modules-zone gitlink-modules-file
|
||||
else
|
||||
docker-compose stop "$server_name"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
# 删除所有环境/模块
|
||||
rm(){
|
||||
if [ -z "$server_name" ]; then
|
||||
docker-compose rm -f
|
||||
else
|
||||
docker-compose rm -f "$server_name"
|
||||
fi
|
||||
|
||||
}
|
||||
# 根据输入参数,使用不同环境的配置文件
|
||||
case "$1" in
|
||||
"test")
|
||||
# 获取测试环境配置文件中的安装信息
|
||||
. ./test_config.profile
|
||||
;;
|
||||
"prod")
|
||||
. ./prod_config.profile
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
# 根据输入参数,选择执行对应方法,不输入则执行使用说明
|
||||
case "$2" in
|
||||
"port")
|
||||
port
|
||||
;;
|
||||
"mysql")
|
||||
mysql
|
||||
;;
|
||||
"base")
|
||||
base
|
||||
;;
|
||||
"build_base")
|
||||
build_base
|
||||
;;
|
||||
"build_modules")
|
||||
build_modules
|
||||
;;
|
||||
"modules")
|
||||
modules
|
||||
;;
|
||||
"build_nginx")
|
||||
build_nginx
|
||||
;;
|
||||
"nginx")
|
||||
nginx
|
||||
;;
|
||||
"stop_modules")
|
||||
stop_modules
|
||||
;;
|
||||
"stop")
|
||||
stop
|
||||
;;
|
||||
"rm")
|
||||
rm
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
|
@ -0,0 +1,96 @@
|
|||
## 部署环境
|
||||
deploy_env=dev
|
||||
## 基础镜像版本
|
||||
base_image_version=1.0.0
|
||||
## Nacos数据库连接
|
||||
NACOS_SPRING_DATASOURCE_PLATFORM=mysql
|
||||
NACOS_MYSQL_SERVICE_HOST=127.0.0.1
|
||||
NACOS_MYSQL_SERVICE_PORT=3306
|
||||
NACOS_MYSQL_SERVICE_DB_NAME=gitlink-nacos-config
|
||||
NACOS_MYSQL_SERVICE_USER=root
|
||||
NACOS_MYSQL_SERVICE_PASSWORD=123456
|
||||
NACOS_AUTH_ENABLE=true
|
||||
NACOS_AUTH_TOKEN=RHBxaW5kTllsQ1dIUlJ6ZXM0ajdzUmgxbXJIMzVaZFFmbXlqNkw5c1dCNnBFd082V21EeFBtME5NazFYYnQwWW43ekZXQQ==
|
||||
NACOS_AUTH_IDENTITY_KEY=gitlink_key
|
||||
NACOS_AUTH_IDENTITY_VALUE=gitlink_value
|
||||
nacos_db_username=root
|
||||
nacos_db_password=123456
|
||||
## 连接Nacos配置
|
||||
nacos_ip=127.0.0.1
|
||||
nacos_port=8848
|
||||
nacos_username=nacos
|
||||
nacos_password=nacos
|
||||
## 连接Redis配置
|
||||
redis_ip=127.0.0.1
|
||||
redis_port=6379
|
||||
## 业务库数据源配置
|
||||
mysql_root_password=123456
|
||||
db_url=127.0.0.1:3306
|
||||
db_host=127.0.0.1
|
||||
db_name=ruoyi-gitlink
|
||||
db_username=root
|
||||
db_password=123456
|
||||
mapping_mysql_port=3306
|
||||
## GitLink库数据源配置
|
||||
gitlink_db_url=127.0.0.1:3306
|
||||
gitlink_db_name=test_gitlink_user
|
||||
gitlink_db_username=root
|
||||
gitlink_db_password=123456
|
||||
## 文件服务访问地址
|
||||
file_url=https://10.47.38.116:8080/file
|
||||
# 容器内文件上传路径
|
||||
file_path=/home/gitlink/uploadPath
|
||||
## 内容管理系统配置
|
||||
# 自动提取概要最大长度
|
||||
cms_summaryMaxLength=100
|
||||
# 特色专区项目组织名称
|
||||
cms_gitLinkOrganization=prefecture
|
||||
# 专区资讯详情路由
|
||||
cmsDetailPath=/newdetail
|
||||
# GitLink访问地址
|
||||
cms_gitLinkUrl=https://testforgeplus.trustie.net/
|
||||
## skywalking配置
|
||||
skywalking_backend_service=172.20.32.205:11800
|
||||
## Docker数据路径
|
||||
docker_data=/data/docker-data
|
||||
## Nacos映射端口
|
||||
mapping_nacos_port=8848
|
||||
## Redis映射端口
|
||||
mapping_redis_port=26379
|
||||
## Gateway映射端口
|
||||
mapping_gateway_port=8080
|
||||
## 专区相关配置
|
||||
# 邀请链接有效时长(单位:天)
|
||||
invitationLinkExpirationTime=10
|
||||
# 邀请确认页面
|
||||
invitationPagePath=/index
|
||||
# 消息模板
|
||||
messageTemplate=1428
|
||||
# 会员加入失败消息模板
|
||||
memberMessageTemplate=1428
|
||||
# 专区管理地址
|
||||
zoneAdminUrl=https://testgetway.trustie.net/zone/list
|
||||
# 专区首页前缀
|
||||
zoneHomepagePath=/zone
|
||||
# 专区会员后缀
|
||||
zoneMemberPath=/VIP
|
||||
# 专区配置地址
|
||||
zoneConfigurationUrl=http://127.0.0.1/zone/configuration
|
||||
# 专区资讯管理地址
|
||||
docManageUrl=http://127.0.0.1/zone/content/doc
|
||||
# 专区资源管理地址
|
||||
resourceManageUrl=http://127.0.0.1/zone/resource/resource
|
||||
# 项目聚合中,GitLink项目Id
|
||||
gitlinkProjectId=546714
|
||||
# 会员聚合中,gitlink用户名
|
||||
gitLinkUserName1=floraachy
|
||||
gitLinkUserName2=innov
|
||||
gitLinkUserName3=ttt77777
|
||||
gitLinkUserName4=OTTO
|
||||
## 网关地址
|
||||
gatewayUrl=http://127.0.0.1:8080
|
||||
## 内置gitlink管理员账号
|
||||
gitlinkAdminUsername=innov
|
||||
gitlinkAdminPassword=12345678
|
||||
gitlinkClientId=yllzwpMD2U5sAKHVnWbUiIZVpbp63DL7FleZi49uUXY
|
||||
gitlinkClientSecret=AdfaPHO_RJf3Tnz3n9xuCuYKpCt9Nioy9bYY6EJY7TI
|
|
@ -0,0 +1,15 @@
|
|||
# 基础镜像
|
||||
FROM gitlink-java:#base_image_version
|
||||
|
||||
# 复制jar文件到路径
|
||||
COPY ./jar/ruoyi-auth.jar /home/gitlink/ruoyi-auth.jar
|
||||
# 启动认证服务
|
||||
ENTRYPOINT java -javaagent:/home/gitlink/skywalking-agent/skywalking-agent.jar \
|
||||
-Dskywalking.agent.service_name=#deploy_env::ruoyi-auth \
|
||||
-Dskywalking.collector.backend_service=#skywalking_backend_service \
|
||||
-jar ruoyi-auth.jar \
|
||||
--nacos_ip=#nacos_ip \
|
||||
--nacos_port=#nacos_port \
|
||||
--nacos_username=#nacos_username \
|
||||
--nacos_password=#nacos_password \
|
||||
--spring.profiles.active=prod
|
|
@ -0,0 +1 @@
|
|||
存放认证中心打包好的jar文件,用于docker启动应用。
|
|
@ -0,0 +1,14 @@
|
|||
# 基础镜像
|
||||
FROM openjdk:8-jre
|
||||
# author
|
||||
MAINTAINER gitlink
|
||||
# 挂载目录
|
||||
VOLUME /home/gitlink
|
||||
# 创建目录
|
||||
RUN mkdir -p /home/gitlink
|
||||
# 指定路径
|
||||
WORKDIR /home/gitlink
|
||||
# 复制skywalking-agent文件到路径
|
||||
ADD skywalking/skywalking-agent.tar.gz /home/gitlink/
|
||||
# 启动bash
|
||||
CMD ["/bin/bash"]
|
Binary file not shown.
|
@ -0,0 +1,14 @@
|
|||
# 基础镜像
|
||||
FROM gitlink-java:#base_image_version
|
||||
# 复制jar文件到路径
|
||||
COPY ./jar/ruoyi-gateway.jar /home/gitlink/ruoyi-gateway.jar
|
||||
# 启动网关服务
|
||||
ENTRYPOINT java -javaagent:/home/gitlink/skywalking-agent/skywalking-agent.jar \
|
||||
-Dskywalking.agent.service_name=#deploy_env::ruoyi-gateway \
|
||||
-Dskywalking.collector.backend_service=#skywalking_backend_service \
|
||||
-jar ruoyi-gateway.jar \
|
||||
--nacos_ip=#nacos_ip \
|
||||
--nacos_port=#nacos_port \
|
||||
--nacos_username=#nacos_username \
|
||||
--nacos_password=#nacos_password \
|
||||
--spring.profiles.active=prod
|
|
@ -0,0 +1 @@
|
|||
存放网关中心打包好的jar文件,用于docker启动应用。
|
|
@ -0,0 +1,14 @@
|
|||
# 基础镜像
|
||||
FROM gitlink-java:#base_image_version
|
||||
# 复制jar文件到路径
|
||||
COPY ./jar/ruoyi-modules-cms.jar /home/gitlink/ruoyi-modules-cms.jar
|
||||
# 启动系统服务
|
||||
ENTRYPOINT java -javaagent:/home/gitlink/skywalking-agent/skywalking-agent.jar \
|
||||
-Dskywalking.agent.service_name=#deploy_env::ruoyi-modules-cms \
|
||||
-Dskywalking.collector.backend_service=#skywalking_backend_service \
|
||||
-jar ruoyi-modules-cms.jar \
|
||||
--nacos_ip=#nacos_ip \
|
||||
--nacos_port=#nacos_port \
|
||||
--nacos_username=#nacos_username \
|
||||
--nacos_password=#nacos_password \
|
||||
--spring.profiles.active=prod
|
|
@ -0,0 +1 @@
|
|||
存放内容管理服务打包好的jar文件,用于docker启动应用。
|
|
@ -0,0 +1,14 @@
|
|||
# 基础镜像
|
||||
FROM gitlink-java:#base_image_version
|
||||
# 复制jar文件到路径
|
||||
COPY ./jar/ruoyi-modules-file.jar /home/gitlink/ruoyi-modules-file.jar
|
||||
# 启动文件服务
|
||||
ENTRYPOINT java -javaagent:/home/gitlink/skywalking-agent/skywalking-agent.jar \
|
||||
-Dskywalking.agent.service_name=#deploy_env::ruoyi-modules-file \
|
||||
-Dskywalking.collector.backend_service=#skywalking_backend_service \
|
||||
-jar ruoyi-modules-file.jar \
|
||||
--nacos_ip=#nacos_ip \
|
||||
--nacos_port=#nacos_port \
|
||||
--nacos_username=#nacos_username \
|
||||
--nacos_password=#nacos_password \
|
||||
--spring.profiles.active=prod
|
|
@ -0,0 +1 @@
|
|||
存放文件服务打包好的jar文件,用于docker启动应用。
|
|
@ -0,0 +1,14 @@
|
|||
# 基础镜像
|
||||
FROM gitlink-java:#base_image_version
|
||||
# 复制jar文件到路径
|
||||
COPY ./jar/ruoyi-modules-job.jar /home/gitlink/ruoyi-modules-job.jar
|
||||
# 启动定时任务服务
|
||||
ENTRYPOINT java -javaagent:/home/gitlink/skywalking-agent/skywalking-agent.jar \
|
||||
-Dskywalking.agent.service_name=#deploy_env::ruoyi-modules-job \
|
||||
-Dskywalking.collector.backend_service=#skywalking_backend_service \
|
||||
-jar ruoyi-modules-job.jar \
|
||||
--nacos_ip=#nacos_ip \
|
||||
--nacos_port=#nacos_port \
|
||||
--nacos_username=#nacos_username \
|
||||
--nacos_password=#nacos_password \
|
||||
--spring.profiles.active=prod
|
|
@ -0,0 +1 @@
|
|||
存放定时任务服务打包好的jar文件,用于docker启动应用。
|
|
@ -0,0 +1,14 @@
|
|||
# 基础镜像
|
||||
FROM gitlink-java:#base_image_version
|
||||
# 复制jar文件到路径
|
||||
COPY ./jar/ruoyi-modules-system.jar /home/gitlink/ruoyi-modules-system.jar
|
||||
# 启动系统服务
|
||||
ENTRYPOINT java -javaagent:/home/gitlink/skywalking-agent/skywalking-agent.jar \
|
||||
-Dskywalking.agent.service_name=#deploy_env::ruoyi-modules-system \
|
||||
-Dskywalking.collector.backend_service=#skywalking_backend_service \
|
||||
-jar ruoyi-modules-system.jar \
|
||||
--nacos_ip=#nacos_ip \
|
||||
--nacos_port=#nacos_port \
|
||||
--nacos_username=#nacos_username \
|
||||
--nacos_password=#nacos_password \
|
||||
--spring.profiles.active=prod
|
|
@ -0,0 +1 @@
|
|||
存放系统服务打包好的jar文件,用于docker启动应用。
|
|
@ -0,0 +1,14 @@
|
|||
# 基础镜像
|
||||
FROM gitlink-java:#base_image_version
|
||||
# 复制jar文件到路径
|
||||
COPY ./jar/ruoyi-modules-zone.jar /home/gitlink/ruoyi-modules-zone.jar
|
||||
# 启动系统服务
|
||||
ENTRYPOINT java -javaagent:/home/gitlink/skywalking-agent/skywalking-agent.jar \
|
||||
-Dskywalking.agent.service_name=#deploy_env::ruoyi-modules-zone \
|
||||
-Dskywalking.collector.backend_service=#skywalking_backend_service \
|
||||
-jar ruoyi-modules-zone.jar \
|
||||
--nacos_ip=#nacos_ip \
|
||||
--nacos_port=#nacos_port \
|
||||
--nacos_username=#nacos_username \
|
||||
--nacos_password=#nacos_password \
|
||||
--spring.profiles.active=prod
|
|
@ -0,0 +1 @@
|
|||
存放内容管理服务打包好的jar文件,用于docker启动应用。
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,4 @@
|
|||
# 基础镜像
|
||||
FROM nacos/nacos-server:v2.3.1
|
||||
# author
|
||||
MAINTAINER gitlink
|
|
@ -0,0 +1,424 @@
|
|||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config_info`;
|
||||
CREATE TABLE `config_info`
|
||||
(
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
|
||||
`content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`md5` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'md5',
|
||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`src_user` text CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT 'source user',
|
||||
`src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip',
|
||||
`app_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
|
||||
`tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '租户字段',
|
||||
`c_desc` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
|
||||
`c_use` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
|
||||
`effect` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
|
||||
`type` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
|
||||
`c_schema` text CHARACTER SET utf8 COLLATE utf8_bin NULL,
|
||||
`encrypted_data_key` text CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT '秘钥',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_configinfo_datagrouptenant` (`data_id`, `group_id`, `tenant_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 55
|
||||
CHARACTER SET = utf8
|
||||
COLLATE = utf8_bin COMMENT = 'config_info'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of config_info
|
||||
-- ----------------------------
|
||||
INSERT INTO `config_info`
|
||||
VALUES (1, 'application-prod.yml', 'DEFAULT_GROUP',
|
||||
'spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\n servlet:\n multipart:\n max-file-size: 100MB\n max-request-size: 100MB\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n\nhttp:\n #最大连接数\n maxTotal: 100\n #并发数\n defaultMaxPerRoute: 20\n #创建连接的最长时间\n connectTimeout: 1000\n #从连接池中获取到连接的最长时间\n connectionRequestTimeout: 500\n #数据传输的最长时间\n socketTimeout: 10000\n #提交请求前测试连接是否可用\n staleConnectionCheckEnabled: true\n #gitlink请求地址\n gitLinkUrl: #cms_gitLinkUrl\n #网关请求地址\n gatewayUrl: #gatewayUrl\n\nswagger:\n host: #gatewayUrl/api\n\ngitlink:\n admin_user:\n username: #gitlinkAdminUsername\n password: #gitlinkAdminPassword\n client_id: #gitlinkClientId\n client_secret: #gitlinkClientSecret\n',
|
||||
'5f9b789aa22c2418a629ca812a0b6176', '2020-05-20 12:00:00', '2023-12-08 09:24:50', 'nacos', '172.18.0.1', '', '',
|
||||
'通用配置', 'null', 'null', 'yaml', '', '');
|
||||
INSERT INTO `config_info`
|
||||
VALUES (2, 'ruoyi-gateway-prod.yml', 'DEFAULT_GROUP',
|
||||
'spring:\n redis:\n host: #redis_ip\n port: #redis_port\n password:\n cloud:\n gateway:\n globalcors: #跨域问题\n cors-configurations:\n \'[/**]\':\n allowedOriginPatterns:\n - \"*\"\n allowedHeaders:\n - \"*\"\n allowCredentials: true\n maxAge: 360000\n allowedMethods:\n - GET\n - POST\n - DELETE\n - PUT\n - OPTIONS\n - HEAD\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: ruoyi-auth\n uri: lb://ruoyi-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestFilter\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: ruoyi-gen\n uri: lb://ruoyi-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: ruoyi-job\n uri: lb://ruoyi-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: ruoyi-system\n uri: lb://ruoyi-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: ruoyi-file\n uri: lb://ruoyi-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n # 内容管理服务\n - id: ruoyi-cms\n uri: lb://ruoyi-cms\n predicates:\n - Path=/cms/**\n filters:\n - StripPrefix=1\n \n # 特色专区服务\n - id: ruoyi-zone\n uri: lb://ruoyi-zone\n predicates:\n - Path=/zone/**\n filters:\n - StripPrefix=1\n\n # 项目管理服务\n - id: ruoyi-pms\n uri: lb://ruoyi-pms\n predicates:\n - Path=/pms/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /csrf\n - /profile/**\n - /cms/blog/cms/**\n - /cms/message/cms/**\n - /cms/comment/cms/**\n - /file/statics/**\n - /cms/doc/open/**\n - /zone/open/**\n - /file/open/**\n',
|
||||
'22aff6c040e82ae8ad57a83170ffc15d', '2020-05-14 14:17:55', '2023-12-07 15:06:06', 'nacos', '172.18.0.1', '', '',
|
||||
'网关模块', 'null', 'null', 'yaml', '', '');
|
||||
INSERT INTO `config_info`
|
||||
VALUES (3, 'ruoyi-auth-prod.yml', 'DEFAULT_GROUP',
|
||||
'spring:\n redis:\n host: #redis_ip\n port: #redis_port\n password:\n',
|
||||
'fa91c345f1bf98f36d1f4d6fe24cb925', '2020-11-20 00:00:00', '2023-04-26 16:27:42', 'nacos', '172.18.0.1', '', '',
|
||||
'认证中心', 'null', 'null', 'yaml', '', '');
|
||||
INSERT INTO `config_info`
|
||||
VALUES (5, 'ruoyi-system-prod.yml', 'DEFAULT_GROUP',
|
||||
'# spring配置\nspring:\n redis:\n host: #redis_ip\n port: #redis_port\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://#db_url/#db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: #db_username\n password: #db_password\n # 从库数据源\n slave:\n username: #gitlink_db_username\n password: #gitlink_db_password\n url: jdbc:mysql://#gitlink_db_url/#gitlink_db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n driver-class-name: com.mysql.cj.jdbc.Driver\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.system\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n configuration:\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n\n# swagger配置\nswagger:\n title: 系统模块接口文档\n license: Powered By ruoyi\n licenseUrl: https://ruoyi.vip',
|
||||
'0530f34dae0dd2f3d905b66334e438a2', '2020-11-20 00:00:00', '2023-04-26 16:28:09', 'nacos', '172.18.0.1', '', '',
|
||||
'系统模块', 'null', 'null', 'yaml', '', '');
|
||||
INSERT INTO `config_info`
|
||||
VALUES (7, 'ruoyi-job-prod.yml', 'DEFAULT_GROUP',
|
||||
'# spring配置\nspring:\n redis:\n host: #redis_ip\n port: #redis_port\n password: \n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://#db_url/#db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: #db_username\n password: #db_password\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.job.domain\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n\n# swagger配置\nswagger:\n title: 定时任务接口文档\n license: Powered By ruoyi\n licenseUrl: https://ruoyi.vip\n',
|
||||
'70213ed62c6a9fc42cd652c11556483e', '2020-11-20 00:00:00', '2023-04-26 16:28:25', 'nacos', '172.18.0.1', '', '',
|
||||
'定时任务', 'null', 'null', 'yaml', '', '');
|
||||
INSERT INTO `config_info`
|
||||
VALUES (8, 'ruoyi-file-prod.yml', 'DEFAULT_GROUP',
|
||||
'# 本地文件上传 \nfile:\n domain: #file_url\n path: #file_path\n prefix: /statics\n # 允许的文件后缀(该格式允许通过静态资源直接访问)\n allowedExtension: gif,jfif,svg,webp,bmp,gif,jpg,jpeg,png\n # cms允许的文件后缀\n cmsAllowedExtension: gif,jfif,svg,webp,bmp,gif,jpg,jpeg,png,mp4,avi,rmvb,mov,wmv,flv,webm,mkv\n # 允许的最大文件大小(单位MB)\n maxSize: 200\n # 文件名最大长度\n maxNameSize: 100\n\n# FastDFS配置\nfdfs:\n domain: http://8.129.231.12\n soTimeout: 3000\n connectTimeout: 2000\n trackerList: 8.129.231.12:22122\n\n# Minio配置\nminio:\n url: http://8.129.231.12:9000\n accessKey: minioadmin\n secretKey: minioadmin\n bucketName: test\n# spring配置\nspring:\n redis:\n host: #redis_ip\n port: #redis_port\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://#db_url/#db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: #db_username\n password: #db_password\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.file\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n configuration:\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl',
|
||||
'a63f9934c3961d24333cb58592457d6a', '2020-11-20 00:00:00', '2023-12-07 15:08:54', 'nacos', '172.18.0.1', '', '',
|
||||
'文件服务', 'null', 'null', 'yaml', '', '');
|
||||
INSERT INTO `config_info`
|
||||
VALUES (9, 'sentinel-ruoyi-gateway', 'DEFAULT_GROUP',
|
||||
'[\r\n {\r\n \"resource\": \"ruoyi-auth\",\r\n \"count\": 500,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"ruoyi-system\",\r\n \"count\": 1000,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"ruoyi-gen\",\r\n \"count\": 200,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n },\r\n {\r\n \"resource\": \"ruoyi-job\",\r\n \"count\": 300,\r\n \"grade\": 1,\r\n \"limitApp\": \"default\",\r\n \"strategy\": 0,\r\n \"controlBehavior\": 0\r\n }\r\n]',
|
||||
'9f3a3069261598f74220bc47958ec252', '2020-11-20 00:00:00', '2020-11-20 00:00:00', NULL, '0:0:0:0:0:0:0:1', '',
|
||||
'', '限流策略', 'null', 'null', 'json', NULL, '');
|
||||
INSERT INTO `config_info`
|
||||
VALUES (14, 'ruoyi-cms-prod.yml', 'DEFAULT_GROUP',
|
||||
'# spring配置\nspring:\n redis:\n host: #redis_ip\n port: #redis_port\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://#db_url/#db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: #db_username\n password: #db_password\n # 从库数据源\n # slave:\n # username: root\n # password: Trust_#%01\n # url: jdbc:mysql://173.15.15.83:3306/testjunkenewweb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n # driver-class-name: com.mysql.cj.jdbc.Driver\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.cms\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n configuration:\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n\n# swagger配置\nswagger:\n title: 内容管理模块接口文档\n license: Powered By ruoyi\n licenseUrl: https://ruoyi.vip\n\ncms:\n summaryMaxLength: #cms_summaryMaxLength\n gitLinkOrganization: #cms_gitLinkOrganization\n #专区资讯详情路由\n detailPath: #cmsDetailPath\n',
|
||||
'7107b9b8e369432a754cfd7ac8d0fdcd', '2023-03-21 14:26:45', '2023-12-07 15:09:25', 'nacos', '172.18.0.1', '', '',
|
||||
'', '', '', 'yaml', '', '');
|
||||
INSERT INTO `config_info`
|
||||
VALUES (45, 'ruoyi-zone-prod.yml', 'DEFAULT_GROUP',
|
||||
'# spring配置\nspring:\n redis:\n host: #redis_ip\n port: #redis_port\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://#db_url/#db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: #db_username\n password: #db_password\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.zone\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n configuration:\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n\n# swagger配置\nswagger:\n title: 内容管理模块接口文档\n license: Powered By ruoyi\n licenseUrl: https://ruoyi.vip\n\nzone:\n #邀请链接有效时长(单位:天)\n invitationLinkExpirationTime: #invitationLinkExpirationTime\n #邀请确认页面\n invitationPagePath: #invitationPagePath\n #消息模板\n messageTemplate: #messageTemplate\n #会员加入失败消息模板\n memberMessageTemplate: #memberMessageTemplate\n #专区管理地址\n zoneAdminUrl: #zoneAdminUrl\n #专区首页前缀\n zoneHomepagePath: #zoneHomepagePath\n #专区会员后缀\n zoneMemberPath: #zoneMemberPath\n #后台管理地址\n adminUrl: #adminUrl\n #专区配置地址\n zoneConfigurationUrl: #zoneConfigurationUrl\n #专区资讯管理地址\n docManageUrl: #docManageUrl\n #专区资源管理地址\n resourceManageUrl: #resourceManageUrl\n #专区初始化数据\n initData:\n #项目聚合中,GitLink项目Id\n gitlinkProjectId: #gitlinkProjectId\n #会员聚合中,gitlink用户名\n gitLinkUserName1: #gitLinkUserName1\n gitLinkUserName2: #gitLinkUserName2\n gitLinkUserName3: #gitLinkUserName3\n gitLinkUserName4: #gitLinkUserName4',
|
||||
'd54d4255749d67f314e3985176e26624', '2023-05-16 09:05:57', '2023-12-07 15:12:49', 'nacos', '172.18.0.1', '', '',
|
||||
'', '', '', 'yaml', '', '');
|
||||
INSERT INTO `config_info`
|
||||
VALUES (52, 'ruoyi-pms-prod.yml', 'DEFAULT_GROUP',
|
||||
'# spring配置\r\nspring:\r\n redis:\r\n host: #redis_ip\r\n port: #redis_port\r\n password:\r\n datasource:\r\n druid:\r\n stat-view-servlet:\r\n enabled: true\r\n loginUsername: admin\r\n loginPassword: 123456\r\n dynamic:\r\n druid:\r\n initial-size: 5\r\n min-idle: 5\r\n maxActive: 20\r\n maxWait: 60000\r\n timeBetweenEvictionRunsMillis: 60000\r\n minEvictableIdleTimeMillis: 300000\r\n validationQuery: SELECT 1 FROM DUAL\r\n testWhileIdle: true\r\n testOnBorrow: false\r\n testOnReturn: false\r\n poolPreparedStatements: true\r\n maxPoolPreparedStatementPerConnectionSize: 20\r\n filters: stat,slf4j\r\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\r\n datasource:\r\n # 主库数据源\r\n master:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://#db_url/#db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: #db_username\r\n password: #db_password\r\n\r\n# mybatis配置\r\nmybatis:\r\n # 搜索指定包别名\r\n typeAliasesPackage: com.ruoyi.pms\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n configuration:\r\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n\r\n# swagger配置\r\nswagger:\r\n title: 项目管理模块接口文档\r\n license: Powered By ruoyi\r\n licenseUrl: https://ruoyi.vip',
|
||||
'375d4b57eaf365c384f8baedc0c15092', '2023-12-07 15:16:03', '2023-12-07 15:16:03', NULL, '172.18.0.1', '', '',
|
||||
NULL, NULL, NULL, 'yaml', NULL, '');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_info_aggr
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config_info_aggr`;
|
||||
CREATE TABLE `config_info_aggr`
|
||||
(
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`datum_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'datum_id',
|
||||
`content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '内容',
|
||||
`gmt_modified` datetime NOT NULL COMMENT '修改时间',
|
||||
`app_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
|
||||
`tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '租户字段',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_configinfoaggr_datagrouptenantdatum` (`data_id`, `group_id`, `tenant_id`, `datum_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
CHARACTER SET = utf8
|
||||
COLLATE = utf8_bin COMMENT = '增加租户字段'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of config_info_aggr
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_info_beta
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config_info_beta`;
|
||||
CREATE TABLE `config_info_beta`
|
||||
(
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`app_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'app_name',
|
||||
`content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`beta_ips` varchar(1024) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'betaIps',
|
||||
`md5` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'md5',
|
||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`src_user` text CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT 'source user',
|
||||
`src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip',
|
||||
`tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '租户字段',
|
||||
`encrypted_data_key` text CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT '秘钥',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_configinfobeta_datagrouptenant` (`data_id`, `group_id`, `tenant_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
CHARACTER SET = utf8
|
||||
COLLATE = utf8_bin COMMENT = 'config_info_beta'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of config_info_beta
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_info_tag
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config_info_tag`;
|
||||
CREATE TABLE `config_info_tag`
|
||||
(
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT 'tenant_id',
|
||||
`tag_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'tag_id',
|
||||
`app_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'app_name',
|
||||
`content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'content',
|
||||
`md5` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'md5',
|
||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
`src_user` text CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT 'source user',
|
||||
`src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'source ip',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_configinfotag_datagrouptenanttag` (`data_id`, `group_id`, `tenant_id`, `tag_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
CHARACTER SET = utf8
|
||||
COLLATE = utf8_bin COMMENT = 'config_info_tag'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of config_info_tag
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for config_tags_relation
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `config_tags_relation`;
|
||||
CREATE TABLE `config_tags_relation`
|
||||
(
|
||||
`id` bigint(20) NOT NULL COMMENT 'id',
|
||||
`tag_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'tag_name',
|
||||
`tag_type` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'tag_type',
|
||||
`data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'data_id',
|
||||
`group_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'group_id',
|
||||
`tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT 'tenant_id',
|
||||
`nid` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
PRIMARY KEY (`nid`) USING BTREE,
|
||||
UNIQUE INDEX `uk_configtagrelation_configidtag` (`id`, `tag_name`, `tag_type`) USING BTREE,
|
||||
INDEX `idx_tenant_id` (`tenant_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
CHARACTER SET = utf8
|
||||
COLLATE = utf8_bin COMMENT = 'config_tag_relation'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of config_tags_relation
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for group_capacity
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `group_capacity`;
|
||||
CREATE TABLE `group_capacity`
|
||||
(
|
||||
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`group_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Group ID,空字符表示整个集群',
|
||||
`quota` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '配额,0表示使用默认值',
|
||||
`usage` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用量',
|
||||
`max_size` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
|
||||
`max_aggr_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '聚合子配置最大个数,,0表示使用默认值',
|
||||
`max_aggr_size` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
|
||||
`max_history_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最大变更历史数量',
|
||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_group_id` (`group_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
CHARACTER SET = utf8
|
||||
COLLATE = utf8_bin COMMENT = '集群、各Group容量信息表'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of group_capacity
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for his_config_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `his_config_info`;
|
||||
CREATE TABLE `his_config_info`
|
||||
(
|
||||
`id` bigint(64) UNSIGNED NOT NULL,
|
||||
`nid` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||
`data_id` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
|
||||
`group_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
|
||||
`app_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'app_name',
|
||||
`content` longtext CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
|
||||
`md5` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
|
||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`src_user` text CHARACTER SET utf8 COLLATE utf8_bin NULL,
|
||||
`src_ip` varchar(50) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
|
||||
`op_type` char(10) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL,
|
||||
`tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '租户字段',
|
||||
`encrypted_data_key` text CHARACTER SET utf8 COLLATE utf8_bin NULL COMMENT '秘钥',
|
||||
PRIMARY KEY (`nid`) USING BTREE,
|
||||
INDEX `idx_gmt_create` (`gmt_create`) USING BTREE,
|
||||
INDEX `idx_gmt_modified` (`gmt_modified`) USING BTREE,
|
||||
INDEX `idx_did` (`data_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 10
|
||||
CHARACTER SET = utf8
|
||||
COLLATE = utf8_bin COMMENT = '多租户改造'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of his_config_info
|
||||
-- ----------------------------
|
||||
INSERT INTO `his_config_info`
|
||||
VALUES (1, 1, 'application-prod.yml', 'DEFAULT_GROUP', '',
|
||||
'spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\n servlet:\n multipart:\n max-file-size: 100MB\n max-request-size: 100MB\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n\n\nhttp:\n #最大连接数\n maxTotal: 100\n #并发数\n defaultMaxPerRoute: 20\n #创建连接的最长时间\n connectTimeout: 1000\n #从连接池中获取到连接的最长时间\n connectionRequestTimeout: 500\n #数据传输的最长时间\n socketTimeout: 10000\n #提交请求前测试连接是否可用\n staleConnectionCheckEnabled: true\n #gitlink请求地址\n gitLinkUrl: #cms_gitLinkUrl\n',
|
||||
'0466a4b215975b0659266be39de36b15', '2023-12-07 15:02:44', '2023-12-07 15:02:45', 'nacos', '172.18.0.1', 'U',
|
||||
'', '');
|
||||
INSERT INTO `his_config_info`
|
||||
VALUES (2, 2, 'ruoyi-gateway-prod.yml', 'DEFAULT_GROUP', '',
|
||||
'spring:\n redis:\n host: #redis_ip\n port: #redis_port\n password:\n cloud:\n gateway:\n globalcors: #跨域问题\n cors-configurations:\n \'[/**]\':\n allowedOriginPatterns:\n - \"*\"\n allowedHeaders:\n - \"*\"\n allowCredentials: true\n maxAge: 360000\n allowedMethods:\n - GET\n - POST\n - DELETE\n - PUT\n - OPTIONS\n - HEAD\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: ruoyi-auth\n uri: lb://ruoyi-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestFilter\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: ruoyi-gen\n uri: lb://ruoyi-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: ruoyi-job\n uri: lb://ruoyi-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: ruoyi-system\n uri: lb://ruoyi-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: ruoyi-file\n uri: lb://ruoyi-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n # 内容管理服务\n - id: ruoyi-cms\n uri: lb://ruoyi-cms\n predicates:\n - Path=/cms/**\n filters:\n - StripPrefix=1\n # 特色专区服务\n - id: ruoyi-zone\n uri: lb://ruoyi-zone\n predicates:\n - Path=/zone/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /csrf\n - /profile/**\n - /cms/blog/cms/**\n - /cms/message/cms/**\n - /cms/comment/cms/**\n - /file/statics/**\n - /cms/doc/open/**\n - /zone/open/**\n',
|
||||
'dedf84995bd0ece580befa5ca05e79d0', '2023-12-07 15:06:05', '2023-12-07 15:06:06', 'nacos', '172.18.0.1', 'U',
|
||||
'', '');
|
||||
INSERT INTO `his_config_info`
|
||||
VALUES (1, 3, 'application-prod.yml', 'DEFAULT_GROUP', '',
|
||||
'spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\n servlet:\n multipart:\n max-file-size: 100MB\n max-request-size: 100MB\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n\n\nhttp:\n #最大连接数\n maxTotal: 100\n #并发数\n defaultMaxPerRoute: 20\n #创建连接的最长时间\n connectTimeout: 1000\n #从连接池中获取到连接的最长时间\n connectionRequestTimeout: 500\n #数据传输的最长时间\n socketTimeout: 10000\n #提交请求前测试连接是否可用\n staleConnectionCheckEnabled: true\n #gitlink请求地址\n gitLinkUrl: #cms_gitLinkUrl\n #网关请求地址\n gatewayUrl: #gatewayUrl\n\ngitlink:\n admin_user:\n username: #gitlinkAdminUsername\n password: #gitlinkAdminPassword\n client_id: #gitlinkClientId\n client_secret: #gitlinkClientSecret\n',
|
||||
'ac2b302f7b4f774a8458905b84dac26a', '2023-12-07 15:06:33', '2023-12-07 15:06:34', 'nacos', '172.18.0.1', 'U',
|
||||
'', '');
|
||||
INSERT INTO `his_config_info`
|
||||
VALUES (8, 4, 'ruoyi-file-prod.yml', 'DEFAULT_GROUP', '',
|
||||
'# 本地文件上传 \nfile:\n domain: #file_url\n path: #file_path\n prefix: /statics\n\n# FastDFS配置\nfdfs:\n domain: http://8.129.231.12\n soTimeout: 3000\n connectTimeout: 2000\n trackerList: 8.129.231.12:22122\n\n# Minio配置\nminio:\n url: http://8.129.231.12:9000\n accessKey: minioadmin\n secretKey: minioadmin\n bucketName: test',
|
||||
'1ca67f615144b6dae3d1fcc437c1e681', '2023-12-07 15:08:53', '2023-12-07 15:08:54', 'nacos', '172.18.0.1', 'U',
|
||||
'', '');
|
||||
INSERT INTO `his_config_info`
|
||||
VALUES (14, 5, 'ruoyi-cms-prod.yml', 'DEFAULT_GROUP', '',
|
||||
'# spring配置\nspring:\n redis:\n host: #redis_ip\n port: #redis_port\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://#db_url/#db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: #db_username\n password: #db_password\n # 从库数据源\n # slave:\n # username: root\n # password: Trust_#%01\n # url: jdbc:mysql://173.15.15.83:3306/testjunkenewweb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n # driver-class-name: com.mysql.cj.jdbc.Driver\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.cms\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n configuration:\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n\n# swagger配置\nswagger:\n title: 内容管理模块接口文档\n license: Powered By ruoyi\n licenseUrl: https://ruoyi.vip\n\ncms:\n summaryMaxLength: #cms_summaryMaxLength\n gitLinkOrganization: #cms_gitLinkOrganization\n',
|
||||
'9966bd2f7023b0c8fdb01d2f57e484e3', '2023-12-07 15:09:24', '2023-12-07 15:09:25', 'nacos', '172.18.0.1', 'U',
|
||||
'', '');
|
||||
INSERT INTO `his_config_info`
|
||||
VALUES (45, 6, 'ruoyi-zone-prod.yml', 'DEFAULT_GROUP', '',
|
||||
'# spring配置\nspring:\n redis:\n host: #redis_ip\n port: #redis_port\n password:\n datasource:\n druid:\n stat-view-servlet:\n enabled: true\n loginUsername: admin\n loginPassword: 123456\n dynamic:\n druid:\n initial-size: 5\n min-idle: 5\n maxActive: 20\n maxWait: 60000\n timeBetweenEvictionRunsMillis: 60000\n minEvictableIdleTimeMillis: 300000\n validationQuery: SELECT 1 FROM DUAL\n testWhileIdle: true\n testOnBorrow: false\n testOnReturn: false\n poolPreparedStatements: true\n maxPoolPreparedStatementPerConnectionSize: 20\n filters: stat,slf4j\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\n datasource:\n # 主库数据源\n master:\n driver-class-name: com.mysql.cj.jdbc.Driver\n url: jdbc:mysql://#db_url/#db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n username: #db_username\n password: #db_password\n # 从库数据源\n # slave:\n # username: root\n # password: Trust_#%01\n # url: jdbc:mysql://173.15.15.83:3306/testjunkenewweb?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\n # driver-class-name: com.mysql.cj.jdbc.Driver\n\n# mybatis配置\nmybatis:\n # 搜索指定包别名\n typeAliasesPackage: com.ruoyi.zone\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\n mapperLocations: classpath:mapper/**/*.xml\n configuration:\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n\n# swagger配置\nswagger:\n title: 内容管理模块接口文档\n license: Powered By ruoyi\n licenseUrl: https://ruoyi.vip\n\nzone:\n #邀请链接有效时长(单位:天)\n invitationLinkExpirationTime: #invitationLinkExpirationTime\n #邀请确认页面\n invitationPagePath: #invitationPagePath\n #消息模板\n messageTemplate: #messageTemplate\n #专区管理地址\n zoneAdminUrl: #zoneAdminUrl\n #专区初始化数据\n initData:\n #项目聚合中,GitLink项目Id\n gitlinkProjectId: #gitlinkProjectId\n #会员聚合中,gitlink用户名\n gitLinkUserName1: #gitLinkUserName1\n gitLinkUserName2: #gitLinkUserName2\n gitLinkUserName3: #gitLinkUserName3\n gitLinkUserName4: #gitLinkUserName4',
|
||||
'd4b72950712cff61d20a4739ec617c16', '2023-12-07 15:12:49', '2023-12-07 15:12:49', 'nacos', '172.18.0.1', 'U',
|
||||
'', '');
|
||||
INSERT INTO `his_config_info`
|
||||
VALUES (0, 7, 'ruoyi-pms-prod.yml', 'DEFAULT_GROUP', '',
|
||||
'# spring配置\r\nspring:\r\n redis:\r\n host: #redis_ip\r\n port: #redis_port\r\n password:\r\n datasource:\r\n druid:\r\n stat-view-servlet:\r\n enabled: true\r\n loginUsername: admin\r\n loginPassword: 123456\r\n dynamic:\r\n druid:\r\n initial-size: 5\r\n min-idle: 5\r\n maxActive: 20\r\n maxWait: 60000\r\n timeBetweenEvictionRunsMillis: 60000\r\n minEvictableIdleTimeMillis: 300000\r\n validationQuery: SELECT 1 FROM DUAL\r\n testWhileIdle: true\r\n testOnBorrow: false\r\n testOnReturn: false\r\n poolPreparedStatements: true\r\n maxPoolPreparedStatementPerConnectionSize: 20\r\n filters: stat,slf4j\r\n connectionProperties: druid.stat.mergeSql\\=true;druid.stat.slowSqlMillis\\=5000\r\n datasource:\r\n # 主库数据源\r\n master:\r\n driver-class-name: com.mysql.cj.jdbc.Driver\r\n url: jdbc:mysql://#db_url/#db_name?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8\r\n username: #db_username\r\n password: #db_password\r\n\r\n# mybatis配置\r\nmybatis:\r\n # 搜索指定包别名\r\n typeAliasesPackage: com.ruoyi.pms\r\n # 配置mapper的扫描,找到所有的mapper.xml映射文件\r\n mapperLocations: classpath:mapper/**/*.xml\r\n configuration:\r\n log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\r\n\r\n# swagger配置\r\nswagger:\r\n title: 项目管理模块接口文档\r\n license: Powered By ruoyi\r\n licenseUrl: https://ruoyi.vip',
|
||||
'375d4b57eaf365c384f8baedc0c15092', '2023-12-07 15:16:03', '2023-12-07 15:16:03', NULL, '172.18.0.1', 'I', '',
|
||||
'');
|
||||
INSERT INTO `his_config_info`
|
||||
VALUES (1, 8, 'application-prod.yml', 'DEFAULT_GROUP', '',
|
||||
'spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\n servlet:\n multipart:\n max-file-size: 100MB\n max-request-size: 100MB\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n\nhttp:\n #最大连接数\n maxTotal: 100\n #并发数\n defaultMaxPerRoute: 20\n #创建连接的最长时间\n connectTimeout: 1000\n #从连接池中获取到连接的最长时间\n connectionRequestTimeout: 500\n #数据传输的最长时间\n socketTimeout: 10000\n #提交请求前测试连接是否可用\n staleConnectionCheckEnabled: true\n #gitlink请求地址\n gitLinkUrl: #cms_gitLinkUrl\n #网关请求地址\n gatewayUrl: #gatewayUrl\n\ngitlink:\n admin_user:\n username: #gitlinkAdminUsername\n password: #gitlinkAdminPassword\n client_id: #gitlinkClientId\n client_secret: #gitlinkClientSecret\n',
|
||||
'37eac228d7bf07256764e6c374a6abea', '2023-12-08 09:24:43', '2023-12-08 09:24:43', 'nacos', '172.18.0.1', 'U',
|
||||
'', '');
|
||||
INSERT INTO `his_config_info`
|
||||
VALUES (1, 9, 'application-prod.yml', 'DEFAULT_GROUP', '',
|
||||
'spring:\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n mvc:\n pathmatch:\n matching-strategy: ant_path_matcher\n servlet:\n multipart:\n max-file-size: 100MB\n max-request-size: 100MB\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n\nhttp:\n #最大连接数\n maxTotal: 100\n #并发数\n defaultMaxPerRoute: 20\n #创建连接的最长时间\n connectTimeout: 1000\n #从连接池中获取到连接的最长时间\n connectionRequestTimeout: 500\n #数据传输的最长时间\n socketTimeout: 10000\n #提交请求前测试连接是否可用\n staleConnectionCheckEnabled: true\n #gitlink请求地址\n gitLinkUrl: #cms_gitLinkUrl\n #网关请求地址\n gatewayUrl: #gatewayUrl\n\nswagger:\n host: #gatewayUrl/api\n\ngitlink:\n admin_user:\n username: #gitlinkAdminUsername\n password: #gitlinkAdminPassword\n client_id: #gitlinkClientId\n client_secret: #gitlinkClientSecret\n',
|
||||
'5f9b789aa22c2418a629ca812a0b6176', '2023-12-08 09:24:50', '2023-12-08 09:24:50', 'nacos', '172.18.0.1', 'U',
|
||||
'', '');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for permissions
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `permissions`;
|
||||
CREATE TABLE `permissions`
|
||||
(
|
||||
`role` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`resource` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`action` varchar(8) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
UNIQUE INDEX `uk_role_permission` (`role`, `resource`, `action`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of permissions
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for roles
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `roles`;
|
||||
CREATE TABLE `roles`
|
||||
(
|
||||
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`role` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
UNIQUE INDEX `idx_user_role` (`username`, `role`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of roles
|
||||
-- ----------------------------
|
||||
INSERT INTO `roles`
|
||||
VALUES ('nacos', 'ROLE_ADMIN');
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tenant_capacity
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `tenant_capacity`;
|
||||
CREATE TABLE `tenant_capacity`
|
||||
(
|
||||
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '主键ID',
|
||||
`tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '' COMMENT 'Tenant ID',
|
||||
`quota` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '配额,0表示使用默认值',
|
||||
`usage` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '使用量',
|
||||
`max_size` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '单个配置大小上限,单位为字节,0表示使用默认值',
|
||||
`max_aggr_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '聚合子配置最大个数',
|
||||
`max_aggr_size` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '单个聚合数据的子配置大小上限,单位为字节,0表示使用默认值',
|
||||
`max_history_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '最大变更历史数量',
|
||||
`gmt_create` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`gmt_modified` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_tenant_id` (`tenant_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
CHARACTER SET = utf8
|
||||
COLLATE = utf8_bin COMMENT = '租户容量信息表'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of tenant_capacity
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for tenant_info
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `tenant_info`;
|
||||
CREATE TABLE `tenant_info`
|
||||
(
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`kp` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT 'kp',
|
||||
`tenant_id` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT 'tenant_id',
|
||||
`tenant_name` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT 'tenant_name',
|
||||
`tenant_desc` varchar(256) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'tenant_desc',
|
||||
`create_source` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT 'create_source',
|
||||
`gmt_create` bigint(20) NOT NULL COMMENT '创建时间',
|
||||
`gmt_modified` bigint(20) NOT NULL COMMENT '修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE INDEX `uk_tenant_info_kptenantid` (`kp`, `tenant_id`) USING BTREE,
|
||||
INDEX `idx_tenant_id` (`tenant_id`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
AUTO_INCREMENT = 1
|
||||
CHARACTER SET = utf8
|
||||
COLLATE = utf8_bin COMMENT = 'tenant_info'
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of tenant_info
|
||||
-- ----------------------------
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for users
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `users`;
|
||||
CREATE TABLE `users`
|
||||
(
|
||||
`username` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`password` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
||||
`enabled` tinyint(1) NOT NULL,
|
||||
PRIMARY KEY (`username`) USING BTREE
|
||||
) ENGINE = InnoDB
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci
|
||||
ROW_FORMAT = DYNAMIC;
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of users
|
||||
-- ----------------------------
|
||||
INSERT INTO `users`
|
||||
VALUES ('nacos', '$2a$10$EuWPZHzz32dJN7jexM34MOeYirDdFAZm2kuWj7VEOJhhZkDrxfvUu', 1);
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
|
@ -0,0 +1,48 @@
|
|||
worker_processes 1;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include mime.types;
|
||||
default_type application/octet-stream;
|
||||
sendfile on;
|
||||
keepalive_timeout 65;
|
||||
client_max_body_size 500m;
|
||||
|
||||
server {
|
||||
listen #mapping_gateway_port;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /home/gitlink/projects/zone_admin;
|
||||
try_files $uri $uri/ /index.html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
location /api/{
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://gitlink-gateway:8080/;
|
||||
}
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root html;
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen #mapping_nacos_port;
|
||||
server_name localhost;
|
||||
location / {
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header REMOTE-HOST $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_pass http://gitlink-nacos:8848;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
# 基础镜像
|
||||
FROM nginx
|
||||
# author
|
||||
MAINTAINER gitlink
|
||||
|
||||
# 挂载目录
|
||||
VOLUME /home/gitlink/projects
|
||||
# 创建目录
|
||||
RUN mkdir -p /home/gitlink/projects
|
||||
# 指定路径
|
||||
WORKDIR /home/gitlink/projects
|
|
@ -0,0 +1,95 @@
|
|||
## 部署环境
|
||||
deploy_env=prod
|
||||
## 基础镜像版本
|
||||
base_image_version=1.0.0
|
||||
## Nacos数据库连接
|
||||
NACOS_SPRING_DATASOURCE_PLATFORM=mysql
|
||||
NACOS_MYSQL_SERVICE_HOST=gitlink-mysql
|
||||
NACOS_MYSQL_SERVICE_PORT=3306
|
||||
NACOS_MYSQL_SERVICE_DB_NAME=gitlink-nacos-config
|
||||
NACOS_MYSQL_SERVICE_USER=root
|
||||
NACOS_MYSQL_SERVICE_PASSWORD=Trust_#%01
|
||||
NACOS_AUTH_ENABLE=true
|
||||
NACOS_AUTH_TOKEN=RHBxaW5kTllsQ1dIUlJ6ZXM0ajdzUmgxbXJIMzVaZFFmbXlqNkw5c1dCNnBFd082V21EeFBtME5NazFYYnQwWW43ekZXQQ==
|
||||
NACOS_AUTH_IDENTITY_KEY=gitlink_key
|
||||
NACOS_AUTH_IDENTITY_VALUE=gitlink_value
|
||||
nacos_db_username=root
|
||||
nacos_db_password=hnxjy2024#
|
||||
## 连接Nacos配置
|
||||
nacos_ip=gitlink-nacos
|
||||
nacos_port=8848
|
||||
nacos_username=nacos
|
||||
nacos_password=gitlink-nacos
|
||||
## 连接Redis配置
|
||||
redis_ip=gitlink-redis
|
||||
redis_port=6379
|
||||
## 业务库数据源配置
|
||||
mysql_root_password=Trust_#%01
|
||||
db_url=gitlink-mysql:3306
|
||||
db_host=127.0.0.1
|
||||
db_name=ruoyi-gitlink
|
||||
db_username=root
|
||||
db_password=Trust_#%01
|
||||
mapping_mysql_port=22306
|
||||
## GitLink库数据源配置
|
||||
gitlink_db_url=10.9.60.75:3306
|
||||
gitlink_db_name=forgeplus
|
||||
gitlink_db_username=root
|
||||
gitlink_db_password=Trust_#%01
|
||||
## 文件服务访问地址
|
||||
file_url=https://gateway.gitlink.org.cn/api/file
|
||||
# 容器内文件上传路径
|
||||
file_path=/home/gitlink/uploadPath
|
||||
## 内容管理系统配置
|
||||
# 自动提取概要最大长度
|
||||
cms_summaryMaxLength=100
|
||||
# 特色专区项目组织名称
|
||||
cms_gitLinkOrganization=prefecture
|
||||
# 专区资讯详情路由
|
||||
cmsDetailPath=/newdetail
|
||||
# GitLink访问地址
|
||||
cms_gitLinkUrl=https://www.gitlink.org.cn/
|
||||
## skywalking配置
|
||||
skywalking_backend_service=111.8.36.180:95
|
||||
## Docker数据路径
|
||||
docker_data=/data/docker-data
|
||||
## Nacos映射端口
|
||||
mapping_nacos_port=8848
|
||||
## Redis映射端口
|
||||
mapping_redis_port=26379
|
||||
## Gateway映射端口
|
||||
mapping_gateway_port=8080
|
||||
## 邀请链接有效时长(单位:天)
|
||||
invitationLinkExpirationTime=10
|
||||
## 邀请确认页面
|
||||
invitationPagePath=/index
|
||||
## 消息模板
|
||||
messageTemplate=1428
|
||||
# 会员加入失败消息模板
|
||||
memberMessageTemplate=1428
|
||||
## 专区管理地址
|
||||
zoneAdminUrl=https://gateway.gitlink.org.cn/zone/list
|
||||
# 专区首页前缀
|
||||
zoneHomepagePath=/zone
|
||||
# 专区会员后缀
|
||||
zoneMemberPath=/VIP
|
||||
# 专区配置地址
|
||||
zoneConfigurationUrl=https://gateway.gitlink.org.cn/zone/configuration
|
||||
# 专区资讯管理地址
|
||||
docManageUrl=https://gateway.gitlink.org.cn/zone/content/doc
|
||||
# 专区资源管理地址
|
||||
resourceManageUrl=https://gateway.gitlink.org.cn/zone/resource/resource
|
||||
## 项目聚合中,GitLink项目Id
|
||||
gitlinkProjectId=5988
|
||||
## 会员聚合中,gitlink用户名
|
||||
gitLinkUserName1=maxj
|
||||
gitLinkUserName2=maxj1
|
||||
gitLinkUserName3=maxmaxj
|
||||
gitLinkUserName4=maxmaxj1
|
||||
## 网关地址
|
||||
gatewayUrl=https://gateway.gitlink.org.cn
|
||||
## 内置gitlink管理员账号
|
||||
gitlinkAdminUsername=xxx
|
||||
gitlinkAdminPassword=xxx
|
||||
gitlinkClientId=xxx
|
||||
gitlinkClientSecret=xxx
|
|
@ -0,0 +1 @@
|
|||
# requirepass 123456
|
|
@ -0,0 +1,13 @@
|
|||
# 基础镜像
|
||||
FROM redis:5.0
|
||||
# author
|
||||
MAINTAINER gitlink
|
||||
|
||||
# 挂载目录
|
||||
VOLUME /home/gitlink/redis
|
||||
# 创建目录
|
||||
RUN mkdir -p /home/gitlink/redis
|
||||
# 指定路径
|
||||
WORKDIR /home/gitlink/redis
|
||||
# 复制conf文件到路径
|
||||
COPY ./conf/redis.conf /home/gitlink/redis/redis.conf
|
|
@ -0,0 +1,96 @@
|
|||
## 部署环境
|
||||
deploy_env=test
|
||||
## 基础镜像版本
|
||||
base_image_version=1.0.0
|
||||
## Nacos数据库连接
|
||||
NACOS_SPRING_DATASOURCE_PLATFORM=mysql
|
||||
NACOS_MYSQL_SERVICE_HOST=gitlink-mysql
|
||||
NACOS_MYSQL_SERVICE_PORT=3306
|
||||
NACOS_MYSQL_SERVICE_DB_NAME=gitlink-nacos-config
|
||||
NACOS_MYSQL_SERVICE_USER=root
|
||||
NACOS_MYSQL_SERVICE_PASSWORD=Trust_#%01
|
||||
NACOS_AUTH_ENABLE=true
|
||||
NACOS_AUTH_TOKEN=RHBxaW5kTllsQ1dIUlJ6ZXM0ajdzUmgxbXJIMzVaZFFmbXlqNkw5c1dCNnBFd082V21EeFBtME5NazFYYnQwWW43ekZXQQ==
|
||||
NACOS_AUTH_IDENTITY_KEY=gitlink_key
|
||||
NACOS_AUTH_IDENTITY_VALUE=gitlink_value
|
||||
nacos_username=nacos
|
||||
nacos_password=hnxjy2023
|
||||
## 连接Nacos配置
|
||||
nacos_ip=gitlink-nacos
|
||||
nacos_port=8848
|
||||
nacos_username=nacos
|
||||
nacos_password=hnxjy2023
|
||||
## 连接Redis配置
|
||||
redis_ip=gitlink-redis
|
||||
redis_port=6379
|
||||
## 业务库数据源配置
|
||||
mysql_root_password=Trust_#%01
|
||||
db_url=gitlink-mysql:3306
|
||||
db_host=127.0.0.1
|
||||
db_name=ruoyi-gitlink
|
||||
db_username=root
|
||||
db_password=Trust_#%01
|
||||
mapping_mysql_port=22306
|
||||
## GitLink库数据源配置
|
||||
gitlink_db_url=10.9.70.25:3306
|
||||
gitlink_db_name=testforgeplus
|
||||
gitlink_db_username=root
|
||||
gitlink_db_password=Trust_#%01
|
||||
## 文件服务访问地址
|
||||
file_url=https://testgetway.trustie.net/api/file
|
||||
# 容器内文件上传路径
|
||||
file_path=/home/gitlink/uploadPath
|
||||
## 内容管理系统配置
|
||||
# 自动提取概要最大长度
|
||||
cms_summaryMaxLength=100
|
||||
# 特色专区项目组织名称
|
||||
cms_gitLinkOrganization=prefecture
|
||||
# 专区资讯详情路由
|
||||
cmsDetailPath=/newdetail
|
||||
# GitLink访问地址
|
||||
cms_gitLinkUrl=https://testforgeplus.trustie.net/
|
||||
## skywalking配置
|
||||
skywalking_backend_service=111.8.36.180:95
|
||||
## Docker数据路径
|
||||
docker_data=/data/docker-data
|
||||
## Nacos映射端口
|
||||
mapping_nacos_port=8848
|
||||
## Redis映射端口
|
||||
mapping_redis_port=26379
|
||||
## Gateway映射端口
|
||||
mapping_gateway_port=8080
|
||||
## 专区相关配置
|
||||
## 邀请链接有效时长(单位:天)
|
||||
invitationLinkExpirationTime=10
|
||||
## 邀请确认页面
|
||||
invitationPagePath=/index
|
||||
## 消息模板
|
||||
messageTemplate=1428
|
||||
# 会员加入失败消息模板
|
||||
memberMessageTemplate=1428
|
||||
## 专区管理地址
|
||||
zoneAdminUrl=https://testgetway.trustie.net/zone/list
|
||||
# 专区首页前缀
|
||||
zoneHomepagePath=/zone
|
||||
# 专区会员后缀
|
||||
zoneMemberPath=/VIP
|
||||
# 专区配置地址
|
||||
zoneConfigurationUrl=https://testgetway.trustie.net/zone/configuration
|
||||
# 专区资讯管理地址
|
||||
docManageUrl=https://testgetway.trustie.net/zone/content/doc
|
||||
# 专区资源管理地址
|
||||
resourceManageUrl=https://testgetway.trustie.net/zone/resource/resource
|
||||
## 项目聚合中,GitLink项目Id
|
||||
gitlinkProjectId=546714
|
||||
## 会员聚合中,gitlink用户名
|
||||
gitLinkUserName1=floraachy
|
||||
gitLinkUserName2=innov
|
||||
gitLinkUserName3=ttt77777
|
||||
gitLinkUserName4=OTTO
|
||||
## 网关地址
|
||||
gatewayUrl=https://testgetway.trustie.net
|
||||
## 内置gitlink管理员账号
|
||||
gitlinkAdminUsername=innov
|
||||
gitlinkAdminPassword=12345678
|
||||
gitlinkClientId=yllzwpMD2U5sAKHVnWbUiIZVpbp63DL7FleZi49uUXY
|
||||
gitlinkClientSecret=AdfaPHO_RJf3Tnz3n9xuCuYKpCt9Nioy9bYY6EJY7TI
|
|
@ -0,0 +1,182 @@
|
|||
#!/bin/bash
|
||||
|
||||
# 获取当前路径
|
||||
origin_path=$(pwd)
|
||||
current_env=$1
|
||||
server_name=$3
|
||||
|
||||
# 使用说明,用来提示输入参数
|
||||
usage() {
|
||||
echo -e "\e[91m错误:必须传入环境参数 \e[0m"
|
||||
echo "Usage: sh update_db.sh [dev|test|prod] [gen_time_string|exec_update_sql]"
|
||||
exit 1
|
||||
}
|
||||
gen_time_string(){
|
||||
local TIME_STRING=$(date +'%Y%m%d%H%M%S')
|
||||
echo "$TIME_STRING"
|
||||
}
|
||||
|
||||
update_sql_config(){
|
||||
# 进入sql所在目录
|
||||
cd "${origin_path}"/../sql/update
|
||||
# 检查是否存在"replace_config"文件夹
|
||||
if [ -d "replace_config" ]; then
|
||||
cd ./replace_config
|
||||
# 获取所有后缀为.replace的文件
|
||||
REPLACE_FILES=$(find . -type f -name "*.replace")
|
||||
|
||||
# 遍历所有.replace文件
|
||||
for REPLACE_FILE in $REPLACE_FILES; do
|
||||
# 将.replace文件复制为.sql文件,并替换其中的占位符
|
||||
SQL_FILE=${REPLACE_FILE%.replace}.sql
|
||||
cp "$REPLACE_FILE" "$SQL_FILE"
|
||||
sed -i "s|#gateway_url|${gateway_url}|g" "$SQL_FILE"
|
||||
|
||||
# 检查.sql文件是否在update文件夹下存在
|
||||
if [ -f "$SQL_FILE" ]; then
|
||||
# 如果存在,则删除update下该sql文件,并将重命名后的.sql文件移动到update文件夹下
|
||||
rm -f ../"$SQL_FILE"
|
||||
mv "$SQL_FILE" ../
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
exec_update_sql(){
|
||||
set -e
|
||||
# 拉取最新代码
|
||||
git pull
|
||||
# 替换sql中变量
|
||||
update_sql_config
|
||||
cd "${origin_path}"/../sql/update
|
||||
# 检查MySQL客户端是否已安装
|
||||
if ! command -v mysql &> /dev/null; then
|
||||
echo "错误:未找到MySQL客户端。请先安装MySQL客户端,并确保其在环境变量中可用。"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# MySQL连接信息
|
||||
DB_HOST="${db_host}"
|
||||
DB_PORT="${mapping_mysql_port}"
|
||||
DB_USER="${db_username}"
|
||||
DB_PASS="${db_password}"
|
||||
DB_NAME="${db_name}"
|
||||
|
||||
# 版本表信息
|
||||
VERSION_TABLE="sys_version"
|
||||
VERSION_FIELD="current_version"
|
||||
REMARKS_FIELD="remarks"
|
||||
|
||||
# 检查并过滤符合命名规则的SQL文件
|
||||
validate_sql_file() {
|
||||
local file="$1"
|
||||
local filename=$(basename "$file")
|
||||
local regex='^[0-9]{14}_.*\.sql$'
|
||||
|
||||
if [[ ! $filename =~ $regex ]]; then
|
||||
echo "错误:$filename 不是有效的SQL文件。跳过执行。"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# 获取所有未在版本库中记录的SQL文件名,并按照从小到大的顺序排序
|
||||
UNEXECUTED_SQL_FILES=$(comm -23 <(ls *.sql | sort) <(mysql -N --default-character-set=utf8mb4 -h $DB_HOST -P $DB_PORT -u $DB_USER -p$DB_PASS -D $DB_NAME -e "SELECT $VERSION_FIELD FROM $VERSION_TABLE;" | sort))
|
||||
|
||||
# 将未执行的SQL文件名按照日期和版本号的顺序排序
|
||||
SORTED_SQL_FILES=$(echo "$UNEXECUTED_SQL_FILES" | sort)
|
||||
|
||||
# 创建已成功执行的SQL文件列表和未能执行的SQL文件列表
|
||||
SUCCESSFUL_SQL_FILES=""
|
||||
FAILED_SQL_FILES=""
|
||||
|
||||
# 开始事务
|
||||
mysql --default-character-set=utf8mb4 -h "$DB_HOST" -P "$DB_PORT" -u "$DB_USER" -p"$DB_PASS" -D "$DB_NAME" -e "START TRANSACTION;"
|
||||
|
||||
# 循环执行排序后的未执行SQL文件
|
||||
for SQL_FILE in $SORTED_SQL_FILES; do
|
||||
# 检查SQL文件名是否符合规则
|
||||
if ! validate_sql_file "$SQL_FILE"; then
|
||||
FAILED_SQL_FILES+="\n$SQL_FILE"
|
||||
continue
|
||||
fi
|
||||
|
||||
# 提取日期和版本号
|
||||
FILENAME=$(basename "$SQL_FILE")
|
||||
DATE=$(echo "$FILENAME" | cut -c 1-14)
|
||||
VERSION=$(echo "$FILENAME" | cut -c 16- | cut -d'_' -f1)
|
||||
|
||||
# 提取注释内容
|
||||
FIRST_LINE=$(head -n 1 "$SQL_FILE")
|
||||
REMARKS=$(echo "$FIRST_LINE" | sed 's/^--\s*//')
|
||||
|
||||
# 执行SQL文件,捕获错误输出
|
||||
if ! output=$(mysql --default-character-set=utf8mb4 -h $DB_HOST -P $DB_PORT -u $DB_USER -p$DB_PASS -D $DB_NAME < $SQL_FILE 2>&1); then
|
||||
# SQL文件执行失败,打印错误信息并终止脚本
|
||||
echo -e "\n错误:SQL文件 $SQL_FILE 执行失败。错误原因如下:"
|
||||
echo "$output"
|
||||
|
||||
# 回滚事务
|
||||
mysql --default-character-set=utf8mb4 -h $DB_HOST -P $DB_PORT -u $DB_USER -p$DB_PASS -D $DB_NAME -e "ROLLBACK;"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# SQL文件执行成功,将其添加到已成功执行的SQL文件列表中
|
||||
SUCCESSFUL_SQL_FILES+="\n$SQL_FILE"
|
||||
|
||||
# 提取完整的SQL文件名(包含时间戳和版本号)
|
||||
FULL_SQL_FILE_NAME=$(basename "$SQL_FILE")
|
||||
|
||||
# 在版本表中插入记录,包括完整的SQL文件名和备注字段
|
||||
mysql --default-character-set=utf8mb4 -h $DB_HOST -P $DB_PORT -u $DB_USER -p$DB_PASS -D $DB_NAME -e "INSERT INTO $VERSION_TABLE (execute_time, $VERSION_FIELD, $REMARKS_FIELD) VALUES (NOW(), '$FULL_SQL_FILE_NAME', '$REMARKS');"
|
||||
|
||||
done
|
||||
|
||||
# 所有SQL执行成功,提交事务
|
||||
mysql --default-character-set=utf8mb4 -h $DB_HOST -P $DB_PORT -u $DB_USER -p$DB_PASS -D $DB_NAME -e "COMMIT;"
|
||||
|
||||
# 打印已成功执行的SQL文件列表
|
||||
if [ -n "$SUCCESSFUL_SQL_FILES" ]; then
|
||||
echo -e "\n以下SQL文件已成功执行:"
|
||||
echo -e "$SUCCESSFUL_SQL_FILES"
|
||||
fi
|
||||
|
||||
# 打印未能执行的SQL文件列表
|
||||
if [ -n "$FAILED_SQL_FILES" ]; then
|
||||
echo -e "\n以下SQL文件未能执行:"
|
||||
echo -e "$FAILED_SQL_FILES"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
case "$current_env" in
|
||||
"test")
|
||||
# 获取测试环境配置文件中的安装信息
|
||||
. ./test_config.profile
|
||||
;;
|
||||
"dev")
|
||||
# 获取测试环境配置文件中的安装信息
|
||||
. ./dev_config.profile
|
||||
;;
|
||||
"prod")
|
||||
. ./prod_config.profile
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
||||
# 根据输入参数,选择执行对应方法,不输入则执行使用说明
|
||||
case "$2" in
|
||||
"gen_time_string")
|
||||
gen_time_string
|
||||
;;
|
||||
"exec_update_sql")
|
||||
exec_update_sql
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
|
@ -1,155 +0,0 @@
|
|||
package com.microservices.system.api;
|
||||
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.constant.ServiceNameConstants;
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.system.api.domain.SysDept;
|
||||
import com.microservices.system.api.domain.SysUserDeptRole;
|
||||
import com.microservices.system.api.factory.RemoteDeptFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 部门服务
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
@FeignClient(contextId = "remoteDeptService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteDeptFallbackFactory.class)
|
||||
public interface RemoteDeptService {
|
||||
/**
|
||||
* 通过部门Id列表查询部门列表
|
||||
*
|
||||
* @param ids 部门Id列表
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/dept/listInIds/{ids}")
|
||||
public R<List<SysDept>> getDeptInDeptIds(@PathVariable("ids") List<Long> ids,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 通过部门Id查询部门信息
|
||||
*
|
||||
* @param deptId 部门Id
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/dept/getDeptByDeptId/{deptId}")
|
||||
public R<SysDept> getDeptByDeptId(@PathVariable("deptId") Long deptId,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 根据专区名称创建部门
|
||||
*
|
||||
* @param zoneName 专区名称
|
||||
* @param source 请求来源
|
||||
* @return 部门Id
|
||||
*/
|
||||
@PostMapping("/dept/addDeptByZone")
|
||||
public R<Long> addDeptByZone(@RequestBody String zoneName
|
||||
, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 通过部门Id获取自身及子部门Id列表
|
||||
*
|
||||
* @param deptId 部门Id
|
||||
* @return 自身及子部门Id列表
|
||||
*/
|
||||
@GetMapping("/dept/getSelfAndChildrenDeptIdListByDeptId/{deptId}")
|
||||
public R<List<Long>> getSelfAndChildrenDeptIdListByDeptId(@PathVariable("deptId") Long deptId,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 根据企业名称创建部门
|
||||
*
|
||||
* @param pmsEnterpriseName 企业名称
|
||||
* @param source 请求来源
|
||||
* @return 部门Id
|
||||
*/
|
||||
@PostMapping("/dept/addDeptByPmsEnterprise")
|
||||
public R<Long> addDeptByPmsEnterprise(@RequestBody String pmsEnterpriseName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 根据部门Id更新部门名称
|
||||
*
|
||||
* @param deptId 部门id
|
||||
* @param deptName 部门名称
|
||||
* @param source 请求来源
|
||||
* @return 部门Id
|
||||
*/
|
||||
@PostMapping("/dept/updateDeptNameByDeptId/{deptId}")
|
||||
public R<Boolean> updateDeptNameByDeptId(@PathVariable("deptId") Long deptId, @RequestBody String deptName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 根据组织id删除部门
|
||||
*
|
||||
* @param deptId 部门id
|
||||
* @param source 请求来源
|
||||
* @return 是否删除成功
|
||||
*/
|
||||
@DeleteMapping("/dept/deleteDeptByDeptId")
|
||||
public R<Boolean> deleteDeptByDeptId(@RequestBody Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 根据企业名称删除部门
|
||||
*
|
||||
* @param pmsEnterpriseName 企业名称
|
||||
* @param source 请求来源
|
||||
* @return 部门Id
|
||||
*/
|
||||
@DeleteMapping("/dept/deleteDeptByPmsEnterprise")
|
||||
public R<Boolean> deleteDeptByPmsEnterprise(@RequestBody String pmsEnterpriseName, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 通过用户名查询用户下组织及组织对应角色列表
|
||||
*
|
||||
* @param deptId 组织ID
|
||||
* @param source 请求来源
|
||||
* @return 用户下组织及组织对应角色列表
|
||||
*/
|
||||
@GetMapping("/SysUserDeptRole/userByDeptId/{deptId}/list")
|
||||
public R<List<SysUserDeptRole>> getSysUserDeptRoleListByDeptId(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
|
||||
/**
|
||||
* 查询组织编号下拥有传入角色权限字符串的用户名
|
||||
*
|
||||
* @param deptId 组织编号
|
||||
* @param roleKeys 角色权限字符串
|
||||
* @return 组织下拥有传入角色权限字符串的用户名列表
|
||||
*/
|
||||
@GetMapping("/dept/getGitLinkUserNamesByDeptIdAndRoleKeys/{deptId}/list")
|
||||
R<List<String>> getGitLinkUserNamesByDeptIdAndRoleKeys(@PathVariable("deptId") Long deptId, @RequestParam("roleKeys") String roleKeys, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 检查用户是否在指定部门下具有指定角色
|
||||
*
|
||||
* @param currentDeptId 组织编号
|
||||
* @param roleKey 角色权限字符串
|
||||
* @return 组织下拥有传入角色权限字符串的用户名列表
|
||||
*/
|
||||
@GetMapping("/SysUserDeptRole/checkUserInDeptHasRole")
|
||||
R<Boolean> checkUserInDeptHasRole(@RequestParam("currentDeptId") Long currentDeptId, @RequestParam("userId") Long userId, @RequestParam("roleKey") String roleKey, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 检查用户是否在指定部门下具有指定菜单权限
|
||||
*
|
||||
* @param currentDeptId 组织id
|
||||
* @param userId 用户id
|
||||
* @param perms 菜单权限
|
||||
* @return 用户是否在指定部门下具有菜单权限 是true 否false
|
||||
*/
|
||||
@GetMapping("/SysUserDeptRole/checkUserInDeptHasPerms")
|
||||
R<Boolean> checkUserInDeptHasPerms(@RequestParam("currentDeptId") Long currentDeptId, @RequestParam("userId") Long userId, @RequestParam("perms") String perms, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 检查用户是否在指定部门下
|
||||
*
|
||||
* @param currentDeptId 组织id
|
||||
* @param userId 用户id
|
||||
* @return 用户是否在指定部门下是true 否false
|
||||
*/
|
||||
@GetMapping("/SysUserDeptRole/checkUserInDept")
|
||||
R<Boolean> checkUserInDept(@RequestParam("currentDeptId") Long currentDeptId, @RequestParam("userId") Long userId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
package com.microservices.system.api;
|
||||
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.constant.ServiceNameConstants;
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.system.api.domain.SysFile;
|
||||
import com.microservices.system.api.domain.SysFileInfo;
|
||||
import com.microservices.system.api.factory.RemoteFileFallbackFactory;
|
||||
import feign.Response;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件服务
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@FeignClient(contextId = "remoteFileService", value = ServiceNameConstants.FILE_SERVICE, fallbackFactory = RemoteFileFallbackFactory.class)
|
||||
public interface RemoteFileService {
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param file 文件信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
public R<SysFile> upload(@RequestPart(value = "file") MultipartFile file,
|
||||
@RequestParam("type") String type,
|
||||
@RequestParam("hierarchy") String hierarchy,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 根据文件Id列表获取文件列表
|
||||
*
|
||||
* @param fileIds 文件Id列表
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/open/getFileList/{fileIds}")
|
||||
public R<List<SysFileInfo>> getFileList(@PathVariable("fileIds") String fileIds);
|
||||
|
||||
/**
|
||||
* 根据文件Id获取文件信息
|
||||
*
|
||||
* @param fileId 文件Id
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/open/getFile/{fileId}")
|
||||
public R<SysFileInfo> getFile(@PathVariable("fileId") Long fileId);
|
||||
|
||||
/**
|
||||
* 根据文件Id获取文件信息
|
||||
*
|
||||
* @param fileIdentifier 文件标识
|
||||
* @return 结果
|
||||
*/
|
||||
@GetMapping("/common/getFileByFileIdentifier/{fileIdentifier}")
|
||||
public R<SysFileInfo> getFileByFileIdentifier(@PathVariable("fileIdentifier") String fileIdentifier,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 根据文件标识列表获取文件详情列表
|
||||
*
|
||||
* @param fileIdentifiers 文件标识列表,逗号分隔
|
||||
* @return 文件详情列表
|
||||
*/
|
||||
@GetMapping("/open/getFileListByIdentifier/{fileIdentifiers}")
|
||||
R<List<SysFileInfo>> getFileListByIdentifier(@PathVariable("fileIdentifiers") String fileIdentifiers);
|
||||
|
||||
/**
|
||||
* 通过文件标识列表批量删除文件
|
||||
*
|
||||
* @param fileIdentifiers 文件标识列表,逗号分隔
|
||||
* @return 结果
|
||||
*/
|
||||
@DeleteMapping("/common/byIdentifiers/{fileIdentifiers}")
|
||||
R<Boolean> deleteFileByIdentifiers(@PathVariable("fileIdentifiers") String fileIdentifiers,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 根据文件标识获取文件实体
|
||||
*
|
||||
* @param fileIdentifier 文件标识
|
||||
*/
|
||||
@GetMapping("/common/getFileEntityByIdentifier/{fileIdentifier}")
|
||||
Response getFileEntityByIdentifier(@PathVariable("fileIdentifier") String fileIdentifier,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 打包文件
|
||||
*
|
||||
* @param packagedStructure 打包结构<文件包内路径,文件来源(文件标识或文件下载地址)>
|
||||
* @param zipFileName 压缩文件名(不包含文件后缀)
|
||||
* @param type 微服务类型
|
||||
* @param hierarchy 层次结构
|
||||
* @param source 鉴权
|
||||
* @return 压缩包文件标识
|
||||
*/
|
||||
@PostMapping(value = "/common/packagedFile")
|
||||
R<String> packagedFile(
|
||||
@RequestBody HashMap<String, String> packagedStructure,
|
||||
@RequestParam("zipFileName") String zipFileName,
|
||||
@RequestParam("type") String type,
|
||||
@RequestParam("hierarchy") String hierarchy,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 通过Url下载文件到本地
|
||||
*/
|
||||
@PostMapping(value = "/common/downloadFileByUrl")
|
||||
R<String> downloadFileByUrl(
|
||||
@RequestParam("fileUrl") String fileUrl
|
||||
, @RequestParam("type") String type
|
||||
, @RequestParam("hierarchy") String hierarchy,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 上传本地文件到Forge
|
||||
*
|
||||
* @param fileIdentifiers 文件标识列表,逗号分隔
|
||||
* @return Forge文件标识列表
|
||||
*/
|
||||
@PostMapping(value = "/common/uploadFileToForge/{fileIdentifiers}")
|
||||
R<List<String>> uploadFileToForge(@PathVariable("fileIdentifiers") String fileIdentifiers,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
package com.microservices.system.api;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.constant.ServiceNameConstants;
|
||||
import com.microservices.system.api.factory.RemoteGatewayFallbackFactory;
|
||||
import feign.Response;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 网关
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Component
|
||||
@FeignClient(contextId = "remoteGatewayService", value = ServiceNameConstants.GATEWAY_SERVICE, fallbackFactory = RemoteGatewayFallbackFactory.class)
|
||||
public interface RemoteGatewayService {
|
||||
/**
|
||||
* 登录Sentinel
|
||||
*
|
||||
* @return 响应
|
||||
*/
|
||||
@PostMapping("/sentinel/auth/login")
|
||||
Response loginSentinel(@RequestParam("username") String username, @RequestParam("password") String password);
|
||||
|
||||
/**
|
||||
* 登录Nacos
|
||||
*
|
||||
* @return 响应
|
||||
*/
|
||||
@PostMapping(value = "/nacos/v1/auth/users/login", consumes = {"application/x-www-form-urlencoded"})
|
||||
Response loginNacos(Map<String, ?> formParams);
|
||||
|
||||
/**
|
||||
* 登录Portainer
|
||||
*
|
||||
* @return 响应
|
||||
*/
|
||||
@PostMapping("/portainer/api/auth")
|
||||
Response loginPortainer(@RequestBody JSONObject loginBody);
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
package com.microservices.system.api;
|
||||
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.constant.ServiceNameConstants;
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.system.api.domain.SysLogininfor;
|
||||
import com.microservices.system.api.domain.SysOperLog;
|
||||
import com.microservices.system.api.factory.RemoteLogFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 日志服务
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@FeignClient(contextId = "remoteLogService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteLogFallbackFactory.class)
|
||||
public interface RemoteLogService
|
||||
{
|
||||
/**
|
||||
* 保存系统日志
|
||||
*
|
||||
* @param sysOperLog 日志实体
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/operlog")
|
||||
public R<Boolean> saveLog(@RequestBody SysOperLog sysOperLog, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 保存访问记录
|
||||
*
|
||||
* @param sysLogininfor 访问实体
|
||||
* @param source 请求来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/logininfor")
|
||||
public R<Boolean> saveLogininfor(@RequestBody SysLogininfor sysLogininfor, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 获取操作日志列表
|
||||
*
|
||||
* @param title 日志标题
|
||||
* @param operUrl 操作地址
|
||||
* @param status 操作状态
|
||||
* @param topN 获取最新N条
|
||||
* @return 操作日志列表
|
||||
*/
|
||||
@GetMapping("/operlog/latest")
|
||||
R<List<SysOperLog>> getLatestOperLogList(@RequestParam(value = "title", required = false) String title,
|
||||
@RequestParam(value = "operUrl", required = false) String operUrl,
|
||||
@RequestParam(value = "status", required = false) Integer status,
|
||||
@RequestParam(value = "topN") Integer topN,
|
||||
@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package com.microservices.system.api;
|
||||
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.constant.ServiceNameConstants;
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.system.api.domain.SysNotice;
|
||||
import com.microservices.system.api.factory.RemoteUserFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Component
|
||||
@FeignClient(contextId = "remoteNoticeService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteUserFallbackFactory.class)
|
||||
public interface RemoteNoticeService {
|
||||
|
||||
@PostMapping("/notice/innerAdd")
|
||||
R<Long> addNotice(@RequestBody SysNotice sysNotice, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
@GetMapping("/notice/innerGetInfo/{noticeId}")
|
||||
R<SysNotice> getNotice(@PathVariable(value = "noticeId") Long noticeId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
@PutMapping("/notice/innerEdit")
|
||||
R<Integer> editNotice(@RequestBody SysNotice sysNotice, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
@DeleteMapping("/notice/innerRemove/{noticeIds}")
|
||||
R<Integer> deleteNotice(@PathVariable(value = "noticeIds") Long[] noticeIds, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
package com.microservices.system.api;
|
||||
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.constant.ServiceNameConstants;
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.system.api.factory.RemotePmsFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@Component
|
||||
@FeignClient(contextId = "remotePmsService", value = ServiceNameConstants.PMS_SERVICE, fallbackFactory = RemotePmsFallbackFactory.class)
|
||||
public interface RemotePmsService {
|
||||
/**
|
||||
* 切换用户在Gitlink组织团队
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param deptId 组织id
|
||||
* @param oldRoleId 旧角色id
|
||||
* @param newRoleId 新角色id
|
||||
* @param source 来源
|
||||
* @return 结果
|
||||
*/
|
||||
@PutMapping("/pmsEnterprise/changeUserGitlinkRole/user/{userId}/dept/{deptId}")
|
||||
public R<Boolean> changeUserGitlinkRole(
|
||||
@PathVariable("userId") Long userId
|
||||
, @PathVariable("deptId") Long deptId
|
||||
, @RequestParam("oldRoleId") Long oldRoleId
|
||||
, @RequestParam("newRoleId") Long newRoleId
|
||||
, @RequestHeader(SecurityConstants.FROM_SOURCE) String source
|
||||
, @RequestHeader(SecurityConstants.USER_KEY) String userKey);
|
||||
}
|
|
@ -1,58 +0,0 @@
|
|||
package com.microservices.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文件管理对象 sys_file_info
|
||||
*
|
||||
* @author microservices
|
||||
* @date 2021-12-29
|
||||
*/
|
||||
@Data
|
||||
public class SimpleGitlinkFileInfo {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 文件主键id
|
||||
*/
|
||||
@ApiModelProperty(value = "文件主键id")
|
||||
private Long id;
|
||||
/**
|
||||
* 文件标识
|
||||
*/
|
||||
@ApiModelProperty(value = "文件标识")
|
||||
private String identifier;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
@ApiModelProperty(value = "文件名称")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 文件类型,例如txt
|
||||
*/
|
||||
@ApiModelProperty(value = "文件类型,例如txt")
|
||||
private String content_type;
|
||||
|
||||
/**
|
||||
* 文件大小
|
||||
*/
|
||||
@ApiModelProperty(value = "文件大小")
|
||||
private String filesize;
|
||||
|
||||
/**
|
||||
* 下载地址
|
||||
*/
|
||||
@ApiModelProperty(value = "下载地址")
|
||||
private String url;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间", hidden = true)
|
||||
private Date created_on;
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
package com.microservices.system.api.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Gitlink简单用户对象
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class SimpleGitlinkUser{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Gitlink用户ID
|
||||
*/
|
||||
@ApiModelProperty(value = "Gitlink用户ID")
|
||||
private Long id;
|
||||
/**
|
||||
* GitLink用户头像
|
||||
*/
|
||||
private String image_url;
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@ApiModelProperty(value = "用户名")
|
||||
private String login;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@ApiModelProperty(value = "用户名称")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
@ApiModelProperty(value = "用户类型")
|
||||
private String type="User";
|
||||
}
|
|
@ -1,45 +0,0 @@
|
|||
package com.microservices.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.microservices.common.core.enums.SystemRole;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 角色表 sys_role
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Data
|
||||
public class SimpleSysRole implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
@ApiModelProperty(value = "角色ID")
|
||||
private Long roleId;
|
||||
|
||||
/**
|
||||
* 角色名称
|
||||
*/
|
||||
@ApiModelProperty(value = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
/**
|
||||
* 角色标识
|
||||
*/
|
||||
@ApiModelProperty(value = "角色标识")
|
||||
private String roleKey;
|
||||
|
||||
public SimpleSysRole() {
|
||||
}
|
||||
|
||||
public SimpleSysRole(SystemRole systemRole) {
|
||||
this.roleName = systemRole.getRoleName();
|
||||
this.roleKey = systemRole.getRoleKey();
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package com.microservices.system.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 文件信息
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Data
|
||||
public class SysFile
|
||||
{
|
||||
/**
|
||||
* 文件标识
|
||||
*/
|
||||
private String fileIdentifier;
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
private String url;
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
package com.microservices.system.api.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* 文件流
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Data
|
||||
public class SysFileBytes {
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件流
|
||||
*/
|
||||
private InputStream fileInputStream;
|
||||
}
|
|
@ -1,123 +0,0 @@
|
|||
package com.microservices.system.api.domain;
|
||||
|
||||
import com.microservices.common.core.annotation.Excel;
|
||||
import com.microservices.common.core.annotation.Excel.ColumnType;
|
||||
import com.microservices.common.core.utils.bean.BeanUtils;
|
||||
import com.microservices.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 角色表 sys_role
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Data
|
||||
public class SysRole extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 角色ID */
|
||||
@Excel(name = "角色序号", cellType = ColumnType.NUMERIC)
|
||||
private Long roleId;
|
||||
|
||||
/** 角色名称 */
|
||||
@Excel(name = "角色名称")
|
||||
private String roleName;
|
||||
|
||||
/** 角色权限 */
|
||||
@Excel(name = "角色权限")
|
||||
private String roleKey;
|
||||
|
||||
/** 角色排序 */
|
||||
@Excel(name = "角色排序")
|
||||
private Integer roleSort;
|
||||
|
||||
/** 数据范围(1:所有数据权限;2:自定义数据权限;3:本部门数据权限;4:本部门及以下数据权限;5:仅本人数据权限) */
|
||||
@Excel(name = "数据范围", readConverterExp = "1=所有数据权限,2=自定义数据权限,3=本部门数据权限,4=本部门及以下数据权限,5=仅本人数据权限")
|
||||
private String dataScope;
|
||||
|
||||
/** 菜单树选择项是否关联显示( 0:父子不互相关联显示 1:父子互相关联显示) */
|
||||
private boolean menuCheckStrictly;
|
||||
|
||||
/** 部门树选择项是否关联显示(0:父子不互相关联显示 1:父子互相关联显示 ) */
|
||||
private boolean deptCheckStrictly;
|
||||
|
||||
/** 角色状态(0正常 1停用) */
|
||||
@Excel(name = "角色状态", readConverterExp = "0=正常,1=停用")
|
||||
private String status;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
/** 用户是否存在此角色标识 默认不存在 */
|
||||
private boolean flag = false;
|
||||
|
||||
/** 菜单组 */
|
||||
private Long[] menuIds;
|
||||
|
||||
/** 部门组(数据权限) */
|
||||
private Long[] deptIds;
|
||||
|
||||
/**
|
||||
* 组织类型
|
||||
*/
|
||||
private Integer deptType;
|
||||
|
||||
/**
|
||||
* 是否默认角色
|
||||
*/
|
||||
private Boolean isDefault;
|
||||
|
||||
/** 角色菜单权限 */
|
||||
private Set<String> permissions;
|
||||
|
||||
public SysRole() {
|
||||
}
|
||||
|
||||
public SysRole(Long roleId)
|
||||
{
|
||||
this.roleId = roleId;
|
||||
}
|
||||
|
||||
|
||||
public boolean isAdmin()
|
||||
{
|
||||
return isAdmin(this.roleId);
|
||||
}
|
||||
|
||||
public static boolean isAdmin(Long roleId)
|
||||
{
|
||||
return roleId != null && 1L == roleId;
|
||||
}
|
||||
|
||||
@NotBlank(message = "角色名称不能为空")
|
||||
@Size(min = 0, max = 30, message = "角色名称长度不能超过30个字符")
|
||||
public String getRoleName()
|
||||
{
|
||||
return roleName;
|
||||
}
|
||||
|
||||
@NotBlank(message = "权限字符不能为空")
|
||||
@Size(min = 0, max = 100, message = "权限字符长度不能超过100个字符")
|
||||
public String getRoleKey()
|
||||
{
|
||||
return roleKey;
|
||||
}
|
||||
|
||||
@NotNull(message = "显示顺序不能为空")
|
||||
public Integer getRoleSort()
|
||||
{
|
||||
return roleSort;
|
||||
}
|
||||
|
||||
public SimpleSysRole toSimpleSysRole() {
|
||||
SimpleSysRole target = new SimpleSysRole();
|
||||
BeanUtils.copyProperties(this, target);
|
||||
return target;
|
||||
}
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
package com.microservices.system.api.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
/**
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
@ApiModel("用户与部门及部门对应角色的关联对象")
|
||||
public class SysUserDeptRole {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 部门ID
|
||||
*/
|
||||
@ApiModelProperty("部门ID")
|
||||
private Long deptId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@ApiModelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 角色ID
|
||||
*/
|
||||
@ApiModelProperty("角色ID")
|
||||
private Long roleId;
|
||||
|
||||
@ApiModelProperty("身份状态")
|
||||
private String state;
|
||||
|
||||
/**
|
||||
* 部门对象
|
||||
*/
|
||||
@ApiModelProperty(value = "部门对象", hidden = true)
|
||||
private SysDept sysDept;
|
||||
/**
|
||||
* 用户对象
|
||||
*/
|
||||
@ApiModelProperty(value = "用户对象", hidden = true)
|
||||
private SysUser sysUser;
|
||||
/**
|
||||
* 角色对象
|
||||
*/
|
||||
@ApiModelProperty(value = "角色对象", hidden = true)
|
||||
private SysRole sysRole;
|
||||
}
|
|
@ -1,85 +0,0 @@
|
|||
package com.microservices.system.api.factory;
|
||||
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.system.api.RemoteFileService;
|
||||
import com.microservices.system.api.domain.SysFile;
|
||||
import com.microservices.system.api.domain.SysFileInfo;
|
||||
import feign.Response;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文件服务降级处理
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Component
|
||||
public class RemoteFileFallbackFactory implements FallbackFactory<RemoteFileService>
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteFileFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteFileService create(Throwable throwable)
|
||||
{
|
||||
log.error("文件服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteFileService() {
|
||||
|
||||
@Override
|
||||
public R<SysFile> upload(MultipartFile file, String type, String hierarchy, String source) {
|
||||
return R.fail("上传文件失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<SysFileInfo>> getFileList(String fileIds) {
|
||||
return R.fail("获取文件列表失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<SysFileInfo> getFile(Long fileId) {
|
||||
return R.fail("根据文件Id获取文件信息失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<SysFileInfo> getFileByFileIdentifier(String fileIdentifier, String source) {
|
||||
return R.fail("根据文件标识获取文件信息失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<SysFileInfo>> getFileListByIdentifier(String fileIdentifiers) {
|
||||
return R.fail("根据文件标识列表获取文件详情列表失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Boolean> deleteFileByIdentifiers(String fileIdentifiers, String source) {
|
||||
return R.fail("通过文件标识列表批量删除文件失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response getFileEntityByIdentifier(String fileIdentifier, String source) {
|
||||
throw new ServiceException("文件获取失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<String> packagedFile(HashMap<String, String> packagedStructure, String zipFileName, String type, String hierarchy, String source) {
|
||||
return R.fail("打包文件失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<String> downloadFileByUrl(String fileUrl, String type, String hierarchy, String source) {
|
||||
return R.fail("通过Url下载文件到本地失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<String>> uploadFileToForge(String fileIdentifiers, String source) {
|
||||
return R.fail("上传本地文件到Forge失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
package com.microservices.system.api.factory;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.system.api.RemoteGatewayService;
|
||||
import feign.Response;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Component
|
||||
public class RemoteGatewayFallbackFactory implements FallbackFactory<RemoteGatewayService> {
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteGatewayFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteGatewayService create(Throwable throwable) {
|
||||
log.error("网关服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteGatewayService() {
|
||||
|
||||
@Override
|
||||
public Response loginSentinel(String password, String username) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response loginNacos(Map<String, ?> formParams) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Response loginPortainer(JSONObject loginBody) {
|
||||
System.out.println(throwable.getMessage());
|
||||
return null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
package com.microservices.system.api.factory;
|
||||
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.system.api.RemoteNoticeService;
|
||||
import com.microservices.system.api.domain.SysNotice;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
|
||||
public class RemoteNoticeFallbackFactory implements FallbackFactory<RemoteNoticeService> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RemoteNoticeFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemoteNoticeService create(Throwable throwable)
|
||||
{
|
||||
log.error("用户服务调用失败:{}", throwable.getMessage());
|
||||
return new RemoteNoticeService()
|
||||
{
|
||||
@Override
|
||||
public R<Long> addNotice(SysNotice sysNotice, String source)
|
||||
{
|
||||
return R.fail("添加公告失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<SysNotice> getNotice(Long noticeId, String source) {
|
||||
return R.fail("获取公告详情失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Integer> editNotice(SysNotice sysNotice, String source) {
|
||||
return R.fail("编辑公告失败:" + throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Integer> deleteNotice(Long[] noticeIds, String source) {
|
||||
return R.fail("删除公告失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
package com.microservices.system.api.factory;
|
||||
|
||||
import com.microservices.common.core.domain.R;
|
||||
import com.microservices.system.api.RemotePmsService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 用户服务降级处理
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Component
|
||||
public class RemotePmsFallbackFactory implements FallbackFactory<RemotePmsService> {
|
||||
private static final Logger log = LoggerFactory.getLogger(RemotePmsFallbackFactory.class);
|
||||
|
||||
@Override
|
||||
public RemotePmsService create(Throwable throwable) {
|
||||
log.error("项目管理服务调用失败:{}", throwable.getMessage());
|
||||
return new RemotePmsService() {
|
||||
|
||||
@Override
|
||||
public R<Boolean> changeUserGitlinkRole(Long userId, Long deptId, Long oldRoleId, Long newRoleId, String source, String userKey) {
|
||||
return R.fail("切换用户在Gitlink组织团队失败:" + throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
com.microservices.system.api.factory.RemoteUserFallbackFactory
|
||||
com.microservices.system.api.factory.RemoteDeptFallbackFactory
|
||||
com.microservices.system.api.factory.RemoteLogFallbackFactory
|
||||
com.microservices.system.api.factory.RemoteFileFallbackFactory
|
||||
com.microservices.system.api.factory.RemoteCmsFallbackFactory
|
||||
com.microservices.system.api.factory.RemoteZoneFallbackFactory
|
||||
com.microservices.system.api.factory.RemotePmsFallbackFactory
|
||||
com.microservices.system.api.factory.RemoteGatewayFallbackFactory
|
|
@ -1,20 +0,0 @@
|
|||
package com.microservices.auth;
|
||||
|
||||
import com.microservices.common.security.annotation.EnableRyFeignClients;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* 认证授权中心
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@EnableRyFeignClients
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
public class MicroservicesAuthApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(MicroservicesAuthApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 认证授权中心启动成功 ლ(´ڡ`ლ)゙ \n");
|
||||
}
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
com.microservices.common.async.config.AsyncConfiguration
|
|
@ -1,17 +0,0 @@
|
|||
package com.microservices.common.core.constant;
|
||||
|
||||
/**
|
||||
* 异常信息常量
|
||||
*
|
||||
* @author otto
|
||||
*/
|
||||
public class ExceptionMsgConstants {
|
||||
/**
|
||||
* 平台通用异常
|
||||
*/
|
||||
public static final String SYSTEM_EXEC_ERROR = "请求处理异常,请联系管理员处理";
|
||||
/**
|
||||
* 重试异常
|
||||
*/
|
||||
public static final String RETRY_ERROR = "请求发生异常,请重新请求";
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
package com.microservices.common.core.constant;
|
||||
|
||||
/**
|
||||
* 服务名称
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
public class ServiceNameConstants {
|
||||
/**
|
||||
* 认证服务的serviceid
|
||||
*/
|
||||
public static final String AUTH_SERVICE = "microservices-auth";
|
||||
|
||||
/**
|
||||
* 系统模块的serviceid
|
||||
*/
|
||||
public static final String SYSTEM_SERVICE = "microservices-system";
|
||||
|
||||
/**
|
||||
* 文件服务的serviceid
|
||||
*/
|
||||
public static final String FILE_SERVICE = "microservices-file";
|
||||
/**
|
||||
* Cms模块的serviceid
|
||||
*/
|
||||
public static final String CMS_SERVICE = "microservices-cms";
|
||||
/**
|
||||
* 专区模块的serviceid
|
||||
*/
|
||||
public static final String ZONE_SERVICE = "microservices-zone";
|
||||
/**
|
||||
* 项目管理模块的serviceid
|
||||
*/
|
||||
public static final String PMS_SERVICE = "microservices-pms";
|
||||
/**
|
||||
* 网关模块的serviceid
|
||||
*/
|
||||
public static final String GATEWAY_SERVICE = "microservices-gateway";
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
package com.microservices.common.core.constant;
|
||||
|
||||
/**
|
||||
* 用户常量信息
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
public class UserConstants
|
||||
{
|
||||
/**
|
||||
* 平台内系统用户的唯一标志
|
||||
*/
|
||||
public static final String SYS_USER = "SYS_USER";
|
||||
/**
|
||||
* 平台内系统用户的唯一标志
|
||||
*/
|
||||
public static final String DELETE_USER_NICKNAME = "已注销";
|
||||
/**
|
||||
* 已删除用户默认头像
|
||||
*/
|
||||
public static final String DELETE_USER_AVATAR = "data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI3MCIgaGVpZ2h0PSI3MCIgdmlld0JveD0iMCAwIDcwIDcwIj4KICA8ZyBpZD0i57uEXzk5NzEiIGRhdGEtbmFtZT0i57uEIDk5NzEiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIxODQwIDE0NDA3KSI+CiAgICA8Y2lyY2xlIGlkPSLmpK3lnIZfMjI3IiBkYXRhLW5hbWU9IuakreWchiAyMjciIGN4PSIzNSIgY3k9IjM1IiByPSIzNSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIxODQwIC0xNDQwNykiIGZpbGw9IiM4Zjk1OWUiLz4KICAgIDxwYXRoIGlkPSLlt7Lms6jplIAiIGQ9Ik0xMDEuMTM3LDY5LjJhOS4yLDkuMiwwLDEsMS05LjIsOS4yLDkuMiw5LjIsMCwwLDEsOS4yLTkuMlptLTkuNjE5LTIuNzY4YTE0LjMyMywxNC4zMjMsMCwwLDEsNS4xMDguOTM2LDExLjUsMTEuNSwwLDAsMC01LjA2OSwxOC41NTFsLTE2LjY0NSwwYTUuMTI3LDUuMTI3LDAsMCwxLTUuMTI3LTUuMTI3QTE0LjM1NywxNC4zNTcsMCwwLDEsODMuNjE0LDY2LjQ0NmwuNTI4LS4wMTJoNy4zNzVabTEzLjA2OCwxMC44MTdoLTYuOWExLjE1LDEuMTUsMCwwLDAtLjIwNywyLjI4MWwuMjA3LjAxOGg2LjlhMS4xNSwxLjE1LDAsMCwwLDAtMi4zWk04Ny44Myw0NS45NzhhOS44MTUsOS44MTUsMCwxLDEtOS44MTUsOS44MTVBOS44MTUsOS44MTUsMCwwLDEsODcuODMsNDUuOTc4WiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoLTIxODk0Ljc4NSAtMTQ0MzguOTc4KSIgZmlsbD0iI2ZmZiIgb3BhY2l0eT0iMC45NCIvPgogIDwvZz4KPC9zdmc+Cg==";
|
||||
/**
|
||||
* 已删除标记
|
||||
*/
|
||||
public static final String DEL_FLAG_TRUE = "2";
|
||||
/**
|
||||
* 未删除标记
|
||||
*/
|
||||
public static final String DEL_FLAG_FALSE = "0";
|
||||
|
||||
/** 正常状态 */
|
||||
public static final String NORMAL = "0";
|
||||
|
||||
/** 异常状态 */
|
||||
public static final String EXCEPTION = "1";
|
||||
|
||||
/** 用户封禁状态 */
|
||||
public static final String USER_DISABLE = "1";
|
||||
|
||||
/** 角色封禁状态 */
|
||||
public static final String ROLE_DISABLE = "1";
|
||||
|
||||
/** 部门正常状态 */
|
||||
public static final String DEPT_NORMAL = "0";
|
||||
|
||||
/** 部门停用状态 */
|
||||
public static final String DEPT_DISABLE = "1";
|
||||
|
||||
/** 字典正常状态 */
|
||||
public static final String DICT_NORMAL = "0";
|
||||
|
||||
/** 是否为系统默认(是) */
|
||||
public static final String YES = "Y";
|
||||
|
||||
/** 是否菜单外链(是) */
|
||||
public static final String YES_FRAME = "0";
|
||||
|
||||
/** 是否菜单外链(否) */
|
||||
public static final String NO_FRAME = "1";
|
||||
|
||||
/** 菜单类型(目录) */
|
||||
public static final String TYPE_DIR = "M";
|
||||
|
||||
/** 菜单类型(菜单) */
|
||||
public static final String TYPE_MENU = "C";
|
||||
|
||||
/** 菜单类型(按钮) */
|
||||
public static final String TYPE_BUTTON = "F";
|
||||
|
||||
/** Layout组件标识 */
|
||||
public final static String LAYOUT = "Layout";
|
||||
|
||||
/** ParentView组件标识 */
|
||||
public final static String PARENT_VIEW = "ParentView";
|
||||
|
||||
/** InnerLink组件标识 */
|
||||
public final static String INNER_LINK = "InnerLink";
|
||||
|
||||
/** 校验是否唯一的返回标识 */
|
||||
public final static boolean UNIQUE = true;
|
||||
public final static boolean NOT_UNIQUE = false;
|
||||
|
||||
/**
|
||||
* 用户名长度限制
|
||||
*/
|
||||
public static final int USERNAME_MIN_LENGTH = 2;
|
||||
|
||||
public static final int USERNAME_MAX_LENGTH = 20;
|
||||
|
||||
/**
|
||||
* 密码长度限制
|
||||
*/
|
||||
public static final int PASSWORD_MIN_LENGTH = 5;
|
||||
|
||||
public static final int PASSWORD_MAX_LENGTH = 20;
|
||||
/**
|
||||
* 部门及以下数据权限
|
||||
*/
|
||||
public static final String DATA_SCOPE_DEPT_AND_CHILD = "1";
|
||||
|
||||
/**
|
||||
* 仅本人数据权限
|
||||
*/
|
||||
public static final String DATA_SCOPE_SELF = "2";
|
||||
/**
|
||||
* 项目管理-查看我的项目数据权限
|
||||
*/
|
||||
public static final String PMS_PROJECT_DATA_SCOPE_PERMS_ME = "pms:pmsProject:showMe";
|
||||
/**
|
||||
* 项目管理-查看所有项目数据权限
|
||||
*/
|
||||
public static final String PMS_PROJECT_DATA_SCOPE_PERMS_ALL = "pms:pmsProject:show";
|
||||
/**
|
||||
* 项目管理-编辑产品权限
|
||||
*/
|
||||
public static final String PMS_PERMS_PRODUCT_EDIT = "pms:pmsProduct:edit";
|
||||
/**
|
||||
* 项目管理-编辑项目权限
|
||||
*/
|
||||
public static final String PMS_PERMS_PROJECT_EDIT = "pms:pmsProject:edit";
|
||||
/**
|
||||
* 项目管理-知识库管理权限
|
||||
*/
|
||||
public static final String PMS_PERMS_DOCS_MANAGE = "pms:docs:manage";
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
package com.microservices.common.core.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 系统角色信息
|
||||
*
|
||||
* @author wanjia
|
||||
*/
|
||||
@Getter
|
||||
public enum SystemRole {
|
||||
/**
|
||||
* 组织管理员
|
||||
*/
|
||||
PMS_ORG_ADMIN("组织管理员", "pms_org_admin", false),
|
||||
/**
|
||||
* 项目经理
|
||||
*/
|
||||
PMS_PROJECT_MANAGER("项目经理", "pms_project_manager", false),
|
||||
/**
|
||||
* 产品经理
|
||||
*/
|
||||
PMS_PRODUCT_MANAGER("产品经理", "pms_product_manager", false),
|
||||
/**
|
||||
* 普通成员
|
||||
*/
|
||||
PMS_USER("普通成员", "pms_user", false),
|
||||
/**
|
||||
* 测试人员
|
||||
*/
|
||||
PMS_TEST_USER("测试人员", "pms_test_user", false),
|
||||
/**
|
||||
* 客户
|
||||
*/
|
||||
PMS_CUSTOMER("客户", "pms_customer", false),
|
||||
/**
|
||||
* 平台管理员
|
||||
*/
|
||||
PLATFORM_ADMIN("平台管理员", "platform_admin", false),
|
||||
/**
|
||||
* 专区管理员
|
||||
*/
|
||||
ZONE_ADMIN("专区管理员", "zone_admin", false),
|
||||
/**
|
||||
* 专区运营人员
|
||||
*/
|
||||
ZONE_OPERATOR("专区运营人员", "zone_operationer", false),
|
||||
/**
|
||||
* 专区会员
|
||||
*/
|
||||
ZONE_MEMBER("专区会员", "zone_member", true),
|
||||
/**
|
||||
* 未知角色
|
||||
*/
|
||||
UNKNOWN_ROLE("未知角色", "unknown_role",false);
|
||||
|
||||
private final String roleName;
|
||||
private final String roleKey;
|
||||
/**
|
||||
* 是否为虚拟角色,虚拟角色则不可有用户手动在组织中切换设置,系统自动处理相关逻辑
|
||||
*/
|
||||
private final Boolean isVirtual;
|
||||
|
||||
SystemRole(String roleName, String roleKey, Boolean isVirtual) {
|
||||
this.roleName = roleName;
|
||||
this.roleKey = roleKey;
|
||||
this.isVirtual = isVirtual;
|
||||
}
|
||||
|
||||
public static SystemRole getSystemRole(String roleKey) {
|
||||
for (SystemRole systemRole : SystemRole.values()) {
|
||||
if (systemRole.getRoleKey().equals(roleKey)) {
|
||||
return systemRole;
|
||||
}
|
||||
}
|
||||
return UNKNOWN_ROLE;
|
||||
}
|
||||
|
||||
public static Boolean isVirtual(String roleKey) {
|
||||
for (SystemRole systemRole : SystemRole.values()) {
|
||||
if (systemRole.roleKey.equals(roleKey)) {
|
||||
return systemRole.isVirtual;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static Boolean isDefault(String roleKey) {
|
||||
for (SystemRole systemRole : SystemRole.values()) {
|
||||
if (systemRole.roleKey.equals(roleKey)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
package com.microservices.common.core.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 用户身份状态
|
||||
*
|
||||
* @author OTTO
|
||||
*/
|
||||
@Getter
|
||||
public enum UserIdentityStatus {
|
||||
NORMAL("normal", "正常"),
|
||||
QUIT("quit", "离职"),
|
||||
DELETE("delete", "已注销");
|
||||
private final String state;
|
||||
private final String info;
|
||||
|
||||
UserIdentityStatus(String state, String info) {
|
||||
this.state = state;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取非正常状态
|
||||
*
|
||||
* @param state 状态值
|
||||
* @return 状态
|
||||
*/
|
||||
public static UserIdentityStatus getNonNormalState(String state) {
|
||||
for (UserIdentityStatus status : values()) {
|
||||
if (status == QUIT && status.state.equals(state)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getStateInfo() {
|
||||
return "(" + this.getInfo() + ")";
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
package com.microservices.common.core.exception;
|
||||
|
||||
/**
|
||||
* 业务异常
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
public final class NotFoundException extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 错误提示
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 错误明细,内部调试错误
|
||||
* <p>
|
||||
* 和 {@link CommonResult#getDetailMessage()} 一致的设计
|
||||
*/
|
||||
private String detailMessage;
|
||||
|
||||
/**
|
||||
* 空构造方法,避免反序列化问题
|
||||
*/
|
||||
public NotFoundException() {
|
||||
}
|
||||
|
||||
public NotFoundException(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户可传入异常消息及参数列表,系统将根据String.format形式组装异常消息
|
||||
*
|
||||
* @param message
|
||||
* @param params
|
||||
*/
|
||||
public NotFoundException(String message, Object... params) {
|
||||
this.message = String.format(message, params);
|
||||
}
|
||||
|
||||
public String getDetailMessage() {
|
||||
return detailMessage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public NotFoundException setMessage(String message) {
|
||||
this.message = message;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NotFoundException setDetailMessage(String detailMessage) {
|
||||
this.detailMessage = detailMessage;
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package com.microservices.common.core.threadPool;
|
||||
|
||||
import com.microservices.common.core.context.SecurityContextHolder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.*;
|
||||
|
||||
/**
|
||||
* @author OTTO
|
||||
*/
|
||||
public class ThreadPoolExecutorWrap extends ThreadPoolExecutor {
|
||||
private static final Logger logger = LoggerFactory.getLogger(ThreadPoolExecutorWrap.class);
|
||||
|
||||
public ThreadPoolExecutorWrap(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
|
||||
super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory, handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(Runnable task) {
|
||||
if (task == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
super.execute(newTaskFor(new RunnableWrap(task), null));
|
||||
}
|
||||
|
||||
static class RunnableWrap implements Runnable {
|
||||
private final Runnable task;
|
||||
private final Map<String, Object> contextValue;
|
||||
|
||||
public RunnableWrap(Runnable task) {
|
||||
contextValue = SecurityContextHolder.getLocalMap();
|
||||
this.task = task;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
SecurityContextHolder.setLocalMap(contextValue);
|
||||
// 用户任务逻辑
|
||||
task.run();
|
||||
} catch (Exception e) {
|
||||
logger.error("线程池任务执行失败:", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
package com.microservices.common.core.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class CookieUtil {
|
||||
|
||||
|
||||
public static HashMap<String, String> getCookieMap(String cookie) {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
if (cookie != null) {
|
||||
String[] cookies = cookie.split(";");
|
||||
for (String cookieStr : cookies) {
|
||||
String[] cookieArr = cookieStr.split("=");
|
||||
String key = cookieArr[0].trim();
|
||||
String value = cookieArr[1].trim();
|
||||
map.put(key, value);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
public static String getCookieValue(String cookie, String key) {
|
||||
HashMap<String, String> map = getCookieMap(cookie);
|
||||
return map.get(key);
|
||||
}
|
||||
|
||||
public static String removeCookieKey(String cookie, String key) {
|
||||
HashMap<String, String> map = getCookieMap(cookie);
|
||||
map.remove(key);
|
||||
return genCookieStr(map);
|
||||
}
|
||||
|
||||
private static String genCookieStr(HashMap<String, String> cookieMap) {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for (String key : cookieMap.keySet()) {
|
||||
stringBuilder.append(key).append("=").append(cookieMap.get(key)).append(";");
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
package com.microservices.common.core.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author otto
|
||||
*/
|
||||
public class ListUtil {
|
||||
|
||||
/**
|
||||
* 泛型列表格式转换
|
||||
*
|
||||
* @param obj
|
||||
* @param clazz
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> List<T> castList(List<?> obj, Class<T> clazz) {
|
||||
List<T> result = new ArrayList<T>();
|
||||
for (Object o : obj) {
|
||||
result.add(clazz.cast(o));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
package com.microservices.common.core.utils;
|
||||
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
|
||||
import java.util.Base64;
|
||||
|
||||
public class YamlValidatorUtils {
|
||||
|
||||
public static void validateYaml(String base64Yaml) {
|
||||
// 将base64编码的字符串解码为原始YAML字符串
|
||||
byte[] decodedBytes = Base64.getDecoder().decode(base64Yaml);
|
||||
String yamlString = new String(decodedBytes);
|
||||
|
||||
// 创建YAML解析器
|
||||
Yaml yaml = new Yaml();
|
||||
|
||||
try {
|
||||
// 尝试解析YAML字符串
|
||||
yaml.load(yamlString);
|
||||
} catch (YAMLException e) {
|
||||
// 捕获YAML格式错误,并返回错误提示信息
|
||||
throw new ServiceException("YAML格式错误");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package com.microservices.common.core.web.page;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class Breadcrumb {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer type;
|
||||
}
|
|
@ -1 +0,0 @@
|
|||
com.microservices.common.core.utils.SpringUtils
|
|
@ -1 +0,0 @@
|
|||
com.microservices.common.datascope.aspect.DataScopeAspect
|
|
@ -1,19 +0,0 @@
|
|||
package com.microservices.common.datasource.annotation;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 主库数据源
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@DS("master")
|
||||
public @interface Master
|
||||
{
|
||||
|
||||
}
|
|
@ -1,19 +0,0 @@
|
|||
package com.microservices.common.datasource.annotation;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 从库数据源
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@Target({ ElementType.TYPE, ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@DS("slave")
|
||||
public @interface Slave
|
||||
{
|
||||
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
package com.microservices.common.httpClient.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AuthorDto {
|
||||
|
||||
private String image_url;
|
||||
private String name;
|
||||
private Long id;
|
||||
private String login;
|
||||
private String type;
|
||||
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package com.microservices.common.httpClient.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
public class CommitDto {
|
||||
|
||||
private String message;
|
||||
private String sha;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||
private Date created_at;
|
||||
private String time_from_now;
|
||||
private Long created_at_unix;
|
||||
private Long timestamp;
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
package com.microservices.common.httpClient.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EntryDto implements Comparable<EntryDto> {
|
||||
private String name;
|
||||
private String path;
|
||||
private String sha;
|
||||
private String type;
|
||||
private Long size;
|
||||
private Boolean is_readme_file;
|
||||
private String content;
|
||||
private String target;
|
||||
private CommitDto commit;
|
||||
|
||||
@Override
|
||||
public int compareTo(EntryDto entryDto) {
|
||||
// 重写Comparable接口的compareTo方法,根据年龄升序排列,降序修改相减顺序即可
|
||||
return Math.toIntExact(entryDto.getCommit().getCreated_at_unix() - this.commit.getCreated_at_unix());
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
package com.microservices.common.httpClient.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class FileEntryDto {
|
||||
private EntryDto entries;
|
||||
private LastCommitDto last_commit;
|
||||
}
|
|
@ -1,191 +0,0 @@
|
|||
package com.microservices.common.httpClient.domain;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.alibaba.fastjson2.TypeReference;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.core.utils.html.EscapeUtil;
|
||||
import lombok.Data;
|
||||
import org.apache.http.client.utils.URIBuilder;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author otto
|
||||
*/
|
||||
@Data
|
||||
public class GitLinkRequestUrl {
|
||||
private String path;
|
||||
private Boolean isOpen;
|
||||
private Boolean isAdmin;
|
||||
private String resultKey;
|
||||
|
||||
protected static GitLinkRequestUrl getGitLinkRequestUrl(boolean isOpen, String path, String resultKey) {
|
||||
GitLinkRequestUrl gitLinkRequestUrl = new GitLinkRequestUrl();
|
||||
gitLinkRequestUrl.setIsOpen(isOpen);
|
||||
gitLinkRequestUrl.setIsAdmin(false);
|
||||
gitLinkRequestUrl.setPath(path);
|
||||
gitLinkRequestUrl.setResultKey(resultKey);
|
||||
return gitLinkRequestUrl;
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl UPLOAD_ATTACHMENTS() {
|
||||
return getGitLinkRequestUrl("/api/attachments.json");
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl DELETE_ATTACHMENTS(Object fileIdentifier) {
|
||||
String path = String.format("/api/attachments/%s.json", fileIdentifier);
|
||||
return getGitLinkRequestUrl(path);
|
||||
}
|
||||
|
||||
protected static GitLinkRequestUrl getAdminGitLinkRequestUrl(String path) {
|
||||
GitLinkRequestUrl gitLinkRequestUrl = new GitLinkRequestUrl();
|
||||
gitLinkRequestUrl.setIsOpen(false);
|
||||
gitLinkRequestUrl.setIsAdmin(true);
|
||||
gitLinkRequestUrl.setPath(path);
|
||||
return gitLinkRequestUrl;
|
||||
}
|
||||
|
||||
protected static GitLinkRequestUrl getGitLinkRequestUrl(String path) {
|
||||
return getGitLinkRequestUrl(false, path, null);
|
||||
}
|
||||
|
||||
public static String GET_ATTACHMENTS(String gitlinkUrl, String fileId) {
|
||||
return EscapeUtil.removeExtraSlashOfUrl(String.format("%s/api/attachments/%s", gitlinkUrl, fileId));
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl GET_LIST_BY_PAGES(String url, Integer page, Integer limit) {
|
||||
return getAdminGitLinkRequestUrl(String.format("%s?page=%d&limit=%d", url, page, limit));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*/
|
||||
public static GitLinkRequestUrl USER(String username) {
|
||||
return getOpenGitLinkRequestUrl(String.format("/api/users/%s.json", username));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取TOKEN
|
||||
*/
|
||||
public static GitLinkRequestUrl GET_TOKEN() {
|
||||
return getOpenGitLinkRequestUrl("/oauth/token");
|
||||
}
|
||||
|
||||
|
||||
protected static GitLinkRequestUrl getGitLinkRequestUrl(String path, String resultKey) {
|
||||
return getGitLinkRequestUrl(false, path, resultKey);
|
||||
}
|
||||
|
||||
protected static GitLinkRequestUrl getOpenGitLinkRequestUrl(String path) {
|
||||
return getGitLinkRequestUrl(true, path, null);
|
||||
}
|
||||
|
||||
protected static GitLinkRequestUrl getOpenGitLinkRequestUrl(String path, String resultKey) {
|
||||
return getGitLinkRequestUrl(true, path, resultKey);
|
||||
}
|
||||
|
||||
public static String buildUri(String url, Map<String, String> params) throws URISyntaxException {
|
||||
return ConcatenateParametersAfterUrl(url, params);
|
||||
}
|
||||
|
||||
public static String buildUri(String url, JSONObject paramsObj) throws URISyntaxException {
|
||||
Map<String, String> params = converJSONObjectToParamsMap(paramsObj);
|
||||
return ConcatenateParametersAfterUrl(url, params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 在url后拼接参数
|
||||
*
|
||||
* @param url eg: gitlink.org.cn/api/v1
|
||||
* @param paramKey eg: push_whitelist_usernames[]
|
||||
* @param params eg: ["a","b"]
|
||||
* @return String eg: gitlink.org.cn/api/v1?push_whitelist_usernames[]=a&push_whitelist_usernames[]=b
|
||||
*/
|
||||
public static String concatenateParametersAfterUrl(String url, String paramKey, List<String> params) {
|
||||
if (params == null || params.isEmpty()) {
|
||||
return url;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder(url);
|
||||
|
||||
if (!url.contains("?")) {
|
||||
sb.append("?");
|
||||
} else if (!url.endsWith("&")) {
|
||||
sb.append("&");
|
||||
}
|
||||
|
||||
for (String username : params) {
|
||||
sb.append(paramKey).append("=").append(username).append("&");
|
||||
}
|
||||
|
||||
// 判断最后一个字符是否为"&"
|
||||
if(sb.charAt(sb.length() - 1) == '&') {
|
||||
sb.deleteCharAt(sb.length() - 1);
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索用户列表
|
||||
*/
|
||||
public static GitLinkRequestUrl USERS(String query) {
|
||||
return getOpenGitLinkRequestUrl(String.format("/api/users/list.json%s", query));
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl LOGIN() {
|
||||
return getOpenGitLinkRequestUrl("/api/accounts/login.json");
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl CREATE_FILE(String repoOwner, String repoIdentifier) {
|
||||
return getGitLinkRequestUrl(
|
||||
String.format("/api/%s/%s/create_file.json", repoOwner, repoIdentifier)
|
||||
);
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl UPDATE_FILE(String repoOwner, String repoIdentifier) {
|
||||
return getGitLinkRequestUrl(
|
||||
String.format("/api/%s/%s/update_file.json", repoOwner, repoIdentifier)
|
||||
);
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl DELETE_FILE(String repoOwner, String repoIdentifier, String filepath, String sha, String branchName) {
|
||||
return getGitLinkRequestUrl(
|
||||
String.format("/api/%s/%s/delete_file.json?filepath=%s&sha=%s&branch=%s", repoOwner, repoIdentifier, URLEncoder.encode(filepath), sha, branchName)
|
||||
);
|
||||
}
|
||||
|
||||
public static GitLinkRequestUrl GET_FILE_SUB_ENTRIES(String repoOwner, String repoIdentifier, String filepath, String ref) {
|
||||
return getGitLinkRequestUrl(
|
||||
String.format("/api/%s/%s/sub_entries.json?filepath=%s&ref=%s&type=%s", repoOwner, repoIdentifier, URLEncoder.encode(filepath), ref, "file")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将JSONObject转为Map<String,String>
|
||||
*/
|
||||
private static Map<String, String> converJSONObjectToParamsMap(JSONObject issueTagsSearchParams) {
|
||||
return JSON.parseObject(issueTagsSearchParams.toJSONString(), new TypeReference<Map<String, String>>() {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 在url后拼接参数
|
||||
*/
|
||||
private static String ConcatenateParametersAfterUrl(String url, Map<String, String> params) throws URISyntaxException {
|
||||
URIBuilder uriBuilder = new URIBuilder(url);
|
||||
if (params != null) {
|
||||
Set<Map.Entry<String, String>> entrySet = params.entrySet();
|
||||
for (Map.Entry<String, String> entry : entrySet) {
|
||||
if (StringUtils.isNotEmpty(entry.getValue())) {
|
||||
uriBuilder.addParameter(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return uriBuilder.build().toString();
|
||||
}
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package com.microservices.common.httpClient.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LastCommitDto {
|
||||
|
||||
private AuthorDto committer;
|
||||
private AuthorDto author;
|
||||
|
||||
}
|
|
@ -1,389 +0,0 @@
|
|||
package com.microservices.common.httpClient.service;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.constant.Constants;
|
||||
import com.microservices.common.core.constant.HttpStatus;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.httpClient.domain.CustomHttpDelete;
|
||||
import com.microservices.system.api.domain.SysFileBytes;
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.client.config.RequestConfig;
|
||||
import org.apache.http.client.methods.*;
|
||||
import org.apache.http.entity.ContentType;
|
||||
import org.apache.http.entity.StringEntity;
|
||||
import org.apache.http.entity.mime.MultipartEntityBuilder;
|
||||
import org.apache.http.impl.client.CloseableHttpClient;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.microservices.common.core.web.domain.AjaxResult.DATA_TAG;
|
||||
|
||||
/**
|
||||
* @author otto
|
||||
*/
|
||||
@Component
|
||||
public class HttpAPIService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(HttpAPIService.class);
|
||||
|
||||
@Autowired
|
||||
private CloseableHttpClient httpClient;
|
||||
@Autowired
|
||||
private RequestConfig config;
|
||||
|
||||
/**
|
||||
* 带参数的post请求
|
||||
*
|
||||
* @param url
|
||||
* @param jsonObject
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public JSONObject doPost(String url, JSONObject jsonObject) throws Exception {
|
||||
return doPost(url, jsonObject, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带参数的post请求
|
||||
*
|
||||
* @param url
|
||||
* @param jsonArray
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public JSONObject doPost(String url, JSONArray jsonArray) throws Exception {
|
||||
return doPost(url, jsonArray, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带参数以及Header的post请求
|
||||
*
|
||||
* @param url
|
||||
* @param jsonObject
|
||||
* @param headers
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public JSONObject doPost(String url, JSONObject jsonObject, HashMap<String, String> headers) throws Exception {
|
||||
// 声明httpPost请求
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
// 加入配置信息
|
||||
httpPost.setConfig(config);
|
||||
|
||||
if (jsonObject != null) {
|
||||
String contentJsonString = jsonObject.toJSONString();
|
||||
StringEntity stringEntity = new StringEntity(contentJsonString, Constants.UTF8);
|
||||
stringEntity.setContentEncoding(Constants.UTF8);
|
||||
stringEntity.setContentType(Constants.JSON_CONTENT_TYPE);
|
||||
// 把表单放到post里
|
||||
httpPost.setEntity(stringEntity);
|
||||
}
|
||||
return doRequest(httpPost, headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带参数以及Header的post请求
|
||||
*
|
||||
* @param url
|
||||
* @param jsonArray
|
||||
* @param headers
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public JSONObject doPost(String url, JSONArray jsonArray, HashMap<String, String> headers) throws Exception {
|
||||
// 声明httpPost请求
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
// 加入配置信息
|
||||
httpPost.setConfig(config);
|
||||
|
||||
if (jsonArray != null) {
|
||||
String contentJsonString = jsonArray.toJSONString();
|
||||
StringEntity stringEntity = new StringEntity(contentJsonString, Constants.UTF8);
|
||||
stringEntity.setContentEncoding(Constants.UTF8);
|
||||
stringEntity.setContentType(Constants.JSON_CONTENT_TYPE);
|
||||
// 把表单放到post里
|
||||
httpPost.setEntity(stringEntity);
|
||||
}
|
||||
return doRequest(httpPost, headers);
|
||||
}
|
||||
|
||||
public JSONObject doPostFile(String url, MultipartFile file, HashMap<String, String> headers) throws Exception {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
|
||||
// 创建一个输入流
|
||||
InputStream inputStream = file.getInputStream();
|
||||
try {
|
||||
// 构建文件上传请求的实体
|
||||
MultipartEntityBuilder builder = MultipartEntityBuilder.create();
|
||||
builder.addBinaryBody(
|
||||
"file",
|
||||
inputStream,
|
||||
ContentType.create("application/octet-stream"),
|
||||
URLEncoder.encode(file.getOriginalFilename(), StandardCharsets.UTF_8.toString())
|
||||
);
|
||||
|
||||
HttpEntity entity = builder.build();
|
||||
httpPost.setEntity(entity);
|
||||
return doRequest(httpPost, headers);
|
||||
} finally {
|
||||
// 确保输入流被关闭,以释放资源
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException e) {
|
||||
// Log the exception
|
||||
logger.error("Failed to close input stream", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public JSONObject doPostFormData(String url, HttpEntity httpEntity, HashMap<String, String> headers) throws Exception {
|
||||
HttpPost httpPost = new HttpPost(url);
|
||||
httpPost.setEntity(httpEntity);
|
||||
|
||||
return doRequest(httpPost, headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带参数以及Header的put请求
|
||||
*
|
||||
* @param url
|
||||
* @param jsonObject
|
||||
* @param headers
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public JSONObject doPut(String url, JSONObject jsonObject, HashMap<String, String> headers) throws Exception {
|
||||
// 声明httpPut请求
|
||||
HttpPut httpPut = new HttpPut(url);
|
||||
// 加入配置信息
|
||||
httpPut.setConfig(config);
|
||||
|
||||
if (jsonObject != null) {
|
||||
StringEntity stringEntity = new StringEntity(jsonObject.toJSONString(), Constants.UTF8);
|
||||
stringEntity.setContentEncoding(Constants.UTF8);
|
||||
stringEntity.setContentType(Constants.JSON_CONTENT_TYPE);
|
||||
// 把表单放到post里
|
||||
httpPut.setEntity(stringEntity);
|
||||
}
|
||||
return doRequest(httpPut, headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带Header的delete请求
|
||||
*
|
||||
* @param url
|
||||
* @param headers
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public JSONObject doDelete(String url, JSONObject jsonObject, HashMap<String, String> headers) throws Exception {
|
||||
// 声明httpDelete请求
|
||||
CustomHttpDelete httpDelete = new CustomHttpDelete(url);
|
||||
// 加入配置信息
|
||||
httpDelete.setConfig(config);
|
||||
if (jsonObject != null) {
|
||||
StringEntity stringEntity = new StringEntity(jsonObject.toJSONString(), Constants.UTF8);
|
||||
stringEntity.setContentEncoding(Constants.UTF8);
|
||||
stringEntity.setContentType(Constants.JSON_CONTENT_TYPE);
|
||||
// 把表单放到post里
|
||||
httpDelete.setEntity(stringEntity);
|
||||
}
|
||||
|
||||
return doRequest(httpDelete, headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带Header的get请求
|
||||
*
|
||||
* @param url
|
||||
* @param headers
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public JSONObject doGet(String url, HashMap<String, String> headers) throws Exception {
|
||||
// 声明httpGet请求
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
// 加入配置信息
|
||||
httpGet.setConfig(config);
|
||||
|
||||
return doRequest(httpGet, headers);
|
||||
}
|
||||
|
||||
public void doGetResponse(String url, HttpServletResponse resp, HashMap<String, String> headers) throws Exception {
|
||||
// 声明httpGet请求
|
||||
HttpGet httpGet = new HttpGet(url);
|
||||
// 加入配置信息
|
||||
httpGet.setConfig(config);
|
||||
doRequestForResponse(httpGet, resp, headers);
|
||||
}
|
||||
|
||||
public JSONObject doPatch(String url, JSONObject jsonParam, HashMap<String, String> header) throws Exception {
|
||||
|
||||
HttpPatch httpPatch = new HttpPatch(url);
|
||||
//请求头
|
||||
if (MapUtils.isNotEmpty(header)) {
|
||||
for (Map.Entry<String, String> entry : header.entrySet()) {
|
||||
httpPatch.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
if (jsonParam != null) {
|
||||
StringEntity entity = new StringEntity(jsonParam.toString(), Constants.UTF8);
|
||||
entity.setContentEncoding(Constants.UTF8);
|
||||
entity.setContentType(Constants.JSON_CONTENT_TYPE);
|
||||
httpPatch.setEntity(entity);
|
||||
}
|
||||
return doRequest(httpPatch, header);
|
||||
}
|
||||
|
||||
/**
|
||||
* 带参数以及Header的请求
|
||||
*
|
||||
* @param request
|
||||
* @param headers
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public JSONObject doRequest(HttpUriRequest request, HashMap<String, String> headers) throws Exception {
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
headers.forEach(request::setHeader);
|
||||
}
|
||||
|
||||
// 发起请求
|
||||
try (CloseableHttpResponse response = httpClient.execute(request)) {
|
||||
if (response != null) {
|
||||
int httpStatusCode = response.getStatusLine().getStatusCode();
|
||||
|
||||
if (HttpStatus.checkSuccess(httpStatusCode)) {
|
||||
HttpEntity httpEntity = response.getEntity();
|
||||
if (httpEntity == null) {
|
||||
return createStatusObject(httpStatusCode);
|
||||
} else {
|
||||
// length>0代表有数据,length=-1代表分块传输,length=0代表未返回数据
|
||||
long length = httpEntity.getContentLength();
|
||||
if (length != 0L) {
|
||||
String result = EntityUtils.toString(httpEntity);
|
||||
if (!JSON.isValid(result)) {
|
||||
logger.error("平台接口响应格式异常,状态码:{},响应内容:{}", httpStatusCode, result);
|
||||
throw new ServiceException("平台接口响应格式异常");
|
||||
}
|
||||
Object resultObj = JSON.parse(result);
|
||||
if (resultObj instanceof JSONArray) {
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put(DATA_TAG, resultObj);
|
||||
return jsonObject;
|
||||
}
|
||||
return JSONObject.parseObject(result);
|
||||
} else {
|
||||
return createStatusObject(httpStatusCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
HttpEntity httpEntity = response.getEntity();
|
||||
if (httpEntity != null) {
|
||||
String result = EntityUtils.toString(httpEntity);
|
||||
throw new Exception("请求响应失败:" + result);
|
||||
}
|
||||
throw new Exception("请求响应失败,状态码:" + response.getStatusLine().getStatusCode());
|
||||
}
|
||||
throw new Exception("请求响应失败");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建响应状态码JSON对象
|
||||
*
|
||||
* @param status 请求响应状态码
|
||||
* @return JSON对象
|
||||
*/
|
||||
private JSONObject createStatusObject(int status) {
|
||||
JSONObject resObject = new JSONObject();
|
||||
resObject.put("status", status);
|
||||
return resObject;
|
||||
}
|
||||
|
||||
|
||||
public void doRequestForResponse(HttpUriRequest request, HttpServletResponse resp, HashMap<String, String> headers) throws Exception {
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
headers.forEach(request::setHeader);
|
||||
}
|
||||
|
||||
try (CloseableHttpResponse response = httpClient.execute(request)) {
|
||||
if (response != null) {
|
||||
if (response.getStatusLine().getStatusCode() == HttpStatus.SUCCESS) {
|
||||
copyResponse(response, resp);
|
||||
}
|
||||
throw new Exception("请求响应失败,状态码:" + response.getStatusLine().getStatusCode());
|
||||
}
|
||||
throw new Exception("请求响应失败");
|
||||
}
|
||||
}
|
||||
|
||||
private void copyResponse(CloseableHttpResponse closeableHttpResponse, HttpServletResponse httpResponse) throws IOException {
|
||||
// 设置响应状态码
|
||||
httpResponse.setStatus(closeableHttpResponse.getStatusLine().getStatusCode());
|
||||
|
||||
// 复制响应头
|
||||
for (org.apache.http.Header header : closeableHttpResponse.getAllHeaders()) {
|
||||
httpResponse.addHeader(header.getName(), header.getValue());
|
||||
}
|
||||
|
||||
// 复制响应体
|
||||
try (InputStream input = closeableHttpResponse.getEntity().getContent();
|
||||
OutputStream output = httpResponse.getOutputStream()) {
|
||||
byte[] buffer = new byte[4096];
|
||||
int bytesRead;
|
||||
while ((bytesRead = input.read(buffer)) != -1) {
|
||||
output.write(buffer, 0, bytesRead);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SysFileBytes doGetFileInputStream(String url, HashMap<String, String> headers) throws Exception {
|
||||
// 声明httpGet请求
|
||||
HttpGet request = new HttpGet(url);
|
||||
// 加入配置信息
|
||||
request.setConfig(config);
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
headers.forEach(request::setHeader);
|
||||
}
|
||||
|
||||
try (CloseableHttpResponse response = httpClient.execute(request)) {
|
||||
if (response != null) {
|
||||
int httpStatusCode = response.getStatusLine().getStatusCode();
|
||||
if (HttpStatus.checkSuccess(httpStatusCode)) {
|
||||
HttpEntity httpEntity = response.getEntity();
|
||||
if (httpEntity != null) {
|
||||
InputStream input = httpEntity.getContent();
|
||||
InputStream cloneInput = IOUtils.toBufferedInputStream(input);
|
||||
String fileName = url.substring(url.lastIndexOf('/') + 1);
|
||||
SysFileBytes sysFileBytes = new SysFileBytes();
|
||||
sysFileBytes.setFileInputStream(cloneInput);
|
||||
sysFileBytes.setFileName(fileName);
|
||||
return sysFileBytes;
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new Exception("请求响应失败");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
com.microservices.common.httpClient.service.HttpAPIService
|
||||
com.microservices.common.httpClient.util.GitLinkRequestHelper
|
||||
com.microservices.common.httpClient.config.HttpClientConfiguration
|
|
@ -1,2 +0,0 @@
|
|||
com.microservices.common.log.service.AsyncLogService
|
||||
com.microservices.common.log.aspect.LogAspect
|
|
@ -1,2 +0,0 @@
|
|||
com.microservices.common.redis.configure.RedisConfig
|
||||
com.microservices.common.redis.service.RedisService
|
|
@ -1,38 +0,0 @@
|
|||
package com.microservices.common.security.feign;
|
||||
|
||||
import feign.RequestInterceptor;
|
||||
import feign.codec.Encoder;
|
||||
import feign.form.FormEncoder;
|
||||
import org.springframework.beans.factory.ObjectFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
|
||||
import org.springframework.cloud.openfeign.support.SpringEncoder;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
/**
|
||||
* Feign 配置注册
|
||||
*
|
||||
* @author microservices
|
||||
**/
|
||||
@Configuration
|
||||
public class FeignAutoConfiguration
|
||||
{
|
||||
// 这里会由容器自动注入HttpMessageConverters的对象工厂
|
||||
@Autowired
|
||||
private ObjectFactory<HttpMessageConverters> messageConverters;
|
||||
@Bean
|
||||
public RequestInterceptor requestInterceptor()
|
||||
{
|
||||
return new FeignRequestInterceptor();
|
||||
}
|
||||
|
||||
// new一个form编码器,实现支持form表单提交
|
||||
// 注意这里方法名称,也就是bean的名称是什么不重要,
|
||||
// 重要的是返回类型要是 Encoder 并且实现类必须是 FormEncoder 或者其子类
|
||||
@Bean
|
||||
public Encoder feignFormEncoder() {
|
||||
return new FormEncoder(new SpringEncoder(messageConverters));
|
||||
}
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
package com.microservices.common.security.service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @author otto
|
||||
*/
|
||||
public interface IRequestCustomService {
|
||||
/**
|
||||
* 处理请求中组织Id
|
||||
*/
|
||||
String processRequestDeptId(HttpServletRequest request);
|
||||
}
|
|
@ -1,20 +0,0 @@
|
|||
package com.microservices.common.security.service.impl;
|
||||
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.utils.ServletUtils;
|
||||
import com.microservices.common.security.service.IRequestCustomService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @author otto
|
||||
*/
|
||||
@Service
|
||||
public class RequestCustomServiceImpl implements IRequestCustomService {
|
||||
|
||||
@Override
|
||||
public String processRequestDeptId(HttpServletRequest request) {
|
||||
return ServletUtils.getHeader(request, SecurityConstants.DEPT_ID);
|
||||
}
|
||||
}
|
|
@ -1,318 +0,0 @@
|
|||
package com.microservices.common.security.utils;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.microservices.common.core.constant.SecurityConstants;
|
||||
import com.microservices.common.core.constant.TokenConstants;
|
||||
import com.microservices.common.core.context.SecurityContextHolder;
|
||||
import com.microservices.common.core.exception.ServiceException;
|
||||
import com.microservices.common.core.utils.ServletUtils;
|
||||
import com.microservices.common.core.utils.StringUtils;
|
||||
import com.microservices.common.security.annotation.RequiresPermissions;
|
||||
import com.microservices.system.api.domain.SysRole;
|
||||
import com.microservices.system.api.domain.SysUser;
|
||||
import com.microservices.system.api.domain.SysUserDeptRole;
|
||||
import com.microservices.system.api.model.LoginUser;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
|
||||
import org.springframework.core.type.filter.AnnotationTypeFilter;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 权限获取工具类
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
public class SecurityUtils
|
||||
{
|
||||
/**
|
||||
* 获取用户ID
|
||||
*/
|
||||
public static Long getUserId()
|
||||
{
|
||||
return SecurityContextHolder.getUserId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取组织ID
|
||||
*/
|
||||
public static Long getDeptId() {
|
||||
return SecurityContextHolder.getDeptId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户名称
|
||||
*/
|
||||
public static String getUsername()
|
||||
{
|
||||
return SecurityContextHolder.getUserName();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录GitlinkId
|
||||
*/
|
||||
public static Long getGitlinkUserId() {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
if (loginUser == null) {
|
||||
return null;
|
||||
}
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
if (sysUser == null) {
|
||||
return null;
|
||||
}
|
||||
return sysUser.getGitlinkUserId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户key
|
||||
*/
|
||||
public static String getUserKey()
|
||||
{
|
||||
return SecurityContextHolder.getUserKey();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录用户信息
|
||||
*/
|
||||
public static LoginUser getLoginUser() {
|
||||
return SecurityContextHolder.get(SecurityConstants.LOGIN_USER, LoginUser.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录用户身份
|
||||
*/
|
||||
public static SysUserDeptRole getUserIdentity() {
|
||||
return SecurityContextHolder.get(SecurityConstants.USER_IDENTITY, SysUserDeptRole.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置忽略数据权限校验
|
||||
*/
|
||||
public static void setIgnoreDataScopeCheck() {
|
||||
SecurityContextHolder.set(SecurityConstants.IGNORE_DATA_SCOPE_CHECK, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否忽略数据权限校验
|
||||
*/
|
||||
public static Boolean getIgnoreDataScopeCheck() {
|
||||
Boolean ignoreCheck = SecurityContextHolder.get(SecurityConstants.IGNORE_DATA_SCOPE_CHECK, Boolean.class);
|
||||
if (ignoreCheck == null) {
|
||||
return false;
|
||||
}
|
||||
return ignoreCheck;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取登录用户身份
|
||||
*/
|
||||
public static Boolean checkCurrentDeptId(Long deptId) {
|
||||
Boolean ignoreDataScopeCheck = getIgnoreDataScopeCheck();
|
||||
if (ignoreDataScopeCheck) {
|
||||
return true;
|
||||
}
|
||||
SysUserDeptRole userIdentify = getUserIdentity();
|
||||
if (userIdentify == null) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(userIdentify.getDeptId(), deptId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色键值
|
||||
*/
|
||||
public static String getRoleKey() {
|
||||
SysUserDeptRole userIdentity = getUserIdentity();
|
||||
if (userIdentity != null) {
|
||||
SysRole sysRole = userIdentity.getSysRole();
|
||||
if (sysRole != null) {
|
||||
return sysRole.getRoleKey();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求token
|
||||
*/
|
||||
public static String getToken() {
|
||||
return getToken(ServletUtils.getRequest());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据request获取请求token
|
||||
*/
|
||||
public static String getToken(HttpServletRequest request)
|
||||
{
|
||||
if (request == null) {
|
||||
return null;
|
||||
}
|
||||
// 从header获取token标识
|
||||
String token = request.getHeader(TokenConstants.AUTHENTICATION);
|
||||
return replaceTokenPrefix(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* 裁剪token前缀
|
||||
*/
|
||||
public static String replaceTokenPrefix(String token)
|
||||
{
|
||||
// 如果前端设置了令牌前缀,则裁剪掉前缀
|
||||
if (StringUtils.isNotEmpty(token) && token.startsWith(TokenConstants.PREFIX))
|
||||
{
|
||||
token = token.replaceFirst(TokenConstants.PREFIX, "");
|
||||
}
|
||||
return token;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否为管理员
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean isAdmin(Long userId) {
|
||||
return userId != null && 1L == userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前登录用户是否为管理员
|
||||
*
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean isAdmin() {
|
||||
LoginUser loginUser = getLoginUser();
|
||||
Long userId = loginUser.getUserId();
|
||||
return userId != null && 1L == userId;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成BCryptPasswordEncoder密码
|
||||
*
|
||||
* @param password 密码
|
||||
* @return 加密字符串
|
||||
*/
|
||||
public static String encryptPassword(String password) {
|
||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
return passwordEncoder.encode(password);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断密码是否相同
|
||||
*
|
||||
* @param rawPassword 真实密码
|
||||
* @param encodedPassword 加密后字符
|
||||
* @return 结果
|
||||
*/
|
||||
public static boolean matchesPassword(String rawPassword, String encodedPassword)
|
||||
{
|
||||
BCryptPasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
return passwordEncoder.matches(rawPassword, encodedPassword);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取微服务下所有权限清单
|
||||
*
|
||||
* @param basePackage 包路径(示例:com.microservices.pms.*.controller)
|
||||
* @return 权限清单
|
||||
*/
|
||||
public static List<JSONObject> getAllPermissions(String basePackage) {
|
||||
List<JSONObject> jsonObjectList = new ArrayList<>();
|
||||
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false);
|
||||
provider.addIncludeFilter(new AnnotationTypeFilter(RestController.class));
|
||||
|
||||
Set<BeanDefinition> candidateComponents = new HashSet<>();
|
||||
for (String packageToScan : basePackage.split(",")) {
|
||||
candidateComponents.addAll(provider.findCandidateComponents(packageToScan));
|
||||
}
|
||||
|
||||
try {
|
||||
for (BeanDefinition candidateComponent : candidateComponents) {
|
||||
JSONObject controllerObject = new JSONObject();
|
||||
String basePath = "";
|
||||
Class<?> clazz = Class.forName(candidateComponent.getBeanClassName());
|
||||
String controllerName = clazz.getName();
|
||||
if (clazz.isAnnotationPresent(Api.class)) {
|
||||
Api api = clazz.getAnnotation(Api.class);
|
||||
String[] tags = api.tags();
|
||||
if (StringUtils.isNotEmpty(tags) && !api.hidden()) {
|
||||
controllerName = String.join(",", tags);
|
||||
}
|
||||
}
|
||||
if (clazz.isAnnotationPresent(RequestMapping.class)) {
|
||||
RequestMapping requestMapping = clazz.getAnnotation(RequestMapping.class);
|
||||
if (requestMapping.value().length > 0) {
|
||||
basePath = requestMapping.value()[0];
|
||||
}
|
||||
}
|
||||
|
||||
controllerObject.put("Controller", controllerName);
|
||||
List<JSONObject> methodList = new ArrayList<>();
|
||||
Method[] methods = clazz.getMethods();
|
||||
for (Method method : methods) {
|
||||
StringBuilder path = new StringBuilder(basePath);
|
||||
if (method.isAnnotationPresent(RequiresPermissions.class)) {
|
||||
String methodName = method.getName();
|
||||
String requestMethodName = "";
|
||||
if (method.isAnnotationPresent(ApiOperation.class)) {
|
||||
ApiOperation apiOperation = method.getAnnotation(ApiOperation.class);
|
||||
methodName = apiOperation.value();
|
||||
}
|
||||
|
||||
if (method.isAnnotationPresent(GetMapping.class)) {
|
||||
GetMapping requestMapping = method.getAnnotation(GetMapping.class);
|
||||
if (requestMapping.value().length > 0) {
|
||||
path.append(requestMapping.value()[0]);
|
||||
}
|
||||
requestMethodName = "GET ";
|
||||
}
|
||||
|
||||
if (method.isAnnotationPresent(PostMapping.class)) {
|
||||
PostMapping requestMapping = method.getAnnotation(PostMapping.class);
|
||||
if (requestMapping.value().length > 0) {
|
||||
path.append(requestMapping.value()[0]);
|
||||
}
|
||||
requestMethodName = "POST ";
|
||||
}
|
||||
|
||||
if (method.isAnnotationPresent(DeleteMapping.class)) {
|
||||
DeleteMapping requestMapping = method.getAnnotation(DeleteMapping.class);
|
||||
if (requestMapping.value().length > 0) {
|
||||
path.append(requestMapping.value()[0]);
|
||||
}
|
||||
requestMethodName = "DELETE ";
|
||||
}
|
||||
|
||||
if (method.isAnnotationPresent(PutMapping.class)) {
|
||||
PutMapping requestMapping = method.getAnnotation(PutMapping.class);
|
||||
if (requestMapping.value().length > 0) {
|
||||
path.append(requestMapping.value()[0]);
|
||||
}
|
||||
requestMethodName = "PUT ";
|
||||
}
|
||||
|
||||
RequiresPermissions requiresPermissions = method.getAnnotation(RequiresPermissions.class);
|
||||
String[] permissionsValue = requiresPermissions.value();
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("methodName", methodName);
|
||||
jsonObject.put("permissionsValue", String.join(",", permissionsValue));
|
||||
jsonObject.put("url", String.format("%s%s", requestMethodName, path));
|
||||
methodList.add(jsonObject);
|
||||
}
|
||||
}
|
||||
controllerObject.put("methodList", methodList);
|
||||
jsonObjectList.add(controllerObject);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ServiceException("错误错误:%s", e.getMessage());
|
||||
}
|
||||
return jsonObjectList;
|
||||
}
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
com.microservices.common.security.config.WebMvcConfig
|
||||
com.microservices.common.security.service.TokenService
|
||||
com.microservices.common.security.service.impl.RequestCustomServiceImpl
|
||||
com.microservices.common.security.aspect.PreAuthorizeAspect
|
||||
com.microservices.common.security.aspect.InnerAuthAspect
|
||||
com.microservices.common.security.handler.GlobalExceptionHandler
|
|
@ -1,16 +0,0 @@
|
|||
package com.microservices.common.swagger.annotation;
|
||||
|
||||
import com.microservices.common.swagger.config.SwaggerAutoConfiguration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ ElementType.TYPE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Inherited
|
||||
@Import({ SwaggerAutoConfiguration.class })
|
||||
public @interface EnableCustomSwagger2
|
||||
{
|
||||
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
com.microservices.common.swagger.config.SwaggerAutoConfiguration
|
||||
com.microservices.common.swagger.config.SwaggerWebConfiguration
|
||||
com.microservices.common.swagger.config.SwaggerBeanPostProcessor
|
|
@ -1,30 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>com.microservices</groupId>
|
||||
<artifactId>microservices</artifactId>
|
||||
<version>3.6.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<modules>
|
||||
<module>microservices-common-async</module>
|
||||
<module>microservices-common-log</module>
|
||||
<module>microservices-common-core</module>
|
||||
<module>microservices-common-redis</module>
|
||||
<module>microservices-common-swagger</module>
|
||||
<module>microservices-common-security</module>
|
||||
<module>microservices-common-datascope</module>
|
||||
<module>microservices-common-datasource</module>
|
||||
<module>microservices-common-httpClient</module>
|
||||
</modules>
|
||||
|
||||
<artifactId>microservices-common</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<description>
|
||||
microservices-common通用模块
|
||||
</description>
|
||||
|
||||
</project>
|
|
@ -1,20 +0,0 @@
|
|||
package com.microservices.gateway;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
|
||||
/**
|
||||
* 网关启动程序
|
||||
*
|
||||
* @author microservices
|
||||
*/
|
||||
@EnableFeignClients(basePackages = "com.microservices")
|
||||
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
|
||||
public class MicroservicesGatewayApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(com.microservices.gateway.MicroservicesGatewayApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 微服务网关启动成功 ლ(´ڡ`ლ)゙ \n");
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue