D10024Service.java 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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.D10024BaseModel;
  7. import com.miniframe.model.system.DGas;
  8. import com.miniframe.model.system.DGasBlastArea;
  9. import com.miniframe.model.system.DPipe;
  10. import com.miniframe.model.system.dao.DGasBlastAreaMapper;
  11. import com.miniframe.model.system.dao.DGasMapper;
  12. import com.miniframe.model.system.dao.DPipeMapper;
  13. /**
  14. * 基础系统,“瓦斯爆炸区添加修改”逻辑处理(重新生成不覆盖)。
  15. */
  16. public class D10024Service extends D10024BaseModel implements ExecProcessFlow {
  17. private static final long serialVersionUID = -7051358269847459502L;
  18. /**
  19. * 基础系统,“瓦斯爆炸区添加修改”业务核心处理
  20. */
  21. public void transExecute() throws Exception {
  22. Integer gbid =this.getA_d10024().getGbid();
  23. Integer gid= this.getA_d10024().getGid();
  24. Integer pid =this.getA_d10024().getPid();
  25. Double ssite =this.getA_d10024().getSsite();
  26. Double esite =this.getA_d10024().getEsite();
  27. DGasMapper gasMapper = UtilTools.getBean(DGasMapper.class);
  28. DGas gas =gasMapper.selectByPrimaryKey(gid);
  29. if(gas ==null){
  30. throw new BusinessException("EB3100022");
  31. }
  32. DPipeMapper pipeMapper =UtilTools.getBean(DPipeMapper.class);
  33. DPipe pipe =pipeMapper.selectByPrimaryKey(pid);
  34. if(pipe==null){
  35. throw new BusinessException("EB3100015");
  36. }
  37. DGasBlastAreaMapper blastAreaMapper =UtilTools.getBean(DGasBlastAreaMapper.class);
  38. if(gbid==null||gbid<=0){//添加
  39. DGasBlastArea gb= new DGasBlastArea();
  40. gb.setAid(gas.getAid());
  41. gb.setGid(gid);
  42. gb.setPid(pid);
  43. gb.setPname(pipe.getCode());
  44. gb.setEsite(esite.floatValue());
  45. gb.setSsite(ssite.floatValue());
  46. blastAreaMapper.insertSelective(gb);
  47. }else{//修改
  48. DGasBlastArea gb= blastAreaMapper.selectByPrimaryKey(gbid);
  49. if(gb==null){
  50. throw new BusinessException("EB3100023");
  51. }
  52. gb.setAid(gas.getAid());
  53. gb.setGid(gid);
  54. gb.setPid(pid);
  55. gb.setPname(pipe.getCode());
  56. gb.setEsite(esite.floatValue());
  57. gb.setSsite(ssite.floatValue());
  58. blastAreaMapper.updateByPrimaryKey(gb);
  59. }
  60. }
  61. /**
  62. * 基础系统,“瓦斯爆炸区添加修改”业务前处理
  63. */
  64. public void preTransFlow() throws Exception {
  65. this.validater();
  66. }
  67. /**
  68. * 基础系统,“瓦斯爆炸区添加修改”业务后处理
  69. */
  70. public void afterTransFlow() throws Exception {
  71. }
  72. /**
  73. * 基础系统,“瓦斯爆炸区添加修改”逻辑入口处理方法
  74. */
  75. @SuppressWarnings("rawtypes")
  76. @Override
  77. public Map execute(Map vars) throws Exception {
  78. this.setTransMap(vars);
  79. preTransFlow();// 执行业务开始的规则检查和校验
  80. transExecute();// 执行核心业务段
  81. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  82. return this.getTransMap();
  83. }
  84. }