|  |  |  | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.quartz.JobExecutionContext; | 
|---|
|  |  |  | import org.quartz.JobExecutionException; | 
|---|
|  |  |  | import org.springframework.stereotype.Component; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Slf4j | 
|---|
|  |  |  | @Component | 
|---|
|  |  |  | public class LogMoveTask extends TaskJob { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | 
|---|
|  |  |  | public void execute(JobExecutionContext ctx) throws JobExecutionException { | 
|---|
|  |  |  | log.info("生产日志移动任务开始"); | 
|---|
|  |  |  | StaDeviceProductionLogPastMapper pastMapper = SpringContextUtil.getBean(StaDeviceProductionLogPastMapper.class); | 
|---|
|  |  |  | pastMapper.insertIntoPastLogs(); | 
|---|
|  |  |  | pastMapper.deleteFromLogTable(); | 
|---|
|  |  |  | Long count = pastMapper.countLastDayLogs(); | 
|---|
|  |  |  | if(count>0){ | 
|---|
|  |  |  | pastMapper.insertIntoPastLogs(); | 
|---|
|  |  |  | pastMapper.deleteFromLogTable(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | log.info("生产日志移动任务结束"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|