干燥机配套车间生产管理系统/云平台服务端
baoshiwei
2023-03-10 58d42ccf875b120f40fddce63752298e916e0b0b
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package org.jeecg.config.thirdapp;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
 
/**
 * 第三方App对接配置
 * @author: jeecg-boot
 */
@Configuration
public class ThirdAppConfig {
 
    /**
     * 钉钉
     */
    public final static String DINGTALK = "DINGTALK";
    /**
     * 企业微信
     */
    public final static String WECHAT_ENTERPRISE = "WECHAT_ENTERPRISE";
 
    /**
     * 是否启用 第三方App对接
     */
    @Value("${third-app.enabled:false}")
    private boolean enabled;
 
    /**
     * 系统类型,目前支持:WECHAT_ENTERPRISE(企业微信);DINGTALK (钉钉)
     */
    @Autowired
    private ThirdAppTypeConfig type;
 
    public boolean isEnabled() {
        return enabled;
    }
 
    public ThirdAppConfig setEnabled(boolean enabled) {
        this.enabled = enabled;
        return this;
    }
 
    /**
     * 获取企业微信配置
     */
    public ThirdAppTypeItemVo getWechatEnterprise() {
        return this.type.getWECHAT_ENTERPRISE();
    }
 
    /**
     * 获取钉钉配置
     */
    public ThirdAppTypeItemVo getDingtalk() {
        return this.type.getDINGTALK();
    }
 
    /**
     * 获取企业微信是否启用
     */
    public boolean isWechatEnterpriseEnabled() {
        try {
            return this.enabled && this.getWechatEnterprise().isEnabled();
        } catch (Exception e) {
            return false;
        }
    }
 
    /**
     * 获取钉钉是否启用
     */
    public boolean isDingtalkEnabled() {
        try {
            return this.enabled && this.getDingtalk().isEnabled();
        } catch (Exception e) {
            return false;
        }
    }
 
}