Authored by DengXinFei

Merge branch 'hotfix' of git.dev.yoho.cn:yoho30/yohobuy-activity into hotfix

... ... @@ -40,7 +40,7 @@ public class RedisCache {
IDrawlineUserQueueDAO drawlineUserQueueDAO;
@Resource
IDrawlineActivityDAO drawlineActivityDAO;
public static final String SORT_ID_KEY = "SORT_ID_KEY_";
public static final String SORT_ID_KEY = "yh:activity:activitysort_";
@PostConstruct
public void init() {
... ...
... ... @@ -12,7 +12,7 @@ package com.yoho.activity.common.constatns;
public class Constant {
//是否执行定时任务
public static boolean EXECUTE_TASK = false;
public static boolean EXECUTE_TASK = true;
}
... ...
... ... @@ -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);
}
}
... ...