Authored by zhaoqing

限定商品分享助力获取限购码优化

@@ -14,6 +14,8 @@ import com.yoho.service.model.activity.drawline.request.LimitProductHelpUserRequ @@ -14,6 +14,8 @@ import com.yoho.service.model.activity.drawline.request.LimitProductHelpUserRequ
14 import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserListBO; 14 import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserListBO;
15 import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserRespBO; 15 import com.yoho.service.model.activity.drawline.response.LimitProductHelpUserRespBO;
16 import com.yoho.service.model.activity.drawline.response.UserBaseRspBO; 16 import com.yoho.service.model.activity.drawline.response.UserBaseRspBO;
  17 +import com.yoho.service.model.promotion.LimitCodeUserBo;
  18 +import com.yoho.service.model.promotion.request.ProductLimitCodeReq;
17 import org.apache.commons.collections.CollectionUtils; 19 import org.apache.commons.collections.CollectionUtils;
18 import org.apache.commons.lang.StringUtils; 20 import org.apache.commons.lang.StringUtils;
19 import org.slf4j.Logger; 21 import org.slf4j.Logger;
@@ -105,6 +107,26 @@ public class ProductLimitUserHelpServiceImpl implements IProductLimitUserHelpSer @@ -105,6 +107,26 @@ public class ProductLimitUserHelpServiceImpl implements IProductLimitUserHelpSer
105 //清除缓存 107 //清除缓存
106 String redisKeySuffix = limitProductHelpUserRequestBO.getUserId() + ":" + limitProductHelpUserRequestBO.getLimitProductCode(); 108 String redisKeySuffix = limitProductHelpUserRequestBO.getUserId() + ":" + limitProductHelpUserRequestBO.getLimitProductCode();
107 redisValueCache.delete(CacheKeyEnum.LIMIT_USER_HELP_INFO, redisKeySuffix); 109 redisValueCache.delete(CacheKeyEnum.LIMIT_USER_HELP_INFO, redisKeySuffix);
  110 + //处理获取限购码逻辑如下:
  111 + //查出限定商品属于哪种活动类型,当为分享助力时,即limitProductType == 4, 需要判断助力人数是否已经达到要求,如达到要求则发送限购码
  112 + LimitProductBo limitProductBo = serviceCaller.call("product.getLimitProductByCode", limitProductHelpUserRequestBO.getLimitProductCode(), LimitProductBo.class);
  113 + if (null == limitProductBo){
  114 + return;
  115 + }
  116 + if (null != limitProductBo.getLimitProductType() && limitProductBo.getLimitProductType() == 4){
  117 + List<LimitProductHelpUser> list = productLimitUserHelpMapper.selectHelpInfo(limitProductHelpUserRequestBO.getUserId(),limitProductHelpUserRequestBO.getLimitProductCode());
  118 + Integer helpLimit = limitProductBo.getHelpLimit();
  119 + if (CollectionUtils.isNotEmpty(list) && list.size() == helpLimit){
  120 + ProductLimitCodeReq limitCodeReq = new ProductLimitCodeReq();
  121 + limitCodeReq.setLimitProductCode(limitProductHelpUserRequestBO.getLimitProductCode());
  122 + limitCodeReq.setUid(limitProductHelpUserRequestBO.getUserId());
  123 + // 调promotion接口发放限购码奖励
  124 + logger.info("ProductLimitUserHelpServiceImpl :: addHelpUserInfo start promotion.addLimitCodeReceiveRecord, uid is: {},limitProductCode is:{}", limitCodeReq.getUid(),limitCodeReq.getLimitProductCode());
  125 + LimitCodeUserBo data = serviceCaller.call("promotion.addLimitCodeReceiveRecord", limitCodeReq, LimitCodeUserBo.class);
  126 + logger.info("ProductLimitUserHelpServiceImpl :: addHelpUserInfo end promotion.addLimitCodeReceiveRecord", data);
  127 + }
  128 + }
  129 +
108 } 130 }
109 131
110 @Override 132 @Override