1.付款申请单实付金额根据付款申请单行号过滤反写功能开发

This commit is contained in:
zhangzhiguo 2025-04-22 15:21:01 +08:00
parent e8108297cf
commit 24ba9dbb6b
3 changed files with 52 additions and 35 deletions

View File

@ -35,6 +35,7 @@ public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn {
super.onPreparePropertys(e); super.onPreparePropertys(e);
e.getFieldKeys().add("formid"); e.getFieldKeys().add("formid");
e.getFieldKeys().add("id"); e.getFieldKeys().add("id");
e.getFieldKeys().add("applier");
} }
@Override @Override
@ -49,14 +50,13 @@ public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn {
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities(); ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
Long currentUserId = UserServiceHelper.getCurrentUserId(); Long currentUserId = UserServiceHelper.getCurrentUserId();
//当前提交的探亲单据id集合
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) { for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
DynamicObject dataEntity = extendedDataEntity.getDataEntity(); DynamicObject dataEntity = extendedDataEntity.getDataEntity();
String billId = dataEntity.getString("id"); String billId = dataEntity.getString("id");
String formid = dataEntity.getString("formid"); String formid = dataEntity.getString("formid");
//获取报销人 //获取报销人
//DynamicObject applier = dataEntity.getDynam+icObject("applier"); DynamicObject applier = dataEntity.getDynamicObject("applier");
//long applierId = applier.getLong("id"); Long applierId = applier.getLong("id");
boolean isOk = true; boolean isOk = true;
//所有审批记录,从审批记录中获取已经审批过的人 //所有审批记录,从审批记录中获取已经审批过的人
List<IApprovalRecordGroup> allApprovalRecords = WorkflowServiceHelper.getApprovalRecords(formid, billId, true); List<IApprovalRecordGroup> allApprovalRecords = WorkflowServiceHelper.getApprovalRecords(formid, billId, true);
@ -66,13 +66,13 @@ public class ApprovalCheckFlowOp extends AbstractOperationServicePlugIn {
//过滤提交的和待分配的任务 //过滤提交的和待分配的任务
if("submit".equals(groupDecisionType)){ //获取每个节点的审批类型 提交submit if("submit".equals(groupDecisionType)){ //获取每个节点的审批类型 提交submit
Long userId = allApprovalRecord.getChildren().get(0).getUserId();//获取每个节点的审批人 Long userId = allApprovalRecord.getChildren().get(0).getUserId();//获取每个节点的审批人
if(currentUserId.equals(userId) ){//如果审批不是提交则可以进行审批操作 if(applierId.equals(userId) ){//如果审批不是申请则可以进行审批操作
isOk = false; isOk = false;
} }
} }
} }
if(!isOk){ if(!isOk){
this.addFatalErrorMessage(extendedDataEntity, "当前操作人为单据提交人,无法进行审批操作,请转给他人进行审批!"); this.addFatalErrorMessage(extendedDataEntity, "当前操作人为单据申请人,无法进行审批操作,请转给他人进行审批!");
return; return;
} }
} }

View File

