Преглед изворни кода

Merge branch 'refs/heads/dev1.0'

liutao пре 1 недеља
родитељ
комит
f8fd238b3f

+ 14 - 12
src/main/java/com/sunxung/factoring/service/invoicemanage/impl/InvoiceApprovalServiceImpl.java

@@ -390,18 +390,20 @@ public class InvoiceApprovalServiceImpl extends ServiceImpl<InvoiceApprovalMappe
                     CSalesContractSupplementBasicInfo salesContractSupplementBasicInfo = salesContractSupplementBasicInfoService.lambdaQuery()
                             .eq(CSalesContractSupplementBasicInfo::getcSalesContractSupplementInfoId, s.getId())
                             .one();
-                    List<FileStorageDO> SupplementFileStorageDOS = fileService.findByBusinessId(salesContractSupplementBasicInfo.getId(),
-                            FileModuleDict.ChildEnum.SALES_CONTRACT_SUPPLEMENT_CONTRACT_FILE.getCode());
-                    if (CollectionUtil.isNotEmpty(SupplementFileStorageDOS)) {
-                        SupplementFileStorageDOS.forEach(fileStorageDO -> {
-                            FileStorage fileStorage = new FileStorage();
-                            fileStorage.setAbsolutePath(fileStorageDO.getAbsolutePath());
-                            fileStorage.setName(fileStorageDO.getOriginalName());
-                            fileStorage.setPath(fileStorageDO.getPath());
-                            fileStorage.setId(fileStorageDO.getId());
-                            fileStorage.setOriginalName(fileStorageDO.getOriginalName());
-                            salesContract.add(fileStorage);
-                        });
+                    if(salesContractSupplementBasicInfo != null){
+                        List<FileStorageDO> SupplementFileStorageDOS = fileService.findByBusinessId(salesContractSupplementBasicInfo.getId(),
+                                FileModuleDict.ChildEnum.SALES_CONTRACT_SUPPLEMENT_CONTRACT_FILE.getCode());
+                        if (CollectionUtil.isNotEmpty(SupplementFileStorageDOS)) {
+                            SupplementFileStorageDOS.forEach(fileStorageDO -> {
+                                FileStorage fileStorage = new FileStorage();
+                                fileStorage.setAbsolutePath(fileStorageDO.getAbsolutePath());
+                                fileStorage.setName(fileStorageDO.getOriginalName());
+                                fileStorage.setPath(fileStorageDO.getPath());
+                                fileStorage.setId(fileStorageDO.getId());
+                                fileStorage.setOriginalName(fileStorageDO.getOriginalName());
+                                salesContract.add(fileStorage);
+                            });
+                        }
                     }
 
                     CSalesSupplementSignConfirmation salesSupplementSignConfirmation = salesSupplementSignConfirmationService

+ 13 - 10
src/main/java/com/sunxung/factoring/service/refundsManagement/impl/RefundManagementApprovalServiceImpl.java

@@ -168,16 +168,19 @@ public class RefundManagementApprovalServiceImpl extends ServiceImpl<RefundManag
                         User user = userService.get(apply.getUserId());
                         apply.setUserName(user.getName());
 
-                        //关联的计划
-                        List<RefundManagementPayCollPlanFactoringRef> payCollPlanFactoringRefs = refundManagementPayCollPlanFactoringRefService
-                                .lambdaQuery().eq(RefundManagementPayCollPlanFactoringRef::getRefundManagementId, approval.getRefundManagementId())
-                                .eq(RefundManagementPayCollPlanFactoringRef::getStatus, 0)
-                                .list();
-                        if (CollectionUtil.isNotEmpty(payCollPlanFactoringRefs)) {
-                            List<Long> planIds = payCollPlanFactoringRefs.stream()
-                                    .map(RefundManagementPayCollPlanFactoringRef::getPayCollPlanFactoringId).collect(Collectors.toList());
-                            apply.setPlanIds(planIds);
+                        if (apply.getPaymentMatter().equals("oaRefundMatter")){
+                            //关联的计划
+                            List<RefundManagementPayCollPlanFactoringRef> payCollPlanFactoringRefs = refundManagementPayCollPlanFactoringRefService
+                                    .lambdaQuery().eq(RefundManagementPayCollPlanFactoringRef::getRefundManagementId, approval.getRefundManagementId())
+                                    .eq(RefundManagementPayCollPlanFactoringRef::getStatus, 0)
+                                    .list();
+                            if (CollectionUtil.isNotEmpty(payCollPlanFactoringRefs)) {
+                                List<Long> planIds = payCollPlanFactoringRefs.stream()
+                                        .map(RefundManagementPayCollPlanFactoringRef::getPayCollPlanFactoringId).collect(Collectors.toList());
+                                apply.setPlanIds(planIds);
+                            }
                         }
+
                         //关联的履约保证金和质保金
                         List<RefundDetails> refundDetailsList = refundDetailsService.lambdaQuery()
                                 .eq(RefundDetails::getRefundManagementId, approval.getRefundManagementId())
@@ -311,7 +314,7 @@ public class RefundManagementApprovalServiceImpl extends ServiceImpl<RefundManag
                 .eq(RefundsApplyDetails::getStatus, 0)
                 .set(RefundsApplyDetails::getStatus, status).update();
 
-        refundManagementPayCollPlanFactoringRefService.lambdaUpdate().eq(RefundManagementPayCollPlanFactoringRef::getRefundManagementId, approval.getId())
+        refundManagementPayCollPlanFactoringRefService.lambdaUpdate().eq(RefundManagementPayCollPlanFactoringRef::getRefundManagementId, approval.getRefundManagementId())
                 .eq(RefundManagementPayCollPlanFactoringRef::getStatus, 0)
                 .set(RefundManagementPayCollPlanFactoringRef::getStatus, status)
                 .update();

+ 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();
             }
         }
+        applyDetails.setPaymentRemark(remark);
 
-        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)