|
|
|
@ -1,10 +1,9 @@
|
|
|
|
package cn.iocoder.yudao.module.system.mq.producer.sms;
|
|
|
|
package cn.iocoder.yudao.module.system.mq.producer.sms;
|
|
|
|
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
|
|
|
import cn.iocoder.yudao.framework.common.core.KeyValue;
|
|
|
|
import cn.iocoder.yudao.framework.mq.core.bus.AbstractBusProducer;
|
|
|
|
|
|
|
|
import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage;
|
|
|
|
import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import org.springframework.cloud.stream.function.StreamBridge;
|
|
|
|
import org.springframework.context.ApplicationContext;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
@ -14,14 +13,14 @@ import java.util.List;
|
|
|
|
* Sms 短信相关消息的 Producer
|
|
|
|
* Sms 短信相关消息的 Producer
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @author zzf
|
|
|
|
* @author zzf
|
|
|
|
* @date 2021/3/9 16:35
|
|
|
|
* @since 2021/3/9 16:35
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
|
@Component
|
|
|
|
@Component
|
|
|
|
public class SmsProducer extends AbstractBusProducer {
|
|
|
|
public class SmsProducer {
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private StreamBridge streamBridge;
|
|
|
|
private ApplicationContext applicationContext;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 发送 {@link SmsSendMessage} 消息
|
|
|
|
* 发送 {@link SmsSendMessage} 消息
|
|
|
|
@ -36,7 +35,7 @@ public class SmsProducer extends AbstractBusProducer {
|
|
|
|
Long channelId, String apiTemplateId, List<KeyValue<String, Object>> templateParams) {
|
|
|
|
Long channelId, String apiTemplateId, List<KeyValue<String, Object>> templateParams) {
|
|
|
|
SmsSendMessage message = new SmsSendMessage().setLogId(logId).setMobile(mobile);
|
|
|
|
SmsSendMessage message = new SmsSendMessage().setLogId(logId).setMobile(mobile);
|
|
|
|
message.setChannelId(channelId).setApiTemplateId(apiTemplateId).setTemplateParams(templateParams);
|
|
|
|
message.setChannelId(channelId).setApiTemplateId(apiTemplateId).setTemplateParams(templateParams);
|
|
|
|
streamBridge.send("smsSend-out-0", message);
|
|
|
|
applicationContext.publishEvent(message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|