Compare commits

...

No commits in common. "master_dyf" and "master" have entirely different histories.

461 changed files with 2097 additions and 4410 deletions

View File

@ -1,26 +1,26 @@
## 系统模块
~~~
com.etl
├── etl-ui // 前端框架 [80]
├── etl-gateway // 网关模块 [8080]
├── etl-auth // 认证中心 [9200]
├── etl-common // 通用模块
│ └── etl-common-core // 核心模块
│ └── etl-common-datascope // 权限范围
│ └── etl-common-datasource // 多数据源
│ └── etl-common-log // 日志记录
│ └── etl-common-redis // 缓存服务
│ └── etl-common-seata // 分布式事务
│ └── etl-common-security // 安全模块
│ └── etl-common-swagger // 系统接口
│ └── etl-common-system // 系统基础
├── etl-modules // 业务模块
│ └── etl-system // 系统模块 [9201]
│ └── etl-gen // 代码生成 [9202]
│ └── etl-job // 定时任务 [9203]
│ └── etl-file // 文件服务 [9300]
├── etl-visual // 图形化管理模块
│ └── etl-visual-monitor // 监控中心 [9100]
com.muyu
├── muyu-ui // 前端框架 [80]
├── muyu-gateway // 网关模块 [8080]
├── muyu-auth // 认证中心 [9200]
├── muyu-common // 通用模块
│ └── muyu-common-core // 核心模块
│ └── muyu-common-datascope // 权限范围
│ └── muyu-common-datasource // 多数据源
│ └── muyu-common-log // 日志记录
│ └── muyu-common-redis // 缓存服务
│ └── muyu-common-seata // 分布式事务
│ └── muyu-common-security // 安全模块
│ └── muyu-common-swagger // 系统接口
│ └── muyu-common-system // 系统基础
├── muyu-modules // 业务模块
│ └── muyu-system // 系统模块 [9201]
│ └── muyu-gen // 代码生成 [9202]
│ └── muyu-job // 定时任务 [9203]
│ └── muyu-file // 文件服务 [9300]
├── muyu-visual // 图形化管理模块
│ └── muyu-visual-monitor // 监控中心 [9100]
├──pom.xml // 公共依赖
~~~

View File

@ -4,11 +4,11 @@ echo [<5B><>Ϣ] ʹ<><CAB9>Jar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Auth<74><68><EFBFBD>̡<EFBFBD>
echo.
cd %~dp0
cd ../etl-auth/target
cd ../muyu-auth/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar etl-auth.jar
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar muyu-auth.jar
cd bin
pause

View File

@ -4,11 +4,11 @@ echo [<5B><>Ϣ] ʹ<><CAB9>Jar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Gateway<61><79><EFBFBD>̡<EFBFBD>
echo.
cd %~dp0
cd ../etl-gateway/target
cd ../muyu-gateway/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar etl-gateway.jar
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar muyu-gateway.jar
cd bin
pause

View File

@ -4,11 +4,11 @@ echo [<5B><>Ϣ] ʹ<><CAB9>Jar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Modules-File<6C><65><EFBFBD>̡<EFBFBD>
echo.
cd %~dp0
cd ../etl-modules/etl-file/target
cd ../muyu-modules/muyu-file/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar etl-modules-file.jar
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar muyu-modules-file.jar
cd bin
pause

View File

@ -4,11 +4,11 @@ echo [<5B><>Ϣ] ʹ<><CAB9>Jar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Modules-Gen<65><6E><EFBFBD>̡<EFBFBD>
echo.
cd %~dp0
cd ../etl-modules/etl-gen/target
cd ../muyu-modules/muyu-gen/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar etl-modules-gen.jar
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar muyu-modules-gen.jar
cd bin
pause

View File

@ -4,11 +4,11 @@ echo [<5B><>Ϣ] ʹ<><CAB9>Jar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Modules-Job<6F><62><EFBFBD>̡<EFBFBD>
echo.
cd %~dp0
cd ../etl-modules/etl-job/target
cd ../muyu-modules/muyu-job/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar etl-modules-job.jar
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar muyu-modules-job.jar
cd bin
pause

View File

@ -4,11 +4,11 @@ echo [<5B><>Ϣ] ʹ<><CAB9>Jar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Modules-System<65><6D><EFBFBD>̡<EFBFBD>
echo.
cd %~dp0
cd ../etl-modules/etl-system/target
cd ../muyu-modules/muyu-system/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar etl-modules-system.jar
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar muyu-modules-system.jar
cd bin
pause

View File

@ -4,11 +4,11 @@ echo [<5B><>Ϣ] ʹ<><CAB9>Jar<61><72><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Monitor<6F><72><EFBFBD>̡<EFBFBD>
echo.
cd %~dp0
cd ../etl-visual/etl-monitor/target
cd ../muyu-visual/muyu-monitor/target
set JAVA_OPTS=-Xms512m -Xmx1024m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=512m
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar etl-visual-monitor.jar
java -Dfile.encoding=utf-8 %JAVA_OPTS% -jar muyu-visual-monitor.jar
cd bin
pause

View File

