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;
import com.alibaba.fastjson.JSON;
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.config.RpcConfig;
import com.netease.yanxuan.wx.store.sharer.integration.handler.RestTemplateHandler;
import com.netease.yanxuan.wx.store.sharer.integration.facade.UasFacade;
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 lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
......@@ -29,12 +27,8 @@ import java.util.Map;
@Service
public class UasClientImpl implements IUasClient {
private final RpcConfig rpcConfig;
private final RestTemplateHandler restTemplateHandler;
private final UasFacade uasFacade;
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";
/**
......@@ -50,18 +44,16 @@ public class UasClientImpl implements IUasClient {
String scenes, SmsCodeScenesConfigBO scenesConfigBO) {
Map<String, Object> params = assembleSmsArg(uid, phone, code, scenes, scenesConfigBO);
log.error("[op:UasClientImpl:sendSmsCode] params:{}", JSON.toJSONString(params));
String httpUrl = rpcConfig.getUasUrl() + SMS_SEND_PATH + PRODUCT;
try {
log.error("[op:UasClientImpl:sendSmsCode] httpUrl:{}", httpUrl);
SendSmsCodeBO rpcResult = restTemplateHandler.execute(httpUrl, HttpMethod.POST, params, SendSmsCodeBO.class);
SendSmsCodeBO rpcResult = uasFacade.pushSmsCode(params);
log.error("[op:UasClientImpl:sendSmsCode] rpcResult:{}", JSON.toJSONString(rpcResult));
if(null == rpcResult){
if (null == rpcResult) {
return false;
}
if(HttpStatus.OK.value() == rpcResult.getCode()){
if (HttpStatus.OK.value() == rpcResult.getCode()) {
return true;
}
if(StringUtils.isNotBlank(rpcResult.getErrorCode())){
if (StringUtils.isNotBlank(rpcResult.getErrorCode())) {
throw new BizException(rpcResult.getErrorCode());
}
} catch (Exception e) {
......
......@@ -2,16 +2,11 @@ package com.netease.yanxuan.wx.store.sharer.integration.config;
import com.ctrip.framework.apollo.spring.annotation.EnableAutoUpdateApolloConfig;
import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@Getter
@Component
@EnableAutoUpdateApolloConfig("rpc.config")
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