...
|
...
|
@@ -6,12 +6,14 @@ 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;
|
|
|
|
|
|
import com.netflix.config.DynamicPropertyFactory;
|
|
|
import com.netflix.config.DynamicStringProperty;
|
|
|
import com.yoho.activity.common.utils.PropertiesUtil;
|
|
|
import com.yoho.activity.queue.service.ILuckyUserService;
|
|
|
import com.yoho.core.common.utils.LocalIp;
|
|
|
|
|
|
/**
|
|
|
* 描述:对活动中奖用户发放奖励
|
...
|
...
|
@@ -25,20 +27,27 @@ public class SendUserAwardTimer { |
|
|
|
|
|
@Autowired
|
|
|
private ILuckyUserService luckyUserService;
|
|
|
|
|
|
|
|
|
@Scheduled(fixedDelay = 300 * 1000)
|
|
|
public void sendAwardToLuckyUser() {
|
|
|
|
|
|
DynamicStringProperty taskHost = DynamicPropertyFactory.getInstance().getStringProperty("execute.timetask.host", "192.168.90.9");
|
|
|
String localIP = LocalIp.getLocalIp();
|
|
|
log.info("sendAwardToLuckyUser: getLocalIp. localIP is {}, taskHost is {}", localIP, taskHost.get());
|
|
|
if (null == localIP || !localIP.equals(taskHost.get())) {
|
|
|
log.info("sendAwardToLuckyUser: not bind execute.timetask.host. localIP is {}, taskHost is {}", localIP, taskHost.get());
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
boolean execute = PropertiesUtil.getExecuteTask();
|
|
|
log.info(" SendUserAwardTimer.sendAwardToLuckyUser, execute is {}", execute);
|
|
|
if (!execute) {
|
|
|
log.info("properties is false exit task");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
// 对中奖表中的所有记录做发放
|
|
|
log.info(" start luckyUserService.sendAwardToLuckyUser");
|
|
|
luckyUserService.sendAwardToLuckyUser(null);
|
|
|
|
|
|
|
|
|
}
|
|
|
} |
...
|
...
|
|