@ -14,28 +14,28 @@ cp ../sql/ry_config_20220929.sql ./mysql/db
# copy html
echo "begin copy html "
cp -r ../etl-ui/dist/** ./nginx/html/dist
cp -r ../muyu-ui/dist/** ./nginx/html/dist
# copy jar
echo "begin copy etl-gateway "
cp ../etl-gateway/target/etl-gateway.jar ./etl/gateway/jar
echo "begin copy muyu-gateway "
cp ../muyu-gateway/target/muyu-gateway.jar ./muyu/gateway/jar
echo "begin copy etl-auth "
cp ../etl-auth/target/etl-auth.jar ./etl/auth/jar
echo "begin copy muyu-auth "
cp ../muyu-auth/target/muyu-auth.jar ./muyu/auth/jar
echo "begin copy etl-visual "
cp ../etl-visual/etl-monitor/target/etl-visual-monitor.jar ./etl/visual/monitor/jar
echo "begin copy muyu-visual "
cp ../muyu-visual/muyu-monitor/target/muyu-visual-monitor.jar ./muyu/visual/monitor/jar
echo "begin copy etl-modules-system "
cp ../etl-modules/etl-system/target/etl-modules-system.jar ./etl/modules/system/jar
echo "begin copy muyu-modules-system "
cp ../muyu-modules/muyu-system/target/muyu-modules-system.jar ./muyu/modules/system/jar
echo "begin copy etl-modules-file "
cp ../etl-modules/etl-file/target/etl-modules-file.jar ./etl/modules/file/jar
echo "begin copy muyu-modules-file "
cp ../muyu-modules/muyu-file/target/muyu-modules-file.jar ./muyu/modules/file/jar
echo "begin copy etl-modules-job "
cp ../etl-modules/etl-job/target/etl-modules-job.jar ./etl/modules/job/jar
echo "begin copy muyu-modules-job "
cp ../muyu-modules/muyu-job/target/muyu-modules-job.jar ./muyu/modules/job/jar
echo "begin copy etl-modules-gen "
cp ../etl-modules/etl-gen/target/etl-modules-gen.jar ./etl/modules/gen/jar
echo "begin copy muyu-modules-gen "
cp ../muyu-modules/muyu-gen/target/muyu-modules-gen.jar ./muyu/modules/gen/jar

View File

@ -26,12 +26,12 @@ port(){
# 启动基础环境(必须)
base(){
docker-compose up -d etl-mysql etl-redis etl-nacos
docker-compose up -d muyu-mysql muyu-redis muyu-nacos
}
# 启动程序模块(必须)
modules(){
docker-compose up -d etl-nginx etl-gateway etl-auth etl-modules-system
docker-compose up -d muyu-nginx muyu-gateway muyu-auth muyu-modules-system
}
# 关闭所有环境/模块

View File

@ -1,7 +1,7 @@
version : '3.8'
services:
etl-nacos:
container_name: etl-nacos
muyu-nacos:
container_name: muyu-nacos
image: nacos/nacos-server
build:
context: ./nacos
@ -15,9 +15,9 @@ services:
- "9848:9848"
- "9849:9849"
depends_on:
- etl-mysql
etl-mysql:
container_name: etl-mysql
- muyu-mysql
muyu-mysql:
container_name: muyu-mysql
image: mysql:5.7
build:
context: ./mysql
@ -38,103 +38,103 @@ services:
environment:
MYSQL_DATABASE: 'ry-cloud'
MYSQL_ROOT_PASSWORD: password
etl-redis:
container_name: etl-redis
muyu-redis:
container_name: muyu-redis
image: redis
build:
context: ./redis
ports:
- "6379:6379"
volumes:
- ./redis/conf/redis.conf:/home/etl/redis/redis.conf
- ./redis/conf/redis.conf:/home/muyu/redis/redis.conf
- ./redis/data:/data
command: redis-server /home/etl/redis/redis.conf
etl-nginx:
container_name: etl-nginx
command: redis-server /home/muyu/redis/redis.conf
muyu-nginx:
container_name: muyu-nginx
image: nginx
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./nginx/html/dist:/home/etl/projects/etl-ui
- ./nginx/html/dist:/home/muyu/projects/muyu-ui
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/logs:/var/log/nginx
- ./nginx/conf.d:/etc/nginx/conf.d
depends_on:
- etl-gateway
- muyu-gateway
links:
- etl-gateway
etl-gateway:
container_name: etl-gateway
- muyu-gateway
muyu-gateway:
container_name: muyu-gateway
build:
context: ./etl/gateway
context: ./muyu/gateway
dockerfile: dockerfile
ports:
- "8080:8080"
depends_on:
- etl-redis
- muyu-redis
links:
- etl-redis
etl-auth:
container_name: etl-auth
- muyu-redis
muyu-auth:
container_name: muyu-auth
build:
context: ./etl/auth
context: ./muyu/auth
dockerfile: dockerfile
ports:
- "9200:9200"
depends_on:
- etl-redis
- muyu-redis
links:
- etl-redis
etl-modules-system:
container_name: etl-modules-system
- muyu-redis
muyu-modules-system:
container_name: muyu-modules-system
build:
context: ./etl/modules/system
context: ./muyu/modules/system
dockerfile: dockerfile
ports:
- "9201:9201"
depends_on:
- etl-redis
- etl-mysql
- muyu-redis
- muyu-mysql
links:
- etl-redis
- etl-mysql
etl-modules-gen:
container_name: etl-modules-gen
- muyu-redis
- muyu-mysql
muyu-modules-gen:
container_name: muyu-modules-gen
build:
context: ./etl/modules/gen
context: ./muyu/modules/gen
dockerfile: dockerfile
ports:
- "9202:9202"
depends_on:
- etl-mysql
- muyu-mysql
links:
- etl-mysql
etl-modules-job:
container_name: etl-modules-job
- muyu-mysql
muyu-modules-job:
container_name: muyu-modules-job
build:
context: ./etl/modules/job
context: ./muyu/modules/job
dockerfile: dockerfile
ports:
- "9203:9203"
depends_on:
- etl-mysql
- muyu-mysql
links:
- etl-mysql
etl-modules-file:
container_name: etl-modules-file
- muyu-mysql
muyu-modules-file:
container_name: muyu-modules-file
build:
context: ./etl/modules/file
context: ./muyu/modules/file
dockerfile: dockerfile
ports:
- "9300:9300"
volumes:
- ./etl/uploadPath:/home/etl/uploadPath
etl-visual-monitor:
container_name: etl-visual-monitor
- ./muyu/uploadPath:/home/muyu/uploadPath
muyu-visual-monitor:
container_name: muyu-visual-monitor
build:
context: ./etl/visual/monitor
context: ./muyu/visual/monitor
dockerfile: dockerfile
ports:
- "9100:9100"

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER etl
# 挂载目录
VOLUME /home/etl
# 创建目录
RUN mkdir -p /home/etl
# 指定路径
WORKDIR /home/etl
# 复制jar文件到路径
COPY ./jar/etl-auth.jar /home/etl/etl-auth.jar
# 启动认证服务
ENTRYPOINT ["java","-jar","etl-auth.jar"]

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER etl
# 挂载目录
VOLUME /home/etl
# 创建目录
RUN mkdir -p /home/etl
# 指定路径
WORKDIR /home/etl
# 复制jar文件到路径
COPY ./jar/etl-gateway.jar /home/etl/etl-gateway.jar
# 启动网关服务
ENTRYPOINT ["java","-jar","etl-gateway.jar"]

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER etl
# 挂载目录
VOLUME /home/etl
# 创建目录
RUN mkdir -p /home/etl
# 指定路径
WORKDIR /home/etl
# 复制jar文件到路径
COPY ./jar/etl-modules-file.jar /home/etl/etl-modules-file.jar
# 启动文件服务
ENTRYPOINT ["java","-jar","etl-modules-file.jar"]

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER etl
# 挂载目录
VOLUME /home/etl
# 创建目录
RUN mkdir -p /home/etl
# 指定路径
WORKDIR /home/etl
# 复制jar文件到路径
COPY ./jar/etl-modules-gen.jar /home/etl/etl-modules-gen.jar
# 启动代码生成服务
ENTRYPOINT ["java","-jar","etl-modules-gen.jar"]

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER etl
# 挂载目录
VOLUME /home/etl
# 创建目录
RUN mkdir -p /home/etl
# 指定路径
WORKDIR /home/etl
# 复制jar文件到路径
COPY ./jar/etl-modules-job.jar /home/etl/etl-modules-job.jar
# 启动定时任务服务
ENTRYPOINT ["java","-jar","etl-modules-job.jar"]

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER etl
# 挂载目录
VOLUME /home/etl
# 创建目录
RUN mkdir -p /home/etl
# 指定路径
WORKDIR /home/etl
# 复制jar文件到路径
COPY ./jar/etl-modules-system.jar /home/etl/etl-modules-system.jar
# 启动系统服务
ENTRYPOINT ["java","-jar","etl-modules-system.jar"]

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER etl
# 挂载目录
VOLUME /home/etl
# 创建目录
RUN mkdir -p /home/etl
# 指定路径
WORKDIR /home/etl
# 复制jar文件到路径
COPY ./jar/etl-visual-monitor.jar /home/etl/etl-visual-monitor.jar
# 启动系统服务
ENTRYPOINT ["java","-jar","etl-visual-monitor.jar"]

View File

@ -0,0 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER muyu
# 挂载目录
VOLUME /home/muyu
# 创建目录
RUN mkdir -p /home/muyu
# 指定路径
WORKDIR /home/muyu
# 复制jar文件到路径
COPY ./jar/muyu-auth.jar /home/muyu/muyu-auth.jar
# 启动认证服务
ENTRYPOINT ["java","-jar","muyu-auth.jar"]

View File

@ -0,0 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER muyu
# 挂载目录
VOLUME /home/muyu
# 创建目录
RUN mkdir -p /home/muyu
# 指定路径
WORKDIR /home/muyu
# 复制jar文件到路径
COPY ./jar/muyu-gateway.jar /home/muyu/muyu-gateway.jar
# 启动网关服务
ENTRYPOINT ["java","-jar","muyu-gateway.jar"]

View File

@ -0,0 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER muyu
# 挂载目录
VOLUME /home/muyu
# 创建目录
RUN mkdir -p /home/muyu
# 指定路径
WORKDIR /home/muyu
# 复制jar文件到路径
COPY ./jar/muyu-modules-file.jar /home/muyu/muyu-modules-file.jar
# 启动文件服务
ENTRYPOINT ["java","-jar","muyu-modules-file.jar"]

View File

@ -0,0 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER muyu
# 挂载目录
VOLUME /home/muyu
# 创建目录
RUN mkdir -p /home/muyu
# 指定路径
WORKDIR /home/muyu
# 复制jar文件到路径
COPY ./jar/muyu-modules-gen.jar /home/muyu/muyu-modules-gen.jar
# 启动代码生成服务
ENTRYPOINT ["java","-jar","muyu-modules-gen.jar"]

View File

@ -0,0 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER muyu
# 挂载目录
VOLUME /home/muyu
# 创建目录
RUN mkdir -p /home/muyu
# 指定路径
WORKDIR /home/muyu
# 复制jar文件到路径
COPY ./jar/muyu-modules-job.jar /home/muyu/muyu-modules-job.jar
# 启动定时任务服务
ENTRYPOINT ["java","-jar","muyu-modules-job.jar"]

View File

@ -0,0 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER muyu
# 挂载目录
VOLUME /home/muyu
# 创建目录
RUN mkdir -p /home/muyu
# 指定路径
WORKDIR /home/muyu
# 复制jar文件到路径
COPY ./jar/muyu-modules-system.jar /home/muyu/muyu-modules-system.jar
# 启动系统服务
ENTRYPOINT ["java","-jar","muyu-modules-system.jar"]

View File

@ -0,0 +1,15 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER muyu
# 挂载目录
VOLUME /home/muyu
# 创建目录
RUN mkdir -p /home/muyu
# 指定路径
WORKDIR /home/muyu
# 复制jar文件到路径
COPY ./jar/muyu-visual-monitor.jar /home/muyu/muyu-visual-monitor.jar
# 启动系统服务
ENTRYPOINT ["java","-jar","muyu-visual-monitor.jar"]

View File

@ -1,7 +1,7 @@
# 基础镜像
FROM mysql:5.7
# author
MAINTAINER etl
MAINTAINER muyu
# 执行sql脚本
ADD ./db/*.sql /docker-entrypoint-initdb.d/

View File

@ -1,6 +1,6 @@
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://etl-mysql:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.url.0=jdbc:mysql://muyu-mysql:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=password
@ -16,7 +16,7 @@ management.metrics.export.influx.enabled=false
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
server.tomcat.basedir=/home/etl/nacos/tomcat/logs
server.tomcat.basedir=/home/muyu/nacos/tomcat/logs
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**

View File

@ -1,7 +1,7 @@
# 基础镜像
FROM nacos/nacos-server
# author
MAINTAINER etl
MAINTAINER muyu
# 复制conf文件到路径
COPY ./conf/application.properties /home/nacos/conf/application.properties

View File

@ -15,7 +15,7 @@ http {
server_name localhost;
location / {
root /home/etl/projects/etl-ui;
root /home/muyu/projects/muyu-ui;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
@ -25,7 +25,7 @@ http {
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://etl-gateway:8080/;
proxy_pass http://muyu-gateway:8080/;
}
# 避免actuator暴露

View File

@ -1,15 +1,15 @@
# 基础镜像
FROM nginx
# author
MAINTAINER etl
MAINTAINER muyu
# 挂载目录
VOLUME /home/etl/projects/etl-ui
VOLUME /home/muyu/projects/muyu-ui
# 创建目录
RUN mkdir -p /home/etl/projects/etl-ui
RUN mkdir -p /home/muyu/projects/muyu-ui
# 指定路径
WORKDIR /home/etl/projects/etl-ui
WORKDIR /home/muyu/projects/muyu-ui
# 复制conf文件到路径
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
# 复制html文件到路径
COPY ./html/dist /home/etl/projects/etl-ui
COPY ./html/dist /home/muyu/projects/muyu-ui

View File

@ -1,13 +1,13 @@
# 基础镜像
FROM redis
# author
MAINTAINER etl
MAINTAINER muyu
# 挂载目录
VOLUME /home/etl/redis
VOLUME /home/muyu/redis
# 创建目录
RUN mkdir -p /home/etl/redis
RUN mkdir -p /home/muyu/redis
# 指定路径
WORKDIR /home/etl/redis
WORKDIR /home/muyu/redis
# 复制conf文件到路径
COPY ./conf/redis.conf /home/etl/redis/redis.conf
COPY ./conf/redis.conf /home/muyu/redis/redis.conf

View File

@ -1,23 +0,0 @@
package com.etl.common.core.constant;
/**
*
*
* @author etl
*/
public class ServiceNameConstants {
/**
* serviceid
*/
public static final String AUTH_SERVICE = "etl-auth";
/**
* serviceid
*/
public static final String SYSTEM_SERVICE = "etl-system";
/**
* serviceid
*/
public static final String FILE_SERVICE = "etl-file";
}

