diff --git a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar index 56e89329..c471e57c 100644 Binary files a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar and b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar differ diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java index 8fba47e9..5267a0b2 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java @@ -4748,13 +4748,16 @@ public class CoeDesignerWeb extends ActionWeb { } //1.创建角色模型 - String oldRoleModelId = getExistingModel(oldUUID, "org.role");// 查询与流程相关联的角色,即使流程内为关联具体的任何角色形状 + String oldRoleModelId = getExistingModel(oldUUID, "org.role");// 查询与流程相关联的角色,即使流程内未关联具体的任何角色形状 if (oldRoleModelId != null) { 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 修改 CoeProcessLevelUtil.copyRepositoryProperty(PALRepositoryCache.getCache().get(oldUUID), PALRepositoryCache.getCache().get(newUUID), mapNewUUID, _uc,true); @@ -4970,107 +4973,92 @@ public class CoeDesignerWeb extends ActionWeb { * @param targetId * @return */ - public String CreateRelevancePerformanceModel(boolean isLargeIteration, String olduuid, PALRepositoryModel newModel, Map mapNewUUID, Double tempVer) { - ResponseObject ro = ResponseObject.newOkResponse(); - // 校验 - PALRepositoryModel model = PALRepositoryCache.getCache().get(olduuid); - if (model == null) - throw new AWSException("没有找到文件:" + olduuid); - PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao(); - List oldPropertyList = repositoryPropertyDao.getPropertysByPlid(olduuid, ""); - if (oldPropertyList != null && oldPropertyList.size() > 0) - for (PALRepositoryPropertyModel propertyModel : oldPropertyList) - //获取文件属性中流程绩效 - if (propertyModel.getPropertyId().equals("Process_performance_metrics")) { - String relationFileId = JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId"); - String[] splitRelationFileId; - if (UtilString.isNotEmpty(relationFileId)) { - - if (relationFileId.contains(",")) { - relationFileId = relationFileId.split(",")[0]; - } - 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, "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 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 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()); - } - - } + public String CreateRelevancePerformanceModel(boolean isLargeIteration, String olduuid, PALRepositoryModel newModel, Map mapNewUUID, Double tempVer, String teamId, String relationFileId) { + ResponseObject ro = null; + DesignerShapeRelationDao dao = new DesignerShapeRelationDao(); + List oldModelList = dao.getModelListByFileId(olduuid); + // 1.创建绩效模型 + 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, "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 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(); } @@ -5206,30 +5194,31 @@ public class CoeDesignerWeb extends ActionWeb { * @return */ public String changePalDesignerVersionUseBycorrelationPerformanceModel(String wsId, String teamId, String id) { + int answer = 0; ResponseObject ro = ResponseObject.newOkResponse(); - DesignerShapeRelationDao dao = new DesignerShapeRelationDao(); - List oldModelList = dao.getModelListByFileId(id); - for (DesignerShapeRelationModel oldModel : oldModelList) { - - //如果关联角色图,则同步复制角色图关联关系 - String methodIds = ""; - if (oldModel.getAttrId().equals("Process_performance_metrics")) { - 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(); - } - + PALRepository repository = CoeProcessLevelDaoFacotory.createCoeProcessLevel(); + // 绩效图的所有版本先置为非使用中 + PALRepositoryModel processModel = PALRepositoryCache.getCache().get(id); + if (processModel != null) { + String versionId = getExistingModelVersionId(processModel.getVersionId(), "control.kpi"); + if (versionId != null) { + answer = repository.updateStateOfVersionUuid(versionId);// 更新所有的为0 } } - 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串