用款申请单列表过滤逻辑优化

This commit is contained in:
xuhaihui 2025-08-25 17:55:49 +08:00
parent 094c55ad31
commit e872b0b2d3
1 changed files with 11 additions and 2 deletions

View File

@ -9,7 +9,9 @@ import kd.bos.list.ListShowParameter;
import kd.bos.list.plugin.AbstractListPlugin; import kd.bos.list.plugin.AbstractListPlugin;
import kd.bos.orm.query.QCP; import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.permission.api.HasPermOrgResult;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.permission.PermissionServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper;
import java.util.ArrayList; import java.util.ArrayList;
@ -80,9 +82,16 @@ public class paymentApplicationListPlugin extends AbstractListPlugin {
return; return;
} }
if ("zcgj_org.id".equals(key)) { if ("zcgj_org.id".equals(key)) {
String userid = RequestContext.get().getUserId();//获取当前用户id String userId = RequestContext.get().getUserId();//获取当前用户id
List<Long> ids = UserServiceHelper.getOrgsUserJoin(Long.parseLong(userid));//获取用户所有部门id boolean superUser = PermissionServiceHelper.isSuperUser(Long.parseLong(userId)); //判断是否为全功能用户
boolean adminUser = PermissionServiceHelper.isAdminUser(Long.parseLong(userId)); //判断是否管理员用户
List<Long> ids = UserServiceHelper.getOrgsUserJoin(Long.parseLong(userId));//获取用户所有部门id
List<Long> ids2 = new ArrayList<>(); List<Long> ids2 = new ArrayList<>();
if(!superUser && !adminUser){
HasPermOrgResult userHasPermOrgs = PermissionServiceHelper.getUserHasPermOrgs(Long.parseLong(userId),true);
List<Long> hasPermOrgs = userHasPermOrgs.getHasPermOrgs();
ids2.addAll(hasPermOrgs);
}
for (Long userMainOrgId : ids) { for (Long userMainOrgId : ids) {
QFilter[] qFilter = new QFilter[]{new QFilter("id", QCP.equals, userMainOrgId)}; QFilter[] qFilter = new QFilter[]{new QFilter("id", QCP.equals, userMainOrgId)};
DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_adminorg", qFilter);//行政组织 DynamicObject org = BusinessDataServiceHelper.loadSingle("bos_adminorg", qFilter);//行政组织