Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
Y
yifu-mvp
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fangxinjiang
yifu-mvp
Commits
6fb1c51e
Commit
6fb1c51e
authored
Jun 15, 2022
by
fangxinjiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增定时任务服务及配置
parent
c9c13b5b
Hide whitespace changes
Inline
Side-by-side
Showing
47 changed files
with
1630 additions
and
441 deletions
+1630
-441
yifu-codegen-service.yaml
k8s-bash-test/yifu-codegen-service.yaml
+2
-2
yifu-job-deployment.yaml
k8s-bash-test/yifu-job-deployment.yaml
+107
-0
yifu-job-service.yaml
k8s-bash-test/yifu-job-service.yaml
+20
-0
pom.xml
pom.xml
+1
-1
.gitignore
yifu-job/.gitignore
+0
-0
pom.xml
yifu-job/pom.xml
+4
-5
pom.xml
yifu-job/yifu-job-api/pom.xml
+9
-9
DemonTimeTask.java
...ava/com/yifu/cloud/plus/v1/job/compont/DemonTimeTask.java
+29
-0
SysScheduleJob.java
...ava/com/yifu/cloud/plus/v1/job/entity/SysScheduleJob.java
+82
-0
SysScheduleJobLog.java
.../com/yifu/cloud/plus/v1/job/entity/SysScheduleJobLog.java
+83
-0
spring.factories
...yifu-job-api/src/main/resources/META-INF/spring.factories
+2
-0
Dockerfile
yifu-job/yifu-job-biz/Dockerfile
+3
-3
build-prd.sh
yifu-job/yifu-job-biz/build-prd.sh
+0
-0
build-test.sh
yifu-job/yifu-job-biz/build-test.sh
+0
-0
build.sh
yifu-job/yifu-job-biz/build.sh
+0
-0
pom.xml
yifu-job/yifu-job-biz/pom.xml
+33
-31
JobApplication.java
.../main/java/com/yifu/cloud/plus/v1/job/JobApplication.java
+3
-3
SchedulerBeanFactoryConfig.java
.../cloud/plus/v1/job/config/SchedulerBeanFactoryConfig.java
+54
-0
SysScheduleJobController.java
...loud/plus/v1/job/controller/SysScheduleJobController.java
+179
-0
SysScheduleJobLogController.java
...d/plus/v1/job/controller/SysScheduleJobLogController.java
+100
-0
SysScheduleJobLogMapper.java
...ifu/cloud/plus/v1/job/mapper/SysScheduleJobLogMapper.java
+25
-0
SysScheduleJobMapper.java
...m/yifu/cloud/plus/v1/job/mapper/SysScheduleJobMapper.java
+28
-0
SysScheduleJobLogService.java
...u/cloud/plus/v1/job/service/SysScheduleJobLogService.java
+26
-0
SysScheduleJobService.java
...yifu/cloud/plus/v1/job/service/SysScheduleJobService.java
+38
-0
SysScheduleJobLogServiceImpl.java
...lus/v1/job/service/impl/SysScheduleJobLogServiceImpl.java
+29
-0
SysScheduleJobServiceImpl.java
...d/plus/v1/job/service/impl/SysScheduleJobServiceImpl.java
+182
-0
TaskTestService.java
.../yifu/cloud/plus/v1/job/service/impl/TaskTestService.java
+19
-0
ScheduleJobs.java
...in/java/com/yifu/cloud/plus/v1/job/util/ScheduleJobs.java
+89
-0
ScheduleRunnable.java
...ava/com/yifu/cloud/plus/v1/job/util/ScheduleRunnable.java
+42
-0
ScheduleStatus.java
.../java/com/yifu/cloud/plus/v1/job/util/ScheduleStatus.java
+23
-0
ScheduleUtils.java
...n/java/com/yifu/cloud/plus/v1/job/util/ScheduleUtils.java
+151
-0
application.yml
yifu-job/yifu-job-biz/src/main/resources/application.yml
+44
-10
logback-spring.xml
yifu-job/yifu-job-biz/src/main/resources/logback-spring.xml
+0
-4
SysScheduleJobLogMapper.xml
...biz/src/main/resources/mapper/SysScheduleJobLogMapper.xml
+69
-0
SysScheduleJobMapper.xml
...ob-biz/src/main/resources/mapper/SysScheduleJobMapper.xml
+64
-0
Provider.java
...java/com/yifu/cloud/plus/v1/provider/entity/Provider.java
+0
-59
RemoteProviderService.java
...u/cloud/plus/v1/provider/feign/RemoteProviderService.java
+0
-18
spring.factories.txt
...ider-api/src/main/resources/META-INF/spring.factories.txt
+0
-2
ProviderController.java
...cloud/plus/v1/provider/controller/ProviderController.java
+0
-129
ProviderMapper.java
...om/yifu/cloud/plus/v1/provider/mapper/ProviderMapper.java
+0
-33
ProviderService.java
.../yifu/cloud/plus/v1/provider/service/ProviderService.java
+0
-31
ProviderServiceImpl.java
...ud/plus/v1/provider/service/impl/ProviderServiceImpl.java
+0
-34
ProviderMapper.xml
...provider-biz/src/main/resources/mapper/ProviderMapper.xml
+0
-35
SysMenuServiceImpl.java
...d.plus.v1/yifu/admin/service/impl/SysMenuServiceImpl.java
+1
-1
pom.xml
yifu-visual/yifu-xxl-job-admin/pom.xml
+21
-6
YifuXxlJobAdminApplication.java
...in/java/com/xxl/job/admin/YifuXxlJobAdminApplication.java
+0
-2
application.yml
...ual/yifu-xxl-job-admin/src/main/resources/application.yml
+68
-23
No files found.
k8s-bash-test/yifu-codegen-service.yaml
View file @
6fb1c51e
...
...
@@ -10,11 +10,11 @@ spec: # 资源规范字段
-
port
:
8000
# service 端口
protocol
:
TCP
# 协议
targetPort
:
8000
# 容器暴露的端口
name
:
http-
auth
# 端口名称
name
:
http-
codegen
# 端口名称
-
port
:
3500
# service 端口
protocol
:
TCP
# 协议
targetPort
:
3500
# 容器暴露的端口
name
:
http-
auth
-dapr
name
:
http-
codegen
-dapr
selector
:
# 选择器
app
:
yifu-codegen
# 资源名称
type
:
ClusterIP
# ClusterIP 类型
\ No newline at end of file
k8s-bash-test/yifu-job-deployment.yaml
0 → 100644
View file @
6fb1c51e
apiVersion
:
apps/v1
# 指定api版本,此值必须在kubectl api-versions中
kind
:
Deployment
# 指定创建资源的角色/类型
metadata
:
# 资源的元数据/属性
name
:
yifu-job
# 资源的名字,在同一个namespace中必须唯一
namespace
:
qas-mvp
# 部署在哪个namespace中
spec
:
# 资源规范字段
selector
:
# 选择器
matchLabels
:
# 匹配标签
app
:
yifu-job
replicas
:
1
# 声明副本数目
#revisionHistoryLimit: 3 # 保留历史版本
#strategy: # 策略
# rollingUpdate: # 滚动更新
# maxSurge: 30% # 最大额外可以存在的副本数,可以为百分比,也可以为整数
# maxUnavailable: 30% # 示在更新过程中能够进入不可用状态的 Pod 的最大值,可以为百分比,也可以为整数
# type: RollingUpdate # 滚动更新策略
template
:
# 模版
metadata
:
# 模版
labels
:
# 设定资源的标签
app
:
yifu-job
annotations
:
dapr.io/enabled
:
"
true"
#设定此参数为 true 注入Dapr sidecar到pod
dapr.io/app-id
:
"
yifu-job"
#应用程序唯一 ID。 用于服务发现、状态封装 和 发布/订阅 消费者ID
dapr.io/app-port
:
"
5004"
#这个参数告诉Dapr你的应用程序正在监听哪个端口。
#dapr.io/log-level: "debug" #为 Dapr sidecar设置日志级别。 允许的值是debug,info,warn,error。 默认是 info
#dapr.io/log-as-json: "false" #将此参数设置为true以JSON格式输出日志。 默认值为 false.
#dapr.io/config: file #告诉 Dapr 要使用哪个配置 CRD
dapr.io/app-protocol
:
"
http"
#告诉 Dapr 你的应用程序正在使用哪种协议。 有效选项是 http and grpc。 Default is http
#dapr.io/app-max-concurrency: "20" #限制应用程序的并发量。 有效的数值是大于 0
#dapr.io/app-ssl: "false" #告诉Dapr通过不安全的SSL连接调用应用程序。 同时适用于HTTP和gRPC。 Traffic between your app and the Dapr sidecar is encrypted with a certificate issued by a non-trusted certificate authority, which is considered insecure. 默认值为 false.
dapr.io/metrics-port
:
"
9090"
#设置 sidecar 度量服务器的端口。 默认值为 9090
#dapr.io/sidecar-cpu-limit: 2 #Dapr sidecar可以使用的最大CPU数量。 默认情况下未设置
#dapr.io/sidecar-memory-limit: "800Mi" #Dapr sidecar可以使用的最大内存量。默认情况下未设置 请参阅 https://kubernetes.io/docs/tasks/administer-cluster/manage-resources/quota-memory-cpu-namespace/ 的有效值。
#dapr.io/sidecar-cpu-request: 1 #Dapr sidecar要求的 CPU 数量
#dapr.io/sidecar-memory-request #Dapr sidecar 请求的内存数量
#dapr.io/http-max-request-size: "8MB" #增加http和grpc服务器请求正文参数的最大大小,单位为MB,以处理大文件的上传。 默认值为 4 MB
dapr.io/sidecar-listen-addresses
:
"
0.0.0.0"
# 更多dapr配置请参考 https://www.bookstack.cn/read/dapr-1.5-zh/cc77b74e2cc2f4d4.md
spec
:
# 资源规范字段
nodeSelector
:
# node 选择器
node-type
:
worker
# node标签
containers
:
# 容器
-
name
:
yifu-job
# 容器的名字
image
:
hub.yifucenter.com:5500/qas-mvp/yifu-job:1.0.0
# 容器镜像地址
imagePullPolicy
:
Always
# 每次Pod启动拉取镜像策略,三个选择 Always、Never、IfNotPresent
# Always,每次都检查;Never,每次都不检查(不管本地是否有);IfNotPresent,如果本地有就不检查,如果没有就拉取(手动测试时,
# 已经打好镜像存在docker容器中时,使用存在不检查级别,
# 默认为每次都检查,然后会进行拉取新镜像,因镜像仓库不存在,导致部署失败)
ports
:
-
containerPort
:
5004
# 容器端口
env
:
# 启动环境配置信息 active and timeZone set
-
name
:
SPRING_PROFILES_ACTIVE
value
:
test
-
name
:
TZ
value
:
Asia/Shanghai
resources
:
#资源配置限制
limits
:
# 最大使用
memory
:
"
2048Mi"
#cpu: 300m # CPU,1核心 = 1000m
requests
:
# 容器运行时,最低资源需求,也就是说最少需要多少资源容器才能正常运行
#cpu: 100m
memory
:
"
500Mi"
#livenessProbe: # pod 内部健康检查的设置
# httpGet: # 通过httpget检查健康,返回200-399之间,则认为容器正常
# path: /healthCheck # URI地址
# port: 8080 # 端口
# scheme: HTTP # 协议
# # host: 127.0.0.1 # 主机地址
# initialDelaySeconds: 30 # 表明第一次检测在容器启动后多长时间后开始
# timeoutSeconds: 5 # 检测的超时时间
# periodSeconds: 30 # 检查间隔时间
# successThreshold: 1 # 成功门槛
# failureThreshold: 5 # 失败门槛,连接失败5次,pod杀掉,重启一个新的pod
# readinessProbe: # Pod 准备服务健康检查设置
# httpGet:
# path: /healthCheck
# port: 8080
# scheme: HTTP
# initialDelaySeconds: 30
# timeoutSeconds: 5
# periodSeconds: 10
# successThreshold: 1
# failureThreshold: 5
#也可以用这种方法
#exec: 执行命令的方法进行监测,如果其退出码不为0,则认为容器正常
# command:
# - cat
# - /tmp/health
#也可以用这种方法
#tcpSocket: # 通过tcpSocket检查健康
# port: number
#ports:
# - name: http # 名称
# containerPort: 8080 # 容器开发对外的端口
# protocol: TCP # 协议
imagePullSecrets
:
# 镜像仓库拉取密钥
-
name
:
login
#affinity: # 亲和性调试
# nodeAffinity: # 节点亲和力
# requiredDuringSchedulingIgnoredDuringExecution: # pod 必须部署到满足条件的节点上
# nodeSelectorTerms: # 节点满足任何一个条件就可以
# - matchExpressions: # 有多个选项,则只有同时满足这些逻辑选项的节点才能运行 pod
# - key: beta.kubernetes.io/arch
# operator: In
# values:
# - amd64
\ No newline at end of file
k8s-bash-test/yifu-job-service.yaml
0 → 100644
View file @
6fb1c51e
apiVersion
:
v1
# 指定api版本,此值必须在kubectl api-versions中
kind
:
Service
# 指定创建资源的角色/类型
metadata
:
# 资源的元数据/属性
labels
:
# 设定资源的标签
app
:
yifu-job
# 资源的名字,在同一个namespace中必须唯一
name
:
yifu-job
# 资源的名字,在同一个namespace中必须唯一
namespace
:
qas-mvp
# 部署在哪个namespace中
spec
:
# 资源规范字段
ports
:
-
port
:
5004
# service 端口
protocol
:
TCP
# 协议
targetPort
:
5004
# 容器暴露的端口
name
:
http-job
# 端口名称
-
port
:
3500
# service 端口
protocol
:
TCP
# 协议
targetPort
:
3500
# 容器暴露的端口
name
:
http-job-dapr
selector
:
# 选择器
app
:
yifu-job
# 资源名称
type
:
ClusterIP
# ClusterIP 类型
\ No newline at end of file
pom.xml
View file @
6fb1c51e
...
...
@@ -95,7 +95,7 @@
<module>
yifu-upms
</module>
<module>
yifu-common
</module>
<module>
yifu-visual
</module>
<module>
yifu-
provider
</module>
<module>
yifu-
job
</module>
<module>
yifu-consumer
</module>
</modules>
...
...
yifu-
provider
/.gitignore
→
yifu-
job
/.gitignore
View file @
6fb1c51e
File moved
yifu-
provider
/pom.xml
→
yifu-
job
/pom.xml
View file @
6fb1c51e
...
...
@@ -8,15 +8,14 @@
<version>
1.0.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
yifu-provider
</artifactId>
<description>
服务提供
</description>
<artifactId>
yifu-job
</artifactId>
<description>
定时任务提供
</description>
<packaging>
pom
</packaging>
<!--项目子模块-->
<modules>
<module>
provider
-api
</module>
<module>
provider
-biz
</module>
<module>
yifu-job
-api
</module>
<module>
yifu-job
-biz
</module>
</modules>
</project>
\ No newline at end of file
yifu-
provider/provider
-api/pom.xml
→
yifu-
job/yifu-job
-api/pom.xml
View file @
6fb1c51e
...
...
@@ -6,14 +6,14 @@
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-
provider
</artifactId>
<artifactId>
yifu-
job
</artifactId>
<version>
1.0.0
</version>
</parent>
<artifactId>
provider
-api
</artifactId>
<artifactId>
yifu-job
-api
</artifactId>
<packaging>
jar
</packaging>
<description>
provider
接口模块
</description>
<description>
job
接口模块
</description>
<dependencies>
<!-- core 工具类 -->
...
...
@@ -37,10 +37,10 @@
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-mybatis
</artifactId>
</dependency>
<!--
excel 导入导出 https://github.com/pig-mesh/excel-spring-boot-starter
-->
<dependency>
<groupId>
com.pig4cloud.excel
</groupId>
<artifactId>
excel-spring-boot-starter
</artifactId>
</dependency>
</dependencies>
<!--
定时任务依赖
-->
<dependency>
<groupId>
org.quartz-scheduler
</groupId>
<artifactId>
quartz
</artifactId>
</dependency>
</dependencies>
</project>
yifu-job/yifu-job-api/src/main/java/com/yifu/cloud/plus/v1/job/compont/DemonTimeTask.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
compont
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Component
;
/**
* @Author fxj
* @Description 定时任务具体执行类
* @Date 10:48 2022/6/15
* @Param
* @return
**/
@Component
(
value
=
"demonTimeTask"
)
@Slf4j
public
class
DemonTimeTask
{
/**
* @Author fxj
* @Description
* @Date 10:49 2022/6/15
* @Param
* @return
**/
public
void
demonTimeTask
()
{
log
.
info
(
"------------生成-上月的垫付额度使用明细-定时任务开始------------"
);
// TODO 具体执行远程端口
log
.
info
(
"------------生成-上月的垫付额度使用明细-定时任务结束------------"
);
}
}
yifu-job/yifu-job-api/src/main/java/com/yifu/cloud/plus/v1/job/entity/SysScheduleJob.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.hibernate.validator.constraints.Length
;
/**
* @author wangan
* @date 2019-08-12 10:19:42
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
"sys_schedule_job"
)
@Schema
(
description
=
"定时任务表"
)
public
class
SysScheduleJob
extends
Model
<
SysScheduleJob
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 任务调度参数key
*/
public
static
final
String
JOB_PARAM_KEY
=
"JOB_PARAM_KEY"
;
/**
*
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"主键"
)
private
String
id
;
/**
*
*/
@Length
(
max
=
100
,
message
=
"不能超过100个字符"
)
@Schema
(
description
=
"jobId"
)
private
String
jobId
;
/**
*
*/
@Length
(
max
=
20
,
message
=
"不能超过20个字符"
)
@Schema
(
description
=
"执行类名称"
)
private
String
beanName
;
/**
*
*/
@Length
(
max
=
40
,
message
=
"不能超过40个字符"
)
@Schema
(
description
=
"执行类方法"
)
private
String
methodName
;
/**
*
*/
@Length
(
max
=
50
,
message
=
"不能超过50个字符"
)
@Schema
(
description
=
"执行类方法参数"
)
private
String
params
;
/**
*
*/
@Length
(
max
=
1
,
message
=
"不能超过1个字符"
)
@Schema
(
description
=
"执行状态"
)
private
String
status
;
/**
*
*/
@Length
(
max
=
50
,
message
=
"不能超过50个字符"
)
@Schema
(
description
=
"执行cron表达式"
)
private
String
cronExpression
;
/**
*
*/
@Length
(
max
=
200
,
message
=
"不能超过200个字符"
)
@Schema
(
description
=
"备注"
)
private
String
remark
;
/**
*
*/
@Length
(
max
=
14
,
message
=
"不能超过14个字符"
)
@Schema
(
description
=
"创建时间"
)
private
String
createtime
;
}
yifu-job/yifu-job-api/src/main/java/com/yifu/cloud/plus/v1/job/entity/SysScheduleJobLog.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
org.hibernate.validator.constraints.Length
;
/**
* @author wangan
* @date 2019-08-12 10:19:42
*/
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
@TableName
(
"sys_schedule_job_log"
)
@Schema
(
description
=
"定时任务执行记录表"
)
public
class
SysScheduleJobLog
extends
Model
<
SysScheduleJobLog
>
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"主键"
)
private
String
id
;
/**
*
*/
@Length
(
max
=
100
,
message
=
"不能超过100个字符"
)
@Schema
(
description
=
"任务ID"
)
private
String
jobId
;
/**
*
*/
@Length
(
max
=
20
,
message
=
"不能超过20个字符"
)
@Schema
(
description
=
"执行类名称"
)
private
String
beanName
;
/**
*
*/
@Length
(
max
=
40
,
message
=
"不能超过40个字符"
)
@Schema
(
description
=
"执行方法"
)
private
String
methodName
;
/**
*
*/
@Length
(
max
=
50
,
message
=
"不能超过50个字符"
)
@Schema
(
description
=
"执行方法参数"
)
private
String
params
;
/**
*
*/
@Length
(
max
=
1
,
message
=
"不能超过1个字符"
)
@Schema
(
description
=
"状态"
)
private
String
status
;
/**
*
*/
@Length
(
max
=
100
,
message
=
"不能超过100个字符"
)
@Schema
(
description
=
"错误信息"
)
private
String
error
;
/**
*
*/
@Length
(
max
=
10
,
message
=
"不能超过10个字符"
)
@Schema
(
description
=
"执行时长"
)
private
String
times
;
/**
*
*/
@Length
(
max
=
14
,
message
=
"不能超过14个字符"
)
@Schema
(
description
=
"创建时间"
)
private
String
createtime
;
/**
*
*/
@Length
(
max
=
200
,
message
=
"不能超过200个字符"
)
@Schema
(
description
=
"备注"
)
private
String
remark
;
}
yifu-job/yifu-job-api/src/main/resources/META-INF/spring.factories
0 → 100644
View file @
6fb1c51e
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
com.yifu.cloud.plus.v1.job.config.SchedulerBeanFactoryConfig
\ No newline at end of file
yifu-
provider/provider
-biz/Dockerfile
→
yifu-
job/yifu-job
-biz/Dockerfile
View file @
6fb1c51e
FROM
moxm/java:1.8-full
RUN
mkdir
-p
/
provider
RUN
mkdir
-p
/
job
WORKDIR
provider
WORKDIR
job
ARG
JAR_FILE=target/
provider
-biz.jar
ARG
JAR_FILE=target/
job
-biz.jar
COPY
${JAR_FILE} app.jar
...
...
yifu-
provider/provider
-biz/build-prd.sh
→
yifu-
job/yifu-job
-biz/build-prd.sh
View file @
6fb1c51e
File moved
yifu-
provider/provider
-biz/build-test.sh
→
yifu-
job/yifu-job
-biz/build-test.sh
View file @
6fb1c51e
File moved
yifu-
provider/provider
-biz/build.sh
→
yifu-
job/yifu-job
-biz/build.sh
View file @
6fb1c51e
File moved
yifu-
provider/provider
-biz/pom.xml
→
yifu-
job/yifu-job
-biz/pom.xml
View file @
6fb1c51e
...
...
@@ -6,28 +6,22 @@
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-
provider
</artifactId>
<artifactId>
yifu-
job
</artifactId>
<version>
1.0.0
</version>
</parent>
<artifactId>
provider
-biz
</artifactId>
<artifactId>
yifu-job
-biz
</artifactId>
<packaging>
jar
</packaging>
<description>
provider
业务模块
</description>
<description>
job
业务模块
</description>
<dependencies>
<!--选配: 依赖seata模块-->
<dependency>
<
!--<
dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-seata</artifactId>
</dependency>
<!--必备: 依赖api模块-->
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
provider-api
</artifactId>
<version>
1.0.0
</version>
</dependency>
</dependency>-->
<!--选配: orm 模块-->
<dependency>
<groupId>
com.baomidou
</groupId>
...
...
@@ -42,36 +36,44 @@
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-security
</artifactId>
</dependency>
<!--必备:服务处理-->
<!--<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-feign</artifactId>
</dependency>-->
<!--必备:日志处理-->
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-log
</artifactId>
</dependency>
<!--必备:swagger-->
<!--<dependency>
<groupId>com.yifu.cloud.plus.v1</groupId>
<artifactId>yifu-common-swagger</artifactId>
</dependency>-->
<!--必备: 注册中心客户端-->
<!--<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>-->
<!--必备: 配置中心客户端-->
<!--<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>-->
<!--必备:undertow容器-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-undertow
</artifactId>
</dependency>
<!--web 模块-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<exclusions>
<!--排除tomcat依赖-->
<exclusion>
<artifactId>
spring-boot-starter-tomcat
</artifactId>
<groupId>
org.springframework.boot
</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
org.quartz-scheduler
</groupId>
<artifactId>
quartz
</artifactId>
<version>
2.2.3
</version>
</dependency>
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-job-api
</artifactId>
<version>
1.0.0
</version>
<scope>
compile
</scope>
</dependency>
<!--接口文档 http://127.0.0.1:5004/swagger-ui/index.html-->
<dependency>
<groupId>
com.yifu.cloud.plus.v1
</groupId>
<artifactId>
yifu-common-swagger
</artifactId>
</dependency>
</dependencies>
<build>
...
...
yifu-
provider/provider-biz/src/main/java/com/yifu/cloud/plus/v1/provider/Provider
Application.java
→
yifu-
job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/Job
Application.java
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
provider
;
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.EnableYifuResourceServer
;
import
org.springframework.boot.SpringApplication
;
...
...
@@ -11,10 +11,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
*/
@EnableYifuResourceServer
@SpringBootApplication
public
class
Provider
Application
{
public
class
Job
Application
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
Provider
Application
.
class
,
args
);
SpringApplication
.
run
(
Job
Application
.
class
,
args
);
}
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/config/SchedulerBeanFactoryConfig.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.quartz.SchedulerFactoryBean
;
import
javax.sql.DataSource
;
import
java.util.Properties
;
/**
* @Author fxj
* @Description
* @Date 11:47 2022/6/15
* @Param
* @return
**/
@Configuration
public
class
SchedulerBeanFactoryConfig
{
@Bean
public
SchedulerFactoryBean
SchedulerFactoryBean
(
DataSource
dataSource
)
{
SchedulerFactoryBean
factoryBean
=
new
SchedulerFactoryBean
();
factoryBean
.
setDataSource
(
dataSource
);
Properties
properties
=
new
Properties
();
properties
.
setProperty
(
"org.quartz.scheduler.instanceName"
,
"Scheduler"
);
properties
.
setProperty
(
"org.quartz.scheduler.instanceId"
,
"AUTO"
);
//线程池配置
properties
.
setProperty
(
"org.quartz.threadPool.class"
,
"org.quartz.simpl.SimpleThreadPool"
);
properties
.
setProperty
(
"org.quartz.threadPool.threadCount"
,
"20"
);
properties
.
setProperty
(
"org.quartz.threadPool.threadPriority"
,
"5"
);
//JobStore 配置
//properties.setProperty("org.quartz.jobStore.class", "org.quartz.impl.jdbcjobstore.JobStoreTX");
// spring boot 2.6.X 的定时任务修正
properties
.
setProperty
(
"org.quartz.jobStore.class"
,
"org.springframework.scheduling.quartz.LocalDataSourceJobStore"
);
//集群配置
properties
.
setProperty
(
"org.quartz.jobStore.isClustered"
,
"true"
);
properties
.
setProperty
(
"org.quartz.jobStore.clusterCheckinInterval"
,
"15000"
);
properties
.
setProperty
(
"org.quartz.jobStore.maxMisfiresToHandleAtATime"
,
"1"
);
properties
.
setProperty
(
"org.quartz.jobStore.misfireThreshold"
,
"12000"
);
//表前缀
properties
.
setProperty
(
"org.quartz.jobStore.tablePrefix"
,
"QRTZ_"
);
factoryBean
.
setQuartzProperties
(
properties
);
factoryBean
.
setSchedulerName
(
"Scheduler"
);
factoryBean
.
setStartupDelay
(
10
);
factoryBean
.
setApplicationContextSchedulerContextKey
(
"applicationContextSchedulerContextKey"
);
factoryBean
.
setOverwriteExistingJobs
(
true
);
factoryBean
.
setAutoStartup
(
true
);
return
factoryBean
;
}
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/controller/SysScheduleJobController.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJob
;
import
com.yifu.cloud.plus.v1.job.service.SysScheduleJobService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.Common
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
import
java.util.List
;
/**
* @Author fxj
* @Description
* @Date 15:11 2022/6/15
* @Param
* @return
**/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/sysschedulejob"
)
@Tag
(
name
=
"定时任务管理"
)
public
class
SysScheduleJobController
{
private
final
SysScheduleJobService
sysScheduleJobService
;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysScheduleJob
* @return
*/
@Operation
(
summary
=
"分页查询"
,
description
=
"分页查询"
)
@GetMapping
(
"/page"
)
public
R
<
IPage
<
List
<
SysScheduleJob
>>>
getSysScheduleJobPage
(
Page
page
,
SysScheduleJob
sysScheduleJob
)
{
return
R
.
ok
(
sysScheduleJobService
.
getSysScheduleJobPage
(
page
,
sysScheduleJob
));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation
(
summary
=
"id查询"
,
description
=
"id查询"
)
@GetMapping
(
"/{id}"
)
public
R
<
SysScheduleJob
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
new
R
<>(
sysScheduleJobService
.
getById
(
id
));
}
/**
* 新增记录
*
* @param scheduleJob
* @return R
*/
@Operation
(
summary
=
"新增"
,
description
=
"新增"
)
@PostMapping
(
"/add"
)
@PreAuthorize
(
"@pms.hasPermission('sys_schedule_add')"
)
public
R
save
(
@Valid
@RequestBody
SysScheduleJob
scheduleJob
)
{
//数据校验
if
(
Common
.
isEmpty
(
scheduleJob
.
getBeanName
()))
{
return
R
.
failed
(
"bean名称不能为空"
);
}
if
(
Common
.
isEmpty
(
scheduleJob
.
getMethodName
()))
{
return
R
.
failed
(
"方法名称不能为空"
);
}
if
(
Common
.
isEmpty
(
scheduleJob
.
getCronExpression
()))
{
return
R
.
failed
(
"cron表达式不能为空"
);
}
sysScheduleJobService
.
saveSysScheduleJob
(
scheduleJob
);
return
R
.
ok
(
"新增成功"
);
}
/**
* 修改记录
*
* @param sysScheduleJob
* @return R
*/
@Operation
(
summary
=
"修改"
,
description
=
"修改"
)
@SysLog
(
"修改"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('sys_schedulejob_edit')"
)
public
R
update
(
@RequestBody
SysScheduleJob
sysScheduleJob
)
{
//数据校验
if
(
Common
.
isEmpty
(
sysScheduleJob
.
getBeanName
()))
{
return
R
.
failed
(
"bean名称不能为空"
);
}
if
(
Common
.
isEmpty
(
sysScheduleJob
.
getMethodName
()))
{
return
R
.
failed
(
"方法名称不能为空"
);
}
if
(
Common
.
isEmpty
(
sysScheduleJob
.
getCronExpression
()))
{
return
R
.
failed
(
"cron表达式不能为空"
);
}
// 修改
QueryWrapper
<
SysScheduleJob
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
eq
(
"JOB_ID"
,
sysScheduleJob
.
getJobId
());
SysScheduleJob
job
=
sysScheduleJobService
.
getOne
(
queryWrapper
);
job
.
setBeanName
(
sysScheduleJob
.
getBeanName
());
job
.
setMethodName
(
sysScheduleJob
.
getMethodName
());
job
.
setCronExpression
(
sysScheduleJob
.
getCronExpression
());
job
.
setRemark
(
sysScheduleJob
.
getRemark
());
job
.
setParams
(
sysScheduleJob
.
getParams
());
sysScheduleJobService
.
updateSysScheduleJob
(
job
);
return
R
.
ok
(
"修改成功"
);
}
/**
* 通过id删除一条记录
*
* @param id
* @return R
*/
@Operation
(
summary
=
"删除"
,
description
=
"删除"
)
@SysLog
(
"删除"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('sys_schedulejob_del')"
)
public
R
removeById
(
@PathVariable
String
id
)
{
sysScheduleJobService
.
deleteSysScheduleJob
(
id
);
return
R
.
ok
(
"删除成功"
);
}
/**
* @param jobIds
* @Author: wangan
* @Date: 2019/8/12
* @Description: 立即执行
* @return: com.yifu.cloud.v1.common.core.util.RRemoteThirdServiceFallbackImpl
**/
@GetMapping
(
"/run"
)
// @PreAuthorize("@pms.hasPermission('sys_schedulejob_run')")
public
R
run
(
@RequestParam
(
"jobIds"
)
String
jobIds
)
{
sysScheduleJobService
.
run
(
new
String
[]{
jobIds
});
return
R
.
ok
(
"执行成功"
);
}
/**
* @param jobIds
* @Author: wangan
* @Date: 2019/8/12
* @Description: 暂停定时任务
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@GetMapping
(
"/pause"
)
@PreAuthorize
(
"@pms.hasPermission('sys_schedulejob_pause')"
)
public
R
pause
(
@RequestParam
(
"jobIds"
)
String
jobIds
)
{
sysScheduleJobService
.
pause
(
new
String
[]{
jobIds
});
return
R
.
ok
(
"暂停成功"
);
}
/**
* @param jobIds
* @Author: wangan
* @Date: 2019/8/12
* @Description: 恢复定时任务
* @return: com.yifu.cloud.v1.common.core.util.R
**/
@GetMapping
(
"/resume"
)
@PreAuthorize
(
"@pms.hasPermission('sys_schedulejob_resume')"
)
public
R
resume
(
@RequestParam
(
"jobIds"
)
String
jobIds
)
{
sysScheduleJobService
.
resume
(
new
String
[]{
jobIds
});
return
R
.
ok
(
"恢复成功"
);
}
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/controller/SysScheduleJobLogController.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
controller
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJobLog
;
import
com.yifu.cloud.plus.v1.job.service.SysScheduleJobLogService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.web.bind.annotation.*
;
import
javax.validation.Valid
;
/**
* @Author fxj
* @Description
* @Date 11:18 2022/6/15
* @Param
* @return
**/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/sysschedulejoblog"
)
@Tag
(
name
=
"任务执行日志"
,
description
=
"任务执行日志"
)
public
class
SysScheduleJobLogController
{
private
final
SysScheduleJobLogService
sysScheduleJobLogService
;
/**
* 简单分页查询
*
* @param page 分页对象
* @param sysScheduleJobLog
* @return
*/
@Operation
(
summary
=
"简单分页查询"
,
description
=
"简单分页查询"
)
@GetMapping
(
"/page"
)
public
R
<
IPage
<
SysScheduleJobLog
>>
getSysScheduleJobLogPage
(
Page
<
SysScheduleJobLog
>
page
,
SysScheduleJobLog
sysScheduleJobLog
)
{
return
new
R
<>(
sysScheduleJobLogService
.
getSysScheduleJobLogPage
(
page
,
sysScheduleJobLog
));
}
/**
* 通过id查询单条记录
*
* @param id
* @return R
*/
@Operation
(
summary
=
"id查询"
,
description
=
"id查询"
)
@GetMapping
(
"/{id}"
)
public
R
<
SysScheduleJobLog
>
getById
(
@PathVariable
(
"id"
)
String
id
)
{
return
new
R
<>(
sysScheduleJobLogService
.
getById
(
id
));
}
/**
* 新增记录
*
* @param sysScheduleJobLog
* @return R
*/
@Operation
(
summary
=
"新增"
,
description
=
"新增"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('wxhr:sysschedulejoblog_add')"
)
public
R
save
(
@Valid
@RequestBody
SysScheduleJobLog
sysScheduleJobLog
)
{
return
new
R
<>(
sysScheduleJobLogService
.
save
(
sysScheduleJobLog
));
}
/**
* 修改记录
*
* @param sysScheduleJobLog
* @return R
*/
@Operation
(
summary
=
"修改"
,
description
=
"修改"
)
@SysLog
(
"修改"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('wxhr:sysschedulejoblog_edit')"
)
public
R
update
(
@RequestBody
SysScheduleJobLog
sysScheduleJobLog
)
{
return
new
R
<>(
sysScheduleJobLogService
.
updateById
(
sysScheduleJobLog
));
}
/**
* 通过id删除一条记录
*
* @param id
* @return R
*/
@Operation
(
summary
=
"删除"
,
description
=
"删除"
)
@SysLog
(
"删除"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('wxhr:sysschedulejoblog_del')"
)
public
R
removeById
(
@PathVariable
String
id
)
{
return
new
R
<>(
sysScheduleJobLogService
.
removeById
(
id
));
}
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/mapper/SysScheduleJobLogMapper.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJobLog
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* @author wangan
* @date 2019-08-12 10:19:42
*/
@Mapper
public
interface
SysScheduleJobLogMapper
extends
BaseMapper
<
SysScheduleJobLog
>
{
/**
* 简单分页查询
*
* @param sysScheduleJobLog
* @return
*/
IPage
<
SysScheduleJobLog
>
getSysScheduleJobLogPage
(
Page
page
,
@Param
(
"sysScheduleJobLog"
)
SysScheduleJobLog
sysScheduleJobLog
);
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/mapper/SysScheduleJobMapper.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJob
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
/**
* @Author fxj
* @Description
* @Date 11:38 2022/6/15
* @Param
* @return
**/
@Mapper
public
interface
SysScheduleJobMapper
extends
BaseMapper
<
SysScheduleJob
>
{
/**
* 简单分页查询
*
* @param sysScheduleJob
* @return
*/
IPage
<
SysScheduleJob
>
getSysScheduleJobPage
(
Page
page
,
@Param
(
"sysScheduleJob"
)
SysScheduleJob
sysScheduleJob
);
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/service/SysScheduleJobLogService.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJobLog
;
/**
* @Author fxj
* @Description
* @Date 11:13 2022/6/15
* @Param
* @return
**/
public
interface
SysScheduleJobLogService
extends
IService
<
SysScheduleJobLog
>
{
/**
* 简单分页查询
*
* @param sysScheduleJobLog
* @return
*/
IPage
<
SysScheduleJobLog
>
getSysScheduleJobLogPage
(
Page
<
SysScheduleJobLog
>
page
,
SysScheduleJobLog
sysScheduleJobLog
);
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/service/SysScheduleJobService.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
service
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJob
;
/**
* @Author fxj
* @Description
* @Date 11:13 2022/6/15
* @Param
* @return
**/
public
interface
SysScheduleJobService
extends
IService
<
SysScheduleJob
>
{
/**
* 简单分页查询
*
* @param sysScheduleJob
* @return
*/
IPage
<
SysScheduleJob
>
getSysScheduleJobPage
(
Page
<
SysScheduleJob
>
page
,
SysScheduleJob
sysScheduleJob
);
void
run
(
String
[]
jobIds
);
void
pause
(
String
[]
jobIds
);
void
resume
(
String
[]
jobIds
);
void
saveSysScheduleJob
(
SysScheduleJob
scheduleJob
);
void
updateSysScheduleJob
(
SysScheduleJob
scheduleJob
);
void
deleteSysScheduleJob
(
String
jobIds
);
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/service/impl/SysScheduleJobLogServiceImpl.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJobLog
;
import
com.yifu.cloud.plus.v1.job.mapper.SysScheduleJobLogMapper
;
import
com.yifu.cloud.plus.v1.job.service.SysScheduleJobLogService
;
import
org.springframework.stereotype.Service
;
/**
* @author wangan
* @date 2019-08-12 10:19:42
*/
@Service
public
class
SysScheduleJobLogServiceImpl
extends
ServiceImpl
<
SysScheduleJobLogMapper
,
SysScheduleJobLog
>
implements
SysScheduleJobLogService
{
/**
* 简单分页查询
*
* @param sysScheduleJobLog
* @return
*/
@Override
public
IPage
<
SysScheduleJobLog
>
getSysScheduleJobLogPage
(
Page
<
SysScheduleJobLog
>
page
,
SysScheduleJobLog
sysScheduleJobLog
)
{
return
baseMapper
.
getSysScheduleJobLogPage
(
page
,
sysScheduleJobLog
);
}
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/service/impl/SysScheduleJobServiceImpl.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
service
.
impl
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJob
;
import
com.yifu.cloud.plus.v1.job.mapper.SysScheduleJobMapper
;
import
com.yifu.cloud.plus.v1.job.service.SysScheduleJobService
;
import
com.yifu.cloud.plus.v1.job.util.ScheduleStatus
;
import
com.yifu.cloud.plus.v1.job.util.ScheduleUtils
;
import
org.quartz.CronTrigger
;
import
org.quartz.Scheduler
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
java.util.Date
;
import
java.util.List
;
/**
* @Author fxj
* @Description
* @Date 11:37 2022/6/15
* @Param
* @return
**/
@Service
public
class
SysScheduleJobServiceImpl
extends
ServiceImpl
<
SysScheduleJobMapper
,
SysScheduleJob
>
implements
SysScheduleJobService
{
@Autowired
private
Scheduler
scheduler
;
/**
* 项目启动时,初始化定时器
*/
@PostConstruct
public
void
init
()
{
List
<
SysScheduleJob
>
scheduleJobList
=
this
.
list
(
new
QueryWrapper
<>());
for
(
SysScheduleJob
scheduleJob
:
scheduleJobList
)
{
CronTrigger
cronTrigger
=
ScheduleUtils
.
getCronTrigger
(
scheduler
,
scheduleJob
.
getJobId
());
//如果不存在,则创建
if
(
cronTrigger
==
null
)
{
ScheduleUtils
.
createScheduleJob
(
scheduler
,
scheduleJob
);
}
else
{
ScheduleUtils
.
updateScheduleJob
(
scheduler
,
scheduleJob
);
}
}
}
/**
* 简单分页查询
*
* @param sysScheduleJob
* @return
*/
@Override
public
IPage
<
SysScheduleJob
>
getSysScheduleJobPage
(
Page
<
SysScheduleJob
>
page
,
SysScheduleJob
sysScheduleJob
)
{
return
baseMapper
.
getSysScheduleJobPage
(
page
,
sysScheduleJob
);
}
/**
* @Author fxj
* @Description 运行定时任务
* @Date 11:37 2022/6/15
* @Param
* @return
**/
@Override
public
void
run
(
String
[]
jobIds
)
{
for
(
String
jobId
:
jobIds
)
{
SysScheduleJob
scheduleJob
=
new
SysScheduleJob
();
scheduleJob
.
setJobId
(
jobId
);
QueryWrapper
<
SysScheduleJob
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
setEntity
(
scheduleJob
);
scheduleJob
=
this
.
getOne
(
queryWrapper
);
scheduleJob
.
setStatus
(
String
.
valueOf
(
ScheduleStatus
.
NORMAL
.
getValue
()));
this
.
updateById
(
scheduleJob
);
ScheduleUtils
.
run
(
scheduler
,
scheduleJob
);
}
}
/**
* @param jobIds
* @Author: wangan
* @Date: 2019/8/12
* @Description: 暂停定时任务
* @return: void
**/
@Override
public
void
pause
(
String
[]
jobIds
)
{
for
(
String
jobId
:
jobIds
)
{
ScheduleUtils
.
pauseJob
(
scheduler
,
jobId
);
}
updateBatch
(
jobIds
,
ScheduleStatus
.
PAUSE
.
getValue
());
}
/**
* @param jobIds
* @Author: wangan
* @Date: 2019/8/12
* @Description: 恢复定时任务
* @return: void
**/
@Override
public
void
resume
(
String
[]
jobIds
)
{
for
(
String
jobId
:
jobIds
)
{
ScheduleUtils
.
resumeJob
(
scheduler
,
jobId
);
}
updateBatch
(
jobIds
,
ScheduleStatus
.
NORMAL
.
getValue
());
}
private
void
updateBatch
(
String
[]
jobIds
,
int
value
)
{
for
(
String
jobId
:
jobIds
)
{
SysScheduleJob
scheduleJob
=
new
SysScheduleJob
();
scheduleJob
.
setJobId
(
jobId
);
QueryWrapper
<
SysScheduleJob
>
queryWrapper
=
new
QueryWrapper
<>();
queryWrapper
.
setEntity
(
scheduleJob
);
scheduleJob
=
this
.
getOne
(
queryWrapper
);
scheduleJob
.
setStatus
(
String
.
valueOf
(
value
));
this
.
updateById
(
scheduleJob
);
updateSysScheduleJob
(
jobId
,
value
);
}
}
/**
* @param scheduleJob
* @Author: wangan
* @Date: 2019/8/12
* @Description: 新建定时任务
* @return: void
**/
public
void
saveSysScheduleJob
(
SysScheduleJob
scheduleJob
)
{
scheduleJob
.
setCreatetime
(
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_MS_PATTERN
));
scheduleJob
.
setStatus
(
String
.
valueOf
(
ScheduleStatus
.
NORMAL
.
getValue
()));
this
.
save
(
scheduleJob
);
ScheduleUtils
.
createScheduleJob
(
scheduler
,
scheduleJob
);
}
/**
* @param scheduleJob
* @Author: wangan
* @Date: 2019/8/12
* @Description: 更新定时任务
* @return: void
**/
public
void
updateSysScheduleJob
(
SysScheduleJob
scheduleJob
)
{
ScheduleUtils
.
updateScheduleJob
(
scheduler
,
scheduleJob
);
QueryWrapper
<
SysScheduleJob
>
wrapper
=
new
QueryWrapper
<
SysScheduleJob
>();
wrapper
.
eq
(
"ID"
,
scheduleJob
.
getId
());
this
.
updateById
(
scheduleJob
);
}
/**
* @param jobIds
* @Author: wangan
* @Date: 2019/8/12
* @Description: 删除定时任务
* @return: void
**/
public
void
deleteSysScheduleJob
(
String
jobIds
)
{
ScheduleUtils
.
deleteScheduleJob
(
scheduler
,
jobIds
);
QueryWrapper
<
SysScheduleJob
>
wrapper
=
new
QueryWrapper
<
SysScheduleJob
>();
wrapper
.
eq
(
"JOB_ID"
,
jobIds
);
this
.
remove
(
wrapper
);
}
public
int
updateSysScheduleJob
(
String
jobIds
,
int
status
)
{
SysScheduleJob
scheduleJob
=
new
SysScheduleJob
();
scheduleJob
.
setJobId
(
jobIds
);
QueryWrapper
<
SysScheduleJob
>
queryWrapper
=
new
QueryWrapper
<
SysScheduleJob
>();
queryWrapper
.
setEntity
(
scheduleJob
);
scheduleJob
=
this
.
getOne
(
queryWrapper
);
scheduleJob
.
setStatus
(
String
.
valueOf
(
status
));
this
.
updateById
(
scheduleJob
);
ScheduleUtils
.
updateScheduleJob
(
scheduler
,
scheduleJob
);
return
0
;
}
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/service/impl/TaskTestService.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
service
.
impl
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.stereotype.Component
;
/**
* @auther wangan
* @date 2019/8/12
*/
@Component
(
value
=
"taskTestService"
)
public
class
TaskTestService
{
private
Logger
log
=
LoggerFactory
.
getLogger
(
TaskTestService
.
class
);
private
void
test
()
{
log
.
info
(
"测试taskTestService"
);
}
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/util/ScheduleJobs.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
util
;
import
cn.hutool.core.date.DatePattern
;
import
cn.hutool.core.date.DateUtil
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJob
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJobLog
;
import
com.yifu.cloud.plus.v1.job.service.SysScheduleJobLogService
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.SpringContextHolder
;
import
org.quartz.JobExecutionContext
;
import
org.quartz.JobExecutionException
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.MDC
;
import
org.springframework.scheduling.quartz.QuartzJobBean
;
import
java.util.Date
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Future
;
public
class
ScheduleJobs
extends
QuartzJobBean
{
private
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
private
ExecutorService
service
=
Executors
.
newSingleThreadExecutor
();
@Override
protected
void
executeInternal
(
JobExecutionContext
context
)
throws
JobExecutionException
{
SysScheduleJob
scheduleJob
=
(
SysScheduleJob
)
context
.
getMergedJobDataMap
()
.
get
(
SysScheduleJob
.
JOB_PARAM_KEY
);
//获取spring bean
SysScheduleJobLogService
scheduleJobLogService
=
(
SysScheduleJobLogService
)
SpringContextHolder
.
getBean
(
"sysScheduleJobLogService"
);
//数据库保存执行记录
SysScheduleJobLog
log
=
new
SysScheduleJobLog
();
log
.
setJobId
(
scheduleJob
.
getJobId
());
log
.
setBeanName
(
scheduleJob
.
getBeanName
());
log
.
setMethodName
(
scheduleJob
.
getMethodName
());
log
.
setParams
(
scheduleJob
.
getParams
());
log
.
setCreatetime
(
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_MS_PATTERN
));
log
.
setRemark
(
scheduleJob
.
getRemark
());
//任务开始时间
long
startTime
=
System
.
currentTimeMillis
();
try
{
// MDC.put("logname");
MDC
.
put
(
"logName"
,
getLogName
(
scheduleJob
.
getMethodName
()));
//执行任务
logger
.
info
(
"任务准备执行,任务ID:"
+
scheduleJob
.
getJobId
());
//任务状态 0:成功 1:失败 2 执行中
log
.
setStatus
(
String
.
valueOf
(
2
));
scheduleJobLogService
.
saveOrUpdate
(
log
);
ScheduleRunnable
task
=
new
ScheduleRunnable
(
scheduleJob
.
getBeanName
(),
scheduleJob
.
getMethodName
(),
scheduleJob
.
getParams
());
Future
<?>
future
=
service
.
submit
(
task
);
future
.
get
();
//任务执行总时长
long
times
=
System
.
currentTimeMillis
()
-
startTime
;
log
.
setTimes
(
String
.
valueOf
(
times
));
//任务状态 0:成功 1:失败 2 执行中
log
.
setStatus
(
String
.
valueOf
(
0
));
logger
.
info
(
"任务执行完毕,任务ID:"
+
scheduleJob
.
getJobId
()
+
" 总共耗时:"
+
times
+
"毫秒"
);
}
catch
(
Exception
e
)
{
logger
.
error
(
"任务执行失败,任务ID:"
+
scheduleJob
.
getJobId
(),
e
);
//任务执行总时长
long
times
=
System
.
currentTimeMillis
()
-
startTime
;
log
.
setTimes
(
String
.
valueOf
(
times
));
//任务状态 0:成功 1:失败 2 执行中
log
.
setStatus
(
String
.
valueOf
(
1
));
log
.
setError
(
e
.
toString
());
}
finally
{
MDC
.
remove
(
"logName"
);
scheduleJobLogService
.
saveOrUpdate
(
log
);
}
}
private
String
getLogName
(
String
path
)
{
return
String
.
format
(
"%s%s_%s"
,
"Schedule"
,
DateUtil
.
format
(
new
Date
(),
DatePattern
.
NORM_DATETIME_MS_PATTERN
),
path
);
}
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/util/ScheduleRunnable.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
util
;
import
com.alibaba.excel.util.StringUtils
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.SpringContextHolder
;
import
org.springframework.util.ReflectionUtils
;
import
java.lang.reflect.Method
;
/**
* 执行定时任务
*/
public
class
ScheduleRunnable
implements
Runnable
{
private
Object
target
;
private
Method
method
;
private
String
params
;
public
ScheduleRunnable
(
String
beanName
,
String
methodName
,
String
params
)
throws
NoSuchMethodException
,
SecurityException
{
this
.
target
=
SpringContextHolder
.
getBean
(
beanName
);
this
.
params
=
params
;
if
(
StringUtils
.
isNotBlank
(
params
))
{
this
.
method
=
target
.
getClass
().
getDeclaredMethod
(
methodName
,
String
.
class
);
}
else
{
this
.
method
=
target
.
getClass
().
getDeclaredMethod
(
methodName
);
}
}
// @Override
public
void
run
()
{
try
{
ReflectionUtils
.
makeAccessible
(
method
);
if
(
StringUtils
.
isNotBlank
(
params
))
{
method
.
invoke
(
target
,
params
);
}
else
{
method
.
invoke
(
target
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
// throw new Exception("执行定时任务失败", e);
}
}
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/util/ScheduleStatus.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
util
;
public
enum
ScheduleStatus
{
/**
* 正常
*/
NORMAL
(
0
),
/**
* 暂停
*/
PAUSE
(
1
);
private
int
value
;
ScheduleStatus
(
int
value
)
{
this
.
value
=
value
;
}
public
int
getValue
()
{
return
value
;
}
}
yifu-job/yifu-job-biz/src/main/java/com/yifu/cloud/plus/v1/job/util/ScheduleUtils.java
0 → 100644
View file @
6fb1c51e
package
com
.
yifu
.
cloud
.
plus
.
v1
.
job
.
util
;
import
com.yifu.cloud.plus.v1.job.entity.SysScheduleJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.quartz.*
;
@Slf4j
public
class
ScheduleUtils
{
private
final
static
String
JOB_NAME
=
"TASK_"
;
/**
* 获取触发器key
*/
public
static
TriggerKey
getTriggerKey
(
String
jobId
)
{
return
TriggerKey
.
triggerKey
(
JOB_NAME
+
jobId
);
}
/**
* 获取jobKey
*/
public
static
JobKey
getJobKey
(
String
jobId
)
{
return
JobKey
.
jobKey
(
JOB_NAME
+
jobId
);
}
/**
* 获取表达式触发器
*/
public
static
CronTrigger
getCronTrigger
(
Scheduler
scheduler
,
String
jobId
)
{
try
{
return
(
CronTrigger
)
scheduler
.
getTrigger
(
getTriggerKey
(
jobId
));
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
// throw new RRException("获取定时任务CronTrigger出现异常", e);
}
return
null
;
}
/**
* 创建定时任务
*/
public
static
void
createScheduleJob
(
Scheduler
scheduler
,
SysScheduleJob
scheduleJob
)
{
try
{
//构建job信息
JobDetail
jobDetail
=
JobBuilder
.
newJob
(
ScheduleJobs
.
class
).
withIdentity
(
getJobKey
(
scheduleJob
.
getJobId
())).
build
();
//表达式调度构建器
CronScheduleBuilder
scheduleBuilder
=
CronScheduleBuilder
.
cronSchedule
(
scheduleJob
.
getCronExpression
())
.
withMisfireHandlingInstructionDoNothing
();
//按新的cronExpression表达式构建一个新的trigger
CronTrigger
trigger
=
TriggerBuilder
.
newTrigger
().
withIdentity
(
getTriggerKey
(
scheduleJob
.
getJobId
())).
withSchedule
(
scheduleBuilder
).
build
();
//放入参数,运行时的方法可以获取
jobDetail
.
getJobDataMap
().
put
(
SysScheduleJob
.
JOB_PARAM_KEY
,
scheduleJob
);
scheduler
.
scheduleJob
(
jobDetail
,
trigger
);
//暂停任务
if
(
Integer
.
parseInt
(
scheduleJob
.
getStatus
())
==
(
ScheduleStatus
.
PAUSE
.
getValue
()))
{
// if (scheduleJob.getStatus().equals(ScheduleStatus.PAUSE.getValue())) {
pauseJob
(
scheduler
,
scheduleJob
.
getJobId
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
// throw new RRException("创建定时任务失败", e);
}
}
/**
* 更新定时任务
*/
public
static
void
updateScheduleJob
(
Scheduler
scheduler
,
SysScheduleJob
scheduleJob
)
{
try
{
TriggerKey
triggerKey
=
getTriggerKey
(
scheduleJob
.
getJobId
());
//表达式调度构建器
CronScheduleBuilder
scheduleBuilder
=
CronScheduleBuilder
.
cronSchedule
(
scheduleJob
.
getCronExpression
())
.
withMisfireHandlingInstructionDoNothing
();
CronTrigger
trigger
=
getCronTrigger
(
scheduler
,
scheduleJob
.
getJobId
());
//按新的cronExpression表达式重新构建trigger
trigger
=
trigger
.
getTriggerBuilder
().
withIdentity
(
triggerKey
).
withSchedule
(
scheduleBuilder
).
build
();
//参数
trigger
.
getJobDataMap
().
put
(
SysScheduleJob
.
JOB_PARAM_KEY
,
scheduleJob
);
scheduler
.
rescheduleJob
(
triggerKey
,
trigger
);
//暂停任务
if
(
Integer
.
parseInt
(
scheduleJob
.
getStatus
())
==
(
ScheduleStatus
.
PAUSE
.
getValue
()))
{
pauseJob
(
scheduler
,
scheduleJob
.
getJobId
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
// throw new RRException("更新定时任务失败", e);
}
}
/**
* 立即执行任务
*/
public
static
void
run
(
Scheduler
scheduler
,
SysScheduleJob
scheduleJob
)
{
try
{
//参数
JobDataMap
dataMap
=
new
JobDataMap
();
dataMap
.
put
(
SysScheduleJob
.
JOB_PARAM_KEY
,
scheduleJob
);
scheduler
.
triggerJob
(
getJobKey
(
scheduleJob
.
getJobId
()),
dataMap
);
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
}
/**
* 暂停任务
*/
public
static
void
pauseJob
(
Scheduler
scheduler
,
String
jobId
)
{
try
{
scheduler
.
pauseJob
(
getJobKey
(
jobId
));
}
catch
(
Exception
e
)
{
// throw new RRException("暂停定时任务失败", e);
log
.
error
(
"执行异常"
,
e
);
}
}
/**
* 恢复任务
*/
public
static
void
resumeJob
(
Scheduler
scheduler
,
String
jobId
)
{
try
{
scheduler
.
resumeJob
(
getJobKey
(
jobId
));
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
}
/**
* 删除定时任务
*/
public
static
void
deleteScheduleJob
(
Scheduler
scheduler
,
String
jobId
)
{
try
{
scheduler
.
deleteJob
(
getJobKey
(
jobId
));
}
catch
(
Exception
e
)
{
log
.
error
(
"执行异常"
,
e
);
}
}
}
yifu-
provider/provider
-biz/src/main/resources/application.yml
→
yifu-
job/yifu-job
-biz/src/main/resources/application.yml
View file @
6fb1c51e
server
:
port
:
7001
port
:
5004
# 加解密根密码
jasypt
:
encryptor
:
...
...
@@ -22,7 +22,12 @@ security:
resource
:
loadBalanced
:
true
token-info-uri
:
http://yifu-auth/oauth/check_token
# 直接放行URL
ignore
:
urls
:
-
/v3/api-docs
-
/actuator/**
-
/swagger-ui/**
# mybaits-plus配置
mybatis-plus
:
mapper-locations
:
classpath:/mapper/*Mapper.xml
...
...
@@ -36,16 +41,45 @@ mybatis-plus:
configuration
:
map-underscore-to-camel-case
:
true
# 直接放行URL
ignore
:
urls
:
-
/v2/api-docs
-
/actuator/**
#spring 配置
spring
:
application
:
name
:
@
artifactId@
#swagger 文档 https://springdoc.org/
### OpenAPI3 注解
# OpenAPI 3 注解位置
# @Tag(name = “接口类描述”) Controller 类上
# @Operation(summary =“接口方法描述”) Controller 方法上
# @Parameters Controller 方法上
# @Parameter(description=“参数描述”) Controller 方法上 @Parameters 里
# @Parameter(description=“参数描述”) Controller 方法的参数上
# @Parameter(hidden = true) 或 @Hidden --
# @Schema DTO类上
# @Schema DTO属性上
springdoc
:
api-docs
:
#是否开启文档功能
enabled
:
true
#swagger后端请求地址
path
:
/api-docs
swagger-ui
:
#自定义swagger前端请求路径,输入http:127.0.0.1:8080/test会自动重定向到swagger页面
path
:
/api
#包扫描路径
packages-to-scan
:
com.yifu.cloud.plus.v1.job.controller
#这里定义了两个分组,可定义多个,也可以不定义
group-configs
:
#分组名
#- group: admin
#按路径匹配
# pathsToMatch: /admin/**
#分组名
-
group
:
job
#按包路径匹配
packagesToScan
:
com.yifu.cloud.plus.v1.job.controller
---
# 数据源配置
spring
:
...
...
@@ -57,7 +91,7 @@ spring:
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
yf_zsk
url
:
jdbc:mysql://192.168.1.65:22306/
provider
?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://192.168.1.65:22306/
yifu_job
?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
config
:
activate
:
on-profile
:
test
...
...
@@ -66,14 +100,14 @@ spring:
# 数据源配置
spring
:
redis
:
host
:
1
92.168.1.65
host
:
1
27.0.0.1
password
:
'
@yf_2017'
datasource
:
type
:
com.zaxxer.hikari.HikariDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
yf_zsk
url
:
jdbc:mysql://192.168.1.65:22306/
provider
?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
url
:
jdbc:mysql://192.168.1.65:22306/
yifu_job
?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
config
:
activate
:
on-profile
:
dev
...
...
yifu-
provider/provider
-biz/src/main/resources/logback-spring.xml
→
yifu-
job/yifu-job
-biz/src/main/resources/logback-spring.xml
View file @
6fb1c51e
...
...
@@ -48,10 +48,6 @@
</filter>
</appender>
<!--nacos 心跳 INFO 屏蔽-->
<logger
name=
"com.alibaba.nacos"
level=
"OFF"
>
<appender-ref
ref=
"error"
/>
</logger>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root
level=
"INFO"
>
...
...
yifu-job/yifu-job-biz/src/main/resources/mapper/SysScheduleJobLogMapper.xml
0 → 100644
View file @
6fb1c51e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yifu.cloud.plus.v1.job.mapper.SysScheduleJobLogMapper"
>
<resultMap
id=
"sysScheduleJobLogMap"
type=
"com.yifu.cloud.plus.v1.job.entity.SysScheduleJobLog"
>
<id
property=
"id"
column=
"ID"
/>
<result
property=
"jobId"
column=
"JOB_ID"
/>
<result
property=
"beanName"
column=
"BEAN_NAME"
/>
<result
property=
"methodName"
column=
"METHOD_NAME"
/>
<result
property=
"params"
column=
"PARAMS"
/>
<result
property=
"status"
column=
"STATUS"
/>
<result
property=
"error"
column=
"ERROR"
/>
<result
property=
"times"
column=
"TIMES"
/>
<result
property=
"createtime"
column=
"CREATETIME"
/>
<result
property=
"remark"
column=
"REMARK"
/>
</resultMap>
<!--sysScheduleJobLog简单分页查询-->
<select
id=
"getSysScheduleJobLogPage"
resultMap=
"sysScheduleJobLogMap"
>
SELECT
ID,
JOB_ID,
BEAN_NAME,
METHOD_NAME,
PARAMS,
STATUS,
ERROR,
TIMES,
CREATETIME,
REMARK
FROM sys_schedule_job_log
<where>
1=1
<if
test=
"sysScheduleJobLog.id != null and sysScheduleJobLog.id.trim() != ''"
>
AND ID = #{sysScheduleJobLog.id}
</if>
<if
test=
"sysScheduleJobLog.jobId != null and sysScheduleJobLog.jobId.trim() != ''"
>
AND JOB_ID = #{sysScheduleJobLog.jobId}
</if>
<if
test=
"sysScheduleJobLog.beanName != null and sysScheduleJobLog.beanName.trim() != ''"
>
AND BEAN_NAME = #{sysScheduleJobLog.beanName}
</if>
<if
test=
"sysScheduleJobLog.methodName != null and sysScheduleJobLog.methodName.trim() != ''"
>
AND METHOD_NAME = #{sysScheduleJobLog.methodName}
</if>
<if
test=
"sysScheduleJobLog.params != null and sysScheduleJobLog.params.trim() != ''"
>
AND PARAMS = #{sysScheduleJobLog.params}
</if>
<if
test=
"sysScheduleJobLog.status != null and sysScheduleJobLog.status.trim() != ''"
>
AND STATUS = #{sysScheduleJobLog.status}
</if>
<if
test=
"sysScheduleJobLog.error != null and sysScheduleJobLog.error.trim() != ''"
>
AND ERROR = #{sysScheduleJobLog.error}
</if>
<if
test=
"sysScheduleJobLog.times != null and sysScheduleJobLog.times.trim() != ''"
>
AND TIMES = #{sysScheduleJobLog.times}
</if>
<if
test=
"sysScheduleJobLog.createtime != null and sysScheduleJobLog.createtime.trim() != ''"
>
AND CREATETIME = #{sysScheduleJobLog.createtime}
</if>
<if
test=
"sysScheduleJobLog.remark != null and sysScheduleJobLog.remark.trim() != ''"
>
AND REMARK = #{sysScheduleJobLog.remark}
</if>
</where>
</select>
</mapper>
yifu-job/yifu-job-biz/src/main/resources/mapper/SysScheduleJobMapper.xml
0 → 100644
View file @
6fb1c51e
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yifu.cloud.plus.v1.job.mapper.SysScheduleJobMapper"
>
<resultMap
id=
"sysScheduleJobMap"
type=
"com.yifu.cloud.plus.v1.job.entity.SysScheduleJob"
>
<id
property=
"id"
column=
"ID"
/>
<result
property=
"jobId"
column=
"JOB_ID"
/>
<result
property=
"beanName"
column=
"BEAN_NAME"
/>
<result
property=
"methodName"
column=
"METHOD_NAME"
/>
<result
property=
"params"
column=
"PARAMS"
/>
<result
property=
"status"
column=
"STATUS"
/>
<result
property=
"cronExpression"
column=
"CRON_EXPRESSION"
/>
<result
property=
"remark"
column=
"REMARK"
/>
<result
property=
"createtime"
column=
"CREATETIME"
/>
</resultMap>
<!--sysScheduleJob简单分页查询-->
<select
id=
"getSysScheduleJobPage"
resultMap=
"sysScheduleJobMap"
>
SELECT
ID,
JOB_ID,
BEAN_NAME,
METHOD_NAME,
PARAMS,
STATUS,
CRON_EXPRESSION,
REMARK,
CREATETIME
FROM sys_schedule_job
<where>
1=1
<if
test=
"sysScheduleJob.id != null and sysScheduleJob.id.trim() != ''"
>
AND ID = #{sysScheduleJob.id}
</if>
<if
test=
"sysScheduleJob.jobId != null and sysScheduleJob.jobId.trim() != ''"
>
AND JOB_ID = #{sysScheduleJob.jobId}
</if>
<if
test=
"sysScheduleJob.beanName != null and sysScheduleJob.beanName.trim() != ''"
>
AND BEAN_NAME = #{sysScheduleJob.beanName}
</if>
<if
test=
"sysScheduleJob.methodName != null and sysScheduleJob.methodName.trim() != ''"
>
AND METHOD_NAME = #{sysScheduleJob.methodName}
</if>
<if
test=
"sysScheduleJob.params != null and sysScheduleJob.params.trim() != ''"
>
AND PARAMS = #{sysScheduleJob.params}
</if>
<if
test=
"sysScheduleJob.status != null and sysScheduleJob.status.trim() != ''"
>
AND STATUS = #{sysScheduleJob.status}
</if>
<if
test=
"sysScheduleJob.cronExpression != null and sysScheduleJob.cronExpression.trim() != ''"
>
AND CRON_EXPRESSION = #{sysScheduleJob.cronExpression}
</if>
<if
test=
"sysScheduleJob.remark != null and sysScheduleJob.remark.trim() != ''"
>
AND REMARK = #{sysScheduleJob.remark}
</if>
<if
test=
"sysScheduleJob.createtime != null and sysScheduleJob.createtime.trim() != ''"
>
AND CREATETIME = #{sysScheduleJob.createtime}
</if>
</where>
</select>
</mapper>
yifu-provider/provider-api/src/main/java/com/yifu/cloud/plus/v1/provider/entity/Provider.java
deleted
100644 → 0
View file @
c9c13b5b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
provider
.
entity
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.yifu.cloud.plus.v1.yifu.common.mybatis.base.BaseEntity
;
import
io.swagger.v3.oas.annotations.media.Schema
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
/**
* provider表
*
* @author fxj
* @date 2022-05-13 23:28:32
*/
@Data
@TableName
(
"provider"
)
@EqualsAndHashCode
(
callSuper
=
true
)
@Schema
(
description
=
"provider表"
)
public
class
Provider
extends
BaseEntity
{
/**
* 主键
*/
@TableId
(
type
=
IdType
.
ASSIGN_ID
)
@Schema
(
description
=
"主键"
)
private
Long
id
;
/**
* 用户名
*/
@Schema
(
description
=
"用户名"
)
private
String
username
;
/**
* 昵称
*/
@Schema
(
description
=
"昵称"
)
private
String
nicename
;
}
yifu-provider/provider-api/src/main/java/com/yifu/cloud/plus/v1/provider/feign/RemoteProviderService.java
deleted
100644 → 0
View file @
c9c13b5b
package
com
.
yifu
.
cloud
.
plus
.
v1
.
provider
.
feign
;
import
com.yifu.cloud.plus.v1.provider.entity.Provider
;
import
com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestHeader
;
/**
* @author fxj
* @Date 2022-05-14
*/
//@FeignClient(contextId="remoteProviderService",value = ServiceNameConstants.PROVIDER_SERVICE)
public
interface
RemoteProviderService
{
@PostMapping
(
"/provider/inner/save"
)
R
<
Boolean
>
testSeata
(
@RequestBody
Provider
provider
,
@RequestHeader
(
SecurityConstants
.
FROM
)
String
from
);
}
yifu-provider/provider-api/src/main/resources/META-INF/spring.factories.txt
deleted
100644 → 0
View file @
c9c13b5b
com.yifu.cloud.plus.v1.yifu.common.feign.YifuFeignAutoConfiguration=\
com.yifu.cloud.plus.v1.provider.feign.RemoteProviderService
\ No newline at end of file
yifu-provider/provider-biz/src/main/java/com/yifu/cloud/plus/v1/provider/controller/ProviderController.java
deleted
100644 → 0
View file @
c9c13b5b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
provider
.
controller
;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yifu.cloud.plus.v1.yifu.common.core.util.R
;
import
com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog
;
import
com.yifu.cloud.plus.v1.provider.entity.Provider
;
import
com.yifu.cloud.plus.v1.provider.service.ProviderService
;
import
com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner
;
import
com.yifu.cloud.plus.v1.yifu.common.security.util.SecurityUtils
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
io.swagger.v3.oas.annotations.Operation
;
import
io.swagger.v3.oas.annotations.security.SecurityRequirement
;
import
io.swagger.v3.oas.annotations.tags.Tag
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.web.bind.annotation.*
;
/**
* provider表
*
* @author fxj
* @date 2022-05-13 23:28:32
*/
@RestController
@RequiredArgsConstructor
@RequestMapping
(
"/provider"
)
@Tag
(
name
=
"provider表管理"
)
@SecurityRequirement
(
name
=
HttpHeaders
.
AUTHORIZATION
)
public
class
ProviderController
{
private
final
ProviderService
providerService
;
/**
* 分页查询
* @param page 分页对象
* @param provider provider表
* @return
*/
@Operation
(
summary
=
"分页查询"
,
description
=
"分页查询"
)
@GetMapping
(
"/page"
)
@PreAuthorize
(
"@pms.hasPermission('provider_provider_get')"
)
public
R
getProviderPage
(
Page
page
,
Provider
provider
)
{
return
R
.
ok
(
providerService
.
page
(
page
,
Wrappers
.
query
(
provider
)));
}
/**
* 通过id查询provider表
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id查询"
,
description
=
"通过id查询"
)
@GetMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('provider_provider_get')"
)
public
R
getById
(
@PathVariable
(
"id"
)
Long
id
)
{
return
R
.
ok
(
providerService
.
getById
(
id
));
}
/**
* 新增provider表
* @param provider provider表
* @return R
*/
@Operation
(
summary
=
"新增provider表"
,
description
=
"新增provider表"
)
@SysLog
(
"新增provider表"
)
@PostMapping
@PreAuthorize
(
"@pms.hasPermission('provider_provider_add')"
)
public
R
save
(
@RequestBody
Provider
provider
)
{
SecurityUtils
.
getAuthentication
();
return
R
.
ok
(
providerService
.
save
(
provider
));
}
/**
* 新增provider表
* @param provider provider表
* @return R
*/
@Operation
(
summary
=
"新增provider表"
,
description
=
"新增provider表"
)
@SysLog
(
"新增provider表"
)
@Inner
@PostMapping
(
"/inner/save"
)
public
R
saveInner
(
@RequestBody
Provider
provider
)
{
return
R
.
ok
(
providerService
.
save
(
provider
));
}
/**
* 修改provider表
* @param provider provider表
* @return R
*/
@Operation
(
summary
=
"修改provider表"
,
description
=
"修改provider表"
)
@SysLog
(
"修改provider表"
)
@PutMapping
@PreAuthorize
(
"@pms.hasPermission('provider_provider_edit')"
)
public
R
updateById
(
@RequestBody
Provider
provider
)
{
return
R
.
ok
(
providerService
.
updateById
(
provider
));
}
/**
* 通过id删除provider表
* @param id id
* @return R
*/
@Operation
(
summary
=
"通过id删除provider表"
,
description
=
"通过id删除provider表"
)
@SysLog
(
"通过id删除provider表"
)
@DeleteMapping
(
"/{id}"
)
@PreAuthorize
(
"@pms.hasPermission('provider_provider_del')"
)
public
R
removeById
(
@PathVariable
Long
id
)
{
return
R
.
ok
(
providerService
.
removeById
(
id
));
}
}
yifu-provider/provider-biz/src/main/java/com/yifu/cloud/plus/v1/provider/mapper/ProviderMapper.java
deleted
100644 → 0
View file @
c9c13b5b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
provider
.
mapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yifu.cloud.plus.v1.provider.entity.Provider
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* provider表
*
* @author fxj
* @date 2022-05-13 23:28:32
*/
@Mapper
public
interface
ProviderMapper
extends
BaseMapper
<
Provider
>
{
}
yifu-provider/provider-biz/src/main/java/com/yifu/cloud/plus/v1/provider/service/ProviderService.java
deleted
100644 → 0
View file @
c9c13b5b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
provider
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yifu.cloud.plus.v1.provider.entity.Provider
;
/**
* provider表
*
* @author fxj
* @date 2022-05-13 23:28:32
*/
public
interface
ProviderService
extends
IService
<
Provider
>
{
}
yifu-provider/provider-biz/src/main/java/com/yifu/cloud/plus/v1/provider/service/impl/ProviderServiceImpl.java
deleted
100644 → 0
View file @
c9c13b5b
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package
com
.
yifu
.
cloud
.
plus
.
v1
.
provider
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.yifu.cloud.plus.v1.provider.entity.Provider
;
import
com.yifu.cloud.plus.v1.provider.mapper.ProviderMapper
;
import
com.yifu.cloud.plus.v1.provider.service.ProviderService
;
import
org.springframework.stereotype.Service
;
/**
* provider表
*
* @author fxj
* @date 2022-05-13 23:28:32
*/
@Service
public
class
ProviderServiceImpl
extends
ServiceImpl
<
ProviderMapper
,
Provider
>
implements
ProviderService
{
}
yifu-provider/provider-biz/src/main/resources/mapper/ProviderMapper.xml
deleted
100644 → 0
View file @
c9c13b5b
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yifu.cloud.plus.v1.provider.mapper.ProviderMapper"
>
<resultMap
id=
"providerMap"
type=
"com.yifu.cloud.plus.v1.provider.entity.Provider"
>
<id
property=
"id"
column=
"id"
/>
<result
property=
"username"
column=
"username"
/>
<result
property=
"nicename"
column=
"nicename"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"createBy"
column=
"create_by"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"updateBy"
column=
"update_by"
/>
</resultMap>
</mapper>
yifu-upms/yifu-upms-biz/src/main/java/com/yifu.cloud.plus.v1/yifu/admin/service/impl/SysMenuServiceImpl.java
View file @
6fb1c51e
...
...
@@ -162,7 +162,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
*/
@Override
public
IPage
<
List
<
SysMenu
>>
getMenuPage
(
Page
page
,
SysMenu
sysMenu
)
{
sysMenu
.
setDelFlag
(
CommonConstants
.
STATUS_
DE
L
);
sysMenu
.
setDelFlag
(
CommonConstants
.
STATUS_
NORMA
L
);
return
baseMapper
.
selectPage
(
page
,
buildQueryWrapper
(
sysMenu
));
}
/**
...
...
yifu-visual/yifu-xxl-job-admin/pom.xml
View file @
6fb1c51e
...
...
@@ -13,11 +13,6 @@
<dependencies>
<!--注册中心客户端-->
<dependency>
<groupId>
com.alibaba.cloud
</groupId>
<artifactId>
spring-cloud-starter-alibaba-nacos-discovery
</artifactId>
</dependency>
<!--hibernate-validator 兼容JAVA11-->
<dependency>
...
...
@@ -80,8 +75,28 @@
<artifactId>
spring-boot-maven-plugin
</artifactId>
</plugin>
<plugin>
<groupId>
io.fabric8
</groupId>
<groupId>
com.spotify
</groupId>
<artifactId>
docker-maven-plugin
</artifactId>
<version>
1.1.0
</version>
<configuration>
<serverId>
docker-hub
</serverId>
<!--指定生成的镜像名-->
<imageName>
${my.hub.host}/${map.group.name}/${project.artifactId}:${project.version}
</imageName>
<dockerDirectory>
${project.basedir}/
</dockerDirectory>
<!--指定远程 docker api地址-->
<!--<dockerHost>http://172.16.66.232:2375</dockerHost>-->
<!-- 这里是复制 jar 包到 docker 容器指定目录配置-->
<resources>
<resource>
<targetPath>
/
</targetPath>
<!--jar 包所在的路径 此处配置的 即对应 target 目录-->
<directory>
${project.build.directory}
</directory>
<!-- 需要包含的 jar包 ,这里对应的是 Dockerfile中添加的文件名 -->
<include>
${project.build.finalName}.jar
</include>
</resource>
</resources>
<forceTags>
true
</forceTags>
</configuration>
</plugin>
</plugins>
<resources>
...
...
yifu-visual/yifu-xxl-job-admin/src/main/java/com/xxl/job/admin/YifuXxlJobAdminApplication.java
View file @
6fb1c51e
...
...
@@ -2,12 +2,10 @@ package com.xxl.job.admin;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
/**
* @author xuxueli 2018-10-28 00:38:13
*/
@EnableDiscoveryClient
@SpringBootApplication
public
class
YifuXxlJobAdminApplication
{
...
...
yifu-visual/yifu-xxl-job-admin/src/main/resources/application.yml
View file @
6fb1c51e
...
...
@@ -18,21 +18,39 @@ xxl:
mybatis
:
mapper-locations
:
classpath:/mybatis-mapper/*Mapper.xml
# spring boot admin 配置
management
:
health
:
mail
:
enabled
:
false
endpoints
:
web
:
exposure
:
include
:
'
*'
endpoint
:
health
:
show-details
:
ALWAYS
# spring
---
# 数据源配置
spring
:
application
:
name
:
@
artifactId@
cloud
:
nacos
:
discovery
:
server-addr
:
${NACOS_HOST:yifu-register}:${NACOS_PORT:8848}
metadata
:
management.context-path
:
${server.servlet.context-path}/actuator
config
:
activate
:
on-profile
:
test
redis
:
host
:
192.168.1.65
port
:
22379
password
:
'
@yf_2017'
datasource
:
url
:
jdbc:mysql://${MYSQL_HOST:yifu-mysql}:${MYSQL_PORT:3306}/${MYSQL_DB:yifu_job}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=tru
e
type
:
com.zaxxer.hikari.HikariDataSourc
e
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
${MYSQL_USER:root}
password
:
${MYSQL_PWD:root}
username
:
root
password
:
yf_zsk
url
:
jdbc:mysql://192.168.1.65:22306/yifu_job?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
#web:
# resources:
# static-locations: classpath:/static/,classpath:/views/
mvc
:
static-path-pattern
:
/static/**
freemarker
:
...
...
@@ -53,16 +71,43 @@ spring:
ssl.enable
:
true
starttls.enable
:
false
required
:
false
# spring boot admin 配置
management
:
health
:
mail
:
enabled
:
false
endpoints
:
web
:
exposure
:
include
:
'
*'
endpoint
:
health
:
show-details
:
ALWAYS
---
# 数据源配置
spring
:
config
:
activate
:
on-profile
:
dev
redis
:
host
:
127.0.0.1
port
:
6379
password
:
'
@yf_2017'
datasource
:
type
:
com.zaxxer.hikari.HikariDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
username
:
root
password
:
yf_zsk
url
:
jdbc:mysql://192.168.1.65:22306/yifu_job?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
#web:
# resources:
# static-locations: classpath:/static/,classpath:/views/
mvc
:
static-path-pattern
:
/static/**
freemarker
:
suffix
:
.ftl
request-context-attribute
:
request
settings
:
number_format
:
0.##########
mail
:
host
:
smtp.mxhichina.com
port
:
465
from
:
xxxx@gitee.wang
username
:
xxxx@gitee.wang
password
:
xxxx
properties
:
mail
:
smtp
:
auth
:
true
ssl.enable
:
true
starttls.enable
:
false
required
:
false
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment