Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
byit-myth-job
Overview
Overview
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
liyuan
byit-myth-job
Commits
a9a34a68
Commit
a9a34a68
authored
Dec 09, 2019
by
huangfusuper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加任务节点的查询
parent
f047ac4a
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
224 additions
and
3 deletions
+224
-3
pom.xml
byit-myth-admin/pom.xml
+0
-1
JobController.java
...dmin/src/main/java/com/byit/controller/JobController.java
+12
-1
pom.xml
byit-myth-core/myth-admin-core/pom.xml
+26
-0
MythJobAutoConfigure.java
...ore/src/main/java/com/byit/conf/MythJobAutoConfigure.java
+23
-0
JobInfoMapper.java
...-admin-core/src/main/java/com/byit/dao/JobInfoMapper.java
+23
-0
JobInfoService.java
...n-core/src/main/java/com/byit/service/JobInfoService.java
+21
-0
JobInfoServiceImpl.java
...c/main/java/com/byit/service/impl/JobInfoServiceImpl.java
+25
-0
spring.factories
...h-admin-core/src/main/resources/META-INF/spring.factories
+2
-0
MythJobInfoMapper.xml
...dmin-core/src/main/resources/mapper/MythJobInfoMapper.xml
+75
-0
MythJobInfo.java
...-common/src/main/java/com/byit/job/model/MythJobInfo.java
+1
-1
pom.xml
pom.xml
+16
-0
No files found.
byit-myth-admin/pom.xml
View file @
a9a34a68
...
@@ -29,7 +29,6 @@
...
@@ -29,7 +29,6 @@
<dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<artifactId>
fastjson
</artifactId>
<version>
1.2.62
</version>
</dependency>
</dependency>
</dependencies>
</dependencies>
...
...
byit-myth-admin/src/main/java/com/byit/controller/JobController.java
View file @
a9a34a68
package
com
.
byit
.
controller
;
package
com
.
byit
.
controller
;
import
com.byit.job.WorkRoulette
;
import
com.byit.job.WorkRoulette
;
import
com.byit.job.model.MythJobInfo
;
import
com.byit.job.model.PluginBeanJobInfo
;
import
com.byit.job.model.PluginBeanJobInfo
;
import
com.byit.job.model.ReturnResult
;
import
com.byit.job.model.ReturnResult
;
import
com.byit.service.JobInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
/**
/**
* @program: byit-myth-job->JobHandel
* @program: byit-myth-job->JobHandel
* @description: 测试添加任务
* @description: 测试添加任务
...
@@ -14,7 +19,8 @@ import org.springframework.web.bind.annotation.*;
...
@@ -14,7 +19,8 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RestController
@RequestMapping
(
"job"
)
@RequestMapping
(
"job"
)
public
class
JobController
{
public
class
JobController
{
@Autowired
private
JobInfoService
jobInfoService
;
@PostMapping
(
value
=
"addJob"
)
@PostMapping
(
value
=
"addJob"
)
public
String
addJob
(
@RequestBody
PluginBeanJobInfo
pluginBeanJobInfo
){
public
String
addJob
(
@RequestBody
PluginBeanJobInfo
pluginBeanJobInfo
){
WorkRoulette
.
addJob
(
pluginBeanJobInfo
);
WorkRoulette
.
addJob
(
pluginBeanJobInfo
);
...
@@ -25,4 +31,9 @@ public class JobController {
...
@@ -25,4 +31,9 @@ public class JobController {
public
void
callbackRes
(
@RequestBody
ReturnResult
<
String
>
result
){
public
void
callbackRes
(
@RequestBody
ReturnResult
<
String
>
result
){
System
.
out
.
println
(
result
.
getCode
()+
"-----"
+
result
.
getMsg
());
System
.
out
.
println
(
result
.
getCode
()+
"-----"
+
result
.
getMsg
());
}
}
@GetMapping
(
value
=
"getJobInfo"
)
public
List
<
MythJobInfo
>
getJobInfo
(){
return
jobInfoService
.
findMythJobInfoByTriggerNextTime
(
11
);
}
}
}
byit-myth-core/myth-admin-core/pom.xml
View file @
a9a34a68
...
@@ -30,6 +30,32 @@
...
@@ -30,6 +30,32 @@
<artifactId>
myth-core-common
</artifactId>
<artifactId>
myth-core-common
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-mail
</artifactId>
</dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<!--自动装载配置-->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-autoconfigure
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-configuration-processor
</artifactId>
</dependency>
</dependencies>
</dependencies>
...
...
byit-myth-core/myth-admin-core/src/main/java/com/byit/conf/MythJobAutoConfigure.java
0 → 100644
View file @
a9a34a68
package
com
.
byit
.
conf
;
import
com.byit.service.impl.JobInfoServiceImpl
;
import
com.byit.service.JobInfoService
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.PropertySource
;
/**
* @program: byit-myth-job->AppConf
* @description: 稳健配置
* @author: huangfu
* @date: 2019/12/9 14:51
**/
@Configuration
@MapperScan
(
"com.byit.dao"
)
public
class
MythJobAutoConfigure
{
@Bean
public
JobInfoService
jobInfoService
(){
return
new
JobInfoServiceImpl
();
}
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/dao/JobInfoMapper.java
0 → 100644
View file @
a9a34a68
package
com
.
byit
.
dao
;
import
com.byit.job.model.MythJobInfo
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
/**
* @program: byit-myth-job->JobInfoMapper
* @description: 对于任务节点的操作
* @author: huangfu
* @date: 2019/12/9 14:47
**/
@Repository
public
interface
JobInfoMapper
{
/**
* 根据下次执行时间+7000毫秒 查询所有任务节点
* @param maxNextTime
* @return
*/
List
<
MythJobInfo
>
findMythJobInfoByTriggerNextTime
(
@Param
(
"maxNextTime"
)
long
maxNextTime
);
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/JobInfoService.java
0 → 100644
View file @
a9a34a68
package
com
.
byit
.
service
;
import
com.byit.job.model.MythJobInfo
;
import
java.util.List
;
/**
* @program: byit-myth-job->JobInfoService
* @description: 任务节点操作
* @author: huangfu
* @date: 2019/12/9 15:17
**/
public
interface
JobInfoService
{
/**
* 查询7秒内要执行的数据
* @param maxNextTime
* @return
*/
List
<
MythJobInfo
>
findMythJobInfoByTriggerNextTime
(
long
maxNextTime
);
}
byit-myth-core/myth-admin-core/src/main/java/com/byit/service/impl/JobInfoServiceImpl.java
0 → 100644
View file @
a9a34a68
package
com
.
byit
.
service
.
impl
;
import
com.byit.dao.JobInfoMapper
;
import
com.byit.job.model.MythJobInfo
;
import
com.byit.service.JobInfoService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* @program: byit-myth-job->JobInfoServiceImpl
* @description: 任务节点操作的实现类
* @author: huangfu
* @date: 2019/12/9 15:18
**/
public
class
JobInfoServiceImpl
implements
JobInfoService
{
@Autowired
private
JobInfoMapper
jobInfoMapper
;
@Override
public
List
<
MythJobInfo
>
findMythJobInfoByTriggerNextTime
(
long
maxNextTime
)
{
return
jobInfoMapper
.
findMythJobInfoByTriggerNextTime
(
maxNextTime
);
}
}
byit-myth-core/myth-admin-core/src/main/resources/META-INF/spring.factories
0 → 100644
View file @
a9a34a68
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\com.byit.conf.MythJobAutoConfigure
\ No newline at end of file
byit-myth-core/myth-admin-core/src/main/resources/mapper/MythJobInfoMapper.xml
0 → 100644
View file @
a9a34a68
<?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.byit.dao.JobInfoMapper"
>
<sql
id=
"Base_Column_List"
>
t.id,
t.job_name,
t.executor_handler,
t.job_cron,
t.job_desc,
t.plugin_urls,
t.routing_strategy,
t.blocking_strategy,
t.callback_token,
t.gateway_token,
t.request_host,
t.request_port,
t.job_param,
t.job_type,
t.taskflow_id,
t.parent_id,
t.taskflow_is_cron,
t.alarm_email,
t.executor_timeout,
t.source_urls,
t.trigger_status,
t.glue_source,
t.glue_remark,
t.glue_updatetime,
t.trigger_next_time,
t.author,
t.add_time,
t.update_time,
t.removal_mark
</sql>
<resultMap
id=
"MythJobInfo"
type=
"com.byit.job.model.MythJobInfo"
>
<id
column=
"id"
property=
"id"
/>
<result
column=
"job_name"
property=
"jobName"
/>
<result
column=
"executor_handler"
property=
"executorHandler"
/>
<result
column=
"job_cron"
property=
"jobCron"
/>
<result
column=
"job_desc"
property=
"jobDesc"
/>
<result
column=
"plugin_urls"
property=
"pluginUrls"
/>
<result
column=
"routing_strategy"
property=
"routingStrategy"
/>
<result
column=
"blocking_strategy"
property=
"blockingStrategy"
/>
<result
column=
"callback_token"
property=
"callbackToken"
/>
<result
column=
"gateway_token"
property=
"gatewayToken"
/>
<result
column=
"request_host"
property=
"requestHost"
/>
<result
column=
"request_port"
property=
"requestPort"
/>
<result
column=
"job_param"
property=
"jobParam"
/>
<result
column=
"job_type"
property=
"jobType"
/>
<result
column=
"taskflow_id"
property=
"taskFlowId"
/>
<result
column=
"parent_id"
property=
"parentId"
/>
<result
column=
"taskflow_is_cron"
property=
"taskFlowIsCron"
/>
<result
column=
"alarm_email"
property=
"alarmEmail"
/>
<result
column=
"executor_timeout"
property=
"executorTimeout"
/>
<result
column=
"source_urls"
property=
"sourceUrls"
/>
<result
column=
"trigger_status"
property=
"triggerStatus"
/>
<result
column=
"glue_source"
property=
"glueSource"
/>
<result
column=
"glue_remark"
property=
"glueRemark"
/>
<result
column=
"glue_updatetime"
property=
"glueUpdateTime"
/>
<result
column=
"trigger_next_time"
property=
"triggerNextTime"
/>
<result
column=
"author"
property=
"author"
/>
<result
column=
"add_time"
property=
"addTime"
/>
<result
column=
"update_time"
property=
"updateTime"
/>
<result
column=
"removal_mark"
property=
"removalMark"
/>
</resultMap>
<select
id=
"findMythJobInfoByTriggerNextTime"
resultMap=
"MythJobInfo"
>
SELECT
<include
refid=
"Base_Column_List"
/>
FROM job_info AS t
WHERE t.trigger_status=1
and t.trigger_next_time
<![CDATA[ <= ]]>
#{maxNextTime}
</select>
</mapper>
\ No newline at end of file
byit-myth-core/myth-core-common/src/main/java/com/byit/job/model/MythJobInfo.java
View file @
a9a34a68
...
@@ -25,7 +25,7 @@ public class MythJobInfo {
...
@@ -25,7 +25,7 @@ public class MythJobInfo {
/**
/**
* 任务节点的名字
* 任务节点的名字
*/
*/
private
String
n
ame
;
private
String
jobN
ame
;
/**
/**
* 插件任务调度的key,调度中心会根据这个key找到对应的插件端任务,执行
* 插件任务调度的key,调度中心会根据这个key找到对应的插件端任务,执行
*/
*/
...
...
pom.xml
View file @
a9a34a68
...
@@ -52,6 +52,8 @@
...
@@ -52,6 +52,8 @@
<spring-cloud.version>
Dalston.RELEASE
</spring-cloud.version>
<spring-cloud.version>
Dalston.RELEASE
</spring-cloud.version>
<lombok.version>
1.18.4
</lombok.version>
<lombok.version>
1.18.4
</lombok.version>
<hutool.version>
4.5.11
</hutool.version>
<hutool.version>
4.5.11
</hutool.version>
<spring.boot.starter.mail.version>
2.2.2.RELEASE
</spring.boot.starter.mail.version>
<mybatis.spring.boot.starter>
2.1.1
</mybatis.spring.boot.starter>
<commons.lang3.version>
3.9
</commons.lang3.version>
<commons.lang3.version>
3.9
</commons.lang3.version>
<maven-source-plugin.version>
3.1.0
</maven-source-plugin.version>
<maven-source-plugin.version>
3.1.0
</maven-source-plugin.version>
...
@@ -147,6 +149,20 @@
...
@@ -147,6 +149,20 @@
<version>
${commons.lang3.version}
</version>
<version>
${commons.lang3.version}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-mail
</artifactId>
<version>
${spring.boot.starter.mail.version}
</version>
</dependency>
<dependency>
<groupId>
org.mybatis.spring.boot
</groupId>
<artifactId>
mybatis-spring-boot-starter
</artifactId>
<version>
${mybatis.spring.boot.starter}
</version>
</dependency>
</dependencies>
</dependencies>
</dependencyManagement>
</dependencyManagement>
...
...
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