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

测试代码

parent 92065d50
......@@ -142,7 +142,7 @@ public class BaiHangZhuDaiService {
private Boolean isDebug;
//众信利民助贷报送的资方id
private static Integer[] fundingCorpIds ={420, 520, 580, 650, 670, 810, 240, 640, 700}; //"420,520,580,650,670,810,240,640,700"
private static Integer[] fundingCorpIds ={1080,100040,1030,100030}; //"420,520,580,650,670,810,240,640,700"
private static final String branchTemplate = "%s 报送 : \n 成功 %s 条,失败 %s 条,白名单跳过 %s 条";
private static final String rootTemplate = "%s \n %s \n %s";
......@@ -384,6 +384,7 @@ public class BaiHangZhuDaiService {
String temp_yuQi = "逾期报送:查询 %d条(联合贷%d条), 实际 %d条, 跳过 %d条, 报送成功 %d条, 存日志 %d条;";
ReportResult normalResult = null;
ReportResult overdueResult = new ReportResult();
List<String> reportList = new ArrayList<>();
for (int j = 0; j < 2; j++) {
Stopwatch sendWatch = Stopwatch.createStarted();
try {
......@@ -481,22 +482,26 @@ public class BaiHangZhuDaiService {
String logJson = JSON.toJSONString(repaymentLoanInfo);
repaymentLoanInfo.setPid(interfaceUploadClient(repaymentLoanInfo.getPid()));
repaymentLoanInfo.setName(interfaceUploadClient(repaymentLoanInfo.getName()));
repaymentLoanInfo.setMobile(interfaceUploadClient(repaymentLoanInfo.getMobile()));
String resultStr = iHttpService.postBaiHang(baiHangRepayMentLoanInfoUrl, getHeader(), JSON.toJSONString(repaymentLoanInfo));
log.info("助贷还款用户报送结果, J: {} , param: {} , resultStr: {} ", j, logJson, resultStr);
if (Objects.isNull(resultStr) || !"success".equalsIgnoreCase(JSON.parseObject(resultStr).getString("status"))) {
log.info("量化派助贷TO百行报送-还款返回结果不正确, 开始时间: {} , 结束时间: {} , reqId_log: {} , recordId: {} , loanId: {} , bean: {} ", startnyr, endnyr, reqId_log, id, repaymentLoanInfo.getLoanId(), JSON.toJSONString(repaymentLoanInfo));
repaymentLoanInfoDbMapper.updateCurrentRecordEnableFalse(BaiHangUpDateRecord.builder().enable("0").recordId(id).build());
} else {
// repaymentLoanInfo.setPid(interfaceUploadClient(repaymentLoanInfo.getPid()));
// repaymentLoanInfo.setName(interfaceUploadClient(repaymentLoanInfo.getName()));
// repaymentLoanInfo.setMobile(interfaceUploadClient(repaymentLoanInfo.getMobile()));
// String resultStr = iHttpService.postBaiHang(baiHangRepayMentLoanInfoUrl, getHeader(), JSON.toJSONString(repaymentLoanInfo));
// log.info("助贷还款用户报送结果, J: {} , param: {} , resultStr: {} ", j, logJson, resultStr);
// if (Objects.isNull(resultStr) || !"success".equalsIgnoreCase(JSON.parseObject(resultStr).getString("status"))) {
// log.info("量化派助贷TO百行报送-还款返回结果不正确, 开始时间: {} , 结束时间: {} , reqId_log: {} , recordId: {} , loanId: {} , bean: {} ", startnyr, endnyr, reqId_log, id, repaymentLoanInfo.getLoanId(), JSON.toJSONString(repaymentLoanInfo));
// repaymentLoanInfoDbMapper.updateCurrentRecordEnableFalse(BaiHangUpDateRecord.builder().enable("0").recordId(id).build());
// } else {
// succ_atomicInt.getAndIncrement();
// }
succ_atomicInt.getAndIncrement();
}
reportList.add(JSON.toJSONString(repaymentLoanInfo));
} catch (Exception e) {
log.error("量化派助贷TO百行报送-还款信息异常, reqId_log: {} , recordId: {} , loanId: {} ", reqId_log, id, repaymentLoanInfo.getLoanId(), e);
}
}
File file = new File("\\test\\量子数科科技有限公司_D3_"+fileNameReplaceAll(startnyr.split("T")[0])+"_"+fileNameReplaceAll(endnyr.split("T")[0])+"_"+j+"_"+String.format("%06d",new Random().nextInt(999999))+".txt");
FileUtils.writeLines(file,reportList);
log.info("量化派助贷TO百行报送-还款申请完成 J: {} , 开始时间: {} , 结束时间: {} , list大小: {} , 实际大小: {} , 跳过: {} , 报送成功大小: {} , 保存日志: {} , 耗时: {} ", j, startnyr, endnyr, repaymentLoanInfos.size(), totail_atomicInt.get(), tg_atomicInt.get(), succ_atomicInt.get(), saveLog_atomicInt.get(), (sendWatch.stop().elapsed(TimeUnit.MILLISECONDS) / 1000) + ".s");
if (j == 0) {
......@@ -522,11 +527,11 @@ public class BaiHangZhuDaiService {
resMsg += "[" + (totail_atomicInt.get() == succ_atomicInt.get()) + "]";
} catch (Exception e) {
log.error("量化派助贷TO百行报送-异常 J: {} , 开始时间: {} , 结束时间: {} ", j, startnyr, endnyr, e);
dingTalk.talk("Error","量化派助贷TO百行报送-"+(j==0?"还款":"逾期")+"信息异常", e);
dingTalk.talk_ToUser("D3报送失败", "量化派助贷TO百行报送-"+(j==0?"还款":"逾期")+"信息异常,请尽快手动处理!");
//dingTalk.talk("Error","量化派助贷TO百行报送-"+(j==0?"还款":"逾期")+"信息异常", e);
//dingTalk.talk_ToUser("D3报送失败", "量化派助贷TO百行报送-"+(j==0?"还款":"逾期")+"信息异常,请尽快手动处理!");
}
}
dingTalk.talkToLeader("Info","",combineLeaderReport(normalResult,overdueResult));
//dingTalk.talkToLeader("Info","",combineLeaderReport(normalResult,overdueResult));
log.info("量化派助贷TO百行报送-实时还款&逾期结束, resMsg: {} ", resMsg);
return resMsg;
}
......@@ -2434,6 +2439,13 @@ public class BaiHangZhuDaiService {
return allRepaymentLoanInfo;
}
private String fileNameReplaceAll(String str) {
if (str.length()<=0) {
return "";
}
return str.replaceAll("-","").replaceAll(":","").replaceAll(" ","");
}
}
......@@ -394,7 +394,7 @@
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
and b.funding_corp_id in (880,890)
and b.funding_corp_id in (1080,100040,1030,100030)
and b.contract_term not in (2,3)
and b.loan_paid_at>='2019-10-25'
) a
......@@ -411,7 +411,7 @@
left join xyqb.loan_application_manifest_history b
on a.loan_application_history_id=b.loan_application_history_id
left join xyqb.repayment_record g on a.id=g.repayment_plan_id
where b.funding_corp_id in (880,890)
where b.funding_corp_id in (1080,100040,1030,100030)
group by a.loan_application_history_id) f on a.loan_application_history_id=f.loan_application_history_id
left join xyqb.repayment_record g on a.id=g.repayment_plan_id
left join (
......@@ -423,7 +423,7 @@
on a.loan_application_history_id=b.loan_application_history_id and b.loan_paid_at &lt; #{endTime,jdbcType=VARCHAR}
left join xyqb.repayment_plan c on a.loan_application_history_id=c.loan_application_history_id
where DATEDIFF(a.repaid_at,c.deadline)>=-1
and b.funding_corp_id in (880,890)
and b.funding_corp_id in (1080,100040,1030,100030)
group by a.loan_application_history_id,a.term_no) h
on a.loan_application_history_id=h.loan_application_history_id and a.term_no=h.term_no
left join (
......@@ -434,7 +434,7 @@
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}
left join xyqb.repayment_record d on a.loan_application_history_id=d.loan_application_history_id
where b.funding_corp_id in (880,890)
where b.funding_corp_id in (1080,100040,1030,100030)
group by a.loan_application_history_id,a.term_no) i
on a.loan_application_history_id=i.loan_application_history_id and a.term_no=i.term_no
left join xyqb.repayment_plan j on a.loan_application_history_id=j.loan_application_history_id
......@@ -483,7 +483,7 @@
where (a.repayment_status !=3 or (a.repayment_status =3 and a.repaid_at>= #{endTime,jdbcType=VARCHAR})) and
if(b.contract_term>a.term_no,DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)=0,DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)>=0)
and floor(DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)/30)=DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)/30
and b.funding_corp_id in (420,520,580,650,670,810,240,640,700)
and b.funding_corp_id in (1080,100040,1030,100030)
and b.transaction_status in (2,5)
and b.contract_term not in (2,3)
) a
......@@ -499,7 +499,7 @@
left join xyqb.loan_application_manifest_history b on a.loan_application_history_id=b.loan_application_history_id
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
where b.funding_corp_id in (420,520,580,650,670,810,240,640,700)
where b.funding_corp_id in (1080,100040,1030,100030)
group by a.loan_application_history_id
) f on a.loan_application_history_id=f.loan_application_history_id
left join xyqb.repayment_record g on a.id=g.repayment_plan_id;
......@@ -602,7 +602,7 @@
where ((a.repayment_status !=3 and DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)>=30) or (a.repayment_status =3 and a.repaid_at>= #{endTime,jdbcType=VARCHAR} and DATEDIFF(a.repaid_at,a.deadline)>=30)) and
if(b.contract_term>a.term_no,DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)=30,DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)>=30)
and floor(DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)/30)=DATEDIFF( #{endTime,jdbcType=VARCHAR},a.deadline)/30
and b.funding_corp_id in (880,890)
and b.funding_corp_id in (1080,100040,1030,100030)
and b.transaction_status in (2,5)
and b.contract_term not in (2,3)
and b.loan_paid_at>='2019-10-25'
......@@ -619,7 +619,7 @@
on a.loan_application_history_id=b.loan_application_history_id
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
where b.funding_corp_id in (880,890)
where b.funding_corp_id in (1080,100040,1030,100030)
group by a.loan_application_history_id) f on a.loan_application_history_id=f.loan_application_history_id
left join xyqb.repayment_record g on a.id=g.repayment_plan_id;
</select>
......
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