Authored by wangshusheng

定时任务10分钟执行一次

... ... @@ -6,6 +6,7 @@ package com.yoho.activity.other.timer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
... ... @@ -21,12 +22,26 @@ public class SendUserAwardTimer {
static Logger log = LoggerFactory.getLogger(SendUserAwardTimer.class);
@Value("${is_task_enable}")
private String taskFlag = "true";
public String getTaskFlag() {
return taskFlag;
}
public void setTaskFlag(String taskFlag) {
this.taskFlag = taskFlag;
}
@Autowired
private ILuckyUserService luckyUserService;
@Scheduled(fixedDelay = 60 * 1000)
@Scheduled(fixedDelay = 600 * 1000)
public void sendAwardToLuckyUser() {
// 对中奖表中的所有记录做发放
luckyUserService.sendAwardToLuckyUser(null);
if("true".equals(taskFlag)){
// 对中奖表中的所有记录做发放
luckyUserService.sendAwardToLuckyUser(null);
}
}
}
... ...