Pārlūkot izejas kodu

Merge branch 'feature/视图对当前用户组织查询变更' into 'develop'

Merge of feature/[数据中心]视图对当前用户组织查询变更 to develop

See merge request o2oa/o2oa!706
o2null 5 gadi atpakaļ
vecāks
revīzija
84d8ea4ba0

+ 2 - 12
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/view/ActionBundle.java

@@ -38,18 +38,8 @@ class ActionBundle extends BaseAction {
 				throw new ExceptionViewNotExist(id);
 			}
 			Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
-			Runtime runtime = new Runtime();
-			runtime.person = effectivePerson.getDistinguishedName();
-			runtime.identityList = business.organization().identity()
-					.listWithPerson(effectivePerson.getDistinguishedName());
-			runtime.unitList = business.organization().unit().listWithPerson(effectivePerson.getDistinguishedName());
-			runtime.unitAllList = business.organization().unit()
-					.listWithPersonSupNested(effectivePerson.getDistinguishedName());
-			runtime.groupList = business.organization().group().listWithPerson(effectivePerson.getDistinguishedName());
-			runtime.roleList = business.organization().role().listWithPerson(effectivePerson.getDistinguishedName());
-			runtime.parameter = wi.getParameter();
-			runtime.filterList = wi.getFilterList();
-			runtime.count = this.getCount(view, wi.getCount());
+
+			Runtime runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(), wi.getCount());
 
 			List<String> os = null;
 			switch (StringUtils.trimToEmpty(view.getType())) {

+ 1 - 12
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/view/ActionSimulate.java

@@ -41,19 +41,8 @@ class ActionSimulate extends BaseAction {
 			if (wi == null) {
 				wi = new Wi();
 			}
-			Runtime runtime = new Runtime();
-			runtime.person = effectivePerson.getDistinguishedName();
-			runtime.identityList = business.organization().identity()
-					.listWithPerson(effectivePerson.getDistinguishedName());
-			runtime.unitList = business.organization().unit().listWithPerson(effectivePerson.getDistinguishedName());
-			runtime.unitAllList = business.organization().unit()
-					.listWithPersonSupNested(effectivePerson.getDistinguishedName());
-			runtime.groupList = business.organization().group().listWithPerson(effectivePerson.getDistinguishedName());
-			runtime.roleList = business.organization().role().listWithPerson(effectivePerson.getDistinguishedName());
-			runtime.parameter = wi.getParameter();
-			runtime.filterList = wi.getFilterList();
+			Runtime runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(), wi.getCount());
 			runtime.bundleList = wi.getBundleList();
-			runtime.count = this.getCount(view, wi.getCount());
 			switch (StringUtils.trimToEmpty(view.getType())) {
 
 			case View.TYPE_CMS:

+ 67 - 0
o2server/x_query_assemble_designer/src/main/java/com/x/query/assemble/designer/jaxrs/view/BaseAction.java

@@ -7,9 +7,13 @@ import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
 import com.google.gson.reflect.TypeToken;
+import com.x.base.core.project.http.EffectivePerson;
 import com.x.base.core.project.tools.ListTools;
 import com.x.processplatform.core.entity.element.Process;
+import com.x.query.core.express.plan.FilterEntry;
 import com.x.query.core.express.plan.ProcessPlatformPlan;
+import com.x.query.core.express.plan.Runtime;
+import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.math.NumberUtils;
 
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
@@ -18,7 +22,9 @@ import com.x.query.core.entity.Query;
 import com.x.query.core.entity.View;
 import com.x.query.core.entity.View_;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
 
 abstract class BaseAction extends StandardJaxrsAction {
 
@@ -44,6 +50,67 @@ abstract class BaseAction extends StandardJaxrsAction {
 		return em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult() == 0;
 	}
 
+	protected Runtime runtime(EffectivePerson effectivePerson, Business business, View view,
+							  List<FilterEntry> filterList, Map<String, String> parameter, Integer count) throws Exception {
+		Runtime runtime = new Runtime();
+		runtime.person = effectivePerson.getDistinguishedName();
+		runtime.identityList = business.organization().identity().listWithPerson(effectivePerson);
+		List<String> list = new ArrayList<>();
+		if(runtime.identityList!=null){
+			for(String identity : runtime.identityList){
+				if(identity.indexOf("@")>-1) {
+					list.add(StringUtils.substringAfter(identity, "@"));
+				}
+			}
+			runtime.identityList.addAll(list);
+			list.clear();
+		}
+		runtime.unitList = business.organization().unit().listWithPerson(effectivePerson);
+		if(runtime.unitList!=null){
+			for(String item : runtime.unitList){
+				if(item.indexOf("@")>-1) {
+					list.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+			runtime.unitList.addAll(list);
+			list.clear();
+		}
+		runtime.unitAllList = business.organization().unit().listWithPersonSupNested(effectivePerson);
+		if(runtime.unitAllList!=null){
+			for(String item : runtime.unitAllList){
+				if(item.indexOf("@")>-1) {
+					list.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+			runtime.unitAllList.addAll(list);
+			list.clear();
+		}
+		runtime.groupList = business.organization().group().listWithPerson(effectivePerson.getDistinguishedName());
+		if(runtime.groupList!=null){
+			for(String item : runtime.groupList){
+				if(item.indexOf("@")>-1) {
+					list.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+			runtime.groupList.addAll(list);
+			list.clear();
+		}
+		runtime.roleList = business.organization().role().listWithPerson(effectivePerson);
+		if(runtime.roleList!=null){
+			for(String item : runtime.roleList){
+				if(item.indexOf("@")>-1) {
+					list.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+			runtime.roleList.addAll(list);
+			list.clear();
+		}
+		runtime.parameter = parameter;
+		runtime.filterList = filterList;
+		runtime.count = this.getCount(view, count);
+		return runtime;
+	}
+
 	protected Integer getCount(View view, Integer count) {
 		Integer viewCount = view.getCount();
 		Integer wiCount = ((count == null) || (count < 1) || (count > View.MAX_COUNT)) ? View.MAX_COUNT : count;

+ 47 - 0
o2server/x_query_assemble_surface/src/main/java/com/x/query/assemble/surface/jaxrs/view/BaseAction.java

@@ -1,6 +1,7 @@
 package com.x.query.assemble.surface.jaxrs.view;
 
 import java.io.ByteArrayOutputStream;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
 import java.util.Objects;
@@ -205,10 +206,56 @@ abstract class BaseAction extends StandardJaxrsAction {
 		Runtime runtime = new Runtime();
 		runtime.person = effectivePerson.getDistinguishedName();
 		runtime.identityList = business.organization().identity().listWithPerson(effectivePerson);
+		List<String> list = new ArrayList<>();
+		if(runtime.identityList!=null){
+			for(String identity : runtime.identityList){
+				if(identity.indexOf("@")>-1) {
+					list.add(StringUtils.substringAfter(identity, "@"));
+				}
+			}
+			runtime.identityList.addAll(list);
+			list.clear();
+		}
 		runtime.unitList = business.organization().unit().listWithPerson(effectivePerson);
+		if(runtime.unitList!=null){
+			for(String item : runtime.unitList){
+				if(item.indexOf("@")>-1) {
+					list.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+			runtime.unitList.addAll(list);
+			list.clear();
+		}
 		runtime.unitAllList = business.organization().unit().listWithPersonSupNested(effectivePerson);
+		if(runtime.unitAllList!=null){
+			for(String item : runtime.unitAllList){
+				if(item.indexOf("@")>-1) {
+					list.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+			runtime.unitAllList.addAll(list);
+			list.clear();
+		}
 		runtime.groupList = business.organization().group().listWithPerson(effectivePerson.getDistinguishedName());
+		if(runtime.groupList!=null){
+			for(String item : runtime.groupList){
+				if(item.indexOf("@")>-1) {
+					list.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+			runtime.groupList.addAll(list);
+			list.clear();
+		}
 		runtime.roleList = business.organization().role().listWithPerson(effectivePerson);
+		if(runtime.roleList!=null){
+			for(String item : runtime.roleList){
+				if(item.indexOf("@")>-1) {
+					list.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+			runtime.roleList.addAll(list);
+			list.clear();
+		}
 		runtime.parameter = parameter;
 		runtime.filterList = filterList;
 		runtime.count = this.getCount(view, count);

+ 3 - 0
o2server/x_query_core_express/src/main/java/com/x/query/core/express/plan/CmsPlan.java

@@ -382,6 +382,9 @@ public class CmsPlan extends Plan {
 					if("readPersonList".equals(path)){
 						p = cb.or(p, cb.isMember("所有人", root.get(Document_.readPersonList)));
 						p = cb.or(p, cb.isMember(runtime.person, root.get(Document_.readPersonList)));
+						if(runtime.person.indexOf("@")>-1){
+							p = cb.or(p, cb.isMember(StringUtils.substringAfter(runtime.person, "@"), root.get(Document_.readPersonList)));
+						}
 					}else if("readUnitList".equals(path)){
 						if(ListTools.isNotEmpty(runtime.unitAllList)){
 							p = cb.or(p, root.get(Document_.readUnitList).in(runtime.unitAllList));