ソースを参照

feat(供应商):增加暂存功能

liutao 7 ヶ月 前
コミット
4aab1822db

+ 140 - 0
src/main/java/com/sunxung/factoring/entity/supplier/CorporateGoodwill.java

@@ -217,12 +217,72 @@ public class CorporateGoodwill {
     @TableField("document_finance")
     private Integer documentFinance;
 
+    /**
+     * 是否存在被追偿余额、关注类余额、不良类余额
+     */
+    @TableField(exist = false)
+    private Integer VideoRecoveredBalance;
+
+    /**
+     * 是否存在未结清信贷的关注类账户
+     */
+    @TableField(exist = false)
+    private Integer VideoUnclearFollowUpAccounts;
+
+    /**
+     * 是否存在未结清信贷的不良类账户
+     */
+    @TableField(exist = false)
+    private Integer VideoOutstandingNonPerformingAccounts;
+
+    /**
+     * 未结清短期借款余额
+     */
+    @TableField(exist = false)
+    private BigDecimal VideoOutstandingShortTermLoanBalance;
+
+    /**
+     * 是否存在被追偿余额、关注类余额、不良类余额得分
+     */
+    @TableField(exist = false)
+    private BigDecimal VideoRecoveredBalanceScore;
+
+    /**
+     * 是否存在未结清信贷的关注类账户得分
+     */
+    @TableField(exist = false)
+    private BigDecimal VideoConcernedAccountsWithOutstandingCreditScore;
+
+    /**
+     * 是否存在未结清信贷的不良类账户得分
+     */
+    @TableField(exist = false)
+    private BigDecimal VideoOutstandingNonPerformingAccountsScore;
+
+    /**
+     * 未结清短期借款余额得分
+     */
+    @TableField(exist = false)
+    private BigDecimal VideoOutstandingBalanceScore;
+
     /**
      * 问题
      */
     @TableField(exist = false)
     private String question;
 
+    /**
+     * 反馈
+     */
+    @TableField(exist = false)
+    private String feedback;
+
+    /**
+     * 文件
+     */
+    @TableField(exist = false)
+    private List<FileStorage> files;
+
     /**
      * 是否存在民间借贷
      */
@@ -266,6 +326,86 @@ public class CorporateGoodwill {
     @TableField(exist = false)
     private VideoDueDiligenceCorporateGoodwill videoDueDiligenceCorporateGoodwill;
 
+    public List<FileStorage> getFiles() {
+        return files;
+    }
+
+    public void setFiles(List<FileStorage> files) {
+        this.files = files;
+    }
+
+    public Integer getVideoRecoveredBalance() {
+        return VideoRecoveredBalance;
+    }
+
+    public void setVideoRecoveredBalance(Integer videoRecoveredBalance) {
+        VideoRecoveredBalance = videoRecoveredBalance;
+    }
+
+    public Integer getVideoUnclearFollowUpAccounts() {
+        return VideoUnclearFollowUpAccounts;
+    }
+
+    public void setVideoUnclearFollowUpAccounts(Integer videoUnclearFollowUpAccounts) {
+        VideoUnclearFollowUpAccounts = videoUnclearFollowUpAccounts;
+    }
+
+    public Integer getVideoOutstandingNonPerformingAccounts() {
+        return VideoOutstandingNonPerformingAccounts;
+    }
+
+    public void setVideoOutstandingNonPerformingAccounts(Integer videoOutstandingNonPerformingAccounts) {
+        VideoOutstandingNonPerformingAccounts = videoOutstandingNonPerformingAccounts;
+    }
+
+    public BigDecimal getVideoOutstandingShortTermLoanBalance() {
+        return VideoOutstandingShortTermLoanBalance;
+    }
+
+    public void setVideoOutstandingShortTermLoanBalance(BigDecimal videoOutstandingShortTermLoanBalance) {
+        VideoOutstandingShortTermLoanBalance = videoOutstandingShortTermLoanBalance;
+    }
+
+    public BigDecimal getVideoRecoveredBalanceScore() {
+        return VideoRecoveredBalanceScore;
+    }
+
+    public void setVideoRecoveredBalanceScore(BigDecimal videoRecoveredBalanceScore) {
+        VideoRecoveredBalanceScore = videoRecoveredBalanceScore;
+    }
+
+    public BigDecimal getVideoConcernedAccountsWithOutstandingCreditScore() {
+        return VideoConcernedAccountsWithOutstandingCreditScore;
+    }
+
+    public void setVideoConcernedAccountsWithOutstandingCreditScore(BigDecimal videoConcernedAccountsWithOutstandingCreditScore) {
+        VideoConcernedAccountsWithOutstandingCreditScore = videoConcernedAccountsWithOutstandingCreditScore;
+    }
+
+    public BigDecimal getVideoOutstandingNonPerformingAccountsScore() {
+        return VideoOutstandingNonPerformingAccountsScore;
+    }
+
+    public void setVideoOutstandingNonPerformingAccountsScore(BigDecimal videoOutstandingNonPerformingAccountsScore) {
+        VideoOutstandingNonPerformingAccountsScore = videoOutstandingNonPerformingAccountsScore;
+    }
+
+    public BigDecimal getVideoOutstandingBalanceScore() {
+        return VideoOutstandingBalanceScore;
+    }
+
+    public void setVideoOutstandingBalanceScore(BigDecimal videoOutstandingBalanceScore) {
+        VideoOutstandingBalanceScore = videoOutstandingBalanceScore;
+    }
+
+    public String getFeedback() {
+        return feedback;
+    }
+
+    public void setFeedback(String feedback) {
+        this.feedback = feedback;
+    }
+
     public VideoDueDiligenceCorporateGoodwill getVideoDueDiligenceCorporateGoodwill() {
         return videoDueDiligenceCorporateGoodwill;
     }

+ 29 - 0
src/main/java/com/sunxung/factoring/entity/supplier/CreditSituation.java

@@ -159,6 +159,13 @@ public class CreditSituation extends BaseEntity {
     @TableField("ST_count_score")
     private BigDecimal stCountScore;
 
+
+    /**
+     * 文件
+     */
+    @TableField(exist = false)
+    private List<FileStorage> files;
+
     @TableField(exist = false)
     public CCreditInvestigationInfoHistory creditInvestigationInfoHistory;
 
@@ -168,6 +175,12 @@ public class CreditSituation extends BaseEntity {
     @TableField(exist = false)
     private String question;
 
+    /**
+     * 反馈
+     */
+    @TableField(exist = false)
+    private String feedback;
+
     /**
      * 征信报告
      */
@@ -240,6 +253,22 @@ public class CreditSituation extends BaseEntity {
     @TableField(exist = false)
     private Integer stCountFix;
 
+    public List<FileStorage> getFiles() {
+        return files;
+    }
+
+    public void setFiles(List<FileStorage> files) {
+        this.files = files;
+    }
+
+    public String getFeedback() {
+        return feedback;
+    }
+
+    public void setFeedback(String feedback) {
+        this.feedback = feedback;
+    }
+
     public Long getOverdueAccounts() {
         return overdueAccounts;
     }

+ 11 - 0
src/main/java/com/sunxung/factoring/entity/supplier/SupplierApprovalSecond.java

@@ -222,6 +222,9 @@ public class SupplierApprovalSecond extends BaseEntity {
      */
     @TableField("notice")
     private String notice;
+
+    @TableField("visible")
+    private Boolean visible;
     /**
      * 供应商红否原因
      */
@@ -591,4 +594,12 @@ public class SupplierApprovalSecond extends BaseEntity {
     public void setOfficeFilesCompliance(Integer officeFilesCompliance) {
         this.officeFilesCompliance = officeFilesCompliance;
     }
+
+    public Boolean getVisible() {
+        return visible;
+    }
+
+    public void setVisible(Boolean visible) {
+        this.visible = visible;
+    }
 }

+ 3 - 3
src/main/java/com/sunxung/factoring/entity/supplier/SupplierInfo.java

@@ -91,6 +91,9 @@ public class SupplierInfo extends Project {
     @TableField("guarantee_enterprise_errors")
     private String guaranteeEnterpriseErrors;
 
+    @TableField("visible")
+    private Boolean visible;
+
     @TableField(exist = false)
     private String supplierName;
 
@@ -121,9 +124,6 @@ public class SupplierInfo extends Project {
     @TableField(exist = false)
     private SupplierApprovalFirst supplierApprovalFirst;
 
-    @TableField(exist = false)
-    private Boolean visible;
-
     @TableField(exist = false)
     private String taskId;
 

+ 12 - 0
src/main/java/com/sunxung/factoring/entity/supplier/VideoDueDiligence.java

@@ -482,6 +482,10 @@ public class VideoDueDiligence extends BaseEntity {
     @TableField("negative_information_feedback")
     private String negativeInformationFeedback;
 
+
+    @TableField("visible")
+    private Boolean visible;
+
     /**
      * 负面清单文件
      */
@@ -1546,4 +1550,12 @@ public class VideoDueDiligence extends BaseEntity {
     public void setAge(Integer age) {
         this.age = age;
     }
+
+    public Boolean getVisible() {
+        return visible;
+    }
+
+    public void setVisible(Boolean visible) {
+        this.visible = visible;
+    }
 }

+ 15 - 12
src/main/java/com/sunxung/factoring/service/supplier/impl/SupplierApprovalFirstServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sunxung.factoring.component.constance.SupplierScoringModel;
 import com.sunxung.factoring.component.exception.ServiceException;
+import com.sunxung.factoring.component.exception.ValidatorException;
 import com.sunxung.factoring.component.util.*;
 import com.sunxung.factoring.dict.impl.FileModuleDict;
 import com.sunxung.factoring.entity.ResponseJson;
@@ -133,9 +134,6 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void firstReview(SupplierInfo supplierInfo) {
-        //保存第一步审核结论
-        SupplierApprovalFirst supplierApprovalFirst = measurement(supplierInfo);
-        save(supplierApprovalFirst);
         //保存企业审核信息
         Enterprise enterprise = supplierInfo.getEnterprise();
         saveInfo(enterprise,supplierInfo.getId());
@@ -145,7 +143,10 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
             saveInfo(guaranteeEnterprise, supplierInfo.getId());
         }
         //流程处理
-//        if(supplierInfo.getVisible()){
+        if(supplierInfo.getVisible()){
+            //保存第一步审核结论
+            SupplierApprovalFirst supplierApprovalFirst = measurement(supplierInfo);
+            save(supplierApprovalFirst);
             String taskId = supplierInfo.getTaskId();
             String result = "通过";
             Long mainEnterpriseCount = supplierApprovalFirst.getMainEnterpriseCount();
@@ -172,7 +173,7 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
                         "供应商名称为“" + enterprise.getCorporateName() + "”的供应商审核已被否决");
             }
             flowableService.completeMyTask(taskId, supplierInfo, procVariables, null, supplierApprovalFirst.getId(), msgVariables, ConstantUtil.SUPPLIER_INFO);
-//        }
+        }
     }
 
 
@@ -186,6 +187,8 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
                 creditSituation.setcSupplierInfoId(id);
                 creditSituationService.save(creditSituation);
             }
+        }else {
+            throw new ValidatorException(CodeUtil.FAIL,"企业主要人员征信情况不能为空!");
         }
         corporateGoodwillService.lambdaUpdate().eq(CorporateGoodwill::getcSupplierInfoId,id)
                 .eq(CorporateGoodwill::getcEnterpriseId,enterprise.getId()).remove();
@@ -428,37 +431,37 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
         enterprise.setCorporateGoodwill(corporateGoodwill);
         List<PrivateLending> privateLendings = privateLendingService.lambdaQuery().eq(PrivateLending::getcSupplierInfoId, id).eq(PrivateLending::getcEnterpriseId, enterprise.getId()).list();
         if(CollectionUtil.isNotEmpty(privateLendings)){
-            privateLendings.forEach(r->r.setPrivateLending(0));
+            //privateLendings.forEach(r->r.setPrivateLending(0));
         }
         enterprise.setPrivateLendings(privateLendings);
         List<SeriousIllegality> seriousIllegalities = seriousIllegalityService.lambdaQuery().eq(SeriousIllegality::getcSupplierInfoId, id).eq(SeriousIllegality::getcEnterpriseId, enterprise.getId()).list();
         if(CollectionUtil.isNotEmpty(seriousIllegalities)){
-            seriousIllegalities.forEach(r->r.setSeriousIllegality(0));
+            //seriousIllegalities.forEach(r->r.setSeriousIllegality(0));
         }
         enterprise.setSeriousIllegalities(seriousIllegalities);
         List<TaxOweNotice> taxOweNotices = taxOweNoticeService.lambdaQuery().eq(TaxOweNotice::getcSupplierInfoId, id).eq(TaxOweNotice::getcEnterpriseId, enterprise.getId()).list();
         if(CollectionUtil.isNotEmpty(taxOweNotices)){
-            taxOweNotices.forEach(r->r.setTaxOweNotice(0));
+            //taxOweNotices.forEach(r->r.setTaxOweNotice(0));
         }
         enterprise.setTaxOweNotices(taxOweNotices);
         List<TaxIllegalData> taxIllegalData = taxIllegalDataService.lambdaQuery().eq(TaxIllegalData::getcSupplierInfoId, id).eq(TaxIllegalData::getcEnterpriseId, enterprise.getId()).list();
         if(CollectionUtil.isNotEmpty(taxIllegalData)){
-            taxIllegalData.forEach(r->r.setTaxIllegal(0));
+            //taxIllegalData.forEach(r->r.setTaxIllegal(0));
         }
         enterprise.setTaxIllegalData(taxIllegalData);
         List<Blacklist> blacklists = blacklistService.lambdaQuery().eq(Blacklist::getcSupplierInfoId, id).eq(Blacklist::getcEnterpriseId, enterprise.getId()).list();
         if(CollectionUtil.isNotEmpty(blacklists)){
-            blacklists.forEach(r->r.setBlacklist(0));
+            //blacklists.forEach(r->r.setBlacklist(0));
         }
         enterprise.setBlacklists(blacklists);
         List<ExceptionData> exceptionData = exceptionDataService.lambdaQuery().eq(ExceptionData::getcSupplierInfoId, id).eq(ExceptionData::getcEnterpriseId, enterprise.getId()).list();
         if(CollectionUtil.isNotEmpty(exceptionData)){
-            exceptionData.forEach(r->r.setException(0));
+            //exceptionData.forEach(r->r.setException(0));
         }
         enterprise.setExceptionData(exceptionData);
         List<News> news = newsService.lambdaQuery().eq(News::getcSupplierInfoId, id).eq(News::getcEnterpriseId, enterprise.getId()).list();
         if(CollectionUtil.isNotEmpty(news)){
-            news.forEach(r->r.setNews(0));
+            //news.forEach(r->r.setNews(0));
         }
         enterprise.setNews(news);
         if(CollectionUtil.isEmpty(privateLendings) || CollectionUtil.isEmpty(seriousIllegalities) || CollectionUtil.isEmpty(taxOweNotices) || CollectionUtil.isEmpty(taxIllegalData)

+ 119 - 92
src/main/java/com/sunxung/factoring/service/supplier/impl/SupplierApprovalSecondServiceImpl.java

@@ -31,6 +31,7 @@ import com.sunxung.factoring.service.sys.ISysAttachmentRefService;
 import com.sunxung.factoring.service.sys.UserService;
 import com.sunxung.factoring.service.sys.dto.AttachmentDto;
 import com.sunxung.factoring.service.sys.flowable.FlowableService;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -158,7 +159,10 @@ public class SupplierApprovalSecondServiceImpl extends ServiceImpl<SupplierAppro
 
     @Override
     public SupplierApprovalSecond getSecondReviewById(Long id) {
-        SupplierApprovalSecond supplierApprovalSecond = new SupplierApprovalSecond();
+        SupplierApprovalSecond supplierApprovalSecond = lambdaQuery().eq(SupplierApprovalSecond::getcSupplierInfoId, id).eq(SupplierApprovalSecond::getVisible, false).one();
+        if(supplierApprovalSecond == null){
+            supplierApprovalSecond = new SupplierApprovalSecond();
+        }
         //获取最后一次供应商C端录入时的log
         BusinessProcessingLog lastLog = businessProcessingLogService.getLastByBusinessKeyBusinessTypeTaskName(id, ConstantUtil.SUPPLIER_INFO, "供应商C端录入");
         CSupplierInfoHistory supplierInfoHistory = supplierInfoHistoryService.getById(lastLog.getFormBusinessId());
@@ -208,34 +212,50 @@ public class SupplierApprovalSecondServiceImpl extends ServiceImpl<SupplierAppro
         supplierApprovalSecond.setcEnterpriseHistoryId(enterpriseHistory.getId());
         supplierApprovalSecond.setBusinessAddress(enterpriseHistory.getBusinessAddress());
         //获取经营范围
-        String getScopeUrl = getScope + "?comprehensiveRiskInvestigationId=" + enterpriseHistory.getcComprehensiveRiskInvestigationId();
-        String scope = restTemplate.getForObject(getScopeUrl, String.class);
-        supplierApprovalSecond.setScope(scope);
-        //上游采购单据
-        List<CUpstreamProcurementDocumentsHistory> cUpstreamProcurementDocumentsHistories = cUpstreamProcurementDocumentsHistoryService.lambdaQuery().eq(CUpstreamProcurementDocumentsHistory::getcEnterpriseHistoryId, enterpriseHistory.getId()).list();
-        if (CollectionUtil.isNotEmpty(cUpstreamProcurementDocumentsHistories)) {
-            List<UpstreamProcurementDocuments> upstreamProcurementDocumentsList = cUpstreamProcurementDocumentsHistories.stream().map(r -> {
-                List<FileStorageDO> fileStorageDOS = fileService.findByBusinessId(r.getId(), FileModuleDict.ChildEnum.ENTERPRISE_UPSTREAM_DOCUMENTS_HISTORY.getCode());
-                UpstreamProcurementDocuments upstreamProcurementDocuments = new UpstreamProcurementDocuments();
-                upstreamProcurementDocuments.setFileStorageDOS(fileStorageDOS);
-                upstreamProcurementDocuments.setcUpstreamProcurementDocumentsHistoryId(r.getId());
-                upstreamProcurementDocuments.setName(r.getName());
-                return upstreamProcurementDocuments;
-            }).collect(Collectors.toList());
-            supplierApprovalSecond.setUpstreamProcurementDocumentsList(upstreamProcurementDocumentsList);
+        if(StringUtils.isEmpty(supplierApprovalSecond.getScope())){
+            String getScopeUrl = getScope + "?comprehensiveRiskInvestigationId=" + enterpriseHistory.getcComprehensiveRiskInvestigationId();
+            String scope = restTemplate.getForObject(getScopeUrl, String.class);
+            supplierApprovalSecond.setScope(scope);
         }
-        //下游销售单据
-        List<CSalesDocumentsInfoHistory> cSalesDocumentsInfoHistories = cSalesDocumentsInfoHistoryService.lambdaQuery().eq(CSalesDocumentsInfoHistory::getcEnterpriseHistoryId, enterpriseHistory.getId()).list();
-        if (CollectionUtil.isNotEmpty(cSalesDocumentsInfoHistories)) {
-            List<SalesDocumentsInfo> salesDocumentsInfoList = cSalesDocumentsInfoHistories.stream().map(r -> {
-                List<FileStorageDO> fileStorageDOS = fileService.findByBusinessId(r.getId(), FileModuleDict.ChildEnum.ENTERPRISE_SALES_DOCUMENTS_HISTORY.getCode());
-                SalesDocumentsInfo salesDocumentsInfo = new SalesDocumentsInfo();
-                salesDocumentsInfo.setFileStorageDOS(fileStorageDOS);
-                salesDocumentsInfo.setcSalesDocumentsInfoHistoryId(r.getId());
-                salesDocumentsInfo.setName(r.getName());
-                return salesDocumentsInfo;
-            }).collect(Collectors.toList());
+        if(supplierApprovalSecond.getId() != null){
+            //保存文件
+            AttachmentDto attachmentDto = AttachmentDto.builder()
+                    .setEntityId(supplierApprovalSecond.getId())
+                    .setChildEnum(FileModuleDict.ChildEnum.SUPPLIER_APPROVAL_MOVABLE_PROPERTY_FINANCING_FILE)
+                    .build();
+            List<FileStorage> files = attachmentRefService.getFiles(attachmentDto);
+            supplierApprovalSecond.setFileStorageList(files);
+            List<UpstreamProcurementDocuments> upstreamProcurementDocumentsList = upstreamProcurementDocumentsService.lambdaQuery().eq(UpstreamProcurementDocuments::getSupplierApprovalSecondId, supplierApprovalSecond.getId()).list();
+            supplierApprovalSecond.setUpstreamProcurementDocumentsList(upstreamProcurementDocumentsList);
+            List<SalesDocumentsInfo> salesDocumentsInfoList = salesDocumentsInfoService.lambdaQuery().eq(SalesDocumentsInfo::getSupplierApprovalSecondId, supplierApprovalSecond.getId()).list();
             supplierApprovalSecond.setSalesDocumentsInfoList(salesDocumentsInfoList);
+        }else {
+            //上游采购单据
+            List<CUpstreamProcurementDocumentsHistory> cUpstreamProcurementDocumentsHistories = cUpstreamProcurementDocumentsHistoryService.lambdaQuery().eq(CUpstreamProcurementDocumentsHistory::getcEnterpriseHistoryId, enterpriseHistory.getId()).list();
+            if (CollectionUtil.isNotEmpty(cUpstreamProcurementDocumentsHistories)) {
+                List<UpstreamProcurementDocuments> upstreamProcurementDocumentsList = cUpstreamProcurementDocumentsHistories.stream().map(r -> {
+                    List<FileStorageDO> fileStorageDOS = fileService.findByBusinessId(r.getId(), FileModuleDict.ChildEnum.ENTERPRISE_UPSTREAM_DOCUMENTS_HISTORY.getCode());
+                    UpstreamProcurementDocuments upstreamProcurementDocuments = new UpstreamProcurementDocuments();
+                    upstreamProcurementDocuments.setFileStorageDOS(fileStorageDOS);
+                    upstreamProcurementDocuments.setcUpstreamProcurementDocumentsHistoryId(r.getId());
+                    upstreamProcurementDocuments.setName(r.getName());
+                    return upstreamProcurementDocuments;
+                }).collect(Collectors.toList());
+                supplierApprovalSecond.setUpstreamProcurementDocumentsList(upstreamProcurementDocumentsList);
+            }
+            //下游销售单据
+            List<CSalesDocumentsInfoHistory> cSalesDocumentsInfoHistories = cSalesDocumentsInfoHistoryService.lambdaQuery().eq(CSalesDocumentsInfoHistory::getcEnterpriseHistoryId, enterpriseHistory.getId()).list();
+            if (CollectionUtil.isNotEmpty(cSalesDocumentsInfoHistories)) {
+                List<SalesDocumentsInfo> salesDocumentsInfoList = cSalesDocumentsInfoHistories.stream().map(r -> {
+                    List<FileStorageDO> fileStorageDOS = fileService.findByBusinessId(r.getId(), FileModuleDict.ChildEnum.ENTERPRISE_SALES_DOCUMENTS_HISTORY.getCode());
+                    SalesDocumentsInfo salesDocumentsInfo = new SalesDocumentsInfo();
+                    salesDocumentsInfo.setFileStorageDOS(fileStorageDOS);
+                    salesDocumentsInfo.setcSalesDocumentsInfoHistoryId(r.getId());
+                    salesDocumentsInfo.setName(r.getName());
+                    return salesDocumentsInfo;
+                }).collect(Collectors.toList());
+                supplierApprovalSecond.setSalesDocumentsInfoList(salesDocumentsInfoList);
+            }
         }
         return supplierApprovalSecond;
     }
@@ -246,23 +266,20 @@ public class SupplierApprovalSecondServiceImpl extends ServiceImpl<SupplierAppro
         String taskId = supplierApprovalSecond.getTaskId();
         SupplierInfo supplierInfo = supplierInfoService.get(supplierApprovalSecond.getcSupplierInfoId());
         Enterprise enterprise = enterpriseService.getById(supplierInfo.getcEnterpriseId());
-        if("pass".equals(supplierApprovalSecond.getApprovalConclusion())){
-            //一键测算
-            SupplierApprovalSecond measurement = measurement(supplierApprovalSecond);
-            supplierInfo.setSupplierErrors(measurement.getSupplierErrors());
-        }
         //保存第二次审核信息
-        save(supplierApprovalSecond);
+        saveOrUpdate(supplierApprovalSecond);
         //保存文件
         List<Long> files = supplierApprovalSecond.getFiles();
+        AttachmentDto attachmentDto = AttachmentDto.builder()
+                .setEntityId(supplierApprovalSecond.getId())
+                .setChildEnum(FileModuleDict.ChildEnum.SUPPLIER_APPROVAL_MOVABLE_PROPERTY_FINANCING_FILE)
+                .build();
+        attachmentRefService.removeRef(attachmentDto);
         if (CollectionUtil.isNotEmpty(files)) {
-            AttachmentDto attachmentDto = AttachmentDto.builder()
-                    .setEntityId(supplierApprovalSecond.getId())
-                    .setChildEnum(FileModuleDict.ChildEnum.SUPPLIER_APPROVAL_MOVABLE_PROPERTY_FINANCING_FILE)
-                    .build();
             attachmentRefService.saveRef(files, attachmentDto);
         }
         //保存上游采购单据
+        upstreamProcurementDocumentsService.lambdaUpdate().eq(UpstreamProcurementDocuments::getSupplierApprovalSecondId,supplierApprovalSecond.getId()).remove();
         List<UpstreamProcurementDocuments> upstreamProcurementDocumentsList = supplierApprovalSecond.getUpstreamProcurementDocumentsList();
         if (CollectionUtil.isNotEmpty(upstreamProcurementDocumentsList)) {
             for (UpstreamProcurementDocuments upstreamProcurementDocuments : upstreamProcurementDocumentsList) {
@@ -271,6 +288,7 @@ public class SupplierApprovalSecondServiceImpl extends ServiceImpl<SupplierAppro
             }
         }
         //保存下游销售单据
+        salesDocumentsInfoService.lambdaUpdate().eq(SalesDocumentsInfo::getSupplierApprovalSecondId,supplierApprovalSecond.getId()).remove();
         List<SalesDocumentsInfo> salesDocumentsInfoList = supplierApprovalSecond.getSalesDocumentsInfoList();
         if (CollectionUtil.isNotEmpty(salesDocumentsInfoList)) {
             for (SalesDocumentsInfo salesDocumentsInfo : salesDocumentsInfoList) {
@@ -278,63 +296,72 @@ public class SupplierApprovalSecondServiceImpl extends ServiceImpl<SupplierAppro
                 salesDocumentsInfoService.save(salesDocumentsInfo);
             }
         }
-        //完成流程
-        String result;
-        String approvalConclusion = supplierApprovalSecond.getApprovalConclusion();
-        if (approvalConclusion.equals(ConstantConversionUtil.APPROVAL_RESULT_PASS)) {
-            BigDecimal score = supplierApprovalSecond.getScore();
-            BigDecimal creditLimit = supplierApprovalSecond.getCreditLimit();
-            if (score.compareTo(new BigDecimal("90")) > -1 && creditLimit.compareTo(new BigDecimal(10000000)) < 1) {
-                result = "授信成功";
-                supplierInfo.setStatusStr(SupplierStatusEnums.CREDIT_SUCCESS.getCode());
+        if(supplierApprovalSecond.getVisible()){
+            if("pass".equals(supplierApprovalSecond.getApprovalConclusion())){
+                //一键测算
+                SupplierApprovalSecond measurement = measurement(supplierApprovalSecond);
+                supplierInfo.setSupplierErrors(measurement.getSupplierErrors());
+                //保存第二次审核信息
+                saveOrUpdate(supplierApprovalSecond);
+            }
+            //完成流程
+            String result;
+            String approvalConclusion = supplierApprovalSecond.getApprovalConclusion();
+            if (approvalConclusion.equals(ConstantConversionUtil.APPROVAL_RESULT_PASS)) {
+                BigDecimal score = supplierApprovalSecond.getScore();
+                BigDecimal creditLimit = supplierApprovalSecond.getCreditLimit();
+                if (score.compareTo(new BigDecimal("90")) > -1 && creditLimit.compareTo(new BigDecimal(10000000)) < 1) {
+                    result = "授信成功";
+                    supplierInfo.setStatusStr(SupplierStatusEnums.CREDIT_SUCCESS.getCode());
+                } else {
+                    supplierInfo.setStatusStr(SupplierStatusEnums.DUE_DILIGENCE_APPOINTMENT.getCode());
+                    result = "待视频尽调";
+                }
+            } else if (approvalConclusion.equals(ConstantConversionUtil.APPROVAL_RESULT_BACK)) {
+                result = "退回";
+                supplierInfo.setStatusStr(SupplierStatusEnums.ADD_INFO.getCode());
             } else {
-                supplierInfo.setStatusStr(SupplierStatusEnums.DUE_DILIGENCE_APPOINTMENT.getCode());
-                result = "待视频尽调";
+                throw new ValidatorException(CodeUtil.FAIL, "审核结论错误!");
             }
-        } else if (approvalConclusion.equals(ConstantConversionUtil.APPROVAL_RESULT_BACK)) {
-            result = "退回";
-            supplierInfo.setStatusStr(SupplierStatusEnums.ADD_INFO.getCode());
-        } else {
-            throw new ValidatorException(CodeUtil.FAIL, "审核结论错误!");
-        }
-        supplierInfo.setScore(supplierApprovalSecond.getScore());
-        supplierInfo.setAdmitted(supplierApprovalSecond.getAdmitted());
-        supplierInfo.setCreditLimit(supplierApprovalSecond.getCreditLimit());
-        supplierInfo.setRevenueRating(supplierApprovalSecond.getRevenueRating());
-        supplierInfoService.updateById(supplierInfo);
-        Map<String, Object> procVariables = new HashMap<>();
-        procVariables.put("result", result);
-        Map<String, Object> msgVariables = new HashMap<>();
-        msgVariables.put(ConstantUtil.FLOWABLE_MSG_TITLE, "供应商名称:" + enterprise.getCorporateName());
-        if (result.equals("授信成功")) {
-            msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
-                    "供应商名称为“" + enterprise.getCorporateName() + "”的供应商审核已授信成功");
-        } else if (result.equals("退回")) {
-            msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
-                    "供应商名称为“" + enterprise.getCorporateName() + "”的供应商已退回进入“"
-                            + ConstantConversionUtil.flowBusinessKeyNames.get(ConstantUtil.SUPPLIER_INFO) + "—供应商C端录入,"
-                            + ConstantUtil.FLOWABLE_MSG_ASSIGNEE);
-        } else if (result.equals("待视频尽调")) {
-            msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
-                    "供应商名称为“" + enterprise.getCorporateName() + "”的供应商已进入“"
-                            + ConstantConversionUtil.flowBusinessKeyNames.get(ConstantUtil.SUPPLIER_INFO) + "—供应商审核视频尽调预约,"
-                            + ConstantUtil.FLOWABLE_MSG_ASSIGNEE);
-        } else {
-            throw new ValidatorException(CodeUtil.FAIL, "审核结论错误!");
-        }
-        flowableService.completeMyTask(taskId, supplierInfo, procVariables, null, supplierApprovalSecond.getId(), msgVariables, ConstantUtil.SUPPLIER_INFO);
-
-        if("pass".equals(supplierApprovalSecond.getApprovalConclusion())){
-            //判断是否开启授信决议
-            List<ProjectInformation> projectInformations = projectInformationService.lambdaQuery().eq(ProjectInformation::getcSupplierInfoId, supplierInfo.getId()).list();
-            if (CollectionUtil.isNotEmpty(projectInformations)) {
-                for (ProjectInformation projectInformation : projectInformations) {
-                    if (projectInformation.getStatusStr().equals(ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode())) {
-                        ProjectCoreEnterprise projectCoreEnterprise = projectCoreEnterpriseService.lambdaQuery().eq(ProjectCoreEnterprise::getcProjectInformationId, projectInformation.getId()).one();
-                        if (projectCoreEnterprise.getStatusStr().equals(ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode())) {
-                            if (supplierInfo.getStatusStr().equals(SupplierStatusEnums.CREDIT_SUCCESS.getCode())) {
-                                //开启流程
-                                creditResolutionService.startProcess(projectInformation.getId());
+            supplierInfo.setScore(supplierApprovalSecond.getScore());
+            supplierInfo.setAdmitted(supplierApprovalSecond.getAdmitted());
+            supplierInfo.setCreditLimit(supplierApprovalSecond.getCreditLimit());
+            supplierInfo.setRevenueRating(supplierApprovalSecond.getRevenueRating());
+            supplierInfoService.updateById(supplierInfo);
+            Map<String, Object> procVariables = new HashMap<>();
+            procVariables.put("result", result);
+            Map<String, Object> msgVariables = new HashMap<>();
+            msgVariables.put(ConstantUtil.FLOWABLE_MSG_TITLE, "供应商名称:" + enterprise.getCorporateName());
+            if (result.equals("授信成功")) {
+                msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
+                        "供应商名称为“" + enterprise.getCorporateName() + "”的供应商审核已授信成功");
+            } else if (result.equals("退回")) {
+                msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
+                        "供应商名称为“" + enterprise.getCorporateName() + "”的供应商已退回进入“"
+                                + ConstantConversionUtil.flowBusinessKeyNames.get(ConstantUtil.SUPPLIER_INFO) + "—供应商C端录入,"
+                                + ConstantUtil.FLOWABLE_MSG_ASSIGNEE);
+            } else if (result.equals("待视频尽调")) {
+                msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
+                        "供应商名称为“" + enterprise.getCorporateName() + "”的供应商已进入“"
+                                + ConstantConversionUtil.flowBusinessKeyNames.get(ConstantUtil.SUPPLIER_INFO) + "—供应商审核视频尽调预约,"
+                                + ConstantUtil.FLOWABLE_MSG_ASSIGNEE);
+            } else {
+                throw new ValidatorException(CodeUtil.FAIL, "审核结论错误!");
+            }
+            flowableService.completeMyTask(taskId, supplierInfo, procVariables, null, supplierApprovalSecond.getId(), msgVariables, ConstantUtil.SUPPLIER_INFO);
+
+            if("pass".equals(supplierApprovalSecond.getApprovalConclusion())){
+                //判断是否开启授信决议
+                List<ProjectInformation> projectInformations = projectInformationService.lambdaQuery().eq(ProjectInformation::getcSupplierInfoId, supplierInfo.getId()).list();
+                if (CollectionUtil.isNotEmpty(projectInformations)) {
+                    for (ProjectInformation projectInformation : projectInformations) {
+                        if (projectInformation.getStatusStr().equals(ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode())) {
+                            ProjectCoreEnterprise projectCoreEnterprise = projectCoreEnterpriseService.lambdaQuery().eq(ProjectCoreEnterprise::getcProjectInformationId, projectInformation.getId()).one();
+                            if (projectCoreEnterprise.getStatusStr().equals(ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode())) {
+                                if (supplierInfo.getStatusStr().equals(SupplierStatusEnums.CREDIT_SUCCESS.getCode())) {
+                                    //开启流程
+                                    creditResolutionService.startProcess(projectInformation.getId());
+                                }
                             }
                         }
                     }

+ 351 - 185
src/main/java/com/sunxung/factoring/service/supplier/impl/VideoDueDiligenceServiceImpl.java

@@ -176,56 +176,9 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
 
     @Override
     public VideoDueDiligence getVideoDueDiligence(Long supplierId) {
-        VideoDueDiligence videoDueDiligence = lambdaQuery().eq(VideoDueDiligence::getcSupplierInfoId, supplierId).one();
-        if (videoDueDiligence == null) {
-            videoDueDiligence = new VideoDueDiligence();
-            videoDueDiligence.setcSupplierInfoId(supplierId);
-        }
+        SupplierApprovalSecond supplierApprovalSecond = supplierApprovalSecondService.lambdaQuery().eq(SupplierApprovalSecond::getcSupplierInfoId, supplierId).orderByDesc(SupplierApprovalSecond::getGmtCreate).list().get(0);
         SupplierInfo supplierInfo = supplierInfoService.get(supplierId);
         Enterprise enterprise = enterpriseService.getById(supplierInfo.getcEnterpriseId());
-        if (supplierInfo.getGuaranteeEnterpriseId() != null) {
-            enterprise = enterpriseService.getById(supplierInfo.getGuaranteeEnterpriseId());
-        }
-        videoDueDiligence.setEnterpriseName(enterprise.getCorporateName());
-        videoDueDiligence.setSocialCreditCode(enterprise.getSocialCreditCode());
-        // 股东信息 工商登记
-        String pubStockUrl = pubStock + "?socialCreditCode=" + enterprise.getSocialCreditCode() + "&comprehensiveRiskInvestigationId=" + enterprise.getcComprehensiveRiskInvestigationId();
-        ResponseJson forObject = restTemplate.getForObject(pubStockUrl, ResponseJson.class);
-        JSONObject jsonObject = new JSONObject(forObject.getData());
-        List<CRegStock> list = jsonObject.getBeanList("list", CRegStock.class);
-        videoDueDiligence.setRegStocks(list);
-        videoDueDiligence.setLegalRepresentative(enterprise.getLegalRepresentative());
-        CreditInvestigationInfo creditInvestigationInfo = creditInvestigationInfoService.lambdaQuery()
-                .eq(CreditInvestigationInfo::getcEnterpriseId, enterprise.getId())
-                .eq(CreditInvestigationInfo::getName, enterprise.getLegalRepresentative())
-                .eq(CreditInvestigationInfo::getType, "c_credit_investigation_info_type_1").one();
-        int bornYear = Integer.valueOf(creditInvestigationInfo.getSocialCreditCode().substring(6, 10));
-        int bornMon = Integer.valueOf(creditInvestigationInfo.getSocialCreditCode().substring(10, 12));
-        int bornDay = Integer.valueOf(creditInvestigationInfo.getSocialCreditCode().substring(12, 14));
-        Date date = new Date(bornYear-1900, bornMon, bornDay);
-        int age = cn.hutool.core.date.DateUtil.age(date,new Date());
-        videoDueDiligence.setAge(age);
-        SupplierApprovalSecond supplierApprovalSecond = supplierApprovalSecondService.lambdaQuery().eq(SupplierApprovalSecond::getcSupplierInfoId, supplierId).orderByDesc(SupplierApprovalSecond::getGmtCreate).list().get(0);
-        videoDueDiligence.setShareholderStandardScore(BigDecimal.ONE);
-        videoDueDiligence.setShareholderMeasurementScore(supplierApprovalSecond.getShareholderScore());
-        videoDueDiligence.setShareholderQuestion("法人是否为代持?股东是否为亲属?公司实控人是?");
-        videoDueDiligence.setStartDate(enterprise.getStartSate());
-        long year = DateUtil.betweenYear(enterprise.getStartSate(), new Date(), false);
-        videoDueDiligence.setEstablishmentPeriod(year);
-        videoDueDiligence.setLifeStandardScore(new BigDecimal("1.5"));
-        videoDueDiligence.setLifeMeasurementScore(supplierApprovalSecond.getEstablishmentPeriodScore());
-        videoDueDiligence.setLifeQuestion("实际从事该行业的年份?是否存在其他抬头公司进行业务经营?");
-        videoDueDiligence.setRegisteredCapital(enterprise.getRegisteredCapital());
-        videoDueDiligence.setCapitalStandardScore(new BigDecimal("1.5"));
-        videoDueDiligence.setCapitalMeasurementScore(supplierApprovalSecond.getRegisteredCapitalScore());
-        videoDueDiligence.setCapitalQuestion("公司实际运营资金多少?投入资金多少?");
-        videoDueDiligence.setAddress(enterprise.getAddress());
-        videoDueDiligence.setAddressStandardScore(new BigDecimal("1"));
-        videoDueDiligence.setAddressMeasurementScore(supplierApprovalSecond.getRegisteredAddressScore());
-        videoDueDiligence.setAddressQuestion("注册地址与实际经营地址是否不一致?");
-        videoDueDiligence.setBusinessAddress(enterprise.getBusinessAddress());
-        videoDueDiligence.setBusinessAddressQuestion("是否存在该项资料?是否可以补充上传?");
-        //查询文件
         CSupplierInfoHistory supplierInfoHistory = supplierInfoHistoryService.getById(supplierApprovalSecond.getcSupplierInfoHistoryId());
         CEnterpriseHistory enterpriseHistory;
         if (supplierInfoHistory.getGuaranteeEnterpriseHistoryId() != null) {
@@ -233,47 +186,116 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
         } else {
             enterpriseHistory = enterpriseHistoryService.getById(supplierInfoHistory.getcEnterpriseHistoryId());
         }
-        List<FileStorageDO> rentalFiles = fileService.findByBusinessId(enterpriseHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_RENTAL_CONTRACT_HISTORY.getCode());
-        List<FileStorageDO> waterFiles = fileService.findByBusinessId(enterpriseHistory.getId(), FileModuleDict.ChildEnum.WATER_ELECTRIICITY_FEES_HISTORY.getCode());
-        List<FileStorageDO> officeFiles = fileService.findByBusinessId(enterpriseHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_OFFICE_ENVIRONMENT_HISTORY.getCode());
-        videoDueDiligence.setRentalFiles(rentalFiles);
-        videoDueDiligence.setWaterFiles(waterFiles);
-        videoDueDiligence.setOfficeFiles(officeFiles);
-        videoDueDiligence.setBusinessAddressStandardScore(new BigDecimal("3"));
-        videoDueDiligence.setBusinessAddressMeasurementScore(supplierApprovalSecond.getBusinessAddressScore());
-        //所属行业
-        String getIndustryUrl = getIndustry + "?comprehensiveRiskInvestigationId=" + enterprise.getcComprehensiveRiskInvestigationId();
-        String industry = restTemplate.getForObject(getIndustryUrl, String.class);
-        videoDueDiligence.setIndustry(industry);
-        //经营范围
-        videoDueDiligence.setBusinessScope(supplierApprovalSecond.getScope());
-        videoDueDiligence.setBusinessScopeStandardScore(new BigDecimal("1"));
-        videoDueDiligence.setBusinessScopeMeasurementScore(supplierApprovalSecond.getBusinessScopeScore());
-        //近一年股东或法人变更*次
-        String getChangesUrl = getChanges + "?comprehensiveRiskInvestigationId=" + enterprise.getcComprehensiveRiskInvestigationId();
-        Integer changes = restTemplate.getForObject(getChangesUrl, Integer.class);
-        videoDueDiligence.setBasicChangeSize(changes);
-        videoDueDiligence.setChangeStandardScore(new BigDecimal("1"));
-        videoDueDiligence.setChangeMeasurementScore(supplierApprovalSecond.getBasicChangeScore());
-        //关联企业
-        List<CAssociatedEnterpriseInfoHistory> enterpriseInfoHistoryList = associatedEnterpriseInfoHistoryService.lambdaQuery().eq(CAssociatedEnterpriseInfoHistory::getcEnterpriseHistoryId, enterpriseHistory.getId()).list();
-        videoDueDiligence.setEnterpriseInfoHistoryList(enterpriseInfoHistoryList);
-        videoDueDiligence.setAssociatedEnterpriseQuestion("是否还有其他业务关联公司?关联公司业务分别是?");
-        //人员信息
-        List<CreditSituation> creditSituations = creditSituationService.lambdaQuery().eq(CreditSituation::getcSupplierInfoId, supplierId).list();
-        creditSituations = creditSituations.stream().filter(r -> {
-            CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(r.getcCreditInvestigationInfoHistoryId());
-            CEnterpriseHistory byId = enterpriseHistoryService.getById(creditInvestigationInfoHistory.getcEnterpriseHistoryId());
-            CEnterpriseHistory serviceById = enterpriseHistoryService.getById(supplierApprovalSecond.getcEnterpriseHistoryId());
-            return byId.getCorporateName().equals(serviceById.getCorporateName());
-        }).collect(Collectors.toList());
-        for (CreditSituation creditSituation : creditSituations) {
-            CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(creditSituation.getcCreditInvestigationInfoHistoryId());
-            String name = dictionaryService.getByCode(creditInvestigationInfoHistory.getType()).getName();
-            creditInvestigationInfoHistory.setTypeStr(name);
+        if (supplierInfo.getGuaranteeEnterpriseId() != null) {
+            enterprise = enterpriseService.getById(supplierInfo.getGuaranteeEnterpriseId());
+        }
+        VideoDueDiligence videoDueDiligence = lambdaQuery().eq(VideoDueDiligence::getcSupplierInfoId, supplierId).one();
+        if (videoDueDiligence == null) {
+            videoDueDiligence = new VideoDueDiligence();
+            videoDueDiligence.setcSupplierInfoId(supplierId);
+            videoDueDiligence.setShareholderQuestion("法人是否为代持?股东是否为亲属?公司实控人是?");
+            videoDueDiligence.setLifeQuestion("实际从事该行业的年份?是否存在其他抬头公司进行业务经营?");
+            videoDueDiligence.setCapitalQuestion("公司实际运营资金多少?投入资金多少?");
+            videoDueDiligence.setAddressQuestion("注册地址与实际经营地址是否不一致?");
+            videoDueDiligence.setAssociatedEnterpriseQuestion("是否还有其他业务关联公司?关联公司业务分别是?");
+            videoDueDiligence.setNegativeInformationQuestion(" 历史失信被执行情况详情?判决书;历史被执行情况详情?判决书;限制高消费情况详情;行政处罚情况说明;涉诉情况说明");
+            videoDueDiligence.setBusinessAddressQuestion("是否存在该项资料?是否可以补充上传?");
+            videoDueDiligence.setEnterpriseName(enterprise.getCorporateName());
+            videoDueDiligence.setSocialCreditCode(enterprise.getSocialCreditCode());
+            videoDueDiligence.setLegalRepresentative(enterprise.getLegalRepresentative());
+            CreditInvestigationInfo creditInvestigationInfo = creditInvestigationInfoService.lambdaQuery()
+                    .eq(CreditInvestigationInfo::getcEnterpriseId, enterprise.getId())
+                    .eq(CreditInvestigationInfo::getName, enterprise.getLegalRepresentative())
+                    .eq(CreditInvestigationInfo::getType, "c_credit_investigation_info_type_1").one();
+            int bornYear = Integer.valueOf(creditInvestigationInfo.getSocialCreditCode().substring(6, 10));
+            int bornMon = Integer.valueOf(creditInvestigationInfo.getSocialCreditCode().substring(10, 12));
+            int bornDay = Integer.valueOf(creditInvestigationInfo.getSocialCreditCode().substring(12, 14));
+            Date date = new Date(bornYear-1900, bornMon, bornDay);
+            int age = cn.hutool.core.date.DateUtil.age(date,new Date());
+            videoDueDiligence.setAge(age);
+            videoDueDiligence.setShareholderStandardScore(BigDecimal.ONE);
+            videoDueDiligence.setShareholderMeasurementScore(supplierApprovalSecond.getShareholderScore());
+            videoDueDiligence.setStartDate(enterprise.getStartSate());
+            long year = DateUtil.betweenYear(enterprise.getStartSate(), new Date(), false);
+            videoDueDiligence.setEstablishmentPeriod(year);
+            videoDueDiligence.setLifeStandardScore(new BigDecimal("1.5"));
+            videoDueDiligence.setLifeMeasurementScore(supplierApprovalSecond.getEstablishmentPeriodScore());
+            videoDueDiligence.setRegisteredCapital(enterprise.getRegisteredCapital());
+            videoDueDiligence.setCapitalStandardScore(new BigDecimal("1.5"));
+            videoDueDiligence.setCapitalMeasurementScore(supplierApprovalSecond.getRegisteredCapitalScore());
+            videoDueDiligence.setAddress(enterprise.getAddress());
+            videoDueDiligence.setAddressStandardScore(new BigDecimal("1"));
+            videoDueDiligence.setAddressMeasurementScore(supplierApprovalSecond.getRegisteredAddressScore());
+            videoDueDiligence.setBusinessAddress(enterprise.getBusinessAddress());
+            videoDueDiligence.setBusinessAddressStandardScore(new BigDecimal("3"));
+            videoDueDiligence.setBusinessAddressMeasurementScore(supplierApprovalSecond.getBusinessAddressScore());
+            //所属行业
+            String getIndustryUrl = getIndustry + "?comprehensiveRiskInvestigationId=" + enterprise.getcComprehensiveRiskInvestigationId();
+            String industry = restTemplate.getForObject(getIndustryUrl, String.class);
+            videoDueDiligence.setIndustry(industry);
+            //经营范围
+            videoDueDiligence.setBusinessScope(supplierApprovalSecond.getScope());
+            videoDueDiligence.setBusinessScopeStandardScore(new BigDecimal("1"));
+            videoDueDiligence.setBusinessScopeMeasurementScore(supplierApprovalSecond.getBusinessScopeScore());
+            //近一年股东或法人变更*次
+            String getChangesUrl = getChanges + "?comprehensiveRiskInvestigationId=" + enterprise.getcComprehensiveRiskInvestigationId();
+            Integer changes = restTemplate.getForObject(getChangesUrl, Integer.class);
+            videoDueDiligence.setBasicChangeSize(changes);
+            videoDueDiligence.setChangeStandardScore(new BigDecimal("1"));
+            videoDueDiligence.setChangeMeasurementScore(supplierApprovalSecond.getBasicChangeScore());
+            //关联企业
+            List<CAssociatedEnterpriseInfoHistory> enterpriseInfoHistoryList = associatedEnterpriseInfoHistoryService.lambdaQuery().eq(CAssociatedEnterpriseInfoHistory::getcEnterpriseHistoryId, enterpriseHistory.getId()).list();
+            videoDueDiligence.setEnterpriseInfoHistoryList(enterpriseInfoHistoryList);
+            //人员信息
+            List<CreditSituation> creditSituations = creditSituationService.lambdaQuery().eq(CreditSituation::getcSupplierInfoId, supplierId).list();
+            creditSituations = creditSituations.stream().filter(r -> {
+                CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(r.getcCreditInvestigationInfoHistoryId());
+                CEnterpriseHistory byId = enterpriseHistoryService.getById(creditInvestigationInfoHistory.getcEnterpriseHistoryId());
+                CEnterpriseHistory serviceById = enterpriseHistoryService.getById(supplierApprovalSecond.getcEnterpriseHistoryId());
+                return byId.getCorporateName().equals(serviceById.getCorporateName());
+            }).collect(Collectors.toList());
+            for (CreditSituation creditSituation : creditSituations) {
+                CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(creditSituation.getcCreditInvestigationInfoHistoryId());
+                String name = dictionaryService.getByCode(creditInvestigationInfoHistory.getType()).getName();
+                creditInvestigationInfoHistory.setTypeStr(name);
+                //todo 填充征信报告
+                CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, creditInvestigationInfoHistory.getSocialCreditCode()).one();
+                List<FileStorage> fileList = new ArrayList<>();
+                if (creditInfo != null) {
+                    List<CreditDetail> creditDetails = creditDetailService.lambdaQuery()
+                            .eq(CreditDetail::getCreditId,creditInfo.getId())
+                            .isNotNull(CreditDetail::getCreditAddress)
+                            .orderByDesc(CreditDetail::getGmtCreate).list();
+                    if (CollectionUtil.isNotEmpty(creditDetails)) {
+                        CreditDetail creditDetail = creditDetails.get(0);
+                        if(StringUtil.isNotEmpty(creditDetail.getCreditAddress())){
+                            FileStorage creditDetailFiles = fileStorageService.get(Long.valueOf(creditDetail.getCreditAddress()));
+                            fileList.add(creditDetailFiles);
+                        }
+                    }
+                }
+                creditInvestigationInfoHistory.setCreditDetailFiles(fileList);
+                List<FileStorageDO> cardFiles = fileService.findByBusinessId(creditInvestigationInfoHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_IDCARD_FILES_HISTORY.getCode());
+                creditInvestigationInfoHistory.setCardFiles(cardFiles);
+                creditSituation.setQuestion("逾期详情?提供还款记录说明;逾期详情?提供还款记录说明;查询的原因是?小贷查询次数多少?查询后借到多少金额款项?什么性质的担保?为谁担保?历史失信被执行情况详情?判决书;历史被执行情况详情?判决书;限制高消费情况详情;详细解释诉讼案件以及提供判决书");
+                creditSituation.setCreditInvestigationInfoHistory(creditInvestigationInfoHistory);
+            }
+            videoDueDiligence.setCreditSituations(creditSituations);
+            //企业信誉
+            CorporateGoodwill corporateGoodwill = corporateGoodwillService.lambdaQuery()
+                    .eq(CorporateGoodwill::getcSupplierInfoId, supplierId).eq(CorporateGoodwill::getcEnterpriseId, enterprise.getId()).one();
+            corporateGoodwill.setShiXin(corporateGoodwill.getShiXin() == 0 ? 0 : 1);
+            corporateGoodwill.setHistoryShiXin(corporateGoodwill.getHistoryShiXin() == 0 ? 0 : 1);
+            corporateGoodwill.setZhiXing(corporateGoodwill.getZhiXing() == 0 ? 0 : 1);
+            corporateGoodwill.setHistoryZhiXing(corporateGoodwill.getHistoryZhiXing() == 0 ? 0 : 1);
+            corporateGoodwill.setGaoXiao(corporateGoodwill.getGaoXiao() == 0 ? 0 : 1);
+            corporateGoodwill.setHistoryGaoXiao(corporateGoodwill.getHistoryGaoXiao() == 0 ? 0 : 1);
+            corporateGoodwill.setDocumnetBeiGao(corporateGoodwill.getDocumnetBeiGao() == 0 ? 0 : 1);
+            corporateGoodwill.setDocumnetYuanGao(corporateGoodwill.getDocumnetYuanGao() == 0 ? 0 : 1);
+            corporateGoodwill.setDocumentFinance(corporateGoodwill.getDocumentFinance() == 0 ? 0 : 1);
             //todo 填充征信报告
-            CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, creditInvestigationInfoHistory.getSocialCreditCode()).one();
             List<FileStorage> fileList = new ArrayList<>();
+            CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, enterprise.getSocialCreditCode()).one();
             if (creditInfo != null) {
                 List<CreditDetail> creditDetails = creditDetailService.lambdaQuery()
                         .eq(CreditDetail::getCreditId,creditInfo.getId())
@@ -287,45 +309,173 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
                     }
                 }
             }
-            creditInvestigationInfoHistory.setCreditDetailFiles(fileList);
-            List<FileStorageDO> cardFiles = fileService.findByBusinessId(creditInvestigationInfoHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_IDCARD_FILES_HISTORY.getCode());
-            creditInvestigationInfoHistory.setCardFiles(cardFiles);
-            creditSituation.setQuestion("逾期详情?提供还款记录说明;逾期详情?提供还款记录说明;查询的原因是?小贷查询次数多少?查询后借到多少金额款项?什么性质的担保?为谁担保?历史失信被执行情况详情?判决书;历史被执行情况详情?判决书;限制高消费情况详情;详细解释诉讼案件以及提供判决书");
-            creditSituation.setCreditInvestigationInfoHistory(creditInvestigationInfoHistory);
-        }
-        videoDueDiligence.setCreditSituations(creditSituations);
-        //企业信誉
-        CorporateGoodwill corporateGoodwill = corporateGoodwillService.lambdaQuery()
-                .eq(CorporateGoodwill::getcSupplierInfoId, supplierId).eq(CorporateGoodwill::getcEnterpriseId, enterprise.getId()).one();
-        corporateGoodwill.setShiXin(corporateGoodwill.getShiXin() == 0 ? 0 : 1);
-        corporateGoodwill.setHistoryShiXin(corporateGoodwill.getHistoryShiXin() == 0 ? 0 : 1);
-        corporateGoodwill.setZhiXing(corporateGoodwill.getZhiXing() == 0 ? 0 : 1);
-        corporateGoodwill.setHistoryZhiXing(corporateGoodwill.getHistoryZhiXing() == 0 ? 0 : 1);
-        corporateGoodwill.setGaoXiao(corporateGoodwill.getGaoXiao() == 0 ? 0 : 1);
-        corporateGoodwill.setHistoryGaoXiao(corporateGoodwill.getHistoryGaoXiao() == 0 ? 0 : 1);
-        corporateGoodwill.setDocumnetBeiGao(corporateGoodwill.getDocumnetBeiGao() == 0 ? 0 : 1);
-        corporateGoodwill.setDocumnetYuanGao(corporateGoodwill.getDocumnetYuanGao() == 0 ? 0 : 1);
-        corporateGoodwill.setDocumentFinance(corporateGoodwill.getDocumentFinance() == 0 ? 0 : 1);
-        //todo 填充征信报告
-        List<FileStorage> fileList = new ArrayList<>();
-        CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, enterprise.getSocialCreditCode()).one();
-        if (creditInfo != null) {
-            List<CreditDetail> creditDetails = creditDetailService.lambdaQuery()
-                    .eq(CreditDetail::getCreditId,creditInfo.getId())
-                    .isNotNull(CreditDetail::getCreditAddress)
-                    .orderByDesc(CreditDetail::getGmtCreate).list();
-            if (CollectionUtil.isNotEmpty(creditDetails)) {
-                CreditDetail creditDetail = creditDetails.get(0);
-                if(StringUtil.isNotEmpty(creditDetail.getCreditAddress())){
-                    FileStorage creditDetailFiles = fileStorageService.get(Long.valueOf(creditDetail.getCreditAddress()));
-                    fileList.add(creditDetailFiles);
+            corporateGoodwill.setCreditDetailFiles(fileList);
+            corporateGoodwill.setQuestion("有无其他融资渠道?融资缺口有多少?");
+            videoDueDiligence.setCorporateGoodwill(corporateGoodwill);
+            //企业财务
+            VideoDueDiligenceFinance videoDueDiligenceFinance = new VideoDueDiligenceFinance();
+            videoDueDiligenceFinance.setQuestion("是否有企业内账?企业真实年营业收入有多少?业务收入占比情况如何?毛利率约多少?对客户是如何筛选?");
+            videoDueDiligence.setVideoDueDiligenceFinance(videoDueDiligenceFinance);
+            //企业经营情况
+            VideoDueDiligenceOperations videoDueDiligenceOperations = new VideoDueDiligenceOperations();
+            videoDueDiligenceOperations.setQuestion("主营业务是?有无其他业务?合作的客户或者项目有哪些?年供应量大概多少?参与过项目有哪些?合作过的下游国企有哪些?有没有长期合作企业?本年度的项目有哪些?主要销售市场是?其他地区有没有业务如何入行?关系经验有哪些?有没有计划拓展的新领域?销售计划是什么?预计本年度营收收入、销售量多少?\n" +
+                    "1.上游情况一般是从钢厂采购?供应商有没有区别?是钢厂的代理?上游合作商有哪些?如何选用供应商?还会采购其他货物吗?\n" + "2.下游情况招投标、签合同、下订单、送货、验收、对账、开票、付款流程介绍项目都有招标吗?与国企的往期合作情况 实际账期大概多久?付款方式是?");
+            videoDueDiligence.setVideoDueDiligenceOperations(videoDueDiligenceOperations);
+        }else {
+            List<FileStorage> addressFile = getFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_ADDRESS_FILE);
+            videoDueDiligence.setAddressFile(addressFile);
+            List<FileStorage> associatedEnterpriseFile = getFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_ASSOCIATED_ENTERPRISE_FILE);
+            videoDueDiligence.setAssociatedEnterpriseFile(associatedEnterpriseFile);
+            List<FileStorage> businessAddressFile = getFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_BUSINESS_ADDRESS_FILE);
+            videoDueDiligence.setBusinessAddressFile(businessAddressFile);
+            List<FileStorage> businessScopeFile = getFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_BUSINESS_SCOPE_FILE);
+            videoDueDiligence.setBusinessScopeFile(businessScopeFile);
+            List<FileStorage> capitalFiles = getFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_CAPITAL_FILE);
+            videoDueDiligence.setCapitalFile(capitalFiles);
+            List<FileStorage> changeFiles = getFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_CHANGE_FILE);
+            videoDueDiligence.setChangeFile(changeFiles);
+            List<FileStorage> industryFiles = getFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_INDUSTRY_FILE);
+            videoDueDiligence.setIndustryFile(industryFiles);
+            List<FileStorage> lifeFiles = getFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_LIFE_FILE);
+            videoDueDiligence.setLifeFile(lifeFiles);
+            List<FileStorage> negativeInformationFile = getFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_NEGATIVE_INFORMATION_FILE);
+            videoDueDiligence.setNegativeInformationFile(negativeInformationFile);
+            List<FileStorage> shareholderFiles = getFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_SHAREHOLDER_FILE);
+            videoDueDiligence.setShareholderFile(shareholderFiles);
+            //视频尽调企业人员
+            List<CreditSituation> creditSituations =  creditSituationService.lambdaQuery().eq(CreditSituation::getcSupplierInfoId, supplierId).list();
+            List<VideoDueDiligenceShareholdersSituation> videoDueDiligenceShareholdersSituations = videoDueDiligenceShareholdersSituationService.lambdaQuery().eq(VideoDueDiligenceShareholdersSituation::getVideoDueDiligenceId, videoDueDiligence.getId()).list();
+            for (CreditSituation creditSituation : creditSituations) {
+                for (VideoDueDiligenceShareholdersSituation videoDueDiligenceShareholdersSituation : videoDueDiligenceShareholdersSituations) {
+                    if (creditSituation.getcCreditInvestigationInfoHistoryId() == videoDueDiligenceShareholdersSituation.getcCreditInvestigationInfoHistoryId()) {
+                        creditSituation.setOverdueAccounts(videoDueDiligenceShareholdersSituation.getOverdueAccounts());
+                        creditSituation.setTotalOverdueAmountFix(videoDueDiligenceShareholdersSituation.getTotalOverdueAmountFix());
+                        creditSituation.setOver90DaysOverdue(videoDueDiligenceShareholdersSituation.getOver90DaysOverdue());
+                        creditSituation.setOverdueMonths(videoDueDiligenceShareholdersSituation.getOverdueMonths());
+                        creditSituation.setNumberOfOverdueRepayments(videoDueDiligenceShareholdersSituation.getNumberOfOverdueRepayments());
+                        creditSituation.setNumberOfLoanInquiries(videoDueDiligenceShareholdersSituation.getNumberOfLoanInquiries());
+                        creditSituation.setRepaymentGuaranteeAmount(videoDueDiligenceShareholdersSituation.getRepaymentGuaranteeAmount());
+                        creditSituation.setBadRecordsFix(videoDueDiligenceShareholdersSituation.getBadRecordsFix());
+                        creditSituation.setRecordOfDishonestyExecutionFix(videoDueDiligenceShareholdersSituation.getRecordOfDishonestyExecutionFix());
+                        creditSituation.setExecutedRecordFix(videoDueDiligenceShareholdersSituation.getExecutedRecordFix());
+                        creditSituation.setStCountFix(videoDueDiligenceShareholdersSituation.getStCountFix());
+                        creditSituation.setQuestion(videoDueDiligenceShareholdersSituation.getQuestion());
+                        creditSituation.setFeedback(videoDueDiligenceShareholdersSituation.getFeedback());
+                        List<FileStorage> files = getFiles(videoDueDiligenceShareholdersSituation.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_SHAREHOLDER_SITUATION_FILE);
+                        creditSituation.setFiles(files);
+
+                        CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(creditSituation.getcCreditInvestigationInfoHistoryId());
+                        String name = dictionaryService.getByCode(creditInvestigationInfoHistory.getType()).getName();
+                        creditInvestigationInfoHistory.setTypeStr(name);
+                        //todo 填充征信报告
+                        CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, creditInvestigationInfoHistory.getSocialCreditCode()).one();
+                        List<FileStorage> fileList = new ArrayList<>();
+                        if (creditInfo != null) {
+                            List<CreditDetail> creditDetails = creditDetailService.lambdaQuery()
+                                    .eq(CreditDetail::getCreditId,creditInfo.getId())
+                                    .isNotNull(CreditDetail::getCreditAddress)
+                                    .orderByDesc(CreditDetail::getGmtCreate).list();
+                            if (CollectionUtil.isNotEmpty(creditDetails)) {
+                                CreditDetail creditDetail = creditDetails.get(0);
+                                if(StringUtil.isNotEmpty(creditDetail.getCreditAddress())){
+                                    FileStorage creditDetailFiles = fileStorageService.get(Long.valueOf(creditDetail.getCreditAddress()));
+                                    fileList.add(creditDetailFiles);
+                                }
+                            }
+                        }
+                        creditInvestigationInfoHistory.setCreditDetailFiles(fileList);
+                        List<FileStorageDO> cardFiles = fileService.findByBusinessId(creditInvestigationInfoHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_IDCARD_FILES_HISTORY.getCode());
+                        creditInvestigationInfoHistory.setCardFiles(cardFiles);
+                        creditSituation.setCreditInvestigationInfoHistory(creditInvestigationInfoHistory);
+                    }
+                }
+            }
+            videoDueDiligence.setCreditSituations(creditSituations);
+            videoDueDiligence.setVideoDueDiligenceShareholdersSituations(videoDueDiligenceShareholdersSituations);
+            //视频尽调企业信誉信息
+            VideoDueDiligenceCorporateGoodwill videoDueDiligenceCorporateGoodwill = videoDueDiligenceCorporateGoodwillService.lambdaQuery().eq(VideoDueDiligenceCorporateGoodwill::getVideoDueDiligenceId, videoDueDiligence.getId()).one();
+            //企业信誉
+            CorporateGoodwill corporateGoodwill = corporateGoodwillService.lambdaQuery()
+                    .eq(CorporateGoodwill::getcSupplierInfoId, supplierId).eq(CorporateGoodwill::getcEnterpriseId, enterprise.getId()).one();
+            corporateGoodwill.setShiXin(corporateGoodwill.getShiXin() == 0 ? 0 : 1);
+            corporateGoodwill.setHistoryShiXin(corporateGoodwill.getHistoryShiXin() == 0 ? 0 : 1);
+            corporateGoodwill.setZhiXing(corporateGoodwill.getZhiXing() == 0 ? 0 : 1);
+            corporateGoodwill.setHistoryZhiXing(corporateGoodwill.getHistoryZhiXing() == 0 ? 0 : 1);
+            corporateGoodwill.setGaoXiao(corporateGoodwill.getGaoXiao() == 0 ? 0 : 1);
+            corporateGoodwill.setHistoryGaoXiao(corporateGoodwill.getHistoryGaoXiao() == 0 ? 0 : 1);
+            corporateGoodwill.setDocumnetBeiGao(corporateGoodwill.getDocumnetBeiGao() == 0 ? 0 : 1);
+            corporateGoodwill.setDocumnetYuanGao(corporateGoodwill.getDocumnetYuanGao() == 0 ? 0 : 1);
+            corporateGoodwill.setDocumentFinance(corporateGoodwill.getDocumentFinance() == 0 ? 0 : 1);
+
+            corporateGoodwill.setVideoConcernedAccountsWithOutstandingCreditScore(videoDueDiligenceCorporateGoodwill.getConcernedAccountsWithOutstandingCreditScore());
+            corporateGoodwill.setVideoOutstandingBalanceScore(videoDueDiligenceCorporateGoodwill.getOutstandingBalanceScore());
+            corporateGoodwill.setVideoRecoveredBalance(videoDueDiligenceCorporateGoodwill.getRecoveredBalance());
+            corporateGoodwill.setVideoOutstandingNonPerformingAccounts(videoDueDiligenceCorporateGoodwill.getOutstandingNonPerformingAccounts());
+            corporateGoodwill.setVideoOutstandingNonPerformingAccountsScore(videoDueDiligenceCorporateGoodwill.getOutstandingNonPerformingAccountsScore());
+            corporateGoodwill.setVideoOutstandingShortTermLoanBalance(videoDueDiligenceCorporateGoodwill.getOutstandingShortTermLoanBalance());
+            corporateGoodwill.setVideoUnclearFollowUpAccounts(videoDueDiligenceCorporateGoodwill.getUnclearFollowUpAccounts());
+            corporateGoodwill.setVideoRecoveredBalanceScore(videoDueDiligenceCorporateGoodwill.getRecoveredBalanceScore());
+
+
+            //todo 填充征信报告
+            List<FileStorage> fileList = new ArrayList<>();
+            CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, enterprise.getSocialCreditCode()).one();
+            if (creditInfo != null) {
+                List<CreditDetail> creditDetails = creditDetailService.lambdaQuery()
+                        .eq(CreditDetail::getCreditId,creditInfo.getId())
+                        .isNotNull(CreditDetail::getCreditAddress)
+                        .orderByDesc(CreditDetail::getGmtCreate).list();
+                if (CollectionUtil.isNotEmpty(creditDetails)) {
+                    CreditDetail creditDetail = creditDetails.get(0);
+                    if(StringUtil.isNotEmpty(creditDetail.getCreditAddress())){
+                        FileStorage creditDetailFiles = fileStorageService.get(Long.valueOf(creditDetail.getCreditAddress()));
+                        fileList.add(creditDetailFiles);
+                    }
                 }
             }
