Commit 5014647f authored by 陈宏杰's avatar 陈宏杰

不清库的重报方案

parent 5f0ec89c
......@@ -155,9 +155,9 @@ public class ManualToolController {
}
@RequestMapping("/createFile")
public String testD2Repost(String type, String startDate, String endDate, Integer daySpilt, String loanStartDateStr, String loanEndDateStr){
public String testD2Repost(String type, String startDate, String endDate, Integer daySpilt, String loanStartDateStr, String loanEndDateStr, String prefix){
try {
fileReportService.createReportFile(type,startDate,endDate,daySpilt,loanStartDateStr,loanEndDateStr);
fileReportService.createReportFile(type,startDate,endDate,daySpilt,loanStartDateStr,loanEndDateStr,prefix);
return "SUCCESS";
}catch (Exception e){
return e.getMessage();
......
......@@ -84,7 +84,7 @@ public class BaiHangFileReportService {
* @param end 报送区间的截止时间 格式:"2019-05-07T00:00:00"
*/
@Async
public void createReportFile(String type, String start, String end,int daySplitCount, String loanStartDateStr, String loanEndDateStr) {
public void createReportFile(String type, String start, String end,int daySplitCount, String loanStartDateStr, String loanEndDateStr, String prefix) {
try {
if (!increment(Constant.QG_ZHU_DAI_CREATE_REPORT_FILE_LOCK_KEY)) {
log.error("创建报送文件任务已经开始执行...请勿重复操作");
......@@ -99,18 +99,18 @@ public class BaiHangFileReportService {
Date stepStartDate = DateUtils.parseDate(dateFormat,start);
Date stepEndDate = org.apache.commons.lang3.time.DateUtils.addDays(stepStartDate,daySplitCount);
// D3 还款记录 防止漏期
Date endDate = "D3R".equalsIgnoreCase(type) ? new Date() : DateUtils.parseDate(dateFormat,end);
Date endDate = "D3R".equalsIgnoreCase(type) ? org.apache.commons.lang3.time.DateUtils.addDays(new Date(),1) : DateUtils.parseDate(dateFormat,end);
Date loanStartDate = DateUtils.parseDate(dateFormat,loanStartDateStr);
Date loanEndDate = DateUtils.parseDate(dateFormat,loanEndDateStr);
Stopwatch stopwatch = Stopwatch.createStarted();
while (stepEndDate.getTime() <= endDate.getTime()){
createReportFile(type,stepStartDate,stepEndDate,loanStartDate,loanEndDate);
createReportFile(type,stepStartDate,stepEndDate,loanStartDate,loanEndDate,prefix);
stepStartDate = new Date(stepEndDate.getTime());
stepEndDate = org.apache.commons.lang3.time.DateUtils.addDays(stepEndDate,daySplitCount);
}
log.info("当前 {} -- {}--{} 任务执行结束 总耗时 : {}",type,start,end,stopwatch.elapsed(TimeUnit.MILLISECONDS));
if (stepEndDate.getTime() > endDate.getTime()){
createReportFile(type,stepStartDate,endDate,loanStartDate,loanEndDate);
createReportFile(type,stepStartDate,endDate,loanStartDate,loanEndDate,prefix);
}
} catch (Exception e) {
log.error("创建报送文件异常!",e);
......@@ -119,7 +119,7 @@ public class BaiHangFileReportService {
}
}
private void createReportFile(String type, Date startDate, Date endDate, Date loanStartDate, Date loanEndDate) {
private void createReportFile(String type, Date startDate, Date endDate, Date loanStartDate, Date loanEndDate, String prefix) {
Stopwatch stopwatch = Stopwatch.createStarted();
String starTime = DateUtils.formatDate(startDate,"yyyy-MM-dd HH:mm:ss");
String endTime = DateUtils.formatDate(endDate,"yyyy-MM-dd HH:mm:ss");
......@@ -130,15 +130,15 @@ public class BaiHangFileReportService {
if ("A1".equalsIgnoreCase(type)) {
reportA1(starTime,endTime);
} else if ("D2".equalsIgnoreCase(type)) {
reportD2(starTime,endTime);
reportD2(starTime,endTime,prefix);
} else if ("D3".equalsIgnoreCase(type)) {
reportD3(starTime,endTime);
reportD3(starTime,endTime,prefix);
} else if ("D3O".equalsIgnoreCase(type)) {
reportD3O(starTime,endTime);
reportD3O(starTime,endTime,prefix);
} else if ("D3R".equalsIgnoreCase(type)) {
reportD3R(starTime,endTime,loanStartTime,loanEndTime);
reportD3R(starTime,endTime,loanStartTime,loanEndTime,prefix);
} else if ("D3O30".equalsIgnoreCase(type)) {
reportD3OFor30Day(starTime,endTime);
reportD3OFor30Day(starTime,endTime,prefix);
} else {
throw new QGException(COMMON_ILLEGAL_PARAM_TOAST,"报送类型不正确");
}
......@@ -214,7 +214,7 @@ public class BaiHangFileReportService {
* @param starTime 开始时间
* @param endTime 截至时间
*/
private void reportD2(String starTime, String endTime) {
private void reportD2(String starTime, String endTime, String prefix) {
List<LoanInfoZhuDai> loanInfozdList = null,recordList = new ArrayList<>(D2_INITIAL_CAPACITY);
Stopwatch stopwatch = Stopwatch.createStarted();
try {
......@@ -255,6 +255,12 @@ public class BaiHangFileReportService {
loanInfoVo.setAccountOpenDate(loanInfoVo.getIssueDate());
loanInfoVo.setApplyDate(loanInfoVo.getIssueDate());
}
if (isDebug && StringUtils.isNotBlank(prefix)) {
loanInfoVo.setReqID(prefix+loanInfoVo.getReqID());
loanInfoVo.setLoanId(prefix+loanInfoVo.getLoanId());
finTechAgencyBusiness.setRelationID(prefix+finTechAgencyBusiness.getRelationID());
loanInfoVo.setFinTechAgencyBusiness(finTechAgencyBusiness);
}
reportList.add(JSON.toJSONString(loanInfoVo));
atomicInteger.getAndIncrement();
} catch (Exception e) {
......@@ -282,7 +288,7 @@ public class BaiHangFileReportService {
* @param startTime 开始时间
* @param endTime 截止时间
*/
private void reportD3( String startTime, String endTime) {
private void reportD3( String startTime, String endTime, String prefix) {
for (int j = 0; j < 2; j++) {
List<String> reportList = new ArrayList<>();
reportList.add("#singleLoanRepayInfo");
......@@ -323,6 +329,10 @@ public class BaiHangFileReportService {
repaymentLoanInfo.setName(sensitiveFilter(repaymentLoanInfo.getName()));
repaymentLoanInfo.setPid(sensitiveFilter(repaymentLoanInfo.getPid()));
repaymentLoanInfo.setMobile(sensitiveFilter(repaymentLoanInfo.getMobile()));
if (isDebug && StringUtils.isNotBlank(prefix)) {
repaymentLoanInfo.setReqID(prefix+repaymentLoanInfo.getReqID());
repaymentLoanInfo.setLoanId(prefix+repaymentLoanInfo.getLoanId());
}
atomicInteger.getAndIncrement();
reportList.add(JSON.toJSONString(repaymentLoanInfo));
} catch (Exception e) {
......@@ -397,7 +407,7 @@ public class BaiHangFileReportService {
* @param startTime 开始时间
* @param endTime 截止时间
*/
private void reportD3O(String startTime, String endTime) {
private void reportD3O(String startTime, String endTime, String prefix) {
List<RepaymentInfoZhuDai> repaymentLoanInfos = null,recordList = new ArrayList<>(D3_INITIAL_CAPACITY);
List<String> reportList = new ArrayList<>(D3_INITIAL_CAPACITY);
reportList.add("#singleLoanRepayInfo");
......@@ -420,6 +430,10 @@ public class BaiHangFileReportService {
repaymentLoanInfo.setName(sensitiveFilter(repaymentLoanInfo.getName()));
repaymentLoanInfo.setPid(sensitiveFilter(repaymentLoanInfo.getPid()));
repaymentLoanInfo.setMobile(sensitiveFilter(repaymentLoanInfo.getMobile()));
if (isDebug && StringUtils.isNotBlank(prefix)) {
repaymentLoanInfo.setReqID(prefix+repaymentLoanInfo.getReqID());
repaymentLoanInfo.setLoanId(prefix+repaymentLoanInfo.getLoanId());
}
atomicInteger.getAndIncrement();
reportList.add(JSON.toJSONString(repaymentLoanInfo));
} catch (Exception e) {
......@@ -445,7 +459,7 @@ public class BaiHangFileReportService {
/**
* 应还款日次日起,每30天的次日报送一次逾期记录,直至结清或转出
*/
private void reportD3OFor30Day(String startTime, String endTime) {
private void reportD3OFor30Day(String startTime, String endTime, String prefix) {
List<LoanApplicationHistoryIdInfo> idInfos = null;
LoanApplicationHistoryIdInfo idInfo = null;
List<RepaymentInfoZhuDai> repaymentLoanInfos = new ArrayList<>(D3_INITIAL_CAPACITY),tempRepaymentLoanInfos = null,recordList = new ArrayList<>(D3_INITIAL_CAPACITY);
......@@ -488,6 +502,10 @@ public class BaiHangFileReportService {
repaymentLoanInfo.setName(sensitiveFilter(repaymentLoanInfo.getName()));
repaymentLoanInfo.setPid(sensitiveFilter(repaymentLoanInfo.getPid()));
repaymentLoanInfo.setMobile(sensitiveFilter(repaymentLoanInfo.getMobile()));
if (isDebug && StringUtils.isNotBlank(prefix)) {
repaymentLoanInfo.setReqID(prefix+repaymentLoanInfo.getReqID());
repaymentLoanInfo.setLoanId(prefix+repaymentLoanInfo.getLoanId());
}
atomicInteger.getAndIncrement();
reportList.add(JSON.toJSONString(repaymentLoanInfo));
} catch (Exception e) {
......@@ -515,7 +533,7 @@ public class BaiHangFileReportService {
* @param startTime 开始时间
* @param endTime 截止时间
*/
private void reportD3R(String startTime, String endTime, String loanStartTime, String loanEndTime) {
private void reportD3R(String startTime, String endTime, String loanStartTime, String loanEndTime, String prefix) {
List<RepaymentInfoZhuDai> repaymentLoanInfos = null,recordList = new ArrayList<>(D3_INITIAL_CAPACITY);
List<String> reportList = new ArrayList<>(D3_INITIAL_CAPACITY);
reportList.add("#singleLoanRepayInfo");
......@@ -538,6 +556,10 @@ public class BaiHangFileReportService {
repaymentLoanInfo.setName(sensitiveFilter(repaymentLoanInfo.getName()));
repaymentLoanInfo.setPid(sensitiveFilter(repaymentLoanInfo.getPid()));
repaymentLoanInfo.setMobile(sensitiveFilter(repaymentLoanInfo.getMobile()));
if (isDebug && StringUtils.isNotBlank(prefix)) {
repaymentLoanInfo.setReqID(prefix+repaymentLoanInfo.getReqID());
repaymentLoanInfo.setLoanId(prefix+repaymentLoanInfo.getLoanId());
}
atomicInteger.getAndIncrement();
reportList.add(JSON.toJSONString(repaymentLoanInfo));
} catch (Exception e) {
......
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