Authored by ping

update

/**
*
*/
package com.yoho.activity.common.constatns;
/**
* 描述:
*
* @author ping.huang
* 2016年3月8日
*/
public class Constant {
//是否执行定时任务
public static boolean EXECUTE_TASK = false;
}
... ...
... ... @@ -3,8 +3,7 @@
*/
package com.yoho.activity.common.utils;
import com.netflix.config.DynamicBooleanProperty;
import com.netflix.config.DynamicPropertyFactory;
import com.yoho.activity.common.constatns.Constant;
/**
* 描述:
... ... @@ -19,7 +18,10 @@ public class PropertiesUtil {
* @return
*/
public static boolean getExecuteTask() {
DynamicBooleanProperty pro = DynamicPropertyFactory.getInstance().getBooleanProperty("activity.execute.task", false);
return pro.get();
return Constant.EXECUTE_TASK;
}
public static void setExecuteTaskValue(boolean value) {
Constant.EXECUTE_TASK = value;
}
}
... ...
/**
*
*/
package com.yoho.activity.other.restapi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yoho.activity.common.utils.PropertiesUtil;
import com.yoho.activity.queue.ApiResponse;
/**
* 描述:
*
* @author ping.huang
* 2016年3月8日
*/
@Controller
public class ChangeTaskValueRest {
static Logger logger = LoggerFactory.getLogger(ChangeTaskValueRest.class);
@RequestMapping(params = "method=app.drawline.changeTaskValue")
@ResponseBody
public ApiResponse changeTaskValue(String value){
logger.info("Enter changeTaskValue: value is {}", value);
PropertiesUtil.setExecuteTaskValue(Boolean.valueOf(value));
return new ApiResponse.ApiResponseBuilder().build();
}
}
... ...
... ... @@ -8,7 +8,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import org.apache.commons.lang.StringUtils;
... ... @@ -52,9 +51,6 @@ public class AddVirtualUserTimer {
//各个活动下,待进入排队的马甲
Map<Integer, List<DrawlineVirtualUser>> waitAddUserMap = new HashMap<Integer, List<DrawlineVirtualUser>>();
//各个活动下,已经进入排队的马甲(该变量可以去掉了)
// Map<Integer, DrawlineVirtualUser> alreadyAddUserMap = null;
//所有的活动
List<DrawlineActivity> activityList = null;
... ... @@ -67,8 +63,13 @@ public class AddVirtualUserTimer {
/**
* 初始化一些参数
*/
@PostConstruct
public void init() {
waitAddUserMap = new HashMap<Integer, List<DrawlineVirtualUser>>();
activityList = new ArrayList<DrawlineActivity>();
activityIdList = new ArrayList<Integer>();
first = new HashMap<Integer, Boolean>();
//初始化所有活动
activityList = drawlineActivityDAO.selectAllActivity();
... ... @@ -112,6 +113,9 @@ public class AddVirtualUserTimer {
return;
}
//初始化数据
init();
//没有活动,直接退出
if (activityList == null || activityList.size() == 0) {
log.info("activityList is empty over");
... ...
... ... @@ -33,5 +33,3 @@ drawline.luckydraw.interval=1440
# ******************** drawline lucky user notice task interval(TimeUnit.MINUTES) ********************
drawline.luckyUserNotice.interval=120
#定时任务是否执行
activity.execute.task = true
... ...
... ... @@ -9,7 +9,6 @@
<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" />
... ...
... ... @@ -33,5 +33,3 @@ 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}
... ...