Commit efcef36e by fanjiaxin

推客分佣单阿波罗配置调整

parent 7bd0d4fb
Pipeline #75530 passed with stages
in 1 minute 10 seconds
...@@ -9,14 +9,12 @@ package com.netease.yanxuan.wx.store.sharer.integration.client.impl; ...@@ -9,14 +9,12 @@ package com.netease.yanxuan.wx.store.sharer.integration.client.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
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.integration.client.IUasClient; import com.netease.yanxuan.wx.store.sharer.integration.client.IUasClient;
import com.netease.yanxuan.wx.store.sharer.integration.config.RpcConfig; import com.netease.yanxuan.wx.store.sharer.integration.facade.UasFacade;
import com.netease.yanxuan.wx.store.sharer.integration.handler.RestTemplateHandler;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.SendSmsCodeBO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.SendSmsCodeBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.SmsCodeScenesConfigBO; import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.SmsCodeScenesConfigBO;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -29,12 +27,8 @@ import java.util.Map; ...@@ -29,12 +27,8 @@ import java.util.Map;
@Service @Service
public class UasClientImpl implements IUasClient { public class UasClientImpl implements IUasClient {
private final RpcConfig rpcConfig; private final UasFacade uasFacade;
private final RestTemplateHandler restTemplateHandler;
private static final String PRODUCT = "yanxuan-wx-store-sharer";
private static final String SMS_SEND_PATH = "/push/sms/";
private static final String TOPIC_FORMAT = "verify_%s"; private static final String TOPIC_FORMAT = "verify_%s";
/** /**
...@@ -50,18 +44,16 @@ public class UasClientImpl implements IUasClient { ...@@ -50,18 +44,16 @@ public class UasClientImpl implements IUasClient {
String scenes, SmsCodeScenesConfigBO scenesConfigBO) { String scenes, SmsCodeScenesConfigBO scenesConfigBO) {
Map<String, Object> params = assembleSmsArg(uid, phone, code, scenes, scenesConfigBO); Map<String, Object> params = assembleSmsArg(uid, phone, code, scenes, scenesConfigBO);
log.error("[op:UasClientImpl:sendSmsCode] params:{}", JSON.toJSONString(params)); log.error("[op:UasClientImpl:sendSmsCode] params:{}", JSON.toJSONString(params));
String httpUrl = rpcConfig.getUasUrl() + SMS_SEND_PATH + PRODUCT;
try { try {
log.error("[op:UasClientImpl:sendSmsCode] httpUrl:{}", httpUrl); SendSmsCodeBO rpcResult = uasFacade.pushSmsCode(params);
SendSmsCodeBO rpcResult = restTemplateHandler.execute(httpUrl, HttpMethod.POST, params, SendSmsCodeBO.class);
log.error("[op:UasClientImpl:sendSmsCode] rpcResult:{}", JSON.toJSONString(rpcResult)); log.error("[op:UasClientImpl:sendSmsCode] rpcResult:{}", JSON.toJSONString(rpcResult));
if(null == rpcResult){ if (null == rpcResult) {
return false; return false;
} }
if(HttpStatus.OK.value() == rpcResult.getCode()){ if (HttpStatus.OK.value() == rpcResult.getCode()) {
return true; return true;
} }
if(StringUtils.isNotBlank(rpcResult.getErrorCode())){ if (StringUtils.isNotBlank(rpcResult.getErrorCode())) {
throw new BizException(rpcResult.getErrorCode()); throw new BizException(rpcResult.getErrorCode());
} }
} catch (Exception e) { } catch (Exception e) {
......
...@@ -2,16 +2,11 @@ package com.netease.yanxuan.wx.store.sharer.integration.config; ...@@ -2,16 +2,11 @@ package com.netease.yanxuan.wx.store.sharer.integration.config;
import com.ctrip.framework.apollo.spring.annotation.EnableAutoUpdateApolloConfig; import com.ctrip.framework.apollo.spring.annotation.EnableAutoUpdateApolloConfig;
import lombok.Getter; import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@Getter @Getter
@Component @Component
@EnableAutoUpdateApolloConfig("rpc.config") @EnableAutoUpdateApolloConfig("rpc.config")
public class RpcConfig { public class RpcConfig {
/**
* uas地址
*/
@Value("${uas.url:http://127.0.0.1:8550/proxy/test.logistics-uas.service.mailsaas}")
private String uasUrl;
} }
package com.netease.yanxuan.wx.store.sharer.integration.facade;
import com.netease.yanxuan.missa.client.annotation.MissaClient;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.SendSmsCodeBO;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.util.Map;
@MissaClient(serviceCode = "logistics-uas")
public interface UasFacade {
@RequestMapping(value = "/push/sms/yanxuan-wx-store-sharer", method = RequestMethod.POST)
SendSmsCodeBO pushSmsCode(@RequestBody Map<String, Object> param);
}
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