瀏覽代碼

Merge branch 'liutao' into dev1.0

liutao 5 月之前
父節點
當前提交
068a135522

+ 1 - 1
build.gradle

@@ -9,7 +9,7 @@ targetCompatibility = 1.8
 
 jar {
     baseName = 'factoring-trade-prod'
-    version = '1.0.9'
+    version = '1.0.11'
 }
 
 springBoot {

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

@@ -22,10 +22,10 @@ public class CreditSituation extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
     /**
-     * c端 供应商企业信息id
+     * 审核第一步id
      */
-    @TableField("c_supplier_info_id")
-    private Long cSupplierInfoId;
+    @TableField("supplier_approval_first_id")
+    private Long supplierApprovalFirstId;
 
     /**
      * c端 征信相关情况 企业负责人
@@ -489,12 +489,12 @@ public class CreditSituation extends BaseEntity {
         this.creditInvestigationInfoHistory = creditInvestigationInfoHistory;
     }
 
-    public Long getcSupplierInfoId() {
-        return cSupplierInfoId;
+    public Long getSupplierApprovalFirstId() {
+        return supplierApprovalFirstId;
     }
 
-    public void setcSupplierInfoId(Long cSupplierInfoId) {
-        this.cSupplierInfoId = cSupplierInfoId;
+    public void setSupplierApprovalFirstId(Long supplierApprovalFirstId) {
+        this.supplierApprovalFirstId = supplierApprovalFirstId;
     }
 
     public Long getcCreditInvestigationInfoHistoryId() {

+ 39 - 0
src/main/java/com/sunxung/factoring/entity/supplier/SupplierApprovalFirst.java

@@ -53,6 +53,45 @@ public class SupplierApprovalFirst extends BaseEntity {
     @TableField("guarantee_enterprise_result")
     private String guaranteeEnterpriseResult;
 
+    @TableField("visible")
+    private Boolean visible;
+
+    /**
+     * 审批意见
+     */
+    @TableField("approval_comment")
+    private String approvalComment;
+
+    /**
+     * 审批结论
+     */
+    @TableField("approval_conclusion")
+    private String approvalConclusion;
+
+    public String getApprovalComment() {
+        return approvalComment;
+    }
+
+    public void setApprovalComment(String approvalComment) {
+        this.approvalComment = approvalComment;
+    }
+
+    public String getApprovalConclusion() {
+        return approvalConclusion;
+    }
+
+    public void setApprovalConclusion(String approvalConclusion) {
+        this.approvalConclusion = approvalConclusion;
+    }
+
+    public Boolean getVisible() {
+        return visible;
+    }
+
+    public void setVisible(Boolean visible) {
+        this.visible = visible;
+    }
+
     public Long getcSupplierInfoHistoryId() {
         return cSupplierInfoHistoryId;
     }

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

@@ -94,6 +94,19 @@ public class SupplierInfo extends Project {
     @TableField("visible")
     private Boolean visible;
 
+    /**
+     * 审批意见
+     */
+    @TableField(exist = false)
+    private String approvalComment;
+
+    /**
+     * 审批结论
+     */
+    @TableField(exist = false)
+    private String approvalConclusion;
+
+
     @TableField(exist = false)
     private String supplierName;
 
@@ -142,6 +155,23 @@ public class SupplierInfo extends Project {
     @TableField(exist = false)
     private List<String> errors;
 
+    public String getApprovalComment() {
+        return approvalComment;
+    }
+
+    public void setApprovalComment(String approvalComment) {
+        this.approvalComment = approvalComment;
+    }
+
+    public String getApprovalConclusion() {
+        return approvalConclusion;
+    }
+
+    public void setApprovalConclusion(String approvalConclusion) {
+        this.approvalConclusion = approvalConclusion;
+    }
+
+
     public List<String> getErrorList() {
         return errors;
     }

+ 4 - 4
src/main/java/com/sunxung/factoring/service/project/impl/ProjectCoreEnterpriseServiceImpl.java

@@ -287,11 +287,11 @@ public class ProjectCoreEnterpriseServiceImpl extends ServiceImpl<ProjectCoreEnt
         params.put("stCountScore", b.format(enterpriseReport.getStCountScore()));
         params.put("stCountPerson", enterpriseReport.getStCountPerson() == 0 ? "不存在" : "存在");
         params.put("stCountPersonScore", b.format(enterpriseReport.getStCountPersonScore()));
-        params.put("zhiXingAmount", enterpriseReport.getZhiXingAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
+        params.put("zhiXingAmount", enterpriseReport.getZhiXingAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
         params.put("zhiXingAmountScore", b.format(enterpriseReport.getZhiXingAmountScore()));
         params.put("zhiXingFrequent", enterpriseReport.getZhiXingFrequent());
         params.put("zhiXingFrequentScore", b.format(enterpriseReport.getZhiXingFrequentScore()));
-        params.put("historicalLitigationAmount", enterpriseReport.getHistoricalLitigationAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
+        params.put("historicalLitigationAmount", enterpriseReport.getHistoricalLitigationAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
         params.put("historicalLitigationAmountScore", b.format(enterpriseReport.getHistoricalLitigationAmountScore()));
         params.put("historicalLitigationCount", enterpriseReport.getHistoricalLitigationCount());
         params.put("historicalLitigationCountScore", b.format(enterpriseReport.getHistoricalLitigationCountScore()));
@@ -315,9 +315,9 @@ public class ProjectCoreEnterpriseServiceImpl extends ServiceImpl<ProjectCoreEnt
         params.put("exceptionScore", b.format(enterpriseReport.getExceptionScore()));
         params.put("administrativePenaltyCount", enterpriseReport.getAdministrativePenaltyCount());
         params.put("administrativePenaltyCountScore", b.format(enterpriseReport.getAdministrativePenaltyCountScore()));
-        params.put("administrativePenaltyAmount", enterpriseReport.getAdministrativePenaltyAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
+        params.put("administrativePenaltyAmount", enterpriseReport.getAdministrativePenaltyAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
         params.put("administrativePenaltyAmountScore", b.format(enterpriseReport.getAdministrativePenaltyAmountScore()));
-        params.put("environmentalPenaltiesAmount", enterpriseReport.getEnvironmentalPenaltiesAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
+        params.put("environmentalPenaltiesAmount", enterpriseReport.getEnvironmentalPenaltiesAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
         params.put("environmentalPenaltiesAmountScore", b.format(enterpriseReport.getEnvironmentalPenaltiesAmountScore()));
         params.put("news", enterpriseReport.getNews() == 0 ? "不存在" : "存在");
         params.put("newsScore", b.format(enterpriseReport.getNewsScore()));

+ 4 - 4
src/main/java/com/sunxung/factoring/service/project/impl/ProjectInformationServiceImpl.java

@@ -317,11 +317,11 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
         params.put("stCountScore", b.format(projectReport.getStCountScore()));
         params.put("stCountPerson", projectReport.getStCountPerson() == 0 ? "不存在" : "存在");
         params.put("stCountPersonScore", b.format(projectReport.getStCountPersonScore()));
-        params.put("zhiXingAmount", projectReport.getZhiXingAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
+        params.put("zhiXingAmount", projectReport.getZhiXingAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
         params.put("zhiXingAmountScore", b.format(projectReport.getZhiXingAmountScore()));
         params.put("zhiXingFrequent", projectReport.getZhiXingFrequent());
         params.put("zhiXingFrequentScore", b.format(projectReport.getZhiXingFrequentScore()));
-        params.put("historicalLitigationAmount", projectReport.getHistoricalLitigationAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
+        params.put("historicalLitigationAmount", projectReport.getHistoricalLitigationAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
         params.put("historicalLitigationAmountScore", b.format(projectReport.getHistoricalLitigationAmountScore()));
         params.put("historicalLitigationCount", projectReport.getHistoricalLitigationCount());
         params.put("historicalLitigationCountScore", b.format(projectReport.getHistoricalLitigationCountScore()));
@@ -345,9 +345,9 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
         params.put("exceptionScore", b.format(projectReport.getExceptionScore()));
         params.put("administrativePenaltyCount", projectReport.getAdministrativePenaltyCount());
         params.put("administrativePenaltyCountScore", b.format(projectReport.getAdministrativePenaltyCountScore()));
-        params.put("administrativePenaltyAmount", projectReport.getAdministrativePenaltyAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
+        params.put("administrativePenaltyAmount", projectReport.getAdministrativePenaltyAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
         params.put("administrativePenaltyAmountScore", b.format(projectReport.getAdministrativePenaltyAmountScore()));
-        params.put("environmentalPenaltiesAmount", projectReport.getEnvironmentalPenaltiesAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
+        params.put("environmentalPenaltiesAmount", projectReport.getEnvironmentalPenaltiesAmount().setScale(2, RoundingMode.HALF_UP) + "元人民币");
         params.put("environmentalPenaltiesAmountScore", b.format(projectReport.getEnvironmentalPenaltiesAmountScore()));
         params.put("news", projectReport.getNews() == 0 ? "不存在" : "存在");
         params.put("newsScore", b.format(projectReport.getNewsScore()));

+ 281 - 237
src/main/java/com/sunxung/factoring/service/supplier/impl/SupplierApprovalFirstServiceImpl.java

@@ -3,7 +3,6 @@ package com.sunxung.factoring.service.supplier.impl;
 import cn.hutool.json.JSONArray;
 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.enums.SupplierStatusEnums;
 import com.sunxung.factoring.component.exception.ServiceException;
 import com.sunxung.factoring.component.exception.ValidatorException;
@@ -29,6 +28,7 @@ import com.sunxung.factoring.service.sys.FileService;
 import com.sunxung.factoring.service.sys.FileStorageService;
 import com.sunxung.factoring.service.sys.UserService;
 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;
@@ -135,42 +135,71 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void firstReview(SupplierInfo supplierInfo) {
-        //保存企业审核信息
-        Enterprise enterprise = supplierInfo.getEnterprise();
-        saveInfo(enterprise,supplierInfo.getId());
-        //保存担保企业审核信息
+        SupplierApprovalFirst supplierApprovalFirst = lambdaQuery().eq(SupplierApprovalFirst::getcSupplierInfoId, supplierInfo.getId()).eq(SupplierApprovalFirst::getVisible, false).one();
         Enterprise guaranteeEnterprise = supplierInfo.getGuaranteeEnterprise();
-        if(guaranteeEnterprise != null){
-            saveInfo(guaranteeEnterprise, supplierInfo.getId());
+        Enterprise enterprise = supplierInfo.getEnterprise();
+        //保存第一步审核结论
+        if (supplierApprovalFirst == null) {
+            supplierApprovalFirst = new SupplierApprovalFirst();
+        }
+        supplierApprovalFirst.setcSupplierInfoId(supplierInfo.getId());
+        supplierApprovalFirst.setVisible(supplierInfo.getVisible());
+        supplierApprovalFirst.setApprovalComment(supplierInfo.getApprovalComment());
+        supplierApprovalFirst.setApprovalConclusion(supplierInfo.getApprovalConclusion());
+        supplierApprovalFirst.setcSupplierInfoHistoryId(supplierInfo.getHistoryId());
+        saveOrUpdate(supplierApprovalFirst);
+        supplierInfo.setSupplierApprovalFirst(supplierApprovalFirst);
+        if (StringUtils.isEmpty(supplierInfo.getApprovalConclusion()) || supplierInfo.getApprovalConclusion().equals(ConstantConversionUtil.APPROVAL_RESULT_PASS)) {
+            //保存企业审核信息
+            saveInfo(enterprise, supplierApprovalFirst.getId(), supplierInfo.getId());
+            //保存担保企业审核信息
+            if (guaranteeEnterprise != null) {
+                saveInfo(guaranteeEnterprise, supplierApprovalFirst.getId(), supplierInfo.getId());
+            }
         }
         //流程处理
-        if(supplierInfo.getVisible()){
-            //保存第一步审核结论
-            SupplierApprovalFirst supplierApprovalFirst = measurement(supplierInfo);
-            save(supplierApprovalFirst);
+        if (supplierInfo.getVisible()) {
             String taskId = supplierInfo.getTaskId();
-            String result = "通过";
-            Long mainEnterpriseCount = supplierApprovalFirst.getMainEnterpriseCount();
-            if(mainEnterpriseCount > 0){
-                result = "红否";
-            }
-            if(guaranteeEnterprise != null){
-                Long guaranteeEnterpriseCount = supplierApprovalFirst.getGuaranteeEnterpriseCount();
-                if(guaranteeEnterpriseCount > 0){
+            String result;
+            if (supplierInfo.getApprovalConclusion().equals(ConstantConversionUtil.APPROVAL_RESULT_BACK)) {
+                result = "退回";
+            } else if (supplierInfo.getApprovalConclusion().equals(ConstantConversionUtil.APPROVAL_RESULT_PASS)) {
+                //保存第一步审核结论
+                supplierApprovalFirst = measurement(supplierInfo);
+                updateById(supplierApprovalFirst);
+                result = "通过";
+                Long mainEnterpriseCount = supplierApprovalFirst.getMainEnterpriseCount();
+                if (mainEnterpriseCount > 0) {
                     result = "红否";
                 }
+                if (guaranteeEnterprise != null) {
+                    Long guaranteeEnterpriseCount = supplierApprovalFirst.getGuaranteeEnterpriseCount();
+                    if (guaranteeEnterpriseCount > 0) {
+                        result = "红否";
+                    }
+                }
+            } else {
+                throw new ServiceException(CodeUtil.FAIL, "审批结论出错!");
             }
             Map<String, Object> procVariables = new HashMap<>();
-            procVariables.put("result",result);
+            procVariables.put("result", result);
             Map<String, Object> msgVariables = new HashMap<>();
             msgVariables.put(ConstantUtil.FLOWABLE_MSG_TITLE, "供应商名称:" + enterprise.getCorporateName());
-            if(result.equals("通过")){
+            if (result.equals("通过")) {
                 msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
                         "供应商名称为“" + enterprise.getCorporateName() + "”的供应商已进入“"
                                 + ConstantConversionUtil.flowBusinessKeyNames.get(ConstantUtil.SUPPLIER_INFO) + "—供应商审核第二步,"
                                 + ConstantUtil.FLOWABLE_MSG_ASSIGNEE);
-            }else {
-                supplierInfoService.lambdaUpdate().eq(SupplierInfo::getId,supplierInfo.getId()).set(SupplierInfo::getStatusStr, SupplierStatusEnums.VOTE.getCode()).update();
+            } else if (result.equals("退回")) {
+                supplierInfo.setStatusStr(SupplierStatusEnums.ADD_INFO.getCode());
+                supplierInfoService.updateById(supplierInfo);
+                msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
+                        "供应商名称为“" + enterprise.getCorporateName() + "”的供应商已进入“"
+                                + ConstantConversionUtil.flowBusinessKeyNames.get(ConstantUtil.SUPPLIER_INFO) + "—C端供应商录入,"
+                                + ConstantUtil.FLOWABLE_MSG_ASSIGNEE);
+            } else {
+                supplierApprovalFirst.setApprovalConclusion(ConstantConversionUtil.APPROVAL_RESULT_VETO);
+                supplierInfoService.lambdaUpdate().eq(SupplierInfo::getId, supplierInfo.getId()).set(SupplierInfo::getStatusStr, SupplierStatusEnums.VOTE.getCode()).update();
                 msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
                         "供应商名称为“" + enterprise.getCorporateName() + "”的供应商审核已被否决");
             }
@@ -179,91 +208,91 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
     }
 
 
-    private void saveInfo(Enterprise enterprise, Long id) {
+    private void saveInfo(Enterprise enterprise, Long id, Long supplierInfoId) {
         List<CreditSituation> creditSituations = enterprise.getCreditSituations();
-        if(CollectionUtil.isNotEmpty(creditSituations)){
+        if (CollectionUtil.isNotEmpty(creditSituations)) {
             for (CreditSituation creditSituation : creditSituations) {
                 creditSituationService.lambdaUpdate()
-                        .eq(CreditSituation::getcCreditInvestigationInfoHistoryId,creditSituation.getcCreditInvestigationInfoHistoryId())
-                        .eq(CreditSituation::getcSupplierInfoId,id).remove();
-                creditSituation.setcSupplierInfoId(id);
+                        .eq(CreditSituation::getcCreditInvestigationInfoHistoryId, creditSituation.getcCreditInvestigationInfoHistoryId())
+                        .eq(CreditSituation::getSupplierApprovalFirstId, id).remove();
+                creditSituation.setSupplierApprovalFirstId(id);
                 creditSituationService.save(creditSituation);
             }
-        }else {
-            throw new ValidatorException(CodeUtil.FAIL,"企业主要人员征信情况不能为空!");
+        } else {
+            throw new ValidatorException(CodeUtil.FAIL, "企业主要人员征信情况不能为空!");
         }
-        corporateGoodwillService.lambdaUpdate().eq(CorporateGoodwill::getcSupplierInfoId,id)
-                .eq(CorporateGoodwill::getcEnterpriseId,enterprise.getId()).remove();
+        corporateGoodwillService.lambdaUpdate().eq(CorporateGoodwill::getcSupplierInfoId, supplierInfoId)
+                .eq(CorporateGoodwill::getcEnterpriseId, enterprise.getId()).remove();
         CorporateGoodwill corporateGoodwill = enterprise.getCorporateGoodwill();
-        corporateGoodwill.setcSupplierInfoId(id);
+        corporateGoodwill.setcSupplierInfoId(supplierInfoId);
         corporateGoodwill.setcEnterpriseId(enterprise.getId());
         corporateGoodwillService.save(corporateGoodwill);
-        privateLendingService.lambdaUpdate().eq(PrivateLending::getcSupplierInfoId,id)
-                .eq(PrivateLending::getcEnterpriseId,enterprise.getId()).remove();
+        privateLendingService.lambdaUpdate().eq(PrivateLending::getcSupplierInfoId, supplierInfoId)
+                .eq(PrivateLending::getcEnterpriseId, enterprise.getId()).remove();
         List<PrivateLending> privateLendings = enterprise.getPrivateLendings();
-        if(CollectionUtil.isNotEmpty(privateLendings)){
+        if (CollectionUtil.isNotEmpty(privateLendings)) {
             for (PrivateLending privateLending : privateLendings) {
-                privateLending.setcSupplierInfoId(id);
+                privateLending.setcSupplierInfoId(supplierInfoId);
                 privateLending.setcEnterpriseId(enterprise.getId());
                 privateLendingService.save(privateLending);
             }
         }
-        seriousIllegalityService.lambdaUpdate().eq(SeriousIllegality::getcSupplierInfoId,id)
-                .eq(SeriousIllegality::getcEnterpriseId,enterprise.getId()).remove();
+        seriousIllegalityService.lambdaUpdate().eq(SeriousIllegality::getcSupplierInfoId, supplierInfoId)
+                .eq(SeriousIllegality::getcEnterpriseId, enterprise.getId()).remove();
         List<SeriousIllegality> seriousIllegalities = enterprise.getSeriousIllegalities();
-        if(CollectionUtil.isNotEmpty(seriousIllegalities)){
+        if (CollectionUtil.isNotEmpty(seriousIllegalities)) {
             for (SeriousIllegality seriousIllegality : seriousIllegalities) {
-                seriousIllegality.setcSupplierInfoId(id);
+                seriousIllegality.setcSupplierInfoId(supplierInfoId);
                 seriousIllegality.setcEnterpriseId(enterprise.getId());
                 seriousIllegalityService.save(seriousIllegality);
             }
         }
         List<TaxOweNotice> taxOweNotices = enterprise.getTaxOweNotices();
-        taxOweNoticeService.lambdaUpdate().eq(TaxOweNotice::getcSupplierInfoId,id)
-                .eq(TaxOweNotice::getcEnterpriseId,enterprise.getId()).remove();
-        if(CollectionUtil.isNotEmpty(taxOweNotices)){
+        taxOweNoticeService.lambdaUpdate().eq(TaxOweNotice::getcSupplierInfoId, supplierInfoId)
+                .eq(TaxOweNotice::getcEnterpriseId, enterprise.getId()).remove();
+        if (CollectionUtil.isNotEmpty(taxOweNotices)) {
             for (TaxOweNotice taxOweNotice : taxOweNotices) {
-                taxOweNotice.setcSupplierInfoId(id);
+                taxOweNotice.setcSupplierInfoId(supplierInfoId);
                 taxOweNotice.setcEnterpriseId(enterprise.getId());
                 taxOweNoticeService.save(taxOweNotice);
             }
         }
         List<TaxIllegalData> taxIllegalData = enterprise.getTaxIllegalData();
-        taxIllegalDataService.lambdaUpdate().eq(TaxIllegalData::getcSupplierInfoId,id)
-                .eq(TaxIllegalData::getcEnterpriseId,enterprise.getId()).remove();
-        if(CollectionUtil.isNotEmpty(taxIllegalData)){
+        taxIllegalDataService.lambdaUpdate().eq(TaxIllegalData::getcSupplierInfoId, supplierInfoId)
+                .eq(TaxIllegalData::getcEnterpriseId, enterprise.getId()).remove();
+        if (CollectionUtil.isNotEmpty(taxIllegalData)) {
             for (TaxIllegalData taxIllegalDatum : taxIllegalData) {
-                taxIllegalDatum.setcSupplierInfoId(id);
+                taxIllegalDatum.setcSupplierInfoId(supplierInfoId);
                 taxIllegalDatum.setcEnterpriseId(enterprise.getId());
                 taxIllegalDataService.save(taxIllegalDatum);
             }
         }
         List<Blacklist> blacklists = enterprise.getBlacklists();
-        blacklistService.lambdaUpdate().eq(Blacklist::getcSupplierInfoId,id)
-                .eq(Blacklist::getcEnterpriseId,enterprise.getId()).remove();
-        if(CollectionUtil.isNotEmpty(blacklists)){
+        blacklistService.lambdaUpdate().eq(Blacklist::getcSupplierInfoId, supplierInfoId)
+                .eq(Blacklist::getcEnterpriseId, enterprise.getId()).remove();
+        if (CollectionUtil.isNotEmpty(blacklists)) {
             for (Blacklist blacklist : blacklists) {
-                blacklist.setcSupplierInfoId(id);
+                blacklist.setcSupplierInfoId(supplierInfoId);
                 blacklist.setcEnterpriseId(enterprise.getId());
                 blacklistService.save(blacklist);
             }
         }
         List<ExceptionData> exceptionData = enterprise.getExceptionData();
-        exceptionDataService.lambdaUpdate().eq(ExceptionData::getcSupplierInfoId,id)
-                .eq(ExceptionData::getcEnterpriseId,enterprise.getId()).remove();
-        if(CollectionUtil.isNotEmpty(exceptionData)){
+        exceptionDataService.lambdaUpdate().eq(ExceptionData::getcSupplierInfoId, supplierInfoId)
+                .eq(ExceptionData::getcEnterpriseId, enterprise.getId()).remove();
+        if (CollectionUtil.isNotEmpty(exceptionData)) {
             for (ExceptionData exceptionDatum : exceptionData) {
-                exceptionDatum.setcSupplierInfoId(id);
+                exceptionDatum.setcSupplierInfoId(supplierInfoId);
                 exceptionDatum.setcEnterpriseId(enterprise.getId());
                 exceptionDataService.save(exceptionDatum);
             }
         }
         List<News> news = enterprise.getNews();
-        newsService.lambdaUpdate().eq(News::getcSupplierInfoId,id)
-                .eq(News::getcEnterpriseId,enterprise.getId()).remove();
-        if(CollectionUtil.isNotEmpty(news)){
+        newsService.lambdaUpdate().eq(News::getcSupplierInfoId, supplierInfoId)
+                .eq(News::getcEnterpriseId, enterprise.getId()).remove();
+        if (CollectionUtil.isNotEmpty(news)) {
             for (News news1 : news) {
-                news1.setcSupplierInfoId(id);
+                news1.setcSupplierInfoId(supplierInfoId);
                 news1.setcEnterpriseId(enterprise.getId());
                 newsService.save(news1);
             }
@@ -273,92 +302,100 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
     @Override
     public SupplierInfo getFirstReviewById(Long id) {
         //获取最后一次供应商C端录入时的log
-        BusinessProcessingLog lastLog = businessProcessingLogService.getLastByBusinessKeyBusinessTypeTaskName(id,ConstantUtil.SUPPLIER_INFO,"供应商C端录入");
+        BusinessProcessingLog lastLog = businessProcessingLogService.getLastByBusinessKeyBusinessTypeTaskName(id, ConstantUtil.SUPPLIER_INFO, "供应商C端录入");
         CSupplierInfoHistory supplierInfoHistory = supplierInfoHistoryService.getById(lastLog.getFormBusinessId());
         SupplierInfo supplierInfo = supplierInfoService.get(id);
         DueDiligenceAllocation dueDiligenceAllocation = dueDiligenceAllocationService.lambdaQuery().eq(DueDiligenceAllocation::getcSupplierInfoId, id).one();
         User riskManager = userService.get(dueDiligenceAllocation.getRiskManagerId());
         dueDiligenceAllocation.setRiskManager(riskManager);
         supplierInfo.setDueDiligenceAllocation(dueDiligenceAllocation);
-
-        SupplierApprovalFirst supplierApprovalFirst = lambdaQuery().eq(SupplierApprovalFirst::getcSupplierInfoId, id).one();
+        List<SupplierApprovalFirst> supplierApprovalFirsts = lambdaQuery().eq(SupplierApprovalFirst::getcSupplierInfoId, id).eq(SupplierApprovalFirst::getVisible, false)
+                .orderByDesc(SupplierApprovalFirst::getGmtCreate).list();
+        if (CollectionUtil.isNotEmpty(supplierApprovalFirsts)) {
+            SupplierApprovalFirst supplierApprovalFirst = supplierApprovalFirsts.get(0);
+            supplierInfo.setSupplierApprovalFirst(supplierApprovalFirst);
+            supplierInfo.setApprovalConclusion(supplierApprovalFirst.getApprovalConclusion());
+            supplierInfo.setApprovalComment(supplierApprovalFirst.getApprovalComment());
+        }
         supplierInfo.setHistoryId(supplierInfoHistory.getId());
-        supplierInfo.setSupplierApprovalFirst(supplierApprovalFirst);
 
         CEnterpriseHistory enterpriseHistory = enterpriseHistoryService.getById(supplierInfoHistory.getcEnterpriseHistoryId());
         Enterprise enterprise = enterpriseService.getById(supplierInfo.getcEnterpriseId());
-        autoFirstReview(id,enterprise,enterpriseHistory);
+        autoFirstReview(supplierInfo, enterprise, enterpriseHistory);
         supplierInfo.setEnterprise(enterprise);
         supplierInfo.setHasGuaranteeEnterprise(false);
-        if(supplierInfo.getGuaranteeEnterpriseId() != null){
+        if (supplierInfo.getGuaranteeEnterpriseId() != null) {
             supplierInfo.setHasGuaranteeEnterprise(true);
             CEnterpriseHistory enteguaranteeHistory = enterpriseHistoryService.getById(supplierInfoHistory.getGuaranteeEnterpriseHistoryId());
             Enterprise guaranteeEnterprise = enterpriseService.getById(supplierInfo.getGuaranteeEnterpriseId());
-            autoFirstReview(id,guaranteeEnterprise, enteguaranteeHistory);
+            autoFirstReview(supplierInfo, guaranteeEnterprise, enteguaranteeHistory);
             supplierInfo.setGuaranteeEnterprise(guaranteeEnterprise);
         }
         return supplierInfo;
     }
 
-    private void autoFirstReview(Long id,Enterprise enterprise, CEnterpriseHistory enterpriseHistory) {
-        //企业负责人征信情况
-        List<CreditSituation> creditSituations = creditSituationService.lambdaQuery().eq(CreditSituation::getcSupplierInfoId, id).list();
+    private void autoFirstReview(SupplierInfo supplierInfo, Enterprise enterprise, CEnterpriseHistory enterpriseHistory) {
+        Long id = supplierInfo.getId();
         List<CreditSituation> creditSituationsResult = new ArrayList<>();
-        if(CollectionUtil.isNotEmpty(creditSituations)){
-            for (CreditSituation creditSituation : creditSituations) {
-                CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(creditSituation.getcCreditInvestigationInfoHistoryId());
-                creditInvestigationInfoHistory.setTypeStr(dictionaryService.getByCode(creditInvestigationInfoHistory.getType()).getName());
-                CEnterpriseHistory byId = enterpriseHistoryService.getById(creditInvestigationInfoHistory.getcEnterpriseHistoryId());
-                CEnterpriseHistory historyServiceById = enterpriseHistoryService.getById(enterpriseHistory.getId());
-                List<FileStorage> list = new ArrayList<>();
-                if(byId.getCorporateName().equals(historyServiceById.getCorporateName())){
-                    //todo 填充征信报告
-                    CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, creditInvestigationInfoHistory.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()));
-                                list.add(creditDetailFiles);
+        if (supplierInfo.getSupplierApprovalFirst() != null) {
+            Long firstReviewId = supplierInfo.getSupplierApprovalFirst().getId();
+            List<CreditSituation> creditSituations = creditSituationService.lambdaQuery().eq(CreditSituation::getSupplierApprovalFirstId, firstReviewId).list();
+            if (CollectionUtil.isNotEmpty(creditSituations)) {
+                for (CreditSituation creditSituation : creditSituations) {
+                    CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(creditSituation.getcCreditInvestigationInfoHistoryId());
+                    creditInvestigationInfoHistory.setTypeStr(dictionaryService.getByCode(creditInvestigationInfoHistory.getType()).getName());
+                    CEnterpriseHistory byId = enterpriseHistoryService.getById(creditInvestigationInfoHistory.getcEnterpriseHistoryId());
+                    CEnterpriseHistory historyServiceById = enterpriseHistoryService.getById(enterpriseHistory.getId());
+                    List<FileStorage> list = new ArrayList<>();
+                    if (byId.getCorporateName().equals(historyServiceById.getCorporateName())) {
+                        //todo 填充征信报告
+                        CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, creditInvestigationInfoHistory.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()));
+                                    list.add(creditDetailFiles);
+                                }
                             }
                         }
+                        creditInvestigationInfoHistory.setCreditDetailFiles(list);
+                        List<FileStorageDO> cardFiles = fileService.findByBusinessId(creditInvestigationInfoHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_IDCARD_FILES_HISTORY.getCode());
+                        creditInvestigationInfoHistory.setCardFiles(cardFiles);
+                        creditSituation.setCreditInvestigationInfoHistory(creditInvestigationInfoHistory);
+                        creditSituationsResult.add(creditSituation);
                     }
-                    creditInvestigationInfoHistory.setCreditDetailFiles(list);
-                    List<FileStorageDO> cardFiles = fileService.findByBusinessId(creditInvestigationInfoHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_IDCARD_FILES_HISTORY.getCode());
-                    creditInvestigationInfoHistory.setCardFiles(cardFiles);
-                    creditSituation.setCreditInvestigationInfoHistory(creditInvestigationInfoHistory);
-                    creditSituationsResult.add(creditSituation);
                 }
             }
         }
-        if(CollectionUtil.isEmpty(creditSituationsResult)){
+        //企业负责人征信情况
+        if (CollectionUtil.isEmpty(creditSituationsResult)) {
             List<CCreditInvestigationInfoHistory> creditInvestigationInfoHistories = creditInvestigationInfoHistoryService.lambdaQuery().eq(CCreditInvestigationInfoHistory::getcEnterpriseHistoryId, enterpriseHistory.getId()).list();
-            if(CollectionUtil.isNotEmpty(creditInvestigationInfoHistories)){
+            if (CollectionUtil.isNotEmpty(creditInvestigationInfoHistories)) {
                 //去重
                 List<CCreditInvestigationInfoHistory> filterResult = creditInvestigationInfoHistories.stream()
                         .collect(Collectors.toMap(CCreditInvestigationInfoHistory::getName, user -> user, (u1, u2) -> u1))
                         .values().stream().collect(Collectors.toList());
                 for (CCreditInvestigationInfoHistory creditInvestigationInfoHistory : filterResult) {
                     List<FileStorage> list = new ArrayList<>();
-                    if(creditInvestigationInfoHistory.getcEnterpriseHistoryId().equals(enterpriseHistory.getId())){
+                    if (creditInvestigationInfoHistory.getcEnterpriseHistoryId().equals(enterpriseHistory.getId())) {
                         List<FileStorageDO> cardFiles = fileService.findByBusinessId(creditInvestigationInfoHistory.getId(), FileModuleDict.ChildEnum.ENTERPRISE_IDCARD_FILES_HISTORY.getCode());
                         creditInvestigationInfoHistory.setTypeStr(dictionaryService.getByCode(creditInvestigationInfoHistory.getType()).getName());
                         creditInvestigationInfoHistory.setCardFiles(cardFiles);
                         CreditSituation creditSituation = new CreditSituation();
-                        creditSituation.setcSupplierInfoId(id);
                         creditSituation.setcCreditInvestigationInfoHistoryId(creditInvestigationInfoHistory.getId());
                         //todo 填充征信报告
                         CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, creditInvestigationInfoHistory.getSocialCreditCode()).one();
-                        if(creditInfo != null){
+                        if (creditInfo != null) {
                             List<CreditDetail> creditDetails = creditDetailService.lambdaQuery()
-                                    .eq(CreditDetail::getCreditId,creditInfo.getId())
+                                    .eq(CreditDetail::getCreditId, creditInfo.getId())
                                     .isNotNull(CreditDetail::getCreditAddress)
                                     .orderByDesc(CreditDetail::getGmtCreate).list();
-                            if(CollectionUtil.isNotEmpty(creditDetails)){
+                            if (CollectionUtil.isNotEmpty(creditDetails)) {
                                 CreditDetail creditDetail = creditDetails.get(0);
                                 FileStorage creditDetailFiles = fileStorageService.get(Long.valueOf(creditDetail.getCreditAddress()));
                                 list.add(creditDetailFiles);
@@ -371,10 +408,10 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
                             dongjiangaoRiskId = enterprise.getcDongjiangaoRiskId();
                         } else if (creditInvestigationInfoHistory.getType().equals("c_credit_investigation_info_type_2")) {
                             dongjiangaoRiskId = enterprise.getcDongjiangaoRiskBigId();
-                        }else {
+                        } else {
                             dongjiangaoRiskId = enterprise.getcDongjiangaoRiskControllerId();
                         }
-                        if(dongjiangaoRiskId != null){
+                        if (dongjiangaoRiskId != null) {
                             String dongjiangaoRisksUrl = dongjiangaoRisks + "?id=" + dongjiangaoRiskId;
                             ResponseJson dongjiangaoRisksObject = restTemplate.getForObject(dongjiangaoRisksUrl, ResponseJson.class);
                             if (dongjiangaoRisksObject == null) {
@@ -408,7 +445,7 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
         enterprise.setCreditSituations(creditSituationsResult);
         //企业信誉
         CorporateGoodwill corporateGoodwill = corporateGoodwillService.lambdaQuery().eq(CorporateGoodwill::getcSupplierInfoId, id).eq(CorporateGoodwill::getcEnterpriseId, enterprise.getId()).one();
-        if(corporateGoodwill == null){
+        if (corporateGoodwill == null) {
             corporateGoodwill = new CorporateGoodwill();
             corporateGoodwill.setcSupplierInfoId(id);
             corporateGoodwill.setcEnterpriseId(enterprise.getId());
@@ -416,14 +453,14 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
         //todo 填充征信报告
         CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, enterprise.getSocialCreditCode()).one();
         List<FileStorage> list = new ArrayList<>();
-        if(creditInfo != null){
+        if (creditInfo != null) {
             List<CreditDetail> creditDetails = creditDetailService.lambdaQuery()
-                    .eq(CreditDetail::getCreditId,creditInfo.getId())
+                    .eq(CreditDetail::getCreditId, creditInfo.getId())
                     .isNotNull(CreditDetail::getCreditAddress)
                     .orderByDesc(CreditDetail::getGmtCreate).list();
-            if(CollectionUtil.isNotEmpty(creditDetails)){
+            if (CollectionUtil.isNotEmpty(creditDetails)) {
                 CreditDetail creditDetail = creditDetails.get(0);
-                if(StringUtil.isNotEmpty(creditDetail.getCreditAddress())){
+                if (StringUtil.isNotEmpty(creditDetail.getCreditAddress())) {
                     FileStorage creditDetailFiles = fileStorageService.get(Long.valueOf(creditDetail.getCreditAddress()));
                     list.add(creditDetailFiles);
                 }
@@ -432,47 +469,47 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
         corporateGoodwill.setCreditDetailFiles(list);
         enterprise.setCorporateGoodwill(corporateGoodwill);
         List<PrivateLending> privateLendings = privateLendingService.lambdaQuery().eq(PrivateLending::getcSupplierInfoId, id).eq(PrivateLending::getcEnterpriseId, enterprise.getId()).list();
-        if(CollectionUtil.isNotEmpty(privateLendings)){
+        if (CollectionUtil.isNotEmpty(privateLendings)) {
             //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)){
+        if (CollectionUtil.isNotEmpty(seriousIllegalities)) {
             //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)){
+        if (CollectionUtil.isNotEmpty(taxOweNotices)) {
             //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)){
+        if (CollectionUtil.isNotEmpty(taxIllegalData)) {
             //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)){
+        if (CollectionUtil.isNotEmpty(blacklists)) {
             //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)){
+        if (CollectionUtil.isNotEmpty(exceptionData)) {
             //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)){
+        if (CollectionUtil.isNotEmpty(news)) {
             //news.forEach(r->r.setNews(0));
         }
         enterprise.setNews(news);
-        if(CollectionUtil.isEmpty(privateLendings) || CollectionUtil.isEmpty(seriousIllegalities) || CollectionUtil.isEmpty(taxOweNotices) || CollectionUtil.isEmpty(taxIllegalData)
-                || CollectionUtil.isEmpty(blacklists)|| CollectionUtil.isEmpty(exceptionData)|| CollectionUtil.isEmpty(news)){
+        if (CollectionUtil.isEmpty(privateLendings) || CollectionUtil.isEmpty(seriousIllegalities) || CollectionUtil.isEmpty(taxOweNotices) || CollectionUtil.isEmpty(taxIllegalData)
+                || CollectionUtil.isEmpty(blacklists) || CollectionUtil.isEmpty(exceptionData) || CollectionUtil.isEmpty(news)) {
             //sop 获取企业信誉数据
             String findCorporateGoodwillUrl = findCorporateGoodwill + "?comprehensiveRiskInvestigationId=" + enterprise.getcComprehensiveRiskInvestigationId();
             ResponseJson responseJson = restTemplate.getForObject(findCorporateGoodwillUrl, ResponseJson.class);
-            if(responseJson != null && responseJson.getCode().equals("200")){
-                JSONObject jsonObject = new JSONObject(responseJson.getData()) ;
+            if (responseJson != null && responseJson.getCode().equals("200")) {
+                JSONObject jsonObject = new JSONObject(responseJson.getData());
                 JSONArray judgmentDocuments = jsonObject.getJSONArray("judgmentDocuments");
                 JSONArray seriousIllegalData = jsonObject.getJSONArray("seriousIllegalData");
                 JSONArray taxOweNoticeData = jsonObject.getJSONArray("taxOweNoticeData");
@@ -481,7 +518,7 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
                 JSONArray newsRj = jsonObject.getJSONArray("news");
                 JSONArray taxIllegalDataRj = jsonObject.getJSONArray("taxIllegalData");
                 List<PrivateLending> judgmentDocumentList = new ArrayList();
-                if(CollectionUtil.isNotEmpty(judgmentDocuments)){
+                if (CollectionUtil.isNotEmpty(judgmentDocuments)) {
                     for (Object judgmentDocument : judgmentDocuments) {
                         JSONObject object = (JSONObject) judgmentDocument;
                         PrivateLending privateLending = new PrivateLending();
@@ -501,7 +538,7 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
                 }
                 enterprise.setPrivateLendings(judgmentDocumentList);
                 List<SeriousIllegality> seriousIllegalitieList = new ArrayList<>();
-                if(CollectionUtil.isNotEmpty(seriousIllegalData)){
+                if (CollectionUtil.isNotEmpty(seriousIllegalData)) {
                     for (Object seriousIllegalDatum : seriousIllegalData) {
                         JSONObject object = (JSONObject) seriousIllegalDatum;
                         SeriousIllegality seriousIllegality = new SeriousIllegality();
@@ -516,7 +553,7 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
                 }
                 enterprise.setSeriousIllegalities(seriousIllegalitieList);
                 List<TaxOweNotice> taxOweNoticeList = new ArrayList<>();
-                if(CollectionUtil.isNotEmpty(taxOweNoticeData)){
+                if (CollectionUtil.isNotEmpty(taxOweNoticeData)) {
                     for (Object taxOweNoticeDatum : taxOweNoticeData) {
                         JSONObject object = (JSONObject) taxOweNoticeDatum;
                         TaxOweNotice taxOweNotice = new TaxOweNotice();
@@ -533,7 +570,7 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
                 }
                 enterprise.setTaxOweNotices(taxOweNoticeList);
                 List<TaxIllegalData> taxIllegalDataList = new ArrayList<>();
-                if(CollectionUtil.isNotEmpty(taxIllegalDataRj)){
+                if (CollectionUtil.isNotEmpty(taxIllegalDataRj)) {
                     for (Object taxIllegal : taxIllegalDataRj) {
                         JSONObject object = (JSONObject) taxIllegal;
                         TaxIllegalData taxIllegalData1 = new TaxIllegalData();
@@ -550,7 +587,7 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
                 }
                 enterprise.setTaxIllegalData(taxIllegalDataList);
                 List<Blacklist> blacklist = new ArrayList<>();
-                if(CollectionUtil.isNotEmpty(blacklistsRj)){
+                if (CollectionUtil.isNotEmpty(blacklistsRj)) {
                     for (Object black : blacklistsRj) {
                         JSONObject object = (JSONObject) black;
                         Blacklist blacks = new Blacklist();
@@ -567,7 +604,7 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
                 }
                 enterprise.setBlacklists(blacklist);
                 List<ExceptionData> exceptionDataList = new ArrayList<>();
-                if(CollectionUtil.isNotEmpty(exceptionDataRj)){
+                if (CollectionUtil.isNotEmpty(exceptionDataRj)) {
                     for (Object exception : exceptionDataRj) {
                         JSONObject object = (JSONObject) exception;
                         ExceptionData exceptionData1 = new ExceptionData();
@@ -582,7 +619,7 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
                 }
                 enterprise.setExceptionData(exceptionDataList);
                 List<News> newsList = new ArrayList<>();
-                if(CollectionUtil.isNotEmpty(newsRj)){
+                if (CollectionUtil.isNotEmpty(newsRj)) {
                     for (Object newsObj : newsRj) {
                         JSONObject object = (JSONObject) newsObj;
                         News newsData = new News();
@@ -603,6 +640,8 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
     public SupplierInfo getView(Long id) {
         SupplierApprovalFirst supplierApprovalFirst = getById(id);
         SupplierInfo supplierInfo = supplierInfoService.get(supplierApprovalFirst.getcSupplierInfoId());
+        supplierInfo.setApprovalConclusion(supplierApprovalFirst.getApprovalConclusion());
+        supplierInfo.setApprovalComment(supplierApprovalFirst.getApprovalComment());
         DueDiligenceAllocation dueDiligenceAllocation = dueDiligenceAllocationService.lambdaQuery().eq(DueDiligenceAllocation::getcSupplierInfoId, supplierInfo.getId()).one();
         User user = userService.get(dueDiligenceAllocation.getRiskManagerId());
         dueDiligenceAllocation.setRiskManager(user);
@@ -611,14 +650,14 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
         supplierInfo.setSupplierApprovalFirst(supplierApprovalFirst);
         CEnterpriseHistory enterpriseHistory = enterpriseHistoryService.getById(supplierInfoHistory.getcEnterpriseHistoryId());
         Enterprise enterprise = enterpriseService.getById(supplierInfo.getcEnterpriseId());
-        autoView(supplierInfo.getId(),enterprise,enterpriseHistory);
+        autoView(supplierInfo, enterprise, enterpriseHistory);
         supplierInfo.setEnterprise(enterprise);
         supplierInfo.setHasGuaranteeEnterprise(false);
-        if(supplierInfo.getGuaranteeEnterpriseId() != null){
+        if (supplierInfo.getGuaranteeEnterpriseId() != null) {
             supplierInfo.setHasGuaranteeEnterprise(true);
             CEnterpriseHistory guaranteeHistory = enterpriseHistoryService.getById(supplierInfoHistory.getGuaranteeEnterpriseHistoryId());
             Enterprise guarantee = enterpriseService.getById(supplierInfo.getGuaranteeEnterpriseId());
-            autoView(supplierInfo.getId(),guarantee,guaranteeHistory);
+            autoView(supplierInfo, guarantee, guaranteeHistory);
             supplierInfo.setGuaranteeEnterprise(guarantee);
         }
         return supplierInfo;
@@ -626,16 +665,19 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
 
     @Override
     public SupplierApprovalFirst measurement(SupplierInfo supplierInfo) {
-        SupplierApprovalFirst supplierApprovalFirst = new SupplierApprovalFirst();
+        SupplierApprovalFirst supplierApprovalFirst = supplierInfo.getSupplierApprovalFirst();
+        if (supplierApprovalFirst == null) {
+            supplierApprovalFirst = new SupplierApprovalFirst();
+        }
         supplierApprovalFirst.setcSupplierInfoId(supplierInfo.getId());
         supplierApprovalFirst.setcSupplierInfoHistoryId(supplierInfo.getHistoryId());
         //企业审核信息
         Enterprise enterprise = supplierInfo.getEnterprise();
-        measurementCount(enterprise,supplierApprovalFirst,true);
+        measurementCount(enterprise, supplierApprovalFirst, true);
         //担保企业审核信息
         Enterprise guaranteeEnterprise = supplierInfo.getGuaranteeEnterprise();
-        if(guaranteeEnterprise != null){
-            measurementCount(guaranteeEnterprise,supplierApprovalFirst,false);
+        if (guaranteeEnterprise != null) {
+            measurementCount(guaranteeEnterprise, supplierApprovalFirst, false);
         }
         return supplierApprovalFirst;
     }
@@ -643,172 +685,174 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
     private void measurementCount(Enterprise enterprise, SupplierApprovalFirst supplierApprovalFirst, boolean flag) {
         long count = 0L;
         List<CreditSituation> creditSituations = enterprise.getCreditSituations();
-        if(CollectionUtil.isNotEmpty(creditSituations)){
+        if (CollectionUtil.isNotEmpty(creditSituations)) {
             for (CreditSituation creditSituation : creditSituations) {
-                creditSituation.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
-                creditSituationService.lambdaUpdate()
-                        .eq(CreditSituation::getcCreditInvestigationInfoHistoryId,creditSituation.getcCreditInvestigationInfoHistoryId())
-                        .eq(CreditSituation::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId()).remove();
-                creditSituationService.save(creditSituation);
+//                creditSituation.setSupplierApprovalFirstId(supplierApprovalFirst.getId());
+//                creditSituationService.lambdaUpdate()
+//                        .eq(CreditSituation::getcCreditInvestigationInfoHistoryId,creditSituation.getcCreditInvestigationInfoHistoryId())
+//                        .eq(CreditSituation::getSupplierApprovalFirstId,supplierApprovalFirst.getId()).remove();
+//                creditSituationService.save(creditSituation);
                 //近两年发生过逾期的账户数≥3且合计金额≥5000元
-                if(creditSituation.getNumberOfOverdueAccounts() >= 3 && creditSituation.getTotalOverdueAmount().compareTo(new BigDecimal(5000)) > -1){
-                    count ++;
+                if (creditSituation.getNumberOfOverdueAccounts() >= 3 && creditSituation.getTotalOverdueAmount().compareTo(new BigDecimal(5000)) > -1) {
+                    count++;
                 }
                 //发生过90天以上逾期的账户数≥1
-                if(creditSituation.getOverdue() >= 1){
-                    count ++;
+                if (creditSituation.getOverdue() >= 1) {
+                    count++;
                 }
                 //近两年贷款、信用卡连续逾期月数>2个月且近两年逾期还款记录累计次数>5次
-                if(creditSituation.getConsecutiveOverdueMonth() > 2 && creditSituation.getAccumulatedOverdueTimes() > 5){
-                    count ++;
+                if (creditSituation.getConsecutiveOverdueMonth() > 2 && creditSituation.getAccumulatedOverdueTimes() > 5) {
+                    count++;
                 }
-                if(creditSituation.getBadRecords().equals(1)){
-                    count ++;
+                if (creditSituation.getBadRecords().equals(1)) {
+                    count++;
                 }
             }
         }
         CorporateGoodwill corporateGoodwill = enterprise.getCorporateGoodwill();
-        corporateGoodwill.setcEnterpriseId(enterprise.getId());
-        corporateGoodwill.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
-        if(corporateGoodwill.getRecoveredBalance().equals(1)){
-            count ++;
-        }
-        if(corporateGoodwill.getConcernedAccountsWithOutstandingCredit().equals(1)){
-            count ++;
-        }
-        if(corporateGoodwill.getOutstandingNonPerformingAccounts().equals(1)){
-            count ++;
-        }
-        corporateGoodwillService.lambdaUpdate().eq(CorporateGoodwill::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
-                        .eq(CorporateGoodwill::getcEnterpriseId,enterprise.getId()).remove();
-        corporateGoodwillService.save(corporateGoodwill);
-        privateLendingService.lambdaUpdate().eq(PrivateLending::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
-                .eq(PrivateLending::getcEnterpriseId,enterprise.getId()).remove();
+//        corporateGoodwill.setcEnterpriseId(enterprise.getId());
+//        corporateGoodwill.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
+        if (corporateGoodwill.getRecoveredBalance().equals(1)) {
+            count++;
+        }
+        if (corporateGoodwill.getConcernedAccountsWithOutstandingCredit().equals(1)) {
+            count++;
+        }
+        if (corporateGoodwill.getOutstandingNonPerformingAccounts().equals(1)) {
+            count++;
+        }
+//        corporateGoodwillService.lambdaUpdate().eq(CorporateGoodwill::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
+//                        .eq(CorporateGoodwill::getcEnterpriseId,enterprise.getId()).remove();
+//        corporateGoodwillService.save(corporateGoodwill);
+//        privateLendingService.lambdaUpdate().eq(PrivateLending::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
+//                .eq(PrivateLending::getcEnterpriseId,enterprise.getId()).remove();
         List<PrivateLending> privateLendings = enterprise.getPrivateLendings();
-        if(CollectionUtil.isNotEmpty(privateLendings)){
+        if (CollectionUtil.isNotEmpty(privateLendings)) {
             for (PrivateLending privateLending : privateLendings) {
-                privateLending.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
-                privateLending.setcEnterpriseId(enterprise.getId());
-                privateLendingService.save(privateLending);
-                if(privateLending.getPrivateLending().equals(1)){
-                    count ++;
+//                privateLending.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
+//                privateLending.setcEnterpriseId(enterprise.getId());
+//                privateLendingService.save(privateLending);
+                if (privateLending.getPrivateLending().equals(1)) {
+                    count++;
                 }
             }
         }
-        seriousIllegalityService.lambdaUpdate().eq(SeriousIllegality::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
-                .eq(SeriousIllegality::getcEnterpriseId,enterprise.getId()).remove();
+//        seriousIllegalityService.lambdaUpdate().eq(SeriousIllegality::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
+//                .eq(SeriousIllegality::getcEnterpriseId,enterprise.getId()).remove();
         List<SeriousIllegality> seriousIllegalities = enterprise.getSeriousIllegalities();
-        if(CollectionUtil.isNotEmpty(seriousIllegalities)){
+        if (CollectionUtil.isNotEmpty(seriousIllegalities)) {
             for (SeriousIllegality seriousIllegality : seriousIllegalities) {
-                seriousIllegality.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
-                seriousIllegality.setcEnterpriseId(enterprise.getId());
-                seriousIllegalityService.save(seriousIllegality);
-                if(seriousIllegality.getSeriousIllegality().equals(1)){
-                    count ++;
+//                seriousIllegality.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
+//                seriousIllegality.setcEnterpriseId(enterprise.getId());
+//                seriousIllegalityService.save(seriousIllegality);
+                if (seriousIllegality.getSeriousIllegality().equals(1)) {
+                    count++;
                 }
             }
         }
-        taxOweNoticeService.lambdaUpdate().eq(TaxOweNotice::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
-                .eq(TaxOweNotice::getcEnterpriseId,enterprise.getId()).remove();
+//        taxOweNoticeService.lambdaUpdate().eq(TaxOweNotice::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
+//                .eq(TaxOweNotice::getcEnterpriseId,enterprise.getId()).remove();
         List<TaxOweNotice> taxOweNotices = enterprise.getTaxOweNotices();
-        if(CollectionUtil.isNotEmpty(taxOweNotices)){
+        if (CollectionUtil.isNotEmpty(taxOweNotices)) {
             for (TaxOweNotice taxOweNotice : taxOweNotices) {
-                taxOweNotice.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
-                taxOweNotice.setcEnterpriseId(enterprise.getId());
-                taxOweNoticeService.save(taxOweNotice);
-                if(taxOweNotice.getTaxOweNotice().equals(1)){
-                    count ++;
+//                taxOweNotice.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
+//                taxOweNotice.setcEnterpriseId(enterprise.getId());
+//                taxOweNoticeService.save(taxOweNotice);
+                if (taxOweNotice.getTaxOweNotice().equals(1)) {
+                    count++;
                 }
             }
         }
-        taxIllegalDataService.lambdaUpdate().eq(TaxIllegalData::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
-                .eq(TaxIllegalData::getcEnterpriseId,enterprise.getId()).remove();
+//        taxIllegalDataService.lambdaUpdate().eq(TaxIllegalData::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
+//                .eq(TaxIllegalData::getcEnterpriseId,enterprise.getId()).remove();
         List<TaxIllegalData> taxIllegalData = enterprise.getTaxIllegalData();
-        if(CollectionUtil.isNotEmpty(taxIllegalData)){
+        if (CollectionUtil.isNotEmpty(taxIllegalData)) {
             for (TaxIllegalData taxIllegalDatum : taxIllegalData) {
-                taxIllegalDatum.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
-                taxIllegalDatum.setcEnterpriseId(enterprise.getId());
-                taxIllegalDataService.save(taxIllegalDatum);
-                if(taxIllegalDatum.getTaxIllegal().equals(1)){
-                    count ++;
+//                taxIllegalDatum.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
+//                taxIllegalDatum.setcEnterpriseId(enterprise.getId());
+//                taxIllegalDataService.save(taxIllegalDatum);
+                if (taxIllegalDatum.getTaxIllegal().equals(1)) {
+                    count++;
                 }
             }
         }
-        blacklistService.lambdaUpdate().eq(Blacklist::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
-                .eq(Blacklist::getcEnterpriseId,enterprise.getId()).remove();
+//        blacklistService.lambdaUpdate().eq(Blacklist::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
+//                .eq(Blacklist::getcEnterpriseId,enterprise.getId()).remove();
         List<Blacklist> blacklists = enterprise.getBlacklists();
-        if(CollectionUtil.isNotEmpty(blacklists)){
+        if (CollectionUtil.isNotEmpty(blacklists)) {
             for (Blacklist blacklist : blacklists) {
-                blacklist.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
-                blacklist.setcEnterpriseId(enterprise.getId());
-                blacklistService.save(blacklist);
-                if(blacklist.getBlacklist().equals(1)){
-                    count ++;
+//                blacklist.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
+//                blacklist.setcEnterpriseId(enterprise.getId());
+//                blacklistService.save(blacklist);
+                if (blacklist.getBlacklist().equals(1)) {
+                    count++;
                 }
             }
         }
-        exceptionDataService.lambdaUpdate().eq(ExceptionData::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
-                .eq(ExceptionData::getcEnterpriseId,enterprise.getId()).remove();
+//        exceptionDataService.lambdaUpdate().eq(ExceptionData::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
+//                .eq(ExceptionData::getcEnterpriseId,enterprise.getId()).remove();
         List<ExceptionData> exceptionData = enterprise.getExceptionData();
-        if(CollectionUtil.isNotEmpty(exceptionData)){
+        if (CollectionUtil.isNotEmpty(exceptionData)) {
             for (ExceptionData exceptionDatum : exceptionData) {
-                exceptionDatum.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
-                exceptionDatum.setcEnterpriseId(enterprise.getId());
-                exceptionDataService.save(exceptionDatum);
-                if(exceptionDatum.getException().equals(1)){
-                    count ++;
+//                exceptionDatum.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
+//                exceptionDatum.setcEnterpriseId(enterprise.getId());
+//                exceptionDataService.save(exceptionDatum);
+                if (exceptionDatum.getException().equals(1)) {
+                    count++;
                 }
             }
         }
-        newsService.lambdaUpdate().eq(News::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
-                .eq(News::getcEnterpriseId,enterprise.getId()).remove();
+//        newsService.lambdaUpdate().eq(News::getcSupplierInfoId,supplierApprovalFirst.getcSupplierInfoId())
+//                .eq(News::getcEnterpriseId,enterprise.getId()).remove();
         List<News> news = enterprise.getNews();
-        if(CollectionUtil.isNotEmpty(news)){
+        if (CollectionUtil.isNotEmpty(news)) {
             for (News news1 : news) {
-                news1.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
-                news1.setcEnterpriseId(enterprise.getId());
-                newsService.save(news1);
-                if(news1.getNews().equals(1)){
-                    count ++;
+//                news1.setcSupplierInfoId(supplierApprovalFirst.getcSupplierInfoId());
+//                news1.setcEnterpriseId(enterprise.getId());
+//                newsService.save(news1);
+                if (news1.getNews().equals(1)) {
+                    count++;
                 }
             }
         }
-        if(flag){
+        if (flag) {
             supplierApprovalFirst.setMainEnterpriseCount(count);
-            if(count > 0 ){
+            if (count > 0) {
                 supplierApprovalFirst.setMainEnterpriseResult("未通过");
-            }else {
+            } else {
                 supplierApprovalFirst.setMainEnterpriseResult("通过");
             }
-        }else {
+        } else {
             supplierApprovalFirst.setGuaranteeEnterpriseCount(count);
-            if(count > 0 ){
+            if (count > 0) {
                 supplierApprovalFirst.setGuaranteeEnterpriseResult("未通过");
-            }else {
+            } else {
                 supplierApprovalFirst.setGuaranteeEnterpriseResult("通过");
             }
         }
     }
 
-    private void autoView(Long id, Enterprise enterprise,CEnterpriseHistory enterpriseHistory) {
+    private void autoView(SupplierInfo supplierInfo, Enterprise enterprise, CEnterpriseHistory enterpriseHistory) {
+        Long id = supplierInfo.getId();
+        Long firstReviewId = supplierInfo.getSupplierApprovalFirst().getId();
         //企业负责人征信情况
-        List<CreditSituation> creditSituations = creditSituationService.lambdaQuery().eq(CreditSituation::getcSupplierInfoId, id).list();
+        List<CreditSituation> creditSituations = creditSituationService.lambdaQuery().eq(CreditSituation::getSupplierApprovalFirstId, firstReviewId).list();
         List<CreditSituation> creditSituationsResult = new ArrayList<>();
-        if(CollectionUtil.isNotEmpty(creditSituations)){
+        if (CollectionUtil.isNotEmpty(creditSituations)) {
             for (CreditSituation creditSituation : creditSituations) {
                 CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(creditSituation.getcCreditInvestigationInfoHistoryId());
                 List<FileStorage> list = new ArrayList<>();
-                if(creditInvestigationInfoHistory.getcEnterpriseHistoryId().equals(enterpriseHistory.getId())){
+                if (creditInvestigationInfoHistory.getcEnterpriseHistoryId().equals(enterpriseHistory.getId())) {
                     //todo 填充征信报告
                     CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, creditInvestigationInfoHistory.getSocialCreditCode()).one();
-                    if(creditInfo != null){
+                    if (creditInfo != null) {
                         List<CreditDetail> creditDetails = creditDetailService.lambdaQuery()
-                                .eq(CreditDetail::getCreditId,creditInfo.getId())
+                                .eq(CreditDetail::getCreditId, creditInfo.getId())
                                 .isNotNull(CreditDetail::getCreditAddress)
                                 .orderByDesc(CreditDetail::getGmtCreate).list();
-                        if(CollectionUtil.isNotEmpty(creditDetails)){
+                        if (CollectionUtil.isNotEmpty(creditDetails)) {
                             CreditDetail creditDetail = creditDetails.get(0);
-                            if(StringUtil.isNotEmpty(creditDetail.getCreditAddress())){
+                            if (StringUtil.isNotEmpty(creditDetail.getCreditAddress())) {
                                 FileStorage creditDetailFiles = fileStorageService.get(Long.valueOf(creditDetail.getCreditAddress()));
                                 list.add(creditDetailFiles);
                             }
@@ -829,14 +873,14 @@ public class SupplierApprovalFirstServiceImpl extends ServiceImpl<SupplierApprov
         //todo 填充征信报告
         CreditInfo creditInfo = creditService.lambdaQuery().eq(CreditInfo::getCardNo, enterprise.getSocialCreditCode()).one();
         List<FileStorage> list = new ArrayList<>();
-        if(creditInfo != null){
+        if (creditInfo != null) {
             List<CreditDetail> creditDetails = creditDetailService.lambdaQuery()
-                    .eq(CreditDetail::getCreditId,creditInfo.getId())
+                    .eq(CreditDetail::getCreditId, creditInfo.getId())
                     .isNotNull(CreditDetail::getCreditAddress)
                     .orderByDesc(CreditDetail::getGmtCreate).list();
-            if(CollectionUtil.isNotEmpty(creditDetails)){
+            if (CollectionUtil.isNotEmpty(creditDetails)) {
                 CreditDetail creditDetail = creditDetails.get(0);
-                if(StringUtil.isNotEmpty(creditDetail.getCreditAddress())){
+                if (StringUtil.isNotEmpty(creditDetail.getCreditAddress())) {
                     FileStorage creditDetailFiles = fileStorageService.get(Long.valueOf(creditDetail.getCreditAddress()));
                     list.add(creditDetailFiles);
                 }

+ 7 - 1
src/main/java/com/sunxung/factoring/service/supplier/impl/SupplierApprovalSecondServiceImpl.java

@@ -145,6 +145,9 @@ public class SupplierApprovalSecondServiceImpl extends ServiceImpl<SupplierAppro
     @Autowired
     private ISysAttachmentRefService attachmentRefService;
 
+    @Autowired
+    private ISupplierApprovalFirstService supplierApprovalFirstService;
+
     @Value("${sop.getEnterpriseAreaUrl}")
     private String getEnterpriseArea;
 
@@ -545,8 +548,11 @@ public class SupplierApprovalSecondServiceImpl extends ServiceImpl<SupplierAppro
             }
             //企业负责人情况
             BigDecimal personScore;
+            SupplierApprovalFirst supplierApprovalFirst = supplierApprovalFirstService.lambdaQuery().eq(SupplierApprovalFirst::getcSupplierInfoId, supplierApprovalSecond.getcSupplierInfoId())
+                    .eq(SupplierApprovalFirst::getVisible,true)
+                    .orderByDesc(SupplierApprovalFirst::getGmtCreate).list().get(0);
             List<CreditSituation> creditSituations = creditSituationService.lambdaQuery()
-                    .eq(CreditSituation::getcSupplierInfoId, supplierApprovalSecond.getcSupplierInfoId()).list();
+                    .eq(CreditSituation::getSupplierApprovalFirstId, supplierApprovalFirst.getId()).list();
             if (CollectionUtil.isNotEmpty(creditSituations)) {
                 creditSituations = creditSituations.stream().filter(r -> {
                     CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(r.getcCreditInvestigationInfoHistoryId());

+ 7 - 2
src/main/java/com/sunxung/factoring/service/supplier/impl/SupplierInfoServiceImpl.java

@@ -207,6 +207,9 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
     @Autowired
     private FileStorageService fileStorageService;
 
+    @Autowired
+    private ISupplierApprovalFirstService supplierApprovalFirstService;
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public String startProcess(SupplierInfo supplierInfo) {
@@ -270,7 +273,7 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
             msgVariables.put(ConstantUtil.FLOWABLE_MSG_TITLE, "供应商名称:" + enterprise.getCorporateName());
             msgVariables.put(ConstantUtil.FLOWABLE_MSG_CONTENT,
                     "供应商名称为“" + enterprise.getCorporateName() + "”的供应商已进入“"
-                            + ConstantConversionUtil.flowBusinessKeyNames.get(ConstantUtil.SUPPLIER_INFO) + "—供应商审核(第步)),"
+                            + ConstantConversionUtil.flowBusinessKeyNames.get(ConstantUtil.SUPPLIER_INFO) + "—供应商审核(第步)),"
                             + ConstantUtil.FLOWABLE_MSG_ASSIGNEE);
             flowableService.completeMyTask(lastLog.getHistoricTaskId(), supplierInfo, procVariables, null, historyId, msgVariables, ConstantUtil.SUPPLIER_INFO);
             statusStr = SupplierStatusEnums.DUE_DILIGENCE_REVIEW.getCode();
@@ -737,8 +740,10 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
             Integer changes = restTemplate.getForObject(getChangesUrl, Integer.class);
             videoDueDiligence.setBasicChangeSize(changes);
             videoDueDiligence.setChangeMeasurementScore(supplierApprovalSecond.getBasicChangeScore());
+            SupplierApprovalFirst supplierApprovalFirst = supplierApprovalFirstService.lambdaQuery().eq(SupplierApprovalFirst::getcSupplierInfoId, supplierId)
+                    .eq(SupplierApprovalFirst::getVisible,true).orderByDesc(SupplierApprovalFirst::getGmtCreate).list().get(0);
             //人员信息
-            List<CreditSituation> creditSituations = creditSituationService.lambdaQuery().eq(CreditSituation::getcSupplierInfoId, supplierId).list();
+            List<CreditSituation> creditSituations = creditSituationService.lambdaQuery().eq(CreditSituation::getSupplierApprovalFirstId, supplierApprovalFirst.getId()).list();
             creditSituations = creditSituations.stream().filter(r -> {
                 CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(r.getcCreditInvestigationInfoHistoryId());
                 CEnterpriseHistory enterpriseHistoryServiceById = enterpriseHistoryService.getById(creditInvestigationInfoHistory.getcEnterpriseHistoryId());

+ 7 - 2
src/main/java/com/sunxung/factoring/service/supplier/impl/VideoDueDiligenceServiceImpl.java

@@ -174,8 +174,13 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
     @Autowired
     private FileStorageService fileStorageService;
 
+    @Autowired
+    private ISupplierApprovalFirstService supplierApprovalFirstService;
+
     @Override
     public VideoDueDiligence getVideoDueDiligence(Long supplierId) {
+        SupplierApprovalFirst supplierApprovalFirst = supplierApprovalFirstService.lambdaQuery().eq(SupplierApprovalFirst::getcSupplierInfoId, supplierId).eq(SupplierApprovalFirst::getVisible,true)
+                .orderByDesc(SupplierApprovalFirst::getGmtCreate).list().get(0);
         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());
@@ -244,7 +249,7 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
             videoDueDiligence.setChangeStandardScore(new BigDecimal("1"));
             videoDueDiligence.setChangeMeasurementScore(supplierApprovalSecond.getBasicChangeScore());
             //人员信息
-            List<CreditSituation> creditSituations = creditSituationService.lambdaQuery().eq(CreditSituation::getcSupplierInfoId, supplierId).list();
+            List<CreditSituation> creditSituations = creditSituationService.lambdaQuery().eq(CreditSituation::getSupplierApprovalFirstId, supplierApprovalFirst.getId()).list();
             creditSituations = creditSituations.stream().filter(r -> {
                 CCreditInvestigationInfoHistory creditInvestigationInfoHistory = creditInvestigationInfoHistoryService.getById(r.getcCreditInvestigationInfoHistoryId());
                 CEnterpriseHistory byId = enterpriseHistoryService.getById(creditInvestigationInfoHistory.getcEnterpriseHistoryId());
@@ -340,7 +345,7 @@ public class VideoDueDiligenceServiceImpl extends ServiceImpl<VideoDueDiligenceM
             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<CreditSituation> creditSituations =  creditSituationService.lambdaQuery().eq(CreditSituation::getSupplierApprovalFirstId, supplierApprovalFirst.getId()).list();
             List<VideoDueDiligenceShareholdersSituation> videoDueDiligenceShareholdersSituations = videoDueDiligenceShareholdersSituationService.lambdaQuery().eq(VideoDueDiligenceShareholdersSituation::getVideoDueDiligenceId, videoDueDiligence.getId()).list();
             for (CreditSituation creditSituation : creditSituations) {
                 for (VideoDueDiligenceShareholdersSituation videoDueDiligenceShareholdersSituation : videoDueDiligenceShareholdersSituations) {

+ 21 - 21
src/main/resources/application-dev.yml

@@ -119,33 +119,33 @@ flowable:
 # sop接口调用地址
 sop:
   url: http://192.168.3.6:8868
-  findCorporateGoodwillUrl: http://localhost:8868/api/trade/corporateGoodwill
-  getScopeUrl: http://localhost:8868/api/trade/getScope
-  getChangesUrl: http://localhost:8868/api/trade/getChanges
-  dongjiangaoRisksUrl: http://localhost:8868/api/trade/dongjiangaoRiskById
-  getBusinesssScoreUrl: http://localhost:8868/api/trade/getBusinesssScore
-  pubStockUrl: http://localhost:8868/api/trade/pubStock
-  getIndustryUrl: http://localhost:8868/api/trade/getIndustry
-  getProjectReviewInfoUrl: http://localhost:8868/api/trade/getProjectReviewInfo
-  getProjectCoreEnterpriseScoreUrl: http://localhost:8868/api/trade/getProjectCoreEnterpriseScore
-  reviewResolutionReportUrl: http://localhost:8868/api/trade/reviewResolution/report
-  getEnterpriseAreaUrl: http://localhost:8868/api/trade/getEnterpriseArea
+  findCorporateGoodwillUrl: http://192.168.3.6:8868/api/trade/corporateGoodwill
+  getScopeUrl: http://192.168.3.6:8868/api/trade/getScope
+  getChangesUrl: http://192.168.3.6:8868/api/trade/getChanges
+  dongjiangaoRisksUrl: http://192.168.3.6:8868/api/trade/dongjiangaoRiskById
+  getBusinesssScoreUrl: http://192.168.3.6:8868/api/trade/getBusinesssScore
+  pubStockUrl: http://192.168.3.6:8868/api/trade/pubStock
+  getIndustryUrl: http://192.168.3.6:8868/api/trade/getIndustry
+  getProjectReviewInfoUrl: http://192.168.3.6:8868/api/trade/getProjectReviewInfo
+  getProjectCoreEnterpriseScoreUrl: http://192.168.3.6:8868/api/trade/getProjectCoreEnterpriseScore
+  reviewResolutionReportUrl: http://192.168.3.6:8868/api/trade/reviewResolution/report
+  getEnterpriseAreaUrl: http://192.168.3.6:8868/api/trade/getEnterpriseArea
   getBusinessByKeyWordUrl: http://192.168.3.6:8868/api/trade/findBusinessName
   getFlushUrl: http://192.168.3.6:8868/sys/customer/flushByTrade/url
   getEnterpriseInfoUrl: http://192.168.3.6:8868/sys/customer/getEnterpriseInfoByTrade
   synchronizeDownloadFile: http://192.168.3.6:8868/synchronize/factoringContractTemplate/fileStorage/downloadFile
   synchronizeInformation: http://192.168.3.6:8868/sys/customer/synchronize/information
-  getPaymentCollBasicStatus: http://localhost:8868/api/trade/findStatusListByContractNoAndBatch
+  getPaymentCollBasicStatus: http://192.168.3.6:8868/api/trade/findStatusListByContractNoAndBatch
   getBusinessNoByTrade: http://192.168.3.6:8868/api/trade/quotaDisburseReport/getBusinessNoByTrade
-  judgeOverdueBySocialCreditCode: http://localhost:8868/api/trade/judgeOverdueBySocialCreditCode
-  getPaymentCollBasicOneStatus: http://localhost:8868/api/trade/findStatusByContractNoAndBatch
-  underlyingAssetsBasicId: http://localhost:8868/api/underlyingAssetsBasic/findBySocialCreditCode
-  underlyingAssetsDomesticAdd: http://localhost:8868/api/underlyingAssetsDomestic/add
-  domesticAccountsReceivableAdd: http://localhost:8868/api/domesticAccountsReceivable/add
-  quotaDisburseReportUrl: http://localhost:8868/api/quotaDisburse/report
-  addBusinessUrl: http://localhost:8868/api/trade/addBusiness
-  getAllOACompanyEntityUrl: http://localhost:8868/api/trade/getAllOACompanyEntity
-  applyOtherOAUrl: http://localhost:8868/api/trade/applyOtherOA
+  judgeOverdueBySocialCreditCode: http://192.168.3.6:8868/api/trade/judgeOverdueBySocialCreditCode
+  getPaymentCollBasicOneStatus: http://192.168.3.6:8868/api/trade/findStatusByContractNoAndBatch
+  underlyingAssetsBasicId: http://192.168.3.6:8868/api/underlyingAssetsBasic/findBySocialCreditCode
+  underlyingAssetsDomesticAdd: http://192.168.3.6:8868/api/underlyingAssetsDomestic/add
+  domesticAccountsReceivableAdd: http://192.168.3.6:8868/api/domesticAccountsReceivable/add
+  quotaDisburseReportUrl: http://192.168.3.6:8868/api/quotaDisburse/report
+  addBusinessUrl: http://192.168.3.6:8868/api/trade/addBusiness
+  getAllOACompanyEntityUrl: http://192.168.3.6:8868/api/trade/getAllOACompanyEntity
+  applyOtherOAUrl: http://192.168.3.6:8868/api/trade/applyOtherOA
 
 fdd:
   contractUrl: "http://192.168.125.194:8888/#/register"

+ 1 - 1
src/main/resources/application.yml

@@ -1,4 +1,4 @@
 #环境配置
 spring:
   profiles:
-    active: dev
+    active: prod