diff --git a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java index a9ffe133..6f390ca3 100644 --- a/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java +++ b/com.actionsoft.apps.coe.pal.publisher/src/com/actionsoft/apps/coe/pal/publisher/client/web/ProcessPublishWeb.java @@ -133,17 +133,14 @@ public class ProcessPublishWeb extends ActionWeb { public String processPublishNewPage(String teamId, String wsId) { String teamName = ""; boolean isActive = PALRepositoryQueryAPIManager.getInstance().isActiveWorkSpace(wsId); - if (!isActive) { - return AlertWindow.getAuthorityMessagePage("资产库被停用", "资产库被停用,该小组无法访问流程发布功能,请联系系统管理员"); - } + if (!isActive) + return AlertWindow.getAuthorityMessagePage("资产库被停用", "资产库被停用,该小组无法访问流程发布功能,请联系系统管理员"); if (UtilString.isNotEmpty(teamId)) { CoeCooperationTeamModel team = CoeCooperationAPIManager.getInstance().queryCooperationTeamById(teamId, true); - if (team == null) { - return AlertWindow.getAuthorityMessagePage("小组查询失败", "小组不存在或已停用,该小组无法访问流程发布功能,请联系系统管理员"); - } - if (!team.getWsId().equals(wsId)) { - return AlertWindow.getAuthorityMessagePage("小组信息错误", "小组与对应的资产库信息不匹配,参数错误,请联系系统管理员"); - } + if (team == null) + return AlertWindow.getAuthorityMessagePage("小组查询失败", "小组不存在或已停用,该小组无法访问流程发布功能,请联系系统管理员"); + if (!team.getWsId().equals(wsId)) + return AlertWindow.getAuthorityMessagePage("小组信息错误", "小组与对应的资产库信息不匹配,参数错误,请联系系统管理员"); teamName = team.getTeamName(); } ProcessDefinition processDef = ProcessDefCache.getInstance().getModel(PublisherConstant.PROCESSID); @@ -152,9 +149,8 @@ public class ProcessPublishWeb extends ActionWeb { macroLibraries.put("teamId", teamId == null ? "" : teamId); macroLibraries.put("teamName", teamName); macroLibraries.put("wsId", wsId); - if (title == null || "".equals(title)) { - title = Quota.getMaxCoEPALUser() <= 0 ? "PAL流程发布" : "流程发布"; - } + if (title == null || "".equals(title)) + title = Quota.getMaxCoEPALUser() <= 0 ? "PAL流程发布" : "流程发布"; macroLibraries.put("title", title); macroLibraries.put("sessionId", _uc.getSessionId()); macroLibraries.put("settingParam", JSON.toJSON(macroLibraries)); @@ -179,24 +175,20 @@ public class ProcessPublishWeb extends ActionWeb { for (TaskInstance taskInstance : list) { int num = start * size + i; String owner = taskInstance.getOwner(); - if (UserCache.getModel(owner) != null) { - owner = UserCache.getModel(owner).getUserName(); - } + if (UserCache.getModel(owner) != null) + owner = UserCache.getModel(owner).getUserName(); boolean hasRead = taskInstance.getReadTime() == null ? false : true; String className = ""; - if (!hasRead) { - className = "task_no_read"; - } + if (!hasRead) + className = "task_no_read"; String checkBox = ""; // 任务发起人可以删除任务 - if ("00000000-0000-0000-0000-000000000000".equals(taskInstance.getParentTaskInstId())) { - checkBox = ""; - } String openState = ""; - if (taskInstance.getState() == UserTaskRuntimeConst.STATE_TYPE_SYSTEM_NOTIFY) { - openState = "2"; - } + if (taskInstance.getState() == UserTaskRuntimeConst.STATE_TYPE_SYSTEM_NOTIFY) + openState = "2"; html.append("" + " " + num + "" + " " + checkBox @@ -231,11 +223,10 @@ public class ProcessPublishWeb extends ActionWeb { list = list.stream().filter(taskInstance -> taskInstance.getState() != UserTaskRuntimeConst.STATE_TYPE_SYSTEM_NOTIFY).collect(Collectors.toList()); handleNewTaskInstanceList(list, processPublishDTOS, search, ""); } - if (processPublishDTOS.size() > (start * size + size)) { - res.put("data", processPublishDTOS.subList(0, start * size + size)); - } else { - res.put("data", processPublishDTOS); - } + if (processPublishDTOS.size() > (start * size + size)) + res.put("data", processPublishDTOS.subList(0, start * size + size)); + else + res.put("data", processPublishDTOS); res.put("count", processPublishDTOS.size()); return res.toString(); } @@ -257,11 +248,10 @@ public class ProcessPublishWeb extends ActionWeb { list = list.stream().filter(taskInstance -> taskInstance.getState() == UserTaskRuntimeConst.STATE_TYPE_SYSTEM_NOTIFY).collect(Collectors.toList()); handleNewTaskInstanceList(list, processPublishDTOS, search, "2"); } - if (processPublishDTOS.size() > (start * size + size)) { - res.put("data", processPublishDTOS.subList(0, start * size + size)); - } else { - res.put("data", processPublishDTOS); - } + if (processPublishDTOS.size() > (start * size + size)) + res.put("data", processPublishDTOS.subList(0, start * size + size)); + else + res.put("data", processPublishDTOS); res.put("count", processPublishDTOS.size()); return res.toString(); } @@ -289,12 +279,10 @@ public class ProcessPublishWeb extends ActionWeb { dto.setOwnerProcess("00000000-0000-0000-0000-000000000000".equals(taskInstance.getParentTaskInstId())); dto.setTaskInstId(taskInstance.getId()); if (StringUtils.isNotBlank(search)) { - if (fromUser.toLowerCase().contains(search.toLowerCase())) { - processPublishDTOS.add(dto); - } - } else { - processPublishDTOS.add(dto); - } + if (fromUser.toLowerCase().contains(search.toLowerCase())) + processPublishDTOS.add(dto); + } else + processPublishDTOS.add(dto); } int index = 1; for (ProcessPublishDTO dto : processPublishDTOS) { @@ -321,14 +309,12 @@ public class ProcessPublishWeb extends ActionWeb { for (HistoryTaskInstance historyTaskInstance : list) { int num = start * size + i; String owner = historyTaskInstance.getOwner(); - if (UserCache.getModel(owner) != null) { - owner = UserCache.getModel(owner).getUserName(); - } + if (UserCache.getModel(owner) != null) + owner = UserCache.getModel(owner).getUserName(); boolean hasRead = historyTaskInstance.getReadTime() == null ? false : true; String className = ""; - if (!hasRead) { - className = "task_no_read"; - } + if (!hasRead) + className = "task_no_read"; html.append("" + " " + num + "" @@ -364,11 +350,10 @@ public class ProcessPublishWeb extends ActionWeb { list = list.stream().filter(historyTaskInstance -> historyTaskInstance.getState() != UserTaskRuntimeConst.STATE_TYPE_SYSTEM_NOTIFY).collect(Collectors.toList()); handleNewHistoryTaskInstanceList(list, processPublishDTOS, search); } - if (processPublishDTOS.size() > (start * size + size)) { - res.put("data", processPublishDTOS.subList(0, start * size + size)); - } else { - res.put("data", processPublishDTOS); - } + if (processPublishDTOS.size() > (start * size + size)) + res.put("data", processPublishDTOS.subList(0, start * size + size)); + else + res.put("data", processPublishDTOS); res.put("count", processPublishDTOS.size()); return res.toString(); } @@ -390,11 +375,10 @@ public class ProcessPublishWeb extends ActionWeb { list = list.stream().filter(historyTaskInstance -> historyTaskInstance.getState() == UserTaskRuntimeConst.STATE_TYPE_SYSTEM_NOTIFY).collect(Collectors.toList()); handleNewHistoryTaskInstanceList(list, processPublishDTOS, search); } - if (processPublishDTOS.size() > (start * size + size)) { - res.put("data", processPublishDTOS.subList(0, start * size + size)); - } else { - res.put("data", processPublishDTOS); - } + if (processPublishDTOS.size() > (start * size + size)) + res.put("data", processPublishDTOS.subList(0, start * size + size)); + else + res.put("data", processPublishDTOS); res.put("count", processPublishDTOS.size()); return res.toString(); } @@ -421,12 +405,10 @@ public class ProcessPublishWeb extends ActionWeb { dto.setOpenState("2"); dto.setTaskInstId(historyTaskInstance.getId()); if (StringUtils.isNotBlank(search)) { - if (fromUser.toLowerCase().contains(search.toLowerCase())) { - processPublishDTOS.add(dto); - } - } else { - processPublishDTOS.add(dto); - } + if (fromUser.toLowerCase().contains(search.toLowerCase())) + processPublishDTOS.add(dto); + } else + processPublishDTOS.add(dto); } int index = 1; for (ProcessPublishDTO dto : processPublishDTOS) { @@ -452,9 +434,8 @@ public class ProcessPublishWeb extends ActionWeb { for (ProcessInstance processInstance : list) { int num = pageNum * size + i; String creater = processInstance.getCreateUser(); - if (UserCache.getModel(creater) != null) { - creater = UserCache.getModel(creater).getUserName(); - } + if (UserCache.getModel(creater) != null) + creater = UserCache.getModel(creater).getUserName(); html.append("" + " " + num + "" + "
taskList = SDK.getTaskQueryAPI().processInstId(processInstance.getId()).activeTask().list(); @@ -520,9 +500,8 @@ public class ProcessPublishWeb extends ActionWeb { String approvalState; for (TaskInstance taskInstance : taskList) { String title = taskInstance.getTitle(); - if (title.contains("流程通知")) { - continue; - } + if (title.contains("流程通知")) + continue; transactor = taskInstance.getTarget(); UserModel userModel = SDK.getORGAPI().getUser(transactor); if (userModel != null) { @@ -544,9 +523,8 @@ public class ProcessPublishWeb extends ActionWeb { if (isEnd) { transactor = "无"; approvalState = "已完成"; - } else { - approvalState = "审批中"; - } + } else + approvalState = "审批中"; dto.setApprovalUser(transactor); dto.setApprovalState(approvalState); dto.setApprovalUserId(transactorId); @@ -557,40 +535,34 @@ public class ProcessPublishWeb extends ActionWeb { //类型的获取 List type = Lists.newArrayList(); BO publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(processInstance.getId()); - if (publish == null) { - dto.setType(""); - } else { + if (publish == null) + dto.setType(""); + else { String bindId = publish.getBindId(); List n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").addQuery("BINDID=", bindId).list(); - if (n != null && n.size() > 0) { - type.add("发布" + n.size()); - } + if (n != null && n.size() > 0) + type.add("发布" + n.size()); List c = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").addQuery("BINDID=", bindId).list(); - if (c != null && c.size() > 0) { - type.add("更新" + c.size()); - } + if (c != null && c.size() > 0) + type.add("更新" + c.size()); List s = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").addQuery("BINDID=", bindId).list(); - if (s != null && s.size() > 0) { - type.add("废止" + s.size()); - } + if (s != null && s.size() > 0) + type.add("废止" + s.size()); dto.setType(Joiner.on(",").join(type)); } //处理返回数据根据搜索条件 if (flag) { if (dto.getTitle().toLowerCase().contains(searchValue) || dto.getCreateUser().contains(searchValue) - || dto.getType().toLowerCase().contains(searchValue) || dto.getApprovalState().toLowerCase().contains(searchValue)) { - processPublishHistoryDTOList.add(dto); - } - } else { - processPublishHistoryDTOList.add(dto); - } - } - if (processPublishHistoryDTOList.size() > (start * size + size)) { - res.put("data", processPublishHistoryDTOList.subList(0, start * size + size)); - } else { - res.put("data", processPublishHistoryDTOList); + || dto.getType().toLowerCase().contains(searchValue) || dto.getApprovalState().toLowerCase().contains(searchValue)) + processPublishHistoryDTOList.add(dto); + } else + processPublishHistoryDTOList.add(dto); } + if (processPublishHistoryDTOList.size() > (start * size + size)) + res.put("data", processPublishHistoryDTOList.subList(0, start * size + size)); + else + res.put("data", processPublishHistoryDTOList); res.put("count", processPublishHistoryDTOList.size()); return res.toString(); } @@ -604,9 +576,8 @@ public class ProcessPublishWeb extends ActionWeb { */ public String sendMessageUrge(UserContext me, String processInstId) { BO publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(processInstId); - if (publish == null) { - return ResponseObject.newErrResponse("not found processInstance").toString(); - } + if (publish == null) + return ResponseObject.newErrResponse("not found processInstance").toString(); ProcessDefinition processDef = ProcessDefCache.getInstance().getModel(publish.getProcessDefId()); String reminderConfig = processDef.getNotifyConfig(); JSONObject object = JSON.parseObject(reminderConfig); @@ -619,9 +590,8 @@ public class ProcessPublishWeb extends ActionWeb { return ResponseObject.newErrResponse(e.getMessage()).toString(); } return ResponseObject.newOkResponse().toString(); - } else { - return ResponseObject.newErrResponse("流程催办未开启,请先开启").toString(); - } + } else + return ResponseObject.newErrResponse("流程催办未开启,请先开启").toString(); } /** @@ -638,11 +608,10 @@ public class ProcessPublishWeb extends ActionWeb { AppAPI appApi = SDK.getAppAPI(); String processDefId = ""; String selectionmode = appApi.getProperty(PublisherConstant.PUBLISH, "selectionmode"); - if ("radio".equals(selectionmode)) { - processDefId = appApi.getProperty("com.actionsoft.apps.coe.pal.publisher", "newPublishProcessId"); - } else if ("check".equals(selectionmode) || "checkInherit".equals(selectionmode)) { - processDefId = appApi.getProperty(PublisherConstant.PUBLISH, "publishProcessId"); - } + if ("radio".equals(selectionmode)) + processDefId = appApi.getProperty("com.actionsoft.apps.coe.pal.publisher", "newPublishProcessId"); + else if ("check".equals(selectionmode) || "checkInherit".equals(selectionmode)) + processDefId = appApi.getProperty(PublisherConstant.PUBLISH, "publishProcessId"); ProcessDefinition processDef = (ProcessDefinition) ProcessDefCache.getInstance().getModel(processDefId); // 先建立bo再运行任务 // 创建流程实例 @@ -670,24 +639,20 @@ public class ProcessPublishWeb extends ActionWeb { List tracks = execquery.fetch(); TaskInstance userTaskInst = null; String targetUserInfo = ""; - for (ProcessExecutionTrack track : tracks) { - if (track.getObjectList() != null) { + for (ProcessExecutionTrack track : tracks) + if (track.getObjectList() != null) { List taskList = track.getObjectList(); - for (Object o : taskList) { - if (o instanceof TaskInstance) { + for (Object o : taskList) + if (o instanceof TaskInstance) { TaskInstance taskInst = (TaskInstance) o; - if (taskInst.getActivityType().equals(TaskRuntimeConst.ACTIVITY_TYPE_USERTASK)) { - if (taskInst.getTarget().equals(getContext().getUID())) { + if (taskInst.getActivityType().equals(TaskRuntimeConst.ACTIVITY_TYPE_USERTASK)) + if (taskInst.getTarget().equals(getContext().getUID())) { userTaskInst = taskInst; break;// 如果是多例的人工任务,只拿第1个给当前人打开表单 - } else { - targetUserInfo += " " + SDK.getORGAPI().getUserAliasNames(taskInst.getTarget()); - } - } + } else + targetUserInfo += " " + SDK.getORGAPI().getUserAliasNames(taskInst.getTarget()); } - } } - } ResponseObject ro = ResponseObject.newOkResponse(); JSONObject object = new JSONObject(); @@ -740,24 +705,20 @@ public class ProcessPublishWeb extends ActionWeb { List tracks = execquery.fetch(); TaskInstance userTaskInst = null; String targetUserInfo = ""; - for (ProcessExecutionTrack track : tracks) { - if (track.getObjectList() != null) { + for (ProcessExecutionTrack track : tracks) + if (track.getObjectList() != null) { List taskList = track.getObjectList(); - for (Object o : taskList) { - if (o instanceof TaskInstance) { + for (Object o : taskList) + if (o instanceof TaskInstance) { TaskInstance taskInst = (TaskInstance) o; - if (taskInst.getActivityType().equals(TaskRuntimeConst.ACTIVITY_TYPE_USERTASK)) { - if (taskInst.getTarget().equals(getContext().getUID())) { + if (taskInst.getActivityType().equals(TaskRuntimeConst.ACTIVITY_TYPE_USERTASK)) + if (taskInst.getTarget().equals(getContext().getUID())) { userTaskInst = taskInst; break;// 如果是多例的人工任务,只拿第1个给当前人打开表单 - } else { - targetUserInfo += " " + SDK.getORGAPI().getUserAliasNames(taskInst.getTarget()); - } - } + } else + targetUserInfo += " " + SDK.getORGAPI().getUserAliasNames(taskInst.getTarget()); } - } } - } ResponseObject ro = ResponseObject.newOkResponse(); JSONObject object = new JSONObject(); @@ -782,11 +743,10 @@ public class ProcessPublishWeb extends ActionWeb { */ public String toPublishInstanceHandle(String processInstId, String taskInstId, String openState) { int openType = 2; - if (openState != null && !"".equals(openState)) { - openType = Integer.parseInt(openState); - } else { - return SDK.getFormAPI().getFormPage(_uc, processInstId, taskInstId, 1, 1, null, null); - } + if (openState != null && !"".equals(openState)) + openType = Integer.parseInt(openState); + else + return SDK.getFormAPI().getFormPage(_uc, processInstId, taskInstId, 1, 1, null, null); return SDK.getFormAPI().getFormPage(_uc, processInstId, taskInstId, openType, 1, null, null); } @@ -803,9 +763,8 @@ public class ProcessPublishWeb extends ActionWeb { int successNum = 0; // 删除成功的条数(分页需要) int errNum = 0; for (String processInstId : processInstIdArray) { - if (processInstId.equals("")) { - continue; - } + if (processInstId.equals("")) + continue; boolean result = SDK.getProcessAPI().deleteById(processInstId, _uc.getUID()); if (!result) { ProcessInstance processInstModel = SDK.getProcessAPI().getInstanceById(processInstId); @@ -813,9 +772,8 @@ public class ProcessPublishWeb extends ActionWeb { errorTask.append(processInstModel.getTitle()).append(","); errNum++; } - } else { - successNum++; - } + } else + successNum++; } if (errorTask.length() == 0) { ResponseObject ro = ResponseObject.newOkResponse(); @@ -856,16 +814,14 @@ public class ProcessPublishWeb extends ActionWeb { if (UtilString.isNotEmpty(teamId)) { // 小组Id不为空,则需要查询小组授权后的流程库 CoeCooperationTeamModel team = CoeCooperationAPIManager.getInstance().queryCooperationTeamById(teamId, true); - if (team != null) { - wsId = team.getWsId(); - } + if (team != null) + wsId = team.getWsId(); } List usedList = new ArrayList(); List methodList = PALMethodManager.getInstance().list(); - for (String method : methodList) { - PALRepositoryQueryAPIManager.getInstance().getAllUsedPalRepositoryModelsByPid(wsId, method, usedList); - } + for (String method : methodList) + PALRepositoryQueryAPIManager.getInstance().getAllUsedPalRepositoryModelsByPid(wsId, method, usedList); List list = dao.getNotPublishedRepositoryList(wsId); List removeList = new ArrayList(); @@ -874,26 +830,21 @@ public class ProcessPublishWeb extends ActionWeb { List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); // 小组Id不为空,删除不具有小组权限的流程 if (list != null) { - for (PALRepositoryModel model : list) { - if (!versionIds.contains(model.getVersionId())) { - removeList.add(model); - } - } + for (PALRepositoryModel model : list) + if (!versionIds.contains(model.getVersionId())) + removeList.add(model); list.removeAll(removeList); } if (usedList != null) { - for (PALRepositoryModel model : usedList) { - if (!versionIds.contains(model.getVersionId())) { - removeUsedList.add(model); - } - } + for (PALRepositoryModel model : usedList) + if (!versionIds.contains(model.getVersionId())) + removeUsedList.add(model); usedList.removeAll(removeUsedList); } } StringBuilder checkboxIds = new StringBuilder(); - for (PALRepositoryModel model : list) { - checkboxIds.append(model.getId()).append(","); - } + for (PALRepositoryModel model : list) + checkboxIds.append(model.getId()).append(","); JSONArray treeData = getRepositoryTree(usedList, wsId, false, true, checkboxIds.toString(), false); ResponseObject ro = ResponseObject.newOkResponse(); ro.put("treeData", treeData); @@ -914,8 +865,8 @@ public class ProcessPublishWeb extends ActionWeb { JSONArray ja = new JSONArray(); PALRepository dao = new PALRepository(); List list = dao.getPublishedRepositoryVersionListByRid(resourceId); - if (list != null) { - for (PALRepositoryModel model : list) { + if (list != null) + for (PALRepositoryModel model : list) { JSONObject object = new JSONObject(); object.put("id", model.getId()); object.put("name", model.getName()); @@ -923,7 +874,6 @@ public class ProcessPublishWeb extends ActionWeb { // object.put("version", model.getVersion()); ja.add(object); } - } ResponseObject ro = ResponseObject.newOkResponse(); ro.put("treeData", ja); return ro.toString(); @@ -958,23 +908,19 @@ public class ProcessPublishWeb extends ActionWeb { if (UtilString.isNotEmpty(teamId)) { // 小组Id不为空,则需要查询小组授权后的流程库 CoeCooperationTeamModel team = CoeCooperationAPIManager.getInstance().queryCooperationTeamById(teamId, true); - if (team != null) { - wsId = team.getWsId(); - } + if (team != null) + wsId = team.getWsId(); } List list = dao.getPublishedRepositoryList(wsId); List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); - if (UtilString.isNotEmpty(teamId)) { - if (list != null) { + if (UtilString.isNotEmpty(teamId)) + if (list != null) { List removeList = new ArrayList(); - for (PALRepositoryModel model : list) { - if (!versionIds.contains(model.getVersionId())) { - removeList.add(model); - } - } + for (PALRepositoryModel model : list) + if (!versionIds.contains(model.getVersionId())) + removeList.add(model); list.removeAll(removeList); } - } JSONArray treeData = getRepositoryTree(list, wsId, false, true, "-", false); ResponseObject ro = ResponseObject.newOkResponse(); @@ -994,16 +940,14 @@ public class ProcessPublishWeb extends ActionWeb { JSONArray wsTree = new JSONArray(); String isIntegrationAWSUser = appApi.getProperty(PublisherConstant.PUBLISH, "isIntegrationAWSUser"); // 是否整合AWS用户 String roleId = ""; - if ("false".equals(isIntegrationAWSUser)) { - roleId = PublishConst.GUESTROLE; - } else { - roleId = _uc.getRoleModel().getId(); - } + if ("false".equals(isIntegrationAWSUser)) + roleId = PublishConst.GUESTROLE; + else + roleId = _uc.getRoleModel().getId(); PALRepository dao = new PALRepository(); List> allWsList = dao.getWorkSpaceListByPublishRole(roleId, false); - if (allWsList == null || allWsList.size() == 0) { - return AlertWindow.getAuthorityMessagePage("没有可访问的资产库文件", "未分配资产库访问权限,请联系系统管理员"); - } + if (allWsList == null || allWsList.size() == 0) + return AlertWindow.getAuthorityMessagePage("没有可访问的资产库文件", "未分配资产库访问权限,请联系系统管理员"); List> wsList = dao.getWorkSpaceListByPublishRole(roleId, true); // 有访问权限的资产库 JSONArray repositoryList = new JSONArray(); // 有访问权限的文件 if (wsList != null && wsList.size() > 0) { @@ -1011,17 +955,16 @@ public class ProcessPublishWeb extends ActionWeb { List> removeList = new ArrayList>(); for (Map ws : wsList) { boolean isActive = PALRepositoryQueryAPIManager.getInstance().isActiveWorkSpace(ws.get("wsId")); - if (!isActive) { - removeList.add(ws); - } else { + if (!isActive) + removeList.add(ws); + else { JSONObject wsJson = new JSONObject(); wsJson.put("id", ws.get("wsId")); wsJson.put("name", ws.get("wsName")); - if (i == 0) { - wsJson.put("open", true); - } else { - wsJson.put("open", false); - } + if (i == 0) + wsJson.put("open", true); + else + wsJson.put("open", false); wsJson.put("ws", true); wsJson.put("wsName", ws.get("wsName")); wsTree.add(wsJson); @@ -1034,16 +977,13 @@ public class ProcessPublishWeb extends ActionWeb { List repositoryModelList = dao.getRepositoryListByPublishRole(roleId, wsList.get(0).get("wsId")); repositoryList = getRepositoryTree(repositoryModelList, wsList.get(0).get("wsId"), true, false, null, false); - } else { - return AlertWindow.getWarningMessagePage("没有可访问的资产库文件", "资产库被停用,请联系系统管理员"); - } - } else { - return AlertWindow.getWarningMessagePage("没有可访问的资产库文件", "可访问流程未发布,请联系系统管理员"); - } + } else + return AlertWindow.getWarningMessagePage("没有可访问的资产库文件", "资产库被停用,请联系系统管理员"); + } else + return AlertWindow.getWarningMessagePage("没有可访问的资产库文件", "可访问流程未发布,请联系系统管理员"); - if (repositoryList != null && repositoryList.size() > 0) { - wsTree.addAll(repositoryList); - } + if (repositoryList != null && repositoryList.size() > 0) + wsTree.addAll(repositoryList); boolean isComment = PublisherConf.isComment(); // 允许留言 boolean isViewHistory = PublisherConf.isViewHistory(); // 允许查看历史发布记录 @@ -1051,18 +991,14 @@ public class ProcessPublishWeb extends ActionWeb { boolean isPrint = PublisherConf.isPrint(); // 允许打印 String fotter = PublisherConf.getFotter(); // 页底信息 JSONObject dockDisplay = new JSONObject(); - if (!isComment) { - dockDisplay.put("messageView", "display: none;"); - } - if (!isViewHistory) { - dockDisplay.put("publishView", "display: none;"); - } - if (!isViewAttribute) { - dockDisplay.put("attributeView", "display: none;"); - } - if (!isPrint) { - dockDisplay.put("printView", "display: none;"); - } + if (!isComment) + dockDisplay.put("messageView", "display: none;"); + if (!isViewHistory) + dockDisplay.put("publishView", "display: none;"); + if (!isViewAttribute) + dockDisplay.put("attributeView", "display: none;"); + if (!isPrint) + dockDisplay.put("printView", "display: none;"); Map macroLibraries = new HashMap(); macroLibraries.put("sid", this.getContext().getSessionId()); @@ -1108,31 +1044,25 @@ public class ProcessPublishWeb extends ActionWeb { List methodList = PALMethodCache.getPALMethodList(true); for (String method : methodList) { //过滤控制/组织/数据/it数据 - if(method.equals("control") || method.equals("org") || method.equals("data") || method.equals("itsystem")){ - continue; - } + if(method.equals("control") || method.equals("org") || method.equals("data") || method.equals("itsystem")) + continue; JSONArray array = getPublishRepositoryJSONArray(repositoryList, method, wsId, profitionIcon, checkbox, checkboxIds); if (array.size() > 0) { JSONObject object = new JSONObject(); - if (flag) { - object.put("id", method); - } else { - object.put("id", method + "_" + wsId); - } + if (flag) + object.put("id", method); + else + object.put("id", method + "_" + wsId); object.put("name", I18nRes.findValue(CoEConstant.APP_ID, method)); - if (multiWs) { - object.put("pid", wsId); - } + if (multiWs) + object.put("pid", wsId); object.put("open", false); - if (profitionIcon) { - object.put("icon", "../apps/" + CoEConstant.APP_ID + "/img/method/" + method + ".png"); - } else { - if (PublisherConf.PUBLISH_PORTAL_VERSION.equals("v1")) { - object.put("icon", PublisherConf.PORTAL_TREE_ICON_FOLDER); - } else { - object.put("icon", PublisherConf.PORTAL_TREE_ICON_FOLDER1); - } - } + if (profitionIcon) + object.put("icon", "../apps/" + CoEConstant.APP_ID + "/img/method/" + method + ".png"); + else if (PublisherConf.PUBLISH_PORTAL_VERSION.equals("v1")) + object.put("icon", PublisherConf.PORTAL_TREE_ICON_FOLDER); + else + object.put("icon", PublisherConf.PORTAL_TREE_ICON_FOLDER1); object.put("nocheck", true); jsonArray.add(object); jsonArray.addAll(array); @@ -1162,31 +1092,25 @@ public class ProcessPublishWeb extends ActionWeb { List methodList = PALMethodCache.getPALMethodList(true); for (String method : methodList) { //过滤流程制度/组织/数据/it数据 - if(method.equals("process") || method.equals("org") || method.equals("data") || method.equals("itsystem")){ - continue; - } + if(method.equals("process") || method.equals("org") || method.equals("data") || method.equals("itsystem")) + continue; JSONArray array = getPublishRepositoryJSONArray(repositoryList, method, wsId, profitionIcon, checkbox, checkboxIds); if (array.size() > 0) { JSONObject object = new JSONObject(); - if (flag) { - object.put("id", method); - } else { - object.put("id", method + "_" + wsId); - } + if (flag) + object.put("id", method); + else + object.put("id", method + "_" + wsId); object.put("name", I18nRes.findValue(CoEConstant.APP_ID, method)); - if (multiWs) { - object.put("pid", wsId); - } + if (multiWs) + object.put("pid", wsId); object.put("open", false); - if (profitionIcon) { - object.put("icon", "../apps/" + CoEConstant.APP_ID + "/img/method/" + method + ".png"); - } else { - if (PublisherConf.PUBLISH_PORTAL_VERSION.equals("v1")) { - object.put("icon", PublisherConf.PORTAL_TREE_ICON_FOLDER); - } else { - object.put("icon", PublisherConf.PORTAL_TREE_ICON_FOLDER1); - } - } + if (profitionIcon) + object.put("icon", "../apps/" + CoEConstant.APP_ID + "/img/method/" + method + ".png"); + else if (PublisherConf.PUBLISH_PORTAL_VERSION.equals("v1")) + object.put("icon", PublisherConf.PORTAL_TREE_ICON_FOLDER); + else + object.put("icon", PublisherConf.PORTAL_TREE_ICON_FOLDER1); object.put("nocheck", true); jsonArray.add(object); jsonArray.addAll(array); @@ -1218,8 +1142,8 @@ public class ProcessPublishWeb extends ActionWeb { List list = dao.getRepositoryListByResourceId(repositoryId, wsId); JSONArray jsonArray = new JSONArray(); - if (list != null && list.size() > 0) { - for (PublishListHistoryModel publishModel : list) { + if (list != null && list.size() > 0) + for (PublishListHistoryModel publishModel : list) { JSONObject object = new JSONObject(); Timestamp publishDate = publishModel.getPublishDate(); DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); @@ -1228,7 +1152,6 @@ public class ProcessPublishWeb extends ActionWeb { object.put("publishDesc", publishModel.getPublishDesc()); jsonArray.add(object); } - } ResponseObject ro = ResponseObject.newOkResponse(jsonArray.toString()); return ro.toString(); @@ -1250,29 +1173,26 @@ public class ProcessPublishWeb extends ActionWeb { JSONObject object = list.getJSONObject(i); String objectYear = object.getString("year"); if (!year.equals(objectYear)) { - if (!"".equals(year)) { - html.append(" " + "
" + ""); - } + if (!"".equals(year)) + html.append(" " + "" + ""); html.append("
" + "

" + objectYear + "年

" + "
" + "
" + " "); } - if (!"".equals(year)) { - html.append(" " + "
" + ""); - } + if (!"".equals(year)) + html.append(" " + "" + ""); } Map macroLibraries = new HashMap(); @@ -1326,9 +1245,8 @@ public class ProcessPublishWeb extends ActionWeb { model = PALRepositoryCache.getCache().get(ruuid); if (model != null) { if (PublishAPIManager.getInstance().havingReadPALRepositoryPermissionByRoleId(roleId, - model.getId())) { - models.add(model); - } + model.getId())) + models.add(model); ruuid = model.getParentId(); } else { if (ruuid.length() < 36) { @@ -1346,9 +1264,8 @@ public class ProcessPublishWeb extends ActionWeb { PALRepositoryModel plModel = models.get(ii); sb.append(I18nRes.findValue(CoEConstant.APP_ID, plModel.getName())); - if (ii != 0) { - sb.append(">"); - } + if (ii != 0) + sb.append(">"); } html.append( "
" @@ -1356,9 +1273,8 @@ public class ProcessPublishWeb extends ActionWeb { + palModel.getId() + "\" style=\"cursor:pointer; display:inline-block;margin-left:5px;\">" + "
" + sb.toString() + "
" + " " + "
"); - if (i > 15) { - break; - } + if (i > 15) + break; } ResponseObject ro = ResponseObject.newOkResponse(html.toString()); @@ -1384,25 +1300,22 @@ public class ProcessPublishWeb extends ActionWeb { AppAPI appApi = SDK.getAppAPI(); String isIntegrationAWSUser = appApi.getProperty(PublisherConstant.PUBLISH, "isIntegrationAWSUser"); // 是否整合AWS用户 String roleId = ""; - if ("false".equals(isIntegrationAWSUser)) { - roleId = PublishConst.GUESTROLE; - } else { - roleId = _uc.getRoleModel().getId(); - } + if ("false".equals(isIntegrationAWSUser)) + roleId = PublishConst.GUESTROLE; + else + roleId = _uc.getRoleModel().getId(); int startNum = -1; - if (start != null && !"".equals(start)) { - startNum = Integer.parseInt(start); - } + if (start != null && !"".equals(start)) + startNum = Integer.parseInt(start); int sizeNum = 10; - if (size != null && !"".equals(size)) { - sizeNum = Integer.parseInt(size); - } + if (size != null && !"".equals(size)) + sizeNum = Integer.parseInt(size); List modelList = dao.getPublishListHistoryByRole(roleId, startNum, sizeNum, type); JSONArray list = new JSONArray(); - if (modelList != null) { - for (PublishListHistoryModel model : modelList) { + if (modelList != null) + for (PublishListHistoryModel model : modelList) { PALRepositoryModel repositoryModel = PALRepositoryCache.getCache().get(model.getPalRepositoryId()); JSONObject object = new JSONObject(); String actionType = model.getActionType(); @@ -1413,13 +1326,12 @@ public class ProcessPublishWeb extends ActionWeb { DateFormat sdfy = new SimpleDateFormat("yyyy"); object.put("year", sdfy.format(date)); String intro = ""; - if ("N".equals(actionType)) { - intro = "新发布"; - } else if ("C".equals(actionType)) { - intro = "变更"; - } else if ("S".equals(actionType)) { - intro = "停用"; - } + if ("N".equals(actionType)) + intro = "新发布"; + else if ("C".equals(actionType)) + intro = "变更"; + else if ("S".equals(actionType)) + intro = "停用"; object.put("intro", intro + " " + repositoryModel.getName()); String p = repositoryModel.getFilePath(); String image = "../apps/" + CoEConstant.APP_ID + "/img/method/default.png"; @@ -1443,7 +1355,6 @@ public class ProcessPublishWeb extends ActionWeb { object.put("isPublish", repositoryModel.isPublish() ? "1" : "0"); list.add(object); } - } return list; } @@ -1479,16 +1390,14 @@ public class ProcessPublishWeb extends ActionWeb { JSONArray wsTree = new JSONArray(); String isIntegrationAWSUser = appApi.getProperty(PublisherConstant.PUBLISH, "isIntegrationAWSUser"); // 是否整合AWS用户 String roleId = ""; - if ("false".equals(isIntegrationAWSUser)) { - roleId = PublishConst.GUESTROLE; - } else { - roleId = _uc.getRoleModel().getId(); - } + if ("false".equals(isIntegrationAWSUser)) + roleId = PublishConst.GUESTROLE; + else + roleId = _uc.getRoleModel().getId(); PALRepository dao = new PALRepository(); List> allWsList = dao.getWorkSpaceListByPublishRole(roleId, false); - if (allWsList == null || allWsList.size() == 0) { - return AlertWindow.getAuthorityMessagePage("没有可访问的资产库文件", "未分配资产库访问权限,请联系系统管理员"); - } + if (allWsList == null || allWsList.size() == 0) + return AlertWindow.getAuthorityMessagePage("没有可访问的资产库文件", "未分配资产库访问权限,请联系系统管理员"); List> wsList = dao.getWorkSpaceListByPublishRole(roleId, true); // 有访问权限的资产库 JSONArray repositoryList = new JSONArray(); // 有访问权限的文件 if (wsList != null && wsList.size() > 0) { @@ -1496,17 +1405,16 @@ public class ProcessPublishWeb extends ActionWeb { List> removeList = new ArrayList>(); for (Map ws : wsList) { boolean isActive = PALRepositoryQueryAPIManager.getInstance().isActiveWorkSpace(ws.get("wsId")); - if (!isActive) { - removeList.add(ws); - } else { + if (!isActive) + removeList.add(ws); + else { JSONObject wsJson = new JSONObject(); wsJson.put("id", ws.get("wsId")); wsJson.put("name", ws.get("wsName")); - if (i == 0) { - wsJson.put("open", true); - } else { - wsJson.put("open", false); - } + if (i == 0) + wsJson.put("open", true); + else + wsJson.put("open", false); wsJson.put("ws", true); wsJson.put("wsName", ws.get("wsName")); wsTree.add(wsJson); @@ -1519,16 +1427,13 @@ public class ProcessPublishWeb extends ActionWeb { List repositoryModelList = dao.getRepositoryListByPublishRole(roleId, wsList.get(0).get("wsId")); repositoryList = getRepositoryTree(repositoryModelList, wsList.get(0).get("wsId"), true, false, null, false); - } else { - return AlertWindow.getWarningMessagePage("没有可访问的资产库文件", "资产库被停用,请联系系统管理员"); - } - } else { - return AlertWindow.getWarningMessagePage("没有可访问的资产库文件", "可访问流程未发布,请联系系统管理员"); - } + } else + return AlertWindow.getWarningMessagePage("没有可访问的资产库文件", "资产库被停用,请联系系统管理员"); + } else + return AlertWindow.getWarningMessagePage("没有可访问的资产库文件", "可访问流程未发布,请联系系统管理员"); - if (repositoryList != null && repositoryList.size() > 0) { - wsTree.addAll(repositoryList); - } + if (repositoryList != null && repositoryList.size() > 0) + wsTree.addAll(repositoryList); String isComment = appApi.getProperty(PublisherConstant.PUBLISH, "isComment"); // 允许留言 String isViewHistory = appApi.getProperty(PublisherConstant.PUBLISH, "isViewHistory"); // 允许查看历史发布记录 @@ -1536,18 +1441,14 @@ public class ProcessPublishWeb extends ActionWeb { String isPrint = appApi.getProperty(PublisherConstant.PUBLISH, "isPrint"); // 允许打印 String fotter = appApi.getProperty(PublisherConstant.PUBLISH, "fotter"); // 页底信息 JSONObject dockDisplay = new JSONObject(); - if ("false".equals(isComment)) { - dockDisplay.put("messageView", "display: none;"); - } - if ("false".equals(isViewHistory)) { - dockDisplay.put("publishView", "display: none;"); - } - if ("false".equals(isViewAttribute)) { - dockDisplay.put("attributeView", "display: none;"); - } - if ("false".equals(isPrint)) { - dockDisplay.put("printView", "display: none;"); - } + if ("false".equals(isComment)) + dockDisplay.put("messageView", "display: none;"); + if ("false".equals(isViewHistory)) + dockDisplay.put("publishView", "display: none;"); + if ("false".equals(isViewAttribute)) + dockDisplay.put("attributeView", "display: none;"); + if ("false".equals(isPrint)) + dockDisplay.put("printView", "display: none;"); Map macroLibraries = new HashMap(); macroLibraries.put("sid", this.getContext().getSessionId()); @@ -1565,8 +1466,8 @@ public class ProcessPublishWeb extends ActionWeb { BO bo = new BO(); BO publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(processInstId); int i = 0; - if (!ProFile_NId.isEmpty()) { - if (publish != null) { + if (!ProFile_NId.isEmpty()) + if (publish != null) { String bindId = publish.getBindId(); BO N = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").detailByBindId(bindId); if (null == N) { @@ -1589,9 +1490,8 @@ public class ProcessPublishWeb extends ActionWeb { i = SDK.getBOAPI().update("BO_ACT_COE_PUBLISH_N", bo); } } - } - if (!ChangeDFileNameNew.isEmpty()) { - if (publish != null) { + if (!ChangeDFileNameNew.isEmpty()) + if (publish != null) { String bindId = publish.getBindId(); BO C = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").detailByBindId(bindId); if (null == C) { @@ -1619,9 +1519,8 @@ public class ProcessPublishWeb extends ActionWeb { } } - } - if (!ProFile_s.isEmpty()) { - if (publish != null) { + if (!ProFile_s.isEmpty()) + if (publish != null) { String bindId = publish.getBindId(); BO S = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").detailByBindId(bindId); if (null == S) { @@ -1645,7 +1544,6 @@ public class ProcessPublishWeb extends ActionWeb { i = SDK.getBOAPI().update("BO_ACT_COE_PUBLISH_S", bo); } } - } return i + ""; } @@ -1660,10 +1558,8 @@ public class ProcessPublishWeb extends ActionWeb { if (!list.isEmpty()) { for (TaskInstance taskIn : list) { String parentTaskInstId = taskIn.getParentTaskInstId(); - if ("00000000-0000-0000-0000-000000000000".equals(parentTaskInstId)) { - proNumber = true; - - } + if ("00000000-0000-0000-0000-000000000000".equals(parentTaskInstId)) + proNumber = true; } object.put("PRONUMBER", proNumber); } @@ -1714,36 +1610,29 @@ public class ProcessPublishWeb extends ActionWeb { String bindid = null; String taskid = null; List list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").addQuery("BINDID=", processInstId).list(); - if (!list.isEmpty()) { - for (BO bo : list) { + if (!list.isEmpty()) + for (BO bo : list) { bindid = bo.getString("BINDID"); if (type.equals("n")) { List n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").addQuery("BINDID=", bindid).list(); - if (!n.isEmpty()) { - for (BO bn : n) { - taskid = bn.getString("TASKID"); - } - } + if (!n.isEmpty()) + for (BO bn : n) + taskid = bn.getString("TASKID"); } if (type.equals("c")) { List c = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").addQuery("BINDID=", bindid).list(); - if (!c.isEmpty()) { - for (BO bc : c) { - taskid = bc.getString("TASKID"); - } - } + if (!c.isEmpty()) + for (BO bc : c) + taskid = bc.getString("TASKID"); } if (type.equals("s")) { List s = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").addQuery("BINDID=", bindid).list(); - if (!s.isEmpty()) { - for (BO bs : s) { - taskid = bs.getString("TASKID"); - } - } + if (!s.isEmpty()) + for (BO bs : s) + taskid = bs.getString("TASKID"); } } - } String url = ""; url = PALRepositoryQueryAPIManager.getInstance().outputReportPreview(me, taskid); return url; @@ -1755,13 +1644,12 @@ public class ProcessPublishWeb extends ActionWeb { List list = new ArrayList(); List modelList = null; - if ("N".equals(queryType)) { - modelList = publisherClientDao.getCoeProcessLevelByNamen(autoContent, wsId, null); - } else if ("C".equals(queryType)) { - modelList = publisherClientDao.getCoeProcessLevelByNamec(autoContent, wsId, null); - } else if ("S".equals(queryType)) { - modelList = publisherClientDao.getCoeProcessLevelByNameAndCategorys(autoContent, wsId, null); - } + if ("N".equals(queryType)) + modelList = publisherClientDao.getCoeProcessLevelByNamen(autoContent, wsId, null); + else if ("C".equals(queryType)) + modelList = publisherClientDao.getCoeProcessLevelByNamec(autoContent, wsId, null); + else if ("S".equals(queryType)) + modelList = publisherClientDao.getCoeProcessLevelByNameAndCategorys(autoContent, wsId, null); for (int i = 0, size = modelList.size(); i < size; i++) { PALRepositoryModel coeProcessLevelModel = modelList.get(i); CoeProcessLevelAutoBean bean = new CoeProcessLevelAutoBean(); @@ -1783,9 +1671,8 @@ public class ProcessPublishWeb extends ActionWeb { cplm.setId(ruuid); cplm.setName(ruuid); models.add(cplm); - } else { - isError = true; - } + } else + isError = true; break; } } @@ -1797,9 +1684,8 @@ public class ProcessPublishWeb extends ActionWeb { PALRepositoryModel plModel = models.get(ii); sb.append(I18nRes.findValue(CoEConstant.APP_ID, plModel.getName())); - if (ii != 0) { - sb.append(">"); - } + if (ii != 0) + sb.append(">"); } bean.setUi( "
" + sb.toString() + "
"); @@ -1807,9 +1693,8 @@ public class ProcessPublishWeb extends ActionWeb { bean.setName(coeProcessLevelModel.getName()); bean.setType(coeProcessLevelModel.getMethodId()); list.add(bean); - if (list.size() > 15) { - break; - } + if (list.size() > 15) + break; } return JSON.toJSONString(list); } @@ -1830,13 +1715,10 @@ public class ProcessPublishWeb extends ActionWeb { boolean proNumber = false; List list = SDK.getTaskQueryAPI().processInstId(processInstId).list(); - if (!list.isEmpty()) { - for (TaskInstance taskIn : list) { - if ("obj_87371cad5d54457e8c325c805028a56f".equals(taskIn.getActivityDefId())) { - proNumber = true; - } - } - } + if (!list.isEmpty()) + for (TaskInstance taskIn : list) + if ("obj_87371cad5d54457e8c325c805028a56f".equals(taskIn.getActivityDefId())) + proNumber = true; ro.put("proNumber", proNumber); BO publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(processInstId); if (publish != null) { @@ -1862,11 +1744,9 @@ public class ProcessPublishWeb extends ActionWeb { List shapeIds = new ArrayList<>(); List> shapeList = CoeDesignerUtil.getShapeMessageJson2(publishId);// 获取所有节点 - if (shapeList != null && shapeList.size() > 0) { - for (Map map : shapeList) { + if (shapeList != null && shapeList.size() > 0) + for (Map map : shapeList) shapeIds.add((String) map.get("id")); - } - } /******************** 附件 ************************/ // 文件或节点自身附件 JSONArray js = new JSONArray(); @@ -1874,8 +1754,8 @@ public class ProcessPublishWeb extends ActionWeb { StringBuilder sqlWhere = new StringBuilder(); sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'"); List fileList = upFileDao.search(sqlWhere.toString()); - if (fileList != null && fileList.size() > 0) { - for (UpfileModel upfileModel : fileList) { + if (fileList != null && fileList.size() > 0) + for (UpfileModel upfileModel : fileList) if ("f".equals(upfileModel.getType())) { JSONObject jb = new JSONObject(); String upfileId = upfileModel.getUuid(); @@ -1886,16 +1766,13 @@ public class ProcessPublishWeb extends ActionWeb { ResponseObject ros = getUrl(jb, id, upFileName); JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData())); String url = parseObject.get("url").toString(); - if(url.contains(".xls")) { + if(url.contains(".xls")) openUrl= url; - }else { + else openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", ""); - } jb.put("openUrl",openUrl); js.add(jb.toJSONString()); } - } - } newObj.put("upfileId", js); } else { @@ -1921,23 +1798,21 @@ public class ProcessPublishWeb extends ActionWeb { changeObj.put("methodId", model.getMethodId()); changeObj.put("category", model.getMethodCategory()); List list2 = PALRepositoryCache.getByVersionId(wsId, model.getVersionId()); - if (list2 != null && list2.size() > 0) { - Collections.sort(list2, new Comparator() { + if (list2 != null && list2.size() > 0) + Collections.sort(list2, new Comparator() { @Override public int compare(PALRepositoryModel o1, PALRepositoryModel o2) { return VersionUtil.compareVersionNo(o1.getVersion(), o2.getVersion(), true); //升序 } }); - } - for (PALRepositoryModel model2 : list2) { - if (!model2.getId().equals(changeObj.getString("changeFileId")) && !model2.isPublish()) { + for (PALRepositoryModel model2 : list2) + if (!model2.getId().equals(changeObj.getString("changeFileId")) && !model2.isPublish()) { JSONObject object = new JSONObject(); object.put("text", model2.getName()); object.put("id", model2.getId()); object.put("version", VersionUtil.getVersionStr(model2.getVersion())); array.add(object); } - } // List> shapeMessageJson4 = @@ -1946,11 +1821,9 @@ public class ProcessPublishWeb extends ActionWeb { List shapeIds = new ArrayList<>(); List> shapeList = CoeDesignerUtil.getShapeMessageJson2(changeId);// 获取所有节点 - if (shapeList != null && shapeList.size() > 0) { - for (Map map : shapeList) { + if (shapeList != null && shapeList.size() > 0) + for (Map map : shapeList) shapeIds.add((String) map.get("id")); - } - } /******************** 附件 ************************/ // 文件或节点自身附件 JSONArray js = new JSONArray(); @@ -1958,8 +1831,8 @@ public class ProcessPublishWeb extends ActionWeb { StringBuilder sqlWhere = new StringBuilder(); sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'"); List fileList = upFileDao.search(sqlWhere.toString()); - if (fileList != null && fileList.size() > 0) { - for (UpfileModel upfileModel : fileList) { + if (fileList != null && fileList.size() > 0) + for (UpfileModel upfileModel : fileList) if ("f".equals(upfileModel.getType())) { JSONObject jb = new JSONObject(); String upfileId = upfileModel.getUuid(); @@ -1970,16 +1843,13 @@ public class ProcessPublishWeb extends ActionWeb { ResponseObject ros = getUrl(jb, model.getId(), upFileName); JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData())); String url = parseObject.get("url").toString(); - if(url.contains(".xls")) { + if(url.contains(".xls")) openUrl= url; - }else { + else openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", ""); - } jb.put("openUrl",openUrl); js.add(jb.toJSONString()); } - } - } changeObj.put("upfileId", js); } else { changeObj.put("fileVersion", "1.0"); @@ -2050,22 +1920,19 @@ public class ProcessPublishWeb extends ActionWeb { ro.put("checkbox", checkbox); ro.put("checkInherit", checkInherit); JSONArray array; - if ("new".equals(type)) {// new - array = getNotPublishedRepositoryTreeData(wsId, teamId, flag, pid); - } else if ("change".equals(type)) {// change - array = getPublishedRepositoryTreeData2(wsId, teamId); - } else {// stop - array = getPublishedRepositoryTreeData(wsId, teamId); - } - if (array == null || array.isEmpty()) { - array = new JSONArray(); - } + if ("new".equals(type)) + array = getNotPublishedRepositoryTreeData(wsId, teamId, flag, pid); + else if ("change".equals(type)) + array = getPublishedRepositoryTreeData2(wsId, teamId); + else + array = getPublishedRepositoryTreeData(wsId, teamId); + if (array == null || array.isEmpty()) + array = new JSONArray(); ro.put("data", array); - if (flag) { - return ro.toString(); - } else { - return array.toString(); - } + if (flag) + return ro.toString(); + else + return array.toString(); } @@ -2098,48 +1965,22 @@ public class ProcessPublishWeb extends ActionWeb { ro.put("checkbox", checkbox); ro.put("checkInherit", checkInherit); JSONArray array; - if ("new".equals(type)) {// new - array = getNotMaPublishedRepositoryTreeData(wsId, teamId, flag, pid); - } else if ("change".equals(type)) {// change - array = getMaPublishedRepositoryTreeData2(wsId, teamId); - } else {// stop - array = getMaPublishedRepositoryTreeData(wsId, teamId); - } - if (array == null || array.isEmpty()) { - array = new JSONArray(); - } + if ("new".equals(type)) + array = getNotMaPublishedRepositoryTreeData(wsId, teamId, flag, pid); + else if ("change".equals(type)) + array = getMaPublishedRepositoryTreeData2(wsId, teamId); + else + array = getMaPublishedRepositoryTreeData(wsId, teamId); + if (array == null || array.isEmpty()) + array = new JSONArray(); ro.put("data", array); - if (flag) { - return ro.toString(); - } else { - return array.toString(); - } + if (flag) + return ro.toString(); + else + return array.toString(); } - /** - * 根据当前许可环境获取当前wsid - * @return - */ - public String queryMaPublishGetWsId(){ - ResponseObject ro = ResponseObject.newOkResponse(); - String wsId = null; - boolean dev = Quota.isDEV(); - if(dev==true){ - wsId="0285ff6a-e418-4d8b-a5b1-22240296f769"; - } - boolean prd=Quota.isPRD(); - if(prd==true){ - wsId="7d3ca852-a0bd-42e6-80b1-3dcea6f55083"; - } - boolean qas=Quota.isQAS(); - if(qas==true){ - wsId="7d3ca852-a0bd-42e6-80b1-3dcea6f55083"; - } - ro.put("wsId", wsId); - return ro.toString(); - } - /** * 快速查询定位树节点 * @@ -2151,28 +1992,23 @@ public class ProcessPublishWeb extends ActionWeb { if (UtilString.isNotEmpty(teamId)) { // 小组Id不为空,则需要查询小组授权后的流程库 CoeCooperationTeamModel team = CoeCooperationAPIManager.getInstance().queryCooperationTeamById(teamId, true); - if (team != null) { - wsId = team.getWsId(); - } + if (team != null) + wsId = team.getWsId(); } List usedList = Lists.newArrayList(); List methodList = PALMethodManager.getInstance().list(); - for (String method : methodList) { - PALRepositoryQueryAPIManager.getInstance().getAllUsedPalRepositoryModelsByPid(wsId, method, usedList); - } + for (String method : methodList) + PALRepositoryQueryAPIManager.getInstance().getAllUsedPalRepositoryModelsByPid(wsId, method, usedList); List removeUsedList = new ArrayList(); List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); - if (UtilString.isNotEmpty(teamId)) { - if (usedList != null) { - for (PALRepositoryModel model : usedList) { - if (!versionIds.contains(model.getVersionId())) { - removeUsedList.add(model); - } - } + if (UtilString.isNotEmpty(teamId)) + if (usedList != null) { + for (PALRepositoryModel model : usedList) + if (!versionIds.contains(model.getVersionId())) + removeUsedList.add(model); usedList.removeAll(removeUsedList);// 筛选具有权限的所有使用中的流程 } - } JSONArray treeData = RepositoryTreeUtil.list2tree(usedList, wsId, true, true, "-"); return treeData.toString(); } @@ -2189,9 +2025,8 @@ public class ProcessPublishWeb extends ActionWeb { if (UtilString.isNotEmpty(teamId)) { // 小组Id不为空,则需要查询小组授权后的流程库 CoeCooperationTeamModel team = CoeCooperationAPIManager.getInstance().queryCooperationTeamById(teamId, true); - if (team != null) { - wsId = team.getWsId(); - } + if (team != null) + wsId = team.getWsId(); } if (flag) {// 根节点 @@ -2199,9 +2034,8 @@ public class ProcessPublishWeb extends ActionWeb { List methodList = PALMethodCache.getPalMehtodList(teamId, _uc.getUID(), true); for (String method : methodList) { //新建发布过滤掉控制/组织/数据/it类数据 - if(method.equals("control") || method.equals("org") || method.equals("data") || method.equals("itsystem")){ - continue; - } + if(method.equals("control") || method.equals("org") || method.equals("data") || method.equals("itsystem")) + continue; JSONObject object = new JSONObject(); object.put("id", method); object.put("name", I18nRes.findValue(CoEConstant.APP_ID, method)); @@ -2217,15 +2051,13 @@ public class ProcessPublishWeb extends ActionWeb { for (PALRepositoryModel model : subModels) { List verList = PALRepositoryCache.getByVersionId(model.getVersionId()); boolean checkbox = true; - for (PALRepositoryModel verModel : verList) { - if (verModel.isPublish()) { + for (PALRepositoryModel verModel : verList) + if (verModel.isPublish()) { checkbox = false; continue; } - } - if (checkbox) { - checkboxIds.append(model.getId()).append(","); - } + if (checkbox) + checkboxIds.append(model.getId()).append(","); } JSONArray array = RepositoryTreeUtil.list2tree(subModels, wsId, true, true, checkboxIds.toString()); for (int i = 0; i < array.size(); i++) { @@ -2255,9 +2087,8 @@ public class ProcessPublishWeb extends ActionWeb { if (UtilString.isNotEmpty(teamId)) { // 小组Id不为空,则需要查询小组授权后的流程库 CoeCooperationTeamModel team = CoeCooperationAPIManager.getInstance().queryCooperationTeamById(teamId, true); - if (team != null) { - wsId = team.getWsId(); - } + if (team != null) + wsId = team.getWsId(); } if (flag) {// 根节点 @@ -2265,9 +2096,8 @@ public class ProcessPublishWeb extends ActionWeb { List methodList = PALMethodCache.getPalMehtodList(teamId, _uc.getUID(), true); for (String method : methodList) { //新建发布过滤掉控制/组织/数据/it类数据 - if(method.equals("process") || method.equals("org") || method.equals("data") || method.equals("itsystem")){ - continue; - } + if(method.equals("process") || method.equals("org") || method.equals("data") || method.equals("itsystem")) + continue; JSONObject object = new JSONObject(); object.put("id", method); object.put("name", I18nRes.findValue(CoEConstant.APP_ID, method)); @@ -2281,28 +2111,23 @@ public class ProcessPublishWeb extends ActionWeb { List subModels = PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryModelsByPidNew(_uc, wsId, teamId, pid); StringBuilder checkboxIds = new StringBuilder(); for (PALRepositoryModel model : subModels) { - if(model.getName().equals("末级流程绩效")){ - continue; - } + if(model.getName().equals("末级流程绩效")) + continue; List verList = PALRepositoryCache.getByVersionId(model.getVersionId()); boolean checkbox = true; - for (PALRepositoryModel verModel : verList) { - if (verModel.isPublish()) { + for (PALRepositoryModel verModel : verList) + if (verModel.isPublish()) { checkbox = false; continue; } - } - if (checkbox) { - checkboxIds.append(model.getId()).append(","); - } + if (checkbox) + checkboxIds.append(model.getId()).append(","); } //过滤掉末级绩效数据 - if(subModels.size()>1){ - for(int i=0;i1) + for(int i=0;i list = dao.getPublishedRepositoryList(wsId); // List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); Set versionIds = CooperationCache.getUserDataVisitablePermission(teamId, _uc.getUID(), false); - if (UtilString.isNotEmpty(teamId)) { - if (list != null) { + if (UtilString.isNotEmpty(teamId)) + if (list != null) { List removeList = new ArrayList(); - for (PALRepositoryModel model : list) { - if (!versionIds.contains(model.getVersionId())) { - removeList.add(model); - } - } + for (PALRepositoryModel model : list) + if (!versionIds.contains(model.getVersionId())) + removeList.add(model); list.removeAll(removeList); } - } JSONArray treeData = getRepositoryTree(list, wsId, false, true, "-", false); return treeData; } @@ -2371,24 +2192,20 @@ public class ProcessPublishWeb extends ActionWeb { if (UtilString.isNotEmpty(teamId)) { // 小组Id不为空,则需要查询小组授权后的流程库 CoeCooperationTeamModel team = CoeCooperationAPIManager.getInstance().queryCooperationTeamById(teamId, true); - if (team != null) { - wsId = team.getWsId(); - } + if (team != null) + wsId = team.getWsId(); } List list = dao.getPublishedRepositoryList(wsId); // List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); Set versionIds = CooperationCache.getUserDataVisitablePermission(teamId, _uc.getUID(), false); - if (UtilString.isNotEmpty(teamId)) { - if (list != null) { + if (UtilString.isNotEmpty(teamId)) + if (list != null) { List removeList = new ArrayList(); - for (PALRepositoryModel model : list) { - if (!versionIds.contains(model.getVersionId())) { - removeList.add(model); - } - } + for (PALRepositoryModel model : list) + if (!versionIds.contains(model.getVersionId())) + removeList.add(model); list.removeAll(removeList); } - } JSONArray treeData = getMaRepositoryTree(list, wsId, false, true, "-", false); return treeData; } @@ -2405,31 +2222,26 @@ public class ProcessPublishWeb extends ActionWeb { if (UtilString.isNotEmpty(teamId)) { // 小组Id不为空,则需要查询小组授权后的流程库 CoeCooperationTeamModel team = CoeCooperationAPIManager.getInstance().queryCooperationTeamById(teamId, true); - if (team != null) { - wsId = team.getWsId(); - } + if (team != null) + wsId = team.getWsId(); } List list = dao.getPublishedRepositoryList(wsId); // List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); Set versionIds = CooperationCache.getUserDataVisitablePermission(teamId, _uc.getUID(), false); - if (UtilString.isNotEmpty(teamId)) { - if (list != null) { + if (UtilString.isNotEmpty(teamId)) + if (list != null) { List removeList = new ArrayList(); - for (PALRepositoryModel model : list) { - if (!versionIds.contains(model.getVersionId())) { - removeList.add(model); - } - } + for (PALRepositoryModel model : list) + if (!versionIds.contains(model.getVersionId())) + removeList.add(model); list.removeAll(removeList); } - } // 只获取有未发布版本的已发布流程文件 List list2 = new ArrayList<>(); for (PALRepositoryModel model : list) { List temp = PALRepositoryCache.getByVersionId(model.getWsId(), model.getVersionId()); - if (temp != null && temp.size() > 1) { - list2.add(model); - } + if (temp != null && temp.size() > 1) + list2.add(model); } JSONArray treeData = getRepositoryTree(list2, wsId, false, true, "-", false); return treeData; @@ -2449,31 +2261,26 @@ public class ProcessPublishWeb extends ActionWeb { if (UtilString.isNotEmpty(teamId)) { // 小组Id不为空,则需要查询小组授权后的流程库 CoeCooperationTeamModel team = CoeCooperationAPIManager.getInstance().queryCooperationTeamById(teamId, true); - if (team != null) { - wsId = team.getWsId(); - } + if (team != null) + wsId = team.getWsId(); } List list = dao.getPublishedRepositoryList(wsId); // List versionIds = CoeCooperationAPIManager.getInstance().queryCooperationRoleDataPermByTeamUser(teamId, _uc.getUID()); Set versionIds = CooperationCache.getUserDataVisitablePermission(teamId, _uc.getUID(), false); - if (UtilString.isNotEmpty(teamId)) { - if (list != null) { + if (UtilString.isNotEmpty(teamId)) + if (list != null) { List removeList = new ArrayList(); - for (PALRepositoryModel model : list) { - if (!versionIds.contains(model.getVersionId())) { - removeList.add(model); - } - } + for (PALRepositoryModel model : list) + if (!versionIds.contains(model.getVersionId())) + removeList.add(model); list.removeAll(removeList); } - } // 只获取有未发布版本的已发布流程文件 List list2 = new ArrayList<>(); for (PALRepositoryModel model : list) { List temp = PALRepositoryCache.getByVersionId(model.getWsId(), model.getVersionId()); - if (temp != null && temp.size() > 1) { - list2.add(model); - } + if (temp != null && temp.size() > 1) + list2.add(model); } JSONArray treeData = getMaRepositoryTree(list2, wsId, false, true, "-", false); return treeData; @@ -2490,50 +2297,42 @@ public class ProcessPublishWeb extends ActionWeb { */ public String createOutputPrReport(String uuid, String wsId, String teamId) { // 校验流程手册是否安装并启动 - if (!SDK.getAppAPI().isActive("com.actionsoft.apps.coe.pal.output.pr")) { - return ResponseObject.newErrResponse("流程手册未安装或已暂停").toString(); - } - if (!SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.bd")) { - return ResponseObject.newErrResponse("表单手册未安装或已暂停").toString(); - } - if (!SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.zd")) { - return ResponseObject.newErrResponse("制度手册未安装或已暂停").toString(); - } + if (!SDK.getAppAPI().isActive("com.actionsoft.apps.coe.pal.output.pr")) + return ResponseObject.newErrResponse("流程手册未安装或已暂停").toString(); + if (!SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.bd")) + return ResponseObject.newErrResponse("表单手册未安装或已暂停").toString(); + if (!SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.zd")) + return ResponseObject.newErrResponse("制度手册未安装或已暂停").toString(); ResponseObject ro = ResponseObject.newOkResponse(); // 校验 PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); - if (model == null) { - throw new AWSException("没有找到文件:" + uuid); - } + if (model == null) + throw new AWSException("没有找到文件:" + uuid); String taskId = ""; if (("control.policy".equals(model.getMethodId()) || "data.form".equals(model.getMethodId()) || model.getMethodId().contains("process.")) && !"default".equals(model.getMethodId())) { - } else { - throw new AWSException("文件不支持创建流程手册:" + uuid); - } + } else + throw new AWSException("文件不支持创建流程手册:" + uuid); if (model.getMethodId().contains("process.")) { taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, _uc.getUID(), teamId, uuid); JSONObject object = JSONObject.parseObject(taskId); - if ("ok".equals(object.getString("result"))) { - taskId = object.getJSONObject("data").getString("taskId"); - } else { - throw new AWSException("创建流程手册失败:" + uuid); - } + if ("ok".equals(object.getString("result"))) + taskId = object.getJSONObject("data").getString("taskId"); + else + throw new AWSException("创建流程手册失败:" + uuid); } else if ("data.form".equals(model.getMethodId())) { taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, _uc.getUID(), teamId, uuid); JSONObject object = JSONObject.parseObject(taskId); - if ("ok".equals(object.getString("result"))) { - taskId = object.getJSONObject("data").getString("taskId"); - } else { - throw new AWSException("创建流程手册失败:" + uuid); - } + if ("ok".equals(object.getString("result"))) + taskId = object.getJSONObject("data").getString("taskId"); + else + throw new AWSException("创建流程手册失败:" + uuid); } else if ("control.policy".equals(model.getMethodId())) { taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, _uc.getUID(), teamId, uuid); JSONObject object = JSONObject.parseObject(taskId); - if ("ok".equals(object.getString("result"))) { - taskId = object.getJSONObject("data").getString("taskId"); - } else { - throw new AWSException("创建流程手册失败:" + uuid); - } + if ("ok".equals(object.getString("result"))) + taskId = object.getJSONObject("data").getString("taskId"); + else + throw new AWSException("创建流程手册失败:" + uuid); } ro.put("taskId", taskId); return ro.toString(); @@ -2551,14 +2350,13 @@ public class ProcessPublishWeb extends ActionWeb { ResponseObject ro = ResponseObject.newOkResponse(); // 校验 PALRepositoryModel m = PALRepositoryCache.getCache().get(uuid); - if (m == null) { - throw new AWSException("没有找到文件:" + uuid); - } + if (m == null) + throw new AWSException("没有找到文件:" + uuid); JSONArray array = new JSONArray(); PALRepository dao = new PALRepository(); List list = dao.getPublishedRepositoryVersionListByRid(uuid); - if (list != null) { - for (PALRepositoryModel model : list) { + if (list != null) + for (PALRepositoryModel model : list) { JSONObject object = new JSONObject(); object.put("id", model.getId()); object.put("text", model.getName()); @@ -2566,7 +2364,6 @@ public class ProcessPublishWeb extends ActionWeb { // object.put("version", model.getVersion()); array.add(object); } - } ro.put("data", array); return ro.toString(); } @@ -2583,9 +2380,8 @@ public class ProcessPublishWeb extends ActionWeb { ResponseObject ro = ResponseObject.newOkResponse(); PublishListHistory pHistory = new PublishListHistory(); String taskId = pHistory.getLastPublishTaskIdByModelId(uuid); - if (taskId == null) { - taskId = ""; - } + if (taskId == null) + taskId = ""; ro.put("taskId", taskId); return ro.toString(); } @@ -2631,9 +2427,8 @@ public class ProcessPublishWeb extends ActionWeb { } BO publishBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(processInstId); - if (publishBo == null) { - throw new AWSException("无法找到流程实例 processInstId:" + processInstId); - } + if (publishBo == null) + throw new AWSException("无法找到流程实例 processInstId:" + processInstId); String bindId = publishBo.getBindId(); // 变更主BO表状态 SDK.getBOAPI().updateByBindId("BO_ACT_COE_PUBLISH", bindId, "SAVESTATUS", 2); @@ -2642,9 +2437,8 @@ public class ProcessPublishWeb extends ActionWeb { String boName = "BO_ACT_COE_PUBLISH_N"; BO bo = SDK.getBOAPI().query(boName).detailByBindId(bindId); if (UtilString.isEmpty(publishNewFileId)) { - if (bo != null) { - SDK.getBOAPI().remove(boName, bo.getId());// 清空 - } + if (bo != null) + SDK.getBOAPI().remove(boName, bo.getId());// 清空 } else { BO newBo = new BO(); PALRepositoryModel model = PALRepositoryCache.getCache().get(publishNewFileId); @@ -2674,9 +2468,8 @@ public class ProcessPublishWeb extends ActionWeb { String boName = "BO_ACT_COE_PUBLISH_C"; BO bo = SDK.getBOAPI().query(boName).detailByBindId(bindId); if (UtilString.isEmpty(publishChangetargetId)) { - if (bo != null) { - SDK.getBOAPI().remove(boName, bo.getId());// 清空 - } + if (bo != null) + SDK.getBOAPI().remove(boName, bo.getId());// 清空 } else { BO changeBo = new BO(); PALRepositoryModel model = PALRepositoryCache.getCache().get(publishChangeFileId); @@ -2711,9 +2504,8 @@ public class ProcessPublishWeb extends ActionWeb { String boName = "BO_ACT_COE_PUBLISH_S"; BO bo = SDK.getBOAPI().query(boName).detailByBindId(bindId); if (UtilString.isEmpty(publishStopFileId)) { - if (bo != null) { - SDK.getBOAPI().remove(boName, bo.getId());// 清空 - } + if (bo != null) + SDK.getBOAPI().remove(boName, bo.getId());// 清空 } else { BO stopBo = new BO(); PALRepositoryModel model = PALRepositoryCache.getCache().get(publishStopFileId); @@ -2748,27 +2540,22 @@ public class ProcessPublishWeb extends ActionWeb { */ private void validPublisData(String publishNewFileId, String publishChangeFileId, String publishStopFileId, String processInstId, String wsId, JSONObject obj) { Set set = new HashSet<>(); - if (!UtilString.isEmpty(publishNewFileId)) { - set.add(publishNewFileId); - } - if (!UtilString.isEmpty(publishChangeFileId)) { - set.add(publishChangeFileId); - } - if (!UtilString.isEmpty(publishStopFileId)) { - set.add(publishStopFileId); - } - if (set.isEmpty()) { - return; - } + if (!UtilString.isEmpty(publishNewFileId)) + set.add(publishNewFileId); + if (!UtilString.isEmpty(publishChangeFileId)) + set.add(publishChangeFileId); + if (!UtilString.isEmpty(publishStopFileId)) + set.add(publishStopFileId); + if (set.isEmpty()) + return; List list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").addQuery("ISEND =", 0).list(); if (list != null && list.size() > 0) { String type = null; PALRepositoryModel m = null; end: for (BO bo : list) { - if (bo.getBindId().equals(processInstId)) { - continue; - } + if (bo.getBindId().equals(processInstId)) + continue; // 获取三个子表 {// 发布表 BO newBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").detailByBindId(bo.getBindId()); @@ -2776,14 +2563,13 @@ public class ProcessPublishWeb extends ActionWeb { PALRepositoryModel temp1 = PALRepositoryCache.getCache().get(newBo.getString("PUBLISHFILEID")); if (temp1 != null) { List list1 = PALRepositoryCache.getByVersionId(wsId, temp1.getVersionId()); - for (PALRepositoryModel model : list1) { - if (set.contains(model.getId())) { + for (PALRepositoryModel model : list1) + if (set.contains(model.getId())) { // 存在未办理完成的表单 type = "new"; m = model; break end; } - } } } } @@ -2793,14 +2579,13 @@ public class ProcessPublishWeb extends ActionWeb { PALRepositoryModel temp2 = PALRepositoryCache.getCache().get(changeBo.getString("CHANGEFILEID")); if (temp2 != null) { List list1 = PALRepositoryCache.getByVersionId(wsId, temp2.getVersionId()); - for (PALRepositoryModel model : list1) { - if (set.contains(model.getId())) { + for (PALRepositoryModel model : list1) + if (set.contains(model.getId())) { // 存在未办理完成的表单 type = "change"; m = model; break end; } - } } } } @@ -2810,14 +2595,13 @@ public class ProcessPublishWeb extends ActionWeb { PALRepositoryModel temp3 = PALRepositoryCache.getCache().get(stopBo.getString("STOPFILEID")); if (temp3 != null) { List list1 = PALRepositoryCache.getByVersionId(wsId, temp3.getVersionId()); - for (PALRepositoryModel model : list1) { - if (set.contains(model.getId())) { + for (PALRepositoryModel model : list1) + if (set.contains(model.getId())) { // 存在未办理完成的表单 type = "stop"; m = model; break end; } - } } } } @@ -2838,9 +2622,8 @@ public class ProcessPublishWeb extends ActionWeb { * @param uuid */ private void validModelExist(String uuid) { - if (!UtilString.isEmpty(uuid) && PALRepositoryCache.getCache().get(uuid) == null) { - throw new AWSException("文件不存在,请联系管理员 uuid:" + uuid); - } + if (!UtilString.isEmpty(uuid) && PALRepositoryCache.getCache().get(uuid) == null) + throw new AWSException("文件不存在,请联系管理员 uuid:" + uuid); } @@ -2907,7 +2690,7 @@ public class ProcessPublishWeb extends ActionWeb { JSONArray stopArr = new JSONArray(); boolean proNumber = false; List list = SDK.getTaskQueryAPI().processInstId(processInstId).list(); - if (!list.isEmpty()) { + if (!list.isEmpty()) for (TaskInstance taskIn : list) { // 根据节点表单应用-操作权限-主子表是否可修改控制是否只读 UserTaskModel userTaskModel = UserTaskDefUtil.getModel(taskIn.getProcessDefId(), @@ -2918,7 +2701,6 @@ public class ProcessPublishWeb extends ActionWeb { // proNumber = true; // } } - } ro.put("proNumber", proNumber); BO publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(processInstId); if (publish != null) { @@ -2926,7 +2708,7 @@ public class ProcessPublishWeb extends ActionWeb { ro.put("isEnd", isEnd); String bindId = publish.getBindId(); List newList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").addQuery("BINDID=", bindId).list(); - if (!isEmpty(newList)) { + if (!isEmpty(newList)) for (int i = 0; i < newList.size(); i++) { JSONObject obj = new JSONObject(); BO newBo = newList.get(i); @@ -2948,11 +2730,9 @@ public class ProcessPublishWeb extends ActionWeb { // 当前流程所有节点 List shapeIds = new ArrayList<>(); List> shapeList = CoeDesignerUtil.getShapeMessageJson2(publishId);// 获取所有节点 - if (shapeList != null && shapeList.size() > 0) { - for (Map map : shapeList) { + if (shapeList != null && shapeList.size() > 0) + for (Map map : shapeList) shapeIds.add((String) map.get("id")); - } - } /******************** 附件 ************************/ // 文件或节点自身附件 JSONArray js = new JSONArray(); @@ -2960,8 +2740,8 @@ public class ProcessPublishWeb extends ActionWeb { StringBuilder sqlWhere = new StringBuilder(); sqlWhere.append(" and PALREPOSITORYID ='").append(publishId).append("'"); List fileList = upFileDao.search(sqlWhere.toString()); - if (fileList != null && fileList.size() > 0) { - for (UpfileModel upfileModel : fileList) { + if (fileList != null && fileList.size() > 0) + for (UpfileModel upfileModel : fileList) if("data".equals(methodCategory)) { if ("s".equals(upfileModel.getType())) { JSONObject jb = new JSONObject(); @@ -2973,37 +2753,30 @@ public class ProcessPublishWeb extends ActionWeb { ResponseObject ros = getUrl(jb, id, upFileName); JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData())); String url = parseObject.get("url").toString(); - if(url.contains(".xls")) { + if(url.contains(".xls")) openUrl= url; - }else { + else openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", ""); - } - jb.put("openUrl",openUrl); - js.add(jb.toJSONString()); - } - }else { - if ("f".equals(upfileModel.getType())) { - JSONObject jb = new JSONObject(); - String upfileId = upfileModel.getUuid(); - String upFileName = upfileModel.getFileName(); - jb.put("upfileId", upfileId); - jb.put("upFileName", upFileName); - String openUrl = ""; - ResponseObject ros = getUrl(jb, id, upFileName); - JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData())); - String url = parseObject.get("url").toString(); - if(url.contains(".xls")) { - openUrl= url; - }else { - openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", ""); - } jb.put("openUrl",openUrl); js.add(jb.toJSONString()); } + } else if ("f".equals(upfileModel.getType())) { + JSONObject jb = new JSONObject(); + String upfileId = upfileModel.getUuid(); + String upFileName = upfileModel.getFileName(); + jb.put("upfileId", upfileId); + jb.put("upFileName", upFileName); + String openUrl = ""; + ResponseObject ros = getUrl(jb, id, upFileName); + JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData())); + String url = parseObject.get("url").toString(); + if(url.contains(".xls")) + openUrl= url; + else + openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", ""); + jb.put("openUrl",openUrl); + js.add(jb.toJSONString()); } - - } - } obj.put("upfileId", js); } else { obj.put("fileVersion", "1.0"); @@ -3014,9 +2787,8 @@ public class ProcessPublishWeb extends ActionWeb { newArr.add(obj); } } - } List changeList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").addQuery("BINDID=", bindId).list(); - if (!isEmpty(changeList)) { + if (!isEmpty(changeList)) for (int j = 0; j < changeList.size(); j++) { JSONObject obj = new JSONObject(); BO changeBo = changeList.get(j); @@ -3037,15 +2809,14 @@ public class ProcessPublishWeb extends ActionWeb { obj.put("category", model.getMethodCategory()); List list2 = PALRepositoryCache.getByVersionId(wsId, model.getVersionId()); - if (list2 != null && list2.size() > 0) { + if (list2 != null && list2.size() > 0) Collections.sort(list2, new Comparator() { @Override public int compare(PALRepositoryModel o1, PALRepositoryModel o2) { return VersionUtil.compareVersionNo(o1.getVersion(), o2.getVersion(), true); // 升序 } }); - } - for (PALRepositoryModel model2 : list2) { + for (PALRepositoryModel model2 : list2) if (!model2.getId().equals(obj.getString("changeFileId")) && !model2.isPublish()) { JSONObject object = new JSONObject(); object.put("text", model2.getName()); @@ -3053,7 +2824,6 @@ public class ProcessPublishWeb extends ActionWeb { object.put("version", VersionUtil.getVersionStr(model2.getVersion())); array.add(object); } - } String changeId = changeBo.getString("CHANGEDFILEIDNEW"); PALRepositoryModel model3 = PALRepositoryCache.getCache().get(changeId); if(null!= model3) { @@ -3061,11 +2831,9 @@ public class ProcessPublishWeb extends ActionWeb { List shapeIds = new ArrayList<>(); String methodCategory = model3.getMethodCategory(); List> shapeList = CoeDesignerUtil.getShapeMessageJson2(changeId);// 获取所有节点 - if (shapeList != null && shapeList.size() > 0) { - for (Map map : shapeList) { + if (shapeList != null && shapeList.size() > 0) + for (Map map : shapeList) shapeIds.add((String) map.get("id")); - } - } /******************** 附件 ************************/ // 文件或节点自身附件 JSONArray js = new JSONArray(); @@ -3073,8 +2841,8 @@ public class ProcessPublishWeb extends ActionWeb { StringBuilder sqlWhere = new StringBuilder(); sqlWhere.append(" and PALREPOSITORYID ='").append(changeId).append("'"); List fileList = upFileDao.search(sqlWhere.toString()); - if (fileList != null && fileList.size() > 0) { - for (UpfileModel upfileModel : fileList) { + if (fileList != null && fileList.size() > 0) + for (UpfileModel upfileModel : fileList) if("data".equals(methodCategory)) { if ("s".equals(upfileModel.getType())) { JSONObject jb = new JSONObject(); @@ -3086,36 +2854,30 @@ public class ProcessPublishWeb extends ActionWeb { ResponseObject ros = getUrl(jb, id, upFileName); JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData())); String url = parseObject.get("url").toString(); - if(url.contains(".xls")) { + if(url.contains(".xls")) openUrl= url; - }else { + else openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", ""); - } - jb.put("openUrl",openUrl); - js.add(jb.toJSONString()); - } - }else { - if ("f".equals(upfileModel.getType())) { - JSONObject jb = new JSONObject(); - String upfileId = upfileModel.getUuid(); - String upFileName = upfileModel.getFileName(); - jb.put("upfileId", upfileId); - jb.put("upFileName", upFileName); - String openUrl = ""; - ResponseObject ros = getUrl(jb, id, upFileName); - JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData())); - String url = parseObject.get("url").toString(); - if(url.contains(".xls")) { - openUrl= url; - }else { - openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", ""); - } jb.put("openUrl",openUrl); js.add(jb.toJSONString()); } + } else if ("f".equals(upfileModel.getType())) { + JSONObject jb = new JSONObject(); + String upfileId = upfileModel.getUuid(); + String upFileName = upfileModel.getFileName(); + jb.put("upfileId", upfileId); + jb.put("upFileName", upFileName); + String openUrl = ""; + ResponseObject ros = getUrl(jb, id, upFileName); + JSONObject parseObject = JSON.parseObject(JSON.toJSONString(ros.getData())); + String url = parseObject.get("url").toString(); + if(url.contains(".xls")) + openUrl= url; + else + openUrl = SDK.getConfAPI().getPortalUrl() + "/r/" + url.replace("./", ""); + jb.put("openUrl",openUrl); + js.add(jb.toJSONString()); } - } - } obj.put("upfileId", js); } @@ -3140,9 +2902,8 @@ public class ProcessPublishWeb extends ActionWeb { changeArr.add(obj); } } - } List stopList = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").addQuery("BINDID=", bindId).list(); - if (!isEmpty(stopList)) { + if (!isEmpty(stopList)) for (int i = 0; i < stopList.size(); i++) { JSONObject obj = new JSONObject(); BO stopBo = stopList.get(i); @@ -3164,7 +2925,6 @@ public class ProcessPublishWeb extends ActionWeb { stopArr.add(obj); } } - } } ro.put("newData", newArr); ro.put("changeData", changeArr); @@ -3186,15 +2946,12 @@ public class ProcessPublishWeb extends ActionWeb { */ public String createOutputPrReports(String wsId, String teamId, String uuids) { // 校验流程手册是否安装并启动 - if (!SDK.getAppAPI().isActive("com.actionsoft.apps.coe.pal.output.pr")) { - return ResponseObject.newErrResponse("流程手册未安装或已暂停").toString(); - } - if (!SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.bd")) { - return ResponseObject.newErrResponse("表单手册未安装或已暂停").toString(); - } - if (!SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.zd")) { - return ResponseObject.newErrResponse("制度手册未安装或已暂停").toString(); - } + if (!SDK.getAppAPI().isActive("com.actionsoft.apps.coe.pal.output.pr")) + return ResponseObject.newErrResponse("流程手册未安装或已暂停").toString(); + if (!SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.bd")) + return ResponseObject.newErrResponse("表单手册未安装或已暂停").toString(); + if (!SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.zd")) + return ResponseObject.newErrResponse("制度手册未安装或已暂停").toString(); ResponseObject ro = ResponseObject.newOkResponse(); JSONObject result = new JSONObject(); JSONArray array = JSONArray.parseArray(uuids); @@ -3202,34 +2959,30 @@ public class ProcessPublishWeb extends ActionWeb { String uuid = array.getString(i); // 校验 PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); - if (model == null) { - throw new AWSException("没有找到文件:" + uuid); - } + if (model == null) + throw new AWSException("没有找到文件:" + uuid); String taskId = ""; if (model.getMethodId().contains("process.")) { taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, _uc.getUID(), teamId, uuid); JSONObject object = JSONObject.parseObject(taskId); - if ("ok".equals(object.getString("result"))) { - taskId = object.getJSONObject("data").getString("taskId"); - } else { - throw new AWSException("创建流程手册失败:" + uuid); - } + if ("ok".equals(object.getString("result"))) + taskId = object.getJSONObject("data").getString("taskId"); + else + throw new AWSException("创建流程手册失败:" + uuid); } else if ("data.form".equals(model.getMethodId())) { taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, _uc.getUID(), teamId, uuid); JSONObject object = JSONObject.parseObject(taskId); - if ("ok".equals(object.getString("result"))) { - taskId = object.getJSONObject("data").getString("taskId"); - } else { - throw new AWSException("创建表单手册失败:" + uuid); - } + if ("ok".equals(object.getString("result"))) + taskId = object.getJSONObject("data").getString("taskId"); + else + throw new AWSException("创建表单手册失败:" + uuid); } else if ("control.policy".equals(model.getMethodId())) { taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, _uc.getUID(), teamId, uuid); JSONObject object = JSONObject.parseObject(taskId); - if ("ok".equals(object.getString("result"))) { - taskId = object.getJSONObject("data").getString("taskId"); - } else { - throw new AWSException("创建制度手册失败:" + uuid); - } + if ("ok".equals(object.getString("result"))) + taskId = object.getJSONObject("data").getString("taskId"); + else + throw new AWSException("创建制度手册失败:" + uuid); } result.put(uuid, UtilString.isEmpty(taskId) ? "" : taskId); } @@ -3250,22 +3003,20 @@ public class ProcessPublishWeb extends ActionWeb { ResponseObject ro = ResponseObject.newOkResponse(); StringBuilder sb1 = new StringBuilder(); JSONArray array = JSONArray.parseArray(uuids); - if(array.size()==0){ - ro.put("result","error"); - }else{ - for (int i = 0; i < array.size(); i++) { + if(array.size()==0) + ro.put("result","error"); + else + for (int i = 0; i < array.size(); i++) { String uuid = array.getString(i); // 校验 PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); - if (model == null) { - throw new AWSException("没有找到文件:" + uuid); - } + if (model == null) + throw new AWSException("没有找到文件:" + uuid); PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao(); List oldPropertyList = repositoryPropertyDao.getPropertysByPlid(uuid, ""); - if (oldPropertyList != null && oldPropertyList.size() > 0) { - for (PALRepositoryPropertyModel propertyModel : oldPropertyList) { - - //获取文件属性中支持文件 + if (oldPropertyList != null && oldPropertyList.size() > 0) + for (PALRepositoryPropertyModel propertyModel : oldPropertyList) + //获取文件属性中支持文件 if(propertyModel.getPropertyId().equals("support_files")){ String relationFileId=JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId"); String[] splitRelationFileId = new String[0]; @@ -3275,42 +3026,34 @@ public class ProcessPublishWeb extends ActionWeb { if(relationFileId.contains(",")){ splitRelationFileId=relationFileId.split(","); fileElements = CoeDesignerUtil.getShapeMessageJson4(splitRelationFileId[0]); - }else{ - fileElements = CoeDesignerUtil.getShapeMessageJson4(relationFileId); - } + } else + fileElements = CoeDesignerUtil.getShapeMessageJson4(relationFileId); for (Map shape : fileElements) { String tempShapeId = shape.get("id").toString(); UpFileDao dao = new UpFileDao(); // 文件:根据relationFileId 和 文件类型 查询 List list2; - if(relationFileId.contains(",")){ - list2= dao.search(splitRelationFileId[0], tempShapeId, "s"); - }else{ - list2= dao.search(relationFileId, tempShapeId, "s"); - } + if(relationFileId.contains(",")) + list2= dao.search(splitRelationFileId[0], tempShapeId, "s"); + else + list2= dao.search(relationFileId, tempShapeId, "s"); - if(list2.size()==0){ - sb.append("模型名称:").append(shape.get("plName")).append("
").append("节点名称:").append("'"+shape.get("name")+"'").append("未上传附件,请检查").append(","); - } + if(list2.size()==0) + sb.append("模型名称:").append(shape.get("plName")).append("
").append("节点名称:").append("'"+shape.get("name")+"'").append("未上传附件,请检查").append(","); } } } - - } - } if (sb.length() > 0) { sb1=sb.deleteCharAt(sb.length()-1); ro.put("sb",sb1); ro.put("result","error"); - }else{ - ro.put("result","ok"); - } + } else + ro.put("result","ok"); } - } return ro.toString(); } @@ -3329,22 +3072,20 @@ public class ProcessPublishWeb extends ActionWeb { StringBuilder sb1 = new StringBuilder(); JSONArray array = JSONArray.parseArray(uuids); - if(array.size()==0){ - ro.put("result","error"); - }else{ - for (int i = 0; i < array.size(); i++) { + if(array.size()==0) + ro.put("result","error"); + else + for (int i = 0; i < array.size(); i++) { String uuid = array.getString(i); // 校验 PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); - if (model == null) { - throw new AWSException("没有找到文件:" + uuid); - } + if (model == null) + throw new AWSException("没有找到文件:" + uuid); PALRepositoryPropertyDao repositoryPropertyDao = new PALRepositoryPropertyDao(); List oldPropertyList = repositoryPropertyDao.getPropertysByPlid(uuid, ""); - if (oldPropertyList != null && oldPropertyList.size() > 0) { - for (PALRepositoryPropertyModel propertyModel : oldPropertyList) { - - //获取文件属性中支持文件 + if (oldPropertyList != null && oldPropertyList.size() > 0) + for (PALRepositoryPropertyModel propertyModel : oldPropertyList) + //获取文件属性中支持文件 if(propertyModel.getPropertyId().equals("support_files")){ String relationFileId=JSONObject.parseObject(propertyModel.getPropertyValue()).getString("relationFileId"); String[] splitRelationFileId; @@ -3352,16 +3093,12 @@ public class ProcessPublishWeb extends ActionWeb { splitRelationFileId=relationFileId.split(","); RowMap rowMap=DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID=?",splitRelationFileId[0]); String ispublish=rowMap.getString("ISPUBLISH"); - if(ispublish.equals("0")) { - sb.append(rowMap.getString("PLNAME")).append("需进行选择发布!"); - } + if(ispublish.equals("0")) + sb.append(rowMap.getString("PLNAME")).append("需进行选择发布!"); } } - } - - } @@ -3369,15 +3106,12 @@ public class ProcessPublishWeb extends ActionWeb { sb1=sb.deleteCharAt(sb.length()-1); ro.put("sb",sb1); ro.put("result","error"); - }else{ - ro.put("result","ok"); - } + } else + ro.put("result","ok"); } - - } return ro.toString(); } @@ -3412,8 +3146,8 @@ public class ProcessPublishWeb extends ActionWeb { List models = PALRepositoryCache.getByVersionId(wsId, model.getVersionId()); if (models.size() > 0) { models.sort((m1, m2) -> {return m2.getVersion() > m1.getVersion() ? 1 : -1;}); - for (PALRepositoryModel model2 : models) { - if (!model2.isPublish() && !model2.getId().equals(model.getId())) { + for (PALRepositoryModel model2 : models) + if (!model2.isPublish() && !model2.getId().equals(model.getId())) { String id = model2.getId(); double version = model2.getVersion(); String text = model2.getName(); @@ -3423,7 +3157,6 @@ public class ProcessPublishWeb extends ActionWeb { obj.put("version", VersionUtil.getVersionStr(version)); object.getJSONArray("targetFiles").add(obj); } - } } // 生成流程手册 if (object.getJSONArray("targetFiles").size() > 0) { @@ -3437,30 +3170,27 @@ public class ProcessPublishWeb extends ActionWeb { object.put("targetMethodId", model2.getMethodId()); object.put("targetCategory", model2.getMethodCategory()); String taskId = ""; - if ("submit_create".equals(createTime)) { - taskId = "submit_create"; - } else { + if ("submit_create".equals(createTime)) + taskId = "submit_create"; + else { String category = model2.getMethodCategory(); - if (model.getMethodId().contains("process.")) { - taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, _uc.getUID(), teamId, model2.getId()); - } else if ("data.form".equals(model.getMethodId())) { - taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, _uc.getUID(), teamId, model2.getId()); - } else if ("control.policy".equals(model.getMethodId())) { - taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, _uc.getUID(), teamId, model2.getId()); - } + if (model.getMethodId().contains("process.")) + taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, _uc.getUID(), teamId, model2.getId()); + else if ("data.form".equals(model.getMethodId())) + taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, _uc.getUID(), teamId, model2.getId()); + else if ("control.policy".equals(model.getMethodId())) + taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, _uc.getUID(), teamId, model2.getId()); JSONObject object2 = JSONObject.parseObject(taskId); - if ("ok".equals(object2.getString("result"))) { - taskId = object2.getJSONObject("data").getString("taskId"); - } else { - throw new AWSException("创建流程手册失败:" + model2.getId()); - } + if ("ok".equals(object2.getString("result"))) + taskId = object2.getJSONObject("data").getString("taskId"); + else + throw new AWSException("创建流程手册失败:" + model2.getId()); } object.put("taskId", taskId); } result.add(object); - } else { - result.add(object); - } + } else + result.add(object); } ro.put("data", result); return ro.toString(); @@ -3482,9 +3212,8 @@ public class ProcessPublishWeb extends ActionWeb { for (int i = 0; i < array.size(); i++) { String uuid = array.getString(i); String taskId = pHistory.getLastPublishTaskIdByModelId(uuid); - if (taskId == null) { - taskId = ""; - } + if (taskId == null) + taskId = ""; object.put(uuid, taskId); } ro.put("data", object); @@ -3553,9 +3282,8 @@ public class ProcessPublishWeb extends ActionWeb { JSONObject object = array.getJSONObject(i); validModelExist(object.getString("changeFileId"));// 校验 String newId = object.getString("changedFileIdNew"); - if (!UtilString.isEmpty(newId)) { - validModelExist(newId);// 校验 - } + if (!UtilString.isEmpty(newId)) + validModelExist(newId);// 校验 ids.add(object.getString("changeFileId")); } JSONArray result = new JSONArray(); @@ -3576,9 +3304,8 @@ public class ProcessPublishWeb extends ActionWeb { PALRepositoryModel model = PALRepositoryCache.getCache().get(object.getString("changeFileId")); PALRepositoryModel newModel = null; String newId = object.getString("changedFileIdNew"); - if (!UtilString.isEmpty(newId)) { - newModel = PALRepositoryCache.getCache().get(newId); - } + if (!UtilString.isEmpty(newId)) + newModel = PALRepositoryCache.getCache().get(newId); BO changeBo = new BO(); changeBo.set("CHANGEFILENAME", model.getName()); changeBo.set("CHANGEDFILENAMENEW", newModel == null ? "" : newModel.getName()); @@ -3641,11 +3368,10 @@ public class ProcessPublishWeb extends ActionWeb { if (set.isEmpty()) return; Set filter = new HashSet<>(); List list = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").addQuery("ISEND =", 0).list(); - if (list != null && list.size() > 0) { - for (BO bo : list) { - if (bo.getBindId().equals(processInstId)) { - continue; - } + if (list != null && list.size() > 0) + for (BO bo : list) { + if (bo.getBindId().equals(processInstId)) + continue; // 获取三个子表 {// 发布表 BO newBo = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").detailByBindId(bo.getBindId()); @@ -3653,8 +3379,8 @@ public class ProcessPublishWeb extends ActionWeb { PALRepositoryModel temp1 = PALRepositoryCache.getCache().get(newBo.getString("PUBLISHFILEID")); if (temp1 != null) { List list1 = PALRepositoryCache.getByVersionId(wsId, temp1.getVersionId()); - for (PALRepositoryModel model : list1) { - if (set.contains(model.getId()) && !filter.contains(model.getId())) { + for (PALRepositoryModel model : list1) + if (set.contains(model.getId()) && !filter.contains(model.getId())) { // 存在未办理完成的表单 JSONObject obj = new JSONObject(); obj.put("type", "new"); @@ -3663,7 +3389,6 @@ public class ProcessPublishWeb extends ActionWeb { obj.put("version", VersionUtil.getVersionStr(model.getVersion())); array.add(obj); } - } } } } @@ -3673,8 +3398,8 @@ public class ProcessPublishWeb extends ActionWeb { PALRepositoryModel temp2 = PALRepositoryCache.getCache().get(changeBo.getString("CHANGEFILEID")); if (temp2 != null) { List list1 = PALRepositoryCache.getByVersionId(wsId, temp2.getVersionId()); - for (PALRepositoryModel model : list1) { - if (set.contains(model.getId()) && !filter.contains(model.getId())) { + for (PALRepositoryModel model : list1) + if (set.contains(model.getId()) && !filter.contains(model.getId())) { // 存在未办理完成的表单 JSONObject obj = new JSONObject(); obj.put("type", "change"); @@ -3683,7 +3408,6 @@ public class ProcessPublishWeb extends ActionWeb { obj.put("version", VersionUtil.getVersionStr(model.getVersion())); array.add(obj); } - } } } } @@ -3693,8 +3417,8 @@ public class ProcessPublishWeb extends ActionWeb { PALRepositoryModel temp3 = PALRepositoryCache.getCache().get(stopBo.getString("STOPFILEID")); if (temp3 != null) { List list1 = PALRepositoryCache.getByVersionId(wsId, temp3.getVersionId()); - for (PALRepositoryModel model : list1) { - if (set.contains(model.getId()) && !filter.contains(model.getId())) { + for (PALRepositoryModel model : list1) + if (set.contains(model.getId()) && !filter.contains(model.getId())) { // 存在未办理完成的表单 JSONObject obj = new JSONObject(); obj.put("type", "stop"); @@ -3703,12 +3427,10 @@ public class ProcessPublishWeb extends ActionWeb { obj.put("version", VersionUtil.getVersionStr(model.getVersion())); array.add(obj); } - } } } } } - } } /** @@ -3732,31 +3454,27 @@ public class ProcessPublishWeb extends ActionWeb { // 校验所有数据 HashSet ids = new HashSet<>(); JSONArray result = new JSONArray(); - if (!newArray.isEmpty()) {// 校验 - for (int i = 0; i < newArray.size(); i++) { + if (!newArray.isEmpty()) + for (int i = 0; i < newArray.size(); i++) { JSONObject object = newArray.getJSONObject(i); validModelExist(object.getString("publishFileId"));// 校验 ids.add(object.getString("publishFileId")); } - } - if (!changeArray.isEmpty()) {// 校验 - for (int i = 0; i < changeArray.size(); i++) { + if (!changeArray.isEmpty()) + for (int i = 0; i < changeArray.size(); i++) { JSONObject object = changeArray.getJSONObject(i); validModelExist(object.getString("changeFileId"));// 校验 String newId = object.getString("changedFileIdNew"); - if (!UtilString.isEmpty(newId)) { - validModelExist(newId);// 校验 - } + if (!UtilString.isEmpty(newId)) + validModelExist(newId);// 校验 ids.add(object.getString("changeFileId")); } - } - if (!stopArray.isEmpty()) {// 校验 - for (int i = 0; i < stopArray.size(); i++) { + if (!stopArray.isEmpty()) + for (int i = 0; i < stopArray.size(); i++) { JSONObject object = stopArray.getJSONObject(i); validModelExist(object.getString("stopFileId"));// 校验 ids.add(object.getString("stopFileId")); } - } validPublisData(ids, processInstId, wsId, result);// 校验 if (result.size() > 0) { @@ -3806,9 +3524,8 @@ public class ProcessPublishWeb extends ActionWeb { // repositoryDao.updateIsApproval(1, model.getId()); PALRepositoryModel newModel = null; String newId = object.getString("changedFileIdNew"); - if (!UtilString.isEmpty(newId)) { - newModel = PALRepositoryCache.getCache().get(newId); - } + if (!UtilString.isEmpty(newId)) + newModel = PALRepositoryCache.getCache().get(newId); BO changeBo = new BO(); changeBo.set("CHANGEFILENAME", model.getName()); changeBo.set("CHANGEDFILENAMENEW", newModel == null ? "" : newModel.getName()); @@ -3843,9 +3560,8 @@ public class ProcessPublishWeb extends ActionWeb { SDK.getBOAPI().create(stopBoName, list, bindId, _uc.getUID()); } // 提交时通过线程处理流程手册的创建 - if (isTransact) { - batchCreateReportByThread(wsId, processInstId); - } + if (isTransact) + batchCreateReportByThread(wsId, processInstId); return ro.toString(); } @@ -3863,21 +3579,18 @@ public class ProcessPublishWeb extends ActionWeb { if (model.getMethodId().contains("process.")) { taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, userId, teamId, uuid); JSONObject object = JSONObject.parseObject(taskId); - if ("ok".equals(object.getString("result"))) { - taskId = object.getJSONObject("data").getString("taskId"); - } + if ("ok".equals(object.getString("result"))) + taskId = object.getJSONObject("data").getString("taskId"); } else if ("data.form".equals(model.getMethodId())) { taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportBd(wsId, userId, teamId, uuid); JSONObject object = JSONObject.parseObject(taskId); - if ("ok".equals(object.getString("result"))) { - taskId = object.getJSONObject("data").getString("taskId"); - } + if ("ok".equals(object.getString("result"))) + taskId = object.getJSONObject("data").getString("taskId"); } else if ("control.policy".equals(model.getMethodId())) { taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, userId, teamId, uuid); JSONObject object = JSONObject.parseObject(taskId); - if ("ok".equals(object.getString("result"))) { - taskId = object.getJSONObject("data").getString("taskId"); - } + if ("ok".equals(object.getString("result"))) + taskId = object.getJSONObject("data").getString("taskId"); } return taskId; } @@ -3895,27 +3608,23 @@ public class ProcessPublishWeb extends ActionWeb { ThreadFactory namedThreadFactory = new ThreadFactoryBuilder().setNameFormat("Thread-call-runner-%d").build(); ExecutorService service = new ThreadPoolExecutor(4, 4, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingDeque<>(), namedThreadFactory); List n = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_N").addQuery("BINDID=", processInstId).list(); - if (!n.isEmpty()) { - for (BO bn : n) { + if (!n.isEmpty()) + for (BO bn : n) { String taskId = bn.getString("TASKID"); - if ("submit_create".equals(taskId)) { - service.execute(() -> { + if ("submit_create".equals(taskId)) + service.execute(() -> { // 创建流程手册 String publishFileId = bn.getString("PUBLISHFILEID"); PALRepositoryModel model = PALRepositoryCache.getCache().get(publishFileId); - if ("default".equals(model.getMethodId())) { - SDK.getLogAPI().consoleErr("流程发布表单[发布]提交时创建流程手册失败,processInstId=" + processInstId + ",publishFileId=" + publishFileId); - } + if ("default".equals(model.getMethodId())) + SDK.getLogAPI().consoleErr("流程发布表单[发布]提交时创建流程手册失败,processInstId=" + processInstId + ",publishFileId=" + publishFileId); // 校验流程手册是否安装并启动 - if (model.getMethodId().contains("process.") && !SDK.getAppAPI().isActive("com.actionsoft.apps.coe.pal.output.pr")) { - SDK.getLogAPI().consoleErr("[流程手册未安装]流程手册更新失败"); - } - if ("data.form".equals(model.getMethodId()) && !SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.bd")) { - SDK.getLogAPI().consoleErr("[表单手册未安装]流程手册更新失败"); - } - if ("control.policy".equals(model.getMethodId()) && !SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.zd")) { - SDK.getLogAPI().consoleErr("[表单手册未安装]流程手册更新失败"); - } + if (model.getMethodId().contains("process.") && !SDK.getAppAPI().isActive("com.actionsoft.apps.coe.pal.output.pr")) + SDK.getLogAPI().consoleErr("[流程手册未安装]流程手册更新失败"); + if ("data.form".equals(model.getMethodId()) && !SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.bd")) + SDK.getLogAPI().consoleErr("[表单手册未安装]流程手册更新失败"); + if ("control.policy".equals(model.getMethodId()) && !SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.zd")) + SDK.getLogAPI().consoleErr("[表单手册未安装]流程手册更新失败"); String newTaskId = createOutputReport(model, model.getWsId(), _uc.getUID(), "", model.getId()); //JSONObject object = JSONObject.parseObject(newTaskId); @@ -3924,38 +3633,30 @@ public class ProcessPublishWeb extends ActionWeb { SDK.getLogAPI().consoleInfo("流程发布表单[发布]提交时创建流程手册成功,processInstId=" + processInstId + ",publishFileId=" + publishFileId); int count = DBSql.update("UPDATE BO_ACT_COE_PUBLISH_N SET TASKID='" + newTaskId + "' WHERE ID ='" + bn.getId() + "'"); SDK.getLogAPI().consoleInfo("流程发布表单[发布]提交时创建流程手册保存数据库成功,processInstId" + processInstId + ",publishFileId=" + publishFileId + ",执行SQL条数[" + count + "]"); - } else { - SDK.getLogAPI().consoleErr("流程发布表单[发布]提交时创建流程手册失败,processInstId=" + processInstId + ",publishFileId=" + publishFileId); - } + } else + SDK.getLogAPI().consoleErr("流程发布表单[发布]提交时创建流程手册失败,processInstId=" + processInstId + ",publishFileId=" + publishFileId); }); - } } - } List c = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_C").addQuery("BINDID=", processInstId).list(); - if (!c.isEmpty()) { - for (BO bc : c) { + if (!c.isEmpty()) + for (BO bc : c) { String taskId = bc.getString("TASKID"); - if ("submit_create".equals(taskId)) { - - // 创建流程手册 + if ("submit_create".equals(taskId)) + // 创建流程手册 service.execute(() -> { // 创建流程手册 String changedFileIdNew = bc.getString("CHANGEDFILEIDNEW"); PALRepositoryModel model = PALRepositoryCache.getCache().get(changedFileIdNew); - if ("default".equals(model.getMethodId())) { - SDK.getLogAPI().consoleErr("流程发布表单[发布]提交时创建流程手册失败,processInstId=" + processInstId + ",changedFileIdNew=" + changedFileIdNew); - } + if ("default".equals(model.getMethodId())) + SDK.getLogAPI().consoleErr("流程发布表单[发布]提交时创建流程手册失败,processInstId=" + processInstId + ",changedFileIdNew=" + changedFileIdNew); // 校验流程手册是否安装并启动 - if (model.getMethodId().contains("process.") && !SDK.getAppAPI().isActive("com.actionsoft.apps.coe.pal.output.pr")) { - SDK.getLogAPI().consoleErr("[流程手册未安装]流程手册更新失败"); - } - if ("data.form".equals(model.getMethodId()) && !SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.bd")) { - SDK.getLogAPI().consoleErr("[表单手册未安装]流程手册更新失败"); - } - if ("control.policy".equals(model.getMethodId()) && !SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.zd")) { - SDK.getLogAPI().consoleErr("[表单手册未安装]流程手册更新失败"); - } + if (model.getMethodId().contains("process.") && !SDK.getAppAPI().isActive("com.actionsoft.apps.coe.pal.output.pr")) + SDK.getLogAPI().consoleErr("[流程手册未安装]流程手册更新失败"); + if ("data.form".equals(model.getMethodId()) && !SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.bd")) + SDK.getLogAPI().consoleErr("[表单手册未安装]流程手册更新失败"); + if ("control.policy".equals(model.getMethodId()) && !SDK.getAppAPI().isActive("com.awspaas.user.apps.coe.pal.output.zd")) + SDK.getLogAPI().consoleErr("[表单手册未安装]流程手册更新失败"); String newTaskId = createOutputReport(model, model.getWsId(), _uc.getUID(), "", model.getId()); // JSONObject object = JSONObject.parseObject(newTaskId); @@ -3964,13 +3665,10 @@ public class ProcessPublishWeb extends ActionWeb { SDK.getLogAPI().consoleInfo("流程发布表单[变更]提交时创建流程手册成功,processInstId=" + processInstId + ",changedFileIdNew=" + changedFileIdNew); int count = DBSql.update("UPDATE BO_ACT_COE_PUBLISH_C SET TASKID='" + newTaskId + "' WHERE ID ='" + bc.getId() + "'"); SDK.getLogAPI().consoleInfo("流程发布表单[变更]提交时创建流程手册保存数据库成功,processInstId=" + processInstId + ",changedFileIdNew=" + changedFileIdNew + ",执行SQL条数[" + count + "]"); - } else { - SDK.getLogAPI().consoleErr("流程发布表单[变更]提交时创建流程手册失败,processInstId=" + processInstId + ",changedFileIdNew=" + changedFileIdNew); - } + } else + SDK.getLogAPI().consoleErr("流程发布表单[变更]提交时创建流程手册失败,processInstId=" + processInstId + ",changedFileIdNew=" + changedFileIdNew); }); - } } - } // 关闭线程池 service.shutdown(); } @@ -3986,17 +3684,14 @@ public class ProcessPublishWeb extends ActionWeb { if (!UtilString.isEmpty(uuid)) { PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); if (model != null) { - if ("default".equals(model.getMethodId())) { - return ResponseObject.newErrResponse("文件夹类型不允许打开").toString(); - } else { - return ResponseObject.newOkResponse().toString(); - } - } else { - return ResponseObject.newErrResponse("打开文件错误").toString(); - } - } else { - return ResponseObject.newErrResponse("打开文件错误").toString(); - } + if ("default".equals(model.getMethodId())) + return ResponseObject.newErrResponse("文件夹类型不允许打开").toString(); + else + return ResponseObject.newOkResponse().toString(); + } else + return ResponseObject.newErrResponse("打开文件错误").toString(); + } else + return ResponseObject.newErrResponse("打开文件错误").toString(); } /** @@ -4038,12 +3733,20 @@ public class ProcessPublishWeb extends ActionWeb { for (RowMap tmp : resulttmp) { String key = tmp.getString("PROPERTYID"); String value = tmp.getString("PROPERTYVALUE"); - if (result.containsKey(key) && !value.isEmpty()) { + //如果有记录,但是当前记录架构为空 + if(UtilString.isNotEmpty(result.getString(key))&&UtilString.isEmpty(value)) { + iswrong = true; + //如果记录架构为空,但是当前记录不为空 + }else if(result.containsKey(key)&&UtilString.isEmpty(result.getString(key))&&UtilString.isNotEmpty(value)) { + iswrong = true; + //如果已有记录不为空,当前不为空,进行比较。 + }else if (result.containsKey(key)){ String v = result.getString(key); if (!value.equals(v)) { - iswrong = true; - } + iswrong = true; } + + } result.put(key, value); } } @@ -4105,17 +3808,15 @@ public class ProcessPublishWeb extends ActionWeb { */ public String downloadOutput(String taskId, String uuid) { PALRepositoryModel plModel = PALRepositoryCache.getCache().get(uuid); - if (plModel == null) { - return ResponseObject.newErrResponse("下载失败,模型不存在").toString(); - } + if (plModel == null) + return ResponseObject.newErrResponse("下载失败,模型不存在").toString(); String category = plModel.getMethodCategory(); String outputAppId = plModel.getMethodId().contains("process.") ? "com.actionsoft.apps.coe.pal.output.pr" : "data.form".equals(plModel.getMethodId()) ? "com.awspaas.user.apps.coe.pal.output.bd" : "control.policy".equals(plModel.getMethodId()) ? "com.awspaas.user.apps.coe.pal.output.zd" : ""; - if (UtilString.isEmpty(outputAppId)) { - return ResponseObject.newErrResponse("下载失败,模型分类不符").toString(); - } + if (UtilString.isEmpty(outputAppId)) + return ResponseObject.newErrResponse("下载失败,模型分类不符").toString(); OutputTaskModel model = new OutputTask().getTaskReportById(taskId); ResponseObject ro = ResponseObject.newOkResponse(); JSONObject json = new JSONObject(); @@ -4133,9 +3834,8 @@ public class ProcessPublishWeb extends ActionWeb { UtilFile.zipCompressExcludeName(file.getPath(), ff, "log,**/config.txt"); dcContext.setSession(_uc); // 操作行为日志记录 - if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) { - CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_APPCENTER, CoEOpLogConst.OP_DOWNLOAD, CoEOpLogConst.INFO_OUTPUT_DOWNLOAD); - } + if (SDK.getAppAPI().getPropertyBooleanValue(CoEConstant.APP_ID, "IS_RECORD_OP_LOG", false)) + CoEOpLogAPI.auditOkOp(_uc, CoEOpLogConst.MODULE_CATEGORY_APPCENTER, CoEOpLogConst.OP_DOWNLOAD, CoEOpLogConst.INFO_OUTPUT_DOWNLOAD); url = dcContext.getDownloadURL(); } json.put("url", url); diff --git a/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js b/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js index acee3696..751b9491 100644 --- a/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js +++ b/com.actionsoft.apps.coe.pal.publisher/web/com.actionsoft.apps.coe.pal.publisher/js/coe.pal.process.publish.multiple.js @@ -33,7 +33,6 @@ var stopPageSetting = { } var isHighSecurity; $(document).ready(function(){ - getWsId(); $('td,th').css('padding-top','0px'); $('td,th').css('padding-bottom','0px'); // $('#alertMsg').css('background', '#fff'); @@ -52,32 +51,6 @@ $(document).ready(function(){ // listenCloseEvent();// 关闭窗口执行,关闭窗口/刷新都会造成流程实例被删除,注释掉 }) - - -//获取wsid -function getWsId() { - var param = { - sid : $("#sid").val(), - cmd : "com.actionsoft.apps.coe.pal.publisher_publish_getWsId" - } - $.ajax({ - url : "./jd", - type : "POST", - dataType : "JSON", - data : param, - async: false, - success : function(r) { - if (r.result == 'ok') { - var wsId=$("#WSID").val(); - if(wsId==""){ - $("#WSID").val(r.data.wsId); - } - } - } - }); -} - - var paginationSetting = { pageLimit: pageLimit, showItem: 10, @@ -270,9 +243,9 @@ function initHtml() { newHtml += ''; newHtml += ''; newHtml += '序号'; - newHtml += '流程制度'; - newHtml += '文件文本'; - newHtml += '文件编号'; + newHtml += '流程制度模型'; + newHtml += '文件预览'; + newHtml += '文件编号'; newHtml += ''; newHtml += ''; newHtml += ''; @@ -304,12 +277,12 @@ function initHtml() { changeHtml += ''; changeHtml += ''; changeHtml += ''; - changeHtml += ''; - changeHtml += ''; - changeHtml += ''; - changeHtml += ''; - changeHtml += ''; - changeHtml += ''; + changeHtml += ''; + changeHtml += ''; + changeHtml += ''; + changeHtml += ''; + changeHtml += ''; + changeHtml += ''; changeHtml += ''; changeHtml += ''; changeHtml += ''; @@ -339,8 +312,8 @@ function initHtml() { stopHtml += ''; stopHtml += ''; stopHtml += ''; - stopHtml += ''; - stopHtml += ''; + stopHtml += ''; + stopHtml += ''; stopHtml += ''; stopHtml += ''; stopHtml += ''; @@ -451,9 +424,7 @@ function initPublishData(data, type, pageNumber, start){ // 初始化数据 function selectPublishData(data, type, pageNumber, start) { - //渲染到前台的流程架构L1,L2,L3 - var param = { cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs', processInstId: processInstId, @@ -475,31 +446,17 @@ function selectPublishData(data, type, pageNumber, start) { var L1old = ui("LEVEL_1_PROCESS_NAME"); var L2old = ui("LEVEL_2_PROCESS_NAME"); var L3old = ui("LEVEL_3_PROCESS_NAME"); - if((L1old != '' && L1 != L1old) || (L2old != '' && L2 != L2old) || (L3old != '' && L3 != L3old)){ - $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); - $.simpleAlert("只能选择同一级别下的流程,请重新选择"); - return; - } - //不属于同一L3 所以直接提示 - if(info == true){ - $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); - $.simpleAlert("只能选择同一级别下的流程,请重新选择"); - return; - }else{ - if(ui("LEVEL_1_PROCESS_NAME").length > 0){ - return; - } - ui("LEVEL_1_PROCESS_NAME",L1); - ui("LEVEL_2_PROCESS_NAME",L2); - ui("LEVEL_3_PROCESS_NAME",L3); - showlist(data, type, pageNumber, start); + + ui("LEVEL_1_PROCESS_NAME",L1); + ui("LEVEL_2_PROCESS_NAME",L2); + ui("LEVEL_3_PROCESS_NAME",L3); + showlist(data, type, pageNumber, start); //发起请求把审批人查询出来~ - queryapprove(); - ui("ADAPT_NAME_THE_COMPANY",""), - ui("ADAPT_REGION_NAME",""), - ui("APPLICABLE_PRODUCT",""), - $("#publisher_dialog").dialog("close"); - } + queryapprove(); + ui("ADAPT_NAME_THE_COMPANY",""), + ui("ADAPT_REGION_NAME",""), + ui("APPLICABLE_PRODUCT",""), + $("#publisher_dialog").dialog("close"); //展示未发布过的流程 //data = r.data.is_not_publish_data; } @@ -599,7 +556,7 @@ function showlist(data, type, pageNumber, start){ html += ''; html += ''; html += ''; - html += ''; + html += ''; //html += ''; //html += ''; html += ''; @@ -670,7 +627,8 @@ function showlist(data, type, pageNumber, start){ var selectPerm = editPerm ? '' : '' + targetFileName + ''; html += ''; html += ''; - //html += ''; + //html += ''; + //html += ''; html += ''; //html += ''; html += ''; @@ -823,6 +781,7 @@ function addProcess(type) { height:height, buttons:[ {text:'确定',cls:"blue",handler:function(){ + debugger; window.$.simpleAlert("请稍等...", "loading"); if (type == 'new') { if (treeCheckedNewArr.length == 0) { @@ -860,6 +819,7 @@ function addProcess(type) { temps[i].publishDesc = desc; newTemp.push(temps[i]); } + //校验支持文件是否上传 publishFlowCheck(newTemp); // 初始化页数及当前页 initNewPagination(newPageSetting.pageNum - 1); @@ -1096,6 +1056,7 @@ function openQueryDataDialog(type) { buttons:[ {text:'确定',cls:"blue",handler:function(){ if (type == 'new') { + debugger; getNewPublishBatchResult(type); // 数据写入主dialog var names = ''; @@ -1249,26 +1210,63 @@ function loadNewData(treeNode) { // 发布类型批量结果数据回填主dialog function getNewPublishBatchResult(type) { + debugger; var nodes = initTree.getCheckedNodes(); treeCheckedNewArr = []; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - if (node.id.length > 36) continue; - //by bzp - if(node.method == "process.framework"){ - continue; + var param = { + cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs', + processInstId: processInstId, + wsId : wsId, + sid: sid, + datas:JSON.stringify(nodes) + }; + + $.ajax({ + url : "./jd", + type : "POST", + dataType : "JSON", + async : false, + data : param, + success : function(r) { + var info = r.data.info; + var L1 = r.data.data.Process_Architecture_L1; + var L2 = r.data.data.Process_Architecture_L2; + var L3 = r.data.data.Process_Architecture_L3; + var L1old = ui("LEVEL_1_PROCESS_NAME"); + var L2old = ui("LEVEL_2_PROCESS_NAME"); + var L3old = ui("LEVEL_3_PROCESS_NAME"); + if((L1old != '' && L1 != L1old) || (L2old != '' && L2 != L2old) || (L3old != '' && L3 != L3old)){ + $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); + $.simpleAlert("只能选择同一级别下的流程,请重新选择"); + return; + }else if(info == true){ + $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); + $.simpleAlert("只能选择同一级别下的流程,请重新选择"); + return; + + }else{ + //treeCheckedNewArr = nodes; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (node.id.length > 36) continue; + //by bzp + if(node.method == "process.framework"){ + continue; + } + var obj = {}; + obj.fileVersion = node.version; + obj.publishFileId = node.id; + obj.id = node.id; + // obj.publishFileName = node.name; + obj.publishFileName = node.tempName; + obj.methodId = node.method; + obj.category = node.category; + obj.taskId = "";// 后续生成流程手册 + treeCheckedNewArr.push(obj); + } + } } - var obj = {}; - obj.fileVersion = node.version; - obj.publishFileId = node.id; - obj.id = node.id; - // obj.publishFileName = node.name; - obj.publishFileName = node.tempName; - obj.methodId = node.method; - obj.category = node.category; - obj.taskId = "";// 后续生成流程手册 - treeCheckedNewArr.push(obj); - } + }); } //获取已发布文件数据结构 @@ -1326,48 +1324,117 @@ function getPublishedTreeData(type) { //变更类型批量结果数据回填主dialog function getChangeBatchResult(type) { + debugger; var nodes = initTree.getCheckedNodes(); treeCheckedChangeArr = []; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - if (node.id.length > 36) continue; - var obj = {}; - // obj.changeFileName = node.name; - obj.changeFileName = node.tempName; - obj.changeFileId = node.id; - obj.fileVersion = node.version; - obj.methodId = node.method; - obj.category = node.category; - obj.id = node.id; - obj.targetFiles = [];// 后续生成 - obj.changedFileIdNew = "";// 后续生成 - obj.changedFileNameNew = "";// 后续生成 - obj.taskId = "";// 后续生成 - obj.targetFileVersion = "";// 后续生成 - obj.targetMethodId = node.method - obj.targetCategory = node.category - treeCheckedChangeArr.push(obj); - } + var param = { + cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs', + processInstId: processInstId, + wsId : wsId, + sid: sid, + datas:JSON.stringify(nodes) + }; + $.ajax({ + url : "./jd", + type : "POST", + dataType : "JSON", + async : false, + data : param, + success : function(r) { + var info = r.data.info; + var L1 = r.data.data.Process_Architecture_L1; + var L2 = r.data.data.Process_Architecture_L2; + var L3 = r.data.data.Process_Architecture_L3; + var L1old = ui("LEVEL_1_PROCESS_NAME"); + var L2old = ui("LEVEL_2_PROCESS_NAME"); + var L3old = ui("LEVEL_3_PROCESS_NAME"); + if((L1old != '' && L1 != L1old) || (L2old != '' && L2 != L2old) || (L3old != '' && L3 != L3old)){ + $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); + $.simpleAlert("只能选择同一级别下的流程,请重新选择"); + return; + }else if(info == true){ + $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); + $.simpleAlert("只能选择同一级别下的流程,请重新选择"); + return; + }else{ + //treeCheckedNewArr = nodes; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (node.id.length > 36) continue; + var obj = {}; + // obj.changeFileName = node.name; + obj.changeFileName = node.tempName; + obj.changeFileId = node.id; + obj.fileVersion = node.version; + obj.methodId = node.method; + obj.category = node.category; + obj.id = node.id; + obj.targetFiles = [];// 后续生成 + obj.changedFileIdNew = "";// 后续生成 + obj.changedFileNameNew = "";// 后续生成 + obj.taskId = "";// 后续生成 + obj.targetFileVersion = "";// 后续生成 + obj.targetMethodId = node.method + obj.targetCategory = node.category + treeCheckedChangeArr.push(obj); + } + } + } + }); } // 停用类型批量结果数据回填主dialog function getStopBatchResult(type) { var nodes = initTree.getCheckedNodes(); treeCheckedStopArr = []; - for (var i = 0; i < nodes.length; i++) { - var node = nodes[i]; - if (node.id.length > 36) continue; - var obj = {}; - // obj.stopFileName = node.name; - obj.stopFileName = node.tempName; - obj.stopFileId = node.id; - obj.fileVersion = node.version; - obj.id = node.id; - obj.methodId = node.method; - obj.category = node.category; - obj.taskId = "";// 后续查询已经存在的流程手册 - treeCheckedStopArr.push(obj); - } + var param = { + cmd: 'com.actionsoft.apps.coe.pal.publisher_getPublishNameByJs', + processInstId: processInstId, + wsId : wsId, + sid: sid, + datas:JSON.stringify(nodes) + }; + $.ajax({ + url : "./jd", + type : "POST", + dataType : "JSON", + async : false, + data : param, + success : function(r) { + var info = r.data.info; + var L1 = r.data.data.Process_Architecture_L1; + var L2 = r.data.data.Process_Architecture_L2; + var L3 = r.data.data.Process_Architecture_L3; + var L1old = ui("LEVEL_1_PROCESS_NAME"); + var L2old = ui("LEVEL_2_PROCESS_NAME"); + var L3old = ui("LEVEL_3_PROCESS_NAME"); + if((L1old != '' && L1 != L1old) || (L2old != '' && L2 != L2old) || (L3old != '' && L3 != L3old)){ + $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); + $.simpleAlert("只能选择同一级别下的流程,请重新选择"); + return; + }else if(info == true){ + $('#publisher_dialog').find('div.dlg-button').find('button:first').prop('disabled', ''); + $.simpleAlert("只能选择同一级别下的流程,请重新选择"); + return; + }else{ + //treeCheckedNewArr = nodes; + for (var i = 0; i < nodes.length; i++) { + var node = nodes[i]; + if (node.id.length > 36) continue; + var obj = {}; + // obj.stopFileName = node.name; + obj.stopFileName = node.tempName; + obj.stopFileId = node.id; + obj.fileVersion = node.version; + obj.id = node.id; + obj.methodId = node.method; + obj.category = node.category; + obj.taskId = "";// 后续查询已经存在的流程手册 + treeCheckedStopArr.push(obj); + } + } + } + }); } // 获取已有的流程手册 @@ -1509,7 +1576,7 @@ function getOutputName(category, method) { return '制度手册'; } if (method == 'data.form') { - return '表单手册' + return '表单封面' } if (method.indexOf('process.') > -1) { return '流程手册';
序号流程制度变更后流程制度文件文本文件编号序号流程制度模型变更后流程制度模型文件预览文件编号
序号流程制度文件文本流程制度模型文件预览文件编号
' + s + '' + fileName + '

' + reportName +fName+ '

' + reportName + fName+'
' + fName + ''+ processNumber +'' + selectPerm + '

' + reportName + fName +'
' + reportName + fName +'' + reportName + '' + fName + '' + curr.changedNumber + '