Authored by ping

update

/**
*
*/
package com.yoho.activity.common.utils;
import com.netflix.config.DynamicBooleanProperty;
import com.netflix.config.DynamicPropertyFactory;
/**
* 描述:
*
* @author ping.huang
* 2016年3月8日
*/
public class PropertiesUtil {
/**
* 获取定时任务是否执行的配置值
* @return
*/
public static boolean getExecuteTask() {
DynamicBooleanProperty pro = DynamicPropertyFactory.getInstance().getBooleanProperty("activity.execute.task", false);
return pro.get();
}
}
... ...
... ... @@ -20,6 +20,7 @@ import org.springframework.stereotype.Component;
import com.yoho.activity.common.enums.UserTypeEnum;
import com.yoho.activity.common.utils.MapUtil;
import com.yoho.activity.common.utils.MapUtil.FunctionExPlus;
import com.yoho.activity.common.utils.PropertiesUtil;
import com.yoho.queue.dal.IDrawlineActivityDAO;
import com.yoho.queue.dal.IDrawlineUserQueueDAO;
import com.yoho.queue.dal.IDrawlineVirtualUserDAO;
... ... @@ -36,7 +37,7 @@ import com.yoho.queue.dal.model.DrawlineVirtualUser;
*
* @author ping.huang 2016年3月5日
*/
//@Component
@Component
public class AddVirtualUserTimer {
static Logger log = LoggerFactory.getLogger(AddVirtualUserTimer.class);
... ... @@ -105,6 +106,11 @@ public class AddVirtualUserTimer {
@Scheduled(fixedDelay = 60 * 1000)
public void run() {
log.info("start add virtuals");
boolean execute = PropertiesUtil.getExecuteTask();
if (!execute) {
log.info("properties is false exit task");
return;
}
//没有活动,直接退出
if (activityList == null || activityList.size() == 0) {
... ...
... ... @@ -32,3 +32,6 @@ drawline.luckydraw.interval=1440
# ******************** drawline lucky user notice task interval(TimeUnit.MINUTES) ********************
drawline.luckyUserNotice.interval=120
#定时任务是否执行
activity.execute.task = true
... ...
... ... @@ -9,6 +9,7 @@
<property name="drawline.luckydraw.interval" defaultValue="1440" description="执行定时抽奖任务间隔" />
<property name="drawline.luckyUserNotice.interval" defaultValue="120" description="执行抽奖结果通知任务间隔" />
<property name="activity.execute.task" defaultValue="false" description="定时任务是否执行" />
</group>
<script>
<generate template="META-INF/autoconf/databases.yml" destfile="WEB-INF/classes/databases.yml" />
... ...
... ... @@ -32,3 +32,6 @@ drawline.luckydraw.interval=${drawline.luckydraw.interval}
# ******************** drawline user notice task interval(TimeUnit.MINUTES) ********************
drawline.luckyUserNotice.interval=${drawline.luckyUserNotice.interval}
#\u5B9A\u65F6\u4EFB\u52A1\u662F\u5426\u6267\u884C
activity.execute.task = ${activity.execute.task}
... ...