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 7340c19f..04432fef 100644 Binary files a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar and b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar differ diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/PALRepositoryQueryAPIManager.java index 9c00b53b..0ba88895 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 @@ -6,15 +6,7 @@ import java.io.IOException; import java.io.UnsupportedEncodingException; import java.lang.reflect.Field; import java.nio.charset.StandardCharsets; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import com.actionsoft.apps.coe.pal.cooperation.CoeCooperationAPIManager; import com.actionsoft.apps.coe.pal.log.CoEOpLogAPI; @@ -95,6 +87,7 @@ import com.actionsoft.apps.coe.pal.pal.repository.util.CoeProcessLevelUtil; import com.actionsoft.apps.coe.pal.pal.ws.dao.CoeWorkSpace; import com.actionsoft.apps.coe.pal.pal.ws.web.VersionUtil; import com.actionsoft.apps.coe.pal.util.StringHandleUtil; +import com.actionsoft.bpms.util.Base64; import com.actionsoft.exception.AWSException; import com.actionsoft.i18n.I18nRes; import com.actionsoft.sdk.local.SDK; @@ -5430,6 +5423,9 @@ public class PALRepositoryQueryAPIManager { if ("relation".equals(attributeModel.getType())) { List inputValueList = new ArrayList<>(); List list = DesignerShapeRelationCache.getListByAttrId(plModel.getId(), "", attributeModel.getKey()); + if(attributeModel.getKey().equals("support_files")){ + list.sort(Comparator.comparing(DesignerShapeRelationModel::getRelationShapeText)); + } if (list != null && list.size() > 0) { // 判断是否有重复数据,进行重复过滤 Set tempStrs = new HashSet<>(); @@ -5504,8 +5500,11 @@ public class PALRepositoryQueryAPIManager { List positionValList = new ArrayList<>(); List roleValList = new ArrayList<>(); List userValList = new ArrayList<>(); + + JSONArray depjsonArray=new JSONArray(); if (list != null && list.size() > 0) { Set filter = new HashSet();// 去重记录 + list.sort((m1, m2) -> { return m1.getId().compareTo(m2.getId()); }); @@ -5514,14 +5513,31 @@ public class PALRepositoryQueryAPIManager { JSONObject object = JSONObject.parseObject(model.getRelationShapeText()); boolean flag = false; // 查询最新名称 - if ("department".equals(object.getString("type"))) { + /*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 ("department".equals(object.getString("type"))) { + DepartmentModel dept = SDK.getORGAPI().getDepartmentById(object.getString("id")); + if (dept != null && !filter.contains(dept.getId())) { + if(object.getString("timestamp")!=null){ + flag = false; + depjsonArray.add(object); + }else{ + 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())) { @@ -5549,6 +5565,22 @@ public class PALRepositoryQueryAPIManager { if (flag) { attrObj.getJSONArray("value").add(object); } + + } + } + + /*********************************自定义排序*******************************/ + if(depjsonArray.size()>0 && depjsonArray.getJSONObject(0).getString("timestamp")!=null){ + Set filter1 = new HashSet();// 去重记录 + depjsonArray.sort(Comparator.comparing(st ->((JSONObject)st).getString("timestamp"))); + JSONObject jo = new JSONObject(new LinkedHashMap()); + for(int b=0;b list = dao.getModelListByShapeIdAndRelationShapeId(ruuid, shapeId, null, tmpStr); + if(attrId.equals("support_files")){ + list.sort(Comparator.comparing(DesignerShapeRelationModel::getRelationShapeText)); + } for (DesignerShapeRelationModel model : list) { if (ids.contains(model.getRelationFileId())) { continue; @@ -994,6 +989,7 @@ public class DesignerRelationShapeWeb extends ActionWeb { } else {// 关联形状 Set ids = new HashSet<>(); List list = dao.getModelListByShapeIdAndRelationShapeId(ruuid, shapeId, relationShapeIds, null); + for (DesignerShapeRelationModel model : list) { if (ids.contains(model.getRelationShapeId()) && !"shapeAndFile".equals(type)) { continue; @@ -2633,6 +2629,7 @@ public class DesignerRelationShapeWeb extends ActionWeb { treeData.add(role); } + JSONArray depjsonArray=new JSONArray(); // 获取已保存数据 JSONObject o = new JSONObject(); Iterator modelIterator = DesignerShapeRelationCache.getByAttrId(fileId, shapeId, attrId); @@ -2644,13 +2641,22 @@ public class DesignerRelationShapeWeb extends ActionWeb { JSONObject object = JSONObject.parseObject(model.getRelationShapeText()); boolean flag = false; // 查询最新名称 - if (scope.contains("department") && "department".equals(object.getString("type"))) { + /*if (scope.contains("department") && "department".equals(object.getString("type"))) { DepartmentModel dept = SDK.getORGAPI().getDepartmentById(object.getString("id")); if (dept != null && !filter.contains(dept.getId())) { flag = true; object.put("name", dept.getName()); filter.add(dept.getId()); } + }*/ + + //使用自定义排序规则 + if (scope.contains("department") && "department".equals(object.getString("type"))) { + DepartmentModel dept = SDK.getORGAPI().getDepartmentById(object.getString("id")); + if (dept != null && !filter.contains(dept.getId())) { + flag = true; + depjsonArray.add(object); + } } if (scope.contains("user") && "user".equals(object.getString("type"))) { UserModel user = SDK.getORGAPI().getUser(object.getString("id")); @@ -2682,8 +2688,22 @@ public class DesignerRelationShapeWeb extends ActionWeb { } } } + map.put("treeData", treeData); - map.put("checkedList", o); + + /******************************自定义排序******************************************************/ + if(depjsonArray.size()>0 && depjsonArray.getJSONObject(0).getString("timestamp")!=null){ + depjsonArray.sort(Comparator.comparing(st ->((JSONObject)st).getString("timestamp"))); + JSONObject jo = new JSONObject(new LinkedHashMap()); + for(int b=0;b list = DesignerShapeRelationCache.getListByAttrId(uuid, "", attributeModel.getKey()); + + //如果类型为支持文件根据时间戳排序 + if(attributeModel.getKey().equals("support_files")){ + list.sort(Comparator.comparing(DesignerShapeRelationModel::getRelationShapeText)); + } + if (list != null && list.size() > 0) { // 判断是否有重复数据,进行重复过滤 Set tempStrs = new HashSet<>(); @@ -2579,62 +2586,40 @@ public class CoeProcessLevelWeb extends ActionWeb { } // 关联bpm组织架构 JSONArray dataArr = new JSONArray(); + JSONArray depjsonArray=new JSONArray(); if ("awsorg".equals(attributeModel.getType())) { List list = DesignerShapeRelationCache.getListByAttrId(uuid, "", attributeModel.getKey()); - - if(list.size()>0){ - - for(int b=0;b list2=new ArrayList(); - - - - - if (list != null && list.size() > 0) { Set filter = new HashSet();// 去重记录 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()); // 查询最新名称 - if ("department".equals(object.getString("type"))) { + /*if ("department".equals(object.getString("type"))) { DepartmentModel dept = SDK.getORGAPI().getDepartmentById(object.getString("id")); if (dept != null && !filter.contains(dept.getId())) { object.put("name", dept.getName()); filter.add(dept.getId()); dataArr.add(object); } + }*/ + + if ("department".equals(object.getString("type"))) { + DepartmentModel dept = SDK.getORGAPI().getDepartmentById(object.getString("id")); + if (dept != null && !filter.contains(dept.getId())) { + + if(object.getString("timestamp")!=null){ + depjsonArray.add(object); + }else{ + object.put("name", dept.getName()); + filter.add(dept.getId()); + dataArr.add(object); + } + + } } + if ("position".equals(object.getString("type"))) {// 岗位,先用角色代替 RoleModel role = SDK.getORGAPI().getRoleById(object.getString("id")); if (role != null && !filter.contains(role.getId())) { @@ -2662,12 +2647,40 @@ public class CoeProcessLevelWeb extends ActionWeb { } } } - // 数据组合 - List valueList = new ArrayList<>(); - for (int i = 0; i < dataArr.size(); i++) { - valueList.add(dataArr.getJSONObject(i).getString("name")); + if(depjsonArray.size()>0 && depjsonArray.getJSONObject(0).getString("timestamp")!=null){ + + depjsonArray.sort(Comparator.comparing(st ->((JSONObject)st).getString("timestamp"))); + JSONArray dataArr2 = new JSONArray(); + Set filter1 = new HashSet();// 去重记录 + for(int t=0;t valueList = new ArrayList<>(); + for (int i = 0; i < dataArr2.size(); i++) { + valueList.add(dataArr2.getJSONObject(i).getString("name")); + } + inputValue = StringUtils.join(valueList, ","); + + }else { + // 数据组合 + List valueList = new ArrayList<>(); + for (int i = 0; i < dataArr.size(); i++) { + valueList.add(dataArr.getJSONObject(i).getString("name")); + } + inputValue = StringUtils.join(valueList, ","); } - inputValue = StringUtils.join(valueList, ","); + + + + } inputValue = inputValue.replaceAll("'", "'"); @@ -2757,6 +2770,7 @@ public class CoeProcessLevelWeb extends ActionWeb { } + /** * 判断是否为json格式 * @param str @@ -3171,7 +3185,8 @@ public class CoeProcessLevelWeb extends ActionWeb { relationModel.setAttrId(relationObj.getString("attrId")); relationModel.setRelationFileId(relationFileId); relationModel.setRelationShapeId(""); - relationModel.setRelationShapeText(""); + long l = System.currentTimeMillis(); + relationModel.setRelationShapeText(l+""); // 获取文件 JSONObject refObj = JSONObject.parseObject(attrModelMap.get(attrId).getRef()); String relationType = refObj.containsKey("type") ? refObj.getString("type") : "shape"; diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.designer.shapes.aws.org.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.designer.shapes.aws.org.js index d06de220..62bbd73a 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.designer.shapes.aws.org.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.designer.shapes.aws.org.js @@ -1,10 +1,12 @@ var checkedOrgList = {};// 记录最终结果 var setting = {}; var checkTree; -var orgindex=1; + + $(document).ready(function() { initSetting(); checkedOrgList = checkedList; + checkTree = awsui.tree.init($("#tree"), setting); // 初始化已选中 initCheckedList(); @@ -101,7 +103,8 @@ function getCurrentCheck(dom, node) { obj.id = node.uuid; obj.type = node.type; obj.name = node.name; - obj.orgindex=orgindex++; + var timestamp = new Date().valueOf(); + obj.timestamp=timestamp; checkedOrgList[node.uuid] = obj; } else { // 无子节点,直接删除 diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.designer.shapes.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.designer.shapes.js index 840b74d0..195a6f2b 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.designer.shapes.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.designer.shapes.js @@ -491,6 +491,7 @@ function deleteRelation(obj) { //获取关联信息 function getRelationShapeInfos() { + var relations = new Array(); $("#relationShapes div.relation_div").each(function(){ var obj = { @@ -606,7 +607,6 @@ function autoAjaxWaitFn() { } function autoajax(ro) { - debugger; if(relationType == 'file') {// 前后置流程 closeProcessSearchDialog(); $('#processSearchData').empty(); diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.processlevel.create.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.processlevel.create.js index e9f11c01..7f2606cf 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.processlevel.create.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.pal.processlevel.create.js @@ -612,7 +612,6 @@ function saveDialogTableValue(tableValue,id,dom) { } function saveContent(obj) { - // debugger; var sid = $("#sid").val(); var uuid = $("#id").val(); var id = obj.attr("id"); @@ -1526,7 +1525,6 @@ function openRelationAwsorgDialog(obj) { //将关联关系保存到数据库(AWS org) function saveRelevanceAwsOrgShapesTODB(awsorgValueArr, shapeId, shapeName, objId) { - debugger; $.ajax({ type : "POST", url : "./jd?sid=" + $("#sid").val()