增加组织机构判断

This commit is contained in:
zhangzhiguo 2025-06-26 15:59:02 +08:00
parent 8c96159598
commit 5818d4d2f6
1 changed files with 20 additions and 0 deletions

View File

@ -47,4 +47,24 @@ public class OrgCheckUtils {
}
return false;
}
/**
* 判断某个组织是否在某个组织下面
* parentOrgNumber 上层组织编码
* currentOrgId 需要判断的组织id
*/
public static boolean isChildrenOrg(String parentOrgNumber,Long currentOrgId){
QFilter filterOrgId = new QFilter("number", QCP.equals,parentOrgNumber);//中材矿山建设有限公司
DynamicObject adminOrg = BusinessDataServiceHelper.loadSingle("bos_org", "number,name,fullname", new QFilter[]{filterOrgId});
long orgId = adminOrg.getLong("id");
List<Long> orgIds = new ArrayList<>(1);
//orgIds.add(1692204547985902592L);
orgIds.add(orgId);
List<Long> subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true);
Set<Long> orgSer = subOrgIds.stream().collect(Collectors.toSet());
if(orgSer.contains(currentOrgId)){
return true;
}
return false;
}
}