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.D10024BaseModel; import com.miniframe.model.system.DGas; import com.miniframe.model.system.DGasBlastArea; import com.miniframe.model.system.DPipe; import com.miniframe.model.system.dao.DGasBlastAreaMapper; import com.miniframe.model.system.dao.DGasMapper; import com.miniframe.model.system.dao.DPipeMapper; /** * 基础系统,“瓦斯爆炸区添加修改”逻辑处理(重新生成不覆盖)。 */ public class D10024Service extends D10024BaseModel implements ExecProcessFlow { private static final long serialVersionUID = -7051358269847459502L; /** * 基础系统,“瓦斯爆炸区添加修改”业务核心处理 */ public void transExecute() throws Exception { Integer gbid =this.getA_d10024().getGbid(); Integer gid= this.getA_d10024().getGid(); Integer pid =this.getA_d10024().getPid(); Double ssite =this.getA_d10024().getSsite(); Double esite =this.getA_d10024().getEsite(); DGasMapper gasMapper = UtilTools.getBean(DGasMapper.class); DGas gas =gasMapper.selectByPrimaryKey(gid); if(gas ==null){ throw new BusinessException("EB3100022"); } DPipeMapper pipeMapper =UtilTools.getBean(DPipeMapper.class); DPipe pipe =pipeMapper.selectByPrimaryKey(pid); if(pipe==null){ throw new BusinessException("EB3100015"); } DGasBlastAreaMapper blastAreaMapper =UtilTools.getBean(DGasBlastAreaMapper.class); if(gbid==null||gbid<=0){//添加 DGasBlastArea gb= new DGasBlastArea(); gb.setAid(gas.getAid()); gb.setGid(gid); gb.setPid(pid); gb.setPname(pipe.getCode()); gb.setEsite(esite.floatValue()); gb.setSsite(ssite.floatValue()); blastAreaMapper.insertSelective(gb); }else{//修改 DGasBlastArea gb= blastAreaMapper.selectByPrimaryKey(gbid); if(gb==null){ throw new BusinessException("EB3100023"); } gb.setAid(gas.getAid()); gb.setGid(gid); gb.setPid(pid); gb.setPname(pipe.getCode()); gb.setEsite(esite.floatValue()); gb.setSsite(ssite.floatValue()); blastAreaMapper.updateByPrimaryKey(gb); } } /** * 基础系统,“瓦斯爆炸区添加修改”业务前处理 */ 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(); } }