1.提取矿山组织判断逻辑至工具类

2.合同台账签约方默认为当前人组织
This commit is contained in:
zhangzhiguo 2024-12-27 17:16:32 +08:00
parent c55ed5d85a
commit 5f8a4a4c41
15 changed files with 92 additions and 212 deletions

View File

@ -0,0 +1,29 @@
package zcgj.zcdev.zcdev.fs.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.context.RequestContext;
import kd.bos.servicehelper.user.UserServiceHelper;
import kd.sdk.plugin.Plugin;
import java.util.EventObject;
/**
* 合同台账单签约方默认值设置插件
*/
public class ContractbillContractpartyDefaultPlugin extends AbstractBillPlugIn implements Plugin {
@Override
public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e);
Long currentUserId = UserServiceHelper.getCurrentUserId();
// 当前用户的主职部门(组织)
Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId);
//当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的
if(OrgCheckUtils.isKS(currentOrgId)){
this.getModel().setValue("contractparty",mainOrgId);
}
}
}

View File

@ -72,7 +72,7 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu
//costcompany 费用承担公司 //costcompany 费用承担公司
DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany");
long costcompanyId = costcompany.getLong("id"); long costcompanyId = costcompany.getLong("id");
if(isKS(currentOrgId) && isKS(costcompanyId)){ if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
fieldEdit.addBeforeF7SelectListener(this); fieldEdit.addBeforeF7SelectListener(this);
fieldEdit.addAfterF7SelectListener(this); fieldEdit.addAfterF7SelectListener(this);
@ -213,23 +213,4 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu
} }
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
} }

View File

@ -69,7 +69,7 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu
//costcompany 费用承担公司 //costcompany 费用承担公司
DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany");
long costcompanyId = costcompany.getLong("id"); long costcompanyId = costcompany.getLong("id");
if(isKS(currentOrgId) && isKS(costcompanyId)){ if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
fieldEdit.addBeforeF7SelectListener(this); fieldEdit.addBeforeF7SelectListener(this);
fieldEdit.addAfterF7SelectListener(this); fieldEdit.addAfterF7SelectListener(this);
@ -211,22 +211,5 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu
} }
} }
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
} }

View File

@ -16,6 +16,7 @@ import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter; import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper; import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper;
import kd.sdk.plugin.Plugin; import kd.sdk.plugin.Plugin;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -55,9 +56,13 @@ public class DailyreimbursVisitCheckPlugin extends AbstractBillPlugIn implemen
@Override @Override
public void afterCreateNewData(EventObject e) { public void afterCreateNewData(EventObject e) {
super.afterCreateNewData(e); super.afterCreateNewData(e);
QFilter nameQFilterAccItem = new QFilter("number",QCP.equals,"FYXM004.999"); Long currentUserId = UserServiceHelper.getCurrentUserId();
DynamicObject dynamicObjectAccItem = BusinessDataServiceHelper.loadSingle("er_expenseitemedit", "number,name", new QFilter[]{nameQFilterAccItem}); // 当前用户所属组织
this.getModel().setValue("expenseitem",dynamicObjectAccItem,0); Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId);
this.getModel().setValue("contractparty",mainOrgId);
//QFilter nameQFilterAccItem = new QFilter("number",QCP.equals,"FYXM004.999");
//DynamicObject dynamicObjectAccItem = BusinessDataServiceHelper.loadSingle("er_expenseitemedit", "number,name", new QFilter[]{nameQFilterAccItem});
//this.getModel().setValue("expenseitem",dynamicObjectAccItem,0);
} }
/** /**

View File

@ -0,0 +1,34 @@
package zcgj.zcdev.zcdev.fs.plugin.form;
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.List;
import java.util.Set;
import java.util.stream.Collectors;
public class OrgCheckUtils {
/**
* 判断是否为矿山
*/
public static boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
}

View File