View File

@ -1,2 +0,0 @@
com.etl.common.log.service.AsyncLogService
com.etl.common.log.aspect.LogAspect

View File

@ -1,2 +0,0 @@
com.etl.common.redis.configure.RedisConfig
com.etl.common.redis.service.RedisService

View File

@ -1,5 +0,0 @@
com.etl.common.security.config.WebMvcConfig
com.etl.common.security.service.TokenService
com.etl.common.security.aspect.PreAuthorizeAspect
com.etl.common.security.aspect.InnerAuthAspect
com.etl.common.security.handler.GlobalExceptionHandler

View File

@ -1,3 +0,0 @@
# com.etl.common.swagger.config.SwaggerAutoConfiguration
# com.etl.common.swagger.config.SwaggerWebConfiguration
# com.etl.common.swagger.config.SwaggerBeanPostProcessor

View File

@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.etl</groupId>
<artifactId>etl-common</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>etl-common-system</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- ETL Common Core-->
<dependency>
<groupId>com.etl</groupId>
<artifactId>etl-common-core</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,3 +0,0 @@
com.etl.common.system.remote.factory.RemoteUserFallbackFactory
com.etl.common.system.remote.factory.RemoteLogFallbackFactory
com.etl.common.system.remote.factory.RemoteFileFallbackFactory

View File

@ -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.etl</groupId>
<artifactId>etl-cloud</artifactId>
<version>3.6.3</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<modules>
<module>etl-common-log</module>
<module>etl-common-core</module>
<module>etl-common-redis</module>
<module>etl-common-seata</module>
<module>etl-common-swagger</module>
<module>etl-common-security</module>
<module>etl-common-datascope</module>
<module>etl-common-datasource</module>
<module>etl-common-system</module>
</modules>
<artifactId>etl-common</artifactId>
<packaging>pom</packaging>
<description>
etl-common通用模块
</description>
</project>

View File

@ -1,87 +0,0 @@
package com.etl.data.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.etl.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName AssetsModel
* @Description
* @Author YunFei.Du
* @Date 2024/4/22 10:07
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("assets_model")
public class AssetsModel extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* id
*/
private Long dataTableId;
/**
*
*/
private String fieldsName;
/**
*
*/
private String fieldsAnnotation;
/**
*
*/
private Integer isPrimary;
/**
*
*/
private String baseType;
/**
* java
*/
private String javaType;
/**
*
*/
private Integer fieldsLength;
/**
*
*/
private Integer decimalPlace;
/**
*
*/
private Integer isEmpty;
/**
*
*/
private String defaultValue;
/**
*
*/
private String isDictionary;
/**
* id
*/
private String dictionaryId;
/**
*
*/
private String dictionaryName;
private String tableName;
}

View File

@ -1,91 +0,0 @@
package com.etl.data.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.etl.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName DataSource
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:36
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("data_source")
public class DataSource extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId( type = IdType.AUTO)
private Long id;
/**
*
*/
private String name;
/**
*
*/
private String fromSystem;
private Long typeId;
/**
* ip
*/
private String dataSourceIp;
/**
*
*/
private String dataSourcePort;
/**
*
*/
private String dataSourceDatabaseName;
/**
*
*/
private String dataSourceUsername;
/**
*
*/
private String dataSourcePassword;
/**
*
*/
private String additionalConfiguration;
/**
*
*/
private String status;
/**
*
*/
private Integer initialNumberOfConnections;
/**
*
*/
private Integer maximumNumberOfConnections;
/**
*
*/
private Integer maximumWaitingTime;
/**
*
*/
private Integer maximumWaitingTimes;
/**
*
*/
private Integer isSync;
private Integer tableCount;
private Integer dataModelCount;
}

View File

@ -1,49 +0,0 @@
package com.etl.data.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.etl.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName DataTable
* @Description
* @Author YunFei.Du
* @Date 2024/4/22 10:01
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("data_table")
public class DataTable extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* id
*/
@TableId(type = IdType.AUTO)
private Long id;
/**
* id
*/
private Long dataSourceId;
/**
*
*/
private String tableName;
/**
*
*/
private Integer recordCount;
/**
*
*/
private String tableAnnotation;
}

View File

@ -1,30 +0,0 @@
package com.etl.data.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.etl.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName DataType
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:34
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("data_type")
public class DataType extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId( type = IdType.AUTO)
private Long id;
private String dataType;
}

View File

@ -1,47 +0,0 @@
package com.etl.data.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.etl.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
*
* @author YunFei.Du
* @date 21:27 2024/4/25
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("dictionary")
public class Dictionary extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId( type = IdType.AUTO)
private Long id;
/**
* id
*/
private Long dataSourceId;
/**
*
*/
private String dictionaryName;
/**
*
*/
private String dictionaryValue;
}

View File

@ -1,43 +0,0 @@
package com.etl.data.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.etl.common.core.web.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
* @author YunFei.Du
* @date 21:27 2024/4/25
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("dictionary_info")
public class DictionaryInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
@TableId( type = IdType.AUTO)
private Long id;
/**
* id
*/
private Long dictionaryId;
/**
*
*/
private String label;
/**
*
*/
private String value;
}

View File

@ -1,40 +0,0 @@
package com.etl.data.domain.decoration;
import com.etl.data.domain.DataSource;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
*
* @author YunFei.Du
* @date 17:09 2024/4/25
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class DataSourceDecoration {
/**
*
*/
private DataSource dataSource;
/**
*
*/
private List<DataTableDecoration> dataTableList;
/**
*
*/
private String type;
public static DataSourceDecoration dataSourceBuild(DataSource dataSource, List<DataTableDecoration> dataTables){
return DataSourceDecoration.builder()
.dataSource(dataSource)
.type("dataSource")
.dataTableList(dataTables)
.build();
}
}

View File

@ -1,33 +0,0 @@
package com.etl.data.domain.decoration;
import com.etl.data.domain.DataTable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
*
* @author YunFei.Du
* @date 17:09 2024/4/25
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class DataTableDecoration {
/**
*
*/
private DataTable dataTable;
/**
*
*/
private String type;
public static DataTableDecoration dataSourceBuild(DataTable dataTable){
return DataTableDecoration.builder()
.dataTable(dataTable)
.type("dataTable")
.build();
}
}

View File

@ -1,31 +0,0 @@
package com.etl.data.domain.model;
import com.etl.data.domain.DataSource;
import com.etl.data.domain.DataTable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
*
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class DataSourceInfo {
/**
*
*/
private DataSource dataSource;
/**
*
*/
private List<DataTable> dataTableList;
}

View File

@ -1,22 +0,0 @@
package com.etl.data.domain.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName DataTest
* @Description
* @Author YunFei.Du
* @Date 2024/4/19 20:48
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class NameAndType {
private String name;
private String type;
}

View File

@ -1,20 +0,0 @@
package com.etl.data.domain.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName Structure
* @Description
* @Author YunFei.Du
* @Date 2024/4/21 19:28
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class Structure {
private Integer id;
}

