|
|
@@ -1,11 +1,11 @@
|
|
|
package me.zhengjie.application.admin.service.impl;
|
|
|
|
|
|
-import java.time.LocalDateTime;
|
|
|
-import java.util.ArrayList;
|
|
|
+import java.io.File;
|
|
|
+import java.io.InputStream;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
-import me.zhengjie.dao.mybatis.mapper.*;
|
|
|
+import org.apache.commons.io.FileUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -17,22 +17,20 @@ import com.xxl.job.core.handler.annotation.XxlJob;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import me.zhengjie.application.admin.service.CochainLogService;
|
|
|
import me.zhengjie.application.admin.service.OrderCochainService;
|
|
|
-import me.zhengjie.application.bank.service.BorrowerService;
|
|
|
-import me.zhengjie.application.bank.service.GuaranteeService;
|
|
|
-import me.zhengjie.application.bank.service.MortgageService;
|
|
|
import me.zhengjie.application.bank.service.OrderRoomIdService;
|
|
|
import me.zhengjie.application.bank.service.OrderService;
|
|
|
+import me.zhengjie.application.bank.service.SysDictService;
|
|
|
import me.zhengjie.base.chain.CochainService;
|
|
|
import me.zhengjie.base.util.FileUploadUtil;
|
|
|
-import me.zhengjie.base.util.UUIDGenerator;
|
|
|
import me.zhengjie.dao.mybatis.entity.BorrowerEntity;
|
|
|
import me.zhengjie.dao.mybatis.entity.CochainLogEntity;
|
|
|
import me.zhengjie.dao.mybatis.entity.FileInfoEntity;
|
|
|
-import me.zhengjie.dao.mybatis.entity.GuaranteeEntity;
|
|
|
-import me.zhengjie.dao.mybatis.entity.MortgageEntity;
|
|
|
import me.zhengjie.dao.mybatis.entity.OrderCochainEntity;
|
|
|
-import me.zhengjie.dao.mybatis.entity.OrderFileEntity;
|
|
|
-import me.zhengjie.dao.mybatis.entity.OrderRoomIdEntity;
|
|
|
+import me.zhengjie.dao.mybatis.mapper.BorrowerMapper;
|
|
|
+import me.zhengjie.dao.mybatis.mapper.GuaranteeMapper;
|
|
|
+import me.zhengjie.dao.mybatis.mapper.ICochainLogDao;
|
|
|
+import me.zhengjie.dao.mybatis.mapper.MortgageMapper;
|
|
|
+import me.zhengjie.dao.mybatis.mapper.OrderFileMapper;
|
|
|
|
|
|
/**
|
|
|
* TODO 这个需要去掉抵押人,可以有联合借款,联合抵押,现在都是按照单个处理,
|
|
|
@@ -67,6 +65,8 @@ public class CochainLogServiceImpl extends ServiceImpl<ICochainLogDao, CochainLo
|
|
|
OrderFileMapper orderFileMapper;
|
|
|
@Autowired
|
|
|
OrderRoomIdService orderRoomService;
|
|
|
+ @Autowired
|
|
|
+ SysDictService sysDictService;
|
|
|
|
|
|
// @PostConstruct
|
|
|
public void init() {
|
|
|
@@ -98,172 +98,207 @@ public class CochainLogServiceImpl extends ServiceImpl<ICochainLogDao, CochainLo
|
|
|
}
|
|
|
// 先读取借款人的,
|
|
|
String businessNo = cochainEntity.getBusinessNo();
|
|
|
+ //得到文件的临时目录
|
|
|
+ String applicationDir = FileUploadUtil.getApplicationTempDir();
|
|
|
+ String downloadPath = applicationDir + "/" + businessNo;
|
|
|
// 查询数据
|
|
|
- log.info("【开始】调用上链业务编号:"+businessNo);
|
|
|
-
|
|
|
-
|
|
|
+ log.info("【开始】调用上链业务编号:" + businessNo);
|
|
|
CochainLogEntity cochainLog = new CochainLogEntity();
|
|
|
cochainLog.setBusinessNo(businessNo);
|
|
|
- // 查询已经插入过的
|
|
|
- QueryWrapper<CochainLogEntity> callCochainLog = cochainLogService.convertQuery(cochainLog);
|
|
|
- callCochainLog.select("file_path");
|
|
|
- List<String> cochainLogs = cochainLogService.listObjs(callCochainLog, a -> {
|
|
|
- return String.valueOf(a.toString());
|
|
|
- });
|
|
|
+
|
|
|
// 查询所有上传的图片
|
|
|
Map<String, FileInfoEntity> map = orderService.getUploadFile(businessNo);
|
|
|
// 借款人查询数据
|
|
|
QueryWrapper<BorrowerEntity> borrowerQW = new QueryWrapper<>();
|
|
|
- borrowerQW.eq("business_no",businessNo);
|
|
|
+ borrowerQW.eq("business_no", businessNo);
|
|
|
List<BorrowerEntity> borrowers = borrowerMapper.selectList(borrowerQW);
|
|
|
for (BorrowerEntity obj : borrowers) {
|
|
|
- List<CochainLogEntity> logs = new ArrayList<CochainLogEntity>();
|
|
|
- // 身份证正面
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getCardFront(), map, logs, cochainLogs);
|
|
|
- // 身份证反面
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getCardBack(), map, logs, cochainLogs);
|
|
|
- // 合同
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getCompactPic(), map, logs, cochainLogs);
|
|
|
- // 房产证
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs);
|
|
|
- // 房产证
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs);
|
|
|
- // 其他上传
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getOtherUpload(), map, logs, cochainLogs);
|
|
|
- // 户口本
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getHkbPic(), map, logs, cochainLogs);
|
|
|
- // 带有盖章的pdf
|
|
|
- QueryWrapper<OrderFileEntity> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("business_no", businessNo);
|
|
|
- wrapper.eq("contract_id", obj.getId());
|
|
|
- // 这里处理,如果没有盖章的就把签名的pdf上传
|
|
|
- List<OrderFileEntity> orderFiles = orderFileMapper.selectList(wrapper);
|
|
|
- for (OrderFileEntity orderFile : orderFiles) {
|
|
|
- if (StringUtils.isNotBlank(orderFile.getSignedPdfUrl())) {
|
|
|
- recordCochain(businessNo, obj.getId(), orderFile.getSignedPdfUrl(), logs, cochainLogs);
|
|
|
- } else {
|
|
|
- recordCochain(businessNo, obj.getId(), orderFile.getPdfUrl(), logs, cochainLogs);
|
|
|
- }
|
|
|
- }
|
|
|
- // 处理视频
|
|
|
- QueryWrapper<OrderRoomIdEntity> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("orderId", obj.getId());
|
|
|
- queryWrapper.orderByDesc("create_time");
|
|
|
- List<OrderRoomIdEntity> orderRoomList = orderRoomService.list(queryWrapper);
|
|
|
- if (orderRoomList != null && orderRoomList.size() > 0) {
|
|
|
- OrderRoomIdEntity orderRoomId = orderRoomList.get(0);
|
|
|
- recordCochain(businessNo, obj.getId(), orderRoomId.getAppVideoUrl(), logs, cochainLogs);
|
|
|
- recordCochain(businessNo, obj.getId(), orderRoomId.getPcVideoUrl(), logs, cochainLogs);
|
|
|
- }
|
|
|
- // 数据插入
|
|
|
- cochainLogService.saveBatch(logs);
|
|
|
+
|
|
|
}
|
|
|
- // 抵押人查询数据
|
|
|
- QueryWrapper<MortgageEntity> mortgageQW = new QueryWrapper<>();
|
|
|
- mortgageQW.eq("business_no",businessNo);
|
|
|
- List<MortgageEntity> mortgages = mortgageMapper.selectList(mortgageQW);
|
|
|
- for (MortgageEntity obj : mortgages) {
|
|
|
- List<CochainLogEntity> logs = new ArrayList<CochainLogEntity>();
|
|
|
- // 身份证正面
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getCardFront(), map, logs, cochainLogs);
|
|
|
- // 身份证反面
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getCardBack(), map, logs, cochainLogs);
|
|
|
- // 合同
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getCompactPic(), map, logs, cochainLogs);
|
|
|
- // 房产证
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs);
|
|
|
- // 房产证
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs);
|
|
|
- // 其他上传
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getOtherUpload(), map, logs, cochainLogs);
|
|
|
- // 户口本
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getHkbPic(), map, logs, cochainLogs);
|
|
|
- // 带有盖章的pdf
|
|
|
- QueryWrapper<OrderFileEntity> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("business_no", businessNo);
|
|
|
- wrapper.eq("contract_id", obj.getId());
|
|
|
- // 这里处理,如果没有盖章的就把签名的pdf上传
|
|
|
- List<OrderFileEntity> orderFiles = orderFileMapper.selectList(wrapper);
|
|
|
- for (OrderFileEntity orderFile : orderFiles) {
|
|
|
- if (StringUtils.isNotBlank(orderFile.getSignedPdfUrl())) {
|
|
|
- recordCochain(businessNo, obj.getId(), orderFile.getSignedPdfUrl(), logs, cochainLogs);
|
|
|
- } else {
|
|
|
- recordCochain(businessNo, obj.getId(), orderFile.getPdfUrl(), logs, cochainLogs);
|
|
|
- }
|
|
|
- }
|
|
|
- // 处理视频
|
|
|
- QueryWrapper<OrderRoomIdEntity> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("orderId", obj.getId());
|
|
|
- queryWrapper.orderByDesc("create_time");
|
|
|
- List<OrderRoomIdEntity> orderRoomList = orderRoomService.list(queryWrapper);
|
|
|
- if (orderRoomList != null && orderRoomList.size() > 0) {
|
|
|
- OrderRoomIdEntity orderRoomId = orderRoomList.get(0);
|
|
|
- recordCochain(businessNo, obj.getId(), orderRoomId.getAppVideoUrl(), logs, cochainLogs);
|
|
|
- recordCochain(businessNo, obj.getId(), orderRoomId.getPcVideoUrl(), logs, cochainLogs);
|
|
|
- }
|
|
|
- // 数据插入
|
|
|
- cochainLogService.saveBatch(logs);
|
|
|
- }
|
|
|
- // 担保人查询数据
|
|
|
- QueryWrapper<GuaranteeEntity> guaranteeQW = new QueryWrapper<>();
|
|
|
- guaranteeQW.eq("business_no",businessNo);
|
|
|
- List<GuaranteeEntity> guarantees = guaranteeMapper.selectList(guaranteeQW);
|
|
|
- for (GuaranteeEntity obj : guarantees) {
|
|
|
- List<CochainLogEntity> logs = new ArrayList<CochainLogEntity>();
|
|
|
- // 身份证正面
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getCardFront(), map, logs, cochainLogs);
|
|
|
- // 身份证反面
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getCardBack(), map, logs, cochainLogs);
|
|
|
- // 合同
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getCompactPic(), map, logs, cochainLogs);
|
|
|
- // 房产证
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs);
|
|
|
- // 房产证
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs);
|
|
|
- // 其他上传
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getOtherUpload(), map, logs, cochainLogs);
|
|
|
- // 户口本
|
|
|
- recordCochain(businessNo, obj.getId(), obj.getHkbPic(), map, logs, cochainLogs);
|
|
|
+// List<CochainLogEntity> logs = new ArrayList<CochainLogEntity>();
|
|
|
+// final String borrower = "borrower";
|
|
|
+// // 身份证正面
|
|
|
+// recordCochain(obj.getCardFront(), "");
|
|
|
+// // 身份证反面
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getCardBack(), map, logs, cochainLogs, "身份证反面", borrower);
|
|
|
+// // 合同
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getCompactPic(), map, logs, cochainLogs, "合同", borrower);
|
|
|
+// // 抵押物
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getMortgagePic(), map, logs, cochainLogs, "抵押物", borrower);
|
|
|
+// // 结婚证
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs, "结婚证", borrower);
|
|
|
+// // 其他上传
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getOtherUpload(), map, logs, cochainLogs, "其他上传", borrower);
|
|
|
+// // 户口本
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getHkbPic(), map, logs, cochainLogs, "户口本", borrower);
|
|
|
+// // 配偶身份证正面照片
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getSpouseIdcardFrontPic(), map, logs, cochainLogs, "配偶身份证正面照片",
|
|
|
+// borrower);
|
|
|
+// // 配偶身份证反面照片
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getSpouseIdcardBackPic(), map, logs, cochainLogs, "配偶身份证反面照片",
|
|
|
+// borrower);
|
|
|
+
|
|
|
// 带有盖章的pdf
|
|
|
- QueryWrapper<OrderFileEntity> wrapper = new QueryWrapper<>();
|
|
|
- wrapper.eq("business_no", businessNo);
|
|
|
- wrapper.eq("contract_id", obj.getId());
|
|
|
- // 这里处理,如果没有盖章的就把签名的pdf上传
|
|
|
- List<OrderFileEntity> orderFiles = orderFileMapper.selectList(wrapper);
|
|
|
- for (OrderFileEntity orderFile : orderFiles) {
|
|
|
- if (StringUtils.isNotBlank(orderFile.getSignedPdfUrl())) {
|
|
|
- recordCochain(businessNo, obj.getId(), orderFile.getSignedPdfUrl(), logs, cochainLogs);
|
|
|
- } else {
|
|
|
- recordCochain(businessNo, obj.getId(), orderFile.getPdfUrl(), logs, cochainLogs);
|
|
|
- }
|
|
|
- }
|
|
|
- // 处理视频
|
|
|
- QueryWrapper<OrderRoomIdEntity> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("orderId", obj.getId());
|
|
|
- queryWrapper.orderByDesc("create_time");
|
|
|
- List<OrderRoomIdEntity> orderRoomList = orderRoomService.list(queryWrapper);
|
|
|
- if (orderRoomList != null && orderRoomList.size() > 0) {
|
|
|
- OrderRoomIdEntity orderRoomId = orderRoomList.get(0);
|
|
|
- recordCochain(businessNo, obj.getId(), orderRoomId.getAppVideoUrl(), logs, cochainLogs);
|
|
|
- recordCochain(businessNo, obj.getId(), orderRoomId.getPcVideoUrl(), logs, cochainLogs);
|
|
|
- }
|
|
|
- // 数据插入
|
|
|
- cochainLogService.saveBatch(logs);
|
|
|
- }
|
|
|
- // 查询是否有失败的
|
|
|
- CochainLogEntity success = new CochainLogEntity();
|
|
|
- success.setBusinessNo(businessNo);
|
|
|
- success.setStatus("0");
|
|
|
- long count = cochainLogService.count(success);
|
|
|
- if (count > 0) {
|
|
|
- cochainEntity.setStatus("2");
|
|
|
- cochainEntity.setUpdateTime(LocalDateTime.now());
|
|
|
- } else {
|
|
|
- cochainEntity.setStatus("1");
|
|
|
- cochainEntity.setUpdateTime(LocalDateTime.now());
|
|
|
- }
|
|
|
- orderCochainService.updateById(cochainEntity);
|
|
|
- log.info("【结束】调用上链业务编号:"+businessNo);
|
|
|
+// QueryWrapper<OrderFileEntity> wrapper = new QueryWrapper<>();
|
|
|
+// wrapper.eq("business_no", businessNo);
|
|
|
+// wrapper.eq("contract_id", obj.getId());
|
|
|
+// // 这里处理,如果没有盖章的就把签名的pdf上传
|
|
|
+// List<OrderFileEntity> orderFiles = orderFileMapper.selectList(wrapper);
|
|
|
+// for (OrderFileEntity orderFile : orderFiles) {
|
|
|
+// if (StringUtils.isNotBlank(orderFile.getSignedPdfUrl())) {
|
|
|
+// recordCochain(businessNo, obj.getId(), orderFile.getSignedPdfUrl(), logs, cochainLogs,
|
|
|
+// orderFile.getFileName(), borrower);
|
|
|
+// } else {
|
|
|
+// recordCochain(businessNo, obj.getId(), orderFile.getPdfUrl(), logs, cochainLogs,
|
|
|
+// orderFile.getFileName(), borrower);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 处理视频
|
|
|
+// QueryWrapper<OrderRoomIdEntity> queryWrapper = new QueryWrapper<>();
|
|
|
+// queryWrapper.eq("orderId", obj.getId());
|
|
|
+// queryWrapper.orderByDesc("create_time");
|
|
|
+// List<OrderRoomIdEntity> orderRoomList = orderRoomService.list(queryWrapper);
|
|
|
+// if (orderRoomList != null && orderRoomList.size() > 0) {
|
|
|
+// OrderRoomIdEntity orderRoomId = orderRoomList.get(0);
|
|
|
+// recordCochain(businessNo, obj.getId(), orderRoomId.getAppVideoUrl(), logs, cochainLogs, "APP视频",
|
|
|
+// borrower);
|
|
|
+// recordCochain(businessNo, obj.getId(), orderRoomId.getPcVideoUrl(), logs, cochainLogs, "PC视频",
|
|
|
+// borrower);
|
|
|
+// }
|
|
|
+// // 数据插入
|
|
|
+// cochainLogService.saveBatch(logs);
|
|
|
+// }
|
|
|
+// // 抵押人查询数据
|
|
|
+// QueryWrapper<MortgageEntity> mortgageQW = new QueryWrapper<>();
|
|
|
+// mortgageQW.eq("business_no", businessNo);
|
|
|
+// List<MortgageEntity> mortgages = mortgageMapper.selectList(mortgageQW);
|
|
|
+// for (MortgageEntity obj : mortgages) {
|
|
|
+// final String mortgage = "抵押人";
|
|
|
+// List<CochainLogEntity> logs = new ArrayList<CochainLogEntity>();
|
|
|
+// // 身份证正面
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getCardFront(), map, logs, cochainLogs, "身份证正面", mortgage);
|
|
|
+// // 身份证反面
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getCardBack(), map, logs, cochainLogs, "身份证反面", mortgage);
|
|
|
+// // 合同
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getCompactPic(), map, logs, cochainLogs, "身份证反面", mortgage);
|
|
|
+// // 房产证
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs, "身份证反面", mortgage);
|
|
|
+// // 房产证
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs, "身份证反面", mortgage);
|
|
|
+// // 其他上传
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getOtherUpload(), map, logs, cochainLogs, "身份证反面", mortgage);
|
|
|
+// // 户口本
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getHkbPic(), map, logs, cochainLogs, "身份证反面", mortgage);
|
|
|
+//
|
|
|
+// // 配偶身份证正面照片
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getSpouseIdcardFrontPic(), map, logs, cochainLogs, "配偶身份证正面照片",
|
|
|
+// mortgage);
|
|
|
+// // 配偶身份证反面照片
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getSpouseIdcardBackPic(), map, logs, cochainLogs, "配偶身份证反面照片",
|
|
|
+// mortgage);
|
|
|
+//
|
|
|
+// // 带有盖章的pdf
|
|
|
+// QueryWrapper<OrderFileEntity> wrapper = new QueryWrapper<>();
|
|
|
+// wrapper.eq("business_no", businessNo);
|
|
|
+// wrapper.eq("contract_id", obj.getId());
|
|
|
+// // 这里处理,如果没有盖章的就把签名的pdf上传
|
|
|
+// List<OrderFileEntity> orderFiles = orderFileMapper.selectList(wrapper);
|
|
|
+// for (OrderFileEntity orderFile : orderFiles) {
|
|
|
+// if (StringUtils.isNotBlank(orderFile.getSignedPdfUrl())) {
|
|
|
+// recordCochain(businessNo, obj.getId(), orderFile.getSignedPdfUrl(), logs, cochainLogs,
|
|
|
+// orderFile.getFileName(), mortgage);
|
|
|
+// } else {
|
|
|
+// recordCochain(businessNo, obj.getId(), orderFile.getPdfUrl(), logs, cochainLogs,
|
|
|
+// orderFile.getFileName(), mortgage);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 处理视频
|
|
|
+// QueryWrapper<OrderRoomIdEntity> queryWrapper = new QueryWrapper<>();
|
|
|
+// queryWrapper.eq("orderId", obj.getId());
|
|
|
+// queryWrapper.orderByDesc("create_time");
|
|
|
+// List<OrderRoomIdEntity> orderRoomList = orderRoomService.list(queryWrapper);
|
|
|
+// if (orderRoomList != null && orderRoomList.size() > 0) {
|
|
|
+// OrderRoomIdEntity orderRoomId = orderRoomList.get(0);
|
|
|
+// recordCochain(businessNo, obj.getId(), orderRoomId.getAppVideoUrl(), logs, cochainLogs, "APP视频",
|
|
|
+// mortgage);
|
|
|
+// recordCochain(businessNo, obj.getId(), orderRoomId.getPcVideoUrl(), logs, cochainLogs, "APP视频",
|
|
|
+// mortgage);
|
|
|
+// }
|
|
|
+// // 数据插入
|
|
|
+// cochainLogService.saveBatch(logs);
|
|
|
+// }
|
|
|
+// // 担保人查询数据
|
|
|
+// QueryWrapper<GuaranteeEntity> guaranteeQW = new QueryWrapper<>();
|
|
|
+// guaranteeQW.eq("business_no", businessNo);
|
|
|
+// List<GuaranteeEntity> guarantees = guaranteeMapper.selectList(guaranteeQW);
|
|
|
+// for (GuaranteeEntity obj : guarantees) {
|
|
|
+// final String guarantee = "担保人";
|
|
|
+// List<CochainLogEntity> logs = new ArrayList<CochainLogEntity>();
|
|
|
+// // 身份证正面
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getCardFront(), map, logs, cochainLogs, "身份证反面", guarantee);
|
|
|
+// // 身份证反面
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getCardBack(), map, logs, cochainLogs, "身份证反面", guarantee);
|
|
|
+// // 合同
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getCompactPic(), map, logs, cochainLogs, "身份证反面", guarantee);
|
|
|
+// // 房产证
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs, "身份证反面", guarantee);
|
|
|
+// // 房产证
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getMarragePic(), map, logs, cochainLogs, "身份证反面", guarantee);
|
|
|
+// // 其他上传
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getOtherUpload(), map, logs, cochainLogs, "身份证反面", guarantee);
|
|
|
+// // 户口本
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getHkbPic(), map, logs, cochainLogs, "身份证反面", guarantee);
|
|
|
+// // 配偶身份证正面照片
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getSpouseIdcardFrontPic(), map, logs, cochainLogs, "配偶身份证正面照片",
|
|
|
+// guarantee);
|
|
|
+// // 配偶身份证反面照片
|
|
|
+// recordCochain(businessNo, obj.getId(), obj.getSpouseIdcardBackPic(), map, logs, cochainLogs, "配偶身份证反面照片",
|
|
|
+// guarantee);
|
|
|
+//
|
|
|
+// // 带有盖章的pdf
|
|
|
+// QueryWrapper<OrderFileEntity> wrapper = new QueryWrapper<>();
|
|
|
+// wrapper.eq("business_no", businessNo);
|
|
|
+// wrapper.eq("contract_id", obj.getId());
|
|
|
+// // 这里处理,如果没有盖章的就把签名的pdf上传
|
|
|
+// List<OrderFileEntity> orderFiles = orderFileMapper.selectList(wrapper);
|
|
|
+// for (OrderFileEntity orderFile : orderFiles) {
|
|
|
+// if (StringUtils.isNotBlank(orderFile.getSignedPdfUrl())) {
|
|
|
+// recordCochain(businessNo, obj.getId(), orderFile.getSignedPdfUrl(), logs, cochainLogs,
|
|
|
+// orderFile.getFileName(), guarantee);
|
|
|
+// } else {
|
|
|
+// recordCochain(businessNo, obj.getId(), orderFile.getPdfUrl(), logs, cochainLogs,
|
|
|
+// orderFile.getFileName(), guarantee);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// // 处理视频
|
|
|
+// QueryWrapper<OrderRoomIdEntity> queryWrapper = new QueryWrapper<>();
|
|
|
+// queryWrapper.eq("orderId", obj.getId());
|
|
|
+// queryWrapper.orderByDesc("create_time");
|
|
|
+// List<OrderRoomIdEntity> orderRoomList = orderRoomService.list(queryWrapper);
|
|
|
+// if (orderRoomList != null && orderRoomList.size() > 0) {
|
|
|
+// OrderRoomIdEntity orderRoomId = orderRoomList.get(0);
|
|
|
+// recordCochain(businessNo, obj.getId(), orderRoomId.getAppVideoUrl(), logs, cochainLogs, "APP视频",
|
|
|
+// guarantee);
|
|
|
+// recordCochain(businessNo, obj.getId(), orderRoomId.getPcVideoUrl(), logs, cochainLogs, "PC视频",
|
|
|
+// guarantee);
|
|
|
+// }
|
|
|
+// // 数据插入
|
|
|
+// cochainLogService.saveBatch(logs);
|
|
|
+// }
|
|
|
+// // 查询是否有失败的
|
|
|
+// CochainLogEntity success = new CochainLogEntity();
|
|
|
+// success.setBusinessNo(businessNo);
|
|
|
+// success.setStatus("0");
|
|
|
+// long count = cochainLogService.count(success);
|
|
|
+// if (count > 0) {
|
|
|
+// cochainEntity.setStatus("2");
|
|
|
+// cochainEntity.setUpdateTime(LocalDateTime.now());
|
|
|
+// } else {
|
|
|
+// cochainEntity.setStatus("1");
|
|
|
+// cochainEntity.setUpdateTime(LocalDateTime.now());
|
|
|
+// }
|
|
|
+// orderCochainService.updateById(cochainEntity);
|
|
|
+// log.info("【结束】调用上链业务编号:" + businessNo);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -274,49 +309,44 @@ public class CochainLogServiceImpl extends ServiceImpl<ICochainLogDao, CochainLo
|
|
|
chainEvidence();
|
|
|
}
|
|
|
|
|
|
- public void recordCochain(String businessNo, Long orderId, String filePath, List<CochainLogEntity> logs,
|
|
|
- List<String> cochainLogs) {
|
|
|
- if (StringUtils.isNotBlank(filePath) && !cochainLogs.contains(filePath)) {
|
|
|
- // 先初始化
|
|
|
- CochainLogEntity chainLog = new CochainLogEntity();
|
|
|
- String bisCode = UUIDGenerator.uuid();
|
|
|
- chainLog.setBusinessNo(businessNo);
|
|
|
- chainLog.setOrderId(orderId.toString());
|
|
|
- chainLog.setFilePath(filePath);
|
|
|
- chainLog.setCreateTime(LocalDateTime.now());
|
|
|
- chainLog.setUpdateTime(LocalDateTime.now());
|
|
|
- chainLog.setBisCode(bisCode);
|
|
|
- long size = FileUploadUtil.getSize(filePath);
|
|
|
- cochainService.sendRequest(chainLog, String.valueOf(size));
|
|
|
- logs.add(chainLog);
|
|
|
+ /**
|
|
|
+ * 通过文件下载
|
|
|
+ *
|
|
|
+ * @param businessNo
|
|
|
+ * @param orderId
|
|
|
+ * @param filePath
|
|
|
+ * @param logs
|
|
|
+ * @param cochainLogs
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ public void recordCochain(String filePath, String destination) throws Exception {
|
|
|
+ if (StringUtils.isNotBlank(filePath)) {
|
|
|
+
|
|
|
+ InputStream input = null;
|
|
|
+ try {
|
|
|
+ input = FileUploadUtil.getInputStream(filePath);
|
|
|
+ FileUtils.copyInputStreamToFile(input, new File(destination));
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw e;
|
|
|
+ } finally {
|
|
|
+ if (input != null) {
|
|
|
+ input.close();
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public void recordCochain(String businessNo, Long orderId, String fileId, Map<String, FileInfoEntity> map,
|
|
|
- List<CochainLogEntity> logs, List<String> cochainLogs) {
|
|
|
+ public void downloadFile(Long orderId, String fileId, Map<String, FileInfoEntity> map) {
|
|
|
if (StringUtils.isNotBlank(fileId)) {
|
|
|
// 先初始化
|
|
|
String[] list = { fileId };
|
|
|
if (fileId.contains(",")) {
|
|
|
list = fileId.split(",");
|
|
|
}
|
|
|
+ int i = 1;
|
|
|
for (String key : list) {
|
|
|
// 计算是否已经包含了插入数据
|
|
|
FileInfoEntity fileInfo = map.get(key);
|
|
|
- if (!cochainLogs.contains(fileInfo.getPath())) {
|
|
|
- CochainLogEntity chainLog = new CochainLogEntity();
|
|
|
- long size = FileUploadUtil.getSize(fileInfo.getPath());
|
|
|
- String bisCode = UUIDGenerator.uuid();
|
|
|
- chainLog.setBusinessNo(businessNo);
|
|
|
- chainLog.setOrderId(orderId.toString());
|
|
|
- chainLog.setFilePath(fileInfo.getPath());
|
|
|
- chainLog.setImageId(fileId);
|
|
|
- chainLog.setCreateTime(LocalDateTime.now());
|
|
|
- chainLog.setUpdateTime(LocalDateTime.now());
|
|
|
- chainLog.setBisCode(bisCode);
|
|
|
- cochainService.sendRequest(chainLog, String.valueOf(size));
|
|
|
- logs.add(chainLog);
|
|
|
- }
|
|
|
|
|
|
}
|
|
|
|