Commit ee9435be by fanjiaxin

代码初始化

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