@ -31,10 +31,10 @@ public class DailInvoiceOverdueRemindersOp extends AbstractOperationServicePlugI
public void onPreparePropertys(PreparePropertysEventArgs e) { public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e); super.onPreparePropertys(e);
e.getFieldKeys().add("invoiceentry"); e.getFieldKeys().add("invoiceentry");
//e.getFieldKeys().add("zcgj_entryentity"); e.getFieldKeys().add("zcgj_description_cq");
e.getFieldKeys().add("zcgj_attachmentcount_cq");
e.getFieldKeys().add("zcgj_is_cq"); e.getFieldKeys().add("zcgj_is_cq");
e.getFieldKeys().add("costcompany"); e.getFieldKeys().add("costcompany");
e.getFieldKeys().add("costdept");
e.getFieldKeys().add("expenseentryentity"); e.getFieldKeys().add("expenseentryentity");
e.getFieldKeys().add("applier"); e.getFieldKeys().add("applier");
@ -75,12 +75,15 @@ public class DailInvoiceOverdueRemindersOp extends AbstractOperationServicePlugI
DynamicObject applier = dataEntity.getDynamicObject("applier"); DynamicObject applier = dataEntity.getDynamicObject("applier");
long applierId = applier.getLong("id"); long applierId = applier.getLong("id");
Object costcompanyObj = dataEntity.get("costcompany"); 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"); //超期附件数 boolean isCq = dataEntity.getBoolean("zcgj_is_cq"); //超期附件数
if(costcompanyObj!=null){ if(costcompanyObj!=null && costdeptObj!=null){
DynamicObject costcompany = (DynamicObject)costcompanyObj; DynamicObject costcompany = (DynamicObject)costcompanyObj;
DynamicObject costdept = (DynamicObject)costdeptObj;
long costcompanyId = costcompany.getLong("id"); long costcompanyId = costcompany.getLong("id");
long costdeptId = costdept.getLong("id");
if(OrgCheckUtils.isKS(costcompanyId)){ if(OrgCheckUtils.isKS(costcompanyId)){
DynamicObjectCollection expenseentryentity = dataEntity.getDynamicObjectCollection("expenseentryentity");//费用明细 DynamicObjectCollection expenseentryentity = dataEntity.getDynamicObjectCollection("expenseentryentity");//费用明细
//1.判断费用项目中是否有包含日常费用的 //1.判断费用项目中是否有包含日常费用的
@ -99,22 +102,19 @@ public class DailInvoiceOverdueRemindersOp extends AbstractOperationServicePlugI
} }
} }
DynamicObject[] load = null; DynamicObject[] load = null;
if(yw){//如果是业务招待费报销则需要判断是不是领导 if(yw){//如果是业务招待费报销
// 报销人主职部门
Long mainOrgId = UserServiceHelper.getUserMainOrgId(applierId);
QFilter[] filterArray = new QFilter[2]; 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); filterArray[1] = new QFilter("zcgj_is_latency", QCP.equals, true);
load = BusinessDataServiceHelper.load("zcgj_leadership_config", load = BusinessDataServiceHelper.load("zcgj_leadership_config",
"id", "id",
filterArray); 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("zcgj_entryentity");//oa流程分录
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("invoiceentry");//发票信息 DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("invoiceentry");//发票信息
List<LocalDate> dateList = new ArrayList<>(); List<LocalDate> dateList = new ArrayList<>();
@ -136,15 +136,18 @@ public class DailInvoiceOverdueRemindersOp extends AbstractOperationServicePlugI
long daysBetween = ChronoUnit.DAYS.between(maxDate, currentDate); long daysBetween = ChronoUnit.DAYS.between(maxDate, currentDate);
// 判断是否超过90天 // 判断是否超过90天
if (daysBetween > 30 &&( if (daysBetween > 30 &&(
!isCq || attachmentcountCq == 0)) { !isCq || descriptionCq == null || descriptionCq.isEmpty())) {
isOverDay =true;
}
}
}
if(isOverDay){
if(yw){ //如果是业务招待则进行强控 if(yw){ //如果是业务招待则进行强控
this.addFatalErrorMessage(extendedDataEntity, "本次报销已上传最近的发票日期与当前日期相隔超30天请勾选超期报销并上传超期说明附件"); this.addFatalErrorMessage(extendedDataEntity, "本次报销已上传最近的发票日期与当前日期相隔超30天请勾选超期报销并上传超期说明附件");
}else{//如果是日常费用的其他的项目则只进行提醒 }else{//如果是日常费用的其他的项目则只进行提醒
this.addWarningMessage(extendedDataEntity, "请注意本次报销已上传最近的发票日期与当前日期相隔超30天。"); this.addWarningMessage(extendedDataEntity, "请注意本次报销已上传最近的发票日期与当前日期相隔超30天。");
} }
}
}
} }
} }
} }

View File

