|  | @@ -1,11 +1,14 @@
 | 
											
												
													
														|  |  package com.miniframe.modo.temp;
 |  |  package com.miniframe.modo.temp;
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  import com.miniframe.core.ext.UtilTools;
 |  |  import com.miniframe.core.ext.UtilTools;
 | 
											
												
													
														|  | 
 |  | +import com.miniframe.generate.appcode.ComType;
 | 
											
												
													
														|  |  import com.miniframe.mdo.service.LogService;
 |  |  import com.miniframe.mdo.service.LogService;
 | 
											
												
													
														|  | 
 |  | +import com.miniframe.mdo.utils.MdoUidUtils;
 | 
											
												
													
														|  |  import com.miniframe.model.mdo.*;
 |  |  import com.miniframe.model.mdo.*;
 | 
											
												
													
														|  |  import com.miniframe.model.mdo.dao.*;
 |  |  import com.miniframe.model.mdo.dao.*;
 | 
											
												
													
														|  |  import com.miniframe.modo.temp.cpacs.*;
 |  |  import com.miniframe.modo.temp.cpacs.*;
 | 
											
												
													
														|  |  import com.miniframe.modo.temp.problem.*;
 |  |  import com.miniframe.modo.temp.problem.*;
 | 
											
												
													
														|  | 
 |  | +import com.miniframe.modo.temp.workflow.*;
 | 
											
												
													
														|  |  import freemarker.template.Configuration;
 |  |  import freemarker.template.Configuration;
 | 
											
												
													
														|  |  import freemarker.template.Template;
 |  |  import freemarker.template.Template;
 | 
											
												
													
														|  |  import freemarker.template.TemplateException;
 |  |  import freemarker.template.TemplateException;
 | 
											
										
											
												
													
														|  | @@ -147,6 +150,8 @@ public class TemplateGenerator {
 | 
											
												
													
														|  |          WorkflowVo vo = new WorkflowVo();
 |  |          WorkflowVo vo = new WorkflowVo();
 | 
											
												
													
														|  |          MdoProXfoil xfoil = findXfoil(pid);
 |  |          MdoProXfoil xfoil = findXfoil(pid);
 | 
											
												
													
														|  |          MdoProAdflow adflow = findAdflow(pid);
 |  |          MdoProAdflow adflow = findAdflow(pid);
 | 
											
												
													
														|  | 
 |  | +        MdoProFsi fsi= findFsi(pid);
 | 
											
												
													
														|  | 
 |  | +        MdoProMathfunc mathfunc = findMashfunc(pid);
 | 
											
												
													
														|  |          //不用生成
 |  |          //不用生成
 | 
											
												
													
														|  |          if(xfoil==null&& adflow==null){
 |  |          if(xfoil==null&& adflow==null){
 | 
											
												
													
														|  |              return null;
 |  |              return null;
 | 
											
										
											
												
													
														|  | @@ -155,8 +160,216 @@ public class TemplateGenerator {
 | 
											
												
													
														|  |          header.setName(pid);
 |  |          header.setName(pid);
 | 
											
												
													
														|  |          header.setTimestamp(new Date());
 |  |          header.setTimestamp(new Date());
 | 
											
												
													
														|  |          vo.setHeader(header);
 |  |          vo.setHeader(header);
 | 
											
												
													
														|  | 
 |  | +        List<String> executeOrders =new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +        if(fsi!=null){
 | 
											
												
													
														|  | 
 |  | +            FsiflowVo fsivo = new FsiflowVo();
 | 
											
												
													
														|  | 
 |  | +            fsivo.setUid("aeroelastic");
 | 
											
												
													
														|  | 
 |  | +            fsivo.setName("pyAeroelasticADJ");
 | 
											
												
													
														|  | 
 |  | +            List<String> inUids = findFsiInUids(pid);
 | 
											
												
													
														|  | 
 |  | +            fsivo.setInUids(inUids);
 | 
											
												
													
														|  | 
 |  | +            List<String> outUids= findFsiOutUid(pid);
 | 
											
												
													
														|  | 
 |  | +            fsivo.setOutUids(outUids);
 | 
											
												
													
														|  | 
 |  | +            vo.setFsivo(fsivo);
 | 
											
												
													
														|  | 
 |  | +            executeOrders.add(fsivo.getUid());
 | 
											
												
													
														|  | 
 |  | +        }else if(xfoil!=null){
 | 
											
												
													
														|  | 
 |  | +            XfoilflowVo xfoilvo = new XfoilflowVo();
 | 
											
												
													
														|  | 
 |  | +            xfoilvo.setUid("xfoil");
 | 
											
												
													
														|  | 
 |  | +            xfoilvo.setName("pyXFoil");
 | 
											
												
													
														|  | 
 |  | +            List<String> inUids = findXfoilInUids(pid);
 | 
											
												
													
														|  | 
 |  | +            xfoilvo.setInUids(inUids);
 | 
											
												
													
														|  | 
 |  | +            List<String> outUids= findXfoilOutUid(pid);
 | 
											
												
													
														|  | 
 |  | +            xfoilvo.setOutUids(outUids);
 | 
											
												
													
														|  | 
 |  | +            vo.setXfoilvo(xfoilvo);
 | 
											
												
													
														|  | 
 |  | +            executeOrders.add(xfoilvo.getUid());
 | 
											
												
													
														|  | 
 |  | +        }else if(adflow!=null){
 | 
											
												
													
														|  | 
 |  | +            AdflowVo adflowVo = new AdflowVo();
 | 
											
												
													
														|  | 
 |  | +            adflowVo.setUid("ADflow");
 | 
											
												
													
														|  | 
 |  | +            adflowVo.setName("pyADflow");
 | 
											
												
													
														|  | 
 |  | +            List<String> inUids = findAdflowInUids(pid);
 | 
											
												
													
														|  | 
 |  | +            adflowVo.setInUids(inUids);
 | 
											
												
													
														|  | 
 |  | +            List<String> outUids= findAdflowOutUid(pid);
 | 
											
												
													
														|  | 
 |  | +            adflowVo.setOutUids(outUids);
 | 
											
												
													
														|  | 
 |  | +            vo.setAdflowvo(adflowVo);
 | 
											
												
													
														|  | 
 |  | +            executeOrders.add(adflowVo.getUid());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        if(mathfunc!=null){
 | 
											
												
													
														|  | 
 |  | +            MathFuncflowVo mathfuncflowvo = new MathFuncflowVo();
 | 
											
												
													
														|  | 
 |  | +            mathfuncflowvo.setUid("mathFunc1");
 | 
											
												
													
														|  | 
 |  | +            mathfuncflowvo.setName("MathFunc");
 | 
											
												
													
														|  | 
 |  | +            mathfuncflowvo.setInUids(findMathFuncInParaVos(pid,mathfunc));
 | 
											
												
													
														|  | 
 |  | +            mathfuncflowvo.setOutUids(findMathFuncOutParaVos(pid,mathfunc));
 | 
											
												
													
														|  | 
 |  | +            vo.setMathfuncflowvo(mathfuncflowvo);
 | 
											
												
													
														|  | 
 |  | +            executeOrders.add(mathfuncflowvo.getUid());
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        vo.setExecuteorders(executeOrders);
 | 
											
												
													
														|  | 
 |  | +        List<ParaVo> paravos = getAllParaVos(pid);
 | 
											
												
													
														|  | 
 |  | +        vo.setParavos(paravos);
 | 
											
												
													
														|  |          return vo;
 |  |          return vo;
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    private static List<ParaVo> getAllParaVos(String pid) {
 | 
											
												
													
														|  | 
 |  | +        List<ParaVo> paravos =new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        List<String> allUid = findAllOutUids(pid);
 | 
											
												
													
														|  | 
 |  | +        for (String uid:allUid) {
 | 
											
												
													
														|  | 
 |  | +            ParaVo pvo =new ParaVo();
 | 
											
												
													
														|  | 
 |  | +            pvo.setUid(uid);
 | 
											
												
													
														|  | 
 |  | +            pvo.setLable(uid.substring(uid.lastIndexOf("/")+1,uid.length()));
 | 
											
												
													
														|  | 
 |  | +            paravos.add(pvo);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        paravos.addAll(findMathFuncInMySelfParaVos(pid));//自建 MathFunc in
 | 
											
												
													
														|  | 
 |  | +        //in param
 | 
											
												
													
														|  | 
 |  | +        List<ParaVo> inPlist = getInParaVos(pid);
 | 
											
												
													
														|  | 
 |  | +        paravos.addAll(inPlist);
 | 
											
												
													
														|  | 
 |  | +        return paravos;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    private static List<ParaVo> getInParaVos(String pid) {
 | 
											
												
													
														|  | 
 |  | +        MdoProjectVariateMapper vDao =UtilTools.getBean(MdoProjectVariateMapper.class);
 | 
											
												
													
														|  | 
 |  | +        MdoProjectVariateSQLBuilder vsb = new MdoProjectVariateSQLBuilder();
 | 
											
												
													
														|  | 
 |  | +        vsb.createCriteria().andPidEqualTo(pid);
 | 
											
												
													
														|  | 
 |  | +        List<MdoProjectVariate> vList =vDao.selectByExample(vsb);
 | 
											
												
													
														|  | 
 |  | +        Set<ParaVo> inParas = new HashSet<>();
 | 
											
												
													
														|  | 
 |  | +        for (MdoProjectVariate v:vList) {
 | 
											
												
													
														|  | 
 |  | +            ParaVo p= new ParaVo();
 | 
											
												
													
														|  | 
 |  | +            p.setLable(v.getName());
 | 
											
												
													
														|  | 
 |  | +            p.setUid(v.getUid());
 | 
											
												
													
														|  | 
 |  | +            inParas.add(p);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        List<ParaVo> inPlist = new ArrayList<>(inParas);
 | 
											
												
													
														|  | 
 |  | +        return inPlist;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    private static List<ParaVo> findMathFuncInMySelfParaVos(String pid) {
 | 
											
												
													
														|  | 
 |  | +        List<ParaVo> inParaVos = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        MdoProInoutParaMapper dao = UtilTools.getBean(MdoProInoutParaMapper.class);
 | 
											
												
													
														|  | 
 |  | +        MdoProInoutParaSQLBuilder sb = new MdoProInoutParaSQLBuilder();
 | 
											
												
													
														|  | 
 |  | +        MdoProInoutParaSQLBuilder.Criteria sc = sb.createCriteria();
 | 
											
												
													
														|  | 
 |  | +        sc.andPidEqualTo(pid);
 | 
											
												
													
														|  | 
 |  | +        sc.andComtypeEqualTo(Integer.valueOf(ComType.MathFunc.getIndex()));
 | 
											
												
													
														|  | 
 |  | +        sc.andFlagEqualTo(1);//启用
 | 
											
												
													
														|  | 
 |  | +        sc.andTypeEqualTo(1);//输入参数
 | 
											
												
													
														|  | 
 |  | +        sc.andFcomidIsNull();//自建
 | 
											
												
													
														|  | 
 |  | +        List<MdoProInoutPara> paras = dao.selectByExample(sb);
 | 
											
												
													
														|  | 
 |  | +        for (MdoProInoutPara para:paras) {
 | 
											
												
													
														|  | 
 |  | +            ParaVo vo = new ParaVo();
 | 
											
												
													
														|  | 
 |  | +            String uid ;
 | 
											
												
													
														|  | 
 |  | +            uid =MdoUidUtils.getUidByComTyeAndPcode(para.getComtype().toString(),para.getCode());
 | 
											
												
													
														|  | 
 |  | +            vo.setUid(uid);
 | 
											
												
													
														|  | 
 |  | +            vo.setLable(para.getName());
 | 
											
												
													
														|  | 
 |  | +            inParaVos.add(vo);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        return inParaVos;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    private static List<String> findAllOutUids(String pid) {
 | 
											
												
													
														|  | 
 |  | +        MdoMapper mDao = UtilTools.getBean(MdoMapper.class);
 | 
											
												
													
														|  | 
 |  | +        List<String> uids = mDao.selectAllOutUid(pid);
 | 
											
												
													
														|  | 
 |  | +        return uids;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    private static List<ParaVo> findMathFuncOutParaVos(String pid,MdoProMathfunc mathfunc) {
 | 
											
												
													
														|  | 
 |  | +        List<ParaVo> outParaVos = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        MdoProInoutParaMapper dao = UtilTools.getBean(MdoProInoutParaMapper.class);
 | 
											
												
													
														|  | 
 |  | +        MdoProInoutParaSQLBuilder sb = new MdoProInoutParaSQLBuilder();
 | 
											
												
													
														|  | 
 |  | +        MdoProInoutParaSQLBuilder.Criteria sc = sb.createCriteria();
 | 
											
												
													
														|  | 
 |  | +        sc.andPidEqualTo(pid);
 | 
											
												
													
														|  | 
 |  | +        sc.andComtypeEqualTo(Integer.valueOf(ComType.MathFunc.getIndex()));
 | 
											
												
													
														|  | 
 |  | +        sc.andFlagEqualTo(1);//启用
 | 
											
												
													
														|  | 
 |  | +        sc.andTypeEqualTo(2);//输出参数
 | 
											
												
													
														|  | 
 |  | +        sc.andFatheridEqualTo(mathfunc.getId());
 | 
											
												
													
														|  | 
 |  | +        List<MdoProInoutPara> paras = dao.selectByExample(sb);
 | 
											
												
													
														|  | 
 |  | +        for (MdoProInoutPara para:paras) {
 | 
											
												
													
														|  | 
 |  | +            ParaVo vo = new ParaVo();
 | 
											
												
													
														|  | 
 |  | +            String uid ;
 | 
											
												
													
														|  | 
 |  | +            if(para.getFcomtype()!=null){//来源
 | 
											
												
													
														|  | 
 |  | +                uid =MdoUidUtils.getUidByComTyeAndPcode(para.getFcomtype().toString(),para.getCode());
 | 
											
												
													
														|  | 
 |  | +            }else{
 | 
											
												
													
														|  | 
 |  | +                uid =MdoUidUtils.getUidByComTyeAndPcode(para.getComtype().toString(),para.getCode());
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            vo.setUid(uid);
 | 
											
												
													
														|  | 
 |  | +            String[] pythons = mathfunc.getEquation().split("\n");
 | 
											
												
													
														|  | 
 |  | +            for (String py:pythons) {
 | 
											
												
													
														|  | 
 |  | +                if(py.startsWith(para.getCode()+"=")){
 | 
											
												
													
														|  | 
 |  | +                    vo.setLable(py.replace(para.getCode()+"=",""));
 | 
											
												
													
														|  | 
 |  | +                }
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            outParaVos.add(vo);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        return  outParaVos;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    private static List<ParaVo> findMathFuncInParaVos(String pid,MdoProMathfunc mathfunc) {
 | 
											
												
													
														|  | 
 |  | +        List<ParaVo> inParaVos = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        MdoProInoutParaMapper dao = UtilTools.getBean(MdoProInoutParaMapper.class);
 | 
											
												
													
														|  | 
 |  | +        MdoProInoutParaSQLBuilder sb = new MdoProInoutParaSQLBuilder();
 | 
											
												
													
														|  | 
 |  | +        MdoProInoutParaSQLBuilder.Criteria sc = sb.createCriteria();
 | 
											
												
													
														|  | 
 |  | +        sc.andPidEqualTo(pid);
 | 
											
												
													
														|  | 
 |  | +        sc.andComtypeEqualTo(Integer.valueOf(ComType.MathFunc.getIndex()));
 | 
											
												
													
														|  | 
 |  | +        sc.andFlagEqualTo(1);//启用
 | 
											
												
													
														|  | 
 |  | +        sc.andTypeEqualTo(1);//输入参数
 | 
											
												
													
														|  | 
 |  | +        sc.andFatheridEqualTo(mathfunc.getId());
 | 
											
												
													
														|  | 
 |  | +        List<MdoProInoutPara> paras = dao.selectByExample(sb);
 | 
											
												
													
														|  | 
 |  | +        for (MdoProInoutPara para:paras) {
 | 
											
												
													
														|  | 
 |  | +            ParaVo vo = new ParaVo();
 | 
											
												
													
														|  | 
 |  | +            String uid ;
 | 
											
												
													
														|  | 
 |  | +            if(para.getFcomtype()!=null){//来源
 | 
											
												
													
														|  | 
 |  | +                uid =MdoUidUtils.getUidByComTyeAndPcode(para.getFcomtype().toString(),para.getCode());
 | 
											
												
													
														|  | 
 |  | +            }else{
 | 
											
												
													
														|  | 
 |  | +                uid =MdoUidUtils.getUidByComTyeAndPcode(para.getComtype().toString(),para.getCode());
 | 
											
												
													
														|  | 
 |  | +            }
 | 
											
												
													
														|  | 
 |  | +            vo.setUid(uid);
 | 
											
												
													
														|  | 
 |  | +            vo.setLable(para.getName());
 | 
											
												
													
														|  | 
 |  | +            inParaVos.add(vo);
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +        return  inParaVos;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    private static List<String> findAdflowOutUid(String pid) {
 | 
											
												
													
														|  | 
 |  | +        List<String> outUids = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        MdoMapper mDao = UtilTools.getBean(MdoMapper.class);
 | 
											
												
													
														|  | 
 |  | +        List<String> cuids = mDao.selectAdflowCuids(pid);
 | 
											
												
													
														|  | 
 |  | +        List<String> ouids = mDao.selectAdflowOuids(pid);
 | 
											
												
													
														|  | 
 |  | +        outUids.addAll(cuids);
 | 
											
												
													
														|  | 
 |  | +        outUids.addAll(ouids);
 | 
											
												
													
														|  | 
 |  | +        return  outUids;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    private static List<String> findAdflowInUids(String pid) {
 | 
											
												
													
														|  | 
 |  | +        MdoMapper mDao = UtilTools.getBean(MdoMapper.class);
 | 
											
												
													
														|  | 
 |  | +        List<String> vuids = mDao.selectAdflowVuids(pid);
 | 
											
												
													
														|  | 
 |  | +        return vuids;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    private static List<String> findXfoilOutUid(String pid) {
 | 
											
												
													
														|  | 
 |  | +        List<String> outUids = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        MdoMapper mDao = UtilTools.getBean(MdoMapper.class);
 | 
											
												
													
														|  | 
 |  | +        List<String> cuids = mDao.selectXfoilCuids(pid);
 | 
											
												
													
														|  | 
 |  | +        List<String> ouids = mDao.selectXfoilOuids(pid);
 | 
											
												
													
														|  | 
 |  | +        outUids.addAll(cuids);
 | 
											
												
													
														|  | 
 |  | +        outUids.addAll(ouids);
 | 
											
												
													
														|  | 
 |  | +        return  outUids;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    private static List<String> findXfoilInUids(String pid) {
 | 
											
												
													
														|  | 
 |  | +        MdoMapper mDao = UtilTools.getBean(MdoMapper.class);
 | 
											
												
													
														|  | 
 |  | +        List<String> vuids = mDao.selectXfoilVuids(pid);
 | 
											
												
													
														|  | 
 |  | +        return vuids;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +    private static List<String> findFsiOutUid(String pid) {
 | 
											
												
													
														|  | 
 |  | +        List<String> outUids = new ArrayList<>();
 | 
											
												
													
														|  | 
 |  | +        MdoMapper mDao = UtilTools.getBean(MdoMapper.class);
 | 
											
												
													
														|  | 
 |  | +        List<String> cuids = mDao.selectFsiCuids(pid);
 | 
											
												
													
														|  | 
 |  | +        List<String> ouids = mDao.selectFsiOuids(pid);
 | 
											
												
													
														|  | 
 |  | +        outUids.addAll(cuids);
 | 
											
												
													
														|  | 
 |  | +        outUids.addAll(ouids);
 | 
											
												
													
														|  | 
 |  | +        return  outUids;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +    private static List<String> findFsiInUids(String pid) {
 | 
											
												
													
														|  | 
 |  | +        MdoMapper mDao = UtilTools.getBean(MdoMapper.class);
 | 
											
												
													
														|  | 
 |  | +        List<String> vuids = mDao.selectFsiVuids(pid);
 | 
											
												
													
														|  | 
 |  | +        return vuids;
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  |      public static CpacsVo getCpacsVo(String pid) {
 |  |      public static CpacsVo getCpacsVo(String pid) {
 | 
											
												
													
														|  |          CpacsVo vo = new CpacsVo();
 |  |          CpacsVo vo = new CpacsVo();
 | 
											
												
													
														|  |          HeaderVo header =new HeaderVo();
 |  |          HeaderVo header =new HeaderVo();
 | 
											
										
											
												
													
														|  | @@ -499,6 +712,35 @@ public class TemplateGenerator {
 | 
											
												
													
														|  |              return null;
 |  |              return null;
 | 
											
												
													
														|  |          }
 |  |          }
 | 
											
												
													
														|  |      }
 |  |      }
 | 
											
												
													
														|  | 
 |  | +    /**
 | 
											
												
													
														|  | 
 |  | +     * @return
 | 
											
												
													
														|  | 
 |  | +     */
 | 
											
												
													
														|  | 
 |  | +    public static String createcWorkflowXmlT(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("workflow_t.ftl");
 | 
											
												
													
														|  | 
 |  | +            // 定义数据模型(Map)
 | 
											
												
													
														|  | 
 |  | +            Map<String, Object> dataModel = new HashMap<>();
 | 
											
												
													
														|  | 
 |  | +
 | 
											
												
													
														|  | 
 |  | +            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;
 | 
											
												
													
														|  | 
 |  | +        }
 | 
											
												
													
														|  | 
 |  | +    }
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 | 
											
												
													
														|  |  
 |  |  
 |