diff --git a/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar b/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar index 2186fd16..cb973ca4 100644 Binary files a/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar and b/com.actionsoft.apps.coe.pal.output.pr/lib/com.actionsoft.apps.coe.pal.output.pr.jar differ diff --git a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java index b197a9e2..8b2e625a 100644 --- a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java +++ b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report1/Report1Gener.java @@ -320,10 +320,10 @@ public class Report1Gener { int dangerIndex = 1;// 风险序号 int regulateIndex = 1;// 控制序号 for (Map shape : repositoryFileElements) { - //如果图形元素不是流程步骤,不导出该元素 -// if (PrReportComment.PROCESS_STEP.indexOf((String)shape.get("type")) == -1 && "method_approval_node,method_service_node,method_manual_node".indexOf((String)shape.get("type")) == -1) { -// continue; -// } + //过滤导出的图形类型 + if ("method_approval_node,method_service_node,method_approval_node3,method_service_node4".indexOf((String)shape.get("type")) == -1) { + continue; + } JSONObject _tr = new JSONObject(); OutputWordUtil.setShapeDefaultValue2(repositoryId, _tr); //设置默认值 _tr.put(OutputWordUtil.SERIAL_NUMBER, index); //序号 diff --git a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report2/Report2Gener.java b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report2/Report2Gener.java index fbc4bd13..de0a8d5b 100644 --- a/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report2/Report2Gener.java +++ b/com.actionsoft.apps.coe.pal.output.pr/src/com/actionsoft/apps/coe/pal/output/pr/report2/Report2Gener.java @@ -299,10 +299,10 @@ public class Report2Gener { int dangerIndex = 1;// 风险序号 int regulateIndex = 1;// 控制序号 for (Map shape : repositoryFileElements) { - //如果图形元素不是流程步骤,不导出该元素 -// if (PrReportComment.PROCESS_STEP.indexOf((String)shape.get("type")) == -1 && "method_approval_node,method_service_node,method_manual_node".indexOf((String)shape.get("type")) == -1) { -// continue; -// } + //过滤导出的图形类型 + if ("method_approval_node,method_service_node,method_approval_node3,method_service_node4".indexOf((String)shape.get("type")) == -1) { + continue; + } JSONObject _tr = new JSONObject(); OutputWordUtil.setShapeDefaultValue2(repositoryId, _tr); //设置默认值 _tr.put(OutputWordUtil.SERIAL_NUMBER, index); //序号 diff --git a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar index 3423d624..afec35c6 100644 Binary files a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar and b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar differ diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/method/cache/PALMethodCache.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/method/cache/PALMethodCache.java index 83c56e4d..c86a42bd 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/method/cache/PALMethodCache.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/method/cache/PALMethodCache.java @@ -116,8 +116,8 @@ public class PALMethodCache { } else { List result = new ArrayList<>(); //String[] methodArray = new String[] { "process", "org", "data", "itsystem", "control" }; - String[] methodArray = new String[] { "process","data","control","org","itsystem"}; - for (String method : methodArray) { + String[] methodArrays = new String[] { "process","data","control","org","itsystem"}; + for (String method : methodArrays) { if (list.contains(method)) { result.add(method); } diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/OutPutReportWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/OutPutReportWeb.java index e8298fd9..718f346e 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/OutPutReportWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/output/OutPutReportWeb.java @@ -320,10 +320,10 @@ public class OutPutReportWeb extends ActionWeb { json.put("icon", "../apps/" + profile.getAppContext().getId() + "/img/parent16.png"); jsonArray.add(json); } - // 排序 pr or raci risk + // 排序 pr or raci risk,加入制度手册与表单手册排序 if (jsonArray != null && !jsonArray.isEmpty()) { JSONArray temp = new JSONArray(); - String [] arr = {"output_pr", "output_or", "output_raci", "output_risk"}; + String [] arr = {"output_pr", "output_or", "output_raci","output_bd","output_zd","output_risk"}; for (int i = 0; i < arr.length; i++) { for (int j = 0; j < jsonArray.size(); j++) { if (arr[i].equals(jsonArray.getJSONObject(j).getString("id"))) { diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java index 72a76f6d..7250ae72 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java @@ -38,6 +38,8 @@ import com.actionsoft.bpms.commons.mvc.view.ResponseObject; import com.actionsoft.bpms.commons.security.high.HighSecurity; import com.actionsoft.bpms.org.cache.DepartmentCache; import com.actionsoft.bpms.org.model.DepartmentModel; +import com.actionsoft.bpms.org.model.RoleModel; +import com.actionsoft.bpms.org.model.UserModel; import com.actionsoft.bpms.server.DispatcherRequest; import com.actionsoft.bpms.server.SSOUtil; import com.actionsoft.bpms.server.UserContext; @@ -100,6 +102,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import org.apache.commons.collections4.IteratorUtils; +import org.apache.commons.lang.StringUtils; /** * 资产库文件查询接口API封装 @@ -509,10 +512,7 @@ public class PALRepositoryQueryAPIManager { while (it.hasNext()) { PALRepositoryModel model = it.next(); if (model.getWsId().equals(wsId) && category.contains(model.getMethodId())) { - boolean flag = true; - if (isUse && !model.isUse()) { - flag = false; - } + boolean flag = !isUse || model.isUse(); if (isPublish && !model.isPublish()) { flag = false; } @@ -2354,7 +2354,7 @@ public class PALRepositoryQueryAPIManager { for (int i = 0; i < list.size(); i++) { PALRepositoryModel model = list.get(i); JSONObject obj = JSONObject.parseObject(model.toJson()); - String openUrl = "./w?sid=" + _uc.getSessionId() + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer_viewer" + "&uuid=" + model.getId() + "&openType=0&processDefId=" + model.getVersionId() + "&collaboration=1&teamId=&perms=v" + "&filePerms=" + filePerms.toString(); + String openUrl = "./w?sid=" + _uc.getSessionId() + "&cmd=com.actionsoft.apps.coe.pal_pl_repository_designer_viewer" + "&uuid=" + model.getId() + "&openType=0&processDefId=" + model.getVersionId() + "&collaboration=1&teamId=&perms=v" + "&filePerms=" + filePerms; obj.put("openUrl", openUrl); array.add(obj); } @@ -2633,10 +2633,7 @@ public class PALRepositoryQueryAPIManager { * @return 返回高频表中数据,按照访问量降序,若高频表数据不足,返回符合条件的无序数据 */ public List getFrequenceProcess(String wsId, String category, String methodId, int count) { - boolean hasCategory = false; - if (!UtilString.isEmpty(category)) { - hasCategory = true; - } + boolean hasCategory = !UtilString.isEmpty(category); boolean hasMehtod = false; if (!UtilString.isEmpty(hasMehtod)) { hasMehtod = true; @@ -4202,4 +4199,345 @@ public class PALRepositoryQueryAPIManager { return dirPath; } + /** + * 根据模型ID查询所有文件扩展属性 + * + * @param uuid + * @return + */ + public Map queryRepositoryAttributeById(String uuid) { + Map result = new HashMap<>(); + PALRepositoryModel plModel = PALRepositoryCache.getCache().get(uuid); + // 获取所有文件属性 + List methodAttrModels = PALRepositoryAPIManager.getInstance().getValidAndUseAttributeModels(plModel.getWsId(), plModel.getMethodId()); + if (methodAttrModels != null && methodAttrModels.size() > 0) { + Map attributeModelMap = new HashMap<>(); + Map sortAttrMap = new HashMap<>(); + if (methodAttrModels != null) { + int sort = 0; + for (PALMethodAttributeModel attr : methodAttrModels) { + attributeModelMap.put(attr.getKey(), attr); + sortAttrMap.put(attr.getKey(), ++sort); + } + } + List propertys = PALRepositoryPropertyCache.getPropertyByPlId(plModel.getId()); + // 排序 + // propertys.sort((p1, p2) -> (sortAttrMap.containsKey(p1.getPropertyId()) ? sortAttrMap.get(p1.getPropertyId()) : 0) - (sortAttrMap.containsKey(p2.getPropertyId()) ? sortAttrMap.get(p2.getPropertyId()) : 0)); + + for (PALRepositoryPropertyModel property : propertys) { + String id = property.getPropertyId(); + if (!attributeModelMap.containsKey(id) || !attributeModelMap.get(id).getUse()) { + continue; + } + PALMethodAttributeModel attributeModel = attributeModelMap.get(id); + // 记录结果集 + JSONObject attrObj = new JSONObject(); + attrObj.put("ref", attributeModel.getRef());// ref + attrObj.put("type", attributeModel.getType());// 类型 relation string ... + attrObj.put("attrId", attributeModel.getKey());// 属性key + attrObj.put("attrTitle", attributeModel.getNewTitle());// 属性标题 + attrObj.put("text", "");// 属性内容单行文本 + attrObj.put("value", new JSONArray());// 属性内容集,relation或awsorg类型时存储对应的json数据 + String inputValue = property.getPropertyValue(); + if ("relation".equals(attributeModel.getType())) { + List inputValueList = new ArrayList<>(); + List list = DesignerShapeRelationCache.getListByAttrId(plModel.getId(), "", attributeModel.getKey()); + if (list != null && list.size() > 0) { + // 判断是否有重复数据,进行重复过滤 + Set tempStrs = new HashSet<>(); + List tempList = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + DesignerShapeRelationModel model = list.get(i); + String str = model.getFileId() + model.getShapeId() + model.getAttrId() + model.getRelationFileId() + model.getRelationShapeId(); + if (!tempStrs.contains(str)) { + tempList.add(model); + tempStrs.add(str); + } + } + list = tempList; + for (int i = 0; i < list.size(); i++) { + DesignerShapeRelationModel model = list.get(i); + JSONObject refObj = JSONObject.parseObject(attributeModel.getRef()); + String relationTyp = refObj.containsKey("type") ? refObj.getString("type") : "shape"; + if ("file".equals(relationTyp)) {// 关联的模型文件 + if (model.getRelationFileId().length() < 36) { + continue; + } + List list2 = PALRepositoryCache.getByVersionId(plModel.getWsId(), model.getRelationFileId()); + for (PALRepositoryModel model2 : list2) { + if (model2.isUse()) { + inputValueList.add(model2.getName()); + JSONObject tmp = new JSONObject(); + tmp.put("fileId", model2.getId()); + tmp.put("name", model2.getName()); + tmp.put("isFile", true); + attrObj.getJSONArray("value").add(tmp); + break; + } + } + } else { + inputValueList.add(model.getRelationShapeText()); + JSONObject tmp = new JSONObject(); + tmp.put("fileId", model.getRelationFileId()); + tmp.put("shapeId", model.getRelationShapeId()); + tmp.put("name", model.getRelationShapeText()); + tmp.put("isFile", false); + attrObj.getJSONArray("value").add(tmp); + } + } + } + inputValue = StringUtils.join(inputValueList, ","); + } + // 关联bpm组织架构 + if ("awsorg".equals(attributeModel.getType())) { + List list = DesignerShapeRelationCache.getListByAttrId(plModel.getId(), "", attributeModel.getKey()); + List deptValList = new ArrayList<>(); + List positionValList = new ArrayList<>(); + List roleValList = new ArrayList<>(); + List userValList = new ArrayList<>(); + if (list != null && list.size() > 0) { + Set filter = new HashSet();// 去重记录 + list.sort((m1, m2) -> { + return m1.getId().compareTo(m2.getId()); + }); + for (DesignerShapeRelationModel model : list) { + if ("00000000-0000-0000-0000-000000000000".equals(model.getRelationFileId()) && "00000000-0000-0000-0000-000000000000".equals(model.getRelationShapeId())) { + JSONObject object = JSONObject.parseObject(model.getRelationShapeText()); + boolean flag = false; + // 查询最新名称 + if ("department".equals(object.getString("type"))) { + DepartmentModel dept = SDK.getORGAPI().getDepartmentById(object.getString("id")); + if (dept != null && !filter.contains(dept.getId())) { + deptValList.add(dept.getName()); + filter.add(dept.getId()); + flag = true; + } + } + if ("position".equals(object.getString("type"))) {// 岗位,先用角色代替 + RoleModel role = SDK.getORGAPI().getRoleById(object.getString("id")); + if (role != null && !filter.contains(role.getId())) { + positionValList.add(role.getName()); + filter.add(role.getId()); + flag = true; + } + } + if ("user".equals(object.getString("type"))) { + UserModel user = SDK.getORGAPI().getUser(object.getString("id")); + if (user != null && !filter.contains(user.getUID())) { + userValList.add(user.getUserName()); + filter.add(user.getUID()); + flag = true; + } + } + if ("role".equals(object.getString("type"))) { + RoleModel role = SDK.getORGAPI().getRoleById(object.getString("id")); + if (role != null && !filter.contains(role.getId())) { + roleValList.add(role.getName()); + filter.add(role.getId()); + flag = true; + } + } + if (flag) { + attrObj.getJSONArray("value").add(object); + } + } + } + } + // 数据组合 + deptValList.addAll(positionValList); + deptValList.addAll(roleValList); + deptValList.addAll(userValList); + inputValue = StringUtils.join(deptValList, ","); + + } + inputValue = inputValue.replaceAll("'", "'"); + inputValue = inputValue.replaceAll("\"", """); + attrObj.put("text", inputValue); + result.put(attributeModel.getKey(), attrObj); + } + } + return result; + } + + + /** + * 根据模型和形状查询所有形状扩展属性 + * + * @param uuid + * @param shapeId + * @param shapeObject 当前节点的定义json,可以通过PALRepositoryQueryAPIManager.getInstance().getProcessDefinition获取string--》转换JSONObject--》获取elements--》elements.getJSONObject(shapeId)得到 + * @param separator 分隔符,不清楚作用请给null或"" + * @return + */ + public Map queryRepositoryShapeAttributeById(String uuid, String shapeId, JSONObject shapeObject, String separator) { + separator = UtilString.isEmpty(separator) ? "," : separator; + Map result = new HashMap<>(); + PALRepositoryModel model = PALRepositoryCache.getCache().get(uuid); + String methodId = model.getMethodId(); + String wsId = model.getWsId(); + JSONObject dataAttributes = ShapeUtil.getCustom(shapeObject.getJSONArray("dataAttributes")); + JSONArray attributesJsonArray = dataAttributes.containsKey("attributesJsonArray") ? dataAttributes.getJSONArray("attributesJsonArray") : new JSONArray(); //扩展属性 + // 查询属性数据集合 + Map attrDataMap = new HashMap<>(); + for (Object obj : attributesJsonArray) { + if (obj == null) { + continue; //删除的节点不存在 + } + JSONObject jsonObj = (JSONObject) obj; + if (!jsonObj.containsKey("groupPath") || UtilString.isEmpty(jsonObj.getString("groupPath"))) { + continue; //排除组 + } + if (!jsonObj.containsKey("type") || UtilString.isEmpty(jsonObj.getString("type"))) { + continue; //排除无type的 + } + attrDataMap.put(jsonObj.getString("key"), jsonObj); + } + // 获取形状的属性配置(有效且使用中) + List methodAttrModels = CoeDesignerShapeAPIManager.getInstance().getValidAndUseAttributeModels(wsId, methodId, shapeObject.getString("name"), methodId); + for (PALMethodAttributeModel attributeModel : methodAttrModels) { + // 记录结果集 + JSONObject attrObj = new JSONObject(); + attrObj.put("ref", attributeModel.getRef());// ref + attrObj.put("type", attributeModel.getType());// 类型 relation string ... + attrObj.put("attrId", attributeModel.getKey());// 属性key + attrObj.put("attrTitle", attributeModel.getNewTitle());// 属性标题 + attrObj.put("text", "");// 属性内容单行文本 + attrObj.put("value", new JSONArray());// 属性内容集,relation或awsorg类型时存储对应的json数据 + + String key = attributeModel.getKey(); + String attrValue = ""; + if (attrDataMap.containsKey(key)) { + JSONObject jsonObj = attrDataMap.get(key); + String type = attributeModel.getType(); + if ("string".equals(type)) { + attrValue = jsonObj.containsKey("value") ? jsonObj.getString("value") : ""; + } else if ("number".equals(type)) { + attrValue = jsonObj.containsKey("value") ? jsonObj.getString("value") : ""; + } else if ("textarea".equals(type)) { + attrValue = jsonObj.containsKey("value") ? jsonObj.getString("value") : ""; + } else if ("boolean".equals(type)) { + attrValue = jsonObj.containsKey("value") ? jsonObj.getString("value") : ""; + } else if ("select".equals(type)) { + attrValue = jsonObj.containsKey("value") ? jsonObj.getString("value") : ""; + } else if ("select_m".equals(type)) { + attrValue = jsonObj.containsKey("value") ? jsonObj.getString("value") : ""; + String[] values = attrValue.split(","); + List valueList = new ArrayList<>(); + for (int i = 0; i < values.length; i++) { + if (!UtilString.isEmpty(values[i])) { + valueList.add(values[i]); + } + } + attrValue = StringUtils.join(valueList, separator); + } else if ("relation".equals(type)) { + List inputValues = new ArrayList<>(); + JSONObject refObj = JSONObject.parseObject(attributeModel.getRef()); + String relationType = refObj.containsKey("type") ? refObj.getString("type") : "shape"; + List list = DesignerShapeRelationCache.getListByAttrId(uuid, shapeId, key); + if (list != null && list.size() > 0) { + // 判断是否有重复数据,进行重复过滤 + Set tempStrs = new HashSet<>(); + List tempList = new ArrayList<>(); + for (int i = 0; i < list.size(); i++) { + DesignerShapeRelationModel relationModel = list.get(i); + String str = relationModel.getFileId() + relationModel.getShapeId() + relationModel.getAttrId() + relationModel.getRelationFileId() + relationModel.getRelationShapeId(); + if (!tempStrs.contains(str)) { + tempList.add(relationModel); + tempStrs.add(str); + } + } + list = tempList; + for (int i = 0; i < list.size(); i++) { + DesignerShapeRelationModel relationModel = list.get(i); + if ("file".equals(relationType)) {// 文件属性 + String versionId = UtilString.isEmpty(relationModel.getRelationShapeId()) ? relationModel.getRelationFileId() : relationModel.getRelationShapeId(); + if (!UtilString.isEmpty(versionId)) { + List list2 = PALRepositoryCache.getByVersionId(wsId, versionId); + for (PALRepositoryModel model2 : list2) { + if (model2.isUse()) { + inputValues.add(model2.getName()); + JSONObject tmp = new JSONObject(); + tmp.put("fileId", model2.getId()); + tmp.put("name", model2.getName()); + tmp.put("isFile", true); + attrObj.getJSONArray("value").add(tmp); + break; + } + } + } + } else {// 形状属性 + inputValues.add(relationModel.getRelationShapeText()); + JSONObject tmp = new JSONObject(); + tmp.put("fileId", relationModel.getRelationFileId()); + tmp.put("shapeId", relationModel.getRelationShapeId()); + tmp.put("name", relationModel.getRelationShapeText()); + tmp.put("isFile", false); + attrObj.getJSONArray("value").add(tmp); + } + } + } + attrValue = StringUtils.join(inputValues, separator); + } else if ("awsorg".equals(type)) {// 关联bpm组织架构 + List list = DesignerShapeRelationCache.getListByAttrId(uuid, shapeId, key); + List awsOrgResultList = new ArrayList<>(); + List deptValueList = new ArrayList<>(); + List positionValueList = new ArrayList<>(); + List userValueList = new ArrayList<>(); + List roleValueList = new ArrayList<>(); + if (list != null && list.size() > 0) { + for (DesignerShapeRelationModel relationModel : list) { + JSONObject object = JSONObject.parseObject(relationModel.getRelationShapeText()); + String orgType = object.getString("type"); + String keyId = object.getString("id"); + boolean flag = false; + if ("department".equals(orgType)) {// 部门 + DepartmentModel deptModel = SDK.getORGAPI().getDepartmentById(keyId); + if (deptModel != null) { + deptValueList.add(deptModel.getName()); + flag = true; + } + } + if ("position".equals(orgType)) {// 岗位 + RoleModel roleModel = SDK.getORGAPI().getRoleById(keyId); + if (roleModel != null) { + positionValueList.add(roleModel.getName()); + flag = true; + } + } + if ("user".equals(orgType)) {// 人员 + UserModel userModel = SDK.getORGAPI().getUser(keyId); + if (userModel != null) { + userValueList.add(userModel.getUserName()); + flag = true; + } + } + if ("role".equals(orgType)) {// 角色 + RoleModel roleModel = SDK.getORGAPI().getRoleById(keyId); + if (roleModel != null) { + roleValueList.add(roleModel.getName()); + flag = true; + } + } + if (flag) { + attrObj.getJSONArray("value").add(object); + } + } + } + awsOrgResultList.addAll(deptValueList); + awsOrgResultList.addAll(positionValueList); + awsOrgResultList.addAll(roleValueList); + awsOrgResultList.addAll(userValueList); + attrValue = StringUtils.join(awsOrgResultList, separator); + } else { + attrValue = jsonObj.containsKey("value") ? jsonObj.getString("value") : ""; + } + } + attrValue = attrValue.replaceAll("'", "'"); + attrValue = attrValue.replaceAll("\"", """); + attrObj.put("text", attrValue); + result.put(attributeModel.getKey(), attrObj); + } + return result; + } + } diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/relation/web/DesignerRelationShapeWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/relation/web/DesignerRelationShapeWeb.java index 6ff9bd54..98936f61 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/relation/web/DesignerRelationShapeWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/relation/web/DesignerRelationShapeWeb.java @@ -754,7 +754,8 @@ public class DesignerRelationShapeWeb extends ActionWeb { // macroLibraries.put("treeData", getTreeJson(wsId, "", category, type, method)); // by bzp - String treeJson=getTreeJson(wsId, "", category, type, method,ruuid); + String treeJson=getTreeJson(wsId, "", category, type, method,ruuid,attrId); + //JSONObject jsonObject = JSONObject.parseObject(json); JSONArray jsonArr_new= new JSONArray(); @@ -842,10 +843,10 @@ public class DesignerRelationShapeWeb extends ActionWeb { return HtmlPageTemplate.merge(CoEConstant.APP_ID, "pal.pl.repository.designer.shapes.htm", macroLibraries); } - public String getTreeJson(String wsId, String pid, String category, String type, String method, String ruuid) { + public String getTreeJson(String wsId, String pid, String category, String type, String method, String ruuid,String attrId) { StringBuffer treeJson = new StringBuffer(); if (pid.equals("")) { - return getRootJson(wsId, category, type, method,ruuid); // 加载根 + return getRootJson(wsId, category, type, method,ruuid,attrId); // 加载根 } // 加载二级 // treeJson.append(getTwoNodeJson(pid, wsId)); @@ -855,6 +856,9 @@ public class DesignerRelationShapeWeb extends ActionWeb { return treeJson.toString(); } + + + /** * 获取第二级及其以下目录 * by bzp 增加method方法 判断 @@ -875,7 +879,7 @@ public class DesignerRelationShapeWeb extends ActionWeb { return jsonArray.toString(); } - protected String getRootJson(String wsuuid, String category, String type, String methodScope,String ruuid) { + protected String getRootJson(String wsuuid, String category, String type, String methodScope,String ruuid,String attrId) { JSONArray jsonArray = new JSONArray(); if ("file".equals(type)) {// 关联的文件模型 PALMethodJsonModel processpmjm = new PALMethodJsonModel(); @@ -912,7 +916,8 @@ public class DesignerRelationShapeWeb extends ActionWeb { } jsonArray.add(node); } - } else {// 关联的形状节点 + } else { + // 关联的形状节点 PALMethodJsonModel controlpmjm = new PALMethodJsonModel(); controlpmjm.setId(category); controlpmjm.setName(I18nRes.findValue(CoEConstant.APP_ID, category)); @@ -921,6 +926,29 @@ public class DesignerRelationShapeWeb extends ActionWeb { controlpmjm.setMenu(false); controlpmjm.setOpen(true); jsonArray.add(controlpmjm); + + if(attrId.equals("R_relevant_flies")||attrId.equals("support_files")){ + PALMethodJsonModel controlpmjm1 = new PALMethodJsonModel(); + controlpmjm1.setId("process"); + controlpmjm1.setName(I18nRes.findValue(CoEConstant.APP_ID, "process")); + controlpmjm1.setUrl(""); + controlpmjm1.setIcon("../apps/" + CoEConstant.APP_ID + "/img/method/" + "process" + ".png"); + controlpmjm1.setMenu(false); + controlpmjm1.setOpen(true); + jsonArray.add(controlpmjm1); + + + PALMethodJsonModel controlpmjm2 = new PALMethodJsonModel(); + controlpmjm2.setId("control"); + controlpmjm2.setName(I18nRes.findValue(CoEConstant.APP_ID, "control")); + controlpmjm2.setUrl(""); + controlpmjm2.setIcon("../apps/" + CoEConstant.APP_ID + "/img/method/" + "control" + ".png"); + controlpmjm2.setMenu(false); + controlpmjm2.setOpen(true); + jsonArray.add(controlpmjm2); + } + + JSONArray nodes = PALRepositoryQueryAPIManager.getInstance().getUsedPalRepositoryTreeDataByPid(_uc, wsuuid, controlpmjm.getId()); for (int i = 0; i < nodes.size(); i++) { JSONObject node = nodes.getJSONObject(i); @@ -946,6 +974,9 @@ public class DesignerRelationShapeWeb extends ActionWeb { return jsonArray.toString(); } + + + /** * 关联属性快速搜索 * @param wsId diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java index 9f8c1da0..b880f510 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/designer/web/CoeDesignerWeb.java @@ -8,17 +8,8 @@ import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; import java.sql.Timestamp; import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Date; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.Map.Entry; -import java.util.Set; import javax.imageio.ImageIO; @@ -163,7 +154,7 @@ import com.google.common.collect.Maps; public class CoeDesignerWeb extends ActionWeb { private static final long serialVersionUID = 1L; - private UserContext _uc; + private final UserContext _uc; private CoeProcessLevelWeb coeProcessLevelWeb; public CoeDesignerWeb(UserContext uc) { @@ -499,14 +490,9 @@ public class CoeDesignerWeb extends ActionWeb { DesignerRelationShapeCacheManager relationShapeCache = DesignerRelationShapeCacheManager.getInstance(); Map> shapeMap = relationShapeCache.getShapemap(); - boolean isExistCopy = false; - if (shapeMap.get(_uc.getUID()) != null) { - isExistCopy = true; - } - boolean isAppearCopy = true; - if (shapeMap.get(_uc.getUID()) != null && shapeMap.get(_uc.getUID()).get("shapeCopyContent") != null) { - isAppearCopy = false;// 默认为定义复制 - } + boolean isExistCopy = shapeMap.get(_uc.getUID()) != null; + boolean isAppearCopy = shapeMap.get(_uc.getUID()) == null || shapeMap.get(_uc.getUID()).get("shapeCopyContent") == null; + // 默认为定义复制 macroLibraries.put("isExistCopy", isExistCopy); macroLibraries.put("isAppearCopy", isAppearCopy); // 如果流程只读,获取流程图片信息 @@ -565,25 +551,38 @@ public class CoeDesignerWeb extends ActionWeb { macroLibraries.put("processOnIsActive", processOnIsActive); JSONObject relationShapeIds = new JSONObject(); JSONObject relationShapeModels = new JSONObject(); - List> elements = CoeDesignerUtil.getShapeMessageJson(plModel.getId()); - if (elements != null && elements.size() > 0) { - for (Map element : elements) { - String elementId = element.containsKey("id") ? element.get("id").toString() : ""; - if (!UtilString.isEmpty(elementId)) { - Iterator modelIterator = DesignerShapeRelationCache.getByShapeId(plModel.getId(), elementId); - if (modelIterator != null) { - while (modelIterator.hasNext()) { - DesignerShapeRelationModel shapeRelationModel = modelIterator.next(); - PALRepositoryModel relationPalModel = PALRepositoryCache.getCache().get(shapeRelationModel.getRelationFileId()); - if (relationPalModel != null) { - relationShapeIds.put(shapeRelationModel.getRelationShapeId(), shapeRelationModel); - relationShapeModels.put(shapeRelationModel.getShapeId() + "_" + shapeRelationModel.getAttrId(), shapeRelationModel.getRelationShapeText()); - } - } + + + + String define = PALRepositoryQueryAPIManager.getInstance().getProcessDefinition(_uc, plModel.getId()); + JSONObject definition = JSONObject.parseObject(define); + JSONObject elements = definition.getJSONObject("elements"); + for (String id: elements.keySet()) { + JSONObject shapeObj = elements.getJSONObject(id); + String name = shapeObj.getString("name"); + if ("linker".equals(name)) { + continue; + } + Iterator modelIterator = DesignerShapeRelationCache.getByShapeId(plModel.getId(), id); + if (modelIterator != null) { + while (modelIterator.hasNext()) { + DesignerShapeRelationModel shapeRelationModel = modelIterator.next(); + PALRepositoryModel relationPalModel = PALRepositoryCache.getCache().get(shapeRelationModel.getRelationFileId()); + if (relationPalModel != null) { + relationShapeIds.put(shapeRelationModel.getRelationShapeId(), shapeRelationModel); } } } + Map map = PALRepositoryQueryAPIManager.getInstance().queryRepositoryShapeAttributeById(plModel.getId(), id, shapeObj, "|"); + for (Entry entry : map.entrySet()) { + JSONObject object = entry.getValue(); + if (object == null || object.isEmpty()) { + continue; + } + relationShapeModels.put(id + "_" + entry.getKey(), Arrays.asList(object.getString("text").split("\\|"))); + } } + macroLibraries.put("relationShapes", relationShapeIds); macroLibraries.put("relationShapeModels", relationShapeModels); @@ -2197,10 +2196,7 @@ public class CoeDesignerWeb extends ActionWeb { StringBuffer shapes = new StringBuffer(); List cateList = PALMethodUtil.distinct(categories); CoeUserModel userModel = (CoeUserModel) CoeUserDaoFactory.createUser().getInstanceByUserId(_uc.getUID()); - boolean isAdmin = false; - if (userModel != null && userModel.getIsAdmin() == 1) { - isAdmin = true; - } + boolean isAdmin = userModel != null && userModel.getIsAdmin() == 1; PALMethodModel mModel = PALMethodCache.getPALMethodModelById(methodId); // 是否允许用户自定义模板,0:不允许;1:允许。 @@ -2996,14 +2992,9 @@ public class CoeDesignerWeb extends ActionWeb { macroLibraries.put("userNum", ""); DesignerRelationShapeCacheManager relationShapeCache = DesignerRelationShapeCacheManager.getInstance(); Map> shapeMap = relationShapeCache.getShapemap(); - boolean isExistCopy = false; - if (shapeMap.get(_uc.getUID()) != null) { - isExistCopy = true; - } - boolean isAppearCopy = true; - if (shapeMap.get(_uc.getUID()) != null && shapeMap.get(_uc.getUID()).get("shapeCopyContent") != null) { - isAppearCopy = false;// 默认为定义复制 - } + boolean isExistCopy = shapeMap.get(_uc.getUID()) != null; + boolean isAppearCopy = shapeMap.get(_uc.getUID()) == null || shapeMap.get(_uc.getUID()).get("shapeCopyContent") == null; + // 默认为定义复制 macroLibraries.put("isExistCopy", isExistCopy); macroLibraries.put("isAppearCopy", isAppearCopy); diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java index b7c96599..9fa91fd1 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/web/CoeProcessLevelWeb.java @@ -7842,7 +7842,7 @@ public class CoeProcessLevelWeb extends ActionWeb { folderArr.add(defaultObj); } - // 内置/扩展建模方法 修改 + // 内置/扩展建模方法 List palMethodCategoryList = PALMethodCache.getPALMethodList(true); for (String c : palMethodCategoryList) { List list = PALMethodCache.getPALMethodModelListByMethod(c); @@ -8146,7 +8146,7 @@ public class CoeProcessLevelWeb extends ActionWeb { // } } // 保存文件属性 - //PALRepositoryAPIManager.getInstance().updateRepositoryProperty(model.getId()); + PALRepositoryAPIManager.getInstance().updateRepositoryProperty(model.getId()); JSONArray repositoryPathData = CoeProcessLevelUtil.getRepositoryPath(parentId); diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js index 724701b8..dd612dd2 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js @@ -443,7 +443,7 @@ function handleMovePool(lanes, selectedShape, allShape, isForce) { } } if (isCurLane) { - return; + } else { //对在泳池中泳道内形状的处理 for (var k = 0; tmpLanes.length > k; k++) { @@ -535,7 +535,7 @@ function handleShapeAttrValue(lane, shapes, timerCount, isForce) { if (shapeAttrsJsonArray[k].id == attr.id) { flag = true; tmpShapeAttrJson = shapeAttrsJsonArray[k]; - continue; + } } //shapes中已经存在了lane中的属性 @@ -624,7 +624,7 @@ function handleLaneTextValue(lane) { for (var i = 0; i < attributesJsonArray.length; i++) { var attr = attributesJsonArray[i] if (attr.value == undefined || attr.value == "" || attr.value == null) { - continue; + } else { if (attr.type == "relation") { //flag是用于防止多次查询同样的值导致数据重复 @@ -808,12 +808,14 @@ function operateAwsorgDB(shapesObj, shapeId, shapeText, attrId, shapeAttrJson) { getPrivateAttributeHtml(tmpAttributesJsonArray, "tagContentTable0", tmpShape); } function operateDB(shapesObj, shapeId, attrId, shapeAttrJson) { + debugger; //添加关联属性时,更新relationShapeModelObject的值 + var tmp = shapeId + '_' + attrId; + relationShapeModelObject[tmp] = []; if (shapesObj.length > 0) { for (var i = 0; i < shapesObj.length; i++) { var temp = shapesObj[i]; - var shapeIdAttrId = temp.shapeId + "_" + temp.attrId; - relationShapeModelObject[shapeIdAttrId] = temp.relationShapeText; + relationShapeModelObject[tmp].push(temp.relationShapeText); } } var shapeGroupId = ""; @@ -1405,7 +1407,7 @@ var DesignerCopyPaste = { if (typeof(a[v]) == 'undefined') { a[v] = 1; } - }; + } data.length = 0; for (var i in a) { data[data.length] = i; diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.js index 9828f035..6969d304 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.link.js @@ -216,10 +216,10 @@ UI.showInsertLink = function() { } } if (!addr) { - addr = new Array(); + addr = []; } - var links_file = new Array(); - var links_custom = new Array(); + var links_file = []; + var links_custom = []; for (var i = 0; i < addr.length; i++) { var link = addr[i]; if (link.type == "file") { @@ -669,7 +669,7 @@ UI.setLink = function() { for (var i = 0; i < shape.dataAttributes.length; i++) { var attr = shape.dataAttributes[i]; if (attr.linksArray) { - linkArr = new Array(); + linkArr = []; break; } } @@ -1670,7 +1670,7 @@ function removeTrRelevanceShapes(obj) { onConfirm : function() { // 确定删除 var shape = Utils.getSelected()[0]; - var tempArray = new Array(); + var tempArray = []; var count = 0; if (shape) { var relevanceShapes = []; @@ -1788,7 +1788,7 @@ function updateModelElementsAttribute(selectedShape, nodes) { } if (arrJsontemp.length != 0) { var tempArr = removeShepeAttributeAndReturnDifferent(arrJsontemp, filterNotCheckedAttribute(nodes, arrJsontemp)); - var tempArray = new Array(); + var tempArray = []; for (var e = 0; e < tempArr.length; e++) { if (tempArr[e] != 0 && tempArr[e] != "0") { removeNotCheckedAttribute(shape, tempArr[e]); @@ -1877,7 +1877,7 @@ function removeShepeAttributeAndReturnDifferent(exitObj, newObj1) { // 删除没有选中的元素 function removeNotCheckedAttribute(shape, obj1) { - var tempArray = new Array(); + var tempArray = []; var attributesJsonArray1 = []; for (var i = 0; i < shape.dataAttributes.length; i++) { var attr = shape.dataAttributes[i]; @@ -2163,7 +2163,7 @@ function updateAttributeById(objId, va, shapeId) { shape = Utils.getSelected()[0]; selectShape = shape; } - var tempArray = new Array(); + var tempArray = []; var count = 0; if (shape) { /* @@ -2220,7 +2220,7 @@ function removeTrAttribute(obj) { onConfirm : function() { // 确定删除 var shape = Utils.getSelected()[0]; - var tempArray = new Array(); + var tempArray = []; var count = 0; if (shape) { // shape.attributesContent = $("#tagContentTable0").html(); @@ -2847,7 +2847,7 @@ function changeArributeByShape() { var newAttrArray = []; newAttrArray = tempAttrArray.concat(attributesJsonArrayT).filter(function(v, i, arr) { return arr.indexOf(v) === arr.lastIndexOf(v); - });; + }); attributesJsonArrayT = tempAttrArray.concat(newAttrArray); } } @@ -3328,7 +3328,7 @@ function saveRelevanceAwsOrgShapesTODB1(shapesObj, shapeId, shapeName, fileName, relationShapeIds = relationShapeIds.split(","); } //修改文件中保存的属性值 - var tempArray = new Array(); + var tempArray = []; var count = 0; var attributesJsonArray = []; for (var i = 0; i < shape.dataAttributes.length; i++) { @@ -3355,6 +3355,7 @@ function saveRelevanceAwsOrgShapesTODB1(shapesObj, shapeId, shapeName, fileName, break; } } + relationShapeModelObject[shapeId + "_" + objId] = name; } Model.update(shape); } @@ -3715,11 +3716,12 @@ function saveRelevanceShapesTODB(shapesObj, shapeId, shapeName, fileName, $("input[objid='" + objId + "']").addClass("required_input_css"); return; } + var tmp = shapeId + '_' + objId; + relationShapeModelObject[tmp] = []; if (shapesObj.length > 0) { for (var i = 0; i < shapesObj.length; i++) { var temp = shapesObj[i]; - var shapeIdAttrId = temp.shapeId + "_" + temp.attrId; - relationShapeModelObject[shapeIdAttrId] = temp.relationShapeText; + relationShapeModelObject[tmp].push(temp.relationShapeText); } } //by bzp 校验角色和岗位不能同时选择 @@ -3790,7 +3792,7 @@ function saveRelevanceShapesTODB(shapesObj, shapeId, shapeName, fileName, // $("input[objid='" + objId + "']").val(shapeNames.join(",")); // } //修改文件中保存的属性值 - var tempArray = new Array(); + var tempArray = []; var count = 0; var attributesJsonArray = []; for (var i = 0; i < shape.dataAttributes.length; i++) { diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.core.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.core.js index 438ca53b..6c7ae0eb 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.core.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.core.js @@ -3985,28 +3985,20 @@ var Designer = { if (temp.isShowAttrName && attrTypeArray.indexOf(attrType) >= 0 && (cfgContent + '').trim().length > 0) { cfgContent = "(" + temp.attrName + ")" +cfgContent; } - if (attrType == "relation" && cfgContent.length == 0) { - cfgContent = ""; - } else if (attrType == "relation" && cfgContent.length > 0) { + if (attrType == 'relation' || attrType == 'awsorg') { var shapeIdAttrId = q.id + "_" + attrId; var relationData = relationShapeModelObject; var relationValue = ""; - for (var j = 0; j < cfgContent.length; j++) { - if (j == cfgContent.length - 1) { - if (relationData.hasOwnProperty(shapeIdAttrId)) { - var tempRelationValue = relationData[shapeIdAttrId]; - relationValue = relationValue + tempRelationValue; - } - } else if (relationData.hasOwnProperty(shapeIdAttrId)) { - var tempRelationValue = relationData[shapeIdAttrId] + "|"; - relationValue = relationValue + tempRelationValue; - } + if (relationData[shapeIdAttrId]) { + cfgContent = relationData[shapeIdAttrId].join(","); + } else { + cfgContent = ""; } - cfgContent = relationValue; if (temp.isShowAttrName) { cfgContent = "(" + temp.attrName + ")" + cfgContent; } } + params.showType = "attr"; params.value = cfgContent; } @@ -4691,10 +4683,10 @@ var Designer = { var tempL = (v + 1) * tempShapeWidth; var tempX = 0; if (c.showType == "text") { - b.fillStyle = "#A1A1A1"; + b.fillStyle = "#696969"; } if (c.showType == "attr") { - b.fillStyle = "#6666FF"; + b.fillStyle = "#191970"; } var tempY = a / 2 + v * 12; if (tempL < D) {