@ -33,6 +33,7 @@ import java.util.stream.Collectors;
/** /**
* 国外住宿费标准 * 国外住宿费标准
*/ */
@Deprecated
public class OverseaStaysLimitPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener { public class OverseaStaysLimitPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener {
private static final Log log = LogFactory.getLog(OverseaStaysLimitPlugin.class); private static final Log log = LogFactory.getLog(OverseaStaysLimitPlugin.class);
@ -48,7 +49,7 @@ public class OverseaStaysLimitPlugin extends AbstractBillPlugIn implements Plugi
//当前切换选择的组织 //当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId(); Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的 //当前所在的组织是属于矿山下的
if(isKS(currentOrgId)){ if(OrgCheckUtils.isKS(currentOrgId)){
BasedataEdit fieldEdit = this.getView().getControl("zcgj_district_f7"); BasedataEdit fieldEdit = this.getView().getControl("zcgj_district_f7");
fieldEdit.addBeforeF7SelectListener(this); fieldEdit.addBeforeF7SelectListener(this);
} }
@ -65,24 +66,6 @@ public class OverseaStaysLimitPlugin extends AbstractBillPlugIn implements Plugi
} }
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
} }

View File

@ -52,7 +52,7 @@ public class PrepaybillContractPlugin extends AbstractBillPlugIn implements Plug
//当前切换选择的组织 //当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId(); Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的 //当前所在的组织是属于矿山下的
if(isKS(currentOrgId) && (args.getSource() instanceof Submit) ) { if(OrgCheckUtils.isKS(currentOrgId) && (args.getSource() instanceof Submit) ) {
Submit source = (Submit) args.getSource(); Submit source = (Submit) args.getSource();
if (source.getOperateKey().equals("submit")) { if (source.getOperateKey().equals("submit")) {
//获取当前页面的数据包 //获取当前页面的数据包
@ -79,24 +79,6 @@ public class PrepaybillContractPlugin extends AbstractBillPlugIn implements Plug
} }
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
/** /**
* java.util.Date 转换为 java.time.LocalDate * java.util.Date 转换为 java.time.LocalDate
* @param date java.util.Date * @param date java.util.Date

View File

@ -72,7 +72,7 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin
//costcompany 费用承担公司 //costcompany 费用承担公司
DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany");
long costcompanyId = costcompany.getLong("id"); long costcompanyId = costcompany.getLong("id");
if(isKS(currentOrgId) && isKS(costcompanyId)){ if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
fieldEdit.addBeforeF7SelectListener(this); fieldEdit.addBeforeF7SelectListener(this);
fieldEdit.addAfterF7SelectListener(this); fieldEdit.addAfterF7SelectListener(this);
@ -214,22 +214,4 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin
} }
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
} }

View File

@ -43,7 +43,7 @@ public class PublicreimbursebillContractPlugin extends AbstractBillPlugIn implem
//当前切换选择的组织 //当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId(); Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的 //当前所在的组织是属于矿山下的
if(isKS(currentOrgId)&&(args.getSource() instanceof Submit) ) { if(OrgCheckUtils.isKS(currentOrgId)&&(args.getSource() instanceof Submit) ) {
Submit source = (Submit) args.getSource(); Submit source = (Submit) args.getSource();
if (source.getOperateKey().equals("submit")) { if (source.getOperateKey().equals("submit")) {
//获取当前页面的数据包 //获取当前页面的数据包
@ -67,24 +67,7 @@ public class PublicreimbursebillContractPlugin extends AbstractBillPlugIn implem
} }
} }
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
/** /**
* java.util.Date 转换为 java.time.LocalDate * java.util.Date 转换为 java.time.LocalDate

View File

@ -72,7 +72,7 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen
//costcompany 费用承担公司 //costcompany 费用承担公司
DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany");
long costcompanyId = costcompany.getLong("id"); long costcompanyId = costcompany.getLong("id");
if(isKS(currentOrgId) && isKS(costcompanyId)){ if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){
BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM);
fieldEdit.addBeforeF7SelectListener(this); fieldEdit.addBeforeF7SelectListener(this);
fieldEdit.addAfterF7SelectListener(this); fieldEdit.addAfterF7SelectListener(this);
@ -213,23 +213,5 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen
} }
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
} }

View File

@ -21,7 +21,9 @@ import java.util.stream.Collectors;
/** /**
* 差旅报销单国外住宿标准提醒插件 * 差旅报销单国外住宿标准提醒插件
* 废弃使用产品自带逻辑
*/ */
@Deprecated
public class TripreimbursebillAbroadAlertedPlugin extends AbstractBillPlugIn implements Plugin { public class TripreimbursebillAbroadAlertedPlugin extends AbstractBillPlugIn implements Plugin {
//private static final Log log = LogFactory.getLog(TripreimbursebillPlugin.class); //private static final Log log = LogFactory.getLog(TripreimbursebillPlugin.class);
@ -37,7 +39,7 @@ public class TripreimbursebillAbroadAlertedPlugin extends AbstractBillPlugIn imp
//当前切换选择的组织 //当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId(); Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的 //当前所在的组织是属于矿山下的
if(isKS(currentOrgId)){ if(OrgCheckUtils.isKS(currentOrgId)){
String name = e.getProperty().getName(); String name = e.getProperty().getName();
//目的地变更 //目的地变更
if("to".equals(name)){ if("to".equals(name)){
@ -104,22 +106,4 @@ public class TripreimbursebillAbroadAlertedPlugin extends AbstractBillPlugIn imp
} }
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
} }

View File

@ -17,6 +17,9 @@ import kd.sdk.plugin.Plugin;
import java.util.EventObject; import java.util.EventObject;
/**
* 住宿标准自动取数
*/
public class TripstandAccmodationAutoPlugin extends AbstractBillPlugIn implements Plugin { public class TripstandAccmodationAutoPlugin extends AbstractBillPlugIn implements Plugin {

View File

@ -79,22 +79,5 @@ public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn {
} }
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
} }

View File

@ -15,6 +15,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper; import kd.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.org.OrgUnitServiceHelper; import kd.bos.servicehelper.org.OrgUnitServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper;
import zcgj.zcdev.zcdev.fs.plugin.form.OrgCheckUtils;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate; import java.time.LocalDate;
@ -53,7 +54,7 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
//当前切换选择的组织 //当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId(); Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的 //当前所在的组织是属于矿山下的
if(isKS(currentOrgId)){ if(OrgCheckUtils.isKS(currentOrgId)){
e.getValidators().add(new ValidatorExt()); e.getValidators().add(new ValidatorExt());
} }
} }
@ -385,23 +386,5 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn {
return LocalDate.of(date.getYear() - (years - 1), Month.JANUARY, 1); return LocalDate.of(date.getYear() - (years - 1), Month.JANUARY, 1);
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
} }

View File

@ -15,6 +15,7 @@ import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.org.OrgUnitServiceHelper; import kd.bos.servicehelper.org.OrgUnitServiceHelper;
import kd.bos.servicehelper.user.UserServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper;
import zcgj.zcdev.zcdev.fs.plugin.form.OrgCheckUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -50,7 +51,7 @@ public class TripreimbursebillUpOp extends AbstractOperationServicePlugIn {
//当前切换选择的组织 //当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId(); Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的 //当前所在的组织是属于矿山下的
if(isKS(currentOrgId)){ if(OrgCheckUtils.isKS(currentOrgId)){
e.getValidators().add(new ValidatorExt()); e.getValidators().add(new ValidatorExt());
} }
} }
@ -97,22 +98,4 @@ public class TripreimbursebillUpOp extends AbstractOperationServicePlugIn {
} }
} }
/**
* 判断是否为矿山
*/
public boolean isKS(Long currentOrgId){
String rootOrgCode = "10006431";//矿山总部组织编码
QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司
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;
}
} }