From 3d451abc07cbb47ea22980f6e0545b54bf9aefdb Mon Sep 17 00:00:00 2001 From: zhangzhiguo Date: Fri, 27 Dec 2024 09:18:28 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=EF=BC=8C=E4=BB=85=E9=99=90=E7=9F=BF=E5=B1=B1?= =?UTF-8?q?=E6=9C=AC=E9=83=A8=E5=8F=8A=E4=BB=A5=E4=B8=8B=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=202.=E5=8F=B0=E8=B4=A6=E4=BB=A3=E7=A0=81=E8=B0=83=E6=95=B4=203?= =?UTF-8?q?.=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8=E5=8F=96=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fs/plugin/form/AnnualBudgetPlugin.java | 1 + .../form/DailyloanbillExpAccPlugin.java | 51 +++++- .../form/DailyreimbursExpAccPlugin.java | 49 +++++- .../plugin/form/DefaultExpenseItemPlugin.java | 2 + .../plugin/form/OverseaStaysLimitPlugin.java | 66 ++++---- .../plugin/form/PrepaybillContractPlugin.java | 33 +++- .../plugin/form/PrepaybillExpAccPlugin.java | 49 +++++- .../PublicreimbursebillContractPlugin.java | 38 ++++- .../form/PublicreimbursebillExpAccPlugin.java | 51 +++++- .../TripreimbursebillAbroadAlertedPlugin.java | 147 +++++++++++------- .../form/TripstandAccmodationAutoPlugin.java | 59 +++++++ .../fs/plugin/form/UserHomeConfPlugin.java | 1 + .../fs/plugin/form/UserVisitSetPlugin.java | 1 + .../plugin/operate/ApprovalCheckFlowOp.java | 30 +++- .../operate/DailyreimbursVisitCheckOp.java | 38 ++++- .../plugin/operate/TripreimbursebillUpOp.java | 85 +++++----- 16 files changed, 522 insertions(+), 179 deletions(-) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/AnnualBudgetPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/AnnualBudgetPlugin.java index 52a0ef7..03b27c2 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/AnnualBudgetPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/AnnualBudgetPlugin.java @@ -18,6 +18,7 @@ import java.text.SimpleDateFormat; /** * 单据界面插件 * 人员年度预算单界面插件 + * 矿山新增二开 */ public class AnnualBudgetPlugin extends AbstractBillPlugIn implements Plugin { diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java index 2d9bf3a..875be37 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java @@ -1,6 +1,7 @@ package zcgj.zcdev.zcdev.fs.plugin.form; import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.CloneUtils; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; @@ -20,9 +21,15 @@ import kd.bos.logging.LogFactory; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.sdk.plugin.Plugin; +import java.util.ArrayList; import java.util.EventObject; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; /** * 借款单会计科目与费用项目关联插件 @@ -56,14 +63,24 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu @Override public void registerListener(EventObject e) { super.registerListener(e); - BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); - fieldEdit.addBeforeF7SelectListener(this); - fieldEdit.addAfterF7SelectListener(this); - - BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM); - fieldEditExpense.addBeforeF7SelectListener(this); - fieldEditExpense.addAfterF7SelectListener(this); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 costcompany + //costcompany 费用承担公司 + DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); + long costcompanyId = costcompany.getLong("id"); + if(isKS(currentOrgId) && isKS(costcompanyId)){ + BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); + fieldEdit.addBeforeF7SelectListener(this); + fieldEdit.addAfterF7SelectListener(this); + BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM); + fieldEditExpense.addBeforeF7SelectListener(this); + fieldEditExpense.addAfterF7SelectListener(this); + } } @Override @@ -195,4 +212,24 @@ 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; + } + return false; + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java index 45b8efe..ccba7c4 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java @@ -1,6 +1,7 @@ package zcgj.zcdev.zcdev.fs.plugin.form; import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.CloneUtils; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; @@ -20,9 +21,15 @@ import kd.bos.logging.LogFactory; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.sdk.plugin.Plugin; +import java.util.ArrayList; import java.util.EventObject; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; /** * 费用报销单会计科目与费用项目关联插件 @@ -53,13 +60,24 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu @Override public void registerListener(EventObject e) { super.registerListener(e); - BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); - fieldEdit.addBeforeF7SelectListener(this); - fieldEdit.addAfterF7SelectListener(this); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户的主职部门(组织) + Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 + //costcompany 费用承担公司 + DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); + long costcompanyId = costcompany.getLong("id"); + if(isKS(currentOrgId) && isKS(costcompanyId)){ + BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); + fieldEdit.addBeforeF7SelectListener(this); + fieldEdit.addAfterF7SelectListener(this); - BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM); - fieldEditExpense.addBeforeF7SelectListener(this); - fieldEditExpense.addAfterF7SelectListener(this); + BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM); + fieldEditExpense.addBeforeF7SelectListener(this); + fieldEditExpense.addAfterF7SelectListener(this); + } } @Override @@ -193,5 +211,22 @@ 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; + } + return false; + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DefaultExpenseItemPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DefaultExpenseItemPlugin.java index 8970465..a44bdf4 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DefaultExpenseItemPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DefaultExpenseItemPlugin.java @@ -63,4 +63,6 @@ public class DefaultExpenseItemPlugin extends AbstractBillPlugIn implements Plu } } + + } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OverseaStaysLimitPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OverseaStaysLimitPlugin.java index 5b89067..c10455d 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OverseaStaysLimitPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OverseaStaysLimitPlugin.java @@ -1,6 +1,7 @@ package zcgj.zcdev.zcdev.fs.plugin.form; import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.datamodel.IDataModel; @@ -18,10 +19,16 @@ import kd.bos.logging.LogFactory; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.sdk.plugin.Plugin; import java.math.BigDecimal; +import java.util.ArrayList; import java.util.EventObject; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; /** * 国外住宿费标准 @@ -35,8 +42,16 @@ public class OverseaStaysLimitPlugin extends AbstractBillPlugIn implements Plugi @Override public void registerListener(EventObject e) { super.registerListener(e); - BasedataEdit fieldEdit = this.getView().getControl("zcgj_district_f7"); - fieldEdit.addBeforeF7SelectListener(this); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 + if(isKS(currentOrgId)){ + BasedataEdit fieldEdit = this.getView().getControl("zcgj_district_f7"); + fieldEdit.addBeforeF7SelectListener(this); + } } @Override @@ -50,37 +65,24 @@ public class OverseaStaysLimitPlugin extends AbstractBillPlugIn implements Plugi } } - /*@Override - public void propertyChanged(PropertyChangedArgs e) { - super.propertyChanged(e); - String name = e.getProperty().getName(); - if("zcgj_district_f7".equals(name)){ - IDataModel model = this.getModel(); - ChangeData[] changeSet = e.getChangeSet(); - DynamicObject newValue = (DynamicObject)changeSet[0].getNewValue(); - long id = newValue.getLong("id"); - //获取地域详细信息 - //bd_admindivision - DynamicObject cityObj = BusinessDataServiceHelper.loadSingle("bd_admindivision", "country", - new QFilter[]{new QFilter("id", QCP.equals,id)}); - if(cityObj!=null){ - DynamicObject country = cityObj.getDynamicObject("country"); - long countryId = country.getLong("id"); - //获取所属国家 - //bd_country - DynamicObject countryObj = BusinessDataServiceHelper.loadSingle("bd_country", "number,name,twocountrycode", - new QFilter[]{new QFilter("id", QCP.equals,countryId)}); - if(countryObj!=null){ - String twocountrycode = countryObj.getString("twocountrycode"); - String countname = countryObj.getString("name"); - if(!"CN".equals(twocountrycode)){ - //保存国家id - // this.getModel().setValue("zcgj_countryid",countryId); - } - } - } + /** + * 判断是否为矿山 + */ + 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; } - }*/ + return false; + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillContractPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillContractPlugin.java index 2ce2163..1f2156d 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillContractPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillContractPlugin.java @@ -1,6 +1,7 @@ package zcgj.zcdev.zcdev.fs.plugin.form; import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.CloneUtils; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; @@ -22,12 +23,14 @@ import kd.bos.logging.LogFactory; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.sdk.plugin.Plugin; import java.time.LocalDate; import java.time.ZoneId; -import java.util.Date; -import java.util.EventObject; +import java.util.*; +import java.util.stream.Collectors; /** * 预付单去年合同提醒插件 @@ -44,7 +47,12 @@ public class PrepaybillContractPlugin extends AbstractBillPlugIn implements Plug @Override public void beforeDoOperation(BeforeDoOperationEventArgs args) { - if((args.getSource() instanceof Submit) ) { + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 + if(isKS(currentOrgId) && (args.getSource() instanceof Submit) ) { Submit source = (Submit) args.getSource(); if (source.getOperateKey().equals("submit")) { //获取当前页面的数据包 @@ -71,7 +79,24 @@ 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; + } + return false; + } /** * 将 java.util.Date 转换为 java.time.LocalDate * @param date java.util.Date diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java index 71a5c02..6ab12be 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java @@ -1,6 +1,7 @@ package zcgj.zcdev.zcdev.fs.plugin.form; import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.CloneUtils; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; @@ -20,9 +21,15 @@ import kd.bos.logging.LogFactory; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.sdk.plugin.Plugin; +import java.util.ArrayList; import java.util.EventObject; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; /** * 预付单会计科目与费用项目关联插件 @@ -56,13 +63,24 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin @Override public void registerListener(EventObject e) { super.registerListener(e); - BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); - fieldEdit.addBeforeF7SelectListener(this); - fieldEdit.addAfterF7SelectListener(this); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 costcompany + //costcompany 费用承担公司 + DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); + long costcompanyId = costcompany.getLong("id"); + if(isKS(currentOrgId) && isKS(costcompanyId)){ + BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); + fieldEdit.addBeforeF7SelectListener(this); + fieldEdit.addAfterF7SelectListener(this); - BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM); - fieldEditExpense.addBeforeF7SelectListener(this); - fieldEditExpense.addAfterF7SelectListener(this); + BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM); + fieldEditExpense.addBeforeF7SelectListener(this); + fieldEditExpense.addAfterF7SelectListener(this); + } } @@ -195,4 +213,23 @@ 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; + } + return false; + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillContractPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillContractPlugin.java index a60b37b..8f37c90 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillContractPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillContractPlugin.java @@ -1,17 +1,27 @@ package zcgj.zcdev.zcdev.fs.plugin.form; import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.operate.Submit; import kd.bos.form.events.BeforeDoOperationEventArgs; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.sdk.plugin.Plugin; import java.time.LocalDate; import java.time.ZoneId; +import java.util.ArrayList; import java.util.Date; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; /** * 对公报销单去年合同提醒插件 @@ -27,8 +37,13 @@ public class PublicreimbursebillContractPlugin extends AbstractBillPlugIn implem @Override public void beforeDoOperation(BeforeDoOperationEventArgs args) { - - if((args.getSource() instanceof Submit) ) { + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 + if(isKS(currentOrgId)&&(args.getSource() instanceof Submit) ) { Submit source = (Submit) args.getSource(); if (source.getOperateKey().equals("submit")) { //获取当前页面的数据包 @@ -52,7 +67,24 @@ 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; + } + return false; + } /** * 将 java.util.Date 转换为 java.time.LocalDate diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java index b4bf7d3..bee6343 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java @@ -1,6 +1,7 @@ package zcgj.zcdev.zcdev.fs.plugin.form; import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.CloneUtils; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; @@ -20,9 +21,15 @@ import kd.bos.logging.LogFactory; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.sdk.plugin.Plugin; +import java.util.ArrayList; import java.util.EventObject; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; /** * 对公报销单会计科目与费用项目关联插件 @@ -56,14 +63,24 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen @Override public void registerListener(EventObject e) { super.registerListener(e); - BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); - fieldEdit.addBeforeF7SelectListener(this); - fieldEdit.addAfterF7SelectListener(this); - - BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM); - fieldEditExpense.addBeforeF7SelectListener(this); - fieldEditExpense.addAfterF7SelectListener(this); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 costcompany + //costcompany 费用承担公司 + DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); + long costcompanyId = costcompany.getLong("id"); + if(isKS(currentOrgId) && isKS(costcompanyId)){ + BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); + fieldEdit.addBeforeF7SelectListener(this); + fieldEdit.addAfterF7SelectListener(this); + BasedataEdit fieldEditExpense = this.getView().getControl(EXPENSE_ITEM); + fieldEditExpense.addBeforeF7SelectListener(this); + fieldEditExpense.addAfterF7SelectListener(this); + } } @Override @@ -195,4 +212,24 @@ 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; + } + return false; + } + } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripreimbursebillAbroadAlertedPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripreimbursebillAbroadAlertedPlugin.java index 4de434d..5527ef1 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripreimbursebillAbroadAlertedPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripreimbursebillAbroadAlertedPlugin.java @@ -1,6 +1,7 @@ package zcgj.zcdev.zcdev.fs.plugin.form; import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.entity.datamodel.IDataModel; import kd.bos.entity.datamodel.events.ChangeData; @@ -8,13 +9,15 @@ import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.sdk.plugin.Plugin; import java.io.InputStream; import java.math.BigDecimal; import java.math.RoundingMode; -import java.util.HashMap; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 差旅报销单国外住宿标准提醒插件 @@ -28,71 +31,95 @@ public class TripreimbursebillAbroadAlertedPlugin extends AbstractBillPlugIn imp @Override public void propertyChanged(PropertyChangedArgs e) { super.propertyChanged(e); - String name = e.getProperty().getName(); - //目的地变更 - if("to".equals(name)){ - IDataModel model = this.getModel(); - ChangeData[] changeSet = e.getChangeSet(); - DynamicObject newValue = (DynamicObject)changeSet[0].getNewValue(); - if(newValue!=null){ - long id = newValue.getLong("id"); - //获取地域详细信息 - //bd_admindivision - DynamicObject cityObj = BusinessDataServiceHelper.loadSingle("bd_admindivision", "country", - new QFilter[]{new QFilter("id", QCP.equals,id)}); - if(cityObj!=null){ - long cityId = cityObj.getLong("id"); - DynamicObject country = cityObj.getDynamicObject("country"); - long countryId = country.getLong("id"); - //获取所属国家 - //bd_country - DynamicObject countryObj = BusinessDataServiceHelper.loadSingle("bd_country", "number,name,twocountrycode", - new QFilter[]{new QFilter("id", QCP.equals,countryId)}); - if(countryObj!=null){ - String twocountrycode = countryObj.getString("twocountrycode"); - String countname = countryObj.getString("name"); - if(!"CN".equals(twocountrycode)){ - DynamicObject[] load = BusinessDataServiceHelper.load("zcgj_oversea_stays_limit", - "zcgj_district_f7,zcgj_country,zcgj_currency,zcgj_stays_criteria,zcgj_rate" - , new QFilter[]{new QFilter("zcgj_country", QCP.equals, countryId)}); - BigDecimal otherAmount = BigDecimal.ZERO; - BigDecimal cirtyAmount = BigDecimal.ZERO; - BigDecimal rate = BigDecimal.ZERO; - String currencyName = ""; - String currencySign = ""; - if(load == null || load.length<1){ - // this.getView().showTipNotification("当前出差国家为:"+countname+",未设置住宿标准!"); - }else{ - Map map = new HashMap<>(); - for (DynamicObject dynamicObject : load) { - DynamicObject zcgjCountry = dynamicObject.getDynamicObject("zcgj_country"); - DynamicObject zcgjDistrictF7 = dynamicObject.getDynamicObject("zcgj_district_f7"); - DynamicObject zcgjCurrency = dynamicObject.getDynamicObject("zcgj_currency"); - BigDecimal zcgjStaysCriteria = dynamicObject.getBigDecimal("zcgj_stays_criteria"); - BigDecimal zcgjRate = dynamicObject.getBigDecimal("zcgj_rate"); - rate=zcgjRate; - currencyName = zcgjCurrency.getString("name"); - if(zcgjDistrictF7 ==null ){ - otherAmount = zcgjStaysCriteria.multiply(zcgjRate); - }else if(cityId == zcgjDistrictF7.getLong("id")){ - cirtyAmount = zcgjStaysCriteria.multiply(zcgjRate); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 + if(isKS(currentOrgId)){ + String name = e.getProperty().getName(); + //目的地变更 + if("to".equals(name)){ + IDataModel model = this.getModel(); + ChangeData[] changeSet = e.getChangeSet(); + DynamicObject newValue = (DynamicObject)changeSet[0].getNewValue(); + if(newValue!=null){ + long id = newValue.getLong("id"); + //获取地域详细信息 + //bd_admindivision + DynamicObject cityObj = BusinessDataServiceHelper.loadSingle("bd_admindivision", "country", + new QFilter[]{new QFilter("id", QCP.equals,id)}); + if(cityObj!=null){ + long cityId = cityObj.getLong("id"); + DynamicObject country = cityObj.getDynamicObject("country"); + long countryId = country.getLong("id"); + //获取所属国家 + //bd_country + DynamicObject countryObj = BusinessDataServiceHelper.loadSingle("bd_country", "number,name,twocountrycode", + new QFilter[]{new QFilter("id", QCP.equals,countryId)}); + if(countryObj!=null){ + String twocountrycode = countryObj.getString("twocountrycode"); + String countname = countryObj.getString("name"); + if(!"CN".equals(twocountrycode)){ + DynamicObject[] load = BusinessDataServiceHelper.load("zcgj_oversea_stays_limit", + "zcgj_district_f7,zcgj_country,zcgj_currency,zcgj_stays_criteria,zcgj_rate" + , new QFilter[]{new QFilter("zcgj_country", QCP.equals, countryId)}); + BigDecimal otherAmount = BigDecimal.ZERO; + BigDecimal cirtyAmount = BigDecimal.ZERO; + BigDecimal rate = BigDecimal.ZERO; + String currencyName = ""; + String currencySign = ""; + if(load == null || load.length<1){ + // this.getView().showTipNotification("当前出差国家为:"+countname+",未设置住宿标准!"); + }else{ + Map map = new HashMap<>(); + for (DynamicObject dynamicObject : load) { + DynamicObject zcgjCountry = dynamicObject.getDynamicObject("zcgj_country"); + DynamicObject zcgjDistrictF7 = dynamicObject.getDynamicObject("zcgj_district_f7"); + DynamicObject zcgjCurrency = dynamicObject.getDynamicObject("zcgj_currency"); + BigDecimal zcgjStaysCriteria = dynamicObject.getBigDecimal("zcgj_stays_criteria"); + BigDecimal zcgjRate = dynamicObject.getBigDecimal("zcgj_rate"); + rate=zcgjRate; + currencyName = zcgjCurrency.getString("name"); + if(zcgjDistrictF7 ==null ){ + otherAmount = zcgjStaysCriteria.multiply(zcgjRate); + }else if(cityId == zcgjDistrictF7.getLong("id")){ + cirtyAmount = zcgjStaysCriteria.multiply(zcgjRate); + } + } + if(!BigDecimal.ZERO.equals(otherAmount) && BigDecimal.ZERO.equals(cirtyAmount) ){ + this.getView().showTipNotification("当前出差国家为:"+countname+",汇率为:"+rate.setScale(4, RoundingMode.HALF_UP)+",住宿标准每人每天为(人民币):"+otherAmount.setScale(4, RoundingMode.HALF_UP)+"元"); + }else if(!BigDecimal.ZERO.equals(cirtyAmount) ){ + this.getView().showTipNotification("当前出差国家为:"+countname+",汇率为:"+rate.setScale(4, RoundingMode.HALF_UP)+",住宿标准每人每天为(人民币):"+cirtyAmount.setScale(4, RoundingMode.HALF_UP)+"元"); } - } - if(!BigDecimal.ZERO.equals(otherAmount) && BigDecimal.ZERO.equals(cirtyAmount) ){ - this.getView().showTipNotification("当前出差国家为:"+countname+",汇率为:"+rate.setScale(4, RoundingMode.HALF_UP)+",住宿标准每人每天为(人民币):"+otherAmount.setScale(4, RoundingMode.HALF_UP)+"元"); - }else if(!BigDecimal.ZERO.equals(cirtyAmount) ){ - this.getView().showTipNotification("当前出差国家为:"+countname+",汇率为:"+rate.setScale(4, RoundingMode.HALF_UP)+",住宿标准每人每天为(人民币):"+cirtyAmount.setScale(4, RoundingMode.HALF_UP)+"元"); } } } } } + + InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("fs.properties"); } - - InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("fs.properties"); - System.out.println(); - - } } + + /** + * 判断是否为矿山 + */ + 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; + } + return false; + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java new file mode 100644 index 0000000..5f2ccf0 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java @@ -0,0 +1,59 @@ +package zcgj.zcdev.zcdev.fs.plugin.form; + +import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.form.ConfirmCallBackListener; +import kd.bos.form.MessageBoxOptions; +import kd.bos.form.MessageBoxResult; +import kd.bos.form.control.events.BeforeClickEvent; +import kd.bos.form.control.events.BeforeItemClickEvent; +import kd.bos.form.events.MessageBoxClosedEvent; +import kd.sdk.plugin.Plugin; + +import java.util.EventObject; + +public class TripstandAccmodationAutoPlugin extends AbstractBillPlugIn implements Plugin { + + + @Override + public void registerListener(EventObject e) { + super.registerListener(e); +//监听工具栏按钮点击事件 + this.addItemClickListeners("zcgj_auto_get_data"); + this.addClickListeners("zcgj_auto_get_data"); + } + + @Override + public void beforeClick(BeforeClickEvent evt) { + super.beforeClick(evt); + } + + @Override + public void beforeItemClick(BeforeItemClickEvent evt) { + //工具栏上的所有按钮的点击都会激活itemClick和beforeItemClick方法, 需 //要开发人员实现不同按钮的逻辑 + if (evt.getItemKey().equals("zcgj_auto_get_data")) { + evt.setCancel(true); + ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener("submitconfirm", this); + //设置页面确认框,参数为:标题,选项框类型,回调监听 + this.getView().showConfirm("您确认提交该办公用品登记单吗?", MessageBoxOptions.YesNoCancel, confirmCallBackListener); + } + super.beforeItemClick(evt); + } + + @Override + public void confirmCallBack(MessageBoxClosedEvent messageBoxClosedEvent) { + super.confirmCallBack(messageBoxClosedEvent); + //判断是否是对应确认框的点击回调事件 + if (("submitconfirm").equals(messageBoxClosedEvent.getCallBackId())) { + if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) { + //如果点击确认按钮,则调用提交操作 + // this.getView().invokeOperation("submit"); + this.getView().showMessage("你好"); + } else if (MessageBoxResult.No.equals(messageBoxClosedEvent.getResult())) { + + } else if (MessageBoxResult.Cancel.equals(messageBoxClosedEvent.getResult())) { + // 点击取消的相关处理逻辑。。。。 + } + } + + } +} \ No newline at end of file diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/UserHomeConfPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/UserHomeConfPlugin.java index 283d23a..75dda9d 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/UserHomeConfPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/UserHomeConfPlugin.java @@ -15,6 +15,7 @@ import kd.sdk.plugin.Plugin; /** * 来往家居地配置界面插件 + * 矿山二开新功能 */ public class UserHomeConfPlugin extends AbstractBillPlugIn implements Plugin { diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/UserVisitSetPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/UserVisitSetPlugin.java index f11ae39..9ba08cd 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/UserVisitSetPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/UserVisitSetPlugin.java @@ -14,6 +14,7 @@ import kd.sdk.plugin.Plugin; /** * 人员探亲配置界面插件 + * 矿山二开新功能 */ public class UserVisitSetPlugin extends AbstractBillPlugIn implements Plugin { //开发商标识 diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java index b45c5eb..87a89e7 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java @@ -6,10 +6,13 @@ import kd.bos.dataentity.entity.DynamicObject; import kd.bos.entity.ExtendedDataEntity; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AddValidatorsEventArgs; +import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.validate.AbstractValidator; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper; import kd.bos.servicehelper.workflow.WorkflowServiceHelper; import kd.bos.workflow.api.AgentExecution; @@ -19,6 +22,7 @@ import kd.bos.workflow.engine.extitf.IWorkflowPlugin; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.util.*; +import java.util.stream.Collectors; /** * 判断当前审批人是否为提交人 @@ -26,6 +30,12 @@ import java.util.*; */ public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn { + @Override + public void onPreparePropertys(PreparePropertysEventArgs e) { + super.onPreparePropertys(e); + e.getFieldKeys().add("formid"); + e.getFieldKeys().add("id"); + } @Override public void onAddValidators(AddValidatorsEventArgs e) { @@ -45,7 +55,7 @@ public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn { String billId = dataEntity.getString("id"); String formid = dataEntity.getString("formid"); //获取报销人 - //DynamicObject applier = dataEntity.getDynamicObject("applier"); + //DynamicObject applier = dataEntity.getDynam+icObject("applier"); //long applierId = applier.getLong("id"); boolean isOk = true; //所有审批记录,从审批记录中获取已经审批过的人 @@ -69,4 +79,22 @@ 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; + } + return false; + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyreimbursVisitCheckOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyreimbursVisitCheckOp.java index 1461dc7..8334e74 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyreimbursVisitCheckOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyreimbursVisitCheckOp.java @@ -2,6 +2,7 @@ package zcgj.zcdev.zcdev.fs.plugin.operate; import kd.bos.algo.DataSet; import kd.bos.algo.Row; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.entity.ExtendedDataEntity; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; @@ -10,7 +11,10 @@ import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.validate.AbstractValidator; import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import java.text.SimpleDateFormat; import java.time.LocalDate; @@ -18,6 +22,7 @@ import java.time.Month; import java.time.ZoneId; import java.time.temporal.TemporalAdjusters; import java.util.*; +import java.util.stream.Collectors; /** * 费用报销单探亲检查 @@ -42,7 +47,15 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn { @Override public void onAddValidators(AddValidatorsEventArgs e) { super.onAddValidators(e); - e.getValidators().add(new ValidatorExt()); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 + if(isKS(currentOrgId)){ + e.getValidators().add(new ValidatorExt()); + } } class ValidatorExt extends AbstractValidator { @@ -76,7 +89,7 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn { //探亲类型 1:探望父母,2:探望配偶 String visitType = dataEntity.getString(prefix + "_visit_type"); - + //判断是否探亲 if(isVisit){ //获取当前人的探亲假配置 @@ -275,7 +288,7 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn { DataSet dateSet = QueryServiceHelper.queryDataSet( this.getClass().getName(), "er_dailyreimbursebill", - "id,billno,zcgj_holiday_start_time as startTime,zcgj_holiday_end_time as endTime,zcgj_is_home as ishome", + "id,billno,zcgj_holiday_start_time as startTime,zcgj_holiday_end_time as endTime,zcgj_is_home as ishome,", filterArray, null ); int goHomeCount = 0; @@ -371,5 +384,24 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn { } 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; + } + return false; + } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillUpOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillUpOp.java index cad584e..c272d30 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillUpOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillUpOp.java @@ -1,5 +1,6 @@ package zcgj.zcdev.zcdev.fs.plugin.operate; +import kd.bos.context.RequestContext; import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.entity.ExtendedDataEntity; @@ -9,9 +10,18 @@ import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.validate.AbstractValidator; import kd.bos.logging.Log; import kd.bos.logging.LogFactory; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import kd.bos.servicehelper.org.OrgUnitServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import java.math.BigDecimal; import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; /** * 差旅报销单上浮20%控制 @@ -34,7 +44,15 @@ public class TripreimbursebillUpOp extends AbstractOperationServicePlugIn { @Override public void onAddValidators(AddValidatorsEventArgs e) { super.onAddValidators(e); - e.getValidators().add(new ValidatorExt()); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 + Long currentOrgId = RequestContext.get().getOrgId(); + //当前所在的组织是属于矿山下的 + if(isKS(currentOrgId)){ + e.getValidators().add(new ValidatorExt()); + } } class ValidatorExt extends AbstractValidator { @@ -79,53 +97,22 @@ public class TripreimbursebillUpOp extends AbstractOperationServicePlugIn { } } - /*@Override - public void beforeDoOperation(BeforeDoOperationEventArgs args) { - if((args.getSource() instanceof Submit) ){ - Submit source = (Submit)args.getSource(); - if(source.getOperateKey().equals("submit") ){ - //highseasontripstdshow - //提交时校验附件是否必填 - IDataModel model = this.getModel(); - String zsKey = String.valueOf(model.getValue("zcgj_zs_key")); - boolean isfloating20 = Boolean.parseBoolean(model.getValue("zcgj_isfloating20")+""); - - //获取当前费用为住宿的 - DynamicObjectCollection tripentryCollection = model.getEntryEntity("tripentry"); - //tripentry.get(0).getDynamicObjectCollection("entryentity").get(2).getDynamicObject("expenseitem").getString("number"); - for (DynamicObject tripentry : tripentryCollection) { - DynamicObjectCollection entryentityCollection = tripentry.getDynamicObjectCollection("entryentity"); - for (DynamicObject entryentity : entryentityCollection) { - DynamicObject expenseitem = entryentity.getDynamicObject("expenseitem"); - String zsNumber = expenseitem.getString("number"); - if(zsKey.equals(zsNumber)){ - BigDecimal orientryamount = entryentity.getBigDecimal("orientryamount");//报销金额 - BigDecimal tripstandardamount = entryentity.getBigDecimal("tripstandardamount");//差旅标准金额 - Integer caldaycount = entryentity.getInt("caldaycount");//标准天数 - //如果选择了上浮20%,则按照上浮20%进行判断 - if(isfloating20){ - //BigDecimal multiply = tripstandardamount.multiply(new BigDecimal("1.2")).multiply(new BigDecimal(caldaycount)); - BigDecimal multiply = tripstandardamount.multiply(new BigDecimal(caldaycount)); - //-1表示小于,0是等于,1是大于 - if(orientryamount.compareTo(multiply) > 0){ - this.getView().showTipNotification("报销住宿超出标准!(上浮20%)"); - //取消提交操作 - args.setCancel(true); - } - }else{ - BigDecimal multiply = tripstandardamount.multiply(new BigDecimal(caldaycount)); - //-1表示小于,0是等于,1是大于 - if(orientryamount.compareTo(multiply) > 0){ - this.getView().showTipNotification("报销住宿超出标准!"); - //取消提交操作 - args.setCancel(true); - } - } - } - } - - } - } + /** + * 判断是否为矿山 + */ + 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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; } - }*/ + return false; + } } From c55ed5d85a1b5d2524e6badf7051fe373f967f48 Mon Sep 17 00:00:00 2001 From: zhangzhiguo Date: Fri, 27 Dec 2024 11:09:08 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=9B=BD=E5=A4=96=E4=BD=8F=E5=AE=BF?= =?UTF-8?q?=E6=A0=87=E5=87=86=E5=A2=9E=E5=8A=A0=E8=87=AA=E5=8A=A8=E5=8F=96?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../form/TripstandAccmodationAutoPlugin.java | 40 ++++++++++++++----- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java index 5f2ccf0..bdd0401 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java @@ -1,12 +1,18 @@ package zcgj.zcdev.zcdev.fs.plugin.form; import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.form.ConfirmCallBackListener; import kd.bos.form.MessageBoxOptions; import kd.bos.form.MessageBoxResult; import kd.bos.form.control.events.BeforeClickEvent; import kd.bos.form.control.events.BeforeItemClickEvent; +import kd.bos.form.control.events.ItemClickEvent; import kd.bos.form.events.MessageBoxClosedEvent; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.sdk.plugin.Plugin; import java.util.EventObject; @@ -18,13 +24,8 @@ public class TripstandAccmodationAutoPlugin extends AbstractBillPlugIn implemen public void registerListener(EventObject e) { super.registerListener(e); //监听工具栏按钮点击事件 - this.addItemClickListeners("zcgj_auto_get_data"); - this.addClickListeners("zcgj_auto_get_data"); - } - - @Override - public void beforeClick(BeforeClickEvent evt) { - super.beforeClick(evt); + this.addItemClickListeners("advcontoolbarap"); + //this.addClickListeners("advcontoolbarap"); } @Override @@ -34,7 +35,7 @@ public class TripstandAccmodationAutoPlugin extends AbstractBillPlugIn implemen evt.setCancel(true); ConfirmCallBackListener confirmCallBackListener = new ConfirmCallBackListener("submitconfirm", this); //设置页面确认框,参数为:标题,选项框类型,回调监听 - this.getView().showConfirm("您确认提交该办公用品登记单吗?", MessageBoxOptions.YesNoCancel, confirmCallBackListener); + this.getView().showConfirm("此操作将会覆盖现有当前标准明细数据。", MessageBoxOptions.YesNo, confirmCallBackListener); } super.beforeItemClick(evt); } @@ -47,11 +48,28 @@ public class TripstandAccmodationAutoPlugin extends AbstractBillPlugIn implemen if (MessageBoxResult.Yes.equals(messageBoxClosedEvent.getResult())) { //如果点击确认按钮,则调用提交操作 // this.getView().invokeOperation("submit"); - this.getView().showMessage("你好"); + //QFilter filterOrgId = new QFilter("number", QCP.equals,rootOrgCode);//中材矿山建设有限公司 + DynamicObject[] consumeStays = BusinessDataServiceHelper.load("zcgj_consume_stays", "zcgj_tripexpenseitem,zcgj_triparea,zcgj_currency," + + "zcgj_standardamount,zcgj_highseasonstandardam", new QFilter[]{}); + DynamicObjectCollection entryEntity = this.getModel().getDataEntity(true).getDynamicObjectCollection("entryentity"); + entryEntity.clear(); + getView().updateView(); + for (DynamicObject dynamicObject : consumeStays) { + DynamicObject dynamicObject1 = entryEntity.addNew(); + dynamicObject1.set("tripstandardtype",dynamicObject.getDynamicObject("zcgj_tripexpenseitem"));//差旅项目 + dynamicObject1.set("triparea",dynamicObject.getDynamicObject("zcgj_triparea"));//出差地域 + dynamicObject1.set("currency",dynamicObject.getDynamicObject("zcgj_currency"));//币别 + dynamicObject1.set("standardamount",dynamicObject.getBigDecimal("zcgj_standardamount"));//标准人天 + dynamicObject1.set("highseasonstandardamount",dynamicObject.getBigDecimal("zcgj_highseasonstandardam"));//旺季标准 + } + getView().updateView(); + if(consumeStays!=null){ + this.getView().showMessage("取数完成,共获取"+consumeStays.length+"条数据!"); + }else{ + this.getView().showMessage("取数完成,共获取0条数据!"); + } } else if (MessageBoxResult.No.equals(messageBoxClosedEvent.getResult())) { - } else if (MessageBoxResult.Cancel.equals(messageBoxClosedEvent.getResult())) { - // 点击取消的相关处理逻辑。。。。 } } From 5f8a4a4c41e30bd71a8f9d3211a98cc67f81b96a Mon Sep 17 00:00:00 2001 From: zhangzhiguo Date: Fri, 27 Dec 2024 17:16:32 +0800 Subject: [PATCH 3/3] =?UTF-8?q?1.=E6=8F=90=E5=8F=96=E7=9F=BF=E5=B1=B1?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E5=88=A4=E6=96=AD=E9=80=BB=E8=BE=91=E8=87=B3?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E7=B1=BB=202.=E5=90=88=E5=90=8C=E5=8F=B0?= =?UTF-8?q?=E8=B4=A6=E7=AD=BE=E7=BA=A6=E6=96=B9=E9=BB=98=E8=AE=A4=E4=B8=BA?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E4=BA=BA=E7=BB=84=E7=BB=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ontractbillContractpartyDefaultPlugin.java | 29 ++++++++++++++++ .../form/DailyloanbillExpAccPlugin.java | 21 +----------- .../form/DailyreimbursExpAccPlugin.java | 21 ++---------- .../form/DailyreimbursVisitCheckPlugin.java | 11 ++++-- .../zcdev/fs/plugin/form/OrgCheckUtils.java | 34 +++++++++++++++++++ .../plugin/form/OverseaStaysLimitPlugin.java | 21 ++---------- .../plugin/form/PrepaybillContractPlugin.java | 20 +---------- .../plugin/form/PrepaybillExpAccPlugin.java | 20 +---------- .../PublicreimbursebillContractPlugin.java | 21 ++---------- .../form/PublicreimbursebillExpAccPlugin.java | 20 +---------- .../TripreimbursebillAbroadAlertedPlugin.java | 22 ++---------- .../form/TripstandAccmodationAutoPlugin.java | 3 ++ .../plugin/operate/ApprovalCheckFlowOp.java | 19 +---------- .../operate/DailyreimbursVisitCheckOp.java | 21 ++---------- .../plugin/operate/TripreimbursebillUpOp.java | 21 ++---------- 15 files changed, 92 insertions(+), 212 deletions(-) create mode 100644 code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/ContractbillContractpartyDefaultPlugin.java create mode 100644 code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OrgCheckUtils.java diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/ContractbillContractpartyDefaultPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/ContractbillContractpartyDefaultPlugin.java new file mode 100644 index 0000000..dd26891 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/ContractbillContractpartyDefaultPlugin.java @@ -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); + } + } +} diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java index 875be37..b0614a4 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyloanbillExpAccPlugin.java @@ -72,7 +72,7 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu //costcompany 费用承担公司 DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); long costcompanyId = costcompany.getLong("id"); - if(isKS(currentOrgId) && isKS(costcompanyId)){ + if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){ BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); fieldEdit.addBeforeF7SelectListener(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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java index ccba7c4..736c3f4 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursExpAccPlugin.java @@ -69,7 +69,7 @@ public class DailyreimbursExpAccPlugin extends AbstractBillPlugIn implements Plu //costcompany 费用承担公司 DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); long costcompanyId = costcompany.getLong("id"); - if(isKS(currentOrgId) && isKS(costcompanyId)){ + if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){ BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); fieldEdit.addBeforeF7SelectListener(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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } + } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursVisitCheckPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursVisitCheckPlugin.java index 60ab7f1..ca83063 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursVisitCheckPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/DailyreimbursVisitCheckPlugin.java @@ -16,6 +16,7 @@ import kd.bos.orm.query.QCP; import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; +import kd.bos.servicehelper.user.UserServiceHelper; import kd.sdk.plugin.Plugin; import java.text.SimpleDateFormat; @@ -55,9 +56,13 @@ public class DailyreimbursVisitCheckPlugin extends AbstractBillPlugIn implemen @Override public void afterCreateNewData(EventObject e) { super.afterCreateNewData(e); - 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); + Long currentUserId = UserServiceHelper.getCurrentUserId(); + // 当前用户所属组织 + 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); } /** diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OrgCheckUtils.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OrgCheckUtils.java new file mode 100644 index 0000000..c279b93 --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OrgCheckUtils.java @@ -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 orgIds = new ArrayList<>(1); + //orgIds.add(1692204547985902592L); + orgIds.add(orgId); + List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); + Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); + if(orgSer.contains(currentOrgId)){ + return true; + } + return false; + } +} diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OverseaStaysLimitPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OverseaStaysLimitPlugin.java index c10455d..98ca42f 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OverseaStaysLimitPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/OverseaStaysLimitPlugin.java @@ -33,6 +33,7 @@ import java.util.stream.Collectors; /** * 国外住宿费标准 */ +@Deprecated public class OverseaStaysLimitPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener { 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(); //当前所在的组织是属于矿山下的 - if(isKS(currentOrgId)){ + if(OrgCheckUtils.isKS(currentOrgId)){ BasedataEdit fieldEdit = this.getView().getControl("zcgj_district_f7"); 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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillContractPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillContractPlugin.java index 1f2156d..63c6c13 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillContractPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillContractPlugin.java @@ -52,7 +52,7 @@ public class PrepaybillContractPlugin extends AbstractBillPlugIn implements Plug //当前切换选择的组织 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(); 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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } /** * 将 java.util.Date 转换为 java.time.LocalDate * @param date java.util.Date diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java index 6ab12be..edd0a19 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PrepaybillExpAccPlugin.java @@ -72,7 +72,7 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin //costcompany 费用承担公司 DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); long costcompanyId = costcompany.getLong("id"); - if(isKS(currentOrgId) && isKS(costcompanyId)){ + if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){ BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); fieldEdit.addBeforeF7SelectListener(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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillContractPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillContractPlugin.java index 8f37c90..223f34f 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillContractPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillContractPlugin.java @@ -43,7 +43,7 @@ public class PublicreimbursebillContractPlugin extends AbstractBillPlugIn implem //当前切换选择的组织 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(); 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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } + /** * 将 java.util.Date 转换为 java.time.LocalDate diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java index bee6343..a43a815 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/PublicreimbursebillExpAccPlugin.java @@ -72,7 +72,7 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen //costcompany 费用承担公司 DynamicObject costcompany = (DynamicObject)this.getModel().getValue("costcompany"); long costcompanyId = costcompany.getLong("id"); - if(isKS(currentOrgId) && isKS(costcompanyId)){ + if(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.isKS(costcompanyId)){ BasedataEdit fieldEdit = this.getView().getControl(ACCOUNT_ITEM); fieldEdit.addBeforeF7SelectListener(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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripreimbursebillAbroadAlertedPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripreimbursebillAbroadAlertedPlugin.java index 5527ef1..7395b0f 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripreimbursebillAbroadAlertedPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripreimbursebillAbroadAlertedPlugin.java @@ -21,7 +21,9 @@ import java.util.stream.Collectors; /** * 差旅报销单国外住宿标准提醒插件 + * 废弃,使用产品自带逻辑 */ +@Deprecated public class TripreimbursebillAbroadAlertedPlugin extends AbstractBillPlugIn implements Plugin { //private static final Log log = LogFactory.getLog(TripreimbursebillPlugin.class); @@ -37,7 +39,7 @@ public class TripreimbursebillAbroadAlertedPlugin extends AbstractBillPlugIn imp //当前切换选择的组织 Long currentOrgId = RequestContext.get().getOrgId(); //当前所在的组织是属于矿山下的 - if(isKS(currentOrgId)){ + if(OrgCheckUtils.isKS(currentOrgId)){ String name = e.getProperty().getName(); //目的地变更 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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java index bdd0401..a57ea8a 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java @@ -17,6 +17,9 @@ import kd.sdk.plugin.Plugin; import java.util.EventObject; +/** + * 住宿标准自动取数 + */ public class TripstandAccmodationAutoPlugin extends AbstractBillPlugIn implements Plugin { diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java index 87a89e7..8d038d0 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/ApprovalCheckFlowOp.java @@ -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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } + } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyreimbursVisitCheckOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyreimbursVisitCheckOp.java index 8334e74..12d8219 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyreimbursVisitCheckOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailyreimbursVisitCheckOp.java @@ -15,6 +15,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.QueryServiceHelper; import kd.bos.servicehelper.org.OrgUnitServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper; +import zcgj.zcdev.zcdev.fs.plugin.form.OrgCheckUtils; import java.text.SimpleDateFormat; import java.time.LocalDate; @@ -53,7 +54,7 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn { //当前切换选择的组织 Long currentOrgId = RequestContext.get().getOrgId(); //当前所在的组织是属于矿山下的 - if(isKS(currentOrgId)){ + if(OrgCheckUtils.isKS(currentOrgId)){ e.getValidators().add(new ValidatorExt()); } } @@ -385,23 +386,5 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn { 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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillUpOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillUpOp.java index c272d30..c7df556 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillUpOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TripreimbursebillUpOp.java @@ -15,6 +15,7 @@ import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.BusinessDataServiceHelper; import kd.bos.servicehelper.org.OrgUnitServiceHelper; import kd.bos.servicehelper.user.UserServiceHelper; +import zcgj.zcdev.zcdev.fs.plugin.form.OrgCheckUtils; import java.math.BigDecimal; import java.text.SimpleDateFormat; @@ -50,7 +51,7 @@ public class TripreimbursebillUpOp extends AbstractOperationServicePlugIn { //当前切换选择的组织 Long currentOrgId = RequestContext.get().getOrgId(); //当前所在的组织是属于矿山下的 - if(isKS(currentOrgId)){ + if(OrgCheckUtils.isKS(currentOrgId)){ 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 orgIds = new ArrayList<>(1); - //orgIds.add(1692204547985902592L); - orgIds.add(orgId); - List subOrgIds = OrgUnitServiceHelper.getAllSubordinateOrgs(1L, orgIds, true); - Set orgSer = subOrgIds.stream().collect(Collectors.toSet()); - if(orgSer.contains(currentOrgId)){ - return true; - } - return false; - } }