+            corporateGoodwill.setCreditDetailFiles(fileList);
+            videoDueDiligenceCorporateGoodwill.setCreditDetailFiles(fileList);
+            corporateGoodwill.setQuestion(videoDueDiligenceCorporateGoodwill.getQuestion());
+            corporateGoodwill.setFeedback(videoDueDiligenceCorporateGoodwill.getFeedback());
+
+            List<FileStorage> files = getFiles(videoDueDiligenceCorporateGoodwill.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_CORPORATE_GOODWILL_FILE);
+            corporateGoodwill.setFiles(files);
+            videoDueDiligenceCorporateGoodwill.setFiles(files);
+
+            videoDueDiligence.setVideoDueDiligenceCorporateGoodwill(videoDueDiligenceCorporateGoodwill);
+            videoDueDiligence.setCorporateGoodwill(corporateGoodwill);
+            //企业经营与财务
+            VideoDueDiligenceFinance videoDueDiligenceFinance = videoDueDiligenceFinanceService.lambdaQuery().eq(VideoDueDiligenceFinance::getVideoDueDiligenceId, videoDueDiligence.getId()).one();
+            videoDueDiligence.setMainBusinessIncomeFix(videoDueDiligenceFinance.getMainBusinessIncomeFix());
+            videoDueDiligence.setMainBusinessCostFix(videoDueDiligenceFinance.getMainBusinessCostFix());
+            videoDueDiligence.setMainBusinessProfitFix(videoDueDiligenceFinance.getMainBusinessProfitFix());
+            List<FileStorage> fileStorageList = getFiles(videoDueDiligenceFinance.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_FINANCE_FILE);
+            videoDueDiligenceFinance.setFiles(fileStorageList);
+            videoDueDiligence.setVideoDueDiligenceFinance(videoDueDiligenceFinance);
+            //企业经营情况
+            VideoDueDiligenceOperations videoDueDiligenceOperations = videoDueDiligenceOperationsService.lambdaQuery().eq(VideoDueDiligenceOperations::getVideoDueDiligenceId, videoDueDiligence.getId()).one();
+            List<FileStorage> fileStorages = getFiles(videoDueDiligenceOperations.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_OPERATIONS_FILE);
+            videoDueDiligenceOperations.setFiles(fileStorages);
+            videoDueDiligence.setVideoDueDiligenceOperations(videoDueDiligenceOperations);
+            //综合评估
+            VideoDueDiligenceComprehensiveEvaluation videoDueDiligenceComprehensiveEvaluation = videoDueDiligenceComprehensiveEvaluationService.lambdaQuery().eq(VideoDueDiligenceComprehensiveEvaluation::getVideoDueDiligenceId, videoDueDiligence.getId()).one();
+            videoDueDiligence.setVideoDueDiligenceComprehensiveEvaluation(videoDueDiligenceComprehensiveEvaluation);
         }
