解决升版导致错误多次新建角色图问题

This commit is contained in:
zhal 2023-02-17 14:18:42 +08:00
parent d3e5ea4367
commit 13e4e6cce1
2 changed files with 98 additions and 5 deletions

View File

@ -4225,7 +4225,7 @@ public class CoeDesignerWeb extends ActionWeb {
CoePropertyUtil.createProperty(newUUID + "_attr", property);
}
//创建关联关系
//创建角色关联关系
CreateRelevanceRoleModel(isLargeIteration,oldUUID,PALRepositoryCache.getCache().get(newUUID),mapNewUUID,tempVer);
//创建绩效关联关系
CreateRelevancePerformanceModel(isLargeIteration,oldUUID,PALRepositoryCache.getCache().get(newUUID),mapNewUUID,tempVer);
@ -4250,7 +4250,7 @@ public class CoeDesignerWeb extends ActionWeb {
/**
* 操作升级版本/复制副本 创建对应角色/绩效关联关系
* 操作升级版本/复制副本
* @param isLargeIteration
* @param olduuid
*/
@ -4258,7 +4258,96 @@ public class CoeDesignerWeb extends ActionWeb {
ResponseObject ro = null;
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(olduuid);
if(oldModelList.size()>0){
//1.创建角色模型
if (oldModelList.size()>0) {
if(oldModelList.get(0).getAttrId().equals("role")) {
String relationFileId = oldModelList.get(0).getRelationFileId();
String srcPath = "";// 源文件路径
String targetPath = "";// 目标文件路径
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
PALRepositoryModelImpl lastplModel = (PALRepositoryModelImpl) coeProcessLevel.getInstance(relationFileId);
final String oldUUID = lastplModel.getId();
lastplModel.setId(UUIDGener.getUUID());
final String newUUID = lastplModel.getId();
//大小版本号处理
tempVer = isLargeIteration ? coeProcessLevel.getMaxVersionNum(lastplModel.getVersionId()) : coeProcessLevel.getMaxVersionNum(lastplModel.getVersionId(), lastplModel.getVersion());
lastplModel.setHistoryMaxVersion("0");
lastplModel.setVersion(VersionUtil.increaseVersionNo(tempVer, isLargeIteration));
lastplModel.setUse(false);
srcPath = lastplModel.getFilePath();
if (!"".equals(srcPath) && srcPath != null) {
targetPath = srcPath.replace(relationFileId, lastplModel.getId());
}
lastplModel.setFilePath(targetPath);
lastplModel.setPublish(false);
lastplModel.setStop(false);
lastplModel.setApproval(false);
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
String uid = super.getContext().getUID();
lastplModel.setCreateUser(uid);
lastplModel.setCreateDate(nowTime);
lastplModel.setModifyUser(uid);
lastplModel.setModifyDate(nowTime);
List data = new ArrayList<>();
data.add(0, "org.role");
data.add(1, newModel.getId());
lastplModel.setExt2(data.toString());
//密级
lastplModel.setSecurityLevel(-1);
int store = 0;
try {
store = CoeProcessLevelDaoFacotory.createCoeProcessLevel().insert(lastplModel);
if (store == 1) {
// 修改设计器文件
CoeFile fileUtil = new CoeFile();
fileUtil.copyDefaultVersion(srcPath, relationFileId, targetPath, lastplModel.getId());
// 获取新旧节点关联关系
final Map<String, String> mapNewUUID1 = createShapeIdRelation(PALRepositoryCache.getCache().get(relationFileId), true);
// 处理流程属性
String property = CoePropertyUtil.getPropertyValue(relationFileId + "_attr");
if (!UtilString.isEmpty(property)) {
CoePropertyUtil.createProperty(newUUID + "_attr", property);
}
for (DesignerShapeRelationModel oldModel : oldModelList) {
if (oldModel.getAttrId().equals("role")) {
String methodIds = "org.role";
if (mapNewUUID.containsKey(oldModel.getShapeId())) {
//重新设置修订关联关系
DesignerShapeRelationModel newModel1 = new DesignerShapeRelationModel();
newModel1.setId(UUIDGener.getUUID());
newModel1.setFileId(newModel.getId());
newModel1.setShapeId(mapNewUUID.get(oldModel.getShapeId()));
newModel1.setShapeText(oldModel.getShapeText());
newModel1.setAttrId(oldModel.getAttrId());
newModel1.setRelationFileId(newUUID);
newModel1.setRelationShapeId(oldModel.getRelationShapeId());
newModel1.setRelationShapeText(oldModel.getRelationShapeText());
dao.insert(newModel1);
}
}
}
CoeProcessLevelUtil.copyRepositoryProperty(PALRepositoryCache.getCache().get(relationFileId), PALRepositoryCache.getCache().get(newUUID), mapNewUUID1, _uc);
ro = ResponseObject.newOkResponse("创建成功");
ro.put("uuid", lastplModel.getId());
} else {
ro = ResponseObject.newWarnResponse("创建失败");
}
} catch (Exception e) {
ro = ResponseObject.newWarnResponse("创建失败," + e.getMessage());
}
}
}
/*if(oldModelList.size()>0){
for (DesignerShapeRelationModel oldModel : oldModelList) {
PALRepositoryModel model = PALRepositoryCache.getCache().get(newModel.getId());
@ -4344,10 +4433,11 @@ public class CoeDesignerWeb extends ActionWeb {
}else{
ro = ResponseObject.newWarnResponse("创建失败");
}
break;
}
}else{
ro = ResponseObject.newWarnResponse("创建失败");
}
}*/
return ro.toString();
}
@ -4523,7 +4613,9 @@ public class CoeDesignerWeb extends ActionWeb {
ResponseObject ro=ResponseObject.newOkResponse();
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(id);
for (DesignerShapeRelationModel oldModel : oldModelList) {
if(oldModelList.size()>0){
DesignerShapeRelationModel oldModel=oldModelList.get(0);
//如果关联角色图则同步复制角色图关联关系
String methodIds = "";
if (oldModel.getAttrId().equals("role")) {
@ -4547,6 +4639,7 @@ public class CoeDesignerWeb extends ActionWeb {
}
}
}
return ro.toString();
}