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/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 2d9bf3a..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 @@ -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(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.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,5 @@ public class DailyloanbillExpAccPlugin extends AbstractBillPlugIn implements Plu } } } + } 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..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 @@ -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(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.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 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/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/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 5b89067..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 @@ -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,14 +19,21 @@ 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; /** * 国外住宿费标准 */ +@Deprecated public class OverseaStaysLimitPlugin extends AbstractBillPlugIn implements Plugin, BeforeF7SelectListener { private static final Log log = LogFactory.getLog(OverseaStaysLimitPlugin.class); @@ -35,8 +43,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(OrgCheckUtils.isKS(currentOrgId)){ + BasedataEdit fieldEdit = this.getView().getControl("zcgj_district_f7"); + fieldEdit.addBeforeF7SelectListener(this); + } } @Override @@ -50,37 +66,6 @@ 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); - } - } - } - } - }*/ } 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..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 @@ -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(OrgCheckUtils.isKS(currentOrgId) && (args.getSource() instanceof Submit) ) { Submit source = (Submit) args.getSource(); if (source.getOperateKey().equals("submit")) { //获取当前页面的数据包 @@ -71,7 +79,6 @@ public class PrepaybillContractPlugin extends AbstractBillPlugIn implements Plug } } - /** * 将 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..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 @@ -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(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.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,5 @@ public class PrepaybillExpAccPlugin extends AbstractBillPlugIn implements Plugin } } } + } 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..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 @@ -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(OrgCheckUtils.isKS(currentOrgId)&&(args.getSource() instanceof Submit) ) { Submit source = (Submit) args.getSource(); if (source.getOperateKey().equals("submit")) { //获取当前页面的数据包 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..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 @@ -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(OrgCheckUtils.isKS(currentOrgId) && OrgCheckUtils.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,6 @@ public class PublicreimbursebillExpAccPlugin extends AbstractBillPlugIn implemen } } } + + } 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..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 @@ -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,17 +9,21 @@ 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; /** * 差旅报销单国外住宿标准提醒插件 + * 废弃,使用产品自带逻辑 */ +@Deprecated public class TripreimbursebillAbroadAlertedPlugin extends AbstractBillPlugIn implements Plugin { //private static final Log log = LogFactory.getLog(TripreimbursebillPlugin.class); @@ -28,71 +33,77 @@ 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(OrgCheckUtils.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(); - - } } + } 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..a57ea8a --- /dev/null +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/form/TripstandAccmodationAutoPlugin.java @@ -0,0 +1,80 @@ +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; + +/** + * 住宿标准自动取数 + */ +public class TripstandAccmodationAutoPlugin extends AbstractBillPlugIn implements Plugin { + + + @Override + public void registerListener(EventObject e) { + super.registerListener(e); +//监听工具栏按钮点击事件 + this.addItemClickListeners("advcontoolbarap"); + //this.addClickListeners("advcontoolbarap"); + } + + @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.YesNo, 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"); + //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())) { + + } + } + + } +} \ 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..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 @@ -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,5 @@ public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn { } } + } 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..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 @@ -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,11 @@ 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 zcgj.zcdev.zcdev.fs.plugin.form.OrgCheckUtils; import java.text.SimpleDateFormat; import java.time.LocalDate; @@ -18,6 +23,7 @@ import java.time.Month; import java.time.ZoneId; import java.time.temporal.TemporalAdjusters; import java.util.*; +import java.util.stream.Collectors; /** * 费用报销单探亲检查 @@ -42,7 +48,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(OrgCheckUtils.isKS(currentOrgId)){ + e.getValidators().add(new ValidatorExt()); + } } class ValidatorExt extends AbstractValidator { @@ -76,7 +90,7 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn { //探亲类型 1:探望父母,2:探望配偶 String visitType = dataEntity.getString(prefix + "_visit_type"); - + //判断是否探亲 if(isVisit){ //获取当前人的探亲假配置 @@ -275,7 +289,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 +385,6 @@ public class DailyreimbursVisitCheckOp extends AbstractOperationServicePlugIn { } return LocalDate.of(date.getYear() - (years - 1), Month.JANUARY, 1); } + } 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..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 @@ -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,19 @@ 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 zcgj.zcdev.zcdev.fs.plugin.form.OrgCheckUtils; 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 +45,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(OrgCheckUtils.isKS(currentOrgId)){ + e.getValidators().add(new ValidatorExt()); + } } class ValidatorExt extends AbstractValidator { @@ -79,53 +98,4 @@ 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); - } - } - } - } - - } - } - } - }*/ }