模型清单导入由匹配最新版本模型改为匹配当前使用中版本模型

This commit is contained in:
446052889@qq.com 2022-12-28 16:23:12 +08:00
parent 4e83453c93
commit e4f08b74e7
4 changed files with 33 additions and 8 deletions

View File

@ -15,6 +15,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.designer.relation.model.Design
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.coe.pal.pal.ws.web.VersionUtil;
import com.actionsoft.apps.coe.pal.yili.log.datamigration.log.Cache.LogRealTimeCountCache;
import com.actionsoft.apps.coe.pal.yili.log.datamigration.log.Model.LogRealTimeCountModel;
import com.actionsoft.bpms.commons.security.logging.model.Level;
@ -80,7 +81,7 @@ public class ImportProcessExcel {
LogUtil.appendLog("PAL批量导入模型清单 Begin " + UtilDate.datetimeFormat(startDate), simpleLogFile, fullLogFile);
LogUtil.appendLog("--------------------------------", simpleLogFile, fullLogFile);
LogUtil.appendLog("若模型(流程、表单、制度等各类模型)存在多版本,只与模型最新版本进行匹配,过往版本忽略不进行任何处理,若最新版本模型非可编辑状态(已发布、已停用、审批中),直接跳过该模型,不做任何调整", simpleLogFile, fullLogFile);
LogUtil.appendLog("若模型(流程、表单、制度等各类模型)存在多版本,只与模型当前使用中版本进行匹配,其他版本忽略不进行任何处理,若当前使用中版本模型非可编辑状态(已发布、已停用、审批中),直接跳过该模型,不做任何调整", simpleLogFile, fullLogFile);
String wsId = object.getString("wsId");
JSONObject data = object.getJSONObject("data");
@ -675,7 +676,7 @@ public class ImportProcessExcel {
} else {// 更新
String namePath = getFileNamePath(palModel);
LogUtil.appendLog(BatchConst.LOG_START + "[执行阶段][更新模型阶段]更新模型" + I18nRes.findValue(CoEConstant.APP_ID, palModel.getMethodId()) + "[" + palModel.getName() + "]模型模型ID[" + palModel.getId() + "]", simpleLogFile, fullLogFile);
LogUtil.appendLog(BatchConst.LOG_START + "[执行阶段][更新模型阶段]更新模型" + I18nRes.findValue(CoEConstant.APP_ID, palModel.getMethodId()) + "[" + palModel.getName() + "][" + VersionUtil.getVersionStrV(palModel.getVersion()) + "]模型模型ID[" + palModel.getId() + "]", simpleLogFile, fullLogFile);
LogUtil.appendLog(BatchConst.LOG_DESC + "模型所属路径[" + namePath + "]", simpleLogFile, fullLogFile);
@ -888,11 +889,11 @@ public class ImportProcessExcel {
}
private List<JSONObject> assemblePalData(String wsId, String methodCategory) {
// 获取指定根目录下所有的最新版本模型列表
List<PALRepositoryModel> recentVerList = ProcessUtil.getRecentRepositoryList(wsId, methodCategory);
// 获取指定根目录下所有的使用中版本模型列表
List<PALRepositoryModel> useVerList = ProcessUtil.getUseRepositoryList(wsId, methodCategory);
// 拼接数据
List<JSONObject> list = new ArrayList<JSONObject>();
for (PALRepositoryModel model : recentVerList) {
for (PALRepositoryModel model : useVerList) {
JSONObject tmp = new JSONObject();
tmp.put("id", model.getId());
tmp.put("name", model.getName());

View File

@ -302,6 +302,30 @@ public class ProcessUtil {
return null;
}
/**
* 获取指定根目录下所有的使用中版本模型列表
* @param wsId
* @param category 根节点分类如processdataorg等
* @return
*/
public static List<PALRepositoryModel> getUseRepositoryList(String wsId, String category) {
List<PALRepositoryModel> list = new ArrayList<>();
Set<String> ids = new HashSet<>();
PALRepositoryCache.getAllChildrenModelsByPid(wsId, category, list, ids);
// 找到使用中版本只匹配使用中版本在日志中添加此明显提示 todo
List<PALRepositoryModel> useVerList = new ArrayList<>();
Map<String, PALRepositoryModel> modelMap = new HashMap<>();
for (PALRepositoryModel model : list) {
if (model.isUse()) {
modelMap.put(model.getVersionId(), model);
}
}
for (Map.Entry<String, PALRepositoryModel> entry : modelMap.entrySet()) {
useVerList.add(entry.getValue());
}
return useVerList;
}
/**
* 获取指定根目录下所有的最新版本模型列表
* @param wsId

View File

@ -157,10 +157,10 @@ public class ValidProcessExcel {
}
// 3.校验在pal中是否存在并整合到目录框架
// 获取指定根目录下所有的最新版本模型列表
List<PALRepositoryModel> recentVerList = ProcessUtil.getRecentRepositoryList(wsId, methodCategory);
// 获取指定根目录下所有的使用中版本模型列表
List<PALRepositoryModel> useVerList = ProcessUtil.getUseRepositoryList(wsId, methodCategory);
// 模型进行转换
List<RepositoryInfoModel> batchModelList = ProcessUtil.palRepository2RepositoryInfoList(recentVerList, methodCategory);
List<RepositoryInfoModel> batchModelList = ProcessUtil.palRepository2RepositoryInfoList(useVerList, methodCategory);
// 查找重复的
for (RepositoryInfoModel infoModel : batchModelList) {