View File

@ -1,36 +0,0 @@
package com.etl.data.domain.model;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName TableInfo
* @Description
* @Author YunFei.Du
* @Date 2024/4/21 19:33
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class TableInfo {
/**
*
*/
private Long tableId;
/**
*
*/
private String tableName;
/**
*
*/
private Long dataCount;
/**
*
*/
private String dataAnnotation;
private String type;
}

View File

@ -1,25 +0,0 @@
package com.etl.data.domain.req;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName DataSourceQueryReq
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 13:20
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class DataSourceQueryReq {
/**
*
*/
private String fromSystem;
private String name;
private String dataSourceDatabaseName;
}

View File

@ -1,27 +0,0 @@
package com.etl.data.domain.req;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName QueryTableReq
* @Description
* @Author YunFei.Du
* @Date 2024/4/21 11:58
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class QueryTableReq {
private Long typeId;
private String dataSourceIp;
private String dataSourcePort;
private String dataSourceDatabaseName;
private String dataSourceUsername;
private String dataSourcePassword;
private String additionalConfiguration;
private String tableName;
}

View File

@ -1,37 +0,0 @@
package com.etl.data.domain.req;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName TableStructureQueryReq
* @Description
* @Author YunFei.Du
* @Date 2024/4/21 22:22
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class TableStructureQueryReq {
private Long id;
private Long typeId;
private String dataType;
private String dataSourceIp;
private String dataSourcePort;
private String dataSourceDatabaseName;
private String dataSourceUsername;
private String dataSourcePassword;
private String additionalConfiguration;
private String status;
private Integer initialNumberOfConnections;
private Integer maximumNumberOfConnections;
private Integer maximumWaitingTime;
private Integer maximumWaitingTimes;
private String name;
private String fromSystem;
private String remark;
private String tableName;
}

View File

@ -1,42 +0,0 @@
package com.etl.data.domain.resp;
import com.etl.data.domain.AssetsModel;
import com.etl.data.domain.DataTable;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* @ClassName AssetsModelResp
* @Description
* @Author YunFei.Du
* @Date 2024/4/23 20:38
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class AssetsModelResp {
/**
*
*/
private DataTable dataTable;
private List<AssetsModel> assetsModelList;
/**
*
*
* @param dTable
* @param assetsModels
* @return
*/
public static AssetsModelResp dataTableAndAssetsModelBuild(DataTable dTable,List<AssetsModel> assetsModels){
return AssetsModelResp.builder()
.dataTable(dTable)
.assetsModelList(assetsModels)
.build();
}
}

View File

@ -1,160 +0,0 @@
package com.etl.data.domain.resp;
import com.etl.data.domain.DataSource;
import com.etl.data.domain.DataType;
import com.etl.data.domain.req.TableStructureQueryReq;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* @ClassName DataSourceResp
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:42
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class DataSourceResp {
/**
*
*/
private Long id;
/**
*
*/
private String name;
/**
*
*/
private String fromSystem;
/**
* id
*/
private Long typeId;
/**
*
*/
private String dataType;
/**
*ip
*/
private String dataSourceIp;
/**
*
*/
private String dataSourcePort;
/**
*
*/
private String dataSourceDatabaseName;
/**
* ip
*/
private String dataSourceUsername;
/**
*
*/
private String dataSourcePassword;
/**
*
*/
private String additionalConfiguration;
/**
*
*/
private String status;
/**
*
*/
private Integer initialNumberOfConnections;
/**
*
*/
private Integer maximumNumberOfConnections;
/**
*
*/
private Integer maximumWaitingTime;
/**
*
*/
private Integer maximumWaitingTimes;
/**
*
*/
private String remark;
/**
*
*/
private Integer isSync;
/**
*
*/
private List<DataSpliceParam> dataSpliceParamList;
/**
*
* @param dataSpliceParams
* @param dataSource
* @param dataType
* @return
*/
public static DataSourceResp buildDataSourceResp(List<DataSpliceParam> dataSpliceParams, DataSource dataSource, DataType dataType){
return DataSourceResp.builder()
.id(dataSource.getId())
.typeId(dataType.getId())
.dataType(dataType.getDataType())
.dataSourceIp(dataSource.getDataSourceIp())
.dataSourcePort(dataSource.getDataSourcePort())
.dataSourceDatabaseName(dataSource.getDataSourceDatabaseName())
.dataSourceUsername(dataSource.getDataSourceUsername())
.dataSourcePassword(dataSource.getDataSourcePassword())
.additionalConfiguration(dataSource.getAdditionalConfiguration())
.status(dataSource.getStatus())
.initialNumberOfConnections(dataSource.getInitialNumberOfConnections())
.maximumNumberOfConnections(dataSource.getMaximumNumberOfConnections())
.maximumWaitingTime(dataSource.getMaximumWaitingTime())
.maximumWaitingTimes(dataSource.getMaximumWaitingTimes())
.dataSpliceParamList(dataSpliceParams)
.name(dataSource.getName())
.fromSystem(dataSource.getFromSystem())
.remark(dataSource.getRemark())
.isSync(dataSource.getIsSync())
.build();
}
/**
*
* @param dataSource
* @return
*/
public static DataSourceResp tableStructureQueryReqBuild(TableStructureQueryReq dataSource){
return DataSourceResp.builder()
.id(dataSource.getId())
.typeId(dataSource.getTypeId())
.dataType(dataSource.getDataType())
.dataSourceIp(dataSource.getDataSourceIp())
.dataSourcePort(dataSource.getDataSourcePort())
.dataSourceDatabaseName(dataSource.getDataSourceDatabaseName())
.dataSourceUsername(dataSource.getDataSourceUsername())
.dataSourcePassword(dataSource.getDataSourcePassword())
.additionalConfiguration(dataSource.getAdditionalConfiguration())
.status(dataSource.getStatus())
.initialNumberOfConnections(dataSource.getInitialNumberOfConnections())
.maximumNumberOfConnections(dataSource.getMaximumNumberOfConnections())
.maximumWaitingTime(dataSource.getMaximumWaitingTime())
.maximumWaitingTimes(dataSource.getMaximumWaitingTimes())
.dataSpliceParamList(null)
.name(dataSource.getName())
.fromSystem(dataSource.getFromSystem())
.remark(dataSource.getRemark())
.build();
}
}

View File

@ -1,34 +0,0 @@
package com.etl.data.domain.resp;
import com.etl.data.domain.decoration.DataSourceDecoration;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
* @ClassName DataSourceTableResp
* @Description
* @Author YunFei.Du
* @Date 2024/4/21 19:39
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class DataSourceTableResp {
/**
*
*/
private List<DataSourceDecoration> dataSourceDecorationList;
/**
*
*/
private Integer allTableCount;
/**
* ()
*/
private Integer allDataModelCount;
}

View File

@ -1,21 +0,0 @@
package com.etl.data.domain.resp;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
/**
* @ClassName DataSpliceParam
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 12:28
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
public class DataSpliceParam {
private String paramName;
private String paramValue;
}

View File

@ -1,39 +0,0 @@
package com.etl.data.domain.resp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.etl.data.domain.DataTable;
import com.etl.data.domain.Dictionary;
import com.etl.data.domain.DictionaryInfo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import java.util.List;
/**
*
* @author YunFei.Du
* @date 21:33 2024/4/25
*/
@Data
@SuperBuilder
@AllArgsConstructor
@NoArgsConstructor
public class DictionaryInfoResp {
private Dictionary dictionary;
private List< DictionaryInfo > dictionaryInfoList;
public static DictionaryInfoResp dictionaryAndInfoBuild(Dictionary dict, List< DictionaryInfo > dictInfoList){
return DictionaryInfoResp.builder ()
.dictionary(dict)
.dictionaryInfoList(dictInfoList)
.build();
}
}

View File

@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.etl</groupId>
<artifactId>etl-data-source</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>etl-data-source-remote</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -1,128 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.etl</groupId>
<artifactId>etl-data-source</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>etl-data-source-server</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- etl Common DataSource -->
<dependency>
<groupId>com.etl</groupId>
<artifactId>etl-common-datasource</artifactId>
</dependency>
<!-- etl Common DataScope -->
<dependency>
<groupId>com.etl</groupId>
<artifactId>etl-common-datascope</artifactId>
</dependency>
<!-- etl Common Log -->
<dependency>
<groupId>com.etl</groupId>
<artifactId>etl-common-log</artifactId>
</dependency>
<!-- etl Common Swagger -->
<dependency>
<groupId>com.etl</groupId>
<artifactId>etl-common-swagger</artifactId>
</dependency>
<!-- ETL模块 公共依赖 -->
<dependency>
<groupId>com.etl</groupId>
<artifactId>etl-data-source-common</artifactId>
</dependency>
<!-- ETL模块 远程调用 依赖 -->
<dependency>
<groupId>com.etl</groupId>
<artifactId>etl-data-source-remote</artifactId>
</dependency>
<!-- 添加 PostgreSQL JDBC 驱动 -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.5.0</version> <!-- 使用当前最新稳定版本 -->
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- 加入maven deploy插件当在deploy时忽略些model-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,24 +0,0 @@
package com.etl.data;
import com.etl.common.security.annotation.EnableCustomConfig;
import com.etl.common.security.annotation.EnableMyFeignClients;
import com.etl.common.swagger.annotation.EnableCustomSwagger2;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
*
*
* @author YunFei
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableMyFeignClients
@SpringBootApplication
@MapperScan("com.etl.data.mapper")
public class ETLDataSourceApplication {
public static void main (String[] args) {
SpringApplication.run(ETLDataSourceApplication.class, args);
}
}

