فهرست منبع

增加打印错误信息

menglu 3 سال پیش
والد
کامیت
ac739e4387
1فایلهای تغییر یافته به همراه101 افزوده شده و 68 حذف شده
  1. 101 68
      ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDDownloadUtil.java

+ 101 - 68
ibms-data-sdk/src/main/java/com/persagy/ibms/data/sdk/util/RWDDownloadUtil.java

@@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.persagy.ibms.core.util.FastJsonUtil;
 import com.persagy.ibms.core.util.FileUtil;
 import com.persagy.ibms.core.util.LogOfDownload;
+import com.persagy.ibms.core.util.LogUtil;
 
 import lombok.extern.slf4j.Slf4j;
 
@@ -248,15 +249,19 @@ public class RWDDownloadUtil {
 			JSONObject param = new JSONObject();
 			JSONObject criteria = new JSONObject();
 			param.put("criteria", criteria);
-			String post_result = HttpClientUtil.instance("rwd").post_compress(Constant.zkt_dmp_url + "/rwd/def/class?projectId="
-					+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
-					param.toJSONString());
-			JSONObject resultJSON = JSON.parseObject(post_result);
-			if (!resultJSON.getString("result").equals("success")) {
-				throw new Exception(param.toJSONString() + "\n" + post_result);
+			String post_url = Constant.zkt_dmp_url + "/rwd/def/class?projectId=" + RepositoryContainer.RepositoryProject.projectId + "&groupCode="
+					+ RepositoryContainer.RepositoryProject.groupCode;
+			try {
+				String post_result = HttpClientUtil.instance("rwd").post_compress(post_url, param.toJSONString());
+				JSONObject resultJSON = JSON.parseObject(post_result);
+				if (!resultJSON.getString("result").equals("success")) {
+					throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + post_result);
+				}
+				classArray = resultJSON.getJSONArray("data");
+				classArray = classArray == null ? new JSONArray() : classArray;
+			} catch (Exception e) {
+				throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
 			}
-			classArray = resultJSON.getJSONArray("data");
-			classArray = classArray == null ? new JSONArray() : classArray;
 			FileUtil.Save(path + Constant.getSeperator() + "classArray.json", FastJsonUtil.toFormatString(classArray), LogOfDownload.downloadList);
 		}
 		for (int i = 0; i < classArray.size(); i++) {
@@ -269,15 +274,19 @@ public class RWDDownloadUtil {
 				criteria.put("classCode", code);
 				param.put("criteria", criteria);
 				log.debug("Download info " + code);
-				String post_result = HttpClientUtil.instance("rwd").post_compress(Constant.zkt_dmp_url + "/rwd/def/funcid?projectId="
-						+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
-						param.toJSONString());
-				JSONObject resultJSON = JSON.parseObject(post_result);
-				if (!resultJSON.getString("result").equals("success")) {
-					throw new Exception(param.toJSONString() + "\n" + post_result);
+				String post_url = Constant.zkt_dmp_url + "/rwd/def/funcid?projectId=" + RepositoryContainer.RepositoryProject.projectId
+						+ "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode;
+				try {
+					String post_result = HttpClientUtil.instance("rwd").post_compress(post_url, param.toJSONString());
+					JSONObject resultJSON = JSON.parseObject(post_result);
+					if (!resultJSON.getString("result").equals("success")) {
+						throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + post_result);
+					}
+					infoArray = resultJSON.getJSONArray("data");
+					infoArray = infoArray == null ? new JSONArray() : infoArray;
+				} catch (Exception e) {
+					throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
 				}
-				infoArray = resultJSON.getJSONArray("data");
-				infoArray = infoArray == null ? new JSONArray() : infoArray;
 			}
 			FileUtil.Save(path + Constant.getSeperator() + "info" + Constant.getSeperator() + code + ".json", FastJsonUtil.toFormatString(infoArray),
 					LogOfDownload.downloadList);
@@ -309,16 +318,19 @@ public class RWDDownloadUtil {
 				criteria.put("valid", 1);
 				param.put("criteria", criteria);
 				log.debug("Download object " + code);
-				String post_result = HttpClientUtil.instance("rwd")
-						.post_compress(Constant.zkt_dmp_url + "/rwd/instance/object/query?projectId="
-								+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
-								param.toJSONString());
-				JSONObject resultJSON = JSON.parseObject(post_result);
-				if (!resultJSON.getString("result").equals("success")) {
-					throw new Exception(param.toJSONString() + "\n" + post_result);
+				String post_url = Constant.zkt_dmp_url + "/rwd/instance/object/query?projectId=" + RepositoryContainer.RepositoryProject.projectId
+						+ "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode;
+				try {
+					String post_result = HttpClientUtil.instance("rwd").post_compress(post_url, param.toJSONString());
+					JSONObject resultJSON = JSON.parseObject(post_result);
+					if (!resultJSON.getString("result").equals("success")) {
+						throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + post_result);
+					}
+					infoArray = resultJSON.getJSONArray("data");
+					infoArray = infoArray == null ? new JSONArray() : infoArray;
+				} catch (Exception e) {
+					throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
 				}
-				infoArray = resultJSON.getJSONArray("data");
-				infoArray = infoArray == null ? new JSONArray() : infoArray;
 			}
 			FileUtil.Save(path + Constant.getSeperator() + "object" + Constant.getSeperator() + code + ".json",
 					FastJsonUtil.toFormatString(infoArray), LogOfDownload.downloadList);
@@ -345,15 +357,19 @@ public class RWDDownloadUtil {
 					criteria.put("relCode", relCode);
 					param.put("criteria", criteria);
 					log.debug("Download relation " + graphCode + " " + relCode);
-					String post_result = HttpClientUtil.instance("rwd").post_compress(Constant.zkt_dmp_url + "/rwd/instance/relation/query?projectId="
-							+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
-							param.toJSONString());
-					JSONObject resultJSON = JSON.parseObject(post_result);
-					if (!resultJSON.getString("result").equals("success")) {
-						throw new Exception(param.toJSONString() + "\n" + post_result);
+					String post_url = Constant.zkt_dmp_url + "/rwd/instance/relation/query?projectId="
+							+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode;
+					try {
+						String post_result = HttpClientUtil.instance("rwd").post_compress(post_url, param.toJSONString());
+						JSONObject resultJSON = JSON.parseObject(post_result);
+						if (!resultJSON.getString("result").equals("success")) {
+							throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + post_result);
+						}
+						infoArray = resultJSON.getJSONArray("data");
+						infoArray = infoArray == null ? new JSONArray() : infoArray;
+					} catch (Exception e) {
+						throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
 					}
-					infoArray = resultJSON.getJSONArray("data");
-					infoArray = infoArray == null ? new JSONArray() : infoArray;
 				}
 				FileUtil.Save(path + Constant.getSeperator() + "relation" + Constant.getSeperator() + graphCode + Constant.getSeperator() + relCode
 						+ ".json", FastJsonUtil.toFormatString(infoArray), LogOfDownload.downloadList);
@@ -433,11 +449,16 @@ public class RWDDownloadUtil {
 			pathInner.add("产品模块");
 			JSONObject param = new JSONObject();
 			param.put("path", pathInner);
-			String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(Constant.zkt_dmp_url + "/post?projectId="
-					+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
-					param.toJSONString());
-			sceneArray = JSON.parseArray(post_result);
-			FileUtil.Save(path + Constant.getSeperator() + "sceneArray.json", FastJsonUtil.toFormatString(sceneArray), LogOfDownload.downloadList);
+			String post_url = Constant.zkt_dmp_url + "/post?projectId=" + RepositoryContainer.RepositoryProject.projectId + "&groupCode="
+					+ RepositoryContainer.RepositoryProject.groupCode;
+			try {
+				String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(post_url, param.toJSONString());
+				sceneArray = JSON.parseArray(post_result);
+				FileUtil.Save(path + Constant.getSeperator() + "sceneArray.json", FastJsonUtil.toFormatString(sceneArray),
+						LogOfDownload.downloadList);
+			} catch (Exception e) {
+				throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
+			}
 		}
 		JSONArray classArray;
 		{
@@ -445,16 +466,21 @@ public class RWDDownloadUtil {
 			JSONObject criteria = new JSONObject();
 			criteria.put("ibms", true);
 			param.put("criteria", criteria);
-			String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(Constant.zkt_dmp_url + "/rwd/def/class?projectId="
-					+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
-					param.toJSONString());
-			JSONObject resultJSON = JSON.parseObject(post_result);
-			if (!resultJSON.getString("result").equals("success")) {
-				throw new Exception(param.toJSONString() + "\n" + post_result);
+			String post_url = Constant.zkt_dmp_url + "/rwd/def/class?projectId=" + RepositoryContainer.RepositoryProject.projectId + "&groupCode="
+					+ RepositoryContainer.RepositoryProject.groupCode;
+			try {
+				String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(post_url, param.toJSONString());
+				JSONObject resultJSON = JSON.parseObject(post_result);
+				if (!resultJSON.getString("result").equals("success")) {
+					throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + post_result);
+				}
+				classArray = resultJSON.getJSONArray("data");
+				classArray = classArray == null ? new JSONArray() : classArray;
+				FileUtil.Save(path + Constant.getSeperator() + "classArray.json", FastJsonUtil.toFormatString(classArray),
+						LogOfDownload.downloadList);
+			} catch (Exception e) {
+				throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
 			}
-			classArray = resultJSON.getJSONArray("data");
-			classArray = classArray == null ? new JSONArray() : classArray;
-			FileUtil.Save(path + Constant.getSeperator() + "classArray.json", FastJsonUtil.toFormatString(classArray), LogOfDownload.downloadList);
 		}
 		for (int i = 0; i < classArray.size(); i++) {
 			JSONObject item = (JSONObject) classArray.get(i);
@@ -468,16 +494,19 @@ public class RWDDownloadUtil {
 				criteria.put("ibmsClassCode", ibmsClassCode);
 				param.put("criteria", criteria);
 				log.debug("Download object " + ibmsSceneCode + "-" + ibmsClassCode);
-				String post_result = HttpClientUtil.instance("zkt_dmp")
-						.post_compress(Constant.zkt_dmp_url + "/rwd/instance/object/query?projectId="
-								+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
-								param.toJSONString());
-				JSONObject resultJSON = JSON.parseObject(post_result);
-				if (!resultJSON.getString("result").equals("success")) {
-					throw new Exception(param.toJSONString() + "\n" + post_result);
+				String post_url = Constant.zkt_dmp_url + "/rwd/instance/object/query?projectId=" + RepositoryContainer.RepositoryProject.projectId
+						+ "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode;
+				try {
+					String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(post_url, param.toJSONString());
+					JSONObject resultJSON = JSON.parseObject(post_result);
+					if (!resultJSON.getString("result").equals("success")) {
+						throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + post_result);
+					}
+					infoArray = resultJSON.getJSONArray("data");
+					infoArray = infoArray == null ? new JSONArray() : infoArray;
+				} catch (Exception e) {
+					throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
 				}
-				infoArray = resultJSON.getJSONArray("data");
-				infoArray = infoArray == null ? new JSONArray() : infoArray;
 			}
 			File sceneDir = new File(path + Constant.getSeperator() + "object" + Constant.getSeperator() + ibmsSceneCode);
 			if (!sceneDir.exists()) {
@@ -717,15 +746,19 @@ public class RWDDownloadUtil {
 			JSONObject criteria = new JSONObject();
 			criteria.put("ibms", true);
 			param.put("criteria", criteria);
-			String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(Constant.zkt_dmp_url + "/rwd/def/class?projectId="
-					+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode,
-					param.toJSONString());
-			JSONObject resultJSON = JSON.parseObject(post_result);
-			if (!resultJSON.getString("result").equals("success")) {
-				throw new Exception(param.toJSONString() + "\n" + post_result);
+			String post_url = Constant.zkt_dmp_url + "/rwd/def/class?projectId=" + RepositoryContainer.RepositoryProject.projectId + "&groupCode="
+					+ RepositoryContainer.RepositoryProject.groupCode;
+			try {
+				String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(post_url, param.toJSONString());
+				JSONObject resultJSON = JSON.parseObject(post_result);
+				if (!resultJSON.getString("result").equals("success")) {
+					throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + post_result);
+				}
+				classArray = resultJSON.getJSONArray("data");
+				classArray = classArray == null ? new JSONArray() : classArray;
+			} catch (Exception e) {
+				throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
 			}
-			classArray = resultJSON.getJSONArray("data");
-			classArray = classArray == null ? new JSONArray() : classArray;
 			FileUtil.Save(path + Constant.getSeperator() + "classArray.json", FastJsonUtil.toFormatString(classArray), LogOfDownload.downloadList);
 		}
 		JSONArray groupArray;
@@ -776,13 +809,13 @@ public class RWDDownloadUtil {
 						criteria.put("ibmsSceneCode", ibmsSceneCode);
 						criteria.put("ibmsClassCode", ibmsClassCode);
 						param.put("criteria", criteria);
-						String postUrl = Constant.zkt_dmp_url + "/rwd/instance/object/query?projectId="
+						String post_url = Constant.zkt_dmp_url + "/rwd/instance/object/query?projectId="
 								+ RepositoryContainer.RepositoryProject.projectId + "&groupCode=" + RepositoryContainer.RepositoryProject.groupCode;
 						try {
-							String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(postUrl, param.toJSONString());
+							String post_result = HttpClientUtil.instance("zkt_dmp").post_compress(post_url, param.toJSONString());
 							JSONObject resultJSON = JSON.parseObject(post_result);
 							if (!resultJSON.getString("result").equals("success")) {
-								throw new Exception(postUrl + "\n" + param.toJSONString() + "\n" + post_result);
+								throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + post_result);
 							}
 							JSONArray dataArray = resultJSON.getJSONArray("data");
 							dataArray = dataArray == null ? new JSONArray() : dataArray;
@@ -795,7 +828,7 @@ public class RWDDownloadUtil {
 								infoArray.add(logicalObject);
 							}
 						} catch (Exception e) {
-							log.error(postUrl + "\n" + FastJsonUtil.toFormatString(param), e);
+							log.error(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
 							throw e;
 						}
 					} else {