Authored by zhaoqing

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

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