作者 钟来

模块整理

... ... @@ -8,21 +8,21 @@ import java.util.HashMap;
public enum ConfigurationParameter {
ifVeiw(false, Boolean.class,"sys_config","是否显示"),//是否显示
captureNumber(0, Integer.class,"sys_config","摄像头编号"),//摄像头编号
reflectionThreshold(100, Integer.class,"sys_config","反光阈值"),//反光阈值
kernelSize(3, Integer.class,"sys_config","去噪调整内核大小,用来消除小的物体或噪声"),//去噪调整内核大小,用来消除小的物体或噪声
maxValue(255, Integer.class,"sys_config","最大反光阈值"), //最大反光阈值
gear_command (new HashMap<String,String>(),HashMap.class,"gear_command","档位对应的指令"), //档位对应的指令
absValue_command (new ArrayList<FishCurveControlCondition>(),ArrayList.class,"absValue_command","斜率范围对应的档位"), //斜率范围对应的档位
VeiwDto_isFrame(false, Boolean.class,"sys_config","是否显示原图"), //是否显示原图
VeiwDto_isBinaryImage(false, Boolean.class,"sys_config","是否显示临时图"), //是否显示临时图
VeiwDto_isSize(false, Boolean.class,"sys_config","是否显示面积"), //是否显示面积
VeiwDto_isAbsValue(false, Boolean.class,"sys_config","是否显示斜率"), //是否显示斜率
absValue(0.0, Double.class,"sys_config","显示斜率"), //显示斜率
FishGroupImageRecognition(true, Boolean.class,"sys_config","鱼群图像识别是否开启"), //鱼群图像识别是否开启
FeedingControl(true, Boolean.class,"sys_config","鱼群图像识别投料控制是否开启"), //鱼群图像识别投料控制是否开启
SerialPortConfig(new SerialPortConfig().defaultSerialPortConfig(),com.zhonglai.luhui.smart.feeder.dto.SerialPortConfig.class,"sys_config","串口配置"),//串口配置
ifVeiw(false, Boolean.class,"sys_config","是否显示",true),//是否显示
captureNumber(0, Integer.class,"sys_config","摄像头编号",true),//摄像头编号
reflectionThreshold(100, Integer.class,"sys_config","反光阈值",true),//反光阈值
kernelSize(3, Integer.class,"sys_config","去噪调整内核大小,用来消除小的物体或噪声",true),//去噪调整内核大小,用来消除小的物体或噪声
maxValue(255, Integer.class,"sys_config","最大反光阈值",true), //最大反光阈值
gear_command (new HashMap<String,String>(),HashMap.class,"gear_command","档位对应的指令",true), //档位对应的指令
absValue_command (new ArrayList<FishCurveControlCondition>(),ArrayList.class,"absValue_command","斜率范围对应的档位",true), //斜率范围对应的档位
VeiwDto_isFrame(false, Boolean.class,"sys_config","是否显示原图",true), //是否显示原图
VeiwDto_isBinaryImage(false, Boolean.class,"sys_config","是否显示临时图",true), //是否显示临时图
VeiwDto_isSize(false, Boolean.class,"sys_config","是否显示面积",true), //是否显示面积
VeiwDto_isAbsValue(false, Boolean.class,"sys_config","是否显示斜率",true), //是否显示斜率
absValue(0.0, Double.class,"sys_config","显示斜率",false), //斜率
FishGroupImageRecognition(true, Boolean.class,"sys_config","鱼群图像识别是否开启",true), //鱼群图像识别是否开启
FeedingControl(true, Boolean.class,"sys_config","鱼群图像识别投料控制是否开启",true), //鱼群图像识别投料控制是否开启
SerialPortConfig(new SerialPortConfig().defaultSerialPortConfig(),com.zhonglai.luhui.smart.feeder.dto.SerialPortConfig.class,"sys_config","串口配置",true),//串口配置
;
private Object value;
... ... @@ -31,11 +31,14 @@ public enum ConfigurationParameter {
private String describe;
ConfigurationParameter(Object value,Class valuType,String tableName,String describe) {
private Boolean persistence;
ConfigurationParameter(Object value,Class valuType,String tableName,String describe,Boolean persistence) {
this.value = value;
this.valuType = valuType;
this.tableName = tableName;
this.describe = describe;
this.persistence = persistence;
}
public Object getValue()
... ... @@ -55,6 +58,10 @@ public enum ConfigurationParameter {
return describe;
}
public Boolean getPersistence() {
return persistence;
}
public String valueToString(Object o)
{
switch (getValuType().getName()) {
... ...
... ... @@ -101,7 +101,12 @@ public class ConfigurationParameterService {
}
break;
default:
if(configurationParameter.getPersistence())
{
setDefaultCommandMap(configurationParameter,value);
}else{
setNotPersistenceCommandMap(configurationParameter,value);
}
}
... ... @@ -113,6 +118,11 @@ public class ConfigurationParameterService {
return ehCacheService.readFromCache(configurationParameter);
}
private void setNotPersistenceCommandMap(ConfigurationParameter configurationParameter,Object value)
{
ehCacheService.writeToCache(configurationParameter,value);
}
private void setDefaultCommandMap(ConfigurationParameter configurationParameter,Object value)
{
ehCacheService.writeToCache(configurationParameter,value);
... ...