View File

@ -1,36 +0,0 @@
package com.etl.data.controller;
import com.etl.common.core.domain.Result;
import com.etl.common.core.web.controller.BaseController;
import com.etl.data.domain.resp.AssetsModelResp;
import com.etl.data.service.AssetsModelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
*
* @author YunFei.Du
* @date 21:46 2024/4/25
*/
@RestController
@RequestMapping("/assets")
public class AssetsModelController extends BaseController {
@Autowired
private AssetsModelService assetsModelService;
//查找所有的数据模型
@PostMapping("/getAssetsModelList")
public Result<List<AssetsModelResp>> getAssetsModelListByTableIds(@RequestBody List<Integer> tableIds){
return assetsModelService.getAssetsModelListByTableIds(tableIds);
}
@GetMapping("/getAssetsModelByDataTableId")
public Result<AssetsModelResp> getAssetsModelByDataTableId(@RequestParam Integer id){
return assetsModelService.getAssetsModelByDataTableId(id);
}
}

View File

@ -1,77 +0,0 @@
package com.etl.data.controller;
import com.etl.common.core.domain.Result;
import com.etl.common.core.web.controller.BaseController;
import com.etl.common.security.utils.SecurityUtils;
import com.etl.data.domain.DataSource;
import com.etl.data.domain.req.DataSourceQueryReq;
import com.etl.data.domain.req.TableStructureQueryReq;
import com.etl.data.domain.resp.DataSourceResp;
import com.etl.data.domain.resp.DataSourceTableResp;
import com.etl.data.service.DataSourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.List;
/**
*
* @author YunFei.Du
* @date 21:47 2024/4/25
*/
@RestController
@RequestMapping("/source")
public class DataSourceController extends BaseController {
@Autowired
private DataSourceService dataSourceService;
/**
*
* @param dataSourceQueryReq
* @return
*/
@PostMapping("/list")
public Result getDataSourceList (@RequestBody DataSourceQueryReq dataSourceQueryReq) {
List<DataSourceResp> list = dataSourceService.list(dataSourceQueryReq);
return success(list);
}
@PostMapping("/insertDataSource")
public Result insertDataSource(@RequestBody DataSource dataSource){
if (dataSource.getId() != null){
dataSource.setUpdateBy(SecurityUtils.getUsername());
dataSource.setUpdateTime(new Date());
dataSourceService.updateById(dataSource);
}else {
dataSource.setCreateBy(SecurityUtils.getUsername());
dataSource.setCreateTime(new Date());
dataSourceService.save(dataSource);
}
return success();
}
@PostMapping("/testConnect")
public Boolean testConnect(@RequestBody DataSourceResp dataSourceResp){
return dataSourceService.testConnect(dataSourceResp);
}
@PostMapping("/queryBigStructure")
public Result<DataSourceTableResp> queryStructure(){
return dataSourceService.queryBigStructure();
}
@PostMapping("/queryTableStructure")
public Result queryTableStructure(@RequestBody TableStructureQueryReq tableStructureQueryReq){
return dataSourceService.queryTableStructure(tableStructureQueryReq);
}
//数据同步
@PostMapping("/dataSynchronization")
public Result dataSynchronization(@RequestBody DataSourceResp dataSourceResp){
return dataSourceService.dataSynchronization(dataSourceResp);
}
}

View File

@ -1,33 +0,0 @@
package com.etl.data.controller;
import com.etl.common.core.domain.Result;
import com.etl.common.core.web.controller.BaseController;
import com.etl.data.domain.DataType;
import com.etl.data.service.DataTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
*
* @author YunFei.Du
* @date 21:47 2024/4/25
*/
@RestController
@RequestMapping("/dataType")
public class DataTypeController extends BaseController {
@Autowired
private DataTypeService dataTypeService;
/**
*
*/
@GetMapping("/getAllDataType")
public Result<List<DataType>> getAllDataList(){
List<DataType> list = dataTypeService.list();
return Result.success(list);
}
}

View File

@ -1,49 +0,0 @@
package com.etl.data.controller;
import com.etl.common.core.domain.Result;
import com.etl.data.domain.Dictionary;
import com.etl.data.domain.DictionaryInfo;
import com.etl.data.domain.resp.DictionaryInfoResp;
import com.etl.data.service.DictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @ClassName Dictionary
* @Description
* @Author YunFei.Du
* @Date 2024/4/26 15:41
*/
@RestController
@RequestMapping("dict")
public class DictionaryController {
@Autowired
private DictionaryService dictionaryService;
/**
* id
* @param dataSourceId
* @return
*/
@GetMapping("/getDictionaryByDataSourceId")
public Result<List< DictionaryInfoResp >> getDictionaryByDataSourceId(@RequestParam Integer dataSourceId){
return dictionaryService.getDictionaryByDataSourceId(dataSourceId);
}
/**
*
*/
@PostMapping("insertDictionary")
public Result insertDictionary(@RequestBody Dictionary dictionary){
return dictionaryService.insertDictionary(dictionary);
}
/**
*
*/
@PostMapping("insertDictionarySelect")
public Result insertDictionarySelect(@RequestBody DictionaryInfo dictionaryInfo){
return dictionaryService.insertDictionarySelect(dictionaryInfo);
}
}

View File

@ -1,13 +0,0 @@
package com.etl.data.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etl.data.domain.AssetsModel;
/**
* @ClassName AssetsModelMapper
* @Description
* @Author YunFei.Du
* @Date 2024/4/22 14:37
*/
public interface AssetsModelMapper extends BaseMapper<AssetsModel> {
}

View File

@ -1,13 +0,0 @@
package com.etl.data.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etl.data.domain.DataSource;
/**
* @ClassName DataSourceMapper
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:46
*/
public interface DataSourceMapper extends BaseMapper<DataSource> {
}

View File

@ -1,13 +0,0 @@
package com.etl.data.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etl.data.domain.DataTable;
/**
* @ClassName DataTableMapper
* @Description
* @Author YunFei.Du
* @Date 2024/4/22 14:35
*/
public interface DataTableMapper extends BaseMapper<DataTable> {
}

View File

@ -1,13 +0,0 @@
package com.etl.data.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etl.data.domain.DataType;
/**
* @ClassName DataSourceMapper
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:46
*/
public interface DataTypeMapper extends BaseMapper<DataType> {
}

View File

@ -1,14 +0,0 @@
package com.etl.data.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etl.data.domain.DictionaryInfo;
/**
* @ClassName DataSourceMapper
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:46
*/
public interface DictionaryInfoMapper extends BaseMapper< DictionaryInfo > {
}

View File

@ -1,15 +0,0 @@
package com.etl.data.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.etl.data.domain.Dictionary;
/**
* @ClassName DataSourceMapper
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:46
*/
public interface DictionaryMapper extends BaseMapper< Dictionary > {
}

View File

@ -1,22 +0,0 @@
package com.etl.data.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.etl.common.core.domain.Result;
import com.etl.data.domain.AssetsModel;
import com.etl.data.domain.resp.AssetsModelResp;
import java.util.List;
/**
* @ClassName AssetsModelService
* @Description
* @Author YunFei.Du
* @Date 2024/4/22 14:39
*/
public interface AssetsModelService extends IService<AssetsModel> {
Result<List<AssetsModelResp>> getAssetsModelListByTableIds(List<Integer> tableIds);
Result<AssetsModelResp> getAssetsModelByDataTableId(Integer id);
}

View File

@ -1,31 +0,0 @@
package com.etl.data.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.etl.common.core.domain.Result;
import com.etl.data.domain.DataSource;
import com.etl.data.domain.req.DataSourceQueryReq;
import com.etl.data.domain.req.TableStructureQueryReq;
import com.etl.data.domain.resp.DataSourceResp;
import com.etl.data.domain.resp.DataSourceTableResp;
import java.util.List;
/**
* @ClassName DataMansgerService
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:48
*/
public interface DataSourceService extends IService<DataSource> {
List<DataSourceResp> list(DataSourceQueryReq dataSourceQueryReq);
Boolean testConnect(DataSourceResp dataSourceResp);
Result queryTableStructure(TableStructureQueryReq tableStructureQueryReq);
Result<DataSourceTableResp> queryBigStructure();
Result dataSynchronization(DataSourceResp dataSourceResp);
}

View File

@ -1,13 +0,0 @@
package com.etl.data.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.etl.data.domain.DataTable;
/**
* @ClassName DataTableService
* @Description
* @Author YunFei.Du
* @Date 2024/4/22 14:36
*/
public interface DataTableService extends IService<DataTable> {
}

