Explorar el Código

几何 cp 数据

huangxingxing hace 5 meses
padre
commit
32a0d7e584

+ 13 - 0
generated/com/miniframe/generate/comm/mdo/A_MDO0021.java

@@ -22,4 +22,17 @@ public class A_MDO0021 extends BaseMapModel implements Serializable {
 	public String getPid() {
 		return this.pid;
 	}
+	int type;//1-列表数据 2-几何数据 3-压力数据
+	/**
+	 *1-列表数据 2-几何数据 3-压力数据
+	 */
+	public void setType(int type) {
+		this.type=type;
+	}
+	/**
+	 *1-列表数据 2-几何数据 3-压力数据
+	 */
+	public int getType() {
+		return this.type;
+	}
 }

+ 1 - 0
generated/validator/resources_a_mdo0021Form_validator.properties

@@ -1,2 +1,3 @@
 a_mdo0021.pid = \u9879\u76EEID
+a_mdo0021.type = 1-\u5217\u8868\u6570\u636E2-\u51E0\u4F55\u6570\u636E3-\u538B\u529B\u6570\u636E
 a_mdo0021Form = true

+ 1 - 0
generated/validator/resources_a_mdo0021Form_validator_zh_CN.properties

@@ -1,2 +1,3 @@
 a_mdo0021.pid = \u9879\u76EEID
+a_mdo0021.type = 1-\u5217\u8868\u6570\u636E2-\u51E0\u4F55\u6570\u636E3-\u538B\u529B\u6570\u636E
 a_mdo0021Form = true

+ 23 - 0
modelsrc/com/miniframe/model/mdo/MdoProComval.java

@@ -32,6 +32,11 @@ public class MdoProComval extends MiniserviceBaseModel implements Serializable {
      */
     private String vals;
 
+    /**
+     * 1-列表数据 2-几何数据 3-压力数据
+     */
+    private Integer type;
+
     private static final long serialVersionUID = 1L;
 
     /**
@@ -123,4 +128,22 @@ public class MdoProComval extends MiniserviceBaseModel implements Serializable {
     public void setVals(String vals) {
         this.vals = vals == null ? null : vals.trim();
     }
+
+    /**
+     * 获取1-列表数据 2-几何数据 3-压力数据
+     *
+     * @return type - 1-列表数据 2-几何数据 3-压力数据
+     */
+    public Integer getType() {
+        return type;
+    }
+
+    /**
+     * 设置1-列表数据 2-几何数据 3-压力数据
+     *
+     * @param type 1-列表数据 2-几何数据 3-压力数据
+     */
+    public void setType(Integer type) {
+        this.type = type;
+    }
 }

+ 60 - 0
modelsrc/com/miniframe/model/mdo/MdoProComvalSQLBuilder.java

@@ -453,6 +453,66 @@ public class MdoProComvalSQLBuilder {
             addCriterion("vals not between", value1, value2, "vals");
             return (Criteria) this;
         }