-        corporateGoodwill.setCreditDetailFiles(fileList);
-        corporateGoodwill.setQuestion("有无其他融资渠道?融资缺口有多少?");
-        videoDueDiligence.setCorporateGoodwill(corporateGoodwill);
-        videoDueDiligence.setNegativeInformationQuestion(" 历史失信被执行情况详情?判决书;历史被执行情况详情?判决书;限制高消费情况详情;行政处罚情况说明;涉诉情况说明");
+        // 股东信息 工商登记
+        String pubStockUrl = pubStock + "?socialCreditCode=" + enterprise.getSocialCreditCode() + "&comprehensiveRiskInvestigationId=" + enterprise.getcComprehensiveRiskInvestigationId();
+        ResponseJson forObject = restTemplate.getForObject(pubStockUrl, ResponseJson.class);
+        JSONObject jsonObject = new JSONObject(forObject.getData());
+        List<CRegStock> list = jsonObject.getBeanList("list", CRegStock.class);
+        videoDueDiligence.setRegStocks(list);
+
+        //查询文件
+        List<FileStorageDO> rentalFiles = fileService.findByBusinessId(enterpriseHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_RENTAL_CONTRACT_HISTORY.getCode());
+        List<FileStorageDO> waterFiles = fileService.findByBusinessId(enterpriseHistory.getId(), FileModuleDict.ChildEnum.WATER_ELECTRIICITY_FEES_HISTORY.getCode());
+        List<FileStorageDO> officeFiles = fileService.findByBusinessId(enterpriseHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_OFFICE_ENVIRONMENT_HISTORY.getCode());
+        videoDueDiligence.setRentalFiles(rentalFiles);
+        videoDueDiligence.setWaterFiles(waterFiles);
+        videoDueDiligence.setOfficeFiles(officeFiles);
+
         List<PrivateLending> privateLendings = privateLendingService.lambdaQuery().eq(PrivateLending::getcSupplierInfoId, supplierId).eq(PrivateLending::getcEnterpriseId, enterprise.getId()).list();
         if(CollectionUtil.isNotEmpty(privateLendings)){
             privateLendings.forEach(r->r.setVideoDueDiligencePrivateLending(0));
@@ -367,25 +517,6 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
                 .build();
         List<FileStorage> files = attachmentRefService.getFiles(attachmentDto);
         videoDueDiligence.setFiles(files);
-        //企业经营与财务
-        List<FileStorageDO> enterpriseTaxReturnFiles = fileService.findByBusinessId(enterpriseHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_TAX_RETURN_HISTORY.getCode());
-        List<CCorporateFinanceHistory> cCorporateFinanceHistories = corporateFinanceHistoryService.lambdaQuery().eq(CCorporateFinanceHistory::getcEnterpriseHistoryId, enterpriseHistory.getId()).list();
-        for (CCorporateFinanceHistory cCorporateFinanceHistory : cCorporateFinanceHistories) {
-            List<FileStorageDO> enterpriseFinancialStatementsFiles = fileService.findByBusinessId(cCorporateFinanceHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_FINANCIAL_STATEMENTS_HISTORY.getCode());
-            cCorporateFinanceHistory.setFileStorageDO(enterpriseFinancialStatementsFiles.get(0));
-            cCorporateFinanceHistory.setFileStorage(enterpriseFinancialStatementsFiles.get(0));
-        }
-        List<FileStorageDO> enterpriseAccountingReportFiles = fileService.findByBusinessId(enterpriseHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_ACCOUNTING_REPORT_HISTORY.getCode());
-        videoDueDiligence.setEnterpriseTaxReturnFiles(enterpriseTaxReturnFiles);
-        videoDueDiligence.setCorporateFinanceList(cCorporateFinanceHistories);
-        videoDueDiligence.setEnterpriseAccountingReportFiles(enterpriseAccountingReportFiles);
-        //企业财务
-        VideoDueDiligenceFinance videoDueDiligenceFinance = new VideoDueDiligenceFinance();
-        videoDueDiligence.setMainBusinessIncome(supplierApprovalSecond.getMainBusinessIncome());
-        videoDueDiligence.setMainBusinessCost(supplierApprovalSecond.getMainBusinessCost());
-        videoDueDiligence.setMainBusinessProfit(supplierApprovalSecond.getMainBusinessProfit());
-        videoDueDiligenceFinance.setQuestion("是否有企业内账?企业真实年营业收入有多少?业务收入占比情况如何?毛利率约多少?对客户是如何筛选?");
-        videoDueDiligence.setVideoDueDiligenceFinance(videoDueDiligenceFinance);
         //上游采购单据
         List<UpstreamProcurementDocuments> upstreamProcurementDocumentsList = upstreamProcurementDocumentsService.lambdaQuery().eq(UpstreamProcurementDocuments::getSupplierApprovalSecondId, supplierApprovalSecond.getId()).list();
         if (CollectionUtil.isNotEmpty(upstreamProcurementDocumentsList)) {
@@ -405,65 +536,85 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
                 salesDocumentsInfo.setStandardScore(new BigDecimal("1"));
             }
         }
