|
@@ -1055,17 +1055,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
result.setSumPrice(null != invoicingVo.getReceivablePremium() ? invoicingVo.getReceivablePremium().toString() : null);
|
|
result.setSumPrice(null != invoicingVo.getReceivablePremium() ? invoicingVo.getReceivablePremium().toString() : null);
|
|
|
|
|
|
|
|
// ============================结算逻辑============================
|
|
// ============================结算逻辑============================
|
|
|
- // 实际已经收了的金额
|
|
|
|
|
- BigDecimal actualReceivedAmount = this.getInvoicingAmount(settlementVo.getInvoicingId());
|
|
|
|
|
-
|
|
|
|
|
- // 所有需要结算的金额
|
|
|
|
|
- BigDecimal allToSettlement = invoice.getReceivableSupervisePremium().add(invoice.getOverinflatedAmount());
|
|
|
|
|
- // 剩余的金额
|
|
|
|
|
- BigDecimal surplusPremium = allToSettlement.subtract(actualReceivedAmount);
|
|
|
|
|
- log.info("invoiceId=[{}],一共需要结算的金额[{}],实际已经结算的金额[{}],本次计划结算的金额[{}]",
|
|
|
|
|
- settlementVo.getInvoicingId(), allToSettlement,actualReceivedAmount,settlementVo.getActualReceivedAmount());
|
|
|
|
|
// 校验是否超出了剩余的金额
|
|
// 校验是否超出了剩余的金额
|
|
|
- AssertionUtils.isFail(surplusPremium.compareTo(settlementVo.getActualReceivedAmount()) < 0, "已超出应收金额,请核对!");
|
|
|
|
|
|
|
+// AssertionUtils.isFail(surplusPremium.compareTo(settlementVo.getActualReceivedAmount()) < 0, "已超出应收金额,请核对!");
|
|
|
|
|
|
|
|
// 处理结算数据
|
|
// 处理结算数据
|
|
|
// 未完全结算完成
|
|
// 未完全结算完成
|
|
@@ -1507,7 +1498,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
log.info("invoiceId=[{}],一共需要结算的金额[{}],实际已经结算的金额[{}],本次计划结算的金额[{}]",
|
|
log.info("invoiceId=[{}],一共需要结算的金额[{}],实际已经结算的金额[{}],本次计划结算的金额[{}]",
|
|
|
settlementVo.getInvoicingId(), allToSettlement,actualReceivedAmount,settlementVo.getActualReceivedAmount());
|
|
settlementVo.getInvoicingId(), allToSettlement,actualReceivedAmount,settlementVo.getActualReceivedAmount());
|
|
|
// 校验是否超出了剩余的金额
|
|
// 校验是否超出了剩余的金额
|
|
|
- AssertionUtils.isFail(surplusPremium.compareTo(settlementVo.getActualReceivedAmount()) < 0, "已超出应收金额,请核对!");
|
|
|
|
|
|
|
+// AssertionUtils.isFail(surplusPremium.compareTo(settlementVo.getActualReceivedAmount()) < 0, "已超出应收金额,请核对!");
|
|
|
|
|
|
|
|
// 处理结算数据
|
|
// 处理结算数据
|
|
|
// 未完全结算完成
|
|
// 未完全结算完成
|
|
@@ -1529,8 +1520,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
insPlyIncomeInvoiceSettlementFileMapper.insert(files);
|
|
insPlyIncomeInvoiceSettlementFileMapper.insert(files);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 判断是否已经结算完成
|
|
|
|
|
- if (surplusPremium.compareTo(settlementVo.getActualReceivedAmount()) == 0) {
|
|
|
|
|
|
|
+ // 判断是否已经结算完成,剩余金额小于等于实收金额就算完成结算了
|
|
|
|
|
+ if (surplusPremium.compareTo(settlementVo.getActualReceivedAmount()) <= 0) {
|
|
|
log.info("序号为[{}]的发票已经结算完成",insPlyIncomeInvoice.getId());
|
|
log.info("序号为[{}]的发票已经结算完成",insPlyIncomeInvoice.getId());
|
|
|
// 更新发票状态
|
|
// 更新发票状态
|
|
|
insPlyIncomeInvoice.setStatus("1");
|
|
insPlyIncomeInvoice.setStatus("1");
|
|
@@ -2482,7 +2473,7 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
log.info("invoiceId=[{}],一共需要结算的金额[{}],实际已经结算的金额[{}],本次计划结算的金额[{}]",
|
|
log.info("invoiceId=[{}],一共需要结算的金额[{}],实际已经结算的金额[{}],本次计划结算的金额[{}]",
|
|
|
settlementVo.getInvoicingId(), allToSettlement,actualReceivedAmount,settlementVo.getActualReceivedAmount());
|
|
settlementVo.getInvoicingId(), allToSettlement,actualReceivedAmount,settlementVo.getActualReceivedAmount());
|
|
|
// 校验是否超出了剩余的金额,判断 surplusPremium 是否 小于 实际到账金额
|
|
// 校验是否超出了剩余的金额,判断 surplusPremium 是否 小于 实际到账金额
|
|
|
- AssertionUtils.isFail(surplusPremium.compareTo(settlementVo.getActualReceivedAmount()) < 0, "已超出应收金额,请核对!");
|
|
|
|
|
|
|
+// AssertionUtils.isFail(surplusPremium.compareTo(settlementVo.getActualReceivedAmount()) < 0, "已超出应收金额,请核对!");
|
|
|
|
|
|
|
|
// 处理结算数据
|
|
// 处理结算数据
|
|
|
// 未完全结算完成
|
|
// 未完全结算完成
|
|
@@ -2504,8 +2495,8 @@ public class ReceivableServiceImpl extends ServiceImpl<ReceivableMapper, InsPlyI
|
|
|
insPlyIncomeInvoiceSettlementFileMapper.insert(files);
|
|
insPlyIncomeInvoiceSettlementFileMapper.insert(files);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 判断是否已经结算完成
|
|
|
|
|
- if (surplusPremium.compareTo(settlementVo.getActualReceivedAmount()) == 0) {
|
|
|
|
|
|
|
+ // 判断是否已经结算完成,剩余金额小于等于实收金额就算完成结算了
|
|
|
|
|
+ if (surplusPremium.compareTo(settlementVo.getActualReceivedAmount()) <= 0) {
|
|
|
log.info("序号为[{}]的发票已经结算完成",insPlyIncomeInvoice.getId());
|
|
log.info("序号为[{}]的发票已经结算完成",insPlyIncomeInvoice.getId());
|
|
|
// 更新发票状态
|
|
// 更新发票状态
|
|
|
insPlyIncomeInvoice.setStatus("1");
|
|
insPlyIncomeInvoice.setStatus("1");
|