Commit ee9435be by fanjiaxin

代码初始化

parent 6ce14981
Pipeline #71440 passed with stages
in 1 minute 13 seconds
......@@ -19,7 +19,7 @@ import java.util.Collections;
public class WebConfig implements WebMvcConfigurer {
private final AuthInterceptor authInterceptor;
private static final String[] EXCLUDE_URLS = {"/open/**", "/product/page/list", "/user/login"};
private static final String[] EXCLUDE_URLS = {"/open/**", "/user/login", "/product/page/list"};
@Override
public void addInterceptors(InterceptorRegistry registry) {
......
......@@ -30,6 +30,7 @@ public class AuthInterceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
log.info("AuthInterceptor preHandle execute, url:{}", request.getRequestURI());
String token = request.getHeader(CoreConstant.AUTH_HEADER_TOKEN_KEY);
if (StringUtils.isEmpty(token)) {
throw new NoAuthException("用户认证失败");
......
......@@ -14,5 +14,5 @@ public interface IProductService {
/**
* 获取商品分页列表
*/
PageVO<ProductListVO> getPageList(PageQuery pageQuery, String keyword);
PageVO<ProductListVO> getProductPageList(PageQuery pageQuery, String keyword);
}
package com.netease.yanxuan.wx.store.sharer.biz.service.impl;
import com.netease.yanxuan.wx.store.sharer.biz.config.DrmSharerConfig;
import com.netease.yanxuan.wx.store.sharer.biz.core.LoginUserContextHolder;
import com.netease.yanxuan.wx.store.sharer.biz.core.LoginUserInfo;
import com.netease.yanxuan.wx.store.sharer.biz.meta.model.vo.ProductListVO;
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.service.IProductService;
import com.netease.yanxuan.wx.store.sharer.common.exception.NoAuthException;
import com.netease.yanxuan.wx.store.sharer.integration.handler.impl.WeChatPromoteProductDetailRequest;
import com.netease.yanxuan.wx.store.sharer.integration.handler.impl.WeChatPromoteProductLinkRequest;
import com.netease.yanxuan.wx.store.sharer.integration.handler.impl.WeChatPromoteProductListRequest;
......@@ -14,6 +14,7 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.impl.WeChatSharer
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -38,13 +39,10 @@ public class ProductServiceImpl implements IProductService {
private final WeChatPromoteProductDetailRequest weChatPromoteProductDetailRequest;
private final WeChatPromoteProductLinkRequest weChatPromoteProductLinkRequest;
private final WeChatSharerListRequest weChatSharerListRequest;
private final DrmSharerConfig drmSharerConfig;
@Override
public PageVO<ProductListVO> getPageList(PageQuery pageQuery, String keyword) {
LoginUserInfo loginUserInfo = LoginUserContextHolder.get();
if (null == loginUserInfo) {
throw new NoAuthException("用户登录状态过期");
}
public PageVO<ProductListVO> getProductPageList(PageQuery pageQuery, String keyword) {
PageVO<ProductListVO> pageVO = new PageVO<>();
WeChatPromoteProductListVO productListVO = weChatPromoteProductListRequest.handle(keyword,
pageQuery.getNextKey(), pageQuery.getPageSize());
......@@ -79,7 +77,10 @@ public class ProductServiceImpl implements IProductService {
listVO.setPrice(price);
// 推客分佣比例
BigDecimal commissionRatio = null;
BigDecimal commissionRatio = drmSharerConfig.getDefaultCommissionRatio();
// 获取用户信息
LoginUserInfo loginUserInfo = LoginUserContextHolder.get();
if(null != loginUserInfo && StringUtils.isNotBlank(loginUserInfo.getOpenId())){
WeChatSharerListVO sharerListVO = weChatSharerListRequest.handle(loginUserInfo.getOpenId(), "", 1);
if (null != sharerListVO && !CollectionUtils.isEmpty(sharerListVO.getSharer_info_list())) {
WeChatSharerInfoVO sharerInfoVO = sharerListVO.getSharer_info_list().get(0);
......@@ -87,6 +88,7 @@ public class ProductServiceImpl implements IProductService {
commissionRatio = sharerInfoVO.getCommission_ratio();
}
}
}
WeChatPromoteProductDetailVO.WeChatPromoteProductVO.WeChatPromoteProductCommissionInfoVO commissionInfo = product.getCommission_info();
// 服务费率
Integer serviceRatio = null != commissionInfo ? commissionInfo.getService_ratio() : null;
......
......@@ -27,9 +27,9 @@ public class ProductController extends BaseController {
* 商品分页列表
*/
@GetMapping("/page/list")
public Result<PageVO> getUserInfo(PageQuery pageQuery,
public Result<PageVO> getProductPageList(PageQuery pageQuery,
@RequestParam(value = "keyword", required = false) String keyword) {
PageVO<ProductListVO> pageList = iProductService.getPageList(pageQuery, keyword);
PageVO<ProductListVO> pageList = iProductService.getProductPageList(pageQuery, keyword);
return Result.ok(pageList);
}
......
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