Parcourir la source

求解结果 存储

huangxingxing il y a 2 jours
Parent
commit
02c3e057ca

+ 40 - 15
modelsrc/com/miniframe/model/ac/AcProResult.java

@@ -10,7 +10,8 @@ public class AcProResult extends MiniserviceBaseModel implements Serializable {
      * 主键
      */
     @Id
-    private String cid;
+    @Column(name = "pr_id")
+    private String prId;
 
     /**
      * 项目id
@@ -20,8 +21,8 @@ public class AcProResult extends MiniserviceBaseModel implements Serializable {
     /**
      * 数据类型
      */
-    @Column(name = "ast_id")
-    private String astId;
+    @Column(name = "ast_type")
+    private Integer astType;
 
     /**
      * rank0类型
@@ -44,24 +45,30 @@ public class AcProResult extends MiniserviceBaseModel implements Serializable {
      */
     private String value;
 
+    /**
+     * key中文
+     */
+    @Column(name = "key_zh")
+    private String keyZh;
+
     private static final long serialVersionUID = 1L;
 
     /**
      * 获取主键
      *
-     * @return cid - 主键
+     * @return pr_id - 主键
      */
-    public String getCid() {
-        return cid;
+    public String getPrId() {
+        return prId;
     }
 
     /**
      * 设置主键
      *
-     * @param cid 主键
+     * @param prId 主键
      */
-    public void setCid(String cid) {
-        this.cid = cid == null ? null : cid.trim();
+    public void setPrId(String prId) {
+        this.prId = prId == null ? null : prId.trim();
     }
 
     /**
@@ -85,19 +92,19 @@ public class AcProResult extends MiniserviceBaseModel implements Serializable {
     /**
      * 获取数据类型
      *
-     * @return ast_id - 数据类型
+     * @return ast_type - 数据类型
      */
-    public String getAstId() {
-        return astId;
+    public Integer getAstType() {
+        return astType;
     }
 
     /**
      * 设置数据类型
      *
-     * @param astId 数据类型
+     * @param astType 数据类型
      */
-    public void setAstId(String astId) {
-        this.astId = astId == null ? null : astId.trim();
+    public void setAstType(Integer astType) {
+        this.astType = astType;
     }
 
     /**
@@ -171,4 +178,22 @@ public class AcProResult extends MiniserviceBaseModel implements Serializable {
     public void setValue(String value) {
         this.value = value == null ? null : value.trim();
     }
+
+    /**
+     * 获取key中文
+     *
+     * @return key_zh - key中文
+     */
+    public String getKeyZh() {
+        return keyZh;
+    }
+
+    /**
+     * 设置key中文
+     *
+     * @param keyZh key中文
+     */
+    public void setKeyZh(String keyZh) {
+        this.keyZh = keyZh == null ? null : keyZh.trim();
+    }
 }

+ 122 - 62
modelsrc/com/miniframe/model/ac/AcProResultSQLBuilder.java

@@ -104,73 +104,73 @@ public class AcProResultSQLBuilder {
             criteria.add(new Criterion(condition, value1, value2));
         }
 
-        public Criteria andCidIsNull() {
-            addCriterion("cid is null");
+        public Criteria andPrIdIsNull() {
+            addCriterion("pr_id is null");
             return (Criteria) this;
         }
 
-        public Criteria andCidIsNotNull() {
-            addCriterion("cid is not null");
+        public Criteria andPrIdIsNotNull() {
+            addCriterion("pr_id is not null");
             return (Criteria) this;
         }
 
-        public Criteria andCidEqualTo(String value) {
-            addCriterion("cid =", value, "cid");
+        public Criteria andPrIdEqualTo(String value) {
+            addCriterion("pr_id =", value, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidNotEqualTo(String value) {
-            addCriterion("cid <>", value, "cid");
+        public Criteria andPrIdNotEqualTo(String value) {
+            addCriterion("pr_id <>", value, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidGreaterThan(String value) {
-            addCriterion("cid >", value, "cid");
+        public Criteria andPrIdGreaterThan(String value) {
+            addCriterion("pr_id >", value, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidGreaterThanOrEqualTo(String value) {
-            addCriterion("cid >=", value, "cid");
+        public Criteria andPrIdGreaterThanOrEqualTo(String value) {
+            addCriterion("pr_id >=", value, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidLessThan(String value) {
-            addCriterion("cid <", value, "cid");
+        public Criteria andPrIdLessThan(String value) {
+            addCriterion("pr_id <", value, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidLessThanOrEqualTo(String value) {
-            addCriterion("cid <=", value, "cid");
+        public Criteria andPrIdLessThanOrEqualTo(String value) {
+            addCriterion("pr_id <=", value, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidLike(String value) {
-            addCriterion("cid like", value, "cid");
+        public Criteria andPrIdLike(String value) {
+            addCriterion("pr_id like", value, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidNotLike(String value) {
-            addCriterion("cid not like", value, "cid");
+        public Criteria andPrIdNotLike(String value) {
+            addCriterion("pr_id not like", value, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidIn(List<String> values) {
-            addCriterion("cid in", values, "cid");
+        public Criteria andPrIdIn(List<String> values) {
+            addCriterion("pr_id in", values, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidNotIn(List<String> values) {
-            addCriterion("cid not in", values, "cid");
+        public Criteria andPrIdNotIn(List<String> values) {
+            addCriterion("pr_id not in", values, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidBetween(String value1, String value2) {
-            addCriterion("cid between", value1, value2, "cid");
+        public Criteria andPrIdBetween(String value1, String value2) {
+            addCriterion("pr_id between", value1, value2, "prId");
             return (Criteria) this;
         }
 
-        public Criteria andCidNotBetween(String value1, String value2) {
-            addCriterion("cid not between", value1, value2, "cid");
+        public Criteria andPrIdNotBetween(String value1, String value2) {
+            addCriterion("pr_id not between", value1, value2, "prId");
             return (Criteria) this;
         }
 
@@ -244,73 +244,63 @@ public class AcProResultSQLBuilder {
             return (Criteria) this;
         }
 
-        public Criteria andAstIdIsNull() {
-            addCriterion("ast_id is null");
+        public Criteria andAstTypeIsNull() {
+            addCriterion("ast_type is null");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdIsNotNull() {
-            addCriterion("ast_id is not null");
+        public Criteria andAstTypeIsNotNull() {
+            addCriterion("ast_type is not null");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdEqualTo(String value) {
-            addCriterion("ast_id =", value, "astId");
+        public Criteria andAstTypeEqualTo(Integer value) {
+            addCriterion("ast_type =", value, "astType");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdNotEqualTo(String value) {
-            addCriterion("ast_id <>", value, "astId");
+        public Criteria andAstTypeNotEqualTo(Integer value) {
+            addCriterion("ast_type <>", value, "astType");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdGreaterThan(String value) {
-            addCriterion("ast_id >", value, "astId");
+        public Criteria andAstTypeGreaterThan(Integer value) {
+            addCriterion("ast_type >", value, "astType");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdGreaterThanOrEqualTo(String value) {
-            addCriterion("ast_id >=", value, "astId");
+        public Criteria andAstTypeGreaterThanOrEqualTo(Integer value) {
+            addCriterion("ast_type >=", value, "astType");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdLessThan(String value) {
-            addCriterion("ast_id <", value, "astId");
+        public Criteria andAstTypeLessThan(Integer value) {
+            addCriterion("ast_type <", value, "astType");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdLessThanOrEqualTo(String value) {
-            addCriterion("ast_id <=", value, "astId");
+        public Criteria andAstTypeLessThanOrEqualTo(Integer value) {
+            addCriterion("ast_type <=", value, "astType");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdLike(String value) {
-            addCriterion("ast_id like", value, "astId");
+        public Criteria andAstTypeIn(List<Integer> values) {
+            addCriterion("ast_type in", values, "astType");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdNotLike(String value) {
-            addCriterion("ast_id not like", value, "astId");
+        public Criteria andAstTypeNotIn(List<Integer> values) {
+            addCriterion("ast_type not in", values, "astType");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdIn(List<String> values) {
-            addCriterion("ast_id in", values, "astId");
+        public Criteria andAstTypeBetween(Integer value1, Integer value2) {
+            addCriterion("ast_type between", value1, value2, "astType");
             return (Criteria) this;
         }
 
-        public Criteria andAstIdNotIn(List<String> values) {
-            addCriterion("ast_id not in", values, "astId");
-            return (Criteria) this;
-        }
-
-        public Criteria andAstIdBetween(String value1, String value2) {
-            addCriterion("ast_id between", value1, value2, "astId");
-            return (Criteria) this;
-        }
-
-        public Criteria andAstIdNotBetween(String value1, String value2) {
-            addCriterion("ast_id not between", value1, value2, "astId");
+        public Criteria andAstTypeNotBetween(Integer value1, Integer value2) {
+            addCriterion("ast_type not between", value1, value2, "astType");
             return (Criteria) this;
         }
 
@@ -583,6 +573,76 @@ public class AcProResultSQLBuilder {
             addCriterion("value not between", value1, value2, "value");
             return (Criteria) this;
         }
+
+        public Criteria andKeyZhIsNull() {
+            addCriterion("key_zh is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhIsNotNull() {
+            addCriterion("key_zh is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhEqualTo(String value) {
+            addCriterion("key_zh =", value, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhNotEqualTo(String value) {
+            addCriterion("key_zh <>", value, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhGreaterThan(String value) {
+            addCriterion("key_zh >", value, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhGreaterThanOrEqualTo(String value) {
+            addCriterion("key_zh >=", value, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhLessThan(String value) {
+            addCriterion("key_zh <", value, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhLessThanOrEqualTo(String value) {
+            addCriterion("key_zh <=", value, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhLike(String value) {
+            addCriterion("key_zh like", value, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhNotLike(String value) {
+            addCriterion("key_zh not like", value, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhIn(List<String> values) {
+            addCriterion("key_zh in", values, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhNotIn(List<String> values) {
+            addCriterion("key_zh not in", values, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhBetween(String value1, String value2) {
+            addCriterion("key_zh between", value1, value2, "keyZh");
+            return (Criteria) this;
+        }
+
+        public Criteria andKeyZhNotBetween(String value1, String value2) {
+            addCriterion("key_zh not between", value1, value2, "keyZh");
+            return (Criteria) this;
+        }
     }
 
     public static class Criteria extends GeneratedCriteria {

+ 1 - 1
modelsrc/com/miniframe/model/ac/dbconfig/MapperConfig-ac.xml

@@ -5,7 +5,7 @@
     This file is generated by MyBatis Generator.
     This file is the shell of a Mapper Config file - in many cases you will need to add
       to this file before it is usable by MyBatis.
-    This file was generated on Mon Sep 08 14:21:09 CST 2025.
+    This file was generated on Mon Sep 08 15:08:46 CST 2025.
   -->
   <mappers>
     <mapper resource="com/miniframe/model/ac/xml/AcProMapper.xml" />

+ 1 - 1
modelsrc/com/miniframe/model/system/dbconfig/MapperConfig-system.xml

@@ -5,7 +5,7 @@
     This file is generated by MyBatis Generator.
     This file is the shell of a Mapper Config file - in many cases you will need to add
       to this file before it is usable by MyBatis.
-    This file was generated on Mon Sep 08 14:21:10 CST 2025.
+    This file was generated on Mon Sep 08 15:08:46 CST 2025.
   -->
   <mappers>
     <mapper resource="com/miniframe/model/system/xml/SysAppcodeMapper.xml" />

+ 159 - 2
src/main/java/com/miniframe/bisiness/ac/AC00006Service.java

@@ -1,5 +1,10 @@
 package com.miniframe.bisiness.ac;
 
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
@@ -7,7 +12,11 @@ import ac.template.TemplateGenerator;
 import com.github.dockerjava.api.async.ResultCallback;
 import com.github.dockerjava.api.model.Frame;
 import com.miniframe.core.ExecProcessFlow;
+import com.miniframe.core.ext.UtilTools;
 import com.miniframe.generate.business.ac.model.AC00006BaseModel;
+import com.miniframe.model.ac.AcProResult;
+import com.miniframe.model.ac.AcProResultSQLBuilder;
+import com.miniframe.model.ac.dao.AcProResultMapper;
 import com.miniframe.tools.XIFileUtils;
 import com.miniframe.tools.docker.DockerExe;
 import service.LogService;
@@ -31,16 +40,16 @@ public class AC00006Service extends AC00006BaseModel implements ExecProcessFlow
 		XIFileUtils.mkdir(XIFileUtils.getRootPathStr()+"/ac/"+pid+"/"+type);
 		TemplateGenerator.createGuiXml(pid,type);
 		run(pid,type);
-
 	}
 	private void run(String pid,Integer type) throws Exception {
 		LogService.clearLog(pid,type);
+		deleteResult(pid, type);
 		LogService.addLog(pid,type,"求解——————————————————开始");
 		DockerExe.stopDocker(pid);
 		DockerExe.run(pid,type);
 		final int[] con = {0};
 		final String[] line = {""};
-		CompletableFuture<Void> cf = CompletableFuture.supplyAsync(()-> {try {
+		CompletableFuture<Void> cf = CompletableFuture.supplyAsync(()-> { try {
 			DockerExe.getDockerLogs(pid,new ResultCallback.Adapter<Frame>() {
 				@Override
 				public void onNext(Frame frame) {
@@ -74,6 +83,7 @@ public class AC00006Service extends AC00006BaseModel implements ExecProcessFlow
 				}
 			});
 			LogService.addLog(pid,type,"求解——————————————————成功");
+			readLog(pid,type);
 		} catch (Exception e) {
 			LogService.addLog(pid,type,"求解——————————————————失败");
 			e.printStackTrace();
@@ -81,6 +91,153 @@ public class AC00006Service extends AC00006BaseModel implements ExecProcessFlow
 			return null;
 		});
 	}
+
+	private void deleteResult(String pid, Integer type) {
+		AcProResultMapper ardao = UtilTools.getBean(AcProResultMapper.class);
+		AcProResultSQLBuilder sb = new AcProResultSQLBuilder();
+		AcProResultSQLBuilder.Criteria sc = sb.createCriteria();
+		sc.andPidEqualTo(pid);
+		sc.andAstTypeEqualTo(type);
+		ardao.deleteByExample(sb);
+	}
+
+	private void readLog(String pid ,Integer type) throws IOException {
+		List<String> lines = LogService.readLog(pid,type);
+		List<AcProResult> ars = new ArrayList<>();
+		String rankType = null;
+		int step =0;
+		for (String l:lines) {
+			if(l.indexOf("rank0")>0){
+				String[] lr =l.split("rank0:")[1].split("\\|");
+				rankType= lr[0];
+				step= Integer.valueOf(lr[1]);
+			}
+			if(l.indexOf("thickness_cp")>0){
+				String val= l.split("array")[1];
+				val=val.replace("(","") .replace(")","")
+						.replace("{","").replace("}","")
+						.replace("[","").replace("]","");
+				AcProResult ar =new AcProResult();
+				ar.setPrId(UtilTools.getUUid());
+				ar.setKey("thickness_cp");
+				ar.setKeyZh("厚度分布");
+				ar.setAstType(type);
+				ar.setPid(pid);
+				ar.setRankType(rankType);
+				ar.setStep(step);
+				ar.setValue(val);
+				ars.add(ar);
+				continue;
+			}
+			if(l.indexOf("twist_cp")>0){
+				String val= l.split("array")[1];
+				val=val.replace("(","") .replace(")","")
+						.replace("{","").replace("}","")
+						.replace("[","").replace("]","");
+				AcProResult ar =new AcProResult();
+				ar.setPrId(UtilTools.getUUid());
+				ar.setKey("twist_cp");
+				ar.setKeyZh("流转分布");
+				ar.setAstType(type);
+				ar.setPid(pid);
+				ar.setRankType(rankType);
+				ar.setStep(step);
+				ar.setValue(val);
+				ars.add(ar);
+				continue;
+			}
+			if(l.indexOf("CL")>0){
+				String val= l.split("array")[1];
+				val=val.replace("(","") .replace(")","")
+						.replace("{","").replace("}","")
+						.replace("[","").replace("]","");
+				AcProResult ar =new AcProResult();
+				ar.setPrId(UtilTools.getUUid());
+				ar.setKey("CL");
+				ar.setKeyZh("升力系数");
+				ar.setAstType(type);
+				ar.setPid(pid);
+				ar.setRankType(rankType);
+				ar.setStep(step);
+				ar.setValue(val);
+				ars.add(ar);
+				continue;
+			}
+			if(l.indexOf("CD")>0){
+				String val= l.split("array")[1];
+				val=val.replace("(","") .replace(")","")
+						.replace("{","").replace("}","")
+						.replace("[","").replace("]","");
+				AcProResult ar =new AcProResult();
+				ar.setPrId(UtilTools.getUUid());
+				ar.setKey("CD");
+				ar.setKeyZh("阻力系数");
+				ar.setAstType(type);
+				ar.setPid(pid);
+				ar.setRankType(rankType);
+				ar.setStep(step);
+				ar.setValue(val);
+				ars.add(ar);
+				continue;
+			}
+			if(l.indexOf("failure")>0){
+				String val= l.split("array")[1];
+				val=val.replace("(","") .replace(")","")
+						.replace("{","").replace("}","")
+						.replace("[","").replace("]","");
+				AcProResult ar =new AcProResult();
+				ar.setPrId(UtilTools.getUUid());
+				ar.setKey("failure");
+				ar.setKeyZh("失效应力");
+				ar.setAstType(type);
+				ar.setPid(pid);
+				ar.setRankType(rankType);
+				ar.setStep(step);
+				ar.setValue(val);
+				ars.add(ar);
+				continue;
+			}
+			if(l.indexOf("structural_mass")>0){
+				String val= l.split("array")[1];
+				val=val.replace("(","") .replace(")","")
+						.replace("{","").replace("}","")
+						.replace("[","").replace("]","");
+				AcProResult ar =new AcProResult();
+				ar.setPrId(UtilTools.getUUid());
+				ar.setKey("structural_mass");
+				ar.setKeyZh("结构质量");
+				ar.setAstType(type);
+				ar.setPid(pid);
+				ar.setRankType(rankType);
+				ar.setStep(step);
+				ar.setValue(val);
+				ars.add(ar);
+				continue;
+			}
+			if(l.indexOf("fuelburn")>0){
+				String val= l.split("array")[1];
+				val=val.replace("(","") .replace(")","")
+						.replace("{","").replace("}","")
+						.replace("[","").replace("]","");
+				AcProResult ar =new AcProResult();
+				ar.setPrId(UtilTools.getUUid());
+				ar.setKey("fuelburn");
+				ar.setKeyZh("燃油消耗");
+				ar.setAstType(type);
+				ar.setPid(pid);
+				ar.setRankType(rankType);
+				ar.setStep(step);
+				ar.setValue(val);
+				ars.add(ar);
+				continue;
+			}
+		}
+
+		AcProResultMapper ardao = UtilTools.getBean(AcProResultMapper.class);
+		for (AcProResult ar: ars) {
+			ardao.insert(ar);
+		}
+	}
 	
 	/**
 	 * 气动设计系统,“项目求解”业务前处理

+ 1 - 1
src/main/java/com/miniframe/dbtransfer/AcProResultDbTransfer.java

@@ -5,7 +5,7 @@ import java.io.Serializable;
 import java.util.List;
 import java.util.Map;
 
-import com.miniframe.model.system.AcProResult;
+import com.miniframe.model.ac.AcProResult;
 
 /**
  * 实体列表,“AC_PRO_RESULT”数据库数据转化逻辑处理(重新生成不覆盖)。

+ 8 - 0
src/main/java/service/LogService.java

@@ -9,6 +9,9 @@ import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.List;
 import java.util.concurrent.CompletableFuture;
 
 public class LogService {
@@ -43,6 +46,11 @@ public class LogService {
         }
     }
 
+    public static List<String>  readLog(String pid,Integer type) throws IOException {
+        List<String> lines = Files.readAllLines(Paths.get(LogService.BPATH+"/"+pid+"/"+type+"/log.txt"));
+        return lines;
+    }
+
     /**
      * 文件内容追加
      * @param

+ 15 - 15
src/test/java/com/miniframe/AcProResultTest.java

@@ -31,21 +31,21 @@ public class AcProResultTest implements CommandLineRunner {
             line = reader.readLine();
             while (line != null) {
                 if(line.contains("rank0")){
-                    String[] parts = line.split("[:|]");
-                    String afterColon = parts[1];
-                    String afterPipe = parts[2];
-                    AcProResult acProResult = new AcProResult();
-                    acProResult.setCid(UtilTools.getUUid());
-                    acProResult.setPid("1111111111");
-                    acProResult.setAstId("c");
-                    acProResult.setRankType(afterColon);
-                    acProResult.setStep();
-                    line = reader.readLine();
-                    while (true){
-                        if(line.contains("twist_cp")){
-                            acProResult.set
-                        }
-                    }
+//                    String[] parts = line.split("[:|]");
+//                    String afterColon = parts[1];
+//                    String afterPipe = parts[2];
+//                    AcProResult acProResult = new AcProResult();
+//                    acProResult.setCid(UtilTools.getUUid());
+//                    acProResult.setPid("1111111111");
+//                    acProResult.setAstId("c");
+//                    acProResult.setRankType(afterColon);
+//                    acProResult.setStep();
+//                    line = reader.readLine();
+//                    while (true){
+//                        if(line.contains("twist_cp")){
+//                            acProResult.set
+//                        }
+//                    }
                 }
             }
         } catch (IOException e) {

+ 144 - 0
src/test/java/com/miniframe/AcTest.java

@@ -3,11 +3,17 @@ package com.miniframe;
 import ac.template.TemplateGenerator;
 import ac.template.TemplateServer;
 import ac.template.model.gui.AttVo;
+import com.miniframe.core.ext.UtilTools;
+import com.miniframe.model.ac.AcProResult;
 import freemarker.template.TemplateException;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;
+import service.LogService;
 
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
 import java.util.List;
 
 @SpringBootTest
@@ -19,4 +25,142 @@ public class AcTest {
         TemplateGenerator.createGuiXml("d540dd9b4d764895b471e7b077eb1c04",0);
     }
 
+    public static void main(String[] args) throws IOException {
+        readLog("t",1);
+    }
+
+    public static void readLog(String pid ,Integer type) throws IOException {
+        List<String> lines = Files.readAllLines(Paths.get("D://log_qt.txt"));
+        List<AcProResult> ars = new ArrayList<>();
+        String rankType = null;
+        int step =0;
+        for (String l:lines) {
+            if(l.indexOf("rank0")>0){
+                String[] lr =l.split("rank0:")[1].split("\\|");
+                rankType= lr[0];
+                step= Integer.valueOf(lr[1]);
+            }
+            if(l.indexOf("thickness_cp")>0){
+                String val= l.split("array")[1];
+                val=val.replace("(","") .replace(")","")
+                        .replace("{","").replace("}","")
+                        .replace("[","").replace("]","");
+                AcProResult ar =new AcProResult();
+                ar.setPrId(UtilTools.getUUid());
+                ar.setKey("thickness_cp");
+                ar.setKeyZh("厚度分布");
+                ar.setAstType(type);
+                ar.setPid(pid);
+                ar.setRankType(rankType);
+                ar.setStep(step);
+                ar.setValue(val);
+                ars.add(ar);
+                continue;
+            }
+            if(l.indexOf("twist_cp")>0){
+                String val= l.split("array")[1];
+                val=val.replace("(","") .replace(")","")
+                        .replace("{","").replace("}","")
+                        .replace("[","").replace("]","");
+                AcProResult ar =new AcProResult();
+                ar.setPrId(UtilTools.getUUid());
+                ar.setKey("twist_cp");
+                ar.setKeyZh("流转分布");
+                ar.setAstType(type);
+                ar.setPid(pid);
+                ar.setRankType(rankType);
+                ar.setStep(step);
+                ar.setValue(val);
+                ars.add(ar);
+                continue;
+            }
+            if(l.indexOf("CL")>0){
+                String val= l.split("array")[1];
+                val=val.replace("(","") .replace(")","")
+                        .replace("{","").replace("}","")
+                        .replace("[","").replace("]","");
+                AcProResult ar =new AcProResult();
+                ar.setPrId(UtilTools.getUUid());
+                ar.setKey("CL");
+                ar.setKeyZh("升力系数");
+                ar.setAstType(type);
+                ar.setPid(pid);
+                ar.setRankType(rankType);
+                ar.setStep(step);
+                ar.setValue(val);
+                ars.add(ar);
+                continue;
+            }
+            if(l.indexOf("CD")>0){
+                String val= l.split("array")[1];
+                val=val.replace("(","") .replace(")","")
+                        .replace("{","").replace("}","")
+                        .replace("[","").replace("]","");
+                AcProResult ar =new AcProResult();
+                ar.setPrId(UtilTools.getUUid());
+                ar.setKey("CD");
+                ar.setKeyZh("阻力系数");
+                ar.setAstType(type);
+                ar.setPid(pid);
+                ar.setRankType(rankType);
+                ar.setStep(step);
+                ar.setValue(val);
+                ars.add(ar);
+                continue;
+            }
+            if(l.indexOf("failure")>0){
+                String val= l.split("array")[1];
+                val=val.replace("(","") .replace(")","")
+                        .replace("{","").replace("}","")
+                        .replace("[","").replace("]","");
+                AcProResult ar =new AcProResult();
+                ar.setPrId(UtilTools.getUUid());
+                ar.setKey("failure");
+                ar.setKeyZh("失效应力");
+                ar.setAstType(type);
+                ar.setPid(pid);
+                ar.setRankType(rankType);
+                ar.setStep(step);
+                ar.setValue(val);
+                ars.add(ar);
+                continue;
+            }
+            if(l.indexOf("structural_mass")>0){
+                String val= l.split("array")[1];
+                val=val.replace("(","") .replace(")","")
+                        .replace("{","").replace("}","")
+                        .replace("[","").replace("]","");
+                AcProResult ar =new AcProResult();
+                ar.setPrId(UtilTools.getUUid());
+                ar.setKey("structural_mass");
+                ar.setKeyZh("结构质量");
+                ar.setAstType(type);
+                ar.setPid(pid);
+                ar.setRankType(rankType);
+                ar.setStep(step);
+                ar.setValue(val);
+                ars.add(ar);
+                continue;
+            }
+            if(l.indexOf("fuelburn")>0){
+                String val= l.split("array")[1];
+                val=val.replace("(","") .replace(")","")
+                        .replace("{","").replace("}","")
+                        .replace("[","").replace("]","");
+                AcProResult ar =new AcProResult();
+                ar.setPrId(UtilTools.getUUid());
+                ar.setKey("fuelburn");
+                ar.setKeyZh("燃油消耗");
+                ar.setAstType(type);
+                ar.setPid(pid);
+                ar.setRankType(rankType);
+                ar.setStep(step);
+                ar.setValue(val);
+                ars.add(ar);
+                continue;
+            }
+        }
+
+    }
+
 }