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