+        //企业经营与财务
+        List<FileStorageDO> enterpriseTaxReturnFiles = fileService.findByBusinessId(enterpriseHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_TAX_RETURN_HISTORY.getCode());
+        List<CCorporateFinanceHistory> cCorporateFinanceHistories = corporateFinanceHistoryService.lambdaQuery().eq(CCorporateFinanceHistory::getcEnterpriseHistoryId, enterpriseHistory.getId()).list();
+        for (CCorporateFinanceHistory cCorporateFinanceHistory : cCorporateFinanceHistories) {
+            List<FileStorageDO> enterpriseFinancialStatementsFiles = fileService.findByBusinessId(cCorporateFinanceHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_FINANCIAL_STATEMENTS_HISTORY.getCode());
+            cCorporateFinanceHistory.setFileStorageDO(enterpriseFinancialStatementsFiles.get(0));
+            cCorporateFinanceHistory.setFileStorage(enterpriseFinancialStatementsFiles.get(0));
+        }
+        videoDueDiligence.setMainBusinessIncome(supplierApprovalSecond.getMainBusinessIncome());
+        videoDueDiligence.setMainBusinessCost(supplierApprovalSecond.getMainBusinessCost());
+        videoDueDiligence.setMainBusinessProfit(supplierApprovalSecond.getMainBusinessProfit());
+        List<FileStorageDO> enterpriseAccountingReportFiles = fileService.findByBusinessId(enterpriseHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_ACCOUNTING_REPORT_HISTORY.getCode());
+        videoDueDiligence.setEnterpriseTaxReturnFiles(enterpriseTaxReturnFiles);
+        videoDueDiligence.setCorporateFinanceList(cCorporateFinanceHistories);
+        videoDueDiligence.setEnterpriseAccountingReportFiles(enterpriseAccountingReportFiles);
         videoDueDiligence.setSalesDocumentsInfoList(salesDocumentsInfoList);
