123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152 |
- package com.miniframe.bisiness.system;
- import java.util.ArrayList;
- 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.D10018BaseModel;
- import com.miniframe.generate.comm.system.D_D10018_COCODES_RECODE;
- import com.miniframe.generate.comm.system.D_D10018_CODES_RECODE;
- import com.miniframe.generate.comm.system.D_D10018_VALS_RECODE;
- import com.miniframe.model.system.*;
- import com.miniframe.model.system.dao.DAccidentMapper;
- import com.miniframe.model.system.dao.DChecknodeValMapper;
- import com.miniframe.model.system.dao.DChecknodeValcodeMapper;
- import io.netty.util.internal.StringUtil;
- /**
- * 基础系统,“监测点结果获取”逻辑处理(重新生成不覆盖)。
- */
- public class D10018Service extends D10018BaseModel implements ExecProcessFlow {
-
- private static final long serialVersionUID = -7051358269847459502L;
-
- /**
- * 基础系统,“监测点结果获取”业务核心处理
- */
- public void transExecute() throws Exception {
- Integer aid= getA_d10018().getAid();
- Integer step =getA_d10018().getStep();
- DAccidentMapper accidentDao = UtilTools.getBean(DAccidentMapper.class);
- DAccident accident= accidentDao.selectByPrimaryKey(aid);
- List<D_D10018_CODES_RECODE> codes =new ArrayList<>();
- findValCode(aid, accident, codes);
- List<D_D10018_VALS_RECODE> vals =new ArrayList<>();
- findVal(aid, step, accident, vals);
- this.getD_d10018().setCodes(codes);
- this.getD_d10018().setVals(vals);
- }
- private void findVal(Integer aid, Integer step, DAccident accident, List<D_D10018_VALS_RECODE> vals) {
- DChecknodeValMapper valMapper =UtilTools.getBean(DChecknodeValMapper.class);
- DChecknodeValSQLBuilder sb = new DChecknodeValSQLBuilder();
- DChecknodeValSQLBuilder.Criteria sc =sb.createCriteria();
- sc.andAidEqualTo(aid);
- sc.andJidEqualTo(accident.getJid());
- sc.andStepEqualTo(step);
- sb.setOrderByClause("id ASC");
- List<DChecknodeVal> nVals = valMapper.selectByExample(sb);
- for (DChecknodeVal nval:nVals) {
- D_D10018_VALS_RECODE val =new D_D10018_VALS_RECODE();
- val.setChname(nval.getChname());
- val.setV1(nval.getV1());
- val.setV2(nval.getV2());
- val.setV3(nval.getV3());
- val.setV4(nval.getV4());
- val.setV5(nval.getV5());
- val.setV6(nval.getV6());
- vals.add(val);
- }
- }
- private void findValCode(Integer aid, DAccident accident, List<D_D10018_CODES_RECODE> codes) throws BusinessException {
- DChecknodeValcodeMapper valcodeMapper =UtilTools.getBean(DChecknodeValcodeMapper.class);
- DChecknodeValcodeSQLBuilder codesb =new DChecknodeValcodeSQLBuilder();
- DChecknodeValcodeSQLBuilder.Criteria codesc = codesb.createCriteria();
- codesc.andAidEqualTo(aid);
- codesc.andJidEqualTo(accident.getJid());
- List<DChecknodeValcode> valcodes = valcodeMapper.selectByExample(codesb );
- if(valcodes.isEmpty()){
- throw new BusinessException("EB3100026");
- }
- DChecknodeValcode valcode =valcodes.get(0);
- setCodes(valcode, codes);
- }
- private void setCodes(DChecknodeValcode valcode, List<D_D10018_CODES_RECODE> codes) {
- if(!StringUtil.isNullOrEmpty(valcode.getValCode1()))
- {
- D_D10018_CODES_RECODE code =new D_D10018_CODES_RECODE();
- code.setCode(valcode.getValCode1());
- codes.add(code);
- }
- if(!StringUtil.isNullOrEmpty(valcode.getValCode2()))
- {
- D_D10018_CODES_RECODE code =new D_D10018_CODES_RECODE();
- code.setCode(valcode.getValCode2());
- codes.add(code);
- }
- if(!StringUtil.isNullOrEmpty(valcode.getValCode3()))
- {
- D_D10018_CODES_RECODE code =new D_D10018_CODES_RECODE();
- code.setCode(valcode.getValCode3());
- codes.add(code);
- }
- if(!StringUtil.isNullOrEmpty(valcode.getValCode4()))
- {
- D_D10018_CODES_RECODE code =new D_D10018_CODES_RECODE();
- code.setCode(valcode.getValCode4());
- codes.add(code);
- }
- if(!StringUtil.isNullOrEmpty(valcode.getValCode5()))
- {
- D_D10018_CODES_RECODE code =new D_D10018_CODES_RECODE();
- code.setCode(valcode.getValCode5());
- codes.add(code);
- }
- if(!StringUtil.isNullOrEmpty(valcode.getValCode6()))
- {
- D_D10018_CODES_RECODE code =new D_D10018_CODES_RECODE();
- code.setCode(valcode.getValCode6());
- codes.add(code);
- }
- }
- /**
- * 基础系统,“监测点结果获取”业务前处理
- */
- 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();
- }
- }
|