Commit 45cf8fd2 by fanjiaxin

推客分佣单入库

parent 58a19a61
Pipeline #75666 passed with stages
in 1 minute 1 second
package com.netease.yanxuan.wx.store.sharer.integration.handler; package com.netease.yanxuan.wx.store.sharer.integration.handler;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.common.exception.BizException; import com.netease.yanxuan.wx.store.sharer.common.exception.BizException;
import com.netease.yanxuan.wx.store.sharer.common.handler.RestTemplateClient; import com.netease.yanxuan.wx.store.sharer.common.handler.RestTemplateClient;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
...@@ -19,15 +20,17 @@ import org.springframework.stereotype.Service; ...@@ -19,15 +20,17 @@ import org.springframework.stereotype.Service;
public class RestTemplateHandler { public class RestTemplateHandler {
private final RestTemplateClient restTemplateClient; private final RestTemplateClient restTemplateClient;
/** /**
* 执行操作 * 执行操作
*/ */
public <T, R> R execute(String url, HttpMethod method, T params, Class<R> resType) { public <T, R> R execute(String url, HttpMethod method, T params, Class<R> resType) {
try { try {
log.info("[op:RestTemplateHandler.execute] url:{} params:{}", url, JSONObject.toJSONString(params));
String resultJson = restTemplateClient.execute(url, method, params); String resultJson = restTemplateClient.execute(url, method, params);
log.info("[op:RestTemplateHandler.execute] result:{}", resultJson);
return JSON.parseObject(resultJson, resType); return JSON.parseObject(resultJson, resType);
} catch (Exception e) { } catch (Exception e) {
log.info("[op:RestTemplateHandler.execute] is error", e);
throw new BizException(e); throw new BizException(e);
} }
} }
......
package com.netease.yanxuan.wx.store.sharer.integration.handler; package com.netease.yanxuan.wx.store.sharer.integration.handler;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.common.exception.WeChatException; import com.netease.yanxuan.wx.store.sharer.common.exception.WeChatException;
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.handler.RestTemplateClient; import com.netease.yanxuan.wx.store.sharer.common.handler.RestTemplateClient;
...@@ -30,9 +31,12 @@ public class WeChatRestTemplateHandler { ...@@ -30,9 +31,12 @@ public class WeChatRestTemplateHandler {
public <T, R extends WeChatCoreVO> R execute(String url, HttpMethod method, T params, Class<R> resType) { public <T, R extends WeChatCoreVO> R execute(String url, HttpMethod method, T params, Class<R> resType) {
R result; R result;
try { try {
log.info("[op:WeChatRestTemplateHandler.execute] url:{} params:{}", url, JSONObject.toJSONString(params));
String resultJson = restTemplateClient.execute(url, method, params); String resultJson = restTemplateClient.execute(url, method, params);
log.info("[op:WeChatRestTemplateHandler.execute] result:{}", resultJson);
result = JSON.parseObject(resultJson, resType); result = JSON.parseObject(resultJson, resType);
} catch (Exception e) { } catch (Exception e) {
log.info("[op:WeChatRestTemplateHandler.execute] is error", e);
throw new WeChatException(e); throw new WeChatException(e);
} }
if (StringUtils.isNotBlank(result.getErrcode()) if (StringUtils.isNotBlank(result.getErrcode())
......
package com.netease.yanxuan.wx.store.sharer.integration.handler.impl; package com.netease.yanxuan.wx.store.sharer.integration.handler.impl;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig; import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig;
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.core.WeChatContextHolder; import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
...@@ -46,10 +45,7 @@ public class WeChatCommissionOrderDetailRequest implements IWeChatRequest { ...@@ -46,10 +45,7 @@ public class WeChatCommissionOrderDetailRequest implements IWeChatRequest {
.order_id(orderId) .order_id(orderId)
.sku_id(skuId) .sku_id(skuId)
.build(); .build();
log.info("[op:WeChatCommissionOrderDetailRequest.handle] requestParam={}", JSONObject.toJSONString(params)); return weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(),
WeChatCommissionOrderDetailVO res = weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(),
params, WeChatCommissionOrderDetailVO.class); params, WeChatCommissionOrderDetailVO.class);
log.info("[op:WeChatCommissionOrderDetailRequest.res] res={}", JSONObject.toJSONString(res));
return res;
} }
} }
package com.netease.yanxuan.wx.store.sharer.integration.handler.impl; package com.netease.yanxuan.wx.store.sharer.integration.handler.impl;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig; import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig;
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.core.WeChatContextHolder; import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
...@@ -49,10 +48,7 @@ public class WeChatCommissionOrderListRequest implements IWeChatRequest { ...@@ -49,10 +48,7 @@ public class WeChatCommissionOrderListRequest implements IWeChatRequest {
.next_key(nextKey) .next_key(nextKey)
.page_size(pageSize) .page_size(pageSize)
.build(); .build();
log.info("[op:WeChatCommissionOrderListRequest.handle] requestParam={}", JSONObject.toJSONString(params)); return weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(),
WeChatCommissionOrderListVO res = weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(),
params, WeChatCommissionOrderListVO.class); params, WeChatCommissionOrderListVO.class);
log.info("[op:WeChatCommissionOrderListRequest.res] res={}", JSONObject.toJSONString(res));
return res;
} }
} }
package com.netease.yanxuan.wx.store.sharer.integration.handler.impl; package com.netease.yanxuan.wx.store.sharer.integration.handler.impl;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig; import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig;
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.core.WeChatContextHolder; import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
...@@ -12,9 +8,10 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplat ...@@ -12,9 +8,10 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplat
import com.netease.yanxuan.wx.store.sharer.integration.meta.enums.CommissionTypeEnum; import com.netease.yanxuan.wx.store.sharer.integration.meta.enums.CommissionTypeEnum;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSetSharerCommissionBO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSetSharerCommissionBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatCoreVO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatCoreVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/** /**
* @Description 设置推客的分佣比例信息 * @Description 设置推客的分佣比例信息
...@@ -51,9 +48,6 @@ public class WeChatShopSetSharerCommissionRequest implements IWeChatRequest { ...@@ -51,9 +48,6 @@ public class WeChatShopSetSharerCommissionRequest implements IWeChatRequest {
.commission_type(CommissionTypeEnum.PLATFORM.getCode()) .commission_type(CommissionTypeEnum.PLATFORM.getCode())
.commission_ratio(commissionRatio) .commission_ratio(commissionRatio)
.build(); .build();
log.info("[op:WeChatShopSetSharerCommissionRequest.handle] requestParam={}", JSONObject.toJSONString(params)); return weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatCoreVO.class);
WeChatCoreVO res = weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatCoreVO.class);
log.info("[op:WeChatShopSetSharerCommissionRequest.handle] res={}", JSONObject.toJSONString(res));
return res;
} }
} }
package com.netease.yanxuan.wx.store.sharer.integration.handler.impl; package com.netease.yanxuan.wx.store.sharer.integration.handler.impl;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig; import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig;
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.core.WeChatContextHolder; import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
...@@ -11,9 +7,10 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest; ...@@ -11,9 +7,10 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest;
import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler; import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSetSharerProductCommissionBO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSetSharerProductCommissionBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatCoreVO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatCoreVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/** /**
* @Description 设置推客的单个商品的分佣比例信息 * @Description 设置推客的单个商品的分佣比例信息
...@@ -50,9 +47,6 @@ public class WeChatShopSetSharerProductCommissionRequest implements IWeChatReque ...@@ -50,9 +47,6 @@ public class WeChatShopSetSharerProductCommissionRequest implements IWeChatReque
.product_id(productId) .product_id(productId)
.commission_ratio(commissionRatio) .commission_ratio(commissionRatio)
.build(); .build();
log.info("[op:WeChatShopSetSharerProductCommissionRequest.handle] requestParam={}", JSONObject.toJSONString(params)); return weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatCoreVO.class);
WeChatCoreVO res = weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatCoreVO.class);
log.info("[op:WeChatShopSetSharerProductCommissionRequest.handle] res={}", JSONObject.toJSONString(res));
return res;
} }
} }
package com.netease.yanxuan.wx.store.sharer.integration.handler.impl; package com.netease.yanxuan.wx.store.sharer.integration.handler.impl;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig; import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig;
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.core.WeChatContextHolder; import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
...@@ -11,9 +7,10 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest; ...@@ -11,9 +7,10 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest;
import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler; import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSharerListBO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSharerListBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerListVO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerListVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/** /**
* @Description 获取机构绑定的推客信息 * @Description 获取机构绑定的推客信息
...@@ -50,9 +47,6 @@ public class WeChatShopSharerListRequest implements IWeChatRequest { ...@@ -50,9 +47,6 @@ public class WeChatShopSharerListRequest implements IWeChatRequest {
.next_key(nextKey) .next_key(nextKey)
.page_size(pageSize) .page_size(pageSize)
.build(); .build();
log.info("[op:WeChatShopSharerListRequest.handle] requestParam={}", JSONObject.toJSONString(params)); return weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatSharerListVO.class);
WeChatSharerListVO res = weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatSharerListVO.class);
log.info("[op:WeChatShopSharerListRequest.res] res={}", JSONObject.toJSONString(res));
return res;
} }
} }
package com.netease.yanxuan.wx.store.sharer.integration.handler.impl; package com.netease.yanxuan.wx.store.sharer.integration.handler.impl;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
import com.alibaba.fastjson.JSONObject;
import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig; import com.netease.yanxuan.wx.store.sharer.integration.config.WeChatConfig;
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.core.WeChatContextHolder; import com.netease.yanxuan.wx.store.sharer.integration.core.WeChatContextHolder;
...@@ -11,9 +7,10 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest; ...@@ -11,9 +7,10 @@ import com.netease.yanxuan.wx.store.sharer.integration.handler.IWeChatRequest;
import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler; import com.netease.yanxuan.wx.store.sharer.integration.handler.WeChatRestTemplateHandler;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSharerRegisterBindBO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.WeChatSharerRegisterBindBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerRegisterBindVO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.vo.WeChatSharerRegisterBindVO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpMethod;
import org.springframework.stereotype.Service;
/** /**
* @Description 微信凭证请求 * @Description 微信凭证请求
...@@ -49,9 +46,6 @@ public class WeChatShopSharerRegisterBindRequest implements IWeChatRequest { ...@@ -49,9 +46,6 @@ public class WeChatShopSharerRegisterBindRequest implements IWeChatRequest {
.is_simple_register(true) .is_simple_register(true)
.sharer_openid(sharerOpenid) .sharer_openid(sharerOpenid)
.build(); .build();
log.info("[op:WeChatShopSharerRegisterBindRequest.handle] requestParam={}", JSONObject.toJSONString(params)); return weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatSharerRegisterBindVO.class);
WeChatSharerRegisterBindVO res = weChatRestTemplateHandler.execute(getRequestUrl(), getRequestMethod(), params, WeChatSharerRegisterBindVO.class);
log.info("[op:WeChatShopSharerRegisterBindRequest.handle] res={}", JSONObject.toJSONString(res));
return res;
} }
} }
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