Browse Source

引擎部分拆分到sailfish

menglu 3 years ago
parent
commit
07978b9dd9
69 changed files with 486 additions and 15033 deletions
  1. 5 0
      ibms-data-sdk/pom.xml
  2. 0 9
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/CriteriaBase.java
  3. 0 31
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/CriteriaDefault.java
  4. 0 22
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Criteria_and.java
  5. 0 19
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Criteria_not.java
  6. 0 22
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Criteria_or.java
  7. 0 7
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/MatchBase.java
  8. 0 98
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/MatchUtil.java
  9. 0 43
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_contain.java
  10. 0 49
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_e.java
  11. 0 49
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_gt.java
  12. 0 49
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_gte.java
  13. 0 36
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_in.java
  14. 0 49
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_lt.java
  15. 0 49
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_lte.java
  16. 0 49
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_ne.java
  17. 0 36
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_notin.java
  18. 0 47
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_regex.java
  19. 0 43
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_startwith.java
  20. 0 14
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/Change.java
  21. 0 169
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneDataObject.java
  22. 0 19
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneDataPrimitive.java
  23. 0 72
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneDataSet.java
  24. 0 98
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneDataValue.java
  25. 0 13
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneObject.java
  26. 0 129
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneProperty.java
  27. 6 6
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/AlarmDurationThread.java
  28. 12 9
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/DaemonThread.java
  29. 12 11
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/RefreshThread.java
  30. 3 3
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/WebSocketCheckThread.java
  31. 5 4
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestApi.java
  32. 33 205
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestUtil.java
  33. 0 324
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/CheckUtil.java
  34. 0 133
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/CompareUtil.java
  35. 0 626
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ComputeUtil.java
  36. 2 2
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/Constant.java
  37. 12 11
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ControlUtil.java
  38. 0 86
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/DataUtil.java
  39. 11 8
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/DeamonUtil.java
  40. 107 0
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/DrawUtil.java
  41. 0 308
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/FastJsonCompareUtil.java
  42. 0 94
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/FastJsonReaderUtil.java
  43. 0 595
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/FastJsonUtil.java
  44. 4 1
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/FileUtil.java
  45. 0 9
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/IntWrapper.java
  46. 0 205
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/LogUtil.java
  47. 0 6
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/QueryAssist.java
  48. 0 1330
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/QueryUtil.java
  49. 21 20
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDAlarmUtil.java
  50. 17 13
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDDownloadUtil.java
  51. 24 37
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDLoadUtil.java
  52. 66 0
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDRepositoryUtil.java
  53. 0 124
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDUtil.java
  54. 0 492
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RecursiveUtil.java
  55. 0 67
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/Repository.java
  56. 0 38
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RepositoryBase.java
  57. 6 0
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RepositoryContainer.java
  58. 94 0
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RepositoryImpl.java
  59. 36 0
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RepositoryProject.java
  60. 0 80
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/SceneDataValueComparator.java
  61. 10 10
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/websocket/IOTWebSocketClient.java
  62. 0 71
      ibms-data-sdk/src/main/java/com/sagacloud/ExpressionUtil.java
  63. 0 2433
      ibms-data-sdk/src/main/java/com/sagacloud/advanced/expression/AdvancedExpressionLexer.java
  64. 0 2861
      ibms-data-sdk/src/main/java/com/sagacloud/advanced/expression/AdvancedExpressionParser.java
  65. 0 1578
      ibms-data-sdk/src/main/java/com/sagacloud/advanced/expression/AdvancedExpressionScanner.java
  66. 0 1702
      ibms-data-sdk/src/main/java/com/sagacloud/advanced/expression/AdvancedExpressionWalker.java
  67. 0 82
      ibms-data-sdk/src/main/java/com/sagacloud/util/math/FunctionUtil.java
  68. 0 56
      ibms-data-sdk/src/main/java/com/sagacloud/util/math/ValueObject.java
  69. 0 172
      ibms-data-sdk/src/main/java/com/sagacloud/util/math/ValueObjectUtil.java

+ 5 - 0
ibms-data-sdk/pom.xml

@@ -208,6 +208,11 @@
 			<scope>test</scope>
 		</dependency>
 
+		<dependency>
+			<groupId>com.persagy</groupId>
+			<artifactId>sailfish</artifactId>
+			<version>0.0.1</version>
+		</dependency>
 	</dependencies>
 
 	<build>

+ 0 - 9
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/CriteriaBase.java

@@ -1,9 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-
-public abstract class CriteriaBase {
-	public String type;// default and or not
-
-	public abstract boolean match(SceneDataObject item);
-}

+ 0 - 31
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/CriteriaDefault.java

@@ -1,31 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-
-public class CriteriaDefault extends CriteriaBase {
-	public Map<String, List<MatchBase>> column2MatchList = new HashMap<String, List<MatchBase>>();
-
-	public CriteriaDefault() {
-		this.type = "default";
-	}
-
-	public boolean match(SceneDataObject item) {
-		for (String column : column2MatchList.keySet()) {
-			List<MatchBase> matchList = column2MatchList.get(column);
-			Object itemValue = null;
-			if (item.containsKey(column)) {
-				itemValue = item.get(column).value_prim.value;
-			}
-			for (MatchBase match : matchList) {
-				if (!match.match(itemValue)) {
-					return false;
-				}
-			}
-		}
-		return true;
-	}
-}

+ 0 - 22
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Criteria_and.java

@@ -1,22 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import java.util.List;
-
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-
-public class Criteria_and extends CriteriaBase {
-	public List<CriteriaBase> criteriaList;
-
-	public Criteria_and() {
-		this.type = "and";
-	}
-
-	public boolean match(SceneDataObject item) {
-		for (CriteriaBase criteria : this.criteriaList) {
-			if (!criteria.match(item)) {
-				return false;
-			}
-		}
-		return true;
-	}
-}

+ 0 - 19
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Criteria_not.java

@@ -1,19 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-
-public class Criteria_not extends CriteriaBase {
-	public CriteriaBase criteria;
-
-	public Criteria_not() {
-		this.type = "not";
-	}
-
-	public boolean match(SceneDataObject item) {
-		if (criteria.match(item)) {
-			return false;
-		} else {
-			return true;
-		}
-	}
-}

+ 0 - 22
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Criteria_or.java

@@ -1,22 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import java.util.List;
-
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-
-public class Criteria_or extends CriteriaBase {
-	public List<CriteriaBase> criteriaList;
-
-	public Criteria_or() {
-		this.type = "or";
-	}
-
-	public boolean match(SceneDataObject item) {
-		for (CriteriaBase criteria : this.criteriaList) {
-			if (criteria.match(item)) {
-				return true;
-			}
-		}
-		return false;
-	}
-}

+ 0 - 7
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/MatchBase.java

@@ -1,7 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-public abstract class MatchBase {
-	public abstract boolean match(Object item);
-
-	public abstract boolean change();
-}

+ 0 - 98
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/MatchUtil.java

@@ -1,98 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-public class MatchUtil {
-	public static boolean match(String fuhao, Object objValue1, Object objValue2) {
-		int compareRsult;
-		if (objValue1 instanceof String && objValue2 instanceof String) {
-			String value1 = (String) objValue1;
-			String value2 = (String) objValue2;
-			compareRsult = value1.compareTo(value2);
-		} else if ((objValue1 instanceof Boolean || objValue1 instanceof String) && (objValue2 instanceof Boolean || objValue2 instanceof String)) {
-			Boolean value1 = objValue1 instanceof Boolean ? (Boolean) objValue1 : Boolean.parseBoolean((String) objValue1);
-			Boolean value2 = objValue2 instanceof Boolean ? (Boolean) objValue2 : Boolean.parseBoolean((String) objValue2);
-			compareRsult = value1.compareTo(value2);
-			compareRsult = value1.compareTo(value2);
-		} else if ((objValue1 instanceof Integer || objValue1 instanceof Long || objValue1 instanceof BigInteger || objValue1 instanceof Float
-				|| objValue1 instanceof Double || objValue1 instanceof BigDecimal || objValue1 instanceof String)
-				&& (objValue2 instanceof Integer || objValue2 instanceof Long || objValue2 instanceof BigInteger || objValue2 instanceof Float
-						|| objValue2 instanceof Double || objValue2 instanceof BigDecimal || objValue2 instanceof String)) {
-			Object noString1 = objValue1;
-			if (objValue1 instanceof String) {
-				try {
-					noString1 = Long.parseLong((String) objValue1);
-				} catch (NumberFormatException e) {
-					try {
-						noString1 = Double.parseDouble((String) objValue1);
-					} catch (NumberFormatException e1) {
-						// throw e1;
-						return false;
-					}
-				}
-			}
-			Object noString2 = objValue2;
-			if (objValue2 instanceof String) {
-				try {
-					noString2 = Long.parseLong((String) objValue2);
-				} catch (NumberFormatException e) {
-					try {
-						noString2 = Double.parseDouble((String) objValue2);
-					} catch (NumberFormatException e2) {
-						// throw e2;
-						return false;
-					}
-				}
-			}
-			if ((noString1 instanceof Float || noString1 instanceof Double || noString1 instanceof BigDecimal)
-					|| (noString2 instanceof Float || noString2 instanceof Double || noString2 instanceof BigDecimal)) {
-				if (noString1 instanceof Float || noString1 instanceof Double || noString1 instanceof BigDecimal) {
-					if (noString2 instanceof Float || noString2 instanceof Double || noString2 instanceof BigDecimal) {
-						Double value1 = noString1 instanceof Float ? (float) noString1
-								: (noString1 instanceof Double ? (double) noString1 : ((BigDecimal) noString1).doubleValue());
-						Double value2 = noString2 instanceof Float ? (float) noString2
-								: (noString2 instanceof Double ? (double) noString2 : ((BigDecimal) noString2).doubleValue());
-						compareRsult = value1.compareTo(value2);
-					} else {
-						Double value1 = noString1 instanceof Float ? (float) noString1
-								: (noString1 instanceof Double ? (double) noString1 : ((BigDecimal) noString1).doubleValue());
-						Long value2 = noString2 instanceof Integer ? (int) noString2
-								: (noString2 instanceof Long ? (long) noString2 : ((BigInteger) noString2).longValue());
-						compareRsult = value1.compareTo(value2.doubleValue());
-					}
-				} else {
-					Long value1 = noString1 instanceof Integer ? (int) noString1
-							: (noString1 instanceof Long ? (long) noString1 : ((BigInteger) noString1).longValue());
-					Double value2 = noString2 instanceof Float ? (float) noString2
-							: (noString2 instanceof Double ? (double) noString2 : ((BigDecimal) noString2).doubleValue());
-					compareRsult = 0 - value2.compareTo(value1.doubleValue());
-				}
-			} else {
-				Long value1 = noString1 instanceof Integer ? (int) noString1
-						: (noString1 instanceof Long ? (long) noString1 : ((BigInteger) noString1).longValue());
-				Long value2 = noString2 instanceof Integer ? (int) noString2
-						: (noString2 instanceof Long ? (long) noString2 : ((BigInteger) noString2).longValue());
-				compareRsult = value1.compareTo(value2);
-			}
-		} else {
-			return false;
-		}
-
-		if (fuhao.equals("gt")) {
-			return compareRsult >= 1;
-		} else if (fuhao.equals("gte")) {
-			return compareRsult >= 0;
-		} else if (fuhao.equals("lt")) {
-			return compareRsult < 0;
-		} else if (fuhao.equals("lte")) {
-			return compareRsult <= 0;
-		} else if (fuhao.equals("e")) {
-			return compareRsult == 0;
-		} else if (fuhao.equals("ne")) {
-			return compareRsult != 0;
-		} else {
-			return false;
-		}
-	}
-}

+ 0 - 43
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_contain.java

