处理一个流程的多个版本对应了多个绩效图的问题(在创建绩效图、流程升版、版本切换调整为与角色图相同的处理方式)
This commit is contained in:
parent
940f568587
commit
603e3b18dc
Binary file not shown.
@ -4748,13 +4748,16 @@ public class CoeDesignerWeb extends ActionWeb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//1.创建角色模型
|
//1.创建角色模型
|
||||||
String oldRoleModelId = getExistingModel(oldUUID, "org.role");// 查询与流程相关联的角色,即使流程内为关联具体的任何角色形状
|
String oldRoleModelId = getExistingModel(oldUUID, "org.role");// 查询与流程相关联的角色,即使流程内未关联具体的任何角色形状
|
||||||
if (oldRoleModelId != null) {
|
if (oldRoleModelId != null) {
|
||||||
CreateRelevanceRoleModel(isLargeIteration, oldUUID, PALRepositoryCache.getCache().get(newUUID), mapNewUUID, tempVer, teamId, oldRoleModelId);
|
CreateRelevanceRoleModel(isLargeIteration, oldUUID, PALRepositoryCache.getCache().get(newUUID), mapNewUUID, tempVer, teamId, oldRoleModelId);
|
||||||
}
|
}
|
||||||
|
|
||||||
//创建绩效关联关系
|
//创建绩效关联关系
|
||||||
CreateRelevancePerformanceModel(isLargeIteration, oldUUID, PALRepositoryCache.getCache().get(newUUID), mapNewUUID, tempVer);
|
String oldPerformanceModelId = getExistingModel(oldUUID, "control.kpi");// 查询与流程相关联的绩效,即使流程内未关联具体的任何绩效形状
|
||||||
|
if (oldPerformanceModelId != null) {
|
||||||
|
CreateRelevancePerformanceModel(isLargeIteration, oldUUID, PALRepositoryCache.getCache().get(newUUID), mapNewUUID, tempVer, teamId, oldPerformanceModelId);
|
||||||
|
}
|
||||||
|
|
||||||
//ydq 修改
|
//ydq 修改
|
||||||
CoeProcessLevelUtil.copyRepositoryProperty(PALRepositoryCache.getCache().get(oldUUID), PALRepositoryCache.getCache().get(newUUID), mapNewUUID, _uc,true);
|
CoeProcessLevelUtil.copyRepositoryProperty(PALRepositoryCache.getCache().get(oldUUID), PALRepositoryCache.getCache().get(newUUID), mapNewUUID, _uc,true);
|
||||||
@ -4970,107 +4973,92 @@ public class CoeDesignerWeb extends ActionWeb {
|
|||||||
* @param targetId
|
* @param targetId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String CreateRelevancePerformanceModel(boolean isLargeIteration, String olduuid, PALRepositoryModel newModel, Map<String, String> mapNewUUID, Double tempVer) {
|
public String CreateRelevancePerformanceModel(boolean isLargeIteration, String olduuid, PALRepositoryModel newModel, Map<String, String> mapNewUUID, Double tempVer, String teamId, String relationFileId) {
|
||||||
ResponseObject ro = ResponseObject.newOkResponse();
|
ResponseObject ro = null;
|
||||||
// 校验
|
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
||||||
PALRepositoryModel model = PALRepositoryCache.getCache().get(olduuid);
|
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(olduuid);
|
||||||
if (model == null)
|
// 1.创建绩效模型
|
||||||
throw new AWSException("没有找到文件:" + olduuid);
|
String srcPath = "";// 源文件路径
|
||||||
PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao();
|
String targetPath = "";// 目标文件路径
|
||||||
List<PALRepositoryPropertyModel> oldPropertyList = repositoryPropertyDao.getPropertysByPlid(olduuid, "");
|
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||||
if (oldPropertyList != null && oldPropertyList.size() > 0)
|
PALRepositoryModelImpl lastplModel = (PALRepositoryModelImpl) coeProcessLevel.getInstance(relationFileId);
|
||||||
for (PALRepositoryPropertyModel propertyModel : oldPropertyList)
|
final String oldUUID = lastplModel.getId();
|
||||||
//获取文件属性中流程绩效
|
lastplModel.setId(UUIDGener.getUUID());
|
||||||
if (propertyModel.getPropertyId().equals("Process_performance_metrics")) {
|
final String newUUID = lastplModel.getId();
|
||||||
String relationFileId = JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId");
|
//大小版本号处理
|
||||||
String[] splitRelationFileId;
|
tempVer = isLargeIteration ? coeProcessLevel.getMaxVersionNum(lastplModel.getVersionId()) : coeProcessLevel.getMaxVersionNum(lastplModel.getVersionId(), lastplModel.getVersion());
|
||||||
if (UtilString.isNotEmpty(relationFileId)) {
|
lastplModel.setHistoryMaxVersion("0");
|
||||||
|
lastplModel.setVersion(VersionUtil.increaseVersionNo(tempVer, isLargeIteration));
|
||||||
if (relationFileId.contains(",")) {
|
lastplModel.setUse(false);
|
||||||
relationFileId = relationFileId.split(",")[0];
|
srcPath = lastplModel.getFilePath();
|
||||||
}
|
if (!"".equals(srcPath) && srcPath != null) {
|
||||||
String srcPath = "";// 源文件路径
|
targetPath = srcPath.replace(relationFileId, lastplModel.getId());
|
||||||
String targetPath = "";// 目标文件路径
|
}
|
||||||
PALRepository coeProcessLevel = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
lastplModel.setFilePath(targetPath);
|
||||||
PALRepositoryModelImpl lastplModel = (PALRepositoryModelImpl) coeProcessLevel.getInstance(relationFileId);
|
lastplModel.setPublish(false);
|
||||||
final String oldUUID = lastplModel.getId();
|
lastplModel.setStop(false);
|
||||||
lastplModel.setId(UUIDGener.getUUID());
|
lastplModel.setApproval(false);
|
||||||
final String newUUID = lastplModel.getId();
|
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
||||||
//大小版本号处理
|
String uid = super.getContext().getUID();
|
||||||
tempVer = isLargeIteration ? coeProcessLevel.getMaxVersionNum(lastplModel.getVersionId()) : coeProcessLevel.getMaxVersionNum(lastplModel.getVersionId(), lastplModel.getVersion());
|
lastplModel.setCreateUser(uid);
|
||||||
lastplModel.setHistoryMaxVersion("0");
|
lastplModel.setCreateDate(nowTime);
|
||||||
lastplModel.setVersion(VersionUtil.increaseVersionNo(tempVer, isLargeIteration));
|
lastplModel.setModifyUser(uid);
|
||||||
lastplModel.setUse(false);
|
lastplModel.setModifyDate(nowTime);
|
||||||
srcPath = lastplModel.getFilePath();
|
List data = new ArrayList<>();
|
||||||
if (!"".equals(srcPath) && srcPath != null) {
|
data.add(0, "control.kpi");
|
||||||
targetPath = srcPath.replace(relationFileId, lastplModel.getId());
|
data.add(1, newModel.getId());
|
||||||
}
|
lastplModel.setExt2(data.toString());
|
||||||
lastplModel.setFilePath(targetPath);
|
//密级
|
||||||
lastplModel.setPublish(false);
|
lastplModel.setSecurityLevel(-1);
|
||||||
lastplModel.setStop(false);
|
int store = 0;
|
||||||
lastplModel.setApproval(false);
|
try {
|
||||||
Timestamp nowTime = new Timestamp(System.currentTimeMillis());
|
store = CoeProcessLevelDaoFacotory.createCoeProcessLevel().insert(lastplModel);
|
||||||
String uid = super.getContext().getUID();
|
if (store == 1) {
|
||||||
lastplModel.setCreateUser(uid);
|
// 修改设计器文件
|
||||||
lastplModel.setCreateDate(nowTime);
|
CoeFile fileUtil = new CoeFile();
|
||||||
lastplModel.setModifyUser(uid);
|
fileUtil.copyDefaultVersion(srcPath, relationFileId, targetPath, lastplModel.getId());
|
||||||
lastplModel.setModifyDate(nowTime);
|
|
||||||
List data = new ArrayList<>();
|
|
||||||
data.add(0, "control.kpi");
|
|
||||||
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), false);
|
|
||||||
// 处理流程属性
|
|
||||||
String property = CoePropertyUtil.getPropertyValue(relationFileId + "_attr");
|
|
||||||
if (!UtilString.isEmpty(property)) {
|
|
||||||
CoePropertyUtil.createProperty(newUUID + "_attr", property);
|
|
||||||
}
|
|
||||||
|
|
||||||
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
|
||||||
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(olduuid);
|
|
||||||
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
|
||||||
|
|
||||||
if (oldModel.getAttrId().equals("Process_performance_metrics")) {
|
|
||||||
//重新设置修订关联关系
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// 获取新旧节点关联关系
|
||||||
|
final Map<String, String> mapNewUUID1 = createShapeIdRelation(PALRepositoryCache.getCache().get(relationFileId), false);
|
||||||
|
// 处理流程属性
|
||||||
|
String property = CoePropertyUtil.getPropertyValue(relationFileId + "_attr");
|
||||||
|
if (!UtilString.isEmpty(property)) {
|
||||||
|
CoePropertyUtil.createProperty(newUUID + "_attr", property);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
||||||
|
if (oldModel.getAttrId().equals("Process_performance_metrics")) {
|
||||||
|
String methodIds = "control.kpi";
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新版本文件 小组权限设置
|
||||||
|
if (UtilString.isNotEmpty(teamId)) {
|
||||||
|
CoeCooperationAPIManager.getInstance().addRepositoryToTeamAndRolePerm(_uc, teamId, lastplModel.getVersionId(), true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
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());
|
||||||
|
}
|
||||||
return ro.toString();
|
return ro.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5206,30 +5194,31 @@ public class CoeDesignerWeb extends ActionWeb {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String changePalDesignerVersionUseBycorrelationPerformanceModel(String wsId, String teamId, String id) {
|
public String changePalDesignerVersionUseBycorrelationPerformanceModel(String wsId, String teamId, String id) {
|
||||||
|
int answer = 0;
|
||||||
ResponseObject ro = ResponseObject.newOkResponse();
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
DesignerShapeRelationDao dao = new DesignerShapeRelationDao();
|
PALRepository repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
||||||
List<DesignerShapeRelationModel> oldModelList = dao.getModelListByFileId(id);
|
// 绩效图的所有版本先置为非使用中
|
||||||
for (DesignerShapeRelationModel oldModel : oldModelList) {
|
PALRepositoryModel processModel = PALRepositoryCache.getCache().get(id);
|
||||||
|
if (processModel != null) {
|
||||||
//如果关联角色图,则同步复制角色图关联关系
|
String versionId = getExistingModelVersionId(processModel.getVersionId(), "control.kpi");
|
||||||
String methodIds = "";
|
if (versionId != null) {
|
||||||
if (oldModel.getAttrId().equals("Process_performance_metrics")) {
|
answer = repository.updateStateOfVersionUuid(versionId);// 更新所有的为0
|
||||||
int answer = 0;
|
|
||||||
PALRepository repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel();
|
|
||||||
PALRepositoryModel lastPlModel = repository.getInstance(oldModel.getRelationFileId());
|
|
||||||
answer = repository.updateStateOfVersionUuid(lastPlModel.getVersionId());// 更新所有的为0
|
|
||||||
answer = repository.updateUseStateOfVersionUuid(lastPlModel.getId());// 更新当前版本为使用状态
|
|
||||||
CoeProcessLevelNoCache.getInstance().reloadInBackground(lastPlModel.getWsId());
|
|
||||||
if (answer > 0) {
|
|
||||||
ro.put("id", id);
|
|
||||||
return ro.toString();
|
|
||||||
} else {
|
|
||||||
return ResponseObject.newErrResponse("使用版本更新失败").toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ro.toString();
|
|
||||||
|
String performanceId = getExistingModel(id, "control.kpi");
|
||||||
|
if (performanceId != null) {
|
||||||
|
PALRepositoryModel lastPlModel = repository.getInstance(performanceId);
|
||||||
|
answer = repository.updateUseStateOfVersionUuid(lastPlModel.getId());// 更新当前版本为使用状态
|
||||||
|
CoeProcessLevelNoCache.getInstance().reloadInBackground(lastPlModel.getWsId());
|
||||||
|
if (answer > 0) {
|
||||||
|
ro.put("id", id);
|
||||||
|
return ro.toString();
|
||||||
|
} else {
|
||||||
|
return ResponseObject.newErrResponse("使用版本更新失败").toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ResponseObject.newErrResponse("使用版本更新失败,绩效图尚未建立").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 生成更多特性的json串
|
// 生成更多特性的json串
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user