瀏覽代碼

分账逻辑优化

liuj 7 月之前
父節點
當前提交
95d1875a57

+ 4 - 0
src/main/java/com/sunxung/factoring/service/ledger/impl/LedgerManagementServiceImpl.java

@@ -1384,6 +1384,8 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
                                 if (surplusInterest.compareTo(BigDecimal.ZERO) != 0) {
                                     PaymentCollectionPlanFactoring lastInterestFactoring = getLastPrincipalFactoring(allPlanFactoringList, interestDict, lastPlanDate);
                                     if (lastInterestFactoring == null) {
+                                        //这种场景可能存在未分配的利息,要删除
+                                        deleteUnAssignList(interestFactoringList, ledgerPlanFactoringAssignList, goodsAssignVo);
                                         ledgerPlanFactoringAssignList.add(addPlanFactoringInsertAssign(ledgerDate, surplusInterest, BigDecimal.ZERO,
                                                 IncomeExpenditureTypeDict.ChildEnum.INTEREST.getCode(), goodsAssignVo, 0));
                                     } else {
@@ -1409,6 +1411,8 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
                                 if (surplusManagement.compareTo(BigDecimal.ZERO) != 0) {
                                     PaymentCollectionPlanFactoring lastManagementFactoring = getLastPrincipalFactoring(allPlanFactoringList, managementFeeDict, lastPlanDate);
                                     if (lastManagementFactoring == null) {
+                                        //这种场景可能存在未分配的管理费,要删除
+                                        deleteUnAssignList(managementFeeFactoringList, ledgerPlanFactoringAssignList, goodsAssignVo);
                                         ledgerPlanFactoringAssignList.add(addPlanFactoringInsertAssign(ledgerDate, surplusManagement, BigDecimal.ZERO,
                                                 IncomeExpenditureTypeDict.ChildEnum.MANAGEMENT_FEE.getCode(), goodsAssignVo, 0));
                                     } else {