yangys
2024-04-04 ed4a5236bab800094be4a8378f5098eebe3de6ac
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
package com.qianwen.smartman.modules.notify.manager;
 
import com.qianwen.core.notify.NotifyType;
import com.qianwen.core.notify.template.AbstractTemplateManager;
import com.qianwen.core.notify.template.TemplateProperties;
import com.qianwen.core.notify.template.TemplateProvider;
import com.qianwen.core.tool.utils.Func;
import com.qianwen.smartman.modules.notify.entity.NotifyTemplateEntity;
import com.qianwen.smartman.modules.notify.service.INotifyTemplateService;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;
 
@Component
/* loaded from: blade-api.jar:BOOT-INF/classes/org/springblade/modules/notify/manager/DefaultTemplateManager.class */
public class DefaultTemplateManager extends AbstractTemplateManager implements BeanPostProcessor {
    @Autowired
    private INotifyTemplateService templateService;
 
    protected TemplateProperties getProperties(NotifyType type, String id) {
        TemplateProperties result = null;
        NotifyTemplateEntity templateEntity = (NotifyTemplateEntity) this.templateService.getById(id);
        if (Func.isNotEmpty(templateEntity)) {
            result = templateEntity.toTemplateProperties();
        }
        return result;
    }
 
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if (bean instanceof TemplateProvider) {
            register((TemplateProvider) bean);
        }
        return bean;
    }
}