+
+        public Criteria andTypeIsNull() {
+            addCriterion("type is null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIsNotNull() {
+            addCriterion("type is not null");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeEqualTo(Integer value) {
+            addCriterion("type =", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotEqualTo(Integer value) {
+            addCriterion("type <>", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeGreaterThan(Integer value) {
+            addCriterion("type >", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeGreaterThanOrEqualTo(Integer value) {
+            addCriterion("type >=", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLessThan(Integer value) {
+            addCriterion("type <", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeLessThanOrEqualTo(Integer value) {
+            addCriterion("type <=", value, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeIn(List<Integer> values) {
+            addCriterion("type in", values, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotIn(List<Integer> values) {
+            addCriterion("type not in", values, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeBetween(Integer value1, Integer value2) {
+            addCriterion("type between", value1, value2, "type");
+            return (Criteria) this;
+        }
+
+        public Criteria andTypeNotBetween(Integer value1, Integer value2) {
+            addCriterion("type not between", value1, value2, "type");
+            return (Criteria) this;
+        }
     }
 
     public static class Criteria extends GeneratedCriteria {

+ 1 - 1
modelsrc/com/miniframe/model/mdo/dbconfig/MapperConfig-mdo.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 Wed Mar 12 16:01:07 CST 2025.
+    This file was generated on Tue Mar 18 14:03:32 CST 2025.
   -->
   <mappers>
     <mapper resource="com/miniframe/model/mdo/xml/MdoProjectMapper.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 Wed Mar 12 16:01:07 CST 2025.
+    This file was generated on Tue Mar 18 14:03:33 CST 2025.
   -->
   <mappers>
     <mapper resource="com/miniframe/model/system/xml/SysAppcodeMapper.xml" />

+ 5 - 0
pom.xml

@@ -324,6 +324,11 @@
             <version>2.0.9</version>
         </dependency>
 
+        <dependency>
+            <groupId>org.hdfgroup</groupId>
+            <artifactId>hdf-java</artifactId>
+            <version>2.6.1</version>
+        </dependency>
 
     </dependencies>
 

+ 21 - 7
src/main/java/com/miniframe/bisiness/mdo/MDO0039Service.java

@@ -27,9 +27,8 @@ import com.miniframe.modo.temp.problem.WorkflowVo;
 import com.miniframe.tools.XIFileUtils;
 import com.miniframe.tools.XiJsonUtil;
 import com.miniframe.tools.docker.DockerExe;
-import com.miniframe.tools.file.FileMonitor;
-import com.miniframe.tools.file.SurromdaoFileListener;
-import com.miniframe.tools.file.SurromdaoFileRead;
+import com.miniframe.tools.file.*;
+import com.sun.media.sound.AiffFileReader;
 import freemarker.template.Configuration;
 import freemarker.template.Template;
 import lombok.SneakyThrows;
@@ -126,10 +125,21 @@ public class MDO0039Service extends MDO0039BaseModel implements ExecProcessFlow
 		MdoProComvalSQLBuilder.Criteria sc = sb.createCriteria();
 		sc.andPidEqualTo(pid);
 		comvalDao.deleteByExample(sb);
-		FileMonitor fileMonitor = new FileMonitor(1000);
+
+		FileMonitor surrMonitor = new FileMonitor(1000);
 		SurromdaoFileListener t= new SurromdaoFileListener(pid);
-		fileMonitor.monitor("/cephfs/mdo/"+pid+"/in/myid_0", t);
-		fileMonitor.start();
+		surrMonitor.monitor("/cephfs/mdo/"+pid+"/in/myid_0", t);
+		surrMonitor.start();
+
+		FileMonitor aifoilMonitor = new FileMonitor(1000);
+		AirfoilFileListener airfoilFileListener= new AirfoilFileListener(pid);
+		aifoilMonitor.monitor("/cephfs/mdo/"+pid+"/in/myid_0/xfoil", airfoilFileListener);
+		aifoilMonitor.start();
+
+		FileMonitor cpMonitor = new FileMonitor(1000);
+		CpFileListener cpFileListener= new CpFileListener(pid);
+		cpMonitor.monitor("/cephfs/mdo/"+pid+"/in/myid_0/xfoil", cpFileListener);
+		cpMonitor.start();
 
 		LogService.addLog(pid,"求解——————————————————开始");
 		DockerExe.stopDocker(pid);
@@ -175,8 +185,12 @@ public class MDO0039Service extends MDO0039BaseModel implements ExecProcessFlow
 			e.printStackTrace();
 		}
 			try {
-				fileMonitor.stop();
+				surrMonitor.stop();
 				SurromdaoFileRead.readFile(new File("/cephfs/mdo/"+pid+"/in/myid_0/surromdao_history_all.dat"),pid);
+				aifoilMonitor.stop();
+				AirfoilFileRead.readFile(new File("/cephfs/mdo/"+pid+"/in/myid_0/xfoil/airfoil.dat"),pid);
+				cpMonitor.stop();
+				CpFileRead.readFile(new File("/cephfs/mdo/"+pid+"/in/myid_0/xfoil/cp.dat"),pid);
 			} catch (Exception e) {
 				e.printStackTrace();
 			}

+ 41 - 0
src/main/java/com/miniframe/tools/file/AirfoilFileListener.java

@@ -0,0 +1,41 @@
+package com.miniframe.tools.file;
+
+import org.apache.commons.io.monitor.FileAlterationListenerAdaptor;
+
+import java.io.File;
+
+public class AirfoilFileListener extends FileAlterationListenerAdaptor {
+    private String filename ="airfoil.dat";
+    private String pid ;
+    private String line1;
+
+
+    public AirfoilFileListener(String pid) {
+        this.pid = pid;
+    }
+
+    @Override
+    public void onFileChange(File file) {
+        String compressedPath = file.getAbsolutePath();
+        if(filename.equals(file.getName())){
+            AirfoilFileRead.readFile(file,pid);
+        }
+    }
+
+
+
+    @Override
+    public void onFileCreate(File file) {
+        String compressedPath = file.getAbsolutePath();
+        if(filename.equals(file.getName())){
+
+        }
+    }
+    public String getFilename() {
+        return filename;
+    }
+
+    public void setFilename(String filename) {
+        this.filename = filename;
+    }
+}

+ 69 - 0
src/main/java/com/miniframe/tools/file/AirfoilFileRead.java

@@ -0,0 +1,69 @@
+package com.miniframe.tools.file;
+
+import com.google.gson.Gson;
+import com.miniframe.core.ext.UtilTools;
+import com.miniframe.model.mdo.MdoProComval;
+import com.miniframe.model.mdo.MdoProComvalSQLBuilder;
+import com.miniframe.model.mdo.dao.MdoProComvalMapper;
+import com.miniframe.websocket.WebsocketEndPoint;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.List;
+
+public class AirfoilFileRead {
+
+    public static void readFile(File file, String pid) {
+        String line1="";
+        MdoProComvalMapper comvalDao = UtilTools.getBean(MdoProComvalMapper.class);
+        MdoProComvalSQLBuilder sb =new MdoProComvalSQLBuilder();
+        MdoProComvalSQLBuilder.Criteria sc = sb.createCriteria();
+        sc.andPidEqualTo(pid);
+        sb.setOrderByClause("step asc");
+        List<MdoProComval> comvals =comvalDao.selectByExample(sb);
+        int con =0;
+        if(comvals!=null||!comvals.isEmpty()){
+            con=comvals.size();
+        }
+        int i= 0;
+        String line;
+        // 使用try-with-resources语句确保资源被正确关闭
+        try (BufferedReader br = new BufferedReader(new FileReader(file))) {
+
+            // 逐行读取,直到文件末尾
+            while ((line = br.readLine()) != null) {
+//                if(i ==0){
+//                    line=line.trim().replaceAll("\\s+"," ");//替换多个空格为一个空格
+//                    line=line.replace(" / ","/");
+//                    line1=line.replace("阻力系数Cdconstraint","阻力系数Cd constraint");
+//                    // 处理每一行数据
+//                    System.out.println(line);
+//                }
+//                if(!line.endsWith("\n")){
+
+//                }
+                if(i>con){
+                    String tvals=line.trim().replaceAll("\\s+"," ");//替换多个空格为一个空格
+                    MdoProComval comval =new MdoProComval();
+                    comval.setId(UtilTools.getUUid());
+                    comval.setPid(pid);
+                    comval.setStep(String.valueOf(i));
+                    comval.setVars("v1 v2");
+                    comval.setVals(tvals);
+                    comval.setType(2);//"1-列表数据 2-几何数据 3-压力数据"
+                    comvalDao.insert(comval);
+                    WebsocketEndPoint webs =  (WebsocketEndPoint) UtilTools.getBean("websocketEndPoint");
+                    Gson gson = new Gson();
+                    webs.sendMessageToUser(String.valueOf(pid),gson.toJson(comval));
+                }
+                i++;
+
+            }
+        } catch (IOException e) {
+            // 异常处理
+            e.printStackTrace();
+        }
+    }
+}

+ 41 - 0
src/main/java/com/miniframe/tools/file/CpFileListener.java

@@ -0,0 +1,41 @@
+package com.miniframe.tools.file;
+
+import org.apache.commons.io.monitor.FileAlterationListenerAdaptor;
+
+import java.io.File;
+
+public class CpFileListener extends FileAlterationListenerAdaptor {
+    private String filename ="cp.dat";
+    private String pid ;
+    private String line1;
+
+
+    public CpFileListener(String pid) {
+        this.pid = pid;
+    }
+
+    @Override
+    public void onFileChange(File file) {
+        String compressedPath = file.getAbsolutePath();
+        if(filename.equals(file.getName())){
+            CpFileRead.readFile(file,pid);
+        }
+    }
+
+
+
+    @Override
+    public void onFileCreate(File file) {
+        String compressedPath = file.getAbsolutePath();
+        if(filename.equals(file.getName())){
+
+        }
+    }
+    public String getFilename() {
+        return filename;
+    }
+
+    public void setFilename(String filename) {
+        this.filename = filename;
+    }
+}

+ 69 - 0
src/main/java/com/miniframe/tools/file/CpFileRead.java

@@ -0,0 +1,69 @@
+package com.miniframe.tools.file;
+
+import com.google.gson.Gson;
+import com.miniframe.core.ext.UtilTools;
+import com.miniframe.model.mdo.MdoProComval;
+import com.miniframe.model.mdo.MdoProComvalSQLBuilder;
+import com.miniframe.model.mdo.dao.MdoProComvalMapper;
+import com.miniframe.websocket.WebsocketEndPoint;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.util.List;
+
+public class CpFileRead {
+
+    public static void readFile(File file, String pid) {
+        String line1="";
+        MdoProComvalMapper comvalDao = UtilTools.getBean(MdoProComvalMapper.class);
+        MdoProComvalSQLBuilder sb =new MdoProComvalSQLBuilder();
+        MdoProComvalSQLBuilder.Criteria sc = sb.createCriteria();
+        sc.andPidEqualTo(pid);
+        sb.setOrderByClause("step asc");
+        List<MdoProComval> comvals =comvalDao.selectByExample(sb);
+        int con =0;
+        if(comvals!=null||!comvals.isEmpty()){
+            con=comvals.size();
+        }
+        int i= 0;
+        String line;
+        // 使用try-with-resources语句确保资源被正确关闭
+        try (BufferedReader br = new BufferedReader(new FileReader(file))) {
+
+            // 逐行读取,直到文件末尾
+            while ((line = br.readLine()) != null) {
+                if(i ==0){
+                    line=line.trim().replaceAll("\\s+"," ");//替换多个空格为一个空格
+                    line=line.replace(" / ","/");
+                    line1=line.replace("阻力系数Cdconstraint","阻力系数Cd constraint");
+                    // 处理每一行数据
+                    System.out.println(line);
+                }
+//                if(!line.endsWith("\n")){
+//                    break;
+//                }
+                if(i>con){
+                    String tvals=line.trim().replaceAll("\\s+"," ");//替换多个空格为一个空格
+                    MdoProComval comval =new MdoProComval();
+                    comval.setId(UtilTools.getUUid());
+                    comval.setPid(pid);
+                    comval.setStep(String.valueOf(i));
+                    comval.setVars(line1);
+                    comval.setVals(tvals);
+                    comval.setType(3);//"1-列表数据 2-几何数据 3-压力数据"
+                    comvalDao.insert(comval);
+                    WebsocketEndPoint webs =  (WebsocketEndPoint) UtilTools.getBean("websocketEndPoint");
+                    Gson gson = new Gson();
+                    webs.sendMessageToUser(String.valueOf(pid),gson.toJson(comval));
+                }
+                i++;
+
+            }
+        } catch (IOException e) {
+            // 异常处理
+            e.printStackTrace();
+        }
+    }
+}

+ 4 - 2
src/main/java/com/miniframe/tools/file/SurromdaoFileRead.java

@@ -41,6 +41,9 @@ public class SurromdaoFileRead {
                     // 处理每一行数据
                     System.out.println(line);
                 }
+//                if(!line.endsWith("\n")){
+//
+//                }
                 if(i>con){
                     String tvals=line.trim().replaceAll("\\s+"," ");//替换多个空格为一个空格
                     MdoProComval comval =new MdoProComval();
@@ -49,12 +52,11 @@ public class SurromdaoFileRead {
                     comval.setStep(String.valueOf(i));
                     comval.setVars(line1);
                     comval.setVals(tvals);
+                    comval.setType(1);
                     comvalDao.insert(comval);
-
                     WebsocketEndPoint webs =  (WebsocketEndPoint) UtilTools.getBean("websocketEndPoint");
                     Gson gson = new Gson();
                     webs.sendMessageToUser(String.valueOf(pid),gson.toJson(comval));
-
                 }
                 i++;
 

+ 2 - 1
系统设计/通信设计/通讯报文/mdo(系统服务)/报文体/MDO0021_A(求解过程变量数据获取).csv

@@ -1,2 +1,3 @@
 序号,英文名称,中文名称,数据类型,默认值,格式化,非空/引用,最小(长度/值),最大(长度/值),验证规则,标准数据ID,XML样式,TAG标签,映射/子标签,CDATA
-1,pid,项目ID,string,,,是,,,,,,,,
+1,pid,项目ID,string,,,是,,,,,,,,
+2,type,1-列表数据 2-几何数据 3-压力数据,int,,1,,,,,,,,,