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

不清库的重报方案

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