Compare commits

..

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

37 changed files with 488 additions and 927 deletions

View File

@ -1,155 +0,0 @@
kind: pipeline # 定义对象类型还有secret和signature两种类型
type: docker # 定义流水线类型还有kubernetes、exec、ssh等类型
name: ludu-drone-images # 定义流水线名称
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 # 应用打包命令
- |
if [ "${service}" = "gateway" ] || [ "${service}" = "all" ]; then
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/
fi
if [ "${service}" = "system" ] || [ "${service}" = "all" ]; then
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/
fi
if [ "${service}" = "infra" ] || [ "${service}" = "all" ]; then
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/
fi
if [ "${service}" = "job" ] || [ "${service}" = "all" ]; then
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/
fi
if [ "${service}" = "ticketing" ] || [ "${service}" = "all" ]; then
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/
fi
if [ "${service}" = "parking" ] || [ "${service}" = "all" ]; then
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/
fi
if [ "${service}" = "datacenter" ] || [ "${service}" = "all" ]; then
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/
fi
- name: push-images
image: appleboy/drone-ssh # SSH工具镜像
settings:
host: 101.43.112.107 # 远程连接地址
username: root # 远程连接账号
password:
from_secret: ssh_password # 从Secret中读取SSH密码
port: 22 # 远程连接端口
command_timeout: 30m # 远程执行命令超时时间
script:
- |
deploy_service() {
local image_name=$1
local container_name=$2
if [[ -z "${image_name}" || -z "${container_name}" ]]; then
echo "Error: image_name or container_name is empty."
exit 1
fi
cd /ludu/build/${image_name}
docker stop ${container_name}
docker rm ${container_name}
docker rmi -f ${image_name}:1.0.0
docker buildx build -f Dockerfile -t ${image_name}:1.0.0 .
docker tag ${image_name}:1.0.0 120.46.37.243:8080/lundu/${image_name}:1.0.0
docker push 120.46.37.243:8080/lundu/${image_name}:1.0.0
}
if [ "${service}" = "gateway" ] || [ "${service}" = "all" ]; then
deploy_service "yudao-gateway" "yudao-gateway"
fi
if [ "${service}" = "system" ] || [ "${service}" = "all" ]; then
deploy_service "yudao-module-system" "yudao-system"
fi
if [ "${service}" = "infra" ] || [ "${service}" = "all" ]; then
deploy_service "yudao-module-infra" "yudao-infra"
fi
if [ "${service}" = "job" ] || [ "${service}" = "all" ]; then
deploy_service "ludu-job-admin" "ludu-job-admin"
fi
if [ "${service}" = "ticketing" ] || [ "${service}" = "all" ]; then
deploy_service "ludu-module-ticketing" "ludu-ticketing"
fi
if [ "${service}" = "parking" ] || [ "${service}" = "all" ]; then
deploy_service "ludu-module-parking" "ludu-parking"
fi
if [ "${service}" = "datacenter" ] || [ "${service}" = "all" ]; then
deploy_service "ludu-module-datacenter" "ludu-datacenter"
fi
- name: pull-image-and-run
image: appleboy/drone-ssh # SSH工具镜像
settings:
host: 121.36.203.133 # 远程连接地址
username: root # 远程连接账号
password:
from_secret: ssh_password3 # 从Secret中读取SSH密码
port: 22 # 远程连接端口
command_timeout: 20m # 远程执行命令超时时间
script:
- cd /ludu
- ./start_service.sh ${service}
volumes: # 定义流水线挂载目录,用于共享数据
- name: maven-build
host:
path: /ludu/maven/build # 从宿主机中挂载的目录
- name: maven-cache
host:
path: /ludu/maven/cache # 从宿主机中挂载的目录

View File

@ -50,7 +50,7 @@ steps: # 定义流水线执行步骤,这些步骤将顺序执行
- chmod +x run.sh
- ./run.sh || echo "job build failed"
- cd /root/ludu-cloud/ludu-module-datacenter/ludu-module-datacenter-biz/
- cd ludu-module-datacenter/ludu-module-datacenter-biz/
- chmod +x run.sh
- ./run.sh || echo "datacenter build failed"

View File

@ -3,14 +3,14 @@ app_name='ludu-job-admin'
app_version='1.0.0'
# 定义应用环境
#profile_active='prod'
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
echo '----stop container----'
docker stop ${app_name}
echo '----rm container----'
docker rm ${app_name}
echo '----rmi none image----'
docker rmi $(docker images -f "dangling=true" -q)
echo '----rm image----'
docker rmi ${app_name}:${app_version}
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
echo '----start container----'
docker run -d -p 48083:9090 --name ${app_name} --restart always ${app_name}:${app_version}
docker run -d -p 48084:9090 --name ${app_name} --memory 512m ${app_name}:${app_version}

View File

