|
@@ -0,0 +1,134 @@
|
|
|
+package com.miniframe.bisiness.es;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import com.miniframe.core.ExecProcessFlow;
|
|
|
+import com.miniframe.core.ext.UtilTools;
|
|
|
+import com.miniframe.generate.business.es.model.ES0030BaseModel;
|
|
|
+import com.miniframe.generate.comm.es.A_ES0029_PCCIDS_RECODE;
|
|
|
+import com.miniframe.generate.comm.es.A_ES0029_PCIDS_RECODE;
|
|
|
+import com.miniframe.mappers.es.model.PcCopyVo;
|
|
|
+import com.miniframe.model.es.*;
|
|
|
+import com.miniframe.model.es.dao.*;
|
|
|
+import com.miniframe.tools.XiJsonUtil;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 无锡发动机,“导入”逻辑处理(重新生成不覆盖)。
|
|
|
+ */
|
|
|
+public class ES0030Service extends ES0030BaseModel implements ExecProcessFlow {
|
|
|
+
|
|
|
+ private static final long serialVersionUID = -7051358269847459502L;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 无锡发动机,“导入”业务核心处理
|
|
|
+ */
|
|
|
+ public void transExecute() throws Exception {
|
|
|
+
|
|
|
+
|
|
|
+ String pid =this.getA_es0030().getPid();
|
|
|
+ String npid = this.getA_es0030().getNpid();
|
|
|
+ EsProMapper pdao = UtilTools.getBean(EsProMapper.class);
|
|
|
+ EsPro pro =pdao.selectByPrimaryKey(pid);
|
|
|
+ if(pro==null){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ //组件复制
|
|
|
+ List<PcCopyVo> vos =new ArrayList<>();
|
|
|
+ Map<String,String> comIdsMap = new HashMap<>();
|
|
|
+ EsProComMapper comdao = UtilTools.getBean(EsProComMapper.class);
|
|
|
+ EsProComSQLBuilder comsb = new EsProComSQLBuilder();
|
|
|
+ EsProComSQLBuilder.Criteria comsc = comsb.createCriteria();
|
|
|
+ comsc.andPcIdNotEqualTo("-1");//排除模拟参数
|
|
|
+ comsc.andPidEqualTo(pid);
|
|
|
+ List<EsProCom> coms = comdao.selectByExample(comsb);
|
|
|
+ for (EsProCom com :coms) {
|
|
|
+ String npcid = UtilTools.getUUid();
|
|
|
+ String pcid = com.getPcId();
|
|
|
+ EsProComAttMapper comattdao = UtilTools.getBean(EsProComAttMapper.class);
|
|
|
+ EsProComAttSQLBuilder comattsb = new EsProComAttSQLBuilder();
|
|
|
+ EsProComAttSQLBuilder.Criteria comattsc = comattsb.createCriteria();
|
|
|
+ comattsc.andPcIdEqualTo(pcid);
|
|
|
+ List<EsProComAtt> atts = comattdao.selectByExample(comattsb);
|
|
|
+ for (EsProComAtt att:atts) {
|
|
|
+ EsProComAttDataMapper comattdatadao = UtilTools.getBean(EsProComAttDataMapper.class);
|
|
|
+ EsProComAttDataSQLBuilder comattdatasb = new EsProComAttDataSQLBuilder();
|
|
|
+ EsProComAttDataSQLBuilder.Criteria comattdatasc = comattdatasb.createCriteria();
|
|
|
+ comattdatasc.andPcaIdEqualTo(att.getPcaId());
|
|
|
+ List<EsProComAttData> attDatas = comattdatadao.selectByExample(comattdatasb);
|
|
|
+ String nPcaId=UtilTools.getUUid();
|
|
|
+ for (EsProComAttData attd:attDatas) {
|
|
|
+ attd.setPcId(npcid);
|
|
|
+ attd.setPcaId(nPcaId);
|
|
|
+ attd.setPcadId(UtilTools.getUUid());
|
|
|
+ attd.setPid(npid);
|
|
|
+ comattdatadao.insert(attd);
|
|
|
+ }
|
|
|
+ att.setPcId(npcid);
|
|
|
+ att.setPcaId(nPcaId);
|
|
|
+ att.setPid(npid);
|
|
|
+ comattdao.insert(att);
|
|
|
+ }
|
|
|
+ com.setPid(npid);
|
|
|
+ com.setPcId(npcid);
|
|
|
+ comdao.insert(com);
|
|
|
+
|
|
|
+ comIdsMap.put(pcid,npcid);
|
|
|
+ PcCopyVo cp= new PcCopyVo();
|
|
|
+ cp.setType(1);
|
|
|
+ cp.setOldId(pcid);
|
|
|
+ cp.setNewId(npcid);
|
|
|
+ vos.add(cp);
|
|
|
+ }
|
|
|
+ EsProComConMapper condao = UtilTools.getBean(EsProComConMapper.class);
|
|
|
+ EsProComConSQLBuilder consb = new EsProComConSQLBuilder();
|
|
|
+ EsProComConSQLBuilder.Criteria consc =consb.createCriteria();
|
|
|
+ consc.andPidEqualTo(pid);
|
|
|
+ List<EsProComCon> cons = condao.selectByExample(consb);
|
|
|
+ for (EsProComCon con:cons) {
|
|
|
+ String pccid =con.getPccId();
|
|
|
+ String npccid =UtilTools.getUUid();
|
|
|
+ con.setPcId(comIdsMap.get(con.getPcId()));
|
|
|
+ con.setNpcId(comIdsMap.get(con.getNpcId()));
|
|
|
+ con.setPccId(npccid);
|
|
|
+ con.setPid(npid);
|
|
|
+ condao.insert(con);
|
|
|
+ PcCopyVo cp= new PcCopyVo();
|
|
|
+ cp.setType(2);
|
|
|
+ cp.setOldId(pccid);
|
|
|
+ cp.setNewId(npccid);
|
|
|
+ vos.add(cp);
|
|
|
+ }
|
|
|
+ this.getD_es0030().setCpjson(XiJsonUtil.objectToJson(vos));
|
|
|
+ this.getD_es0030().setOldflow(pro.getFlow());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 无锡发动机,“导入”业务前处理
|
|
|
+ */
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|