|
|
@@ -1,6 +1,7 @@
|
|
|
package com.uas.platform.b2c.prod.store.task;
|
|
|
|
|
|
import com.uas.platform.b2c.prod.store.service.StoreViolationsService;
|
|
|
+import org.apache.log4j.Logger;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.scheduling.annotation.EnableAsync;
|
|
|
@@ -8,9 +9,12 @@ import org.springframework.scheduling.annotation.EnableScheduling;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+
|
|
|
/**
|
|
|
* 店铺违规处置自动结束定时任务
|
|
|
- * 每天0:0:0执行任务
|
|
|
+ * 每天0:0:0执行任务[cron: '0 0 0 1/1 * ?']
|
|
|
*
|
|
|
* @author huxz
|
|
|
* @version 2017-08-14 14:59:56 创建文件
|
|
|
@@ -22,15 +26,23 @@ public class ViolationsAutoFinish {
|
|
|
|
|
|
private final StoreViolationsService violationsService;
|
|
|
|
|
|
+ private final Logger logger = Logger.getLogger(getClass());
|
|
|
+
|
|
|
@Autowired
|
|
|
public ViolationsAutoFinish(StoreViolationsService violationsService) {
|
|
|
this.violationsService = violationsService;
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ logger.info(String.format("%s 店铺违规处置自动完成任务实例化", dateFormat.format(new Date())));
|
|
|
}
|
|
|
|
|
|
@Async
|
|
|
- @Scheduled(cron = "0 0 0 1/1 * ?")
|
|
|
+ @Scheduled(cron = "0 */1 * * * ?")
|
|
|
public void execute() {
|
|
|
try {
|
|
|
+ Date startTime = new Date();
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
+ logger.info(String.format("%s 店铺违规处置自动完成任务开始", dateFormat.format(startTime)));
|
|
|
+
|
|
|
violationsService.autoFinishViolationsWhenDisposeTimeIsInvalid();
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|