MDO0006Service.java 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. package com.miniframe.bisiness.mdo;
  2. import com.miniframe.core.ExecProcessFlow;
  3. import com.miniframe.core.exception.BusinessException;
  4. import com.miniframe.core.ext.UtilTools;
  5. import com.miniframe.generate.business.mdo.model.MDO0006BaseModel;
  6. import com.miniframe.model.mdo.MdoMod;
  7. import com.miniframe.model.mdo.dao.MdoModMapper;
  8. import com.miniframe.tools.XIDateTimeUtils;
  9. import tk.mybatis.mapper.util.StringUtil;
  10. import java.util.Date;
  11. import java.util.Map;
  12. /**
  13. * 西工大系统,“模版添加修改”逻辑处理(重新生成不覆盖)。
  14. */
  15. public class MDO0006Service extends MDO0006BaseModel implements ExecProcessFlow {
  16. private static final long serialVersionUID = -7051358269847459502L;
  17. /**
  18. * 西工大系统,“模版添加修改”业务核心处理
  19. */
  20. public void transExecute() throws Exception {
  21. String mid = this.getA_mdo0006().getMid();
  22. String name =this.getA_mdo0006().getName();
  23. String remark =this.getA_mdo0006().getRemark();
  24. String isshare =this.getA_mdo0006().getIsshare();
  25. String image =this.getA_mdo0006().getImage();
  26. String flow =this.getA_mdo0006().getFlow();
  27. String uid=this.getA_mdohead().getUserId();
  28. String image2 =this.getA_mdo0006().getImage2();
  29. Integer type =this.getA_mdo0006().getType();
  30. Date nowDate = XIDateTimeUtils.getNowDate();
  31. MdoModMapper modDao = UtilTools.getBean(MdoModMapper.class);
  32. if(StringUtil.isEmpty(mid)){//添加
  33. mid = UtilTools.getUUid();
  34. MdoMod mod =new MdoMod();
  35. mod.setId(mid);
  36. mod.setUid(uid);
  37. mod.setCreateTime(nowDate);
  38. mod.setUpdateTime(nowDate);
  39. mod.setFlow(flow);
  40. mod.setImage(image);
  41. mod.setIsshare(Short.valueOf(isshare));
  42. mod.setName(name);
  43. mod.setRemark(remark);
  44. mod.setType(type);
  45. mod.setImage2(image2);
  46. modDao.insert(mod);
  47. }else{//修改
  48. MdoMod mod = modDao.selectByPrimaryKey(mid);
  49. if(mod==null){
  50. throw new BusinessException("MDO000002");
  51. }
  52. mod.setId(mid);
  53. mod.setUid(uid);
  54. mod.setUpdateTime(nowDate);
  55. mod.setFlow(flow);
  56. mod.setImage(image);
  57. mod.setIsshare(Short.valueOf(isshare));
  58. mod.setName(name);
  59. mod.setRemark(remark);
  60. mod.setType(type);
  61. mod.setImage2(image2);
  62. modDao.updateByPrimaryKey(mod);
  63. }
  64. }
  65. /**
  66. * 西工大系统,“模版添加修改”业务前处理
  67. */
  68. public void preTransFlow() throws Exception {
  69. this.validater();
  70. }
  71. /**
  72. * 西工大系统,“模版添加修改”业务后处理
  73. */
  74. public void afterTransFlow() throws Exception {
  75. }
  76. /**
  77. * 西工大系统,“模版添加修改”逻辑入口处理方法
  78. */
  79. @SuppressWarnings("rawtypes")
  80. @Override
  81. public Map execute(Map vars) throws Exception {
  82. this.setTransMap(vars);
  83. preTransFlow();// 执行业务开始的规则检查和校验
  84. transExecute();// 执行核心业务段
  85. afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
  86. return this.getTransMap();
  87. }
  88. }