Эх сурвалжийг харах

视图查询当前用户的组织、群组支持编码查询,原根据全称(包含名称)查询

o2sword 5 жил өмнө
parent
commit
a0697270c4

+ 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:

+ 55 - 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;
@@ -19,6 +23,7 @@ import com.x.query.core.entity.View;
 import com.x.query.core.entity.View_;
 
 import java.util.List;
+import java.util.Map;
 
 abstract class BaseAction extends StandardJaxrsAction {
 
@@ -44,6 +49,56 @@ 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);
+		if(runtime.identityList!=null){
+			for(String identity : runtime.identityList){
+				if(identity.indexOf("@")>-1) {
+					runtime.identityList.add(StringUtils.substringAfter(identity, "@"));
+				}
+			}
+		}
+		runtime.unitList = business.organization().unit().listWithPerson(effectivePerson);
+		if(runtime.unitList!=null){
+			for(String item : runtime.unitList){
+				if(item.indexOf("@")>-1) {
+					runtime.unitList.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+		}
+		runtime.unitAllList = business.organization().unit().listWithPersonSupNested(effectivePerson);
+		if(runtime.unitAllList!=null){
+			for(String item : runtime.unitAllList){
+				if(item.indexOf("@")>-1) {
+					runtime.unitAllList.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+		}
+		runtime.groupList = business.organization().group().listWithPerson(effectivePerson.getDistinguishedName());
+		if(runtime.groupList!=null){
+			for(String item : runtime.groupList){
+				if(item.indexOf("@")>-1) {
+					runtime.groupList.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+		}
+		runtime.roleList = business.organization().role().listWithPerson(effectivePerson);
+		if(runtime.roleList!=null){
+			for(String item : runtime.roleList){
+				if(item.indexOf("@")>-1) {
+					runtime.roleList.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+		}
+		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;

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

@@ -205,10 +205,45 @@ abstract class BaseAction extends StandardJaxrsAction {
 		Runtime runtime = new Runtime();
 		runtime.person = effectivePerson.getDistinguishedName();
 		runtime.identityList = business.organization().identity().listWithPerson(effectivePerson);
+		if(runtime.identityList!=null){
+			for(String identity : runtime.identityList){
+				if(identity.indexOf("@")>-1) {
+					runtime.identityList.add(StringUtils.substringAfter(identity, "@"));
+				}
+			}
+		}
 		runtime.unitList = business.organization().unit().listWithPerson(effectivePerson);
+		if(runtime.unitList!=null){
+			for(String item : runtime.unitList){
+				if(item.indexOf("@")>-1) {
+					runtime.unitList.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+		}
 		runtime.unitAllList = business.organization().unit().listWithPersonSupNested(effectivePerson);
+		if(runtime.unitAllList!=null){
+			for(String item : runtime.unitAllList){
+				if(item.indexOf("@")>-1) {
+					runtime.unitAllList.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+		}
 		runtime.groupList = business.organization().group().listWithPerson(effectivePerson.getDistinguishedName());
+		if(runtime.groupList!=null){
+			for(String item : runtime.groupList){
+				if(item.indexOf("@")>-1) {
+					runtime.groupList.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+		}
 		runtime.roleList = business.organization().role().listWithPerson(effectivePerson);
+		if(runtime.roleList!=null){
+			for(String item : runtime.roleList){
+				if(item.indexOf("@")>-1) {
+					runtime.roleList.add(StringUtils.substringAfter(item, "@"));
+				}
+			}
+		}
 		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));