Wangyafan пре 3 недеља
родитељ
комит
d1a196ccd2

+ 18 - 15
src/main/java/com/sunxung/factoring/service/refundsManagement/impl/RefundManagementServiceImpl.java

@@ -150,7 +150,7 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
             refundManagement = lambdaQuery().eq(RefundManagement::getBusinessNumber, ledgerFundGoodsAssign.getBusinessNumber())
                     .eq(RefundManagement::getContractNo, ledgerFundGoodsAssign.getContractNo())
                     .eq(RefundManagement::getQuotaDisburseBatch, ledgerFundGoodsAssign.getQuotaDisburseBatch()).one();
-        }else {
+        } else {
             //不融资
             refundManagement = lambdaQuery().eq(RefundManagement::getBusinessNumber, ledgerFundGoodsAssign.getBusinessNumber())
                     .isNull(RefundManagement::getContractNo)
@@ -250,14 +250,14 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
                 //货款分配数据
 
                 List<LedgerFundGoodsAssign> ledgerFundGoodsAssignList;
-                if (taskVo.getContractNumber() != null && taskVo.getQuotaDisburseBatch() != null){
+                if (taskVo.getContractNumber() != null && taskVo.getQuotaDisburseBatch() != null) {
                     ledgerFundGoodsAssignList = ledgerFundGoodsAssignService
                             .lambdaQuery().eq(LedgerFundGoodsAssign::getBusinessNumber, taskVo.getBusinessNumber())
                             .eq(LedgerFundGoodsAssign::getSubmit, true)
                             .eq(LedgerFundGoodsAssign::getContractNo, taskVo.getContractNumber())
                             .eq(LedgerFundGoodsAssign::getQuotaDisburseBatch, taskVo.getQuotaDisburseBatch())
                             .list();
-                }else {
+                } else {
                     ledgerFundGoodsAssignList = ledgerFundGoodsAssignService
                             .lambdaQuery().eq(LedgerFundGoodsAssign::getBusinessNumber, taskVo.getBusinessNumber())
                             .isNull(LedgerFundGoodsAssign::getContractNo)
@@ -299,7 +299,7 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
                     refundManagement.getContractNumber(), refundManagement.getQuotaDisburseBatch(), refundManagement);
         }
 
-        BigDecimal mustReturn = autoMustAmount(allPlans, refundManagement.getBusinessNumber(),refundManagement.getContractNo(),refundManagement.getQuotaDisburseBatch());
+        BigDecimal mustReturn = autoMustAmount(allPlans, refundManagement.getBusinessNumber(), refundManagement.getContractNo(), refundManagement.getQuotaDisburseBatch());
         refundManagement.setFinancingAmount(mustReturn);
 
         return refundManagement;
@@ -318,8 +318,8 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
         //应退明细
         refundManagement.setContractNo(refundManagement.getContractNumber());
         List<LedgerDetailsVo> ledgerDetailsVos = baseMapper
-                .listByRefundId(id,refundManagement.getBusinessNumber(),
-                        refundManagement.getContractNo(),refundManagement.getQuotaDisburseBatch());
+                .listByRefundId(id, refundManagement.getBusinessNumber(),
+                        refundManagement.getContractNo(), refundManagement.getQuotaDisburseBatch());
         if (CollectionUtil.isNotEmpty(ledgerDetailsVos)) {
             ledgerDetailsVos.forEach(detailsVo -> {
                 Dictionary amountTypeDic = dictionaryService.getByCode(detailsVo.getAmountType());
@@ -615,9 +615,9 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
         });
 
         rows.forEach(taskVo -> {
-                //计算应退金额
-                BigDecimal mustReturn = autoMustAmount(taskVo.getPaymentCollectionPlanFactorings(), taskVo.getBusinessNumber(),taskVo.getContractNumber(),taskVo.getQuotaDisburseBatch());
-                taskVo.setSettlementAmount(mustReturn);
+            //计算应退金额
+            BigDecimal mustReturn = autoMustAmount(taskVo.getPaymentCollectionPlanFactorings(), taskVo.getBusinessNumber(), taskVo.getContractNumber(), taskVo.getQuotaDisburseBatch());
+            taskVo.setSettlementAmount(mustReturn);
 
             //已退金额(审核通过)
             List<RefundsApplyDetails> applyDetailsList = refundsApplyDetailsService
@@ -645,7 +645,7 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
             }
 
             //剩余应退
-            if (mustReturn != null && taskVo.getOpenAmount() != null){
+            if (mustReturn != null && taskVo.getOpenAmount() != null) {
                 BigDecimal residueAmount = mustReturn.subtract(taskVo.getOpenAmount());
                 taskVo.setFinancingAmount(residueAmount);
             }
@@ -665,7 +665,6 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
     }
 
 
-
     private RefundsApplyDetails autoUpstreamGoodsPayment(List<LedgerDetailsVo> ledgerDetailsVoSelected, String businessNumber) {
 
         ProjectInformation projectInformation = projectInformationService
@@ -737,6 +736,8 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
                                                   List<PaymentCollectionPlanFactoring> plansSelecteds,
                                                   String businessNumber) {
 
+        RefundsApplyDetails applyDetails = new RefundsApplyDetails();
+        String remark = "";
         ProjectInformation projectInformation = projectInformationService
                 .lambdaQuery().eq(ProjectInformation::getBusinessNumber, businessNumber).one();
         SupplierInfo supplierInfo = supplierInfoService.get(projectInformation.getcSupplierInfoId());
@@ -750,15 +751,17 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
             for (PaymentCollectionPlanFactoring plansSelected : plansSelecteds) {
                 amountTotal = amountTotal.add(plansSelected.getAmount().abs());
             }
+            remark = plansSelecteds.stream().map(plan -> plan.getAmountTypeName()).collect(Collectors.joining(","));
         }
 
         if (CollectionUtil.isNotEmpty(ledgerDetailsVoSelected)) {
             for (LedgerDetailsVo ledgerDetailsVo : ledgerDetailsVoSelected) {
                 amountTotal = amountTotal.add(ledgerDetailsVo.getAmount());
+                remark = remark + "," + ledgerDetailsVo.getAmountTypeDic().getName();
             }
         }
 
-        RefundsApplyDetails applyDetails = new RefundsApplyDetails();
+
         //收方账户信息
         List<LedgerFundGoodsAssign> fundGoodsAssignList = ledgerFundGoodsAssignService
                 .lambdaQuery().eq(LedgerFundGoodsAssign::getBusinessNumber, businessNumber)
@@ -809,7 +812,7 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
      * @param businessNumber
      * @return
      */
-    private BigDecimal autoMustAmount(List<PaymentCollectionPlanFactoring> paymentCollectionPlanFactorings, String businessNumber,String contractNo,Integer quotaDisburseBatch) {
+    private BigDecimal autoMustAmount(List<PaymentCollectionPlanFactoring> paymentCollectionPlanFactorings, String businessNumber, String contractNo, Integer quotaDisburseBatch) {
 
         BigDecimal mustReturn = BigDecimal.ZERO;
 
@@ -832,14 +835,14 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
 
         List<LedgerFundGoodsAssign> fundGoodsAssigns;
         //贸易:履约保证金+质保金+实退金额
-        if (contractNo != null && quotaDisburseBatch != null){
+        if (contractNo != null && quotaDisburseBatch != null) {
             fundGoodsAssigns = ledgerFundGoodsAssignService
                     .lambdaQuery().eq(LedgerFundGoodsAssign::getBusinessNumber, businessNumber)
                     .eq(LedgerFundGoodsAssign::getSubmit, true)
                     .eq(LedgerFundGoodsAssign::getContractNo, contractNo)
                     .eq(LedgerFundGoodsAssign::getQuotaDisburseBatch, quotaDisburseBatch)
                     .list();
-        }else {
+        } else {
             fundGoodsAssigns = ledgerFundGoodsAssignService
                     .lambdaQuery().eq(LedgerFundGoodsAssign::getBusinessNumber, businessNumber)
                     .isNull(LedgerFundGoodsAssign::getContractNo)