Commit 95f53b92 by fanjiaxin

推客短信发送调试

parent f529ad6b
Pipeline #75538 passed with stages
in 1 minute 7 seconds
......@@ -11,13 +11,11 @@ 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.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@RequiredArgsConstructor
......@@ -39,7 +37,11 @@ public class UasClientImpl implements IUasClient {
@Override
public boolean sendSmsCode(String uid, String phone, String code,
String scenes, SmsCodeScenesConfigBO scenesConfigBO) {
Map<String, Object> params = assembleSmsArg(uid, phone, code, scenes, 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();
log.error("[op:UasClientImpl:sendSmsCode] params:{}", JSON.toJSONString(params));
try {
MissaResponse<Void> missaResponse = uasFacade.pushSmsCode(params);
......@@ -55,17 +57,4 @@ public class UasClientImpl implements IUasClient {
}
return false;
}
private Map<String, Object> assembleSmsArg(String uid, String phone,
String code, String scenes,
SmsCodeScenesConfigBO scenesConfigBO) {
Map<String, Object> params = new HashMap<>();
params.put("phone", phone);
params.put("message", String.format(scenesConfigBO.getMessageFormat(), code, scenesConfigBO.getCodeValidMinutes()));
params.put("level", 1);
params.put("uid", uid);
params.put("topic", String.format(TOPIC_FORMAT, scenes));
return params;
}
}
......@@ -6,13 +6,12 @@
*/
package com.netease.yanxuan.wx.store.sharer.integration.client.impl;
import com.netease.yanxuan.userinfo.client.meta.CommonResult;
import com.netease.yanxuan.missa.specs.interfaces.response.MissaResponse;
import com.netease.yanxuan.wx.store.sharer.integration.client.IUserInfoClient;
import com.netease.yanxuan.wx.store.sharer.integration.facade.UserInfoFacade;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.UserInfoVerifyByIdentityNoBO;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
......@@ -27,9 +26,9 @@ public class UserInfoClientImpl implements IUserInfoClient {
log.info("[op:verifyByIdentityNo] realName:{}, identityNo:{}", realName, identityNo);
try {
UserInfoVerifyByIdentityNoBO bo = UserInfoVerifyByIdentityNoBO.builder().realName(realName).identityNo(identityNo).build();
CommonResult<Boolean> result = userInfoFacade.verifyByIdentityNo(bo);
if (HttpStatus.OK.value() == result.getCode()) {
return result.getResult();
MissaResponse<Boolean> missaResponse = userInfoFacade.verifyByIdentityNo(bo);
if (null != missaResponse && missaResponse.isOK()) {
return missaResponse.getData();
}
} catch (Exception e) {
log.error("[op:verifyByIdentityNo] is exception", e);
......
......@@ -2,15 +2,13 @@ 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map;
@MissaClient(serviceCode = "logistics-uas")
public interface UasFacade {
@PostMapping(value = "/push/sms/yanxuan-wx-store-sharer", produces= MediaType.APPLICATION_FORM_URLENCODED_VALUE)
MissaResponse<Void> pushSmsCode(@RequestBody Map<String, Object> param);
MissaResponse<Void> pushSmsCode(UasPushSmsCodeParamBO param);
}
package com.netease.yanxuan.wx.store.sharer.integration.facade;
import com.netease.yanxuan.missa.client.annotation.MissaClient;
import com.netease.yanxuan.userinfo.client.meta.CommonResult;
import com.netease.yanxuan.missa.specs.interfaces.response.MissaResponse;
import com.netease.yanxuan.wx.store.sharer.integration.meta.model.bo.UserInfoVerifyByIdentityNoBO;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -11,5 +11,5 @@ import org.springframework.web.bind.annotation.RequestMethod;
public interface UserInfoFacade {
@RequestMapping(value = "/user/realName/verifyByIdentityNo", method = RequestMethod.POST)
CommonResult<Boolean> verifyByIdentityNo(@RequestBody UserInfoVerifyByIdentityNoBO bo);
MissaResponse<Boolean> verifyByIdentityNo(@RequestBody UserInfoVerifyByIdentityNoBO bo);
}
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