-        VideoDueDiligenceOperations videoDueDiligenceOperations = new VideoDueDiligenceOperations();
-        videoDueDiligenceOperations.setQuestion("主营业务是?有无其他业务?合作的客户或者项目有哪些?年供应量大概多少?参与过项目有哪些?合作过的下游国企有哪些?有没有长期合作企业?本年度的项目有哪些?主要销售市场是?其他地区有没有业务如何入行?关系经验有哪些?有没有计划拓展的新领域?销售计划是什么?预计本年度营收收入、销售量多少?\n" +
-                "1.上游情况一般是从钢厂采购?供应商有没有区别?是钢厂的代理?上游合作商有哪些?如何选用供应商?还会采购其他货物吗?\n" + "2.下游情况招投标、签合同、下订单、送货、验收、对账、开票、付款流程介绍项目都有招标吗?与国企的往期合作情况 实际账期大概多久?付款方式是?");
-        videoDueDiligence.setVideoDueDiligenceOperations(videoDueDiligenceOperations);
-
         return videoDueDiligence;
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void videoDueDiligence(VideoDueDiligence videoDueDiligence) {
-        //一键测算
-        measurement(videoDueDiligence);
         //保存视频尽调信息
-        save(videoDueDiligence);
+        saveOrUpdate(videoDueDiligence);
         //保存文件
         List<Long> addressFileIds = videoDueDiligence.getAddressFileIds();
+        removeFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_ADDRESS_FILE);
         if (CollectionUtil.isNotEmpty(addressFileIds)) {
             saveFiles(addressFileIds, videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_ADDRESS_FILE);
         }
         List<Long> associatedEnterpriseFileIds = videoDueDiligence.getAssociatedEnterpriseFileIds();
