瀏覽代碼

fix(苏商银行):后台开发完成

liutao 2 月之前
父節點
當前提交
2798644663

+ 6 - 0
src/main/java/com/sunxung/factoring/dict/impl/FileModuleDict.java

@@ -66,6 +66,10 @@ public class FileModuleDict extends Dict {
         SMB_PERSON_BACK_FILE_HISTORY("smb_person_back_file_history","资方融资企业法人反面文件历史"),
         SMB_CONTRACT_FILE_HISTORY("smb_contract_file_history","资方融资企业合同文件历史"),
         SMB_ELECTRONIC_CONTRACT_PERSON_FACE_FILE("smb_electronic_contract_person_face_file","资方融资企业电子签文件人脸文件"),
+        SMB_TYPE_301("smb_type301SdossId","个人征信授权书"),
+        SMB_TYPE_302("type302SdossId","企业征信授权书"),
+        SMB_TYPE_327("type327SdossId","个人综合信息授权书"),
+        SMB_TYPE_303("type303SdossId","企业综合信息授权书"),
 
         /**
          * 项目
@@ -539,6 +543,8 @@ public class FileModuleDict extends Dict {
         SMB_SING_BACK_FILE("smbSignBackFile","苏商法大大签署回调文件"),
         SMB_SING_REPORT_FILE("smbSignReportFile","苏商法大大签署出证文件"),
 
+        SMB_SING_FILE("smbSignFile","苏商签署的文件"),
+
         /**
          * 人脸识别照片
          */

+ 14 - 0
src/main/java/com/sunxung/factoring/entity/smb/FinancingFromInvestors.java

@@ -156,6 +156,20 @@ public class FinancingFromInvestors extends BaseEntity {
     @TableField(exist = false)
     private Enterprise enterprise ;
 
+    /**
+     * 是否续授信
+     */
+    @TableField(exist = false)
+    private Boolean credit = false;
+
+    public Boolean getCredit() {
+        return credit;
+    }
+
+    public void setCredit(Boolean credit) {
+        this.credit = credit;
+    }
+
     public Enterprise getEnterprise() {
         return enterprise;
     }

+ 114 - 0
src/main/java/com/sunxung/factoring/entity/smb/FinancingFromInvestorsNotice.java

@@ -4,9 +4,12 @@ import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
 import java.util.Date;
+import java.util.List;
+
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.sunxung.factoring.entity.BaseEntity;
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.sunxung.factoring.entity.sys.FileStorage;
 
 /**
  * <p>
@@ -135,6 +138,117 @@ public class FinancingFromInvestorsNotice extends BaseEntity {
     @TableField("limit_number")
     private String limitNumber;
 
+    /**
+     * 个人征信授权书
+     */
+    @TableField("type301SdossId")
+    private String type301SdossId;
+    /**
+     * 企业征信授权书
+     */
+    @TableField("type302SdossId")
+    private String type302SdossId;
+    /**
+     * 个人综合信息授权书
+     */
+    @TableField("type327SdossId")
+    private String type327SdossId;
+    /**
+     * 企业综合信息授权书
+     */
+    @TableField("type303SdossId")
+    private String type303SdossId;
+
+    /**
+     * 用户唯一标识
+     */
+    @TableField(exist = false)
+    private String openId;
+
+    @TableField(exist = false)
+    private FileStorage file301;
+
+    @TableField(exist = false)
+    private FileStorage file302;
+
+    @TableField(exist = false)
+    private FileStorage file303;
+
+    @TableField(exist = false)
+    private FileStorage file327;
+
+    public FileStorage getFile301() {
+        return file301;
+    }
+
+    public void setFile301(FileStorage file301) {
+        this.file301 = file301;
+    }
+
+    public FileStorage getFile302() {
+        return file302;
+    }
+
+    public void setFile302(FileStorage file302) {
+        this.file302 = file302;
+    }
+
+    public FileStorage getFile303() {
+        return file303;
+    }
+
+    public void setFile303(FileStorage file303) {
+        this.file303 = file303;
+    }
+
+    public FileStorage getFile327() {
+        return file327;
+    }
+
+    public void setFile327(FileStorage file327) {
+        this.file327 = file327;
+    }
+
+    public String getOpenId() {
+        return openId;
+    }
+
+    public void setOpenId(String openId) {
+        this.openId = openId;
+    }
+
+    public String getType301SdossId() {
+        return type301SdossId;
+    }
+
+    public void setType301SdossId(String type301SdossId) {
+        this.type301SdossId = type301SdossId;
+    }
+
+    public String getType302SdossId() {
+        return type302SdossId;
+    }
+
+    public void setType302SdossId(String type302SdossId) {
+        this.type302SdossId = type302SdossId;
+    }
+
+    public String getType327SdossId() {
+        return type327SdossId;
+    }
+
+    public void setType327SdossId(String type327SdossId) {
+        this.type327SdossId = type327SdossId;
+    }
+
+    public String getType303SdossId() {
+        return type303SdossId;
+    }
+
+    public void setType303SdossId(String type303SdossId) {
+        this.type303SdossId = type303SdossId;
+    }
+
     public String getLimitNumber() {
         return limitNumber;
     }

+ 31 - 0
src/main/java/com/sunxung/factoring/service/project/impl/BusinessProcessingTaskServiceImpl.java

@@ -73,6 +73,7 @@ import com.sunxung.factoring.service.signconfirmation.ISignConfirmationService;
 import com.sunxung.factoring.service.smb.*;
 import com.sunxung.factoring.service.supplier.ISupplierInfoService;
 import com.sunxung.factoring.service.sys.*;
+import com.sunxung.factoring.service.sys.dto.AttachmentDto;
 import com.sunxung.factoring.service.sys.flowable.FlowActivityDefinitionService;
 import com.sunxung.factoring.service.sys.flowable.FlowableService;
 import com.sunxung.factoring.service.underlying.UnderlyingBasicInfoService;
@@ -185,6 +186,8 @@ public class BusinessProcessingTaskServiceImpl implements BusinessProcessingTask
     private IFinancingFromInvestorsEletronicContractService financingFromInvestorsEletronicContractService;
     @Autowired
     private IElectronicSignaturePersonalService electronicSignaturePersonalService;
+    @Autowired
+    private ISysAttachmentRefService sysAttachmentRefService;
 
 
     @Override
@@ -1103,6 +1106,34 @@ public class BusinessProcessingTaskServiceImpl implements BusinessProcessingTask
 
                     //回调
                     FinancingFromInvestorsNotice financingFromInvestorsNotice = financingFromInvestorsNoticeService.lambdaQuery().eq(FinancingFromInvestorsNotice::getFinancingFromInvestorsHistoryId, financingFromInvestorsHistory.getId()).one();
+                    AttachmentDto attachmentDto = AttachmentDto.builder()
+                            .setEntityId(financingFromInvestorsNotice.getId())
+                            .setChildEnum(FileModuleDict.ChildEnum.SMB_TYPE_301)
+                            .build();
+                    List<FileStorage> file301 = sysAttachmentRefService.getFiles(attachmentDto);
+                    if(CollectionUtil.isNotEmpty(file301)){
+                        financingFromInvestorsNotice.setFile301(file301.get(0));
+                    }
+
+                    attachmentDto.setChildEnum(FileModuleDict.ChildEnum.SMB_TYPE_302);
+                    List<FileStorage> files302 = sysAttachmentRefService.getFiles(attachmentDto);
+                    if(CollectionUtil.isNotEmpty(files302)){
+                        financingFromInvestorsNotice.setFile302(files302.get(0));
+                    }
+
+                    attachmentDto.setChildEnum(FileModuleDict.ChildEnum.SMB_TYPE_303);
+                    List<FileStorage> files303 = sysAttachmentRefService.getFiles(attachmentDto);
+                    if(CollectionUtil.isNotEmpty(files303)){
+                        financingFromInvestorsNotice.setFile303(files303.get(0));
+                    }
+
+                    attachmentDto.setChildEnum(FileModuleDict.ChildEnum.SMB_TYPE_327);
+                    List<FileStorage> file327 = sysAttachmentRefService.getFiles(attachmentDto);
+                    if(CollectionUtil.isNotEmpty(file327)){
+                        financingFromInvestorsNotice.setFile327(file327.get(0));
+                    }
+
+                    financingFromInvestorsNotice.setOpenId(financingFromInvestorsHistory.getOpenId());
                     BusinessHistoricDetailVo back = new BusinessHistoricDetailVo();
                     back.setFormBusinessName("苏商银行回调");
                     BusinessProcessingLogVo businessProcessingLogBack = new BusinessProcessingLogVo();

+ 0 - 6
src/main/java/com/sunxung/factoring/service/smb/IFinancingFromInvestorsService.java

@@ -59,12 +59,6 @@ public interface IFinancingFromInvestorsService extends IService<FinancingFromIn
      */
     FinancingFromInvestorsNotice getCreditDetail(Long id);
 
-    /**
-     * 续授信
-     * @param financingFromInvestors
-     */
-    void credit(FinancingFromInvestors financingFromInvestors);
-
     /**
      * 从苏商查询授信详情
      * @param id

+ 109 - 25
src/main/java/com/sunxung/factoring/service/smb/impl/FinancingFromInvestorsServiceImpl.java

@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSONObject;
 import com.deepoove.poi.XWPFTemplate;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
+import com.snb.fsos.bean.AccountInfoQuery;
+import com.snb.fsos.bean.BalanceQuery;
 import com.snb.fsos.bean.ProductCreditApplyV2;
 import com.snb.fsos.bean.SMBFileUpload;
 import com.sunxung.factoring.component.aspect.OperationLogAspect;
@@ -35,11 +37,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.sunxung.factoring.service.smbApi.api.SMBApiService;
 import com.sunxung.factoring.service.smbApi.dto.CreditApplyRiskMsgDto;
 import com.sunxung.factoring.service.smbApi.dto.LoanCreditRiskMsgDto;
+import com.sunxung.factoring.service.smbApi.resp.AccountInfoQueryResp;
+import com.sunxung.factoring.service.smbApi.resp.BalanceQueryResp;
 import com.sunxung.factoring.service.smbApi.resp.CreditApplyResp;
 import com.sunxung.factoring.service.smbApi.resp.CreditProcessQueryResp;
 import com.sunxung.factoring.service.supplier.*;
 import com.sunxung.factoring.service.sys.*;
 import com.sunxung.factoring.service.sys.dto.AttachmentDto;
+import org.apache.bcel.classfile.Code;
 import org.apache.commons.io.FileUtils;
 import org.apache.logging.log4j.LogManager;
 import org.apache.logging.log4j.Logger;
@@ -48,7 +53,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.io.File;
+import java.io.*;
 import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
@@ -138,6 +143,26 @@ public class FinancingFromInvestorsServiceImpl extends ServiceImpl<FinancingFrom
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void addInfo(FinancingFromInvestors financingFromInvestors) {
+        //续授信
+        if(financingFromInvestors.getCredit()){
+            //判断数据的状态是否支持续授信
+            List<FinancingFromInvestorsHistory> financingFromInvestorsHistories = financingFromInvestorsHistoryService.lambdaQuery().eq(FinancingFromInvestorsHistory::getFinancingFromInvestorsId, financingFromInvestors.getId()).orderByDesc(FinancingFromInvestorsHistory::getId).list();
+            FinancingFromInvestorsNotice financingFromInvestorsNotice = null;
+            if (CollectionUtil.isNotEmpty(financingFromInvestorsHistories)) {
+                FinancingFromInvestorsHistory financingFromInvestorsHistory = financingFromInvestorsHistories.get(0);
+                financingFromInvestorsNotice = financingFromInvestorsNoticeService.lambdaQuery().eq(FinancingFromInvestorsNotice::getFinancingFromInvestorsHistoryId, financingFromInvestorsHistory.getId()).one();
+            }
+            if(financingFromInvestorsNotice == null){
+                throw new BusinessException(CodeUtil.FAIL,"无法续授信!请联系开发人员!");
+            }
+            if (financingFromInvestorsNotice.getExpiringDate().compareTo(new Date()) == 1) {
+                throw new BusinessException(CodeUtil.FAIL, "授信生效中,无法续授信!");
+            }
+            if (financingFromInvestorsNotice.getNextApplyDate().compareTo(new Date()) == 1) {
+                throw new BusinessException(CodeUtil.FAIL, "未到可再次申请日期,无法续授信!");
+            }
+            financingFromInvestors.setId(null);
+        }
         List<SMBFileUpload> fileList = new ArrayList<>();
         List<Long> registeredAddressCodeList = financingFromInvestors.getRegisteredAddressCodeList();
         if(CollectionUtil.isNotEmpty(registeredAddressCodeList)){
@@ -819,31 +844,14 @@ public class FinancingFromInvestorsServiceImpl extends ServiceImpl<FinancingFrom
         return financingFromInvestorsNotice;
     }
 
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public void credit(FinancingFromInvestors financingFromInvestors) {
-        //判断数据的状态是否支持续授信
-        List<FinancingFromInvestorsHistory> financingFromInvestorsHistories = financingFromInvestorsHistoryService.lambdaQuery().eq(FinancingFromInvestorsHistory::getFinancingFromInvestorsId, financingFromInvestors.getId()).orderByDesc(FinancingFromInvestorsHistory::getId).list();
-        FinancingFromInvestorsNotice financingFromInvestorsNotice = null;
-        if (CollectionUtil.isNotEmpty(financingFromInvestorsHistories)) {
-            FinancingFromInvestorsHistory financingFromInvestorsHistory = financingFromInvestorsHistories.get(0);
-            financingFromInvestorsNotice = financingFromInvestorsNoticeService.lambdaQuery().eq(FinancingFromInvestorsNotice::getFinancingFromInvestorsHistoryId, financingFromInvestorsHistory.getId()).one();
-        }
-        if (financingFromInvestorsNotice.getExpiringDate().compareTo(new Date()) == 1) {
-            throw new BusinessException(CodeUtil.FAIL, "授信生效中,无法续授信!");
-        }
-        if (financingFromInvestorsNotice.getNextApplyDate().compareTo(new Date()) == 1) {
-            throw new BusinessException(CodeUtil.FAIL, "未到可再次申请日期,无法续授信!");
-        }
-        financingFromInvestors.setId(null);
-        this.addInfo(financingFromInvestors);
-    }
-
     @Override
     public FinancingFromInvestorsNotice findCreditDetail(Long id) {
         FinancingFromInvestors financingFromInvestors = this.getById(id);
         List<FinancingFromInvestorsHistory> financingFromInvestorsHistories =
                 financingFromInvestorsHistoryService.lambdaQuery().eq(FinancingFromInvestorsHistory::getFinancingFromInvestorsId, id).orderByDesc(FinancingFromInvestorsHistory::getId).list();
+        if(CollectionUtil.isEmpty(financingFromInvestorsHistories)){
+            throw new BusinessException(CodeUtil.FAIL,"未查询到授信信息");
+        }
         FinancingFromInvestorsHistory financingFromInvestorsHistory = financingFromInvestorsHistories.get(0);
         CreditProcessQueryResp creditProcessQueryResp = smbApiService.creditProcessQuery(financingFromInvestors.getOpenId(), financingFromInvestorsHistory.getBizNo());
         //删除之前的回调
@@ -893,15 +901,91 @@ public class FinancingFromInvestorsServiceImpl extends ServiceImpl<FinancingFrom
             financingFromInvestorsNotice.setPendingLoanReceipt("否");
         }
         financingFromInvestorsNotice.setGuaranteeMethod(creditProcessQueryResp.getGuaranteeFlag());
-        //todo 待核实字段
-//        financingFromInvestorsNotice.setRepaymentAccount();
-//        financingFromInvestorsNotice.setRepaymentAccountName();
-//        financingFromInvestorsNotice.setRepaymentAccountType();
         financingFromInvestorsNotice.setLimitNumber(creditProcessQueryResp.getProductLimitNo());
+        if(StringUtil.isNotEmpty(creditProcessQueryResp.getType301SdossId())){
+            financingFromInvestorsNotice.setType301SdossId(creditProcessQueryResp.getType301SdossId());
+            FileStorage fileStorage = downloadFile(creditProcessQueryResp.getType301SdossId());
+            fileStorageService.saveAttachmentRefByFileStorage(fileStorage,
+                    FileModuleDict.ChildEnum.SMB_TYPE_301,
+                    financingFromInvestorsNotice.getId());
+        }
+        if(StringUtil.isNotEmpty(creditProcessQueryResp.getType302SdossId())){
+
+            financingFromInvestorsNotice.setType302SdossId(creditProcessQueryResp.getType302SdossId());
+            FileStorage fileStorage = downloadFile(creditProcessQueryResp.getType302SdossId());
+            fileStorageService.saveAttachmentRefByFileStorage(fileStorage,
+                    FileModuleDict.ChildEnum.SMB_TYPE_302,
+                    financingFromInvestorsNotice.getId());
+        }
+        if(StringUtil.isNotEmpty(creditProcessQueryResp.getType303SdossId())){
+
+            financingFromInvestorsNotice.setType303SdossId(creditProcessQueryResp.getType303SdossId());
+            FileStorage fileStorage = downloadFile(creditProcessQueryResp.getType303SdossId());
+            fileStorageService.saveAttachmentRefByFileStorage(fileStorage,
+                    FileModuleDict.ChildEnum.SMB_TYPE_303,
+                    financingFromInvestorsNotice.getId());
+        }
+        if(StringUtil.isNotEmpty(creditProcessQueryResp.getType327SdossId())){
+            financingFromInvestorsNotice.setType327SdossId(creditProcessQueryResp.getType327SdossId());
+            FileStorage fileStorage = downloadFile(creditProcessQueryResp.getType327SdossId());
+            fileStorageService.saveAttachmentRefByFileStorage(fileStorage,
+                    FileModuleDict.ChildEnum.SMB_TYPE_327,
+                    financingFromInvestorsNotice.getId());
+        }
+
+        //查询账户信息
+        AccountInfoQuery accountInfoQuery = new AccountInfoQuery();
+        List<AccountInfoQueryResp> accountInfoQueryResps = smbApiService.accountInfoQuery(accountInfoQuery, financingFromInvestors.getOpenId());
+        AccountInfoQueryResp accountInfoQueryResp = accountInfoQueryResps.get(0);
+
+        financingFromInvestorsNotice.setRepaymentAccount(accountInfoQueryResp.getClientAcct());
+        financingFromInvestorsNotice.setRepaymentAccountName(accountInfoQueryResp.getAcctName());
+        financingFromInvestorsNotice.setRepaymentAccountType(accountInfoQueryResp.getAcctType());
         financingFromInvestorsNoticeService.save(financingFromInvestorsNotice);
+
         return financingFromInvestorsNotice;
     }
 
+
+    private FileStorage downloadFile(String remoteFilePath){
+
+        FileStorage fileStorage = new FileStorage(null, FileModuleDict.ChildEnum.SMB_SING_FILE, UUID.randomUUID().toString(), ".pdf");
+
+        String absolutePath = fileStorage.getAbsolutePath();
+        File file = new File(absolutePath);
+        if (!file.getParentFile().exists()) {
+            file.getParentFile().mkdirs();
+        }
+
+        DataOutputStream out = null ;
+        InputStream inputStream = null;
+
+        try {
+            inputStream = smbApiService.downloadFileStream(".pdf", remoteFilePath);
+            //读文件流
+            out = new DataOutputStream(new FileOutputStream(fileStorage.getAbsolutePath()));
+            byte[] buffer = new byte[2048];
+            int count = 0;
+            while ((count = inputStream.read(buffer)) > 0) {
+                out.write(buffer, 0, count);
+            }
+        }catch (Exception e){
+            e.printStackTrace();
+        }finally {
+            try {
+                if (out != null) {
+                    out.close();
+                }
+                if (inputStream != null) {
+                    inputStream.close();
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+        return fileStorageService.add(fileStorage);
+    }
+
     private File creatCompanyFile(FileStorage fileStorage, Enterprise enterprise) {
         try {
             String absolutePath = fileStorage.getAbsolutePath();

+ 0 - 12
src/main/java/com/sunxung/factoring/web/smb/FinancingFromInvestorsController.java

@@ -88,18 +88,6 @@ public class FinancingFromInvestorsController {
        return new ResponseJson();
     }
 
-    /**
-     * 续授信
-     * @param financingFromInvestors
-     * @return
-     */
-    @RequestMapping("credit")
-    @OperationLog(operationModule = "资方融资管理",operationType = OperationTypeEnum.INSERT,description = "续授信")
-    public ResponseJson credit(@RequestBody FinancingFromInvestors financingFromInvestors){
-        financingFromInvestorsService.credit(financingFromInvestors);
-        return new ResponseJson();
-    }
-
     /**
      * 查看详情
      * @param id