借款单备用金额逻辑优化

This commit is contained in:
xuhaihui 2025-09-09 17:03:58 +08:00
parent 7c92b186fc
commit f3035b011f
2 changed files with 20 additions and 10 deletions

View File

@ -73,10 +73,13 @@ public class DailyLoanBillSubValidatorOp extends AbstractOperationServicePlugIn
DynamicObjectCollection entryEntityCollection = quotaImprestLedger.getDynamicObjectCollection("zcgj_entryentity");//分录 DynamicObjectCollection entryEntityCollection = quotaImprestLedger.getDynamicObjectCollection("zcgj_entryentity");//分录
for (DynamicObject entryEntity : entryEntityCollection) { for (DynamicObject entryEntity : entryEntityCollection) {
DynamicObject person = entryEntity.getDynamicObject("zcgj_person");//人员 DynamicObject person = entryEntity.getDynamicObject("zcgj_person");//人员
if (person == null) {
continue;
}
if (person.getPkValue().equals(applier.getPkValue())) { if (person.getPkValue().equals(applier.getPkValue())) {
BigDecimal zcgj_remainingquota = entryEntity.getBigDecimal("zcgj_remainingquota");//剩余额度 BigDecimal zcgj_remainingquota = entryEntity.getBigDecimal("zcgj_remainingquota");//剩余额度
if (zcgj_remainingquota.compareTo(loanAmount) < 0) { if (zcgj_remainingquota.compareTo(loanAmount) < 0) {
this.addFatalErrorMessage(dataEnt, "借款金额超过剩余额度!"); this.addFatalErrorMessage(dataEnt, "借款金额超过剩余额度!剩余额度为:" + zcgj_remainingquota);
return; return;
} }
} }
@ -103,26 +106,31 @@ public class DailyLoanBillSubValidatorOp extends AbstractOperationServicePlugIn
//项目筹备备用金 //项目筹备备用金
BigDecimal loanAmount = er_dailyLoanBill.getBigDecimal("loanamount");//借款金额合计 BigDecimal loanAmount = er_dailyLoanBill.getBigDecimal("loanamount");//借款金额合计
QFilter filter = new QFilter("zcgj_entryentity.zcgj_person", QCP.equals, applier.getPkValue());// QFilter filter = new QFilter("zcgj_persons.fbasedataid", QCP.in, applier.getPkValue());//项目筹备备用金借款
filter.and(new QFilter("zcgj_currentyear", QCP.equals, bizDateYear));//年度 filter.and(new QFilter("zcgj_currentyear", QCP.equals, bizDateYear));//年度
filter.and(new QFilter("zcgj_persons.fbasedataid", QCP.in, applier.getPkValue()));//项目筹备备用金借款人
DynamicObject quotaImprestLedger = BusinessDataServiceHelper.loadSingle("zcgj_quotaimprestledger", new QFilter[]{filter});//定额备用金初始台账 DynamicObject quotaImprestLedger = BusinessDataServiceHelper.loadSingle("zcgj_quotaimprestledger", new QFilter[]{filter});//定额备用金初始台账
if (quotaImprestLedger == null) { if (quotaImprestLedger == null) {
this.addFatalErrorMessage(dataEnt, "您未在定额备用金初始台账里!!"); this.addFatalErrorMessage(dataEnt, "您未在定额备用金初始台账里!!");
return; return;
} }
DynamicObjectCollection entryEntityCollection = quotaImprestLedger.getDynamicObjectCollection("zcgj_entryentity");//分录 DynamicObjectCollection entryEntityCollection = quotaImprestLedger.getDynamicObjectCollection("zcgj_entryentity");//分录
boolean hasProjectPreparation = false; // 标记是否存在项目筹备人员
for (DynamicObject entryEntity : entryEntityCollection) { for (DynamicObject entryEntity : entryEntityCollection) {
DynamicObject person = entryEntity.getDynamicObject("zcgj_person");//人员
DynamicObject zcgj_personType = entryEntity.getDynamicObject("zcgj_persontype");//人员类型 DynamicObject zcgj_personType = entryEntity.getDynamicObject("zcgj_persontype");//人员类型
if (person.getPkValue().equals(applier.getPkValue()) && zcgj_personType != null && zcgj_personType.getString("number").equals("项目筹备")) { if (zcgj_personType != null && "项目筹备".equals(zcgj_personType.getString("number"))) {
hasProjectPreparation = true;
BigDecimal zcgj_remainingquota = entryEntity.getBigDecimal("zcgj_remainingquota");//剩余额度 BigDecimal zcgj_remainingquota = entryEntity.getBigDecimal("zcgj_remainingquota");//剩余额度
if (zcgj_remainingquota.compareTo(loanAmount) < 0) { if (zcgj_remainingquota.compareTo(loanAmount) < 0) {
this.addFatalErrorMessage(dataEnt, "借款金额超过剩余额度!"); this.addFatalErrorMessage(dataEnt, "借款金额超过剩余额度!剩余额度为:" + zcgj_remainingquota);
return; return;
} }
break;
} }
} }
if (!hasProjectPreparation) {
this.addFatalErrorMessage(dataEnt, "对应的定额备用金初始台账中不存在人员类型为项目筹备的额度!");
return;
}
} }
} }
} }

