|
@@ -696,4 +696,94 @@ public class RestUtil {
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ public static String getAdmUrl(String param){
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ result.put("status","success");
|
|
|
+ result.put("statusCode","0");
|
|
|
+ if(Objects.isNull(param)){
|
|
|
+ result.put("status","fail");
|
|
|
+ result.put("msg","参数不能为空");
|
|
|
+ result.put("statusCode","250");
|
|
|
+ return result.toJSONString();
|
|
|
+ }
|
|
|
+ try {
|
|
|
+
|
|
|
+ JSONObject paramObject = JSON.parseObject(param);
|
|
|
+
|
|
|
+ JSONObject postJSON = new JSONObject();
|
|
|
+
|
|
|
+ postJSON.put("filters", "label contain "+paramObject.get("filters"));
|
|
|
+ Map<String,String> head = new HashMap<>();
|
|
|
+ head.put("projectId", RepositoryContainer.RepositoryBase.projectId);
|
|
|
+
|
|
|
+
|
|
|
+ String post_url ="http://39.102.40.239:28888"+ "/labsl/graph/pub/query";
|
|
|
+ String post_result = HttpClientUtil.post(post_url, postJSON.toJSONString(),head);
|
|
|
+
|
|
|
+ JSONObject resultJSON = JSON.parseObject(post_result);
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ JSONArray content = (JSONArray)resultJSON.get("content");
|
|
|
+ if(content == null || content.isEmpty()){
|
|
|
+
|
|
|
+ result.put("Result", "failure");
|
|
|
+ result.put("ResultMsg", "暂无数据");
|
|
|
+ result.put("ResultCode", 250);
|
|
|
+ return result.toJSONString();
|
|
|
+ }else{
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ JSONObject obj = (JSONObject) content.get(0);
|
|
|
+ map.put("graphId",obj.get("graphId").toString());
|
|
|
+ map.put("id",obj.get("id").toString());
|
|
|
+ map.put("projectId",obj.get("projectId").toString());
|
|
|
+ map.put("serviceUrl","http://192.168.0.53:8811");
|
|
|
+ map.put("img_baseurl","http://39.102.40.239");
|
|
|
+ map.put("topo_baseurl","http://39.102.40.239:28888");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ String path = "http://192.168.0.34:8081/#/";
|
|
|
+
|
|
|
+ JSONObject rd = new JSONObject();
|
|
|
+ rd.put("url",toUrl(path,map));
|
|
|
+ rd.put("projectId","");
|
|
|
+ rd.put("graphId","");
|
|
|
+ result.put("Content",rd);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("获取图形数据失败",e);
|
|
|
+ result.put("Result", "failure");
|
|
|
+ String message = LogUtil.GetExceptionStackTrace(e);
|
|
|
+ result.put("ResultMsg", message);
|
|
|
+ result.put("ResultCode", 250);
|
|
|
+ }
|
|
|
+ return result.toJSONString();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private static String toUrl(String path,Map<String,String> param){
|
|
|
+
|
|
|
+ for (Map.Entry<String, String> entry : param.entrySet()) {
|
|
|
+ if(!path.contains("?")){
|
|
|
+
|
|
|
+ path +="?";
|
|
|
+ }else{
|
|
|
+ path +="&";
|
|
|
+ }
|
|
|
+ path += entry.getKey()+"="+entry.getValue();
|
|
|
+ }
|
|
|
+ return path;
|
|
|
+ }
|
|
|
}
|