+        removeFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_ASSOCIATED_ENTERPRISE_FILE);
         if (CollectionUtil.isNotEmpty(associatedEnterpriseFileIds)) {
             saveFiles(associatedEnterpriseFileIds, videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_ASSOCIATED_ENTERPRISE_FILE);
         }
         List<Long> businessAddressFileIds = videoDueDiligence.getBusinessAddressFileIds();
+        removeFiles( videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_BUSINESS_ADDRESS_FILE);
         if (CollectionUtil.isNotEmpty(businessAddressFileIds)) {
             saveFiles(businessAddressFileIds, videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_BUSINESS_ADDRESS_FILE);
         }
         List<Long> businessScopeFileIds = videoDueDiligence.getBusinessScopeFileIds();
+        removeFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_BUSINESS_SCOPE_FILE);
         if (CollectionUtil.isNotEmpty(businessScopeFileIds)) {
             saveFiles(businessScopeFileIds, videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_BUSINESS_SCOPE_FILE);
         }
         List<Long> capitalFileIds = videoDueDiligence.getCapitalFileIds();
+        removeFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_CAPITAL_FILE);
         if (CollectionUtil.isNotEmpty(capitalFileIds)) {
             saveFiles(capitalFileIds, videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_CAPITAL_FILE);
         }
         List<Long> changeFileIds = videoDueDiligence.getChangeFileIds();