View File

@ -58,6 +58,9 @@ public class LoanSlipReserveFundReverserOp extends AbstractOperationServicePlugI
DynamicObjectCollection entryEntityCollection = quotaImprestLedger.getDynamicObjectCollection("zcgj_entryentity");//分录 DynamicObjectCollection entryEntityCollection = quotaImprestLedger.getDynamicObjectCollection("zcgj_entryentity");//分录
for (DynamicObject entryEntity : entryEntityCollection) { for (DynamicObject entryEntity : entryEntityCollection) {
DynamicObject person = entryEntity.getDynamicObject("zcgj_person");//人员 DynamicObject person = entryEntity.getDynamicObject("zcgj_person");//人员
if (person == null) {
continue;
}
if (person.getPkValue().equals(applier.getPkValue())) { if (person.getPkValue().equals(applier.getPkValue())) {
if (operationKey.equals("submit")) { if (operationKey.equals("submit")) {
//提交 //提交
@ -86,18 +89,17 @@ public class LoanSlipReserveFundReverserOp extends AbstractOperationServicePlugI
BigDecimal loanAmount = er_dailyLoanBill.getBigDecimal("loanamount");//借款金额合计 BigDecimal loanAmount = er_dailyLoanBill.getBigDecimal("loanamount");//借款金额合计
LocalDate localDate = bizDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); LocalDate localDate = bizDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
String bizDateYear = String.valueOf(localDate.getYear());//申请日期年份 String bizDateYear = String.valueOf(localDate.getYear());//申请日期年份
QFilter filter = new QFilter("zcgj_entryentity.zcgj_person", QCP.equals, applier.getPkValue());// QFilter filter = new QFilter("zcgj_persons.fbasedataid", QCP.in, applier.getPkValue());//项目筹备备用金借款
filter.and(new QFilter("zcgj_currentyear", QCP.equals, bizDateYear));//年度 filter.and(new QFilter("zcgj_currentyear", QCP.equals, bizDateYear));//年度
filter.and(new QFilter("zcgj_persons.fbasedataid", QCP.in, applier.getPkValue()));//项目筹备备用金借款人
DynamicObject quotaImprestLedger = BusinessDataServiceHelper.loadSingle("zcgj_quotaimprestledger", new QFilter[]{filter});//定额备用金初始台账 DynamicObject quotaImprestLedger = BusinessDataServiceHelper.loadSingle("zcgj_quotaimprestledger", new QFilter[]{filter});//定额备用金初始台账
if (quotaImprestLedger == null) { if (quotaImprestLedger == null) {
return; return;
} }
DynamicObjectCollection entryEntityCollection = quotaImprestLedger.getDynamicObjectCollection("zcgj_entryentity");//分录 DynamicObjectCollection entryEntityCollection = quotaImprestLedger.getDynamicObjectCollection("zcgj_entryentity");//分录
for (DynamicObject entryEntity : entryEntityCollection) { for (DynamicObject entryEntity : entryEntityCollection) {
DynamicObject person = entryEntity.getDynamicObject("zcgj_person");//人员 // DynamicObject person = entryEntity.getDynamicObject("zcgj_person");//人员
DynamicObject zcgj_personType = entryEntity.getDynamicObject("zcgj_persontype");//人员类型 DynamicObject zcgj_personType = entryEntity.getDynamicObject("zcgj_persontype");//人员类型
if (person.getPkValue().equals(applier.getPkValue()) && zcgj_personType != null && zcgj_personType.getString("number").equals("项目筹备")) { if (zcgj_personType != null && zcgj_personType.getString("number").equals("项目筹备")) {
if (operationKey.equals("submit")) { if (operationKey.equals("submit")) {
//提交 //提交
BigDecimal zcgj_usedquota = entryEntity.getBigDecimal("zcgj_usedquota").add(loanAmount);//已使用+借款金额 BigDecimal zcgj_usedquota = entryEntity.getBigDecimal("zcgj_usedquota").add(loanAmount);//已使用+借款金额