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

批量查询组织、身份、群组信息修改

o2sword 5 лет назад
Родитель
Сommit
9408fda29f

+ 63 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/organization/Group.java

@@ -8,6 +8,10 @@ import com.x.base.core.project.gson.GsonPropertyObject;
 
 public class Group extends GsonPropertyObject {
 
+	@FieldDescribe("匹配字段")
+	private String matchKey;
+	@FieldDescribe("群组id")
+	private String id;
 	@FieldDescribe("群组名称")
 	private String name;
 	@FieldDescribe("群组标识")
@@ -26,6 +30,33 @@ public class Group extends GsonPropertyObject {
 	private List<String> unitList = new ArrayList<>();
 	@FieldDescribe("身份成员")
 	private List<String> identityList = new ArrayList<>();
+	@FieldDescribe("直接下级组织数量")
+	private Long subDirectGroupCount = 0L;
+
+	@FieldDescribe("直接下级用户数量")
+	private Long subDirectPersonCount = 0L;
+
+	@FieldDescribe("直接下级身份数量")
+	private Long subDirectIdentityCount = 0L;
+
+	@FieldDescribe("直接下级组织数量")
+	private Long subDirectOrgCount = 0L;
+
+	public String getMatchKey() {
+		return matchKey;
+	}
+
+	public void setMatchKey(String matchKey) {
+		this.matchKey = matchKey;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public void setId(String id) {
+		this.id = id;
+	}
 
 	public String getName() {
 		return name;
@@ -98,4 +129,36 @@ public class Group extends GsonPropertyObject {
 	public void setIdentityList(List<String> identityList) {
 		this.identityList = identityList;
 	}
+
+	public Long getSubDirectGroupCount() {
+		return subDirectGroupCount;
+	}
+
+	public void setSubDirectGroupCount(Long subDirectGroupCount) {
+		this.subDirectGroupCount = subDirectGroupCount;
+	}
+
+	public Long getSubDirectPersonCount() {
+		return subDirectPersonCount;
+	}
+
+	public void setSubDirectPersonCount(Long subDirectPersonCount) {
+		this.subDirectPersonCount = subDirectPersonCount;
+	}
+
+	public Long getSubDirectIdentityCount() {
+		return subDirectIdentityCount;
+	}
+
+	public void setSubDirectIdentityCount(Long subDirectIdentityCount) {
+		this.subDirectIdentityCount = subDirectIdentityCount;
+	}
+
+	public Long getSubDirectOrgCount() {
+		return subDirectOrgCount;
+	}
+
+	public void setSubDirectOrgCount(Long subDirectOrgCount) {
+		this.subDirectOrgCount = subDirectOrgCount;
+	}
 }

+ 10 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/organization/Identity.java

@@ -5,6 +5,8 @@ import com.x.base.core.project.gson.GsonPropertyObject;
 
 public class Identity extends GsonPropertyObject {
 
+	@FieldDescribe("匹配字段")
+	private String matchKey;
 	@FieldDescribe("身份名称")
 	private String name;
 	@FieldDescribe("身份标识")
@@ -28,6 +30,14 @@ public class Identity extends GsonPropertyObject {
 	@FieldDescribe("是否是设定的主身份")
 	private Boolean major;
 
+	public String getMatchKey() {
+		return matchKey;
+	}
+
+	public void setMatchKey(String matchKey) {
+		this.matchKey = matchKey;
+	}
+
 	public String getName() {
 		return name;
 	}

+ 10 - 0
o2server/x_base_core_project/src/main/java/com/x/base/core/project/organization/Person.java

@@ -8,6 +8,8 @@ import com.x.base.core.project.gson.GsonPropertyObject;
 
 public class Person extends GsonPropertyObject {
 
+	@FieldDescribe("匹配字段")
+	private String matchKey;
 	@FieldDescribe("数据库主键")
 	private String id;
 	@FieldDescribe("个人名称")
@@ -53,6 +55,14 @@ public class Person extends GsonPropertyObject {
 	@FieldDescribe("华为WeLink id")
 	private String weLinkId;
 
+	public String getMatchKey() {
+		return matchKey;
+	}
+
+	public void setMatchKey(String matchKey) {
+		this.matchKey = matchKey;
+	}
+
 	public String getWeLinkId() {
 		return weLinkId;
 	}

+ 7 - 3
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/ActionListObject.java

@@ -57,10 +57,14 @@ class ActionListObject extends BaseAction {
 	}
 
 	private List<Wo> list(Business business, Wi wi) throws Exception {
-		List<Group> os = business.group().pick(wi.getGroupList());
 		List<Wo> wos = new ArrayList<>();
-		for (Group o : os) {
-			wos.add(this.convert(business, o, Wo.class));
+		for (String str : wi.getGroupList()) {
+			Group o = business.group().pick(str);
+			if(o!=null){
+				Wo wo = this.convert(business, o, Wo.class);
+				wo.setMatchKey(str);
+				wos.add(wo);
+			}
 		}
 		return wos;
 	}

+ 18 - 6
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/group/BaseAction.java

@@ -21,8 +21,7 @@ import com.x.organization.core.entity.accredit.Empower;
 
 class BaseAction extends StandardJaxrsAction {
 
-	CacheCategory cacheCategory = new CacheCategory(Identity.class, Unit.class, UnitAttribute.class, UnitDuty.class,
-			Role.class, Person.class, PersonAttribute.class, Group.class, Empower.class);
+	CacheCategory cacheCategory = new CacheCategory(Identity.class, Unit.class, Person.class, Group.class);
 
 	static class WoGroupAbstract extends GsonPropertyObject {
 
@@ -42,6 +41,7 @@ class BaseAction extends StandardJaxrsAction {
 	protected <T extends com.x.base.core.project.organization.Group> T convert(Business business, Group group,
 			Class<T> clz) throws Exception {
 		T t = clz.newInstance();
+		t.setId(group.getId());
 		t.setName(group.getName());
 		t.setDescription(group.getDescription());
 		t.setUnique(group.getUnique());
@@ -50,26 +50,38 @@ class BaseAction extends StandardJaxrsAction {
 		if (ListTools.isNotEmpty(group.getPersonList())) {
 			for (String str : group.getPersonList()) {
 				Person o = business.person().pick(str);
-				t.getPersonList().add(o.getDistinguishedName());
+				if(o!=null) {
+					t.getPersonList().add(o.getDistinguishedName());
+				}
 			}
+			t.setSubDirectPersonCount((long)t.getPersonList().size());
 		}
 		if (ListTools.isNotEmpty(group.getGroupList())) {
 			for (String str : group.getGroupList()) {
 				Group o = business.group().pick(str);
-				t.getGroupList().add(o.getDistinguishedName());
+				if(o!=null) {
+					t.getGroupList().add(o.getDistinguishedName());
+				}
 			}
+			t.setSubDirectGroupCount((long)t.getGroupList().size());
 		}
 		if (ListTools.isNotEmpty(group.getUnitList())) {
 			for (String str : group.getUnitList()) {
 				Unit o = business.unit().pick(str);
-				t.getUnitList().add(o.getDistinguishedName());
+				if(o!=null) {
+					t.getUnitList().add(o.getDistinguishedName());
+				}
 			}
+			t.setSubDirectOrgCount((long)t.getUnitList().size());
 		}
 		if (ListTools.isNotEmpty(group.getIdentityList())) {
 			for (String str : group.getIdentityList()) {
 				Identity o = business.identity().pick(str);
-				t.getIdentityList().add(o.getDistinguishedName());
+				if(o!=null) {
+					t.getIdentityList().add(o.getDistinguishedName());
+				}
 			}
+			t.setSubDirectIdentityCount((long)t.getIdentityList().size());
 		}
 		return t;
 	}

+ 7 - 3
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/identity/ActionListObject.java

@@ -57,10 +57,14 @@ class ActionListObject extends BaseAction {
 	}
 
 	private List<Wo> list(Business business, Wi wi) throws Exception {
-		List<Identity> os = business.identity().pick(wi.getIdentityList());
 		List<Wo> wos = new ArrayList<>();
-		for (Identity o : os) {
-			wos.add(this.convert(business, o, Wo.class));
+		for (String str : wi.getIdentityList()) {
+			Identity o = business.identity().pick(str);
+			if(o!=null){
+				Wo wo = this.convert(business, o, Wo.class);
+				wo.setMatchKey(str);
+				wos.add(wo);
+			}
 		}
 		return wos;
 	}

+ 7 - 3
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/person/ActionListObject.java

@@ -57,10 +57,14 @@ class ActionListObject extends BaseAction {
 	}
 
 	private List<Wo> list(Business business, Wi wi) throws Exception {
-		List<Person> os = business.person().pick(wi.getPersonList());
 		List<Wo> wos = new ArrayList<>();
-		for (Person o : os) {
-			wos.add(this.convert(business, o, Wo.class));
+		for (String str : wi.getPersonList()) {
+			Person o = business.person().pick(str);
+			if(o!=null){
+				Wo wo = this.convert(business, o, Wo.class);
+				wo.setMatchKey(str);
+				wos.add(wo);
+			}
 		}
 		return wos;
 	}

+ 25 - 10
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unit/ActionListObject.java

@@ -72,6 +72,9 @@ class ActionListObject extends BaseAction {
 	public static class Wo extends Unit {
 		private static final long serialVersionUID = -7913547275132005308L;
 
+		@FieldDescribe("匹配字段")
+		private String matchKey;
+
 		@FieldDescribe("直接下级组织数量")
 		private Long subDirectUnitCount = 0L;
 
@@ -81,6 +84,14 @@ class ActionListObject extends BaseAction {
 		static WrapCopier<Unit, Wo> copier = WrapCopierFactory.wo(Unit.class, Wo.class, null,
 				ListTools.toList(JpaObject.FieldsInvisible,Unit.controllerList_FIELDNAME,Unit.inheritedControllerList_FIELDNAME));
 
+		public String getMatchKey() {
+			return matchKey;
+		}
+
+		public void setMatchKey(String matchKey) {
+			this.matchKey = matchKey;
+		}
+
 		public Long getSubDirectUnitCount() {
 			return subDirectUnitCount;
 		}
@@ -100,18 +111,22 @@ class ActionListObject extends BaseAction {
 	}
 
 	private List<Wo> list(Business business, Wi wi) throws Exception {
-		List<Unit> os = business.unit().pick(wi.getUnitList());
-		List<Wo> wos = Wo.copier.copy(os);
-
-		for (Wo wo : wos) {
-			if (StringUtils.isNotEmpty(wo.getSuperior())) {
-				Unit superior = business.unit().pick(wo.getSuperior());
-				if (null != superior) {
-					wo.setSuperior(superior.getDistinguishedName());
+		List<Wo> wos = new ArrayList<>();
+		for (String str : wi.getUnitList()) {
+			Unit o = business.unit().pick(str);
+			if(o!=null){
+				Wo wo = Wo.copier.copy(o);
+				wo.setMatchKey(str);
+				if (StringUtils.isNotEmpty(wo.getSuperior())) {
+					Unit superior = business.unit().pick(wo.getSuperior());
+					if (null != superior) {
+						wo.setSuperior(superior.getDistinguishedName());
+					}
 				}
+				wo.setSubDirectIdentityCount(this.countSubDirectIdentity(business, wo));
+				wo.setSubDirectUnitCount(this.countSubDirectUnit(business, wo));
+				wos.add(wo);
 			}
-			wo.setSubDirectIdentityCount(this.countSubDirectIdentity(business, wo));
-			wo.setSubDirectUnitCount(this.countSubDirectUnit(business, wo));
 		}
 		return wos;
 	}

+ 1 - 2
o2server/x_organization_assemble_express/src/main/java/com/x/organization/assemble/express/jaxrs/unit/BaseAction.java

@@ -22,8 +22,7 @@ import com.x.organization.core.entity.accredit.Empower;
 
 class BaseAction extends StandardJaxrsAction {
 
-	CacheCategory cacheCategory = new CacheCategory(Identity.class, Unit.class, UnitAttribute.class, UnitDuty.class,
-			Role.class, Person.class, PersonAttribute.class, Group.class, Empower.class);
+	CacheCategory cacheCategory = new CacheCategory(Identity.class, Unit.class, UnitAttribute.class, UnitDuty.class, Person.class);
 
 	static class WoUnitListAbstract extends GsonPropertyObject {