REQ-2874: 政务-添加高新区短信渠道
This commit is contained in:
parent
53340ab36f
commit
248a74193d
@ -153,7 +153,7 @@ public class MessageServiceImpl implements MessageService, EnvironmentAware {
|
||||
messageManager.saveMessage(message);
|
||||
|
||||
// 如果模拟发短信成功,则直接设置状态并为成功
|
||||
if (shouldSkip(request)) {
|
||||
if (shouldSkip(request.getPhoneNo())) {
|
||||
successMessageAndSendDingDing(request, message, messageTemplate);
|
||||
return;
|
||||
}
|
||||
@ -374,15 +374,14 @@ public class MessageServiceImpl implements MessageService, EnvironmentAware {
|
||||
* 是否跳过
|
||||
* @return
|
||||
*/
|
||||
private boolean shouldSkip(MnsRequestDto request){
|
||||
String cellphone = request.getPhoneNo();
|
||||
public boolean shouldSkip(String phone){
|
||||
// 白名单包含
|
||||
if(checkCandidate(userCellphoneProperties.getWhitelist(), cellphone)) {
|
||||
if(checkCandidate(userCellphoneProperties.getWhitelist(), phone)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 黑名单包含
|
||||
if(checkCandidate(userCellphoneProperties.getBlacklist(), cellphone)) {
|
||||
if(checkCandidate(userCellphoneProperties.getBlacklist(), phone)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -7,9 +7,11 @@ import cn.axzo.core.constant.RedisNameConstants;
|
||||
import cn.axzo.msg.center.common.redis.IAxzoJedisManager;
|
||||
import cn.axzo.msg.center.domain.enums.InsideSmsCodeEnum;
|
||||
import cn.axzo.msg.center.notices.common.properties.SmsProperties;
|
||||
import cn.axzo.msg.center.notices.integration.client.DingDingClient;
|
||||
import cn.axzo.msg.center.notices.manager.api.dto.request.MnsRequestDto;
|
||||
import cn.axzo.msg.center.notices.service.api.MessageService;
|
||||
import cn.axzo.msg.center.notices.service.gateway.SmsGateway;
|
||||
import cn.axzo.msg.center.notices.service.impl.MessageServiceImpl;
|
||||
import cn.axzo.msg.center.notices.service.impl.MnsType;
|
||||
import cn.axzo.msg.center.notices.service.request.CaptchaParam;
|
||||
import cn.axzo.msg.center.notices.service.request.SendCodeV2Req;
|
||||
@ -27,7 +29,6 @@ import com.aliyuncs.IAcsClient;
|
||||
import com.aliyuncs.http.MethodType;
|
||||
import com.aliyuncs.profile.DefaultProfile;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cloud.context.config.annotation.RefreshScope;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -56,9 +57,10 @@ public class SmsManager extends BaseManager implements SmsGateway {
|
||||
private SmsProperties smsProperties;
|
||||
@Resource
|
||||
private MessageService messageService;
|
||||
|
||||
@Value("${phone.isSendMnsCode}")
|
||||
private boolean isSendMnsCode;
|
||||
@Resource
|
||||
private MessageServiceImpl messageServiceImpl;
|
||||
@Resource(name = "dingDingClient")
|
||||
private DingDingClient dingDingClient;
|
||||
|
||||
private static final HashMap<String,String> messageErrMsg = new HashMap<>();
|
||||
static {
|
||||
@ -66,8 +68,6 @@ public class SmsManager extends BaseManager implements SmsGateway {
|
||||
messageErrMsg.put("isv.DOMESTIC_NUMBER_NOT_SUPPORTED", "国际/港澳台不支持发送境内号码");
|
||||
}
|
||||
|
||||
public static final Integer SUCCESS = 200;
|
||||
|
||||
/**
|
||||
* 发送验证码`
|
||||
* @param req
|
||||
@ -183,7 +183,9 @@ public class SmsManager extends BaseManager implements SmsGateway {
|
||||
}
|
||||
|
||||
public void sendMnsCode(String phoneNumber, Map<String, Object> param, String appCode, String templateNo, Integer code, String expansion) {
|
||||
if (!isSendMnsCode) {
|
||||
if (messageServiceImpl.shouldSkip(phoneNumber)) {
|
||||
log.info("跳过手机发短信验证码,手机号:{}, params: {}", phoneNumber, JSON.toJSONString(param));
|
||||
dingDingClient.notifyMockMessage(phoneNumber, "验证码", JSON.toJSONString(param));
|
||||
return;
|
||||
}
|
||||
MnsRequestDto request = new MnsRequestDto();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user