forked from kidgrow-microservices-platform

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.kidgrow.sms.aliyun.config;
 
import com.kidgrow.sms.template.SmsTemplate;
import lombok.Data;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
 
import java.util.Map;
 
/**
 * 石家庄喜高科技有限责任公司 版权所有 © Copyright 2020<br>
 *
 * @Description: 阿里云 SMS 配置属性<br>
 * @Project: <br>
 * @CreateDate: Created in 2020/2/17 09:10 <br>
 * @Author: <a href="4345453@kidgrow.com">liuke</a>
 */
@Data
@ConfigurationProperties(prefix = "aliyun.sms")
public class SmsProperties implements InitializingBean {
 
    private String accessKeyId;
    private String accessKeySecret;
    private String signName;
    private Map<String, SmsTemplate> templates;
 
    @Override
    public void afterPropertiesSet() throws Exception {
        if (null != this.templates) {
            for (final SmsTemplate smsTemplate : this.templates.values()) {
                if (null == smsTemplate.getSignName()) {
                    smsTemplate.setSignName(this.signName);
                }
            }
        }
    }
}