Просмотр исходного кода

人员归属群组查询条件优化

o2sword 5 лет назад
Родитель
Сommit
07f03b6ff6

+ 38 - 1
o2server/x_organization_core_express/src/main/java/com/x/organization/core/express/group/ActionListWithPerson.java

@@ -10,10 +10,14 @@ import com.x.base.core.project.gson.GsonPropertyObject;
 
 class ActionListWithPerson extends BaseAction {
 
-	public static List<String> execute(AbstractContext context, Collection<String> collection) throws Exception {
+	public static List<String> execute(AbstractContext context, Collection<String> collection,
+									   boolean recursiveGroupFlag, boolean referenceFlag, boolean recursiveOrgFlag) throws Exception {
 		Wi wi = new Wi();
 		if (null != collection) {
 			wi.getPersonList().addAll(collection);
+			wi.setRecursiveGroupFlag(recursiveGroupFlag);
+			wi.setReferenceFlag(referenceFlag);
+			wi.setRecursiveOrgFlag(recursiveOrgFlag);
 		}
 		Wo wo = context.applications().postQuery(applicationClass, "group/list/person", wi).getData(Wo.class);
 		return wo.getGroupList();
@@ -24,6 +28,15 @@ class ActionListWithPerson extends BaseAction {
 		@FieldDescribe("个人")
 		private List<String> personList = new ArrayList<>();
 
+		@FieldDescribe("是否递归查询上级群组,默认true")
+		private Boolean recursiveGroupFlag = true;
+
+		@FieldDescribe("是否包含查找人员身份成员、人员归属组织成员的所属群组,默认false")
+		private Boolean referenceFlag = false;
+
+		@FieldDescribe("是否递归人员归属组织的上级组织所属群组,前提referenceFlag为true,默认false")
+		private Boolean recursiveOrgFlag = false;
+
 		public List<String> getPersonList() {
 			return personList;
 		}
@@ -31,6 +44,30 @@ class ActionListWithPerson extends BaseAction {
 		public void setPersonList(List<String> personList) {
 			this.personList = personList;
 		}
+
+		public Boolean getReferenceFlag() {
+			return referenceFlag;
+		}
+
+		public void setReferenceFlag(Boolean referenceFlag) {
+			this.referenceFlag = referenceFlag;
+		}
+
+		public Boolean getRecursiveGroupFlag() {
+			return recursiveGroupFlag;
+		}
+
+		public void setRecursiveGroupFlag(Boolean recursiveGroupFlag) {
+			this.recursiveGroupFlag = recursiveGroupFlag;
+		}
+
+		public Boolean getRecursiveOrgFlag() {
+			return recursiveOrgFlag;
+		}
+
+		public void setRecursiveOrgFlag(Boolean recursiveOrgFlag) {
+			this.recursiveOrgFlag = recursiveOrgFlag;
+		}
 	}
 
 	public static class Wo extends WoGroupAbstract {

+ 17 - 3
o2server/x_organization_core_express/src/main/java/com/x/organization/core/express/group/GroupFactory.java

@@ -111,17 +111,31 @@ public class GroupFactory {
 
 	/** 查询人员所在的群组 */
 	public List<String> listWithPerson(Collection<String> values) throws Exception {
-		return ActionListWithPerson.execute(context, values);
+		return listWithPersonReference(values,true,false, false);
 	}
 
 	/** 查询人员所在的群组 */
 	public List<String> listWithPerson(String... values) throws Exception {
-		return ActionListWithPerson.execute(context, Arrays.asList(values));
+		return listWithPersonReference(Arrays.asList(values),true,false, false);
 	}
 
 	/** 查询人员所在的群组 */
 	public List<String> listWithPerson(EffectivePerson effectivePerson) throws Exception {
-		return ActionListWithPerson.execute(context, ListTools.toList(effectivePerson.getDistinguishedName()));
+		return listWithPersonReference(ListTools.toList(effectivePerson.getDistinguishedName()),true,false, false);
+	}
+
+	/**
+	 * 查询人员及关联身份、组织所在的群组
+	 * @param values 用户
+	 * @param recursiveGroupFlag 是否递归查询上级群组
+	 * @param referenceFlag 是否包含查找人员身份成员、人员归属组织成员的所属群组
+	 * @param recursiveOrgFlag 是否递归人员归属组织的上级组织所属群组,前提referenceFlag为true
+	 * @return
+	 * @throws Exception
+	 */
+	public List<String> listWithPersonReference(Collection<String> values,
+						boolean recursiveGroupFlag, boolean referenceFlag, boolean recursiveOrgFlag) throws Exception {
+		return ActionListWithPerson.execute(context, values, recursiveGroupFlag, referenceFlag, recursiveOrgFlag);
 	}
 
 }