@ -22,7 +22,7 @@ import java.nio.charset.StandardCharsets;
@Component
public class OAuth2Client {
private static final String BASE_URL = "http://121.36.203.133/admin-api/system/oauth2";
private static final String BASE_URL = "https://mt.ptzykjgs.com/admin-api/system/oauth2";
/**
* 租户编号

View File

@ -21,7 +21,7 @@ import org.springframework.web.client.RestTemplate;
@Component
public class UserClient {
private static final String BASE_URL = "http://121.36.203.133/admin-api/system/oauth2/user";
private static final String BASE_URL = "https://mt.ptzykjgs.com/admin-api/system/oauth2/user";
// @Resource // 可优化注册一个 RestTemplate Bean然后注入
private final RestTemplate restTemplate = new RestTemplate();

View File

@ -20,7 +20,7 @@ logging:
spring:
cloud:
nacos:
server-addr: 172.19.0.1:8848
server-addr: crm.fjptzykj.com:8849
discovery:
namespace: ${spring.profiles.active} # 命名空间。这里使用 dev 开发环境
metadata:
@ -33,7 +33,7 @@ spring:
nacos:
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
config:
server-addr: 172.19.0.1:8848 # Nacos 服务器地址
server-addr: crm.fjptzykj.com:8849 # Nacos 服务器地址
namespace: ${spring.profiles.active} # 命名空间 dev 的ID不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId默认为 spring.application.name

View File

@ -23,7 +23,7 @@ $(function(){
title: I18n.system_tips,
content: ('已退出登录!' || I18n.logout_success)
});*/
window.location.href = "http://121.36.203.133/admin/logout"
window.location.href = "https://mt.ptzykjgs.com/admin/logout"
/*$.post(base_url + "/logout", function(data, status) {
if (data.code == "200") {
layer.msg( I18n.logout_success );

View File

@ -47,9 +47,9 @@
*/
function ssoLogin() {
const clientId = 'ludu-job-admin'; // 可以改写成,你的 clientId
const redirectUri = encodeURIComponent('http://121.36.203.133/xxl-job-admin/toLogin'); // 注意,需要使用 encodeURIComponent 编码地址
const redirectUri = encodeURIComponent('https://mt.ptzykjgs.com/xxl-job-admin/toLogin'); // 注意,需要使用 encodeURIComponent 编码地址
const responseType = 'code'; // 1授权码模式对应 code2简化模式对应 token
window.location.href = 'http://121.36.203.133/admin/sso?client_id=' + clientId
window.location.href = 'https://mt.ptzykjgs.com/admin/sso?client_id=' + clientId
+ '&redirect_uri=' + redirectUri
+ '&response_type=' + responseType;
}
@ -69,9 +69,9 @@
ssoLogin();
} else {
// 提交
const redirectUri = 'http://121.36.203.133/xxl-job-admin/toLogin'; // 需要修改成,你回调的地址,就是在 index.html 拼接的 redirectUri
const redirectUri = 'https://mt.ptzykjgs.com/xxl-job-admin/toLogin'; // 需要修改成,你回调的地址,就是在 index.html 拼接的 redirectUri
$.ajax({
url: "http://121.36.203.133/xxl-job-admin/auth/login-by-code?code=" + code
url: "https://mt.ptzykjgs.com/xxl-job-admin/auth/login-by-code?code=" + code
+ '&redirectUri=' + redirectUri,
method: 'POST',
success: function (result) {

View File

@ -2,14 +2,15 @@ app_name='ludu-module-datacenter'
# 定义应用版本
app_version='1.0.0'
# 定义应用环境
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
#profile_active='prod'
echo '----stop container----'
docker stop ${app_name}
echo '----rm container----'
docker rm ${app_name}
echo '----rmi none image----'
docker rmi $(docker images -f "dangling=true" -q)
echo '----rm image----'
docker rmi ${app_name}:${app_version}
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
echo '----start container----'
docker run -d -p 48092:48092 --name ${app_name} --restart always ${app_name}:${app_version}
docker run -d -p 48092:48092 --name ${app_name} ${app_name}:${app_version}

View File

@ -18,7 +18,7 @@ logging:
spring:
cloud:
nacos:
server-addr: 172.19.0.1:8848
server-addr: crm.fjptzykj.com:8849
discovery:
namespace: ${spring.profiles.active} # 命名空间。这里使用 dev 开发环境
metadata:
@ -31,7 +31,7 @@ spring:
nacos:
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
config:
server-addr: 172.19.0.1:8848 # Nacos 服务器地址
server-addr: crm.fjptzykj.com:8849 # Nacos 服务器地址
namespace: ${spring.profiles.active} # 命名空间 dev 的ID不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId默认为 spring.application.name

View File

@ -2,14 +2,15 @@ app_name='ludu-module-parking'
# 定义应用版本
app_version='1.0.0'
# 定义应用环境
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
#profile_active='prod'
echo '----stop container----'
docker stop ${app_name}
echo '----rm container----'
docker rm ${app_name}
echo '----rmi none image----'
docker rmi $(docker images -f "dangling=true" -q)
echo '----rm image----'
docker rmi ${app_name}:${app_version}
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
echo '----start container----'
docker run -d -p 48090:48090 --name ${app_name} --restart always ${app_name}:${app_version}
docker run -d -p 48090:48090 --name ${app_name} --memory 600m ${app_name}:${app_version}

View File

@ -18,7 +18,7 @@ logging:
spring:
cloud:
nacos:
server-addr: 172.19.0.1:8848
server-addr: crm.fjptzykj.com:8849
discovery:
namespace: ${spring.profiles.active} # 命名空间。这里使用 dev 开发环境
metadata:
@ -31,7 +31,7 @@ spring:
nacos:
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
config:
server-addr: 172.19.0.1:8848 # Nacos 服务器地址
server-addr: crm.fjptzykj.com:8849 # Nacos 服务器地址
namespace: ${spring.profiles.active} # 命名空间 dev 的ID不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId默认为 spring.application.name

View File

@ -2,14 +2,15 @@ app_name='ludu-module-ticketing'
# 定义应用版本
app_version='1.0.0'
# 定义应用环境
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
#profile_active='prod'
echo '----stop container----'
docker stop ${app_name}
echo '----rm container----'
docker rm ${app_name}
echo '----rmi none image----'
docker rmi $(docker images -f "dangling=true" -q)
echo '----rm image----'
docker rmi ${app_name}:${app_version}
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
echo '----start container----'
docker run -d -p 48088:48088 --name ${app_name} --restart always ${app_name}:${app_version}
docker run -d -p 48088:48088 --name ${app_name} --memory 600m ${app_name}:${app_version}

View File

@ -18,7 +18,7 @@ logging:
spring:
cloud:
nacos:
server-addr: 172.19.0.1:8848
server-addr: crm.fjptzykj.com:8849
discovery:
namespace: ${spring.profiles.active} # 命名空间。这里使用 dev 开发环境
metadata:
@ -31,7 +31,7 @@ spring:
nacos:
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
config:
server-addr: 172.19.0.1:8848 # Nacos 服务器地址
server-addr: crm.fjptzykj.com:8849 # Nacos 服务器地址
namespace: ${spring.profiles.active} # 命名空间 dev 的ID不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId默认为 spring.application.name

27
pom.xml
View File

@ -128,29 +128,18 @@
</plugins>
</build>
<!-- 使用 huawei / aliyun 的 Maven 源,提升下载速度 -->
<repositories>
<repository>
<id>public</id>
<name>aliyun nexus</name>
<id>huaweicloud</id>
<name>huawei</name>
<url>https://mirrors.huaweicloud.com/repository/maven/</url>
</repository>
<repository>
<id>aliyunmaven</id>
<name>aliyun</name>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>public</id>
<name>aliyun nexus</name>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>

View File

@ -1,82 +1,68 @@
version: '3.8'
version: '3'
services:
yudao-gateway:
image: 120.46.37.243:8080/lundu/yudao-gateway:1.0.0
image: yudao-gateway
container_name: yudao-gateway
networks:
- ludu_network
environment:
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
- SW_AGENT_NAME=yudao-gateway
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
volumes:
- /docker/yudao-cloud/logs:/root/logs/
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
restart: always
healthcheck:
test: [ "CMD","curl","-f","http://localhost:48080" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
ports:
- "48083:48080"
network_mode: host # 以主机网络环境运行
yudao-system:
image: 120.46.37.243:8080/lundu/yudao-module-system:1.0.0
image: yudao-module-system-biz
container_name: yudao-system
networks:
- ludu_network
environment:
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
- SW_AGENT_NAME=yudao-gateway
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
volumes:
- /docker/yudao-cloud/logs:/root/logs/
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
healthcheck:
test: [ "CMD","curl","-f","http://localhost:48081" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 120s
restart: always
depends_on:
yudao-gateway:
condition: service_healthy
ludu-job-admin:
image: 120.46.37.243:8080/lundu/ludu-job-admin:1.0.0
container_name: ludu-job-admin
networks:
- ludu_network
environment:
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
- SW_AGENT_NAME=yudao-gateway
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
volumes:
- /docker/yudao-cloud/logs:/root/logs/
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:9090 || exit 0"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
restart: always
ports:
- "48084:9090"
depends_on:
yudao-gateway:
condition: service_healthy
network_mode: host
yudao-infra:
image: 120.46.37.243:8080/lundu/yudao-module-infra:1.0.0
image: yudao-module-infra-biz
container_name: yudao-infra
networks:
- ludu_network
environment:
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
- SW_AGENT_NAME=yudao-gateway
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
volumes:
- /docker/yudao-cloud/logs:/root/logs/
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
restart: always
network_mode: host
healthcheck:
test: [ "CMD","curl","-f","http://localhost:48082" ]
interval: 30s
@ -86,75 +72,91 @@ services:
depends_on:
yudao-system:
condition: service_healthy
yudao-gateway:
condition: service_healthy
ludu-datacenter:
image: 120.46.37.243:8080/lundu/ludu-module-datacenter:1.0.0
container_name: ludu-datacenter
networks:
- ludu_network
yudao-report:
image: yudao-module-report-biz
container_name: yudao-report
environment:
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
- SW_AGENT_NAME=yudao-gateway
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
volumes:
- /docker/yudao-cloud/logs:/root/logs/
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
restart: always
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost:48092 || exit 0"]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
network_mode: host
depends_on:
yudao-gateway:
yudao-infra:
condition: service_healthy
ludu-parking:
image: 120.46.37.243:8080/lundu/ludu-module-parking:1.0.0
container_name: ludu-parking
networks:
- ludu_network
yudao-bpm:
image: yudao-module-bpm-biz
container_name: yudao-bpm
environment:
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
- SW_AGENT_NAME=yudao-gateway
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
volumes:
- /docker/yudao-cloud/logs:/root/logs/
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
restart: always
healthcheck:
test: [ "CMD","curl","-f","http://localhost:48090" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
network_mode: host
depends_on:
yudao-system:
yudao-infra:
condition: service_healthy
yudao-gateway:
condition: service_healthy
ludu-ticketing:
image: 120.46.37.243:8080/lundu/ludu-module-ticketing:1.0.0
container_name: ludu-ticketing
networks:
- ludu_network
yudao-pay:
image: yudao-module-pay-biz
container_name: yudao-pay
environment:
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
- SW_AGENT_NAME=yudao-gateway
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
volumes:
- /docker/yudao-cloud/logs:/root/logs/
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
restart: always
healthcheck:
test: [ "CMD","curl","-f","http://localhost:48088" ]
interval: 30s
timeout: 10s
retries: 5
start_period: 60s
network_mode: host
depends_on:
yudao-system:
yudao-infra:
condition: service_healthy
yudao-gateway:
yudao-mp:
image: yudao-module-mp-biz
container_name: yudao-mp
environment:
- TZ=Asia/Shanghai # 配置程序默认时区为上海(中国标准时间)
- JAVA_TOOL_OPTIONS=-javaagent:/data/skywalking/skywalking-agent/skywalking-agent.jar # 配置skywalking
- SW_AGENT_NAME=yudao-gateway
- SW_AGENT_TRACE_IGNORE_PATH=Redisson/PING,/actuator/**,/admin/**
- SW_AGENT_COLLECTOR_BACKEND_SERVICES=[YOUR_SKYWALKING_ADDR] # 请替换 your.skywalking.addr 为你的 skywalking 地址
- SPRING_PROFILES_ACTIVE=test # 指定程序运行环境
- SPRING_CLOUD_NACOS_CONFIG_SERVER_ADDR=[YOUR_NACOS_ADDR] # 配置中心地址
- SPRING_CLOUD_NACOS_CONFIG_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
- SPRING_CLOUD_NACOS_SERVER_ADDR=[YOUR_NACOS_ADDR] # 注册中心地址
- SPRING_CLOUD_NACOS_DISCOVERY_NAMESPACE=[YOUR_NAMESPACE] # 命名空间
volumes:
- /docker/yudao-cloud/logs:/root/logs/
- /data/skywalking/skywalking-agent:/data/skywalking/skywalking-agent
restart: always
network_mode: host
depends_on:
yudao-infra:
condition: service_healthy
networks:
ludu_network:
driver: bridge

View File

@ -1,93 +0,0 @@
#!/bin/bash
cd /ludu
# 定义要检查的服务和 URL
declare -A services=(
["mysql"]="http://101.43.112.107:3306"
["mongo"]="http://101.43.112.107:27017"
#["redis"]="http://101.43.112.107:6379"
["nacos"]="http://101.43.112.107/nacos/#"
)
# 检查服务是否可达
check_services() {
for service in "${!services[@]}"; do
url="${services[$service]}"
if ! curl --silent --fail "$url"; then
echo "Error: $service is not available at $url."
return 1
fi
done
return 0
}
# 从命令行参数获取服务类型
SERVICE_TYPE=$1
# 检查服务类型是否提供
if [ -z "$SERVICE_TYPE" ]; then
echo "Usage: $0 <service_type>"
exit 1
fi
# 检查端口是否全部可达
if check_services; then
# 根据服务类型启动不同的服务
case $SERVICE_TYPE in
"gateway")
docker-compose stop yudao-gateway
docker-compose rm yudao-gateway
docker-compose pull yudao-gateway
docker-compose up -d yudao-gateway
;;
"system")
docker-compose stop yudao-system
docker-compose rm yudao-system
docker-compose pull yudao-system
docker-compose up -d yudao-system
;;
"job")
docker-compose stop ludu-job-admin
docker-compose rm ludu-job-admin
docker-compose pull ludu-job-admin
docker-compose up -d ludu-job-admin
;;
"infra")
docker-compose stop yudao-infra
docker-compose rm yudao-infra
docker-compose pull yudao-infra
docker-compose up -d yudao-infra
;;
"datacenter")
docker-compose stop ludu-datacenter
docker-compose rm ludu-datacenter
docker-compose pull ludu-datacenter
docker-compose up -d ludu-datacenter
;;
"parking")
docker-compose stop ludu-parking
docker-compose rm ludu-parking
docker-compose pull ludu-parking
docker-compose up -d ludu-parking
;;
"ticketing")
docker-compose stop ludu-ticketing
docker-compose rm ludu-ticketing
docker-compose pull ludu-ticketing
docker-compose up -d ludu-ticketing
;;
"all")
docker-compose down
docker-compose pull
docker-compose up -d
;;
*)
echo "Invalid service type."
exit 1
;;
esac
echo "Started service: $SERVICE_TYPE"
else
echo "One or more required services are not available. Please check the dependencies."
fi

View File

@ -1,302 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<!--
| This is the configuration file for Maven. It can be specified at two levels:
|
| 1. User Level. This settings.xml file provides configuration for a single user,
| and is normally provided in ${user.home}/.m2/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -s /path/to/user/settings.xml
|
| 2. Global Level. This settings.xml file provides configuration for all Maven
| users on a machine (assuming they're all using the same Maven
| installation). It's normally provided in
| ${maven.conf}/settings.xml.
|
| NOTE: This location can be overridden with the CLI option:
|
| -gs /path/to/global/settings.xml
|
| The sections in this sample file are intended to give you a running start at
| getting the most out of your Maven installation. Where appropriate, the default
| values (values used when the setting is not specified) are provided.
|
|-->
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<!-- localRepository
| The path to the local repository maven will use to store artifacts.
|
| Default: ${user.home}/.m2/repository
<localRepository>/path/to/local/repo</localRepository>
-->
<localRepository>D:\Maven\apache-maven-3.5.2\repository</localRepository>
<!-- interactiveMode
| This will determine whether maven prompts you when it needs input. If set to false,
| maven will use a sensible default value, perhaps based on some other setting, for
| the parameter in question.
|
| Default: true
<interactiveMode>true</interactiveMode>
-->
<!-- offline
| Determines whether maven should attempt to connect to the network when executing a build.
| This will have an effect on artifact downloads, artifact deployment, and others.
|
| Default: false
<offline>false</offline>
-->
<!-- pluginGroups
| This is a list of additional group identifiers that will be searched when resolving plugins by their prefix, i.e.
| when invoking a command line like "mvn prefix:goal". Maven will automatically add the group identifiers
| "org.apache.maven.plugins" and "org.codehaus.mojo" if these are not already contained in the list.
|-->
<pluginGroups>
<!-- pluginGroup
| Specifies a further group identifier to use for plugin lookup.
<pluginGroup>com.your.plugins</pluginGroup>
-->
</pluginGroups>
<!-- proxies
| This is a list of proxies which can be used on this machine to connect to the network.
| Unless otherwise specified (by system property or command-line switch), the first proxy
| specification in this list marked as active will be used.
|-->
<proxies>
<!-- proxy
| Specification for one proxy, to be used in connecting to the network.
|
<proxy>
<id>optional</id>
<active>true</active>
<protocol>http</protocol>
<username>proxyuser</username>
<password>proxypass</password>
<host>proxy.host.net</host>
<port>80</port>
<nonProxyHosts>local.net|some.host.com</nonProxyHosts>
</proxy>
-->
</proxies>
<!-- servers
| This is a list of authentication profiles, keyed by the server-id used within the system.
| Authentication profiles can be used whenever maven must make a connection to a remote server.
|-->
<servers>
<!-- server
| Specifies the authentication information to use when connecting to a particular server, identified by
| a unique name within the system (referred to by the 'id' attribute below).
|
| NOTE: You should either specify username/password OR privateKey/passphrase, since these pairings are
| used together.
|
<server>
<id>deploymentRepo</id>
<username>repouser</username>
<password>repopwd</password>
</server>
-->
<!-- Another sample, using keys to authenticate.
<server>
<id>siteServer</id>
<privateKey>/path/to/private/key</privateKey>
<passphrase>optional; leave empty if not used.</passphrase>
</server>
-->
</servers>
<!-- mirrors
| This is a list of mirrors to be used in downloading artifacts from remote repositories.
|
| It works like this: a POM may declare a repository to use in resolving certain artifacts.
| However, this repository may have problems with heavy traffic at times, so people have mirrored
| it to several places.
|
| That repository definition will have a unique id, so we can create a mirror reference for that
| repository, to be used as an alternate download site. The mirror site will be the preferred
| server for that repository.
|-->
<mirrors>
<!-- mirror
| Specifies a repository mirror site to use instead of a given repository. The repository that
| this mirror serves has an ID that matches the mirrorOf element of this mirror. IDs are used
| for inheritance and direct lookup purposes, and must be unique across the set of mirrors.
|
<mirror>
<id>mirrorId</id>
<mirrorOf>repositoryId</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://my.repository.com/repo/path</url>
</mirror>
-->
<!-- <mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public</url>
</mirror> -->
<mirror>
<id>alimaven</id>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
<mirrorOf>central</mirrorOf>
</mirror>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/repositories/central/</url>
</mirror>
<mirror>
<id>repo2</id>
<mirrorOf>central</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://repo2.maven.org/maven2/</url>
</mirror>
<mirror>
<id>maven-default-http-blocker</id>
<mirrorOf>external:http:*</mirrorOf>
<name>Pseudo repository to mirror external repositories initially using HTTP.</name>
<url>http://0.0.0.0/</url>
<!-- <blocked>true</blocked> -->
</mirror>
</mirrors>
<!-- profiles
| This is a list of profiles which can be activated in a variety of ways, and which can modify
| the build process. Profiles provided in the settings.xml are intended to provide local machine-
| specific paths and repository locations which allow the build to work in the local environment.
|
| For example, if you have an integration testing plugin - like cactus - that needs to know where
| your Tomcat instance is installed, you can provide a variable here such that the variable is
| dereferenced during the build process to configure the cactus plugin.
|
| As noted above, profiles can be activated in a variety of ways. One way - the activeProfiles
| section of this document (settings.xml) - will be discussed later. Another way essentially
| relies on the detection of a system property, either matching a particular value for the property,
| or merely testing its existence. Profiles can also be activated by JDK version prefix, where a
| value of '1.4' might activate a profile when the build is executed on a JDK version of '1.4.2_07'.
| Finally, the list of active profiles can be specified directly from the command line.
|
| NOTE: For profiles defined in the settings.xml, you are restricted to specifying only artifact
| repositories, plugin repositories, and free-form properties to be used as configuration
| variables for plugins in the POM.
|
|-->
<profiles>
<!-- 设置默认JDK版本 -->
<!--<profile>
<id>jdk1.8</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.8</jdk>
</activation>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
<encoding>UTF-8</encoding>
</properties>
</profile> -->
<!-- profile
| Specifies a set of introductions to the build process, to be activated using one or more of the
| mechanisms described above. For inheritance purposes, and to activate profiles via <activatedProfiles/>
| or the command line, profiles have to have an ID that is unique.
|
| An encouraged best practice for profile identification is to use a consistent naming convention
| for profiles, such as 'env-dev', 'env-test', 'env-production', 'user-jdcasey', 'user-brett', etc.
| This will make it more intuitive to understand what the set of introduced profiles is attempting
| to accomplish, particularly when you only have a list of profile id's for debug.
|
| This profile example uses the JDK version to trigger activation, and provides a JDK-specific repo.
<profile>
<id>jdk-1.4</id>
<activation>
<jdk>1.4</jdk>
</activation>
<repositories>
<repository>
<id>jdk14</id>
<name>Repository for JDK 1.4 builds</name>
<url>http://www.myhost.com/maven/jdk14</url>
<layout>default</layout>
<snapshotPolicy>always</snapshotPolicy>
</repository>
</repositories>
</profile>
-->
<!--
| Here is another profile, activated by the system property 'target-env' with a value of 'dev',
| which provides a specific path to the Tomcat instance. To use this, your plugin configuration
| might hypothetically look like:
|
| ...
| <plugin>
| <groupId>org.myco.myplugins</groupId>
| <artifactId>myplugin</artifactId>
|
| <configuration>
| <tomcatLocation>${tomcatPath}</tomcatLocation>
| </configuration>
| </plugin>
| ...
|
| NOTE: If you just wanted to inject this configuration whenever someone set 'target-env' to
| anything, you could just leave off the <value/> inside the activation-property.
|
<profile>
<id>env-dev</id>
<activation>
<property>
<name>target-env</name>
<value>dev</value>
</property>
</activation>
<properties>
<tomcatPath>/path/to/tomcat/instance</tomcatPath>
</properties>
</profile>
-->
</profiles>
<!-- activeProfiles
| List of profiles that are active for all builds.
|
<activeProfiles>
<activeProfile>alwaysActiveProfile</activeProfile>
<activeProfile>anotherAlwaysActiveProfile</activeProfile>
</activeProfiles>
-->
</settings>

View File

@ -2,14 +2,15 @@ app_name='yudao-gateway'
# 定义应用版本
app_version='1.0.0'
# 定义应用环境
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
#profile_active='prod'
echo '----stop container----'
docker stop ${app_name}
echo '----rm container----'
docker rm ${app_name}
echo '----rmi none image----'
docker rmi $(docker images -f "dangling=true" -q)
echo '----rm image----'
docker rmi ${app_name}:${app_version}
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
echo '----start container----'
docker run -d -p 48081:48080 --name ${app_name} --restart always ${app_name}:${app_version}
docker run -d -p 48083:48080 --name ${app_name} --memory 512m ${app_name}:${app_version}

View File

@ -17,7 +17,7 @@ logging:
spring:
cloud:
nacos:
server-addr: 172.19.0.1:8848
server-addr: crm.fjptzykj.com:8849
discovery:
namespace: ${spring.profiles.active} # 命名空间。这里使用 dev 开发环境
metadata:

View File

@ -2,14 +2,15 @@ app_name='yudao-module-infra'
# 定义应用版本
app_version='1.0.0'
# 定义应用环境
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
#profile_active='prod'
echo '----stop container----'
docker stop ${app_name}
echo '----rm container----'
docker rm ${app_name}
echo '----rmi none image----'
docker rmi $(docker images -f "dangling=true" -q)
echo '----rm image----'
docker rmi ${app_name}:${app_version}
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
echo '----start container----'
docker run -d -p 48082:48082 --name ${app_name} --restart always ${app_name}:${app_version}
docker run -d -p 48082:48082 --name ${app_name} --memory 700m ${app_name}:${app_version}

View File

@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.infra.clients;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
@ -18,49 +17,4 @@ public interface LargeScreenClient {
@GetMapping("/api/checkticket")
Object checkTicketTotal(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
@GetMapping("/api/checkticket/qushi")
Object findByTimeTemp(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
@GetMapping("/api/saledata/thisyear")
Object thisYearNum(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
@GetMapping("/api/saledata/lastyear")
Object lastYearNum(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
@GetMapping("/api/saledata/gender")
Object findByGender(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
@GetMapping("/api/saledata/age")
Object findByage(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
@GetMapping("/api/saledata/lastyear/region")
Object lastYearFindByRegion(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
@GetMapping("/api/saledata/thisyear/region")
Object thisYearFindByRegion(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
@GetMapping("/api/saledata/salemethod")
Object findBySaleMethod(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
@GetMapping("/api/saledata/itemType")
Object findByItemType(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
// @GetMapping("/api/saledata/gender")
// Object findByWuYi(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
//
// @GetMapping("/api/saledata/gender")
// Object findByGuoQing(@RequestParam("starTime") String starTime, @RequestParam("endTime") String endTime);
//
// @GetMapping("/api/saledata/rijunthisyear/{startTime}")
// Object findThisYearRiJun(@PathVariable("startTime") String startTime);
//
// @GetMapping("/api/saledata/rijunlastyear/{startTime}")
// Object findLastYearRiJun(@PathVariable("startTime") String startTime);
@GetMapping("/api/saledata/thisyear/nianjun")
Object findMoneyThisYear();
@GetMapping("/api/saledata/lastyear/nianjun")
Object findMoneyLastYear();
}

View File

@ -12,6 +12,7 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@ -40,50 +41,42 @@ public class TicketingController {
private LargeScreenClient largeScreenClient;
@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 endCalendar = Calendar.getInstance();
startCalendar.setTime(TickingDateUtils.parse(startDate));
endCalendar.setTime(TickingDateUtils.parse(endDate));
return CommonResult.success(ticketDataMigration.getTicketDataByTimeZonesToMongo(startCalendar, endCalendar, method));
}
@GetMapping("/2")
public CommonResult<String> testTicketing2(@RequestParam("method") String method) throws Exception {
Calendar startCalendar = Calendar.getInstance();
startCalendar.add(Calendar.DAY_OF_MONTH, 1);
startCalendar.add(Calendar.YEAR, -1);
return CommonResult.success(ticketDataMigration.getTicketDataByTimeZonesToMongo(startCalendar, startCalendar, method));
@GetMapping("/test1")
public CommonResult<List<String>> testAll(){
return CommonResult.success(checkTicketService.deleteTwoYearLastMonthAgo());
}
@GetMapping("/intoMysql")
public CommonResult<String> testTicketingMysql(@RequestParam("startDate") String startDate, @RequestParam("endDate") String endDate, @RequestParam("method") String method) throws Exception {
return CommonResult.success("");
private void methodUtils(Map<String, Object> map, String name, Object list){
map.put(name,list);
}
private void methodUtils(Map<String, Object> map, String name, Object list) {
map.put(name, list);
}
private String methodDataUtils() {
private String methodDataUtils(){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
LocalDateTime now = LocalDateTime.now();
return now.format(formatter);
}
@GetMapping("/test")
public void test() {
public void test(){
Map<String, Object> map = new HashMap<>();
String dataUtils = this.methodDataUtils();
this.methodUtils(map, "assetCount", largeScreenClient.assetMethod1());
this.methodUtils(map, "saleDataTotal", largeScreenClient.saleDataTotal(dataUtils, dataUtils));
this.methodUtils(map, "checkTicketTotal", largeScreenClient.checkTicketTotal(dataUtils, dataUtils));
webSocketSenderApi.sendObject(2, 1L, "1", map);
this.methodUtils(map,"saleDataTotal",largeScreenClient.saleDataTotal(dataUtils,dataUtils));
this.methodUtils(map,"checkTicketTotal",largeScreenClient.checkTicketTotal(dataUtils,dataUtils));
webSocketSenderApi.sendObject(2,1L,"1",map);
}
@GetMapping("/testa")
public CommonResult<List<String>> testAlla() {
public CommonResult<List<String>> testAlla(){
return CommonResult.success(saleDataService.deleteTwoYearLastMonthAgo());
}
@GetMapping("/testSample")
public void testSample(){
ticketDataMigration.deleteTwoYearOneMonthAgoAndUpdateLastYearTomorrow();
}
}

View File

@ -5,7 +5,6 @@ import cn.iocoder.yudao.module.infra.dal.dataobject.db.DataSourceConfigDO;
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenFrontTypeEnum;
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenSceneEnum;
import cn.iocoder.yudao.module.infra.enums.codegen.CodegenTemplateTypeEnum;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
@ -29,7 +28,7 @@ public class CodegenTableDO extends BaseDO {
/**
* ID 编号
*/
@TableId(type = IdType.AUTO)
@TableId
private Long id;
/**

View File

@ -7,7 +7,6 @@ import cn.iocoder.yudao.module.infra.controller.checkticket.vo.CheckTicketPageRe
import cn.iocoder.yudao.module.infra.dal.dataobject.checkticket.CheckTicketDO;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 检票 Mapper
@ -33,10 +32,4 @@ public interface CheckTicketMapper extends BaseMapperX<CheckTicketDO> {
.orderByDesc(CheckTicketDO::getId));
}
/**
* 根据检票日期物理删除数据
* @param checkticketdate
* @return java.lang.Integer
*/
Integer physicalDeleteByCheckticketdate(@Param("checkticketdate") String checkticketdate);
}

View File

@ -6,7 +6,10 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.infra.controller.saledata.vo.SaleDataPageReqVO;
import cn.iocoder.yudao.module.infra.dal.dataobject.saledata.SaleDataDO;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import java.util.List;
import java.util.Map;
@ -40,11 +43,4 @@ public interface SaleDataMapper extends BaseMapperX<SaleDataDO> {
.likeIfPresent(SaleDataDO::getSalepropetyvaluename, reqVO.getSalepropetyvaluename())
.orderByDesc(SaleDataDO::getId));
}
/**
* 根据销售日期物理删除
* @param sddate
* @return java.lang.Integer
*/
Integer physicalDeleteBySddate(@Param("sddate") String sddate);
}

View File

@ -40,17 +40,6 @@ public class LargeScreenHeartbeat {
this.methodUtils(map, "assetCount", largeScreenClient.assetMethod1());
this.methodUtils(map,"saleDataTotal",largeScreenClient.saleDataTotal(dataUtils,dataUtils));
this.methodUtils(map,"checkTicketTotal",largeScreenClient.checkTicketTotal(dataUtils,dataUtils));
this.methodUtils(map,"findByTimeTemp",largeScreenClient.findByTimeTemp(dataUtils,dataUtils));
this.methodUtils(map,"thisYearNum",largeScreenClient.thisYearNum(dataUtils,dataUtils));
this.methodUtils(map,"lastYearNum",largeScreenClient.lastYearNum(dataUtils,dataUtils));
this.methodUtils(map,"findByGender",largeScreenClient.findByGender(dataUtils,dataUtils));
this.methodUtils(map,"findByage",largeScreenClient.findByage(dataUtils,dataUtils));
this.methodUtils(map,"lastYearFindByRegion",largeScreenClient.lastYearFindByRegion(dataUtils,dataUtils));
this.methodUtils(map,"thisYearFindByRegion",largeScreenClient.thisYearFindByRegion(dataUtils,dataUtils));
this.methodUtils(map,"findBySaleMethod",largeScreenClient.findBySaleMethod(dataUtils,dataUtils));
this.methodUtils(map,"findByItemType",largeScreenClient.findByItemType(dataUtils,dataUtils));
this.methodUtils(map,"findMoneyThisYear",largeScreenClient.findMoneyThisYear());
this.methodUtils(map,"findMoneyLastYear",largeScreenClient.findMoneyLastYear());
webSocketSenderApi.sendObject(2,1L,"1",map);
}

View File

@ -59,67 +59,109 @@ public class TicketDataMigration {
* 存入售票数据的定时任务mysql
*/
@XxlJob("getSaleData")
public String getSaleDataHandler() throws Exception {
public void getSaleDataHandler() throws Exception {
int failedCount = 0;
int pageNumber = 1;
StringJoiner result = new StringJoiner("\n");
XxlJobHelper.log("抽数服务mysql售票数据开始抽数...");
result.add("抽数服务mysql售票数据开始抽数...");
XxlJobHelper.log("抽数服务mysql销售数据开始抽数...");
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
if (ticketingSamplingRespVO == null) {
XxlJobHelper.log("日期:{}暂无数据!", TickingDateUtils.getPreviousDayFormat());
result.add("日期:" + TickingDateUtils.getPreviousDayFormat() + "暂无数据!");
return result.toString();
XxlJobHelper.log("暂无数据!");
return;
}
int totalRows = ticketingSamplingRespVO.getTotalRows();
List<Map<String, Object>> mapList;
List<Map<String, Object>> mapList = ticketingSamplingRespVO.getDataMapList();
// 总条数小于等于每页条数 则直接按照总条数进行插入即可
if (totalRows <= PAGE_SIZE) {
failedCount += insertSaleData(mapList, totalRows, pageNumber);
} else {
// 总条数大于每页条数 执行完第一次插入后根据返回的页数继续进行请求和插入
// 插入第一页的数据
failedCount += insertSaleData(mapList, PAGE_SIZE, pageNumber);
pageNumber++;
// 获得总页数
int totalPages = ticketingSamplingRespVO.getTotalPages();
// 处理剩余页的数据
for (; pageNumber <= totalPages; pageNumber++) {
ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
mapList = ticketingSamplingRespVO.getDataMapList();
// 对最后一页进行处理得到最后一页的实际条数
if (!saleDataService.createSaleData(BeanUtils.toBean(mapList, SaleDataDO.class))) {
failedCount += ticketingSamplingRespVO.getPageSize();
if (pageNumber != totalPages) {
failedCount += insertSaleData(mapList, PAGE_SIZE, pageNumber);
} else {
failedCount += insertSaleData(mapList, totalRows % PAGE_SIZE, pageNumber);
}
}
if (failedCount != 0) {
XxlJobHelper.handleFail("总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!即将重试......");
result.add("总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!即将重试......");
return result.toString();
}
if (!saleDataService.dataValidation(TickingDateUtils.getPreviousDayFormat())) {
XxlJobHelper.log("mysql和mongo数据验证不一致重新进行mongo抽数中......");
result.add("mysql和mongo数据验证不一致重新进行mongo抽数中......");
Calendar yesterday = Calendar.getInstance();
yesterday.add(Calendar.DAY_OF_MONTH, -1);
getTicketDataByTimeZonesToMongo(yesterday, yesterday, "saleData");
if (!saleDataService.dataValidation(TickingDateUtils.getPreviousDayFormat())) {
XxlJobHelper.handleFail("日期:" + TickingDateUtils.getPreviousDayFormat() + "中mongo和mysql售票数据不一致");
result.add("日期:" + TickingDateUtils.getPreviousDayFormat() + "中mongo和mysql售票数据不一致");
XxlJobHelper.log("mysql和mongo数据验证不一致");
XxlJobHelper.log("重新抽取({})mongo数据", TickingDateUtils.getPreviousDayFormat());
getSaleDataByMongoDBHandler();
XxlJobHelper.log("抽数完,比对结果:{}", saleDataService.dataValidation(TickingDateUtils.getPreviousDayFormat()) ? "相等" : "不想等");
}
}
XxlJobHelper.log("抽数服务:售票数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
result.add("抽数服务:售票数据抽数正常结束!总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!");
return result.toString();
XxlJobHelper.log("抽数服务:销售数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
}
/**
* 存入检票数据的定时任务mysql
*/
@XxlJob("getCheckTicket")
public String getCheckTicketHandler() throws Exception {
public void getCheckTicketHandler() throws Exception {
int failedCount = 0;
int pageNumber = 1;
StringJoiner result = new StringJoiner("\n");
result.add("抽数服务mysql检票数据开始抽数...");
XxlJobHelper.log("抽数服务mysql检票数据开始抽数...");
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
if (ticketingSamplingRespVO == null) {
XxlJobHelper.log("日期:{}暂无数据!", TickingDateUtils.getPreviousDayFormat());
result.add("日期:" + TickingDateUtils.getPreviousDayFormat() + "暂无数据!");
return result.toString();
XxlJobHelper.log("暂无数据!");
return;
}
int totalRows = ticketingSamplingRespVO.getTotalRows();
List<Map<String, Object>> mapList = ticketingSamplingRespVO.getDataMapList();
// 总条数小于等于每页条数 则直接按照总条数进行插入即可
if (totalRows <= PAGE_SIZE) {
failedCount += insertCheckTicket(mapList, totalRows, pageNumber);
} else {
// 总条数大于每页条数 执行完第一次插入后根据返回的页数继续进行请求和插入
// 插入第一页的数据
failedCount += insertCheckTicket(mapList, PAGE_SIZE, pageNumber);
pageNumber++;
// 获得总页数
int totalPages = ticketingSamplingRespVO.getTotalPages();
// 处理剩余页的数据
for (; pageNumber <= totalPages; pageNumber++) {
ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
mapList = ticketingSamplingRespVO.getDataMapList();
// 对最后一页进行处理得到最后一页的实际条数
if (pageNumber != totalPages) {
failedCount += insertCheckTicket(mapList, PAGE_SIZE, pageNumber);
} else {
failedCount += insertCheckTicket(mapList, totalRows % PAGE_SIZE, pageNumber);
}
}
}
if (!checkTicketService.dataValidation(TickingDateUtils.getPreviousDayFormat())) {
XxlJobHelper.log("mysql和mongo数据验证不一致");
XxlJobHelper.log("重新抽取({})mongo数据", TickingDateUtils.getPreviousDayFormat());
getCheckTicketByMongoDBHandler();
XxlJobHelper.log("抽数完,比对结果:{}", checkTicketService.dataValidation(TickingDateUtils.getPreviousDayFormat()) ? "相等" : "不想等");
}
XxlJobHelper.log("抽数服务:检票数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
}
/**
* 存入销售数据的定时任务mongodb
*/
@XxlJob("getSaleDataByMongoDB")
public void getSaleDataByMongoDBHandler() throws Exception {
int successCount = 0;
int duplicatesCount = 0;
int pageNumber = 1;
XxlJobHelper.log("抽数服务mongodb销售数据开始抽数...");
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, TickingDateUtils.getNowDayFormat(), pageNumber);
if (ticketingSamplingRespVO == null) {
XxlJobHelper.log("暂无数据!");
return;
}
int totalRows = ticketingSamplingRespVO.getTotalRows();
List<Map<String, Object>> mapList;
@ -127,51 +169,164 @@ public class TicketDataMigration {
int totalPages = ticketingSamplingRespVO.getTotalPages();
// 处理剩余页的数据
for (; pageNumber <= totalPages; pageNumber++) {
ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, TickingDateUtils.getPreviousDayFormat(), pageNumber);
ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, TickingDateUtils.getNowDayFormat(), pageNumber);
mapList = ticketingSamplingRespVO.getDataMapList();
if (!checkTicketService.createCheckTicket(BeanUtils.toBean(mapList, CheckTicketDO.class))) {
failedCount += ticketingSamplingRespVO.getPageSize();
List<Integer> resultNum = saleDataService.insertTodayByMongoDB(BeanUtils.toBean(mapList, SaleDataToday.class));
if (resultNum == null) {
XxlJobHelper.log("数据批量插入异常!", pageNumber);
} else {
successCount += resultNum.get(0);
duplicatesCount += resultNum.get(1);
}
}
if (failedCount != 0) {
XxlJobHelper.handleFail("总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!即将重试......");
result.add("总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!即将重试......");
return result.toString();
}
if (!checkTicketService.dataValidation(TickingDateUtils.getPreviousDayFormat())) {
XxlJobHelper.log("mysql和mongo数据验证不一致重新进行mongo抽数中......");
result.add("mysql和mongo数据验证不一致重新进行mongo抽数中......");
Calendar yesterday = Calendar.getInstance();
yesterday.add(Calendar.DAY_OF_MONTH, -1);
getTicketDataByTimeZonesToMongo(yesterday, yesterday, "checkTicket");
if (!checkTicketService.dataValidation(TickingDateUtils.getPreviousDayFormat())) {
XxlJobHelper.handleFail("日期:" + TickingDateUtils.getPreviousDayFormat() + "中mongo和mysql检票数据不一致");
result.add("日期:" + TickingDateUtils.getPreviousDayFormat() + "中mongo和mysql检票数据不一致");
}
}
XxlJobHelper.log("抽数服务:检票数据抽数正常结束!总共:{}条数据,{}条数据插入失败!", totalRows, failedCount);
result.add("抽数服务:检票数据抽数正常结束!总共:" + totalRows + "条数据," + failedCount + "条数据插入失败!");
return result.toString();
}
/**
* 存入销售数据的定时任务mongodb
*/
@XxlJob("getSaleDataByMongoDB")
public String getSaleDataByMongoDBHandler() throws Exception {
Calendar now = Calendar.getInstance();
return getTicketDataByTimeZonesToMongo(now, now, "saleData");
XxlJobHelper.log("抽数服务:检票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", totalRows, duplicatesCount, successCount);
}
/**
* 存入检票数据的定时任务mongodb
*/
@XxlJob("getCheckTicketByMongoDB")
public String getCheckTicketByMongoDBHandler() throws Exception {
Calendar now = Calendar.getInstance();
return getTicketDataByTimeZonesToMongo(now, now, "checkTicket");
public void getCheckTicketByMongoDBHandler() throws Exception {
XxlJobHelper.log("抽数服务mongodb检票数据开始抽数...");
int successCount = 0;
int duplicatesCount = 0;
int pageNumber = 1;
String date = TickingDateUtils.getNowDayFormat();
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, date, pageNumber);
if (ticketingSamplingRespVO == null) {
XxlJobHelper.log("暂无数据!");
return;
}
int totalRows = ticketingSamplingRespVO.getTotalRows();
List<Map<String, Object>> mapList;
// 获得总页数
int totalPages = ticketingSamplingRespVO.getTotalPages();
// 处理剩余页的数据
for (; pageNumber <= totalPages; pageNumber++) {
ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, date, pageNumber);
mapList = ticketingSamplingRespVO.getDataMapList();
List<Integer> resultNum = checkTicketService.insertTodayByMongoDB(BeanUtils.toBean(mapList, CheckTicketToday.class));
if (resultNum == null) {
XxlJobHelper.log("数据批量插入异常!", pageNumber);
} else {
successCount += resultNum.get(0);
duplicatesCount += resultNum.get(1);
}
}
XxlJobHelper.log("抽数服务:检票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", totalRows, duplicatesCount, successCount);
}
@XxlJob("getCheckTicketByMongoDBLastMonthToNow")
public void getCheckTicketByMongoDBLastMonthToNow() throws Exception {
XxlJobHelper.log("抽数服务mongodb检票数据开始抽数...");
int successCount;
int duplicatesCount;
int pageNumber;
// 获取当前日期
Calendar startDate = Calendar.getInstance();
// 设置开始日期为上一个月的第一天
startDate.set(Calendar.DAY_OF_MONTH, 1); // 先将日期设置为当前月的第一天
startDate.add(Calendar.MONTH, -1); // 然后减去一个月
// 设置结束日期为今天
Calendar endDate = Calendar.getInstance();
// 循环从开始日期到结束日期
while (!startDate.after(endDate)) {
successCount = 0;
duplicatesCount = 0;
String dateString = TickingDateUtils.format(startDate.getTime());
pageNumber = 1;
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, dateString, pageNumber);
if (ticketingSamplingRespVO == null) {
startDate.add(Calendar.DAY_OF_MONTH, 1);
continue;
}
int totalRows = ticketingSamplingRespVO.getTotalRows();
List<Map<String, Object>> mapList;
// 获得总页数
int totalPages = ticketingSamplingRespVO.getTotalPages();
// 处理剩余页的数据
for (; pageNumber <= totalPages; pageNumber++) {
ticketingSamplingRespVO = this.getUrlResponseData(CHECK_TICKET_SERVICE, CHECK_TICKET_METHOD, dateString, pageNumber);
mapList = ticketingSamplingRespVO.getDataMapList();
List<Integer> resultNum = checkTicketService.insertByMongoDB(BeanUtils.toBean(mapList, CheckTicket.class));
if (resultNum == null) {
XxlJobHelper.log("数据批量插入异常!", pageNumber);
} else {
successCount += resultNum.get(0);
duplicatesCount += resultNum.get(1);
}
}
int currentMonth = startDate.get(Calendar.MONTH) + 1; // 加1以得到1-12的月份
int currentDay = startDate.get(Calendar.DAY_OF_MONTH);
XxlJobHelper.log("抽数服务:{}月{}日:检票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", currentMonth, currentDay, totalRows, duplicatesCount, successCount);
// 日期递增一天
startDate.add(Calendar.DAY_OF_MONTH, 1);
}
XxlJobHelper.log("抽数结束!!!");
}
@XxlJob("getSaleDataByMongoDBLastMonthToNow")
public void getSaleDataByMongoDBLastMonthToNow() throws Exception {
XxlJobHelper.log("抽数服务mongodb售票数据开始抽数...");
int successCount;
int duplicatesCount;
int pageNumber;
// 获取当前日期
Calendar startDate = Calendar.getInstance();
// 设置开始日期为上一个月的第一天
startDate.set(Calendar.DAY_OF_MONTH, 1); // 先将日期设置为当前月的第一天
startDate.add(Calendar.MONTH, -1); // 然后减去一个月
// 设置结束日期为今天
Calendar endDate = Calendar.getInstance();
// 循环从开始日期到结束日期
while (!startDate.after(endDate)) {
successCount = 0;
duplicatesCount = 0;
String dateString = TickingDateUtils.format(startDate.getTime());
pageNumber = 1;
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, dateString, pageNumber);
if (ticketingSamplingRespVO == null) {
startDate.add(Calendar.DAY_OF_MONTH, 1);
continue;
}
int totalRows = ticketingSamplingRespVO.getTotalRows();
List<Map<String, Object>> mapList;
// 获得总页数
int totalPages = ticketingSamplingRespVO.getTotalPages();
// 处理剩余页的数据
for (; pageNumber <= totalPages; pageNumber++) {
ticketingSamplingRespVO = this.getUrlResponseData(SALE_DATA_SERVICE, SALE_DATA_METHOD, dateString, pageNumber);
mapList = ticketingSamplingRespVO.getDataMapList();
List<Integer> resultNum = saleDataService.insertByMongoDB(BeanUtils.toBean(mapList, SaleData.class));
if (resultNum == null) {
XxlJobHelper.log("数据批量插入异常!", pageNumber);
} else {
successCount += resultNum.get(0);
duplicatesCount += resultNum.get(1);
}
}
int currentMonth = startDate.get(Calendar.MONTH) + 1; // 加1以得到1-12的月份
int currentDay = startDate.get(Calendar.DAY_OF_MONTH);
XxlJobHelper.log("抽数服务:{}月{}日:售票数据抽数正常结束!总共:{}条数据,{}条数据重复,{}条数据插入成功!", currentMonth, currentDay, totalRows, duplicatesCount, successCount);
// 日期递增一天
startDate.add(Calendar.DAY_OF_MONTH, 1);
}
XxlJobHelper.log("抽数结束!!!");
}
/**
* 删除今年和去年往前推31天外的数据和抽取去年明天的数据
@ -241,10 +396,6 @@ public class TicketDataMigration {
TicketingSamplingRespVO ticketingSamplingRespVO = this.getUrlResponseData(respService, respMethod, dateString, pageNumber);
if (ticketingSamplingRespVO == null) {
startDate.add(Calendar.DAY_OF_MONTH, 1);
result.add("日期:" + TickingDateUtils.format(startDate.getTime()) + "返回无值");
if (startDate.equals(endDate)) { // 如果日期相等退出循环
break;
}
continue;
}
int totalRows = ticketingSamplingRespVO.getTotalRows();
@ -286,6 +437,48 @@ public class TicketDataMigration {
return result.toString();
}
/**
* 插入销售数据的方法mysql
*
* @param mapList 数据集合数组
* @param listSize 实际个数
* @param pageNumber 每页显示条数
* @return int 失败条数
*/
private int insertSaleData(List<Map<String, Object>> mapList, int listSize, int pageNumber) {
int failedCount = 0;
for (int i = 0; i < listSize; i++) {
Map<String, Object> currentMap = mapList.get(i);
SaleDataDO saleDataDO = BeanUtils.toBean(currentMap, SaleDataDO.class);
if (saleDataService.createSaleData(saleDataDO) == 0) {
failedCount++;
XxlJobHelper.log("第{}条数据插入失败,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
}
}
return failedCount;
}
/**
* 插入检票数据的方法mysql
*
* @param mapList 数据集合数组
* @param listSize 实际个数
* @param pageNumber 每页显示条数
* @return int 失败条数
*/
private int insertCheckTicket(List<Map<String, Object>> mapList, int listSize, int pageNumber) {
int failedCount = 0;
for (int i = 0; i < listSize; i++) {
Map<String, Object> currentMap = mapList.get(i);
CheckTicketDO checkTicketDO = BeanUtils.toBean(currentMap, CheckTicketDO.class);
if (checkTicketService.createCheckTicket(checkTicketDO) == 0) {
failedCount++;
XxlJobHelper.log("第{}条数据插入失败,数据值为:{}", ((pageNumber - 1) * PAGE_SIZE + i + 1), currentMap);
}
}
return failedCount;
}
/**
* 请求目标url的响应数据
*
@ -326,4 +519,14 @@ public class TicketDataMigration {
return ticketingSamplingRespVO;
}
/**
* 校验数据
*
* @param date
* @return java.lang.Boolean
*/
public Boolean dataValidation(String date) {
return checkTicketService.dataValidation(date) && saleDataService.dataValidation(date);
}
}

View File

@ -19,10 +19,12 @@ import java.util.Map;
public interface CheckTicketService {
/**
* 批量插入检票数据(mysql)
* 创建检票
*
* @param createReqVO 创建信息
* @return 编号
*/
Boolean createCheckTicket(List<CheckTicketDO> checkTicketDOList);
Long createCheckTicket(@Valid CheckTicketDO createReqVO);
/**
* 查询重复的dataId(mongodb)

View File

@ -48,10 +48,11 @@ public class CheckTicketServiceImpl implements CheckTicketService {
private MongoTemplate mongoTemplate;
@Override
public Boolean createCheckTicket(List<CheckTicketDO> checkTicketDOList) {
checkTicketMapper.physicalDeleteByCheckticketdate(checkTicketDOList.get(0).getCheckticketdate());
public Long createCheckTicket(CheckTicketDO checkTicketDO) {
// 插入
checkTicketMapper.insert(checkTicketDO);
// 返回
return checkTicketMapper.insertBatch(checkTicketDOList);
return checkTicketDO.getId();
}
@Override

View File

@ -21,12 +21,12 @@ import java.util.Map;
public interface SaleDataService {
/**
* 批量插入售票数据(mysql)
* 创建售票
*
* @param saleDataDOList
* @param saleDataDO 创建信息
* @return 编号
*/
Boolean createSaleData(List<SaleDataDO> saleDataDOList);
Long createSaleData(@Valid SaleDataDO saleDataDO);
/**
* 查询重复的dataId(mongodb)

View File

@ -42,9 +42,11 @@ public class SaleDataServiceImpl implements SaleDataService {
private MongoTemplate mongoTemplate;
@Override
public Boolean createSaleData(List<SaleDataDO> saleDataDOList) {
saleDataMapper.physicalDeleteBySddate(saleDataDOList.get(0).getSddate());
return saleDataMapper.insertBatch(saleDataDOList);
public Long createSaleData(SaleDataDO saleDataDO) {
// 插入
saleDataMapper.insert(saleDataDO);
// 返回
return saleDataDO.getId();
}

View File

@ -18,7 +18,7 @@ logging:
spring:
cloud:
nacos:
server-addr: 172.19.0.1:8848
server-addr: crm.fjptzykj.com:8849
discovery:
namespace: ${spring.profiles.active} # 命名空间。这里使用 dev 开发环境
metadata:
@ -31,7 +31,7 @@ spring:
nacos:
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
config:
server-addr: 172.19.0.1:8848 # Nacos 服务器地址
server-addr: crm.fjptzykj.com:8849 # Nacos 服务器地址
namespace: ${spring.profiles.active} # 命名空间 dev 的ID不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId默认为 spring.application.name

View File

@ -1,9 +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="cn.iocoder.yudao.module.infra.dal.mysql.checkticket.CheckTicketMapper">
<delete id="physicalDeleteByCheckticketdate">
DELETE
FROM checkticket
WHERE checkticketdate = #{checkticketdate}
</delete>
</mapper>

View File

@ -1,9 +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="cn.iocoder.yudao.module.infra.dal.mysql.saledata.SaleDataMapper">
<delete id="physicalDeleteBySddate">
DELETE
FROM saledata
WHERE sddate = #{sddate}
</delete>
</mapper>

View File

@ -2,14 +2,15 @@ app_name='yudao-module-system'
# 定义应用版本
app_version='1.0.0'
# 定义应用环境
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
#profile_active='prod'
echo '----stop container----'
docker stop ${app_name}
echo '----rm container----'
docker rm ${app_name}
echo '----rmi none image----'
docker rmi $(docker images -f "dangling=true" -q)
echo '----rm image----'
docker rmi ${app_name}:${app_version}
# 打包编译docker镜像
echo '----build image----'
docker buildx build -f Dockerfile -t ${app_name}:${app_version} .
echo '----start container----'
docker run -d -p 48181:48081 --name ${app_name} --restart always ${app_name}:${app_version}
docker run -d -p 48081:48081 --name ${app_name} --memory 700m ${app_name}:${app_version}

View File

@ -2,8 +2,8 @@ spring:
application:
name: system-server
main:
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
allow-bean-definition-overriding: true # 允许 Bean 覆盖,例如说 Feign 等会存在重复定义的服务
allow-circular-references: true # 解决循环依赖,可能会导致内存泄露
profiles:
active: local
@ -19,7 +19,7 @@ logging:
spring:
cloud:
nacos:
server-addr: 172.19.0.1:8848
server-addr: crm.fjptzykj.com:8849
discovery:
namespace: ${spring.profiles.active} # 命名空间。这里使用 dev 开发环境
metadata:
@ -32,7 +32,7 @@ spring:
nacos:
# Nacos Config 配置项,对应 NacosConfigProperties 配置属性类
config:
server-addr: 172.19.0.1:8848 # Nacos 服务器地址
server-addr: crm.fjptzykj.com:8849 # Nacos 服务器地址
namespace: ${spring.profiles.active} # 命名空间 dev 的ID不能直接使用 dev 名称。创建命名空间的时候需要指定ID为 dev这里使用 dev 开发环境
group: DEFAULT_GROUP # 使用的 Nacos 配置分组,默认为 DEFAULT_GROUP
name: ${spring.application.name} # 使用的 Nacos 配置集的 dataId默认为 spring.application.name