huangxingxing 2 年之前
父節點
當前提交
27d4d8bba9

+ 40 - 0
src/main/java/com/miniframe/aftercure/AnimationFile.java

@@ -0,0 +1,40 @@
+package com.miniframe.aftercure;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.miniframe.tools.XiJsonUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class AnimationFile {
+    Integer step;
+    String filename;
+
+    public Integer getStep() {
+        return step;
+    }
+
+    public void setStep(Integer step) {
+        this.step = step;
+    }
+
+    public String getFilename() {
+        return filename;
+    }
+
+    public void setFilename(String filename) {
+        this.filename = filename;
+    }
+
+    public static void main(String[] args) throws JsonProcessingException {
+        List<AnimationFile> animationFiles =new ArrayList<>();
+        for (int i = 0; i <10 ; i++) {
+            AnimationFile animationFile =new AnimationFile();
+            animationFile.setStep(1);
+            animationFile.setFilename("asdf,afs");
+            animationFiles.add(animationFile);
+        }
+       String ms = XiJsonUtil.objectToJson(animationFiles);
+        System.out.println(ms);
+    }
+}

+ 20 - 14
src/main/java/com/miniframe/bisiness/system/AFT001Service.java

@@ -9,7 +9,9 @@ import java.util.stream.Stream;
 import com.alibaba.nacos.shaded.com.google.gson.JsonArray;
 import com.alibaba.nacos.shaded.com.google.gson.JsonObject;
 import com.alibaba.nacos.shaded.io.grpc.netty.shaded.io.netty.util.internal.StringUtil;
+import com.fasterxml.jackson.core.JsonProcessingException;
 import com.miniframe.aftercure.ActionMsg;
+import com.miniframe.aftercure.AnimationFile;
 import com.miniframe.aftercure.SliceMsg;
 import com.miniframe.aftercure.StreamMsg;
 import com.miniframe.constant.MFConstant;
@@ -326,12 +328,14 @@ public class AFT001Service extends AFT001BaseModel implements ExecProcessFlow {
 	 * @param obj
 	 * @throws BusinessException
 	 */
-	private void animationFemFile(String proId, JSONObject obj) throws BusinessException {
+	private void animationFemFile(String proId, JSONObject obj) throws BusinessException, JsonProcessingException {
 		String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+ proId;
 		String exePath = jobPath+ MFConstant.separator+"fem";
 		String exeOutPath = exePath+ MFConstant.separator+"data_out";
-		JSONArray jsonArray = new JSONArray();
+
 		List<Integer> steps = FEMPath.femTeps(proId);
+
+		List<AnimationFile> animationFiles =new ArrayList<>();
 		for (Integer st:steps) {
 			List<File> fileList = FEMPath.getStepFiles(proId,st.toString());
 			String fileName="";
@@ -342,14 +346,15 @@ public class AFT001Service extends AFT001BaseModel implements ExecProcessFlow {
 					fileName +=fileList.get(i).getName()+",";
 				}
 			}
-			JSONObject obj2 = new JSONObject();
-			obj2.put("step",st);
-			obj2.put("fileName",fileName);
-			jsonArray.put(obj2);
+
+			AnimationFile  animationFile =new AnimationFile();
+			animationFile.setStep(st);
+			animationFile.setFilename(fileName);
+			animationFiles.add(animationFile);
 		}
 		obj.put("filePath", exeOutPath);
 		obj.put("fileType", "ascii");
-		obj.put("fileName", jsonArray);
+		obj.put("fileNames", XiJsonUtil.objectToJson(animationFiles));
 	}
 
 	/**
@@ -423,12 +428,13 @@ public class AFT001Service extends AFT001BaseModel implements ExecProcessFlow {
 	 * @param obj
 	 * @throws BusinessException
 	 */
-	private void animationHcfdFile(String proId, JSONObject obj) throws BusinessException {
+	private void animationHcfdFile(String proId, JSONObject obj) throws BusinessException, JsonProcessingException {
 		String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+ proId;
 		String exePath = jobPath+ MFConstant.separator+"hcfd";
 		String testPath = exePath+ MFConstant.separator+"test";
 		String exeOutPath = testPath+ MFConstant.separator+"data_out";
-		JSONArray jsonArray = new JSONArray();
+//		JSONArray jsonArray = new JSONArray();
+		List<AnimationFile> animationFiles =new ArrayList<>();
 		List<Integer> steps =HcfdPath.hcfdTeps(proId);
 		for (Integer st:steps) {
 			List<File> fileList = HcfdPath.getStepFiles(proId, getA_aft001().getIsVolume(), st.toString());
@@ -440,14 +446,14 @@ public class AFT001Service extends AFT001BaseModel implements ExecProcessFlow {
 					fileName +=fileList.get(i).getName()+",";
 				}
 			}
-			JSONObject obj2 = new JSONObject();
-			obj2.put("step",st);
-			obj2.put("fileName",fileName);
-			jsonArray.put(obj2);
+			AnimationFile  animationFile =new AnimationFile();
+			animationFile.setStep(st);
+			animationFile.setFilename(fileName);
+			animationFiles.add(animationFile);
 		}
 		obj.put("filePath", exeOutPath);
 		obj.put("fileType", "ascii");
-		obj.put("fileNames", jsonArray);
+		obj.put("fileNames", XiJsonUtil.objectToJson(animationFiles));
 	}
 
 	/**