1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- package com.miniframe.bisiness.system;
- import java.util.List;
- 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.D00002BaseModel;
- import com.miniframe.model.system.DAccident;
- import com.miniframe.model.system.DAccidentSQLBuilder;
- import com.miniframe.model.system.DNode;
- import com.miniframe.model.system.DNodeVal;
- import com.miniframe.model.system.dao.DAccidentMapper;
- import com.miniframe.model.system.dao.DNodeMapper;
- import com.miniframe.model.system.dao.DNodeValMapper;
- import com.miniframe.tools.XIDateTimeUtils;
- /**
- * 基础系统,“事故数据添加”逻辑处理(重新生成不覆盖)。
- */
- public class D00002Service extends D00002BaseModel implements ExecProcessFlow {
-
- private static final long serialVersionUID = -7051358269847459502L;
-
- /**
- * 基础系统,“事故数据添加”业务核心处理
- */
- public void transExecute() throws Exception {
- DAccidentMapper accDao = UtilTools.getBean(DAccidentMapper.class);
- String sid = this.getA_d00002().getSid();
- String source =this.getA_d00002().getSource();
- Integer aid =this.getA_d00002().getAid();
- if(aid==null||aid<=0){//修改
- // DAccidentSQLBuilder asb = new DAccidentSQLBuilder();
- // DAccidentSQLBuilder.Criteria asbc= asb.createCriteria();
- // asbc.andSourceEqualTo(source);
- // asbc.andSidEqualTo(sid);
- // DAccident accident= projectDao.selectOneByExample(asb);
- // if(accident!=null){
- // throw new BusinessException("EB3000005");
- // }
- DAccident da = new DAccident();
- da.setName(this.getA_d00002().getName());
- da.setSid(this.getA_d00002().getSid());
- da.setSource(this.getA_d00002().getSource());
- da.setType(this.getA_d00002().getType());
- da.setStype(this.getA_d00002().getStype());
- da.setTime(XIDateTimeUtils.getNowStr());
- accDao.insertSelective(da);
- }else{//修改
- DAccident da =accDao.selectByPrimaryKey(aid);
- if(da==null){
- throw new BusinessException("EB3000002");
- }
- da.setName(this.getA_d00002().getName());
- da.setSid(this.getA_d00002().getSid());
- da.setSource(this.getA_d00002().getSource());
- da.setType(this.getA_d00002().getType());
- da.setStype(this.getA_d00002().getStype());
- // da.setTime(XIDateTimeUtils.getNowStr());
- accDao.updateByPrimaryKey(da);
- }
- }
-
- /**
- * 基础系统,“事故数据添加”业务前处理
- */
- 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();
- }
- }
|