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