+        removeFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_CHANGE_FILE);
         if (CollectionUtil.isNotEmpty(changeFileIds)) {
             saveFiles(changeFileIds, videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_CHANGE_FILE);
         }
         List<Long> industryFileIds = videoDueDiligence.getIndustryFileIds();
+        removeFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_INDUSTRY_FILE);
         if (CollectionUtil.isNotEmpty(industryFileIds)) {
             saveFiles(industryFileIds, videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_INDUSTRY_FILE);
         }
         List<Long> lifeFileIds = videoDueDiligence.getLifeFileIds();
+        removeFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_LIFE_FILE);
         if (CollectionUtil.isNotEmpty(lifeFileIds)) {
             saveFiles(lifeFileIds, videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_LIFE_FILE);
         }
         List<Long> negativeInformationFileIds = videoDueDiligence.getNegativeInformationFileIds();
+        removeFiles( videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_NEGATIVE_INFORMATION_FILE);
         if (CollectionUtil.isNotEmpty(negativeInformationFileIds)) {
             saveFiles(negativeInformationFileIds, videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_NEGATIVE_INFORMATION_FILE);
         }
         List<Long> shareholderFileIds = videoDueDiligence.getShareholderFileIds();
+        removeFiles(videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_SHAREHOLDER_FILE);
         if (CollectionUtil.isNotEmpty(shareholderFileIds)) {
             saveFiles(shareholderFileIds, videoDueDiligence.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_SHAREHOLDER_FILE);
         }
         //保存企业负责人情况
         List<VideoDueDiligenceShareholdersSituation> videoDueDiligenceShareholdersSituations = videoDueDiligence.getVideoDueDiligenceShareholdersSituations();
