hxx 2 tahun lalu
induk
melakukan
eaf8f0fdff

+ 5 - 4
src/main/java/com/miniframe/bisiness/system/C00005Service.java

@@ -65,7 +65,6 @@ public class C00005Service extends C00005BaseModel implements ExecProcessFlow {
 		AdiSolverJob job =AdiSolverJobService.createJob(config);//创建执行任务
 
 		if(solver.getCompany().equals("Adi.SimWork")&& solver.getSolverModel().equals("HCFDLab")){
-
 			HcfdParam param = XiJsonUtil.jsonToPojo(config.getParameterObj(),HcfdParam.class);
 			HcfdExe.CreateMpbcFile(null,config);
 			HcfdExe.CreateNmlFile(null,config);
@@ -75,11 +74,13 @@ public class C00005Service extends C00005BaseModel implements ExecProcessFlow {
 			vfred=param.getNmlParam().getVolume_animation_freq().toString();
 			afred=param.getNmlParam().getAnimation_freq().toString();
 			String url="http://localhost:8082/solverres";//TODO 通过资源数据获取IP
-			httpExeJob(job,url,vfred,afred,null);
+			httpExeJob(job,"hcfd",url,vfred,afred,null);
 		}
 		if(solver.getCompany().equals("ADI.SimWork")&& solver.getSolverModel().equals("FEMLab(结构力学)")){
 			FEMParam param =XiJsonUtil.jsonToPojo(config.getParameterObj(),FEMParam.class);
 			FEMOrder.CreateAnalysisFile(null,config);
+			String url="http://192.168.0.109:8082/solverres";//TODO 通过资源数据获取IP
+			httpExeJob(job,"fem",url,null,null,null);
 		}
 
 		//文件封装,
@@ -94,14 +95,14 @@ public class C00005Service extends C00005BaseModel implements ExecProcessFlow {
 	 * @param afred
 	 * @throws Exception
 	 */
-	private void httpExeJob(AdiSolverJob job,String url,String vfred,String afred ,String resources) throws Exception  {
+	private void httpExeJob(AdiSolverJob job,String projectType,String url,String vfred,String afred ,String resources) throws Exception  {
 		String path ="";
 		String method="";
 		Map<String, String> headers = new HashMap<>();
 		Map<String, String> querys= new HashMap<>();
 		Map<String, String> bodys= new HashMap<>();
 		bodys.put("jobId", job.getId());
-		bodys.put("projectType", "hcfd");
+//		bodys.put("projectType", "hcfd");
 		bodys.put("jobOrder", "");
 		bodys.put("projectId", job.getPid());
 		bodys.put("orderType", "");

+ 1 - 1
src/main/java/com/miniframe/solverconfig/fem/FEMParam.java

@@ -13,7 +13,7 @@ public class FEMParam  implements SolverParam {
      * 上传文件名称
      * "mesh_inp "3" "2.2_flat_dynamicResponse-transient.bdf"
      */
-    private FEMElement mesh_inp =new FEMElement("mesh_inp","3",null);
+    private FEMElement mesh_inp =new FEMElement("mesh_inp","3","fem.bdf");
 
     /**
      * Static(静态)

+ 67 - 0
src/main/java/com/miniframe/solverconfig/fem/FEMPath.java

@@ -0,0 +1,67 @@
+package com.miniframe.solverconfig.fem;
+
+import com.miniframe.constant.MFConstant;
+import com.miniframe.core.ext.UtilTools;
+import com.miniframe.model.system.AdiModeling;
+import com.miniframe.model.system.AdiSolverConfig;
+import com.miniframe.model.system.AdiSolverJob;
+import com.miniframe.model.system.SysFile;
+import com.miniframe.model.system.dao.SysFileMapper;
+import com.miniframe.tools.XIFileUtils;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+
+/**
+ * 对执行所需要的文件进行文件夹规整已满足求解
+ */
+public class FEMPath {
+
+    public static  void femCreatePath(AdiModeling modeling,
+                                      AdiSolverConfig config,
+                                      AdiSolverJob job ) throws IOException {
+        String jobPath = XIFileUtils.getRootPathStr()+ MFConstant.separator+job.getPid();
+        System.out.println(jobPath);
+        String exePath = jobPath+ MFConstant.separator+"fem";
+        String exeInPath = exePath+ MFConstant.separator+"data_in";
+        File exeInDir = new File(exeInPath);
+        if(!exeInDir.exists()){
+            exeInDir.mkdirs();
+        }
+        String exeOutPath = exePath+ MFConstant.separator+"data_out";
+        File exeOutDir = new File(exeOutPath);
+        if(!exeOutDir.exists()){
+            exeOutDir.mkdirs();
+        }
+        SysFileMapper fileMapper = UtilTools.getBean(SysFileMapper.class);
+        SysFile nmlFile= fileMapper.selectByPrimaryKey(config.getNmlFile());
+        fileMove(nmlFile,exePath+MFConstant.separator+"analysis.in");
+        SysFile mapbcFile= fileMapper.selectByPrimaryKey(config.getMapbcFile());
+        fileMove(mapbcFile,exeInPath+MFConstant.separator+"fem.bdf");
+//        SysFile grid= fileMapper.selectByPrimaryKey(modeling.getGridFile());
+//        fileMove(grid,exeInPath+MFConstant.separator+"FE_Pre_New.vtk");
+    }
+
+    /**
+     * 文件移动
+     * @param file
+     * @param pathStr
+     * @throws IOException
+     */
+    public static void fileMove(SysFile file ,String pathStr) throws IOException {
+        Path path = Paths.get(pathStr);
+        SysFileMapper fileMapper = UtilTools.getBean(SysFileMapper.class);
+        Files.move(Paths.get( XIFileUtils.getRootPathStr()+ MFConstant.separator+file.getFilepath()),
+                path, StandardCopyOption.REPLACE_EXISTING);
+        String fielRelativePath = XIFileUtils.getRelativizePathStr(path);
+        file.setFilepath(fielRelativePath);
+        file.setFilename(path.getFileName().toString());
+        fileMapper.updateByPrimaryKey(file);
+    }
+
+
+}