解决发布部门/支持文件排序问题
This commit is contained in:
parent
859402c698
commit
b8f90fd4fa
Binary file not shown.
@ -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<String> inputValueList = new ArrayList<>();
|
||||
List<DesignerShapeRelationModel> 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<String> tempStrs = new HashSet<>();
|
||||
@ -5504,8 +5500,11 @@ public class PALRepositoryQueryAPIManager {
|
||||
List<String> positionValList = new ArrayList<>();
|
||||
List<String> roleValList = new ArrayList<>();
|
||||
List<String> userValList = new ArrayList<>();
|
||||
|
||||
JSONArray depjsonArray=new JSONArray();
|
||||
if (list != null && list.size() > 0) {
|
||||
Set<String> filter = new HashSet<String>();// 去重记录
|
||||
|
||||
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<String> filter1 = new HashSet<String>();// 去重记录
|
||||
depjsonArray.sort(Comparator.comparing(st ->((JSONObject)st).getString("timestamp")));
|
||||
JSONObject jo = new JSONObject(new LinkedHashMap());
|
||||
for(int b=0;b<depjsonArray.size();b++){
|
||||
JSONObject onedata=depjsonArray.getJSONObject(b);
|
||||
DepartmentModel dept = SDK.getORGAPI().getDepartmentById(onedata.getString("id"));
|
||||
deptValList.add(dept.getName());
|
||||
filter1.add(dept.getId());
|
||||
|
||||
attrObj.getJSONArray("value").add(onedata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,15 +2,7 @@ package com.actionsoft.apps.coe.pal.pal.repository.designer.relation.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
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.AppsConst;
|
||||
import com.actionsoft.apps.coe.pal.constant.CoEConstant;
|
||||
@ -974,6 +966,9 @@ public class DesignerRelationShapeWeb extends ActionWeb {
|
||||
}
|
||||
String tmpStr = StringUtils.join(versionIds, ",");
|
||||
List<DesignerShapeRelationModel> 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<String> ids = new HashSet<>();
|
||||
List<DesignerShapeRelationModel> 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<DesignerShapeRelationModel> 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<depjsonArray.size();b++){
|
||||
JSONObject onedata=depjsonArray.getJSONObject(b);
|
||||
jo.put(onedata.getString("id"), onedata);
|
||||
}
|
||||
map.put("checkedList", jo);
|
||||
}else{
|
||||
map.put("checkedList", o);
|
||||
}
|
||||
|
||||
return HtmlPageTemplate.merge(CoEConstant.APP_ID, "pal.pl.repository.designer.shapes.aws.org.htm", map);
|
||||
}
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ import com.actionsoft.apps.coe.pal.util.SubUtil;
|
||||
import com.actionsoft.apps.lifecycle.api.AppsAPIManager;
|
||||
import com.actionsoft.apps.resource.AppContext;
|
||||
import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile;
|
||||
import com.actionsoft.bpms.bo.engine.BO;
|
||||
import com.actionsoft.bpms.bpmn.constant.ProcessDefinitionConst;
|
||||
import com.actionsoft.bpms.bpmn.engine.cache.ProcessDefCache;
|
||||
import com.actionsoft.bpms.bpmn.engine.cache.util.ProcessDefUtil;
|
||||
@ -2532,6 +2533,12 @@ public class CoeProcessLevelWeb extends ActionWeb {
|
||||
String shapeId = "";
|
||||
if ("relation".equals(attributeModel.getType())) {
|
||||
List<DesignerShapeRelationModel> 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<String> 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<DesignerShapeRelationModel> list = DesignerShapeRelationCache.getListByAttrId(uuid, "", attributeModel.getKey());
|
||||
|
||||
|
||||
if(list.size()>0){
|
||||
|
||||
for(int b=0;b<list.size();b++){
|
||||
|
||||
JSONObject jo=JSONObject.parseObject(list.get(b).getRelationShapeText());
|
||||
|
||||
/*for(){
|
||||
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
/*for (int j = newBean.size(); j < dateSourceList.size(); j++) {
|
||||
if (!dateSourceList.get(i).get.equals(dateSourceList.get(j).getId())) {
|
||||
Bean bean2 = dateSourceList.get(j);
|
||||
SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
try {
|
||||
Date or1 = sf.parse(maxBean.getStr("MIND_TIME"));
|
||||
Date or2 = sf.parse(bean2.getStr("MIND_TIME"));
|
||||
if (or2.after(or1)) {
|
||||
// 如果比他大,则替换为最大
|
||||
maxBean = bean2;
|
||||
}
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// 将最大的添加到list中
|
||||
newBean.add(maxBean);*/
|
||||
|
||||
|
||||
List<DesignerShapeRelationModel> list2=new ArrayList<DesignerShapeRelationModel>();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (list != null && list.size() > 0) {
|
||||
Set<String> filter = new HashSet<String>();// 去重记录
|
||||
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<String> 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<String> filter1 = new HashSet<String>();// 去重记录
|
||||
for(int t=0;t<depjsonArray.size();t++){
|
||||
if ("department".equals(depjsonArray.getJSONObject(t).getString("type"))) {
|
||||
DepartmentModel dept = SDK.getORGAPI().getDepartmentById(depjsonArray.getJSONObject(t).getString("id"));
|
||||
if (dept != null && !filter1.contains(dept.getId())) {
|
||||
filter1.add(dept.getId());
|
||||
dataArr2.add(depjsonArray.get(t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 数据组合
|
||||
List<String> valueList = new ArrayList<>();
|
||||
for (int i = 0; i < dataArr2.size(); i++) {
|
||||
valueList.add(dataArr2.getJSONObject(i).getString("name"));
|
||||
}
|
||||
inputValue = StringUtils.join(valueList, ",");
|
||||
|
||||
}else {
|
||||
// 数据组合
|
||||
List<String> 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";
|
||||
|
||||
@ -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 {
|
||||
// 无子节点,直接删除
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user