Authored by ping

update

... ... @@ -2,6 +2,8 @@ package com.yoho.queue.dal;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.yoho.queue.dal.model.DrawlineActivity;
public interface IDrawlineActivityDAO {
... ... @@ -20,5 +22,5 @@ public interface IDrawlineActivityDAO {
List<DrawlineActivity> selectByNotLuckydraw();
List<DrawlineActivity> selectAllActivity();
List<DrawlineActivity> selectAllActivity(@Param("currentTime") int currentTime);
}
\ No newline at end of file
... ...
... ... @@ -38,5 +38,5 @@ public interface IDrawlineUserQueueDAO {
List<DrawlineUserQueue> selectByTypeAndActivityIds(@Param("activityIds") String activityIds, @Param("userType") int userType);
List<Map<String, Object>> selectRealUserCountByActivityIds(@Param("activityIds") String activityIds);
List<Map<String, Object>> selectRealUserCountByActivityIds(@Param("activityIds") String activityIds, @Param("beginTime") int beginTime, @Param("endTime") int endTime);
}
\ No newline at end of file
... ...
... ... @@ -171,6 +171,6 @@
where status = 1 and id not in (select id from drawline_activity_luckydraw where draw_status = 1 and status = 1)
</select>
<select id="selectAllActivity" resultMap="BaseResultMap">
select * from drawline_activity where status=1 and begin_time&lt;=UNIX_TIMESTAMP() and end_time &gt;=UNIX_TIMESTAMP()
select * from drawline_activity where status=1 and begin_time&lt;=#{currentTime} and end_time &gt;=#{currentTime}
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -201,7 +201,7 @@
</select>
<select id="selectRealUserCountByActivityIds" resultType="java.util.Map">
select activity_id, count(activity_id) nums from drawline_user_queue where status=1 and user_type=1
and create_time between UNIX_TIMESTAMP()-60 and UNIX_TIMESTAMP()
and create_time between #{beginTime} and #{entTime}
and activity_id in (${activityIds}) group by activity_id
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -19,6 +19,7 @@ import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.yoho.activity.common.enums.UserTypeEnum;
import com.yoho.activity.common.utils.DateUtils;
import com.yoho.activity.common.utils.MapUtil;
import com.yoho.activity.common.utils.MapUtil.FunctionExPlus;
import com.yoho.activity.common.utils.PropertiesUtil;
... ... @@ -77,7 +78,7 @@ public class AddVirtualUserTimer {
//first = new HashMap<Integer, Boolean>();
//初始化所有活动
activityList = drawlineActivityDAO.selectAllActivity();
activityList = drawlineActivityDAO.selectAllActivity(DateUtils.getCurrentTimeSecond());
if (activityList == null || activityList.size() == 0) {
return;
... ... @@ -143,7 +144,8 @@ public class AddVirtualUserTimer {
}
//查询所有的活动,前一分钟内实际增加的真实用户数
List<Map<String, Object>> realUserCountList = drawlineUserQueueDAO.selectRealUserCountByActivityIds(StringUtils.join(activityIdList, ","));
int currTime = DateUtils.getCurrentTimeSecond();
List<Map<String, Object>> realUserCountList = drawlineUserQueueDAO.selectRealUserCountByActivityIds(StringUtils.join(activityIdList, ","), currTime - 60, currTime);
if (realUserCountList == null) {
realUserCountList = new ArrayList<Map<String,Object>>();
}
... ...