Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
程小伟 2025-04-22 17:18:32 +08:00
commit 99d37d2ec4
6 changed files with 76 additions and 183 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天请勾选超期报销并填写超期说明");
}
} }
} }
} }

View File

@ -1,65 +0,0 @@
package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.datamodel.events.ChangeData;
import kd.bos.entity.datamodel.events.LoadDataEventArgs;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.ec.contract.formplugin.PaymentApplyEditUI;
import java.math.BigDecimal;
import java.util.EventObject;
import java.util.HashSet;
import java.util.Set;
/**
* 重新计算费用申请单的实付金额值
*/
public class PaymentApplyEditUIExtPlugin extends PaymentApplyEditUI {
@Override
protected void thisApplyOfTaxChanged(ChangeData changeData) {
this.sumApplyOfTax();
this.setRealPayAmt();
if (this.getPageCache().get("thisApplyAmountCache") != null) {
this.getPageCache().remove("thisApplyAmountCache");
} else {
int rowIndex = changeData.getRowIndex();
if (!this.hasInvoice(rowIndex)) {
this.setShouldPayOfTax(rowIndex);
BigDecimal applyOfTaxAmount = (BigDecimal)changeData.getNewValue();
BigDecimal taxRate = (BigDecimal)this.getModel().getValue("conttaxrate", rowIndex);
BigDecimal applyAmount = applyOfTaxAmount.divide(BigDecimal.ONE.add(taxRate.divide(BigDecimal.valueOf(100L), 4)), 10, 5);
this.getPageCache().put("thisApplyOfTaxCache", "1");
this.getModel().setValue("thisapplyamount", applyAmount, rowIndex);
}
}
}
private void setRealPayAmt() {
DynamicObjectCollection dynamicObjectCollection = this.getModel().getDataEntity().getDynamicObjectCollection("entryentity");
BigDecimal totalAmount = BigDecimal.ZERO;
Set<String> contractNo = new HashSet<>();
for (DynamicObject dynamicObject : dynamicObjectCollection) {
DynamicObject contract = dynamicObject.getDynamicObject("contract");
if(contract != null) {
String billno = contract.getString("id");
if(!contractNo.contains(billno)) {
totalAmount = dynamicObject.getBigDecimal("thisrealpayamt");
contractNo.add(billno);
}
}
}
this.getModel().setValue("zcgj_realpayamt", totalAmount);
this.getView().updateView("zcgj_realpayamt");
}
@Override
public void afterLoadData(EventObject e) {
this.setRealPayAmt();
super.afterLoadData(e);
}
}

View File

@ -7,6 +7,7 @@ import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.plugin.PreparePropertysEventArgs; import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.validate.AbstractValidator; import kd.bos.entity.validate.AbstractValidator;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -19,7 +20,10 @@ public class OutContractSettleProcessCheckOp extends AbstractOperationServicePl
public void onPreparePropertys(PreparePropertysEventArgs e) { public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e); super.onPreparePropertys(e);
e.getFieldKeys().add("itementry"); e.getFieldKeys().add("itementry");
e.getFieldKeys().add("itementry.oftaxamount");
e.getFieldKeys().add("zcgj_processallocatentity"); e.getFieldKeys().add("zcgj_processallocatentity");
e.getFieldKeys().add("contract");
//e.getFieldKeys().add("contract.zcgj_pricetype");
} }
@Override @Override
@ -35,6 +39,12 @@ public class OutContractSettleProcessCheckOp extends AbstractOperationServicePl
ExtendedDataEntity[] extendedDataEntities = this.getDataEntities(); ExtendedDataEntity[] extendedDataEntities = this.getDataEntities();
for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) { for (ExtendedDataEntity extendedDataEntity : extendedDataEntities) {
DynamicObject dataEntity = extendedDataEntity.getDataEntity(); DynamicObject dataEntity = extendedDataEntity.getDataEntity();
DynamicObject contract = dataEntity.getDynamicObject("contract");
if (contract != null) {
DynamicObject contractObj = BusinessDataServiceHelper.loadSingle(contract.getLong("id"), "ec_out_contract", "zcgj_pricetype");
//不定量不定价合同和总价包干合同zjbgbdlbdj
if (contractObj.getString("zcgj_pricetype").equals("zjbg")
|| contractObj.getString("zcgj_pricetype").equals("bdlbdj")) {
DynamicObjectCollection itementryCollection = dataEntity.getDynamicObjectCollection("itementry"); DynamicObjectCollection itementryCollection = dataEntity.getDynamicObjectCollection("itementry");
int i=1; int i=1;
for (DynamicObject itementry : itementryCollection) { for (DynamicObject itementry : itementryCollection) {
@ -53,3 +63,5 @@ public class OutContractSettleProcessCheckOp extends AbstractOperationServicePl
} }
} }
} }
}
}

View File

@ -1,71 +0,0 @@
package zcgj.zcdev.zcdev.pr.plugin.operate;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.PreparePropertysEventArgs;
import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import java.math.BigDecimal;
import java.util.HashSet;
import java.util.Set;
/**
* 反写工程-项目资金-付款申请单的实际付款
*/
public class PaymentapplySetRealpayamtOp extends AbstractOperationServicePlugIn {
@Override
public void onPreparePropertys(PreparePropertysEventArgs e) {
super.onPreparePropertys(e);
e.getFieldKeys().add("entryentity");
e.getFieldKeys().add("zcgj_realpayamt");
e.getFieldKeys().add("sourcebilltype");
e.getFieldKeys().add("sourcebillnumber");
e.getFieldKeys().add("sourcebillid");
}
@Override
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e);
DynamicObject[] dataEntities = e.getDataEntities();
if(dataEntities!=null && dataEntities.length>0){
DynamicObject object = dataEntities[0];
String sourcebilltype = object.getString("sourcebilltype");
if("ec_paymentapply".equals(sourcebilltype)){//如果上游单据是工程-项目资金-付款申请单
String sourcebillnumber = object.getString("sourcebillnumber");//源单编码
String sourcebillid = object.getString("sourcebillid");//源单id
QFilter numberFilter = new QFilter("billno", QCP.equals,sourcebillnumber);//筛选出属性number=zcgjAccounttableNumber的结果
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(sourcebilltype, "id,number,zcgj_realpayamt,entryentity.contract,entryentity.thisrealpayamt", new QFilter[]{numberFilter});
DynamicObjectCollection dynamicObjectCollection = dynamicObject.getDynamicObjectCollection("entryentity");
Set<String> contractNo = new HashSet<>();
BigDecimal totalAmount = BigDecimal.ZERO;
for (DynamicObject entryentity : dynamicObjectCollection) {
DynamicObject contract = entryentity.getDynamicObject("contract");
if(contract != null) {
String billno = contract.getString("id");
if(!contractNo.contains(billno)) {
totalAmount = entryentity.getBigDecimal("thisrealpayamt");
contractNo.add(billno);
}
}
}
BigDecimal realpayamt = dynamicObject.getBigDecimal("zcgj_realpayamt");
if(realpayamt!=null){
totalAmount = totalAmount.add(realpayamt);
}
dynamicObject.set("zcgj_realpayamt", totalAmount);
Object[] save = SaveServiceHelper.save(new DynamicObject[]{dynamicObject});
}
}
}
}