|
@@ -1,5 +1,49 @@
|
|
|
package com.persagy.ibms.data.sdk.util;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+
|
|
|
public class LogOfDownload {
|
|
|
+ private SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
+
|
|
|
+ public Date startTime;
|
|
|
+ public Date endTime;
|
|
|
+ public List<JSONObject> downloadList = new CopyOnWriteArrayList<JSONObject>();
|
|
|
+ public String pathOld;
|
|
|
+ public long fileSizeOld;
|
|
|
+ public String pathNew;
|
|
|
+ public long fileSizeNew;
|
|
|
+ public List<JSONObject> changeList = new CopyOnWriteArrayList<JSONObject>();
|
|
|
+ public List<JSONObject> errorList = new CopyOnWriteArrayList<JSONObject>();
|
|
|
+ public String status;// running,success,failure
|
|
|
+
|
|
|
+ public LogOfDownload() {
|
|
|
+ this.startTime = new Date();
|
|
|
+ }
|
|
|
|
|
|
+ public synchronized JSONObject toJSON() {
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+ if (startTime != null) {
|
|
|
+ result.put("startTime", sdf.format(startTime));
|
|
|
+ }
|
|
|
+ {
|
|
|
+ JSONArray errorArray = new JSONArray();
|
|
|
+ for (JSONObject error : errorList) {
|
|
|
+ errorArray.add(error);
|
|
|
+ }
|
|
|
+ result.put("errorArray", errorArray);
|
|
|
+ }
|
|
|
+ if (endTime != null) {
|
|
|
+ result.put("endTime", sdf.format(endTime));
|
|
|
+ }
|
|
|
+ if (status != null) {
|
|
|
+ result.put("status", status);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|