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;
|
}
|
}
|