Authored by wangshusheng

给线下店提供接口

... ... @@ -25,4 +25,6 @@ public interface IDrawlineActivityDAO {
List<DrawlineActivity> selectAllActivity(@Param("currentTime") int currentTime);
DrawlineActivity selectActivityById(@Param("activityId") int activityId, @Param("currentTime") int currentTime);
List<DrawlineActivity> selectActivityByIdList(@Param("list") List<Integer> activityIds);
}
\ No newline at end of file
... ...
... ... @@ -33,4 +33,6 @@ public interface IDrawlineUserQueueDAO {
List<DrawlineUserQueue> selectMyQueueList(@Param("activityId")int activityId, @Param("sort")int sort, @Param("limit")int limit, @Param("uid")int uid);
Integer selectHelpUserCount(@Param("activityId")Integer activityId, @Param("uid")Integer uid, @Param("openId")String openId);
List<DrawlineUserQueue> selectByActIdListAndUid(@Param("uid") Integer uid, @Param("list") List<Integer> activityIdList);
}
\ No newline at end of file
... ...
... ... @@ -179,4 +179,13 @@
<select id="selectActivityById" resultMap="BaseResultMap">
select * from drawline_activity where id=#{activityId} and status=1 and begin_time&lt;=#{currentTime} and end_time &gt;=#{currentTime}
</select>
<select id="selectActivityByIdList" resultMap="BaseResultMap">
select * from drawline_activity
where status=1
and id in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -175,4 +175,17 @@
</if>
and user_type = 1 and status = 1
</select>
<select id="selectByActIdListAndUid" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from drawline_user_queue
where uid = #{uid,jdbcType=INTEGER}
<if test="list != null and list.size() > 0">
and activity_id in
<foreach collection="list" item="item" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -4,7 +4,7 @@
<parent>
<groupId>com.yoho</groupId>
<artifactId>parent</artifactId>
<version>1.4.0-SNAPSHOT</version>
<version>1.4.6-SNAPSHOT</version>
</parent>
<groupId>com.yoho.dsf</groupId>
... ...
package com.yoho.activity.queue.convert;
import com.google.common.collect.Lists;
import com.yoho.core.common.helpers.ImagesHelper;
import com.yoho.queue.dal.model.DrawlineActivity;
import com.yoho.queue.dal.model.DrawlineLuckyUser;
import com.yoho.queue.dal.model.DrawlineUserQueue;
import com.yoho.queue.dal.model.DrawlineVirtualUser;
import com.yoho.service.model.activity.drawline.request.DrawlineActivityBo;
import com.yoho.service.model.activity.drawline.response.DrawlineUserQueueRespBO;
import com.yoho.service.model.activity.drawline.response.UserBaseRspBO;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class DrawlineQueueConvert {
public static List<DrawlineActivityBo> toBOListByDOList(List<DrawlineActivity> drawlineQueueList) {
if (null == drawlineQueueList) {
return Lists.newArrayList();
}
List<DrawlineActivityBo> list = new ArrayList<>();
for(DrawlineActivity activity : drawlineQueueList){
DrawlineActivityBo bo = new DrawlineActivityBo();
bo.setActivityDesc(activity.getActivityDesc());
bo.setActivityName(activity.getActivityName());
bo.setAwardType(activity.getAwardType());
bo.setBackgroundStyle(activity.getBackgroundStyle());
bo.setBeginTime(activity.getBeginTime());
bo.setCreateTime(activity.getCreateTime());
bo.setEndTime(activity.getEndTime());
bo.setId(activity.getId());
bo.setNumberLimit(activity.getNumberLimit());
bo.setPlatformType(activity.getPlatformType());
bo.setStatus(activity.getStatus());
bo.setTopBanner(activity.getTopBanner());
bo.setUpdateTime(activity.getUpdateTime());
list.add(bo);
}
return list;
}
}
... ...
package com.yoho.activity.queue.restapi;
import com.yoho.service.model.activity.drawline.request.BatchReqBO;
import com.yoho.service.model.activity.drawline.request.DrawlineActivityBo;
import com.yoho.service.model.activity.drawline.request.UserActivityListReqBO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -15,6 +18,8 @@ import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.activity.drawline.request.DrawlineUserQueueReqBO;
import com.yoho.service.model.activity.drawline.response.DrawlineUserQueueRespBO;
import java.util.List;
@Controller
public class DrawlineUserQueueRest {
private static Logger logger = LoggerFactory.getLogger(DrawlineUserQueueRest.class);
... ... @@ -115,7 +120,32 @@ public class DrawlineUserQueueRest {
}
return new ApiResponse.ApiResponseBuilder().code(code).message(message).data(data).build();
}
/**
* 描述:根据活动id查询活动信息,给线下店提供
*
*/
@RequestMapping("/getQueueActivityList")
@ResponseBody
public ApiResponse getQueueActivityList(@RequestBody BatchReqBO<Integer> request) {
logger.info("Enter getQueueActivityList. param request is {}", request);
List<DrawlineActivityBo> activityBos = drawlineUserQueueService.getQueueActivityList(request.getReqList());
return new ApiResponse.ApiResponseBuilder().code(200).message("getQueueActivityList success").data(activityBos).build();
}
/**
* 描述:根据活动id列表+uid,查询指定的uid是否存在活动列表中,给线下店提供
* 存在返回true,不存在返回false
*
*/
@RequestMapping("/getQueueByUidAndActivity")
@ResponseBody
public ApiResponse getQueueByUidAndActivity(@RequestBody UserActivityListReqBO request) {
logger.info("Enter getQueueByUidAndActivity. param request is {}", request);
boolean flag = drawlineUserQueueService.getQueueByUidAndActivity(request.getUid(), request.getActivityId());
return new ApiResponse.ApiResponseBuilder().code(200).message("getQueueByUidAndActivity success").data(flag).build();
}
///////////////////////////////////////////////////////////////////////////////////////////////
@RequestMapping("/addDrawlineUserQueueByGateway")
... ...
package com.yoho.activity.queue.service;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.activity.drawline.request.DrawlineActivityBo;
import com.yoho.service.model.activity.drawline.request.DrawlineUserQueueReqBO;
import com.yoho.service.model.activity.drawline.response.DrawlineUserQueueRespBO;
import java.util.List;
public interface IDrawlineUserQueueService {
/**
... ... @@ -56,4 +59,8 @@ public interface IDrawlineUserQueueService {
Boolean judgeHelpUserExist(DrawlineUserQueueReqBO drawlineUserQueueReqBO);
Boolean judgeHelpUserNumMoreLimit(DrawlineUserQueueReqBO drawlineUserQueueReqBO);
List<DrawlineActivityBo> getQueueActivityList(List<Integer> activityIds);
boolean getQueueByUidAndActivity(Integer uid, List<Integer> activityId);
}
... ...
... ... @@ -11,8 +11,10 @@ import com.netflix.config.DynamicLongProperty;
import com.netflix.config.DynamicPropertyFactory;
import com.yoho.activity.dal.ProductLimitUserHelpMapper;
import com.yoho.activity.dal.model.LimitProductHelpUser;
import com.yoho.activity.queue.convert.DrawlineQueueConvert;
import com.yoho.message.sdk.common.model.SendMessageRspBo;
import com.yoho.message.sdk.service.ISendLimitCodeMessage;
import com.yoho.service.model.activity.drawline.request.DrawlineActivityBo;
import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserRespBO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
... ... @@ -409,7 +411,26 @@ public class DrawlineUserQueueServiceImpl implements IDrawlineUserQueueService {
return false;
}
private void getHelpInfo(int activityId, List<Integer> uidList, List<DrawlineUserQueueRespBO> drawlineUserQueueRespBOList) {
@Override
public List<DrawlineActivityBo> getQueueActivityList(List<Integer> activityIds) {
List<DrawlineActivity> activities = drawlineActivityDAO.selectActivityByIdList(activityIds);
List<DrawlineActivityBo> activityBos = DrawlineQueueConvert.toBOListByDOList(activities);
return activityBos;
}
@Override
public boolean getQueueByUidAndActivity(Integer uid, List<Integer> activityIds) {
if(CollectionUtils.isEmpty(activityIds)){
return false;
}
List<DrawlineUserQueue> drawlineUserQueueList = drawlineUserQueueDAO.selectByActIdListAndUid(uid, activityIds);
if(CollectionUtils.isEmpty(drawlineUserQueueList)){
return false;
}
return true;
}
private void getHelpInfo(int activityId, List<Integer> uidList, List<DrawlineUserQueueRespBO> drawlineUserQueueRespBOList) {
String activityIdStr = String.valueOf(activityId);
logger.info("DrawlineUserQueueServiceImpl :: getHelpInfo getLimitProductInfo params activityId is {}", activityIdStr);
LimitProductBo limitProductBo = serviceCaller.call("product.getLimitProductByActivityId", activityIdStr, LimitProductBo.class);
... ...