Aris流程导入调整匹配规则,增加匹配验证步骤
This commit is contained in:
parent
f9110c5699
commit
e794286ed6
Binary file not shown.
@ -15,4 +15,6 @@ public class ArisConstant {
|
||||
public final static String IMPORT_LOG_FILE_WARN = "warnErrImport.log";// 错误&警告日志,单独记录错误&警告日志,同时详细日志中也有记录
|
||||
|
||||
|
||||
public final static String ARIS_ROOT_PATH = "\\伊利集团业务流程管理平台";
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package com.actionsoft.apps.coe.pal.datamigration.aris.util;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.model.ModelModel;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ArisXmlUtil {
|
||||
|
||||
/**
|
||||
* 获取aris文件中的epc模型列表
|
||||
* @param modelMap 解析出的模型map
|
||||
* @param sortByPath 是否按照路径进行排序
|
||||
* @return
|
||||
*/
|
||||
public static List<ModelModel> getArisEpcModelList(Map<String, ModelModel> modelMap, boolean sortByPath) {
|
||||
List<ModelModel> result = new ArrayList<>();
|
||||
for (Map.Entry<String, ModelModel> entry : modelMap.entrySet()) {
|
||||
ModelModel arisModel = entry.getValue();
|
||||
if ("MT_EEPC".equals(arisModel.getType())) {
|
||||
result.add(arisModel);
|
||||
}
|
||||
}
|
||||
if (sortByPath) {
|
||||
// 按照路径排序
|
||||
result.sort((a1, a2)-> {
|
||||
return a1.getModelPath().compareTo(a2.getModelPath());
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,10 @@
|
||||
package com.actionsoft.apps.coe.pal.datamigration.aris.web;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.constant.ArisConstant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.mapping.ModelMappingAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.model.*;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.util.ArisXmlUtil;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.constant.Constant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.log.cache.LogRealTimeCountCache;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.log.model.LogRealTimeCountModel;
|
||||
@ -126,25 +128,15 @@ public class ArisXmlImportRun {
|
||||
String rolefolderId = checkAndCreatePalRoleFolderModel(coeProcessLevel, wsId);// 创建/获取角色文件夹ID,作为角色的顶级文件夹
|
||||
|
||||
// 获取所有PAL EPC的模型
|
||||
Map<String, String> palArisPropValMap = getPalRepositoryXmlPathMap(wsId);
|
||||
Map<String, String> palArisPropValMap = ProcessUtil.getPalRepositoryArisPathMap(wsId);
|
||||
|
||||
List<ModelModel> arisEpcModelList = new ArrayList<>();
|
||||
for (Map.Entry<String, ModelModel> entry : modelMap.entrySet()) {
|
||||
ModelModel arisModel = entry.getValue();
|
||||
if ("MT_EEPC".equals(arisModel.getType())) {
|
||||
arisEpcModelList.add(arisModel);
|
||||
}
|
||||
}
|
||||
// 按照路径排序
|
||||
arisEpcModelList.sort((a1, a2)-> {
|
||||
return a1.getModelPath().compareTo(a2.getModelPath());
|
||||
});
|
||||
// 获取所有ARISEPC的模型
|
||||
List<ModelModel> arisEpcModelList = ArisXmlUtil.getArisEpcModelList(modelMap, true);
|
||||
|
||||
String arisRootPath = "\\伊利集团业务流程管理平台";
|
||||
int totalCount = LogRealTimeCountCache.getCache().get(logId).getTotalCount();
|
||||
for (int i = 0; i < arisEpcModelList.size(); i++) {
|
||||
ModelModel arisModel = arisEpcModelList.get(i);
|
||||
String arisPath = arisRootPath + arisModel.getModelPath();
|
||||
String arisPath = ArisConstant.ARIS_ROOT_PATH + arisModel.getModelPath();
|
||||
int importingCount = i + 1;// 当前是导入的第几个
|
||||
LogRealTimeCountCache.getCache().get(logId).setImportingCount(importingCount);// 当前记录缓存
|
||||
// 当前正在导入的流程全部日志记录,方便对照
|
||||
@ -163,22 +155,19 @@ public class ArisXmlImportRun {
|
||||
continue;
|
||||
}
|
||||
|
||||
// PAL过程链图与ARIS流程进行匹配
|
||||
// PAL过程链图与ARIS流程进行匹配,只进行路径匹配
|
||||
boolean flag = false;
|
||||
PALRepositoryModel palModel = null;
|
||||
for (Map.Entry<String, String> entry : palArisPropValMap.entrySet()) {
|
||||
if (arisPath.equals(entry.getValue())) {
|
||||
String palId = entry.getKey();
|
||||
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(palId);
|
||||
if (arisModel.getName().trim().equals(plModel.getName().trim())) {
|
||||
palModel = plModel;
|
||||
flag = true;
|
||||
// 匹配成功不记录到警告日志中
|
||||
LogUtil.appendLog(Constant.LOG_END + "ARIS流程" + "[" + arisModel.getName() + "]与PAL过程链图" + "[" + palModel.getName() + "]匹配", simpleLogFile, fullLogFile);
|
||||
LogUtil.appendLog(Constant.LOG_DESC + "ARIS流程所属路径:" + arisPath, simpleLogFile, fullLogFile);
|
||||
LogUtil.appendLog(Constant.LOG_DESC + "PAL过程链图所属路径:" + ProcessUtil.getRepositoryPath(palModel.getId()), simpleLogFile, fullLogFile);
|
||||
break;
|
||||
}
|
||||
palModel = PALRepositoryCache.getCache().get(palId);
|
||||
flag = true;
|
||||
// 匹配成功不记录到警告日志中
|
||||
LogUtil.appendLog(Constant.LOG_END + "ARIS流程" + "[" + arisModel.getName() + "]与PAL过程链图" + "[" + palModel.getName() + "]匹配", simpleLogFile, fullLogFile);
|
||||
LogUtil.appendLog(Constant.LOG_DESC + "ARIS流程所属路径:" + arisPath, simpleLogFile, fullLogFile);
|
||||
LogUtil.appendLog(Constant.LOG_DESC + "PAL过程链图所属路径:" + ProcessUtil.getRepositoryPath(palModel.getId()), simpleLogFile, fullLogFile);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// 未匹配成功
|
||||
@ -395,38 +384,6 @@ public class ArisXmlImportRun {
|
||||
return timeMsg;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有epc模型,key:epc-id,value:arisUrl
|
||||
* @return
|
||||
*/
|
||||
private Map<String, String> getPalRepositoryXmlPathMap(String wsId) {
|
||||
Map<String, String> propValMap = new HashMap<>();
|
||||
Iterator<PALRepositoryModel> iterator = PALRepositoryCache.getByWsId(wsId);
|
||||
List<PALRepositoryModel> list = new ArrayList<>();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
// 无多版本情况,不考虑
|
||||
PALRepositoryModel model = iterator.next();
|
||||
if (Constant.PROCESS_EPC.equals(model.getMethodId())) {
|
||||
list.add(model);
|
||||
}
|
||||
}
|
||||
PALRepositoryPropertyDao dao = new PALRepositoryPropertyDao();
|
||||
List<PALRepositoryPropertyModel> propertyModels = dao.queryByWsId(wsId);
|
||||
propertyModels = propertyModels.stream().filter(item -> Constant.METHOD_ARIS_URL.equals(item.getPropertyId())).collect(Collectors.toList());
|
||||
Map<String, String> map = new HashMap<>();
|
||||
for (PALRepositoryPropertyModel prop : propertyModels) {
|
||||
map.put(prop.getPlId(), prop.getPropertyValue().replace(" ", ""));// 去除空格
|
||||
}
|
||||
for (PALRepositoryModel model : list) {
|
||||
if (map.containsKey(model.getId())) {
|
||||
propValMap.put(model.getId(), map.get(model.getId()));
|
||||
}
|
||||
}
|
||||
return propValMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验和创建角色模型文件夹
|
||||
* @param coeProcessLevel
|
||||
|
||||
@ -3,17 +3,21 @@ package com.actionsoft.apps.coe.pal.datamigration.aris.web;
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.constant.ArisConstant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.model.*;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.util.ArisXmlUtil;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.aris.util.XMLUtil;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.constant.Constant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.log.cache.LogRealTimeCountCache;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.log.model.LogModel;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.log.model.LogRealTimeCountModel;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.LogUtil;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.ProcessUtil;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.util.ShapeUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ActionWeb;
|
||||
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
|
||||
@ -223,14 +227,83 @@ public class ArisXmlImportWeb extends ActionWeb {
|
||||
}
|
||||
LogUtil.appendLog(Constant.LOG_END + "解析XML文件内容", simpleLogFile, fullLogFile);
|
||||
|
||||
// 统计epc流程图的个数,用以进度展示
|
||||
int totalCount = countProcessMainInfo(handleWeb.modelMap);
|
||||
// 获取所有aris xml epc模型列表
|
||||
List<ModelModel> arisEpcModelList = ArisXmlUtil.getArisEpcModelList(handleWeb.modelMap, true);
|
||||
|
||||
// 统计aris xml epc流程图的个数,用以进度展示
|
||||
int totalCount = arisEpcModelList.size();
|
||||
if (totalCount == 0) {
|
||||
msg = Constant.LOG_ERROR + "上传文件不包含任何" + I18nRes.findValue(CoEConstant.APP_ID, Constant.PROCESS_EPC) + "," + Constant.IMPORT_STOP_MSG;
|
||||
updateErrLog(msg, msg);
|
||||
ro.err("上传文件不包含任何" + I18nRes.findValue(CoEConstant.APP_ID, Constant.PROCESS_EPC));
|
||||
return ro.toString();
|
||||
}
|
||||
|
||||
// 统计Aris xml 路径是否有重复
|
||||
|
||||
Map<String, Set<String>> arisEpcPathMap = new HashMap<>();
|
||||
for (ModelModel model : arisEpcModelList) {
|
||||
if (!arisEpcPathMap.containsKey(model.getModelPath())) {
|
||||
arisEpcPathMap.put(model.getModelPath(), new HashSet<>());
|
||||
}
|
||||
arisEpcPathMap.get(model.getModelPath()).add(model.getId());
|
||||
}
|
||||
|
||||
LogUtil.appendLog("\n" + Constant.LOG_START + "************[执行阶段][校验ARIS EPC流程路径唯一性]Aris xml EPC流程所属目录唯一性************", simpleLogFile, fullLogFile);
|
||||
|
||||
boolean flag = false;
|
||||
for (Map.Entry<String, Set<String>> entry : arisEpcPathMap.entrySet()) {
|
||||
if (entry.getValue().size() > 1) {
|
||||
Set<String> modelIds = entry.getValue();
|
||||
for (String arisModelId : modelIds) {
|
||||
ModelModel model = handleWeb.modelMap.get(arisModelId);
|
||||
String name = model.getName();
|
||||
String path = ArisConstant.ARIS_ROOT_PATH + model.getModelPath();
|
||||
LogUtil.appendLog(Constant.LOG_ERROR + "ARIS XML中流程[" + name + "]所属目录重复,所属目录[" + path + "]", simpleLogFile, fullLogFile, warnLogFile);
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
ro.err("Aris xml文件中存在多个流程同属于一个架构路径,详情查看日志");
|
||||
return ro.toString();
|
||||
}
|
||||
LogUtil.appendLog(Constant.LOG_END + "[执行阶段][校验Aris EPC流程路径唯一性]", simpleLogFile, fullLogFile);
|
||||
|
||||
// 校验pal aris地址属性路径是否存在重复问题
|
||||
// 获取所有PAL EPC的模型
|
||||
Map<String, String> palArisPropValMap = ProcessUtil.getPalRepositoryArisPathMap(wsId);
|
||||
Map<String, Set<String>> palEpcArisPathMap = new HashMap<>();
|
||||
|
||||
for (Map.Entry<String, String> entry : palArisPropValMap.entrySet()) {
|
||||
if (!palEpcArisPathMap.containsKey(entry.getValue())) {
|
||||
palEpcArisPathMap.put(entry.getValue(), new HashSet<>());
|
||||
}
|
||||
palEpcArisPathMap.get(entry.getValue()).add(entry.getKey());
|
||||
}
|
||||
|
||||
LogUtil.appendLog("\n" + Constant.LOG_START + "************[执行阶段][校验PAL EPC文件属性ARIS地址唯一性]PAL EPC流程文件属性ARIS地址唯一性************", simpleLogFile, fullLogFile);
|
||||
|
||||
flag = false;
|
||||
for (Map.Entry<String, Set<String>> entry : palEpcArisPathMap.entrySet()) {
|
||||
if (entry.getValue().size() > 1) {
|
||||
Set<String> ids = entry.getValue();
|
||||
for (String id : ids) {
|
||||
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(id);
|
||||
String name = plModel.getName();
|
||||
String path = ProcessUtil.getRepositoryPath(id);
|
||||
LogUtil.appendLog(Constant.LOG_ERROR + "PAL中流程[" + name + "][V" + plModel.getVersion() + "]文件属性ARIS地址属性内容重复,属性内容[" + path + "]", simpleLogFile, fullLogFile, warnLogFile);
|
||||
}
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
ro.err("PAL 文件属性ARIS地址内容存在重复,详情查看日志");
|
||||
return ro.toString();
|
||||
}
|
||||
LogUtil.appendLog(Constant.LOG_END + "[执行阶段][校验PAL EPC文件属性ARIS地址唯一性]", simpleLogFile, fullLogFile);
|
||||
|
||||
|
||||
// 存储缓存,导入计数
|
||||
LogRealTimeCountModel countModel = new LogRealTimeCountModel();
|
||||
countModel.setTotalCount(totalCount);
|
||||
|
||||
@ -2,13 +2,17 @@ package com.actionsoft.apps.coe.pal.datamigration.util;
|
||||
|
||||
import com.actionsoft.apps.AppsConst;
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
import com.actionsoft.apps.coe.pal.datamigration.constant.Constant;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.PALMethodManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.cache.PALMethodCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodAttributeModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.method.model.PALMethodModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.PALRepositoryQueryAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryPropertyModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
|
||||
import com.actionsoft.apps.lifecycle.api.AppsAPIManager;
|
||||
import com.actionsoft.apps.resource.AppContext;
|
||||
@ -19,6 +23,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ProcessUtil {
|
||||
|
||||
@ -213,5 +218,37 @@ public class ProcessUtil {
|
||||
}
|
||||
return StringUtils.join(list, "\\");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有epc模型,key:epc-id,value:arisUrl
|
||||
* @param wsId
|
||||
* @return
|
||||
*/
|
||||
public static Map<String, String> getPalRepositoryArisPathMap(String wsId) {
|
||||
Map<String, String> propValMap = new HashMap<>();
|
||||
Iterator<PALRepositoryModel> iterator = PALRepositoryCache.getByWsId(wsId);
|
||||
List<PALRepositoryModel> list = new ArrayList<>();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
// 无多版本情况,不考虑
|
||||
PALRepositoryModel model = iterator.next();
|
||||
if (Constant.PROCESS_EPC.equals(model.getMethodId())) {
|
||||
list.add(model);
|
||||
}
|
||||
}
|
||||
PALRepositoryPropertyDao dao = new PALRepositoryPropertyDao();
|
||||
List<PALRepositoryPropertyModel> propertyModels = dao.queryByWsId(wsId);
|
||||
propertyModels = propertyModels.stream().filter(item -> Constant.METHOD_ARIS_URL.equals(item.getPropertyId())).collect(Collectors.toList());
|
||||
Map<String, String> map = new HashMap<>();
|
||||
for (PALRepositoryPropertyModel prop : propertyModels) {
|
||||
map.put(prop.getPlId(), prop.getPropertyValue().replace(" ", ""));// 去除空格
|
||||
}
|
||||
for (PALRepositoryModel model : list) {
|
||||
if (map.containsKey(model.getId())) {
|
||||
propValMap.put(model.getId(), map.get(model.getId()));
|
||||
}
|
||||
}
|
||||
return propValMap;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user