Commit b14c1076 by fanjiaxin

新加入获取用户分佣比例接口

parent 68721f58
Pipeline #71675 passed with stages
in 1 minute 6 seconds
...@@ -4,6 +4,8 @@ import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductListVO; ...@@ -4,6 +4,8 @@ import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductListVO;
import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductPromotionLinkVO; import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductPromotionLinkVO;
import com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageQuery; import com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageQuery;
import com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageVO; import com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageVO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatGetSharerProductCommissionVO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerListVO;
/** /**
* @Description 商品-业务层 * @Description 商品-业务层
...@@ -21,4 +23,14 @@ public interface IProductService { ...@@ -21,4 +23,14 @@ public interface IProductService {
* 商品分享短链 * 商品分享短链
*/ */
ProductPromotionLinkVO getProductPromotionLink(String sharerAppid, String productId); ProductPromotionLinkVO getProductPromotionLink(String sharerAppid, String productId);
/**
* 获取获取机构绑定的推客信息
*/
WeChatSharerListVO getBindSharerList(String sharerOpenid);
/**
* 获取推客的某个商品的推广分佣比例
*/
WeChatGetSharerProductCommissionVO getSharerProductCommissionInfo(String sharerAppid, String productId);
} }
...@@ -14,10 +14,7 @@ import com.netease.yanxuan.wx.store.sharer.common.exception.NoBindSharerExceptio ...@@ -14,10 +14,7 @@ import com.netease.yanxuan.wx.store.sharer.common.exception.NoBindSharerExceptio
import com.netease.yanxuan.wx.store.sharer.common.handler.RedisClient; import com.netease.yanxuan.wx.store.sharer.common.handler.RedisClient;
import com.netease.yanxuan.wx.store.sharer.common.util.AsyncUtils; import com.netease.yanxuan.wx.store.sharer.common.util.AsyncUtils;
import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi; import com.netease.yanxuan.wx.store.sharer.integration.constant.WeChatApi;
import com.netease.yanxuan.wx.store.sharer.integration.handler.impl.WeChatShopPromoteProductDetailRequest; import com.netease.yanxuan.wx.store.sharer.integration.handler.impl.*;
import com.netease.yanxuan.wx.store.sharer.integration.handler.impl.WeChatShopPromoteProductLinkRequest;
import com.netease.yanxuan.wx.store.sharer.integration.handler.impl.WeChatShopPromoteProductListRequest;
import com.netease.yanxuan.wx.store.sharer.integration.handler.impl.WeChatShopSharerListRequest;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.*; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.*;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -27,7 +24,10 @@ import org.springframework.util.CollectionUtils; ...@@ -27,7 +24,10 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode; import java.math.RoundingMode;
import java.util.*; import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -40,13 +40,15 @@ import java.util.stream.Collectors; ...@@ -40,13 +40,15 @@ import java.util.stream.Collectors;
@RequiredArgsConstructor @RequiredArgsConstructor
@Service @Service
public class ProductServiceImpl implements IProductService { public class ProductServiceImpl implements IProductService {
private final RedisClient redisClient;
private final DrmSharerConfig drmSharerConfig;
private final Executor asyncProductListServiceExecutor;
private final WeChatShopPromoteProductListRequest weChatShopPromoteProductListRequest; private final WeChatShopPromoteProductListRequest weChatShopPromoteProductListRequest;
private final WeChatShopPromoteProductDetailRequest weChatShopPromoteProductDetailRequest; private final WeChatShopPromoteProductDetailRequest weChatShopPromoteProductDetailRequest;
private final WeChatShopPromoteProductLinkRequest weChatShopPromoteProductLinkRequest; private final WeChatShopPromoteProductLinkRequest weChatShopPromoteProductLinkRequest;
private final WeChatShopSharerListRequest weChatShopSharerListRequest; private final WeChatShopSharerListRequest weChatShopSharerListRequest;
private final DrmSharerConfig drmSharerConfig; private final WeChatShopGetSharerProductCommissionRequest weChatShopGetSharerProductCommissionRequest;
private final RedisClient redisClient;
private final Executor asyncProductListServiceExecutor;
@Override @Override
...@@ -65,7 +67,7 @@ public class ProductServiceImpl implements IProductService { ...@@ -65,7 +67,7 @@ public class ProductServiceImpl implements IProductService {
// 使用异步多线程处理 // 使用异步多线程处理
productList = AsyncUtils.processListAsync(productListVO.getProduct_list(), item -> { productList = AsyncUtils.processListAsync(productListVO.getProduct_list(), item -> {
WeChatPromoteProductDetailVO detailVO = getProductDetailCache(item.getShop_appid(), item.getProduct_id()); WeChatPromoteProductDetailVO detailVO = getProductDetailCache(item.getShop_appid(), item.getProduct_id());
if(null == detailVO){ if (null == detailVO) {
return null; return null;
} }
WeChatPromoteProductDetailVO.WeChatPromoteProductVO product = detailVO.getProduct(); WeChatPromoteProductDetailVO.WeChatPromoteProductVO product = detailVO.getProduct();
...@@ -159,6 +161,17 @@ public class ProductServiceImpl implements IProductService { ...@@ -159,6 +161,17 @@ public class ProductServiceImpl implements IProductService {
return null; return null;
} }
@Override
public WeChatSharerListVO getBindSharerList(String sharerOpenid) {
return weChatShopSharerListRequest.handle(sharerOpenid, "", 1);
}
@Override
public WeChatGetSharerProductCommissionVO getSharerProductCommissionInfo(String sharerAppid,
String productId) {
return weChatShopGetSharerProductCommissionRequest.handle(sharerAppid, Long.valueOf(productId));
}
/** /**
* 获取商品详情,并缓存到redis中 * 获取商品详情,并缓存到redis中
*/ */
......
...@@ -6,6 +6,8 @@ import com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageQuery; ...@@ -6,6 +6,8 @@ import com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageQuery;
import com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageVO; import com.netease.yanxuan.wx.store.sharer.biz.meta.page.PageVO;
import com.netease.yanxuan.wx.store.sharer.biz.service.IProductService; import com.netease.yanxuan.wx.store.sharer.biz.service.IProductService;
import com.netease.yanxuan.wx.store.sharer.common.core.Result; import com.netease.yanxuan.wx.store.sharer.common.core.Result;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatGetSharerProductCommissionVO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerListVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -44,4 +46,23 @@ public class ProductController extends BaseController { ...@@ -44,4 +46,23 @@ public class ProductController extends BaseController {
ProductPromotionLinkVO promotionLink = iProductService.getProductPromotionLink(shopAppid, productId); ProductPromotionLinkVO promotionLink = iProductService.getProductPromotionLink(shopAppid, productId);
return Result.ok(promotionLink); return Result.ok(promotionLink);
} }
/**
* 获取获取机构绑定的推客信息
*/
@GetMapping("/bind/sharer/list")
public Result<WeChatSharerListVO> getBindSharerList(@RequestParam("sharerOpenid") String sharerOpenid) {
WeChatSharerListVO result = iProductService.getBindSharerList(sharerOpenid);
return Result.ok(result);
}
/**
* 获取推客的某个商品的推广分佣比例
*/
@GetMapping("/sharer/product/commission")
public Result<WeChatGetSharerProductCommissionVO> getSharerProductCommissionInfo(@RequestParam("sharerAppid") String sharerAppid,
@RequestParam("productId") String productId) {
WeChatGetSharerProductCommissionVO result = iProductService.getSharerProductCommissionInfo(sharerAppid, productId);
return Result.ok(result);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment