Commit 1e366106 authored by 陈宏杰's avatar 陈宏杰

D3O

parent 4d20c0c7
......@@ -104,4 +104,14 @@ public interface RepaymentLoanInfoMapper {
List<RepaymentInfoZhuDai> repairNormalLH(@Param("planIds")List<Long> planIds);
/**
* 查询D3逾期记录
*/
List<RepaymentInfoZhuDai> queryOverdueRecordOfD3(BaiHangTimeRecord baiHangTimeRecord);
/**
* 查询D3还款记录
*/
List<RepaymentInfoZhuDai> queryRepayMentRecordOfD3(BaiHangTimeRecord baiHangTimeRecord);
}
......@@ -103,6 +103,10 @@ public class BaiHangFileReportService {
reportD2(starTime,endTime);
} else if ("D3".equalsIgnoreCase(type)) {
reportD3(starTime,endTime);
} else if ("D3O".equalsIgnoreCase(type)) {
reportD3O(starTime,endTime);
} else if ("D3R".equalsIgnoreCase(type)) {
reportD3R(starTime,endTime);
} else {
throw new QGException(COMMON_ILLEGAL_PARAM_TOAST,"报送类型不正确");
}
......@@ -306,6 +310,108 @@ public class BaiHangFileReportService {
}
}
/**
* 非循环贷款贷后数据信息(D3)逾期记录
* @param startTime 开始时间
* @param endTime 截止时间
*/
private void reportD3O(String startTime, String endTime) {
List<RepaymentInfoZhuDai> repaymentLoanInfos = null;
List<String> reportList = new ArrayList<>();
reportList.add("#singleLoanRepayInfo");
Stopwatch sendWatch = Stopwatch.createStarted();
try {
Stopwatch queryStopwatch = Stopwatch.createStarted();
repaymentLoanInfos = repaymentLoanInfoMapper.queryOverdueRecordOfD3(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).build());
log.info("量化派助贷TO百行报送(D3)-逾期记录查询结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), (queryStopwatch.stop().elapsed(TimeUnit.MILLISECONDS) / 1000) + ".s");
AtomicInteger atomicInteger = new AtomicInteger();
String id = "";
for (int i = 0; i < repaymentLoanInfos.size(); i++) {
RepaymentInfoZhuDai repaymentLoanInfo = repaymentLoanInfos.get(i);
try {
id = UUID.randomUUID().toString().replaceAll("-", "");
try {
RepaymentInfoZhuDai record = new RepaymentInfoZhuDai();
BeanUtils.copyProperties(repaymentLoanInfo, record);
record.setRecordId(id);
repaymentLoanInfoDbMapper.saveRepaymentLoanInfoLog(record);
} catch (Exception e) {
log.error("量化派助贷TO百行报送(D3)-逾期记录保存异常", e);
}
repaymentLoanInfo.setReqID(id);
repaymentLoanInfo.setName(sensitiveFilter(repaymentLoanInfo.getName()));
repaymentLoanInfo.setPid(sensitiveFilter(repaymentLoanInfo.getPid()));
repaymentLoanInfo.setMobile(sensitiveFilter(repaymentLoanInfo.getMobile()));
atomicInteger.getAndIncrement();
reportList.add(JSON.toJSONString(repaymentLoanInfo));
} catch (Exception e) {
log.error("量化派助贷TO百行报送(D3)-逾期记录处理异常, recordId: {} , loanId: {} ", id, repaymentLoanInfo.getLoanId(), e);
}
}
File file = new File("量子数科科技有限公司_D3O_"+fileNameReplaceAll(startTime.split("T")[0])+"_"+fileNameReplaceAll(endTime.split("T")[0])+"_"+String.format("%06d",new Random().nextInt(999999))+".txt");
FileUtils.writeLines(file,reportList);
if (reportList.size()<=1) {
log.info("量化派助贷TO百行报送(D3)-逾期记录为空,加密文件不生成!starTime={},endTime={}",startTime,endTime);
} else {
createFile(file.getAbsolutePath());
}
log.info("量化派助贷TO百行报送(D3)-逾期记录完成,开始时间: {} , 结束时间: {} , 实际大小: {} , 报送成功大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), atomicInteger.get(), sendWatch.stop().elapsed(TimeUnit.MILLISECONDS));
} catch (Exception e) {
log.error("量化派助贷TO百行报送(D3)-逾期记录处理异常,开始时间: {} , 结束时间: {} ", startTime, endTime, e);
}
}
/**
* 非循环贷款贷后数据信息(D3)还款记录
* @param startTime 开始时间
* @param endTime 截止时间
*/
private void reportD3R(String startTime, String endTime) {
List<RepaymentInfoZhuDai> repaymentLoanInfos = null;
List<String> reportList = new ArrayList<>();
reportList.add("#singleLoanRepayInfo");
Stopwatch sendWatch = Stopwatch.createStarted();
try {
Stopwatch queryStopwatch = Stopwatch.createStarted();
repaymentLoanInfos = repaymentLoanInfoMapper.queryRepayMentRecordOfD3(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).build());
log.info("量化派助贷TO百行报送(D3)-还款记录查询结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), (queryStopwatch.stop().elapsed(TimeUnit.MILLISECONDS) / 1000) + ".s");
AtomicInteger atomicInteger = new AtomicInteger();
String id = "";
for (int i = 0; i < repaymentLoanInfos.size(); i++) {
RepaymentInfoZhuDai repaymentLoanInfo = repaymentLoanInfos.get(i);
try {
id = UUID.randomUUID().toString().replaceAll("-", "");
try {
RepaymentInfoZhuDai record = new RepaymentInfoZhuDai();
BeanUtils.copyProperties(repaymentLoanInfo, record);
record.setRecordId(id);
repaymentLoanInfoDbMapper.saveRepaymentLoanInfoLog(record);
} catch (Exception e) {
log.error("量化派助贷TO百行报送(D3)-还款记录保存异常", e);
}
repaymentLoanInfo.setReqID(id);
repaymentLoanInfo.setName(sensitiveFilter(repaymentLoanInfo.getName()));
repaymentLoanInfo.setPid(sensitiveFilter(repaymentLoanInfo.getPid()));
repaymentLoanInfo.setMobile(sensitiveFilter(repaymentLoanInfo.getMobile()));
atomicInteger.getAndIncrement();
reportList.add(JSON.toJSONString(repaymentLoanInfo));
} catch (Exception e) {
log.error("量化派助贷TO百行报送(D3)-还款记录处理异常, recordId: {} , loanId: {} ", id, repaymentLoanInfo.getLoanId(), e);
}
}
File file = new File("量子数科科技有限公司_D3R_"+fileNameReplaceAll(startTime.split("T")[0])+"_"+fileNameReplaceAll(endTime.split("T")[0])+"_"+String.format("%06d",new Random().nextInt(999999))+".txt");
FileUtils.writeLines(file,reportList);
if (reportList.size()<=1) {
log.info("量化派助贷TO百行报送(D3)-还款记录为空,加密文件不生成!starTime={},endTime={}",startTime,endTime);
} else {
createFile(file.getAbsolutePath());
}
log.info("量化派助贷TO百行报送(D3)-还款记录完成,开始时间: {} , 结束时间: {} , 实际大小: {} , 报送成功大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), atomicInteger.get(), sendWatch.stop().elapsed(TimeUnit.MILLISECONDS));
} catch (Exception e) {
log.error("量化派助贷TO百行报送(D3)-还款记录处理异常,开始时间: {} , 结束时间: {} ", startTime, endTime, e);
}
}
/**
* 根据传入的文件路径将加密后的文件生成到 {@link BaiHangFileReportService#HOST_PATH}中
* @param filePath 需要加密的文件路径
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment