123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- package com.miniframe.bisiness.system;
- import java.util.Map;
- import com.miniframe.core.ExecProcessFlow;
- import com.miniframe.core.exception.BusinessException;
- import com.miniframe.core.ext.UtilTools;
- import com.miniframe.generate.business.system.model.D20002BaseModel;
- import com.miniframe.model.system.DPipe;
- import com.miniframe.model.system.DPump;
- import com.miniframe.model.system.dao.DPipeMapper;
- import com.miniframe.model.system.dao.DPumpMapper;
- /**
- * 基础系统,“水泵添加修改”逻辑处理(重新生成不覆盖)。
- */
- public class D20002Service extends D20002BaseModel implements ExecProcessFlow {
-
- private static final long serialVersionUID = -7051358269847459502L;
-
- /**
- * 基础系统,“水泵添加修改”业务核心处理
- */
- public void transExecute() throws Exception {
- Integer pumpid=this.getA_d20002().getPumpid();
- Integer pid =this.getA_d20002().getPid();
- String pumpname =this.getA_d20002().getPumpname();
- Double site =this.getA_d20002().getSite();
- Double openhig =this.getA_d20002().getOpenhig();
- Double closehig =this.getA_d20002().getClosehig();
- Integer aid =this.getA_d20002().getAid();
- Integer onoff =this.getA_d20002().getOnoff();
- String pumpcode =this.getA_d20002().getPumpcode();
- Integer pumpbaseid =this.getA_d20002().getPumpbaseid();
- DPipeMapper pipDao =UtilTools.getBean(DPipeMapper.class);
- DPipe pipe = pipDao.selectByPrimaryKey(pid);
- if(pipe==null){
- throw new BusinessException("EB3100015");
- }
- DPumpMapper pumpDao = UtilTools.getBean(DPumpMapper.class);
- if(pumpid==null||pumpid<=0){//添加
- DPump p =new DPump();
- p.setPid(pipe.getId());
- p.setPname(pipe.getName());
- p.setPcode(pipe.getCode());
- p.setAid(aid);
- p.setClosehig(closehig.floatValue());
- p.setOpenhig(openhig.floatValue());
- p.setName(pumpname);
- p.setSite(site.floatValue());
- p.setOnoff(onoff);
- p.setCode(pumpcode);
- p.setPumpbaseid(pumpbaseid);
- pumpDao.insertSelective(p);
- }else{//修改
- DPump p =pumpDao.selectByPrimaryKey(pumpid);
- if(p==null){
- throw new BusinessException("EB3100034", new String[]{pumpid.toString()});
- }
- p.setPid(pipe.getId());
- p.setPname(pipe.getName());
- p.setPcode(pipe.getCode());
- p.setAid(aid);
- p.setClosehig(closehig.floatValue());
- p.setOpenhig(openhig.floatValue());
- p.setName(pumpname);
- p.setSite(site.floatValue());
- p.setOnoff(onoff);
- p.setCode(pumpcode);
- p.setPumpbaseid(pumpbaseid);
- pumpDao.updateByPrimaryKey(p);
- }
- }
-
- /**
- * 基础系统,“水泵添加修改”业务前处理
- */
- public void preTransFlow() throws Exception {
- this.validater();
- }
-
- /**
- * 基础系统,“水泵添加修改”业务后处理
- */
- public void afterTransFlow() throws Exception {
-
- }
-
- /**
- * 基础系统,“水泵添加修改”逻辑入口处理方法
- */
- @SuppressWarnings("rawtypes")
- @Override
- public Map execute(Map vars) throws Exception {
- this.setTransMap(vars);
- preTransFlow();// 执行业务开始的规则检查和校验
- transExecute();// 执行核心业务段
- afterTransFlow();// 执行核心逻辑完成后的收尾逻辑
- return this.getTransMap();
- }
- }
|