Aris地址匹配规则调整为地址+名称

This commit is contained in:
446052889@qq.com 2022-07-17 22:21:06 +08:00
parent ae17a87ce1
commit c63f516e43
5 changed files with 70 additions and 51 deletions

View File

@ -51,18 +51,18 @@ import java.util.stream.Collectors;
public class ArisXmlImportRun { public class ArisXmlImportRun {
private UserContext uc; private final UserContext uc;
private String wsId; private final String wsId;
private String logId; private final String logId;
private String logPath; private final String logPath;
private File simpleLogFile; private final File simpleLogFile;
private File fullLogFile; private final File fullLogFile;
private File warnLogFile; private final File warnLogFile;
private File successLogFile;// 客户特殊需要记录成功日志 private final File successLogFile;// 客户特殊需要记录成功日志
private File matchErrImportFile;// 匹配失败记录 private final File matchErrImportFile;// 匹配失败记录
private String filePath; private final String filePath;
private String fileName; private final String fileName;
private long startTime; private final long startTime;
private long endTime; private long endTime;
@ -142,12 +142,12 @@ public class ArisXmlImportRun {
// 获取所有PAL EPC的模型 // 获取所有PAL EPC的模型
Map<String, String> palArisPropValMap = ProcessUtil.getPalRepositoryArisPathMap(wsId); Map<String, String> palArisPropValMap = ProcessUtil.getPalRepositoryArisPathMap(wsId);
LogUtil.appendLog("\n" + Constant.LOG_START + "开始查询PAL流程清单的所有ARIS地址属性内容", fullLogFile); LogUtil.appendLog("\n" + Constant.LOG_START + "开始查询PAL流程清单的所有ARIS地址+名称属性内容", fullLogFile);
for (Map.Entry<String, String> entry : palArisPropValMap.entrySet()) { for (Map.Entry<String, String> entry : palArisPropValMap.entrySet()) {
LogUtil.appendLog("名称:---" + PALRepositoryCache.getCache().get(entry.getKey()).getName() + "---ARIS地址----" + entry.getValue() + "----", fullLogFile); LogUtil.appendLog("名称:---" + PALRepositoryCache.getCache().get(entry.getKey()).getName() + "---ARIS地址+名称----" + entry.getValue() + "----", fullLogFile);
} }
LogUtil.appendLog("\n" + Constant.LOG_END + "开始查询PAL流程清单的所有ARIS地址属性内容", fullLogFile); LogUtil.appendLog("\n" + Constant.LOG_END + "开始查询PAL流程清单的所有ARIS地址+名称属性内容", fullLogFile);
@ -161,7 +161,7 @@ public class ArisXmlImportRun {
int totalCount = LogRealTimeCountCache.getCache().get(logId).getTotalCount(); int totalCount = LogRealTimeCountCache.getCache().get(logId).getTotalCount();
for (int i = 0; i < arisEpcModelList.size(); i++) { for (int i = 0; i < arisEpcModelList.size(); i++) {
ModelModel arisModel = arisEpcModelList.get(i); ModelModel arisModel = arisEpcModelList.get(i);
String arisPath = ArisConstant.ARIS_ROOT_PATH + arisModel.getModelPath(); String arisPath = ArisConstant.ARIS_ROOT_PATH + arisModel.getModelPath() + "\\" + arisModel.getName();
int importingCount = i + 1;// 当前是导入的第几个 int importingCount = i + 1;// 当前是导入的第几个
LogRealTimeCountCache.getCache().get(logId).setImportingCount(importingCount);// 当前记录缓存 LogRealTimeCountCache.getCache().get(logId).setImportingCount(importingCount);// 当前记录缓存
// 当前正在导入的流程全部日志记录方便对照 // 当前正在导入的流程全部日志记录方便对照
@ -176,7 +176,7 @@ public class ArisXmlImportRun {
// 空模型当作警告处理全部记录 // 空模型当作警告处理全部记录
LogUtil.appendLog(Constant.LOG_WARNING + "ARIS流程" + "[" + arisModel.getName() + "]内容为空,忽略导入", simpleLogFile, fullLogFile, warnLogFile); LogUtil.appendLog(Constant.LOG_WARNING + "ARIS流程" + "[" + arisModel.getName() + "]内容为空,忽略导入", simpleLogFile, fullLogFile, warnLogFile);
LogUtil.appendLog(Constant.LOG_DESC + "该流程所属路径:" + arisPath); LogUtil.appendLog(Constant.LOG_DESC + "该流程所属路径:" + arisPath);
LogUtil.appendLog("[ARIS流程为空]ARIS流程" + "[" + arisModel.getName() + "]ARIS地址[" + arisPath + "]", matchErrImportFile); LogUtil.appendLog("[ARIS流程为空]ARIS流程" + "[" + arisModel.getName() + "]ARIS地址+名称[" + arisPath + "]", matchErrImportFile);
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1); LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);
continue; continue;
} }
@ -200,7 +200,7 @@ public class ArisXmlImportRun {
if (!flag) { if (!flag) {
LogUtil.appendLog(Constant.LOG_WARNING + "ARIS流程" + "[" + arisModel.getName() + "]未匹配到PAL过程链图", simpleLogFile, fullLogFile, warnLogFile); LogUtil.appendLog(Constant.LOG_WARNING + "ARIS流程" + "[" + arisModel.getName() + "]未匹配到PAL过程链图", simpleLogFile, fullLogFile, warnLogFile);
LogUtil.appendLog(Constant.LOG_DESC + "ARIS流程所属路径" + arisPath, simpleLogFile, fullLogFile, warnLogFile); LogUtil.appendLog(Constant.LOG_DESC + "ARIS流程所属路径" + arisPath, simpleLogFile, fullLogFile, warnLogFile);
LogUtil.appendLog("[未匹配到]ARIS流程" + "[" + arisModel.getName() + "]ARIS地址[" + arisPath + "]", matchErrImportFile); LogUtil.appendLog("[未匹配到]ARIS流程" + "[" + arisModel.getName() + "]ARIS地址+名称[" + arisPath + "]", matchErrImportFile);
LogRealTimeCountCache.getCache().get(logId).setMatchFieldCount(LogRealTimeCountCache.getCache().get(logId).getMatchFieldCount() + 1); LogRealTimeCountCache.getCache().get(logId).setMatchFieldCount(LogRealTimeCountCache.getCache().get(logId).getMatchFieldCount() + 1);
continue; continue;
} }
@ -221,7 +221,7 @@ public class ArisXmlImportRun {
LogUtil.appendLog(Constant.LOG_WARNING + "匹配到的PAL过程链图模型已存在数据不允许导入忽略", simpleLogFile, fullLogFile, warnLogFile); LogUtil.appendLog(Constant.LOG_WARNING + "匹配到的PAL过程链图模型已存在数据不允许导入忽略", simpleLogFile, fullLogFile, warnLogFile);
LogUtil.appendLog(Constant.LOG_DESC + "ARIS流程所属路径" + arisPath, simpleLogFile, fullLogFile); LogUtil.appendLog(Constant.LOG_DESC + "ARIS流程所属路径" + arisPath, simpleLogFile, fullLogFile);
LogUtil.appendLog(Constant.LOG_DESC + "PAL过程链图所属路径" + ProcessUtil.getRepositoryPath(palModel.getId()), simpleLogFile, fullLogFile); LogUtil.appendLog(Constant.LOG_DESC + "PAL过程链图所属路径" + ProcessUtil.getRepositoryPath(palModel.getId()), simpleLogFile, fullLogFile);
LogUtil.appendLog("[PAL已存在内容]PAL流程["+ palModel.getName() + "]ARIS流程" + "[" + arisModel.getName() + "]ARIS地址[" + arisPath + "]", matchErrImportFile); LogUtil.appendLog("[PAL已存在内容]PAL流程["+ palModel.getName() + "]ARIS流程" + "[" + arisModel.getName() + "]ARIS地址+名称[" + arisPath + "]", matchErrImportFile);
LogRealTimeCountCache.getCache().get(logId).setPalExistsCount(LogRealTimeCountCache.getCache().get(logId).getPalExistsCount() + 1); LogRealTimeCountCache.getCache().get(logId).setPalExistsCount(LogRealTimeCountCache.getCache().get(logId).getPalExistsCount() + 1);
continue; continue;
} }
@ -330,7 +330,7 @@ public class ArisXmlImportRun {
LogUtil.appendLog("\n" + Constant.LOG_END + "导入ARIS流程" + "[" + arisModel.getName() + "]", simpleLogFile, fullLogFile, warnLogFile); LogUtil.appendLog("\n" + Constant.LOG_END + "导入ARIS流程" + "[" + arisModel.getName() + "]", simpleLogFile, fullLogFile, warnLogFile);
LogUtil.appendLog(Constant.LOG_END + "导入成功的PAL流程" + "[" + palModel.getName() + "]ARIS地址[ " + palArisPropValMap.get(palModel.getId()) + " ]", successLogFile); LogUtil.appendLog(Constant.LOG_END + "导入成功的PAL流程" + "[" + palModel.getName() + "]ARIS地址+名称[ " + palArisPropValMap.get(palModel.getId()) + " ]", successLogFile);
} }
endTime = System.currentTimeMillis(); endTime = System.currentTimeMillis();
Timestamp endDate = new Timestamp(endTime); Timestamp endDate = new Timestamp(endTime);

View File

@ -57,7 +57,7 @@ public class ArisXmlImportWeb extends ActionWeb {
private File warnLogFile; private File warnLogFile;
private String filePath; private String filePath;
private String fileName; private String fileName;
private long startTime = System.currentTimeMillis(); private final long startTime = System.currentTimeMillis();
// Timestamp startDate = new Timestamp(System.currentTimeMillis()); // Timestamp startDate = new Timestamp(System.currentTimeMillis());
@ -249,28 +249,28 @@ public class ArisXmlImportWeb extends ActionWeb {
arisEpcPathMap.get(model.getModelPath()).add(model.getId()); arisEpcPathMap.get(model.getModelPath()).add(model.getId());
} }
LogUtil.appendLog("\n" + Constant.LOG_START + "************[执行阶段][校验ARIS EPC流程路径唯一性]Aris xml EPC流程所属目录唯一性************", simpleLogFile, fullLogFile); // LogUtil.appendLog("\n" + Constant.LOG_START + "************[执行阶段][校验ARIS EPC流程路径唯一性]Aris xml EPC流程所属目录唯一性************", simpleLogFile, fullLogFile);
//
boolean flag = false; boolean flag = false;
for (Map.Entry<String, Set<String>> entry : arisEpcPathMap.entrySet()) { // for (Map.Entry<String, Set<String>> entry : arisEpcPathMap.entrySet()) {
if (entry.getValue().size() > 1) { // if (entry.getValue().size() > 1) {
Set<String> modelIds = entry.getValue(); // Set<String> modelIds = entry.getValue();
for (String arisModelId : modelIds) { // for (String arisModelId : modelIds) {
ModelModel model = handleWeb.modelMap.get(arisModelId); // ModelModel model = handleWeb.modelMap.get(arisModelId);
String name = model.getName(); // String name = model.getName();
String path = ArisConstant.ARIS_ROOT_PATH + model.getModelPath(); // String path = ArisConstant.ARIS_ROOT_PATH + model.getModelPath();
LogUtil.appendLog(Constant.LOG_ERROR + "ARIS XML中流程[" + name + "]所属目录重复,所属目录[" + path + "]", simpleLogFile, fullLogFile, warnLogFile); // LogUtil.appendLog(Constant.LOG_ERROR + "ARIS XML中流程[" + name + "]所属目录重复,所属目录[" + path + "]", simpleLogFile, fullLogFile, warnLogFile);
} // }
flag = true; // flag = true;
} // }
} // }
if (flag) { // if (flag) {
msg = "Aris xml文件中存在多个流程同属于一个架构路径详情查看日志"; // msg = "Aris xml文件中存在多个流程同属于一个架构路径详情查看日志";
updateErrLog(msg, msg); // updateErrLog(msg, msg);
ro.err(msg); // ro.err(msg);
return ro.toString(); // return ro.toString();
} // }
LogUtil.appendLog(Constant.LOG_END + "[执行阶段][校验Aris EPC流程路径唯一性]", simpleLogFile, fullLogFile); // LogUtil.appendLog(Constant.LOG_END + "[执行阶段][校验Aris EPC流程路径唯一性]", simpleLogFile, fullLogFile);
// 校验pal aris地址属性路径是否存在重复问题 // 校验pal aris地址属性路径是否存在重复问题
// 获取所有PAL EPC的模型 // 获取所有PAL EPC的模型
@ -284,7 +284,7 @@ public class ArisXmlImportWeb extends ActionWeb {
palEpcArisPathMap.get(entry.getValue()).add(entry.getKey()); palEpcArisPathMap.get(entry.getValue()).add(entry.getKey());
} }
LogUtil.appendLog("\n" + Constant.LOG_START + "************[执行阶段][校验PAL EPC文件属性ARIS地址唯一性]PAL EPC流程文件属性ARIS地址唯一性************", simpleLogFile, fullLogFile); LogUtil.appendLog("\n" + Constant.LOG_START + "************[执行阶段][校验PAL EPC文件属性ARIS地址+名称唯一性]PAL EPC流程文件属性ARIS地址+名称唯一性************", simpleLogFile, fullLogFile);
flag = false; flag = false;
for (Map.Entry<String, Set<String>> entry : palEpcArisPathMap.entrySet()) { for (Map.Entry<String, Set<String>> entry : palEpcArisPathMap.entrySet()) {
@ -294,18 +294,18 @@ public class ArisXmlImportWeb extends ActionWeb {
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(id); PALRepositoryModel plModel = PALRepositoryCache.getCache().get(id);
String name = plModel.getName(); String name = plModel.getName();
String path = ProcessUtil.getRepositoryPath(id); String path = ProcessUtil.getRepositoryPath(id);
LogUtil.appendLog(Constant.LOG_ERROR + "PAL中流程[" + name + "][V" + plModel.getVersion() + "]文件属性ARIS地址属性内容重复,属性内容[" + path + "]", simpleLogFile, fullLogFile, warnLogFile); LogUtil.appendLog(Constant.LOG_ERROR + "PAL中流程[" + name + "][V" + plModel.getVersion() + "]文件属性ARIS地址+名称属性内容重复,属性内容[" + path + "]", simpleLogFile, fullLogFile, warnLogFile);
} }
flag = true; flag = true;
} }
} }
if (flag) { if (flag) {
msg = "PAL 文件属性ARIS地址内容存在重复,详情查看日志"; msg = "PAL 文件属性ARIS地址+名称内容存在重复,详情查看日志";
updateErrLog(msg, msg); updateErrLog(msg, msg);
ro.err(msg); ro.err(msg);
return ro.toString(); return ro.toString();
} }
LogUtil.appendLog(Constant.LOG_END + "[执行阶段][校验PAL EPC文件属性ARIS地址唯一性]", simpleLogFile, fullLogFile); LogUtil.appendLog(Constant.LOG_END + "[执行阶段][校验PAL EPC文件属性ARIS地址+名称唯一性]", simpleLogFile, fullLogFile);
// 存储缓存导入计数 // 存储缓存导入计数
@ -374,7 +374,7 @@ public class ArisXmlImportWeb extends ActionWeb {
private ResponseObject checkMethodConfig(String wsId) { private ResponseObject checkMethodConfig(String wsId) {
// 校验EPC图的文件属性 // 校验EPC图的文件属性
// 校验前置流程后置流程 // 校验前置流程后置流程
ResponseObject checkRo = checkMethodAttrExist(wsId, Constant.PROCESS_EPC, null, Constant.METHOD_PRE_PROCESS, Constant.METHOD_NEXT_PROCESS, Constant.METHOD_ARIS_URL); ResponseObject checkRo = checkMethodAttrExist(wsId, Constant.PROCESS_EPC, null, Constant.METHOD_PRE_PROCESS, Constant.METHOD_NEXT_PROCESS, Constant.METHOD_ARIS_URL, Constant.METHOD_ARIS_NAME);
if (checkRo.isErr()) { if (checkRo.isErr()) {
return checkRo; return checkRo;
} }

View File

@ -56,6 +56,8 @@ public class Constant {
// public static final String METHOD_ARIS_URL = "ARISURL"; // public static final String METHOD_ARIS_URL = "ARISURL";
public static final String METHOD_ARIS_URL = "ARIS"; public static final String METHOD_ARIS_URL = "ARIS";
public static final String METHOD_ARIS_NAME = "ARIS_process_name";
// 建模属性代码--IT系统别名 // 建模属性代码--IT系统别名
public static final String METHOD_OTHER_NAME = "otherName"; public static final String METHOD_OTHER_NAME = "otherName";

View File

@ -17,6 +17,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil;
import com.actionsoft.apps.lifecycle.api.AppsAPIManager; import com.actionsoft.apps.lifecycle.api.AppsAPIManager;
import com.actionsoft.apps.resource.AppContext; import com.actionsoft.apps.resource.AppContext;
import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.UtilString;
import com.actionsoft.i18n.I18nRes; import com.actionsoft.i18n.I18nRes;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
@ -239,15 +240,31 @@ public class ProcessUtil {
} }
} }
PALRepositoryPropertyDao dao = new PALRepositoryPropertyDao(); PALRepositoryPropertyDao dao = new PALRepositoryPropertyDao();
// aris地址
List<PALRepositoryPropertyModel> propertyModels = dao.queryByWsId(wsId); List<PALRepositoryPropertyModel> propertyModels = dao.queryByWsId(wsId);
propertyModels = propertyModels.stream().filter(item -> Constant.METHOD_ARIS_URL.equals(item.getPropertyId())).collect(Collectors.toList()); propertyModels = propertyModels.stream().filter(item -> Constant.METHOD_ARIS_URL.equals(item.getPropertyId())).collect(Collectors.toList());
Map<String, String> map = new HashMap<>(); // aris流程名称
List<PALRepositoryPropertyModel> arisNameModels = dao.queryByWsId(wsId);
arisNameModels = arisNameModels.stream().filter(item -> Constant.METHOD_ARIS_NAME.equals(item.getPropertyId())).collect(Collectors.toList());
Map<String, String> arisPathMap = new HashMap<>();
for (PALRepositoryPropertyModel prop : propertyModels) { for (PALRepositoryPropertyModel prop : propertyModels) {
map.put(prop.getPlId(), StrUtil.removeAllBlack(prop.getPropertyValue()));// 去除空格 arisPathMap.put(prop.getPlId(), StrUtil.removeAllBlack(prop.getPropertyValue()));// 去除空格
}
Map<String, String> arisNameMap = new HashMap<>();
for (PALRepositoryPropertyModel prop : arisNameModels) {
arisNameMap.put(prop.getPlId(), StrUtil.removeAllBlack(prop.getPropertyValue()));// 去除空格
} }
for (PALRepositoryModel model : list) { for (PALRepositoryModel model : list) {
if (map.containsKey(model.getId())) { if (arisPathMap.containsKey(model.getId()) && arisNameMap.containsKey(model.getId())) {
propValMap.put(model.getId(), map.get(model.getId())); List<String> pathList = new ArrayList<>();
if (UtilString.isNotEmpty(arisPathMap.get(model.getId()))) {
pathList.add(arisPathMap.get(model.getId()));
}
if (UtilString.isNotEmpty(arisNameMap.get(model.getId()))) {
pathList.add(arisNameMap.get(model.getId()));
}
propValMap.put(model.getId(), StringUtils.join(pathList, "\\"));
} }
} }
return propValMap; return propValMap;