MDO0047Service.java 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. package com.miniframe.bisiness.mdo;
  2. import com.miniframe.bisiness.mdo.service.ProXfoilAdflowService;
  3. import com.miniframe.core.ExecProcessFlow;
  4. import com.miniframe.core.ext.UtilTools;
  5. import com.miniframe.generate.business.mdo.model.MDO0047BaseModel;
  6. import com.miniframe.model.mdo.MdoProInoutPara;
  7. import com.miniframe.model.mdo.MdoProInoutParaSQLBuilder;
  8. import com.miniframe.model.mdo.MdoProXfoil;
  9. import com.miniframe.model.mdo.MdoProXfoilSQLBuilder;
  10. import com.miniframe.model.mdo.dao.MdoProInoutParaMapper;
  11. import com.miniframe.model.mdo.dao.MdoProXfoilMapper;
  12. import java.util.List;
  13. import java.util.Map;
  14. /**
  15. * 西工大系统,“xfoil参数添加修改”逻辑处理(重新生成不覆盖)。
  16. */
  17. public class MDO0047Service extends MDO0047BaseModel implements ExecProcessFlow {
  18. private static final long serialVersionUID = -7051358269847459502L;
  19. /**
  20. * 西工大系统,“xfoil参数添加修改”业务核心处理
  21. */
  22. public void transExecute() throws Exception {
  23. String pid = this.getA_mdo0047().getPid();
  24. Integer analyzed =this.getA_mdo0047().getAnalyzed();
  25. String pacc =this.getA_mdo0047().getPacc();
  26. String cpwr =this.getA_mdo0047().getCpwr();
  27. String yxzb =this.getA_mdo0047().getYxzb();
  28. String iter =this.getA_mdo0047().getIter();
  29. String ppar=this.getA_mdo0047().getPpar();
  30. String inParams =this.getA_mdo0047().getInParams();
  31. String outParams = this.getA_mdo0047().getOutParams();
  32. Integer checked =this.getA_mdo0047().getChecked();
  33. MdoProXfoilMapper xDao = UtilTools.getBean(MdoProXfoilMapper.class);
  34. MdoProXfoilSQLBuilder xsb = new MdoProXfoilSQLBuilder();
  35. xsb.createCriteria().andPidEqualTo(pid);
  36. List<MdoProXfoil> xList = xDao.selectByExample(xsb);
  37. MdoProXfoil x;
  38. if(xList !=null&&!xList.isEmpty()){//修改
  39. x =xList.get(0);
  40. x.setPid(pid);
  41. x.setAnalyzed(analyzed);
  42. x.setPacc(pacc);
  43. x.setCpwr(cpwr);
  44. x.setYxzb(yxzb);
  45. x.setIter(iter);
  46. x.setPpar(ppar);
  47. x.setChecked(checked);
  48. xDao.updateByPrimaryKey(x);
  49. }else{//添加
  50. x =new MdoProXfoil();
  51. x.setId(UtilTools.getUUid());
  52. x.setPid(pid);
  53. x.setAnalyzed(analyzed);
  54. x.setPacc(pacc);
  55. x.setCpwr(cpwr);
  56. x.setYxzb(yxzb);
  57. x.setIter(iter);
  58. x.setPpar(ppar);
  59. x.setChecked(checked);
  60. xDao.insert(x);
  61. }
  62. delParas(x);
  63. insetInoutPara(inParams, x,1);
  64. insetInoutPara(outParams, x,2);
  65. ProXfoilAdflowService.delAdflow(pid);
  66. }
  67. private void insetInoutPara(String inParams, MdoProXfoil x,Integer type) {
  68. MdoProInoutParaMapper xpDao = UtilTools.getBean(MdoProInoutParaMapper.class);
  69. String[] inPs = inParams.split(";");
  70. for (String inP : inPs) {
  71. String[] ps = inP.split(",");
  72. MdoProInoutPara p = new MdoProInoutPara();
  73. p.setId(UtilTools.getUUid());
  74. p.setCode(ps[0]);
  75. p.setName(ps[1]);
  76. p.setValue(ps[2]);
  77. p.setFlag(Integer.valueOf(ps[3]));
  78. p.setType(type);
  79. p.setFatherid(x.getId());
  80. xpDao.insert(p);
  81. }
  82. }
  83. private void delParas(MdoProXfoil x) {
  84. MdoProInoutParaMapper xpDao = UtilTools.getBean(MdoProInoutParaMapper.class);
  85. MdoProInoutParaSQLBuilder xpsb = new MdoProInoutParaSQLBuilder();
  86. xpsb.createCriteria().andFatheridEqualTo(x.getId());
  87. xpDao.deleteByExample(xpsb);
  88. }
  89. /**
  90. * 西工大系统,“xfoil参数添加修改”业务前处理
  91. */
  92. public void preTransFlow() throws Exception {
  93. this.validater();
  94. }
  95. /**
  96. * 西工大系统,“xfoil参数添加修改”业务后处理
  97. */
  98. public void afterTransFlow() throws Exception {
  99. }
  100. /**
  101. * 西工大系统,“xfoil参数添加修改”逻辑入口处理方法
  102. */
  103. @SuppressWarnings("rawtypes")
  104. @Override
  105. public Map execute(Map vars) throws Exception {
  106. this.setTransMap(vars);
  107. preTransFlow();// 执行业务开始的规则检查和校验
  108. transExecute();// 执行核心业务段
  109. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  110. return this.getTransMap();
  111. }
  112. }