View File

@ -1,13 +0,0 @@
package com.etl.data.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.etl.data.domain.DataType;
/**
* @ClassName DataMansgerService
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:48
*/
public interface DataTypeService extends IService<DataType> {
}

View File

@ -1,13 +0,0 @@
package com.etl.data.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.etl.data.domain.DictionaryInfo;
/**
* @ClassName DataMansgerService
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:48
*/
public interface DictionaryInfoService extends IService< DictionaryInfo > {
}

View File

@ -1,29 +0,0 @@
package com.etl.data.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.etl.common.core.domain.Result;
import com.etl.data.domain.DataType;
import com.etl.data.domain.Dictionary;
import com.etl.data.domain.DictionaryInfo;
import com.etl.data.domain.resp.DictionaryInfoResp;
import java.util.List;
/**
* @ClassName DataMansgerService
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:48
*/
public interface DictionaryService extends IService< Dictionary > {
Result<List< DictionaryInfoResp >> getDictionaryByDataSourceId(Integer dataSourceId);
/**
*
*/
Result insertDictionary(Dictionary dictionary);
/**
*
*/
Result insertDictionarySelect(DictionaryInfo dictionaryInfo);
}

View File

@ -1,59 +0,0 @@
package com.etl.data.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.etl.common.core.domain.Result;
import com.etl.data.domain.AssetsModel;
import com.etl.data.domain.DataTable;
import com.etl.data.domain.resp.AssetsModelResp;
import com.etl.data.mapper.AssetsModelMapper;
import com.etl.data.service.AssetsModelService;
import com.etl.data.service.DataTableService;
;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName AssetsModelServiceImpl
* @Description
* @Author YunFei.Du
* @Date 2024/4/22 14:39
*/
@Service
public class AssetsModelServiceImpl extends ServiceImpl<AssetsModelMapper, AssetsModel> implements AssetsModelService {
@Autowired
private DataTableService dataTableService;
@Override
public Result<List<AssetsModelResp>> getAssetsModelListByTableIds(List<Integer> tableId) {
ArrayList<AssetsModelResp> assetsModelRespArrayList = new ArrayList<>();
//查询数据表
LambdaQueryWrapper<DataTable> dataTableLambdaQueryWrapper = new LambdaQueryWrapper<>();
dataTableLambdaQueryWrapper.in(DataTable::getId,tableId);
List<DataTable> dataTableList = dataTableService.list(dataTableLambdaQueryWrapper);
//查询所有的数据模型
for (DataTable dataTable : dataTableList) {
LambdaQueryWrapper<AssetsModel> assetsModelLambdaQueryWrapper = new LambdaQueryWrapper<>();
assetsModelLambdaQueryWrapper.eq(AssetsModel::getDataTableId,dataTable.getId());
List<AssetsModel> assetsModelList = this.list(assetsModelLambdaQueryWrapper);
assetsModelRespArrayList.add(AssetsModelResp.dataTableAndAssetsModelBuild(dataTable,assetsModelList));
}
return Result.success(assetsModelRespArrayList);
}
@Override
public Result<AssetsModelResp> getAssetsModelByDataTableId(Integer tableId) {
DataTable dataTable = dataTableService.getById(tableId);
LambdaQueryWrapper<AssetsModel> assetsModelLambdaQueryWrapper = new LambdaQueryWrapper<>();
assetsModelLambdaQueryWrapper.eq(AssetsModel::getDataTableId,dataTable.getId());
List<AssetsModel> assetsModelList = this.list(assetsModelLambdaQueryWrapper);
AssetsModelResp assetsModelResp = AssetsModelResp.dataTableAndAssetsModelBuild(dataTable, assetsModelList);
return Result.success(assetsModelResp);
}
}

View File

