|
@@ -0,0 +1,135 @@
|
|
|
|
+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.ES0029BaseModel;
|
|
|
|
+import com.miniframe.generate.comm.es.A_ES0029;
|
|
|
|
+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.EsProComAttDataMapper;
|
|
|
|
+import com.miniframe.model.es.dao.EsProComAttMapper;
|
|
|
|
+import com.miniframe.model.es.dao.EsProComConMapper;
|
|
|
|
+import com.miniframe.model.es.dao.EsProComMapper;
|
|
|
|
+import com.miniframe.tools.XiJsonUtil;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * 无锡发动机,“组件复制”逻辑处理(重新生成不覆盖)。
|
|
|
|
+ */
|
|
|
|
+public class ES0029Service extends ES0029BaseModel implements ExecProcessFlow {
|
|
|
|
+
|
|
|
|
+ private static final long serialVersionUID = -7051358269847459502L;
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 无锡发动机,“组件复制”业务核心处理
|
|
|
|
+ */
|
|
|
|
+ public void transExecute() throws Exception {
|
|
|
|
+ String pid =this.getA_es0029().getPid();
|
|
|
|
+ String npid = this.getA_es0029().getNpid();
|
|
|
|
+ List<A_ES0029_PCIDS_RECODE> pcids=this.getA_es0029().getPcids();
|
|
|
|
+ List<A_ES0029_PCCIDS_RECODE> pccids=this.getA_es0029().getPccids();
|
|
|
|
+ //组件复制
|
|
|
|
+ List<PcCopyVo> vos =new ArrayList<>();
|
|
|
|
+ Map<String,String> comIdsMap = new HashMap<>();
|
|
|
|
+ for (A_ES0029_PCIDS_RECODE pcidr:pcids) {
|
|
|
|
+ String pcid = pcidr.getPcid();
|
|
|
|
+ EsProComMapper comdao = UtilTools.getBean(EsProComMapper.class);
|
|
|
|
+ EsProCom com = comdao.selectByPrimaryKey(pcid);
|
|
|
|
+ if(com==null){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String npcid = UtilTools.getUUid();
|
|
|
|
+ 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);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ for (A_ES0029_PCCIDS_RECODE pccidr:pccids) {
|
|
|
|
+ String pccid =pccidr.getPccid();
|
|
|
|
+ EsProComConMapper condao = UtilTools.getBean(EsProComConMapper.class);
|
|
|
|
+ EsProComCon con = condao.selectByPrimaryKey(pccid);
|
|
|
|
+ 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_es0029().setCpjson(XiJsonUtil.objectToJson(vos));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 无锡发动机,“组件复制”业务前处理
|
|
|
|
+ */
|
|
|
|
+ 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();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|