|
@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
|
import com.snb.fsos.bean.LoanApply;
|
|
|
+import com.snb.fsos.bean.SMBFileUpload;
|
|
|
import com.sunxung.factoring.component.enums.FinancingCurrentStageEnum;
|
|
|
import com.sunxung.factoring.component.exception.BusinessException;
|
|
|
import com.sunxung.factoring.component.exception.ValidatorException;
|
|
@@ -24,7 +25,10 @@ import com.sunxung.factoring.entity.financing.apply.CFinancingAccountsReceivable
|
|
|
import com.sunxung.factoring.entity.financing.apply.CFinancingApplicantInfo;
|
|
|
import com.sunxung.factoring.entity.financing.apply.CFinancingBasicInfo;
|
|
|
import com.sunxung.factoring.entity.financing.apply.CFinancingGoodsInfo;
|
|
|
-import com.sunxung.factoring.entity.financing.contract.*;
|
|
|
+import com.sunxung.factoring.entity.financing.contract.ContractFinancingInfo;
|
|
|
+import com.sunxung.factoring.entity.financing.contract.ContractInfo;
|
|
|
+import com.sunxung.factoring.entity.financing.contract.ContractLoanConditionSetting;
|
|
|
+import com.sunxung.factoring.entity.financing.contract.ContractMasterContract;
|
|
|
import com.sunxung.factoring.entity.financing.contractTemplate.ContractTemplate;
|
|
|
import com.sunxung.factoring.entity.financing.payment.*;
|
|
|
import com.sunxung.factoring.entity.financing.review.*;
|
|
@@ -715,7 +719,10 @@ public class PaymentApplyServiceImpl extends ServiceImpl<PaymentApplyMapper, Pay
|
|
|
ReviewFinancingInfo reviewFinancingInfo = reviewFinancingInfoService.getOne(new QueryWrapper<ReviewFinancingInfo>()
|
|
|
.eq("review_quota_disburse_id", paymentInfo.getQuotaDisburseId()));
|
|
|
if (reviewFinancingInfo != null && ConstantUtil.JIANGSU_SUSHANG_BANK.equals(reviewFinancingInfo.getInstitutionName())) {
|
|
|
- LoanApplyResp loanApplyResp = withdrawApplyBySmb(financingBasicInfo, reviewFinancingInfo);
|
|
|
+ //文件上传、获取苏商上传文件集合
|
|
|
+ List<LoanCreditRiskMsgDto.FileInfo> fileInfoList = getFileInfoList(paymentApproval, receivablesRegisterInfo, paymentInfo, financingBasicInfo);
|
|
|
+
|
|
|
+ LoanApplyResp loanApplyResp = withdrawApplyBySmb(financingBasicInfo, reviewFinancingInfo, fileInfoList);
|
|
|
//保存资方放款信息
|
|
|
saveFinancingLoanInfo(financingBasicInfo, reviewFinancingInfo, loanApplyResp);
|
|
|
if ("02".equals(loanApplyResp.getStatus())) {
|
|
@@ -734,6 +741,104 @@ public class PaymentApplyServiceImpl extends ServiceImpl<PaymentApplyMapper, Pay
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取上传苏商的文件信息
|
|
|
+ *
|
|
|
+ * @param paymentApproval
|
|
|
+ * @param receivablesRegisterInfo
|
|
|
+ * @param paymentInfo
|
|
|
+ * @param financingBasicInfo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<LoanCreditRiskMsgDto.FileInfo> getFileInfoList(PaymentApproval paymentApproval, ReceivablesRegisterInfo receivablesRegisterInfo, PaymentInfo paymentInfo, CFinancingBasicInfo financingBasicInfo) {
|
|
|
+ List<LoanCreditRiskMsgDto.FileInfo> fileList = new ArrayList<>();
|
|
|
+
|
|
|
+ //上传应收账款合同
|
|
|
+ List<FileStorage> salesContractFile = getSalesContractFile(paymentInfo.getBusinessNo());
|
|
|
+ if (CollectionUtil.isNotEmpty(salesContractFile)) {
|
|
|
+ for (FileStorage fileStorage : salesContractFile) {
|
|
|
+ String fileSdossId = fileUploadBySmb(fileStorage, "811");
|
|
|
+
|
|
|
+ LoanCreditRiskMsgDto.FileInfo fileInfo = new LoanCreditRiskMsgDto.FileInfo();
|
|
|
+ fileInfo.setFileType("811");
|
|
|
+ fileInfo.setFileSdossId(fileSdossId);
|
|
|
+ fileList.add(fileInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ List<FileStorage> purchContractFiles = getPurchContractFiles(paymentInfo.getBusinessNo());
|
|
|
+ if (CollectionUtil.isNotEmpty(purchContractFiles)) {
|
|
|
+ for (FileStorage fileStorage : purchContractFiles) {
|
|
|
+ String fileSdossId = fileUploadBySmb(fileStorage, "811");
|
|
|
+
|
|
|
+ LoanCreditRiskMsgDto.FileInfo fileInfo = new LoanCreditRiskMsgDto.FileInfo();
|
|
|
+ fileInfo.setFileType("811");
|
|
|
+ fileInfo.setFileSdossId(fileSdossId);
|
|
|
+ fileList.add(fileInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //上传应收账款产值单
|
|
|
+ List<FileStorage> acceptanceFile = getAcceptanceFile(financingBasicInfo.getId());
|
|
|
+ for (FileStorage fileStorage : acceptanceFile) {
|
|
|
+ String fileSdossId = fileUploadBySmb(fileStorage, "812");
|
|
|
+
|
|
|
+ LoanCreditRiskMsgDto.FileInfo fileInfo = new LoanCreditRiskMsgDto.FileInfo();
|
|
|
+ fileInfo.setFileType("812");
|
|
|
+ fileInfo.setFileSdossId(fileSdossId);
|
|
|
+ fileList.add(fileInfo);
|
|
|
+ }
|
|
|
+ //上传中登网登记凭证
|
|
|
+ if (CollectionUtil.isNotEmpty(receivablesRegisterInfo.getReceivablesFileIds())) {
|
|
|
+ for (Long fileId : receivablesRegisterInfo.getReceivablesFileIds()) {
|
|
|
+ FileStorage fileStorage = fileStorageService.get(fileId);
|
|
|
+
|
|
|
+ String fileSdossId = fileUploadBySmb(fileStorage, "813");
|
|
|
+ LoanCreditRiskMsgDto.FileInfo fileInfo = new LoanCreditRiskMsgDto.FileInfo();
|
|
|
+ fileInfo.setFileType("813");
|
|
|
+ fileInfo.setFileSdossId(fileSdossId);
|
|
|
+ fileList.add(fileInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //上传回购承诺函
|
|
|
+ List<Long> commitmentFileIds = paymentApproval.getCommitmentFileIds();
|
|
|
+ if (CollectionUtil.isNotEmpty(commitmentFileIds)) {
|
|
|
+ for (Long fileId : commitmentFileIds) {
|
|
|
+ FileStorage fileStorage = fileStorageService.get(fileId);
|
|
|
+
|
|
|
+ String fileSdossId = fileUploadBySmb(fileStorage, "814");
|
|
|
+ LoanCreditRiskMsgDto.FileInfo fileInfo = new LoanCreditRiskMsgDto.FileInfo();
|
|
|
+ fileInfo.setFileType("814");
|
|
|
+ fileInfo.setFileSdossId(fileSdossId);
|
|
|
+ fileList.add(fileInfo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return fileList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 苏商银行-文件上传
|
|
|
+ *
|
|
|
+ * @param fileStorage
|
|
|
+ * @param fileType
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private String fileUploadBySmb(FileStorage fileStorage, String fileType) {
|
|
|
+ List<SMBFileUpload> upload = new ArrayList<>();
|
|
|
+ SMBFileUpload smbFileUpload = new SMBFileUpload();
|
|
|
+ smbFileUpload.setFileName(fileStorage.getOriginalName());
|
|
|
+ smbFileUpload.setFileType(fileType);
|
|
|
+ smbFileUpload.setFilePath(fileStorage.getAbsolutePath());
|
|
|
+ upload.add(smbFileUpload);
|
|
|
+ Map<String, String> map;
|
|
|
+ try {
|
|
|
+ map = smbApiService.fileStreamUpload(upload);
|
|
|
+ String fileSdossId = map.get(fileStorage.getOriginalName());
|
|
|
+ return fileSdossId;
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ throw new BusinessException(CodeUtil.FAIL, "上传苏商文件出错,请稍后重试!");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public List<PaymentCondition> findConditions(Long applyId) {
|
|
|
return paymentConditionService.lambdaQuery().eq(PaymentCondition::getPaymentApplyId, applyId).list();
|
|
@@ -944,7 +1049,7 @@ public class PaymentApplyServiceImpl extends ServiceImpl<PaymentApplyMapper, Pay
|
|
|
* @param reviewFinancingInfo
|
|
|
* @return
|
|
|
*/
|
|
|
- private LoanApplyResp withdrawApplyBySmb(CFinancingBasicInfo financingBasicInfo, ReviewFinancingInfo reviewFinancingInfo) {
|
|
|
+ private LoanApplyResp withdrawApplyBySmb(CFinancingBasicInfo financingBasicInfo, ReviewFinancingInfo reviewFinancingInfo, List<LoanCreditRiskMsgDto.FileInfo> fileInfoList) {
|
|
|
FinancingFromInvestorsNotice notice = reviewQuotaDisburseService.getFinancingFromInvestorsNotice(financingBasicInfo.getId());
|
|
|
FinancingFromInvestorsHistory financingFromInvestorsHistory = financingFromInvestorsHistoryService.getById(notice.getFinancingFromInvestorsHistoryId());
|
|
|
FinancingFromInvestors financingFromInvestors = financingFromInvestorsService.getById(financingFromInvestorsHistory.getFinancingFromInvestorsId());
|
|
@@ -959,15 +1064,15 @@ public class PaymentApplyServiceImpl extends ServiceImpl<PaymentApplyMapper, Pay
|
|
|
//还款方式
|
|
|
loanApplyReq.setRepayMethod("2");
|
|
|
//期限
|
|
|
- loanApplyReq.setTerm(reviewFinancingInfo.getFinancingPeriod().toString());
|
|
|
+ loanApplyReq.setTerm("12");
|
|
|
//期限单位
|
|
|
- loanApplyReq.setTermUnit("D");
|
|
|
+ loanApplyReq.setTermUnit("M");
|
|
|
//还款账户
|
|
|
loanApplyReq.setRepayAcctno(financingFromInvestors.getRepaymentAccount());
|
|
|
//还款账户名
|
|
|
loanApplyReq.setRepayAcctName(financingFromInvestors.getRepaymentAccountName());
|
|
|
- //还款账户账号类型
|
|
|
- loanApplyReq.setRepayAccType(financingFromInvestors.getRepaymentAccountType());
|
|
|
+ //还款账户账号类型-默认为内部户
|
|
|
+ loanApplyReq.setRepayAccType("5");
|
|
|
//支付方式
|
|
|
loanApplyReq.setPayWay("0");
|
|
|
//收款卡标识
|
|
@@ -1027,6 +1132,7 @@ public class PaymentApplyServiceImpl extends ServiceImpl<PaymentApplyMapper, Pay
|
|
|
throw new ValidatorException(CodeUtil.FAIL, "核心企业或核心企业的统一社会信用代码不存在");
|
|
|
}
|
|
|
loanCreditRiskMsg.setContractor(coreEnterprise.getCorporateName());
|
|
|
+ loanCreditRiskMsg.setFileList(fileInfoList);
|
|
|
//获取openId
|
|
|
String openId = financingFromInvestors.getOpenId();
|
|
|
return smbApiService.loanApply(loanApplyReq, loanCreditRiskMsg, openId);
|