|
@@ -129,7 +129,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
private IDepartmentService departmentService;
|
|
|
|
|
|
@Override
|
|
|
- public void createContractDocument(String type, Long id, ContractInfo contractInfo, List<File> list) {
|
|
|
+ public File createContractDocument(String type, Long id, ContractInfo contractInfo) {
|
|
|
ContractTemplate contractTemplate = contractTemplateService.lambdaQuery().eq(ContractTemplate::getTemplateCode, type).eq(ContractTemplate::getVisible, 1).one();
|
|
|
AttachmentDto attachmentDto = AttachmentDto.builder()
|
|
|
.setEntityId(contractTemplate.getId())
|
|
@@ -139,62 +139,65 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileStorage fileStorage = files.get(0);
|
|
|
String absolutePath = fileStorage.getAbsolutePath();
|
|
|
String name = contractTemplate.getName();
|
|
|
+
|
|
|
+ File file = null;
|
|
|
if (type.equals(ConstantConversionUtil.TRIPARTITE_AGREEMENT_FACTORING)) {
|
|
|
// 下载(贸理通)三方协议
|
|
|
- dealNewtTripartiteAgreementFactoringDownload(contractInfo, list, id, absolutePath);
|
|
|
+ file = dealNewtTripartiteAgreementFactoringDownload(contractInfo, id, absolutePath);
|
|
|
} else if (type.equals(ConstantConversionUtil.TRIPARTITE_AGREEMENT)) {
|
|
|
//下载三方协议
|
|
|
- dealNewtTripartiteAgreementDownload(contractInfo, list, id, absolutePath);
|
|
|
+ file = dealNewtTripartiteAgreementDownload(contractInfo, id, absolutePath);
|
|
|
} else if (type.equals(ConstantConversionUtil.POOL_FACTORING_BUSINESS_CONTRACT) ||
|
|
|
type.equals(ConstantConversionUtil.FACTORING_BUSINESS_CONTRACT)) {
|
|
|
//下载池保理业务合同
|
|
|
- dealNewPoolFactoringBusinessContract(contractInfo, list, absolutePath, type);
|
|
|
+ file = dealNewPoolFactoringBusinessContract(contractInfo, absolutePath, type);
|
|
|
} else if (type.equals(ConstantConversionUtil.POOL_FACTORING_FINANCING_CONFIRM) ||
|
|
|
type.equals(ConstantConversionUtil.POOL_FACTORING_INFORMATION_DOMESTIC) ||
|
|
|
type.equals(ConstantConversionUtil.FACTORING_SERVICE_CONFIRMATION)) {
|
|
|
// 注意事项:设置excel表格的时,一定要设置ss:ExpandedRowCount行数,建议其值设置较大,如500,防止创建excel行数不够导致失败
|
|
|
// 下载保理信息表或保理融资确认书
|
|
|
- dealNewFactoringInfo(contractInfo, list, absolutePath, type);
|
|
|
+ file = dealNewFactoringInfo(contractInfo, absolutePath, type);
|
|
|
} else if (type.equals(ConstantConversionUtil.ACCOUNT_RECEIVABLE_TRANSFER_NOTICE) ||
|
|
|
type.equals(ConstantConversionUtil.DOMESTIC_ACCOUNT_RECEIVABLE_TRANSFER_NOTICE_BRIGHT)) {
|
|
|
// 应收账款转让通知书
|
|
|
- dealNewNoticeDownloadAll(contractInfo, list, absolutePath, type);
|
|
|
+ file = dealNewNoticeDownloadAll(contractInfo, absolutePath, type);
|
|
|
} else if (type.equals(ConstantConversionUtil.POOL_FACTORING_ACCOUNT_RECEIVABLE) ||
|
|
|
type.equals(ConstantConversionUtil.DOMESTIC_ACCOUNT_RECEIVABLE_TRANSFER_CONFIRM) ||
|
|
|
type.equals(ConstantConversionUtil.ACCOUNTS_RECEIVABLE_ASSIGNMENT_AGREEMENT)) {
|
|
|
// 应收账款入池确认书 应收账款转让协议
|
|
|
- dealNewConfirmDownload(contractInfo, list, absolutePath, type);
|
|
|
+ file = dealNewConfirmDownload(contractInfo, absolutePath, type);
|
|
|
} else if (type.equals(ConstantConversionUtil.SPOUSE_STATEMENT_GUARANTEE_SPOUSE)) {
|
|
|
// 配偶声明
|
|
|
- dealNewSpouseStatement(id, contractInfo, list, absolutePath, name);
|
|
|
+ file = dealNewSpouseStatement(id, contractInfo, absolutePath, name);
|
|
|
} else if (type.equals(ConstantConversionUtil.FACTORING_CONTRACT_NUMBER_GUARANTEE_COMPANY) ||
|
|
|
type.equals(ConstantConversionUtil.FACTORING_CONTRACT_NUMBER_GUARANTEE_PERSON)) {
|
|
|
// 财产清单
|
|
|
- dealNewDssetsDetail(id, contractInfo, list, absolutePath);
|
|
|
+ file = dealNewDssetsDetail(id, absolutePath);
|
|
|
} else if (type.equals(ConstantConversionUtil.MOVABLE_MORTGAGE_CONTRACT_NUMBER_GUARANTEE_COMPANY) ||
|
|
|
type.equals(ConstantConversionUtil.MOVABLE_MORTGAGE_CONTRACT_NUMBER_GUARANTEE_PERSONAL)) {
|
|
|
// 动产抵押合同
|
|
|
- dealNewChattelMortgageContract(id, contractInfo, list, absolutePath);
|
|
|
+ file = dealNewChattelMortgageContract(id, contractInfo, absolutePath);
|
|
|
} else if (type.equals(ConstantConversionUtil.STOCK_RIGHT_CONTRACT_NUMBER_PLEDGOR_COMPANY) ||
|
|
|
type.equals(ConstantConversionUtil.STOCK_RIGHT_CONTRACT_NUMBER_PLEDGOR_PERSONAL)) {
|
|
|
// 股权质押合同
|
|
|
- dealNewEquityPledgeContract(id, contractInfo, list, absolutePath);
|
|
|
+ file = dealNewEquityPledgeContract(id, contractInfo, absolutePath);
|
|
|
} else if (type.equals(ConstantConversionUtil.MAXIMUM_GUARANTEE_CULVER_COMPANY) ||
|
|
|
type.equals(ConstantConversionUtil.MAXIMUM_GUARANTEE_CULVER_PERSONAL) ||
|
|
|
type.equals(ConstantConversionUtil.MAXIMUM_GUARANTEE_CULVER_COMPANY_M2) ||
|
|
|
type.equals(ConstantConversionUtil.MAXIMUM_GUARANTEE_CULVER_PERSONAL_M2)) {
|
|
|
// 担保涵 最高额保证 2023.3.20 新增m2的最高额保障合同
|
|
|
- dealMaximumGuaranteeCulevert(id, contractInfo, list, absolutePath);
|
|
|
+ file = dealMaximumGuaranteeCulevert(id, contractInfo, absolutePath);
|
|
|
} else if (type.equals(ConstantConversionUtil.GENERAL_GUARANTEE_COMPANY) ||
|
|
|
type.equals(ConstantConversionUtil.GENERAL_GUARANTEE_PERSONAL) ||
|
|
|
type.equals(ConstantConversionUtil.GENERAL_GUARANTEE_COMPANY_M2) ||
|
|
|
type.equals(ConstantConversionUtil.GENERAL_GUARANTEE_PERSONAL_M2)) {
|
|
|
// 担保涵 常规担保函 2023.3.20 新增m2的常规担保函
|
|
|
- dealNewGuaranteeCulevert(id, contractInfo, list, absolutePath, name);
|
|
|
+ file = dealNewGuaranteeCulevert(id, contractInfo, absolutePath, name);
|
|
|
} else if (type.equals(ConstantConversionUtil.TRADING_INFO)) {
|
|
|
// 下载交易信息表
|
|
|
- dealNewTradingInfoDownload(contractInfo, list, id, absolutePath);
|
|
|
+ file = dealNewTradingInfoDownload(contractInfo, id, absolutePath);
|
|
|
}
|
|
|
+ return file;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -202,11 +205,10 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
*
|
|
|
* @param reviewRltRepayId
|
|
|
* @param contractInfo
|
|
|
- * @param list
|
|
|
* @param absolutePath
|
|
|
* @param contractName
|
|
|
*/
|
|
|
- private void dealNewSpouseStatement(Long reviewRltRepayId, ContractInfo contractInfo, List<File> list, String absolutePath, String contractName) {
|
|
|
+ private File dealNewSpouseStatement(Long reviewRltRepayId, ContractInfo contractInfo, String absolutePath, String contractName) {
|
|
|
try {
|
|
|
// 主合同信息
|
|
|
ReviewMasterContract masterContract = reviewMasterContractService.lambdaQuery().eq(ReviewMasterContract::getReviewQuotaDisburseId, contractInfo.getReviewQuotaDisburseId()).one();
|
|
@@ -306,7 +308,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -314,17 +316,16 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载配偶声明出错" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 财产清单
|
|
|
*
|
|
|
* @param reviewRltRepayId
|
|
|
- * @param contractInfo
|
|
|
- * @param list
|
|
|
* @param absolutePath
|
|
|
*/
|
|
|
- private void dealNewDssetsDetail(Long reviewRltRepayId, ContractInfo contractInfo, List<File> list, String absolutePath) {
|
|
|
+ private File dealNewDssetsDetail(Long reviewRltRepayId, String absolutePath) {
|
|
|
try {
|
|
|
ReviewRltRepay rltRepay = reviewRltRepayService.getById(reviewRltRepayId);
|
|
|
if (null != rltRepay && rltRepay.getArlpIdType() != null) {
|
|
@@ -515,7 +516,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(estateFile);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(estateFile);
|
|
|
+ return estateFile;
|
|
|
}
|
|
|
} else if (type.equals(ConstantConversionUtil.IDENTITY_TYPE2)) {
|
|
|
// 公司
|
|
@@ -706,7 +707,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(estateFile);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(estateFile);
|
|
|
+ return estateFile;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -714,6 +715,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载财产清单出错" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -721,10 +723,9 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
*
|
|
|
* @param chattelMortgageId
|
|
|
* @param contractInfo
|
|
|
- * @param list
|
|
|
* @param absolutePath
|
|
|
*/
|
|
|
- private void dealNewChattelMortgageContract(Long chattelMortgageId, ContractInfo contractInfo, List<File> list, String absolutePath) {
|
|
|
+ private File dealNewChattelMortgageContract(Long chattelMortgageId, ContractInfo contractInfo, String absolutePath) {
|
|
|
try {
|
|
|
// 主合同信息
|
|
|
ReviewMasterContract masterContract = reviewMasterContractService.lambdaQuery().eq(ReviewMasterContract::getReviewQuotaDisburseId, contractInfo.getReviewQuotaDisburseId()).one();
|
|
@@ -882,13 +883,14 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载动产股权抵押合同错误错误" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -896,10 +898,9 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
*
|
|
|
* @param chattelMortgageId
|
|
|
* @param contractInfo
|
|
|
- * @param list
|
|
|
* @param absolutePath
|
|
|
*/
|
|
|
- private void dealNewEquityPledgeContract(Long chattelMortgageId, ContractInfo contractInfo, List<File> list, String absolutePath) {
|
|
|
+ private File dealNewEquityPledgeContract(Long chattelMortgageId, ContractInfo contractInfo, String absolutePath) {
|
|
|
try {
|
|
|
// 币种中文名称
|
|
|
String currency_cn = "人民币";
|
|
@@ -997,13 +998,14 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
}
|
|
|
XWPFTemplate template = XWPFTemplate.compile(absolutePath).render(map);
|
|
|
template.writeToFile(path);
|
|
|
- list.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载股权质押合同出错" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1011,10 +1013,9 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
*
|
|
|
* @param reviewRltRepayId
|
|
|
* @param contractInfo
|
|
|
- * @param list
|
|
|
* @param absolutePath
|
|
|
*/
|
|
|
- private void dealMaximumGuaranteeCulevert(Long reviewRltRepayId, ContractInfo contractInfo, List<File> list, String absolutePath) {
|
|
|
+ private File dealMaximumGuaranteeCulevert(Long reviewRltRepayId, ContractInfo contractInfo, String absolutePath) {
|
|
|
try {
|
|
|
// 主合同信息
|
|
|
ReviewMasterContract masterContract = reviewMasterContractService.lambdaQuery().eq(ReviewMasterContract::getReviewQuotaDisburseId, contractInfo.getReviewQuotaDisburseId()).one();
|
|
@@ -1173,12 +1174,13 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载担保函错误" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1186,11 +1188,10 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
*
|
|
|
* @param reviewRltRepayId
|
|
|
* @param contractInfo
|
|
|
- * @param list
|
|
|
* @param absolutePath
|
|
|
* @param contractName
|
|
|
*/
|
|
|
- private void dealNewGuaranteeCulevert(Long reviewRltRepayId, ContractInfo contractInfo, List<File> list, String absolutePath, String contractName) {
|
|
|
+ private File dealNewGuaranteeCulevert(Long reviewRltRepayId, ContractInfo contractInfo, String absolutePath, String contractName) {
|
|
|
try {
|
|
|
// 主合同信息
|
|
|
ReviewMasterContract masterContract = reviewMasterContractService.lambdaQuery().eq(ReviewMasterContract::getReviewQuotaDisburseId, contractInfo.getReviewQuotaDisburseId()).one();
|
|
@@ -1310,18 +1311,19 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载担保函错误" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 下载(贸理通)三方协议
|
|
|
*/
|
|
|
- public void dealNewtTripartiteAgreementFactoringDownload(ContractInfo contractInfo, List<File> list, Long basicContractId, String absolutePath) {
|
|
|
+ public File dealNewtTripartiteAgreementFactoringDownload(ContractInfo contractInfo, Long basicContractId, String absolutePath) {
|
|
|
try {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
// 主合同信息
|
|
@@ -1343,7 +1345,11 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
map.put("managementFeeAmount", financingInfo.getManagementFeeAmount());
|
|
|
// 国内有追索权(正向、反向)、国内无追索权(正向,目前没有反向业务)、池保理(出口和国内)均有三方协议和交易信息表
|
|
|
//贸理通默认国内池保理
|
|
|
- List<ContractBasicContract> basicContractList = contractBasicContractService.list(new QueryWrapper<ContractBasicContract>().eq("contract_info_id", contractInfo.getId()));
|
|
|
+ List<ContractBasicContract> basicContractList = contractInfo.getContractBasicContractList();
|
|
|
+ if (CollectionUtil.isEmpty(basicContractList)) {
|
|
|
+ basicContractList = contractBasicContractService.list(new QueryWrapper<ContractBasicContract>()
|
|
|
+ .eq("contract_info_id", contractInfo.getId()));
|
|
|
+ }
|
|
|
String path;
|
|
|
XWPFTemplate template;
|
|
|
if (null != basicContractList && basicContractList.size() > 0) {
|
|
@@ -1432,18 +1438,19 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载三方协议(贸理通)出错" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 下载三方协议
|
|
|
*/
|
|
|
- public void dealNewtTripartiteAgreementDownload(ContractInfo contractInfo, List<File> list, Long basicContractId, String absolutePath) {
|
|
|
+ public File dealNewtTripartiteAgreementDownload(ContractInfo contractInfo, Long basicContractId, String absolutePath) {
|
|
|
try {
|
|
|
// 主合同信息
|
|
|
ReviewMasterContract masterContract = reviewMasterContractService.getOne(new QueryWrapper<ReviewMasterContract>()
|
|
@@ -1452,7 +1459,11 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
String factoringContractNo = masterContract.getContractNo();
|
|
|
String path;
|
|
|
XWPFTemplate template;
|
|
|
- List<ContractBasicContract> basicContractList = contractBasicContractService.list(new QueryWrapper<ContractBasicContract>().eq("contract_info_id", contractInfo.getId()));
|
|
|
+ List<ContractBasicContract> basicContractList = contractInfo.getContractBasicContractList();
|
|
|
+ if (CollectionUtil.isEmpty(basicContractList)) {
|
|
|
+ basicContractList = contractBasicContractService.list(new QueryWrapper<ContractBasicContract>()
|
|
|
+ .eq("contract_info_id", contractInfo.getId()));
|
|
|
+ }
|
|
|
if (null != basicContractList && basicContractList.size() > 0) {
|
|
|
// 表示有三方协议
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -1515,18 +1526,19 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载三方协议出错" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 下载池保理业务合同 保理业务合同
|
|
|
*/
|
|
|
- private void dealNewPoolFactoringBusinessContract(ContractInfo contractInfo, List<File> list, String absolutePath, String type) {
|
|
|
+ private File dealNewPoolFactoringBusinessContract(ContractInfo contractInfo, String absolutePath, String type) {
|
|
|
XWPFTemplate template;
|
|
|
String path;
|
|
|
try {
|
|
@@ -1583,7 +1595,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(file);
|
|
|
+ return file;
|
|
|
} else {
|
|
|
template = XWPFTemplate.compile(absolutePath).render(dataMap);
|
|
|
path = FileUtil.getAbsolutePath("保理业务合同" + applicantCompanyName, ".docx", FileModuleDict.ChildEnum.CONTRACT_FILE_PREVIEW);
|
|
@@ -1592,7 +1604,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -1603,15 +1615,18 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
/**
|
|
|
* 下载保理信息表或保理融资确认书
|
|
|
*/
|
|
|
- private void dealNewFactoringInfo(ContractInfo contractInfo, List<File> fileAllList, String absolutePath, String type) {
|
|
|
+ private File dealNewFactoringInfo(ContractInfo contractInfo, String absolutePath, String type) {
|
|
|
String path;
|
|
|
XWPFTemplate template;
|
|
|
try {
|
|
|
// 主合同信息
|
|
|
ReviewMasterContract master = reviewMasterContractService.getOne(new QueryWrapper<ReviewMasterContract>()
|
|
|
.eq("review_quota_disburse_id", contractInfo.getReviewQuotaDisburseId()));
|
|
|
- ContractMasterContract contractMasterContract = contractMasterContractService.getOne(new QueryWrapper<ContractMasterContract>()
|
|
|
- .eq("contract_info_id", contractInfo.getId()));
|
|
|
+ ContractMasterContract contractMasterContract = contractInfo.getContractMasterContract();
|
|
|
+ if (contractMasterContract == null) {
|
|
|
+ contractMasterContract = contractMasterContractService.getOne(new QueryWrapper<ContractMasterContract>()
|
|
|
+ .eq("contract_info_id", contractInfo.getId()));
|
|
|
+ }
|
|
|
if (null != master) {
|
|
|
Map<String, Object> dataMap = new HashMap<>();
|
|
|
// 保理合同编号
|
|
@@ -1816,8 +1831,11 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
int loanConditionListLength = 0;
|
|
|
ReviewFinancingInfo financingInfo = reviewFinancingInfoService.getOne(new QueryWrapper<ReviewFinancingInfo>()
|
|
|
.eq("review_quota_disburse_id", contractInfo.getReviewQuotaDisburseId()));
|
|
|
- ContractFinancingInfo contractFinancingInfo = contractFinancingInfoService.getOne(new QueryWrapper<ContractFinancingInfo>()
|
|
|
- .eq("contract_info_id", contractInfo.getId()));
|
|
|
+ ContractFinancingInfo contractFinancingInfo = contractInfo.getContractFinancingInfo();
|
|
|
+ if (contractFinancingInfo == null) {
|
|
|
+ contractFinancingInfo = contractFinancingInfoService.getOne(new QueryWrapper<ContractFinancingInfo>()
|
|
|
+ .eq("contract_info_id", contractInfo.getId()));
|
|
|
+ }
|
|
|
if (null != financingInfo) {
|
|
|
// 池保理
|
|
|
if (isPool.equals(ConstantConversionUtil.POOL_FACTORING)) {
|
|
@@ -1927,7 +1945,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
// 管理费金额
|
|
|
manageFeeAmount = financingInfo.getManagementFeeAmount();
|
|
|
// 管理费率
|
|
|
- manageFeeRate = StringUtil.subZeroAndDot(PercentageUtil.convertPercentage(financingInfo.getManagementFeeRatio().doubleValue()).split("%")[0]+ "%");
|
|
|
+ manageFeeRate = StringUtil.subZeroAndDot(PercentageUtil.convertPercentage(financingInfo.getManagementFeeRatio().doubleValue()).split("%")[0] + "%");
|
|
|
// 管理费金额大写
|
|
|
if (null != manageFeeAmount) {
|
|
|
manageFeeAmountName = MoneyToCNFormatUtil.formatToCN(manageFeeAmount.doubleValue());
|
|
@@ -1999,8 +2017,13 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
String supplementaryConditionNo = null;
|
|
|
// 付款条件
|
|
|
String paymentCondition = null;
|
|
|
- List<ContractLoanConditionSetting> loanConditionSetList = contractLoanConditionSettingService.list(new QueryWrapper<ContractLoanConditionSetting>()
|
|
|
- .eq("contract_info_id", contractInfo.getId()).eq("is_checked", true));
|
|
|
+ List<ContractLoanConditionSetting> loanConditionSetList = contractInfo.getConditionSettingList();
|
|
|
+ if (CollectionUtil.isEmpty(loanConditionSetList)) {
|
|
|
+ loanConditionSetList = contractLoanConditionSettingService.list(new QueryWrapper<ContractLoanConditionSetting>()
|
|
|
+ .eq("contract_info_id", contractInfo.getId()).eq("is_checked", true));
|
|
|
+ } else {
|
|
|
+ loanConditionSetList = loanConditionSetList.stream().filter(setting -> setting.getChecked() != null && setting.getChecked()).collect(Collectors.toList());
|
|
|
+ }
|
|
|
if (null != loanConditionSetList && loanConditionSetList.size() > 0) {
|
|
|
// 固定条件序号
|
|
|
List<Integer> fixedConditionList = loanConditionSetList.stream()
|
|
@@ -2048,9 +2071,16 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
}
|
|
|
loanConditionListLength = loanConditionListMap.size() * 2;
|
|
|
|
|
|
- List<ContractLoanConditionSetting> loanConditionSetList = contractLoanConditionSettingService.list(new QueryWrapper<ContractLoanConditionSetting>()
|
|
|
- .eq("contract_info_id", contractInfo.getId())
|
|
|
- .eq("condition_type", ConstantConversionUtil.CONTRACT_LOAN_CONDITION_SETTING_CONDITION));
|
|
|
+
|
|
|
+ List<ContractLoanConditionSetting> loanConditionSetList = contractInfo.getConditionSettingList();
|
|
|
+ if (CollectionUtil.isEmpty(loanConditionSetList)) {
|
|
|
+ loanConditionSetList = contractLoanConditionSettingService.list(new QueryWrapper<ContractLoanConditionSetting>()
|
|
|
+ .eq("contract_info_id", contractInfo.getId())
|
|
|
+ .eq("condition_type", ConstantConversionUtil.CONTRACT_LOAN_CONDITION_SETTING_CONDITION));
|
|
|
+ } else {
|
|
|
+ loanConditionSetList = loanConditionSetList.stream().filter(setting -> setting.getChecked() != null && setting.getChecked()
|
|
|
+ && ConstantConversionUtil.CONTRACT_LOAN_CONDITION_SETTING_CONDITION.equals(setting.getConditionType())).collect(Collectors.toList());
|
|
|
+ }
|
|
|
if (null != loanConditionSetList && loanConditionSetList.size() > 0) {
|
|
|
List<ContractLoanConditionSetting> list2 = loanConditionSetList.stream()
|
|
|
.filter(e -> !e.getFixedCondition()).collect(Collectors.toList());
|
|
@@ -2278,7 +2308,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- fileAllList.add(file);
|
|
|
+ return file;
|
|
|
} else if (type.equals(ConstantConversionUtil.POOL_FACTORING_INFORMATION_DOMESTIC)) {
|
|
|
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
|
|
Configure configure = Configure.builder().bind("listMap2", policy)
|
|
@@ -2294,7 +2324,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- fileAllList.add(file);
|
|
|
+ return file;
|
|
|
} else if (type.equals(ConstantConversionUtil.FACTORING_SERVICE_CONFIRMATION)) {
|
|
|
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
|
|
Configure configure = Configure.builder().bind("listMap2", policy)
|
|
@@ -2307,13 +2337,14 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- fileAllList.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载保理信息表出错" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -2354,7 +2385,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
/**
|
|
|
* 下载应收账款转让通知书
|
|
|
*/
|
|
|
- private void dealNewNoticeDownloadAll(ContractInfo contractInfo, List<File> fileAllList, String absolutePath, String type) {
|
|
|
+ private File dealNewNoticeDownloadAll(ContractInfo contractInfo, String absolutePath, String type) {
|
|
|
String path;
|
|
|
XWPFTemplate template;
|
|
|
try {
|
|
@@ -2546,7 +2577,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
file.getParentFile().mkdirs();
|
|
|
}
|
|
|
template.writeToFile(file.getPath());
|
|
|
- fileAllList.add(file);
|
|
|
+ return file;
|
|
|
} else if (type.equals(ConstantConversionUtil.DOMESTIC_ACCOUNT_RECEIVABLE_TRANSFER_NOTICE_BRIGHT)) {
|
|
|
LoopRowTableRenderPolicy policy = new LoopRowTableRenderPolicy();
|
|
|
Configure configure = Configure.builder().bind("changeList", policy).build();
|
|
@@ -2557,20 +2588,20 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
file.getParentFile().mkdirs();
|
|
|
}
|
|
|
template.writeToFile(file.getPath());
|
|
|
- fileAllList.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "应收账款转让通知书" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 下载池保理应收账款入池确认书
|
|
|
*/
|
|
|
- private void dealNewConfirmDownload(ContractInfo contractInfo, List<File> fileAllList, String absolutePath, String type) {
|
|
|
+ private File dealNewConfirmDownload(ContractInfo contractInfo, String absolutePath, String type) {
|
|
|
try {
|
|
|
// 主合同信息
|
|
|
ReviewMasterContract masterContract = reviewMasterContractService.getOne(new QueryWrapper<ReviewMasterContract>()
|
|
@@ -2649,7 +2680,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
//融资本金
|
|
|
BigDecimal financingAmmount = financingInfo.getFinancingAmount() == null ? BigDecimal.ZERO : financingInfo.getFinancingAmount();
|
|
|
BigDecimal financingDays = new BigDecimal(Integer.parseInt(financingInfo.getFinancingPeriod().toString()));
|
|
|
- if (financingInfo.getOccupation() != null && financingInfo.getOccupation() == 0){
|
|
|
+ if (financingInfo.getOccupation() != null && financingInfo.getOccupation() == 0) {
|
|
|
//那如果综合考虑的话,这个公式改成:融资本金+融资本金*(12%-管理费率)/360*融资期限
|
|
|
BigDecimal balanceLong = financingAmmount
|
|
|
.add(financingAmmount
|
|
@@ -2657,7 +2688,7 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
.divide(new BigDecimal("360"), 8, BigDecimal.ROUND_HALF_UP).multiply(financingDays));
|
|
|
BigDecimal balance = balanceLong.setScale(3, RoundingMode.HALF_UP);
|
|
|
confirmMap.put("balance", balance);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
confirmMap.put("balance", BigDecimal.ZERO);
|
|
|
}
|
|
|
|
|
@@ -2750,21 +2781,21 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
if (!file.exists()) {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
- fileAllList.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载应收账款转让确认书错误" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 下载交易信息表
|
|
|
*
|
|
|
* @param contractInfo
|
|
|
- * @param list
|
|
|
*/
|
|
|
- private void dealNewTradingInfoDownload(ContractInfo contractInfo, List<File> list, Long basicId, String absolutePath) {
|
|
|
+ private File dealNewTradingInfoDownload(ContractInfo contractInfo, Long basicId, String absolutePath) {
|
|
|
try {
|
|
|
// 主合同信息
|
|
|
ReviewMasterContract masterContract = reviewMasterContractService.getOne(new QueryWrapper<ReviewMasterContract>()
|
|
@@ -2782,8 +2813,11 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
String path;
|
|
|
XWPFTemplate template;
|
|
|
ContractBasicContract basic = null;
|
|
|
- List<ContractBasicContract> basicContractList = contractBasicContractService.list(new QueryWrapper<ContractBasicContract>()
|
|
|
- .eq("contract_info_id", contractInfo.getId()));
|
|
|
+ List<ContractBasicContract> basicContractList = contractInfo.getContractBasicContractList();
|
|
|
+ if (CollectionUtil.isEmpty(basicContractList)) {
|
|
|
+ basicContractList = contractBasicContractService.list(new QueryWrapper<ContractBasicContract>()
|
|
|
+ .eq("contract_info_id", contractInfo.getId()));
|
|
|
+ }
|
|
|
for (ContractBasicContract basicContract : basicContractList) {
|
|
|
if (basicContract.getId().equals(basicId)) {
|
|
|
basic = basicContract;
|
|
@@ -2844,11 +2878,12 @@ public class NewContractMakingServiceImpl implements INewContractMakingService {
|
|
|
FileUtils.createParentDirectories(file);
|
|
|
}
|
|
|
template.writeToFile(path);
|
|
|
- list.add(file);
|
|
|
+ return file;
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
throw new BusinessException(CodeUtil.FAIL, "下载交易信息表出错" + e.getMessage());
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
}
|