提交 da8c2c8d authored 作者: 刘海泉's avatar 刘海泉

增加通用发送短信的功能

上级 496ec2a7
......@@ -10,6 +10,7 @@ import com.clx.performance.param.mq.SendSmsNoticeParam;
import com.clx.performance.service.SendSmsService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageBuilder;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
......@@ -54,4 +55,18 @@ public class SendSmsServiceImpl implements SendSmsService {
.filter(item -> JSONUtil.toList(item.getWarnTypeJson(), Integer.class).contains(code))
.map(VehicleWarnUser::getMobile).collect(Collectors.toList());
}
//构建站内信中的内容,替换变量
private String replaceContent(String content,List<String> list){
int listSize = 0;
int times = countCharTimes(content, "%s");
if(CollectionUtils.isNotEmpty(list)){
listSize = list.size();
}
if(times != listSize){
log.error("替换的变量和字符串中需要的变量数量不一致");
return null;
}
return String.format(content, list.toArray());
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论