MDO0064Service.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. package com.miniframe.bisiness.mdo;
  2. import java.util.List;
  3. import java.util.Map;
  4. import com.miniframe.core.ExecProcessFlow;
  5. import com.miniframe.core.ext.UtilTools;
  6. import com.miniframe.generate.appcode.ComType;
  7. import com.miniframe.generate.business.mdo.model.MDO0064BaseModel;
  8. import com.miniframe.generate.comm.mdo.D_MDO0063;
  9. import com.miniframe.model.mdo.MdoProInoutPara;
  10. import com.miniframe.model.mdo.MdoProInoutParaSQLBuilder;
  11. import com.miniframe.model.mdo.MdoProMathfunc;
  12. import com.miniframe.model.mdo.MdoProMathfuncSQLBuilder;
  13. import com.miniframe.model.mdo.dao.MdoProInoutParaMapper;
  14. import com.miniframe.model.mdo.dao.MdoProMathfuncMapper;
  15. /**
  16. * 西工大系统,“MatchFuc添加修改”逻辑处理(重新生成不覆盖)。
  17. */
  18. public class MDO0064Service extends MDO0064BaseModel implements ExecProcessFlow {
  19. private static final long serialVersionUID = -7051358269847459502L;
  20. /**
  21. * 西工大系统,“MatchFuc添加修改”业务核心处理
  22. */
  23. public void transExecute() throws Exception {
  24. String pid = this.getA_mdo0064().getPid();
  25. String equation =this.getA_mdo0064().getEquation();
  26. String wid = this.getA_mdo0064().getWid();
  27. String inParams=this.getA_mdo0064().getInParams();
  28. String outParams =this.getA_mdo0064().getOutParams();
  29. MdoProMathfuncMapper mfcdao = UtilTools.getBean(MdoProMathfuncMapper.class);
  30. MdoProMathfuncSQLBuilder mfcsb = new MdoProMathfuncSQLBuilder();
  31. MdoProMathfuncSQLBuilder.Criteria mfcsc = mfcsb.createCriteria();
  32. mfcsc.andPidEqualTo(pid);
  33. mfcsc.andWidEqualTo(wid);
  34. List<MdoProMathfunc> mList = mfcdao.selectByExample(mfcsb);
  35. MdoProMathfunc m;
  36. if(mList!=null&&!mList.isEmpty()){
  37. m = mList.get(0);
  38. m.setEquation(equation);
  39. mfcdao.updateByPrimaryKey(m);
  40. }else{
  41. m = new MdoProMathfunc();
  42. m.setId(UtilTools.getUUid());
  43. m.setEquation(equation);
  44. m.setWid(wid);
  45. m.setPid(pid);
  46. mfcdao.insert(m);
  47. }
  48. delParas(m.getId());
  49. insetInoutPara(inParams, m.getId(),1,pid);
  50. insetInoutPara(outParams, m.getId(),2,pid);
  51. this.getD_mdo0064().setMfcid(m.getId());
  52. }
  53. private void delParas(String adid) {
  54. MdoProInoutParaMapper xpDao = UtilTools.getBean(MdoProInoutParaMapper.class);
  55. MdoProInoutParaSQLBuilder xpsb = new MdoProInoutParaSQLBuilder();
  56. xpsb.createCriteria().andFatheridEqualTo(adid);
  57. xpDao.deleteByExample(xpsb);
  58. }
  59. private void insetInoutPara(String inParams, String adid,Integer type,String pid) {
  60. MdoProInoutParaMapper xpDao = UtilTools.getBean(MdoProInoutParaMapper.class);
  61. String[] inPs = inParams.split(";");
  62. for (String inP : inPs) {
  63. String[] ps = inP.split(",");
  64. MdoProInoutPara p = new MdoProInoutPara();
  65. p.setId(UtilTools.getUUid());
  66. p.setCode(ps[0]);
  67. p.setName(ps[1]);
  68. p.setValue(ps[2]);
  69. p.setFlag(Integer.valueOf(ps[3]));
  70. p.setComtype(Integer.valueOf(ComType.MathFunc.getIndex()));
  71. p.setType(type);
  72. p.setFatherid(adid);
  73. p.setPid(pid);
  74. xpDao.insert(p);
  75. }
  76. }
  77. /**
  78. * 西工大系统,“MatchFuc添加修改”业务前处理
  79. */
  80. public void preTransFlow() throws Exception {
  81. this.validater();
  82. }
  83. /**
  84. * 西工大系统,“MatchFuc添加修改”业务后处理
  85. */
  86. public void afterTransFlow() throws Exception {
  87. }
  88. /**
  89. * 西工大系统,“MatchFuc添加修改”逻辑入口处理方法
  90. */
  91. @SuppressWarnings("rawtypes")
  92. @Override
  93. public Map execute(Map vars) throws Exception {
  94. this.setTransMap(vars);
  95. preTransFlow();// 执行业务开始的规则检查和校验
  96. transExecute();// 执行核心业务段
  97. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  98. return this.getTransMap();
  99. }
  100. }