作者 钟来

模块整理

@@ -8,21 +8,21 @@ import java.util.HashMap; @@ -8,21 +8,21 @@ import java.util.HashMap;
8 8
9 9
10 public enum ConfigurationParameter { 10 public enum ConfigurationParameter {
11 - ifVeiw(false, Boolean.class,"sys_config","是否显示"),//是否显示  
12 - captureNumber(0, Integer.class,"sys_config","摄像头编号"),//摄像头编号  
13 - reflectionThreshold(100, Integer.class,"sys_config","反光阈值"),//反光阈值  
14 - kernelSize(3, Integer.class,"sys_config","去噪调整内核大小,用来消除小的物体或噪声"),//去噪调整内核大小,用来消除小的物体或噪声  
15 - maxValue(255, Integer.class,"sys_config","最大反光阈值"), //最大反光阈值  
16 - gear_command (new HashMap<String,String>(),HashMap.class,"gear_command","档位对应的指令"), //档位对应的指令  
17 - absValue_command (new ArrayList<FishCurveControlCondition>(),ArrayList.class,"absValue_command","斜率范围对应的档位"), //斜率范围对应的档位  
18 - VeiwDto_isFrame(false, Boolean.class,"sys_config","是否显示原图"), //是否显示原图  
19 - VeiwDto_isBinaryImage(false, Boolean.class,"sys_config","是否显示临时图"), //是否显示临时图  
20 - VeiwDto_isSize(false, Boolean.class,"sys_config","是否显示面积"), //是否显示面积  
21 - VeiwDto_isAbsValue(false, Boolean.class,"sys_config","是否显示斜率"), //是否显示斜率  
22 - absValue(0.0, Double.class,"sys_config","显示斜率"), //显示斜率  
23 - FishGroupImageRecognition(true, Boolean.class,"sys_config","鱼群图像识别是否开启"), //鱼群图像识别是否开启  
24 - FeedingControl(true, Boolean.class,"sys_config","鱼群图像识别投料控制是否开启"), //鱼群图像识别投料控制是否开启  
25 - SerialPortConfig(new SerialPortConfig().defaultSerialPortConfig(),com.zhonglai.luhui.smart.feeder.dto.SerialPortConfig.class,"sys_config","串口配置"),//串口配置 11 + ifVeiw(false, Boolean.class,"sys_config","是否显示",true),//是否显示
  12 + captureNumber(0, Integer.class,"sys_config","摄像头编号",true),//摄像头编号
  13 + reflectionThreshold(100, Integer.class,"sys_config","反光阈值",true),//反光阈值
  14 + kernelSize(3, Integer.class,"sys_config","去噪调整内核大小,用来消除小的物体或噪声",true),//去噪调整内核大小,用来消除小的物体或噪声
  15 + maxValue(255, Integer.class,"sys_config","最大反光阈值",true), //最大反光阈值
  16 + gear_command (new HashMap<String,String>(),HashMap.class,"gear_command","档位对应的指令",true), //档位对应的指令
  17 + absValue_command (new ArrayList<FishCurveControlCondition>(),ArrayList.class,"absValue_command","斜率范围对应的档位",true), //斜率范围对应的档位
  18 + VeiwDto_isFrame(false, Boolean.class,"sys_config","是否显示原图",true), //是否显示原图
  19 + VeiwDto_isBinaryImage(false, Boolean.class,"sys_config","是否显示临时图",true), //是否显示临时图
  20 + VeiwDto_isSize(false, Boolean.class,"sys_config","是否显示面积",true), //是否显示面积
  21 + VeiwDto_isAbsValue(false, Boolean.class,"sys_config","是否显示斜率",true), //是否显示斜率
  22 + absValue(0.0, Double.class,"sys_config","显示斜率",false), //斜率
  23 + FishGroupImageRecognition(true, Boolean.class,"sys_config","鱼群图像识别是否开启",true), //鱼群图像识别是否开启
  24 + FeedingControl(true, Boolean.class,"sys_config","鱼群图像识别投料控制是否开启",true), //鱼群图像识别投料控制是否开启
  25 + SerialPortConfig(new SerialPortConfig().defaultSerialPortConfig(),com.zhonglai.luhui.smart.feeder.dto.SerialPortConfig.class,"sys_config","串口配置",true),//串口配置
26 ; 26 ;
27 27
28 private Object value; 28 private Object value;
@@ -31,11 +31,14 @@ public enum ConfigurationParameter { @@ -31,11 +31,14 @@ public enum ConfigurationParameter {
31 31
32 private String describe; 32 private String describe;
33 33
34 - ConfigurationParameter(Object value,Class valuType,String tableName,String describe) { 34 + private Boolean persistence;
  35 +
  36 + ConfigurationParameter(Object value,Class valuType,String tableName,String describe,Boolean persistence) {
35 this.value = value; 37 this.value = value;
36 this.valuType = valuType; 38 this.valuType = valuType;
37 this.tableName = tableName; 39 this.tableName = tableName;
38 this.describe = describe; 40 this.describe = describe;
  41 + this.persistence = persistence;
39 } 42 }
40 43
41 public Object getValue() 44 public Object getValue()
@@ -55,6 +58,10 @@ public enum ConfigurationParameter { @@ -55,6 +58,10 @@ public enum ConfigurationParameter {
55 return describe; 58 return describe;
56 } 59 }
57 60
  61 + public Boolean getPersistence() {
  62 + return persistence;
  63 + }
  64 +
58 public String valueToString(Object o) 65 public String valueToString(Object o)
59 { 66 {
60 switch (getValuType().getName()) { 67 switch (getValuType().getName()) {
@@ -101,7 +101,12 @@ public class ConfigurationParameterService { @@ -101,7 +101,12 @@ public class ConfigurationParameterService {
101 } 101 }
102 break; 102 break;
103 default: 103 default:
104 - setDefaultCommandMap(configurationParameter,value); 104 + if(configurationParameter.getPersistence())
  105 + {
  106 + setDefaultCommandMap(configurationParameter,value);
  107 + }else{
  108 + setNotPersistenceCommandMap(configurationParameter,value);
  109 + }
105 110
106 } 111 }
107 112
@@ -113,6 +118,11 @@ public class ConfigurationParameterService { @@ -113,6 +118,11 @@ public class ConfigurationParameterService {
113 return ehCacheService.readFromCache(configurationParameter); 118 return ehCacheService.readFromCache(configurationParameter);
114 } 119 }
115 120
  121 + private void setNotPersistenceCommandMap(ConfigurationParameter configurationParameter,Object value)
  122 + {
  123 + ehCacheService.writeToCache(configurationParameter,value);
  124 + }
  125 +
116 private void setDefaultCommandMap(ConfigurationParameter configurationParameter,Object value) 126 private void setDefaultCommandMap(ConfigurationParameter configurationParameter,Object value)
117 { 127 {
118 ehCacheService.writeToCache(configurationParameter,value); 128 ehCacheService.writeToCache(configurationParameter,value);