md
This commit is contained in:
parent
2a9f0f6078
commit
fa78be9f46
@ -891,6 +891,68 @@ public class EmisSettleBillServiceImpl extends EmisBaseService implements IEmisS
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 如果没有收款记录则设置账单为未收款
|
||||||
|
else{
|
||||||
|
|
||||||
|
// 全部收款金额
|
||||||
|
BigDecimal totalAllPayMoney = BigDecimal.ZERO;
|
||||||
|
// 收款金额-退款金额
|
||||||
|
totalAllPayMoney=totalMoney
|
||||||
|
.add(satisfyMoney)
|
||||||
|
.add(allowanceMoney)
|
||||||
|
.add(deductionMoney)
|
||||||
|
.add(otherMoney)
|
||||||
|
.subtract(refundMoney);
|
||||||
|
|
||||||
|
EmisSettleBill newBill = new EmisSettleBill();
|
||||||
|
newBill.setId(oldBill.getId());
|
||||||
|
newBill.setRecedMoney(totalMoney);
|
||||||
|
newBill.setSatisfyMoney(satisfyMoney);
|
||||||
|
newBill.setAllowanceMoney(allowanceMoney);
|
||||||
|
newBill.setDeductionMoney(deductionMoney);
|
||||||
|
newBill.setOtherMoney(otherMoney);
|
||||||
|
// 退款金额
|
||||||
|
newBill.setRefundMoney(refundMoney);
|
||||||
|
|
||||||
|
// 更新账单收款状态 收款金额
|
||||||
|
log.debug("reCalcSettleBillPayStatus===>收款金额:{},应收:{}",totalMoney,oldBill.getRecMoney());
|
||||||
|
if( totalAllPayMoney.compareTo(BigDecimal.ZERO) == 0 ){
|
||||||
|
newBill.setPaymentStatus("0");
|
||||||
|
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||||
|
}else{
|
||||||
|
int rstDif=totalAllPayMoney.compareTo(oldBill.getRecMoney());
|
||||||
|
if( rstDif >= 0 ){
|
||||||
|
// 已收款
|
||||||
|
newBill.setPaymentStatus("1");
|
||||||
|
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
// 部分收款
|
||||||
|
newBill.setPaymentStatus("2");
|
||||||
|
emisSettleBillMapper.updateEmisSettleBill(newBill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 未收款则更新运单状态未收款状态
|
||||||
|
List<EmisSettleSubBill> list = emisBaseService.selectSubBillListBySettleBillNo(settleBillNo);
|
||||||
|
if (!CollectionUtils.isEmpty(list)) {
|
||||||
|
for (EmisSettleSubBill subBill:list) {
|
||||||
|
// 更新子账单收款状态
|
||||||
|
EmisSettleSubBill updEmisSettleSubBill=new EmisSettleSubBill();
|
||||||
|
updEmisSettleSubBill.setPaymentStatus("0");
|
||||||
|
updEmisSettleSubBill.setRecedMoney(BigDecimal.ZERO);
|
||||||
|
updEmisSettleSubBill.setBillCode(subBill.getBillCode());
|
||||||
|
emisSettleSubBillMapper.updatePayedStatus(updEmisSettleSubBill);
|
||||||
|
|
||||||
|
// 更新运单收款状态
|
||||||
|
EmisWaybill emisWaybill = new EmisWaybill();
|
||||||
|
emisWaybill.setBillCode(subBill.getBillCode());
|
||||||
|
emisWaybill.setPaymentStatus("0");
|
||||||
|
emisWaybillMapper.updatePayedStatus(emisWaybill);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user