|
|
@@ -171,17 +171,21 @@ public class AlarmController extends BaseController {
|
|
|
private void sendSMS(AlarmEntrty alarmEntrty) {
|
|
|
List<UserPhoneInfo> userPhoneInfoList = alarmEntrty.getUserPhoneInfo();
|
|
|
LinkedHashMap<String, List<UserPhoneInfo>> userPhoneInfoMap = Optional.ofNullable(userPhoneInfoList).orElseGet(Collections::emptyList).stream().collect(Collectors.groupingBy(UserPhoneInfo::getPhone, LinkedHashMap::new, Collectors.toList()));
|
|
|
- String text = alarmEntrty.getText() + smsRedirect;
|
|
|
+ StringBuffer textURL = new StringBuffer();
|
|
|
+ textURL.append(alarmEntrty.getText());
|
|
|
for (String phone : alarmEntrty.getTo()) {
|
|
|
- ResultData urlScheme = remoteMessageService.getUrlScheme(alarmEntrty.getLogId());
|
|
|
- if (urlScheme.getCode() != HttpStatus.SUCCESS) {
|
|
|
- log.error("获取urlScheme失败!");
|
|
|
+ try {
|
|
|
+ ResultData urlScheme = remoteMessageService.getUrlScheme(alarmEntrty.getLogId());
|
|
|
+ if (urlScheme.getCode() != HttpStatus.SUCCESS) {
|
|
|
+ log.error("获取urlScheme失败!");
|
|
|
+ }
|
|
|
+ textURL.append(smsRedirect).append("?id=").append(alarmEntrty.getLogId()).append("&urlScheme=").append(urlScheme.getData());
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("获取urlScheme异常!请检查配置(nacos链接配置,小程序参数配置)!");
|
|
|
}
|
|
|
- String newTest = "";
|
|
|
- newTest = text + "?id=" + alarmEntrty.getLogId() + "&urlScheme=" + urlScheme.getData();
|
|
|
- alarmEntrty.setText(newTest);
|
|
|
+ alarmEntrty.setText(textURL.toString());
|
|
|
alarmEntrty.setTo(new String[]{phone});
|
|
|
- log.info("发送给用户===>>>{},短信内容===>>>{}",phone,newTest);
|
|
|
+ log.info("发送给用户===>>>{},短信内容===>>>{}",phone,textURL);
|
|
|
//发送短信
|
|
|
Map map = alarmUtil.sendPost(alarmEntrty);
|
|
|
String data = (String) map.get("Reply");
|