D20002Service.java 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. package com.miniframe.bisiness.system;
  2. import java.util.Map;
  3. import com.miniframe.core.ExecProcessFlow;
  4. import com.miniframe.core.exception.BusinessException;
  5. import com.miniframe.core.ext.UtilTools;
  6. import com.miniframe.generate.business.system.model.D20002BaseModel;
  7. import com.miniframe.model.system.DPipe;
  8. import com.miniframe.model.system.DPump;
  9. import com.miniframe.model.system.dao.DPipeMapper;
  10. import com.miniframe.model.system.dao.DPumpMapper;
  11. /**
  12. * 基础系统,“水泵添加修改”逻辑处理(重新生成不覆盖)。
  13. */
  14. public class D20002Service extends D20002BaseModel implements ExecProcessFlow {
  15. private static final long serialVersionUID = -7051358269847459502L;
  16. /**
  17. * 基础系统,“水泵添加修改”业务核心处理
  18. */
  19. public void transExecute() throws Exception {
  20. Integer pumpid=this.getA_d20002().getPumpid();
  21. Integer pid =this.getA_d20002().getPid();
  22. String pumpname =this.getA_d20002().getPumpname();
  23. Double site =this.getA_d20002().getSite();
  24. Double openhig =this.getA_d20002().getOpenhig();
  25. Double closehig =this.getA_d20002().getClosehig();
  26. Integer aid =this.getA_d20002().getAid();
  27. Integer onoff =this.getA_d20002().getOnoff();
  28. String pumpcode =this.getA_d20002().getPumpcode();
  29. Integer pumpbaseid =this.getA_d20002().getPumpbaseid();
  30. DPipeMapper pipDao =UtilTools.getBean(DPipeMapper.class);
  31. DPipe pipe = pipDao.selectByPrimaryKey(pid);
  32. if(pipe==null){
  33. throw new BusinessException("EB3100015");
  34. }
  35. DPumpMapper pumpDao = UtilTools.getBean(DPumpMapper.class);
  36. if(pumpid==null||pumpid<=0){//添加
  37. DPump p =new DPump();
  38. p.setPid(pipe.getId());
  39. p.setPname(pipe.getName());
  40. p.setPcode(pipe.getCode());
  41. p.setAid(aid);
  42. p.setClosehig(closehig.floatValue());
  43. p.setOpenhig(openhig.floatValue());
  44. p.setName(pumpname);
  45. p.setSite(site.floatValue());
  46. p.setOnoff(onoff);
  47. p.setCode(pumpcode);
  48. p.setPumpbaseid(pumpbaseid);
  49. pumpDao.insertSelective(p);
  50. }else{//修改
  51. DPump p =pumpDao.selectByPrimaryKey(pumpid);
  52. if(p==null){
  53. throw new BusinessException("EB3100034", new String[]{pumpid.toString()});
  54. }
  55. p.setPid(pipe.getId());
  56. p.setPname(pipe.getName());
  57. p.setPcode(pipe.getCode());
  58. p.setAid(aid);
  59. p.setClosehig(closehig.floatValue());
  60. p.setOpenhig(openhig.floatValue());
  61. p.setName(pumpname);
  62. p.setSite(site.floatValue());
  63. p.setOnoff(onoff);
  64. p.setCode(pumpcode);
  65. p.setPumpbaseid(pumpbaseid);
  66. pumpDao.updateByPrimaryKey(p);
  67. }
  68. }
  69. /**
  70. * 基础系统,“水泵添加修改”业务前处理
  71. */
  72. public void preTransFlow() throws Exception {
  73. this.validater();
  74. }
  75. /**
  76. * 基础系统,“水泵添加修改”业务后处理
  77. */
  78. public void afterTransFlow() throws Exception {
  79. }
  80. /**
  81. * 基础系统,“水泵添加修改”逻辑入口处理方法
  82. */
  83. @SuppressWarnings("rawtypes")
  84. @Override
  85. public Map execute(Map vars) throws Exception {
  86. this.setTransMap(vars);
  87. preTransFlow();// 执行业务开始的规则检查和校验
  88. transExecute();// 执行核心业务段
  89. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  90. return this.getTransMap();
  91. }
  92. }