|
@@ -19,8 +19,31 @@ public class RunHaoSfElementUtil {
|
|
|
sfElementMap.put("sfbs", EnumSfElementType.FERTILIZER);
|
|
sfElementMap.put("sfbs", EnumSfElementType.FERTILIZER);
|
|
|
sfElementMap.put("fs", EnumSfElementType.SUCTION);
|
|
sfElementMap.put("fs", EnumSfElementType.SUCTION);
|
|
|
sfElementMap.put("js", EnumSfElementType.MIXING);
|
|
sfElementMap.put("js", EnumSfElementType.MIXING);
|
|
|
-// sfElementMap.put("fa", EnumSfElementType.SOLENOID_VALVE);
|
|
|
|
|
-// sfElementMap.put("qx", EnumSfElementType.GROUP);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ return sfElementMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取灌区类型映射表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static Map<String, EnumSfElementType> getGroupTypeMap() {
|
|
|
|
|
+ Map<String, EnumSfElementType> sfElementMap = new HashMap<>();
|
|
|
|
|
+ sfElementMap.put("qx", EnumSfElementType.GROUP);
|
|
|
|
|
+
|
|
|
|
|
+ return sfElementMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取电磁阀类型映射表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static Map<String, EnumSfElementType> getValveTypeMap() {
|
|
|
|
|
+ Map<String, EnumSfElementType> sfElementMap = new HashMap<>();
|
|
|
|
|
+ sfElementMap.put("fa", EnumSfElementType.SOLENOID_VALVE);
|
|
|
|
|
|
|
|
return sfElementMap;
|
|
return sfElementMap;
|
|
|
}
|
|
}
|
|
@@ -36,13 +59,34 @@ public class RunHaoSfElementUtil {
|
|
|
sfElementMap.put("sfbs", "施肥泵");
|
|
sfElementMap.put("sfbs", "施肥泵");
|
|
|
sfElementMap.put("fs", "肥阀");
|
|
sfElementMap.put("fs", "肥阀");
|
|
|
sfElementMap.put("js", "搅拌电机");
|
|
sfElementMap.put("js", "搅拌电机");
|
|
|
-// sfElementMap.put("fa", "井阀");
|
|
|
|
|
-// sfElementMap.put("qx", "灌区");
|
|
|
|
|
|
|
|
|
|
return sfElementMap;
|
|
return sfElementMap;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
|
+ * 获取灌区名称映射表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static Map<String, String> getGroupNameMap() {
|
|
|
|
|
+ Map<String, String> sfElementMap = new HashMap<>();
|
|
|
|
|
+ sfElementMap.put("qx", "区");
|
|
|
|
|
+ return sfElementMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 获取电磁阀名称映射表
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public static Map<String, String> getValveNameMap() {
|
|
|
|
|
+ Map<String, String> sfElementMap = new HashMap<>();
|
|
|
|
|
+ sfElementMap.put("fa", "井阀");
|
|
|
|
|
+ return sfElementMap;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
* 根据键名获取泵类设备IotSfElementfactor对象
|
|
* 根据键名获取泵类设备IotSfElementfactor对象
|
|
|
*
|
|
*
|
|
|
* @param key 设备元素因子的键名
|
|
* @param key 设备元素因子的键名
|
|
@@ -77,22 +121,73 @@ public class RunHaoSfElementUtil {
|
|
|
return sfElementfactor;
|
|
return sfElementfactor;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// /**
|
|
|
|
|
-// * 根据给定的键获取相应的IotSfElementfactor对象
|
|
|
|
|
-// *
|
|
|
|
|
-// * @param key 键值
|
|
|
|
|
-// * @return 返回对应的IotSfElementfactor对象,若键不符合规范则返回null
|
|
|
|
|
-// */
|
|
|
|
|
-// public static IotSfElementfactor getSfElementfactor(String key) {
|
|
|
|
|
-// String[] temp = key.split("-");
|
|
|
|
|
-// if(temp.length != 2){
|
|
|
|
|
-// return null;
|
|
|
|
|
-// }
|
|
|
|
|
-// IotSfElementfactor iotSfElementfactor = null;
|
|
|
|
|
-// String prefix = temp[0];
|
|
|
|
|
-// if("Btn".equals(prefix)){
|
|
|
|
|
-// iotSfElementfactor = getBtnElementfactor(key);
|
|
|
|
|
-// }
|
|
|
|
|
-// return iotSfElementfactor;
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据键名获取电磁阀类设备IotSfElementfactor对象
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param key 设备元素因子的键名
|
|
|
|
|
+ * @return 设备元素因子对象,如果无法解析则返回null
|
|
|
|
|
+ */
|
|
|
|
|
+ public static IotSfElementfactor getValveElementFactor(String key) {
|
|
|
|
|
+ String[] temp = key.split("-");
|
|
|
|
|
+ String suffix = temp[1];
|
|
|
|
|
+
|
|
|
|
|
+ IotSfElementfactor sfElementfactor = new IotSfElementfactor();
|
|
|
|
|
+ String sfName = null;
|
|
|
|
|
+ EnumSfElementType elementType = null;
|
|
|
|
|
+ Map<String, String> sfNameMap = getValveNameMap();
|
|
|
|
|
+ Map<String, EnumSfElementType> sfTypeMap = getValveTypeMap();
|
|
|
|
|
+
|
|
|
|
|
+ for(Map.Entry<String, String> entry : sfNameMap.entrySet()){
|
|
|
|
|
+ String sfKey = entry.getKey();
|
|
|
|
|
+ if(suffix.startsWith(sfKey)){
|
|
|
|
|
+ sfName = entry.getValue() + suffix.replace(sfKey, "");
|
|
|
|
|
+ elementType = sfTypeMap.get(sfKey);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(elementType == null){
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ sfElementfactor.setSfType(elementType.getCode());
|
|
|
|
|
+ sfElementfactor.setSfName(elementType.getName());
|
|
|
|
|
+ sfElementfactor.setSfDisplayname(sfName);
|
|
|
|
|
+ sfElementfactor.setSfCode(key);
|
|
|
|
|
+
|
|
|
|
|
+ return sfElementfactor;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 根据键名获取泵类设备IotSfElementfactor对象
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param key 设备元素因子的键名
|
|
|
|
|
+ * @return 设备元素因子对象,如果无法解析则返回null
|
|
|
|
|
+ */
|
|
|
|
|
+ public static IotSfElementfactor getGroupElementFactor(String key) {
|
|
|
|
|
+ String[] temp = key.split("-");
|
|
|
|
|
+ String suffix = temp[1];
|
|
|
|
|
+
|
|
|
|
|
+ IotSfElementfactor sfElementfactor = new IotSfElementfactor();
|
|
|
|
|
+ String sfName = null;
|
|
|
|
|
+ EnumSfElementType elementType = null;
|
|
|
|
|
+ Map<String, String> sfNameMap = getGroupNameMap();
|
|
|
|
|
+ Map<String, EnumSfElementType> sfTypeMap = getGroupTypeMap();
|
|
|
|
|
+
|
|
|
|
|
+ for(Map.Entry<String, String> entry : sfNameMap.entrySet()){
|
|
|
|
|
+ String sfKey = entry.getKey();
|
|
|
|
|
+ if(suffix.startsWith(sfKey)){
|
|
|
|
|
+ sfName = suffix.replace(sfKey, "") + entry.getValue();
|
|
|
|
|
+ elementType = sfTypeMap.get(sfKey);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ if(elementType == null){
|
|
|
|
|
+ return null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ sfElementfactor.setSfType(elementType.getCode());
|
|
|
|
|
+ sfElementfactor.setSfName(elementType.getName());
|
|
|
|
|
+ sfElementfactor.setSfDisplayname(sfName);
|
|
|
|
|
+ sfElementfactor.setSfCode(key);
|
|
|
|
|
+
|
|
|
|
|
+ return sfElementfactor;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|