Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibztask
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibztask
提交
4464a49a
提交
4464a49a
编写于
6月 18, 2020
作者:
sq3536
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sample
上级
e7b38937
变更
7
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
175 行增加
和
3 行删除
+175
-3
JobsServiceImpl.java
...va/cn/ibizlab/core/task/service/impl/JobsServiceImpl.java
+27
-3
apiSecurityConfig.java
...rc/main/java/cn/ibizlab/api/config/apiSecurityConfig.java
+1
-0
JobsApiResource.java
...pi/src/main/java/cn/ibizlab/api/rest/JobsApiResource.java
+34
-0
pom.xml
ibztask-sample/pom.xml
+59
-0
JobsSampleApplication.java
.../java/com/baomidou/jobs/sample/JobsSampleApplication.java
+20
-0
DemoJobHandler.java
...java/com/baomidou/jobs/sample/handler/DemoJobHandler.java
+24
-0
application.yml
ibztask-sample/src/main/resources/application.yml
+10
-0
未找到文件。
ibztask-core/src/main/java/cn/ibizlab/core/task/service/impl/JobsServiceImpl.java
浏览文件 @
4464a49a
...
@@ -141,7 +141,16 @@ public class JobsServiceImpl implements IJobsService {
...
@@ -141,7 +141,16 @@ public class JobsServiceImpl implements IJobsService {
if
(
et
==
null
)
if
(
et
==
null
)
return
null
;
return
null
;
JobsInfo
jobsInfo
=
new
JobsInfo
();
JobsInfo
jobsInfo
=
new
JobsInfo
();
CachedBeanCopier
.
copy
(
et
,
jobsInfo
);
jobsInfo
.
setApp
(
et
.
getApp
());
jobsInfo
.
setAuthor
(
et
.
getAuthor
());
jobsInfo
.
setCron
(
et
.
getCron
());
jobsInfo
.
setFailRetryCount
(
et
.
getFailRetryCount
());
jobsInfo
.
setHandler
(
et
.
getHandler
());
jobsInfo
.
setParam
(
et
.
getParam
());
jobsInfo
.
setRemark
(
et
.
getRemark
());
jobsInfo
.
setStatus
(
et
.
getStatus
());
jobsInfo
.
setTenantId
(
et
.
getTenantId
());
jobsInfo
.
setTimeout
(
et
.
getTimeout
());
if
(
et
.
getId
()!=
null
)
if
(
et
.
getId
()!=
null
)
jobsInfo
.
setId
(
et
.
getId
().
longValue
());
jobsInfo
.
setId
(
et
.
getId
().
longValue
());
if
(
et
.
getLastTime
()!=
null
)
if
(
et
.
getLastTime
()!=
null
)
...
@@ -160,7 +169,16 @@ public class JobsServiceImpl implements IJobsService {
...
@@ -160,7 +169,16 @@ public class JobsServiceImpl implements IJobsService {
if
(
et
==
null
)
if
(
et
==
null
)
return
null
;
return
null
;
cn
.
ibizlab
.
core
.
task
.
domain
.
JobsInfo
jobsInfo
=
new
cn
.
ibizlab
.
core
.
task
.
domain
.
JobsInfo
();
cn
.
ibizlab
.
core
.
task
.
domain
.
JobsInfo
jobsInfo
=
new
cn
.
ibizlab
.
core
.
task
.
domain
.
JobsInfo
();
CachedBeanCopier
.
copy
(
et
,
jobsInfo
);
jobsInfo
.
setApp
(
et
.
getApp
());
jobsInfo
.
setAuthor
(
et
.
getAuthor
());
jobsInfo
.
setCron
(
et
.
getCron
());
jobsInfo
.
setFailRetryCount
(
et
.
getFailRetryCount
());
jobsInfo
.
setHandler
(
et
.
getHandler
());
jobsInfo
.
setParam
(
et
.
getParam
());
jobsInfo
.
setRemark
(
et
.
getRemark
());
jobsInfo
.
setStatus
(
et
.
getStatus
());
jobsInfo
.
setTenantId
(
et
.
getTenantId
());
jobsInfo
.
setTimeout
(
et
.
getTimeout
());
if
(
et
.
getId
()!=
null
)
if
(
et
.
getId
()!=
null
)
jobsInfo
.
setId
(
BigInteger
.
valueOf
(
et
.
getId
()));
jobsInfo
.
setId
(
BigInteger
.
valueOf
(
et
.
getId
()));
if
(
et
.
getLastTime
()!=
null
)
if
(
et
.
getLastTime
()!=
null
)
...
@@ -180,7 +198,13 @@ public class JobsServiceImpl implements IJobsService {
...
@@ -180,7 +198,13 @@ public class JobsServiceImpl implements IJobsService {
if
(
et
==
null
)
if
(
et
==
null
)
return
null
;
return
null
;
cn
.
ibizlab
.
core
.
task
.
domain
.
JobsLog
jobsLog
=
new
cn
.
ibizlab
.
core
.
task
.
domain
.
JobsLog
();
cn
.
ibizlab
.
core
.
task
.
domain
.
JobsLog
jobsLog
=
new
cn
.
ibizlab
.
core
.
task
.
domain
.
JobsLog
();
CachedBeanCopier
.
copy
(
et
,
jobsLog
);
jobsLog
.
setAddress
(
et
.
getAddress
());
jobsLog
.
setFailRetryCount
(
et
.
getFailRetryCount
());
jobsLog
.
setHandler
(
et
.
getHandler
());
jobsLog
.
setParam
(
et
.
getParam
());
jobsLog
.
setTriggerCode
(
et
.
getTriggerCode
());
jobsLog
.
setTriggerMsg
(
et
.
getTriggerMsg
());
jobsLog
.
setTriggerType
(
et
.
getTriggerType
());
if
(
et
.
getId
()!=
null
)
if
(
et
.
getId
()!=
null
)
jobsLog
.
setId
(
BigInteger
.
valueOf
(
et
.
getId
()));
jobsLog
.
setId
(
BigInteger
.
valueOf
(
et
.
getId
()));
if
(
et
.
getCreateTime
()!=
null
)
if
(
et
.
getCreateTime
()!=
null
)
...
...
ibztask-provider/ibztask-provider-api/src/main/java/cn/ibizlab/api/config/apiSecurityConfig.java
浏览文件 @
4464a49a
...
@@ -119,6 +119,7 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -119,6 +119,7 @@ public class apiSecurityConfig extends WebSecurityConfigurerAdapter {
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
downloadpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
uploadpath
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/jobs-api"
).
permitAll
()
// 所有请求都需要认证
// 所有请求都需要认证
.
anyRequest
().
authenticated
()
.
anyRequest
().
authenticated
()
// 防止iframe 造成跨域
// 防止iframe 造成跨域
...
...
ibztask-provider/ibztask-provider-api/src/main/java/cn/ibizlab/api/rest/JobsApiResource.java
0 → 100644
浏览文件 @
4464a49a
package
cn
.
ibizlab
.
api
.
rest
;
import
com.baomidou.jobs.JobsConstant
;
import
com.baomidou.jobs.starter.JobsScheduler
;
import
org.springframework.beans.factory.InitializingBean
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
/**
* Jobs Api
*
* @author jobob
* @since 2019-07-13
*/
@RestController
public
class
JobsApiResource
implements
InitializingBean
{
@Override
public
void
afterPropertiesSet
()
throws
Exception
{
// to do nothing
}
@RequestMapping
(
JobsConstant
.
JOBS_API
)
public
void
api
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
,
ServletException
{
JobsScheduler
.
invokeAdminService
(
request
,
response
);
}
}
ibztask-sample/pom.xml
0 → 100644
浏览文件 @
4464a49a
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.2.1.RELEASE
</version>
</parent>
<artifactId>
ibztask-sample
</artifactId>
<name>
Ibztask Sample
</name>
<description>
Sample
</description>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<version>
2.2.1.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
jobs-spring-boot-starter
</artifactId>
<version>
1.0.3
</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>
${basedir}/src/main/resources
</directory>
<includes>
<include>
**/**
</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<configuration>
<finalName>
ibztask
</finalName>
<jvmArguments>
-Dfile.encoding=UTF-8
</jvmArguments>
<mainClass>
com.baomidou.jobs.sample.JobsSampleApplication
</mainClass>
<outputDirectory>
../
</outputDirectory>
</configuration>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
ibztask-sample/src/main/java/com/baomidou/jobs/sample/JobsSampleApplication.java
0 → 100644
浏览文件 @
4464a49a
package
com
.
baomidou
.
jobs
.
sample
;
import
com.baomidou.jobs.starter.EnableJobs
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
/**
* Spring boot jobs sample
*
* @author jobob
* @since 2019-06-25
*/
@EnableJobs
@SpringBootApplication
public
class
JobsSampleApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
JobsSampleApplication
.
class
,
args
);
}
}
\ No newline at end of file
ibztask-sample/src/main/java/com/baomidou/jobs/sample/handler/DemoJobHandler.java
0 → 100644
浏览文件 @
4464a49a
package
com
.
baomidou
.
jobs
.
sample
.
handler
;
import
com.baomidou.jobs.api.JobsResponse
;
import
com.baomidou.jobs.exception.JobsException
;
import
com.baomidou.jobs.handler.IJobsHandler
;
import
org.springframework.stereotype.Component
;
/**
* 处理器 DEMO
*
* @author jobob
* @since 2019-07-16
*/
@Component
(
"demojobhandler"
)
public
class
DemoJobHandler
implements
IJobsHandler
{
@Override
public
JobsResponse
execute
(
String
tenantId
,
String
param
)
throws
JobsException
{
System
.
out
.
println
(
"执行 DemoJobHandler tenantId="
+
tenantId
+
",param="
+
param
);
return
JobsResponse
.
ok
();
}
}
ibztask-sample/src/main/resources/application.yml
0 → 100644
浏览文件 @
4464a49a
# web port
server
:
port
:
8081
### jobs
jobs
:
admin-address
:
http://127.0.0.1:40005
app-name
:
jobs-executor-sample
app-port
:
9999
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录