Compare commits
18 Commits
47051ef8a2
...
5b1b39418e
Author | SHA1 | Date | |
---|---|---|---|
5b1b39418e | |||
dab7059542 | |||
16874f63e8 | |||
77caf22770 | |||
096d95e27d | |||
6b710959d3 | |||
c102c1fab2 | |||
4e4a40e097 | |||
526585ce21 | |||
c924ee7bb7 | |||
cd4e883093 | |||
544f20b6f7 | |||
ffc330485f | |||
90d30810ed | |||
21b3850062 | |||
96b3bd83ef | |||
fe75d590b9 | |||
dd08b68454 |
114
.drone-base.yml
114
.drone-base.yml
@ -2,81 +2,14 @@ kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
|||||||
|
|
||||||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
||||||
|
|
||||||
name: ludu-system-drone # 定义流水线名称
|
name: ludu-base-drone # 定义流水线名称
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||||
|
|
||||||
- name: package # 流水线名称
|
- name: base-build
|
||||||
|
|
||||||
image: maven:3-jdk-8 # 定义创建容器的Docker镜像
|
|
||||||
|
|
||||||
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
|
|
||||||
|
|
||||||
- name: maven-cache
|
|
||||||
|
|
||||||
path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
|
|
||||||
|
|
||||||
- name: maven-build
|
|
||||||
|
|
||||||
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
|
|
||||||
|
|
||||||
commands: # 定义在Docker容器中执行的shell命令
|
|
||||||
|
|
||||||
- mvn package -Dmaven.test.skip=true # 应用打包命令
|
|
||||||
|
|
||||||
- mkdir -p /app/build/yudao-gateway/target
|
|
||||||
- cp ./yudao-gateway/target/yudao-gateway.jar /app/build/yudao-gateway/target
|
|
||||||
- cp ./yudao-gateway/Dockerfile /app/build/yudao-gateway
|
|
||||||
- cp ./yudao-gateway/run.sh /app/build/yudao-gateway
|
|
||||||
|
|
||||||
- mkdir -p /app/build/yudao-module-system/target
|
|
||||||
- cp ./yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /app/build/yudao-module-system/target
|
|
||||||
- cp ./yudao-module-system/yudao-module-system-biz/Dockerfile /app/build/yudao-module-system
|
|
||||||
- cp ./yudao-module-system/yudao-module-system-biz/run.sh /app/build/yudao-module-system
|
|
||||||
|
|
||||||
- mkdir -p /app/build/yudao-module-infra/target
|
|
||||||
- cp ./yudao-module-infra/yudao-module-infra-biz/target/yudao-module-infra-biz.jar /app/build/yudao-module-infra/target
|
|
||||||
- cp ./yudao-module-infra/yudao-module-infra-biz/Dockerfile /app/build/yudao-module-infra
|
|
||||||
- cp ./yudao-module-infra/yudao-module-infra-biz/run.sh /app/build/yudao-module-infra
|
|
||||||
|
|
||||||
- mkdir -p /app/build/ludu-job-admin/target
|
|
||||||
- cp ./ludu-job-admin/ludu-job-admin-biz/target/ludu-job-admin-biz.jar /app/build/ludu-job-admin/target
|
|
||||||
- cp ./ludu-job-admin/ludu-job-admin-biz/Dockerfile /app/build/ludu-job-admin
|
|
||||||
- cp ./ludu-job-admin/ludu-job-admin-biz/run.sh /app/build/ludu-job-admin
|
|
||||||
|
|
||||||
|
|
||||||
- name: copy-to-object # 构建基础模块和复制票务停车场到轮渡服务器
|
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
|
||||||
|
|
||||||
settings:
|
|
||||||
|
|
||||||
host: 101.43.112.107 # 远程连接地址
|
|
||||||
|
|
||||||
username: root # 远程连接账号
|
|
||||||
|
|
||||||
password:
|
|
||||||
|
|
||||||
from_secret: ssh_password # 从Secret中读取SSH密码
|
|
||||||
|
|
||||||
port: 22 # 远程连接端口
|
|
||||||
|
|
||||||
command_timeout: 15m # 远程执行命令超时时间
|
|
||||||
|
|
||||||
script:
|
|
||||||
|
|
||||||
- echo "start copy"
|
|
||||||
- scp -r /ludu/maven/build/yudao-gateway root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "gateway done"
|
|
||||||
- scp -r /ludu/maven/build/yudao-module-system root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "system done"
|
|
||||||
- scp -r /ludu/maven/build/yudao-module-infra root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "infra done"
|
|
||||||
- scp -r /ludu/maven/build/ludu-job-admin root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "job done"
|
|
||||||
|
|
||||||
- name: object-build
|
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
image: appleboy/drone-ssh # SSH工具镜像
|
||||||
|
|
||||||
@ -95,29 +28,24 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
|||||||
command_timeout: 20m # 远程执行命令超时时间
|
command_timeout: 20m # 远程执行命令超时时间
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- cd /root/ludu-cloud
|
||||||
|
- git fetch origin
|
||||||
|
- git reset --hard origin/master
|
||||||
|
- git clean -fd
|
||||||
|
- /root/apache-maven-3.9.4/bin/mvn package -Dmaven.test.skip=true
|
||||||
|
|
||||||
- cd /ludu/maven/build/yudao-gateway/
|
- cd /root/ludu-cloud/yudao-gateway
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "ludu-module-ticketing build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "gateway build failed"
|
||||||
|
|
||||||
- cd /ludu/maven/build/yudao-module-system/
|
- cd /root/ludu-cloud/yudao-module-system/yudao-module-system-biz
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "ludu-module-datacenter build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "system build failed"
|
||||||
|
|
||||||
- cd /ludu/maven/build/yudao-module-infra/
|
- cd /root/ludu-cloud/yudao-module-infra/yudao-module-infra-biz
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "yudao-module-infra build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "infra build failed"
|
||||||
|
|
||||||
- cd /ludu/maven/build/ludu-job-admin/
|
- cd /root/ludu-cloud/ludu-job-admin/ludu-job-admin-biz
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "ludu-job-admin build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "job build failed"
|
||||||
|
|
||||||
volumes: # 定义流水线挂载目录,用于共享数据
|
|
||||||
|
|
||||||
- name: maven-build
|
|
||||||
host:
|
|
||||||
path: /ludu/maven/build # 从宿主机中挂载的目录
|
|
||||||
|
|
||||||
- name: maven-cache
|
|
||||||
host:
|
|
||||||
path: /ludu/maven/cache # 从宿主机中挂载的目录
|
|
@ -2,80 +2,13 @@ kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
|||||||
|
|
||||||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
||||||
|
|
||||||
name: ludu-system-drone # 定义流水线名称
|
name: ludu-datacenter-drone # 定义流水线名称
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||||
|
|
||||||
# - name: package # 流水线名称
|
|
||||||
#
|
|
||||||
# image: maven:3-jdk-8 # 定义创建容器的Docker镜像
|
|
||||||
#
|
|
||||||
# volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
|
|
||||||
#
|
|
||||||
# - name: maven-cache
|
|
||||||
#
|
|
||||||
# path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
|
|
||||||
#
|
|
||||||
# - name: maven-build
|
|
||||||
#
|
|
||||||
# path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
|
|
||||||
#
|
|
||||||
# commands: # 定义在Docker容器中执行的shell命令
|
|
||||||
#
|
|
||||||
# - mvn package -Dmaven.test.skip=true # 应用打包命令
|
|
||||||
# - mkdir -p /app/build/ludu-module-datacenter/target
|
|
||||||
# - cp ./ludu-module-datacenter/ludu-module-datacenter-biz/target/ludu-module-datacenter-biz.jar /app/build/ludu-module-datacenter/target
|
|
||||||
# - cp ./ludu-module-datacenter/ludu-module-datacenter-biz/Dockerfile /app/build/ludu-module-datacenter
|
|
||||||
# - cp ./ludu-module-datacenter/ludu-module-datacenter-biz/run.sh /app/build/ludu-module-datacenter
|
|
||||||
#
|
|
||||||
# - name: copy-to-object # 构建基础模块和复制票务停车场到轮渡服务器
|
|
||||||
#
|
|
||||||
# image: appleboy/drone-ssh # SSH工具镜像
|
|
||||||
#
|
|
||||||
# settings:
|
|
||||||
#
|
|
||||||
# host: 101.43.112.107 # 远程连接地址
|
|
||||||
#
|
|
||||||
# username: root # 远程连接账号
|
|
||||||
#
|
|
||||||
# password:
|
|
||||||
#
|
|
||||||
# from_secret: ssh_password # 从Secret中读取SSH密码
|
|
||||||
#
|
|
||||||
# port: 22 # 远程连接端口
|
|
||||||
#
|
|
||||||
# command_timeout: 15m # 远程执行命令超时时间
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
#
|
|
||||||
# - scp -r /ludu/maven/build/ludu-module-datacenter root@120.46.37.243:/ludu/maven/build
|
|
||||||
# - echo "datacenter done"
|
|
||||||
#
|
|
||||||
# - name: build-old-service
|
|
||||||
#
|
|
||||||
# image: appleboy/drone-ssh # SSH工具镜像
|
|
||||||
#
|
|
||||||
# settings:
|
|
||||||
#
|
|
||||||
# host: 120.46.37.243 # 远程连接地址
|
|
||||||
#
|
|
||||||
# username: root # 远程连接账号
|
|
||||||
#
|
|
||||||
# password:
|
|
||||||
#
|
|
||||||
# from_secret: ssh_password2 # 从Secret中读取SSH密码
|
|
||||||
#
|
|
||||||
# port: 22 # 远程连接端口
|
|
||||||
#
|
|
||||||
# command_timeout: 5m # 远程执行命令超时时间
|
|
||||||
#
|
|
||||||
# script:
|
|
||||||
#
|
|
||||||
# - cd /ludu/maven/build/ludu-module-datacenter/
|
|
||||||
# - chmod +x ./run.sh # 更改为可执行脚本
|
|
||||||
# - ./run.sh || echo "ludu-module-datacenter build failed" # 运行脚本打包应用镜像并运行
|
|
||||||
|
|
||||||
- name: build-new-service
|
- name: build-new-service
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
image: appleboy/drone-ssh # SSH工具镜像
|
||||||
@ -96,23 +29,10 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
|||||||
|
|
||||||
script: |
|
script: |
|
||||||
cd /root/ludu-cloud
|
cd /root/ludu-cloud
|
||||||
git pull origin master
|
git fetch origin
|
||||||
rm -f ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/nacos/config/BeanInit.java
|
git reset --hard origin/master
|
||||||
/root/apache-maven-3.9.4/bin/mvn clean package -Dmaven.test.skip=true
|
git clean -fd
|
||||||
port=48092 # 指定端口号
|
/root/apache-maven-3.9.4/bin/mvn package -Dmaven.test.skip=true
|
||||||
pid=$(lsof -t -i:$port) # 获取占用指定端口的进程号
|
cd ludu-module-datacenter/ludu-module-datacenter-biz/
|
||||||
if [ -n "$pid" ]; then
|
chmod +x run.sh
|
||||||
echo "Killing process $pid"
|
./run.sh || echo "ludu-module-datacenter build failed"
|
||||||
kill -9 $pid
|
|
||||||
fi
|
|
||||||
nohup java -jar ludu-module-datacenter/ludu-module-datacenter-biz/target/ludu-module-datacenter-biz.jar --spring.profiles.active=dev > api.log &
|
|
||||||
|
|
||||||
volumes: # 定义流水线挂载目录,用于共享数据
|
|
||||||
|
|
||||||
- name: maven-build
|
|
||||||
host:
|
|
||||||
path: /ludu/maven/build # 从宿主机中挂载的目录
|
|
||||||
|
|
||||||
- name: maven-cache
|
|
||||||
host:
|
|
||||||
path: /ludu/maven/cache # 从宿主机中挂载的目录
|
|
@ -2,61 +2,14 @@ kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
|||||||
|
|
||||||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
||||||
|
|
||||||
name: ludu-system-drone # 定义流水线名称
|
name: ludu-parking-drone # 定义流水线名称
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||||
|
|
||||||
- name: package # 流水线名称
|
- name: parking-build
|
||||||
|
|
||||||
image: maven:3-jdk-8 # 定义创建容器的Docker镜像
|
|
||||||
|
|
||||||
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
|
|
||||||
|
|
||||||
- name: maven-cache
|
|
||||||
|
|
||||||
path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
|
|
||||||
|
|
||||||
- name: maven-build
|
|
||||||
|
|
||||||
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
|
|
||||||
|
|
||||||
commands: # 定义在Docker容器中执行的shell命令
|
|
||||||
|
|
||||||
- mvn package -Dmaven.test.skip=true # 应用打包命令
|
|
||||||
|
|
||||||
- mkdir -p /app/build/ludu-module-parking/target
|
|
||||||
- cp ./ludu-module-parking/ludu-module-parking-biz/target/ludu-module-parking-biz.jar /app/build/ludu-module-parking/target
|
|
||||||
- cp ./ludu-module-parking/ludu-module-parking-biz/Dockerfile /app/build/ludu-module-parking
|
|
||||||
- cp ./ludu-module-parking/ludu-module-parking-biz/run.sh /app/build/ludu-module-parking
|
|
||||||
|
|
||||||
|
|
||||||
- name: copy-to-object # 构建基础模块和复制票务停车场到轮渡服务器
|
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
|
||||||
|
|
||||||
settings:
|
|
||||||
|
|
||||||
host: 101.43.112.107 # 远程连接地址
|
|
||||||
|
|
||||||
username: root # 远程连接账号
|
|
||||||
|
|
||||||
password:
|
|
||||||
|
|
||||||
from_secret: ssh_password # 从Secret中读取SSH密码
|
|
||||||
|
|
||||||
port: 22 # 远程连接端口
|
|
||||||
|
|
||||||
command_timeout: 15m # 远程执行命令超时时间
|
|
||||||
|
|
||||||
script:
|
|
||||||
|
|
||||||
- echo "start copy"
|
|
||||||
- scp -r /ludu/maven/build/ludu-module-parking root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "parking done"
|
|
||||||
|
|
||||||
|
|
||||||
- name: object-build
|
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
image: appleboy/drone-ssh # SSH工具镜像
|
||||||
|
|
||||||
@ -75,18 +28,12 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
|||||||
command_timeout: 20m # 远程执行命令超时时间
|
command_timeout: 20m # 远程执行命令超时时间
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- cd /root/ludu-cloud
|
||||||
|
- git fetch origin
|
||||||
|
- git reset --hard origin/master
|
||||||
|
- git clean -fd
|
||||||
|
- /root/apache-maven-3.9.4/bin/mvn package -Dmaven.test.skip=true
|
||||||
|
|
||||||
- cd /ludu/maven/build/ludu-module-parking/
|
- cd /root/ludu-cloud/ludu-module-parking/ludu-module-parking-biz
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "ludu-module-parking build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "parking build failed"
|
||||||
|
|
||||||
|
|
||||||
volumes: # 定义流水线挂载目录,用于共享数据
|
|
||||||
|
|
||||||
- name: maven-build
|
|
||||||
host:
|
|
||||||
path: /ludu/maven/build # 从宿主机中挂载的目录
|
|
||||||
|
|
||||||
- name: maven-cache
|
|
||||||
host:
|
|
||||||
path: /ludu/maven/cache # 从宿主机中挂载的目录
|
|
@ -2,60 +2,14 @@ kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
|||||||
|
|
||||||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
||||||
|
|
||||||
name: ludu-system-drone # 定义流水线名称
|
name: ludu-ticketing-drone # 定义流水线名称
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||||
|
|
||||||
- name: package # 流水线名称
|
- name: ticketing-build
|
||||||
|
|
||||||
image: maven:3-jdk-8 # 定义创建容器的Docker镜像
|
|
||||||
|
|
||||||
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
|
|
||||||
|
|
||||||
- name: maven-cache
|
|
||||||
|
|
||||||
path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
|
|
||||||
|
|
||||||
- name: maven-build
|
|
||||||
|
|
||||||
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
|
|
||||||
|
|
||||||
commands: # 定义在Docker容器中执行的shell命令
|
|
||||||
|
|
||||||
- mvn package -Dmaven.test.skip=true # 应用打包命令
|
|
||||||
|
|
||||||
- mkdir -p /app/build/ludu-module-ticketing/target
|
|
||||||
- cp ./ludu-module-ticketing/ludu-module-ticketing-biz/target/ludu-module-ticketing-biz.jar /app/build/ludu-module-ticketing/target
|
|
||||||
- cp ./ludu-module-ticketing/ludu-module-ticketing-biz/Dockerfile /app/build/ludu-module-ticketing
|
|
||||||
- cp ./ludu-module-ticketing/ludu-module-ticketing-biz/run.sh /app/build/ludu-module-ticketing
|
|
||||||
|
|
||||||
|
|
||||||
- name: copy-to-object # 构建基础模块和复制票务停车场到轮渡服务器
|
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
|
||||||
|
|
||||||
settings:
|
|
||||||
|
|
||||||
host: 101.43.112.107 # 远程连接地址
|
|
||||||
|
|
||||||
username: root # 远程连接账号
|
|
||||||
|
|
||||||
password:
|
|
||||||
|
|
||||||
from_secret: ssh_password # 从Secret中读取SSH密码
|
|
||||||
|
|
||||||
port: 22 # 远程连接端口
|
|
||||||
|
|
||||||
command_timeout: 15m # 远程执行命令超时时间
|
|
||||||
|
|
||||||
script:
|
|
||||||
|
|
||||||
- echo "start copy"
|
|
||||||
- scp -r /ludu/maven/build/ludu-module-ticketing root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "ticketing done"
|
|
||||||
|
|
||||||
- name: object-build
|
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
image: appleboy/drone-ssh # SSH工具镜像
|
||||||
|
|
||||||
@ -74,17 +28,12 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
|||||||
command_timeout: 20m # 远程执行命令超时时间
|
command_timeout: 20m # 远程执行命令超时时间
|
||||||
|
|
||||||
script:
|
script:
|
||||||
|
- cd /root/ludu-cloud
|
||||||
|
- git fetch origin
|
||||||
|
- git reset --hard origin/master
|
||||||
|
- git clean -fd
|
||||||
|
- /root/apache-maven-3.9.4/bin/mvn package -Dmaven.test.skip=true
|
||||||
|
|
||||||
- cd /ludu/maven/build/ludu-module-ticketing/
|
- cd /root/ludu-cloud/ludu-module-ticketing/ludu-module-ticketing-biz
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "ludu-module-ticketing build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "ticketing build failed"
|
||||||
|
|
||||||
volumes: # 定义流水线挂载目录,用于共享数据
|
|
||||||
|
|
||||||
- name: maven-build
|
|
||||||
host:
|
|
||||||
path: /ludu/maven/build # 从宿主机中挂载的目录
|
|
||||||
|
|
||||||
- name: maven-cache
|
|
||||||
host:
|
|
||||||
path: /ludu/maven/cache # 从宿主机中挂载的目录
|
|
199
.drone.yml
199
.drone.yml
@ -2,124 +2,14 @@ kind: pipeline # 定义对象类型,还有secret和signature两种类型
|
|||||||
|
|
||||||
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
type: docker # 定义流水线类型,还有kubernetes、exec、ssh等类型
|
||||||
|
|
||||||
name: ludu-system-drone # 定义流水线名称
|
name: ludu-total-drone # 定义流水线名称
|
||||||
|
|
||||||
|
clone:
|
||||||
|
disable: true
|
||||||
|
|
||||||
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
||||||
|
|
||||||
- name: package # 流水线名称
|
- name: total-build
|
||||||
|
|
||||||
image: maven:3-jdk-8 # 定义创建容器的Docker镜像
|
|
||||||
|
|
||||||
volumes: # 将容器内目录挂载到宿主机,仓库需要开启Trusted设置
|
|
||||||
|
|
||||||
- name: maven-cache
|
|
||||||
|
|
||||||
path: /root/.m2 # 将maven下载依赖的目录挂载出来,防止重复下载
|
|
||||||
|
|
||||||
- name: maven-build
|
|
||||||
|
|
||||||
path: /app/build # 将应用打包好的Jar和执行脚本挂载出来
|
|
||||||
|
|
||||||
commands: # 定义在Docker容器中执行的shell命令
|
|
||||||
|
|
||||||
- mvn package -Dmaven.test.skip=true # 应用打包命令
|
|
||||||
|
|
||||||
- mkdir -p /app/build/yudao-gateway/target
|
|
||||||
- cp ./yudao-gateway/target/yudao-gateway.jar /app/build/yudao-gateway/target
|
|
||||||
- cp ./yudao-gateway/Dockerfile /app/build/yudao-gateway
|
|
||||||
- cp ./yudao-gateway/run.sh /app/build/yudao-gateway
|
|
||||||
|
|
||||||
- mkdir -p /app/build/yudao-module-system/target
|
|
||||||
- cp ./yudao-module-system/yudao-module-system-biz/target/yudao-module-system-biz.jar /app/build/yudao-module-system/target
|
|
||||||
- cp ./yudao-module-system/yudao-module-system-biz/Dockerfile /app/build/yudao-module-system
|
|
||||||
- cp ./yudao-module-system/yudao-module-system-biz/run.sh /app/build/yudao-module-system
|
|
||||||
|
|
||||||
- mkdir -p /app/build/yudao-module-infra/target
|
|
||||||
- cp ./yudao-module-infra/yudao-module-infra-biz/target/yudao-module-infra-biz.jar /app/build/yudao-module-infra/target
|
|
||||||
- cp ./yudao-module-infra/yudao-module-infra-biz/Dockerfile /app/build/yudao-module-infra
|
|
||||||
- cp ./yudao-module-infra/yudao-module-infra-biz/run.sh /app/build/yudao-module-infra
|
|
||||||
|
|
||||||
- mkdir -p /app/build/ludu-job-admin/target
|
|
||||||
- cp ./ludu-job-admin/ludu-job-admin-biz/target/ludu-job-admin-biz.jar /app/build/ludu-job-admin/target
|
|
||||||
- cp ./ludu-job-admin/ludu-job-admin-biz/Dockerfile /app/build/ludu-job-admin
|
|
||||||
- cp ./ludu-job-admin/ludu-job-admin-biz/run.sh /app/build/ludu-job-admin
|
|
||||||
|
|
||||||
- mkdir -p /app/build/ludu-module-ticketing/target
|
|
||||||
- cp ./ludu-module-ticketing/ludu-module-ticketing-biz/target/ludu-module-ticketing-biz.jar /app/build/ludu-module-ticketing/target
|
|
||||||
- cp ./ludu-module-ticketing/ludu-module-ticketing-biz/Dockerfile /app/build/ludu-module-ticketing
|
|
||||||
- cp ./ludu-module-ticketing/ludu-module-ticketing-biz/run.sh /app/build/ludu-module-ticketing
|
|
||||||
|
|
||||||
- mkdir -p /app/build/ludu-module-parking/target
|
|
||||||
- cp ./ludu-module-parking/ludu-module-parking-biz/target/ludu-module-parking-biz.jar /app/build/ludu-module-parking/target
|
|
||||||
- cp ./ludu-module-parking/ludu-module-parking-biz/Dockerfile /app/build/ludu-module-parking
|
|
||||||
- cp ./ludu-module-parking/ludu-module-parking-biz/run.sh /app/build/ludu-module-parking
|
|
||||||
|
|
||||||
- mkdir -p /app/build/ludu-module-datacenter/target
|
|
||||||
- cp ./ludu-module-datacenter/ludu-module-datacenter-biz/target/ludu-module-datacenter-biz.jar /app/build/ludu-module-datacenter/target
|
|
||||||
- cp ./ludu-module-datacenter/ludu-module-datacenter-biz/Dockerfile /app/build/ludu-module-datacenter
|
|
||||||
- cp ./ludu-module-datacenter/ludu-module-datacenter-biz/run.sh /app/build/ludu-module-datacenter
|
|
||||||
|
|
||||||
- name: copy-to-object # 构建基础模块和复制票务停车场到轮渡服务器
|
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
|
||||||
|
|
||||||
settings:
|
|
||||||
|
|
||||||
host: 101.43.112.107 # 远程连接地址
|
|
||||||
|
|
||||||
username: root # 远程连接账号
|
|
||||||
|
|
||||||
password:
|
|
||||||
|
|
||||||
from_secret: ssh_password # 从Secret中读取SSH密码
|
|
||||||
|
|
||||||
port: 22 # 远程连接端口
|
|
||||||
|
|
||||||
command_timeout: 15m # 远程执行命令超时时间
|
|
||||||
|
|
||||||
script:
|
|
||||||
|
|
||||||
- echo "start copy"
|
|
||||||
- scp -r /ludu/maven/build/yudao-gateway root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "gateway done"
|
|
||||||
- scp -r /ludu/maven/build/yudao-module-system root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "system done"
|
|
||||||
- scp -r /ludu/maven/build/ludu-module-ticketing root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "ticketing done"
|
|
||||||
- scp -r /ludu/maven/build/ludu-module-parking root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "parking done"
|
|
||||||
- scp -r /ludu/maven/build/yudao-module-infra root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "infra done"
|
|
||||||
- scp -r /ludu/maven/build/ludu-job-admin root@121.36.203.133:/ludu/maven/build
|
|
||||||
- echo "job done"
|
|
||||||
- scp -r /ludu/maven/build/ludu-module-datacenter root@120.46.37.243:/ludu/maven/build
|
|
||||||
- echo "datacenter done"
|
|
||||||
|
|
||||||
- name: build-other-service
|
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
|
||||||
|
|
||||||
settings:
|
|
||||||
|
|
||||||
host: 120.46.37.243 # 远程连接地址
|
|
||||||
|
|
||||||
username: root # 远程连接账号
|
|
||||||
|
|
||||||
password:
|
|
||||||
|
|
||||||
from_secret: ssh_password2 # 从Secret中读取SSH密码
|
|
||||||
|
|
||||||
port: 22 # 远程连接端口
|
|
||||||
|
|
||||||
command_timeout: 5m # 远程执行命令超时时间
|
|
||||||
|
|
||||||
script:
|
|
||||||
|
|
||||||
- cd /ludu/maven/build/ludu-module-datacenter/
|
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
|
||||||
- ./run.sh || echo "ludu-module-datacenter build failed" # 运行脚本打包应用镜像并运行
|
|
||||||
- name: object-build
|
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
image: appleboy/drone-ssh # SSH工具镜像
|
||||||
|
|
||||||
@ -138,65 +28,36 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
|
|||||||
command_timeout: 20m # 远程执行命令超时时间
|
command_timeout: 20m # 远程执行命令超时时间
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- cd /ludu/maven/build/yudao-gateway/
|
- cd /root/ludu-cloud
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- git fetch origin
|
||||||
- ./run.sh || echo "ludu-module-ticketing build failed" # 运行脚本打包应用镜像并运行
|
- git reset --hard origin/master
|
||||||
|
- git clean -fd
|
||||||
|
- /root/apache-maven-3.9.4/bin/mvn package -Dmaven.test.skip=true
|
||||||
|
|
||||||
- cd /ludu/maven/build/yudao-module-system/
|
- cd /root/ludu-cloud/yudao-gateway
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "ludu-module-datacenter build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "gateway build failed"
|
||||||
|
|
||||||
- cd /ludu/maven/build/ludu-module-ticketing/
|
- cd /root/ludu-cloud/yudao-module-system/yudao-module-system-biz
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "ludu-module-ticketing build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "system build failed"
|
||||||
|
|
||||||
- cd /ludu/maven/build/ludu-module-parking/
|
- cd /root/ludu-cloud/yudao-module-infra/yudao-module-infra-biz
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "ludu-module-parking build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "infra build failed"
|
||||||
|
|
||||||
- cd /ludu/maven/build/yudao-module-infra/
|
- cd /root/ludu-cloud/ludu-job-admin/ludu-job-admin-biz
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "yudao-module-infra build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "job build failed"
|
||||||
|
|
||||||
- cd /ludu/maven/build/ludu-job-admin/
|
- cd ludu-module-datacenter/ludu-module-datacenter-biz/
|
||||||
- chmod +x ./run.sh # 更改为可执行脚本
|
- chmod +x run.sh
|
||||||
- ./run.sh || echo "ludu-job-admin build failed" # 运行脚本打包应用镜像并运行
|
- ./run.sh || echo "datacenter build failed"
|
||||||
- name: build-new-service
|
|
||||||
|
|
||||||
image: appleboy/drone-ssh # SSH工具镜像
|
- cd /root/ludu-cloud/ludu-module-ticketing/ludu-module-ticketing-biz
|
||||||
|
- chmod +x run.sh
|
||||||
|
- ./run.sh || echo "ticketing build failed"
|
||||||
|
|
||||||
settings:
|
- cd /root/ludu-cloud/ludu-module-parking/ludu-module-parking-biz
|
||||||
|
- chmod +x run.sh
|
||||||
host: 121.36.203.133 # 远程连接地址
|
- ./run.sh || echo "parking build failed"
|
||||||
|
|
||||||
username: root # 远程连接账号
|
|
||||||
|
|
||||||
password:
|
|
||||||
|
|
||||||
from_secret: ssh_password3 # 从Secret中读取SSH密码
|
|
||||||
|
|
||||||
port: 22 # 远程连接端口
|
|
||||||
|
|
||||||
command_timeout: 10m # 远程执行命令超时时间
|
|
||||||
|
|
||||||
script: |
|
|
||||||
cd /root/ludu-cloud
|
|
||||||
git pull origin master
|
|
||||||
rm -f ludu-module-datacenter/ludu-module-datacenter-biz/src/main/java/cn/iocoder/yudao/module/datacenter/framework/nacos/config/BeanInit.java
|
|
||||||
/root/apache-maven-3.9.4/bin/mvn clean package -Dmaven.test.skip=true
|
|
||||||
port=48092 # 指定端口号
|
|
||||||
pid=$(lsof -t -i:$port) # 获取占用指定端口的进程号
|
|
||||||
if [ -n "$pid" ]; then
|
|
||||||
echo "Killing process $pid"
|
|
||||||
kill -9 $pid
|
|
||||||
fi
|
|
||||||
nohup java -Xms512m -Xmx512m -jar ludu-module-datacenter/ludu-module-datacenter-biz/target/ludu-module-datacenter-biz.jar --spring.profiles.active=dev > api.log &
|
|
||||||
volumes: # 定义流水线挂载目录,用于共享数据
|
|
||||||
|
|
||||||
- name: maven-build
|
|
||||||
host:
|
|
||||||
path: /ludu/maven/build # 从宿主机中挂载的目录
|
|
||||||
|
|
||||||
- name: maven-cache
|
|
||||||
host:
|
|
||||||
path: /ludu/maven/cache # 从宿主机中挂载的目录
|
|
@ -1,6 +1,6 @@
|
|||||||
## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性
|
## AdoptOpenJDK 停止发布 OpenJDK 二进制,而 Eclipse Temurin 是它的延伸,提供更好的稳定性
|
||||||
## 感谢复旦核博士的建议!灰子哥,牛皮!
|
## 感谢复旦核博士的建议!灰子哥,牛皮!
|
||||||
FROM eclipse-temurin:8-jre
|
FROM openjdk:8-jre
|
||||||
|
|
||||||
## 创建目录,并使用它作为工作目录
|
## 创建目录,并使用它作为工作目录
|
||||||
RUN mkdir -p /ludu-module-datacenter-biz
|
RUN mkdir -p /ludu-module-datacenter-biz
|
||||||
|
@ -116,6 +116,12 @@
|
|||||||
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
<artifactId>yudao-spring-boot-starter-monitor</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- feign客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<!-- 设置构建的 jar 包名 -->
|
<!-- 设置构建的 jar 包名 -->
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
app_name='ludu-module-datacenter2'
|
app_name='ludu-module-datacenter'
|
||||||
# 定义应用版本
|
# 定义应用版本
|
||||||
app_version='2.0.0'
|
app_version='1.0.0'
|
||||||
# 定义应用环境
|
# 定义应用环境
|
||||||
#profile_active='prod'
|
#profile_active='prod'
|
||||||
echo '----stop container----'
|
echo '----stop container----'
|
||||||
@ -13,4 +13,4 @@ docker rmi ${app_name}:${app_version}
|
|||||||
echo '----build image----'
|
echo '----build image----'
|
||||||
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
|
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
|
||||||
echo '----start container----'
|
echo '----start container----'
|
||||||
docker run -d -p 9091:48092 --name ${app_name} ${app_name}:${app_version}
|
docker run -d -p 48092:48092 --name ${app_name} ${app_name}:${app_version}
|
@ -2,11 +2,13 @@ package cn.iocoder.yudao.module.datacenter;
|
|||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description 大屏服务启动类
|
* @Description 大屏服务启动类
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableFeignClients
|
||||||
public class DatacenterServerApplication {
|
public class DatacenterServerApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(DatacenterServerApplication.class, args);
|
SpringApplication.run(DatacenterServerApplication.class, args);
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.datacenter.controller.app.checkticket;
|
package cn.iocoder.yudao.module.datacenter.controller.app.checkticket;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.datacenter.controller.app.clients.LoginClient;
|
||||||
|
import cn.iocoder.yudao.module.datacenter.controller.app.clients.vo.AuthLoginReqVO;
|
||||||
import cn.iocoder.yudao.module.datacenter.service.checkticket.CheckTicketService;
|
import cn.iocoder.yudao.module.datacenter.service.checkticket.CheckTicketService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
@ -20,6 +22,10 @@ import java.util.Map;
|
|||||||
public class CheckTicketApi {
|
public class CheckTicketApi {
|
||||||
@Resource
|
@Resource
|
||||||
private CheckTicketService checkTicketService;
|
private CheckTicketService checkTicketService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LoginClient loginClient;
|
||||||
|
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
@Operation(summary = "获得日期当天的检票人数")
|
@Operation(summary = "获得日期当天的检票人数")
|
||||||
public Long checkTicketTotal(String starTime, String endTime) {
|
public Long checkTicketTotal(String starTime, String endTime) {
|
||||||
@ -35,4 +41,13 @@ public class CheckTicketApi {
|
|||||||
String replace1 = endTime.replace("-", "");
|
String replace1 = endTime.replace("-", "");
|
||||||
return checkTicketService.findbytimetemp(replace,replace1);
|
return checkTicketService.findbytimetemp(replace,replace1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/getToken")
|
||||||
|
public Map<Object, Object> test(){
|
||||||
|
AuthLoginReqVO loginReqVO = new AuthLoginReqVO();
|
||||||
|
loginReqVO.setPassword("admin123");
|
||||||
|
loginReqVO.setUsername("admin");
|
||||||
|
Map<Object, Object> token = loginClient.getToken(loginReqVO,"1");
|
||||||
|
return token;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,16 @@
|
|||||||
|
package cn.iocoder.yudao.module.datacenter.controller.app.clients;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.datacenter.controller.app.clients.vo.AuthLoginReqVO;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestHeader;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@FeignClient("system-server")
|
||||||
|
public interface LoginClient {
|
||||||
|
@PostMapping("/admin-api/system/auth/login")
|
||||||
|
Map<Object,Object> getToken(@RequestBody AuthLoginReqVO reqVO, @RequestHeader("Tenant-Id") String tenantId);
|
||||||
|
}
|
@ -0,0 +1,69 @@
|
|||||||
|
package cn.iocoder.yudao.module.datacenter.controller.app.clients.vo;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||||
|
import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import javax.validation.constraints.AssertTrue;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 账号密码登录 Request VO,如果登录并绑定社交用户,需要传递 social 开头的参数")
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
public class AuthLoginReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "yudaoyuanma")
|
||||||
|
@NotEmpty(message = "登录账号不能为空")
|
||||||
|
@Length(min = 4, max = 16, message = "账号长度为 4-16 位")
|
||||||
|
@Pattern(regexp = "^[A-Za-z0-9]+$", message = "账号格式为数字以及字母")
|
||||||
|
private String username;
|
||||||
|
|
||||||
|
@Schema(description = "密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "buzhidao")
|
||||||
|
@NotEmpty(message = "密码不能为空")
|
||||||
|
@Length(min = 4, max = 16, message = "密码长度为 4-16 位")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
// ========== 图片验证码相关 ==========
|
||||||
|
|
||||||
|
@Schema(description = "验证码,验证码开启时,需要传递", requiredMode = Schema.RequiredMode.REQUIRED,
|
||||||
|
example = "PfcH6mgr8tpXuMWFjvW6YVaqrswIuwmWI5dsVZSg7sGpWtDCUbHuDEXl3cFB1+VvCC/rAkSwK8Fad52FSuncVg==")
|
||||||
|
@NotEmpty(message = "验证码不能为空", groups = CodeEnableGroup.class)
|
||||||
|
private String captchaVerification;
|
||||||
|
|
||||||
|
// ========== 绑定社交登录时,需要传递如下参数 ==========
|
||||||
|
|
||||||
|
@Schema(description = "社交平台的类型,参见 SocialTypeEnum 枚举值", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||||
|
@InEnum(SocialTypeEnum.class)
|
||||||
|
private Integer socialType;
|
||||||
|
|
||||||
|
@Schema(description = "授权码", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private String socialCode;
|
||||||
|
|
||||||
|
@Schema(description = "state", requiredMode = Schema.RequiredMode.REQUIRED, example = "9b2ffbc1-7425-4155-9894-9d5c08541d62")
|
||||||
|
private String socialState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开启验证码的 Group
|
||||||
|
*/
|
||||||
|
public interface CodeEnableGroup {}
|
||||||
|
|
||||||
|
@AssertTrue(message = "授权码不能为空")
|
||||||
|
public boolean isSocialCodeValid() {
|
||||||
|
return socialType == null || StrUtil.isNotEmpty(socialCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AssertTrue(message = "授权 state 不能为空")
|
||||||
|
public boolean isSocialState() {
|
||||||
|
return socialType == null || StrUtil.isNotEmpty(socialState);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -9,24 +9,25 @@ import org.springframework.context.annotation.Primary;
|
|||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
@Configuration
|
// TODO 由于datacenter走网关内网,不指定外网IP和端口,自动获取本地
|
||||||
|
//@Configuration
|
||||||
public class BeanInit {
|
public class BeanInit {
|
||||||
/**
|
/**
|
||||||
* 用于改变程序自动获取的本机ip
|
* 用于改变程序自动获取的本机ip
|
||||||
*/
|
*/
|
||||||
@Value("${spring.profiles.active}")
|
// @Value("${spring.profiles.active}")
|
||||||
private String activeEnv;
|
// private String activeEnv;
|
||||||
@Bean
|
// @Bean
|
||||||
@Primary
|
// @Primary
|
||||||
public NacosDiscoveryProperties nacosProperties() throws UnknownHostException {
|
// public NacosDiscoveryProperties nacosProperties() throws UnknownHostException {
|
||||||
NacosDiscoveryProperties nacosDiscoveryProperties = new NacosDiscoveryProperties();
|
// NacosDiscoveryProperties nacosDiscoveryProperties = new NacosDiscoveryProperties();
|
||||||
if ("dev".equals(activeEnv)){
|
// if ("dev".equals(activeEnv)){
|
||||||
// 直接指定域名
|
// // 直接指定域名
|
||||||
String customIp = "120.46.37.243"; // 替换为你的域名
|
// String customIp = "120.46.37.243"; // 替换为你的域名
|
||||||
int customPort = 9091; // 替换为你的端口
|
// int customPort = 9091; // 替换为你的端口
|
||||||
nacosDiscoveryProperties.setIp(customIp);
|
// nacosDiscoveryProperties.setIp(customIp);
|
||||||
nacosDiscoveryProperties.setPort(customPort);
|
// nacosDiscoveryProperties.setPort(customPort);
|
||||||
}
|
// }
|
||||||
return nacosDiscoveryProperties;
|
// return nacosDiscoveryProperties;
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
@ -57,14 +57,20 @@ public class CheckTicketServiceImpl implements CheckTicketService {
|
|||||||
countMap.put("map"+String.format("%02d", Integer.parseInt(i+"")),0);
|
countMap.put("map"+String.format("%02d", Integer.parseInt(i+"")),0);
|
||||||
}
|
}
|
||||||
//查询该时间区域的所有数据
|
//查询该时间区域的所有数据
|
||||||
|
long s1 = System.currentTimeMillis();
|
||||||
List<CheckTicket> allByCheckticketdateBetween = checkTicketRepository.findAllByCheckticketdateBetween(starTime, this.publicMethod(endTime));
|
List<CheckTicket> allByCheckticketdateBetween = checkTicketRepository.findAllByCheckticketdateBetween(starTime, this.publicMethod(endTime));
|
||||||
|
long s2 = System.currentTimeMillis();
|
||||||
|
System.out.println("1-------------------------"+(s2-s1));
|
||||||
//分析数据
|
//分析数据
|
||||||
|
long s3 = System.currentTimeMillis();
|
||||||
for (CheckTicket checkTicket : allByCheckticketdateBetween) {
|
for (CheckTicket checkTicket : allByCheckticketdateBetween) {
|
||||||
String checktickettime = checkTicket.getChecktickettime();
|
String checktickettime = checkTicket.getChecktickettime();
|
||||||
String result = checktickettime.substring(0, 2);
|
String result = checktickettime.substring(0, 2);
|
||||||
Integer numberCount = countMap.get("map" + result);
|
Integer numberCount = countMap.get("map" + result);
|
||||||
countMap.put("map" + result, numberCount+1);
|
countMap.put("map" + result, numberCount+1);
|
||||||
}
|
}
|
||||||
|
long s4 = System.currentTimeMillis();
|
||||||
|
System.out.println("2--------------------------"+(s4-s3));
|
||||||
|
|
||||||
//构造数据结构
|
//构造数据结构
|
||||||
LocalDateTime startTime = LocalDateTime.now();
|
LocalDateTime startTime = LocalDateTime.now();
|
||||||
|
@ -164,6 +164,12 @@
|
|||||||
<artifactId>tika-core</artifactId> <!-- 文件客户端:文件类型的识别 -->
|
<artifactId>tika-core</artifactId> <!-- 文件客户端:文件类型的识别 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- feign客户端 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<!-- 设置构建的 jar 包名 -->
|
<!-- 设置构建的 jar 包名 -->
|
||||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.infra;
|
|||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目的启动类
|
* 项目的启动类
|
||||||
@ -13,6 +14,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@EnableFeignClients
|
||||||
public class InfraServerApplication {
|
public class InfraServerApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package cn.iocoder.yudao.module.infra.clients;
|
||||||
|
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@FeignClient("datacenter-server")
|
||||||
|
public interface LargeScreenClient {
|
||||||
|
@GetMapping("/api/asset/type")
|
||||||
|
List<Object> assetMethod1();
|
||||||
|
}
|
@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.ticketing;
|
|||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import cn.iocoder.yudao.framework.common.util.date.TickingDateUtils;
|
import cn.iocoder.yudao.framework.common.util.date.TickingDateUtils;
|
||||||
import cn.iocoder.yudao.module.infra.job.ticketing.TicketDataMigration;
|
import cn.iocoder.yudao.module.infra.job.ticketing.TicketDataMigration;
|
||||||
|
import cn.iocoder.yudao.module.infra.service.checkticket.CheckTicketService;
|
||||||
|
import cn.iocoder.yudao.module.infra.service.saledata.SaleDataService;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -10,6 +12,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description 测试抽数接口
|
* @Description 测试抽数接口
|
||||||
@ -22,6 +25,12 @@ public class TicketingController {
|
|||||||
@Resource
|
@Resource
|
||||||
TicketDataMigration ticketDataMigration;
|
TicketDataMigration ticketDataMigration;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CheckTicketService checkTicketService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
SaleDataService saleDataService;
|
||||||
|
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public CommonResult<String> testTicketing(@RequestParam("startDate") String startDate, @RequestParam("endDate")String endDate, @RequestParam("method") String method) throws Exception {
|
public CommonResult<String> testTicketing(@RequestParam("startDate") String startDate, @RequestParam("endDate")String endDate, @RequestParam("method") String method) throws Exception {
|
||||||
Calendar startCalendar = Calendar.getInstance();
|
Calendar startCalendar = Calendar.getInstance();
|
||||||
@ -30,4 +39,16 @@ public class TicketingController {
|
|||||||
endCalendar.setTime(TickingDateUtils.parse(endDate));
|
endCalendar.setTime(TickingDateUtils.parse(endDate));
|
||||||
return CommonResult.success(ticketDataMigration.getTicketDataByTimeZonesToMongo(startCalendar, endCalendar, method));
|
return CommonResult.success(ticketDataMigration.getTicketDataByTimeZonesToMongo(startCalendar, endCalendar, method));
|
||||||
}
|
}
|
||||||
|
@GetMapping("/test")
|
||||||
|
public CommonResult<List<String>> testAll(){
|
||||||
|
return CommonResult.success(checkTicketService.deleteTwoYearLastMonthAgo());
|
||||||
|
}
|
||||||
|
@GetMapping("/testa")
|
||||||
|
public CommonResult<List<String>> testAlla(){
|
||||||
|
return CommonResult.success(saleDataService.deleteTwoYearLastMonthAgo());
|
||||||
|
}
|
||||||
|
@GetMapping("/testSample")
|
||||||
|
public void testSample(){
|
||||||
|
ticketDataMigration.deleteTwoYearOneMonthAgoAndUpdateLastYearTomorrow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.infra.dal.mongodb.checkticket;
|
|||||||
|
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicket;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicket;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicketToday;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicketToday;
|
||||||
|
import org.springframework.data.mongodb.repository.Aggregation;
|
||||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||||
import org.springframework.data.mongodb.repository.Query;
|
import org.springframework.data.mongodb.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
@ -27,4 +28,20 @@ public interface CheckTicketTodayRepository extends MongoRepository<CheckTicketT
|
|||||||
*/
|
*/
|
||||||
@Query("{ 'checkticketdate': { $not: { $gte: ?0, $lt: ?1 } } }")
|
@Query("{ 'checkticketdate': { $not: { $gte: ?0, $lt: ?1 } } }")
|
||||||
List<CheckTicketToday> findNotInTimeRange(String startDate, String endDate);
|
List<CheckTicketToday> findNotInTimeRange(String startDate, String endDate);
|
||||||
|
/**
|
||||||
|
* 查询所有去重的 checkticketdate 字段值
|
||||||
|
* @return 去重后的 checkticketdate 字段值列表
|
||||||
|
*/
|
||||||
|
@Aggregation(pipeline = {
|
||||||
|
"{$group: {_id: '$checkticketdate'}}",
|
||||||
|
"{$project: {_id: 0, checkticketdate: '$_id'}}"
|
||||||
|
})
|
||||||
|
List<String> findDistinctDate();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除 checkticketdate 字段值在给定列表中的所有记录
|
||||||
|
* @param dates 日期列表
|
||||||
|
*/
|
||||||
|
@Query("{ 'checkticketdate': { $in: ?0 } }")
|
||||||
|
void deleteByCheckticketdateIn(List<String> dates);
|
||||||
}
|
}
|
||||||
|
@ -78,4 +78,13 @@ public interface SaleDataTodayRepository extends MongoRepository<SaleDataToday,S
|
|||||||
*/
|
*/
|
||||||
@Query("{ 'sddate': { $not: { $gte: ?0, $lt: ?1 } } }")
|
@Query("{ 'sddate': { $not: { $gte: ?0, $lt: ?1 } } }")
|
||||||
List<SaleDataToday> findNotInTimeRange(String startDate, String endDate);
|
List<SaleDataToday> findNotInTimeRange(String startDate, String endDate);
|
||||||
|
/**
|
||||||
|
* 查询所有去重的 sddate 字段值
|
||||||
|
* @return 去重后的 sddate 字段值列表
|
||||||
|
*/
|
||||||
|
@Aggregation(pipeline = {
|
||||||
|
"{$group: {_id: '$sddate'}}",
|
||||||
|
"{$project: {_id: 0, sddate: '$_id'}}"
|
||||||
|
})
|
||||||
|
List<String> findDistinctDate();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,28 @@
|
|||||||
|
package cn.iocoder.yudao.module.infra.job.largeScreenHeartbeat;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.infra.api.websocket.WebSocketSenderApi;
|
||||||
|
import cn.iocoder.yudao.module.infra.clients.LargeScreenClient;
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class LargeScreenHeartbeat {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private WebSocketSenderApi webSocketSenderApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private LargeScreenClient largeScreenClient;
|
||||||
|
|
||||||
|
@XxlJob("largeScreen")
|
||||||
|
public void largeScreenToWebSocket(){
|
||||||
|
List<Object> maps = largeScreenClient.assetMethod1();
|
||||||
|
webSocketSenderApi.sendObject(1,"1",maps);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -309,35 +309,23 @@ public class TicketDataMigration {
|
|||||||
@XxlJob("deleteTwoYearOneMonthAgoAndUpdateLastYearTomorrow")
|
@XxlJob("deleteTwoYearOneMonthAgoAndUpdateLastYearTomorrow")
|
||||||
public void deleteTwoYearOneMonthAgoAndUpdateLastYearTomorrow(){
|
public void deleteTwoYearOneMonthAgoAndUpdateLastYearTomorrow(){
|
||||||
XxlJobHelper.log("删除多余数据开始...");
|
XxlJobHelper.log("删除多余数据开始...");
|
||||||
// 检票数据今年多余删除
|
// 检票数据今年去年多余删除
|
||||||
Calendar today = Calendar.getInstance();
|
XxlJobHelper.log("删除检票日期为{}", checkTicketService.deleteTwoYearLastMonthAgo().toString());
|
||||||
Calendar thirtyDaysAgo = (Calendar) today.clone(); // 克隆当前日期
|
// 售票数据今年去年多余删除
|
||||||
thirtyDaysAgo.add(Calendar.DAY_OF_MONTH, -31);
|
XxlJobHelper.log("删除售票日期为{}", saleDataService.deleteTwoYearLastMonthAgo().toString());
|
||||||
List<String> thisYearCheckTicketList = checkTicketService.deleteNotInTimeZonesByMongoDB(TickingDateUtils.format(thirtyDaysAgo.getTime()), TickingDateUtils.format(today.getTime()));
|
|
||||||
XxlJobHelper.log("删除今年检票日期为{}", thisYearCheckTicketList.toString());
|
|
||||||
// 检票数据去年多余删除
|
|
||||||
Calendar lastYearToday = (Calendar) today.clone();
|
|
||||||
lastYearToday.add(Calendar.YEAR, -1);
|
|
||||||
Calendar lastYearThirtyDaysAgo = (Calendar) lastYearToday.clone();
|
|
||||||
lastYearThirtyDaysAgo.add(Calendar.DAY_OF_MONTH, -31);
|
|
||||||
List<String> lastYearCheckTicketList = checkTicketService.deleteNotInTimeZonesByMongoDB(TickingDateUtils.format(lastYearThirtyDaysAgo.getTime()), TickingDateUtils.format(lastYearToday.getTime()));
|
|
||||||
XxlJobHelper.log("删除去年检票日期为{}", lastYearCheckTicketList.toString());
|
|
||||||
// 售票数据今年多余删除
|
|
||||||
List<String> thisYearSaleDataList = saleDataService.deleteNotInTimeZonesByMongoDB(TickingDateUtils.format(thirtyDaysAgo.getTime()), TickingDateUtils.format(today.getTime()));
|
|
||||||
XxlJobHelper.log("删除今年售票日期为{}", thisYearSaleDataList.toString());
|
|
||||||
// 售票数据去年多余删除
|
|
||||||
List<String> lastYearSaleDataList = checkTicketService.deleteNotInTimeZonesByMongoDB(TickingDateUtils.format(lastYearThirtyDaysAgo.getTime()), TickingDateUtils.format(lastYearToday.getTime()));
|
|
||||||
XxlJobHelper.log("删除去年检票日期为{}", lastYearSaleDataList.toString());
|
|
||||||
// 抽取去年明天的检票和售票数据
|
// 抽取去年明天的检票和售票数据
|
||||||
Calendar lastYearTomorrow = (Calendar) lastYearToday.clone();
|
Calendar lastYearTomorrow = Calendar.getInstance();
|
||||||
lastYearTomorrow.add(Calendar.DAY_OF_MONTH, 1);
|
lastYearTomorrow.add(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
lastYearTomorrow.add(Calendar.YEAR, -1);
|
||||||
try {
|
try {
|
||||||
this.getTicketDataByTimeZonesToMongo(lastYearTomorrow, lastYearTomorrow, "checkTicket");
|
this.getTicketDataByTimeZonesToMongo(lastYearTomorrow, lastYearTomorrow, "checkTicket");
|
||||||
|
XxlJobHelper.log("抽取去年明天的检票数据成功,日期为{}", TickingDateUtils.format(lastYearTomorrow.getTime()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
XxlJobHelper.log("抽取去年明天的检票数据失败,日期为{}", TickingDateUtils.format(lastYearTomorrow.getTime()));
|
XxlJobHelper.log("抽取去年明天的检票数据失败,日期为{}", TickingDateUtils.format(lastYearTomorrow.getTime()));
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.getTicketDataByTimeZonesToMongo(lastYearTomorrow, lastYearTomorrow, "saleData");
|
this.getTicketDataByTimeZonesToMongo(lastYearTomorrow, lastYearTomorrow, "saleData");
|
||||||
|
XxlJobHelper.log("抽取去年明天的售票数据成功,日期为{}", TickingDateUtils.format(lastYearTomorrow.getTime()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
XxlJobHelper.log("抽取去年明天的售票数据失败,日期为{}", TickingDateUtils.format(lastYearTomorrow.getTime()));
|
XxlJobHelper.log("抽取去年明天的售票数据失败,日期为{}", TickingDateUtils.format(lastYearTomorrow.getTime()));
|
||||||
}
|
}
|
||||||
@ -413,6 +401,9 @@ public class TicketDataMigration {
|
|||||||
int currentDay = startDate.get(Calendar.DAY_OF_MONTH);
|
int currentDay = startDate.get(Calendar.DAY_OF_MONTH);
|
||||||
result.add(String.format("抽数服务:%d年%d月%d日:" + methodName + "数据抽数正常结束!总共:%d条数据,%d条数据重复,%d条数据插入成功!", currentYear, currentMonth, currentDay, totalRows, duplicatesCount, successCount));
|
result.add(String.format("抽数服务:%d年%d月%d日:" + methodName + "数据抽数正常结束!总共:%d条数据,%d条数据重复,%d条数据插入成功!", currentYear, currentMonth, currentDay, totalRows, duplicatesCount, successCount));
|
||||||
XxlJobHelper.log("抽数服务:{}年{}月{}日:{}数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", currentYear, currentMonth, currentDay, methodName, totalRows, duplicatesCount, successCount);
|
XxlJobHelper.log("抽数服务:{}年{}月{}日:{}数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", currentYear, currentMonth, currentDay, methodName, totalRows, duplicatesCount, successCount);
|
||||||
|
if (startDate.equals(endDate)){ // 如果日期相等,退出循环
|
||||||
|
break;
|
||||||
|
}
|
||||||
// 日期递增一天
|
// 日期递增一天
|
||||||
startDate.add(Calendar.DAY_OF_MONTH, 1);
|
startDate.add(Calendar.DAY_OF_MONTH, 1);
|
||||||
}
|
}
|
||||||
|
@ -47,4 +47,13 @@ public interface CheckTicketService {
|
|||||||
* @return java.util.List<java.lang.String> 删除的日期
|
* @return java.util.List<java.lang.String> 删除的日期
|
||||||
*/
|
*/
|
||||||
List<String> deleteNotInTimeZonesByMongoDB(String startDate,String endDate);
|
List<String> deleteNotInTimeZonesByMongoDB(String startDate,String endDate);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除两年上个月以前的数据(mongodb)
|
||||||
|
* @param
|
||||||
|
* @return java.util.List<java.lang.String>
|
||||||
|
*/
|
||||||
|
List<String> deleteTwoYearLastMonthAgo();
|
||||||
|
|
||||||
|
List<String> findDistinctDate();
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.checkticket;
|
package cn.iocoder.yudao.module.infra.service.checkticket;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.TickingDateUtils;
|
||||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicket;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicket;
|
||||||
@ -14,6 +15,7 @@ import com.baomidou.dynamic.datasource.annotation.Slave;
|
|||||||
import com.mongodb.MongoException;
|
import com.mongodb.MongoException;
|
||||||
import org.springframework.data.domain.Example;
|
import org.springframework.data.domain.Example;
|
||||||
import org.springframework.data.domain.ExampleMatcher;
|
import org.springframework.data.domain.ExampleMatcher;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
import org.springframework.data.mongodb.core.query.Criteria;
|
import org.springframework.data.mongodb.core.query.Criteria;
|
||||||
import org.springframework.data.mongodb.core.query.Query;
|
import org.springframework.data.mongodb.core.query.Query;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@ -42,6 +44,8 @@ public class CheckTicketServiceImpl implements CheckTicketService {
|
|||||||
private CheckTicketRepository checkTicketRepository;
|
private CheckTicketRepository checkTicketRepository;
|
||||||
@Resource
|
@Resource
|
||||||
private CheckTicketTodayRepository checkTicketTodayRepository;
|
private CheckTicketTodayRepository checkTicketTodayRepository;
|
||||||
|
@Resource
|
||||||
|
private MongoTemplate mongoTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createCheckTicket(CheckTicketDO checkTicketDO) {
|
public Long createCheckTicket(CheckTicketDO checkTicketDO) {
|
||||||
@ -116,4 +120,33 @@ public class CheckTicketServiceImpl implements CheckTicketService {
|
|||||||
return deletedDates;
|
return deletedDates;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> deleteTwoYearLastMonthAgo() {
|
||||||
|
List<String> totalDate = checkTicketTodayRepository.findDistinctDate();
|
||||||
|
List<String> exitDate = new ArrayList<>();
|
||||||
|
Calendar endDate = Calendar.getInstance();
|
||||||
|
Calendar endDateLastYear = (Calendar) endDate.clone();
|
||||||
|
endDateLastYear.add(Calendar.YEAR, -1);
|
||||||
|
for (int i = 0; i < 31; i++) {
|
||||||
|
exitDate.add(TickingDateUtils.format(endDate.getTime()));
|
||||||
|
exitDate.add(TickingDateUtils.format(endDateLastYear.getTime()));
|
||||||
|
endDate.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
|
endDateLastYear.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
|
}
|
||||||
|
List<String> filteredDate = totalDate.stream()
|
||||||
|
.filter(date -> !exitDate.contains(date))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
// TODO 使用这种方法删除会报错,暂时使用mongoTemplate进行删除
|
||||||
|
// checkTicketTodayRepository.deleteByCheckticketdateIn(filteredDate);
|
||||||
|
Query query = new Query();
|
||||||
|
query.addCriteria(Criteria.where("checkticketdate").in(filteredDate));
|
||||||
|
mongoTemplate.remove(query, "check_ticket_today");
|
||||||
|
return filteredDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> findDistinctDate() {
|
||||||
|
return checkTicketTodayRepository.findDistinctDate();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -49,4 +49,10 @@ public interface SaleDataService {
|
|||||||
* @return java.util.List<java.lang.String> 删除的日期
|
* @return java.util.List<java.lang.String> 删除的日期
|
||||||
*/
|
*/
|
||||||
List<String> deleteNotInTimeZonesByMongoDB(String startDate,String endDate);
|
List<String> deleteNotInTimeZonesByMongoDB(String startDate,String endDate);
|
||||||
|
/**
|
||||||
|
* 删除两年上个月以前的数据(mongodb)
|
||||||
|
* @param
|
||||||
|
* @return java.util.List<java.lang.String>
|
||||||
|
*/
|
||||||
|
List<String> deleteTwoYearLastMonthAgo();
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.infra.service.saledata;
|
package cn.iocoder.yudao.module.infra.service.saledata;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.util.date.TickingDateUtils;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicket;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicket;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicketToday;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicketToday;
|
||||||
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleData;
|
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleData;
|
||||||
@ -9,6 +10,9 @@ import cn.iocoder.yudao.module.infra.dal.mongodb.saledata.SaleDataRepository;
|
|||||||
import cn.iocoder.yudao.module.infra.dal.mongodb.saledata.SaleDataTodayRepository;
|
import cn.iocoder.yudao.module.infra.dal.mongodb.saledata.SaleDataTodayRepository;
|
||||||
import cn.iocoder.yudao.module.infra.dal.mysql.saledata.SaleDataMapper;
|
import cn.iocoder.yudao.module.infra.dal.mysql.saledata.SaleDataMapper;
|
||||||
import com.mongodb.MongoException;
|
import com.mongodb.MongoException;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
import org.springframework.data.mongodb.core.query.Criteria;
|
||||||
|
import org.springframework.data.mongodb.core.query.Query;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
@ -34,6 +38,9 @@ public class SaleDataServiceImpl implements SaleDataService {
|
|||||||
@Resource
|
@Resource
|
||||||
private SaleDataMapper saleDataMapper;
|
private SaleDataMapper saleDataMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private MongoTemplate mongoTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createSaleData(SaleDataDO saleDataDO) {
|
public Long createSaleData(SaleDataDO saleDataDO) {
|
||||||
// 插入
|
// 插入
|
||||||
@ -106,5 +113,27 @@ public class SaleDataServiceImpl implements SaleDataService {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return deletedDates;
|
return deletedDates;
|
||||||
}
|
}
|
||||||
|
@Override
|
||||||
|
public List<String> deleteTwoYearLastMonthAgo() {
|
||||||
|
List<String> totalDate = saleDataTodayRepository.findDistinctDate();
|
||||||
|
List<String> exitDate = new ArrayList<>();
|
||||||
|
Calendar endDate = Calendar.getInstance();
|
||||||
|
Calendar endDateLastYear = (Calendar) endDate.clone();
|
||||||
|
endDateLastYear.add(Calendar.YEAR, -1);
|
||||||
|
for (int i = 0; i < 31; i++) {
|
||||||
|
exitDate.add(TickingDateUtils.format(endDate.getTime()));
|
||||||
|
exitDate.add(TickingDateUtils.format(endDateLastYear.getTime()));
|
||||||
|
endDate.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
|
endDateLastYear.add(Calendar.DAY_OF_MONTH, -1);
|
||||||
|
}
|
||||||
|
List<String> filteredDate = totalDate.stream()
|
||||||
|
.filter(date -> !exitDate.contains(date))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
// TODO 使用这种方法删除会报错,暂时使用mongoTemplate进行删除
|
||||||
|
// checkTicketTodayRepository.deleteByCheckticketdateIn(filteredDate);
|
||||||
|
Query query = new Query();
|
||||||
|
query.addCriteria(Criteria.where("sddate").in(filteredDate));
|
||||||
|
mongoTemplate.remove(query, "sale_data_today");
|
||||||
|
return filteredDate;
|
||||||
|
}
|
||||||
}
|
}
|
@ -67,6 +67,9 @@ public class AuthController {
|
|||||||
@PermitAll
|
@PermitAll
|
||||||
@Operation(summary = "使用账号密码登录")
|
@Operation(summary = "使用账号密码登录")
|
||||||
public CommonResult<AuthLoginRespVO> login(@RequestBody @Valid AuthLoginReqVO reqVO) {
|
public CommonResult<AuthLoginRespVO> login(@RequestBody @Valid AuthLoginReqVO reqVO) {
|
||||||
|
// AuthLoginReqVO loginReqVO = new AuthLoginReqVO();
|
||||||
|
// loginReqVO.setPassword("admin123");
|
||||||
|
// loginReqVO.setUsername("admin");
|
||||||
return success(authService.login(reqVO));
|
return success(authService.login(reqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,8 @@ public class SecurityConfiguration {
|
|||||||
.antMatchers("/actuator/**").anonymous();
|
.antMatchers("/actuator/**").anonymous();
|
||||||
// RPC 服务的安全配置
|
// RPC 服务的安全配置
|
||||||
registry.antMatchers(ApiConstants.PREFIX + "/**").permitAll();
|
registry.antMatchers(ApiConstants.PREFIX + "/**").permitAll();
|
||||||
|
//登录接口
|
||||||
|
registry.antMatchers("/system/auth/login").permitAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user