2025-03-11 代碼提交
This commit is contained in:
parent
37ca8a6c8f
commit
b801a90a2e
@ -3,6 +3,7 @@ package com.zkj.loan.batch.tasklet;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zkj.loan.common.internet.mapper.sys.SysMqRecordMapper;
|
||||
import com.zkj.loan.common.internet.model.sys.SysMqRecord;
|
||||
import com.zkj.loan.common.internet.service.sys.impl.SysMqRecordServiceImpl;
|
||||
import com.zkj.loan.common.internet.utils.DateUtil;
|
||||
import com.zkj.rcs.scheduler.model.JobReqEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -23,6 +24,8 @@ public abstract class MsxfContractBatchTasklet extends AbstractBatchTasklet {
|
||||
|
||||
@Resource
|
||||
private SysMqRecordMapper sysMqRecordMapper;
|
||||
@Resource
|
||||
private SysMqRecordServiceImpl sysMqRecordService;
|
||||
|
||||
public String getDate(JobReqEntity jobReqEntity) {
|
||||
return (String) jobReqEntity.getJobParameter().get("tranDate");
|
||||
@ -83,6 +86,14 @@ public abstract class MsxfContractBatchTasklet extends AbstractBatchTasklet {
|
||||
log.info("任务耗时:{} 毫秒", end - start);
|
||||
}
|
||||
|
||||
public boolean updateSysMqRecordStatus(SysMqRecord recordsToUpdate) {
|
||||
long start = System.currentTimeMillis();
|
||||
boolean b = sysMqRecordService.updateById(recordsToUpdate);
|
||||
long end = System.currentTimeMillis();
|
||||
log.info("bizNo: {} 更新 sys_mq_record 状态,更新状态:{},任务耗时:{} 毫秒", recordsToUpdate.getBizNo(), b, end - start);
|
||||
return b;
|
||||
}
|
||||
|
||||
public String getFileType(JobReqEntity jobReqEntity) {
|
||||
return (String) jobReqEntity.getJobParameter().get("fileType");
|
||||
}
|
||||
|
@ -13,26 +13,37 @@ import com.zkj.loan.batch.util.JsonUtil;
|
||||
import com.zkj.loan.common.internet.feign.MsxfSftpClient;
|
||||
import com.zkj.loan.common.internet.feign.pojo.MsxfSftpRespVO;
|
||||
import com.zkj.loan.common.internet.mapper.sys.SysMqRecordMapper;
|
||||
import com.zkj.loan.common.internet.model.fac.LoanDuebill;
|
||||
import com.zkj.loan.common.internet.model.pay.PayUseCreditExt;
|
||||
import com.zkj.loan.common.internet.model.sys.SysMqRecord;
|
||||
import com.zkj.loan.common.internet.service.contract.entity.ContractConst;
|
||||
import com.zkj.loan.common.internet.service.tranfer.FileTransferService;
|
||||
import com.zkj.loan.common.internet.utils.DateUtil;
|
||||
import com.zkj.loan.common.internet.utils.ZipUtils;
|
||||
import com.zkj.open.api.client.feign.api.Result;
|
||||
import com.zkj.rcs.common.core.util.seq.IdGenerator;
|
||||
import com.zkj.rcs.scheduler.model.JobReqEntity;
|
||||
import com.zkj.rcs.scheduler.model.JobRespEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.zkj.loan.batch.constants.JobStatusCode.*;
|
||||
import static com.zkj.loan.common.internet.constant.BusinessConstant.SUCCESS_00000;
|
||||
import static com.zkj.loan.common.internet.service.contract.entity.ContractConst.BIZ_TYPE_FILE_DOWNLOAD;
|
||||
|
||||
/**
|
||||
* 功能描述: <br>
|
||||
@ -54,7 +65,8 @@ public class MsxfContractDownloadTasklet extends MsxfContractBatchTasklet {
|
||||
private MsxfSftpClient msxfSftpClient;
|
||||
@Resource
|
||||
private SysMqRecordMapper sysMqRecordMapper;
|
||||
|
||||
@Resource
|
||||
private IdGenerator idGenerator;
|
||||
private final static String MSG = "批量下载合同文件【msxfContractDownloadTasklet】";
|
||||
private static final Semaphore SEMAPHORE = new Semaphore(10);
|
||||
private static final List<String> RETRY_LIST = new ArrayList<>();
|
||||
@ -116,48 +128,180 @@ public class MsxfContractDownloadTasklet extends MsxfContractBatchTasklet {
|
||||
private void download(JSONObject jsonParams, List<String> fileNames, Boolean first) {
|
||||
// 创建一个固定大小的线程池
|
||||
int size = CollUtil.size(fileNames);
|
||||
ExecutorService executor = Executors.newFixedThreadPool(size);
|
||||
//ExecutorService executor = Executors.newFixedThreadPool(size);
|
||||
List<SysMqRecord> recordList = new ArrayList<>();
|
||||
String bizDate = jsonParams.getStr("bizDate");
|
||||
QueryWrapper<SysMqRecord> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(SysMqRecord::getBizDate,bizDate);
|
||||
queryWrapper.lambda().eq(SysMqRecord::getBizType,ContractConst.BIZ_TYPE_FILE_DOWNLOAD);
|
||||
List<SysMqRecord> list = sysMqRecordMapper.selectList(queryWrapper);
|
||||
Map<String, SysMqRecord> map = list.stream().collect(Collectors.toMap
|
||||
(SysMqRecord::getBizNo, SysMqRecord -> SysMqRecord, (a1, a2) -> a1));
|
||||
// 最多10个任务执行
|
||||
for (int i = 0; i < size; i++) {
|
||||
String filename = CollUtil.get(fileNames, i);
|
||||
executor.submit(() -> {
|
||||
try {
|
||||
SEMAPHORE.acquire();
|
||||
log.info("开始下载文件 {} ...", filename);
|
||||
try {
|
||||
log.info("开始下载文件 {} ...", filename);
|
||||
|
||||
jsonParams.set("filename", filename);
|
||||
Result result = msxfSftpClient.contDownload(jsonParams);
|
||||
if (!SUCCESS_00000.equals(result.getCode())) {
|
||||
throw new RuntimeException("SFTP下载接口调用失败 code:" + result.getCode());
|
||||
}
|
||||
MsxfSftpRespVO msxfSftpRespVO = BeanUtil.toBean(result.getData(), MsxfSftpRespVO.class);
|
||||
String saveFilePath = msxfSftpRespVO.getFilePatchName();
|
||||
String zipLocalPath = saveFilePath + filename;
|
||||
File file = FileUtil.writeBytes(msxfSftpRespVO.getFileContent(), zipLocalPath);
|
||||
if (!file.exists()) {
|
||||
throw new RuntimeException("SFTP文件下载失败,file is not exists");
|
||||
}
|
||||
log.info("文件 {} 下载完毕...", filename);
|
||||
// 解压缩文件
|
||||
String unzipFilePath = saveFilePath + StrUtil.removeSuffix(filename, ".zip") + File.separator;
|
||||
ZipUtils.unzip(zipLocalPath, unzipFilePath);
|
||||
log.info("文件 {} 解压完毕...", filename);
|
||||
|
||||
} catch (Exception e) {
|
||||
// 判断是否为首次下载,如果不是则不再尝试
|
||||
if (first) {
|
||||
RETRY_LIST.add(filename);
|
||||
} else {
|
||||
ERROR_LIST.add(filename);
|
||||
}
|
||||
log.error("{} 文件 {} 下载失败 ==> {}", MSG, filename, e.getMessage());
|
||||
} finally {
|
||||
SEMAPHORE.release();
|
||||
jsonParams.set("filename", filename);
|
||||
Result result = msxfSftpClient.contDownload(jsonParams);
|
||||
if (!SUCCESS_00000.equals(result.getCode())) {
|
||||
throw new RuntimeException("SFTP下载接口调用失败 code:" + result.getCode());
|
||||
}
|
||||
});
|
||||
MsxfSftpRespVO msxfSftpRespVO = BeanUtil.toBean(result.getData(), MsxfSftpRespVO.class);
|
||||
String saveFilePath = msxfSftpRespVO.getFilePatchName();
|
||||
String zipLocalPath = saveFilePath + filename;
|
||||
File file = FileUtil.writeBytes(msxfSftpRespVO.getFileContent(), zipLocalPath);
|
||||
if (!file.exists()) {
|
||||
throw new RuntimeException("SFTP文件下载失败,file is not exists");
|
||||
}
|
||||
log.info("文件 {} 下载完毕...", filename);
|
||||
// 解压缩文件
|
||||
String unzipFilePath = saveFilePath + StrUtil.removeSuffix(filename, ".zip") + File.separator;
|
||||
ZipUtils.unzip(zipLocalPath, unzipFilePath);
|
||||
log.info("文件 {} 解压完毕...", filename);
|
||||
|
||||
// 创建 File 对象
|
||||
File directory = new File(unzipFilePath);
|
||||
String bizNo = StrUtil.removeSuffix(filename, ".zip");
|
||||
// 检查路径是否存在并且是一个目录
|
||||
if (directory.exists() && directory.isDirectory()) {
|
||||
// 获取目录下的文件列表
|
||||
File[] files = directory.listFiles();
|
||||
// 遍历文件列表
|
||||
if (files != null) {
|
||||
for (File fil : files) {
|
||||
SysMqRecord mqRecord = map.get(bizNo);
|
||||
if (Objects.nonNull(mqRecord)){
|
||||
continue;
|
||||
}
|
||||
addrecordList(recordList,fil,bizNo,bizDate);
|
||||
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("指定的路径不是一个有效的目录。");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 判断是否为首次下载,如果不是则不再尝试
|
||||
if (first) {
|
||||
RETRY_LIST.add(filename);
|
||||
} else {
|
||||
ERROR_LIST.add(filename);
|
||||
}
|
||||
log.error("{} 文件 {} 下载失败 ==> {}", MSG, filename, e.getMessage());
|
||||
} finally {
|
||||
SEMAPHORE.release();
|
||||
}
|
||||
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(recordList)) {
|
||||
sysMqRecordMapper.insertBatch(recordList);
|
||||
}
|
||||
}
|
||||
|
||||
private void addrecordList(List<SysMqRecord> recordList,File fil,String bizNo,String bizDate) {
|
||||
if (fil.getName().contains(ContractConst.CONTRACT_POLICY)){
|
||||
SysMqRecord mqRecordDown = new SysMqRecord();
|
||||
mqRecordDown.setId(idGenerator.nextIdStr());
|
||||
mqRecordDown.setBizType(ContractConst.BIZ_TYPE_FILE_DOWNLOAD);
|
||||
mqRecordDown.setBizFileType(ContractConst.CONTRACT_POLICY);
|
||||
mqRecordDown.setBizNo(bizNo);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("appNo",bizNo);
|
||||
jsonObject.put("filePath",fil.getAbsolutePath());
|
||||
mqRecordDown.setData(jsonObject.toString());
|
||||
mqRecordDown.setStatus(SysMqRecord.Status.DONE.getStatus());
|
||||
mqRecordDown.setBizDate(bizDate);
|
||||
recordList.add(mqRecordDown);
|
||||
SysMqRecord mqRecordSign = new SysMqRecord();
|
||||
BeanUtil.copyProperties(mqRecordDown,mqRecordSign);
|
||||
mqRecordSign.setId(idGenerator.nextIdStr());
|
||||
mqRecordSign.setBizType(ContractConst.BIZ_TYPE_FILE_SIGN);
|
||||
mqRecordSign.setStatus(SysMqRecord.Status.DOING.getStatus());
|
||||
recordList.add(mqRecordSign);
|
||||
SysMqRecord mqRecordBack = new SysMqRecord();
|
||||
BeanUtil.copyProperties(mqRecordDown,mqRecordBack);
|
||||
mqRecordBack.setId(idGenerator.nextIdStr());
|
||||
mqRecordBack.setBizType(ContractConst.BIZ_TYPE_FILE_BACK);
|
||||
mqRecordBack.setStatus(SysMqRecord.Status.DOING.getStatus());
|
||||
recordList.add(mqRecordBack);
|
||||
} else if (fil.getName().contains("entrust")){
|
||||
SysMqRecord mqRecordDown = new SysMqRecord();
|
||||
mqRecordDown.setId(idGenerator.nextIdStr());
|
||||
mqRecordDown.setBizType(ContractConst.BIZ_TYPE_FILE_DOWNLOAD);
|
||||
mqRecordDown.setBizFileType(ContractConst.CONTRACT_PROXY);
|
||||
mqRecordDown.setBizNo(bizNo);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("appNo",bizNo);
|
||||
jsonObject.put("filePath",fil.getAbsolutePath());
|
||||
mqRecordDown.setData(jsonObject.toString());
|
||||
mqRecordDown.setStatus(SysMqRecord.Status.DONE.getStatus());
|
||||
mqRecordDown.setBizDate(bizDate);
|
||||
recordList.add(mqRecordDown);
|
||||
SysMqRecord mqRecordSign = new SysMqRecord();
|
||||
BeanUtil.copyProperties(mqRecordDown,mqRecordSign);
|
||||
mqRecordSign.setId(idGenerator.nextIdStr());
|
||||
mqRecordSign.setBizType(ContractConst.BIZ_TYPE_FILE_SIGN);
|
||||
mqRecordSign.setStatus(SysMqRecord.Status.DOING.getStatus());
|
||||
recordList.add(mqRecordSign);
|
||||
SysMqRecord mqRecordBack = new SysMqRecord();
|
||||
BeanUtil.copyProperties(mqRecordDown,mqRecordBack);
|
||||
mqRecordBack.setId(idGenerator.nextIdStr());
|
||||
mqRecordBack.setBizType(ContractConst.BIZ_TYPE_FILE_BACK);
|
||||
mqRecordBack.setStatus(SysMqRecord.Status.DOING.getStatus());
|
||||
recordList.add(mqRecordBack);
|
||||
} else if (fil.getName().contains(ContractConst.CONTRACT_FINANCING)) {
|
||||
SysMqRecord mqRecordDown = new SysMqRecord();
|
||||
mqRecordDown.setId(idGenerator.nextIdStr());
|
||||
mqRecordDown.setBizType(ContractConst.BIZ_TYPE_FILE_DOWNLOAD);
|
||||
mqRecordDown.setBizFileType(ContractConst.CONTRACT_FINANCING);
|
||||
mqRecordDown.setBizNo(bizNo);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("appNo",bizNo);
|
||||
jsonObject.put("filePath",fil.getAbsolutePath());
|
||||
mqRecordDown.setData(jsonObject.toString());
|
||||
mqRecordDown.setStatus(SysMqRecord.Status.DONE.getStatus());
|
||||
mqRecordDown.setBizDate(bizDate);
|
||||
recordList.add(mqRecordDown);
|
||||
SysMqRecord mqRecordSign = new SysMqRecord();
|
||||
BeanUtil.copyProperties(mqRecordDown,mqRecordSign);
|
||||
mqRecordSign.setId(idGenerator.nextIdStr());
|
||||
mqRecordSign.setBizType(ContractConst.BIZ_TYPE_FILE_SIGN);
|
||||
mqRecordSign.setStatus(SysMqRecord.Status.DOING.getStatus());
|
||||
recordList.add(mqRecordSign);
|
||||
SysMqRecord mqRecordBack = new SysMqRecord();
|
||||
BeanUtil.copyProperties(mqRecordDown,mqRecordBack);
|
||||
mqRecordBack.setId(idGenerator.nextIdStr());
|
||||
mqRecordBack.setBizType(ContractConst.BIZ_TYPE_FILE_BACK);
|
||||
mqRecordBack.setStatus(SysMqRecord.Status.DOING.getStatus());
|
||||
recordList.add(mqRecordBack);
|
||||
} else if (fil.getName().contains(ContractConst.INSTALLMENT_GUARANTEE)) {
|
||||
SysMqRecord mqRecordDown = new SysMqRecord();
|
||||
mqRecordDown.setId(idGenerator.nextIdStr());
|
||||
mqRecordDown.setBizType(ContractConst.BIZ_TYPE_FILE_DOWNLOAD);
|
||||
mqRecordDown.setBizFileType(ContractConst.INSTALLMENT_GUARANTEE);
|
||||
mqRecordDown.setBizNo(bizNo);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("appNo",bizNo);
|
||||
jsonObject.put("filePath",fil.getAbsolutePath());
|
||||
mqRecordDown.setData(jsonObject.toString());
|
||||
mqRecordDown.setStatus(SysMqRecord.Status.DONE.getStatus());
|
||||
mqRecordDown.setBizDate(bizDate);
|
||||
recordList.add(mqRecordDown);
|
||||
SysMqRecord mqRecordSign = new SysMqRecord();
|
||||
BeanUtil.copyProperties(mqRecordDown,mqRecordSign);
|
||||
mqRecordSign.setId(idGenerator.nextIdStr());
|
||||
mqRecordSign.setBizType(ContractConst.BIZ_TYPE_FILE_SIGN);
|
||||
mqRecordSign.setStatus(SysMqRecord.Status.DOING.getStatus());
|
||||
recordList.add(mqRecordSign);
|
||||
SysMqRecord mqRecordBack = new SysMqRecord();
|
||||
BeanUtil.copyProperties(mqRecordDown,mqRecordBack);
|
||||
mqRecordBack.setId(idGenerator.nextIdStr());
|
||||
mqRecordBack.setBizType(ContractConst.BIZ_TYPE_FILE_BACK);
|
||||
mqRecordBack.setStatus(SysMqRecord.Status.DOING.getStatus());
|
||||
recordList.add(mqRecordBack);
|
||||
}
|
||||
// 关闭线程池
|
||||
executor.shutdown();
|
||||
}
|
||||
|
||||
private JSONObject populateParams(JobReqEntity jobReqEntity) {
|
||||
@ -185,6 +329,7 @@ public class MsxfContractDownloadTasklet extends MsxfContractBatchTasklet {
|
||||
jsonParams.set("saveFilePath", saveFilePath);
|
||||
jsonParams.set("downloadPath", downloadPath);
|
||||
jsonParams.set("uuid", uuid);
|
||||
jsonParams.set("bizDate",formattedDate);
|
||||
|
||||
String bizType = getEventType(jobReqEntity);
|
||||
Integer status = getStatus(jobReqEntity);
|
||||
|
@ -1,28 +1,43 @@
|
||||
package com.zkj.loan.batch.tasklet.msxf;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollStreamUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zkj.loan.batch.tasklet.MsxfContractBatchTasklet;
|
||||
import com.zkj.loan.common.internet.feign.MsxfSftpClient;
|
||||
import com.zkj.loan.common.internet.feign.pojo.MsxfSftpReqVO;
|
||||
import com.zkj.loan.common.internet.feign.pojo.MsxfSftpRespVO;
|
||||
import com.zkj.loan.common.internet.mapper.sys.SysMqRecordMapper;
|
||||
import com.zkj.loan.common.internet.model.sys.SysMqRecord;
|
||||
import com.zkj.loan.common.internet.service.contract.entity.ContractConst;
|
||||
import com.zkj.loan.common.internet.service.sub.msxf.domain.pojo.LmtSignRecordVO;
|
||||
import com.zkj.loan.common.internet.service.tranfer.FileTransferService;
|
||||
import com.zkj.loan.common.internet.utils.BatchFileUtil;
|
||||
import com.zkj.loan.common.internet.utils.DateUtil;
|
||||
import com.zkj.open.api.client.feign.api.Result;
|
||||
import com.zkj.rcs.common.core.util.ftp.SFTPUtil;
|
||||
import com.zkj.rcs.scheduler.model.JobReqEntity;
|
||||
import com.zkj.rcs.scheduler.model.JobRespEntity;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.zkj.loan.batch.constants.JobStatusCode.*;
|
||||
import static com.zkj.loan.common.internet.constant.BusinessConstant.SUCCESS_00000;
|
||||
import static com.zkj.loan.common.internet.service.sub.msxf.domain.enums.EventType.FILE_BACK;
|
||||
|
||||
/**
|
||||
@ -46,40 +61,97 @@ public class MsxfContractToSFTPTasklet extends MsxfContractBatchTasklet {
|
||||
@Resource
|
||||
private FileTransferService fileTransferService;
|
||||
|
||||
@Resource
|
||||
private MsxfSftpClient msxfSftpClient;
|
||||
|
||||
@Value("${msxf.file.transfer.sleep.enabled:true}")
|
||||
private boolean sleepEnabled;
|
||||
|
||||
private final static String MSG = "回传签章合同给马上消费【msxfContractToSFTPTasklet】";
|
||||
@Override
|
||||
public void runJob(JobReqEntity jobReqEntity, JobRespEntity jobRespEntity) throws Exception {
|
||||
log.info("批量【msxfContractToSFTPTasklet】入参:[{}]", jobReqEntity);
|
||||
String date = getDate(jobReqEntity);
|
||||
String coopNo = getCoopNo(jobReqEntity);
|
||||
String prdCode = getPrdCode(jobReqEntity);
|
||||
String fileType = getFileType(jobReqEntity);
|
||||
//事件类型 参考EventType.java 枚举
|
||||
String eventType = getEventType(jobReqEntity);
|
||||
String bizDate = StringUtils.isEmpty(date) ? LocalDate.now().toString() : date;
|
||||
String formatDate = getYesDateFormats(bizDate);
|
||||
//状态枚举 参考SysMqRecord.java ,Status枚举
|
||||
Integer status = getStatus(jobReqEntity);
|
||||
String eventType = getEventType(jobReqEntity);
|
||||
// 使用逗号分割字符串
|
||||
String[] array = eventType.split(",");
|
||||
// 将数组转换为 List
|
||||
List<String> list = Arrays.asList(array);
|
||||
QueryWrapper<SysMqRecord> queryBack = new QueryWrapper<>();
|
||||
queryBack.lambda().eq(SysMqRecord::getBizDate,formatDate)
|
||||
.in(SysMqRecord::getBizFileType, list)
|
||||
.in(SysMqRecord::getBizType, ContractConst.BIZ_TYPE_FILE_BACK)
|
||||
.ne(SysMqRecord::getStatus, "2");
|
||||
List<SysMqRecord> backFail = sysMqRecordMapper.selectList(queryBack);
|
||||
|
||||
QueryWrapper<SysMqRecord> querySign = new QueryWrapper<>();
|
||||
querySign.lambda().eq(SysMqRecord::getBizDate,formatDate)
|
||||
.in(SysMqRecord::getBizFileType, list)
|
||||
.in(SysMqRecord::getBizType, ContractConst.BIZ_TYPE_FILE_SIGN)
|
||||
.eq(SysMqRecord::getStatus, "2");
|
||||
List<SysMqRecord> signSucc = sysMqRecordMapper.selectList(querySign);
|
||||
// 使用循环将 List 转换为 Map
|
||||
Map<String, SysMqRecord> signMap = new HashMap<>();
|
||||
for (SysMqRecord obj : signSucc) {
|
||||
String key = obj.getBizFileType() + "-" + obj.getBizNo(); // 拼接 key
|
||||
signMap.put(key, obj);
|
||||
}
|
||||
|
||||
List<SysMqRecord> recordsUpdated = uploadFiles(backFail,signMap, jobReqEntity);
|
||||
Map<String, List<SysMqRecord>> uploadedGroup = CollStreamUtil.groupByKey(recordsUpdated, SysMqRecord::getBizDate);
|
||||
|
||||
|
||||
// 上传马上sftp服务路径:/upload/DXBANK/back/contract/YYYYMMDD/
|
||||
String backSftpPath = getUploadPath(jobReqEntity, date);
|
||||
/* String backSftpPath = getUploadPath(jobReqEntity, date);
|
||||
String signFilePath = getSignFilePath(jobReqEntity, getYesDateFormats(date));
|
||||
List<String> eventTypeList = StrUtil.split(eventType, StrUtil.COMMA);
|
||||
|
||||
List<SysMqRecord> recordsToUpload = queryRecordsToUpload(date, status, eventTypeList);
|
||||
String okDownloadFilename = "DXBANK_download.ok";
|
||||
*/
|
||||
jobRespEntity.setRespCode(RESP_CODE_000000);
|
||||
jobRespEntity.setRespMesg(RESP_MESG_000000);
|
||||
|
||||
try {
|
||||
SFTPUtil sftpUtil = fileTransferService.getSftpUtilInstance(coopNo, prdCode, fileType);
|
||||
sftpUtil.login();
|
||||
List<SysMqRecord> recordsToUpdate = uploadFiles(recordsToUpload, backSftpPath, signFilePath, sftpUtil);
|
||||
updateSysMqRecordStatus(recordsToUpdate);
|
||||
String okfileContent = "0|" + recordsToUpdate.size();
|
||||
BatchFileUtil.makeFile(signFilePath, okDownloadFilename, okfileContent.getBytes());
|
||||
sftpUtil.upload(backSftpPath, signFilePath + okDownloadFilename);
|
||||
jobRespEntity.setRespCode(RESP_CODE_000000);
|
||||
jobRespEntity.setRespMesg(RESP_MESG_000000);
|
||||
} catch (Exception e) {
|
||||
log.error("msxfContractToSFTPTasklet 批量上传合同到马上消费SFTP失败", e);
|
||||
jobRespEntity.setRespCode(RESP_CODE_000056);
|
||||
jobRespEntity.setRespMesg(RESP_MESG_000056);
|
||||
}
|
||||
|
||||
private List<SysMqRecord> uploadFiles(List<SysMqRecord> recordsToUpload,Map<String, SysMqRecord> signMap, JobReqEntity jobReqEntity) {
|
||||
for (SysMqRecord record : recordsToUpload) {
|
||||
try {
|
||||
String key = record.getBizFileType() + "-" + record.getBizNo();
|
||||
SysMqRecord mqRecord = signMap.get(key);
|
||||
if (mqRecord == null){
|
||||
continue;
|
||||
}
|
||||
// 上传马上sftp服务路径:/upload/DXBANK/back/contract/YYYYMMDD/
|
||||
String backSftpPath = getUploadPath(jobReqEntity, record.getBizDate());
|
||||
// 获取远端服务器保存文件路径
|
||||
String data = mqRecord.getData();
|
||||
String signedPath = JSONObject.parseObject(data).getString("signedPath");
|
||||
if (StringUtils.isEmpty(signedPath)){
|
||||
continue;
|
||||
}
|
||||
//String saveFilePath = getSaveFilePath(jobReqEntity, record.getBizDate());
|
||||
|
||||
boolean success = uploadFile(record, backSftpPath, signedPath);
|
||||
record.setStatus(success ? SysMqRecord.Status.DONE.getStatus() : SysMqRecord.Status.FAILED.getStatus());
|
||||
} catch (Exception e) {
|
||||
log.error("{} 上传合同失败,serNo:{}", MSG, record.getBizNo(), e);
|
||||
record.setStatus(SysMqRecord.Status.FAILED.getStatus());
|
||||
} finally {
|
||||
try {
|
||||
// 进行记录更新
|
||||
updateSysMqRecordStatus(record);
|
||||
} catch (Exception ex) {
|
||||
log.error("{} 记录更新异常", record.getBizNo());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return CollUtil.removeNull(recordsToUpload);
|
||||
}
|
||||
|
||||
private List<SysMqRecord> queryRecordsToUpload(String date, Integer status, List<String> eventTypeList) {
|
||||
@ -88,47 +160,57 @@ public class MsxfContractToSFTPTasklet extends MsxfContractBatchTasklet {
|
||||
return sysMqRecordMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
private List<SysMqRecord> uploadFiles(List<SysMqRecord> recordsToUpload, String backSftpPath, String signFilePath, SFTPUtil sftpUtil) {
|
||||
return recordsToUpload.stream()
|
||||
.map(record -> {
|
||||
try {
|
||||
boolean success = uploadFile(record, backSftpPath, signFilePath, sftpUtil);
|
||||
record.setBizType(FILE_BACK.name());
|
||||
record.setStatus(success ? SysMqRecord.Status.DOING.getStatus() : SysMqRecord.Status.FAILED.getStatus());
|
||||
return record;
|
||||
} catch (Exception e) {
|
||||
log.error("上传合同失败,serNo:{}", record.getBizNo(), e);
|
||||
record.setStatus(SysMqRecord.Status.FAILED.getStatus());
|
||||
return record;
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private boolean uploadFile(SysMqRecord sysMqRecord, String backSftpPath, String signFilePath, SFTPUtil sftpUtil) throws Exception {
|
||||
private boolean uploadFile(SysMqRecord sysMqRecord, String backSftpPath, String saveFilePath) throws Exception {
|
||||
if(sleepEnabled){
|
||||
log.info("******** 开启睡眠 。。。 2秒 ********");
|
||||
Thread.sleep(2000);
|
||||
}
|
||||
String serNo = sysMqRecord.getBizNo();
|
||||
if (StrUtil.isBlank(serNo)) {
|
||||
log.error("serNo 不存在 id:{}", sysMqRecord.getId());
|
||||
return false;
|
||||
}
|
||||
|
||||
LmtSignRecordVO lmtSignRecordVO = JSONUtil.toBean(sysMqRecord.getData(), LmtSignRecordVO.class);
|
||||
if (lmtSignRecordVO == null) {
|
||||
signFilePath = signFilePath + serNo + "/" + "_contract.pdf";
|
||||
lmtSignRecordVO = new LmtSignRecordVO(serNo, "", signFilePath, "", "", backSftpPath);
|
||||
} else {
|
||||
signFilePath = lmtSignRecordVO.getSignPath();
|
||||
if (StrUtil.isBlank(sysMqRecord.getData())) {
|
||||
throw new RuntimeException("文件元信息不存在");
|
||||
}
|
||||
|
||||
File file = FileUtil.file(signFilePath);
|
||||
/*LmtSignRecordVO lmtSignRecordVO = JSONUtil.toBean(sysMqRecord.getData(), LmtSignRecordVO.class);
|
||||
String signFilePath = lmtSignRecordVO.getSignPath();*/
|
||||
if (StrUtil.isBlank(saveFilePath)) {
|
||||
throw new RuntimeException("签章合同文件路径不存在");
|
||||
}
|
||||
|
||||
File file = FileUtil.file(saveFilePath);
|
||||
if (!FileUtil.exist(file)) {
|
||||
log.error("签章的电子合同不存在,serNo:{},signFilePath:{}", sysMqRecord.getBizNo(), signFilePath);
|
||||
lmtSignRecordVO.setSignMsg("签章的电子合同不存在,serNo:{},signFilePath:{}" + sysMqRecord.getBizNo() + signFilePath);
|
||||
log.error("签章的电子合同不存在,serNo:{},signFilePath:{}", sysMqRecord.getBizNo(), saveFilePath);
|
||||
return false;
|
||||
}
|
||||
sftpUtil.upload(backSftpPath, signFilePath);
|
||||
sysMqRecord.setData(JSONUtil.toJsonStr(lmtSignRecordVO));
|
||||
return true;
|
||||
|
||||
// 调用接口进行SFTP上传
|
||||
MsxfSftpReqVO msxfSftpReqVO = new MsxfSftpReqVO();
|
||||
msxfSftpReqVO.setUuid(IdUtil.fastSimpleUUID());
|
||||
msxfSftpReqVO.setSaveFilePath(saveFilePath);
|
||||
msxfSftpReqVO.setFileName(FileUtil.getName(file));
|
||||
msxfSftpReqVO.setSftpUploadPath(backSftpPath);
|
||||
msxfSftpReqVO.setFileContent(FileUtil.readBytes(file));
|
||||
Result result = msxfSftpClient.contBacksend(JSONUtil.parseObj(msxfSftpReqVO));
|
||||
log.info("{} 调用接口进行SFTP回传结果:{}", MSG, result);
|
||||
if (!SUCCESS_00000.equals(result.getCode())) {
|
||||
throw new RuntimeException("调用接口进行SFTP回传失败");
|
||||
}
|
||||
|
||||
MsxfSftpRespVO msxfSftpRespVO = BeanUtil.toBean(result.getData(), MsxfSftpRespVO.class);
|
||||
if (ObjectUtil.isNotNull(msxfSftpRespVO)) {
|
||||
String returnCode = msxfSftpRespVO.getReturnCode();
|
||||
if (StrUtil.isNotEmpty(returnCode) && "000000".equals(returnCode)) {
|
||||
sysMqRecord.setData(JSONUtil.toJsonStr(msxfSftpRespVO));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -3,6 +3,8 @@ package com.zkj.loan.batch.tasklet.msxfold;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zkj.loan.batch.tasklet.BaseBatchTasklet;
|
||||
import com.zkj.loan.common.internet.mapper.bat.FacLoanDuebillMapper;
|
||||
import com.zkj.loan.common.internet.model.bat.FacLoanDuebill;
|
||||
import com.zkj.loan.common.internet.model.biz.CtrlLoanDetail;
|
||||
import com.zkj.loan.common.internet.service.base.biz.CtrlLoanDetailService;
|
||||
import com.zkj.loan.common.internet.service.base.fac.LoanDetailsService;
|
||||
@ -62,6 +64,9 @@ public class MsxfLoanDetailFileTasklet extends BaseBatchTasklet {
|
||||
@Resource
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
@Resource
|
||||
private FacLoanDuebillMapper facLoanDuebillMapper;
|
||||
|
||||
private static final String[] CALC_FIELD = {
|
||||
"biz_date",
|
||||
"contNo",
|
||||
@ -89,7 +94,7 @@ public class MsxfLoanDetailFileTasklet extends BaseBatchTasklet {
|
||||
String prdCode = (String) jobReqEntity.getJobParameter().get("prdCode");//文件名称
|
||||
if (Objects.nonNull(object)) {
|
||||
String tranDate = (String) object;
|
||||
date = LocalDate.parse(tranDate).plusDays(-1);
|
||||
date = LocalDate.parse(tranDate);
|
||||
} else {
|
||||
RBucket<LocalDate> redisPreDate = redissonClient.getBucket(SysRedisConstant.PREDATE);
|
||||
date = redisPreDate.get();
|
||||
@ -102,12 +107,22 @@ public class MsxfLoanDetailFileTasklet extends BaseBatchTasklet {
|
||||
queryWrapper.lambda().eq(CtrlLoanDetail::getPrdCode,prdCode);
|
||||
ctrlLoanDetailService.remove(queryWrapper);
|
||||
|
||||
/*QueryWrapper<FacLoanDuebill> loanDuebillQuery = new QueryWrapper<>();
|
||||
loanDuebillQuery.lambda().eq(FacLoanDuebill::getBizDate,yesDate);
|
||||
loanDuebillQuery.lambda().eq(FacLoanDuebill::getCoopNo,chanCode);
|
||||
loanDuebillQuery.lambda().eq(FacLoanDuebill::getPrdCode,prdCode);
|
||||
loanDuebillQuery.select("ifnull(sum(loan_bal),0) as loanBal,ifnull(sum(over_bal),0) as overBal");
|
||||
FacLoanDuebill loanDuebill = facLoanDuebillMapper.selectOne(loanDuebillQuery);
|
||||
*/
|
||||
CtrlLoanDetail loanDetail = loanDetailsService.countLoanData(yesDate,chanCode,prdCode);
|
||||
loanDetail.setId(idGenerator.nextIdStr());
|
||||
loanDetail.setOverLoanAmt(loanDetail.getOverAmt());
|
||||
loanDetail.setCoopNo(chanCode);
|
||||
loanDetail.setPrdCode(prdCode);
|
||||
loanDetail.setCreateDate(LocalDate.now());
|
||||
loanDetail.setCreateTime(LocalDateTime.now());
|
||||
loanDetail.setUpdateDate(LocalDate.now());
|
||||
loanDetail.setUpdateTime(LocalDateTime.now());
|
||||
ctrlLoanDetailService.save(loanDetail);
|
||||
/* String ctrlFile = saveTmpPath + "/" + yesDate + "-filelist"+ "/" + getFileName() + ".ctrl";
|
||||
String ctrlFilePattern = replaceDatePattern(ctrlFile,yesDate);
|
||||
|
@ -2,15 +2,19 @@ package com.zkj.loan.batch.tasklet.msxfold;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.Query;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.zkj.loan.batch.tasklet.BaseBatchTasklet;
|
||||
import com.zkj.loan.common.internet.mapper.biz.BizLoanClaimRepayMapper;
|
||||
import com.zkj.loan.common.internet.mapper.cus.PlsRepayPlanDetailMapper;
|
||||
import com.zkj.loan.common.internet.mapper.pls.ext.RepayPlanDetailExtMapper;
|
||||
import com.zkj.loan.common.internet.model.biz.BizLoanClaimRepay;
|
||||
import com.zkj.loan.common.internet.model.biz.CtrlRepayDetail;
|
||||
import com.zkj.loan.common.internet.model.cus.CusCoopMapping;
|
||||
import com.zkj.loan.common.internet.model.fac.LoanRepayPlan;
|
||||
import com.zkj.loan.common.internet.model.lmt.LmtCusCrdtLmt;
|
||||
import com.zkj.loan.common.internet.model.pls.RepayPlanDetail;
|
||||
import com.zkj.loan.common.internet.service.base.biz.BizLoanClaimRepayService;
|
||||
import com.zkj.loan.common.internet.service.base.biz.CtrlRepayDetailService;
|
||||
import com.zkj.loan.common.internet.service.base.cus.CusCoopMappingService;
|
||||
import com.zkj.loan.common.internet.service.base.lmt.LmtCusCrdtLmtService;
|
||||
@ -64,7 +68,8 @@ public class MsxfRepayFileTasklet extends BaseBatchTasklet {
|
||||
@Resource
|
||||
private IdGenerator idGenerator;
|
||||
|
||||
|
||||
@Resource
|
||||
private BizLoanClaimRepayMapper bizLoanClaimRepayMapper;
|
||||
@Resource
|
||||
private CtrlRepayDetailService ctrlRepayDetailService;
|
||||
|
||||
@ -115,12 +120,18 @@ public class MsxfRepayFileTasklet extends BaseBatchTasklet {
|
||||
}
|
||||
|
||||
String dateStr = date.toString().replace("-", "");
|
||||
BizLoanClaimRepay claimRepay = bizLoanClaimRepayMapper.countClaimData(dateStr,chanCode,prdCode);
|
||||
CtrlRepayDetail repayDetail = plsRepayPlanDetailMapper.countRepayData(dateStr,chanCode,prdCode);
|
||||
repayDetail.setId(idGenerator.nextIdStr());
|
||||
repayDetail.setClaimPrinAmt(claimRepay.getRepayAmt());
|
||||
repayDetail.setClaimIntAmt(claimRepay.getPaidIntAmt());
|
||||
repayDetail.setClaimPnltAmt(claimRepay.getPaidPnltAmt());
|
||||
repayDetail.setPrdCode(prdCode);
|
||||
repayDetail.setChanCode(chanCode);
|
||||
repayDetail.setCreateData(LocalDate.now());
|
||||
repayDetail.setCreateDate(LocalDate.now());
|
||||
repayDetail.setCreateTime(LocalDateTime.now());
|
||||
repayDetail.setUpdateDate(LocalDate.now());
|
||||
repayDetail.setUpdateTime(LocalDateTime.now());
|
||||
|
||||
QueryWrapper<CtrlRepayDetail> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(CtrlRepayDetail::getBizDate,dateStr);
|
||||
|
@ -32,6 +32,9 @@ public interface BizLoanClaimRepayMapper extends BaseMapper<BizLoanClaimRepay> {
|
||||
|
||||
int countByBizDate(@Param("startDate") String startDate, @Param("endDate") String endDate,
|
||||
@Param("coopNo") String coopNo);
|
||||
|
||||
|
||||
List<BizRecoveryBlackList> selectClaimCustList(@Param("createDate") LocalDate createDate,@Param("isUpdate") Boolean isUpdate);
|
||||
|
||||
BizLoanClaimRepay countClaimData(@Param("bizDate")String dateStr,@Param("coopNo") String chanCode, @Param("prdCode")String prdCode);
|
||||
|
||||
}
|
||||
|
@ -94,42 +94,42 @@
|
||||
|
||||
<select id="selectLoanClaimRepay" resultMap="LoanClaimRepayMap">
|
||||
SELECT
|
||||
'LN_LPHK' as scene,
|
||||
blcr.duebill_no,
|
||||
blcr.repay_ser,
|
||||
blcr.repay_amt,
|
||||
blcr.paid_int_amt,
|
||||
blcr.paid_pnlt_amt,
|
||||
fld.loan_bal,
|
||||
fld.int_over_bal,
|
||||
fld.int_fine_bal,
|
||||
fld.cust_no,
|
||||
fld.cust_name
|
||||
'LN_LPHK' as scene,
|
||||
blcr.duebill_no,
|
||||
blcr.repay_ser,
|
||||
blcr.repay_amt,
|
||||
blcr.paid_int_amt,
|
||||
blcr.paid_pnlt_amt,
|
||||
fld.loan_bal,
|
||||
fld.int_over_bal,
|
||||
fld.int_fine_bal,
|
||||
fld.cust_no,
|
||||
fld.cust_name
|
||||
FROM biz_loan_claim_repay blcr
|
||||
left join fac_loan_duebill fld on
|
||||
fld.duebill_no = blcr.duebill_no
|
||||
left join fac_loan_duebill fld on
|
||||
fld.duebill_no = blcr.duebill_no
|
||||
where blcr.create_date = #{bizDate}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAllLoanClaimRepayPage" resultType="java.util.Map">
|
||||
SELECT
|
||||
a.duebill_no duebillNo,b.curr_prin_amt currPrinAmt,b.ovd_prin_amt ovdPrinAmt,a.paid_int_amt paidIntAmt,
|
||||
a.paid_pnlt_amt paidPnltAmt,a.biz_date bizDate
|
||||
SELECT
|
||||
a.duebill_no duebillNo,b.curr_prin_amt currPrinAmt,b.ovd_prin_amt ovdPrinAmt,a.paid_int_amt paidIntAmt,
|
||||
a.paid_pnlt_amt paidPnltAmt,a.biz_date bizDate
|
||||
FROM biz_loan_claim_repay a left join fac_loan_repay_plan b on a.duebill_no = b.duebill_no and a.term_no = b.term_no
|
||||
where a.biz_date = #{bizDate} and a.coop_no = #{coopNo}
|
||||
</select>
|
||||
|
||||
<select id="selectAllLoanClaimRepayPageBetweenDate" resultType="java.util.Map">
|
||||
SELECT
|
||||
a.duebill_no duebillNo,ifnull(sum(a.repay_amt),0) repayAmt,ifnull(sum(a.paid_int_amt),0) paidIntAmt,
|
||||
ifnull(sum(a.paid_pnlt_amt),0) paidPnltAmt,a.biz_date bizDate
|
||||
SELECT
|
||||
a.duebill_no duebillNo,ifnull(sum(a.repay_amt),0) repayAmt,ifnull(sum(a.paid_int_amt),0) paidIntAmt,
|
||||
ifnull(sum(a.paid_pnlt_amt),0) paidPnltAmt,a.biz_date bizDate
|
||||
FROM biz_loan_claim_repay a
|
||||
where a.biz_date <= #{startDate} and a.biz_date > #{endDate} and a.coop_no = #{coopNo} group by a.duebill_no
|
||||
</select>
|
||||
<select id="countByBizDate" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
count(*)
|
||||
SELECT
|
||||
count(*)
|
||||
FROM biz_loan_claim_repay a
|
||||
where a.biz_date <= #{startDate} and a.biz_date > #{endDate} and a.coop_no = #{coopNo}
|
||||
</select>
|
||||
@ -143,4 +143,14 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="countClaimData" resultType="com.zkj.loan.common.internet.model.biz.BizLoanClaimRepay">
|
||||
SELECT ifnull(sum(blcr.repay_amt),0) as repay_amt , ifnull(sum(blcr.paid_int_amt),0) as paid_int_amt,
|
||||
ifnull(sum(blcr.paid_pnlt_amt),0) as paid_pnlt_amt
|
||||
FROM biz_loan_claim_repay blcr
|
||||
left join fac_loan_duebill fld on blcr.duebill_no = fld.duebill_no
|
||||
where blcr.biz_date = #{bizDate} and blcr.coop_no = #{coopNo} and fld.prd_code = #{prdCode}
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id,
|
||||
id,
|
||||
biz_date,
|
||||
cont_no,
|
||||
duebill_no,
|
||||
@ -84,9 +84,9 @@
|
||||
from
|
||||
fac_loan_details
|
||||
<where>
|
||||
<if test="coopNo != null and coopNo!=''">
|
||||
and coop_no = #{coopNo}
|
||||
</if>
|
||||
<if test="coopNo != null and coopNo!=''">
|
||||
and coop_no = #{coopNo}
|
||||
</if>
|
||||
</where>
|
||||
group by
|
||||
(case
|
||||
@ -208,24 +208,24 @@
|
||||
|
||||
<select id="selectLoanDetails" resultMap="LoanDetailsResultMap">
|
||||
select
|
||||
'LN_ZCFK' as scene,
|
||||
flds.loan_amt,
|
||||
flds.duebill_no,
|
||||
flds.loan_term,
|
||||
fld.cust_no,
|
||||
fld.loan_bal,
|
||||
fld.int_over_bal,
|
||||
fld.int_fine_bal,
|
||||
fld.cust_name
|
||||
'LN_ZCFK' as scene,
|
||||
flds.loan_amt,
|
||||
flds.duebill_no,
|
||||
flds.loan_term,
|
||||
fld.cust_no,
|
||||
fld.loan_bal,
|
||||
fld.int_over_bal,
|
||||
fld.int_fine_bal,
|
||||
fld.cust_name
|
||||
from
|
||||
fac_loan_details flds
|
||||
left join fac_loan_duebill fld on
|
||||
fld.duebill_no = flds.duebill_no
|
||||
fac_loan_details flds
|
||||
left join fac_loan_duebill fld on
|
||||
fld.duebill_no = flds.duebill_no
|
||||
where flds.biz_date = #{bizDate}
|
||||
</select>
|
||||
|
||||
<select id="selectByDuebillNo">
|
||||
select
|
||||
select
|
||||
<include refid="com.zkj.loan.common.internet.mapper.fac.LoanDetailsMapper.Base_Column_List"/>
|
||||
from fac_loan_details where duebill_no = #{duebillNo} limit 1
|
||||
</select>
|
||||
@ -282,11 +282,12 @@ select
|
||||
|
||||
<select id="countLoanData" resultType="com.zkj.loan.common.internet.model.biz.CtrlLoanDetail">
|
||||
SELECT
|
||||
fls.biz_date as bizDate, count(fls.id) as detailTotal, sum(fls.loan_amt) as loanAmtTotal
|
||||
fls.biz_date as bizDate, count(fls.id) as detailTotal, sum(fls.loan_amt) as loanAmtTotal,
|
||||
ifnull(sum(fld.loan_bal),0) as loanBal,ifnull(sum(fld.over_bal),0) as overAmt
|
||||
FROM fac_loan_details fls
|
||||
left join fac_loan_duebill fld on fls.duebill_no = fld.duebill_no
|
||||
left join fac_loan_duebill fld on fls.duebill_no = fld.duebill_no
|
||||
where fls.biz_date = #{yesDate,jdbcType=VARCHAR} and fls.coop_no = #{chanCode,jdbcType=VARCHAR}
|
||||
and fld.prd_code = #{prdCode,jdbcType=VARCHAR}
|
||||
and fld.prd_code = #{prdCode,jdbcType=VARCHAR}
|
||||
|
||||
</select>
|
||||
|
||||
|
@ -17,30 +17,30 @@
|
||||
<insert id="insertOne" parameterType="com.zkj.loan.common.internet.model.sys.SysMqRecord">
|
||||
INSERT INTO sys_mq_record
|
||||
(
|
||||
id,
|
||||
biz_type,
|
||||
biz_no,
|
||||
data,
|
||||
status,
|
||||
biz_date,
|
||||
create_time,
|
||||
update_time,
|
||||
cust_no,
|
||||
duebill_no
|
||||
id,
|
||||
biz_type,
|
||||
biz_no,
|
||||
data,
|
||||
status,
|
||||
biz_date,
|
||||
create_time,
|
||||
update_time,
|
||||
cust_no,
|
||||
duebill_no
|
||||
)
|
||||
VALUES
|
||||
(
|
||||
#{id},
|
||||
#{bizType},
|
||||
#{bizNo},
|
||||
#{data},
|
||||
#{status},
|
||||
DATE_FORMAT(NOW(), '%Y%m%d'),
|
||||
NOW(),
|
||||
NOW(),
|
||||
#{custNo},
|
||||
#{duebillNo}
|
||||
)
|
||||
(
|
||||
#{id},
|
||||
#{bizType},
|
||||
#{bizNo},
|
||||
#{data},
|
||||
#{status},
|
||||
DATE_FORMAT(NOW(), '%Y%m%d'),
|
||||
NOW(),
|
||||
NOW(),
|
||||
#{custNo},
|
||||
#{duebillNo}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" parameterType="java.util.List">
|
||||
@ -54,7 +54,8 @@
|
||||
create_time,
|
||||
update_time,
|
||||
cust_no,
|
||||
duebill_no
|
||||
duebill_no,
|
||||
biz_file_type
|
||||
)
|
||||
VALUES
|
||||
<foreach collection="list" item="record" separator=",">
|
||||
@ -64,11 +65,12 @@
|
||||
#{record.bizNo},
|
||||
#{record.data},
|
||||
#{record.status},
|
||||
DATE_FORMAT(NOW(), '%Y%m%d'),
|
||||
#{record.bizDate},
|
||||
NOW(),
|
||||
NOW(),
|
||||
#{record.custNo},
|
||||
#{record.duebillNo}
|
||||
#{record.duebillNo},
|
||||
#{record.bizFileType}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
@ -89,20 +91,20 @@
|
||||
|
||||
<select id="selectByBizNo" resultMap="SysMqRecordMap">
|
||||
SELECT
|
||||
id,
|
||||
biz_type,
|
||||
biz_no,
|
||||
data,
|
||||
status,
|
||||
biz_date,
|
||||
create_time,
|
||||
update_time,
|
||||
cust_no,
|
||||
duebill_no
|
||||
id,
|
||||
biz_type,
|
||||
biz_no,
|
||||
data,
|
||||
status,
|
||||
biz_date,
|
||||
create_time,
|
||||
update_time,
|
||||
cust_no,
|
||||
duebill_no
|
||||
FROM
|
||||
sys_mq_record
|
||||
sys_mq_record
|
||||
WHERE
|
||||
biz_no = #{bizNo, jdbcType=VARCHAR} AND biz_type = #{bizType, jdbcType=VARCHAR}
|
||||
biz_no = #{bizNo, jdbcType=VARCHAR} AND biz_type = #{bizType, jdbcType=VARCHAR}
|
||||
</select>
|
||||
|
||||
<select id="selectListBySelectiveAndPage" resultMap="SysMqRecordMap" parameterType="com.zkj.loan.common.internet.model.sys.SysMqRecord">
|
||||
|
@ -40,4 +40,10 @@ public class CtrlLoanDetail extends CommonEntity {
|
||||
private String coopNo;
|
||||
|
||||
private String prdCode;
|
||||
|
||||
private BigDecimal loanBal;
|
||||
|
||||
private BigDecimal overAmt;
|
||||
|
||||
private BigDecimal overLoanAmt;
|
||||
}
|
||||
|
@ -59,6 +59,23 @@ public class CtrlRepayDetail {
|
||||
*/
|
||||
private BigDecimal repayPnltAmt;
|
||||
|
||||
|
||||
/**
|
||||
* 理赔本金
|
||||
*/
|
||||
private BigDecimal claimPrinAmt;
|
||||
|
||||
/**
|
||||
* 理赔利息
|
||||
*/
|
||||
private BigDecimal claimIntAmt;
|
||||
|
||||
/**
|
||||
* 理赔罚息
|
||||
*/
|
||||
private BigDecimal claimPnltAmt;
|
||||
|
||||
|
||||
/**
|
||||
* 产品编号
|
||||
*/
|
||||
@ -69,11 +86,11 @@ public class CtrlRepayDetail {
|
||||
*/
|
||||
private String chanCode;
|
||||
|
||||
private LocalDate createData;
|
||||
private LocalDate createDate;
|
||||
|
||||
private LocalDateTime createTime;
|
||||
|
||||
private LocalDate updateData;
|
||||
private LocalDate updateDate;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
@ -28,11 +28,6 @@ public class SysMqRecord extends IdEntity {
|
||||
*/
|
||||
private String bizType;
|
||||
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
private String bizFileType;
|
||||
|
||||
/**
|
||||
* 交易流水号
|
||||
*/
|
||||
@ -73,6 +68,10 @@ public class SysMqRecord extends IdEntity {
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
private String bizFileType;
|
||||
/**
|
||||
* 状态枚举
|
||||
*/
|
||||
|
@ -58,4 +58,10 @@ public interface MsxfSftpClient {
|
||||
*/
|
||||
@PostMapping("/msxf/api/sftp/files/download")
|
||||
ResponseEntity<byte[]> downloadFileContent(@RequestBody JSONObject params) throws Exception;
|
||||
|
||||
/**
|
||||
* 马上电子合同文件sftp回传
|
||||
*/
|
||||
@PostMapping("/msxf/cont/backsend")
|
||||
Result contBacksend(@RequestBody JSONObject params) throws Exception;
|
||||
}
|
@ -7,6 +7,8 @@ import com.zkj.open.api.client.feign.api.Result;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
/**
|
||||
* @Classname OpenApiFeignFallback
|
||||
@ -50,6 +52,13 @@ public class MsxfSftpFeignFallback implements MsxfSftpClient {
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result contBacksend(JSONObject params) throws Exception {
|
||||
Result result = new Result();
|
||||
result.setCode(FeignConstant.FAIL_999999);
|
||||
result.setMessage(FeignConstant.HYSTRIX_FAIL_MSG);
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public Result loanImages(JSONObject params) {
|
||||
Result result = new Result();
|
||||
@ -60,6 +69,6 @@ public class MsxfSftpFeignFallback implements MsxfSftpClient {
|
||||
|
||||
@Override
|
||||
public ResponseEntity<byte[]> downloadFileContent(JSONObject params) throws Exception {
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(FeignConstant.HYSTRIX_FAIL_MSG.getBytes());
|
||||
return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(FeignConstant.HYSTRIX_FAIL_MSG.getBytes());
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,44 @@
|
||||
package com.zkj.loan.common.internet.feign.pojo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 马消SFTP请求对象
|
||||
*
|
||||
* @author xinrui.xiao
|
||||
* @date 2023-04-18 11:20
|
||||
* @since 1.0.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MsxfSftpReqVO implements Serializable {
|
||||
|
||||
/**
|
||||
* uuid
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* SFTP回传路径
|
||||
*/
|
||||
private String sftpUploadPath;
|
||||
|
||||
/**
|
||||
* 保存文件路径
|
||||
*/
|
||||
private String saveFilePath;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
|
||||
/**
|
||||
* 文件内容
|
||||
*/
|
||||
private byte[] fileContent;
|
||||
|
||||
}
|
@ -38,4 +38,6 @@ public interface ContractConst {
|
||||
String FDD_FILE_UPLOAD_CODE_SUCC = "1000";
|
||||
// 3.FDD-文件上传成功
|
||||
String FDD_FILE_UPLOAD_CODE_FAILD = "2002";
|
||||
// 4.业务类型-文件下载
|
||||
String BIZ_TYPE_FILE_DOWNLOAD = "FILE_DOWNLOAD";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user