插件工具类代码提交

This commit is contained in:
zhangzhiguo 2025-06-30 09:20:26 +08:00
parent e2cdf37c77
commit 1d230f4dd5
2 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,12 @@
package zcgj.zcdev.zcdev.pr.utils;
import kd.bos.entity.datamodel.IDataModel;
public class CommonUtils {
public CommonUtils() {
}
public static boolean isNewData(IDataModel model) {
return !model.getDataEntity().getDataEntityState().getFromDatabase();
}
}

View File

@ -0,0 +1,70 @@
package zcgj.zcdev.zcdev.pr.utils;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.org.OrgUnitServiceHelper;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
public class OrgCheckUtils {
public static String ksNumberTop = "10006431"; //矿山总部组织编码
public static String ksNumber = "10006447";//矿山总部本部
//试点四家公司本部
public static Set<String> testCompanyNumberSet = new HashSet<>();
static {
testCompanyNumberSet.add("10006461"); //南京本部
testCompanyNumberSet.add("10006476"); //兖州本部
testCompanyNumberSet.add("10007186"); //西安本部
testCompanyNumberSet.add("10006939"); //天津本部
}
/**
* 判断是否为矿山
*/
public static boolean isKS(Long currentOrgId){
QFilter filterOrgId = new QFilter("number", QCP.equals,ksNumberTop);//中材矿山建设有限公司
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;
}
/**
* 判断某个组织是否在某个组织下面
* 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;
}
}