Commit 318de9d8 by huluobin

# update

parent 6f085347
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
package com.bailuntec.job; package com.bailuntec.job;
import com.bailuntec.domain.DcJobConfig;
import com.bailuntec.infrastructure.mapper.DcJobConfigMapper; 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.JobExecution;
import org.springframework.batch.core.listener.JobExecutionListenerSupport; import org.springframework.batch.core.listener.JobExecutionListenerSupport;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -13,21 +16,39 @@ import org.springframework.stereotype.Component; ...@@ -13,21 +16,39 @@ import org.springframework.stereotype.Component;
* @author robbendev * @author robbendev
* @since 2021/1/20 9:58 上午 * @since 2021/1/20 9:58 上午
*/ */
@Slf4j
@Component @Component
public class EbayJobListener extends JobExecutionListenerSupport { public class EbayJobListener extends JobExecutionListenerSupport {
private final DcJobConfigMapper dcJobConfigMapper; private final DcJobConfigMapper dcJobConfigMapper;
private final JobConfiguration jobConfiguration;
public EbayJobListener(DcJobConfigMapper dcJobConfigMapper) { public EbayJobListener(DcJobConfigMapper dcJobConfigMapper,
JobConfiguration jobConfiguration) {
super(); super();
this.dcJobConfigMapper = dcJobConfigMapper; this.dcJobConfigMapper = dcJobConfigMapper;
this.jobConfiguration = jobConfiguration;
} }
@Override @Override
public void afterJob(JobExecution jobExecution) { public void afterJob(JobExecution jobExecution) {
DcJobConfig dcJobConfig = jobConfiguration.getDcJobConfig();
dcJobConfigMapper.updateById(dcJobConfig.refresh());
} }
@Override @Override
public void beforeJob(JobExecution jobExecution) { 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");
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment