瀏覽代碼

控制增加反馈结果

menglu 3 年之前
父節點
當前提交
fe63c32ee0

文件差異過大導致無法顯示
+ 765 - 747
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/service/rest/RestUtil.java


+ 23 - 13
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/ControlUtil.java

@@ -2,6 +2,7 @@ package com.persagy.ibms.data.sdk.util;
 
 
 import java.util.List;
 import java.util.List;
 
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.persagy.ibms.data.sdk.data.SceneDataObject;
 import com.persagy.ibms.data.sdk.data.SceneDataObject;
@@ -30,44 +31,49 @@ public class ControlUtil {
 		return result;
 		return result;
 	}
 	}
 
 
-	public static void set(Repository Repository, JSONArray path, String[] valuePath, JSONObject infoValueSet) throws Exception {
+	public static JSONArray set(Repository Repository, JSONArray path, String[] valuePath, JSONObject infoValueSet) throws Exception {
 		setControlValue(path, infoValueSet);
 		setControlValue(path, infoValueSet);
 
 
+		JSONArray result;
 		Object valueObject = ComputeUtil.getValueObject(Repository, valuePath);
 		Object valueObject = ComputeUtil.getValueObject(Repository, valuePath);
 		if (valueObject instanceof SceneDataValue) {
 		if (valueObject instanceof SceneDataValue) {
 			SceneDataValue currData = (SceneDataValue) valueObject;
 			SceneDataValue currData = (SceneDataValue) valueObject;
 			if (currData.value_array != null) {
 			if (currData.value_array != null) {
 				SceneDataValue detail = currData.parentObjectData.get("详情");
 				SceneDataValue detail = currData.parentObjectData.get("详情");
-				setInner(Repository, detail, currData.value_array.set, infoValueSet);
+				result = setInner(Repository, detail, currData.value_array.set, infoValueSet);
 			} else if (currData.value_object != null) {
 			} else if (currData.value_object != null) {
-				set(Repository, currData.value_object, infoValueSet);
+				result = set(Repository, currData.value_object, infoValueSet);
 			} else {
 			} else {
 				throw new Exception();
 				throw new Exception();
 			}
 			}
 		} else {
 		} else {
 			SceneDataObject currData = (SceneDataObject) valueObject;
 			SceneDataObject currData = (SceneDataObject) valueObject;
-			set(Repository, currData, infoValueSet);
+			result = set(Repository, currData, infoValueSet);
 		}
 		}
+		return result;
 	}
 	}
 
 
-	private static void set(Repository Repository, SceneDataObject object, JSONObject infoValueSet) throws Exception {
+	private static JSONArray set(Repository Repository, SceneDataObject object, JSONObject infoValueSet) throws Exception {
+		JSONArray result;
 		if (object.containsKey("清单")) {
 		if (object.containsKey("清单")) {
 			SceneDataValue list = object.get("清单");
 			SceneDataValue list = object.get("清单");
 			SceneDataValue detail = object.get("详情");
 			SceneDataValue detail = object.get("详情");
-			setInner(Repository, detail, list.value_array.set, infoValueSet);
+			result = setInner(Repository, detail, list.value_array.set, infoValueSet);
 		} else {
 		} else {
-			setInner(Repository, object, infoValueSet);
+			result = setInner(Repository, object, infoValueSet);
 		}
 		}
+		return result;
 	}
 	}
 
 
-	private static void setInner(Repository Repository, SceneDataObject object, JSONObject infoValueSet) throws Exception {
+	private static JSONArray setInner(Repository Repository, SceneDataObject object, JSONObject infoValueSet) throws Exception {
 		JSONArray points = new JSONArray();
 		JSONArray points = new JSONArray();
 		build_points(Repository, object, infoValueSet, points);
 		build_points(Repository, object, infoValueSet, points);
 		build_object(object, infoValueSet);
 		build_object(object, infoValueSet);
-		post(points);
+		JSONArray result = post(points);
+		return result;
 	}
 	}
 
 
-	private static void setInner(Repository Repository, SceneDataValue detail, List<SceneDataObject> objectArray, JSONObject infoValueSet)
+	private static JSONArray setInner(Repository Repository, SceneDataValue detail, List<SceneDataObject> objectArray, JSONObject infoValueSet)
 			throws Exception {
 			throws Exception {
 		if (detail != null) {
 		if (detail != null) {
 			build_object(detail.value_object, infoValueSet);
 			build_object(detail.value_object, infoValueSet);
@@ -77,7 +83,8 @@ public class ControlUtil {
 			build_points(Repository, (SceneDataObject) object, infoValueSet, points);
 			build_points(Repository, (SceneDataObject) object, infoValueSet, points);
 			build_object((SceneDataObject) object, infoValueSet);
 			build_object((SceneDataObject) object, infoValueSet);
 		}
 		}
-		post(points);
+		JSONArray result = post(points);
+		return result;
 	}
 	}
 
 
 	private static void build_points(Repository Repository, SceneDataObject object, JSONObject infoValueSet, JSONArray points) {
 	private static void build_points(Repository Repository, SceneDataObject object, JSONObject infoValueSet, JSONArray points) {
@@ -108,13 +115,16 @@ public class ControlUtil {
 		}
 		}
 	}
 	}
 
 
-	private static void post(JSONArray points) throws Exception {
+	private static JSONArray post(JSONArray points) throws Exception {
 		JSONObject postJSON = new JSONObject();
 		JSONObject postJSON = new JSONObject();
 		postJSON.put("building", RepositoryBase.projectId.substring(2));
 		postJSON.put("building", RepositoryBase.projectId.substring(2));
 		postJSON.put("points", points);
 		postJSON.put("points", points);
-		String post_url = Constant.iot_project_url + "pointsetbatch_post";
+		String post_url = Constant.iot_project_url + "sync_pointsetbatch_post";
 		log.debug(postJSON.toJSONString());
 		log.debug(postJSON.toJSONString());
 		String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString());
 		String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString());
+		JSONObject result = JSON.parseObject(post_result);
+		JSONArray result_points = (JSONArray) result.get("points");
 		log.debug(post_result);
 		log.debug(post_result);
+		return result_points;
 	}
 	}
 }
 }