Просмотр исходного кода

Merge remote-tracking branch 'origin/dev1.0' into dev1.0

# Conflicts:
#	src/main/java/com/sunxung/factoring/service/underlying/impl/UnderlyingBasicInfoServiceImpl.java
liutao месяцев назад: 6
Родитель
Сommit
4d78171a91

+ 1 - 0
src/main/java/com/sunxung/factoring/service/invoicemanage/impl/InvoiceBasicInfoServiceImpl.java

@@ -717,6 +717,7 @@ public class InvoiceBasicInfoServiceImpl extends ServiceImpl<InvoiceBasicInfoMap
             fileStorageDO.setSize(fileStorage.getSize());
             fileStorageDO.setBusinessType(FileModuleDict.ChildEnum.INVOICE_SALES_FILE.getCode());
             fileStorageDO.setBusinessId(invoiceBasicInfo.getId());
+            fileStorageDO.setType(fileStorage.getFileType());
             fileService.save(fileStorageDO);
         }
         return invoiceBasicInfo;

+ 49 - 46
src/main/java/com/sunxung/factoring/service/refundsManagement/impl/RefundManagementServiceImpl.java

@@ -138,7 +138,7 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
     @Transactional(rollbackFor = Exception.class)
     public void add(LedgerFundGoodsAssign ledgerFundGoodsAssign) {
 
-        //首次分账时,当 履约保证金 + 质保金 + 实退金额 > 0 时 插入数据,否则需要判断是否是已融资的货物
+        //首次分账时,当 履约保证金 + 质保金 + 实退金额 > 0 时 插入数据,否 则需要判断是否是已融资的货物
         //如是,需要判断对应的收支计划是否存在保证金放款,负的利息、负的管理费,如果存在,插入数据,否则不做插入操作
 
         if (ledgerFundGoodsAssign == null) {
@@ -157,58 +157,61 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
                     .eq(RefundManagement::getContractNo, ledgerFundGoodsAssign.getContractNo())
                     .eq(RefundManagement::getQuotaDisburseBatch, ledgerFundGoodsAssign.getQuotaDisburseBatch()).one();
         }
-        if (!flag && refundManagement == null) {
-            //判断收支计划是否有保证金放款
-            PaymentCollectionBasicVo paymentCollectionBasicVo = new PaymentCollectionBasicVo();
-            FactoringBusinessLoanRecordAccountsReceivableVo factoringBusinessLoanRecordAccountsReceivableVo = new FactoringBusinessLoanRecordAccountsReceivableVo();
-            factoringBusinessLoanRecordAccountsReceivableVo.setSopAccountsReceivableId(ledgerFundGoodsAssign.getSopAccountsReceivableId());
-            factoringBusinessLoanRecordAccountsReceivableVo.setBillingFactoringBusinessLoanRecordId(ledgerFundGoodsAssign.getBillingFactoringBusinessLoanRecordId());
-            paymentCollectionBasicVo.setFactoringBusinessLoanRecordAccountsReceivableVo(factoringBusinessLoanRecordAccountsReceivableVo);
+        if (refundManagement == null) {
+            if (!flag) {
+                //判断收支计划是否有保证金放款
+                PaymentCollectionBasicVo paymentCollectionBasicVo = new PaymentCollectionBasicVo();
+                FactoringBusinessLoanRecordAccountsReceivableVo factoringBusinessLoanRecordAccountsReceivableVo = new FactoringBusinessLoanRecordAccountsReceivableVo();
+                factoringBusinessLoanRecordAccountsReceivableVo.setSopAccountsReceivableId(ledgerFundGoodsAssign.getSopAccountsReceivableId());
+                factoringBusinessLoanRecordAccountsReceivableVo.setBillingFactoringBusinessLoanRecordId(ledgerFundGoodsAssign.getBillingFactoringBusinessLoanRecordId());
+                paymentCollectionBasicVo.setFactoringBusinessLoanRecordAccountsReceivableVo(factoringBusinessLoanRecordAccountsReceivableVo);
+
+                JSONObject jsonObject = restTemplate.postForObject(getPaymentCollBasicOneStatusUrl, paymentCollectionBasicVo, JSONObject.class);
+                if (jsonObject != null) {
+                    if (jsonObject.get("code").equals(CodeUtil.FAIL)) {
+                        throw new BusinessException(CodeUtil.FAIL, jsonObject.get("msg").toString());
+                    }
+                    String data = JSONArray.toJSONString(jsonObject.get("data"));
+                    PaymentCollectionBasicVo paymentCollectionBasicVoSop = JSON.parseObject(data
+                            , PaymentCollectionBasicVo.class);
+                    List<PaymentCollectionPlanFactoring> plans = paymentCollectionBasicVoSop.getPaymentCollectionPlanFactorings();
+                    if (CollectionUtil.isNotEmpty(plans)) {
+                        for (PaymentCollectionPlanFactoring plan : plans) {
+
+                            //非已完成的计划
+                            if (!plan.getStatus().getCode().equals(ProjectInitiationStatusDict.ChildEnum.COMPLETED.getCode())) {
+                                if (plan.getAmountType().getCode().equals(IncomeExpenditureTypeDict.ChildEnum.MARGIN.getCode())
+                                        && plan.getPaymentCollectionType().equals(ConstantConversionUtil.PAY_COLL_PAYMENT)) {
+                                    //保证金放款
+                                    flag = true;
+                                }
 
-            JSONObject jsonObject = restTemplate.postForObject(getPaymentCollBasicOneStatusUrl, paymentCollectionBasicVo, JSONObject.class);
-            if (jsonObject != null) {
-                if (jsonObject.get("code").equals(CodeUtil.FAIL)) {
-                    throw new BusinessException(CodeUtil.FAIL, jsonObject.get("msg").toString());
-                }
-                String data = JSONArray.toJSONString(jsonObject.get("data"));
-                PaymentCollectionBasicVo paymentCollectionBasicVoSop = JSON.parseObject(data
-                        , PaymentCollectionBasicVo.class);
-                List<PaymentCollectionPlanFactoring> plans = paymentCollectionBasicVoSop.getPaymentCollectionPlanFactorings();
-                if (CollectionUtil.isNotEmpty(plans)) {
-                    for (PaymentCollectionPlanFactoring plan : plans) {
-
-                        //非已完成的计划
-                        if (!plan.getStatus().getCode().equals(ProjectInitiationStatusDict.ChildEnum.COMPLETED.getCode())) {
-                            if (plan.getAmountType().getCode().equals(IncomeExpenditureTypeDict.ChildEnum.MARGIN.getCode())
-                                    && plan.getPaymentCollectionType().equals(ConstantConversionUtil.PAY_COLL_PAYMENT)) {
-                                //保证金放款
-                                flag = true;
-                            }
+                                if (plan.getAmountType().getCode().equals(IncomeExpenditureTypeDict.ChildEnum.INTEREST.getCode())
+                                        && plan.getAmount().compareTo(BigDecimal.ZERO) < 0) {
+                                    //利息 < 0
+                                    flag = true;
+                                }
 
-                            if (plan.getAmountType().getCode().equals(IncomeExpenditureTypeDict.ChildEnum.INTEREST.getCode())
-                                    && plan.getAmount().compareTo(BigDecimal.ZERO) < 0) {
-                                //利息 < 0
-                                flag = true;
-                            }
+                                if ((plan.getAmountType().getCode().equals(IncomeExpenditureTypeDict.ChildEnum.MANAGEMENT_FEE.getCode())
+                                        && plan.getAmount().compareTo(BigDecimal.ZERO) < 0)) {
+                                    //管理费 < 0
+                                    flag = true;
+                                }
 
-                            if ((plan.getAmountType().getCode().equals(IncomeExpenditureTypeDict.ChildEnum.MANAGEMENT_FEE.getCode())
-                                    && plan.getAmount().compareTo(BigDecimal.ZERO) < 0)) {
-                                //管理费 < 0
-                                flag = true;
                             }
-
                         }
                     }
+
                 }
 
+            } else {
+                //贸易
+                refundManagement = lambdaQuery().eq(RefundManagement::getBusinessNumber, ledgerFundGoodsAssign.getBusinessNumber()).eq(RefundManagement::getQuotaDisburseBatch, null)
+                        .eq(RefundManagement::getContractNo, null).one();
             }
-
-        } else {
-            //贸易
-            refundManagement = lambdaQuery().eq(RefundManagement::getBusinessNumber, ledgerFundGoodsAssign.getBusinessNumber()).eq(RefundManagement::getQuotaDisburseBatch, null)
-                    .eq(RefundManagement::getContractNo, null).one();
         }
-        if (refundManagement == null && flag) {
+
+        if (flag && null == refundManagement){
             //新增
             refundManagement = new RefundManagement(ledgerFundGoodsAssign);
             CSalesContract salesContract = salesContractService.getByBusinessNumber(refundManagement.getBusinessNumber());
@@ -260,7 +263,7 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
 
             autoPlanAndAmount(paymentCollectionBasicVoList, rows);
 
-            rows.forEach(row->{
+            rows.forEach(row -> {
                 autoExecutor(row);
             });
 
@@ -680,7 +683,7 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
                     .list();
             if (CollectionUtil.isNotEmpty(fundGoodsAssignList)) {
                 List<LedgerAccountBasicInfo> ledgerAccountBasicInfos = fundGoodsAssignList.stream().map(fundGoodsAssign ->
-                        ledgerAccountBasicInfoService.getById(fundGoodsAssign.getLedgerAccountBasicInfoId())
+                        ledgerAccountBasicInfoService.getDetail(fundGoodsAssign.getLedgerAccountBasicInfoId())
                 ).sorted(Comparator.comparing(LedgerAccountBasicInfo::getGmtCreate).reversed()).collect(Collectors.toList());
                 List<RefundsApplyAccountInfo> accountInfoList = new ArrayList<>();
                 if (CollectionUtil.isNotEmpty(ledgerAccountBasicInfos)) {
@@ -743,7 +746,7 @@ public class RefundManagementServiceImpl extends ServiceImpl<RefundManagementMap
                 .list();
         if (CollectionUtil.isNotEmpty(fundGoodsAssignList)) {
             List<LedgerAccountBasicInfo> ledgerAccountBasicInfos = fundGoodsAssignList.stream().map(fundGoodsAssign -> {
-                return ledgerAccountBasicInfoService.getById(fundGoodsAssign.getLedgerAccountBasicInfoId());
+                return ledgerAccountBasicInfoService.getDetail(fundGoodsAssign.getLedgerAccountBasicInfoId());
             }).sorted(Comparator.comparing(LedgerAccountBasicInfo::getGmtCreate).reversed()).collect(Collectors.toList());
             List<RefundsApplyAccountInfo> accountInfoList = new ArrayList<>();
             if (CollectionUtil.isNotEmpty(ledgerAccountBasicInfos)) {