Selaa lähdekoodia

申请融资增加筛选

liuj 6 kuukautta sitten
vanhempi
commit
ca91ff39ac

+ 7 - 0
src/main/java/com/inkasso/factoring/creditmanagement/dao/ProjectInformationMapper.java

@@ -22,4 +22,11 @@ public interface ProjectInformationMapper extends BaseMapper<ProjectInformation>
 
     List<ProjectInformation> getLocalPurchCompletedProject(Long userId);
 
+    /**
+     * 查询指定用户下授信决议已通过采购合同已完成的所有项目
+     *
+     * @param userId
+     * @return
+     */
+    List<ProjectInformation> getLocalCreditResolutionCompletedProject(Long userId);
 }

+ 7 - 1
src/main/java/com/inkasso/factoring/creditmanagement/service/IProjectInformationService.java

@@ -48,6 +48,13 @@ public interface IProjectInformationService extends IService<ProjectInformation>
      */
     List<ProjectInformation> getLocalPurchCompletedProject();
 
+    /**
+     * 查询授信决议已通过采购合同已完成的所有项目
+     *
+     * @return
+     */
+    List<ProjectInformation> getLocalCreditResolutionCompletedProject();
+
     /**
      * 根据供应商id获取该供应商下的全部项目
      * @param supplierId
@@ -61,5 +68,4 @@ public interface IProjectInformationService extends IService<ProjectInformation>
      * @return
      */
     ProjectInformation getDetail(Long id);
-
 }

+ 127 - 114
src/main/java/com/inkasso/factoring/creditmanagement/service/impl/ProjectInformationServiceImpl.java

@@ -1,6 +1,5 @@
 package com.inkasso.factoring.creditmanagement.service.impl;
 
-import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -9,7 +8,6 @@ import com.inkasso.adapter.util.CodeUtil;
 import com.inkasso.adapter.util.CollectionUtil;
 import com.inkasso.adapter.util.StringUtil;
 import com.inkasso.adapter.web.LoginUserHolder;
-import com.inkasso.auth.exception.ValidatorException;
 import com.inkasso.factoring.common.constant.ConstantUtil;
 import com.inkasso.factoring.common.entity.ResponseJson;
 import com.inkasso.factoring.common.service.SerialNumberGenerator;
@@ -26,17 +24,14 @@ import com.inkasso.factoring.file.enums.FileTypeEnum;
 import com.inkasso.factoring.file.service.FileService;
 import com.inkasso.factoring.purchManagement.dao.CPurchContractManagementMapper;
 import com.inkasso.factoring.purchManagement.entity.vo.PurchContractCompletedVo;
-import com.inkasso.factoring.purchManagement.service.ICPurchContractManagementService;
 import com.inkasso.factoring.system.user.entity.UserDO;
 import com.inkasso.factoring.system.user.service.UserService;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
-import org.apache.xpath.operations.Bool;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.client.RestTemplate;
@@ -139,7 +134,7 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
         projectInformation.setBusinessNumber(businessNumber);
         //业主方
         Enterprise enterprise = projectInformation.getEnterprise();