@@ -1,43 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import com.alibaba.fastjson.JSONObject;
-
-public class Match_contain extends MatchBase {
-	public boolean pass;
-	public String value;
-	private boolean change = false;
-
-	public Match_contain(Object value, boolean change) {
-		if (value instanceof JSONObject) {
-			JSONObject valueObject = (JSONObject) value;
-			if (valueObject.containsKey("pass")) {
-				this.pass = true;
-				return;
-			}
-		}
-
-		this.value = (String) value;
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		String itemValue = null;
-		if (item != null) {
-			itemValue = (String) (item);
-		}
-
-		if (itemValue == null) {
-			return false;
-		}
-
-		return itemValue.toLowerCase().contains(this.value.toLowerCase());
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 49
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_e.java

@@ -1,49 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import com.alibaba.fastjson.JSONObject;
-
-public class Match_e extends MatchBase {
-	public boolean pass;
-	public Object value;
-	private boolean change = false;
-
-	public Match_e(Object value, boolean change) {
-		if (value instanceof JSONObject) {
-			JSONObject valueObject = (JSONObject) value;
-			if (valueObject.containsKey("pass")) {
-				this.pass = true;
-				return;
-			}
-		}
-
-		this.value = value;
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		Object itemValue = null;
-		if (item != null) {
-			itemValue = (item);
-		}
-
-		if (itemValue == null && value == null) {
-			return true;
-		}
-		if (itemValue == null && value != null) {
-			return false;
-		}
-		if (itemValue != null && value == null) {
-			return false;
-		}
-
-		return MatchUtil.match("e", itemValue, value);
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 49
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_gt.java

@@ -1,49 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import com.alibaba.fastjson.JSONObject;
-
-public class Match_gt extends MatchBase {
-	public boolean pass;
-	public Object value;
-	private boolean change = false;
-
-	public Match_gt(Object value, boolean change) {
-		if (value instanceof JSONObject) {
-			JSONObject valueObject = (JSONObject) value;
-			if (valueObject.containsKey("pass")) {
-				this.pass = true;
-				return;
-			}
-		}
-
-		this.value = value;
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		Object itemValue = null;
-		if (item != null) {
-			itemValue = (item);
-		}
-
-		if (itemValue == null && value == null) {
-			return false;
-		}
-		if (itemValue == null && value != null) {
-			return false;
-		}
-		if (itemValue != null && value == null) {
-			return true;
-		}
-
-		return MatchUtil.match("gt", itemValue, value);
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 49
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_gte.java

@@ -1,49 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import com.alibaba.fastjson.JSONObject;
-
-public class Match_gte extends MatchBase {
-	public boolean pass;
-	public Object value;
-	private boolean change = false;
-
-	public Match_gte(Object value, boolean change) {
-		if (value instanceof JSONObject) {
-			JSONObject valueObject = (JSONObject) value;
-			if (valueObject.containsKey("pass")) {
-				this.pass = true;
-				return;
-			}
-		}
-
-		this.value = value;
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		Object itemValue = null;
-		if (item != null) {
-			itemValue = (item);
-		}
-
-		if (itemValue == null && value == null) {
-			return true;
-		}
-		if (itemValue == null && value != null) {
-			return false;
-		}
-		if (itemValue != null && value == null) {
-			return true;
-		}
-
-		return MatchUtil.match("gte", itemValue, value);
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 36
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_in.java

@@ -1,36 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import java.util.HashSet;
-
-public class Match_in extends MatchBase {
-	public boolean pass;
-	public HashSet<Object> value;
-	private boolean change = false;
-
-	public Match_in(HashSet<Object> value, boolean change) {
-		this.value = value;
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		Object itemValue = null;
-		if (item != null) {
-			itemValue = (item);
-		}
-
-		for (Object value2 : value) {
-			if (MatchUtil.match("e", itemValue, value2)) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 49
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_lt.java

@@ -1,49 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import com.alibaba.fastjson.JSONObject;
-
-public class Match_lt extends MatchBase {
-	public boolean pass;
-	public Object value;
-	private boolean change = false;
-
-	public Match_lt(Object value, boolean change) {
-		if (value instanceof JSONObject) {
-			JSONObject valueObject = (JSONObject) value;
-			if (valueObject.containsKey("pass")) {
-				this.pass = true;
-				return;
-			}
-		}
-
-		this.value = value;
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		Object itemValue = null;
-		if (item != null) {
-			itemValue = (item);
-		}
-
-		if (itemValue == null && value == null) {
-			return false;
-		}
-		if (itemValue == null && value != null) {
-			return true;
-		}
-		if (itemValue != null && value == null) {
-			return false;
-		}
-
-		return MatchUtil.match("lt", itemValue, value);
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 49
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_lte.java

@@ -1,49 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import com.alibaba.fastjson.JSONObject;
-
-public class Match_lte extends MatchBase {
-	public boolean pass;
-	public Object value;
-	private boolean change = false;
-
-	public Match_lte(Object value, boolean change) {
-		if (value instanceof JSONObject) {
-			JSONObject valueObject = (JSONObject) value;
-			if (valueObject.containsKey("pass")) {
-				this.pass = true;
-				return;
-			}
-		}
-
-		this.value = value;
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		Object itemValue = null;
-		if (item != null) {
-			itemValue = (item);
-		}
-
-		if (itemValue == null && value == null) {
-			return true;
-		}
-		if (itemValue == null && value != null) {
-			return true;
-		}
-		if (itemValue != null && value == null) {
-			return false;
-		}
-
-		return MatchUtil.match("lte", itemValue, value);
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 49
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_ne.java

@@ -1,49 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import com.alibaba.fastjson.JSONObject;
-
-public class Match_ne extends MatchBase {
-	public boolean pass;
-	public Object value;
-	private boolean change = false;
-
-	public Match_ne(Object value, boolean change) {
-		if (value instanceof JSONObject) {
-			JSONObject valueObject = (JSONObject) value;
-			if (valueObject.containsKey("pass")) {
-				this.pass = true;
-				return;
-			}
-		}
-
-		this.value = value;
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		Object itemValue = null;
-		if (item != null) {
-			itemValue = (item);
-		}
-
-		if (itemValue == null && value == null) {
-			return false;
-		}
-		if (itemValue == null && value != null) {
-			return false;
-		}
-		if (itemValue != null && value == null) {
-			return true;
-		}
-
-		return MatchUtil.match("ne", itemValue, value);
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 36
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_notin.java

@@ -1,36 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import java.util.HashSet;
-
-public class Match_notin extends MatchBase {
-	public boolean pass;
-	public HashSet<Object> value;
-	private boolean change = false;
-
-	public Match_notin(HashSet<Object> value, boolean change) {
-		this.value = value;
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		Object itemValue = null;
-		if (item != null) {
-			itemValue = (item);
-		}
-
-		for (Object value2 : value) {
-			if (MatchUtil.match("e", itemValue, value2)) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 47
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_regex.java

@@ -1,47 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import java.util.regex.Pattern;
-
-import com.alibaba.fastjson.JSONObject;
-
-public class Match_regex extends MatchBase {
-	public boolean pass;
-	public Object value;
-	Pattern regex;
-	private boolean change = false;
-
-	public Match_regex(Object value, boolean change) {
-		if (value instanceof JSONObject) {
-			JSONObject valueObject = (JSONObject) value;
-			if (valueObject.containsKey("pass")) {
-				this.pass = true;
-				return;
-			}
-		}
-
-		this.value = value;
-		regex = Pattern.compile(this.value.toString());
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		Object itemValue = null;
-		if (item != null) {
-			itemValue = (item);
-		}
-
-		if (itemValue == null) {
-			return false;
-		}
-
-		return regex.matcher(itemValue.toString()).matches();
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 43
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/criteria/Match_startwith.java

@@ -1,43 +0,0 @@
-package com.persagy.ibms.data.sdk.criteria;
-
-import com.alibaba.fastjson.JSONObject;
-
-public class Match_startwith extends MatchBase {
-	public boolean pass;
-	public String value;
-	private boolean change = false;
-
-	public Match_startwith(Object value, boolean change) {
-		if (value instanceof JSONObject) {
-			JSONObject valueObject = (JSONObject) value;
-			if (valueObject.containsKey("pass")) {
-				this.pass = true;
-				return;
-			}
-		}
-
-		this.value = (String) value;
-		this.change = change;
-	}
-
-	public boolean match(Object item) {
-		if (this.pass) {
-			return true;
-		}
-
-		String itemValue = null;
-		if (item != null) {
-			itemValue = (String) (item);
-		}
-
-		if (itemValue == null) {
-			return false;
-		}
-
-		return itemValue.toLowerCase().startsWith(this.value.toLowerCase());
-	}
-
-	public boolean change() {
-		return this.change;
-	}
-}

+ 0 - 14
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/Change.java

@@ -1,14 +0,0 @@
-package com.persagy.ibms.data.sdk.data;
-
-import java.util.HashMap;
-import java.util.Map;
-
-public class Change {
-	public boolean row_change = false;
-	public Map<String, Boolean> colChangeMap = new HashMap<String, Boolean>();
-
-	@Override
-	public String toString() {
-		return "" + row_change + "\t" + colChangeMap;
-	}
-}

+ 0 - 169
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneDataObject.java

@@ -1,169 +0,0 @@
-package com.persagy.ibms.data.sdk.data;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.persagy.ibms.data.sdk.util.Constant;
-import com.persagy.ibms.data.sdk.util.Repository;
-
-public class SceneDataObject {
-	public SceneDataObject parentObjectData;
-	public String myPropertyName;
-	public SceneDataValue parentArrayData;
-
-	public SceneObject rel_object;
-	public SceneProperty[] query_attached;
-
-	public Map<String, SceneDataValue> value_object;
-	public Change change = new Change();
-
-	private SceneDataObject father;
-
-	public SceneDataObject(Repository Repository, SceneDataObject parentObjectData, String myPropertyName, SceneDataValue parentArrayData,
-			SceneObject custom_object, SceneProperty[] query_attached, SceneDataObject father) {
-		this.parentObjectData = parentObjectData;
-		this.myPropertyName = myPropertyName;
-		this.parentArrayData = parentArrayData;
-		this.rel_object = custom_object;
-		this.query_attached = query_attached;
-		this.father = father;
-
-		this.value_object = new HashMap<String, SceneDataValue>();
-		if (this.rel_object != null) {
-			for (SceneProperty sceneProperty : this.rel_object.propertyList) {
-				this.value_object.put(sceneProperty.propertyName, new SceneDataValue(Repository, this, sceneProperty.propertyName, sceneProperty));
-			}
-		}
-		if (this.query_attached != null) {
-			for (SceneProperty sceneProperty : this.query_attached) {
-				this.value_object.put(sceneProperty.propertyName, new SceneDataValue(Repository, this, sceneProperty.propertyName, sceneProperty));
-			}
-		}
-	}
-
-	public Object toJSON(int depth) {
-		int depthInner = depth == -1 ? -1 : (depth > 0 ? depth - 1 : 0);
-		JSONObject result = new JSONObject();
-		for (String key : this.keySet()) {
-			if (Constant.keyWordMap.containsKey(key)) {
-				continue;
-			}
-			SceneDataValue sdvInner = this.get(key);
-			if (sdvInner != null) {
-				result.put(key, sdvInner.toJSON(false, depthInner));
-			}
-		}
-		return result;
-	}
-
-	@Override
-	public String toString() {
-		return JSONObject.toJSONString(this.toJSON(1), SerializerFeature.WriteMapNullValue);
-	}
-
-	public Set<String> keySet() {
-		Set<String> result = new HashSet<String>();
-		if (this.father != null) {
-			result.addAll(this.father.keySet());
-		}
-		result.addAll(this.value_object.keySet());
-		return result;
-	}
-
-	public boolean containsKey(String key) {
-		if (this.father != null) {
-			if (this.father.containsKey(key)) {
-				return true;
-			}
-		}
-		if (this.value_object.containsKey(key)) {
-			return true;
-		}
-		return false;
-	}
-
-	public SceneDataValue get(String key) {
-		if (this.father != null) {
-			if (this.father.containsKey(key)) {
-				return this.father.get(key);
-			}
-		}
-		if (this.value_object.containsKey(key)) {
-			return this.value_object.get(key);
-		}
-		return null;
-	}
-
-	public void put(String key, SceneDataValue value) {
-		this.value_object.put(key, value);
-	}
-
-	public void remove(String key) {
-		this.value_object.remove(key);
-	}
-
-	public int size() {
-		int result = 0;
-		if (this.father != null) {
-			result += this.father.size();
-		}
-		result += this.value_object.size();
-		return result;
-	}
-
-	public boolean getRowChange() {
-		if (this.father != null) {
-			return this.father.getRowChange();
-		} else {
-			return this.change.row_change;
-		}
-	}
-
-	public void setRowChange(boolean value) throws Exception {
-		this.change.row_change = value;
-	}
-
-	public Map<String, Boolean> getColChange() {
-		Map<String, Boolean> result;
-		if (this.father != null) {
-			result = new HashMap<String, Boolean>();
-			Map<String, Boolean> result_father = this.father.getColChange();
-			for (String col : result_father.keySet()) {
-				result.put(col, true);
-			}
-			for (String col : this.change.colChangeMap.keySet()) {
-				result.put(col, true);
-			}
-		} else {
-			result = this.change.colChangeMap;
-		}
-		return result;
-	}
-
-	public void setColChange(String col) {
-		if (!this.hasColChange(col)) {
-			this.change.colChangeMap.put(col, true);
-		}
-	}
-
-	public void setColChange(Map<String, Boolean> colMap) {
-		for (String col : colMap.keySet()) {
-			if (!this.hasColChange(col)) {
-				this.change.colChangeMap.put(col, true);
-			}
-		}
-	}
-
-	public boolean hasColChange(String col) {
-		if (this.father != null) {
-			if (this.father.hasColChange(col)) {
-				return true;
-			}
-		}
-		return this.change.colChangeMap.containsKey(col);
-	}
-}

+ 0 - 19
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneDataPrimitive.java

@@ -1,19 +0,0 @@
-package com.persagy.ibms.data.sdk.data;
-
-public class SceneDataPrimitive {
-	public Object value;
-	public boolean change;
-
-	public void setRowChange(boolean value) {
-		this.change = value;
-	}
-
-	public boolean getRowChange() {
-		return change;
-	}
-
-	@Override
-	public String toString() {
-		return value.toString();
-	}
-}

+ 0 - 72
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneDataSet.java

@@ -1,72 +0,0 @@
-package com.persagy.ibms.data.sdk.data;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-
-public class SceneDataSet {
-	public boolean isSingleValueSet = false;
-	public List<SceneDataObject> set;
-	public List<SceneDataValue> singleValueSet;
-	public Change change = new Change();
-
-	public SceneDataSet(boolean isSingleValueSet) {
-		this.isSingleValueSet = isSingleValueSet;
-		if (this.isSingleValueSet) {
-			this.singleValueSet = new ArrayList<SceneDataValue>();
-		} else {
-			this.set = new ArrayList<SceneDataObject>();
-		}
-	}
-
-	public boolean getRowChange() {
-		return this.change.row_change;
-	}
-
-	public void setRowChange(boolean value) {
-		this.change.row_change = value;
-	}
-
-	public Map<String, Boolean> getColChange() {
-		Map<String, Boolean> result = this.change.colChangeMap;
-		return result;
-	}
-
-	public void setColChange(String col) {
-		this.change.colChangeMap.put(col, true);
-	}
-
-	public void setColChange(Map<String, Boolean> colMap) {
-		for (String col : colMap.keySet()) {
-			this.change.colChangeMap.put(col, true);
-		}
-	}
-
-	public boolean hasColChange(String col) {
-		return this.change.colChangeMap.containsKey(col);
-	}
-
-	public JSONArray toJSON(int depth) {
-		JSONArray result = new JSONArray();
-		if (this.isSingleValueSet) {
-			for (int i = 0; i < this.singleValueSet.size(); i++) {
-				result.add(this.singleValueSet.get(i).value_prim.value);
-			}
-		} else {
-			for (int i = 0; i < this.set.size(); i++) {
-				SceneDataObject sod = this.set.get(i);
-				result.add(sod.toJSON(depth));
-			}
-		}
-		return result;
-	}
-
-	@Override
-	public String toString() {
-		return JSONObject.toJSONString(this.toJSON(1), SerializerFeature.WriteMapNullValue);
-	}
-}

+ 0 - 98
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneDataValue.java

@@ -1,98 +0,0 @@
-package com.persagy.ibms.data.sdk.data;
-
-import java.util.Date;
-import java.util.concurrent.locks.ReentrantLock;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.persagy.ibms.data.sdk.util.Repository;
-
-public class SceneDataValue {
-	public boolean finish = false;
-
-	public SceneDataObject parentObjectData;
-	public String myPropertyName;
-
-	public SceneProperty rel_property;
-
-	public SceneDataObject value_object;
-	public SceneDataSet value_array;
-	public SceneDataPrimitive value_prim;
-
-	public Date last_compute_time;
-	public ReentrantLock lock;
-
-	public SceneDataValue(Repository Repository, SceneDataObject parentObjectData, String myPropertyName, SceneProperty rel_property) {
-		this.parentObjectData = parentObjectData;
-		this.myPropertyName = myPropertyName;
-		this.rel_property = rel_property;
-
-		if (this.rel_property != null) {
-			if (this.rel_property.propertyValueType.equals("query") || this.rel_property.propertyValueType.equals("static")
-					|| this.rel_property.propertyValueType.equals("deamon")) {
-				if (Repository.property2SDV_enable) {
-					Repository.property2SDV.get(this.rel_property).add(this);
-				}
-			}
-			if (this.rel_property.propertyValueType.equals("query")) {
-				this.lock = new ReentrantLock(true);
-			}
-		}
-
-		if (this.rel_property != null) {
-			if (this.rel_property.propertyValueType.equals("query")) {
-			} else if (this.rel_property.propertyValueType.equals("custom")) {
-				this.value_object = new SceneDataObject(Repository, parentObjectData, myPropertyName, null, this.rel_property.custom_object, null,
-						null);
-				this.finish = true;
-			} else if (this.rel_property.propertyValueType.equals("static")) {
-				if (this.rel_property.propertyValueSchema.equals("JSONArray")) {
-					this.value_array = new SceneDataSet(false);
-					for (SceneObject SceneObject : this.rel_property.static_array) {
-						SceneDataObject sdo = new SceneDataObject(Repository, null, null, this, SceneObject, this.rel_property.query_attached, null);
-						this.value_array.set.add(sdo);
-					}
-					this.finish = true;
-				}
-			}
-		}
-	}
-
-	public Object toJSON(boolean is_direct, int depth) {
-		if (!is_direct && this.rel_property != null && this.rel_property.allow_pass.equals("0")) {
-			return null;
-		}
-
-		int curr_depth = depth;
-		if (!is_direct && this.rel_property != null && curr_depth != -1) {
-			curr_depth -= Integer.parseInt(this.rel_property.offset_level);
-			if (curr_depth < 0) {
-				return null;
-			}
-		}
-
-		if (curr_depth > 0 || curr_depth == -1) {
-			if (this.value_object != null) {
-				JSONObject result = (JSONObject) this.value_object.toJSON(curr_depth);
-				return result;
-			} else if (this.value_array != null) {
-				JSONArray result = this.value_array.toJSON(curr_depth);
-				return result;
-			} else if (this.value_prim != null) {
-				return this.value_prim.value;
-			}
-			return null;
-		} else {
-			if (this.value_prim != null) {
-				return this.value_prim.value;
-			}
-			return null;
-		}
-	}
-
-	@Override
-	public String toString() {
-		return JSONObject.toJSONString(this.toJSON(true, 1), SerializerFeature.WriteMapNullValue);
-	}
-}

+ 0 - 13
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneObject.java

@@ -1,13 +0,0 @@
-package com.persagy.ibms.data.sdk.data;
-
-public class SceneObject {
-	public SceneProperty[] propertyList;
-
-	public SceneProperty[] getPropertyList() {
-		return propertyList;
-	}
-
-	public void setPropertyList(SceneProperty[] propertyList) {
-		this.propertyList = propertyList;
-	}
-}

+ 0 - 129
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/data/SceneProperty.java

@@ -1,129 +0,0 @@
-package com.persagy.ibms.data.sdk.data;
-
-public class SceneProperty {
-	public String propertyName;
-	public boolean propertyVisible;
-
-	public String propertyValueSchema;// JSONObject、JSONArray、string、double、int、boolean
-	public String propertyValueType;// static、query、custom
-
-	public String filter_rule;// 筛选规则
-	public String read_level;// 0表示递归全部、其他正整数表示层次
-	public String offset_level;
-	public String allow_pass;// 1表示通过,0表示截断
-
-	// type=custom
-	public SceneObject custom_object;
-
-	// type=static
-	public String static_value;
-	public SceneObject[] static_array;
-
-	// type=query
-	public String query_sql;
-	public SceneProperty[] query_attached;
-
-	public String getPropertyName() {
-		return propertyName;
-	}
-
-	public void setPropertyName(String propertyName) {
-		this.propertyName = propertyName;
-	}
-
-	public boolean isPropertyVisible() {
-		return propertyVisible;
-	}
-
-	public void setPropertyVisible(boolean propertyVisible) {
-		this.propertyVisible = propertyVisible;
-	}
-
-	public String getPropertyValueSchema() {
-		return propertyValueSchema;
-	}
-
-	public void setPropertyValueSchema(String propertyValueSchema) {
-		this.propertyValueSchema = propertyValueSchema;
-	}
-
-	public String getPropertyValueType() {
-		return propertyValueType;
-	}
-
-	public void setPropertyValueType(String propertyValueType) {
-		this.propertyValueType = propertyValueType;
-	}
-
-	public String getFilter_rule() {
-		return filter_rule;
-	}
-
-	public void setFilter_rule(String filter_rule) {
-		this.filter_rule = filter_rule;
-	}
-
-	public String getRead_level() {
-		return read_level;
-	}
-
-	public void setRead_level(String read_level) {
-		this.read_level = read_level;
-	}
-
-	public String getOffset_level() {
-		return offset_level;
-	}
-
-	public void setOffset_level(String offset_level) {
-		this.offset_level = offset_level;
-	}
-
-	public String getAllow_pass() {
-		return allow_pass;
-	}
-
-	public void setAllow_pass(String allow_pass) {
-		this.allow_pass = allow_pass;
-	}
-
-	public SceneObject getCustom_object() {
-		return custom_object;
-	}
-
-	public void setCustom_object(SceneObject custom_object) {
-		this.custom_object = custom_object;
-	}
-
-	public String getStatic_value() {
-		return static_value;
-	}
-
-	public void setStatic_value(String static_value) {
-		this.static_value = static_value;
-	}
-
-	public SceneObject[] getStatic_array() {
-		return static_array;
-	}
-
-	public void setStatic_array(SceneObject[] static_array) {
-		this.static_array = static_array;
-	}
-
-	public String getQuery_sql() {
-		return query_sql;
-	}
-
-	public void setQuery_sql(String query_sql) {
-		this.query_sql = query_sql;
-	}
-
-	public SceneProperty[] getQuery_attached() {
-		return query_attached;
-	}
-
-	public void setQuery_attached(SceneProperty[] query_attached) {
-		this.query_attached = query_attached;
-	}
-}

+ 6 - 6
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/AlarmDurationThread.java

@@ -7,10 +7,10 @@ import javax.annotation.PostConstruct;
 
 import org.springframework.stereotype.Component;
 
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataPrimitive;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-import com.persagy.ibms.data.sdk.util.RepositoryBase;
+import com.persagy.ibms.core.data.SceneDataObject;
+import com.persagy.ibms.core.data.SceneDataPrimitive;
+import com.persagy.ibms.core.data.SceneDataValue;
+import com.persagy.ibms.data.sdk.util.RepositoryContainer;
 
 @Component
 public class AlarmDurationThread extends Thread {
@@ -29,9 +29,9 @@ public class AlarmDurationThread extends Thread {
 			}
 
 			Date currentTime = new Date();
-			String[] ids = RepositoryBase.id2alarmList.keySet().toArray(new String[0]);
+			String[] ids = RepositoryContainer.RepositoryBase.id2alarmList.keySet().toArray(new String[0]);
 			for (String id : ids) {
-				SceneDataValue alarmList = RepositoryBase.id2alarmList.get(id);
+				SceneDataValue alarmList = RepositoryContainer.RepositoryBase.id2alarmList.get(id);
 				for (int i = 0; i < alarmList.value_array.set.size(); i++) {
 					SceneDataObject sdoInner = (SceneDataObject) alarmList.value_array.set.get(i);
 					long triggerTime = (Long) sdoInner.get("triggerTime").value_prim.value;

+ 12 - 9
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/DaemonThread.java

@@ -8,12 +8,13 @@ import javax.annotation.PostConstruct;
 
 import org.springframework.stereotype.Component;
 
-import com.persagy.ibms.data.sdk.util.ComputeUtil;
+import com.persagy.ibms.core.util.KeywordUtil;
+import com.persagy.ibms.data.sdk.util.RepositoryContainer;
 import com.persagy.ibms.data.sdk.util.Constant;
 import com.persagy.ibms.data.sdk.util.DeamonUtil;
 import com.persagy.ibms.data.sdk.util.RWDDownloadUtil;
-import com.persagy.ibms.data.sdk.util.Repository;
-import com.persagy.ibms.data.sdk.util.RepositoryBase;
+import com.persagy.ibms.data.sdk.util.RWDRepositoryUtil;
+import com.persagy.ibms.data.sdk.util.RepositoryImpl;
 import com.persagy.ibms.data.sdk.websocket.AlarmWebSocketClient;
 import com.persagy.ibms.data.sdk.websocket.IOTWebSocketClient;
 
@@ -40,6 +41,7 @@ public class DaemonThread extends Thread {
 
 	public void run() {
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
+		KeywordUtil.keyWordMap = Constant.keyWordMap;
 		// 没有就下载
 		{
 			Date currTime = new Date();
@@ -66,8 +68,8 @@ public class DaemonThread extends Thread {
 		try {
 			if (Constant.iot_websocket_url != null) {
 				log.warn("iot-websocket");
-				IOTWebSocketClient.client = new IOTWebSocketClient(
-						new URI(Constant.iot_websocket_url + "?projectId=" + RepositoryBase.projectId.substring(2) + "&type=iot,text,pointset"));
+				IOTWebSocketClient.client = new IOTWebSocketClient(new URI(
+						Constant.iot_websocket_url + "?projectId=" + RepositoryContainer.RepositoryBase.projectId.substring(2) + "&type=iot,text,pointset"));
 				IOTWebSocketClient.client.connect();
 				// while (!myClient.getReadyState().equals(READYSTATE.OPEN)) {
 				// Thread.sleep(1000L);
@@ -78,7 +80,7 @@ public class DaemonThread extends Thread {
 			}
 			if (Constant.alarm_enable) {
 				log.warn("alarm-websocket");
-				AlarmWebSocketClient.client = new AlarmWebSocketClient(new URI(Constant.alarm_websocket + "/" + RepositoryBase.projectId));
+				AlarmWebSocketClient.client = new AlarmWebSocketClient(new URI(Constant.alarm_websocket + "/" + RepositoryContainer.RepositoryBase.projectId));
 				AlarmWebSocketClient.client.connect();
 				// while (!myClient.getReadyState().equals(READYSTATE.OPEN)) {
 				// Thread.sleep(1000L);
@@ -88,10 +90,11 @@ public class DaemonThread extends Thread {
 				Thread.sleep(1000L);
 			}
 
-			Repository Repository = RepositoryBase.instance;
-			ComputeUtil.DoRepository(Repository, true);
+			RepositoryImpl Repository = RepositoryContainer.instance;
+			Repository.RepositoryBase = RepositoryContainer.RepositoryBase;
+			RWDRepositoryUtil.DoRepository(Repository, true);
 			log.warn("compute finish");
-			RepositoryBase.compute_finish = true;
+			RepositoryContainer.RepositoryBase.compute_finish = true;
 			// 查询可变集合
 			// RecursiveUtil.print_variable_set("", Repository.objectData);
 

+ 12 - 11
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/RefreshThread.java

@@ -6,16 +6,16 @@ import java.util.Date;
 
 import javax.annotation.PostConstruct;
 
-import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Component;
 
-import com.persagy.ibms.data.sdk.util.ComputeUtil;
+import com.persagy.ibms.data.sdk.util.RepositoryContainer;
 import com.persagy.ibms.data.sdk.util.Constant;
 import com.persagy.ibms.data.sdk.util.FileUtil;
-import com.persagy.ibms.data.sdk.util.LogUtil;
 import com.persagy.ibms.data.sdk.util.RWDDownloadUtil;
-import com.persagy.ibms.data.sdk.util.Repository;
-import com.persagy.ibms.data.sdk.util.RepositoryBase;
+import com.persagy.ibms.data.sdk.util.RWDRepositoryUtil;
+import com.persagy.ibms.data.sdk.util.RepositoryImpl;
+
+import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 @Component
@@ -46,7 +46,7 @@ public class RefreshThread extends Thread {
 				e.printStackTrace();
 			}
 
-			if (RepositoryBase.compute_finish) {
+			if (RepositoryContainer.RepositoryBase.compute_finish) {
 				break;
 			}
 		}
@@ -78,9 +78,10 @@ public class RefreshThread extends Thread {
 				}
 				if (changed_config || changed_physical_world) {
 					log.warn("recompute begin");
-					Repository Repository = new Repository();
-					ComputeUtil.DoRepository(Repository, changed_physical_world);
-					RepositoryBase.instance = Repository;
+					RepositoryImpl Repository = new RepositoryImpl();
+					Repository.RepositoryBase = RepositoryContainer.RepositoryBase;
+					RWDRepositoryUtil.DoRepository(Repository, changed_physical_world);
+					RepositoryContainer.instance = Repository;
 					log.warn("recompute finish");
 				}
 			} catch (Exception e) {
@@ -124,11 +125,11 @@ public class RefreshThread extends Thread {
 		}
 		// 检查一致性
 		boolean compare = FileUtil.compareRecursive(dir1, dir2);
-		log.debug(LogUtil.refreshLoggerName, "Compare tmp1" + (compare ? "==" : "!=") + "tmp2");
+		log.debug("Compare tmp1" + (compare ? "==" : "!=") + "tmp2");
 		if (compare) {
 			File valid = new File(validPath);
 			boolean compare_valid = FileUtil.compareRecursive(valid, dir2);
-			log.debug(LogUtil.refreshLoggerName, "Compare valid" + (compare_valid ? "==" : "!=") + "tmp2");
+			log.debug("Compare valid" + (compare_valid ? "==" : "!=") + "tmp2");
 			if (compare_valid) {
 				return false;
 			} else {

+ 3 - 3
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/WebSocketCheckThread.java

@@ -7,8 +7,8 @@ import javax.annotation.PostConstruct;
 
 import org.springframework.stereotype.Component;
 
+import com.persagy.ibms.data.sdk.util.RepositoryContainer;
 import com.persagy.ibms.data.sdk.util.Constant;
-import com.persagy.ibms.data.sdk.util.RepositoryBase;
 import com.persagy.ibms.data.sdk.websocket.AlarmWebSocketClient;
 import com.persagy.ibms.data.sdk.websocket.IOTWebSocketClient;
 
@@ -33,8 +33,8 @@ public class WebSocketCheckThread extends Thread {
 			if (IOTWebSocketClient.client != null) {
 				try {
 					if (!IOTWebSocketClient.client.isOpen()) {
-						IOTWebSocketClient.client = new IOTWebSocketClient(
-								new URI(Constant.iot_websocket_url + "?projectId=" + RepositoryBase.projectId.substring(2) + "&type=iot,text,pointset"));
+						IOTWebSocketClient.client = new IOTWebSocketClient(new URI(Constant.iot_websocket_url + "?projectId="
+								+ RepositoryContainer.RepositoryBase.projectId.substring(2) + "&type=iot,text,pointset"));
 						IOTWebSocketClient.client.connect();
 					}
 				} catch (URISyntaxException e) {

+ 5 - 4
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestApi.java

@@ -17,7 +17,8 @@ import org.springframework.web.bind.annotation.RestController;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.persagy.ibms.data.sdk.util.RepositoryBase;
+import com.persagy.ibms.core.util.FilterUtil;
+import com.persagy.ibms.data.sdk.util.RepositoryContainer;
 import com.persagy.ibms.data.sdk.util.ToolUtil;
 import com.persagy.ibms.data.sdk.websocket.AlarmWebSocketClient;
 import com.persagy.ibms.data.sdk.websocket.IOTWebSocketClient;
@@ -110,8 +111,8 @@ public class RestApi {
 	@PostMapping(path = { "/post", "/zkt-sdk/post" }, produces = "application/json;charset=UTF-8")
 	public String post(@RequestBody String param, HttpServletRequest request) {
 		String ip = RestUtil.getIp(request);
-		RepositoryBase.ip2param2time.putIfAbsent(ip, new ConcurrentHashMap<String, Date>());
-		ConcurrentHashMap<String, Date> param2time = RepositoryBase.ip2param2time.get(ip);
+		RepositoryContainer.RepositoryBase.ip2param2time.putIfAbsent(ip, new ConcurrentHashMap<String, Date>());
+		ConcurrentHashMap<String, Date> param2time = RepositoryContainer.RepositoryBase.ip2param2time.get(ip);
 		Date exist = param2time.putIfAbsent(param, new Date());
 		if (exist == null) {
 			try {
@@ -139,7 +140,7 @@ public class RestApi {
 
 	@PostMapping(path = { "/post_filter_and_page", "/zkt-sdk/post_filter_and_page" }, produces = "application/json;charset=UTF-8")
 	public String post_filter_and_page(@RequestBody String param, HttpServletRequest request) {
-		String result = RestUtil.post_filter_and_page(param);
+		String result = FilterUtil.post_filter_and_page(RepositoryContainer.instance, param);
 		return result;
 	}
 

+ 33 - 205
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestUtil.java

@@ -15,19 +15,31 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataPrimitive;
-import com.persagy.ibms.data.sdk.data.SceneDataSet;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-import com.persagy.ibms.data.sdk.data.SceneProperty;
-import com.persagy.ibms.data.sdk.util.*;
+import com.persagy.ibms.core.data.SceneDataObject;
+import com.persagy.ibms.core.data.SceneDataSet;
+import com.persagy.ibms.core.data.SceneDataValue;
+import com.persagy.ibms.core.data.SceneProperty;
+import com.persagy.ibms.core.util.ComputeUtil;
+import com.persagy.ibms.core.util.FastJsonReaderUtil;
+import com.persagy.ibms.core.util.IntWrapper;
+import com.persagy.ibms.core.util.LogUtil;
+import com.persagy.ibms.core.util.QueryAssist;
+import com.persagy.ibms.core.util.QueryUtil;
+import com.persagy.ibms.core.util.RecursiveUtil;
+import com.persagy.ibms.data.sdk.util.RepositoryContainer;
+import com.persagy.ibms.data.sdk.util.Constant;
+import com.persagy.ibms.data.sdk.util.ControlUtil;
+import com.persagy.ibms.data.sdk.util.DrawUtil;
+import com.persagy.ibms.data.sdk.util.ExeclReadEquipStaticInfoUtil;
+import com.persagy.ibms.data.sdk.util.HttpClientUtil;
+import com.persagy.ibms.data.sdk.util.RepositoryImpl;
 
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 public class RestUtil {
 	public static String query(String param) {
-		Repository Repository = RepositoryBase.instance;
+		RepositoryImpl Repository = RepositoryContainer.instance;
 		JSONObject result = new JSONObject();
 		Object Content;
 		try {
@@ -62,13 +74,13 @@ public class RestUtil {
 	}
 
 	public static String showTree() {
-		Repository Repository = RepositoryBase.instance;
+		RepositoryImpl Repository = RepositoryContainer.instance;
 		JSONObject JSON = (JSONObject) Repository.objectData.toJSON(-1);
 		return JSONObject.toJSONString(JSON, SerializerFeature.WriteMapNullValue);
 	}
 
 	public static String check() {
-		Repository Repository = RepositoryBase.instance;
+		RepositoryImpl Repository = RepositoryContainer.instance;
 		for (String key : Repository.objectData.keySet()) {
 			SceneDataValue sdv = Repository.objectData.get(key);
 			SceneProperty rel_sp = null;
@@ -185,7 +197,7 @@ public class RestUtil {
 		for (int i = 0; i < path.size(); i++) {
 			valuePath[i] = path.getString(i);
 		}
-		Repository Repository = RepositoryBase.instance;
+		RepositoryImpl Repository = RepositoryContainer.instance;
 		Object valueObject = ComputeUtil.getValueObject(Repository, valuePath);
 		String result;
 		if (valueObject instanceof SceneDataValue) {
@@ -260,7 +272,7 @@ public class RestUtil {
 	}
 
 	public static String show(String[] valuePath, int read_level) {
-		Repository Repository = RepositoryBase.instance;
+		RepositoryImpl Repository = RepositoryContainer.instance;
 		try {
 			Object valueObject = ComputeUtil.getValueObject(Repository, valuePath);
 			Object valueJSON = ComputeUtil.getValueJSON(valueObject, read_level);
@@ -284,7 +296,7 @@ public class RestUtil {
 	}
 
 	public static Object post(String[] valuePath) {
-		Repository Repository = RepositoryBase.instance;
+		RepositoryImpl Repository = RepositoryContainer.instance;
 		try {
 			if (valuePath[valuePath.length - 1].equals("工单")) {
 				JSONObject work_order = FastJsonReaderUtil.Instance()
@@ -306,194 +318,8 @@ public class RestUtil {
 		}
 	}
 
-	public static String post_filter_and_page(String param) {
-		JSONObject result = new JSONObject();
-		try {
-			JSONObject paramObject = JSON.parseObject(param);
-			List<SceneDataObject> array = filter_and_page(paramObject);
-			if (paramObject.containsKey("count")) {
-			} else {
-				int pageSize = Integer.MAX_VALUE;
-				int pageIndex = 0;
-				if (paramObject.containsKey("page")) {
-					pageSize = (Integer) paramObject.get("pageSize");
-					pageIndex = (Integer) paramObject.get("pageIndex");
-				}
-				SceneDataValue sdv = new SceneDataValue(null, null, null, null);
-				sdv.value_array = new SceneDataSet(false);
-				sdv.value_array.set = new ArrayList<SceneDataObject>();
-				for (int i = pageSize * pageIndex; i < pageSize * (pageIndex + 1) && i < array.size(); i++) {
-					sdv.value_array.set.add(array.get(i));
-				}
-				int read_level = 0;
-				JSONArray content = (JSONArray) sdv.toJSON(true, read_level == 0 ? -1 : read_level);
-
-				result.put("content", content);
-			}
-			result.put("count", array.size());
-			result.put("result", "success");
-		} catch (Exception e) {
-			e.printStackTrace();
-			String message = LogUtil.GetExceptionStackTrace(e);
-			log.error(message);
-			result.put("result", "failure");
-		}
-		return result.toJSONString();
-	}
-
-	private static List<SceneDataObject> filter_and_page(JSONObject paramObject) throws Exception {
-		Repository Repository = RepositoryBase.instance;
-		JSONArray path = (JSONArray) paramObject.get("path");
-		String[] valuePath = new String[path.size()];
-		for (int i = 0; i < path.size(); i++) {
-			valuePath[i] = path.getString(i);
-		}
-		JSONObject params = (JSONObject) paramObject.get("params");
-		SceneDataValue valueObject = (SceneDataValue) ComputeUtil.getValueObject(Repository, valuePath);
-		String filter_rule = valueObject.rel_property.filter_rule;
-		if (filter_rule == null || filter_rule.trim().length() == 0) {
-			JSONObject sql_json = new JSONObject();
-			sql_json.put("QueryType", "select");
-			sql_json.put("Criteria", new JSONObject());
-			filter_rule = sql_json.toJSONString();
-		}
-		JSONObject CriteriaObject = JSON.parseObject(filter_rule).getJSONObject("Criteria");
-		List<String> refPropertyList = new ArrayList<String>();
-		JSONObject CriteriaNew = parseCriteria(CriteriaObject, params, refPropertyList);
-
-		SceneDataSet targetSet = new SceneDataSet(false);
-		targetSet.set = new ArrayList<SceneDataObject>();
-		for (SceneDataObject sdb : valueObject.value_array.set) {
-			if (sdb instanceof SceneDataObject) {
-				SceneDataObject sdo = (SceneDataObject) sdb;
-				targetSet.set.add(sdo);
-			}
-		}
-		SceneDataObject parentData = new SceneDataObject(null, null, null, null, null, null, null);
-		for (String key : params.keySet()) {
-			Object value = params.get(key);
-			SceneDataValue svInner = new SceneDataValue(null, parentData, key, null);
-			if (value instanceof JSONArray) {
-				svInner.value_array = new SceneDataSet(true);
-				svInner.value_array.singleValueSet = new ArrayList<SceneDataValue>();
-				JSONArray valueArray = (JSONArray) value;
-				for (int i = 0; i < valueArray.size(); i++) {
-					Object valueItem = valueArray.get(i);
-					SceneDataValue svInner2 = new SceneDataValue(null, null, null, null);
-					svInner2.value_prim = new SceneDataPrimitive();
-					svInner2.value_prim.value = valueItem;
-					svInner.value_array.singleValueSet.add(svInner2);
-				}
-			} else {
-				svInner.value_prim = new SceneDataPrimitive();
-				svInner.value_prim.value = value;
-			}
-			parentData.put(key, svInner);
-		}
-		// SceneDataValue sv = new SceneDataValue(Repository, parentData, valueObject.rel_property.propertyName, valueObject.rel_property);
-		SceneDataValue sv = new SceneDataValue(Repository, parentData, valueObject.rel_property.propertyName, null);
-		JSONObject sql_json = JSON.parseObject(filter_rule);
-		sql_json.put("Criteria", CriteriaNew);
-		SceneDataSet array = (SceneDataSet) QueryUtil.QueryInner(Repository, sv, sql_json, targetSet);
-
-		return array.set;
-	}
-
-	private static JSONObject parseCriteria(JSONObject CriteriaObject, JSONObject params, List<String> criteriaList) throws Exception {
-		JSONObject result = new JSONObject();
-		JSONObject pass = new JSONObject();
-		pass.put("pass", true);
-		Object LogicOperator = CriteriaObject.get("LogicOperator");
-		if (LogicOperator != null) {
-			String LogicOperatorString = (LogicOperator).toString();
-			result.put("LogicOperator", LogicOperator);
-			JSONArray resultCriterias = new JSONArray();
-			result.put("Criterias", resultCriterias);
-			if (LogicOperatorString.equals("and") || LogicOperatorString.equals("or")) {
-				JSONArray Criterias = (JSONArray) CriteriaObject.get("Criterias");
-				for (int i = 0; i < Criterias.size(); i++) {
-					JSONObject CriteriaObjectInner = (JSONObject) Criterias.get(i);
-					List<String> criteriaInner = new ArrayList<String>();
-					JSONObject resultInner = parseCriteria(CriteriaObjectInner, params, criteriaInner);
-					resultCriterias.add(resultInner);
-					criteriaList.addAll(criteriaInner);
-				}
-			} else if (LogicOperatorString.equals("not")) {
-				JSONObject CriteriaObjectInner = (JSONObject) CriteriaObject.get("Criteria");
-				List<String> criteriaInner = new ArrayList<String>();
-				JSONObject resultInner = parseCriteria(CriteriaObjectInner, params, criteriaInner);
-				resultCriterias.add(resultInner);
-				criteriaList.addAll(criteriaInner);
-			} else {
-			}
-		} else {
-			for (String itemKey : CriteriaObject.keySet()) {
-				Object itemValue = CriteriaObject.get(itemKey);
-				if (itemValue instanceof JSONObject) {
-					JSONObject valueInner = (JSONObject) itemValue;
-					if (valueInner.get("ref") != null) {
-						String svInner_value_primitive = parseCriteriaRef(valueInner);
-						if (params.containsKey(svInner_value_primitive)) {
-							result.put(itemKey, itemValue);
-						} else {
-							result.put(itemKey, pass);
-						}
-						criteriaList.add(svInner_value_primitive);
-					} else {
-						JSONObject itemValueResult = new JSONObject();
-						for (String itemKeyInner : valueInner.keySet()) {
-							Object itemValueInner = valueInner.get(itemKeyInner);
-							if (itemKeyInner.equals("e") || itemKeyInner.equals("ne") || itemKeyInner.equals("gt") || itemKeyInner.equals("gte")
-									|| itemKeyInner.equals("lt") || itemKeyInner.equals("lte") || itemKeyInner.equals("regex")
-									|| itemKeyInner.equals("contain")) {
-								if (itemValueInner instanceof JSONObject) {
-									JSONObject valueInnerInner = (JSONObject) itemValueInner;
-									if (valueInnerInner.get("ref") != null) {
-										String svInner_value_primitive = parseCriteriaRef(valueInnerInner);
-										if (params.containsKey(svInner_value_primitive)) {
-											itemValueResult.put(itemKeyInner, itemValueInner);
-										} else {
-											itemValueResult.put(itemKeyInner, pass);
-										}
-										criteriaList.add(svInner_value_primitive);
-									}
-								}
-							} else if (itemKeyInner.equals("in") || itemKeyInner.equals("notin")) {
-								if (itemValueInner instanceof JSONObject) {
-									JSONObject valueInnerInner = (JSONObject) itemValueInner;
-									if (valueInnerInner.get("ref") != null) {
-										String svInner_value_primitive = parseCriteriaRef(valueInnerInner);
-										if (params.containsKey(svInner_value_primitive)) {
-											itemValueResult.put(itemKeyInner, itemValueInner);
-										} else {
-											itemValueResult.put(itemKeyInner, pass);
-										}
-										criteriaList.add(svInner_value_primitive);
-									}
-								}
-							}
-						}
-						result.put(itemKey, itemValueResult);
-					}
-				} else {
-				}
-			}
-		}
-		return result;
-	}
-
-	private static String parseCriteriaRef(JSONObject valueInner) throws Exception {
-		String refString = (valueInner.get("ref")).toString();
-		String[] splits = refString.split("'");
-		if (splits.length == 2 && splits[0].equals("ancestor_1")) {
-			return splits[1];
-		} else {
-			throw new Exception(refString);
-		}
-	}
-
 	public static String control(String param) {
-		Repository Repository = RepositoryBase.instance;
+		RepositoryImpl Repository = RepositoryContainer.instance;
 		JSONObject result = new JSONObject();
 		try {
 			JSONObject paramObject = JSON.parseObject(param);
@@ -590,6 +416,7 @@ public class RestUtil {
 	}
 
 	public static String fjd_query(String param) {
+		RepositoryImpl Repository = RepositoryContainer.instance;
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
 		Date currTime = new Date((new Date()).getTime() / (1000L * 60 * 15) * (1000L * 60 * 15));
 		Date time_from = new Date(
@@ -601,7 +428,7 @@ public class RestUtil {
 		JSONObject parseObject = JSON.parseObject(param);
 		String objId = parseObject.getString("objId");
 		String code = parseObject.getString("code");
-		String pointString = RepositoryBase.info2point.get(objId).get(code);
+		String pointString = Repository.info2point.get(objId).get(code);
 		int index_ = pointString.lastIndexOf('-');
 		String meter = pointString.substring(0, index_);
 		int funcid = Integer.parseInt(pointString.substring(index_ + 1));
@@ -610,10 +437,11 @@ public class RestUtil {
 	}
 
 	public static String fjd_query_history(String param) {
+		RepositoryImpl Repository = RepositoryContainer.instance;
 		JSONObject parseObject = JSON.parseObject(param);
 		String objId = parseObject.getString("objId");
 		String code = parseObject.getString("code");
-		String pointString = RepositoryBase.info2point.get(objId).get(code);
+		String pointString = Repository.info2point.get(objId).get(code);
 		int index_ = pointString.lastIndexOf('-');
 		String meter = pointString.substring(0, index_);
 		int funcid = Integer.parseInt(pointString.substring(index_ + 1));
@@ -655,8 +483,8 @@ public class RestUtil {
 			for (int ii = 0; ii < path.size(); ii++) {
 				valuePath[ii] = path.getString(ii);
 			}
-			Object valueObject = ComputeUtil.getValueObject(RepositoryBase.instance, valuePath);
-			Object drawObject = RecursiveUtil.drawObject(RepositoryBase.instance, valueObject, ObjInfo2Point);
+			Object valueObject = ComputeUtil.getValueObject(RepositoryContainer.instance, valuePath);
+			Object drawObject = DrawUtil.drawObject(RepositoryContainer.instance, valueObject, ObjInfo2Point);
 			drawObjectList.add(drawObject);
 		}
 		Map<String, JSONArray> Point2datas = new HashMap<String, JSONArray>();
@@ -742,7 +570,7 @@ public class RestUtil {
 
 	private static JSONArray fjd_query_inner(JSONArray points) throws Exception {
 		JSONObject postJSON = new JSONObject();
-		postJSON.put("building", RepositoryBase.projectId.substring(2));
+		postJSON.put("building", RepositoryContainer.RepositoryBase.projectId.substring(2));
 		postJSON.put("points", points);
 		String post_url = Constant.iot_collect_url + "fjd_query_batch_post";
 		String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString());
@@ -761,7 +589,7 @@ public class RestUtil {
 		JSONArray points = new JSONArray();
 		points.add(pointObject);
 		JSONObject postJSON = new JSONObject();
-		postJSON.put("building", RepositoryBase.projectId.substring(2));
+		postJSON.put("building", RepositoryContainer.RepositoryBase.projectId.substring(2));
 		postJSON.put("points", points);
 		String post_url = Constant.iot_collect_url + "fjd_query_batch_post";
 		String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString());

+ 0 - 324
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/CheckUtil.java

@@ -1,324 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneObject;
-import com.persagy.ibms.data.sdk.data.SceneProperty;
-
-public class CheckUtil {
-
-	public static void add(List<SceneProperty> result, SceneProperty item) {
-		boolean exist = false;
-		for (SceneProperty sp : result) {
-			if (sp.equals(item)) {
-				exist = true;
-				break;
-			}
-		}
-		if (!exist) {
-			result.add(item);
-		}
-	}
-
-	public static void addAll(List<SceneProperty> result, List<SceneProperty> itemList) {
-		for (SceneProperty sp : itemList) {
-			add(result, sp);
-		}
-	}
-
-	public static List<SceneProperty> getPropertyBefore(Repository Repository, SceneProperty sceneProperty) throws Exception {
-		List<SceneProperty> result = new ArrayList<SceneProperty>();
-		// 往上追溯
-		SceneProperty parentTmp = sceneProperty;
-		while (true) {
-			if (Repository.p2p.containsKey(parentTmp)) {
-				parentTmp = Repository.p2p.get(parentTmp);
-			} else if (Repository.p2o.containsKey(parentTmp)) {
-				parentTmp = Repository.o2p.get(Repository.p2o.get(parentTmp));
-			} else if (Repository.p2sai.containsKey(parentTmp)) {
-				parentTmp = Repository.sai2p.get(Repository.p2sai.get(parentTmp));
-			} else {
-				parentTmp = null;
-			}
-
-			if (parentTmp == null) {
-				break;
-			}
-
-			if (parentTmp.propertyValueType.equals("query")) {
-				add(result, parentTmp);
-				break;
-			}
-		}
-
-		if (sceneProperty.propertyValueType.equals("static")) {
-			if (sceneProperty.propertyValueSchema.equals("JSONArray")) {
-			} else {
-				if (Repository.p2p.containsKey(sceneProperty)) {
-					add(result, Repository.p2p.get(sceneProperty));
-				}
-			}
-			return result;
-		}
-
-		getPropertyBefore_query(Repository, sceneProperty, result);
-		return result;
-	}
-
-	public static void getPropertyBefore_query(Repository Repository, SceneProperty sceneProperty, List<SceneProperty> result) throws Exception {
-		JSONObject sql_json = JSON.parseObject(sceneProperty.query_sql);
-		// 查询目标中的引用为true,其他引用为false
-		Map<String, Boolean> refList = new HashMap<String, Boolean>();
-		query(sql_json, refList);
-		for (String refString : refList.keySet()) {
-			boolean refInTarget = refList.get(refString);
-			String[] splits = refString.split("'");
-			Object parentData;
-			if (splits[0].startsWith("ancestor_")) {
-				int generate = Integer.parseInt(splits[0].substring("ancestor_".length()));
-				parentData = sceneProperty;
-				while (generate > 0) {
-					if (parentData instanceof SceneProperty) {
-						SceneProperty tmpProperty = (SceneProperty) parentData;
-						if (Repository.p2p.containsKey(tmpProperty)) {
-							parentData = Repository.p2p.get(tmpProperty);
-							generate = generate - 2;
-						} else if (Repository.p2o.containsKey(tmpProperty)) {
-							parentData = Repository.o2p.get(Repository.p2o.get(tmpProperty));
-							generate--;
-						} else if (Repository.p2sai.containsKey(tmpProperty)) {
-							parentData = Repository.p2sai.get(tmpProperty);
-							generate--;
-						} else {
-							throw new Exception();
-						}
-					} else {
-						SceneObject tmpObject = (SceneObject) parentData;
-						if (Repository.sai2p.containsKey(tmpObject)) {
-							parentData = Repository.sai2p.get(tmpObject);
-							generate--;
-						} else {
-							throw new Exception();
-						}
-					}
-				}
-			} else {
-				SceneProperty equalSP = null;
-				for (SceneProperty SceneProperty : Repository.sceneObject.propertyList) {
-					if (SceneProperty.propertyName.equals(splits[0])) {
-						equalSP = SceneProperty;
-						break;
-					}
-				}
-				parentData = equalSP;
-			}
-
-			if (parentData instanceof SceneProperty) {
-				SceneProperty tmpProperty = (SceneProperty) parentData;
-				addAll(result, getProperty(tmpProperty, splits, 1, refInTarget));
-			} else {
-				SceneObject tmpObject = (SceneObject) parentData;
-				addAll(result, getProperty(tmpObject, splits, 1, refInTarget));
-			}
-		}
-	}
-
-	// 往下找一级
-	private static List<SceneProperty> getProperty(SceneObject parentData, String[] splits, int splits_index, boolean refInTarget) throws Exception {
-		String name = splits[splits_index];
-		SceneProperty findSP = null;
-		for (SceneProperty spInner : parentData.propertyList) {
-			if (spInner.propertyName.equals(name)) {
-				findSP = spInner;
-				break;
-			}
-		}
-
-		if (findSP != null) {
-			return getProperty(findSP, splits, splits_index + 1, refInTarget);
-		} else {
-			throw new Exception();
-		}
-	}
-
-	// 根据当前所处parent级别获取依赖属性
-	private static List<SceneProperty> getProperty(SceneProperty parentData, String[] splits, int splits_index, boolean refInTarget)
-			throws Exception {
-		List<SceneProperty> result = new ArrayList<SceneProperty>();
-		boolean valid_find = true;
-		if (parentData.propertyValueType.equals("static") && parentData.propertyValueSchema.equals("JSONArray")) {
-			// 静态数组根据是否有匹配,找下一级Object的对应属性
-			String split = splits[splits_index];
-			int index_ = split.indexOf('=');
-			if (index_ != -1) {
-				String propertyName = split.substring(0, index_);
-				String propertyValue = split.substring(index_ + 1);
-				for (SceneObject soInner : parentData.static_array) {
-					boolean matchInner = false;
-					for (SceneProperty spInner : soInner.propertyList) {
-						if (spInner.propertyName.equals(propertyName)) {
-							if (spInner.propertyValueType.equals("static")) {
-								matchInner = propertyValue.equals(spInner.static_value);
-							} else {
-								matchInner = true;
-							}
-						}
-					}
-					if (matchInner) {
-						List<SceneProperty> resultInner = getProperty(soInner, splits, splits_index + 1, refInTarget);
-						result.addAll(resultInner);
-					}
-				}
-			} else {
-				for (SceneObject soInner : parentData.static_array) {
-					List<SceneProperty> resultInner = getProperty(soInner, splits, splits_index, refInTarget);
-					result.addAll(resultInner);
-				}
-			}
-		} else if (parentData.propertyValueType.equals("deamon")) {
-			valid_find = false;
-			result.add(parentData);
-		} else if (splits_index == splits.length) {
-			valid_find = false;
-			result.add(parentData);
-		} else {
-			String name = splits[splits_index];
-			SceneProperty sp_attach = null;
-			if (parentData.query_attached != null) {
-				for (SceneProperty spInner : parentData.query_attached) {
-					if (spInner.propertyName.equals(name)) {
-						sp_attach = spInner;
-						break;
-					}
-				}
-			}
-			if (sp_attach != null) {
-				result = getProperty(sp_attach, splits, splits_index + 1, refInTarget);
-			} else {
-				SceneProperty sp_custom = null;
-				if (parentData.custom_object != null) {
-					for (SceneProperty spInner : parentData.custom_object.propertyList) {
-						if (spInner.propertyName.equals(name)) {
-							sp_custom = spInner;
-							break;
-						}
-					}
-				}
-				if (sp_custom != null) {
-					result = getProperty(sp_custom, splits, splits_index + 1, refInTarget);
-				} else if (parentData.propertyValueType.equals("query") && splits_index == splits.length - 1) {
-					valid_find = false;
-					result.add(parentData);
-				}
-			}
-		}
-
-		// 查询目标中有引用的,需要增加引用项下级的附加属性(query类型的原始值)
-		if (valid_find && refInTarget && splits_index + 1 == splits.length) {
-			List<SceneProperty> tmpList = new ArrayList<SceneProperty>();
-			for (SceneProperty spTmp : result) {
-				if (spTmp.query_attached != null) {
-					for (SceneProperty spTmp2 : spTmp.query_attached) {
-						if (spTmp2.propertyValueType.equals("query")
-								&& (!spTmp2.propertyValueSchema.equals("JSONObject") && !spTmp2.propertyValueSchema.equals("JSONArray"))) {
-							tmpList.add(spTmp2);
-						}
-					}
-				}
-			}
-			for (SceneProperty spTmp : tmpList) {
-				result.add(spTmp);
-			}
-		}
-		return result;
-	}
-
-	public static void query(JSONObject sql_json, Map<String, Boolean> result) {
-		if (sql_json.get("QueryType") != null) {
-			// 扫描备选集合
-			if (sql_json.containsKey("Target")) {
-				parseSet(sql_json.get("Target"), result);
-			}
-
-			// 扫描查询条件
-			JSONObject CriteriaObject = (JSONObject) sql_json.get("Criteria");
-			{
-				parseCriteria(CriteriaObject, result);
-			}
-
-			// 扫描返回列
-			if (sql_json.get("ReturnColumns") != null) {
-				parseSet(sql_json.get("ReturnColumns"), result);
-			}
-		} else if (sql_json.get("SetOperator") != null) {
-			parseSet(sql_json, result);
-		}
-	}
-
-	private static void parseCriteria(JSONObject CriteriaObject, Map<String, Boolean> result) {
-		Object LogicOperator = CriteriaObject.get("LogicOperator");
-		if (LogicOperator != null) {
-			String LogicOperatorString = (LogicOperator).toString();
-			if (LogicOperatorString.equals("and") || LogicOperatorString.equals("or")) {
-				JSONArray Criterias = (JSONArray) CriteriaObject.get("Criterias");
-				for (int i = 0; i < Criterias.size(); i++) {
-					JSONObject CriteriaObjectInner = (JSONObject) Criterias.get(i);
-					parseCriteria(CriteriaObjectInner, result);
-				}
-			} else if (LogicOperatorString.equals("not")) {
-				JSONObject CriteriaObjectInner = (JSONObject) CriteriaObject.get("Criteria");
-				parseCriteria(CriteriaObjectInner, result);
-			}
-		} else {
-			for (String itemKey : CriteriaObject.keySet()) {
-				Object itemValue = CriteriaObject.get(itemKey);
-				if (itemValue instanceof JSONObject) {
-					JSONObject valueInner = (JSONObject) itemValue;
-					for (String itemKeyInner : valueInner.keySet()) {
-						Object itemValueInner = valueInner.get(itemKeyInner);
-						if (itemKeyInner.equals("ref")) {
-							String refString = (itemValueInner).toString();
-							result.put(refString, false);
-						} else if (itemKeyInner.equals("in") || itemKeyInner.equals("notin")) {
-							parseSet(itemValueInner, result);
-						}
-					}
-				}
-			}
-		}
-	}
-
-	private static void parseSet(Object setDesc, Map<String, Boolean> result) {
-		if (setDesc instanceof JSONArray) {
-			return;
-		}
-
-		JSONObject descSet = (JSONObject) setDesc;
-		if (descSet.get("Source") != null) {
-			String Source = (descSet.get("Source")).toString();
-			if (Source.equals("ref")) {
-				String refString = (descSet.get("ref")).toString();
-				result.put(refString, true);
-			}
-		} else if (descSet.get("SetOperator") != null) {
-			String SetOperator = (descSet.get("SetOperator")).toString();
-			if (SetOperator.equals("add") || SetOperator.equals("merge") || SetOperator.equals("unite")) {
-				JSONArray SetArray = (JSONArray) descSet.get("SetArray");
-				for (Object SetArrayItem : SetArray) {
-					parseSet(SetArrayItem, result);
-				}
-			} else if (SetOperator.equals("sub")) {
-				parseSet(descSet.get("Set1"), result);
-				parseSet(descSet.get("Set2"), result);
-			}
-		} else {
-			query(descSet, result);
-		}
-	}
-}

+ 0 - 133
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/CompareUtil.java

@@ -1,133 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.util.Iterator;
-import java.util.List;
-
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-
-public class CompareUtil {
-	private static CompareUtil instance = new CompareUtil();
-
-	public static CompareUtil Instance() {
-		return instance;
-	}
-
-	private CompareUtil() {
-
-	}
-
-	@SuppressWarnings("unchecked")
-	public boolean CompareObject(SceneDataValue sdv1, SceneDataValue sdv2) {
-		if (sdv1 == null && sdv2 == null) {
-			return true;
-		} else if (sdv1 == null && sdv2 != null) {
-			return false;
-		} else if (sdv1 != null && sdv2 == null) {
-			return false;
-		}
-
-		Object value1 = sdv1.value_prim.value != null ? sdv1.value_prim.value : (sdv1.value_object != null ? sdv1.value_object : sdv1.value_array);
-		Object value2 = sdv2.value_prim.value != null ? sdv2.value_prim.value : (sdv2.value_object != null ? sdv2.value_object : sdv2.value_array);
-		if (value1 == null && value2 == null) {
-			return true;
-		} else if (value1 == null && value2 != null) {
-			return false;
-		} else if (value1 != null && value2 == null) {
-			return false;
-		}
-
-		boolean result = false;
-		if (value1.getClass() == value2.getClass()) {
-			if (value1 instanceof Long && value2 instanceof Long) {
-				result = ((Long) value1).longValue() == ((Long) value2).longValue();
-			} else if (value1 instanceof Double && value2 instanceof Double) {
-				result = Math.abs(((Double) value1).doubleValue() - ((Double) value2).doubleValue()) < 0.00000001;
-			} else if (value1 instanceof Boolean && value2 instanceof Boolean) {
-				result = ((Boolean) value1).booleanValue() == ((Boolean) value2).booleanValue();
-			} else if (value1 instanceof String && value2 instanceof String) {
-				result = ((String) value1).equals((String) value2);
-			} else if (value1 instanceof SceneDataObject && value2 instanceof SceneDataObject) {
-				result = this.Compare((SceneDataObject) value1, (SceneDataObject) value2);
-			} else if (value1 instanceof List && value2 instanceof List) {
-				result = this.Compare((List<SceneDataObject>) value1, (List<SceneDataObject>) value2);
-			}
-		}
-		return result;
-	}
-
-	public boolean Compare(SceneDataObject arg1, SceneDataObject arg2) {
-		if (arg1 == null && arg2 == null) {
-			return true;
-		} else if (arg1 == null && arg2 != null) {
-			return false;
-		} else if (arg1 != null && arg2 == null) {
-			return false;
-		}
-
-		if (arg1.size() != arg2.size()) {
-			return false;
-		}
-
-		Iterator<String> keys = arg1.keySet().iterator();
-		while (keys.hasNext()) {
-			String key = (String) keys.next();
-			if (arg2.containsKey(key)) {
-				SceneDataValue value1 = arg1.get(key);
-				SceneDataValue value2 = arg2.get(key);
-
-				boolean equal = this.CompareObject(value1, value2);
-				if (!equal) {
-					return false;
-				}
-			} else {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public boolean Compare(List<SceneDataObject> arg1, List<SceneDataObject> arg2) {
-		if (arg1 == null && arg2 == null) {
-			return true;
-		} else if (arg1 == null && arg2 != null) {
-			return false;
-		} else if (arg1 != null && arg2 == null) {
-			return false;
-		}
-
-		if (arg1.size() != arg2.size()) {
-			return false;
-		}
-
-		{
-			boolean[] useArray = new boolean[arg1.size()];
-			for (int i = 0; i < arg1.size(); i++) {
-				SceneDataObject value1 = arg1.get(i);
-
-				// 在arg2中匹配
-				boolean find = false;
-				for (int ii = 0; ii < arg1.size(); ii++) {
-					if (useArray[ii]) {
-						continue;
-					}
-
-					SceneDataObject value2 = arg2.get(ii);
-
-					boolean equal = this.Compare(value1, value2);
-					if (equal) {
-						useArray[ii] = true;
-						find = true;
-						break;
-					}
-				}
-
-				// 匹配失败,返回
-				if (!find) {
-					return false;
-				}
-			}
-			return true;
-		}
-	}
-}

+ 0 - 626
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ComputeUtil.java

@@ -1,626 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataPrimitive;
-import com.persagy.ibms.data.sdk.data.SceneDataSet;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-import com.persagy.ibms.data.sdk.data.SceneObject;
-import com.persagy.ibms.data.sdk.data.SceneProperty;
-import com.sagacloud.ExpressionUtil;
-import com.sagacloud.advanced.expression.AdvancedExpressionScanner;
-import com.sagacloud.advanced.expression.AdvancedExpressionWalker;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class ComputeUtil {
-
-	public static void DoRepository(Repository Repository, boolean load_physical_world) throws Exception {
-		if (load_physical_world) {
-			log.warn("LoadPhysicalWorld");
-			RWDLoadUtil.LoadPhysicalWorld(Repository);
-			log.warn("LoadReference");
-			RWDLoadUtil.LoadReference(Repository);
-			log.warn("LoadAlarm");
-			if (Constant.alarm_enable) {
-				RWDLoadUtil.LoadAlarm(Repository, false);
-			} else {
-				RWDLoadUtil.LoadAlarm(Repository, true);
-			}
-			log.warn("LoadIBMSPhysicalWorld");
-			RWDLoadUtil.LoadIBMSPhysicalWorld(Repository);
-		} else {
-			Repository.objTypeMap = RepositoryBase.instance.objTypeMap;
-			Repository.code2objTypeMap = RepositoryBase.instance.code2objTypeMap;
-			Repository.infoArrayDic = RepositoryBase.instance.infoArrayDic;
-			Repository.objectArrayDic = RepositoryBase.instance.objectArrayDic;
-			Repository.objectArrayAll = RepositoryBase.instance.objectArrayAll;
-			Repository.objType2id2Value = RepositoryBase.instance.objType2id2Value;
-			Repository.relationArrayDic = RepositoryBase.instance.relationArrayDic;
-			Repository.id2object = RepositoryBase.instance.id2object;
-			Repository.id2sdv = RepositoryBase.instance.id2sdv;
-			Repository.IBMSArrayDic = RepositoryBase.instance.IBMSArrayDic;
-		}
-
-		log.warn("LoadConfig");
-		SceneObject sceneObject = new SceneObject();
-		JSONObject sceneJSON = FastJsonReaderUtil.Instance().ReadJSONObject(new File(Constant.getLatestPath(Constant.config, false)));
-		FastJsonUtil.Set_JavaObject(sceneJSON, sceneObject);
-		Repository.sceneObject = sceneObject;
-
-		Repository.property2SDV_enable = true;
-		Repository.property2SDV.clear();
-		ComputeUtil.RefreshRepository(Repository);
-		List<List<SceneProperty>> spListList = ComputeUtil.computePrepare(Repository);
-		log.warn("computeAll");
-		ComputeUtil.computeAll(Repository, spListList);
-		try {
-			DeamonUtil.Process(Repository);
-		} catch (Exception e) {
-			log.error(e.getMessage(), e);
-		}
-		Repository.property2SDV_enable = false;
-		Repository.property2SDV.clear();
-	}
-
-	public static void RefreshRepository(Repository Repository) {
-		Repository.o2p = new HashMap<SceneObject, SceneProperty>();
-		Repository.p2p = new HashMap<SceneProperty, SceneProperty>();
-		Repository.p2o = new HashMap<SceneProperty, SceneObject>();
-		Repository.p2scanner = new HashMap<SceneProperty, AdvancedExpressionScanner>();
-		Repository.p2walker = new HashMap<SceneProperty, AdvancedExpressionWalker>();
-		RefreshObject(Repository, null, Repository.sceneObject, false);
-	}
-
-	private static void RefreshObject(Repository Repository, SceneProperty parentSP, SceneObject so, boolean so_is_sai) {
-		if (parentSP != null) {
-			if (so_is_sai) {
-				Repository.sai2p.put(so, parentSP);
-			} else {
-				Repository.o2p.put(so, parentSP);
-			}
-		}
-		for (SceneProperty sp : so.propertyList) {
-			RefreshProperty(Repository, so, null, sp, so_is_sai);
-		}
-	}
-
-	private static void RefreshProperty(Repository Repository, SceneObject parentSO, SceneProperty parentSP, SceneProperty sp, boolean so_is_sai) {
-		if (parentSO != null) {
-			if (so_is_sai) {
-				Repository.p2sai.put(sp, parentSO);
-			} else {
-				Repository.p2o.put(sp, parentSO);
-			}
-		}
-		if (parentSP != null) {
-			Repository.p2p.put(sp, parentSP);
-		}
-		if (sp.query_attached != null) {
-			for (SceneProperty spInner : sp.query_attached) {
-				RefreshProperty(Repository, null, sp, spInner, false);
-			}
-		}
-		if (sp.custom_object != null) {
-			RefreshObject(Repository, sp, sp.custom_object, false);
-		}
-		if (sp.static_array != null) {
-			for (SceneObject SO : sp.static_array) {
-				RefreshObject(Repository, sp, SO, true);
-			}
-		}
-	}
-
-	public static List<List<SceneProperty>> computePrepare(Repository Repository) throws Exception {
-		// 先整理顺序
-		List<SceneProperty> spList = getAll(Repository.sceneObject);
-		// 处理expression
-		for (SceneProperty spInner : spList) {
-			if (spInner.propertyValueType.equals("query")) {
-				try {
-					JSONObject sql_json = JSON.parseObject(spInner.query_sql);
-					if (sql_json.containsKey("QueryType")) {
-						String QueryType = (String) sql_json.get("QueryType");
-						if (QueryType.equals("expression")) {
-							String expression = (String) sql_json.get("expression");
-							JSONObject CriteriaObject = (JSONObject) sql_json.get("Criteria");
-							ExpressionUtil.buildAndPut(Repository, spInner, expression, CriteriaObject);
-						}
-					}
-				} catch (Exception e) {
-					log.error(spInner.query_sql);
-					throw e;
-				}
-			}
-		}
-		log.info("****************");
-		for (SceneProperty spInner : spList) {
-			// 打印路径
-			{
-				String path = getPropertyPath(Repository, spInner);
-				log.info("getPropertyBefore:" + path);
-			}
-			{
-				List<SceneProperty> beforeList = CheckUtil.getPropertyBefore(Repository, spInner);
-				Repository.beforeDic.put(spInner, beforeList);
-				for (SceneProperty spInner2 : beforeList) {
-					log.info(getPropertyPath(Repository, spInner2));
-				}
-			}
-		}
-		Map<SceneProperty, Boolean> processedDic = new HashMap<SceneProperty, Boolean>();
-		List<List<SceneProperty>> spListList = new ArrayList<List<SceneProperty>>();
-		while (true) {
-			int count_curr = 0;
-			List<SceneProperty> spInnerList = new ArrayList<SceneProperty>();
-			for (SceneProperty spInner : spList) {
-				if (processedDic.containsKey(spInner)) {
-					continue;
-				}
-				List<SceneProperty> beforeList = Repository.beforeDic.get(spInner);
-				boolean all_finish = true;
-				for (SceneProperty sp_before : beforeList) {
-					if (!processedDic.containsKey(sp_before)) {
-						all_finish = false;
-						break;
-					}
-				}
-				if (all_finish) {
-					count_curr++;
-					spInnerList.add(spInner);
-				}
-			}
-			if (count_curr == 0) {
-				break;
-			}
-			spListList.add(spInnerList);
-			for (SceneProperty spInner : spInnerList) {
-				processedDic.put(spInner, true);
-			}
-		}
-		log.info("****************************************************************");
-		for (List<SceneProperty> spInnerList : spListList) {
-			log.info("********************************");
-			for (SceneProperty spInner2 : spInnerList) {
-				log.info(getPropertyPath(Repository, spInner2));
-				if (!Repository.property2SDV.containsKey(spInner2)) {
-					Repository.property2SDV.put(spInner2, new ArrayList<SceneDataValue>());
-				}
-			}
-			log.info("********************************");
-		}
-		log.info("****************************************************************");
-
-		return spListList;
-	}
-
-	public static String getPropertyPath(Repository Repository, SceneProperty spInner) throws Exception {
-		Object parentData = spInner;
-		List<SceneProperty> tmpList = new ArrayList<SceneProperty>();
-		while (true) {
-			if (parentData == null) {
-				break;
-			}
-			if (parentData instanceof SceneProperty) {
-				SceneProperty tmpProperty = (SceneProperty) parentData;
-				tmpList.add(tmpProperty);
-				if (Repository.p2p.containsKey(tmpProperty)) {
-					parentData = Repository.p2p.get(tmpProperty);
-				} else if (Repository.p2o.containsKey(tmpProperty)) {
-					parentData = Repository.o2p.get(Repository.p2o.get(tmpProperty));
-				} else if (Repository.p2sai.containsKey(tmpProperty)) {
-					parentData = Repository.p2sai.get(tmpProperty);
-				} else {
-					throw new Exception();
-				}
-			} else if (parentData instanceof SceneObject) {
-				SceneObject tmpObject = (SceneObject) parentData;
-				if (Repository.sai2p.containsKey(tmpObject)) {
-					parentData = Repository.sai2p.get(tmpObject);
-				} else if (parentData == Repository.sceneObject) {
-					break;
-				} else {
-					throw new Exception();
-				}
-			}
-		}
-
-		StringBuffer sb = new StringBuffer();
-		for (int i = tmpList.size() - 1; i >= 0; i--) {
-			SceneProperty ss = tmpList.get(i);
-			if (sb.length() > 0) {
-				sb.append("-");
-			}
-			sb.append(ss.propertyName);
-		}
-		return sb.toString();
-	}
-
-	private static List<SceneProperty> getAll(SceneObject so) {
-		List<SceneProperty> result = new ArrayList<SceneProperty>();
-		for (SceneProperty sp : so.propertyList) {
-			List<SceneProperty> resultinner = getAll(sp);
-			result.addAll(resultinner);
-		}
-		return result;
-	}
-
-	private static List<SceneProperty> getAll(SceneProperty sp) {
-		List<SceneProperty> result = new ArrayList<SceneProperty>();
-		if (sp.propertyValueType.equals("static")) {
-			result.add(sp);
-			if (sp.propertyValueSchema.equals("JSONArray")) {
-				if (sp.static_array == null) {
-					sp.static_array = new SceneObject[0];
-				}
-				for (SceneObject SceneObject : sp.static_array) {
-					List<SceneProperty> resultinner = getAll(SceneObject);
-					result.addAll(resultinner);
-				}
-				if (sp.query_attached != null) {
-					for (SceneProperty spInner : sp.query_attached) {
-						List<SceneProperty> resultinner = getAll(spInner);
-						result.addAll(resultinner);
-					}
-				}
-			}
-		} else if (sp.propertyValueType.equals("query")) {
-			result.add(sp);
-			if (sp.query_attached != null) {
-				for (SceneProperty spInner : sp.query_attached) {
-					List<SceneProperty> resultinner = getAll(spInner);
-					result.addAll(resultinner);
-				}
-			}
-		} else if (sp.propertyValueType.equals("custom")) {
-			if (sp.custom_object == null) {
-				sp.custom_object = new SceneObject();
-			}
-			result = getAll(sp.custom_object);
-		} else if (sp.propertyValueType.equals("deamon")) {
-			result.add(sp);
-		}
-		return result;
-	}
-
-	public static void computeAll(Repository Repository, List<List<SceneProperty>> spListList) throws Exception {
-		// 开始计算
-		Repository.objectData = new SceneDataObject(Repository, null, null, null, Repository.sceneObject, null, null);
-		for (List<SceneProperty> spInnerList : spListList) {
-			for (SceneProperty spInner2 : spInnerList) {
-				// 打印路径
-				{
-					Object parentData = spInner2;
-					List<SceneProperty> tmpList = new ArrayList<SceneProperty>();
-					while (true) {
-						if (parentData == null) {
-							break;
-						}
-						if (parentData instanceof SceneProperty) {
-							SceneProperty tmpProperty = (SceneProperty) parentData;
-							tmpList.add(tmpProperty);
-							if (Repository.p2p.containsKey(tmpProperty)) {
-								parentData = Repository.p2p.get(tmpProperty);
-							} else if (Repository.p2o.containsKey(tmpProperty)) {
-								parentData = Repository.o2p.get(Repository.p2o.get(tmpProperty));
-							} else if (Repository.p2sai.containsKey(tmpProperty)) {
-								parentData = Repository.p2sai.get(tmpProperty);
-							} else {
-								throw new Exception();
-							}
-						} else {
-							SceneObject tmpObject = (SceneObject) parentData;
-							if (Repository.sai2p.containsKey(tmpObject)) {
-								parentData = Repository.sai2p.get(tmpObject);
-							} else if (parentData == Repository.sceneObject) {
-								break;
-							} else {
-								throw new Exception();
-							}
-						}
-					}
-					StringBuffer sb = new StringBuffer();
-					for (int i = tmpList.size() - 1; i >= 0; i--) {
-						SceneProperty ss = tmpList.get(i);
-						if (sb.length() > 0) {
-							sb.append("-");
-						}
-						sb.append(ss.propertyName);
-					}
-					log.info("computeOnce:" + sb.toString());
-					// if (sb.toString().equals("基础对象-品质-公共照明-照明空间-清单-照明状态")) {
-					// System.out.println();
-					// }
-				}
-				// 打印路径
-				List<SceneDataValue> sdvList = Repository.property2SDV.get(spInner2);
-				for (SceneDataValue sdv : sdvList) {
-					computeProperty(Repository, sdv);
-				}
-			}
-		}
-	}
-
-	public static void computeProperty(Repository Repository, SceneDataValue sv) throws Exception {
-		String svPath = RecursiveUtil.getDataPath(sv);
-		log.debug(svPath);
-		// if (svPath.equals("基础对象.设备.[电梯].设备类型.[直梯].清单.[Eq4403070003d6f62fb297c64106b3bd17517a5b7f0c].状态")) {
-		// System.out.println();
-		// }
-		SceneDataObject objectData = sv.parentObjectData;
-		SceneProperty sceneProperty = sv.rel_property;
-		if (sceneProperty.propertyValueType.equals("static")) {
-			if (sv.rel_property.propertyValueSchema.equals("JSONObject")) {
-				sv.finish = true;
-			} else if (sv.rel_property.propertyValueSchema.equals("JSONArray")) {
-				boolean finish = true;
-				for (SceneDataObject sdbInner : sv.value_array.set) {
-					if (sdbInner instanceof SceneDataObject) {
-						SceneDataObject SODInner = (SceneDataObject) sdbInner;
-						for (String keySOD : SODInner.keySet()) {
-							SceneDataValue SVInner = SODInner.get(keySOD);
-							if (!SVInner.finish) {
-								finish = false;
-								break;
-							}
-						}
-						if (!finish) {
-							break;
-						}
-					}
-				}
-				if (finish) {
-					sv.finish = true;
-				}
-			} else {
-				sv.value_prim = new SceneDataPrimitive();
-				sv.value_prim.value = QueryUtil.parse_static(sceneProperty.propertyValueSchema, sceneProperty.static_value);
-				sv.value_prim.change = false;
-				sv.finish = true;
-			}
-		} else if (sceneProperty.propertyValueType.equals("query")) {
-			JSONObject sql_json = (JSONObject) JSON.parse(sceneProperty.query_sql);
-			Object queryResult = QueryUtil.query(Repository, sv, sql_json, new QueryAssist());
-			if (sceneProperty.propertyValueSchema.equals("JSONObject")) {
-				// 结果集的聚合选择等等
-				SceneDataObject queryResultObject = null;
-				if (queryResult instanceof SceneDataObject) {
-					queryResultObject = (SceneDataObject) queryResult;
-				} else if (queryResult instanceof SceneDataSet) {
-					SceneDataSet queryResultArray = (SceneDataSet) queryResult;
-					if (queryResultArray.set.size() == 1) {
-						queryResultObject = queryResultArray.set.get(0);
-					}
-				}
-				sv.value_object = new SceneDataObject(Repository, objectData, sceneProperty.propertyName, null, null, sceneProperty.query_attached,
-						queryResultObject);
-				if (queryResult instanceof SceneDataObject) {
-					queryResultObject = (SceneDataObject) queryResult;
-					sv.value_object.setRowChange(queryResultObject.getRowChange());
-					sv.value_object.setColChange(queryResultObject.getColChange());
-				} else if (queryResult instanceof SceneDataSet) {
-					SceneDataSet queryResultArray = (SceneDataSet) queryResult;
-					sv.value_object.setRowChange(queryResultArray.getRowChange());
-					sv.value_object.setColChange(queryResultArray.getColChange());
-				}
-			} else if (sceneProperty.propertyValueSchema.equals("JSONArray")) {
-				SceneDataSet array = (SceneDataSet) queryResult;
-				if (array.isSingleValueSet) {
-					sv.value_array = new SceneDataSet(true);
-					for (int i = 0; i < array.singleValueSet.size(); i++) {
-						SceneDataValue arrayItem = array.singleValueSet.get(i);
-						SceneDataValue sod = new SceneDataValue(Repository, null, null, null);
-						sod.value_prim = new SceneDataPrimitive();
-						sod.value_prim.value = arrayItem.value_prim.value;
-						sv.value_array.singleValueSet.add(sod);
-					}
-				} else {
-					sv.value_array = new SceneDataSet(false);
-					for (int i = 0; i < array.set.size(); i++) {
-						SceneDataObject arrayItem = array.set.get(i);
-						SceneDataObject sod = new SceneDataObject(Repository, null, null, sv, null, sceneProperty.query_attached, arrayItem);
-						sv.value_array.set.add(sod);
-					}
-				}
-				sv.value_array.setRowChange(array.getRowChange());
-				sv.value_array.setColChange(array.getColChange());
-			} else {
-				sv.value_prim = new SceneDataPrimitive();
-				// 计算并放入objectData中
-				if (queryResult instanceof SceneDataSet) {
-					SceneDataSet sdvListInner = (SceneDataSet) queryResult;
-					if (sdvListInner.singleValueSet.size() == 0) {
-					} else if (sdvListInner.singleValueSet.size() == 1) {
-						sv.value_prim.value = sdvListInner.singleValueSet.get(0).value_prim.value;
-					} else {
-					}
-					sv.value_prim.setRowChange(sdvListInner.getRowChange());
-				} else {
-					SceneDataPrimitive sdp = (SceneDataPrimitive) queryResult;
-					sv.value_prim.value = sdp.value;
-					sv.value_prim.setRowChange(sdp.getRowChange());
-				}
-				if (sv.value_prim.getRowChange()) {
-					// 需要向上影响ColChange
-					if (sv.parentObjectData.parentArrayData != null) {
-						if (!sv.parentObjectData.parentArrayData.value_array.getRowChange()) {
-							sv.parentObjectData.parentArrayData.value_array.setColChange(sv.myPropertyName);
-						}
-					} else {
-						if (!sv.parentObjectData.getRowChange()) {
-							sv.parentObjectData.setColChange(sv.myPropertyName);
-						}
-					}
-				}
-				if (sceneProperty.propertyValueSchema.equals("int")) {
-					if (sv.value_prim.value != null) {
-						Object jt = sv.value_prim.value;
-						int jtValue;
-						if (jt instanceof Integer) {
-							jtValue = ((Integer) jt).intValue();
-						} else if (jt instanceof Long) {
-							jtValue = ((Long) jt).intValue();
-						} else if (jt instanceof Float) {
-							jtValue = ((Float) jt).intValue();
-						} else {
-							jtValue = ((Double) jt).intValue();
-						}
-						sv.value_prim.value = jtValue;
-					}
-				} else if (sceneProperty.propertyValueSchema.equals("double")) {
-					if (sv.value_prim.value != null) {
-						Object jt = sv.value_prim.value;
-						double jtValue;
-						if (jt instanceof Integer) {
-							jtValue = ((Integer) jt).doubleValue();
-						} else if (jt instanceof Long) {
-							jtValue = ((Long) jt).doubleValue();
-						} else if (jt instanceof Float) {
-							jtValue = ((Float) jt).doubleValue();
-						} else {
-							jtValue = ((Double) jt).doubleValue();
-						}
-						sv.value_prim.value = jtValue;
-					}
-				}
-			}
-			sv.finish = true;
-		} else if (sceneProperty.propertyValueType.equals("custom")) {
-			if (sv.value_object == null) {
-				sv.value_object = new SceneDataObject(Repository, objectData, sceneProperty.propertyName, null, sceneProperty.custom_object, null,
-						null);
-			}
-		} else if (sceneProperty.propertyValueType.equals("deamon")) {
-			JSONObject sql_json = (JSONObject) JSON.parse(sceneProperty.query_sql);
-			String QueryType = (String) sql_json.get("QueryType");
-			if (QueryType.endsWith("trend")) {
-				sv.value_prim = new SceneDataPrimitive();
-				sv.value_prim.value = 0;
-				sv.value_prim.setRowChange(true);
-			} else if (QueryType.endsWith("curve")) {
-				sv.value_array = new SceneDataSet(false);
-				sv.value_array.set = new ArrayList<SceneDataObject>();
-				sv.value_array.setRowChange(true);
-			}
-			JSONObject Criteria = (JSONObject) sql_json.get("Criteria");
-			List<String> pointList = new ArrayList<String>();
-			for (String key : Criteria.keySet()) {
-				JSONObject CriteriaItemValue = (JSONObject) Criteria.get(key);
-				String refString = (String) CriteriaItemValue.get("ref");
-				SceneDataSet sdvList = QueryUtil.parseSetRef(Repository, sv, refString, new QueryAssist(), false, true);
-				for (SceneDataValue sdvInner : sdvList.singleValueSet) {
-					String point = RepositoryBase.sdv2point.get(sdvInner);
-					pointList.add(point);
-				}
-			}
-			Repository.deamon_sdv2pointList.put(sv, pointList);
-		}
-		sv.last_compute_time = new Date();
-	}
-
-	public static Object getValueObject(Repository Repository, String[] valuePath) {
-		int index = 0;
-		Object tmpData = Repository.objectData.get(valuePath[index]);
-		index++;
-		while (index < valuePath.length) {
-			if (tmpData instanceof SceneDataValue) {
-				SceneDataValue currData = (SceneDataValue) tmpData;
-				currData = currData.value_object.get(valuePath[index]);
-				tmpData = currData;
-				if (currData.value_array != null) {
-					if (index < valuePath.length - 1) {
-						index++;
-						SceneDataObject matchItem = null;
-						for (SceneDataObject sdbInner : currData.value_array.set) {
-							SceneDataObject sodInner = (SceneDataObject) sdbInner;
-							if (sodInner.containsKey("id") && sodInner.get("id").value_prim.value.equals(valuePath[index])) {
-								matchItem = sodInner;
-								break;
-							}
-						}
-						if (matchItem == null) {
-							for (SceneDataObject sdbInner : currData.value_array.set) {
-								SceneDataObject sodInner = (SceneDataObject) sdbInner;
-								if (sodInner.containsKey("名称") && sodInner.get("名称").value_prim.value.equals(valuePath[index])) {
-									matchItem = sodInner;
-									break;
-								}
-							}
-						}
-						tmpData = matchItem;
-					}
-				}
-			} else if (tmpData instanceof SceneDataObject) {
-				SceneDataObject currSOD = (SceneDataObject) tmpData;
-				SceneDataValue currData = currSOD.get(valuePath[index]);
-				tmpData = currData;
-				if (currData.value_array != null) {
-					if (index < valuePath.length - 1) {
-						index++;
-						SceneDataObject matchItem = null;
-						for (SceneDataObject sdbInner : currData.value_array.set) {
-							SceneDataObject sodInner = (SceneDataObject) sdbInner;
-							if (sodInner.containsKey("id") && sodInner.get("id").value_prim.value.equals(valuePath[index])) {
-								matchItem = sodInner;
-								break;
-							}
-						}
-						if (matchItem == null) {
-							for (SceneDataObject sdbInner : currData.value_array.set) {
-								SceneDataObject sodInner = (SceneDataObject) sdbInner;
-								if (sodInner.containsKey("名称") && sodInner.get("名称").value_prim.value.equals(valuePath[index])) {
-									matchItem = sodInner;
-									break;
-								}
-							}
-						}
-						tmpData = matchItem;
-					}
-				}
-			} else {
-				break;
-			}
-
-			index++;
-		}
-		return tmpData;
-	}
-
-	public static Object getValueJSON(Object tmpData) {
-		Object result;
-		if (tmpData instanceof SceneDataValue) {
-			SceneDataValue currData = (SceneDataValue) tmpData;
-			int read_level = currData.rel_property == null ? 1 : Integer.parseInt(currData.rel_property.read_level);
-			result = currData.toJSON(true, read_level == 0 ? -1 : read_level);
-		} else {
-			SceneDataObject currData = (SceneDataObject) tmpData;
-			int read_level = (currData.parentArrayData != null && currData.parentArrayData.rel_property != null)
-					? Integer.parseInt(currData.parentArrayData.rel_property.read_level) : 1;
-			result = currData.toJSON(read_level == 0 ? -1 : read_level);
-		}
-
-		return result;
-	}
-
-	public static Object getValueJSON(Object tmpData, int read_level) {
-		Object result;
-		if (tmpData instanceof SceneDataValue) {
-			SceneDataValue currData = (SceneDataValue) tmpData;
-			result = currData.toJSON(true, read_level == 0 ? -1 : read_level);
-		} else {
-			SceneDataObject currData = (SceneDataObject) tmpData;
-			result = currData.toJSON(read_level == 0 ? -1 : read_level);
-		}
-
-		return result;
-	}
-}

+ 2 - 2
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/Constant.java

@@ -66,12 +66,12 @@ public class Constant {
 					iter = document.selectNodes("/root/groupCode").iterator();
 					if (iter.hasNext()) {
 						element = (Element) iter.next();
-						RepositoryBase.groupCode = element.getText();
+						RepositoryContainer.RepositoryBase.groupCode = element.getText();
 					}
 					iter = document.selectNodes("/root/projectId").iterator();
 					if (iter.hasNext()) {
 						element = (Element) iter.next();
-						RepositoryBase.projectId = element.getText();
+						RepositoryContainer.RepositoryBase.projectId = element.getText();
 					}
 					iter = document.selectNodes("/root/sdk_version").iterator();
 					if (iter.hasNext()) {

+ 12 - 11
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ControlUtil.java

@@ -5,16 +5,17 @@ import java.util.List;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-import com.persagy.ibms.data.sdk.data.SceneDataPrimitive;
+import com.persagy.ibms.core.data.SceneDataObject;
+import com.persagy.ibms.core.data.SceneDataPrimitive;
+import com.persagy.ibms.core.data.SceneDataValue;
+import com.persagy.ibms.core.util.ComputeUtil;
 
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 public class ControlUtil {
 	public static void setControlValue(JSONArray path, JSONObject infoValueSet) {
-		JSONObject exist_value = RepositoryBase.controlValueMap.putIfAbsent(path.toJSONString(), infoValueSet);
+		JSONObject exist_value = RepositoryContainer.RepositoryBase.controlValueMap.putIfAbsent(path.toJSONString(), infoValueSet);
 		if (exist_value != null) {
 			String[] info_codes = infoValueSet.keySet().toArray(new String[0]);
 			for (String info_code : info_codes) {
@@ -24,14 +25,14 @@ public class ControlUtil {
 	}
 
 	public static JSONObject getControlValue(JSONArray path) {
-		JSONObject result = RepositoryBase.controlValueMap.get(path.toString());
+		JSONObject result = RepositoryContainer.RepositoryBase.controlValueMap.get(path.toString());
 		if (result == null) {
 			result = new JSONObject();
 		}
 		return result;
 	}
 
-	public static JSONArray set(Repository Repository, JSONArray path, String[] valuePath, JSONObject infoValueSet) throws Exception {
+	public static JSONArray set(RepositoryImpl Repository, JSONArray path, String[] valuePath, JSONObject infoValueSet) throws Exception {
 		setControlValue(path, infoValueSet);
 
 		JSONArray result;
@@ -53,7 +54,7 @@ public class ControlUtil {
 		return result;
 	}
 
-	private static JSONArray set(Repository Repository, SceneDataObject object, JSONObject infoValueSet) throws Exception {
+	private static JSONArray set(RepositoryImpl Repository, SceneDataObject object, JSONObject infoValueSet) throws Exception {
 		JSONArray result;
 		if (object.containsKey("清单")) {
 			SceneDataValue list = object.get("清单");
@@ -65,7 +66,7 @@ public class ControlUtil {
 		return result;
 	}
 
-	private static JSONArray setInner(Repository Repository, SceneDataObject object, JSONObject infoValueSet) throws Exception {
+	private static JSONArray setInner(RepositoryImpl Repository, SceneDataObject object, JSONObject infoValueSet) throws Exception {
 		JSONArray points = new JSONArray();
 		build_points(Repository, object, infoValueSet, points);
 		build_object(object, infoValueSet);
@@ -73,7 +74,7 @@ public class ControlUtil {
 		return result;
 	}
 
-	private static JSONArray setInner(Repository Repository, SceneDataValue detail, List<SceneDataObject> objectArray, JSONObject infoValueSet)
+	private static JSONArray setInner(RepositoryImpl Repository, SceneDataValue detail, List<SceneDataObject> objectArray, JSONObject infoValueSet)
 			throws Exception {
 		if (detail != null) {
 			build_object(detail.value_object, infoValueSet);
@@ -87,7 +88,7 @@ public class ControlUtil {
 		return result;
 	}
 
-	private static void build_points(Repository Repository, SceneDataObject object, JSONObject infoValueSet, JSONArray points) {
+	private static void build_points(RepositoryImpl Repository, SceneDataObject object, JSONObject infoValueSet, JSONArray points) {
 		String id = (String) object.get("id").value_prim.value;
 		JSONObject obj = Repository.id2object.get(id);
 		for (String key : infoValueSet.keySet()) {
@@ -117,7 +118,7 @@ public class ControlUtil {
 
 	private static JSONArray post(JSONArray points) throws Exception {
 		JSONObject postJSON = new JSONObject();
-		postJSON.put("building", RepositoryBase.projectId.substring(2));
+		postJSON.put("building", RepositoryContainer.RepositoryBase.projectId.substring(2));
 		postJSON.put("points", points);
 		String post_url = Constant.iot_project_url + "sync_pointsetbatch_post";
 		log.debug(postJSON.toJSONString());

+ 0 - 86
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/DataUtil.java

@@ -1,86 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.List;
-
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-import com.persagy.ibms.data.sdk.data.SceneDataPrimitive;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class DataUtil {
-	public static List<SceneDataObject> avg(List<List<SceneDataObject>> dataListList) throws Exception {
-		List<SceneDataObject> result = new ArrayList<SceneDataObject>();
-		int[] indexs = new int[dataListList.size()];
-		while (true) {
-			String data_time_min = null;
-			int min_index = -1;
-			for (int i = 0; i < dataListList.size(); i++) {
-				List<SceneDataObject> dataListInner = dataListList.get(i);
-				if (indexs[i] < dataListInner.size()) {
-					SceneDataObject datainner = (SceneDataObject) dataListInner.get(indexs[i]);
-					SceneDataValue sdvInner = datainner.get("data_time");
-					String data_time = (String) sdvInner.value_prim.value;
-					if (data_time_min == null || data_time_min.compareTo(data_time) > 0) {
-						data_time_min = data_time;
-						min_index = i;
-					}
-				}
-			}
-			if (min_index == -1) {
-				break;
-			}
-
-			SceneDataObject avgData = new SceneDataObject(null, null, null, null, null, null, null);
-			int totalCount = 0;
-			double totalValue = 0.0;
-			for (int i = 0; i < dataListList.size(); i++) {
-				List<SceneDataObject> dataListInner = dataListList.get(i);
-				if (indexs[i] < dataListInner.size()) {
-					SceneDataObject datainner = (SceneDataObject) dataListInner.get(indexs[i]);
-					SceneDataValue sdvInner = datainner.get("data_time");
-					String data_time = (String) sdvInner.value_prim.value;
-					if (data_time.equals(data_time_min)) {
-						totalCount++;
-						totalValue += DataUtil.primitive2double(datainner.get("data_value").value_prim.value);
-						indexs[i]++;
-					}
-				}
-			}
-			SceneDataValue data_time = new SceneDataValue(null, null, null, null);
-			data_time.value_prim = new SceneDataPrimitive();
-			data_time.value_prim.value = data_time_min;
-			SceneDataValue data_value = new SceneDataValue(null, null, null, null);
-			data_value.value_prim = new SceneDataPrimitive();
-			data_value.value_prim.value = totalValue / totalCount;
-			avgData.put("data_time", data_time);
-			avgData.put("data_value", data_value);
-			result.add(avgData);
-		}
-
-		return result;
-	}
-
-	public static double primitive2double(Object value_primitive) throws Exception {
-		if (value_primitive instanceof Integer) {
-			return ((Integer) value_primitive).doubleValue();
-		} else if (value_primitive instanceof Long) {
-			return ((Long) value_primitive).doubleValue();
-		} else if (value_primitive instanceof BigInteger) {
-			return ((BigInteger) value_primitive).doubleValue();
-		} else if (value_primitive instanceof Float) {
-			return ((Float) value_primitive).doubleValue();
-		} else if (value_primitive instanceof Double) {
-			return ((Double) value_primitive).doubleValue();
-		} else if (value_primitive instanceof BigDecimal) {
-			return ((BigDecimal) value_primitive).doubleValue();
-		} else {
-			log.error("primitive2double: " + value_primitive + "\t" + value_primitive.getClass().getName());
-			throw new Exception();
-		}
-	}
-}

+ 11 - 8
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/DeamonUtil.java

@@ -10,14 +10,17 @@ import java.util.Map;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
+import com.persagy.ibms.core.data.SceneDataObject;
+import com.persagy.ibms.core.data.SceneDataValue;
+import com.persagy.ibms.core.util.DataUtil;
+import com.persagy.ibms.core.util.RWDUtil;
+import com.persagy.ibms.core.util.RepositoryBase;
 
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
 public class DeamonUtil {
-	public static void Process(Repository Repository) throws Exception {
+	public static void Process(RepositoryBase Repository) throws Exception {
 		log.warn("deamon start");
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
 		Map<String, Boolean> pointMap = new HashMap<String, Boolean>();
@@ -68,11 +71,11 @@ public class DeamonUtil {
 			if (pointList.size() == 0) {
 				continue;
 			} else if (pointList.size() == 1) {
-				dataList = RepositoryBase.point2curve.get(pointList.get(0));
+				dataList = RepositoryContainer.RepositoryBase.point2curve.get(pointList.get(0));
 			} else {
 				List<List<SceneDataObject>> dataListList = new ArrayList<List<SceneDataObject>>();
 				for (String point : pointList) {
-					List<SceneDataObject> dataListInner = RepositoryBase.point2curve.get(point);
+					List<SceneDataObject> dataListInner = RepositoryContainer.RepositoryBase.point2curve.get(point);
 					dataListList.add(dataListInner);
 				}
 				dataList = DataUtil.avg(dataListList);
@@ -104,9 +107,9 @@ public class DeamonUtil {
 		log.warn("deamon finish");
 	}
 
-	public static void Process(Repository Repository, JSONArray points) throws Exception {
+	public static void Process(RepositoryBase Repository, JSONArray points) throws Exception {
 		JSONObject postJSON = new JSONObject();
-		postJSON.put("building", RepositoryBase.projectId.substring(2));
+		postJSON.put("building", RepositoryContainer.RepositoryBase.projectId.substring(2));
 		postJSON.put("points", points);
 		String post_url = Constant.iot_collect_url + "fjd_query_batch_post";
 		String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString());
@@ -123,7 +126,7 @@ public class DeamonUtil {
 			JSONArray datas = (JSONArray) point.get("datas");
 			SceneDataValue sv = new SceneDataValue(null, null, null, null);
 			RWDUtil.array2SDV(datas, sv);
-			RepositoryBase.point2curve.put(meter + "-" + funcid, sv.value_array.set);
+			RepositoryContainer.RepositoryBase.point2curve.put(meter + "-" + funcid, sv.value_array.set);
 		}
 	}
 }

+ 107 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/DrawUtil.java

@@ -0,0 +1,107 @@
+package com.persagy.ibms.data.sdk.util;
+
+import java.util.Date;
+import java.util.Map;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.ibms.core.data.SceneDataObject;
+import com.persagy.ibms.core.data.SceneDataSet;
+import com.persagy.ibms.core.data.SceneDataValue;
+import com.persagy.ibms.core.util.RWDUtil;
+
+public class DrawUtil {
+
+	/**
+	 * 刷新数据节点,根据read_level
+	 * 
+	 * @param tmpData
+	 * @throws Exception
+	 */
+	public static Object drawObject(RepositoryImpl Repository, Object tmpData, Map<String, String> ObjInfo2Point) {
+		Object result = null;
+		Date currTime = new Date();
+		if (tmpData instanceof SceneDataValue) {
+			SceneDataValue currData = (SceneDataValue) tmpData;
+			int read_level = currData.rel_property == null ? 1 : Integer.parseInt(currData.rel_property.read_level);
+			read_level = read_level == 0 ? -1 : read_level;
+			result = draw(Repository, currData, read_level, currTime, ObjInfo2Point);
+		} else if (tmpData instanceof SceneDataObject) {
+			SceneDataObject currData = (SceneDataObject) tmpData;
+			int read_level = (currData.parentArrayData != null && currData.parentArrayData.rel_property != null)
+					? Integer.parseInt(currData.parentArrayData.rel_property.read_level) : 1;
+			read_level = read_level == 0 ? -1 : read_level;
+			result = draw(Repository, currData, read_level, currTime, ObjInfo2Point);
+		}
+		return result;
+	}
+
+	private static JSONObject draw(RepositoryImpl Repository, SceneDataObject sdo, int depth, Date currTime, Map<String, String> ObjInfo2Point) {
+		if (sdo == null) {
+			return null;
+		}
+		int depthInner = depth == -1 ? -1 : (depth > 0 ? depth - 1 : 0);
+		if (sdo.containsKey("id")) {
+			JSONObject result = new JSONObject();
+			String id = (String) sdo.get("id").value_prim.value;
+			result.put("id", id);
+			JSONObject obj = Repository.id2object.get(id);
+			String classCode = (String) obj.get("classCode");
+			SceneDataSet infoArray = Repository.infoArrayDic.get(classCode);
+			for (String Key : obj.keySet()) {
+				if (obj.get(Key) != null && obj.get(Key) instanceof String) {
+					if (RWDUtil.isRunParam(infoArray.set, Key)) {
+						String infoValue = (String) obj.get(Key);
+						if (RWDUtil.infoValue_is_point(infoValue)) {
+							result.put(Key, "point:" + infoValue);
+							ObjInfo2Point.put(id + "-" + Key, infoValue);
+						}
+					}
+				}
+			}
+			return result;
+		} else if (sdo.containsKey("名称") && sdo.containsKey("清单")) {
+			JSONObject result = new JSONObject();
+			result.put("名称", sdo.get("名称").value_prim.value);
+			Object list = draw(Repository, (SceneDataValue) sdo.get("清单"), depthInner, currTime, ObjInfo2Point);
+			result.put("清单", list);
+			return result;
+		} else {
+			return null;
+		}
+	}
+
+	private static Object draw(RepositoryImpl Repository, SceneDataValue sdv, int depth, Date currTime, Map<String, String> ObjInfo2Point) {
+		if (sdv == null) {
+			return null;
+		}
+
+		int curr_depth = depth;
+		if (sdv.rel_property != null && curr_depth != -1) {
+			curr_depth -= Integer.parseInt(sdv.rel_property.offset_level);
+			if (curr_depth < 0) {
+				return null;
+			}
+		}
+
+		if (depth > 0 || depth == -1) {
+			if (sdv.value_object != null) {
+				JSONObject result = draw(Repository, sdv.value_object, curr_depth, currTime, ObjInfo2Point);
+				return result;
+			} else if (sdv.value_array != null) {
+				JSONArray result = new JSONArray();
+				for (int i = 0; i < sdv.value_array.set.size(); i++) {
+					SceneDataObject sdb = sdv.value_array.set.get(i);
+					if (sdb instanceof SceneDataObject) {
+						SceneDataObject sod = (SceneDataObject) sdb;
+						JSONObject resultItem = draw(Repository, sod, curr_depth, currTime, ObjInfo2Point);
+						result.add(resultItem);
+					}
+				}
+				return result;
+			}
+		}
+
+		return null;
+	}
+}

+ 0 - 308
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/FastJsonCompareUtil.java

@@ -1,308 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Iterator;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-
-@SuppressWarnings("rawtypes")
-public class FastJsonCompareUtil {
-	private static FastJsonCompareUtil instance = new FastJsonCompareUtil();
-
-	public static FastJsonCompareUtil Instance() {
-		return instance;
-	}
-
-	private FastJsonCompareUtil() {
-
-	}
-
-	/***
-	 * objectSet中是否包含属性名为content的JSONArray属性值,该JSONArray包含object
-	 * 
-	 * @param objectSet
-	 * @param content
-	 * @param object
-	 * @return
-	 */
-	public boolean Contain(JSONObject objectSet, String content, JSONObject object) {
-		if (objectSet == null) {
-			return false;
-		}
-		if (!objectSet.containsKey(content)) {
-			return false;
-		}
-		Object contentObject = objectSet.get(content);
-		if (!(contentObject instanceof JSONArray)) {
-			return false;
-		}
-		JSONArray contentArray = (JSONArray) contentObject;
-		for (int i = 0; i < contentArray.size(); i++) {
-			Object itemObject = contentArray.get(i);
-			if (!(itemObject instanceof JSONObject)) {
-				continue;
-			}
-			JSONObject jsonItem = (JSONObject) itemObject;
-			if (this.Compare(jsonItem, object, false)) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	public boolean Contain(JSONArray objectSet, Object object, String[] keys) {
-		if (object == null) {
-			return true;
-		} else {
-			if (objectSet == null) {
-				return false;
-			}
-		}
-
-		for (int i = 0; i < objectSet.size(); i++) {
-			if (this.CompareObject(objectSet.get(i), object, keys)) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	public boolean Contain(JSONArray objectSet, Object object) {
-		if (object == null) {
-			return true;
-		} else {
-			if (objectSet == null) {
-				return false;
-			}
-		}
-
-		for (int i = 0; i < objectSet.size(); i++) {
-			if (this.CompareObject(objectSet.get(i), object, false)) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	public boolean Contain(JSONObject objectSet, JSONObject object) {
-		if (object == null) {
-			return true;
-		} else {
-			if (objectSet == null) {
-				return false;
-			}
-		}
-
-		Iterator<String> keyIter = object.keySet().iterator();
-		while (keyIter.hasNext()) {
-			String key = keyIter.next();
-			Object value = object.get(key);
-
-			if (!objectSet.containsKey(key)) {
-				return false;
-			} else {
-				Object valueSet = objectSet.get(key);
-				if (!this.CompareObject(valueSet, value, false)) {
-					return false;
-				}
-			}
-		}
-
-		return true;
-	}
-
-	/***
-	 * 比较两个对象是否相等,对象类型可以是4种简单类型或者JSONObject、JSONArray
-	 * 
-	 * @param value1
-	 * @param value2
-	 * @return
-	 */
-	public boolean CompareObject(Object value1, Object value2) {
-		return this.CompareObject(value1, value2, false);
-	}
-
-	public boolean CompareObject(Object value1, Object value2, boolean sequence) {
-		if (value1 == null && value2 == null) {
-			return true;
-		} else if (value1 == null && value2 != null) {
-			return false;
-		} else if (value1 != null && value2 == null) {
-			return false;
-		}
-
-		boolean result = false;
-		if (value1.getClass() == value2.getClass()) {
-			if (value1 instanceof Integer && value2 instanceof Integer) {
-				result = ((Integer) value1).intValue() == ((Integer) value2).intValue();
-			} else if (value1 instanceof Long && value2 instanceof Long) {
-				result = ((Long) value1).longValue() == ((Long) value2).longValue();
-			} else if (value1 instanceof BigInteger && value2 instanceof BigInteger) {
-				result = ((BigInteger) value1).longValue() == ((BigInteger) value2).longValue();
-			} else if (value1 instanceof Float && value2 instanceof Float) {
-				result = Math.abs(((Float) value1).floatValue() - ((Float) value2).floatValue()) < 0.00000001;
-			} else if (value1 instanceof Double && value2 instanceof Double) {
-				result = Math.abs(((Double) value1).doubleValue() - ((Double) value2).doubleValue()) < 0.00000001;
-			} else if (value1 instanceof BigDecimal && value2 instanceof BigDecimal) {
-				result = Math.abs(((BigDecimal) value1).doubleValue() - ((BigDecimal) value2).doubleValue()) < 0.00000001;
-			} else if (value1 instanceof Boolean && value2 instanceof Boolean) {
-				result = ((Boolean) value1).booleanValue() == ((Boolean) value2).booleanValue();
-			} else if (value1 instanceof String && value2 instanceof String) {
-				result = ((String) value1).equals((String) value2);
-			} else if (value1 instanceof JSONObject && value2 instanceof JSONObject) {
-				result = this.Compare((JSONObject) value1, (JSONObject) value2, sequence);
-			} else if (value1 instanceof JSONArray && value2 instanceof JSONArray) {
-				result = this.Compare((JSONArray) value1, (JSONArray) value2, sequence);
-			}
-		}
-		return result;
-	}
-
-	public boolean CompareObject(Object value1, Object value2, String[] keys) {
-		if (value1 == null && value2 == null) {
-			return true;
-		} else if (value1 == null && value2 != null) {
-			return false;
-		} else if (value1 != null && value2 == null) {
-			return false;
-		}
-
-		boolean result = false;
-		result = this.Compare((JSONObject) value1, (JSONObject) value2, keys);
-		return result;
-	}
-
-	/***
-	 * 比较两个JSONObject是否相等,顺序无所谓
-	 * 
-	 * @param arg1
-	 * @param arg2
-	 * @return
-	 */
-	public boolean Compare(JSONObject arg1, JSONObject arg2) {
-		return this.Compare(arg1, arg2, false);
-	}
-
-	public boolean Compare(JSONObject arg1, JSONObject arg2, boolean sequence) {
-		if (arg1 == null && arg2 == null) {
-			return true;
-		} else if (arg1 == null && arg2 != null) {
-			return false;
-		} else if (arg1 != null && arg2 == null) {
-			return false;
-		}
-
-		if (arg1.size() != arg2.size()) {
-			return false;
-		}
-
-		Iterator keys = arg1.keySet().iterator();
-		while (keys.hasNext()) {
-			String key = (String) keys.next();
-			if (arg2.containsKey(key)) {
-				Object value1 = arg1.get(key);
-				Object value2 = arg2.get(key);
-
-				boolean equal = this.CompareObject(value1, value2, sequence);
-				if (!equal) {
-					return false;
-				}
-			} else {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public boolean Compare(JSONObject arg1, JSONObject arg2, String[] keys) {
-		if (arg1 == null && arg2 == null) {
-			return true;
-		} else if (arg1 == null && arg2 != null) {
-			return false;
-		} else if (arg1 != null && arg2 == null) {
-			return false;
-		}
-
-		for (String key : keys) {
-			if (arg1.containsKey(key) && arg2.containsKey(key)) {
-				Object value1 = arg1.get(key);
-				Object value2 = arg2.get(key);
-				if (!this.CompareObject(value1, value2, false)) {
-					return false;
-				}
-			} else if (!arg1.containsKey(key) && arg2.containsKey(key)) {
-				return false;
-			} else if (arg1.containsKey(key) && !arg2.containsKey(key)) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	/***
-	 * 比较两个JSONArray是否相等,顺序无所谓
-	 * 
-	 * @param arg1
-	 * @param arg2
-	 * @return
-	 */
-	public boolean Compare(JSONArray arg1, JSONArray arg2) {
-		return this.Compare(arg1, arg2, false);
-	}
-
-	public boolean Compare(JSONArray arg1, JSONArray arg2, boolean sequence) {
-		if (arg1 == null && arg2 == null) {
-			return true;
-		} else if (arg1 == null && arg2 != null) {
-			return false;
-		} else if (arg1 != null && arg2 == null) {
-			return false;
-		}
-
-		if (arg1.size() != arg2.size()) {
-			return false;
-		}
-
-		if (sequence) {
-			for (int i = 0; i < arg1.size(); i++) {
-				Object value1 = arg1.get(i);
-				Object value2 = arg2.get(i);
-				boolean equal = this.CompareObject(value1, value2, true);
-				if (!equal) {
-					return false;
-				}
-			}
-			return true;
-		} else {
-			boolean[] useArray = new boolean[arg1.size()];
-			for (int i = 0; i < arg1.size(); i++) {
-				Object value1 = arg1.get(i);
-
-				// 在arg2中匹配
-				boolean find = false;
-				for (int ii = 0; ii < arg1.size(); ii++) {
-					if (useArray[ii]) {
-						continue;
-					}
-
-					Object value2 = arg2.get(ii);
-
-					boolean equal = this.CompareObject(value1, value2, false);
-					if (equal) {
-						useArray[ii] = true;
-						find = true;
-						break;
-					}
-				}
-
-				// 匹配失败,返回
-				if (!find) {
-					return false;
-				}
-			}
-			return true;
-		}
-	}
-}

+ 0 - 94
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/FastJsonReaderUtil.java

@@ -1,94 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Reader;
-import java.io.Writer;
-import java.nio.charset.Charset;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.JSONReader;
-import com.alibaba.fastjson.JSONWriter;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-
-public class FastJsonReaderUtil {
-	private static FastJsonReaderUtil instance = new FastJsonReaderUtil();
-
-	public static FastJsonReaderUtil Instance() {
-		return instance;
-	}
-
-	private FastJsonReaderUtil() {
-
-	}
-
-	public Object parse(byte[] JSON_bytes) throws Exception {
-		return this.parse(new String(JSON_bytes, "UTF-8"));
-	}
-
-	public Object parse(String JSONString) throws Exception {
-		Object result = JSON.parse(JSONString);
-		FastJsonUtil.Normalize(result);
-		return result;
-	}
-
-	public JSONObject ReadJSONObject(File file) throws Exception {
-		Object result = this.Read(file);
-		if (result == null) {
-			return null;
-		} else {
-			FastJsonUtil.Normalize(result);
-			return (JSONObject) result;
-		}
-	}
-
-	public JSONArray ReadJSONArray(File file) throws Exception {
-		Object result = this.Read(file);
-		if (result == null) {
-			return null;
-		} else {
-			FastJsonUtil.Normalize(result);
-			return (JSONArray) result;
-		}
-	}
-
-	public Object Read(File file) throws Exception {
-		Object result = null;
-
-		InputStream is = new FileInputStream(file);
-		Reader reader = new InputStreamReader(is, Charset.forName("UTF-8"));
-		JSONReader json_reader = new JSONReader(reader);
-		result = json_reader.readObject();
-		json_reader.close();
-		reader.close();
-		is.close();
-
-		return result;
-	}
-
-	public void Write(JSONObject result, String filepath) throws Exception {
-		this.WriteInner(result, filepath);
-	}
-
-	public void Write(JSONArray result, String filepath) throws Exception {
-		this.WriteInner(result, filepath);
-	}
-
-	private void WriteInner(Object result, String filepath) throws Exception {
-		OutputStream os = new FileOutputStream(filepath);
-		Writer writer = new OutputStreamWriter(os);
-		JSONWriter json_writer = new JSONWriter(writer);
-		json_writer.config(SerializerFeature.WriteMapNullValue, false);
-		json_writer.writeObject(result);
-		json_writer.close();
-		writer.close();
-		os.close();
-	}
-}

+ 0 - 595
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/FastJsonUtil.java

@@ -1,595 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.lang.reflect.Array;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Method;
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-
-public class FastJsonUtil {
-	public static Set<Object> ValueArray2ValueSet(JSONArray valueArray) {
-		Set<Object> valueSet = new HashSet<Object>();
-		for (int index_va = 0; index_va < valueArray.size(); index_va++) {
-			Object valueItem = valueArray.get(index_va);
-			valueSet.add(valueItem);
-		}
-		return valueSet;
-	}
-
-	public static JSONArray ValueSet2ValueArray(Set<Object> valueSet) {
-		JSONArray valueArray = new JSONArray();
-		Iterator<Object> valueIter = valueSet.iterator();
-		while (valueIter.hasNext()) {
-			Object valueItem = valueIter.next();
-			valueArray.add(valueItem);
-		}
-		return valueArray;
-	}
-
-	public static Set<Object> ValueSet_or(List<Set<Object>> valueSetList) {
-		Set<Object> result = new HashSet<Object>();
-		for (int i = 0; i < valueSetList.size(); i++) {
-			Set<Object> valueSet = valueSetList.get(i);
-			result.addAll(valueSet);
-		}
-		return result;
-	}
-
-	public static Set<Object> ValueSet_and(List<Set<Object>> valueSetList) {
-		Set<Object> result = new HashSet<Object>();
-		Set<Object> first = valueSetList.get(0);
-		Iterator<Object> valueIter = first.iterator();
-		while (valueIter.hasNext()) {
-			Object valueItem = valueIter.next();
-			boolean all_in = true;
-			for (int i = 1; i < valueSetList.size(); i++) {
-				Set<Object> valueSet = valueSetList.get(i);
-				if (!valueSet.contains(valueItem)) {
-					all_in = false;
-					break;
-				}
-			}
-			if (all_in) {
-				result.add(valueItem);
-			}
-		}
-		return result;
-	}
-
-	public static Set<Object> ValueSet_sub(Set<Object> valueSet1, Set<Object> valueSet2) {
-		Set<Object> result = new HashSet<Object>();
-		Iterator<Object> valueIter = valueSet1.iterator();
-		while (valueIter.hasNext()) {
-			Object valueItem = valueIter.next();
-			if (!valueSet2.contains(valueItem)) {
-				result.add(valueItem);
-			}
-		}
-		return result;
-	}
-
-	public static String toFormatString(Object value) {
-		return toStringInner(value, true);
-	}
-
-	public static String toString(Object value) {
-		return toStringInner(value, false);
-	}
-
-	private static String toStringInner(Object value, boolean has_enter) {
-		if (value == null)
-			return "null";
-
-		if (value instanceof String) {
-			StringBuffer sb = new StringBuffer();
-			escape((String) value, sb);
-			return "\"" + sb.toString() + "\"";
-		}
-
-		if (value instanceof Double) {
-			if (((Double) value).isInfinite() || ((Double) value).isNaN())
-				return "null";
-			else
-				return value.toString();
-		}
-
-		if (value instanceof Float) {
-			if (((Float) value).isInfinite() || ((Float) value).isNaN())
-				return "null";
-			else
-				return value.toString();
-		}
-
-		if (value instanceof Number)
-			return value.toString();
-
-		if (value instanceof Boolean)
-			return value.toString();
-
-		if (value instanceof JSONObject) {
-			JSONObject valueJSON = (JSONObject) value;
-			StringBuffer sb = new StringBuffer();
-			boolean first = true;
-			Iterator<String> iter = valueJSON.keySet().iterator();
-
-			sb.append('{');
-			while (iter.hasNext()) {
-				String key = iter.next();
-
-				if (first)
-					first = false;
-				else
-					sb.append(',');
-
-				if (has_enter) {
-					sb.append("\r\n\t");
-				}
-
-				sb.append('\"');
-				escape(key, sb);
-				sb.append('\"').append(':');
-				String valueString = toStringInner(valueJSON.get(key), has_enter);
-				sb.append(valueString.replaceAll("\r\n", "\r\n\t"));
-			}
-			if (has_enter) {
-				sb.append("\r\n");
-			}
-			sb.append('}');
-			return sb.toString();
-		}
-
-		if (value instanceof JSONArray) {
-			JSONArray valueJSON = (JSONArray) value;
-			boolean first = true;
-			StringBuffer sb = new StringBuffer();
-
-			sb.append('[');
-			for (int i = 0; i < valueJSON.size(); i++) {
-				if (first)
-					first = false;
-				else
-					sb.append(',');
-
-				if (has_enter) {
-					sb.append("\r\n\t");
-				}
-
-				Object valueInner = valueJSON.get(i);
-				if (valueInner == null) {
-					sb.append("null");
-					continue;
-				}
-				String valueString = toStringInner(valueInner, has_enter);
-				sb.append(valueString.replaceAll("\r\n", "\r\n\t"));
-			}
-			if (has_enter) {
-				sb.append("\r\n");
-			}
-			sb.append(']');
-			return sb.toString();
-
-		}
-
-		return value.toString();
-	}
-
-	public static void escape(String s, StringBuffer sb) {
-		for (int i = 0; i < s.length(); i++) {
-			char ch = s.charAt(i);
-			switch (ch) {
-			case '"':
-				sb.append("\\\"");
-				break;
-			case '\\':
-				sb.append("\\\\");
-				break;
-			case '\b':
-				sb.append("\\b");
-				break;
-			case '\f':
-				sb.append("\\f");
-				break;
-			case '\n':
-				sb.append("\\n");
-				break;
-			case '\r':
-				sb.append("\\r");
-				break;
-			case '\t':
-				sb.append("\\t");
-				break;
-			case '/':
-				sb.append("\\/");
-				break;
-			default:
-				// Reference: http://www.unicode.org/versions/Unicode5.1.0/
-				if ((ch >= '\u0000' && ch <= '\u001F') || (ch >= '\u007F' && ch <= '\u009F') || (ch >= '\u2000' && ch <= '\u20FF')) {
-					String ss = Integer.toHexString(ch);
-					sb.append("\\u");
-					for (int k = 0; k < 4 - ss.length(); k++) {
-						sb.append('0');
-					}
-					sb.append(ss.toUpperCase());
-				} else {
-					sb.append(ch);
-				}
-			}
-		} // for
-	}
-
-	public static Long getLong(JSONObject json, String name) throws Exception {
-		if (json.containsKey(name)) {
-			Object item = json.get(name);
-			if (item instanceof Integer) {
-				return ((Integer) item).longValue();
-			} else if (item instanceof Long) {
-				return ((Long) item).longValue();
-			} else if (item instanceof BigInteger) {
-				return ((BigInteger) item).longValue();
-			} else {
-				throw new Exception("FastJsonUtil: " + "JSON property " + name + " cant Cast to Long:"
-						+ JSONObject.toJSONString(json, SerializerFeature.WriteMapNullValue));
-			}
-		} else {
-			return null;
-		}
-	}
-
-	public static Long getDouble(JSONObject json, String name) throws Exception {
-		if (json.containsKey(name)) {
-			Object item = json.get(name);
-			if (item instanceof Integer) {
-				return ((Integer) item).longValue();
-			} else if (item instanceof Long) {
-				return ((Long) item).longValue();
-			} else if (item instanceof BigInteger) {
-				return ((BigInteger) item).longValue();
-			} else if (item instanceof Float) {
-				return ((Float) item).longValue();
-			} else if (item instanceof Double) {
-				return ((Double) item).longValue();
-			} else if (item instanceof BigDecimal) {
-				return ((BigDecimal) item).longValue();
-			} else {
-				throw new Exception("FastJsonUtil: " + "JSON property " + name + " cant Cast to Double:"
-						+ JSONObject.toJSONString(json, SerializerFeature.WriteMapNullValue));
-			}
-		} else {
-			return null;
-		}
-	}
-
-	public static void Set_JSON(Object entity, JSONObject json) throws Exception {
-		Class<?> targetClass = entity.getClass();
-
-		Method[] targetMethodArray = targetClass.getMethods();
-		for (int i = 0; i < targetMethodArray.length; i++) {
-			Method method = targetMethodArray[i];
-			int modifiers = method.getModifiers();
-			String methodName = method.getName();
-			if (modifiers == 1 && methodName.startsWith("get")) {
-				Class<?>[] parameterTypes = method.getParameterTypes();
-				if (parameterTypes.length == 0) {
-					String fieldName = methodName.substring(3);
-					fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
-					if (json.containsKey(fieldName)) {
-						json.remove(fieldName);
-					}
-					Object value = method.invoke(entity, new Object[] {});
-					if (value != null) {
-						String valueClassName = value.getClass().getName();
-						Object put_value = null;
-						if (valueClassName.equals("java.lang.String")) {
-							put_value = value;
-						} else if (valueClassName.equals("java.util.Date")) {
-							SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
-							put_value = sdf.format((Date) value);
-						} else if (valueClassName.equals("java.lang.Long") || valueClassName.equals("long")) {
-							put_value = value;
-						} else if (valueClassName.equals("java.lang.Double") || valueClassName.equals("double")) {
-							put_value = value;
-						} else if (valueClassName.equals("java.lang.Boolean") || valueClassName.equals("boolean")) {
-							put_value = value;
-						} else {
-							put_value = To_JSON(value);
-						}
-
-						json.put(fieldName, put_value);
-					}
-				}
-			}
-		}
-	}
-
-	public static void Set_JavaObject(JSONObject json, Object entity) throws Exception {
-		Class<?> targetClass = entity.getClass();
-
-		if (json == null) {
-			return;
-		}
-
-		Method[] targetMethodArray = targetClass.getMethods();
-		for (int i = 0; i < targetMethodArray.length; i++) {
-			Method method = targetMethodArray[i];
-			int modifiers = method.getModifiers();
-			String methodName = method.getName();
-			if (modifiers == 1 && methodName.startsWith("set")) {
-				Class<?>[] parameterTypes = method.getParameterTypes();
-				if (parameterTypes.length == 1) {
-					// 自适应大小写
-					{
-						String fieldName = methodName.substring(3);
-						fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
-						Class<?> paramClass = parameterTypes[0];
-						if (json.containsKey(fieldName)) {
-							Object sourceFieldValue = json.get(fieldName);
-							Object targetFieldValue = To_JavaObject(sourceFieldValue, paramClass);
-
-							method.invoke(entity, new Object[] { targetFieldValue });
-						}
-					}
-					{
-						String fieldName = methodName.substring(3);
-						Class<?> paramClass = parameterTypes[0];
-						if (json.containsKey(fieldName)) {
-							Object sourceFieldValue = json.get(fieldName);
-							Object targetFieldValue = To_JavaObject(sourceFieldValue, paramClass);
-
-							method.invoke(entity, new Object[] { targetFieldValue });
-						}
-					}
-				}
-			}
-		}
-	}
-
-	public static Object To_JSON(Object source) throws Exception {
-		Class<?> sourceClass = source.getClass();
-		if (sourceClass.isArray()) {
-			JSONArray result = new JSONArray();
-			int array_length = Array.getLength(source);
-			for (int i = 0; i < array_length; i++) {
-				Object item = Array.get(source, i);
-				result.add(To_JSON(item));
-			}
-			return result;
-		} else {
-			JSONObject result = new JSONObject();
-			Method[] meethodArray = sourceClass.getMethods();
-			for (int i = 0; i < meethodArray.length; i++) {
-				Method method = meethodArray[i];
-				int modifiers = method.getModifiers();
-				String methodName = method.getName();
-				if (modifiers == 1 && methodName.startsWith("get")) {
-					Class<?>[] parameterTypes = method.getParameterTypes();
-					if (parameterTypes.length == 0) {
-						String fieldName = methodName.substring(3);
-						fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
-						Object value = method.invoke(source, new Object[] {});
-						Object put_value;
-						if (value == null) {
-							put_value = null;
-						} else {
-							String valueClassName = value.getClass().getName();
-							if (valueClassName.equals("java.lang.String")) {
-								put_value = value;
-							} else if (valueClassName.equals("java.util.Date")) {
-								SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
-								put_value = sdf.format(value);
-							} else if (valueClassName.equals("java.lang.Long") || valueClassName.equals("long")) {
-								put_value = value;
-							} else if (valueClassName.equals("java.lang.Double") || valueClassName.equals("double")) {
-								put_value = value;
-							} else if (valueClassName.equals("java.lang.Boolean") || valueClassName.equals("boolean")) {
-								put_value = value;
-							} else {
-								put_value = To_JSON(value);
-							}
-						}
-						result.put(fieldName, put_value);
-					}
-				}
-			}
-			return result;
-		}
-	}
-
-	public static Object To_JavaObject(Object json, Class<?> entityClass) throws Exception {
-		if (json == null) {
-			return null;
-		}
-
-		String targetClassName = entityClass.getName();
-		if (json instanceof JSONArray && entityClass.isArray()) {
-			JSONArray sourceEntity = (JSONArray) json;
-			int sourceLength = sourceEntity.size();
-
-			Class<?> targetComponentType = entityClass.getComponentType();
-			Object targetObjectArray = Array.newInstance(targetComponentType, sourceLength);
-
-			for (int i = 0; i < sourceLength; i++) {
-				Object sourceObject = sourceEntity.get(i);
-
-				Object targetObject = To_JavaObject(sourceObject, targetComponentType);
-				Array.set(targetObjectArray, i, targetObject);
-			}
-
-			return targetObjectArray;
-		} else if (json instanceof JSONObject) {
-			JSONObject sourceEntity = (JSONObject) json;
-
-			Constructor<?> constructorMethod = entityClass.getConstructor(new Class<?>[] {});
-			Object targetObject = constructorMethod.newInstance(new Object[] {});
-			Method[] methodArray = entityClass.getMethods();
-			for (int i = 0; i < methodArray.length; i++) {
-				Method method = methodArray[i];
-				int modifiers = method.getModifiers();
-				String methodName = method.getName();
-				if (modifiers == 1 && methodName.startsWith("set")) {
-					Class<?>[] parameterTypes = method.getParameterTypes();
-					if (parameterTypes.length == 1) {
-						// 自适应大小写
-						{
-							String fieldName = methodName.substring(3);
-							fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
-							Class<?> paramClass = parameterTypes[0];
-							if (sourceEntity.containsKey(fieldName)) {
-								Object sourceFieldValue = sourceEntity.get(fieldName);
-								Object targetFieldValue = To_JavaObject(sourceFieldValue, paramClass);
-
-								method.invoke(targetObject, new Object[] { targetFieldValue });
-							}
-						}
-						{
-							String fieldName = methodName.substring(3);
-							Class<?> paramClass = parameterTypes[0];
-							if (sourceEntity.containsKey(fieldName)) {
-								Object sourceFieldValue = sourceEntity.get(fieldName);
-								Object targetFieldValue = To_JavaObject(sourceFieldValue, paramClass);
-
-								method.invoke(targetObject, new Object[] { targetFieldValue });
-							}
-						}
-					}
-				}
-			}
-
-			return targetObject;
-		} else if (json instanceof String && targetClassName.equals("java.lang.String")) {
-			return (String) json;
-		} else if (json instanceof String && targetClassName.equals("java.util.Date")) {
-			SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
-			return sdf.parse((String) json);
-		} else if (targetClassName.equals("java.lang.Long") || targetClassName.equals("long")) {
-			if (json instanceof String) {
-				Long value = Long.parseLong((String) json);
-				return value;
-			} else if (json instanceof Integer) {
-				return ((Integer) json).longValue();
-			} else if (json instanceof Long) {
-				return ((Long) json).longValue();
-			} else if (json instanceof BigInteger) {
-				return ((BigInteger) json).longValue();
-			} else {
-				return null;
-			}
-		} else if (targetClassName.equals("java.lang.Double") || targetClassName.equals("double")) {
-			if (json instanceof String) {
-				Double value = Double.parseDouble((String) json);
-				return value;
-			} else if (json instanceof Integer) {
-				return ((Integer) json).doubleValue();
-			} else if (json instanceof Long) {
-				return ((Long) json).doubleValue();
-			} else if (json instanceof BigInteger) {
-				return ((BigInteger) json).doubleValue();
-			} else if (json instanceof Float) {
-				return ((Float) json).doubleValue();
-			} else if (json instanceof Double) {
-				return ((Double) json).doubleValue();
-			} else if (json instanceof BigDecimal) {
-				return ((BigDecimal) json).doubleValue();
-			} else {
-				return null;
-			}
-		} else if (targetClassName.equals("java.lang.Boolean") || targetClassName.equals("boolean")) {
-			if (json instanceof String) {
-				Boolean value = ((String) json).equalsIgnoreCase("true") ? true : false;
-				return value;
-			} else if (json instanceof Boolean) {
-				Boolean value = (Boolean) json;
-				return value;
-			} else {
-				return null;
-			}
-		} else {
-			return null;
-		}
-	}
-
-	public static void Normalize(Object source) {
-		if (source instanceof JSONObject) {
-			JSONObject sourceJSON = (JSONObject) source;
-			Map<String, Object> newMap = new HashMap<String, Object>();
-			Iterator<String> keyIter = sourceJSON.keySet().iterator();
-			while (keyIter.hasNext()) {
-				String key = keyIter.next();
-				Object value = sourceJSON.get(key);
-				if (value == null) {
-					continue;
-				}
-				if (value instanceof Integer) {
-					newMap.put(key, ((Integer) value).longValue());
-				} else if (value instanceof Long) {
-				} else if (value instanceof BigInteger) {
-					newMap.put(key, ((BigInteger) value).longValue());
-				} else if (value instanceof Float) {
-					newMap.put(key, ((Float) value).doubleValue());
-				} else if (value instanceof Double) {
-				} else if (value instanceof BigDecimal) {
-					newMap.put(key, ((BigDecimal) value).doubleValue());
-				} else if (value instanceof JSONObject || value instanceof JSONArray) {
-					Normalize(value);
-				}
-			}
-			Iterator<String> iter2 = newMap.keySet().iterator();
-			while (iter2.hasNext()) {
-				String key = iter2.next();
-				Object value = newMap.get(key);
-				sourceJSON.remove(key);
-				sourceJSON.put(key, value);
-			}
-		} else if (source instanceof JSONArray) {
-			JSONArray sourceJSON = (JSONArray) source;
-			for (int i = 0; i < sourceJSON.size(); i++) {
-				Object sourceItem = sourceJSON.get(i);
-				if (sourceItem != null && (sourceItem instanceof JSONObject || sourceItem instanceof JSONArray)) {
-					Normalize(sourceItem);
-				}
-			}
-		}
-	}
-
-	public static Object Clone_JSON(Object source) {
-		if (source instanceof JSONObject) {
-			JSONObject result = new JSONObject();
-			JSONObject sourceJSON = (JSONObject) source;
-			Iterator<String> keyIter = sourceJSON.keySet().iterator();
-			while (keyIter.hasNext()) {
-				String key = keyIter.next();
-				Object value = sourceJSON.get(key);
-				result.put(key, Clone_JSON(value));
-			}
-			return result;
-		} else if (source instanceof JSONArray) {
-			JSONArray result = new JSONArray();
-			JSONArray sourceJSON = (JSONArray) source;
-			for (int i = 0; i < sourceJSON.size(); i++) {
-				result.add(Clone_JSON(sourceJSON.get(i)));
-			}
-			return result;
-		} else if (source instanceof String) {
-			return source;
-		} else if (source instanceof Double) {
-			return source;
-		} else if (source instanceof Long) {
-			return source;
-		} else if (source instanceof Boolean) {
-			return source;
-		}
-
-		return null;
-	}
-}

+ 4 - 1
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/FileUtil.java

@@ -7,6 +7,9 @@ import java.io.OutputStreamWriter;
 import java.util.HashMap;
 import java.util.Map;
 
+import com.persagy.ibms.core.util.FastJsonCompareUtil;
+import com.persagy.ibms.core.util.FastJsonReaderUtil;
+
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
@@ -73,7 +76,7 @@ public class FileUtil {
 			Object json1 = FastJsonReaderUtil.Instance().Read(file1);
 			Object json2 = FastJsonReaderUtil.Instance().Read(file2);
 			boolean file_compare = FastJsonCompareUtil.Instance().CompareObject(json1, json2);
-			log.debug(LogUtil.refreshLoggerName + "\t" + "Compare " + file1.getPath() + " " + file2.getPath() + "\t" + file_compare);
+			log.debug("Compare " + file1.getPath() + " " + file2.getPath() + "\t" + file_compare);
 			return file_compare;
 		} else {
 			return false;

+ 0 - 9
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/IntWrapper.java

@@ -1,9 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-public class IntWrapper {
-	public int value;
-
-	public IntWrapper() {
-		this.value = 0;
-	}
-}

+ 0 - 205
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/LogUtil.java

@@ -1,205 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-public class LogUtil {
-	// private static Logger logger;
-	// private static Map<String, Logger> loggerMap = new HashMap<String, Logger>();
-	public static String refreshLoggerName = "refreshLogger";
-
-	// static {
-	// try {
-	// String resource = "/log4j.properties";
-	// URL resourceUrl = LogUtil.class.getResource(resource);
-	// String resourcePath = null;
-	// if (resourceUrl == null) {
-	// resourcePath = System.getProperty("user.dir") + resource;
-	// } else {
-	// resourcePath = resourceUrl.getPath();
-	// }
-	// String GetPath = resourcePath.substring(0, resourcePath.length() - resource.length());
-	// String filepathLog4j = GetPath + "/log4j.properties";
-	// File fileLog4j = new File(filepathLog4j);
-	// if (fileLog4j.exists()) {
-	// PropertyConfigurator.configure(URLDecoder.decode(filepathLog4j, "UTF-8"));
-	// logger = Logger.getRootLogger();
-	// Logger loggerInner = Logger.getLogger(refreshLoggerName);
-	// loggerMap.put(refreshLoggerName, loggerInner);
-	// } else {
-	// PropertyConfigurator.configure(LogUtil.class.getResourceAsStream("/log4j.properties"));
-	// logger = Logger.getRootLogger();
-	// Logger loggerInner = Logger.getLogger(refreshLoggerName);
-	// loggerMap.put(refreshLoggerName, loggerInner);
-	// }
-	// } catch (Exception e) {
-	// e.printStackTrace();
-	// }
-	// }
-	//
-	// public static void debug(String message) {
-	// debug(null, message);
-	// }
-	//
-	// public static void info(String message) {
-	// info(null, message);
-	// }
-	//
-	// public static void warn(String message) {
-	// warn(null, message);
-	// }
-	//
-	// public static void error(String message) {
-	// error(null, message);
-	// }
-	//
-	// public static void fatal(String message) {
-	// fatal(null, message);
-	// }
-	//
-	// public static void debug(Exception e) {
-	// debug(null, e);
-	// }
-	//
-	// public static void info(Exception e) {
-	// info(null, e);
-	// }
-	//
-	// public static void warn(Exception e) {
-	// warn(null, e);
-	// }
-	//
-	// public static void error(Exception e) {
-	// error(null, e);
-	// }
-	//
-	// public static void fatal(Exception e) {
-	// fatal(null, e);
-	// }
-
-	// public static void debug(String name, String message) {
-	// Logger loggerInner = getLogger(name);
-	// if (loggerInner != null) {
-	// loggerInner.debug(message);
-	// } else {
-	// System.out.println("debug " + message);
-	// }
-	// }
-	//
-	// public static void info(String name, String message) {
-	// Logger loggerInner = getLogger(name);
-	// if (loggerInner != null) {
-	// loggerInner.info(message);
-	// } else {
-	// System.out.println("info " + message);
-	// }
-	// }
-	//
-	// public static void warn(String name, String message) {
-	// Logger loggerInner = getLogger(name);
-	// if (loggerInner != null) {
-	// loggerInner.warn(message);
-	// } else {
-	// System.out.println("warn " + message);
-	// }
-	// }
-	//
-	// public static void error(String name, String message) {
-	// Logger loggerInner = getLogger(name);
-	// if (loggerInner != null) {
-	// loggerInner.error(message);
-	// } else {
-	// System.out.println("error " + message);
-	// }
-	// }
-	//
-	// public static void fatal(String name, String message) {
-	// Logger loggerInner = getLogger(name);
-	// if (loggerInner != null) {
-	// loggerInner.fatal(message);
-	// } else {
-	// System.out.println("fatal " + message);
-	// }
-	// }
-	//
-	// public static void debug(String name, Exception e) {
-	// Logger loggerInner = getLogger(name);
-	// String message = GetExceptionStackTrace(e);
-	// if (loggerInner != null) {
-	// loggerInner.debug(message);
-	// } else {
-	// System.out.println("debug " + message);
-	// }
-	// }
-	//
-	// public static void info(String name, Exception e) {
-	// Logger loggerInner = getLogger(name);
-	// String message = GetExceptionStackTrace(e);
-	// if (loggerInner != null) {
-	// loggerInner.info(message);
-	// } else {
-	// System.out.println("info " + message);
-	// }
-	// }
-	//
-	// public static void warn(String name, Exception e) {
-	// Logger loggerInner = getLogger(name);
-	// String message = GetExceptionStackTrace(e);
-	// if (loggerInner != null) {
-	// loggerInner.warn(message);
-	// } else {
-	// System.out.println("warn " + message);
-	// }
-	// }
-	//
-	// public static void error(String name, Exception e) {
-	// Logger loggerInner = getLogger(name);
-	// String message = GetExceptionStackTrace(e);
-	// if (loggerInner != null) {
-	// loggerInner.error(message);
-	// } else {
-	// System.out.println("error " + message);
-	// }
-	// }
-	//
-	// public static void fatal(String name, Exception e) {
-	// Logger loggerInner = getLogger(name);
-	// String message = GetExceptionStackTrace(e);
-	// if (loggerInner != null) {
-	// loggerInner.fatal(message);
-	// } else {
-	// System.out.println("fatal " + message);
-	// }
-	// }
-	//
-	// private static Logger getLogger(String name) {
-	// if (name == null) {
-	// return logger;
-	// } else {
-	// return loggerMap.get(name);
-	// }
-	// }
-
-	public static String GetExceptionStackTrace(Exception e) {
-		StringBuffer sb = new StringBuffer();
-		sb.append(e.getClass().getName() + ": " + e.getMessage());
-		sb.append("\n");
-		StackTraceElement[] elements = e.getStackTrace();
-		for (int i = 0; i < elements.length; i++) {
-			StackTraceElement element = elements[i];
-			sb.append("\t" + element.getClassName() + "." + element.getMethodName() + "(" + element.getFileName() + ":" + element.getLineNumber()
-					+ ")");
-			sb.append("\n");
-		}
-		Throwable cause = e.getCause();
-		if (cause != null) {
-			sb.append("Caused by: " + cause.getClass().getName() + ": " + cause.getMessage());
-			sb.append("\n");
-			StackTraceElement[] elements2 = cause.getStackTrace();
-			for (int i = 0; i < elements2.length; i++) {
-				StackTraceElement element = elements2[i];
-				sb.append("\t" + element.getClassName() + "." + element.getMethodName() + "(" + element.getFileName() + ":" + element.getLineNumber()
-						+ ")");
-				sb.append("\n");
-			}
-		}
-		return sb.toString();
-	}
-}

+ 0 - 6
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/QueryAssist.java

@@ -1,6 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-public class QueryAssist {
-	public boolean has_select = false;
-	public boolean has_ref_ancestor = false;
-}

File diff suppressed because it is too large
+ 0 - 1330
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/QueryUtil.java


+ 21 - 20
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDAlarmUtil.java

@@ -6,10 +6,11 @@ import java.util.List;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataPrimitive;
-import com.persagy.ibms.data.sdk.data.SceneDataSet;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
+import com.persagy.ibms.core.data.SceneDataObject;
+import com.persagy.ibms.core.data.SceneDataPrimitive;
+import com.persagy.ibms.core.data.SceneDataSet;
+import com.persagy.ibms.core.data.SceneDataValue;
+import com.persagy.ibms.core.util.RWDUtil;
 
 public class RWDAlarmUtil {
 
@@ -27,24 +28,24 @@ public class RWDAlarmUtil {
 		String treatState = alarm.get("treatState").toString();
 		modify_alarm(alarm);
 		{
-			SceneDataValue alarmList = RepositoryBase.id2alarmList.get(objId);
-			SceneDataValue alarmCount = RepositoryBase.id2alarmCount.get(objId);
+			SceneDataValue alarmList = RepositoryContainer.RepositoryBase.id2alarmList.get(objId);
+			SceneDataValue alarmCount = RepositoryContainer.RepositoryBase.id2alarmCount.get(objId);
 			if (alarmList == null) {
 				SceneDataValue sv_alarmList = new SceneDataValue(null, null, "报警列表", null);
 				sv_alarmList.value_array = new SceneDataSet(false);
 				sv_alarmList.value_array.set = new ArrayList<SceneDataObject>();
 				sv_alarmList.value_array.setRowChange(true);
-				RepositoryBase.id2alarmList.putIfAbsent(objId, sv_alarmList);
+				RepositoryContainer.RepositoryBase.id2alarmList.putIfAbsent(objId, sv_alarmList);
 			}
 			if (alarmCount == null) {
 				SceneDataValue sv_alarmCount = new SceneDataValue(null, null, "报警数量", null);
 				sv_alarmCount.value_prim = new SceneDataPrimitive();
 				sv_alarmCount.value_prim.value = 0;
 				sv_alarmCount.value_prim.change = true;
-				RepositoryBase.id2alarmCount.putIfAbsent(objId, sv_alarmCount);
+				RepositoryContainer.RepositoryBase.id2alarmCount.putIfAbsent(objId, sv_alarmCount);
 			}
-			alarmList = RepositoryBase.id2alarmList.get(objId);
-			alarmCount = RepositoryBase.id2alarmCount.get(objId);
+			alarmList = RepositoryContainer.RepositoryBase.id2alarmList.get(objId);
+			alarmCount = RepositoryContainer.RepositoryBase.id2alarmCount.get(objId);
 
 			// 从设备下删除
 			int existIndex = -1;
@@ -61,38 +62,38 @@ public class RWDAlarmUtil {
 			}
 			// 从报警列表下删除
 			List<Integer> removeIndexList = new ArrayList<Integer>();
-			for (int index_alarm = 0; index_alarm < RepositoryBase.alarmArray.set.size(); index_alarm++) {
-				SceneDataObject alarmItem = RepositoryBase.alarmArray.set.get(index_alarm);
+			for (int index_alarm = 0; index_alarm < RepositoryContainer.RepositoryBase.alarmArray.set.size(); index_alarm++) {
+				SceneDataObject alarmItem = RepositoryContainer.RepositoryBase.alarmArray.set.get(index_alarm);
 				if (alarmItem.value_object.get("id").value_prim.value.equals(id)) {
 					removeIndexList.add(0, index_alarm);
 				}
 			}
 			for (int removeIndex : removeIndexList) {
-				RepositoryBase.alarmArray.set.remove(removeIndex);
+				RepositoryContainer.RepositoryBase.alarmArray.set.remove(removeIndex);
 			}
 
 			if (!treatState.equals("3")) {
 				SceneDataObject sodInner = RWDUtil.object2sod(alarm);
 				alarmList.value_array.set.add(sodInner);
-				RepositoryBase.alarmArray.set.add(sodInner);
+				RepositoryContainer.RepositoryBase.alarmArray.set.add(sodInner);
 			}
 			alarmCount.value_prim.value = alarmList.value_array.set.size();
 		}
 	}
 
 	public static synchronized int refresh() throws Exception {
-		RepositoryBase.alarmArray.set.clear();
-		String[] objIds = RepositoryBase.id2alarmList.keySet().toArray(new String[0]);
+		RepositoryContainer.RepositoryBase.alarmArray.set.clear();
+		String[] objIds = RepositoryContainer.RepositoryBase.id2alarmList.keySet().toArray(new String[0]);
 		for (String objId : objIds) {
-			RepositoryBase.id2alarmList.get(objId).value_array.set.clear();
-			RepositoryBase.id2alarmCount.get(objId).value_prim.value = 0;
+			RepositoryContainer.RepositoryBase.id2alarmList.get(objId).value_array.set.clear();
+			RepositoryContainer.RepositoryBase.id2alarmCount.get(objId).value_prim.value = 0;
 		}
 
 		String post_url = Constant.alarm_rest + "/alarm/queryAlarmList";
 		JSONObject postParam = new JSONObject();
 		postParam.put("userId", "systemId");
-		postParam.put("groupCode", RepositoryBase.groupCode);
-		postParam.put("projectId", RepositoryBase.projectId);
+		postParam.put("groupCode", RepositoryContainer.RepositoryBase.groupCode);
+		postParam.put("projectId", RepositoryContainer.RepositoryBase.projectId);
 		JSONArray treatState = new JSONArray();
 		treatState.add(1);
 		treatState.add(2);

+ 17 - 13
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDDownloadUtil.java

@@ -9,6 +9,8 @@ import java.util.Map;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.persagy.ibms.core.util.FastJsonUtil;
+
 import lombok.extern.slf4j.Slf4j;
 
 @Slf4j
@@ -18,11 +20,11 @@ public class RWDDownloadUtil {
 		FileUtil.deleteRecursive(new File(path));
 		JSONArray classArray = null;
 		List<String> groupCodeList = new ArrayList<String>();
-		groupCodeList.add(RepositoryBase.groupCode);
-		groupCodeList.add(RepositoryBase.groupCode);
+		groupCodeList.add(RepositoryContainer.RepositoryBase.groupCode);
+		groupCodeList.add(RepositoryContainer.RepositoryBase.groupCode);
 		groupCodeList.add("0");
 		List<String> projectIdList = new ArrayList<String>();
-		projectIdList.add(RepositoryBase.projectId);
+		projectIdList.add(RepositoryContainer.RepositoryBase.projectId);
 		projectIdList.add("0");
 		projectIdList.add("0");
 		for (int i = 0; i < groupCodeList.size(); i++) {
@@ -49,7 +51,7 @@ public class RWDDownloadUtil {
 	}
 
 	public static void LoadPhysicalWorld(String path) throws Exception {
-		log.debug(LogUtil.refreshLoggerName + "\t" + "Download physical world refresh dir");
+		log.debug("Download physical world refresh dir");
 		FileUtil.deleteRecursive(new File(path));
 		{
 			File root = new File(path);
@@ -70,7 +72,7 @@ public class RWDDownloadUtil {
 			}
 		}
 
-		log.debug(LogUtil.refreshLoggerName + "\t" + "Download physical world begin " + path);
+		log.debug("Download physical world begin " + path);
 		JSONArray classArray;
 		{
 			JSONObject param = new JSONObject();
@@ -94,7 +96,7 @@ public class RWDDownloadUtil {
 				criteria.put("classCode", code);
 				criteria.put("valid", 1);
 				param.put("criteria", criteria);
-				log.debug(LogUtil.refreshLoggerName + "\t" + "Download info " + code);
+				log.debug("Download info " + code);
 				String post_result = HttpClientUtil.post(Constant.rwd_url + "rwd/def/funcid", param.toJSONString());
 				JSONObject resultJSON = JSON.parseObject(post_result);
 				infoArray = resultJSON.getJSONArray("data");
@@ -114,9 +116,10 @@ public class RWDDownloadUtil {
 				criteria.put("classCode", code);
 				criteria.put("valid", 1);
 				param.put("criteria", criteria);
-				log.debug(LogUtil.refreshLoggerName + "\t" + "Download object " + code);
-				String post_result = HttpClientUtil.post(Constant.rwd_url + "rwd/instance/object/query?projectId=" + RepositoryBase.projectId
-						+ "&groupCode=" + RepositoryBase.groupCode, param.toJSONString());
+				log.debug("Download object " + code);
+				String post_result = HttpClientUtil.post(Constant.rwd_url + "rwd/instance/object/query?projectId="
+						+ RepositoryContainer.RepositoryBase.projectId + "&groupCode=" + RepositoryContainer.RepositoryBase.groupCode,
+						param.toJSONString());
 				JSONObject resultJSON = JSON.parseObject(post_result);
 				infoArray = resultJSON.getJSONArray("data");
 			}
@@ -140,9 +143,10 @@ public class RWDDownloadUtil {
 					criteria.put("graphCode", graphCode);
 					criteria.put("relCode", relCode);
 					param.put("criteria", criteria);
-					log.debug(LogUtil.refreshLoggerName + "\t" + "Download relation " + graphCode + " " + relCode);
-					String post_result = HttpClientUtil.post(Constant.rwd_url + "rwd/instance/relation/query?projectId=" + RepositoryBase.projectId
-							+ "&groupCode=" + RepositoryBase.groupCode, param.toJSONString());
+					log.debug("Download relation " + graphCode + " " + relCode);
+					String post_result = HttpClientUtil.post(Constant.rwd_url + "rwd/instance/relation/query?projectId="
+							+ RepositoryContainer.RepositoryBase.projectId + "&groupCode=" + RepositoryContainer.RepositoryBase.groupCode,
+							param.toJSONString());
 					JSONObject resultJSON = JSON.parseObject(post_result);
 					infoArray = resultJSON.getJSONArray("data");
 				}
@@ -151,6 +155,6 @@ public class RWDDownloadUtil {
 						+ ".json", FastJsonUtil.toFormatString(infoArray));
 			}
 		}
-		log.debug(LogUtil.refreshLoggerName + "\t" + "Download physical world finish " + path);
+		log.debug("Download physical world finish " + path);
 	}
 }

+ 24 - 37
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDLoadUtil.java

@@ -10,10 +10,12 @@ import java.util.concurrent.ConcurrentHashMap;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataPrimitive;
-import com.persagy.ibms.data.sdk.data.SceneDataSet;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
+import com.persagy.ibms.core.data.SceneDataObject;
+import com.persagy.ibms.core.data.SceneDataPrimitive;
+import com.persagy.ibms.core.data.SceneDataSet;
+import com.persagy.ibms.core.data.SceneDataValue;
+import com.persagy.ibms.core.util.FastJsonReaderUtil;
+import com.persagy.ibms.core.util.RWDUtil;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -23,22 +25,7 @@ public class RWDLoadUtil {
 	public static String[] concentrate_codes = { "CO2", "PM2.5" };
 	public static String[] concentrate_names = { "CO2", "PM2.5" };
 
-	public static boolean infoValue_is_point(String infoValue) {
-		int index_ = infoValue.lastIndexOf('-');
-		if (index_ == -1 || index_ == 0 || index_ == infoValue.length() - 1) {
-			return false;
-		}
-
-		String funcid = infoValue.substring(index_ + 1);
-		try {
-			Integer.parseInt(funcid);
-			return true;
-		} catch (NumberFormatException e) {
-			return false;
-		}
-	}
-
-	public static void LoadPhysicalWorld(Repository Repository) throws Exception {
+	public static void LoadPhysicalWorld(RepositoryImpl Repository) throws Exception {
 		String validPath = Constant.getLatestPath(Constant.physical_world, true);
 
 		{
@@ -221,21 +208,21 @@ public class RWDLoadUtil {
 						}
 						String point = (String) value_primitive;
 						if (point != null) {
-							if (RWDLoadUtil.infoValue_is_point(point)) {
-								RepositoryBase.info2point.putIfAbsent(obj_id, new ConcurrentHashMap<String, String>());
-								ConcurrentHashMap<String, String> pointMap = RepositoryBase.info2point.get(obj_id);
+							if (RWDUtil.infoValue_is_point(point)) {
+								Repository.info2point.putIfAbsent(obj_id, new ConcurrentHashMap<String, String>());
+								ConcurrentHashMap<String, String> pointMap = Repository.info2point.get(obj_id);
 								pointMap.putIfAbsent(Key, point);
 								// 表号功能号改为null
 								{
 									SceneDataValue sdv = new SceneDataValue(null, null, null, null);
 									sdv.value_prim = new SceneDataPrimitive();
 									sdv.value_prim.change = true;
-									SceneDataValue exist_sdv = RepositoryBase.point2sdv.putIfAbsent(point, sdv);
+									SceneDataValue exist_sdv = RepositoryContainer.RepositoryBase.point2sdv.putIfAbsent(point, sdv);
 									if (exist_sdv == null) {
-										RepositoryBase.sdv2point.putIfAbsent(sdv, point);
+										RepositoryContainer.RepositoryBase.sdv2point.putIfAbsent(sdv, point);
 									}
 								}
-								SceneDataValue data = RepositoryBase.point2sdv.get(point);
+								SceneDataValue data = RepositoryContainer.RepositoryBase.point2sdv.get(point);
 								obj.put(Key, data);
 							} else {
 								obj.remove(Key);
@@ -247,18 +234,18 @@ public class RWDLoadUtil {
 						}
 						String point = (String) value_primitive;
 						if (point != null) {
-							if (RWDLoadUtil.infoValue_is_point(point)) {
+							if (RWDUtil.infoValue_is_point(point)) {
 								// 表号功能号改为null
 								{
 									SceneDataValue sdv = new SceneDataValue(null, null, null, null);
 									sdv.value_prim = new SceneDataPrimitive();
 									sdv.value_prim.change = true;
-									SceneDataValue exist_sdv = RepositoryBase.set2sdv.putIfAbsent(point, sdv);
+									SceneDataValue exist_sdv = RepositoryContainer.RepositoryBase.set2sdv.putIfAbsent(point, sdv);
 									if (exist_sdv == null) {
-										RepositoryBase.sdv2set.putIfAbsent(sdv, point);
+										RepositoryContainer.RepositoryBase.sdv2set.putIfAbsent(sdv, point);
 									}
 								}
-								SceneDataValue data = RepositoryBase.set2sdv.get(point);
+								SceneDataValue data = RepositoryContainer.RepositoryBase.set2sdv.get(point);
 								obj.put(Key, data);
 							} else {
 								obj.remove(Key);
@@ -270,7 +257,7 @@ public class RWDLoadUtil {
 		}
 	}
 
-	public static void LoadReference(Repository Repository) throws Exception {
+	public static void LoadReference(RepositoryImpl Repository) throws Exception {
 		for (ConfigRelation ConfigRelation : Constant.ConfigRelationList) {
 			Map<String, SceneDataObject> fromMap = Repository.objType2id2Value.get(ConfigRelation.objFrom);
 			Map<String, SceneDataObject> toMap = Repository.objType2id2Value.get(ConfigRelation.objTo);
@@ -434,7 +421,7 @@ public class RWDLoadUtil {
 		}
 	}
 
-	public static void LoadAlarm(Repository Repository, boolean use_sample) throws Exception {
+	public static void LoadAlarm(RepositoryImpl Repository, boolean use_sample) throws Exception {
 		for (String classCode : Repository.objectArrayDic.keySet()) {
 			if (!Repository.code2objTypeMap.containsKey(classCode)) {
 				continue;
@@ -452,18 +439,18 @@ public class RWDLoadUtil {
 					sv_alarmList.value_array = new SceneDataSet(false);
 					sv_alarmList.value_array.set = new ArrayList<SceneDataObject>();
 					sv_alarmList.value_array.setRowChange(true);
-					RepositoryBase.id2alarmList.putIfAbsent(objId, sv_alarmList);
+					RepositoryContainer.RepositoryBase.id2alarmList.putIfAbsent(objId, sv_alarmList);
 				}
-				SceneDataValue alarmList = RepositoryBase.id2alarmList.get(objId);
+				SceneDataValue alarmList = RepositoryContainer.RepositoryBase.id2alarmList.get(objId);
 				objectItem.put("报警列表", alarmList);
 				{
 					SceneDataValue sv_alarmCount = new SceneDataValue(null, null, "报警数量", null);
 					sv_alarmCount.value_prim = new SceneDataPrimitive();
 					sv_alarmCount.value_prim.value = 0;
 					sv_alarmCount.value_prim.change = true;
-					RepositoryBase.id2alarmCount.putIfAbsent(objId, sv_alarmCount);
+					RepositoryContainer.RepositoryBase.id2alarmCount.putIfAbsent(objId, sv_alarmCount);
 				}
-				SceneDataValue alarmCount = RepositoryBase.id2alarmCount.get(objId);
+				SceneDataValue alarmCount = RepositoryContainer.RepositoryBase.id2alarmCount.get(objId);
 				objectItem.put("报警数量", alarmCount);
 				if (use_sample) {
 					if (BKDRHash.getHashCode(objId) % 3 == 0) {
@@ -477,7 +464,7 @@ public class RWDLoadUtil {
 		}
 	}
 
-	public static void LoadIBMSPhysicalWorld(Repository Repository) throws Exception {
+	public static void LoadIBMSPhysicalWorld(RepositoryImpl Repository) throws Exception {
 		String validPath = Constant.getLatestPath(Constant.ibms_physical_world, true);
 		File[] dirs = (new File(validPath)).listFiles(new FileFilter() {
 			@Override

+ 66 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDRepositoryUtil.java

@@ -0,0 +1,66 @@
+package com.persagy.ibms.data.sdk.util;
+
+import java.io.File;
+import java.util.List;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.ibms.core.data.SceneObject;
+import com.persagy.ibms.core.data.SceneProperty;
+import com.persagy.ibms.core.util.ComputeUtil;
+import com.persagy.ibms.core.util.FastJsonReaderUtil;
+import com.persagy.ibms.core.util.FastJsonUtil;
+
+import lombok.extern.slf4j.Slf4j;
+
+@Slf4j
+public class RWDRepositoryUtil {
+
+	public static void DoRepository(RepositoryImpl Repository, boolean load_physical_world) throws Exception {
+		if (load_physical_world) {
+			log.warn("LoadPhysicalWorld");
+			RWDLoadUtil.LoadPhysicalWorld(Repository);
+			log.warn("LoadReference");
+			RWDLoadUtil.LoadReference(Repository);
+			log.warn("LoadAlarm");
+			if (Constant.alarm_enable) {
+				RWDLoadUtil.LoadAlarm(Repository, false);
+			} else {
+				RWDLoadUtil.LoadAlarm(Repository, true);
+			}
+			log.warn("LoadIBMSPhysicalWorld");
+			RWDLoadUtil.LoadIBMSPhysicalWorld(Repository);
+		} else {
+			Repository.objTypeMap = RepositoryContainer.instance.objTypeMap;
+			Repository.code2objTypeMap = RepositoryContainer.instance.code2objTypeMap;
+			Repository.infoArrayDic = RepositoryContainer.instance.infoArrayDic;
+			Repository.objectArrayDic = RepositoryContainer.instance.objectArrayDic;
+			Repository.objectArrayAll = RepositoryContainer.instance.objectArrayAll;
+			Repository.objType2id2Value = RepositoryContainer.instance.objType2id2Value;
+			Repository.relationArrayDic = RepositoryContainer.instance.relationArrayDic;
+			Repository.id2object = RepositoryContainer.instance.id2object;
+			Repository.id2sdv = RepositoryContainer.instance.id2sdv;
+			Repository.IBMSArrayDic = RepositoryContainer.instance.IBMSArrayDic;
+		}
+
+		log.warn("LoadConfig");
+		SceneObject sceneObject = new SceneObject();
+		JSONObject sceneJSON = FastJsonReaderUtil.Instance().ReadJSONObject(new File(Constant.getLatestPath(Constant.config, false)));
+		FastJsonUtil.Set_JavaObject(sceneJSON, sceneObject);
+		Repository.sceneObject = sceneObject;
+
+		Repository.property2SDV_enable = true;
+		Repository.property2SDV.clear();
+		ComputeUtil.RefreshRepository(Repository);
+		List<List<SceneProperty>> spListList = ComputeUtil.computePrepare(Repository);
+		log.warn("computeAll");
+		ComputeUtil.computeAll(Repository, spListList);
+		try {
+			DeamonUtil.Process(Repository);
+		} catch (Exception e) {
+			log.error(e.getMessage(), e);
+		}
+		Repository.property2SDV_enable = false;
+		Repository.property2SDV.clear();
+	}
+
+}

+ 0 - 124
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDUtil.java

@@ -1,124 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataPrimitive;
-import com.persagy.ibms.data.sdk.data.SceneDataSet;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-
-public class RWDUtil {
-	public static SceneDataObject object2sod(JSONObject arrayItem) {
-		SceneDataObject sod = new SceneDataObject(null, null, null, null, null, null, null);
-		for (String kpKey : arrayItem.keySet()) {
-			Object kpValue = arrayItem.get(kpKey);
-			SceneDataValue svInner = new SceneDataValue(null, null, null, null);
-			svInner.value_prim = new SceneDataPrimitive();
-			svInner.value_prim.value = kpValue;
-			svInner.finish = true;
-			sod.put(kpKey, svInner);
-		}
-		return sod;
-	}
-
-	public static void array2SDV(JSONArray array, SceneDataValue sv) {
-		sv.value_array = new SceneDataSet(false);
-		sv.value_array.set = new ArrayList<SceneDataObject>();
-		for (int i = 0; i < array.size(); i++) {
-			JSONObject arrayItem = (JSONObject) array.get(i);
-			SceneDataObject sod = new SceneDataObject(null, null, null, null, null, null, null);
-			for (String kpKey : arrayItem.keySet()) {
-				Object kpValue = arrayItem.get(kpKey);
-				SceneDataValue svInner = new SceneDataValue(null, null, null, null);
-				svInner.value_prim = new SceneDataPrimitive();
-				svInner.value_prim.value = kpValue;
-				svInner.finish = true;
-				sod.put(kpKey, svInner);
-			}
-			sv.value_array.set.add(sod);
-		}
-	}
-
-	public static List<SceneDataObject> array2SDOList(JSONArray array) {
-		List<SceneDataObject> result = new ArrayList<SceneDataObject>();
-		for (int i = 0; i < array.size(); i++) {
-			Object item = array.get(i);
-			JSONObject arrayItem = (JSONObject) item;
-			SceneDataObject sod = new SceneDataObject(null, null, null, null, null, null, null);
-			for (String kpKey : arrayItem.keySet()) {
-				Object kpValue = arrayItem.get(kpKey);
-				SceneDataValue svInner = new SceneDataValue(null, null, null, null);
-				svInner.value_prim = new SceneDataPrimitive();
-				svInner.value_prim.value = kpValue;
-				svInner.finish = true;
-				sod.put(kpKey, svInner);
-			}
-			result.add(sod);
-		}
-		return result;
-	}
-
-	public static List<SceneDataValue> array2SDVList(JSONArray array) {
-		List<SceneDataValue> result = new ArrayList<SceneDataValue>();
-		for (int i = 0; i < array.size(); i++) {
-			Object item = array.get(i);
-			SceneDataValue svInner = new SceneDataValue(null, null, null, null);
-			svInner.value_prim = new SceneDataPrimitive();
-			svInner.value_prim.value = item;
-			result.add(svInner);
-		}
-		return result;
-	}
-
-	public static int getInfoType(SceneDataObject infoJSON) {
-		String firstTag = infoJSON.get("firstTag") == null ? null : (String) infoJSON.get("firstTag").value_prim.value;
-		String secondTag = infoJSON.get("secondTag") == null ? null : (String) infoJSON.get("secondTag").value_prim.value;
-		if (firstTag != null) {
-			if (firstTag.contains("运行参数")) {
-				return 1;
-			} else if (firstTag.contains("事件记录")) {
-				if (secondTag != null && secondTag.contains("报警消息")) {
-					return 1;
-				} else {
-					return 1;
-				}
-			} else if (firstTag.contains("设定参数")) {
-				if (secondTag != null && secondTag.contains("设定反馈值")) {
-					return 1;
-				} else {
-					return 2;
-				}
-			}
-		}
-		return 0;
-	}
-
-	public static boolean isRunParam(List<SceneDataObject> infoArray, String code) {
-		for (int i = 0; i < infoArray.size(); i++) {
-			SceneDataObject infoJSON = infoArray.get(i);
-			if (!infoJSON.get("code").value_prim.value.equals(code)) {
-				continue;
-			}
-			if (getInfoType(infoJSON) == 1) {
-				return true;
-			}
-		}
-		return false;
-	}
-
-	public static boolean isSetParam(List<SceneDataObject> infoArray, String code) {
-		for (int i = 0; i < infoArray.size(); i++) {
-			SceneDataObject infoJSON = infoArray.get(i);
-			if (!infoJSON.get("code").value_prim.value.equals(code)) {
-				continue;
-			}
-			if (getInfoType(infoJSON) == 2) {
-				return true;
-			}
-		}
-		return false;
-	}
-}

+ 0 - 492
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RecursiveUtil.java

@@ -1,492 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.locks.ReentrantLock;
-
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataSet;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-import com.persagy.ibms.data.sdk.data.SceneProperty;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class RecursiveUtil {
-	/**
-	 * 刷新数据节点,根据read_level
-	 * 
-	 * @param tmpData
-	 * @throws Exception
-	 */
-	public static Object fillTimeValueObject(Object tmpData, Map<String, JSONArray> Point2datas, Map<String, IntWrapper> Point2index, String time) {
-		Object result = null;
-		if (tmpData instanceof JSONObject) {
-			JSONObject currData = (JSONObject) tmpData;
-			result = fillTimeValue(currData, Point2datas, Point2index, time);
-		} else if (tmpData instanceof JSONArray) {
-			JSONArray currData = (JSONArray) tmpData;
-			result = fillTimeValue(currData, Point2datas, Point2index, time);
-		}
-		return result;
-	}
-
-	private static Object fillTimeValueAssist(JSONArray datas, IntWrapper intWrapper, String time) {
-		Object result = null;
-		while (intWrapper.value < datas.size()) {
-			JSONObject data = (JSONObject) datas.get(intWrapper.value);
-			String timeInner = (String) data.get("data_time");
-			if (timeInner.compareTo(time) < 0) {
-				intWrapper.value++;
-			} else {
-				break;
-			}
-		}
-		if (intWrapper.value < datas.size()) {
-			JSONObject data = (JSONObject) datas.get(intWrapper.value);
-			result = data.get("data_value");
-		}
-		return result;
-	}
-
-	private static JSONObject fillTimeValue(JSONObject sdo, Map<String, JSONArray> Point2datas, Map<String, IntWrapper> Point2index, String time) {
-		if (sdo == null) {
-			return null;
-		}
-
-		if (sdo.containsKey("id")) {
-			JSONObject result = new JSONObject();
-			String id = (String) sdo.get("id");
-			result.put("id", id);
-			for (String Key : sdo.keySet()) {
-				String infoValue = (String) sdo.get(Key);
-				if (infoValue.startsWith("point:")) {
-					String point = infoValue.substring("point:".length());
-					JSONArray datas = Point2datas.get(point);
-					IntWrapper intWrapper = Point2index.get(point);
-					Object data_value = fillTimeValueAssist(datas, intWrapper, time);
-					result.put(Key, data_value);
-				}
-			}
-			return result;
-		} else {
-			JSONObject result = new JSONObject();
-			for (String Key : sdo.keySet()) {
-				Object value = sdo.get(Key);
-				if (value instanceof String) {
-					result.put(Key, value);
-				} else {
-					result.put(Key, fillTimeValueObject(value, Point2datas, Point2index, time));
-				}
-			}
-			return result;
-		}
-	}
-
-	private static Object fillTimeValue(JSONArray sdv, Map<String, JSONArray> Point2datas, Map<String, IntWrapper> Point2index, String time) {
-		if (sdv == null) {
-			return null;
-		}
-
-		JSONArray result = new JSONArray();
-		for (int i = 0; i < sdv.size(); i++) {
-			Object sdb = sdv.get(i);
-			if (sdb instanceof JSONObject) {
-				JSONObject sdbObject = (JSONObject) sdb;
-				result.add(fillTimeValue(sdbObject, Point2datas, Point2index, time));
-			} else {
-				result.add(fillTimeValueObject(sdb, Point2datas, Point2index, time));
-			}
-		}
-		return result;
-	}
-
-	/**
-	 * 刷新数据节点,根据read_level
-	 * 
-	 * @param tmpData
-	 * @throws Exception
-	 */
-	public static Object drawObject(Repository Repository, Object tmpData, Map<String, String> ObjInfo2Point) {
-		Object result = null;
-		Date currTime = new Date();
-		if (tmpData instanceof SceneDataValue) {
-			SceneDataValue currData = (SceneDataValue) tmpData;
-			int read_level = currData.rel_property == null ? 1 : Integer.parseInt(currData.rel_property.read_level);
-			read_level = read_level == 0 ? -1 : read_level;
-			result = draw(Repository, currData, read_level, currTime, ObjInfo2Point);
-		} else if (tmpData instanceof SceneDataObject) {
-			SceneDataObject currData = (SceneDataObject) tmpData;
-			int read_level = (currData.parentArrayData != null && currData.parentArrayData.rel_property != null)
-					? Integer.parseInt(currData.parentArrayData.rel_property.read_level) : 1;
-			read_level = read_level == 0 ? -1 : read_level;
-			result = draw(Repository, currData, read_level, currTime, ObjInfo2Point);
-		}
-		return result;
-	}
-
-	private static JSONObject draw(Repository Repository, SceneDataObject sdo, int depth, Date currTime, Map<String, String> ObjInfo2Point) {
-		if (sdo == null) {
-			return null;
-		}
-
-		int depthInner = depth == -1 ? -1 : (depth > 0 ? depth - 1 : 0);
-		if (sdo.containsKey("id")) {
-			JSONObject result = new JSONObject();
-			String id = (String) sdo.get("id").value_prim.value;
-			result.put("id", id);
-			JSONObject obj = Repository.id2object.get(id);
-			String classCode = (String) obj.get("classCode");
-			SceneDataSet infoArray = Repository.infoArrayDic.get(classCode);
-			for (String Key : obj.keySet()) {
-				if (obj.get(Key) != null && obj.get(Key) instanceof String) {
-					if (RWDUtil.isRunParam(infoArray.set, Key)) {
-						String infoValue = (String) obj.get(Key);
-						if (RWDLoadUtil.infoValue_is_point(infoValue)) {
-							result.put(Key, "point:" + infoValue);
-							ObjInfo2Point.put(id + "-" + Key, infoValue);
-						}
-					}
-				}
-			}
-			return result;
-		} else if (sdo.containsKey("名称") && sdo.containsKey("清单")) {
-			JSONObject result = new JSONObject();
-			result.put("名称", sdo.get("名称").value_prim.value);
-			Object list = draw(Repository, (SceneDataValue) sdo.get("清单"), depthInner, currTime, ObjInfo2Point);
-			result.put("清单", list);
-			return result;
-		} else {
-			return null;
-		}
-	}
-
-	private static Object draw(Repository Repository, SceneDataValue sdv, int depth, Date currTime, Map<String, String> ObjInfo2Point) {
-		if (sdv == null) {
-			return null;
-		}
-
-		int curr_depth = depth;
-		if (sdv.rel_property != null && curr_depth != -1) {
-			curr_depth -= Integer.parseInt(sdv.rel_property.offset_level);
-			if (curr_depth < 0) {
-				return null;
-			}
-		}
-
-		if (depth > 0 || depth == -1) {
-			if (sdv.value_object != null) {
-				JSONObject result = draw(Repository, sdv.value_object, curr_depth, currTime, ObjInfo2Point);
-				return result;
-			} else if (sdv.value_array != null) {
-				JSONArray result = new JSONArray();
-				for (int i = 0; i < sdv.value_array.set.size(); i++) {
-					SceneDataObject sdb = sdv.value_array.set.get(i);
-					if (sdb instanceof SceneDataObject) {
-						SceneDataObject sod = (SceneDataObject) sdb;
-						JSONObject resultItem = draw(Repository, sod, curr_depth, currTime, ObjInfo2Point);
-						result.add(resultItem);
-					}
-				}
-				return result;
-			}
-		}
-
-		return null;
-	}
-
-	/**
-	 * 刷新数据节点,根据read_level
-	 * 
-	 * @param tmpData
-	 * @throws Exception
-	 */
-	public static void refreshObject(Repository Repository, Object tmpData) throws Exception {
-		Date currTime = new Date();
-		if (tmpData instanceof SceneDataValue) {
-			SceneDataValue currData = (SceneDataValue) tmpData;
-			int read_level = currData.rel_property == null ? 1 : Integer.parseInt(currData.rel_property.read_level);
-			read_level = read_level == 0 ? -1 : read_level;
-			refresh(Repository, currData, read_level, currTime);
-		} else if (tmpData instanceof SceneDataObject) {
-			SceneDataObject currData = (SceneDataObject) tmpData;
-			int read_level = (currData.parentArrayData != null && currData.parentArrayData.rel_property != null)
-					? Integer.parseInt(currData.parentArrayData.rel_property.read_level) : 1;
-			read_level = read_level == 0 ? -1 : read_level;
-			refresh(Repository, currData, read_level, currTime);
-		}
-	}
-
-	private static void refresh(Repository Repository, SceneDataObject sdo, int depth, Date currTime) throws Exception {
-		if (sdo == null) {
-			return;
-		}
-
-		int depthInner = depth == -1 ? -1 : (depth > 0 ? depth - 1 : 0);
-		for (String key : sdo.keySet()) {
-			if (Constant.keyWordMap.containsKey(key)) {
-				continue;
-			}
-
-			refresh(Repository, sdo.get(key), depthInner, currTime);
-		}
-	}
-
-	private static void refresh(Repository Repository, SceneDataValue sdv, int depth, Date currTime) throws Exception {
-		if (sdv == null) {
-			return;
-		}
-
-		int curr_depth = depth;
-		if (sdv.rel_property != null && curr_depth != -1) {
-			curr_depth -= Integer.parseInt(sdv.rel_property.offset_level);
-			if (curr_depth < 0) {
-				return;
-			}
-		}
-
-		compute(Repository, sdv);
-		if (depth > 0 || depth == -1) {
-			if (sdv.value_object != null) {
-				refresh(Repository, sdv.value_object, curr_depth, currTime);
-			} else if (sdv.value_array != null) {
-				if (!sdv.value_array.isSingleValueSet) {
-					for (int i = 0; i < sdv.value_array.set.size(); i++) {
-						SceneDataObject sdb = sdv.value_array.set.get(i);
-						if (sdb instanceof SceneDataObject) {
-							SceneDataObject sod = (SceneDataObject) sdb;
-							refresh(Repository, sod, curr_depth, currTime);
-						}
-					}
-				}
-			}
-		}
-	}
-
-	/**
-	 * 处理variable的sdv
-	 * 
-	 * @param sdv
-	 * @throws Exception
-	 */
-	private static void compute(Repository Repository, SceneDataValue sdv) throws Exception {
-		if (sdv == null) {
-			return;
-		}
-
-		if (sdv.rel_property != null && sdv.rel_property.propertyValueType.equals("query")) {
-			if (sdv.rel_property.propertyValueSchema.equals("JSONObject") || sdv.rel_property.propertyValueSchema.equals("JSONArray")) {
-				{
-					// 递归计算当前节点及下级
-					computeInner(Repository, sdv);
-				}
-			} else {
-				// 计算
-				computeInner(Repository, sdv);
-			}
-		}
-	}
-
-	/**
-	 * 先计算依赖项,再计算自身
-	 * 
-	 * @param sv
-	 * @throws Exception
-	 */
-	private static void computeInner(Repository Repository, SceneDataValue sv) throws Exception {
-		SceneProperty sceneProperty = sv.rel_property;
-		JSONObject sql_json = JSON.parseObject(sceneProperty.query_sql);
-		Map<String, Boolean> refList = new HashMap<String, Boolean>();
-		CheckUtil.query(sql_json, refList);
-		List<SceneDataValue> svListAll = new ArrayList<SceneDataValue>();
-		for (String refString : refList.keySet()) {
-			List<SceneDataValue> svList = new ArrayList<SceneDataValue>();
-			String[] splits = refString.split("'");
-			SceneDataObject parentData;
-			int splits_index;
-			if (splits[0].startsWith("ancestor_")) {
-				int generate = Integer.parseInt(splits[0].substring("ancestor_".length()));
-				Object tmp = sv;
-				while (generate > 0) {
-					if (tmp instanceof SceneDataValue) {
-						SceneDataValue tmpData = (SceneDataValue) tmp;
-						tmp = tmpData.parentObjectData;
-					} else if (tmp instanceof SceneDataObject) {
-						SceneDataObject tmpData = (SceneDataObject) tmp;
-						tmp = tmpData.parentObjectData != null ? tmpData.parentObjectData : tmpData.parentArrayData;
-					}
-					generate--;
-				}
-				parentData = (SceneDataObject) tmp;
-				splits_index = 1;
-			} else {
-				parentData = Repository.objectData;
-				splits_index = 0;
-			}
-
-			// 查询目标可以是value_object或者value_array
-			svList.add(parentData.get(splits[splits_index]));
-			for (int i = splits_index + 1; i < splits.length; i++) {
-				if (i == splits.length - 1 && splits[i].equals("meter-funcid")) {
-					break;
-				}
-				List<SceneDataValue> svListInner = new ArrayList<SceneDataValue>();
-				String split = splits[i];
-				int index_ = split.indexOf('=');
-				if (index_ != -1) {
-					String propertyName = split.substring(0, index_);
-					String propertyValue = split.substring(index_ + 1);
-					for (SceneDataValue svInner : svList) {
-						if (svInner.value_object != null) {
-							SceneDataObject sod = svInner.value_object;
-							if (sod.containsKey(propertyName) && propertyValue.equals(sod.get(propertyName).value_prim.value)) {
-								SceneDataValue svWrapper = new SceneDataValue(null, sod, propertyName, null);
-								svWrapper.value_object = sod;
-								svListInner.add(svWrapper);
-							}
-						} else if (svInner.value_array != null) {
-							for (SceneDataObject sod : svInner.value_array.set) {
-								if (sod.containsKey(propertyName) && propertyValue.equals(sod.get(propertyName).value_prim.value)) {
-									SceneDataValue svWrapper = new SceneDataValue(null, sod, propertyName, null);
-									svWrapper.value_object = sod;
-									svListInner.add(svWrapper);
-								}
-							}
-						}
-					}
-				} else {
-					for (SceneDataValue svInner : svList) {
-						if (svInner.value_object != null) {
-							svListInner.add(svInner.value_object.get(split));
-						} else if (svInner.value_array != null) {
-							for (SceneDataObject sdb : svInner.value_array.set) {
-								if (sdb instanceof SceneDataObject) {
-									SceneDataObject sod = (SceneDataObject) sdb;
-									svListInner.add(sod.get(split));
-								}
-							}
-						}
-					}
-				}
-				svList = svListInner;
-			}
-			svListAll.addAll(svList);
-		}
-
-		for (SceneDataValue sdv : svListAll) {
-			compute(Repository, sdv);
-		}
-
-		if (sv.rel_property != null && sv.rel_property.propertyValueType.equals("query")) {
-			if (sv.value_object != null && sv.value_object.getRowChange() || sv.value_array != null && sv.value_array.getRowChange()
-					|| sv.value_prim != null && sv.value_prim.getRowChange()) {
-				ReentrantLock lock = sv.lock;
-				try {
-					lock.lock();
-					Date currTime = new Date();
-					if (sv.last_compute_time == null || currTime.getTime() - sv.last_compute_time.getTime() > 1000L) {
-						// String svPath = RecursiveUtil.getDataPath(sv);
-						// log.info(svPath);
-						ComputeUtil.computeProperty(Repository, sv);
-					}
-				} finally {
-					lock.unlock();
-				}
-			}
-		}
-	}
-
-	public static String getDataPath(Object sv) throws Exception {
-		List<Object> list = new ArrayList<Object>();
-		{
-			Object tmp = sv;
-			while (tmp != null) {
-				list.add(0, tmp);
-				if (tmp instanceof SceneDataValue) {
-					SceneDataValue tmpData = (SceneDataValue) tmp;
-					tmp = tmpData.parentObjectData;
-				} else if (tmp instanceof SceneDataObject) {
-					SceneDataObject tmpData = (SceneDataObject) tmp;
-					tmp = tmpData.parentObjectData != null ? tmpData.parentObjectData : tmpData.parentArrayData;
-				} else {
-					throw new Exception();
-				}
-			}
-		}
-		StringBuffer sb = new StringBuffer();
-		for (int i = 1; i < list.size(); i++) {
-			Object tmp = list.get(i);
-			if (tmp instanceof SceneDataValue) {
-				SceneDataValue tmpData = (SceneDataValue) tmp;
-				sb.append((sb.length() > 0 ? "." : "") + tmpData.myPropertyName);
-			} else if (tmp instanceof SceneDataObject) {
-				SceneDataObject tmpData = (SceneDataObject) tmp;
-				if (tmpData.myPropertyName == null) {
-					SceneDataValue sdvInner = tmpData.get("名称") != null ? tmpData.get("名称") : tmpData.get("id");
-					if (sdvInner != null) {
-						sb.append((sb.length() > 0 ? "." : "") + "[" + (sdvInner.value_prim == null ? "null" : sdvInner.value_prim.value) + "]");
-					}
-				} else {
-					sb.append((sb.length() > 0 ? "." : "") + tmpData.myPropertyName);
-				}
-			}
-		}
-		return sb.toString();
-	}
-
-	public static void print_variable_set(String path, SceneDataObject sdo) {
-		if (sdo == null) {
-			return;
-		}
-		if (sdo.rel_object == null && sdo.parentArrayData == null) {
-			return;
-		}
-
-		for (String key : sdo.keySet()) {
-			if (Constant.keyWordMap.containsKey(key)) {
-				continue;
-			}
-			print_variable_set(path + "-" + key, sdo.get(key));
-		}
-	}
-
-	public static void print_variable_set(String path, SceneDataValue sdv) {
-		if (sdv == null) {
-			return;
-		}
-		if (sdv.rel_property == null) {
-			return;
-		}
-
-		if (sdv.rel_property.propertyValueSchema.equals("JSONObject")) {
-			if (sdv.rel_property.propertyValueType.equals("query")) {
-				log.debug(
-						path + "\t" + "variable set object" + "\t" + sdv.rel_property.propertyValueType + "\t" + sdv.value_object.change.toString());
-			}
-			print_variable_set(path, sdv.value_object);
-		} else if (sdv.rel_property.propertyValueSchema.equals("JSONArray")) {
-			if (sdv.rel_property.propertyValueType.equals("query")) {
-				log.debug(path + "\t" + "variable set array" + "\t" + sdv.rel_property.propertyValueType + "\t" + sdv.value_array.change.toString());
-			}
-			for (int i = 0; i < sdv.value_array.set.size(); i++) {
-				SceneDataObject sdb = sdv.value_array.set.get(i);
-				if (sdb instanceof SceneDataObject) {
-					SceneDataObject sod = (SceneDataObject) sdb;
-					print_variable_set(path + "[" + i + "]", sod);
-				}
-			}
-		} else {
-			if (sdv.rel_property.propertyValueType.equals("query")) {
-				{
-					log.debug(path + "\t" + "variable value" + "\t" + sdv.value_prim.change);
-				}
-			}
-		}
-	}
-}

+ 0 - 67
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/Repository.java

@@ -1,67 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataSet;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-import com.persagy.ibms.data.sdk.data.SceneObject;
-import com.persagy.ibms.data.sdk.data.SceneProperty;
-import com.sagacloud.advanced.expression.AdvancedExpressionScanner;
-import com.sagacloud.advanced.expression.AdvancedExpressionWalker;
-
-public class Repository {
-
-	// 对象类型,true表示有二级类型
-	public Map<String, Boolean> objTypeMap = new HashMap<String, Boolean>();
-	public Map<String, String> classCode2NameMap = new HashMap<String, String>();
-	// classCode到objType
-	public Map<String, String> code2objTypeMap = new HashMap<String, String>();
-
-	// 对象类型下属信息点
-	public Map<String, SceneDataSet> infoArrayDic = new HashMap<String, SceneDataSet>();
-	// 对象类型到对象实例清单
-	public Map<String, SceneDataSet> objectArrayDic = new HashMap<String, SceneDataSet>();
-	// 所有对象实例清单
-	public SceneDataSet objectArrayAll = new SceneDataSet(false);
-	// 对象类型到map,map里面是id到对象值。只有关联表里面的对象才有
-	public Map<String, Map<String, SceneDataObject>> objType2id2Value = new HashMap<String, Map<String, SceneDataObject>>();
-	// 图类型到边类型到变实例清单
-	public Map<String, Map<String, SceneDataSet>> relationArrayDic = new HashMap<String, Map<String, SceneDataSet>>();
-	// 对象id到JSONObject
-	public Map<String, JSONObject> id2object = new HashMap<String, JSONObject>();
-	// 对象id到SceneDataValue
-	public Map<String, SceneDataObject> id2sdv = new HashMap<String, SceneDataObject>();
-	// 图类型到边类型到变实例清单
-	public Map<String, Map<String, SceneDataSet>> IBMSArrayDic = new HashMap<String, Map<String, SceneDataSet>>();
-
-	// deamon任务到点位清单
-	public ConcurrentHashMap<SceneDataValue, List<String>> deamon_sdv2pointList = new ConcurrentHashMap<SceneDataValue, List<String>>();
-
-	// 属性计算先后关系
-	public Map<SceneProperty, List<SceneProperty>> beforeDic = new HashMap<SceneProperty, List<SceneProperty>>();
-
-	// 场景对象
-	public SceneObject sceneObject = new SceneObject();
-	public Map<SceneProperty, SceneObject> p2o = new HashMap<SceneProperty, SceneObject>();// custom_object
-	public Map<SceneObject, SceneProperty> o2p = new HashMap<SceneObject, SceneProperty>();// custom_object
-	public Map<SceneProperty, SceneObject> p2sai = new HashMap<SceneProperty, SceneObject>();// static_array
-	public Map<SceneObject, SceneProperty> sai2p = new HashMap<SceneObject, SceneProperty>();// static_array
-	public Map<SceneProperty, SceneProperty> p2p = new HashMap<SceneProperty, SceneProperty>();// attached
-	public Map<SceneProperty, AdvancedExpressionScanner> p2scanner = new HashMap<SceneProperty, AdvancedExpressionScanner>();
-	public Map<SceneProperty, AdvancedExpressionWalker> p2walker = new HashMap<SceneProperty, AdvancedExpressionWalker>();
-
-	// 结果数据
-	public SceneDataObject objectData;
-
-	// 属性到sdv清单
-	public boolean property2SDV_enable = true;
-	public Map<SceneProperty, List<SceneDataValue>> property2SDV = new HashMap<SceneProperty, List<SceneDataValue>>();
-
-	// 公用target,减少解析量
-	public Map<String, SceneDataSet> targetListMap = new HashMap<String, SceneDataSet>();
-}

+ 0 - 38
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RepositoryBase.java

@@ -1,38 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-
-import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-import com.persagy.ibms.data.sdk.data.SceneDataSet;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-
-public class RepositoryBase {
-	public static Repository instance = new Repository();
-	public static boolean compute_finish = false;
-	public static boolean query_simulate = true;
-
-	public static String groupCode;
-	public static String projectId;
-
-	// IOT采集数据
-	public static ConcurrentHashMap<String, ConcurrentHashMap<String, String>> info2point = new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>();
-	public static ConcurrentHashMap<String, SceneDataValue> point2sdv = new ConcurrentHashMap<String, SceneDataValue>();
-	public static ConcurrentHashMap<SceneDataValue, String> sdv2point = new ConcurrentHashMap<SceneDataValue, String>();
-	public static ConcurrentHashMap<String, List<SceneDataObject>> point2curve = new ConcurrentHashMap<String, List<SceneDataObject>>();
-	// IOT设置数据
-	public static ConcurrentHashMap<String, SceneDataValue> set2sdv = new ConcurrentHashMap<String, SceneDataValue>();
-	public static ConcurrentHashMap<SceneDataValue, String> sdv2set = new ConcurrentHashMap<SceneDataValue, String>();
-	// 报警数据
-	public static SceneDataSet alarmArray = new SceneDataSet(false);
-	public static ConcurrentHashMap<String, SceneDataValue> id2alarmList = new ConcurrentHashMap<String, SceneDataValue>();
-	public static ConcurrentHashMap<String, SceneDataValue> id2alarmCount = new ConcurrentHashMap<String, SceneDataValue>();
-
-	// 指定路径的控制值
-	public static ConcurrentHashMap<String, JSONObject> controlValueMap = new ConcurrentHashMap<String, JSONObject>();
-
-	// 限流用
-	public static ConcurrentHashMap<String, ConcurrentHashMap<String, Date>> ip2param2time = new ConcurrentHashMap<String, ConcurrentHashMap<String, Date>>();
-}

+ 6 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RepositoryContainer.java

@@ -0,0 +1,6 @@
+package com.persagy.ibms.data.sdk.util;
+
+public class RepositoryContainer {
+	public static RepositoryProject RepositoryBase = new RepositoryProject();
+	public static RepositoryImpl instance = new RepositoryImpl();
+}

+ 94 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RepositoryImpl.java

@@ -0,0 +1,94 @@
+package com.persagy.ibms.data.sdk.util;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.ibms.core.data.SceneDataObject;
+import com.persagy.ibms.core.data.SceneDataSet;
+import com.persagy.ibms.core.data.SceneDataValue;
+import com.persagy.ibms.core.util.RepositoryBase;
+
+public class RepositoryImpl extends RepositoryBase {
+	public RepositoryProject RepositoryBase;
+
+	// 对象类型,true表示有二级类型
+	public Map<String, Boolean> objTypeMap = new HashMap<String, Boolean>();
+	public Map<String, String> classCode2NameMap = new HashMap<String, String>();
+	// classCode到objType
+	public Map<String, String> code2objTypeMap = new HashMap<String, String>();
+
+	// 对象类型下属信息点
+	public Map<String, SceneDataSet> infoArrayDic = new HashMap<String, SceneDataSet>();
+	// 对象类型到对象实例清单
+	public Map<String, SceneDataSet> objectArrayDic = new HashMap<String, SceneDataSet>();
+	// 所有对象实例清单
+	public SceneDataSet objectArrayAll = new SceneDataSet(false);
+	public ConcurrentHashMap<String, ConcurrentHashMap<String, String>> info2point = new ConcurrentHashMap<String, ConcurrentHashMap<String, String>>();
+	// 对象类型到map,map里面是id到对象值。只有关联表里面的对象才有
+	public Map<String, Map<String, SceneDataObject>> objType2id2Value = new HashMap<String, Map<String, SceneDataObject>>();
+	// 图类型到边类型到变实例清单
+	public Map<String, Map<String, SceneDataSet>> relationArrayDic = new HashMap<String, Map<String, SceneDataSet>>();
+	// 对象id到JSONObject
+	public Map<String, JSONObject> id2object = new HashMap<String, JSONObject>();
+	// 对象id到SceneDataValue
+	public Map<String, SceneDataObject> id2sdv = new HashMap<String, SceneDataObject>();
+	// 图类型到边类型到变实例清单
+	public Map<String, Map<String, SceneDataSet>> IBMSArrayDic = new HashMap<String, Map<String, SceneDataSet>>();
+
+	public ConcurrentHashMap<SceneDataValue, String> sdv2point() {
+		return RepositoryBase.sdv2point;
+	}
+
+	public SceneDataSet ParseSource(JSONObject descSet, String Source) {
+		SceneDataSet result = null;
+		if (Source.equals("rwd")) {
+			String rwd = (descSet.get("rwd")).toString();
+			if (rwd.equals("object")) {
+				if (descSet.containsKey("objType")) {
+					String objType = (descSet.get("objType")).toString();
+					if (objType.equals("equipment") || objType.equals("system") || objType.equals("space")) {
+						if (descSet.containsKey("classCode")) {
+							String classCode = (descSet.get("classCode")).toString();
+							result = this.objectArrayDic.get(classCode);
+						} else {
+							result = this.objectArrayDic.get(objType);
+						}
+					} else {
+						result = this.objectArrayDic.get(objType);
+					}
+				} else if (descSet.containsKey("classCode")) {
+					String classCode = (descSet.get("classCode")).toString();
+					result = this.objectArrayDic.get(classCode);
+				} else {
+					result = this.objectArrayAll;
+				}
+			} else if (rwd.equals("info")) {
+				String objType = (descSet.get("objType")).toString();
+				if (objType.equals("equipment") || objType.equals("system") || objType.equals("space")) {
+					String classCode = (descSet.get("classCode")).toString();
+					result = this.infoArrayDic.get(classCode);
+				} else {
+					result = this.infoArrayDic.get(objType);
+				}
+			} else if (rwd.equals("relation")) {
+				String graphCode = (descSet.get("graphCode")).toString();
+				String relCode = (descSet.get("relCode")).toString();
+				result = this.relationArrayDic.get(graphCode).get(relCode);
+			}
+			if (result == null) {
+				result = new SceneDataSet(false);
+				result.setRowChange(false);
+			}
+		} else if (Source.equals("ibms")) {
+			String product = (descSet.get("product")).toString();
+			String type = (descSet.get("type")).toString();
+			result = this.IBMSArrayDic.get(product).get(type);
+		} else if (Source.equals("alarm")) {
+			result = this.RepositoryBase.alarmArray;
+		}
+		return result;
+	}
+
+}

+ 36 - 0
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RepositoryProject.java

@@ -0,0 +1,36 @@
+package com.persagy.ibms.data.sdk.util;
+
+import java.util.Date;
+import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
+
+import com.alibaba.fastjson.JSONObject;
+import com.persagy.ibms.core.data.SceneDataObject;
+import com.persagy.ibms.core.data.SceneDataSet;
+import com.persagy.ibms.core.data.SceneDataValue;
+
+public class RepositoryProject {
+
+	public boolean compute_finish = false;
+
+	public String groupCode;
+	public String projectId;
+
+	// IOT采集数据
+	public ConcurrentHashMap<String, SceneDataValue> point2sdv = new ConcurrentHashMap<String, SceneDataValue>();
+	public ConcurrentHashMap<SceneDataValue, String> sdv2point = new ConcurrentHashMap<SceneDataValue, String>();
+	public ConcurrentHashMap<String, List<SceneDataObject>> point2curve = new ConcurrentHashMap<String, List<SceneDataObject>>();
+	// IOT设置数据
+	public ConcurrentHashMap<String, SceneDataValue> set2sdv = new ConcurrentHashMap<String, SceneDataValue>();
+	public ConcurrentHashMap<SceneDataValue, String> sdv2set = new ConcurrentHashMap<SceneDataValue, String>();
+	// 报警数据
+	public SceneDataSet alarmArray = new SceneDataSet(false);
+	public ConcurrentHashMap<String, SceneDataValue> id2alarmList = new ConcurrentHashMap<String, SceneDataValue>();
+	public ConcurrentHashMap<String, SceneDataValue> id2alarmCount = new ConcurrentHashMap<String, SceneDataValue>();
+
+	// 指定路径的控制值
+	public ConcurrentHashMap<String, JSONObject> controlValueMap = new ConcurrentHashMap<String, JSONObject>();
+
+	// 限流用
+	public ConcurrentHashMap<String, ConcurrentHashMap<String, Date>> ip2param2time = new ConcurrentHashMap<String, ConcurrentHashMap<String, Date>>();
+}

+ 0 - 80
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/SceneDataValueComparator.java

@@ -1,80 +0,0 @@
-package com.persagy.ibms.data.sdk.util;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-import java.util.Comparator;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataObject;
-
-public class SceneDataValueComparator implements Comparator<SceneDataObject> {
-	JSONArray OrderBy;
-
-	public SceneDataValueComparator(JSONArray OrderBy) {
-		this.OrderBy = OrderBy;
-	}
-
-	@Override
-	public int compare(SceneDataObject o1, SceneDataObject o2) {
-		for (int i = 0; i < OrderBy.size(); i++) {
-			JSONObject item = (JSONObject) OrderBy.get(i);
-			String Column = (String) item.get("Column");
-			Boolean Asc = (Boolean) item.get("Asc");
-			Object v1 = null;
-			if (o1.value_object.get(Column) != null && o1.value_object.get(Column).value_prim != null) {
-				v1 = o1.value_object.get(Column).value_prim.value;
-			}
-			Object v2 = null;
-			if (o2.value_object.get(Column) != null && o2.value_object.get(Column).value_prim != null) {
-				v2 = o2.value_object.get(Column).value_prim.value;
-			}
-			if (v1 == null && v2 != null) {
-				if (Asc) {
-					return -1;
-				} else {
-					return 1;
-				}
-			} else if (v1 != null && v2 == null) {
-				if (Asc) {
-					return 1;
-				} else {
-					return -1;
-				}
-			} else if (v1 == null && v2 == null) {
-				continue;
-			} else {
-				int cmp;
-				if (v1 instanceof String && v2 instanceof String) {
-					cmp = ((String) v1).compareTo((String) v2);
-				} else if (v1 instanceof Integer && v2 instanceof Integer) {
-					cmp = ((Integer) v1).compareTo((Integer) v2);
-				} else if (v1 instanceof Long && v2 instanceof Long) {
-					cmp = ((Long) v1).compareTo((Long) v2);
-				} else if (v1 instanceof BigInteger && v2 instanceof BigInteger) {
-					cmp = ((BigInteger) v1).compareTo((BigInteger) v2);
-				} else if (v1 instanceof Float && v2 instanceof Float) {
-					cmp = ((Float) v1).compareTo((Float) v2);
-				} else if (v1 instanceof Double && v2 instanceof Double) {
-					cmp = ((Double) v1).compareTo((Double) v2);
-				} else if (v1 instanceof BigDecimal && v2 instanceof BigDecimal) {
-					cmp = ((BigDecimal) v1).compareTo((BigDecimal) v2);
-				} else if (v1 instanceof Boolean && v2 instanceof Boolean) {
-					cmp = ((Boolean) v1).compareTo((Boolean) v2);
-				} else {
-					continue;
-				}
-				if (cmp == 0) {
-					continue;
-				} else {
-					if (Asc) {
-						return cmp;
-					} else {
-						return 0 - cmp;
-					}
-				}
-			}
-		}
-		return 0;
-	}
-}

+ 10 - 10
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/websocket/IOTWebSocketClient.java

@@ -7,10 +7,10 @@ import org.java_websocket.handshake.ServerHandshake;
 
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneDataPrimitive;
-import com.persagy.ibms.data.sdk.data.SceneDataValue;
-import com.persagy.ibms.data.sdk.util.DataUtil;
-import com.persagy.ibms.data.sdk.util.RepositoryBase;
+import com.persagy.ibms.core.data.SceneDataPrimitive;
+import com.persagy.ibms.core.data.SceneDataValue;
+import com.persagy.ibms.core.util.DataUtil;
+import com.persagy.ibms.data.sdk.util.RepositoryContainer;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -64,11 +64,11 @@ public class IOTWebSocketClient extends WebSocketClient {
 						SceneDataValue sdvInner = new SceneDataValue(null, null, null, null);
 						sdvInner.value_prim = new SceneDataPrimitive();
 						sdvInner.value_prim.change = true;
-						SceneDataValue exist_sdv = RepositoryBase.point2sdv.putIfAbsent(meter + "-" + funcid, sdvInner);
+						SceneDataValue exist_sdv = RepositoryContainer.RepositoryBase.point2sdv.putIfAbsent(meter + "-" + funcid, sdvInner);
 						if (exist_sdv == null) {
-							RepositoryBase.sdv2point.putIfAbsent(sdvInner, meter + "-" + funcid);
+							RepositoryContainer.RepositoryBase.sdv2point.putIfAbsent(sdvInner, meter + "-" + funcid);
 						}
-						SceneDataValue data = RepositoryBase.point2sdv.get(meter + "-" + funcid);
+						SceneDataValue data = RepositoryContainer.RepositoryBase.point2sdv.get(meter + "-" + funcid);
 						if (type.equals("iot")) {
 							try {
 								data.value_prim.value = Double.parseDouble(value);
@@ -93,11 +93,11 @@ public class IOTWebSocketClient extends WebSocketClient {
 					String value = splits[i + 3];
 					try {
 						SceneDataValue sdvInner = new SceneDataValue(null, null, null, null);
-						SceneDataValue exist_sdv = RepositoryBase.set2sdv.putIfAbsent(meter + "-" + funcid, sdvInner);
+						SceneDataValue exist_sdv = RepositoryContainer.RepositoryBase.set2sdv.putIfAbsent(meter + "-" + funcid, sdvInner);
 						if (exist_sdv == null) {
-							RepositoryBase.sdv2set.putIfAbsent(sdvInner, meter + "-" + funcid);
+							RepositoryContainer.RepositoryBase.sdv2set.putIfAbsent(sdvInner, meter + "-" + funcid);
 						}
-						SceneDataValue data = RepositoryBase.set2sdv.get(meter + "-" + funcid);
+						SceneDataValue data = RepositoryContainer.RepositoryBase.set2sdv.get(meter + "-" + funcid);
 						double dataValue = Double.parseDouble(value);
 						if (data.value_prim.value == null || dataValue != DataUtil.primitive2double(data.value_prim.value)) {
 							data.value_prim.value = dataValue;

+ 0 - 71
ibms-data-sdk/src/main/java/com/sagacloud/ExpressionUtil.java

@@ -1,71 +0,0 @@
-package com.sagacloud;
-
-import java.io.ByteArrayInputStream;
-
-import org.antlr.runtime.ANTLRInputStream;
-import org.antlr.runtime.CommonTokenStream;
-import org.antlr.runtime.tree.CommonTree;
-import org.antlr.runtime.tree.CommonTreeNodeStream;
-
-import com.alibaba.fastjson.JSONObject;
-import com.persagy.ibms.data.sdk.data.SceneProperty;
-import com.persagy.ibms.data.sdk.util.Repository;
-import com.sagacloud.advanced.expression.AdvancedExpressionLexer;
-import com.sagacloud.advanced.expression.AdvancedExpressionParser;
-import com.sagacloud.advanced.expression.AdvancedExpressionScanner;
-import com.sagacloud.advanced.expression.AdvancedExpressionWalker;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class ExpressionUtil {
-
-	public static void buildAndPut(Repository Repository, SceneProperty sp, String expression, JSONObject CriteriaObject) throws Exception {
-		ANTLRInputStream input = new ANTLRInputStream(new ByteArrayInputStream((expression + "$").getBytes()));
-		AdvancedExpressionLexer lexer = new AdvancedExpressionLexer(input);
-		CommonTokenStream tokens = new CommonTokenStream(lexer);
-		AdvancedExpressionParser parser = new AdvancedExpressionParser(tokens);
-		AdvancedExpressionParser.prog_return r = parser.prog();
-		CommonTree t = (CommonTree) r.getTree();
-
-		CommonTreeNodeStream nodes = new CommonTreeNodeStream(t);
-		nodes.setTokenStream(tokens);
-
-		AdvancedExpressionScanner scanner = new AdvancedExpressionScanner(nodes);
-		scanner.prog();
-		AdvancedExpressionWalker walker = new AdvancedExpressionWalker(nodes);
-		for (String var : scanner.varDict.keySet()) {
-			if (!CriteriaObject.containsKey(var)) {
-				throw new Exception("var: " + var + " not exist in Criteria");
-			}
-		}
-
-		Repository.p2scanner.put(sp, scanner);
-		Repository.p2walker.put(sp, walker);
-	}
-
-	public static void run(String expression) throws Exception {
-		ANTLRInputStream input = new ANTLRInputStream(new ByteArrayInputStream((expression + "$").getBytes()));
-		AdvancedExpressionLexer lexer = new AdvancedExpressionLexer(input);
-		CommonTokenStream tokens = new CommonTokenStream(lexer);
-		AdvancedExpressionParser parser = new AdvancedExpressionParser(tokens);
-		AdvancedExpressionParser.prog_return r = parser.prog();
-		CommonTree t = (CommonTree) r.getTree();
-
-		CommonTreeNodeStream nodes = new CommonTreeNodeStream(t);
-		nodes.setTokenStream(tokens);
-
-		AdvancedExpressionScanner scanner = new AdvancedExpressionScanner(nodes);
-		scanner.prog();
-		for (String var : scanner.varDict.keySet()) {
-			log.info("var: " + var);
-		}
-
-		AdvancedExpressionWalker walker = new AdvancedExpressionWalker(nodes);
-		walker.reset();
-		for (String var : scanner.varDict.keySet()) {
-			walker.put(var, 1.0);
-		}
-		log.info("" + walker.prog());
-	}
-}

File diff suppressed because it is too large
+ 0 - 2433
ibms-data-sdk/src/main/java/com/sagacloud/advanced/expression/AdvancedExpressionLexer.java


File diff suppressed because it is too large
+ 0 - 2861
ibms-data-sdk/src/main/java/com/sagacloud/advanced/expression/AdvancedExpressionParser.java


File diff suppressed because it is too large
+ 0 - 1578
ibms-data-sdk/src/main/java/com/sagacloud/advanced/expression/AdvancedExpressionScanner.java


File diff suppressed because it is too large
+ 0 - 1702
ibms-data-sdk/src/main/java/com/sagacloud/advanced/expression/AdvancedExpressionWalker.java


+ 0 - 82
ibms-data-sdk/src/main/java/com/sagacloud/util/math/FunctionUtil.java

@@ -1,82 +0,0 @@
-package com.sagacloud.util.math;
-
-import java.lang.reflect.Method;
-
-public class FunctionUtil {
-
-	public static ValueObject constant(String constant) {
-		ValueObject result = new ValueObject();
-		result.type = 1;
-		if (constant.equals("PI")) {
-			result.doubleValue = Math.PI;
-		} else if (constant.equals("E")) {
-			result.doubleValue = Math.E;
-		}
-		return result;
-	}
-
-	public static ValueObject compute(String function) {
-		ValueObject result = new ValueObject();
-		result.type = 1;
-		Class<?> mathClass = Math.class;
-		try {
-			Method method = mathClass.getMethod(function, new Class[] {});
-			result.doubleValue = (Double) method.invoke(mathClass, new Object[] {});
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return result;
-	}
-
-	public static ValueObject compute(String function, ValueObject a) {
-		if (a.is_null()) {
-			return new ValueObject(null);
-		}
-
-		ValueObject result = new ValueObject();
-		result.type = 1;
-		double valuea;
-		if (a.type == 0) {
-			valuea = a.intValue;
-		} else {
-			valuea = a.doubleValue;
-		}
-		Class<?> mathClass = Math.class;
-		try {
-			Method method = mathClass.getMethod(function, new Class[] { double.class });
-			result.doubleValue = (Double) method.invoke(mathClass, new Object[] { valuea });
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return result;
-	}
-
-	public static ValueObject compute(String function, ValueObject a, ValueObject b) {
-		if (a.is_null() || b.is_null()) {
-			return new ValueObject(null);
-		}
-
-		ValueObject result = new ValueObject();
-		result.type = 1;
-		double valuea;
-		if (a.type == 0) {
-			valuea = a.intValue;
-		} else {
-			valuea = a.doubleValue;
-		}
-		double valueb;
-		if (b.type == 0) {
-			valueb = b.intValue;
-		} else {
-			valueb = b.doubleValue;
-		}
-		Class<?> mathClass = Math.class;
-		try {
-			Method method = mathClass.getMethod(function, new Class[] { double.class, double.class });
-			result.doubleValue = (Double) method.invoke(mathClass, new Object[] { valuea, valueb });
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-		return result;
-	}
-}

+ 0 - 56
ibms-data-sdk/src/main/java/com/sagacloud/util/math/ValueObject.java

@@ -1,56 +0,0 @@
-package com.sagacloud.util.math;
-
-public class ValueObject {
-	public ValueObject() {
-
-	}
-
-	public ValueObject(int type, Long value) {
-		this.type = type;
-		this.intValue = value;
-	}
-
-	public ValueObject(int type, Double value) {
-		this.type = type;
-		this.doubleValue = value;
-	}
-
-	public ValueObject(String value) {
-		this.type = 2;
-		this.stringValue = value;
-	}
-
-	// public ValueObject(String text) {
-	// try {
-	// this.intValue = Long.parseLong(text);
-	// } catch (Exception e) {
-	// this.doubleValue = Double.parseDouble(text);
-	// this.type = 1;
-	// }
-	// }
-
-	public int type;// 0:int;1:double;2:string
-	public Long intValue;
-	public Double doubleValue;
-	public String stringValue;
-
-	public Object value() {
-		Object result;
-		if (this.type == 0) {
-			result = this.intValue;
-		} else if (this.type == 1) {
-			result = this.doubleValue;
-		} else {
-			result = this.stringValue;
-		}
-		return result;
-	}
-
-	public boolean is_null() {
-		if (this.type == 2 && this.stringValue == null) {
-			return true;
-		} else {
-			return false;
-		}
-	}
-}

+ 0 - 172
ibms-data-sdk/src/main/java/com/sagacloud/util/math/ValueObjectUtil.java

@@ -1,172 +0,0 @@
-package com.sagacloud.util.math;
-
-public class ValueObjectUtil {
-
-	public static ValueObject compute(String operator, ValueObject a, ValueObject b) {
-		if (a.is_null() || b.is_null()) {
-			return new ValueObject(null);
-		}
-
-		ValueObject result = new ValueObject();
-		if (a.type == 0 && b.type == 0) {
-			if (operator.equals("+")) {
-				result.intValue = a.intValue + b.intValue;
-			} else if (operator.equals("-")) {
-				result.intValue = a.intValue - b.intValue;
-			} else if (operator.equals("*")) {
-				result.intValue = a.intValue * b.intValue;
-			} else if (operator.equals("/")) {
-				result.intValue = a.intValue / b.intValue;
-			} else if (operator.equals("%")) {
-				result.intValue = a.intValue % b.intValue;
-			}
-		} else {
-			result.type = 1;
-			double valuea;
-			if (a.type == 0) {
-				valuea = a.intValue;
-			} else {
-				valuea = a.doubleValue;
-			}
-			double valueb;
-			if (b.type == 0) {
-				valueb = b.intValue;
-			} else {
-				valueb = b.doubleValue;
-			}
-			if (operator.equals("+")) {
-				result.doubleValue = valuea + valueb;
-			} else if (operator.equals("-")) {
-				result.doubleValue = valuea - valueb;
-			} else if (operator.equals("*")) {
-				result.doubleValue = valuea * valueb;
-			} else if (operator.equals("/")) {
-				result.doubleValue = valuea / valueb;
-			} else if (operator.equals("%")) {
-				result.doubleValue = valuea % valueb;
-			}
-		}
-		return result;
-	}
-
-	public static boolean stringcompare(String operator, ValueObject b) {
-		if (operator.equals("==")) {
-			return b.stringValue == null;
-		} else if (operator.equals("!=")) {
-			return b.stringValue != null;
-		}
-		return true;
-	}
-
-	public static boolean stringcompare(String operator, ValueObject a, ValueObject b) {
-		if (a.is_null() && b.is_null()) {
-			if (operator.equals("==")) {
-				return true;
-			} else {
-				return false;
-			}
-		} else if (a.is_null()) {
-			if (operator.equals("<") || operator.equals("<=") || operator.equals("!=")) {
-				return true;
-			} else {
-				return false;
-			}
-		} else if (b.is_null()) {
-			if (operator.equals(">") || operator.equals(">=") || operator.equals("!=")) {
-				return true;
-			} else {
-				return false;
-			}
-		}
-
-		int cmp = a.stringValue.compareTo(b.stringValue);
-		if (operator.equals("<")) {
-			return cmp < 0;
-		} else if (operator.equals("<=")) {
-			return cmp <= 0;
-		} else if (operator.equals(">")) {
-			return cmp > 0;
-		} else if (operator.equals(">=")) {
-			return cmp >= 0;
-		} else if (operator.equals("==")) {
-			return cmp == 0;
-		} else if (operator.equals("!=")) {
-			return cmp != 0;
-		}
-		return true;
-	}
-
-	public static boolean compare(String operator, ValueObject b) {
-		if (operator.equals("==")) {
-			return b.stringValue == null;
-		} else if (operator.equals("!=")) {
-			return b.stringValue != null;
-		}
-		return true;
-	}
-
-	public static boolean compare(String operator, ValueObject a, ValueObject b) {
-		if (a.is_null() && b.is_null()) {
-			if (operator.equals("==")) {
-				return true;
-			} else {
-				return false;
-			}
-		} else if (a.is_null()) {
-			if (operator.equals("<") || operator.equals("<=") || operator.equals("!=")) {
-				return true;
-			} else {
-				return false;
-			}
-		} else if (b.is_null()) {
-			if (operator.equals(">") || operator.equals(">=") || operator.equals("!=")) {
-				return true;
-			} else {
-				return false;
-			}
-		}
-
-		if (a.type == 0 && b.type == 0) {
-			if (operator.equals("<")) {
-				return a.intValue < b.intValue;
-			} else if (operator.equals("<=")) {
-				return a.intValue <= b.intValue;
-			} else if (operator.equals(">")) {
-				return a.intValue > b.intValue;
-			} else if (operator.equals(">=")) {
-				return a.intValue >= b.intValue;
-			} else if (operator.equals("==")) {
-				return a.intValue == b.intValue;
-			} else if (operator.equals("!=")) {
-				return a.intValue != b.intValue;
-			}
-		} else {
-			double valuea;
-			if (a.type == 0) {
-				valuea = a.intValue;
-			} else {
-				valuea = a.doubleValue;
-			}
-			double valueb;
-			if (b.type == 0) {
-				valueb = b.intValue;
-			} else {
-				valueb = b.doubleValue;
-			}
-			if (operator.equals("<")) {
-				return valuea < valueb;
-			} else if (operator.equals("<=")) {
-				return valuea <= valueb;
-			} else if (operator.equals(">")) {
-				return valuea > valueb;
-			} else if (operator.equals(">=")) {
-				return valuea >= valueb;
-			} else if (operator.equals("==")) {
-				return valuea == valueb;
-			} else if (operator.equals("!=")) {
-				return valuea != valueb;
-			}
-		}
-		return true;
-	}
-}