1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- 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.D00004BaseModel;
- import com.miniframe.model.system.*;
- import com.miniframe.model.system.dao.DAccidentMapper;
- import com.miniframe.model.system.dao.DNodeMapper;
- import com.miniframe.model.system.dao.DPipeMapper;
- import com.miniframe.model.system.dao.DSourceMapper;
- import tk.mybatis.mapper.util.StringUtil;
- /**
- * 基础系统,“灾情点源数据添加”逻辑处理(重新生成不覆盖)。
- */
- public class D00004Service extends D00004BaseModel implements ExecProcessFlow {
-
- private static final long serialVersionUID = -7051358269847459502L;
-
- /**
- * 基础系统,“灾情点源数据添加”业务核心处理
- */
- public void transExecute() throws Exception {
- Integer pid =this.getA_d00004().getPid();
- Integer aid = this.getA_d00004().getAid();
- DAccidentMapper dam= UtilTools.getBean(DAccidentMapper.class);
- DAccident da=dam.selectByPrimaryKey(aid);
- if(da==null){
- throw new BusinessException("EB3000002");
- }
- DPipeMapper pnm=UtilTools.getBean(DPipeMapper.class);
- DPipe dp =pnm.selectByPrimaryKey(pid);
- if(dp==null){
- throw new BusinessException("EB3000001");
- }
- DSourceMapper dsm =UtilTools.getBean(DSourceMapper.class);
- DSourceSQLBuilder sb =new DSourceSQLBuilder();
- DSourceSQLBuilder.Criteria sc=sb.createCriteria();
- sc.andAidEqualTo(aid);
- sc.andPidEqualTo(pid);
- Long count = dsm.countByExample(sb);
- if(count>0){
- throw new BusinessException("EB3000003");
- }
- DSource ds =new DSource();
- ds.setAid(aid);
- ds.setPid(pid);
- ds.setPname(dp.getCode());
- ds.setSite((float)this.getA_d00004().getSite());
- dsm.insertSelective(ds);
- }
-
- /**
- * 基础系统,“灾情点源数据添加”业务前处理
- */
- 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();
- }
- }
|