Authored by wangshusheng

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

# Conflicts:
#	pom.xml
Showing 26 changed files with 748 additions and 472 deletions
/.settings
/.project
other/.settings/
other/.project
other/.gitignore
other/.classpath
... ...
... ... @@ -28,13 +28,13 @@ public interface IDrawlineLuckyUserDAO {
DrawlineLuckyUser selectByActivityIdAndUidAndUserType(@Param("activityId") int activityId, @Param("uid") int uid, @Param("userType") byte userType);
List<DrawlineLuckyUser> selectNotcieUserByActId(@Param("activityId") Integer activityId, @Param("offset") int offset, @Param("limit") int limit);
List<DrawlineLuckyUser> selectNotcieUserByActId(@Param("activityId") Integer activityId);
int insertBatch(List<DrawlineLuckyUser> drawlineLuckyUserList);
List<Integer> selectUnNoticeActivityIds();
int updateByActIdAndUids(@Param("activityId") int activityId, @Param("list") List<Integer> uids);
int updateByActIdAndUid(@Param("activityId") int activityId, @Param("uid")int uid);
int deleteByActivityId(Integer activityId);
... ...
... ... @@ -62,7 +62,7 @@
<if test="activityId != null">
and activity_id = #{activityId,jdbcType=INTEGER}
</if>
order by create_time limit #{offset, jdbcType=INTEGER}, #{limit, jdbcType=INTEGER}
order by create_time
</select>
<select id="selectUnNoticeActivityIds" resultType="java.lang.Integer">
... ... @@ -227,17 +227,12 @@
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByActIdAndUids">
<update id="updateByActIdAndUid">
update drawline_lucky_user
set is_send_inbox = 1
where status = 1 and user_type = 1
and activity_id = #{activityId,jdbcType=INTEGER},
<if test="list != null and list.size() > 0">
and uid in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
and activity_id = #{activityId,jdbcType=INTEGER}
and uid = #{uid,jdbcType=INTEGER}
</update>
<insert id="insertBatch" parameterType="java.util.List">
... ...
... ... @@ -179,13 +179,13 @@
select
<include refid="Base_Column_List" />
from drawline_user_queue
where activity_id = #{activityId,jdbcType=INTEGER} and uid in (${uids,jdbcType=VARCHAR}) and user_type = 1 and status = 1
where activity_id = #{activityId,jdbcType=INTEGER} and uid in (${uids}) and user_type = 1 and status = 1
</select>
<select id="selectRealUserQueueByRand" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from drawline_user_queue
where activity_id = #{activityId,jdbcType=INTEGER} and user_type = 1 and status = 1 and uid not in (${uids,jdbcType=VARCHAR})
where activity_id = #{activityId,jdbcType=INTEGER} and user_type = 1 and status = 1 and uid not in (${uids})
ORDER BY RAND() LIMIT #{limit,jdbcType=INTEGER}
</select>
<select id="selectByRand" resultMap="BaseResultMap">
... ...
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.yoho.dsf</groupId>
<artifactId>yohobuy-activity</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-other</artifactId>
<name>yohobuy-activity-other</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
... ...
/**
*
*/
package com.yoho.activity.other.thread;
/**
* 描述:
*
* @author ping.huang
* 2016年3月5日
*/
public class TestThread {
}
... ...
/**
*
*/
package com.yoho.activity.other.timer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
/**
* 描述:
*
* @author ping.huang 2016年3月5日
*/
@Component
public class AddVirtualUserTimer {
static Logger log = LoggerFactory.getLogger(AddVirtualUserTimer.class);
@Scheduled(fixedDelay = 60 * 1000)
public void test() {
log.info("------------");
}
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-4.2.xsd
">
<task:annotation-driven />
<context:annotation-config/>
</beans>
\ No newline at end of file
... ...
package org.yohobuy.activity.other;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
/**
* Unit test for simple App.
*/
public class AppTest
extends TestCase
{
/**
* Create the test case
*
* @param testName name of the test case
*/
public AppTest( String testName )
{
super( testName );
}
/**
* @return the suite of tests being tested
*/
public static Test suite()
{
return new TestSuite( AppTest.class );
}
/**
* Rigourous Test :-)
*/
public void testApp()
{
assertTrue( true );
}
}
... ...
... ... @@ -40,11 +40,16 @@
<artifactId>yohobuy-activity-service</artifactId>
<version>${project-version}</version>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-other</artifactId>
<version>${project-version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- CORE核心代码-->
<!-- CORE核心代码�?-->
<dependency>
<groupId>com.yoho.common</groupId>
<artifactId>error-code</artifactId>
... ... @@ -74,7 +79,6 @@
<groupId>com.yoho.service.model</groupId>
<artifactId>promotion-service-model</artifactId>
</dependency>
<!-- spring核心代码包-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
... ... @@ -136,7 +140,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
... ... @@ -144,7 +147,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
... ... @@ -156,6 +158,7 @@
<module>common</module>
<module>queue</module>
<module>service</module>
</modules>
<module>other</module>
</modules>
</project>
\ No newline at end of file
... ...
... ... @@ -9,9 +9,8 @@ import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import java.util.ArrayList;
/**
* API 响应格式
* /**
* 响应为:
* API 响应格式 /** 响应为:
*
* <pre>
* {
* "code": 200,
... ... @@ -29,164 +28,167 @@ import java.util.ArrayList;
*/
public class ApiResponse {
private static String DEFAULT_MSG = "操作成功";
private static int DEFAULT_CODE = 200;
private static final String MD5_SALT = "fd4ad5fcsa0de589af23234ks1923ks";
private int code;
private String message;
private String md5;
//如果客户端判断有这个,则校验MD5
private String alg = "SALT_MD5";
private Object data;
public ApiResponse() {
this(200, DEFAULT_MSG, null);
}
public ApiResponse(int code, String message, Object data) {
this.code = code;
if (StringUtils.isNotEmpty(message)) {
this.message = message;
}
this.data = data;
}
public String getAlg() {
return alg;
}
public void setAlg(String alg) {
this.alg = alg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
/**
* 构造响应。 使用方式:
* <p/>
* <pre>
* ApiResponse.ApiResponseBuilder builder = new ApiResponse.ApiResponseBuilder();
* ApiResponse apiResponse = builder.code(200).message("coupons total").data(new Total("0")).build();
* </pre>
*/
public static class ApiResponseBuilder {
ApiResponse apiResponse;
public ApiResponseBuilder() {
apiResponse = new ApiResponse();
}
/**
* 设置错误码。默认200
*
* @param code 错误码
* @return ApiResponseBuilder
*/
public ApiResponseBuilder code(int code) {
apiResponse.code = code;
return this;
}
/**
* 设置消息。默认[操作成功]
*
* @param message 错误消息
* @return ApiResponseBuilder
*/
public ApiResponseBuilder message(String message) {
apiResponse.message = message;
return this;
}
/**
* 从Errorcode中设置错误码和错误消息
*
* @param gatewayError
* @return
*/
public ApiResponseBuilder code(GatewayError gatewayError) {
apiResponse.code = gatewayError.getCode();
apiResponse.message = gatewayError.getMessage();
return this;
}
/**
* 设置响应的具体内容
*
* @param data 响应的具体内容
* @return 内容
*/
public ApiResponseBuilder data(Object data) {
apiResponse.data = data;
return this;
}
/**
* 构造响应
*
* @return 响应
*/
public ApiResponse build() {
//参数校验, 并且设置默认值
if (this.apiResponse.code <= 0) {
this.apiResponse.code = DEFAULT_CODE;
}
if (StringUtils.isEmpty(apiResponse.message)) {
this.apiResponse.message = DEFAULT_MSG;
}
//构造JSON
apiResponse.md5 = getMd5();
return apiResponse;
}
//计算MD5
private String getMd5() {
if (this.apiResponse.data == null) {
this.apiResponse.data = new ArrayList<>(0);
}
String json = JSON.toJSONString(this.apiResponse.data); // []
return MD5.md5(MD5_SALT+":"+json);
}
}
private static String DEFAULT_MSG = "操作成功";
private static int DEFAULT_CODE = 200;
private static final String MD5_SALT = "fd4ad5fcsa0de589af23234ks1923ks";
private int code;
private String message;
private String md5;
// 如果客户端判断有这个,则校验MD5
private String alg = "SALT_MD5";
private Object data;
public ApiResponse() {
this(DEFAULT_CODE, DEFAULT_MSG, null);
}
public ApiResponse(int code, String message, Object data) {
this.code = code;
if (StringUtils.isNotEmpty(message)) {
this.message = message;
}
this.data = data;
}
public String getAlg() {
return alg;
}
public void setAlg(String alg) {
this.alg = alg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public String getMd5() {
return md5;
}
public void setMd5(String md5) {
this.md5 = md5;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
@Override
public String toString() {
return ReflectionToStringBuilder.toString(this);
}
/**
* 构造响应。 使用方式:
* <p/>
*
* <pre>
* ApiResponse.ApiResponseBuilder builder = new ApiResponse.ApiResponseBuilder();
* ApiResponse apiResponse = builder.code(200).message(&quot;coupons total&quot;).data(new Total(&quot;0&quot;)).build();
* </pre>
*/
public static class ApiResponseBuilder {
ApiResponse apiResponse;
public ApiResponseBuilder() {
apiResponse = new ApiResponse();
}
/**
* 设置错误码。默认200
*
* @param code
* 错误码
* @return ApiResponseBuilder
*/
public ApiResponseBuilder code(int code) {
apiResponse.code = code;
return this;
}
/**
* 设置消息。默认[操作成功]
*
* @param message
* 错误消息
* @return ApiResponseBuilder
*/
public ApiResponseBuilder message(String message) {
apiResponse.message = message;
return this;
}
/**
* 从Errorcode中设置错误码和错误消息
*
* @param gatewayError
* @return
*/
public ApiResponseBuilder code(GatewayError gatewayError) {
apiResponse.code = gatewayError.getCode();
apiResponse.message = gatewayError.getMessage();
return this;
}
/**
* 设置响应的具体内容
*
* @param data
* 响应的具体内容
* @return 内容
*/
public ApiResponseBuilder data(Object data) {
apiResponse.data = data;
return this;
}
/**
* 构造响应
*
* @return 响应
*/
public ApiResponse build() {
// 参数校验, 并且设置默认值
if (this.apiResponse.code <= 0) {
this.apiResponse.code = DEFAULT_CODE;
}
if (StringUtils.isEmpty(apiResponse.message)) {
this.apiResponse.message = DEFAULT_MSG;
}
// 构造JSON
apiResponse.md5 = getMd5();
return apiResponse;
}
// 计算MD5
private String getMd5() {
if (this.apiResponse.data == null) {
this.apiResponse.data = new ArrayList<>(0);
}
String json = JSON.toJSONString(this.apiResponse.data); // []
return MD5.md5(MD5_SALT + ":" + json);
}
}
}
... ...
package com.yoho.activity.queue.convert;
import com.yoho.queue.dal.model.DrawlineActivityLuckydraw;
public class DrawlineActivityLuckydrawConvert {
public static DrawlineActivityLuckydraw toDOBy(int id, int endTime, int createTime) {
DrawlineActivityLuckydraw drawlineActivityLuckydraw = new DrawlineActivityLuckydraw();
drawlineActivityLuckydraw.setId(id);
drawlineActivityLuckydraw.setEndTime((int) (endTime / 1000));
drawlineActivityLuckydraw.setDrawStatus((byte) 1);
drawlineActivityLuckydraw.setStatus((byte) 1);
drawlineActivityLuckydraw.setCreateTime(createTime);
drawlineActivityLuckydraw.setUpdateTime(createTime);
return drawlineActivityLuckydraw;
}
}
... ...
package com.yoho.activity.queue.convert;
import com.yoho.queue.dal.model.DrawlineLuckyUser;
public class DrawlineLuckyUserConvert {
public static DrawlineLuckyUser toDOBy(int activityId, int queueTime, int createTime, int uid, byte userType) {
DrawlineLuckyUser drawlineLuckyUser = new DrawlineLuckyUser();
drawlineLuckyUser.setSid("");
drawlineLuckyUser.setActivityId(activityId);
drawlineLuckyUser.setQueueTime(queueTime);
drawlineLuckyUser.setStatus((byte) 1);
drawlineLuckyUser.setCreateTime(createTime);
drawlineLuckyUser.setUpdateTime(createTime);
drawlineLuckyUser.setUid(uid);
drawlineLuckyUser.setUserType(userType);
return drawlineLuckyUser;
}
}
... ...
... ... @@ -13,7 +13,7 @@ import com.yoho.service.model.activity.drawline.response.UserBaseRspBO;
public class DrawlineUserQueueConvert {
public static DrawlineUserQueue toDOByUidActivityIdUserType(int uid, int activityId, byte userType) {
public static DrawlineUserQueue toDOBy(int uid, int activityId, byte userType) {
int currentTime = (int) (System.currentTimeMillis() / 1000);
DrawlineUserQueue drawlineUserQueue = new DrawlineUserQueue();
... ...
package com.yoho.activity.queue.restapi;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray;
import com.yoho.activity.queue.ApiResponse;
import com.yoho.activity.queue.service.ITimeTaskService;
@Controller
@RequestMapping("/TimeTaskRest")
public class TimeTaskRest {
private static Logger logger = LoggerFactory.getLogger(TimeTaskRest.class);
@Autowired
private ITimeTaskService timeTaskService;
@RequestMapping("/luckyDraw")
@ResponseBody
public ApiResponse luckyDraw() {
logger.info("Enter luckyDraw.");
JSONArray jsonArray = timeTaskService.luckyDraw();
ApiResponse apiResponse = new ApiResponse();
apiResponse.setData(jsonArray);
return apiResponse;
}
/**
* 描述: 中奖用户站内信通知
*
* @return ApiResponse 活动详情信息
*
*/
@RequestMapping("/luckyUserNotice")
@ResponseBody
public ApiResponse luckyUserNotice() {
logger.info("Enter luckyUserNotice.");
JSONArray jsonArray = timeTaskService.luckyUserNotice();
ApiResponse apiResponse = new ApiResponse();
apiResponse.setMessage("send inbox uid list");
apiResponse.setData(jsonArray);
return apiResponse;
}
}
... ...
package com.yoho.activity.queue.service;
import com.alibaba.fastjson.JSONArray;
public interface ITimeTaskService {
JSONArray luckyDraw();
/**
* 描述: 获取活动详情信息.
* 步骤:
* 1. 查询未发送站内信中奖用户参与活动的ID
* 2. 查询活动奖品设置
* 3. 查询中奖用户列表
* 4. 遍历中奖用户列表发送站内信
*
* @return JSONArray 中奖用户uid列表
*
*/
JSONArray luckyUserNotice();
}
... ...
... ... @@ -145,7 +145,7 @@ public class DrawlineUserActivityInfoServiceImpl implements IDrawlineUserActivit
* 截止时间后,未参与用户点击排队。弹窗:OOPS!您来晚啦,下次早点哦!
*/
String prompt = "";
if(isActivityEnd){
if(0 < userActivityInfoRespBO.getSort() && isActivityEnd){
prompt = userActivityInfoRespBO.getIsLucky() > 0? PROMPT_ACTEND_LUCKY:PROMPT_ACTEND_NOT_LUCKY;
}
userActivityInfoRespBO.setPrompt(prompt);
... ...
... ... @@ -78,7 +78,7 @@ public class DrawlineUserQueueServiceImpl implements IDrawlineUserQueueService {
}
// (5)组装数据,新增排队
drawlineUserQueue = DrawlineUserQueueConvert.toDOByUidActivityIdUserType(uid, activityId, userType);
drawlineUserQueue = DrawlineUserQueueConvert.toDOBy(uid, activityId, userType);
int rows = drawlineUserQueueDAO.insertAutoSort(drawlineUserQueue);
logger.debug("addDrawlineUserQueue: drawlineUserQueueDAO.insertAutoSort. drawlineUserQueue is {}, rows is {}", drawlineUserQueue, rows);
if (1 > rows) {
... ...
package com.yoho.activity.queue.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yoho.activity.queue.convert.DrawlineActivityLuckydrawConvert;
import com.yoho.activity.queue.convert.DrawlineLuckyUserConvert;
import com.yoho.activity.queue.service.ITimeTaskService;
import com.yoho.core.common.restbean.ResponseBean;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.queue.dal.IDrawlineActivityDAO;
import com.yoho.queue.dal.IDrawlineActivityLuckydrawDAO;
import com.yoho.queue.dal.IDrawlineLuckyUserDAO;
import com.yoho.queue.dal.IDrawlinePrizeSettingDAO;
import com.yoho.queue.dal.IDrawlineUserQueueDAO;
import com.yoho.queue.dal.model.DrawlineActivity;
import com.yoho.queue.dal.model.DrawlineActivityLuckydraw;
import com.yoho.queue.dal.model.DrawlineLuckyUser;
import com.yoho.queue.dal.model.DrawlinePrizeSetting;
import com.yoho.queue.dal.model.DrawlineUserQueue;
import com.yoho.service.model.activity.drawline.request.InboxReqBO;
@Service
public class TimeTaskServiceImpl implements ITimeTaskService {
private Logger logger = LoggerFactory.getLogger(TimeTaskServiceImpl.class);
private static final String SEND_INBOX_SERVICE_URL = "message.saveInbox";
private static final String LIMITCODE_MSG_TITLE = "【限购码】您获得了1个限购码";
private static final String LIMITCODE_MSG_CONTENT = "尊敬的客户:恭喜您成功获得1个限购码!您可以在个人中心查看详情和使用。";
@Autowired
private IDrawlineActivityDAO drawlineActivityDAO;
@Autowired
private IDrawlinePrizeSettingDAO drawlinePrizeSettingDAO;
@Autowired
private IDrawlineUserQueueDAO drawlineUserQueueDAO;
@Autowired
private IDrawlineLuckyUserDAO drawlineLuckyUserDAO;
@Autowired
private IDrawlineActivityLuckydrawDAO drawlineActivityLuckydrawDAO;
@Autowired
private IDrawlineLuckyUserDAO luckyUserDAO;
@Autowired
private IDrawlinePrizeSettingDAO prizeSettingDAO;
@Autowired
ServiceCaller serviceCaller;
private static final List<Integer> TIMETASK_LUCKYDRAW_LIST = new ArrayList<Integer>();
public JSONArray luckyDraw() {
logger.info("Enter luckyDraw.");
// (1)查询未成功抽奖的活动
List<DrawlineActivity> drawlineActivityList = drawlineActivityDAO.selectByNotLuckydraw();
logger.debug("luckyDraw: drawlineActivityDAO.selectByNotLuckydraw.");
if (null == drawlineActivityList || 0 == drawlineActivityList.size()) {
return null;
}
JSONArray jsonArray = new JSONArray();
// (2)遍历未完成抽奖活动,进行抽奖动作(1.对过期活动立即抽奖;2.对未过期活动新建延迟任务进行抽奖)
long currentTime = System.currentTimeMillis();
Timer timer = new Timer();
for (DrawlineActivity drawlineActivity : drawlineActivityList) {
if (null == drawlineActivity || null == drawlineActivity.getId() || null == drawlineActivity.getEndTime()) {
continue;
}
Integer id = drawlineActivity.getId();
long endTime = drawlineActivity.getEndTime().longValue() * 1000;
// 判断活动是否过期,过期立即执行抽奖,否则延迟到活动结束后两分钟执行抽奖
if (currentTime > endTime) {
jsonArray.add(luckyDraw(id, endTime));
} else {
if (TIMETASK_LUCKYDRAW_LIST.contains(id)) {
continue;
}
TIMETASK_LUCKYDRAW_LIST.add(id);
timer.schedule(new TimerTask() {
@Override
public void run() {
luckyDraw(id, endTime);
}
}, endTime - currentTime + 120000);
}
}
return jsonArray;
}
private JSONObject luckyDraw(Integer id, long endTime) {
logger.info("luckyDraw. param id is {}, endTiem is {}", id, endTime);
JSONObject jsonObject = new JSONObject();
jsonObject.put("id", id);
jsonObject.put("endTime", endTime);
// (1)查询奖品设置信息
DrawlinePrizeSetting drawlinePrizeSetting = drawlinePrizeSettingDAO.selectByActivityId(id);
logger.debug("luckyDraw: drawlinePrizeSettingDAO.selectByActivityId. activityId is {}, drawlinePrizeSetting is {}", id, drawlinePrizeSetting);
if (null == drawlinePrizeSetting || null == drawlinePrizeSetting.getRealUserNum() || null == drawlinePrizeSetting.getSockUserNum()) {
return jsonObject;
}
// (2)获取白名单排队列表,并用作最终中奖的排队列表
String whileList = drawlinePrizeSetting.getWhiteList();
List<DrawlineUserQueue> drawlineUserQueueList = drawlineUserQueueDAO.selectRealUserQueueByActIdAndUids(id, whileList);
logger.debug("luckyDraw: drawlineUserQueueDAO.selectRealUserQueueByActIdAndUids. activityId is {}, uids is {}", id, whileList);
if (null == drawlineUserQueueList) {
drawlineUserQueueList = new ArrayList<DrawlineUserQueue>();
}
// (3)获取真实用户中奖数量,中奖排队列表,并加入到最终中奖的排队列表中
int realUserNum = drawlinePrizeSetting.getRealUserNum().intValue() - drawlineUserQueueList.size();
if (0 < realUserNum) {
List<DrawlineUserQueue> realUserDrawlineUserQueueList = drawlineUserQueueDAO.selectRealUserQueueByRand(id, whileList, realUserNum);
logger.debug("luckyDraw: drawlineUserQueueDAO.selectRealUserQueueByRand. activityId is {}, uids is {}, limit is {}", id, whileList, realUserNum);
if (null != realUserDrawlineUserQueueList) {
drawlineUserQueueList.addAll(realUserDrawlineUserQueueList);
}
}
// (4)获取马甲用户中奖数量,中奖排队列表,并加入到最终中奖的排队列表当中
int sockUserNum = drawlinePrizeSetting.getSockUserNum().intValue();
if (0 < sockUserNum) {
List<DrawlineUserQueue> sockUserDrawlineUserQueueList = drawlineUserQueueDAO.selectByRand(id, (byte) 2, sockUserNum);
logger.debug("luckyDraw: drawlineUserQueueDAO.selectByRand. activityId is {}, userType is 2, limit is {}", id, sockUserNum);
if (null != sockUserDrawlineUserQueueList) {
drawlineUserQueueList.addAll(sockUserDrawlineUserQueueList);
}
}
// (5)如果中奖排队列表为空,说明无人中奖,终止任务
if (0 == drawlineUserQueueList.size()) {
return jsonObject;
}
// (6)把中奖排队列表插入到中奖用户表中
List<DrawlineLuckyUser> drawlineLuckyUserList = new ArrayList<DrawlineLuckyUser>();
int currTime = (int) (System.currentTimeMillis() / 1000);
for (DrawlineUserQueue drawlineUserQueue : drawlineUserQueueList) {
if (null == drawlineUserQueue || null == drawlineUserQueue.getUid() || null == drawlineUserQueue.getUserType() || null == drawlineUserQueue.getCreateTime()) {
continue;
}
drawlineLuckyUserList.add(DrawlineLuckyUserConvert.toDOBy(id, currTime - drawlineUserQueue.getCreateTime(), currTime, drawlineUserQueue.getUid(), drawlineUserQueue.getUserType()));
}
// (7)删除该活动中奖用户数据数据
int deleteDrawlineLuckyUserRows = drawlineLuckyUserDAO.deleteByActivityId(id);
logger.debug("luckyDraw: drawlineLuckyUserDAO.deleteByActivityId. activityId is {}, deleteDrawlineLuckyUserRows is {}", id, deleteDrawlineLuckyUserRows);
// (8)插入中奖用户数据
int drawlineLuckyUserRows = drawlineLuckyUserDAO.insertBatch(drawlineLuckyUserList);
logger.info("luckyDraw: drawlineLuckyUserDAO.insertBatch. drawlineLuckyUserList size is {}, drawlineLuckyUserRows is {}", drawlineLuckyUserList.size(), drawlineLuckyUserRows);
// (9)删除活动抽奖状态数据
int deleteDrawlineActivityLuckydrawRows = drawlineActivityLuckydrawDAO.deleteByPrimaryKey(id);
logger.debug("luckyDraw: drawlineActivityLuckydrawDAO.deleteByPrimaryKey. id is {}, deleteDrawlineActivityLuckydrawRows is {}", id, deleteDrawlineActivityLuckydrawRows);
// (10)插入活动抽奖状态数据
DrawlineActivityLuckydraw drawlineActivityLuckydraw = DrawlineActivityLuckydrawConvert.toDOBy(id, (int) (endTime / 1000), currTime);
int drawlineActivityLuckydrawRows = drawlineActivityLuckydrawDAO.insert(drawlineActivityLuckydraw);
logger.debug("luckyDraw: drawlineActivityLuckydrawDAO.insert. drawlineActivityLuckydraw is {}, drawlineActivityLuckydrawRows is {}", drawlineActivityLuckydraw, drawlineActivityLuckydrawRows);
// (11)返回
jsonObject.put("deleteDrawlineLuckyUserRows", deleteDrawlineLuckyUserRows);
jsonObject.put("drawlineLuckyUserRows", drawlineLuckyUserRows);
jsonObject.put("deleteDrawlineActivityLuckydrawRows", deleteDrawlineActivityLuckydrawRows);
jsonObject.put("drawlineActivityLuckydrawRows", drawlineActivityLuckydrawRows);
return jsonObject;
}
@Override
public JSONArray luckyUserNotice() {
logger.info("Enter luckyUserNotice service.");
JSONArray res = new JSONArray();
//(1) 查询未发送站内信中奖用户参与活动的ID
List<Integer> actIdList = luckyUserDAO.selectUnNoticeActivityIds();
logger.debug("luckyUserDAO.selectUnNoticeActivityIds: result is {}", actIdList);
if(null == actIdList || 0 == actIdList.size()){
return res;
}
for(Integer actId : actIdList){
//(2) 查询活动奖品设置
DrawlinePrizeSetting prizeSetting = prizeSettingDAO.selectByActivityId(actId);
logger.debug("prizeSettingDAO.selectByActivityId: articleId is {}", actId);
if(null == prizeSetting){
logger.warn("prize is not setted artivityId is {}", actId);
return res;
}
//(3) 查询中奖用户列表
List<DrawlineLuckyUser> luckyUserList = luckyUserDAO.selectNotcieUserByActId(actId);
logger.debug("luckyUserDAO.selectNotcieUserByActId: articleId is {}", actId);
if(null == luckyUserList || 0 == luckyUserList.size()){
return res;
}
//(4) 遍历中奖用户列表发送站内信
for(DrawlineLuckyUser luckyUser : luckyUserList){
if(null == luckyUser || null == luckyUser.getUid() || 0 == luckyUser.getUid()){
continue;
}
int luckyUserId = luckyUser.getUid();
InboxReqBO inboxReqBO = new InboxReqBO();
inboxReqBO.setUid(luckyUserId);
inboxReqBO.setType("1");
inboxReqBO.setTitle(LIMITCODE_MSG_TITLE);
inboxReqBO.setContent(LIMITCODE_MSG_CONTENT);
try{
//(4.1) 调用发送站内信服务
ResponseBean resBean = serviceCaller.call(SEND_INBOX_SERVICE_URL, inboxReqBO, ResponseBean.class);
if(null != resBean && resBean.getCode().equals("200")){
//(4.2) 更新中奖表站内信发送状态
int num = luckyUserDAO.updateByActIdAndUid(actId, luckyUserId);
logger.debug("luckyUserDAO.updateByActIdAndUids, activityId is {}, uid is {}", actId, luckyUserId);
if(num > 0){
JSONObject userObj = new JSONObject();
userObj.put("luckyUserId", luckyUserId);
res.add(userObj);
logger.info("send lucky user inbox success, uid is {}", luckyUserId);
}
}
}catch(Exception e){
logger.error("send luckyUser inbox failed", e);
}
}
}
logger.info("Leave LuckyUserNotice service: result is{}", res);
return res;
}
}
... ...
package com.yoho.activity.queue.thread;
import java.util.ArrayList;
import java.util.List;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
... ... @@ -14,169 +10,25 @@ import org.springframework.stereotype.Service;
import com.netflix.config.DynamicLongProperty;
import com.netflix.config.DynamicPropertyFactory;
import com.yoho.queue.dal.IDrawlineActivityDAO;
import com.yoho.queue.dal.IDrawlineActivityLuckydrawDAO;
import com.yoho.queue.dal.IDrawlineLuckyUserDAO;
import com.yoho.queue.dal.IDrawlinePrizeSettingDAO;
import com.yoho.queue.dal.IDrawlineUserQueueDAO;
import com.yoho.queue.dal.model.DrawlineActivity;
import com.yoho.queue.dal.model.DrawlineActivityLuckydraw;
import com.yoho.queue.dal.model.DrawlineLuckyUser;
import com.yoho.queue.dal.model.DrawlinePrizeSetting;
import com.yoho.queue.dal.model.DrawlineUserQueue;
import com.yoho.activity.queue.service.ITimeTaskService;
@Service
public class LuckyDrawService {
private static Logger logger = LoggerFactory.getLogger(LuckyDrawService.class);
@Autowired
private IDrawlineActivityDAO drawlineActivityDAO;
@Autowired
private IDrawlinePrizeSettingDAO drawlinePrizeSettingDAO;
@Autowired
private IDrawlineUserQueueDAO drawlineUserQueueDAO;
@Autowired
private IDrawlineLuckyUserDAO drawlineLuckyUserDAO;
@Autowired
private IDrawlineActivityLuckydrawDAO drawlineActivityLuckydrawDAO;
private static final List<Integer> TASK_LIST = new ArrayList<Integer>();
private ITimeTaskService timeTaskService;
public LuckyDrawService() {
// 服务启动后5分钟执行任务,起一个每天(默认间隔)执行一次的线程,对活动进行抽奖
DynamicLongProperty interval = DynamicPropertyFactory.getInstance().getLongProperty("drawline.luckydraw.interval", 1440);
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
logger.info("Enter LuckyDrawService thread run.");
// (1)查询未成功抽奖的活动
List<DrawlineActivity> drawlineActivityList = drawlineActivityDAO.selectByNotLuckydraw();
logger.debug("thread run: drawlineActivityDAO.selectByNotLuckydraw. drawlineActivityList size is {}", null == drawlineActivityList ? 0 : drawlineActivityList.size());
if (null == drawlineActivityList || 0 == drawlineActivityList.size()) {
return;
}
// (2)遍历未完成抽奖活动,新建任务抽奖
long currentTime = System.currentTimeMillis();
Timer timer = new Timer();
for (DrawlineActivity drawlineActivity : drawlineActivityList) {
if (null == drawlineActivity) {
continue;
}
Integer endTime = drawlineActivity.getEndTime();
if (null == endTime) {
continue;
}
Integer id = drawlineActivity.getId();
if (TASK_LIST.contains(id)) {
continue;
}
TASK_LIST.add(id);
// 活动结束后1分钟,执行抽奖
logger.info("thread run: start TimerTask to lucky draw. drawlineActivity id is {}", id);
timer.schedule(new TimerTask() {
@Override
public void run() {
logger.info("TimerTask run: begin TimerTask run");
// (1)查询奖品设置信息
DrawlinePrizeSetting drawlinePrizeSetting = drawlinePrizeSettingDAO.selectByActivityId(id);
logger.debug("TimerTask run: drawlinePrizeSettingDAO.selectByActivityId. activityId is {}, drawlinePrizeSetting is {}", id, drawlinePrizeSetting);
if (null == drawlinePrizeSetting || null == drawlinePrizeSetting.getRealUserNum() || null == drawlinePrizeSetting.getSockUserNum()) {
return;
}
// (2)获取白名单排队列表,并用作最终中奖的排队列表
String whileList = drawlinePrizeSetting.getWhiteList();
List<DrawlineUserQueue> drawlineUserQueueList = drawlineUserQueueDAO.selectRealUserQueueByActIdAndUids(id, whileList);
logger.debug("TimerTask run: drawlineUserQueueDAO.selectRealUserQueueByActIdAndUids. activityId is {}, uids is {}, drawlineUserQueueList size is {}", id, whileList,
null == drawlineUserQueueList ? 0 : drawlineUserQueueList.size());
if (null == drawlineUserQueueList) {
drawlineUserQueueList = new ArrayList<DrawlineUserQueue>();
}
// (3)获取真实用户中奖数量,中奖排队列表,并加入到最终中奖的排队列表中
int realUserNum = drawlinePrizeSetting.getRealUserNum().intValue() - drawlineUserQueueList.size();
if (0 < realUserNum) {
List<DrawlineUserQueue> realUserDrawlineUserQueueList = drawlineUserQueueDAO.selectRealUserQueueByRand(id, whileList, realUserNum);
logger.debug("TimerTask run: drawlineUserQueueDAO.selectRealUserQueueByRand. activityId is {}, uids is {}, limit is {}, realUserDrawlineUserQueueList size is {}", id,
whileList, realUserNum, null == realUserDrawlineUserQueueList ? 0 : realUserDrawlineUserQueueList.size());
if (null != realUserDrawlineUserQueueList) {
drawlineUserQueueList.addAll(realUserDrawlineUserQueueList);
}
}
// (4)获取马甲用户中奖数量,中奖排队列表,并加入到最终中奖的排队列表当中
int sockUserNum = drawlinePrizeSetting.getSockUserNum().intValue();
if (0 < sockUserNum) {
List<DrawlineUserQueue> sockUserDrawlineUserQueueList = drawlineUserQueueDAO.selectByRand(id, (byte) 2, sockUserNum);
logger.debug("TimerTask run: drawlineUserQueueDAO.selectByRand. activityId is {}, userType is 2, limit is {}, sockUserDrawlineUserQueueList size is {}", id,
sockUserNum, null == sockUserDrawlineUserQueueList ? 0 : sockUserDrawlineUserQueueList.size());
if (null != sockUserDrawlineUserQueueList) {
drawlineUserQueueList.addAll(sockUserDrawlineUserQueueList);
}
}
// (5)如果中奖排队列表为空,说明无人中奖,终止任务
if (0 == drawlineUserQueueList.size()) {
return;
}
// (6)把中奖排队列表插入到中奖用户表中,并记录活动抽奖状态
List<DrawlineLuckyUser> drawlineLuckyUserList = new ArrayList<DrawlineLuckyUser>();
List<DrawlineActivityLuckydraw> drawlineActivityLuckydrawList = new ArrayList<DrawlineActivityLuckydraw>();
DrawlineLuckyUser drawlineLuckyUser;
DrawlineActivityLuckydraw drawlineActivityLuckydraw;
int currTime = (int) (System.currentTimeMillis() / 1000);
for (DrawlineUserQueue drawlineUserQueue : drawlineUserQueueList) {
if (null == drawlineUserQueue || null == drawlineUserQueue.getUid() || null == drawlineUserQueue.getUserType() || null == drawlineUserQueue.getCreateTime()) {
continue;
}
drawlineLuckyUser = new DrawlineLuckyUser();
drawlineLuckyUser.setSid("");
drawlineLuckyUser.setActivityId(id);
drawlineLuckyUser.setQueueTime(currTime - drawlineUserQueue.getCreateTime());
drawlineUserQueue.setStatus((byte) 1);
drawlineLuckyUser.setCreateTime(currTime);
drawlineLuckyUser.setUpdateTime(currTime);
drawlineLuckyUser.setUid(drawlineUserQueue.getUid());
drawlineLuckyUser.setUserType(drawlineUserQueue.getUserType());
drawlineLuckyUserList.add(drawlineLuckyUser);
drawlineActivityLuckydraw = new DrawlineActivityLuckydraw();
drawlineActivityLuckydraw.setId(id);
drawlineActivityLuckydraw.setEndTime(endTime);
drawlineActivityLuckydraw.setDrawStatus((byte) 1);
drawlineActivityLuckydraw.setStatus((byte) 1);
drawlineActivityLuckydraw.setCreateTime(currTime);
drawlineActivityLuckydraw.setUpdateTime(currTime);
drawlineActivityLuckydrawList.add(drawlineActivityLuckydraw);
}
// 先删除该活动中奖用户数据数据
int rows = drawlineLuckyUserDAO.deleteByActivityId(id);
logger.debug("TimerTask run: drawlineLuckyUserDAO.deleteByActivityId. activityId is {}, rows is {}", id, rows);
// 插入中奖用户数据
int drawlineLuckyUserRows = drawlineLuckyUserDAO.insertBatch(drawlineLuckyUserList);
logger.debug("TimerTask run: drawlineLuckyUserDAO.insertBatch. drawlineLuckyUserList size is {}, drawlineLuckyUserRows is {}", drawlineLuckyUserList.size(),
drawlineLuckyUserRows);
// 先删除活动抽奖状态数据
rows = drawlineActivityLuckydrawDAO.deleteByPrimaryKey(id);
logger.debug("TimerTask run: drawlineActivityLuckydrawDAO.deleteByPrimaryKey. id is {}, rows is {}", id, rows);
// 插入活动抽奖状态数据
int drawlineActivityLuckydrawRows = drawlineActivityLuckydrawDAO.insertBatch(drawlineActivityLuckydrawList);
logger.debug("TimerTask run: drawlineActivityLuckydrawDAO.insertBatch. drawlineActivityLuckydrawList size is {}, drawlineActivityLuckydrawRows is {}",
drawlineActivityLuckydrawList.size(), drawlineActivityLuckydrawRows);
logger.info("TimerTask run: end TimerTask run");
}
}, endTime.longValue() * 1000 - currentTime + 120000);
}
timeTaskService.luckyDraw();
logger.info("Outer LuckyDrawService thread run.");
}
... ...
package com.yoho.activity.queue.thread;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
... ... @@ -9,106 +7,33 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import com.yoho.activity.common.enums.PrizeTypeEnum;
import com.yoho.core.common.restbean.ResponseBean;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.queue.dal.IDrawlineLuckyUserDAO;
import com.yoho.queue.dal.IDrawlinePrizeSettingDAO;
import com.yoho.queue.dal.model.DrawlineLuckyUser;
import com.yoho.queue.dal.model.DrawlinePrizeSetting;
import com.yoho.service.model.activity.drawline.request.InboxReqBO;
import com.netflix.config.DynamicLongProperty;
import com.netflix.config.DynamicPropertyFactory;
import com.yoho.activity.queue.service.ITimeTaskService;
public class LuckyUserNoticeThread {
private Logger logger = LoggerFactory.getLogger(LuckyUserNoticeThread.class);
private static final int USER_NOTICE_NUM = 50;
private static final String SEND_INBOX_SERVICE_URL = "message.batchSaveInbox";
private static final String COUPON_MSG = "【优惠券】恭喜您获得了1张优惠券,请到个人中心查看";
private static final String YOHOCOIN_MSG = "【YOHO币】恭喜您获得了XX个YOHO币,请到个人中心查看";
private static final String LIMINTCODE_MSG = "【限购码】恭喜您获得了限购码,请到个人中心查看使用";
@Autowired
private IDrawlineLuckyUserDAO luckyUserDAO;
@Autowired
private IDrawlinePrizeSettingDAO prizeSettingDAO;
private static Logger logger = LoggerFactory.getLogger(LuckyUserNoticeThread.class);
@Autowired
ServiceCaller serviceCaller;
private ITimeTaskService timeTaskService;
public LuckyUserNoticeThread(){
//(1)定时任务执行时间间隔,单位为分
DynamicLongProperty initialDelay = DynamicPropertyFactory.getInstance().getLongProperty("drawline.luckyUserNotice.interval", 120);
//(2)服务启动10后开始执行, 默认每隔2小时执行一次
Executors.newScheduledThreadPool(1).scheduleAtFixedRate(new Runnable() {
@Override
public void run() {
logger.info("Enter LuckyUserNoticeThread.");
logger.info("LuckyUserNotice thread start...");
//(1) 查询未发送站内信中奖用户参与活动的ID
List<Integer> actIdList = luckyUserDAO.selectUnNoticeActivityIds();
logger.debug("luckyUserDAO.selectUnNoticeActivityIds: result is {}", actIdList);
if(null == actIdList || 0 == actIdList.size()){
return;
}
for(Integer actId : actIdList){
//(2) 查询活动奖品设置
DrawlinePrizeSetting prizeSetting = prizeSettingDAO.selectByActivityId(actId);
logger.debug("prizeSettingDAO.selectByActivityId: articleId is {}", actId);
if(null == prizeSetting){
logger.warn("prize is not setted artivityId is {}", actId);
return;
}
//(3) 查询中奖用户列表
List<DrawlineLuckyUser> luckyUserList = luckyUserDAO.selectNotcieUserByActId(actId, 0, USER_NOTICE_NUM);
logger.debug("luckyUserDAO.selectNotcieUserByActId: articleId is {}", actId);
if(null == luckyUserList || 0 == luckyUserList.size()){
return;
}
//(4) 组装站内信请求列表
List<InboxReqBO> inboxReqBOList = new ArrayList<InboxReqBO>();
List<Integer> uidList= new ArrayList<Integer>();
for(DrawlineLuckyUser luckyUser : luckyUserList){
if(null == luckyUser || null == luckyUser.getUid() || 0 == luckyUser.getUid()){
continue;
}
InboxReqBO inboxReqBO = new InboxReqBO();
inboxReqBO.setUid(luckyUser.getUid());
Byte prizeType = prizeSetting.getPrizeType();
if(prizeType.equals(PrizeTypeEnum._1.getCode())){
inboxReqBO.setTitle(YOHOCOIN_MSG);
}else if(prizeType.equals(PrizeTypeEnum._2.getCode())){
inboxReqBO.setTitle(COUPON_MSG);
}else if(prizeType.equals(PrizeTypeEnum._3.getCode())){
inboxReqBO.setTitle(LIMINTCODE_MSG);
}
inboxReqBO.setType("1");
inboxReqBOList.add(inboxReqBO);
uidList.add(luckyUser.getUid());
}
try{
//(5) 调用发送站内信服务
ResponseBean resBean = serviceCaller.call(SEND_INBOX_SERVICE_URL, luckyUserList, ResponseBean.class);
if(resBean.getCode().equals("200")){
//(6) 更新中奖表站内信发送状态
luckyUserDAO.updateByActIdAndUids(actId, uidList);
logger.info("luckyUserDAO.updateByActIdAndUids, activityId is {}, uidList is {}", actId, uidList);
}
}catch(Exception e){
logger.error("send luckyUser inbox failed", e);
}
}
timeTaskService.luckyUserNotice();
logger.info("Enter LuckyUserNoticeThread.");
logger.info("LuckyUserNotice thread end.");
}
}, 5, 60, TimeUnit.MINUTES);
}, 10, initialDelay.get(), TimeUnit.MINUTES);
}
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>yohobuy-activity</artifactId>
<groupId>com.yoho.dsf</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>yohobuy-activity</artifactId>
<groupId>com.yoho.dsf</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-web</artifactId>
<packaging>war</packaging>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-web</artifactId>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-common</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-dal</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-queue</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-service</artifactId>
</dependency>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-common</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-dal</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-queue</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-service</artifactId>
</dependency>
<dependency>
<groupId>com.netflix.hystrix</groupId>
<artifactId>hystrix-metrics-event-stream</artifactId>
</dependency>
</dependencies>
<build>
<finalName>yohobuy-activity-web</finalName>
<plugins>
<plugin>
<groupId>com.yoho.tools</groupId>
<artifactId>maven-autoconfig-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<configuration>
<exploding>true</exploding>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>autoconfig</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<dependency>
<groupId>com.yoho.dsf.yhactivity</groupId>
<artifactId>yohobuy-activity-other</artifactId>
</dependency>
</dependencies>
<build>
<finalName>yohobuy-activity-web</finalName>
<plugins>
<plugin>
<groupId>com.yoho.tools</groupId>
<artifactId>maven-autoconfig-plugin</artifactId>
<version>1.0.0-SNAPSHOT</version>
<configuration>
<exploding>true</exploding>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>autoconfig</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
... ...
... ... @@ -29,3 +29,6 @@ web.context=activity
# ******************** drawline lucky draw task interval(TimeUnit.MINUTES) ********************
drawline.luckydraw.interval=1440
# ******************** drawline lucky user notice task interval(TimeUnit.MINUTES) ********************
drawline.luckyUserNotice.interval=120
... ...
... ... @@ -115,6 +115,8 @@
<logger name="com.yoho.core.rest.client.finder.zookeeper.CuratorXDiscoveryClientWrapper" level="INFO"/>
<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>
<!-- zk日志 -->
<logger name="org.apache.zookeeper.ClientCnxn" level="INFO" additivity="false">
<appender-ref ref="INFO" />
... ...
... ... @@ -29,3 +29,6 @@ web.context=activity
# ******************** drawline lucky draw task interval(TimeUnit.MINUTES) ********************
drawline.luckydraw.interval=${drawline.luckydraw.interval}
# ******************** drawline user notice task interval(TimeUnit.MINUTES) ********************
drawline.luckyUserNotice.interval=${drawline.luckyUserNotice.interval}
... ...
... ... @@ -131,6 +131,7 @@
<logger name="org.springframework" level="${yoho.logs.level}"/>
<logger name="org.apache.zookeeper.ClientCnxn" level="WARN"/>
<logger name="org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor" level="INFO"/>
<!-- root级别 DEBUG -->
<root level="${yoho.logs.level}">
... ...