自动化立体仓库 - WMS系统
qw
zc
7 天以前 55773cf8183b9ddb45a4321de3468d727cea88fd
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
package com.zy.common.entity;
 
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.zy.system.entity.Config;
import com.zy.system.service.ConfigService;
import com.core.common.Cools;
import com.core.common.SpringUtils;
import lombok.Data;
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
/**
 * 基础配置中心。可通过刷新指定接口刷新相关配置
 */
@Data
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;
 
    // 库位初始化口令
    private String locMastInitPwd;
 
    // 打包下线
    private String packDown;
 
    // erp上报
    private String erpReport;
 
}