-        if(enterprise != null){
+        if (enterprise != null) {
             Enterprise existEnterprise = enterpriseService.lambdaQuery().eq(Enterprise::getSocialCreditCode, enterprise.getSocialCreditCode()).one();
             if (existEnterprise != null) {
                 enterprise = existEnterprise;
@@ -166,10 +161,10 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
             projectCore.setcEnterpriseId(coreEnterprise.getId());
         }
         projectCoreEnterpriseService.save(projectCore);
-        if(enterprise != null){
+        if (enterprise != null) {
             //业主方企查查
             List<String> errors = qichacha(projectInformation, enterprise, null);
-            if(CollectionUtil.isNotEmpty(errors)){
+            if (CollectionUtil.isNotEmpty(errors)) {
                 String errorsString = errors.stream().collect(Collectors.joining(","));
                 projectInformation.setErrorsString(errorsString);
             }
@@ -183,12 +178,12 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
         }
         //核心企业企查查
         List<String> coreErrors = qichacha(null, coreEnterprise, projectCore);
-        if(CollectionUtil.isNotEmpty(coreErrors)){
+        if (CollectionUtil.isNotEmpty(coreErrors)) {
             String errorsString = coreErrors.stream().collect(Collectors.joining(","));
             projectCore.setErrorsString(errorsString);
         }
         coreEnterprise.setErrors(coreErrors);
-        if(enterprise == null){
+        if (enterprise == null) {
             String status = projectCore.getStatus();
             projectInformation.setStatus(status);
             updateById(projectInformation);
@@ -215,14 +210,14 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
                 .eq(FileStorageDO::getBusinessType, FileTypeEnum.PROJECT_DEPARTMENT_FILE.getCode()).list();
         projectInformation.setBiddingFiles(biddingFiles);
         projectInformation.setDepartmentFiles(departmentFiles);
-        if(projectInformation.getcEnterpriseId() != null){
+        if (projectInformation.getcEnterpriseId() != null) {
             Enterprise ownerEnterprise = enterpriseService.getById(projectInformation.getcEnterpriseId());
             projectInformation.setEnterprise(ownerEnterprise);
         }
         ProjectCoreEnterprise projectCoreEnterprise = projectCoreEnterpriseService.lambdaQuery().eq(ProjectCoreEnterprise::getcProjectInformationId, id).one();
         Enterprise enterprise = enterpriseService.getById(projectCoreEnterprise.getcEnterpriseId());
         List<ProjectCoreEnterpriseFile> projectCoreEnterpriseFiles = projectCoreEnterpriseFileService.lambdaQuery().eq(ProjectCoreEnterpriseFile::getcProjectCoreEnterpriseId, projectCoreEnterprise.getId()).list();
-        if(CollectionUtil.isNotEmpty(projectCoreEnterpriseFiles)){
+        if (CollectionUtil.isNotEmpty(projectCoreEnterpriseFiles)) {
             for (ProjectCoreEnterpriseFile projectCoreEnterpriseFile : projectCoreEnterpriseFiles) {
                 List<FileStorageDO> fileStorageDOS = fileService.findByBusinessId(projectCoreEnterpriseFile.getId(), FileTypeEnum.PROJECT_CORE_ENTERPRISE_FILE.getCode());
                 projectCoreEnterpriseFile.setFileStorageDOS(fileStorageDOS);
@@ -239,29 +234,29 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
     public void supplement(ProjectInformation projectInformation) {
         //补充项目信息
         String status = getById(projectInformation.getId()).getStatus();
-        if(!status.equals(ProjectAndEnterpriseStatusEnums.VOTE.getCode())){
+        if (!status.equals(ProjectAndEnterpriseStatusEnums.VOTE.getCode())) {
             updateById(projectInformation);
-            fileService.lambdaUpdate().eq(FileStorageDO::getBusinessId,projectInformation.getId())
+            fileService.lambdaUpdate().eq(FileStorageDO::getBusinessId, projectInformation.getId())
                     .eq(FileStorageDO::getBusinessType, FileTypeEnum.PROJECT_BIDDING_FILE.getCode())
-                    .set(FileStorageDO::getBusinessId,null).update();
+                    .set(FileStorageDO::getBusinessId, null).update();
             //保存文件
             List<Long> files = projectInformation.getBiddingFileIds();
-            fileService.updateBusinessId(files,projectInformation.getId());
-            fileService.lambdaUpdate().eq(FileStorageDO::getBusinessId,projectInformation.getId())
-                    .eq(FileStorageDO::getBusinessType,FileTypeEnum.PROJECT_DEPARTMENT_FILE.getCode())
-                    .set(FileStorageDO::getBusinessId,null).update();
+            fileService.updateBusinessId(files, projectInformation.getId());
+            fileService.lambdaUpdate().eq(FileStorageDO::getBusinessId, projectInformation.getId())
+                    .eq(FileStorageDO::getBusinessType, FileTypeEnum.PROJECT_DEPARTMENT_FILE.getCode())
+                    .set(FileStorageDO::getBusinessId, null).update();
             //保存文件
             List<Long> departmentFileIds = projectInformation.getDepartmentFileIds();
-            fileService.updateBusinessId(departmentFileIds,projectInformation.getId());
+            fileService.updateBusinessId(departmentFileIds, projectInformation.getId());
         }
         //补充核心企业信息
         String coreStatus = null;
         ProjectCoreEnterprise projectCoreEnterprise = projectInformation.getProjectCoreEnterprise();
-        if(projectCoreEnterprise != null){
+        if (projectCoreEnterprise != null) {
             coreStatus = projectCoreEnterpriseService.getById(projectCoreEnterprise.getId()).getStatus();
-            if(!coreStatus.equals(ProjectAndEnterpriseStatusEnums.VOTE.getCode())){
+            if (!coreStatus.equals(ProjectAndEnterpriseStatusEnums.VOTE.getCode())) {
                 projectCoreEnterpriseService.updateById(projectCoreEnterprise);
-                if(projectCoreEnterprise.getHistoricalCooperation() != null && projectCoreEnterprise.getHistoricalCooperation() == 1){
+                if (projectCoreEnterprise.getHistoricalCooperation() != null && projectCoreEnterprise.getHistoricalCooperation() == 1) {
                     //历史合作资料 先删后增
                     projectCoreEnterpriseFileService.lambdaUpdate().eq(ProjectCoreEnterpriseFile::getcProjectCoreEnterpriseId, projectCoreEnterprise.getId()).remove();
                     List<ProjectCoreEnterpriseFile> projectCoreEnterpriseFiles = projectCoreEnterprise.getProjectCoreEnterpriseFiles();
@@ -270,46 +265,46 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
                         projectCoreEnterpriseFileService.save(projectCoreEnterpriseFile);
                         //保存文件
                         List<Long> fileIds = projectCoreEnterpriseFile.getFileIds();
-                        if(CollectionUtil.isNotEmpty(fileIds)){
-                            fileService.updateBusinessId(fileIds,projectCoreEnterpriseFile.getId());
+                        if (CollectionUtil.isNotEmpty(fileIds)) {
+                            fileService.updateBusinessId(fileIds, projectCoreEnterpriseFile.getId());
                         }
                     }
                 }
             }
         }
         Boolean visible = projectInformation.getVisible();
-        if(visible){
+        if (visible) {
             ProjectInformation existsProject = getById(projectInformation.getId());
             SupplierInfo supplierInfo = supplierInfoService.getById(existsProject.getcSupplierInfoId());
             Long sysUserId = supplierInfo.getSysUserId();
             UserDO userDO = userService.getById(sysUserId);
             Long riskManagerId = userDO.getRiskManager();
-            if(riskManagerId == null){
-                throw new ServiceException(CodeUtil.FAIL,"请联系客服分配风控经理!");
+            if (riskManagerId == null) {
+                throw new ServiceException(CodeUtil.FAIL, "请联系客服分配风控经理!");
             }
-            if(userDO.getProjectManager() == null){
-                throw new ServiceException(CodeUtil.FAIL,"请联系客服分配业务经理!");
+            if (userDO.getProjectManager() == null) {
+                throw new ServiceException(CodeUtil.FAIL, "请联系客服分配业务经理!");
             }
             existsProject.setRiskManagerId(riskManagerId);
-            if(!status.equals(ProjectAndEnterpriseStatusEnums.VOTE.getCode())){
-                BigDecimal financialFunds = projectInformation.getFinancialFunds() == null? BigDecimal.ZERO : projectInformation.getFinancialFunds();
-                BigDecimal bankLoans = projectInformation.getBankLoans() == null? BigDecimal.ZERO : projectInformation.getBankLoans();
-                BigDecimal foreignCapital = projectInformation.getForeignCapital() == null? BigDecimal.ZERO : projectInformation.getForeignCapital();
-                BigDecimal raiseIndependently = projectInformation.getRaiseIndependently() == null? BigDecimal.ZERO : projectInformation.getRaiseIndependently();
-                BigDecimal specialFund = projectInformation.getSpecialFund() == null? BigDecimal.ZERO : projectInformation.getSpecialFund();
-                BigDecimal otherFunds = projectInformation.getOtherFunds() == null? BigDecimal.ZERO : projectInformation.getOtherFunds();
-                BigDecimal unknown = projectInformation.getUnknown() == null? BigDecimal.ZERO : projectInformation.getUnknown();
+            if (!status.equals(ProjectAndEnterpriseStatusEnums.VOTE.getCode())) {
+                BigDecimal financialFunds = projectInformation.getFinancialFunds() == null ? BigDecimal.ZERO : projectInformation.getFinancialFunds();
+                BigDecimal bankLoans = projectInformation.getBankLoans() == null ? BigDecimal.ZERO : projectInformation.getBankLoans();
+                BigDecimal foreignCapital = projectInformation.getForeignCapital() == null ? BigDecimal.ZERO : projectInformation.getForeignCapital();
+                BigDecimal raiseIndependently = projectInformation.getRaiseIndependently() == null ? BigDecimal.ZERO : projectInformation.getRaiseIndependently();
+                BigDecimal specialFund = projectInformation.getSpecialFund() == null ? BigDecimal.ZERO : projectInformation.getSpecialFund();
+                BigDecimal otherFunds = projectInformation.getOtherFunds() == null ? BigDecimal.ZERO : projectInformation.getOtherFunds();
+                BigDecimal unknown = projectInformation.getUnknown() == null ? BigDecimal.ZERO : projectInformation.getUnknown();
                 BigDecimal total = financialFunds.add(bankLoans).add(foreignCapital).add(raiseIndependently).add(specialFund).add(otherFunds).add(unknown);
-                if(total.compareTo(new BigDecimal(100)) != 0){
-                    throw new ServiceException(CodeUtil.FAIL,"资金来源及占比加和必须等于100");
+                if (total.compareTo(new BigDecimal(100)) != 0) {
+                    throw new ServiceException(CodeUtil.FAIL, "资金来源及占比加和必须等于100");
                 }
                 //保存项目信息历史
                 CProjectInformationHistory cProjectInformationHistory = new CProjectInformationHistory();
-                BeanUtils.copyProperties(existsProject,cProjectInformationHistory,"id");
+                BeanUtils.copyProperties(existsProject, cProjectInformationHistory, "id");
                 projectInformationHistoryService.save(cProjectInformationHistory);
                 //保存文件历史
                 List<Long> files = projectInformation.getBiddingFileIds();
-                if(CollectionUtil.isNotEmpty(files)){
+                if (CollectionUtil.isNotEmpty(files)) {
                     for (Long file : files) {
                         FileStorageDO fileStorageDO = fileService.getById(file);
                         fileStorageDO.setId(null);
@@ -320,7 +315,7 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
                 }
                 //保存文件历史
                 List<Long> departmentFileIds = projectInformation.getDepartmentFileIds();
-                if(CollectionUtil.isNotEmpty(departmentFileIds)){
+                if (CollectionUtil.isNotEmpty(departmentFileIds)) {
                     for (Long file : departmentFileIds) {
                         FileStorageDO fileStorageDO = fileService.getById(file);
                         fileStorageDO.setId(null);
@@ -329,13 +324,13 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
                         fileService.save(fileStorageDO);
                     }
                 }
-                if(existsProject.getcEnterpriseId() != null){
+                if (existsProject.getcEnterpriseId() != null) {
                     //更改项目状态
                     projectInformation.setStatus(ProjectAndEnterpriseStatusEnums.DUE_DILIGENCE_REVIEW.getCode());
                     updateById(projectInformation);
                     //开启B端流程
                     existsProject.setHistoryId(cProjectInformationHistory.getId());
-                    if(projectCoreEnterprise != null && projectCoreEnterprise.getId() != null){
+                    if (projectCoreEnterprise != null && projectCoreEnterprise.getId() != null) {
                         ProjectCoreEnterprise existsProjectCoreEnterprise = projectCoreEnterpriseService.getById(projectCoreEnterprise.getId());
                         Enterprise existsEnterprise = enterpriseService.getById(existsProjectCoreEnterprise.getcEnterpriseId());
                         existsProjectCoreEnterprise.setEnterprise(existsEnterprise);
@@ -344,37 +339,37 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
                     Enterprise existsProjectEnterprise = enterpriseService.getById(existsProject.getcEnterpriseId());
                     existsProject.setEnterprise(existsProjectEnterprise);
                     try {
-                        restTemplate.postForObject(startProjectProcess,existsProject,ResponseJson.class);
-                    }catch (Exception e){
-                        throw new ServiceException(CodeUtil.FAIL,"网络异常,请稍后重试!");
+                        restTemplate.postForObject(startProjectProcess, existsProject, ResponseJson.class);
+                    } catch (Exception e) {
+                        throw new ServiceException(CodeUtil.FAIL, "网络异常,请稍后重试!");
                     }
                 }
             }
-            if(coreStatus != null && !coreStatus.equals(ProjectAndEnterpriseStatusEnums.VOTE.getCode())){
+            if (coreStatus != null && !coreStatus.equals(ProjectAndEnterpriseStatusEnums.VOTE.getCode())) {
                 //保存核心企业历史
                 CProjectCoreEnterpriseHistory cProjectCoreEnterpriseHistory = new CProjectCoreEnterpriseHistory();
                 ProjectCoreEnterprise existsProjectCoreEnterprise = projectCoreEnterpriseService.getById(projectCoreEnterprise.getId());
-                BeanUtils.copyProperties(existsProjectCoreEnterprise,cProjectCoreEnterpriseHistory,"id");
+                BeanUtils.copyProperties(existsProjectCoreEnterprise, cProjectCoreEnterpriseHistory, "id");
                 projectCoreEnterpriseHistoryService.save(cProjectCoreEnterpriseHistory);
-                if(projectCoreEnterprise.getHistoricalCooperation() == 1){
+                if (projectCoreEnterprise.getHistoricalCooperation() == 1) {
                     //历史合作资料 历史
                     List<ProjectCoreEnterpriseFile> projectCoreEnterpriseFiles = projectCoreEnterprise.getProjectCoreEnterpriseFiles();
                     for (ProjectCoreEnterpriseFile projectCoreEnterpriseFile : projectCoreEnterpriseFiles) {
                         CProjectCoreEnterpriseFileHistory cProjectCoreEnterpriseFileHistory = new CProjectCoreEnterpriseFileHistory();
-                        BeanUtils.copyProperties(projectCoreEnterpriseFile,cProjectCoreEnterpriseFileHistory);
+                        BeanUtils.copyProperties(projectCoreEnterpriseFile, cProjectCoreEnterpriseFileHistory);
                         cProjectCoreEnterpriseFileHistory.setcProjectCoreEnterpriseId(cProjectCoreEnterpriseHistory.getId());
                         projectCoreEnterpriseFileHistoryService.save(cProjectCoreEnterpriseFileHistory);
                         List<Long> fileIds = projectCoreEnterpriseFile.getFileIds();
-                        if(CollectionUtil.isNotEmpty(fileIds)){
+                        if (CollectionUtil.isNotEmpty(fileIds)) {
                             for (Long fileId : fileIds) {
                                 FileStorageDO fileStorageDO = fileService.getById(fileId);
                                 FileStorageDO fileStorageDOHistory = new FileStorageDO();
-                                BeanUtils.copyProperties(fileStorageDO,fileStorageDOHistory,"id");
+                                BeanUtils.copyProperties(fileStorageDO, fileStorageDOHistory, "id");
                                 fileStorageDOHistory.setBusinessType(FileTypeEnum.PROJECT_CORE_ENTERPRISE_FILE_HISTORY.getCode());
                                 fileStorageDOHistory.setBusinessId(cProjectCoreEnterpriseFileHistory.getId());
                                 fileService.save(fileStorageDOHistory);
                             }
-                            fileService.updateBusinessId(fileIds,projectCoreEnterpriseFile.getId());
+                            fileService.updateBusinessId(fileIds, projectCoreEnterpriseFile.getId());
                         }
                     }
                 }
@@ -384,25 +379,25 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
                 //判断3个月内是否授信过  如果是就无需再次授信
                 List<ProjectCoreEnterprise> list = projectCoreEnterpriseService.lambdaQuery()
                         .eq(ProjectCoreEnterprise::getcEnterpriseId, existsProjectCoreEnterprise.getcEnterpriseId())
-                        .eq(ProjectCoreEnterprise::getStatus,ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode())
+                        .eq(ProjectCoreEnterprise::getStatus, ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode())
                         .orderByDesc(ProjectCoreEnterprise::getGmtCreate).list();
-                Boolean start ;
-                if(CollectionUtil.isNotEmpty(list)){
+                Boolean start;
+                if (CollectionUtil.isNotEmpty(list)) {
                     ProjectCoreEnterprise old = list.get(0);
                     Date dateTime = DateUtil.offsetMonth(old.getGmtCreate(), 3);
-                    if(dateTime.compareTo(new Date()) == 1){
+                    if (dateTime.compareTo(new Date()) == 1) {
                         start = false;
                         projectCoreEnterprise.setProcess(0);
                         projectCoreEnterprise.setOldCoreEnterpriseId(old.getId());
                         projectCoreEnterprise.setStatus(ProjectAndEnterpriseStatusEnums.CREDIT_SUCCESS.getCode());
                         projectCoreEnterpriseService.updateById(projectCoreEnterprise);
-                    }else {
+                    } else {
                         start = true;
                     }
-                }else {
+                } else {
                     start = true;
                 }
-                if(start){
+                if (start) {
                     //开启B端流程
                     Enterprise existsProjectEnterprise = enterpriseService.getById(existsProject.getcEnterpriseId());
                     existsProject.setEnterprise(existsProjectEnterprise);
@@ -411,9 +406,9 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
                     existsProjectCoreEnterprise.setHistoryId(cProjectCoreEnterpriseHistory.getId());
                     existsProject.setProjectCoreEnterprise(existsProjectCoreEnterprise);
                     try {
-                        restTemplate.postForObject(startProjectCoreEnterpriseProcess,existsProject,ResponseJson.class);
-                    }catch (Exception e){
-                        throw new ServiceException(CodeUtil.FAIL,"网络异常,请稍后重试!");
+                        restTemplate.postForObject(startProjectCoreEnterpriseProcess, existsProject, ResponseJson.class);
+                    } catch (Exception e) {
+                        throw new ServiceException(CodeUtil.FAIL, "网络异常,请稍后重试!");
                     }
                 }
             }
@@ -423,18 +418,16 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
     @Override
     public List<ProjectInformation> getLocalPurchCompletedProject() {
         List<ProjectInformation> localPurchCompletedProject = baseMapper.getLocalPurchCompletedProject(
-            LoginUserHolder.get().getId());
-        if(CollectionUtil.isNotEmpty(localPurchCompletedProject)){
-            for(ProjectInformation p:localPurchCompletedProject){
-//                PurchContractCompletedVo completedPurchContractByBusinessNumber = purchContractService.getCompletedPurchContractByBusinessNumber(
-//                    p.getBusinessNumber());
+                LoginUserHolder.get().getId());
+        if (CollectionUtil.isNotEmpty(localPurchCompletedProject)) {
+            for (ProjectInformation p : localPurchCompletedProject) {
                 PurchContractCompletedVo purchContractCompletedVo = cPurchContractManagementMapper
-                    .getCompletedPurchContractByBusinessNumber(LoginUserHolder.get().getId(), p.getBusinessNumber());
-                if(purchContractCompletedVo!=null){
+                        .getCompletedPurchContractByBusinessNumber(LoginUserHolder.get().getId(), p.getBusinessNumber());
+                if (purchContractCompletedVo != null) {
                     if (purchContractCompletedVo.getMainEnterpriseId() != null) {
                         Enterprise mainEnterprise = enterpriseService.getById(purchContractCompletedVo.getMainEnterpriseId());
                         if (mainEnterprise != null) {
-                            p.setProjectName(p.getProjectName()+"("+mainEnterprise.getCorporateName()+")");
+                            p.setProjectName(p.getProjectName() + "(" + mainEnterprise.getCorporateName() + ")");
                         }
                     }
 
@@ -444,11 +437,31 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
         return localPurchCompletedProject;
     }
 
+    @Override
+    public List<ProjectInformation> getLocalCreditResolutionCompletedProject() {
+        List<ProjectInformation> localPurchCompletedProject = baseMapper.getLocalCreditResolutionCompletedProject(LoginUserHolder.get().getId());
+        if (CollectionUtil.isNotEmpty(localPurchCompletedProject)) {
+            for (ProjectInformation p : localPurchCompletedProject) {
+                PurchContractCompletedVo purchContractCompletedVo = cPurchContractManagementMapper
+                        .getCompletedPurchContractByBusinessNumber(LoginUserHolder.get().getId(), p.getBusinessNumber());
+                if (purchContractCompletedVo != null) {
+                    if (purchContractCompletedVo.getMainEnterpriseId() != null) {
+                        Enterprise mainEnterprise = enterpriseService.getById(purchContractCompletedVo.getMainEnterpriseId());
+                        if (mainEnterprise != null) {
+                            p.setProjectName(p.getProjectName() + "(" + mainEnterprise.getCorporateName() + ")");
+                        }
+                    }
+                }
+            }
+        }
+        return localPurchCompletedProject;
+    }
+
     @Override
     public List<ProjectInformation> getProjectBySupplierId(Long supplierId) {
         List<ProjectInformation> list = lambdaQuery().eq(ProjectInformation::getcSupplierInfoId, supplierId).orderByDesc(ProjectInformation::getGmtModified).list();
-        list.forEach(r->{
-            if(r.getcEnterpriseId() != null){
+        list.forEach(r -> {
+            if (r.getcEnterpriseId() != null) {
                 Enterprise enterprise = enterpriseService.getById(r.getcEnterpriseId());
                 r.setOwnerName(enterprise.getCorporateName());
             }
@@ -474,29 +487,29 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
         projectInformation.setCoreEnterpriseStatusStr(dictionaryService.getByCode(projectCoreEnterprise.getStatus()).getName());
         projectInformation.setProjectStatusStr(dictionaryService.getByCode(projectInformation.getStatus()).getName());
         CreditResolution creditResolution = creditResolutionService.lambdaQuery().eq(CreditResolution::getcProjectInformationId, projectInformation.getId()).one();
-        if(creditResolution != null){
-            if(ProjectInitiationStatusDict.COMPLETED.getCode().equals(creditResolution.getStatusStr())){
+        if (creditResolution != null) {
+            if (ProjectInitiationStatusDict.COMPLETED.getCode().equals(creditResolution.getStatusStr())) {
                 List<CreditConclusion> creditConclusions = creditConclusionService.lambdaQuery().eq(CreditConclusion::getCreditResolutionId, creditResolution.getId()).list();
                 for (CreditConclusion creditConclusion : creditConclusions) {
-                    if(creditConclusion.getContent().startsWith("给予卖方")){
+                    if (creditConclusion.getContent().startsWith("给予卖方")) {
                         creditConclusion.setFx("/给予卖方(.*?)授信金额(.*?)元人民币/g");
                     }
-                    if(creditConclusion.getContent().startsWith("授信期限自")){
+                    if (creditConclusion.getContent().startsWith("授信期限自")) {
                         creditConclusion.setFx("/授信期限自(.+)/");
                     }
-                    if(creditConclusion.getContent().startsWith("本次合作的买方为")){
+                    if (creditConclusion.getContent().startsWith("本次合作的买方为")) {
                         creditConclusion.setFx("/本次合作的买方为(.*?),项目为(.+)/");
                     }
-                    if(creditConclusion.getContent().startsWith("利息和管理费")){
+                    if (creditConclusion.getContent().startsWith("利息和管理费")) {
                         creditConclusion.setFx("/利息和管理费由卖方支付,支付方式为([\\s\\S]*)/");
                     }
-                    if(creditConclusion.getContent().startsWith("上游账期为")){
+                    if (creditConclusion.getContent().startsWith("上游账期为")) {
                         creditConclusion.setFx("/上游账期为(.+?),保理融资期限为(.+?)账期/");
                     }
-                    if(creditConclusion.getContent().startsWith("上报卖方")){
+                    if (creditConclusion.getContent().startsWith("上报卖方")) {
                         creditConclusion.setFx("/上报卖方([\\s\\S]+?)征信/g");
                     }
-                    if(creditConclusion.getContent().startsWith("卖方法定代表人") || creditConclusion.getContent().startsWith("提供个人连带责任担保") || creditConclusion.getContent().startsWith("提供连带责任担保") ){
+                    if (creditConclusion.getContent().startsWith("卖方法定代表人") || creditConclusion.getContent().startsWith("提供个人连带责任担保") || creditConclusion.getContent().startsWith("提供连带责任担保")) {
                         creditConclusion.setFx("/卖方法定代表人([\\s\\S]*?)提供个人连带责任担保,上报([\\s\\S]*?)征信/g");
                     }
                 }
@@ -512,8 +525,8 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
      * @param projectCore        核心企业信息
      */
     private List<String> qichacha(ProjectInformation projectInformation, Enterprise enterprise, ProjectCoreEnterprise projectCore) {
-        if(StringUtils.isEmpty(enterprise.getSocialCreditCode())){
-            throw new ServiceException(CodeUtil.FAIL,enterprise.getCorporateName() + "不存在统一社会信用代码,无法进行后续授信操作!");
+        if (StringUtils.isEmpty(enterprise.getSocialCreditCode())) {
+            throw new ServiceException(CodeUtil.FAIL, enterprise.getCorporateName() + "不存在统一社会信用代码,无法进行后续授信操作!");
         }
         List<String> error = new ArrayList<>();
         //2006综合风险排查
@@ -521,8 +534,8 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
         ResponseJson comprehensiveRiskInvestigationRj;
         try {
             comprehensiveRiskInvestigationRj = restTemplate.getForObject(comprehensiveRiskInvestigationUrl, ResponseJson.class);
-        }catch (Exception e){
-            throw new ServiceException(CodeUtil.FAIL,"网络异常,请稍后重试!");
+        } catch (Exception e) {
+            throw new ServiceException(CodeUtil.FAIL, "网络异常,请稍后重试!");
         }
         JSONObject comprehensiveRiskJsonObject = new JSONObject(comprehensiveRiskInvestigationRj.getData());
         Long comprehensiveRiskInvestigationId = comprehensiveRiskJsonObject.getLong("id");
@@ -539,13 +552,13 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
         BigDecimal zhixingAmount = comprehensiveRiskJsonObject.getBigDecimal("zhixingAmount");
         enterprise.setBusinessAddress(annualAddress);
         enterprise.setRegisteredCapital(registCapi);
-        if(StringUtils.isEmpty(registCapi)){
-            throw new ServiceException(CodeUtil.FAIL,enterprise.getCorporateName() + "不存在注册资本,无法进行后续授信操作!");
+        if (StringUtils.isEmpty(registCapi)) {
+            throw new ServiceException(CodeUtil.FAIL, enterprise.getCorporateName() + "不存在注册资本,无法进行后续授信操作!");
         }
         registCapi = registCapi.replace("万元人民币", "");
         Double registCapiInt = Double.valueOf(registCapi);
         long betweenYear = 0L;
-        if(startDate != null){
+        if (startDate != null) {
             betweenYear = DateUtil.betweenYear(startDate, new Date(), false);
         }
         //企业基本变动信息
@@ -553,16 +566,16 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
         Integer changes;
         try {
             changes = restTemplate.getForObject(getChangesUrl, Integer.class);
-        }catch (Exception e){
-            throw new ServiceException(CodeUtil.FAIL,"网络异常,请稍后重试!");
+        } catch (Exception e) {
+            throw new ServiceException(CodeUtil.FAIL, "网络异常,请稍后重试!");
         }
         //887-裁判文书核查
         String judgmentDocumentsUrl = judgmentDocuments + "?socialCreditCode=" + enterprise.getSocialCreditCode() + "&comprehensiveRiskInvestigationId=" + comprehensiveRiskInvestigationId;
         ResponseJson judgmentDocumentsObject;
         try {
             judgmentDocumentsObject = restTemplate.getForObject(judgmentDocumentsUrl, ResponseJson.class);
-        }catch (Exception e){
-            throw new ServiceException(CodeUtil.FAIL,"网络异常,请稍后重试!");
+        } catch (Exception e) {
+            throw new ServiceException(CodeUtil.FAIL, "网络异常,请稍后重试!");
         }
         int judgmentDocumentsCount = (int) judgmentDocumentsObject.getData();
         //法人 763-董监高风险扫描
@@ -570,66 +583,66 @@ public class ProjectInformationServiceImpl extends ServiceImpl<ProjectInformatio
         ResponseJson dongjiangaoRisksObject;
         try {
             dongjiangaoRisksObject = restTemplate.getForObject(dongjiangaoRisksUrl, ResponseJson.class);
-        }catch (Exception e){
-            throw new ServiceException(CodeUtil.FAIL,"网络异常,请稍后重试!");
+        } catch (Exception e) {
+            throw new ServiceException(CodeUtil.FAIL, "网络异常,请稍后重试!");
         }
         JSONObject dongjiangaoRisksObjectData = new JSONObject(dongjiangaoRisksObject.getData());
         Integer stCount = dongjiangaoRisksObjectData.getInt("stCount");
         Long dongjiangaoRiskId = dongjiangaoRisksObjectData.getLong("id");
         enterprise.setcDongjiangaoRiskId(dongjiangaoRiskId);
         String status;
-        if (enterprise.getBusinessAddress().contains("黑龙江") || enterprise.getBusinessAddress().contains("辽宁") || enterprise.getBusinessAddress().contains("吉林")|| changes >= 2
-                || shixin > 0 || sumptuary >0 || zhixingAmount.compareTo(new BigDecimal(registCapi)) == 1 || judgmentDocumentsCount > 0 || stCount > 0) {
+        if (enterprise.getBusinessAddress().contains("黑龙江") || enterprise.getBusinessAddress().contains("辽宁") || enterprise.getBusinessAddress().contains("吉林") || changes >= 2
+                || shixin > 0 || sumptuary > 0 || zhixingAmount.compareTo(new BigDecimal(registCapi)) == 1 || judgmentDocumentsCount > 0 || stCount > 0) {
             status = ProjectAndEnterpriseStatusEnums.VOTE.getCode();
-            if(enterprise.getBusinessAddress().contains("黑龙江") || enterprise.getBusinessAddress().contains("辽宁") || enterprise.getBusinessAddress().contains("吉林")){
+            if (enterprise.getBusinessAddress().contains("黑龙江") || enterprise.getBusinessAddress().contains("辽宁") || enterprise.getBusinessAddress().contains("吉林")) {
                 error.add(enterprise.getCorporateName() + "不符合准入条件!");
             }
-            if(changes >= 2){
+            if (changes >= 2) {
                 error.add(enterprise.getCorporateName() + "基本变动信息大于两次");
             }
-            if(shixin > 0){
+            if (shixin > 0) {
                 error.add(enterprise.getCorporateName() + "存在失信执行信息");
             }
-            if(sumptuary >0){
+            if (sumptuary > 0) {
                 error.add(enterprise.getCorporateName() + "存在限制高消");
             }
-            if(zhixingAmount.compareTo(new BigDecimal(registCapi)) == 1){
+            if (zhixingAmount.compareTo(new BigDecimal(registCapi)) == 1) {
                 error.add(enterprise.getCorporateName() + "当前执行金额大于注册资本");
             }
-            if(judgmentDocumentsCount > 0){
+            if (judgmentDocumentsCount > 0) {
                 error.add(enterprise.getCorporateName() + "存在涉诉信息");
             }
-            if(stCount > 0){
+            if (stCount > 0) {
                 error.add(enterprise.getCorporateName() + "法人存在限制高消");
             }
-        }else {
+        } else {
             status = ProjectAndEnterpriseStatusEnums.ADD_INFO.getCode();
         }
-        if(projectInformation != null){
-            if(StringUtil.isNotEmpty(entType) && !entType.equals("4") && betweenYear < 2 && projectInformation.getCompanyForProject() == 0){
+        if (projectInformation != null) {
+            if (StringUtil.isNotEmpty(entType) && !entType.equals("4") && betweenYear < 2 && projectInformation.getCompanyForProject() == 0) {
                 error.add(enterprise.getCorporateName() + "不符合企业准入条件!");
                 status = ProjectAndEnterpriseStatusEnums.VOTE.getCode();
             }
-            if(province.contains("黑龙江") || province.contains("辽宁") || province.contains("吉林")){
+            if (province.contains("黑龙江") || province.contains("辽宁") || province.contains("吉林")) {
                 error.add(enterprise.getCorporateName() + "不符合准入条件!");
                 status = ProjectAndEnterpriseStatusEnums.VOTE.getCode();
             }
             projectInformation.setStatus(status);
             updateById(projectInformation);
         }
-        if(projectCore != null){
-            if(betweenYear < 2){
+        if (projectCore != null) {
+            if (betweenYear < 2) {
                 error.add(enterprise.getCorporateName() + "注册时间少于两年");
                 status = ProjectAndEnterpriseStatusEnums.VOTE.getCode();
             }
-            if(registCapiInt < 5000){
+            if (registCapiInt < 5000) {
                 error.add(enterprise.getCorporateName() + "注册资本少于5000万");
                 status = ProjectAndEnterpriseStatusEnums.VOTE.getCode();
             }
             projectCore.setStatus(status);
             projectCoreEnterpriseService.updateById(projectCore);
         }
-        if(CollectionUtil.isNotEmpty(error)){
+        if (CollectionUtil.isNotEmpty(error)) {
             log.error(enterprise.getCorporateName() + "的不准入原因:" + error.stream().collect(Collectors.joining(",")));
         }
         return error;

+ 22 - 6
src/main/java/com/inkasso/factoring/creditmanagement/web/CProjectInformationController.java

@@ -27,6 +27,7 @@ public class CProjectInformationController {
 
     /**
      * 获取当前用户需要招投标且已通过的授信项目
+     *
      * @return
      */
     @GetMapping(value = "/getUserBiddingProjects")
@@ -37,66 +38,81 @@ public class CProjectInformationController {
 
     /**
      * 增加项目
+     *
      * @param projectInformation
      * @return
      */
     @RequestMapping("/addProject")
     @AvoidRepeatableCommit(key = "projectInfo/addProject")
-    public ResponseJson addProject(@RequestBody ProjectInformation projectInformation){
+    public ResponseJson addProject(@RequestBody ProjectInformation projectInformation) {
         ProjectInformation result = projectInformationService.addProject(projectInformation);
         return new ResponseJson(result);
     }
 
     /**
      * 获取项目补充信息
+     *
      * @return
      */
     @RequestMapping("/getSuppplement")
-    public ResponseJson getSuppplement(@RequestParam Long id){
+    public ResponseJson getSuppplement(@RequestParam Long id) {
         ProjectInformation projectInformation = projectInformationService.getSuppplement(id);
         return new ResponseJson(projectInformation);
     }
 
     /**
      * 补充信息
+     *
      * @return
      */
     @RequestMapping("supplement")
     @AvoidRepeatableCommit(key = "projectInfo/supplement")
-    public ResponseJson supplement(@RequestBody ProjectInformation projectInformation){
+    public ResponseJson supplement(@RequestBody ProjectInformation projectInformation) {
         projectInformationService.supplement(projectInformation);
         return new ResponseJson();
     }
 
     /**
      * 查看详情
+     *
      * @param id
      * @return
      */
     @RequestMapping("getDetail")
-    public ResponseJson getDetail(@RequestParam Long id){
+    public ResponseJson getDetail(@RequestParam Long id) {
         ProjectInformation projectInformation = projectInformationService.getDetail(id);
         return new ResponseJson(projectInformation);
     }
 
     /**
      * 根据供应商id获取该供应商下的全部项目
+     *
      * @param supplierId
      * @return
      */
     @RequestMapping("getProjectBySupplierId")
-    public ResponseJson getProjectBySupplierId(@RequestParam Long supplierId){
+    public ResponseJson getProjectBySupplierId(@RequestParam Long supplierId) {
         List<ProjectInformation> projectInformations = projectInformationService.getProjectBySupplierId(supplierId);
         return new ResponseJson(projectInformations);
     }
 
     /**
      * 获取当前用户下已完成采购合同的所有项目
+     *
      * @return
      */
     @RequestMapping("getLocalPurchCompletedProject")
-    public ResponseJson getLocalPurchCompletedProject(){
+    public ResponseJson getLocalPurchCompletedProject() {
         return new ResponseJson(projectInformationService.getLocalPurchCompletedProject());
     }
 
+    /**
+     * 获取当前用户下已完成采购合同并且授信决议已通过的的所有项目
+     *
+     * @return
+     */
+    @GetMapping("getLocalCreditResolutionCompletedProject")
+    public ResponseJson getLocalCreditResolutionCompletedProject() {
+        return new ResponseJson(projectInformationService.getLocalCreditResolutionCompletedProject());
+    }
 }

+ 2 - 0
src/main/java/com/inkasso/factoring/financingmanagement/service/impl/FinancingApplyServiceImpl.java

@@ -337,6 +337,8 @@ public class FinancingApplyServiceImpl implements FinancingApplyService {
         if (visible) {
             //检验验收单货物是否已经融资
             checkAcceptanceGoods(financingGoodsInfoList);
+            //校验项目授信决议是否通过
+            //123
             //状态为处理中
             financingBasicInfo.setFinancingStatus(ProjectInitiationStatusEnum.PROCESSING.getCode());
             //当前阶段为额度支用

+ 14 - 0
src/main/resources/mapping/creditmanagement/CProjectInformationMapper.xml

@@ -72,5 +72,19 @@
         WHERE c.contract_status = 'project_init_completed'
           AND t3.sys_user_id = #{userId}
     </select>
+    <select id="getLocalCreditResolutionCompletedProject"
+            resultType="com.inkasso.factoring.creditmanagement.entity.ProjectInformation">
+        SELECT
+            t1.*
+        FROM
+            c_project_information t1
+                LEFT JOIN credit_resolution t2 ON t2.c_project_information_id = t1.id
+                LEFT JOIN c_purch_contract_management t3 ON t1.business_number = t3.business_number
+                LEFT JOIN c_supplier_info t4 ON t4.id = t3.c_supplier_info_id
+        WHERE
+            t2.`status` = 'project_init_completed'
+          AND t3.contract_status = 'project_init_completed'
+          AND t4.sys_user_id = #{userId}
+    </select>
 
 </mapper>