|
@@ -13,9 +13,13 @@ import com.ruoyi.common.config.RuoYiConfig;
|
|
|
import com.ruoyi.common.core.redis.RedisCache;
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
|
import com.ruoyi.common.utils.uuid.Seq;
|
|
|
+import com.ruoyi.system.domain.guarantee.GuaranteeInfo;
|
|
|
+import com.ruoyi.system.domain.guarantee.GuaranteeInfoFj;
|
|
|
import com.ruoyi.system.domain.loan.LoanApplicationFj;
|
|
|
import com.ruoyi.system.domain.loan.ShareholderFj;
|
|
|
+import com.ruoyi.system.mapper.GuaranteeInfoFjMapper;
|
|
|
import com.ruoyi.system.mapper.ShareholderFjMapper;
|
|
|
+import com.ruoyi.system.service.guarantee.IGuaranteeInfoFjService;
|
|
|
import com.ruoyi.system.service.loan.ILoanApplicationFjService;
|
|
|
import org.apache.commons.io.FilenameUtils;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
@@ -48,8 +52,7 @@ import static com.ruoyi.common.constant.CommonConstants.*;
|
|
|
*/
|
|
|
|
|
|
@Component
|
|
|
-public class AsyncFactory
|
|
|
-{
|
|
|
+public class AsyncFactory {
|
|
|
private static final Logger sys_user_logger = LoggerFactory.getLogger("sys-user");
|
|
|
|
|
|
@Autowired
|
|
@@ -64,21 +67,18 @@ public class AsyncFactory
|
|
|
* 记录登录信息
|
|
|
*
|
|
|
* @param username 用户名
|
|
|
- * @param status 状态
|
|
|
- * @param message 消息
|
|
|
- * @param args 列表
|
|
|
+ * @param status 状态
|
|
|
+ * @param message 消息
|
|
|
+ * @param args 列表
|
|
|
* @return 任务task
|
|
|
*/
|
|
|
public static TimerTask recordLogininfor(final String username, final String status, final String message,
|
|
|
- final Object... args)
|
|
|
- {
|
|
|
+ final Object... args) {
|
|
|
final UserAgent userAgent = UserAgent.parseUserAgentString(ServletUtils.getRequest().getHeader("User-Agent"));
|
|
|
final String ip = IpUtils.getIpAddr();
|
|
|
- return new TimerTask()
|
|
|
- {
|
|
|
+ return new TimerTask() {
|
|
|
@Override
|
|
|
- public void run()
|
|
|
- {
|
|
|
+ public void run() {
|
|
|
String address = AddressUtils.getRealAddressByIP(ip);
|
|
|
StringBuilder s = new StringBuilder();
|
|
|
s.append(LogUtils.getBlock(ip));
|
|
@@ -101,12 +101,9 @@ public class AsyncFactory
|
|
|
logininfor.setOs(os);
|
|
|
logininfor.setMsg(message);
|
|
|
// 日志状态
|
|
|
- if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER))
|
|
|
- {
|
|
|
+ if (StringUtils.equalsAny(status, Constants.LOGIN_SUCCESS, Constants.LOGOUT, Constants.REGISTER)) {
|
|
|
logininfor.setStatus(Constants.SUCCESS);
|
|
|
- }
|
|
|
- else if (Constants.LOGIN_FAIL.equals(status))
|
|
|
- {
|
|
|
+ } else if (Constants.LOGIN_FAIL.equals(status)) {
|
|
|
logininfor.setStatus(Constants.FAIL);
|
|
|
}
|
|
|
// 插入数据
|
|
@@ -121,13 +118,10 @@ public class AsyncFactory
|
|
|
* @param operLog 操作日志信息
|
|
|
* @return 任务task
|
|
|
*/
|
|
|
- public static TimerTask recordOper(final SysOperLog operLog)
|
|
|
- {
|
|
|
- return new TimerTask()
|
|
|
- {
|
|
|
+ public static TimerTask recordOper(final SysOperLog operLog) {
|
|
|
+ return new TimerTask() {
|
|
|
@Override
|
|
|
- public void run()
|
|
|
- {
|
|
|
+ public void run() {
|
|
|
// 远程查询操作地点
|
|
|
operLog.setOperLocation(AddressUtils.getRealAddressByIP(operLog.getOperIp()));
|
|
|
SpringUtils.getBean(ISysOperLogService.class).insertOperlog(operLog);
|
|
@@ -142,23 +136,22 @@ public class AsyncFactory
|
|
|
* @return
|
|
|
*/
|
|
|
public static TimerTask createPdfFromImages(List<LoanApplicationFj> loanApplicationFjList, String loanApplicationNumber) {
|
|
|
- return new TimerTask(){
|
|
|
+ return new TimerTask() {
|
|
|
@Override
|
|
|
- public void run()
|
|
|
- {
|
|
|
- String key = "lock:A:"+loanApplicationNumber;
|
|
|
- redisCache.setCacheObject(key,1,5, TimeUnit.MINUTES);
|
|
|
+ public void run() {
|
|
|
+ String key = "lock:A:" + loanApplicationNumber;
|
|
|
+ redisCache.setCacheObject(key, 1, 5, TimeUnit.MINUTES);
|
|
|
//自定义锁,必须要所有异步任务都跑完才能再次修改
|
|
|
//根据文件类型进行判断是否需要合成pdf
|
|
|
Map<String, List<LoanApplicationFj>> bigTypeMap = loanApplicationFjList.stream().collect(Collectors.groupingBy(LoanApplicationFj::getBigType));
|
|
|
- if (bigTypeMap.size() > 0){
|
|
|
+ if (bigTypeMap.size() > 0) {
|
|
|
List<LoanApplicationFj> loanApplicationFjListA = bigTypeMap.get(A);
|
|
|
List<LoanApplicationFj> loanApplicationFjListB = bigTypeMap.get(B);
|
|
|
- if (loanApplicationFjListA != null && loanApplicationFjListA.size() > 0){
|
|
|
- createPdfFromImages(loanApplicationFjList,loanApplicationFjListA,loanApplicationNumber,A);
|
|
|
+ if (loanApplicationFjListA != null && loanApplicationFjListA.size() > 0) {
|
|
|
+ createPdfFromImages(loanApplicationFjList, loanApplicationFjListA, loanApplicationNumber, A);
|
|
|
}
|
|
|
- if (loanApplicationFjListB != null && loanApplicationFjListB.size() > 0){
|
|
|
- createPdfFromImages(loanApplicationFjList,loanApplicationFjListB,loanApplicationNumber,B);
|
|
|
+ if (loanApplicationFjListB != null && loanApplicationFjListB.size() > 0) {
|
|
|
+ createPdfFromImages(loanApplicationFjList, loanApplicationFjListB, loanApplicationNumber, B);
|
|
|
}
|
|
|
}
|
|
|
//自定义锁,必须要所有异步任务都跑完才能再次修改
|
|
@@ -168,20 +161,20 @@ public class AsyncFactory
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
- * @param loanApplicationFjList 全体附件
|
|
|
+ * @param loanApplicationFjList 全体附件
|
|
|
* @param loanApplicationFjListA 分附件大类集合
|
|
|
* @return
|
|
|
*/
|
|
|
- public static void createPdfFromImages(List<LoanApplicationFj> loanApplicationFjList, List<LoanApplicationFj> loanApplicationFjListA,String loanApplicationNumber,String bigType){
|
|
|
- if (loanApplicationFjListA != null && loanApplicationFjListA.size() > 0){
|
|
|
+ public static void createPdfFromImages(List<LoanApplicationFj> loanApplicationFjList, List<LoanApplicationFj> loanApplicationFjListA, String loanApplicationNumber, String bigType) {
|
|
|
+ if (loanApplicationFjListA != null && loanApplicationFjListA.size() > 0) {
|
|
|
Map<String, List<LoanApplicationFj>> typeMap = loanApplicationFjListA.stream().collect(Collectors.groupingBy(LoanApplicationFj::getType));
|
|
|
+ List<LoanApplicationFj> list = new ArrayList<>();
|
|
|
for (String type : typeMap.keySet()) {
|
|
|
List<LoanApplicationFj> loanApplicationFjListInsert = typeMap.get(type);
|
|
|
//获取附件名称
|
|
|
String fjName = loanApplicationFjListInsert.get(0).getName().split("_")[0];
|
|
|
List<String> typeList = loanApplicationFjListInsert.stream().filter(e -> type.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 (typeList.size() > 0){
|
|
|
+ if (typeList.size() > 0) {
|
|
|
for (int i = 0; i < typeList.size(); i++) {
|
|
|
///profile/upload/RZDB202405281147018884551/公司章程_20240528114820A002.png 前缀替换
|
|
|
String replaced = typeList.get(i).replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
@@ -189,29 +182,33 @@ public class AsyncFactory
|
|
|
}
|
|
|
//先删除原先的pdf数据库记录
|
|
|
List<LoanApplicationFj> pdfOne = loanApplicationFjListInsert.stream().filter(e -> ObjectUtils.isNotEmpty(e.getRemark()) && e.getRemark().equals(ONE) && ("pdf".equals(e.getName().split("\\.")[1]))).collect(Collectors.toList());
|
|
|
- if (pdfOne.size() > 0){
|
|
|
+ if (pdfOne.size() > 0) {
|
|
|
for (LoanApplicationFj loanApplicationFj : pdfOne) {
|
|
|
//删除数据库数据
|
|
|
SpringUtils.getBean(ILoanApplicationFjService.class).deleteLoanApplicationFjByFjId(loanApplicationFj.getFjId());
|
|
|
//删除服务器记录
|
|
|
String urlPdf = loanApplicationFj.getUrl();
|
|
|
- if (StringUtils.isNotBlank(urlPdf)){
|
|
|
+ if (StringUtils.isNotBlank(urlPdf)) {
|
|
|
String filePath = urlPdf.replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
//删除服务器上对应文件
|
|
|
File file = new File(filePath);
|
|
|
- if (file.exists()){
|
|
|
- if (file.delete()){
|
|
|
- System.out.println("删除:"+filePath);
|
|
|
- }else {
|
|
|
- System.out.println("删除:"+filePath+"失败");
|
|
|
+ if (file.exists()) {
|
|
|
+ if (file.delete()) {
|
|
|
+ System.out.println("删除:" + filePath);
|
|
|
+ } else {
|
|
|
+ System.out.println("删除:" + filePath + "失败");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- createPdfFromImages(loanApplicationFjList, typeList, loanApplicationNumber, fjName+"_" + Seq.getId(Seq.uploadSeqType), type,bigType);
|
|
|
+ createPdfFromImages(list, loanApplicationFjList, typeList, loanApplicationNumber, fjName + "_" + Seq.getId(Seq.uploadSeqType), type, bigType);
|
|
|
}
|
|
|
}
|
|
|
+ if (list.size() > 0){
|
|
|
+ // 插入数据
|
|
|
+ SpringUtils.getBean(ILoanApplicationFjService.class).insertLoanApplicationFj(list);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -221,14 +218,14 @@ public class AsyncFactory
|
|
|
* @param originalFilename pdf文件名称
|
|
|
* @param type 文件类型
|
|
|
*/
|
|
|
- public static void createPdfFromImages(List<LoanApplicationFj> loanApplicationFjList, List<String> imagePaths, String loanApplicationNumber, String originalFilename, String type,String bigType) {
|
|
|
+ public static List<LoanApplicationFj> createPdfFromImages(List<LoanApplicationFj> list, List<LoanApplicationFj> loanApplicationFjList, List<String> imagePaths, String loanApplicationNumber, String originalFilename, String type, String bigType) {
|
|
|
// 上传文件路径 = 根+申请编号
|
|
|
String filePath = StringUtils.format("{}/{}/{}.{}", RuoYiConfig.getUploadPath(), loanApplicationNumber,
|
|
|
FilenameUtils.getBaseName(originalFilename), "pdf");
|
|
|
//pdf保存位置
|
|
|
File outPutPdf = new File(filePath);
|
|
|
try {
|
|
|
- List list = new ArrayList();
|
|
|
+
|
|
|
FileUploadUtils.createPdfFromImages(imagePaths, outPutPdf);
|
|
|
//往附件信息中插入对应PDF数据
|
|
|
LoanApplicationFj applicationFj = new LoanApplicationFj();
|
|
@@ -242,43 +239,40 @@ public class AsyncFactory
|
|
|
//给前端判断是否是系统生成的pdf
|
|
|
applicationFj.setRemark(ONE);
|
|
|
list.add(applicationFj);
|
|
|
- // 插入数据
|
|
|
- SpringUtils.getBean(ILoanApplicationFjService.class).insertLoanApplicationFj(list);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
/**
|
|
|
- * 合并图片生成PDF保存为文件
|
|
|
+ * 股东附件合并图片生成PDF保存为文件
|
|
|
*
|
|
|
* @param shareholderFjList
|
|
|
* @return
|
|
|
*/
|
|
|
|
|
|
public static TimerTask createPdfFromImagesShareholder(List<ShareholderFj> shareholderFjList, String loanApplicationNumber) {
|
|
|
- return new TimerTask(){
|
|
|
+ return new TimerTask() {
|
|
|
@Override
|
|
|
- public void run()
|
|
|
- {
|
|
|
- String key = "lock:B:"+loanApplicationNumber;
|
|
|
- redisCache.setCacheObject(key,1,5, TimeUnit.MINUTES);
|
|
|
+ public void run() {
|
|
|
+ String key = "lock:B:" + loanApplicationNumber;
|
|
|
+ redisCache.setCacheObject(key, 1, 5, TimeUnit.MINUTES);
|
|
|
List<String> imagePaths = new ArrayList<>();
|
|
|
//根据文件类型进行判断是否需要合成pdf
|
|
|
for (ShareholderFj shareholderFj : shareholderFjList) {
|
|
|
//获取原先的pdf地址,去服务器上删除要替换路径
|
|
|
String shareholderZxUrlPdf = shareholderFj.getShareholderZxUrlPdf();
|
|
|
- if (StringUtils.isNotBlank(shareholderZxUrlPdf)){
|
|
|
+ if (StringUtils.isNotBlank(shareholderZxUrlPdf)) {
|
|
|
String filePath = shareholderZxUrlPdf.replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
//删除服务器上对应文件
|
|
|
File file = new File(filePath);
|
|
|
- if (file.exists()){
|
|
|
- if (file.delete()){
|
|
|
- System.out.println("删除:"+filePath);
|
|
|
- }else {
|
|
|
- System.out.println("删除:"+filePath+"失败");
|
|
|
+ if (file.exists()) {
|
|
|
+ if (file.delete()) {
|
|
|
+ System.out.println("删除:" + filePath);
|
|
|
+ } else {
|
|
|
+ System.out.println("删除:" + filePath + "失败");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -286,13 +280,13 @@ public class AsyncFactory
|
|
|
if (StringUtils.isNotEmpty(shareholderZxUrl)) {
|
|
|
String[] split = shareholderZxUrl.split(",");
|
|
|
for (String fileName : split) {
|
|
|
- if ("png".equals(fileName.split("\\.")[1]) || "jpg".equals(fileName.split("\\.")[1]) || "jpeg".equals(fileName.split("\\.")[1])){
|
|
|
+ if ("png".equals(fileName.split("\\.")[1]) || "jpg".equals(fileName.split("\\.")[1]) || "jpeg".equals(fileName.split("\\.")[1])) {
|
|
|
imagePaths.add(fileName);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
if (imagePaths.size() > 0) {
|
|
|
- String substring = imagePaths.get(0).substring(imagePaths.get(0).lastIndexOf("/")+1, imagePaths.get(0).lastIndexOf("_"))+Seq.getId(Seq.uploadSeqType);
|
|
|
+ String substring = imagePaths.get(0).substring(imagePaths.get(0).lastIndexOf("/") + 1, imagePaths.get(0).lastIndexOf("_")) + Seq.getId(Seq.uploadSeqType);
|
|
|
|
|
|
for (int i = 0; i < imagePaths.size(); i++) {
|
|
|
//前缀替换
|
|
@@ -316,12 +310,12 @@ public class AsyncFactory
|
|
|
}
|
|
|
//判断是否有股东shareholder_fj_id
|
|
|
List<ShareholderFj> shareholderFjsInsert = shareholderFjList.stream().filter(e -> ObjectUtils.isEmpty(e.getShareholderFjId())).collect(Collectors.toList());
|
|
|
- if (shareholderFjsInsert.size() > 0){
|
|
|
+ if (shareholderFjsInsert.size() > 0) {
|
|
|
// 新增股东数据
|
|
|
SpringUtils.getBean(ShareholderFjMapper.class).batchShareholderFj(shareholderFjsInsert);
|
|
|
}
|
|
|
List<ShareholderFj> shareholderFjsUpdate = shareholderFjList.stream().filter(e -> ObjectUtils.isNotEmpty(e.getShareholderFjId())).collect(Collectors.toList());
|
|
|
- if (shareholderFjsUpdate.size() > 0){
|
|
|
+ if (shareholderFjsUpdate.size() > 0) {
|
|
|
for (ShareholderFj shareholderFj : shareholderFjsUpdate) {
|
|
|
//更新股东信息
|
|
|
SpringUtils.getBean(ShareholderFjMapper.class).updateShareholderFj(shareholderFj);
|
|
@@ -331,4 +325,131 @@ public class AsyncFactory
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 反担保附件合并图片生成PDF保存为文件
|
|
|
+ *
|
|
|
+ * @param guaranteeInfoList 反担保基础信息集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+
|
|
|
+ public static TimerTask createPdfFromImagesGuaranteeInfo(List<GuaranteeInfo> guaranteeInfoList, String loanApplicationNumber) {
|
|
|
+ return new TimerTask() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ String key = "lock:C:" + loanApplicationNumber;
|
|
|
+ redisCache.setCacheObject(key, 1, 5, TimeUnit.MINUTES);
|
|
|
+ List<GuaranteeInfoFj> list = new ArrayList();
|
|
|
+ //根据文件类型进行判断是否需要合成pdf
|
|
|
+ for (GuaranteeInfo guaranteeInfo : guaranteeInfoList) {
|
|
|
+ Long loanApplicationId = guaranteeInfo.getLoanApplicationId();
|
|
|
+ Long guaranteeInfoId = guaranteeInfo.getGuaranteeInfoId();
|
|
|
+ //所有反担保信息的附件
|
|
|
+ List<GuaranteeInfoFj> guaranteeInfoFjList = guaranteeInfo.getGuaranteeInfoFjList();
|
|
|
+ if (guaranteeInfoFjList != null && guaranteeInfoFjList.size() > 0) {
|
|
|
+ for (GuaranteeInfoFj guaranteeInfoFj : guaranteeInfoFjList) {
|
|
|
+ guaranteeInfoFj.setGuaranteeInfoId(guaranteeInfoId);
|
|
|
+ }
|
|
|
+ Map<String, List<GuaranteeInfoFj>> typeMap = guaranteeInfoFjList.stream().collect(Collectors.groupingBy(GuaranteeInfoFj::getType));
|
|
|
+ for (String type : typeMap.keySet()) {
|
|
|
+ //每个反担保信息的单个分类的附件集合
|
|
|
+ List<GuaranteeInfoFj> guaranteeInfoFjInsert = typeMap.get(type);
|
|
|
+ String fjName = guaranteeInfoFjInsert.get(0).getName().split("_")[0];
|
|
|
+ List<String> imagePaths = guaranteeInfoFjInsert.stream().filter(e -> type.equals(e.getType()) && ("png".equals(e.getName().split("\\.")[1]) || "jpg".equals(e.getName().split("\\.")[1]) || "jpeg".equals(e.getName().split("\\.")[1]))).map(GuaranteeInfoFj::getUrl).collect(Collectors.toList());
|
|
|
+ //替换前缀,获取服务器上地址
|
|
|
+ if (imagePaths.size() > 0) {
|
|
|
+ for (int i = 0; i < imagePaths.size(); i++) {
|
|
|
+ ///profile/upload/RZDB202405281147018884551/公司章程_20240528114820A002.png 前缀替换
|
|
|
+ String replaced = imagePaths.get(i).replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
+ imagePaths.set(i, replaced);
|
|
|
+ }
|
|
|
+
|
|
|
+ //先删除原先的所有pdf数据库记录
|
|
|
+ GuaranteeInfoFj gInfoFj = new GuaranteeInfoFj();
|
|
|
+ gInfoFj.setLoanApplicationId(loanApplicationId);
|
|
|
+ gInfoFj.setLoanApplicationNumber(loanApplicationNumber);
|
|
|
+ gInfoFj.setGuaranteeInfoId(guaranteeInfoId);
|
|
|
+ gInfoFj.setRemark("1");
|
|
|
+ List<GuaranteeInfoFj> pdfOne = SpringUtils.getBean(GuaranteeInfoFjMapper.class).selectGuaranteeInfoFjList(gInfoFj);
|
|
|
+ if (pdfOne.size() > 0) {
|
|
|
+ for (GuaranteeInfoFj guaranteeInfoFj : pdfOne) {
|
|
|
+ //删除数据库数据附件记录
|
|
|
+ SpringUtils.getBean(IGuaranteeInfoFjService.class).deleteGuaranteeInfoFjByGuaranteeInfoFjId(guaranteeInfoFj.getGuaranteeInfoFjId());
|
|
|
+ //删除服务器记录
|
|
|
+ String urlPdf = guaranteeInfoFj.getUrl();
|
|
|
+ if (StringUtils.isNotBlank(urlPdf)) {
|
|
|
+ String filePath = urlPdf.replace("/profile/upload", RuoYiConfig.getUploadPath());
|
|
|
+ //删除服务器上对应文件
|
|
|
+ File file = new File(filePath);
|
|
|
+ if (file.exists()) {
|
|
|
+ if (file.delete()) {
|
|
|
+ System.out.println("删除:" + filePath);
|
|
|
+ } else {
|
|
|
+ System.out.println("删除:" + filePath + "失败");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //生成PDF数据库数据
|
|
|
+ createPdfFromImagesGuaranteeInfoFj(list,guaranteeInfoFjInsert, imagePaths, loanApplicationNumber, fjName + "_" + Seq.getId(Seq.uploadSeqType), type, loanApplicationId, guaranteeInfoId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //判断是否有股东shareholder_fj_id
|
|
|
+ List<GuaranteeInfoFj> guaranteeInfoFjListInsert = guaranteeInfoFjList.stream().filter(e -> ObjectUtils.isEmpty(e.getGuaranteeInfoFjId())).collect(Collectors.toList());
|
|
|
+ if (guaranteeInfoFjListInsert.size() > 0) {
|
|
|
+ // 新增反担保附件数据
|
|
|
+ SpringUtils.getBean(GuaranteeInfoFjMapper.class).batchGuaranteeInfoFj(guaranteeInfoFjListInsert);
|
|
|
+ }
|
|
|
+ List<GuaranteeInfoFj> guaranteeInfoFjListUpdate = guaranteeInfoFjList.stream().filter(e -> ObjectUtils.isNotEmpty(e.getGuaranteeInfoFjId())).collect(Collectors.toList());
|
|
|
+ if (guaranteeInfoFjListUpdate.size() > 0) {
|
|
|
+ for (GuaranteeInfoFj guaranteeInfoFj : guaranteeInfoFjListUpdate) {
|
|
|
+ //更新反担保附件信息
|
|
|
+ SpringUtils.getBean(GuaranteeInfoFjMapper.class).updateGuaranteeInfoFj(guaranteeInfoFj);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //插入附件数据库数据生成的pdf
|
|
|
+ if (list.size() > 0){
|
|
|
+ SpringUtils.getBean(IGuaranteeInfoFjService.class).batchGuaranteeInfoFj(list);
|
|
|
+ }
|
|
|
+ redisCache.deleteObject(key);
|
|
|
+ }
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param imagePaths 图片地址集合
|
|
|
+ * @param loanApplicationNumber 申请编号
|
|
|
+ * @param originalFilename pdf文件名称
|
|
|
+ * @param type 文件类型
|
|
|
+ */
|
|
|
+ public static List<GuaranteeInfoFj> createPdfFromImagesGuaranteeInfoFj( List<GuaranteeInfoFj> list ,List<GuaranteeInfoFj> guaranteeInfoFjInsert, List<String> imagePaths, String loanApplicationNumber, String originalFilename, String type, Long loanApplicationId, Long guaranteeInfoId) {
|
|
|
+ // 上传文件路径 = 根+申请编号
|
|
|
+ String filePath = StringUtils.format("{}/{}/{}.{}", RuoYiConfig.getUploadPath(), loanApplicationNumber,
|
|
|
+ FilenameUtils.getBaseName(originalFilename), "pdf");
|
|
|
+ //pdf保存位置
|
|
|
+ File outPutPdf = new File(filePath);
|
|
|
+ try {
|
|
|
+ FileUploadUtils.createPdfFromImages(imagePaths, outPutPdf);
|
|
|
+ //往附件信息中插入对应PDF数据
|
|
|
+ GuaranteeInfoFj guaranteeInfoFj = new GuaranteeInfoFj();
|
|
|
+ guaranteeInfoFj.setLoanApplicationId(loanApplicationId);
|
|
|
+ guaranteeInfoFj.setLoanApplicationNumber(loanApplicationNumber);
|
|
|
+ guaranteeInfoFj.setGuaranteeInfoId(guaranteeInfoId);
|
|
|
+ guaranteeInfoFj.setName(originalFilename + ".pdf");
|
|
|
+ guaranteeInfoFj.setUrl(StringUtils.format("{}/{}/{}.{}", "/profile/upload", loanApplicationNumber,
|
|
|
+ FilenameUtils.getBaseName(originalFilename), "pdf"));
|
|
|
+ guaranteeInfoFj.setType(type);
|
|
|
+ //给前端判断是否是系统生成的pdf
|
|
|
+ guaranteeInfoFj.setRemark(ONE);
|
|
|
+ list.add(guaranteeInfoFj);
|
|
|
+ } catch (IOException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ return list;
|
|
|
+ }
|
|
|
}
|
|
|
+
|