package com.miniframe.bisiness.mdo; import com.miniframe.bisiness.mdo.service.ProXfoilAdflowService; import com.miniframe.core.ExecProcessFlow; import com.miniframe.core.ext.UtilTools; import com.miniframe.generate.business.mdo.model.MDO0047BaseModel; import com.miniframe.model.mdo.MdoProInoutPara; import com.miniframe.model.mdo.MdoProInoutParaSQLBuilder; import com.miniframe.model.mdo.MdoProXfoil; import com.miniframe.model.mdo.MdoProXfoilSQLBuilder; import com.miniframe.model.mdo.dao.MdoProInoutParaMapper; import com.miniframe.model.mdo.dao.MdoProXfoilMapper; import java.util.List; import java.util.Map; /** * 西工大系统,“xfoil参数添加修改”逻辑处理(重新生成不覆盖)。 */ public class MDO0047Service extends MDO0047BaseModel implements ExecProcessFlow { private static final long serialVersionUID = -7051358269847459502L; /** * 西工大系统,“xfoil参数添加修改”业务核心处理 */ public void transExecute() throws Exception { String pid = this.getA_mdo0047().getPid(); Integer analyzed =this.getA_mdo0047().getAnalyzed(); String pacc =this.getA_mdo0047().getPacc(); String cpwr =this.getA_mdo0047().getCpwr(); String yxzb =this.getA_mdo0047().getYxzb(); String iter =this.getA_mdo0047().getIter(); String ppar=this.getA_mdo0047().getPpar(); String inParams =this.getA_mdo0047().getInParams(); String outParams = this.getA_mdo0047().getOutParams(); Integer checked =this.getA_mdo0047().getChecked(); MdoProXfoilMapper xDao = UtilTools.getBean(MdoProXfoilMapper.class); MdoProXfoilSQLBuilder xsb = new MdoProXfoilSQLBuilder(); xsb.createCriteria().andPidEqualTo(pid); List xList = xDao.selectByExample(xsb); MdoProXfoil x; if(xList !=null&&!xList.isEmpty()){//修改 x =xList.get(0); x.setPid(pid); x.setAnalyzed(analyzed); x.setPacc(pacc); x.setCpwr(cpwr); x.setYxzb(yxzb); x.setIter(iter); x.setPpar(ppar); x.setChecked(checked); xDao.updateByPrimaryKey(x); }else{//添加 x =new MdoProXfoil(); x.setId(UtilTools.getUUid()); x.setPid(pid); x.setAnalyzed(analyzed); x.setPacc(pacc); x.setCpwr(cpwr); x.setYxzb(yxzb); x.setIter(iter); x.setPpar(ppar); x.setChecked(checked); xDao.insert(x); } delParas(x); insetInoutPara(inParams, x,1); insetInoutPara(outParams, x,2); ProXfoilAdflowService.delAdflow(pid); } private void insetInoutPara(String inParams, MdoProXfoil x,Integer type) { MdoProInoutParaMapper xpDao = UtilTools.getBean(MdoProInoutParaMapper.class); String[] inPs = inParams.split(";"); for (String inP : inPs) { String[] ps = inP.split(","); MdoProInoutPara p = new MdoProInoutPara(); p.setId(UtilTools.getUUid()); p.setCode(ps[0]); p.setName(ps[1]); p.setValue(ps[2]); p.setFlag(Integer.valueOf(ps[3])); p.setType(type); p.setFatherid(x.getId()); xpDao.insert(p); } } private void delParas(MdoProXfoil x) { MdoProInoutParaMapper xpDao = UtilTools.getBean(MdoProInoutParaMapper.class); MdoProInoutParaSQLBuilder xpsb = new MdoProInoutParaSQLBuilder(); xpsb.createCriteria().andFatheridEqualTo(x.getId()); xpDao.deleteByExample(xpsb); } /** * 西工大系统,“xfoil参数添加修改”业务前处理 */ public void preTransFlow() throws Exception { this.validater(); } /** * 西工大系统,“xfoil参数添加修改”业务后处理 */ public void afterTransFlow() throws Exception { } /** * 西工大系统,“xfoil参数添加修改”逻辑入口处理方法 */ @SuppressWarnings("rawtypes") @Override public Map execute(Map vars) throws Exception { this.setTransMap(vars); preTransFlow();// 执行业务开始的规则检查和校验 transExecute();// 执行核心业务段 afterTransFlow();// 执行核心逻辑完成后的收尾逻辑 return this.getTransMap(); } }