@ -1,434 +0,0 @@
package com.etl.data.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.etl.common.core.domain.Result;
import com.etl.common.security.utils.SecurityUtils;
import com.etl.data.domain.AssetsModel;
import com.etl.data.domain.DataSource;
import com.etl.data.domain.DataTable;
import com.etl.data.domain.DataType;
import com.etl.data.domain.decoration.DataSourceDecoration;
import com.etl.data.domain.decoration.DataTableDecoration;
import com.etl.data.domain.req.DataSourceQueryReq;
import com.etl.data.domain.req.TableStructureQueryReq;
import com.etl.data.domain.resp.DataSourceResp;
import com.etl.data.domain.resp.DataSourceTableResp;
import com.etl.data.domain.resp.DataSpliceParam;
import com.etl.data.mapper.DataSourceMapper;
import com.etl.data.service.AssetsModelService;
import com.etl.data.service.DataSourceService;
import com.etl.data.service.DataTableService;
import com.etl.data.service.DataTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.sql.*;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* @ClassName DataSourceServiceImpl
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:49
*/
@Service
public class DataSourceServiceImpl extends ServiceImpl<DataSourceMapper, DataSource> implements DataSourceService {
@Autowired
private DataTypeService dataTypeService;
@Autowired
private DataTableService dataTableService;
@Autowired
private AssetsModelService assetsModelService;
@Override
public List<DataSourceResp> list(DataSourceQueryReq dataSourceQueryReq) {
LambdaQueryWrapper<DataSource> dataSourceLambdaQueryWrapper = new LambdaQueryWrapper<>();
if (dataSourceQueryReq.getFromSystem() != null && !"".equals(dataSourceQueryReq.getFromSystem())) {
dataSourceLambdaQueryWrapper.eq(DataSource::getFromSystem, dataSourceQueryReq.getFromSystem());
}
if (dataSourceQueryReq.getDataSourceDatabaseName() != null && !"".equals(dataSourceQueryReq.getDataSourceDatabaseName())) {
dataSourceLambdaQueryWrapper.eq(DataSource::getDataSourceDatabaseName, dataSourceQueryReq.getDataSourceDatabaseName());
}
if (dataSourceQueryReq.getName() != null && !"".equals(dataSourceQueryReq.getName())) {
dataSourceLambdaQueryWrapper.eq(DataSource::getName, dataSourceQueryReq.getName());
}
List<DataSource> list = this.list(dataSourceLambdaQueryWrapper);
ArrayList<DataSourceResp> dataSourceRespList = new ArrayList<>();
//切割参数数据
for (DataSource dataSource : list) {
//查询数据源类型表
DataType byId = dataTypeService.getById(dataSource.getTypeId());
String additionalConfiguration = dataSource.getAdditionalConfiguration();
String[] split = additionalConfiguration.split("&");
ArrayList<DataSpliceParam> dataSpliceParams = new ArrayList<>();
for (String s : split) {
String[] strings = s.split("=");
DataSpliceParam dataSpliceParam = new DataSpliceParam(strings[0], strings[1]);
dataSpliceParams.add(dataSpliceParam);
}
DataSourceResp dataSourceResp = DataSourceResp.buildDataSourceResp(dataSpliceParams, dataSource, byId);
dataSourceRespList.add(dataSourceResp);
}
return dataSourceRespList;
}
@Override
public Boolean testConnect(DataSourceResp dataSourceResp) {
String dbName = dataSourceResp.getDataSourceDatabaseName(); //数据库名
System.out.println("数据库名:" + dbName);
Integer dbType = Math.toIntExact(dataSourceResp.getTypeId()); //数据库类型 1-mysql,2-oracle,3-postgressql
String dbIp = dataSourceResp.getDataSourceIp(); //数据库地址
String dbPort = dataSourceResp.getDataSourcePort(); //端口
String dbIpPort = dbIp + ":" + dbPort;
String driveClass;
String jdbcUrl;
try {
switch (dbType) {
case 1:
// mysql数据库
driveClass = "com.mysql.cj.jdbc.Driver";
jdbcUrl = "jdbc:mysql://" + dbIpPort + "/" + dbName
+ "?serverTimezone=Asia/Shanghai&serverTimezone=Asia/Shanghai" +
"&useSSL=false&useUnicode=true&characterEncoding=UTF-8";
break;
case 2:
// oracle数据库
driveClass = "oracle.jdbc.OracleDriver";
jdbcUrl = "jdbc:oracle:thin:@" + dbIpPort + ":" + dbName;
break;
default:
// PostgreSQL数据库
driveClass = "org.postgresql.Driver";
jdbcUrl = "jdbc:postgresql://" + dbIpPort + "/" + dbName;
}
boolean b = testDatasource(driveClass, jdbcUrl, dataSourceResp.getDataSourceUsername (), dataSourceResp.getDataSourcePassword ());
System.out.println(b);
if (!b) {
return false;
}
} catch (Exception e) {
return false;
}
return true;
}
public Connection queryStructure(DataSourceResp dataSourceResp, String infoDataBaseName) {
try {
//
String username = dataSourceResp.getDataSourceUsername(); //用户名
String password = dataSourceResp.getDataSourcePassword();//密码
String dbName = infoDataBaseName == null ? dataSourceResp.getDataSourceDatabaseName() : infoDataBaseName; //数据库名
System.out.println("数据库名:" + dbName);
Integer dbType = Math.toIntExact(dataSourceResp.getTypeId()); //数据库类型 1-mysql,2-oracle,3-postgressql
String dbIp = dataSourceResp.getDataSourceIp(); //数据库地址
String dbPort = dataSourceResp.getDataSourcePort(); //端口
String dbIpPort = dbIp + ":" + dbPort;
String driveClass;
String jdbcUrl;
//
driveClass = "com.mysql.cj.jdbc.Driver";
jdbcUrl = "jdbc:mysql://" + dbIpPort + "/" + dbName
+ "?serverTimezone=Asia/Shanghai&serverTimezone=Asia/Shanghai" +
"&useSSL=false&useUnicode=true&characterEncoding=UTF-8";
Class.forName(driveClass);
Connection connection = DriverManager.getConnection(jdbcUrl, username, password);
return connection;
} catch (Exception e) {
return null;
}
}
@Override
public Result queryTableStructure(TableStructureQueryReq tableStructureQueryReq) {
DataSourceResp dataSourceResp = DataSourceResp.tableStructureQueryReqBuild(tableStructureQueryReq);
Connection getAssetsConnection = queryStructure(dataSourceResp, null);
try {
DatabaseMetaData metaData = getAssetsConnection.getMetaData();
System.out.println("要查询的表名:" + tableStructureQueryReq.getTableName());
ResultSet pkInfo = metaData.getPrimaryKeys(tableStructureQueryReq.getDataSourceDatabaseName(), "%", tableStructureQueryReq.getTableName());
System.out.println(pkInfo == null);
while (pkInfo.next()) {
System.out.print("数据库名称:" + pkInfo.getString("TABLE_CAT") + " ");
System.out.print("表名称:" + pkInfo.getString("TABLE_NAME") + " ");
System.out.print("主键列的名称:" + pkInfo.getString("COLUMN_NAME") + " ");
System.out.print("类型:" + pkInfo.getString("PK_NAME") + " ");
System.out.println("");
}
// 获取表的相对应的列的名字
ResultSet tableInfo = metaData.getColumns(tableStructureQueryReq.getDataSourceDatabaseName(), "%", tableStructureQueryReq.getTableName(), "%");
while (tableInfo.next()) {
// 表的名字
System.out.print("表名:" + tableInfo.getString("TABLE_NAME") + " ");
// 列的名称
System.out.print("列名:" + tableInfo.getString("COLUMN_NAME") + " ");
// 默认值
System.out.print("默认值 :" + tableInfo.getString("COLUMN_DEF") + " ");
// 字段的类型
System.out.print("字段的类型:" + tableInfo.getString("TYPE_NAME") + " ");
// 是否可以为空
System.out.print("是否可以为空:" + tableInfo.getString("IS_NULLABLE") + " ");
// 是否为自增
System.out.print("是否为自增:" + tableInfo.getString("IS_AUTOINCREMENT") + " ");
// 字段说明
System.out.print("字段说明:" + tableInfo.getString("REMARKS") + " ");
// 长度(有时候是错的)
System.out.print("长度:" + tableInfo.getString("COLUMN_SIZE") + " ");
System.out.println();
}
} catch (SQLException e) {
throw new RuntimeException(e);
}
return null;
}
@Override
public Result<DataSourceTableResp> queryBigStructure() {
Integer allTableCount = 0;
Integer allDataModelCount = 0;
//创建数据源装饰着对象结合
ArrayList<DataSourceDecoration> dataSourceDecorations = new ArrayList<>();
//获取所有数据源
List<DataSource> dataSourceList = this.list();
for (DataSource dataSource : dataSourceList) {
LambdaQueryWrapper<DataTable> dataTableLambdaQueryWrapper = new LambdaQueryWrapper<>();
dataTableLambdaQueryWrapper.eq(DataTable::getDataSourceId,dataSource.getId());
//数据表装饰对象
ArrayList<DataTableDecoration> dataTableDecorations = new ArrayList<>();
List<DataTable> dataTableList = dataTableService.list(dataTableLambdaQueryWrapper);
for (DataTable dataTable : dataTableList) {
dataTableDecorations.add(DataTableDecoration.dataSourceBuild(dataTable));
}
dataSourceDecorations.add(DataSourceDecoration.dataSourceBuild(dataSource, dataTableDecorations));
allTableCount = dataSource.getTableCount() + allTableCount;
allDataModelCount = dataSource.getDataModelCount() + allDataModelCount;
}
return Result.success(DataSourceTableResp.builder()
.allDataModelCount(allDataModelCount)
.allTableCount(allTableCount)
.dataSourceDecorationList(dataSourceDecorations)
.build());
}
@Override
public Result dataSynchronization(DataSourceResp dataSourceResp) {
if (this.testConnect ( dataSourceResp)==!true){
return Result.error ( "连接失败" );
}
// deleteOldDate(dataSourceResp);
LambdaQueryWrapper< DataTable > dataTableLambdaQueryWrapper1 = new LambdaQueryWrapper<> ( );
dataTableLambdaQueryWrapper1.eq ( DataTable::getDataSourceId,dataSourceResp.getId () );
List< DataTable > list = dataTableService.list ( dataTableLambdaQueryWrapper1 );
list.stream ().map ( DataTable::getId ).toList ();
if (list != null &&list.size ()!=0) {
LambdaQueryWrapper< AssetsModel > assetsModelLambdaQueryWrapper = new LambdaQueryWrapper<> ( );
assetsModelLambdaQueryWrapper.in ( AssetsModel::getDataTableId, list );
}
//获取所有表,根据数据源id'
LambdaQueryWrapper<DataTable> dataTableLambdaQueryWrapper = new LambdaQueryWrapper<>();
dataTableLambdaQueryWrapper.eq(DataTable::getDataSourceId,dataSourceResp.getId());
List<DataTable> dataTableList = dataTableService.list(dataTableLambdaQueryWrapper);
//获取所有的根据此数据源存储的表id
List<Long> dataTableIdList = dataTableList.stream().map(DataTable::getId).toList();
//根据表id获取所有的模型记录
if (dataTableIdList != null && dataTableIdList.size()!=0){
LambdaQueryWrapper<AssetsModel> assetsModelLambdaQueryWrapper = new LambdaQueryWrapper<>();
assetsModelLambdaQueryWrapper.in(AssetsModel::getDataTableId,dataTableIdList);
List<AssetsModel> OldAssetsModelList = assetsModelService.list(assetsModelLambdaQueryWrapper);
//获取所有的数据模型记录
List<Long> assetsModelIdList = OldAssetsModelList.stream().map(AssetsModel::getId).toList();
//删除所有源表
dataTableService.removeBatchByIds(dataTableIdList);
if (assetsModelIdList != null && assetsModelIdList.size() !=0){
//删除所有模型
assetsModelService.removeBatchByIds(assetsModelIdList);
}
}
try {
//链接数据库对象
Connection connectionGetCount = queryStructure(dataSourceResp, null);
ArrayList<DataTable> tableInfos = new ArrayList<>();
Connection connection = queryStructure(dataSourceResp, "information_schema");
String queryTableSql = "select TABLE_NAME as 'tableName',TABLE_COMMENT as 'dataAnnotation' from `TABLES` t where TABLE_SCHEMA = '" + dataSourceResp.getDataSourceDatabaseName() + "'";
PreparedStatement preparedStatement = connection.prepareStatement(queryTableSql);
ResultSet resultSet = preparedStatement.executeQuery();
while (resultSet.next()) {
String tableName = resultSet.getString("tableName");
String dataAnnotation = resultSet.getString("dataAnnotation");
String queryTableDataCount = "SELECT count(1) FROM " + tableName;
PreparedStatement preparedStatementCount = connectionGetCount.prepareStatement(queryTableDataCount);
ResultSet resultSetCount = preparedStatementCount.executeQuery();
while (resultSetCount.next()) {
tableInfos.add(DataTable.builder()
.id(null)
.tableName(tableName)
.dataSourceId(dataSourceResp.getId())
.createBy(SecurityUtils.getUsername())
.createTime(new Date())
.recordCount(resultSetCount.getInt(1))
.tableAnnotation(dataAnnotation)
.build());
}
}
dataTableService.saveBatch(tableInfos);
Connection getAssetsConnection = queryStructure(dataSourceResp, null);
ArrayList<AssetsModel> assetsModelList = new ArrayList<>();
for (DataTable tableInfo : tableInfos) {
DatabaseMetaData metaData = getAssetsConnection.getMetaData();
ResultSet pkInfo = metaData.getPrimaryKeys(dataSourceResp.getDataSourceDatabaseName(), "%", tableInfo.getTableName());
System.out.println(pkInfo == null);
String primaryString = "";
while (pkInfo.next()) {
primaryString = pkInfo.getString("COLUMN_NAME");
}
// 获取表的相对应的列的名字
ResultSet assetsInfo = metaData.getColumns(dataSourceResp.getDataSourceDatabaseName(), "%", tableInfo.getTableName(), "%");
String queryTableDataCount = "SELECT * FROM " + tableInfo.getTableName();
PreparedStatement preparedStatementCount = connectionGetCount.prepareStatement(queryTableDataCount);
ResultSet resultSetCount = preparedStatementCount.executeQuery();
while (assetsInfo.next()) {
// 表的名字
String tableName = assetsInfo.getString("TABLE_NAME");
// 列的名称
String fieldsName = assetsInfo.getString("COLUMN_NAME");
String javaType = "";
for (int i = 0; i < resultSetCount.getMetaData().getColumnCount(); i++) {
String columnName = resultSetCount.getMetaData().getColumnName(i + 1);
if (columnName.equals(fieldsName)){
javaType = resultSetCount.getMetaData().getColumnClassName(i+1).substring ( 10 );
}
}
// 默认值
String defaultValue = assetsInfo.getString("COLUMN_DEF");
// 字段的类型
String baseType = assetsInfo.getString("TYPE_NAME");
// 是否可以为空
Integer isEmpty = null;
if ("YES".equals(assetsInfo.getString("IS_NULLABLE"))) {
isEmpty = 1;
} else {
isEmpty = 0;
}
// 字段注释
String fieldsAnnotation = assetsInfo.getString("REMARKS");
// 长度(有时候是错的)
Integer fieldsLength = Integer.valueOf(assetsInfo.getString("COLUMN_SIZE"));
//小数位
Integer decimalPlace = assetsInfo.getInt("DECIMAL_DIGITS");
//是否主键
Integer isPrimary = null;
if (fieldsName.equals(primaryString)) {
isPrimary = 1;
} else {
isPrimary = 0;
}
AssetsModel assetsModel = AssetsModel.builder()
.decimalPlace(decimalPlace)
.dataTableId(tableInfo.getId())
.baseType(baseType)
.defaultValue(defaultValue)
.fieldsAnnotation(fieldsAnnotation)
.fieldsLength(fieldsLength)
.fieldsName(fieldsName)
.tableName(tableName)
.isEmpty(isEmpty)
.isPrimary(isPrimary)
.javaType(javaType)
.createBy(SecurityUtils.getUsername())
.createTime(new Date())
.build();
assetsModelList.add(assetsModel);
}
}
assetsModelService.saveBatch(assetsModelList);
//查询本库中所有的表(资产模型)数量
String queryTableCount = "SELECT COUNT(*) TABLES FROM information_schema.TABLES WHERE table_schema = "+"'"+dataSourceResp.getDataSourceDatabaseName()+"'"+" GROUP BY table_schema";
PreparedStatement preparedStatementGetTableCount = connection.prepareStatement(queryTableCount);
ResultSet resultSetCount = preparedStatementGetTableCount.executeQuery();
int tableCount = 0;
while (resultSetCount.next()){
tableCount = resultSetCount.getInt(1);
}
//查询本库中所有的字段(数据模型)适量
String queryFieldsCount = "SELECT COUNT(column_name) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = "+ "'"+dataSourceResp.getDataSourceDatabaseName()+"'";
PreparedStatement preparedStatementGetFieldsCount = connection.prepareStatement(queryFieldsCount);
ResultSet resultSetFieldsCount = preparedStatementGetFieldsCount.executeQuery();
int fieldsCount = 0;
while (resultSetFieldsCount.next()){
fieldsCount = resultSetFieldsCount.getInt(1);
}
//修改数量
UpdateWrapper<DataSource> dataSourceUpdateWrapper = new UpdateWrapper<>();
dataSourceUpdateWrapper.eq("id",dataSourceResp.getId());
dataSourceUpdateWrapper.set("table_count",tableCount);
dataSourceUpdateWrapper.set("data_model_count",fieldsCount);
this.update(dataSourceUpdateWrapper);
} catch (Exception e) {
return Result.success(null,"数据同步失败,失败原因"+e.getMessage());
}
return Result.success(null,"数据同步成功");
}
public static void close(ResultSet rs, PreparedStatement ps, Connection conn) throws Exception {
if (rs != null) {
rs.close();
}
if (ps != null) {
ps.close();
}
if (conn != null) {
conn.close();
}
}
//测试数据源连接是否有效
public static boolean testDatasource(String driveClass, String url, String username, String password) {
//Result<List<HashMap<String,String>>>
try {
Class.forName(driveClass);
Connection connection = DriverManager.getConnection(url, username, password);
return true;
} catch (Exception e) {
return false;
}
}
}

