Authored by wangshusheng

给线下店提供接口

@@ -25,4 +25,6 @@ public interface IDrawlineActivityDAO { @@ -25,4 +25,6 @@ public interface IDrawlineActivityDAO {
25 List<DrawlineActivity> selectAllActivity(@Param("currentTime") int currentTime); 25 List<DrawlineActivity> selectAllActivity(@Param("currentTime") int currentTime);
26 26
27 DrawlineActivity selectActivityById(@Param("activityId") int activityId, @Param("currentTime") int currentTime); 27 DrawlineActivity selectActivityById(@Param("activityId") int activityId, @Param("currentTime") int currentTime);
  28 +
  29 + List<DrawlineActivity> selectActivityByIdList(@Param("list") List<Integer> activityIds);
28 } 30 }
@@ -33,4 +33,6 @@ public interface IDrawlineUserQueueDAO { @@ -33,4 +33,6 @@ public interface IDrawlineUserQueueDAO {
33 List<DrawlineUserQueue> selectMyQueueList(@Param("activityId")int activityId, @Param("sort")int sort, @Param("limit")int limit, @Param("uid")int uid); 33 List<DrawlineUserQueue> selectMyQueueList(@Param("activityId")int activityId, @Param("sort")int sort, @Param("limit")int limit, @Param("uid")int uid);
34 34
35 Integer selectHelpUserCount(@Param("activityId")Integer activityId, @Param("uid")Integer uid, @Param("openId")String openId); 35 Integer selectHelpUserCount(@Param("activityId")Integer activityId, @Param("uid")Integer uid, @Param("openId")String openId);
  36 +
  37 + List<DrawlineUserQueue> selectByActIdListAndUid(@Param("uid") Integer uid, @Param("list") List<Integer> activityIdList);
36 } 38 }
@@ -179,4 +179,13 @@ @@ -179,4 +179,13 @@
179 <select id="selectActivityById" resultMap="BaseResultMap"> 179 <select id="selectActivityById" resultMap="BaseResultMap">
180 select * from drawline_activity where id=#{activityId} and status=1 and begin_time&lt;=#{currentTime} and end_time &gt;=#{currentTime} 180 select * from drawline_activity where id=#{activityId} and status=1 and begin_time&lt;=#{currentTime} and end_time &gt;=#{currentTime}
181 </select> 181 </select>
  182 +
  183 + <select id="selectActivityByIdList" resultMap="BaseResultMap">
  184 + select * from drawline_activity
  185 + where status=1
  186 + and id in
  187 + <foreach collection="list" item="item" open="(" close=")" separator=",">
  188 + #{item}
  189 + </foreach>
  190 + </select>
182 </mapper> 191 </mapper>
@@ -175,4 +175,17 @@ @@ -175,4 +175,17 @@
175 </if> 175 </if>
176 and user_type = 1 and status = 1 176 and user_type = 1 and status = 1
177 </select> 177 </select>
  178 +
  179 + <select id="selectByActIdListAndUid" resultMap="BaseResultMap">
  180 + select
  181 + <include refid="Base_Column_List" />
  182 + from drawline_user_queue
  183 + where uid = #{uid,jdbcType=INTEGER}
  184 + <if test="list != null and list.size() > 0">
  185 + and activity_id in
  186 + <foreach collection="list" item="item" open="(" close=")" separator=",">
  187 + #{item}
  188 + </foreach>
  189 + </if>
  190 + </select>
178 </mapper> 191 </mapper>
@@ -4,7 +4,7 @@ @@ -4,7 +4,7 @@
4 <parent> 4 <parent>
5 <groupId>com.yoho</groupId> 5 <groupId>com.yoho</groupId>
6 <artifactId>parent</artifactId> 6 <artifactId>parent</artifactId>
7 - <version>1.4.0-SNAPSHOT</version> 7 + <version>1.4.6-SNAPSHOT</version>
8 </parent> 8 </parent>
9 9
10 <groupId>com.yoho.dsf</groupId> 10 <groupId>com.yoho.dsf</groupId>
  1 +package com.yoho.activity.queue.convert;
  2 +
  3 +import com.google.common.collect.Lists;
  4 +import com.yoho.core.common.helpers.ImagesHelper;
  5 +import com.yoho.queue.dal.model.DrawlineActivity;
  6 +import com.yoho.queue.dal.model.DrawlineLuckyUser;
  7 +import com.yoho.queue.dal.model.DrawlineUserQueue;
  8 +import com.yoho.queue.dal.model.DrawlineVirtualUser;
  9 +import com.yoho.service.model.activity.drawline.request.DrawlineActivityBo;
  10 +import com.yoho.service.model.activity.drawline.response.DrawlineUserQueueRespBO;
  11 +import com.yoho.service.model.activity.drawline.response.UserBaseRspBO;
  12 +import org.apache.commons.lang3.StringUtils;
  13 +
  14 +import java.util.ArrayList;
  15 +import java.util.HashMap;
  16 +import java.util.List;
  17 +import java.util.Map;
  18 +
  19 +public class DrawlineQueueConvert {
  20 +
  21 + public static List<DrawlineActivityBo> toBOListByDOList(List<DrawlineActivity> drawlineQueueList) {
  22 + if (null == drawlineQueueList) {
  23 + return Lists.newArrayList();
  24 + }
  25 + List<DrawlineActivityBo> list = new ArrayList<>();
  26 + for(DrawlineActivity activity : drawlineQueueList){
  27 + DrawlineActivityBo bo = new DrawlineActivityBo();
  28 + bo.setActivityDesc(activity.getActivityDesc());
  29 + bo.setActivityName(activity.getActivityName());
  30 + bo.setAwardType(activity.getAwardType());
  31 + bo.setBackgroundStyle(activity.getBackgroundStyle());
  32 + bo.setBeginTime(activity.getBeginTime());
  33 + bo.setCreateTime(activity.getCreateTime());
  34 + bo.setEndTime(activity.getEndTime());
  35 + bo.setId(activity.getId());
  36 + bo.setNumberLimit(activity.getNumberLimit());
  37 + bo.setPlatformType(activity.getPlatformType());
  38 + bo.setStatus(activity.getStatus());
  39 + bo.setTopBanner(activity.getTopBanner());
  40 + bo.setUpdateTime(activity.getUpdateTime());
  41 + list.add(bo);
  42 + }
  43 + return list;
  44 + }
  45 +
  46 +}
