|
@@ -1,49 +1,21 @@
|
|
package com.persagy.ibms.data.sdk.service.rest;
|
|
package com.persagy.ibms.data.sdk.service.rest;
|
|
|
|
|
|
-import java.io.File;
|
|
|
|
-import java.text.ParseException;
|
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
|
-import java.util.ArrayList;
|
|
|
|
-import java.util.Date;
|
|
|
|
-import java.util.HashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-
|
|
|
|
-import javax.servlet.http.HttpServletRequest;
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
-
|
|
|
|
-import org.springframework.core.io.FileSystemResource;
|
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
|
-
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
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.alibaba.fastjson.serializer.SerializerFeature;
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
-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.data.SceneProperty;
|
|
|
|
-import com.persagy.ibms.core.util.ComputeUtil;
|
|
|
|
-import com.persagy.ibms.core.util.FastJsonCompareUtil;
|
|
|
|
-import com.persagy.ibms.core.util.FastJsonReaderUtil;
|
|
|
|
-import com.persagy.ibms.core.util.FilterUtil;
|
|
|
|
-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.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.ExportUtil;
|
|
|
|
-import com.persagy.ibms.data.sdk.util.HttpClientUtil;
|
|
|
|
-import com.persagy.ibms.data.sdk.util.RWDAlarmUtil;
|
|
|
|
-import com.persagy.ibms.data.sdk.util.RepositoryContainer;
|
|
|
|
-import com.persagy.ibms.data.sdk.util.RepositoryImpl;
|
|
|
|
-
|
|
|
|
|
|
+import com.persagy.ibms.core.data.*;
|
|
|
|
+import com.persagy.ibms.core.util.*;
|
|
|
|
+import com.persagy.ibms.data.sdk.util.*;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.core.io.FileSystemResource;
|
|
|
|
+import org.springframework.http.ResponseEntity;
|
|
|
|
+
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.text.ParseException;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.*;
|
|
|
|
|
|
@Slf4j
|
|
@Slf4j
|
|
public class RestUtil {
|
|
public class RestUtil {
|
|
@@ -87,7 +59,7 @@ public class RestUtil {
|
|
}
|
|
}
|
|
return JSONObject.toJSONString(Content, SerializerFeature.WriteMapNullValue);
|
|
return JSONObject.toJSONString(Content, SerializerFeature.WriteMapNullValue);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
result.put("Result", "failure");
|
|
result.put("Result", "failure");
|
|
result.put("Reason", LogUtil.GetExceptionStackTrace(e));
|
|
result.put("Reason", LogUtil.GetExceptionStackTrace(e));
|
|
}
|
|
}
|
|
@@ -120,7 +92,7 @@ public class RestUtil {
|
|
String result = RestUtil.query(JSONObject.toJSONString(query_json_new, SerializerFeature.WriteMapNullValue));
|
|
String result = RestUtil.query(JSONObject.toJSONString(query_json_new, SerializerFeature.WriteMapNullValue));
|
|
return result;
|
|
return result;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
String error = LogUtil.GetExceptionStackTrace(e);
|
|
String error = LogUtil.GetExceptionStackTrace(e);
|
|
return error;
|
|
return error;
|
|
}
|
|
}
|
|
@@ -331,7 +303,7 @@ public class RestUtil {
|
|
Object valueJSON = ComputeUtil.getValueJSON(valueObject, read_level);
|
|
Object valueJSON = ComputeUtil.getValueJSON(valueObject, read_level);
|
|
return JSONObject.toJSONString(valueJSON, SerializerFeature.WriteMapNullValue);
|
|
return JSONObject.toJSONString(valueJSON, SerializerFeature.WriteMapNullValue);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
log.error(message);
|
|
log.error(message);
|
|
return message;
|
|
return message;
|
|
@@ -353,7 +325,7 @@ public class RestUtil {
|
|
try {
|
|
try {
|
|
if (valuePath[valuePath.length - 1].equals("工单")) {
|
|
if (valuePath[valuePath.length - 1].equals("工单")) {
|
|
JSONObject work_order = FastJsonReaderUtil.Instance()
|
|
JSONObject work_order = FastJsonReaderUtil.Instance()
|
|
- .ReadJSONObject(new File(Constant.GetPath() + Constant.getSeperator() + "work_order_sample.json"));
|
|
|
|
|
|
+ .ReadJSONObject(FileUtil.file("work_order_sample.json"));
|
|
JSONArray work_orders = new JSONArray();
|
|
JSONArray work_orders = new JSONArray();
|
|
work_orders.add(work_order);
|
|
work_orders.add(work_order);
|
|
return work_orders;
|
|
return work_orders;
|
|
@@ -364,7 +336,7 @@ public class RestUtil {
|
|
return valueJSON;
|
|
return valueJSON;
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
log.error(message);
|
|
log.error(message);
|
|
return message;
|
|
return message;
|
|
@@ -417,7 +389,7 @@ public class RestUtil {
|
|
result.put("success_count", success_points.size());
|
|
result.put("success_count", success_points.size());
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
log.error(message);
|
|
log.error(message);
|
|
result.put("result", "failure");
|
|
result.put("result", "failure");
|
|
@@ -439,7 +411,7 @@ public class RestUtil {
|
|
result.put("Content", Content);
|
|
result.put("Content", Content);
|
|
result.put("Result", "success");
|
|
result.put("Result", "success");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
log.error(message);
|
|
log.error(message);
|
|
result.put("Result", "failure");
|
|
result.put("Result", "failure");
|
|
@@ -517,7 +489,7 @@ public class RestUtil {
|
|
result.put("Content", parseArray);
|
|
result.put("Content", parseArray);
|
|
result.put("Result", "success");
|
|
result.put("Result", "success");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
log.error(message);
|
|
log.error(message);
|
|
result.put("Result", "failure");
|
|
result.put("Result", "failure");
|
|
@@ -569,7 +541,7 @@ public class RestUtil {
|
|
result.put("Content", datas);
|
|
result.put("Content", datas);
|
|
result.put("Result", "success");
|
|
result.put("Result", "success");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
log.error(message);
|
|
log.error(message);
|
|
result.put("Result", "failure");
|
|
result.put("Result", "failure");
|
|
@@ -645,7 +617,7 @@ public class RestUtil {
|
|
result.add(timeJSON);
|
|
result.add(timeJSON);
|
|
}
|
|
}
|
|
} catch (ParseException e) {
|
|
} catch (ParseException e) {
|
|
- // e.printStackTrace();
|
|
|
|
|
|
+ // log.error(e.getMessage(),e);
|
|
}
|
|
}
|
|
return result.toJSONString();
|
|
return result.toJSONString();
|
|
}
|
|
}
|
|
@@ -655,11 +627,11 @@ public class RestUtil {
|
|
try {
|
|
try {
|
|
pointResult = fjd_query_inner(points);
|
|
pointResult = fjd_query_inner(points);
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- // e.printStackTrace();
|
|
|
|
|
|
+ // log.error(e.getMessage(),e);
|
|
try {
|
|
try {
|
|
pointResult = fjd_query_inner(points);
|
|
pointResult = fjd_query_inner(points);
|
|
} catch (Exception e1) {
|
|
} catch (Exception e1) {
|
|
- // e.printStackTrace();
|
|
|
|
|
|
+ // log.error(e.getMessage(),e);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (pointResult == null) {
|
|
if (pointResult == null) {
|
|
@@ -723,7 +695,7 @@ public class RestUtil {
|
|
result.put("Content", datas);
|
|
result.put("Content", datas);
|
|
result.put("Result", "success");
|
|
result.put("Result", "success");
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ log.error(e.getMessage(),e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
String message = LogUtil.GetExceptionStackTrace(e);
|
|
log.error(message);
|
|
log.error(message);
|
|
result.put("Result", "failure");
|
|
result.put("Result", "failure");
|