|
@@ -168,6 +168,12 @@ public class TemplateGenerator {
|
|
|
vo.setXfoil(xfoil);
|
|
|
MdoProAdflow adflow = findAdflow(pid);
|
|
|
vo.setAdflow(adflow);
|
|
|
+ MdoProMathfunc mathfunc = findMashfunc(pid);
|
|
|
+ vo.setMathfunc(mathfunc);
|
|
|
+ MdoProTacs tacs = findTasc(pid);
|
|
|
+ tacs.setThickness(tacs.getThickness().replace(",",";"));
|
|
|
+ vo.setTacs(tacs);
|
|
|
+ MdoProFsi fsi =findFsi(pid);
|
|
|
//不用生成
|
|
|
if(xfoil==null&& adflow==null){
|
|
|
return null;
|
|
@@ -201,14 +207,75 @@ public class TemplateGenerator {
|
|
|
vo.setAdinvo(adinvo);
|
|
|
|
|
|
AdflowOutVo adoutvo = new AdflowOutVo();
|
|
|
- adoutvo.setCl(getValByParaListAndCode(adInoutList,"cl"));
|
|
|
- adoutvo.setCd(getValByParaListAndCode(adInoutList,"cd"));
|
|
|
- adoutvo.setCmz(getValByParaListAndCode(adInoutList,"cmz"));
|
|
|
+
|
|
|
+ String cl = getValByParaListAndCode(adInoutList,"cl");
|
|
|
+ if("false".equals(cl)){
|
|
|
+ adoutvo.setIscl(false);
|
|
|
+ }else{
|
|
|
+ adoutvo.setIscl(true);
|
|
|
+ adoutvo.setCl(cl);
|
|
|
+ }
|
|
|
+ String cd = getValByParaListAndCode(adInoutList,"cd");
|
|
|
+ if("false".equals(cd)){
|
|
|
+ adoutvo.setIscd(false);
|
|
|
+ }else{
|
|
|
+ adoutvo.setIscd(true);
|
|
|
+ adoutvo.setCd(cd);
|
|
|
+ }
|
|
|
+
|
|
|
+ String cmz = getValByParaListAndCode(adInoutList,"cmz");
|
|
|
+ if("false".equals(cmz)){
|
|
|
+ adoutvo.setIscmz(false);
|
|
|
+ }else{
|
|
|
+ adoutvo.setIscmz(true);
|
|
|
+ adoutvo.setCmz(cmz);
|
|
|
+ }
|
|
|
+
|
|
|
+ String cmy = getValByParaListAndCode(adInoutList,"cmy");
|
|
|
+ if("false".equals(cmy)){
|
|
|
+ adoutvo.setIscmy(false);
|
|
|
+ }else{
|
|
|
+ adoutvo.setIscmy(true);
|
|
|
+ adoutvo.setCmy(cmy);
|
|
|
+ }
|
|
|
+
|
|
|
vo.setAdoutvo(adoutvo);
|
|
|
}
|
|
|
|
|
|
+ if(tacs!=null){
|
|
|
+ List<MdoProInoutPara> adInoutList = findMdoProInoutParas(pid, tacs.getId());
|
|
|
+ TacsOutVo tacsoutvo =new TacsOutVo();
|
|
|
|
|
|
+ String mass = getValByParaListAndCode(adInoutList,"mass");
|
|
|
+ if("false".equals(mass)){
|
|
|
+ tacsoutvo.setIsmass(false);
|
|
|
+ }else{
|
|
|
+ tacsoutvo.setIsmass(true);
|
|
|
+ tacsoutvo.setMass(mass);
|
|
|
+ }
|
|
|
+ String ks_vmfailure = getValByParaListAndCode(adInoutList,"ks_vmfailure");
|
|
|
+ if("false".equals(ks_vmfailure)){
|
|
|
+ tacsoutvo.setIsks_vmfailure(false);
|
|
|
+ }else{
|
|
|
+ tacsoutvo.setIsks_vmfailure(true);
|
|
|
+ tacsoutvo.setKs_vmfailure(ks_vmfailure);
|
|
|
+ }
|
|
|
+ String maxdeform = getValByParaListAndCode(adInoutList,"maxdeform");
|
|
|
+ if("false".equals(maxdeform)){
|
|
|
+ tacsoutvo.setIsmaxdeform(false);
|
|
|
+ }else{
|
|
|
+ tacsoutvo.setIsmaxdeform(true);
|
|
|
+ tacsoutvo.setMaxdeform(maxdeform);
|
|
|
+ }
|
|
|
+ vo.setTacsoutvo(tacsoutvo);
|
|
|
+ }
|
|
|
|
|
|
+ if(mathfunc!=null){
|
|
|
+ List<MdoProInoutPara> adInoutList = findMdoProInoutParas(pid, tacs.getId());
|
|
|
+ MathfuncVo mathfuncVo =new MathfuncVo();
|
|
|
+ mathfuncVo.setCd_mass(getValByParaListAndCode(adInoutList,"cd_mass"));
|
|
|
+ vo.setMathfuncVo(mathfuncVo);
|
|
|
+ }
|
|
|
|
|
|
MdoProCst cst = findCst(pid);
|
|
|
vo.setCst(cst);
|
|
@@ -217,6 +284,33 @@ public class TemplateGenerator {
|
|
|
return vo;
|
|
|
}
|
|
|
|
|
|
+ private static MdoProFsi findFsi(String pid) {
|
|
|
+ MdoProFsiMapper xdao = UtilTools.getBean(MdoProFsiMapper.class);
|
|
|
+ MdoProFsiSQLBuilder xsb = new MdoProFsiSQLBuilder();
|
|
|
+ MdoProFsiSQLBuilder.Criteria xsc =xsb.createCriteria();
|
|
|
+ xsc.andPidEqualTo(pid);
|
|
|
+ List<MdoProFsi> xList = xdao.selectByExample(xsb);
|
|
|
+ MdoProFsi fsi =null;
|
|
|
+ if(xList!=null&&!xList.isEmpty()){
|
|
|
+ fsi=xList.get(0);
|
|
|
+ }
|
|
|
+ return fsi;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static MdoProTacs findTasc(String pid) {
|
|
|
+ MdoProTacsMapper xdao = UtilTools.getBean(MdoProTacsMapper.class);
|
|
|
+ MdoProTacsSQLBuilder xsb = new MdoProTacsSQLBuilder();
|
|
|
+ MdoProTacsSQLBuilder.Criteria xsc =xsb.createCriteria();
|
|
|
+ xsc.andPidEqualTo(pid);
|
|
|
+ List<MdoProTacs> xList = xdao.selectByExample(xsb);
|
|
|
+ MdoProTacs tacs =null;
|
|
|
+ if(xList!=null&&!xList.isEmpty()){
|
|
|
+ tacs=xList.get(0);
|
|
|
+ }
|
|
|
+ return tacs;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
private static List<MdoProInoutPara> findMdoProInoutParas(String pid, String fatherid) {
|
|
|
MdoProInoutParaMapper xdao = UtilTools.getBean(MdoProInoutParaMapper.class);
|
|
|
MdoProInoutParaSQLBuilder xsb = new MdoProInoutParaSQLBuilder();
|
|
@@ -234,10 +328,23 @@ public class TemplateGenerator {
|
|
|
}).collect(Collectors.toList());
|
|
|
if(tList!=null&&!tList.isEmpty()){
|
|
|
value = tList.get(0).getValue();
|
|
|
+ }else{
|
|
|
+ value ="false";
|
|
|
}
|
|
|
return value;
|
|
|
}
|
|
|
-
|
|
|
+ private static MdoProMathfunc findMashfunc(String pid) {
|
|
|
+ MdoProMathfuncMapper mdao = UtilTools.getBean(MdoProMathfuncMapper.class);
|
|
|
+ MdoProMathfuncSQLBuilder sb = new MdoProMathfuncSQLBuilder();
|
|
|
+ MdoProMathfuncSQLBuilder.Criteria sc =sb.createCriteria();
|
|
|
+ sc.andPidEqualTo(pid);
|
|
|
+ List<MdoProMathfunc> mList = mdao.selectByExample(sb);
|
|
|
+ MdoProMathfunc m =null;
|
|
|
+ if(mList!=null&&!mList.isEmpty()){
|
|
|
+ m=mList.get(0);
|
|
|
+ }
|
|
|
+ return m;
|
|
|
+ }
|
|
|
private static MdoProFfd getFfd(String pid) {
|
|
|
MdoProFfdMapper xdao = UtilTools.getBean(MdoProFfdMapper.class);
|
|
|
MdoProFfdSQLBuilder xsb = new MdoProFfdSQLBuilder();
|
|
@@ -293,6 +400,38 @@ public class TemplateGenerator {
|
|
|
}
|
|
|
return xfoil;
|
|
|
}
|
|
|
+ /**
|
|
|
+ * TODO 创建 workflowXml
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String createcWorkflowXml3(String pid,WorkflowVo vo){
|
|
|
+ try {
|
|
|
+ if(vo ==null){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ Configuration cfg = new Configuration(Configuration.VERSION_2_3_0);
|
|
|
+ // 设置模板所在目录
|
|
|
+ cfg.setClassForTemplateLoading(TemplateGenerator.class, "/templates");
|
|
|
+ // 获取模板对象
|
|
|
+ Template template = cfg.getTemplate("workflow3.ftl");
|
|
|
+ // 定义数据模型(Map)
|
|
|
+ Map<String, Object> dataModel = new HashMap<>();
|
|
|
+// CpacsVo vo = getCpacsVo(pid);
|
|
|
+
|
|
|
+ dataModel.put("vo",vo);
|
|
|
+ //dataModel.put("geoFilePath", BPATH + "/" + aid + "/" + jid + "/Geometry");
|
|
|
+ // 将数据模型传入模板进行处理
|
|
|
+ StringWriter writer = new StringWriter();
|
|
|
+ template.process(dataModel, writer);
|
|
|
+ FileWriter fileWriter = new FileWriter(LogService.BPATH + "/" + pid + "/in/workflow.xml");
|
|
|
+ fileWriter.write(writer.toString());
|
|
|
+ fileWriter.close();
|
|
|
+ return LogService.BPATH + "/" + pid + "/in/workflow.xml";
|
|
|
+ }catch (Exception e){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* TODO 创建 workflowXml
|
|
|
* @return
|