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 76b513d..69ff2ea 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 @@ -35,6 +35,7 @@ public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn { super.onPreparePropertys(e); e.getFieldKeys().add("formid"); e.getFieldKeys().add("id"); + e.getFieldKeys().add("applier"); } @Override @@ -49,14 +50,13 @@ public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn { ExtendedDataEntity[] extendedDataEntities = this.getDataEntities(); Long currentUserId = UserServiceHelper.getCurrentUserId(); - //当前提交的探亲单据id集合 for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) { DynamicObject dataEntity = extendedDataEntity.getDataEntity(); String billId = dataEntity.getString("id"); String formid = dataEntity.getString("formid"); //获取报销人 - //DynamicObject applier = dataEntity.getDynam+icObject("applier"); - //long applierId = applier.getLong("id"); + DynamicObject applier = dataEntity.getDynamicObject("applier"); + Long applierId = applier.getLong("id"); boolean isOk = true; //所有审批记录,从审批记录中获取已经审批过的人 List allApprovalRecords = WorkflowServiceHelper.getApprovalRecords(formid, billId, true); @@ -66,13 +66,13 @@ public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn { //过滤提交的和待分配的任务 if("submit".equals(groupDecisionType)){ //获取每个节点的审批类型 提交:submit Long userId = allApprovalRecord.getChildren().get(0).getUserId();//获取每个节点的审批人 - if(currentUserId.equals(userId) ){//如果审批不是提交人,则可以进行审批操作 + if(applierId.equals(userId) ){//如果审批不是申请人,则可以进行审批操作 isOk = false; } } } if(!isOk){ - this.addFatalErrorMessage(extendedDataEntity, "当前操作人为单据提交人,无法进行审批操作,请转给他人进行审批!"); + this.addFatalErrorMessage(extendedDataEntity, "当前操作人为单据申请人,无法进行审批操作,请转给他人进行审批!"); return; } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailInvoiceOverdueRemindersOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailInvoiceOverdueRemindersOp.java index 7af25b0..944c982 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailInvoiceOverdueRemindersOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/DailInvoiceOverdueRemindersOp.java @@ -31,10 +31,10 @@ public class DailInvoiceOverdueRemindersOp extends AbstractOperationServicePlugI public void onPreparePropertys(PreparePropertysEventArgs e) { super.onPreparePropertys(e); e.getFieldKeys().add("invoiceentry"); - //e.getFieldKeys().add("zcgj_entryentity"); - e.getFieldKeys().add("zcgj_attachmentcount_cq"); + e.getFieldKeys().add("zcgj_description_cq"); e.getFieldKeys().add("zcgj_is_cq"); e.getFieldKeys().add("costcompany"); + e.getFieldKeys().add("costdept"); e.getFieldKeys().add("expenseentryentity"); e.getFieldKeys().add("applier"); @@ -75,12 +75,15 @@ public class DailInvoiceOverdueRemindersOp extends AbstractOperationServicePlugI DynamicObject applier = dataEntity.getDynamicObject("applier"); long applierId = applier.getLong("id"); Object costcompanyObj = dataEntity.get("costcompany"); - int attachmentcountCq = dataEntity.getInt("zcgj_attachmentcount_cq"); //超期附件数 + Object costdeptObj = dataEntity.get("costdept"); + String descriptionCq = dataEntity.getString("zcgj_description_cq"); //超期说明 boolean isCq = dataEntity.getBoolean("zcgj_is_cq"); //超期附件数 - if(costcompanyObj!=null){ + if(costcompanyObj!=null && costdeptObj!=null){ DynamicObject costcompany = (DynamicObject)costcompanyObj; + DynamicObject costdept = (DynamicObject)costdeptObj; long costcompanyId = costcompany.getLong("id"); + long costdeptId = costdept.getLong("id"); if(OrgCheckUtils.isKS(costcompanyId)){ DynamicObjectCollection expenseentryentity = dataEntity.getDynamicObjectCollection("expenseentryentity");//费用明细 //1.判断费用项目中是否有包含日常费用的 @@ -99,22 +102,19 @@ public class DailInvoiceOverdueRemindersOp extends AbstractOperationServicePlugI } } DynamicObject[] load = null; - if(yw){//如果是业务招待费报销,则需要判断是不是领导 + if(yw){//如果是业务招待费报销 + // 报销人主职部门 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(applierId); QFilter[] filterArray = new QFilter[2]; //查询申请人下的今年的探亲差旅单据 - filterArray[0] = new QFilter("zcgj_leadership.id", QCP.equals, applierId); + filterArray[0] = new QFilter("zcgj_org.id", QCP.equals, costdeptId); filterArray[1] = new QFilter("zcgj_is_latency", QCP.equals, true); load = BusinessDataServiceHelper.load("zcgj_leadership_config", "id", filterArray); - /*dateSet = QueryServiceHelper.queryDataSet( - this.getClass().getName(), - "zcgj_leadership_config", - "id", - filterArray, null - );*/ } - if((load == null || load.length == 0)&& rc){ //如果不是领导,或领导的延迟报销未开启,则进行延时校验 + boolean isOverDay = false; + if((load == null || load.length == 0)&& rc){ //如果没有延迟报销,则进行延时校验 // DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("zcgj_entryentity");//oa流程分录 DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("invoiceentry");//发票信息 List dateList = new ArrayList<>(); @@ -136,16 +136,19 @@ public class DailInvoiceOverdueRemindersOp extends AbstractOperationServicePlugI long daysBetween = ChronoUnit.DAYS.between(maxDate, currentDate); // 判断是否超过90天 if (daysBetween > 30 &&( - !isCq || attachmentcountCq == 0)) { - if(yw){ //如果是业务招待,则进行强控 - this.addFatalErrorMessage(extendedDataEntity, "本次报销已上传最近的发票日期与当前日期相隔超30天,请勾选超期报销,并上传超期说明附件!"); - }else{//如果是日常费用的其他的项目,则只进行提醒 - this.addWarningMessage(extendedDataEntity, "请注意:本次报销已上传最近的发票日期与当前日期相隔超30天。"); - } - + !isCq || descriptionCq == null || descriptionCq.isEmpty())) { + isOverDay =true; } } } + + if(isOverDay){ + if(yw){ //如果是业务招待,则进行强控 + this.addFatalErrorMessage(extendedDataEntity, "本次报销已上传最近的发票日期与当前日期相隔超30天,请勾选超期报销,并上传超期说明附件!"); + }else{//如果是日常费用的其他的项目,则只进行提醒 + this.addWarningMessage(extendedDataEntity, "请注意:本次报销已上传最近的发票日期与当前日期相隔超30天。"); + } + } } } } diff --git a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TravelInvoiceOverdueRemindersOp.java b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TravelInvoiceOverdueRemindersOp.java index 35e2494..1f7b15f 100644 --- a/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TravelInvoiceOverdueRemindersOp.java +++ b/code/zcdev/zcgj-zcdev-zcdev-fs/src/main/java/zcgj/zcdev/zcdev/fs/plugin/operate/TravelInvoiceOverdueRemindersOp.java @@ -29,9 +29,10 @@ public class TravelInvoiceOverdueRemindersOp extends AbstractOperationServicePlu public void onPreparePropertys(PreparePropertysEventArgs e) { super.onPreparePropertys(e); e.getFieldKeys().add("invoiceentry"); - e.getFieldKeys().add("zcgj_attachmentcount_cq"); + e.getFieldKeys().add("zcgj_description_cq"); e.getFieldKeys().add("zcgj_is_cq"); e.getFieldKeys().add("costcompany"); + e.getFieldKeys().add("costdept"); e.getFieldKeys().add("applier"); } @@ -39,9 +40,7 @@ public class TravelInvoiceOverdueRemindersOp extends AbstractOperationServicePlu @Override public void onAddValidators(AddValidatorsEventArgs e) { super.onAddValidators(e); - Long currentUserId = UserServiceHelper.getCurrentUserId(); - // 当前用户所属组织 - Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId); + //当前切换选择的组织 Long currentOrgId = RequestContext.get().getOrgId(); //当前所在的组织是属于矿山下的 @@ -61,27 +60,39 @@ public class TravelInvoiceOverdueRemindersOp extends AbstractOperationServicePlu Map> currentBillIdListMap = new HashMap<>(); for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) { + + Long currentUserId = UserServiceHelper.getCurrentUserId(); + + DynamicObject dataEntity = extendedDataEntity.getDataEntity(); long aLong = dataEntity.getLong("id"); Object costcompanyObj = dataEntity.get("costcompany"); - int attachmentcountCq = dataEntity.getInt("zcgj_attachmentcount_cq"); //超期附件数 + Object costdeptObj = dataEntity.get("costdept"); boolean isCq = dataEntity.getBoolean("zcgj_is_cq"); //超期附件数 + String descriptionCq = dataEntity.getString("zcgj_description_cq"); - if(costcompanyObj!=null){ + if(costcompanyObj!=null && costdeptObj != null){ DynamicObject costcompany = (DynamicObject)costcompanyObj; + DynamicObject costdept = (DynamicObject)costdeptObj; long costcompanyId = costcompany.getLong("id"); + long costdeptId = costdept.getLong("id"); if(OrgCheckUtils.isKS(costcompanyId)){ //获取报销人 DynamicObject applier = dataEntity.getDynamicObject("applier"); long applierId = applier.getLong("id"); + // 报销人主职部门 + Long mainOrgId = UserServiceHelper.getUserMainOrgId(applierId); + QFilter[] filterArray = new QFilter[2]; //查询申请人下的今年的探亲差旅单据 - filterArray[0] = new QFilter("zcgj_leadership.id", QCP.equals, applierId); + filterArray[0] = new QFilter("zcgj_org.id", QCP.equals, costdeptId); filterArray[1] = new QFilter("zcgj_is_latency", QCP.equals, true); + //获取到的都是不需要控制的 DynamicObject[] load = BusinessDataServiceHelper.load("zcgj_leadership_config", "id", filterArray); - + boolean isOverDay = false; + //如果根据当前人主职部门获取不到,则需要进行超期校验 if(load == null || load.length == 0){ DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("invoiceentry");//发票信息 List dateList = new ArrayList<>(); @@ -106,11 +117,14 @@ public class TravelInvoiceOverdueRemindersOp extends AbstractOperationServicePlu long daysBetween = ChronoUnit.DAYS.between(maxDate, currentDate); // 判断是否超过90天 if (daysBetween > 30 &&( - !isCq || attachmentcountCq == 0)) { - this.addFatalErrorMessage(extendedDataEntity, "最近发票日期与当前日期相隔超30天,请勾选超期报销,并上传超期说明附件!"); + !isCq || descriptionCq == null || descriptionCq.isEmpty())) { + isOverDay =true; } } } + if(isOverDay){ + this.addFatalErrorMessage(extendedDataEntity, "最近发票日期与当前日期相隔超30天,请勾选超期报销,并填写超期说明!"); + } } } }