Commit a7fa51fb by fanjiaxin

推客短信发送调试

parent ce56f943
Pipeline #75549 passed with stages
in 1 minute 15 seconds
......@@ -11,11 +11,12 @@ import com.netease.yanxuan.missa.specs.interfaces.response.MissaResponse;
import com.netease.yanxuan.wx.store.sharer.integration.client.IUasClient;
import com.netease.yanxuan.wx.store.sharer.integration.facade.UasFacade;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.SmsCodeScenesConfigBO;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.UasPushSmsCodeParamBO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
@Slf4j
......@@ -39,10 +40,7 @@ public class UasClientImpl implements IUasClient {
public boolean sendSmsCode(String uid, String phone, String code,
String scenes, SmsCodeScenesConfigBO scenesConfigBO) {
// 构建入参
UasPushSmsCodeParamBO params = UasPushSmsCodeParamBO.builder()
.phone(phone)
.message(String.format(scenesConfigBO.getMessageFormat(), code, scenesConfigBO.getCodeValidMinutes()))
.level(1).uid(uid).topic(String.format(TOPIC_FORMAT, scenes)).build();
MultiValueMap<String, Object> params = assembleSmsArg(uid, phone, code, scenes, scenesConfigBO);
log.error("[op:UasClientImpl:sendSmsCode] params:{}", JSON.toJSONString(params));
try {
MissaResponse<Void> missaResponse = uasFacade.pushSmsCode(params);
......@@ -53,4 +51,17 @@ public class UasClientImpl implements IUasClient {
}
return false;
}
private MultiValueMap<String, Object> assembleSmsArg(String uid, String phone,
String code, String scenes,
SmsCodeScenesConfigBO scenesConfigBO) {
MultiValueMap<String, Object> params = new LinkedMultiValueMap<>(5);
params.add("phone", phone);
params.add("message", String.format(scenesConfigBO.getMessageFormat(), code, scenesConfigBO.getCodeValidMinutes()));
params.add("level", 1);
params.add("uid", uid);
params.add("topic", String.format(TOPIC_FORMAT, scenes));
return params;
}
}
......@@ -2,11 +2,11 @@ package com.netease.yanxuan.wx.store.sharer.integration.facade;
import com.netease.yanxuan.missa.client.annotation.MissaClient;
import com.netease.yanxuan.missa.specs.interfaces.response.MissaResponse;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.UasPushSmsCodeParamBO;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@MissaClient(serviceCode = "logistics-uas")
public interface UasFacade {
......@@ -14,5 +14,5 @@ public interface UasFacade {
@RequestMapping(value = "/push/sms/yanxuan-wx-store-sharer",
method = RequestMethod.POST,
consumes = MediaType.APPLICATION_FORM_URLENCODED_VALUE)
MissaResponse<Void> pushSmsCode(@ModelAttribute UasPushSmsCodeParamBO param);
MissaResponse<Void> pushSmsCode(@RequestParam MultiValueMap<String, Object> formData);
}
package com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo;
import lombok.Builder;
import lombok.Data;
import java.io.Serializable;
/**
* @Description UAS-发送短信-配置-业务对象
* @Author fanjiaxin
* @Date 2025/3/11 18:43
*/
@Data
@Builder
public class UasPushSmsCodeParamBO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 手机号
*/
private String phone;
/**
* 信息
*/
private String message;
/**
* 级别
*/
private Integer level;
/**
* UID
*/
private String uid;
/**
* 主题
*/
private String topic;
}
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