View File

@ -1,17 +0,0 @@
package com.etl.data.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.etl.data.domain.DataTable;
import com.etl.data.mapper.DataTableMapper;
import com.etl.data.service.DataTableService;
import org.springframework.stereotype.Service;
/**
* @ClassName DataTableServiceImpl
* @Description
* @Author YunFei.Du
* @Date 2024/4/22 14:36
*/
@Service
public class DataTableServiceImpl extends ServiceImpl<DataTableMapper, DataTable> implements DataTableService {
}

View File

@ -1,18 +0,0 @@
package com.etl.data.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.etl.data.domain.DataType;
import com.etl.data.mapper.DataTypeMapper;
import com.etl.data.service.DataTypeService;
import org.springframework.stereotype.Service;
/**
* @ClassName DataSourceServiceImpl
* @Description
* @Author YunFei.Du
* @Date 2024/4/20 11:49
*/
@Service
public class DataTypeServiceImpl extends ServiceImpl<DataTypeMapper, DataType> implements DataTypeService {
}

View File

@ -1,17 +0,0 @@
package com.etl.data.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.etl.data.domain.DictionaryInfo;
import com.etl.data.mapper.DictionaryInfoMapper;
import com.etl.data.service.DictionaryInfoService;
import org.springframework.stereotype.Service;
/**
* @ClassName DictionaryServiceImpl
* @Description
* @Author YunFei.Du
* @Date 2024/4/26 9:40
*/
@Service
public class DictionaryInfoServiceImpl extends ServiceImpl<DictionaryInfoMapper, DictionaryInfo> implements DictionaryInfoService {
}

View File

@ -1,73 +0,0 @@
package com.etl.data.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.etl.common.core.domain.Result;
import com.etl.data.domain.Dictionary;
import com.etl.data.domain.DictionaryInfo;
import com.etl.data.domain.resp.DictionaryInfoResp;
import com.etl.data.mapper.DictionaryMapper;
import com.etl.data.service.DictionaryInfoService;
import com.etl.data.service.DictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @ClassName DictionaryServiceImpl
* @Description
* @Author YunFei.Du
* @Date 2024/4/26 9:40
*/
@Service
public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary> implements DictionaryService {
@Autowired
private DictionaryInfoService dictionaryInfoService;
@Override
public Result<List< DictionaryInfoResp >> getDictionaryByDataSourceId(Integer dataSourceId) {
List< DictionaryInfoResp > dictionaryModels = new ArrayList<> ( );
//根据数据源id查询所有适用的字典
List< Dictionary > dictionaryList = this.list ( new LambdaQueryWrapper< Dictionary > ( ).eq ( Dictionary::getDataSourceId, dataSourceId ) );
//根据每一个字典查询所有字典标签,并封装为一个对象
for (Dictionary dictionary : dictionaryList) {
LambdaQueryWrapper<DictionaryInfo> dictionaryInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
dictionaryInfoLambdaQueryWrapper.eq(DictionaryInfo::getDictionaryId,dictionary.getId());
List<DictionaryInfo> dictionaryInfoList = dictionaryInfoService.list(dictionaryInfoLambdaQueryWrapper);
dictionaryModels.add(DictionaryInfoResp.dictionaryAndInfoBuild(dictionary,dictionaryInfoList));
}
return Result.success ( dictionaryModels );
}
@Override
public Result insertDictionary(Dictionary dictionary) {
boolean save = this.save ( dictionary );
if (!save) {
return Result.error ( "添加失败" );
}
return Result.success ( "添加成功" );
}
@Override
public Result insertDictionarySelect(DictionaryInfo dictionaryInfo) {
String returnString = "";
boolean save;
if (dictionaryInfo.getId ( ) == null) {
save = dictionaryInfoService.save ( dictionaryInfo );
returnString = save ? "添加字典标签成功" : "添加字典标签失败";
} else {
save = dictionaryInfoService.updateById ( dictionaryInfo );
returnString = save ? "修改字典标签成功" : "修改字典标签失败";
}
if (save) {
return Result.success ( null, returnString );
}
return Result.error ( returnString );
}
}

View File

@ -1,34 +0,0 @@
# Tomcat
server:
port: 9506
# Spring
spring:
main:
allow-circular-references: true
application:
# 应用名称
name: etl-data-source
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 111.229.102.61:8848
# 命名空间
namespace: etl
config:
# 配置中心地址
server-addr: 111.229.102.61:8848
# 命名空间
namespace: etl
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
logging:
level:
com.etl.data.mapper: DEBUG

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.etl.data.mapper.AssetsModelMapper">
</mapper>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.etl.data.mapper.DataSourceMapper">
</mapper>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.etl.data.mapper.DataTableMapper">
</mapper>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.etl.data.mapper.DataTypeMapper">
</mapper>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.etl.data.mapper.DictionaryInfoMapper">
</mapper>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.etl.data.mapper.DictionaryMapper">
</mapper>

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