|
@@ -251,17 +251,7 @@ public class RWDDownloadUtil {
|
|
|
param.put("criteria", criteria);
|
|
|
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 = post_zkt_dmp(post_url, param);
|
|
|
FileUtil.Save(path + Constant.getSeperator() + "classArray.json", FastJsonUtil.toFormatString(classArray), LogOfDownload.downloadList);
|
|
|
}
|
|
|
for (int i = 0; i < classArray.size(); i++) {
|
|
@@ -276,17 +266,7 @@ public class RWDDownloadUtil {
|
|
|
log.debug("Download info " + code);
|
|
|
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 = post_zkt_dmp(post_url, param);
|
|
|
}
|
|
|
FileUtil.Save(path + Constant.getSeperator() + "info" + Constant.getSeperator() + code + ".json", FastJsonUtil.toFormatString(infoArray),
|
|
|
LogOfDownload.downloadList);
|
|
@@ -320,17 +300,7 @@ public class RWDDownloadUtil {
|
|
|
log.debug("Download object " + code);
|
|
|
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 = post_zkt_dmp(post_url, param);
|
|
|
}
|
|
|
FileUtil.Save(path + Constant.getSeperator() + "object" + Constant.getSeperator() + code + ".json",
|
|
|
FastJsonUtil.toFormatString(infoArray), LogOfDownload.downloadList);
|
|
@@ -359,17 +329,7 @@ public class RWDDownloadUtil {
|
|
|
log.debug("Download relation " + graphCode + " " + relCode);
|
|
|
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 = post_zkt_dmp(post_url, param);
|
|
|
}
|
|
|
FileUtil.Save(path + Constant.getSeperator() + "relation" + Constant.getSeperator() + graphCode + Constant.getSeperator() + relCode
|
|
|
+ ".json", FastJsonUtil.toFormatString(infoArray), LogOfDownload.downloadList);
|
|
@@ -454,11 +414,10 @@ public class RWDDownloadUtil {
|
|
|
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));
|
|
|
}
|
|
|
+ FileUtil.Save(path + Constant.getSeperator() + "sceneArray.json", FastJsonUtil.toFormatString(sceneArray), LogOfDownload.downloadList);
|
|
|
}
|
|
|
JSONArray classArray;
|
|
|
{
|
|
@@ -468,19 +427,8 @@ public class RWDDownloadUtil {
|
|
|
param.put("criteria", criteria);
|
|
|
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 = post_zkt_dmp(post_url, param);
|
|
|
+ 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);
|
|
@@ -496,17 +444,7 @@ public class RWDDownloadUtil {
|
|
|
log.debug("Download object " + ibmsSceneCode + "-" + ibmsClassCode);
|
|
|
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 = post_zkt_dmp(post_url, param);
|
|
|
}
|
|
|
File sceneDir = new File(path + Constant.getSeperator() + "object" + Constant.getSeperator() + ibmsSceneCode);
|
|
|
if (!sceneDir.exists()) {
|
|
@@ -748,17 +686,7 @@ public class RWDDownloadUtil {
|
|
|
param.put("criteria", criteria);
|
|
|
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 = post_zkt_dmp(post_url, param);
|
|
|
FileUtil.Save(path + Constant.getSeperator() + "classArray.json", FastJsonUtil.toFormatString(classArray), LogOfDownload.downloadList);
|
|
|
}
|
|
|
JSONArray groupArray;
|
|
@@ -811,25 +739,14 @@ public class RWDDownloadUtil {
|
|
|
param.put("criteria", criteria);
|
|
|
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);
|
|
|
- }
|
|
|
- JSONArray dataArray = resultJSON.getJSONArray("data");
|
|
|
- dataArray = dataArray == null ? new JSONArray() : dataArray;
|
|
|
- for (int i = 0; i < dataArray.size(); i++) {
|
|
|
- JSONObject itemInner = dataArray.getJSONObject(i);
|
|
|
- String objId = itemInner.getString("id");
|
|
|
- JSONObject logicalObject = new JSONObject();
|
|
|
- logicalObject.put("logicalGroupingId", logicalGroupingId);
|
|
|
- logicalObject.put("objId", objId);
|
|
|
- infoArray.add(logicalObject);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
|
|
|
- throw e;
|
|
|
+ JSONArray dataArray = post_zkt_dmp(post_url, param);
|
|
|
+ for (int i = 0; i < dataArray.size(); i++) {
|
|
|
+ JSONObject itemInner = dataArray.getJSONObject(i);
|
|
|
+ String objId = itemInner.getString("id");
|
|
|
+ JSONObject logicalObject = new JSONObject();
|
|
|
+ logicalObject.put("logicalGroupingId", logicalGroupingId);
|
|
|
+ logicalObject.put("objId", objId);
|
|
|
+ infoArray.add(logicalObject);
|
|
|
}
|
|
|
} else {
|
|
|
JSONObject criteria = new JSONObject();
|
|
@@ -877,6 +794,26 @@ public class RWDDownloadUtil {
|
|
|
log.debug("Download ibms physical world finish " + path);
|
|
|
}
|
|
|
|
|
|
+ private static JSONArray post_zkt_dmp(String post_url, JSONObject param) throws Exception {
|
|
|
+ JSONArray result;
|
|
|
+ try {
|
|
|
+ String post_result = HttpClientUtil.instance("rwd").post_compress(post_url, param.toJSONString());
|
|
|
+ try {
|
|
|
+ JSONObject resultJSON = JSON.parseObject(post_result);
|
|
|
+ if (!resultJSON.getString("result").equals("success")) {
|
|
|
+ throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + post_result);
|
|
|
+ }
|
|
|
+ result = resultJSON.getJSONArray("data");
|
|
|
+ result = result == null ? new JSONArray() : result;
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + post_result);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new Exception(post_url + "\n" + param.toJSONString() + "\n" + LogUtil.GetExceptionStackTrace(e));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
public static void Clear(String path, boolean is_dir) throws Exception {
|
|
|
if (is_dir) {
|
|
|
{
|