...
|
...
|
@@ -3,6 +3,7 @@ |
|
|
*/
|
|
|
package com.yoho.yhmessage.sms.helper;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
...
|
...
|
@@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import com.yoho.core.config.ConfigReader;
|
|
|
import com.yoho.message.dal.MessageFilterMapper;
|
|
|
import com.yoho.yhmessage.sms.common.SmsProviderCodeEnum;
|
|
|
import com.yoho.yhmessage.sms.filter.IFilterUserService;
|
...
|
...
|
@@ -40,6 +42,8 @@ public class SMSSendHelper { |
|
|
@Value("${message.sender.isDev:true}")
|
|
|
private boolean isDev;
|
|
|
|
|
|
@Autowired
|
|
|
private ConfigReader configReader;
|
|
|
/**
|
|
|
* 根据运营商选择发送短信
|
|
|
*
|
...
|
...
|
@@ -60,22 +64,11 @@ public class SMSSendHelper { |
|
|
log.warn("sendSMS error with content is empty");
|
|
|
return null;
|
|
|
}
|
|
|
mobileList = commonFilter(mobileList, content);
|
|
|
// 2 查询是否需要过滤场景
|
|
|
// String sendScene = params.get("sendScene");
|
|
|
// MessageFilter messageFilter =
|
|
|
// messageFilterMapper.selectByScene(sendScene);
|
|
|
// if (null != messageFilter) {
|
|
|
// if (messageFilter.getIsFilter() == 1) {
|
|
|
// // 有配置场景并且过滤开关开启
|
|
|
// // 1. 特定场景过滤(暂时未定规则)
|
|
|
// // 2. 通用过滤
|
|
|
// mobileList = commonFilter(mobileList, content);
|
|
|
// }
|
|
|
// } else {
|
|
|
// // 没有配置过滤场景,用通用过滤场景(过滤重复内容和总次数)
|
|
|
// mobileList = commonFilter(mobileList, content);
|
|
|
// }
|
|
|
|
|
|
// 不用过滤的场景
|
|
|
if (!this.getIgnoreUserCountKeyList().contains(params.get("sendScene"))) {
|
|
|
mobileList = commonFilter(mobileList, content);
|
|
|
}
|
|
|
|
|
|
if (mobileList.isEmpty()) {
|
|
|
log.warn("sendSMS mobileList is empty");
|
...
|
...
|
@@ -123,4 +116,21 @@ public class SMSSendHelper { |
|
|
return mobileList;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
*
|
|
|
* Description: 不用过滤的场景<br>
|
|
|
*
|
|
|
* @author amos.shan<br>
|
|
|
* @taskId <br>
|
|
|
* @return <br>
|
|
|
*/
|
|
|
private List<String> getIgnoreUserCountKeyList() {
|
|
|
String ignoreUserCountKeyList = configReader.getString("msgcenter.sms.degrade.ignoreUserCountKeyList",
|
|
|
"EXCHANGE_GOODS_VERIFY_PASS,REFUND_GOODS_VERIFY_PASS,EXCHANGE_GOODS_ONLY_SMS,REFUND_GOODS_ONLY_SMS");
|
|
|
if (StringUtils.isBlank(ignoreUserCountKeyList)) {
|
|
|
return new ArrayList<String>();
|
|
|
}
|
|
|
return Arrays.asList(ignoreUserCountKeyList.split(","));
|
|
|
}
|
|
|
|
|
|
} |
...
|
...
|
|