| | |
| | | package com.zy.asrs.common.domain.entity; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.common.sys.entity.Config; |
| | | import com.zy.asrs.common.sys.service.ConfigService; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.framework.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.list(new LambdaQueryWrapper<Config>().eq(Config::getStatus, "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; |
| | | |
| | | } |
| | | package com.zy.asrs.common.domain.entity;
|
| | |
|
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.zy.asrs.common.sys.entity.Config;
|
| | | import com.zy.asrs.common.sys.service.ConfigService;
|
| | | import com.zy.asrs.framework.common.Cools;
|
| | | import com.zy.asrs.framework.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.list(new LambdaQueryWrapper<Config>().eq(Config::getStatus, "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;
|
| | |
|
| | | }
|