Browse Source

feat(资方管理):销售发票拉取bug修复

Wangyafan 6 months ago
parent
commit
9bcf7281f2

+ 9 - 9
src/main/java/com/sunxung/factoring/service/fundmanagement/impl/FinancialInstitutionServiceImpl.java

@@ -40,7 +40,6 @@ import com.sunxung.factoring.entity.salescontractmanagement.CSalesSignConfirmati
 import com.sunxung.factoring.entity.salescontractmanagement.CSalesSignConfirmationElectronicInfo;
 import com.sunxung.factoring.entity.settlement.SettlementGoodsInfo;
 import com.sunxung.factoring.entity.supplier.SupplierInfo;
-import com.sunxung.factoring.entity.sys.Dictionary;
 import com.sunxung.factoring.entity.sys.*;
 import com.sunxung.factoring.entity.sys.vo.SeachUser;
 import com.sunxung.factoring.mapper.fundmanagement.FinancialInstitutionMapper;
@@ -76,7 +75,6 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
 
-import java.io.File;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -804,12 +802,14 @@ public class FinancialInstitutionServiceImpl extends ServiceImpl<FinancialInstit
 
                             SalesInvoiceInfo salesInvoiceInfo = salesInvoiceInfoService.lambdaQuery().eq(SalesInvoiceInfo::getInvoiceBasicInfoId, invoiceBasicInfoId).one();
                             //销售发票附件(销售发票未在B端中间表存储 所以取数逻辑不同)
-                            List<FileStorage> salesFileList = fileStorageService.findByBelongIdAndBelongType(salesInvoiceInfo.getId().toString(), FileModuleDict.ChildEnum.INVOICE_SALES_FILE.getCode());
-                            if (CollectionUtil.isNotEmpty(salesFileList)) {
-                                salesFileList.stream().forEach(p -> {
-                                    sysAttachmentRefService.copyFile(p, FileModuleDict.ChildEnum.FINANCIAL_EXPENDITURE_DOWNSTREAM_INVOICE_FILE,
-                                            AttachmentDto.builder().setEntityId(customerExpenditureContractInfo.getId()).build());
-                                });
+                            if (salesInvoiceInfo != null) {
+                                List<FileStorage> salesFileList = fileStorageService.findByBelongIdAndBelongType(salesInvoiceInfo.getId().toString(), FileModuleDict.ChildEnum.INVOICE_SALES_FILE.getCode());
+                                if (CollectionUtil.isNotEmpty(salesFileList)) {
+                                    salesFileList.stream().forEach(p -> {
+                                        sysAttachmentRefService.copyFile(p, FileModuleDict.ChildEnum.FINANCIAL_EXPENDITURE_DOWNSTREAM_INVOICE_FILE,
+                                                AttachmentDto.builder().setEntityId(customerExpenditureContractInfo.getId()).build());
+                                    });
+                                }
                             }
                         }
 
@@ -906,7 +906,7 @@ public class FinancialInstitutionServiceImpl extends ServiceImpl<FinancialInstit
                 //如果客户对应的支用信息都为空 删除客户信息
                 if (dictService.get(financialCustomer.getCustomerStatus()).getCode().equals(FinancialCustomerStatusDict.ChildEnum.FINANCIAL_CUSTOMER_TO_BE_EDIT.getCode())) {
                     BusinessProcessingLog customerLog = businessProcessingLogService
-                            .findLatestByTaskDefKey(null,ConstantUtil.FINANCIAL_CUSTOMER_PROCESS, financialCustomer.getId());
+                            .findLatestByTaskDefKey(null, ConstantUtil.FINANCIAL_CUSTOMER_PROCESS, financialCustomer.getId());
                     //终止客户信息流程
                     businessProcessingTaskService.terminate(customerLog.getHistoricTaskId(), financialCustomer.getId(), customerLog.getBusinessType(),
                             customerLog.getTaskName(), customerLog.getTaskDefKey());