#
tqs
2023-12-05 a0b733a8b19b1db43395a96408098596ac3d2a86
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
81
82
83
84
85
86
87
88
89
90
91
92
93
package zy.cloud.wms.common.entity;
 
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import zy.cloud.wms.system.entity.Config;
import zy.cloud.wms.system.service.ConfigService;
import com.core.common.Cools;
import com.core.common.SpringUtils;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * 基础配置中心。可通过刷新指定接口刷新相关配置
 */
public class Parameter {
 
    private volatile static Parameter instance = null;
 
    private Parameter(){
    }
 
    public static Parameter get(){
        if (instance == null){
            synchronized (Parameter.class){
                instance = reset();
                return instance;
            }
        }
        return instance;
    }
 
    /**
     * 重置
     */
    public static Parameter reset() {
        ConfigService configService = SpringUtils.getBean(ConfigService.class);
        List<Config> configs = configService.selectList(new EntityWrapper<Config>().eq("status", "1"));
        Map<String, Object> data = new HashMap<>();
        for (Config config : configs) {
            if (config.getType() == 1) {
                data.put(config.getCode(), String.valueOf(config.getValue()));
            } else {
                data.put(config.getCode(), JSON.parse(config.getValue()));
            }
        }
        instance = Cools.conver(data, Parameter.class);
        return instance;
    }
 
    // 验证码开关
    private String codeSwitch;
 
    public String getCodeSwitch() {
        return codeSwitch;
    }
 
    public void setCodeSwitch(String codeSwitch) {
        this.codeSwitch = codeSwitch;
    }
 
        // 周计划周天分割规则  0: 全天    1:分上下午
    private Integer weekPlanDayRule;
 
    public Integer getWeekPlanDayRule() {
        return weekPlanDayRule;
    }
 
    public void setWeekPlanDayRule(Integer weekPlanDayRule) {
        this.weekPlanDayRule = weekPlanDayRule;
    }
 
    private String uniNode;
 
    public String getUniNode() {
        return uniNode;
    }
 
    public void setUniNode(String uniNode) {
        this.uniNode = uniNode;
    }
 
    private String syncSwitch;
 
    public String getSyncSwitch() {
        return syncSwitch;
    }
 
    public void setSyncSwitch(String syncSwitch) {
        this.syncSwitch = syncSwitch;
    }
}