1 package com.yoho.activity.queue.restapi; 1 package com.yoho.activity.queue.restapi;
2 2
  3 +import com.yoho.service.model.activity.drawline.request.BatchReqBO;
  4 +import com.yoho.service.model.activity.drawline.request.DrawlineActivityBo;
  5 +import com.yoho.service.model.activity.drawline.request.UserActivityListReqBO;
3 import org.slf4j.Logger; 6 import org.slf4j.Logger;
4 import org.slf4j.LoggerFactory; 7 import org.slf4j.LoggerFactory;
5 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
@@ -15,6 +18,8 @@ import com.yoho.error.exception.ServiceException; @@ -15,6 +18,8 @@ import com.yoho.error.exception.ServiceException;
15 import com.yoho.service.model.activity.drawline.request.DrawlineUserQueueReqBO; 18 import com.yoho.service.model.activity.drawline.request.DrawlineUserQueueReqBO;
16 import com.yoho.service.model.activity.drawline.response.DrawlineUserQueueRespBO; 19 import com.yoho.service.model.activity.drawline.response.DrawlineUserQueueRespBO;
17 20
  21 +import java.util.List;
  22 +
18 @Controller 23 @Controller
19 public class DrawlineUserQueueRest { 24 public class DrawlineUserQueueRest {
20 private static Logger logger = LoggerFactory.getLogger(DrawlineUserQueueRest.class); 25 private static Logger logger = LoggerFactory.getLogger(DrawlineUserQueueRest.class);
@@ -116,6 +121,31 @@ public class DrawlineUserQueueRest { @@ -116,6 +121,31 @@ public class DrawlineUserQueueRest {
116 return new ApiResponse.ApiResponseBuilder().code(code).message(message).data(data).build(); 121 return new ApiResponse.ApiResponseBuilder().code(code).message(message).data(data).build();
117 } 122 }
118 123
  124 + /**
  125 + * 描述:根据活动id查询活动信息,给线下店提供
  126 + *
  127 + */
  128 + @RequestMapping("/getQueueActivityList")
  129 + @ResponseBody
  130 + public ApiResponse getQueueActivityList(@RequestBody BatchReqBO<Integer> request) {
  131 + logger.info("Enter getQueueActivityList. param request is {}", request);
  132 + List<DrawlineActivityBo> activityBos = drawlineUserQueueService.getQueueActivityList(request.getReqList());
  133 + return new ApiResponse.ApiResponseBuilder().code(200).message("getQueueActivityList success").data(activityBos).build();
  134 + }
  135 +
  136 + /**
  137 + * 描述:根据活动id列表+uid,查询指定的uid是否存在活动列表中,给线下店提供
  138 + * 存在返回true,不存在返回false
  139 + *
  140 + */
  141 + @RequestMapping("/getQueueByUidAndActivity")
  142 + @ResponseBody
  143 + public ApiResponse getQueueByUidAndActivity(@RequestBody UserActivityListReqBO request) {
  144 + logger.info("Enter getQueueByUidAndActivity. param request is {}", request);
  145 + boolean flag = drawlineUserQueueService.getQueueByUidAndActivity(request.getUid(), request.getActivityId());
  146 + return new ApiResponse.ApiResponseBuilder().code(200).message("getQueueByUidAndActivity success").data(flag).build();
  147 + }
  148 +
119 /////////////////////////////////////////////////////////////////////////////////////////////// 149 ///////////////////////////////////////////////////////////////////////////////////////////////
120 150
121 @RequestMapping("/addDrawlineUserQueueByGateway") 151 @RequestMapping("/addDrawlineUserQueueByGateway")
1 package com.yoho.activity.queue.service; 1 package com.yoho.activity.queue.service;
2 2
3 import com.yoho.error.exception.ServiceException; 3 import com.yoho.error.exception.ServiceException;
  4 +import com.yoho.service.model.activity.drawline.request.DrawlineActivityBo;
4 import com.yoho.service.model.activity.drawline.request.DrawlineUserQueueReqBO; 5 import com.yoho.service.model.activity.drawline.request.DrawlineUserQueueReqBO;
5 import com.yoho.service.model.activity.drawline.response.DrawlineUserQueueRespBO; 6 import com.yoho.service.model.activity.drawline.response.DrawlineUserQueueRespBO;
6 7
  8 +import java.util.List;
  9 +
7 public interface IDrawlineUserQueueService { 10 public interface IDrawlineUserQueueService {
8 11
9 /** 12 /**
@@ -56,4 +59,8 @@ public interface IDrawlineUserQueueService { @@ -56,4 +59,8 @@ public interface IDrawlineUserQueueService {
56 Boolean judgeHelpUserExist(DrawlineUserQueueReqBO drawlineUserQueueReqBO); 59 Boolean judgeHelpUserExist(DrawlineUserQueueReqBO drawlineUserQueueReqBO);
57 60
58 Boolean judgeHelpUserNumMoreLimit(DrawlineUserQueueReqBO drawlineUserQueueReqBO); 61 Boolean judgeHelpUserNumMoreLimit(DrawlineUserQueueReqBO drawlineUserQueueReqBO);
  62 +
  63 + List<DrawlineActivityBo> getQueueActivityList(List<Integer> activityIds);
  64 +
  65 + boolean getQueueByUidAndActivity(Integer uid, List<Integer> activityId);
59 } 66 }
@@ -11,8 +11,10 @@ import com.netflix.config.DynamicLongProperty; @@ -11,8 +11,10 @@ import com.netflix.config.DynamicLongProperty;
11 import com.netflix.config.DynamicPropertyFactory; 11 import com.netflix.config.DynamicPropertyFactory;
12 import com.yoho.activity.dal.ProductLimitUserHelpMapper; 12 import com.yoho.activity.dal.ProductLimitUserHelpMapper;
13 import com.yoho.activity.dal.model.LimitProductHelpUser; 13 import com.yoho.activity.dal.model.LimitProductHelpUser;
  14 +import com.yoho.activity.queue.convert.DrawlineQueueConvert;
14 import com.yoho.message.sdk.common.model.SendMessageRspBo; 15 import com.yoho.message.sdk.common.model.SendMessageRspBo;
15 import com.yoho.message.sdk.service.ISendLimitCodeMessage; 16 import com.yoho.message.sdk.service.ISendLimitCodeMessage;
  17 +import com.yoho.service.model.activity.drawline.request.DrawlineActivityBo;
16 import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserRespBO; 18 import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserRespBO;
17 import org.apache.commons.collections.CollectionUtils; 19 import org.apache.commons.collections.CollectionUtils;
18 import org.apache.commons.lang3.StringUtils; 20 import org.apache.commons.lang3.StringUtils;
@@ -409,6 +411,25 @@ public class DrawlineUserQueueServiceImpl implements IDrawlineUserQueueService { @@ -409,6 +411,25 @@ public class DrawlineUserQueueServiceImpl implements IDrawlineUserQueueService {
409 return false; 411 return false;
410 } 412 }
411 413
  414 + @Override
  415 + public List<DrawlineActivityBo> getQueueActivityList(List<Integer> activityIds) {
  416 + List<DrawlineActivity> activities = drawlineActivityDAO.selectActivityByIdList(activityIds);
  417 + List<DrawlineActivityBo> activityBos = DrawlineQueueConvert.toBOListByDOList(activities);
  418 + return activityBos;
  419 + }
  420 +
  421 + @Override
  422 + public boolean getQueueByUidAndActivity(Integer uid, List<Integer> activityIds) {
  423 + if(CollectionUtils.isEmpty(activityIds)){
  424 + return false;
  425 + }
  426 + List<DrawlineUserQueue> drawlineUserQueueList = drawlineUserQueueDAO.selectByActIdListAndUid(uid, activityIds);
  427 + if(CollectionUtils.isEmpty(drawlineUserQueueList)){
  428 + return false;
  429 + }
  430 + return true;
  431 + }
  432 +
412 private void getHelpInfo(int activityId, List<Integer> uidList, List<DrawlineUserQueueRespBO> drawlineUserQueueRespBOList) { 433 private void getHelpInfo(int activityId, List<Integer> uidList, List<DrawlineUserQueueRespBO> drawlineUserQueueRespBOList) {
413 String activityIdStr = String.valueOf(activityId); 434 String activityIdStr = String.valueOf(activityId);
414 logger.info("DrawlineUserQueueServiceImpl :: getHelpInfo getLimitProductInfo params activityId is {}", activityIdStr); 435 logger.info("DrawlineUserQueueServiceImpl :: getHelpInfo getLimitProductInfo params activityId is {}", activityIdStr);