Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bailuntec-datacenter
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
huluobin
bailuntec-datacenter
Commits
318de9d8
Commit
318de9d8
authored
Jan 20, 2021
by
huluobin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
# update
parent
6f085347
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletion
+30
-1
Dockerfile
...datacenter-base/base-sync-ebay/src/main/docker/Dockerfile
+8
-0
EbayJobListener.java
...ebay/src/main/java/com/bailuntec/job/EbayJobListener.java
+22
-1
No files found.
datacenter-job/datacenter-base/base-sync-ebay/src/main/docker/Dockerfile
0 → 100644
View file @
318de9d8
FROM
openjdk:8-jdk-alpine
VOLUME
/tmp
ADD
base-sync-fee-1.0-SNAPSHOT.jar app.jar
RUN
echo
"Asia/Shanghai"
>
/etc/timezone
ENTRYPOINT
["java","-Xms300m","-Xmx600m","-jar","-Dspring.profiles.active=prod","/app.jar"]
EXPOSE
8080
datacenter-job/datacenter-base/base-sync-ebay/src/main/java/com/bailuntec/job/EbayJobListener.java
View file @
318de9d8
package
com
.
bailuntec
.
job
;
import
com.bailuntec.domain.DcJobConfig
;
import
com.bailuntec.infrastructure.mapper.DcJobConfigMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.batch.core.BatchStatus
;
import
org.springframework.batch.core.JobExecution
;
import
org.springframework.batch.core.listener.JobExecutionListenerSupport
;
import
org.springframework.stereotype.Component
;
...
...
@@ -13,21 +16,39 @@ import org.springframework.stereotype.Component;
* @author robbendev
* @since 2021/1/20 9:58 上午
*/
@Slf4j
@Component
public
class
EbayJobListener
extends
JobExecutionListenerSupport
{
private
final
DcJobConfigMapper
dcJobConfigMapper
;
private
final
JobConfiguration
jobConfiguration
;
public
EbayJobListener
(
DcJobConfigMapper
dcJobConfigMapper
)
{
public
EbayJobListener
(
DcJobConfigMapper
dcJobConfigMapper
,
JobConfiguration
jobConfiguration
)
{
super
();
this
.
dcJobConfigMapper
=
dcJobConfigMapper
;
this
.
jobConfiguration
=
jobConfiguration
;
}
@Override
public
void
afterJob
(
JobExecution
jobExecution
)
{
DcJobConfig
dcJobConfig
=
jobConfiguration
.
getDcJobConfig
();
dcJobConfigMapper
.
updateById
(
dcJobConfig
.
refresh
());
}
@Override
public
void
beforeJob
(
JobExecution
jobExecution
)
{
DcJobConfig
dcJobConfig
=
dcJobConfigMapper
.
selectByName
(
"base-sync-finance-ebay-ad"
);
jobConfiguration
.
setDcJobConfig
(
dcJobConfig
);
if
(
jobExecution
.
getStatus
()
==
BatchStatus
.
COMPLETED
)
{
log
.
info
(
"!!! JOB FINISHED! Time to verify the results"
);
}
if
(
jobExecution
.
getStatus
()
==
BatchStatus
.
FAILED
)
{
//todo 任务失败提醒推送
log
.
error
(
"!!! JOB FAILED"
);
}
}
}
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