Commit e45b7adb authored by 陈宏杰's avatar 陈宏杰

放款开始结束时间

parent f76cf991
......@@ -160,9 +160,9 @@ public class ManualToolController {
}
@RequestMapping("/createFile")
public String testD2Repost(String type, String startDate, String endDate,Integer daySpilt){
public String testD2Repost(String type, String startDate, String endDate, Integer daySpilt, String loanStartDateStr, String loanEndDateStr){
try {
fileReportService.createReportFile(type,startDate,endDate,daySpilt);
fileReportService.createReportFile(type,startDate,endDate,daySpilt,loanStartDateStr,loanEndDateStr);
return "SUCCESS";
}catch (Exception e){
return e.getMessage();
......
......@@ -19,4 +19,8 @@ public class BaiHangTimeRecord {
private String loanApplicationHistoryId;
private String loanStartTime;
private String loanEndTime;
}
......@@ -77,30 +77,35 @@ public class BaiHangFileReportService {
* @param end 报送区间的截止时间 格式:"2019-05-07T00:00:00"
*/
@Async
public void createReportFile(String type, String start, String end,int daySplitCount) {
if (StringUtils.isAnyBlank(type, start, end)) {
public void createReportFile(String type, String start, String end,int daySplitCount, String loanStartDateStr, String loanEndDateStr) {
if (StringUtils.isAnyBlank(type, start, end, loanStartDateStr, loanEndDateStr)) {
throw new QGException(COMMON_ILLEGAL_PARAM_TOAST,"存在为空参数");
}
daySplitCount = Objects.isNull(daySplitCount) ? 10 : daySplitCount;
String dateFormat = "yyyy-MM-dd";
Date stepStartDate = DateUtils.parseDate(dateFormat,start);
Date stepEndDate = org.apache.commons.lang3.time.DateUtils.addDays(stepStartDate,daySplitCount);
Date endDate = 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);
createReportFile(type,stepStartDate,stepEndDate,loanStartDate,loanEndDate);
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);
createReportFile(type,stepStartDate,endDate,loanStartDate,loanEndDate);
}
}
private void createReportFile(String type, Date startDate, Date endDate) {
private void createReportFile(String type, Date startDate, Date endDate, Date loanStartDate, Date loanEndDate) {
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");
String loanStartTime = DateUtils.formatDate(loanStartDate,"yyyy-MM-dd HH:mm:ss");
String loanEndTime = DateUtils.formatDate(loanEndDate,"yyyy-MM-dd HH:mm:ss");
if (!starTime.equals(endTime)) {
log.info("开始生成报送文件{}----- {} -- {}",type,starTime,endTime);
if ("A1".equalsIgnoreCase(type)) {
......@@ -112,7 +117,7 @@ public class BaiHangFileReportService {
} else if ("D3O".equalsIgnoreCase(type)) {
reportD3O(starTime,endTime);
} else if ("D3R".equalsIgnoreCase(type)) {
reportD3R(starTime,endTime);
reportD3R(starTime,endTime,loanStartTime,loanEndTime);
} else if ("D3O30".equalsIgnoreCase(type)) {
reportD3OFor30Day(starTime,endTime);
} else {
......@@ -485,14 +490,14 @@ public class BaiHangFileReportService {
* @param startTime 开始时间
* @param endTime 截止时间
*/
private void reportD3R(String startTime, String endTime) {
private void reportD3R(String startTime, String endTime, String loanStartTime, String loanEndTime) {
List<RepaymentInfoZhuDai> repaymentLoanInfos = null,recordList = new ArrayList<>(D3_INITIAL_CAPACITY);
List<String> reportList = new ArrayList<>(D3_INITIAL_CAPACITY);
reportList.add("#singleLoanRepayInfo");
Stopwatch sendWatch = Stopwatch.createStarted();
try {
Stopwatch queryStopwatch = Stopwatch.createStarted();
repaymentLoanInfos = repaymentLoanInfoMapper.queryRepayMentRecordOfD3(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).build());
repaymentLoanInfos = repaymentLoanInfoMapper.queryRepayMentRecordOfD3(BaiHangTimeRecord.builder().startTime(startTime).endTime(endTime).loanStartTime(loanStartTime).loanEndTime(loanEndTime).build());
log.info("量化派助贷TO百行报送(D3)-还款记录查询结束, startTime: {} , endTime: {} , 大小: {} , 耗时: {} ", startTime, endTime, repaymentLoanInfos.size(), (queryStopwatch.stop().elapsed(TimeUnit.MILLISECONDS) / 1000) + ".s");
AtomicInteger atomicInteger = new AtomicInteger();
String id = "";
......
......@@ -1064,7 +1064,7 @@
,if(c.deadline is null,a.deadline,c.deadline) next_deadline
from xyqb.repayment_plan a
left join xyqb.loan_application_manifest_history b
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at &lt; #{endTime,jdbcType=VARCHAR}
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at >= #{loanStartTime,jdbcType=VARCHAR} and b.loan_paid_at &lt; #{loanEndTime,jdbcType=VARCHAR}
left join xyqb.repayment_plan c on a.loan_application_history_id=c.loan_application_history_id
and a.term_no=c.term_no-1
where a.repaid_at>=#{startTime,jdbcType=VARCHAR} and a.repaid_at &lt; #{endTime,jdbcType=VARCHAR} and a.repayment_status=3
......@@ -1083,7 +1083,7 @@
from xyqb.repayment_plan a
left join xyqb.loan_application_manifest_history b
on a.loan_application_history_id=b.loan_application_history_id
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at >= #{loanStartTime,jdbcType=VARCHAR} and b.loan_paid_at &lt; #{loanEndTime,jdbcType=VARCHAR}
left join xyqb.repayment_record g on a.id=g.repayment_plan_id
left join xyqb.plan_amount_detail h on a.id=h.plan_id
left join xyqb.repayment_plan c on a.loan_application_history_id=c.loan_application_history_id
......@@ -1098,7 +1098,7 @@
,max(c.deadline) max_deadline
from xyqb.repayment_plan a
left join xyqb.loan_application_manifest_history b
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at &lt; #{endTime,jdbcType=VARCHAR}
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at >= #{loanStartTime,jdbcType=VARCHAR} and b.loan_paid_at &lt; #{loanEndTime,jdbcType=VARCHAR}
left join xyqb.repayment_plan c on a.loan_application_history_id=c.loan_application_history_id
where a.repaid_at>=#{startTime,jdbcType=VARCHAR} and a.repaid_at &lt; #{endTime,jdbcType=VARCHAR} and DATEDIFF(a.repaid_at,c.deadline)>=-1
and b.funding_corp_id in (1080,100040,1030,100030)
......@@ -1110,7 +1110,7 @@
,sum(if(d.term_no>a.term_no,d.principal,0)) dkye
from xyqb.repayment_plan a
left join xyqb.loan_application_manifest_history b
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at &lt; #{endTime,jdbcType=VARCHAR}
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at >= #{loanStartTime,jdbcType=VARCHAR} and b.loan_paid_at &lt; #{loanEndTime,jdbcType=VARCHAR}
left join xyqb.repayment_record d on a.loan_application_history_id=d.loan_application_history_id
where a.repaid_at>=#{startTime,jdbcType=VARCHAR} and a.repaid_at &lt; #{endTime,jdbcType=VARCHAR} and b.funding_corp_id in (1080,100040,1030,100030)
group by a.loan_application_history_id,a.term_no) i
......
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