处理1个流程多版本对应多个流程图问题,建立流程v1,建立流程v2,切换使用流程v2,建立角色图v2,切换流程v1,上述步骤出现的角色图使用状态没有跟随流程图使用状态的问题

This commit is contained in:
446052889@qq.com 2025-03-11 15:01:10 +08:00
parent ff1382fe01
commit fe533014f2
2 changed files with 51 additions and 4 deletions

View File

@ -4782,6 +4782,45 @@ public class CoeDesignerWeb extends ActionWeb {
return ro.toString();
}
/**
* 获取已经存在的流程相关联的模型例如流程关联的角色图
* @param versionId 流程版本Id
* @param methodId 对应的建模方法ID
* @return
*/
private String getExistingModelVersionId(String versionId, String methodId) {
List<PALRepositoryModel> result = new ArrayList<>();
List<PALRepositoryModel> list2 = PALRepositoryCache.getByVersionId(versionId);
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
for (PALRepositoryModel model : list2) {
if (model == null) {
return null;
}
// 1.查询有关联的methodId模型
List<String> paramList = new ArrayList<>();
List data = new ArrayList();
data.add(0, methodId.trim());
data.add(1, model.getId().trim());
String param = data.toString();// 查询参数
paramList.add(param);
// 2.查询符合的methodId模型列表并排序理论上只会有一个
List<PALRepositoryModel> list = coeProcessLevel.searchRepositoryByMethodIdAndExt2(methodId, paramList);
result.addAll(list);
}
if (CollectionUtils.isNotEmpty(result)) {
result.sort((m1,m2) -> {
if (m1.getVersion() == m2.getVersion()) {
return m1.getCreateDate().compareTo(m2.getCreateDate());
}
return m1.getVersion() > m2.getVersion() ? 1 : -1;
});
// 3.取排在首位的角色模型的模型版本
return result.get(0).getVersionId();
}
return null;
}
/**
* 获取已经存在的流程相关联的模型例如流程关联的角色图
* @param uuid 流程Id
@ -5142,13 +5181,21 @@ public class CoeDesignerWeb extends ActionWeb {
* @return
*/
public String changePalDesignerVersionUseBycorrelationRoleModel(String wsId, String teamId, String id) {
ResponseObject ro = ResponseObject.newOkResponse();
String roleId = getExistingModel(id, "org.role");
int answer = 0;
ResponseObject ro = ResponseObject.newOkResponse();
PALRepository repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
// 角色图的所有版本先置为非使用中
PALRepositoryModel processModel = PALRepositoryCache.getCache().get(id);
if (processModel != null) {
String versionId = getExistingModelVersionId(processModel.getVersionId(), "org.role");
if (versionId != null) {
answer = repository.updateStateOfVersionUuid(versionId);// 更新所有的为0
}
}
String roleId = getExistingModel(id, "org.role");
if (roleId != null) {
PALRepository repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
PALRepositoryModel lastPlModel = repository.getInstance(roleId);
answer = repository.updateStateOfVersionUuid(lastPlModel.getVersionId());// 更新所有的为0
answer = repository.updateUseStateOfVersionUuid(lastPlModel.getId());// 更新当前版本为使用状态
CoeProcessLevelNoCache.getInstance().reloadInBackground(lastPlModel.getWsId());
if (answer > 0) {