|
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.huyi.service.base.entity.*;
|
|
|
import com.huyi.service.base.service.*;
|
|
|
import com.huyi.service.constant.FileConstants;
|
|
|
+import com.huyi.service.credit.service.OwnCreditService;
|
|
|
import com.huyi.service.util.DocumentConstant;
|
|
|
import com.keao.tianhu.core.util.AmtUtil;
|
|
|
import com.spire.doc.Document;
|
|
@@ -103,6 +104,9 @@ public class RecordSealController extends BaseController {
|
|
|
//待办服务类
|
|
|
@Autowired
|
|
|
private ISysNoticeService sysNoticeService;
|
|
|
+ //自写融信服务类
|
|
|
+ @Autowired
|
|
|
+ private OwnCreditService ownCreditService;
|
|
|
|
|
|
/**
|
|
|
* 获取合同文件
|
|
@@ -240,38 +244,30 @@ public class RecordSealController extends BaseController {
|
|
|
Map<String,Object> p = new HashMap<>();
|
|
|
//文件信息
|
|
|
List<Map<String,String>> list = new ArrayList<>();
|
|
|
- List<PubFileInf> fileInfList = new ArrayList<>();
|
|
|
p.put("list",list);
|
|
|
+ List<Map> fileInfList;
|
|
|
if(contractIdList.size() < 1){
|
|
|
return AjaxResult.success(p);
|
|
|
}else{
|
|
|
//查询合同
|
|
|
- LambdaQueryWrapper<ZcFinanceContract> contractLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- contractLambdaQueryWrapper.in(ZcFinanceContract::getZfcId,contractIdList);
|
|
|
- contractLambdaQueryWrapper.like(ZcFinanceContract::getZfcNode,code);
|
|
|
- List<ZcFinanceContract> contractList = contractService.findZcFinanceContracts(contractLambdaQueryWrapper);
|
|
|
- if(contractList.size() > 0 ){
|
|
|
- //提取文件编号
|
|
|
- List<String> fileIdList = CommonUtil.getIdFromList(contractList,"zfcFile");
|
|
|
- LambdaQueryWrapper<PubFileInf> fileInfLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- fileInfLambdaQueryWrapper.in(PubFileInf::getPfiFileId,fileIdList);
|
|
|
- fileInfLambdaQueryWrapper.eq(PubFileInf::getPfiIsDel,"00");
|
|
|
- fileInfList = fileInfService.findPubFileInfs(fileInfLambdaQueryWrapper);
|
|
|
- }
|
|
|
+ Map contractMap =new HashMap();
|
|
|
+ contractMap.put("zfcId",contractIdList);
|
|
|
+ contractMap.put("zfcNode",code);
|
|
|
+ fileInfList = ownCreditService.getContact(contractMap);
|
|
|
|
|
|
}
|
|
|
if(fileInfList.size() > 0 ){
|
|
|
//提取所有的文件url
|
|
|
List<String> urlList = CommonUtil.getIdFromList(fileInfList,"pfiFileUrl");
|
|
|
//提取文件名
|
|
|
- List<String> fileNameList = CommonUtil.getIdFromList(fileInfList,"pfiFileName");
|
|
|
+ List<String> fileNameList = CommonUtil.getIdFromList(fileInfList,"zfcName");
|
|
|
for(int i =0 ; i < urlList.size() ;i++){
|
|
|
//TODO 文件路径需要修改
|
|
|
//替换word文档中的变量
|
|
|
//String directory = FileConstants.REMOTE_FILE_PATH;
|
|
|
String directory = configService.selectConfigByKey("credit_file_path").getMsg();
|
|
|
//文件下载
|
|
|
- String filePath = downloadFile(urlList.get(i),fileNameList.get(i));
|
|
|
+ String filePath = downloadFile(urlList.get(i),fileNameList.get(i)+".docx");
|
|
|
//往word中填充数据
|
|
|
Map<String,Object> ps = new HashMap<>();
|
|
|
//开立方
|
|
@@ -481,24 +477,14 @@ public class RecordSealController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- List<PubFileInf> fileInfList = new ArrayList<>();
|
|
|
- List<ZcFinanceContract> contractList = new ArrayList<>();
|
|
|
+ List<Map> fileInfList = new ArrayList<>();
|
|
|
+ //TODO 合同模板
|
|
|
if(contractIdList.size() > 0){
|
|
|
//查询合同
|
|
|
- LambdaQueryWrapper<ZcFinanceContract> contractLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- contractLambdaQueryWrapper.in(ZcFinanceContract::getZfcId,contractIdList);
|
|
|
- contractLambdaQueryWrapper.like(ZcFinanceContract::getZfcNode,code);
|
|
|
- contractLambdaQueryWrapper.orderByAsc(ZcFinanceContract::getZfcFile);
|
|
|
- contractList = contractService.findZcFinanceContracts(contractLambdaQueryWrapper);
|
|
|
- if(contractList.size() > 0 ){
|
|
|
- //提取文件编号
|
|
|
- List<String> fileIdList = CommonUtil.getIdFromList(contractList,"zfcFile");
|
|
|
- LambdaQueryWrapper<PubFileInf> fileInfLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- fileInfLambdaQueryWrapper.in(PubFileInf::getPfiFileId,fileIdList);
|
|
|
- fileInfLambdaQueryWrapper.eq(PubFileInf::getPfiIsDel,"00");
|
|
|
- fileInfLambdaQueryWrapper.orderByAsc(PubFileInf::getPfiFileId);
|
|
|
- fileInfList = fileInfService.findPubFileInfs(fileInfLambdaQueryWrapper);
|
|
|
- }
|
|
|
+ Map contractMap =new HashMap();
|
|
|
+ contractMap.put("zfcId",contractIdList);
|
|
|
+ contractMap.put("zfcNode",code);
|
|
|
+ fileInfList = ownCreditService.getContact(contractMap);
|
|
|
}
|
|
|
// if(contractIdList.size() < 1){
|
|
|
// return AjaxResult.success();
|
|
@@ -525,7 +511,7 @@ public class RecordSealController extends BaseController {
|
|
|
//判断是否为已盖章文件
|
|
|
LambdaQueryWrapper<ZcFinanceFileRel> fileRelLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
fileRelLambdaQueryWrapper.eq(ZcFinanceFileRel::getZffrFinanceId, zfiId);
|
|
|
- fileRelLambdaQueryWrapper.eq(ZcFinanceFileRel::getZffrContractId, contractList.get(i).getZfcId());
|
|
|
+ fileRelLambdaQueryWrapper.eq(ZcFinanceFileRel::getZffrContractId, fileInfList.get(i).get("zfcId"));
|
|
|
List<ZcFinanceFileRel> financeFileList = financeFileRelService.findZcFinanceFileRels(fileRelLambdaQueryWrapper);
|
|
|
// LambdaQueryWrapper<ZcFinanceRecordFileRel> fileRelLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
// //融信id
|
|
@@ -545,7 +531,8 @@ public class RecordSealController extends BaseController {
|
|
|
//String directory = FileConstants.REMOTE_FILE_PATH;
|
|
|
String directory = configService.selectConfigByKey("credit_file_path").getMsg();
|
|
|
//文件下载
|
|
|
- filePath = downloadFile(fileInfList.get(i).getPfiFileUrl(),fileInfList.get(i).getPfiFileName());
|
|
|
+ //TODO 合同模板名称
|
|
|
+ filePath = downloadFile(String.valueOf(fileInfList.get(i).get("pfiFileUrl")),String.valueOf(fileInfList.get(i).get("zfcName"))+".docx");
|
|
|
//往word中填充数据
|
|
|
Map<String,Object> ps = new HashMap<>();
|
|
|
//开立方
|
|
@@ -586,8 +573,8 @@ public class RecordSealController extends BaseController {
|
|
|
//保存为PDF格式
|
|
|
//截取文件名称
|
|
|
//获取.的位置
|
|
|
- int index = fileInfList.get(i).getPfiFileName().lastIndexOf(".");
|
|
|
- fileName = fileInfList.get(i).getPfiFileName().substring(0,index);
|
|
|
+ int index = String.valueOf(fileInfList.get(i).get("zfcName")).lastIndexOf(".");
|
|
|
+ fileName =String.valueOf(fileInfList.get(i).get("zfcName")).substring(0,index);
|
|
|
// doc.saveToFile(directory + fileName + currecntDate + ".pdf", FileFormat.PDF);
|
|
|
WordPdfUtil.doc2pdf(filePath,directory + fileName + currecntDate + ".pdf");
|
|
|
filePath = directory + fileName + currecntDate + ".pdf";
|
|
@@ -611,7 +598,7 @@ public class RecordSealController extends BaseController {
|
|
|
/**-------- 获取合同盖章关键字 开始--------**/
|
|
|
//获取合同信息
|
|
|
//获取合同的节点
|
|
|
- String contractNode = contractList.get(i).getZfcNode();
|
|
|
+ String contractNode =String.valueOf(fileInfList.get(i).get("zfcNode"));
|
|
|
//关键字
|
|
|
String keyWords = "";
|
|
|
//判断节点是否用,分割
|
|
@@ -624,7 +611,7 @@ public class RecordSealController extends BaseController {
|
|
|
site = j;
|
|
|
}
|
|
|
}
|
|
|
- String signKeyWord = contractList.get(i).getZfcSignKeyword();
|
|
|
+ String signKeyWord = String.valueOf(fileInfList.get(i).get("zfcSignKeyword"));
|
|
|
String [] arrKeyWord = signKeyWord.split(",");
|
|
|
if(arr.length != arrKeyWord.length){
|
|
|
throw new Exception("合同信息有误");
|
|
@@ -632,7 +619,7 @@ public class RecordSealController extends BaseController {
|
|
|
keyWords = arrKeyWord[site];
|
|
|
|
|
|
}else {
|
|
|
- keyWords = contractList.get(i).getZfcSignKeyword();
|
|
|
+ keyWords = String.valueOf(fileInfList.get(i).get("zfcSignKeyword"));
|
|
|
}
|
|
|
if(CommonUtil.isEmpty(keyWords)){
|
|
|
throw new Exception("获取关键字失败");
|
|
@@ -685,8 +672,8 @@ public class RecordSealController extends BaseController {
|
|
|
//文件传输
|
|
|
File file = new File(path + contractNo + ".pdf");
|
|
|
FileInputStream input = new FileInputStream(file);
|
|
|
- int index = fileInfList.get(i).getPfiFileName().lastIndexOf(".");
|
|
|
- MultipartFile multipartFile =new MockMultipartFile("file", fileInfList.get(i).getPfiFileName().substring(0,index)+".pdf", "text/plain", IOUtils.toByteArray(input));
|
|
|
+ int index = String.valueOf(fileInfList.get(i).get("zfcName")).lastIndexOf(".");
|
|
|
+ MultipartFile multipartFile =new MockMultipartFile("file", String.valueOf(fileInfList.get(i).get("zfcName")).substring(0,index)+".pdf", "text/plain", IOUtils.toByteArray(input));
|
|
|
R<com.tianhu.system.api.domain.PubFileInf> fileResult = remoteFileService.uploadFile(multipartFile,"01", "02","00",companyId,token);
|
|
|
|
|
|
ZcFinanceRecordFileRel recordFileRel =new ZcFinanceRecordFileRel();
|
|
@@ -697,7 +684,7 @@ public class RecordSealController extends BaseController {
|
|
|
recordFileRel.setZfrfrId(IdUtils.fastSimpleUUID());
|
|
|
//融资id
|
|
|
recordFileRel.setZfrfrFinanceId(zfrId);
|
|
|
- recordFileRel.setZfrfrContractId(contractList.get(i).getZfcId());
|
|
|
+ recordFileRel.setZfrfrContractId(String.valueOf(fileInfList.get(i).get("zfcId")));
|
|
|
// 已盖章文件
|
|
|
// }
|
|
|
// else {
|