+        videoDueDiligenceShareholdersSituationService.lambdaUpdate().eq(VideoDueDiligenceShareholdersSituation::getcSupplierInfoId,videoDueDiligence.getcSupplierInfoId())
+                .eq(VideoDueDiligenceShareholdersSituation::getVideoDueDiligenceId,videoDueDiligence.getId()).remove();
         if (CollectionUtil.isNotEmpty(videoDueDiligenceShareholdersSituations)) {
             for (VideoDueDiligenceShareholdersSituation videoDueDiligenceShareholdersSituation : videoDueDiligenceShareholdersSituations) {
                 videoDueDiligenceShareholdersSituation.setcSupplierInfoId(videoDueDiligence.getcSupplierInfoId());
@@ -475,6 +626,8 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
             }
         }
         //保存企业信誉信息
+        videoDueDiligenceCorporateGoodwillService.lambdaUpdate().eq(VideoDueDiligenceCorporateGoodwill::getcSupplierInfoId,videoDueDiligence.getcSupplierInfoId())
+                .eq(VideoDueDiligenceCorporateGoodwill::getVideoDueDiligenceId,videoDueDiligence.getId()).remove();
         VideoDueDiligenceCorporateGoodwill videoDueDiligenceCorporateGoodwill = videoDueDiligence.getVideoDueDiligenceCorporateGoodwill();
         videoDueDiligenceCorporateGoodwill.setcSupplierInfoId(videoDueDiligence.getcSupplierInfoId());
         videoDueDiligenceCorporateGoodwill.setVideoDueDiligenceId(videoDueDiligence.getId());
@@ -525,6 +678,7 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
             }
         }
         //企业经财务
+        videoDueDiligenceFinanceService.lambdaUpdate().eq(VideoDueDiligenceFinance::getVideoDueDiligenceId,videoDueDiligence.getId()).remove();
         VideoDueDiligenceFinance videoDueDiligenceFinance = videoDueDiligence.getVideoDueDiligenceFinance();
         videoDueDiligenceFinance.setVideoDueDiligenceId(videoDueDiligence.getId());
         videoDueDiligenceFinanceService.save(videoDueDiligenceFinance);
@@ -546,48 +700,53 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
             }
         }
         //企业经营情况
+        videoDueDiligenceOperationsService.lambdaUpdate().eq(VideoDueDiligenceOperations::getVideoDueDiligenceId,videoDueDiligence.getId()).remove();
         VideoDueDiligenceOperations videoDueDiligenceOperations = videoDueDiligence.getVideoDueDiligenceOperations();
         videoDueDiligenceOperations.setVideoDueDiligenceId(videoDueDiligence.getId());
         videoDueDiligenceOperationsService.save(videoDueDiligenceOperations);
         //保存文件
         List<Long> videoDueDiligenceOperationsFileIds = videoDueDiligenceOperations.getFileIds();
         saveFiles(videoDueDiligenceOperationsFileIds, videoDueDiligenceOperations.getId(), FileModuleDict.ChildEnum.VIDEO_DUE_DILIGENCE_OPERATIONS_FILE);
-        //综合评估
-        SupplierInfo supplierInfo = supplierInfoService.get(videoDueDiligence.getcSupplierInfoId());
-        VideoDueDiligenceComprehensiveEvaluation videoDueDiligenceComprehensiveEvaluation = videoDueDiligence.getVideoDueDiligenceComprehensiveEvaluation();
-        videoDueDiligenceComprehensiveEvaluation.setVideoDueDiligenceId(videoDueDiligence.getId());
-        videoDueDiligenceComprehensiveEvaluation.setEvaluationOpinions(videoDueDiligence.getEvaluationOpinions());
-        videoDueDiligenceComprehensiveEvaluationService.save(videoDueDiligenceComprehensiveEvaluation);
-        supplierInfo.setScore(videoDueDiligenceComprehensiveEvaluation.getScore());
-        supplierInfo.setAdmitted(videoDueDiligenceComprehensiveEvaluation.getAdmitted());
-        supplierInfo.setCreditLimit(videoDueDiligenceComprehensiveEvaluation.getCreditLimit());
-        supplierInfo.setRevenueRating(videoDueDiligenceComprehensiveEvaluation.getRevenueRating());
-        if (videoDueDiligenceComprehensiveEvaluation.getAdmitted().equals(SupplierScoringModel.ADMITTED)) {
-            supplierInfo.setStatusStr(SupplierStatusEnums.CREDIT_SUCCESS.getCode());
-        } else {
-            supplierInfo.setStatusStr(SupplierStatusEnums.VOTE.getCode());
-        }
-        supplierInfoService.updateById(supplierInfo);
-        //完成流程
-        String taskId = videoDueDiligence.getTaskId();
-        Enterprise enterprise = enterpriseService.getById(supplierInfo.getcEnterpriseId());
-        Map<String, Object> msgVariables = new HashMap<>();
-        msgVariables.put(ConstantUtil.FLOWABLE_MSG_TITLE, "供应商名称:" + enterprise.getCorporateName());
-        msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
-                "供应商名称为“" + enterprise.getCorporateName() + "”的供应商已完成审核!"
-                        + ConstantUtil.FLOWABLE_MSG_ASSIGNEE);
-        flowableService.completeMyTask(taskId, supplierInfo, null, null, videoDueDiligence.getId(), msgVariables, ConstantUtil.SUPPLIER_INFO);
+        if(videoDueDiligence.getVisible()){
+            //一键测算
+            measurement(videoDueDiligence);
+            //综合评估
+            SupplierInfo supplierInfo = supplierInfoService.get(videoDueDiligence.getcSupplierInfoId());
+            VideoDueDiligenceComprehensiveEvaluation videoDueDiligenceComprehensiveEvaluation = videoDueDiligence.getVideoDueDiligenceComprehensiveEvaluation();
+            videoDueDiligenceComprehensiveEvaluation.setVideoDueDiligenceId(videoDueDiligence.getId());
+            videoDueDiligenceComprehensiveEvaluation.setEvaluationOpinions(videoDueDiligence.getEvaluationOpinions());
+            videoDueDiligenceComprehensiveEvaluationService.save(videoDueDiligenceComprehensiveEvaluation);
+            supplierInfo.setScore(videoDueDiligenceComprehensiveEvaluation.getScore());
+            supplierInfo.setAdmitted(videoDueDiligenceComprehensiveEvaluation.getAdmitted());
+            supplierInfo.setCreditLimit(videoDueDiligenceComprehensiveEvaluation.getCreditLimit());
+            supplierInfo.setRevenueRating(videoDueDiligenceComprehensiveEvaluation.getRevenueRating());
+            if (videoDueDiligenceComprehensiveEvaluation.getAdmitted().equals(SupplierScoringModel.ADMITTED)) {
+                supplierInfo.setStatusStr(SupplierStatusEnums.CREDIT_SUCCESS.getCode());
+            } else {
+                supplierInfo.setStatusStr(SupplierStatusEnums.VOTE.getCode());
+            }
+            supplierInfoService.updateById(supplierInfo);
+            //完成流程
+            String taskId = videoDueDiligence.getTaskId();
+            Enterprise enterprise = enterpriseService.getById(supplierInfo.getcEnterpriseId());
+            Map<String, Object> msgVariables = new HashMap<>();
+            msgVariables.put(ConstantUtil.FLOWABLE_MSG_TITLE, "供应商名称:" + enterprise.getCorporateName());
+            msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
+                    "供应商名称为“" + enterprise.getCorporateName() + "”的供应商已完成审核!"
+                            + ConstantUtil.FLOWABLE_MSG_ASSIGNEE);
+            flowableService.completeMyTask(taskId, supplierInfo, null, null, videoDueDiligence.getId(), msgVariables, ConstantUtil.SUPPLIER_INFO);
 
-        //判断是否开启授信决议
-        List<ProjectInformation> projectInformations = projectInformationService.lambdaQuery().eq(ProjectInformation::getcSupplierInfoId, videoDueDiligence.getcSupplierInfoId()).list();
-        if (CollectionUtil.isNotEmpty(projectInformations)) {
-            for (ProjectInformation projectInformation : projectInformations) {
-                if (projectInformation.getStatusStr().equals(ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode())) {
-                    ProjectCoreEnterprise projectCoreEnterprise = projectCoreEnterpriseService.lambdaQuery().eq(ProjectCoreEnterprise::getcProjectInformationId, projectInformation.getId()).one();
-                    if (projectCoreEnterprise.getStatusStr().equals(ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode())) {
-                        if (supplierInfo.getStatusStr().equals(SupplierStatusEnums.CREDIT_SUCCESS.getCode())) {
-                            //开启流程
-                            creditResolutionService.startProcess(projectInformation.getId());
+            //判断是否开启授信决议
+            List<ProjectInformation> projectInformations = projectInformationService.lambdaQuery().eq(ProjectInformation::getcSupplierInfoId, videoDueDiligence.getcSupplierInfoId()).list();
+            if (CollectionUtil.isNotEmpty(projectInformations)) {
+                for (ProjectInformation projectInformation : projectInformations) {
+                    if (projectInformation.getStatusStr().equals(ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode())) {
+                        ProjectCoreEnterprise projectCoreEnterprise = projectCoreEnterpriseService.lambdaQuery().eq(ProjectCoreEnterprise::getcProjectInformationId, projectInformation.getId()).one();
+                        if (projectCoreEnterprise.getStatusStr().equals(ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode())) {
+                            if (supplierInfo.getStatusStr().equals(SupplierStatusEnums.CREDIT_SUCCESS.getCode())) {
+                                //开启流程
+                                creditResolutionService.startProcess(projectInformation.getId());
+                            }
                         }
                     }
                 }
@@ -604,6 +763,13 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
             attachmentRefService.saveRef(fileIds, attachmentDto);
         }
     }
+    private void removeFiles(Long id, FileModuleDict.ChildEnum fileModuleDict) {
+        AttachmentDto attachmentDto = AttachmentDto.builder()
+                .setEntityId(id)
+                .setChildEnum(fileModuleDict)
+                .build();
+        attachmentRefService.removeRef(attachmentDto);
+    }
 
     @Override
     public VideoDueDiligence getView(Long id) {