This commit is contained in:
linfso 2024-08-20 22:54:10 +08:00
parent 5834d5a334
commit b49af98eef

View File

@ -151,6 +151,8 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
// 计算已收款金额
BigDecimal totalPayMoney = BigDecimal.ZERO;
BigDecimal totalRefundMoney = BigDecimal.ZERO;
// 抵扣金额
BigDecimal satisfyMoney = BigDecimal.ZERO;
/* allowance_money */
@ -160,26 +162,40 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
/* other_money */
BigDecimal otherMoney = BigDecimal.ZERO;
// refund_money
BigDecimal refundMoney = BigDecimal.ZERO;
log.debug("收款状态更新===>应收:{}",oldBill.getRecMoney());
for(EmisSettlePayRecord item:payRecordList){
totalPayMoney=totalPayMoney.add(item.getPayMoney());
satisfyMoney=satisfyMoney.add(item.getSatisfyMoney()==null?BigDecimal.ZERO:item.getSatisfyMoney());
allowanceMoney=allowanceMoney.add(item.getAllowanceMoney()==null?BigDecimal.ZERO:item.getAllowanceMoney());
deductionMoney=deductionMoney.add(item.getDeductionMoney()==null?BigDecimal.ZERO:item.getDeductionMoney());
otherMoney=otherMoney.add(item.getOtherMoney()==null?BigDecimal.ZERO:item.getOtherMoney());
if("1".equals(item.getRecType())) {
totalPayMoney = totalPayMoney.add(item.getPayMoney());
satisfyMoney = satisfyMoney.add(item.getSatisfyMoney() == null ? BigDecimal.ZERO : item.getSatisfyMoney());
allowanceMoney = allowanceMoney.add(item.getAllowanceMoney() == null ? BigDecimal.ZERO : item.getAllowanceMoney());
deductionMoney = deductionMoney.add(item.getDeductionMoney() == null ? BigDecimal.ZERO : item.getDeductionMoney());
otherMoney = otherMoney.add(item.getOtherMoney() == null ? BigDecimal.ZERO : item.getOtherMoney());
}
else if("2".equals(item.getRecType())) {
refundMoney = refundMoney.add(item.getRefundMoney() == null ? BigDecimal.ZERO : item.getRefundMoney());
}
}
// 总应收金额
log.debug("收款状态更新===>totalPayMoney:{},satisfyMoney:{},allowanceMoney:{},deductionMoney:{},otherMoney:{}"
,totalPayMoney,satisfyMoney,allowanceMoney,allowanceMoney,deductionMoney,otherMoney);
// 收款金额-退款金额
totalAllPayMoney=totalAllPayMoney
.add(totalPayMoney)
.add(satisfyMoney)
.add(allowanceMoney)
.add(deductionMoney)
.add(otherMoney);
.add(otherMoney)
.subtract(refundMoney)
;
totalRefundMoney=totalRefundMoney.add(refundMoney);
EmisSettleBill newBill = new EmisSettleBill();
newBill.setId(oldBill.getId());
@ -188,6 +204,9 @@ public class EmisSettlePayRecordServiceImpl extends EmisBaseService implements I
newBill.setAllowanceMoney(allowanceMoney);
newBill.setOtherMoney(otherMoney);
// 退款金额
newBill.setRefundMoney(refundMoney);
// 判断收款状态 收款金额
int rstDif=totalAllPayMoney.compareTo(oldBill.getRecMoney());
log.debug("收款状态更新===>收款总金额:{},应收:{},rsDif:{}",totalAllPayMoney,oldBill.getRecMoney(),rstDif);