|
@@ -28,6 +28,7 @@ import com.ruoyi.system.domain.review.ReviewComments;
|
|
|
import com.ruoyi.system.mapper.*;
|
|
|
import com.ruoyi.system.service.loan.ILoanApplicationService;
|
|
|
import lombok.SneakyThrows;
|
|
|
+import org.apache.commons.io.FilenameUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -192,6 +193,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
loanApplicationFj.setLoanApplicationId(loanApplication.getLoanApplicationId());
|
|
|
loanApplicationFj.setLoanApplicationNumber(loanApplication.getLoanApplicationNumber());
|
|
|
}
|
|
|
+ createPdfFromImages(loanApplicationFjList, loanApplication.getLoanApplicationNumber());
|
|
|
loanApplicationFjMapper.batchLoanApplicationFj(loanApplicationFjList);
|
|
|
}
|
|
|
List<ShareholderFj> shareholderFjList = loanApplication.getShareholderFjList();
|
|
@@ -215,6 +217,115 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
return i;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 合并图片生成PDF保存为文件
|
|
|
+ *
|
|
|
+ * @param loanApplicationFjList
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<LoanApplicationFj> createPdfFromImages(List<LoanApplicationFj> loanApplicationFjList, String loanApplicationNumber) {
|
|
|
+ //根据文件类型进行判断是否需要合成pdf
|
|
|
+ //公司章程
|
|
|
+ List<String> gszc = loanApplicationFjList.stream().filter(e -> "gszc".equals(e.getType()) && ("png".equals(e.getName().split("\\.")[1]) || "jpg".equals(e.getName().split("\\.")[1]) || "jpeg".equals(e.getName().split("\\.")[1]))).map(LoanApplicationFj::getUrl).collect(Collectors.toList());
|
|
|
+ //申请企业征信报告
|
|
|
+ List<String> sqqyzxbg = loanApplicationFjList.stream().filter(e -> "sqqyzxbg".equals(e.getType()) && ("png".equals(e.getName().split("\\.")[1]) || "jpg".equals(e.getName().split("\\.")[1]) || "jpeg".equals(e.getName().split("\\.")[1]))).map(LoanApplicationFj::getUrl).collect(Collectors.toList());
|
|
|
+ //关联企业征信报告
|
|
|
+ List<String> glqyzxbg = loanApplicationFjList.stream().filter(e -> "glqyzxbg".equals(e.getType()) && ("png".equals(e.getName().split("\\.")[1]) || "jpg".equals(e.getName().split("\\.")[1]) || "jpeg".equals(e.getName().split("\\.")[1]))).map(LoanApplicationFj::getUrl).collect(Collectors.toList());
|
|
|
+ //企业法人征信报告
|
|
|
+ List<String> qyfrzxbg = loanApplicationFjList.stream().filter(e -> "qyfrzxbg".equals(e.getType()) && ("png".equals(e.getName().split("\\.")[1]) || "jpg".equals(e.getName().split("\\.")[1]) || "jpeg".equals(e.getName().split("\\.")[1]))).map(LoanApplicationFj::getUrl).collect(Collectors.toList());
|
|
|
+ //实际控股人征信报告
|
|
|
+ List<String> sjkgrzxbg = loanApplicationFjList.stream().filter(e -> "sjkgrzxbg".equals(e.getType()) && ("png".equals(e.getName().split("\\.")[1]) || "jpg".equals(e.getName().split("\\.")[1]) || "jpeg".equals(e.getName().split("\\.")[1]))).map(LoanApplicationFj::getUrl).collect(Collectors.toList());
|
|
|
+ //实际控股人配偶征信报告
|
|
|
+ List<String> sjkgrpozxbg = loanApplicationFjList.stream().filter(e -> "sjkgrpozxbg".equals(e.getType()) && ("png".equals(e.getName().split("\\.")[1]) || "jpg".equals(e.getName().split("\\.")[1]) || "jpeg".equals(e.getName().split("\\.")[1]))).map(LoanApplicationFj::getUrl).collect(Collectors.toList());
|
|
|
+ //反担保人个人征信报告
|
|
|
+ List<String> fdbrgrzxbg = loanApplicationFjList.stream().filter(e -> "fdbrgrzxbg".equals(e.getType()) && ("png".equals(e.getName().split("\\.")[1]) || "jpg".equals(e.getName().split("\\.")[1]) || "jpeg".equals(e.getName().split("\\.")[1]))).map(LoanApplicationFj::getUrl).collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (gszc.size() > 0) {
|
|
|
+ for (int i = 0; i < gszc.size(); i++) {
|
|
|
+ ///profile/upload/RZDB202405281147018884551/公司章程_20240528114820A002.png 前缀替换
|
|
|
+ String replaced = gszc.get(i).replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
+ gszc.set(i, replaced);
|
|
|
+ }
|
|
|
+ createPdfFromImages(loanApplicationFjList, gszc, loanApplicationNumber, "公司章程_" + Seq.getId(Seq.uploadSeqType), "gszc");
|
|
|
+ }
|
|
|
+ if (sqqyzxbg.size() > 0) {
|
|
|
+ for (int i = 0; i < sqqyzxbg.size(); i++) {
|
|
|
+ String replaced = sqqyzxbg.get(i).replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
+ sqqyzxbg.set(i, replaced);
|
|
|
+ }
|
|
|
+ createPdfFromImages(loanApplicationFjList, sqqyzxbg, loanApplicationNumber, "申请企业征信报告_" + Seq.getId(Seq.uploadSeqType), "sqqyzxbg");
|
|
|
+ }
|
|
|
+ if (glqyzxbg.size() > 0) {
|
|
|
+ for (int i = 0; i < glqyzxbg.size(); i++) {
|
|
|
+ String replaced = glqyzxbg.get(i).replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
+ glqyzxbg.set(i, replaced);
|
|
|
+ }
|
|
|
+ createPdfFromImages(loanApplicationFjList, glqyzxbg, loanApplicationNumber, "关联企业征信报告_" + Seq.getId(Seq.uploadSeqType), "glqyzxbg");
|
|
|
+ }
|
|
|
+ if (qyfrzxbg.size() > 0) {
|
|
|
+ for (int i = 0; i < qyfrzxbg.size(); i++) {
|
|
|
+ String replaced = qyfrzxbg.get(i).replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
+ qyfrzxbg.set(i, replaced);
|
|
|
+ }
|
|
|
+ createPdfFromImages(loanApplicationFjList, qyfrzxbg, loanApplicationNumber, "企业法人征信报告_" + Seq.getId(Seq.uploadSeqType), "qyfrzxbg");
|
|
|
+ }
|
|
|
+ if (sjkgrzxbg.size() > 0) {
|
|
|
+ for (int i = 0; i < sjkgrzxbg.size(); i++) {
|
|
|
+ String replaced = sjkgrzxbg.get(i).replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
+ sjkgrzxbg.set(i, replaced);
|
|
|
+ }
|
|
|
+ createPdfFromImages(loanApplicationFjList, sjkgrzxbg, loanApplicationNumber, "实际控股人征信报告_" + Seq.getId(Seq.uploadSeqType), "sjkgrzxbg");
|
|
|
+ }
|
|
|
+ if (sjkgrpozxbg.size() > 0) {
|
|
|
+ for (int i = 0; i < sjkgrpozxbg.size(); i++) {
|
|
|
+ String replaced = sjkgrpozxbg.get(i).replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
+ sjkgrpozxbg.set(i, replaced);
|
|
|
+ }
|
|
|
+ createPdfFromImages(loanApplicationFjList, sjkgrpozxbg, loanApplicationNumber, "实际控股人配偶征信报告_" + Seq.getId(Seq.uploadSeqType), "sjkgrpozxbg");
|
|
|
+ }
|
|
|
+ if (fdbrgrzxbg.size() > 0) {
|
|
|
+ for (int i = 0; i < fdbrgrzxbg.size(); i++) {
|
|
|
+ String replaced = fdbrgrzxbg.get(i).replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
+ fdbrgrzxbg.set(i, replaced);
|
|
|
+ }
|
|
|
+ createPdfFromImages(loanApplicationFjList, fdbrgrzxbg, loanApplicationNumber, "反担保人个人征信报告_" + Seq.getId(Seq.uploadSeqType), "fdbrgrzxbg");
|
|
|
+ }
|
|
|
+ return loanApplicationFjList;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param imagePaths 图片地址集合
|
|
|
+ * @param loanApplicationNumber 申请编号
|
|
|
+ * @param originalFilename pdf文件名称
|
|
|
+ * @param type 文件类型
|
|
|
+ */
|
|
|
+ public List<LoanApplicationFj> createPdfFromImages(List<LoanApplicationFj> loanApplicationFjList, List<String> imagePaths, String loanApplicationNumber, String originalFilename, String type) {
|
|
|
+ // 上传文件路径 = 根+申请编号
|
|
|
+ String filePath = StringUtils.format("{}/{}/{}.{}", RuoYiConfig.getUploadPath(), loanApplicationNumber,
|
|
|
+ FilenameUtils.getBaseName(originalFilename), "pdf");
|
|
|
+ //pdf保存位置
|
|
|
+ File outPutPdf = new File(filePath);
|
|
|
+ try {
|
|
|
+ FileUploadUtils.createPdfFromImages(imagePaths, outPutPdf);
|
|
|
+ //往附件信息中插入对应PDF数据
|
|
|
+ LoanApplicationFj applicationFj = new LoanApplicationFj();
|
|
|
+ applicationFj.setLoanApplicationId(loanApplicationFjList.get(0).getLoanApplicationId());
|
|
|
+ applicationFj.setLoanApplicationNumber(loanApplicationNumber);
|
|
|
+ applicationFj.setName(originalFilename + ".pdf");
|
|
|
+ applicationFj.setUrl(StringUtils.format("{}/{}/{}.{}", "/profile/upload", loanApplicationNumber,
|
|
|
+ FilenameUtils.getBaseName(originalFilename), "pdf"));
|
|
|
+ applicationFj.setBigType(A);
|
|
|
+ applicationFj.setType(type);
|
|
|
+ //给前端判断是否是系统生成的pdf
|
|
|
+ applicationFj.setRemark(ONE);
|
|
|
+ loanApplicationFjList.add(applicationFj);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return loanApplicationFjList;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改贷款申请主
|
|
|
*
|
|
@@ -235,6 +346,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
loanApplicationFj.setLoanApplicationId(loanApplication.getLoanApplicationId());
|
|
|
loanApplicationFj.setLoanApplicationNumber(loanApplication.getLoanApplicationNumber());
|
|
|
}
|
|
|
+ createPdfFromImages(loanApplicationFjList, loanApplication.getLoanApplicationNumber());
|
|
|
loanApplicationFjMapper.batchLoanApplicationFj(loanApplicationFjList);
|
|
|
}
|
|
|
shareholderFjMapper.deleteShareholderFjByLoanApplicationId(loanApplicationId);
|
|
@@ -587,7 +699,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
String enterpriseName = loanApplicationOld.getEnterpriseName();
|
|
|
String loanApplicationNumber = loanApplicationOld.getLoanApplicationNumber();
|
|
|
//如果退到 A角色审核 B角色审核 还需要插入待审核
|
|
|
- if (loanApplication.getAuditSchedule().equals(TWO)){
|
|
|
+ if (loanApplication.getAuditSchedule().equals(TWO)) {
|
|
|
WaitRemind waitRemind = new WaitRemind();
|
|
|
waitRemind.setLoanApplicationId(loanApplicationId);
|
|
|
waitRemind.setLoanApplicationNumber(loanApplicationNumber);
|
|
@@ -599,7 +711,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
waitRemind.setRemindContent(enterpriseName + "有一条贷款申请需及时处理");
|
|
|
waitRemindMapper.insertWaitRemind(waitRemind);
|
|
|
}
|
|
|
- if (loanApplication.getAuditSchedule().equals(THR)){
|
|
|
+ if (loanApplication.getAuditSchedule().equals(THR)) {
|
|
|
WaitRemind waitRemind = new WaitRemind();
|
|
|
waitRemind.setLoanApplicationId(loanApplicationId);
|
|
|
waitRemind.setLoanApplicationNumber(loanApplicationNumber);
|
|
@@ -795,14 +907,14 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
String fileName = "";
|
|
|
String fileNameHz = "";
|
|
|
String wordPath = "";
|
|
|
- String sheet ="";
|
|
|
+ String sheet = "";
|
|
|
//生成二维码
|
|
|
- String ewmPath = RuoYiConfig.getProfile()+"/mb/ewm";
|
|
|
+ String ewmPath = RuoYiConfig.getProfile() + "/mb/ewm";
|
|
|
JSONObject json = new JSONObject();
|
|
|
- json.put("type","2");
|
|
|
- json.put("loanApplicationNumber",loanApplication.getLoanApplicationNumber());
|
|
|
- json.put("bigType",bigType);
|
|
|
- json.put("fileType",fileType);
|
|
|
+ json.put("type", "2");
|
|
|
+ json.put("loanApplicationNumber", loanApplication.getLoanApplicationNumber());
|
|
|
+ json.put("bigType", bigType);
|
|
|
+ json.put("fileType", fileType);
|
|
|
String imagePath = QRCodeUtils.encodeNodate(json.toString(), null, ewmPath, true);
|
|
|
if (StringUtils.isNotEmpty(imagePath)) {
|
|
|
PictureRenderData picture = Pictures.ofLocal(imagePath).size(70, 70).create();//本地图片地址
|
|
@@ -946,7 +1058,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
fileName = loanApplication.getEnterpriseName() + "-项目评审意见签批表";
|
|
|
fileNameHz = fileName + ".xlsx";
|
|
|
templatePath = RuoYiConfig.getProfile() + "/mb/项目评审意见签批表.xlsx";
|
|
|
- fileDir = RuoYiConfig.getProfile() + "/mb/temporarily/" + loanApplicationNumber + "/"+fileNameHz;
|
|
|
+ fileDir = RuoYiConfig.getProfile() + "/mb/temporarily/" + loanApplicationNumber + "/" + fileNameHz;
|
|
|
sheet = ExcelFillUtils.fillOneSheet(templatePath, fileDir, "Sheet1", list);
|
|
|
|
|
|
path = sheet;
|
|
@@ -963,7 +1075,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
fileName = loanApplication.getEnterpriseName() + "-担保项目合法合规表个人个体户";
|
|
|
}
|
|
|
fileNameHz = fileName + ".xlsx";
|
|
|
- fileDir = RuoYiConfig.getProfile() + "/mb/temporarily/" + loanApplicationNumber + "/"+fileNameHz;
|
|
|
+ fileDir = RuoYiConfig.getProfile() + "/mb/temporarily/" + loanApplicationNumber + "/" + fileNameHz;
|
|
|
sheet = ExcelFillUtils.fillOneSheet(templatePath, fileDir, "Sheet1", list);
|
|
|
path = sheet;
|
|
|
break;
|
|
@@ -979,7 +1091,7 @@ public class LoanApplicationServiceImpl implements ILoanApplicationService {
|
|
|
fileName = loanApplication.getEnterpriseName() + "-放款审批合规表个人个体户";
|
|
|
}
|
|
|
fileNameHz = fileName + ".xlsx";
|
|
|
- fileDir = RuoYiConfig.getProfile() + "/mb/temporarily/" + loanApplicationNumber + "/"+fileNameHz;
|
|
|
+ fileDir = RuoYiConfig.getProfile() + "/mb/temporarily/" + loanApplicationNumber + "/" + fileNameHz;
|
|
|
sheet = ExcelFillUtils.fillOneSheet(templatePath, fileDir, "Sheet1", list);
|
|
|
path = sheet;
|
|
|
break;
|