Bläddra i källkod

Merge branch 'dev1.0' of http://192.168.0.200:3000/liuj/factoring-trade-backend into dev1.0

Wangyafan 6 månader sedan
förälder
incheckning
fc9f7a6079

+ 10 - 8
src/main/java/com/sunxung/factoring/service/ledger/impl/LedgerManagementServiceImpl.java

@@ -1170,7 +1170,7 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
 
                             Boolean assignOverdueInterest = hasAssignOverdueInterest(allPlanFactoringList, goodsAssignVo.getHasAssignOverdueInterest());
                             //5.获取截至到分账日期的新的本金计划
-                            List<PaymentCollectionPlanFactoring> newPrincipalFactoringList = new ArrayList<>();
+                            List<PaymentCollectionPlanFactoring> newPrincipalFactoringList;
                             if (assignOverdueInterest) {
                                 //判断是否存在逾期利息不豁免且需要分逾期利息的场景,如果存在分账日期取系统当前日期
                                 newPrincipalFactoringList = getPrincipalFactoringByLedgerDate(principalFactoringList, new Date(), returnedAmount);
@@ -1179,10 +1179,10 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
                             }
                             //6.计算截至到分账日期计划应收管理费总和
                             BigDecimal planManagementTotal = getAllocatedAmountByPlanFactoring(newPrincipalFactoringList, managementFeeDict,
-                                    goodsAssignVo, paymentCalculateVo);
+                                    goodsAssignVo, paymentCalculateVo, ledgerDate);
                             //7.计算截至到分账日期计划应收利息总和
                             BigDecimal planInterestTotal = getAllocatedAmountByPlanFactoring(newPrincipalFactoringList, interestDict,
-                                    goodsAssignVo, paymentCalculateVo);
+                                    goodsAssignVo, paymentCalculateVo, ledgerDate);
                             //剩余未分配管理费
                             BigDecimal unAssignManagement = BigDecimal.ZERO;
                             //剩余未分配利息
@@ -2301,7 +2301,7 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
      * @return
      */
     private BigDecimal getAllocatedAmountByPlanFactoring(List<PaymentCollectionPlanFactoring> principalList, Dictionary dict,
-                                                         LedgerFundGoodsAssign goodsAssign, PrePaymentCalculateVo paymentCalculateVo) {
+                                                         LedgerFundGoodsAssign goodsAssign, PrePaymentCalculateVo paymentCalculateVo, Date ledgerDate) {
         //计算需要分配掉的利息或管理费
         if (principalList == null || principalList.isEmpty()) {
             return BigDecimal.ZERO;
@@ -2323,10 +2323,12 @@ public class LedgerManagementServiceImpl implements LedgerManagementService {
                     newPrincipalList.add(factoring);
                 });
             } else {
-                PaymentCollectionPlanFactoring factoring = new PaymentCollectionPlanFactoring();
-                factoring.setPlanDate(p.getPlanDate());
-                factoring.setAmount(p.getAmount());
-                newPrincipalList.add(factoring);
+                if (DateUtil.isSameDay(p.getPlanDate(), ledgerDate)) {
+                    PaymentCollectionPlanFactoring factoring = new PaymentCollectionPlanFactoring();
+                    factoring.setPlanDate(p.getPlanDate());
+                    factoring.setAmount(p.getAmount());
+                    newPrincipalList.add(factoring);
+                }
             }
         });