@ -29,9 +29,10 @@ public class TravelInvoiceOverdueRemindersOp extends AbstractOperationServicePlu
public void onPreparePropertys(PreparePropertysEventArgs e) { public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e); super.onPreparePropertys(e);
e.getFieldKeys().add("invoiceentry"); 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("zcgj_is_cq");
e.getFieldKeys().add("costcompany"); e.getFieldKeys().add("costcompany");
e.getFieldKeys().add("costdept");
e.getFieldKeys().add("applier"); e.getFieldKeys().add("applier");
} }
@ -39,9 +40,7 @@ public class TravelInvoiceOverdueRemindersOp extends AbstractOperationServicePlu
@Override @Override
public void onAddValidators(AddValidatorsEventArgs e) { public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e); super.onAddValidators(e);
Long currentUserId = UserServiceHelper.getCurrentUserId();
// 当前用户所属组织
Long mainOrgId = UserServiceHelper.getUserMainOrgId(currentUserId);
//当前切换选择的组织 //当前切换选择的组织
Long currentOrgId = RequestContext.get().getOrgId(); Long currentOrgId = RequestContext.get().getOrgId();
//当前所在的组织是属于矿山下的 //当前所在的组织是属于矿山下的
@ -61,27 +60,39 @@ public class TravelInvoiceOverdueRemindersOp extends AbstractOperationServicePlu
Map<Long, List<Long>> currentBillIdListMap = new HashMap<>(); Map<Long, List<Long>> currentBillIdListMap = new HashMap<>();
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) { for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
Long currentUserId = UserServiceHelper.getCurrentUserId();
DynamicObject dataEntity = extendedDataEntity.getDataEntity(); DynamicObject dataEntity = extendedDataEntity.getDataEntity();
long aLong = dataEntity.getLong("id"); long aLong = dataEntity.getLong("id");
Object costcompanyObj = dataEntity.get("costcompany"); Object costcompanyObj = dataEntity.get("costcompany");
int attachmentcountCq = dataEntity.getInt("zcgj_attachmentcount_cq"); //超期附件数 Object costdeptObj = dataEntity.get("costdept");
boolean isCq = dataEntity.getBoolean("zcgj_is_cq"); //超期附件数 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 costcompany = (DynamicObject)costcompanyObj;
DynamicObject costdept = (DynamicObject)costdeptObj;
long costcompanyId = costcompany.getLong("id"); long costcompanyId = costcompany.getLong("id");
long costdeptId = costdept.getLong("id");
if(OrgCheckUtils.isKS(costcompanyId)){ if(OrgCheckUtils.isKS(costcompanyId)){
//获取报销人 //获取报销人
DynamicObject applier = dataEntity.getDynamicObject("applier"); DynamicObject applier = dataEntity.getDynamicObject("applier");
long applierId = applier.getLong("id"); long applierId = applier.getLong("id");
// 报销人主职部门
Long mainOrgId = UserServiceHelper.getUserMainOrgId(applierId);
QFilter[] filterArray = new QFilter[2]; 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); filterArray[1] = new QFilter("zcgj_is_latency", QCP.equals, true);
//获取到的都是不需要控制的
DynamicObject[] load = BusinessDataServiceHelper.load("zcgj_leadership_config", DynamicObject[] load = BusinessDataServiceHelper.load("zcgj_leadership_config",
"id", "id",
filterArray); filterArray);
boolean isOverDay = false;
//如果根据当前人主职部门获取不到则需要进行超期校验
if(load == null || load.length == 0){ if(load == null || load.length == 0){
DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("invoiceentry");//发票信息 DynamicObjectCollection entryentity = dataEntity.getDynamicObjectCollection("invoiceentry");//发票信息
List<LocalDate> dateList = new ArrayList<>(); List<LocalDate> dateList = new ArrayList<>();
@ -106,11 +117,14 @@ public class TravelInvoiceOverdueRemindersOp extends AbstractOperationServicePlu
long daysBetween = ChronoUnit.DAYS.between(maxDate, currentDate); long daysBetween = ChronoUnit.DAYS.between(maxDate, currentDate);
// 判断是否超过90天 // 判断是否超过90天
if (daysBetween > 30 &&( if (daysBetween > 30 &&(
!isCq || attachmentcountCq == 0)) { !isCq || descriptionCq == null || descriptionCq.isEmpty())) {
this.addFatalErrorMessage(extendedDataEntity, "最近发票日期与当前日期相隔超30天请勾选超期报销并上传超期说明附件"); isOverDay =true;
} }
} }
} }
if(isOverDay){
this.addFatalErrorMessage(extendedDataEntity, "最近发票日期与当前日期相隔超30天请勾选超期报销并填写超期说明");
}
} }
} }
} }