Commit 9e0ccc01 authored by 郑建's avatar 郑建

文件报送手动模式

parent 045a3689
package cn.quantgroup.report.controller;
import cn.quantgroup.report.response.GlobalResponse;
import cn.quantgroup.report.service.baihang.BaiHangZhuDaiService;
import cn.quantgroup.report.service.common.CommonQueryService;
import cn.quantgroup.report.service.manualTool.CleanningTransactionLogService;
import cn.quantgroup.report.service.manualTool.ManualToolService;
import cn.quantgroup.report.utils.DateUtils;
import com.alibaba.fastjson.JSON;
import com.google.common.base.Stopwatch;
import com.google.common.collect.ImmutableMap;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.Map;
import java.util.concurrent.TimeUnit;
@Slf4j
@RestController
......@@ -21,6 +26,9 @@ public class ManualToolController {
@Autowired
private ManualToolService manualToolService;
@Autowired
BaiHangZhuDaiService zhuDaiService;
@Autowired
private CommonQueryService queryService;
......@@ -150,5 +158,44 @@ public class ManualToolController {
}
}
@RequestMapping("/createFile")
public void testD2Repost(){
Stopwatch stopwatch = Stopwatch.createStarted();
D2();
log.info("跑了 {}",stopwatch.elapsed(TimeUnit.MILLISECONDS));
}
//2020-07-01
private void D2(){
String startTime = "2020-06-12",endTime = "2020-07-01";
Date startDate;
Date endDate = DateUtils.parseDate("yyyy-MM-dd",endTime);
while (endDate.getTime() < System.currentTimeMillis()){
log.info("开始报送D2----- {} -- {}",startTime,endTime);
zhuDaiService.apiSend("D2",startTime+"T00:00:00",endTime+"T00:00:00");
log.info("报送D2结束----- {} -- {}",startTime,endTime);
startDate = new Date(endDate.getTime());
endDate = org.apache.commons.lang3.time.DateUtils.addMonths(endDate,1);
startTime = DateUtils.formatDate(startDate,"yyyy-MM-dd");
endTime = DateUtils.formatDate(endDate,"yyyy-MM-dd");
}
}
private void D3(){
String startTime = "2020-06-12",endTime = "2020-07-01";
Date startDate;
Date endDate = DateUtils.parseDate("yyyy-MM-dd",endTime);
while (endDate.getTime() < System.currentTimeMillis()){
log.info("开始报送D3----- {} -- {}",startTime,endTime);
zhuDaiService.apiSend("D3",startTime+"T00:00:00",endTime+"T00:00:00");
log.info("报送D3结束----- {} -- {}",startTime,endTime);
startDate = new Date(endDate.getTime());
endDate = org.apache.commons.lang3.time.DateUtils.addDays(endDate,10);
startTime = DateUtils.formatDate(startDate,"yyyy-MM-dd");
endTime = DateUtils.formatDate(endDate,"yyyy-MM-dd");
}
}
}
......@@ -150,7 +150,7 @@ public class BaiHangZhuDaiService {
try {
long log_stUtc1 = System.currentTimeMillis();
baihang_zhudai_publickey = BHRSAUtils.readRSAPublicKey("/baihang/rsa_public_key_test.pem");
baihang_zhudai_publickey = BHRSAUtils.readRSAPublicKey("/baihang/rsa_public_key.pem");
log.info("初始化百行助贷PublicKey实例完成, 耗时: {} ", System.currentTimeMillis() - log_stUtc1);
} catch (Exception e) {
log.error("初始化百行助贷PublicKey实例", e);
......@@ -160,7 +160,7 @@ public class BaiHangZhuDaiService {
public static PublicKey getBaihangZDPublickey() {
if (baihang_zhudai_publickey == null) {
try {
baihang_zhudai_publickey = BHRSAUtils.readRSAPublicKey("/baihang/rsa_public_key_test.pem");
baihang_zhudai_publickey = BHRSAUtils.readRSAPublicKey("/baihang/rsa_public_key.pem");
log.info("初始化百行助贷PublicKey实例完成");
} catch (Exception e) {
log.error("初始化百行助贷PublicKey实例", e);
......@@ -1598,7 +1598,7 @@ public class BaiHangZhuDaiService {
LoanInfoZhuDai record = new LoanInfoZhuDai();
BeanUtils.copyProperties(loanInfo, record);
record.setRecordId(id);
// loanInfoDbMapper.saveLoanInfoRecordLog(record);
loanInfoDbMapper.saveLoanInfoRecordLog(record);
} catch (Exception e) {
log.error("量化派助贷TO百行报送-放款申请保存记录失败", e);
}
......@@ -1611,7 +1611,7 @@ public class BaiHangZhuDaiService {
loanInfoVo.setName(tuomin(loanInfo.getName()));
loanInfoVo.setPid(tuomin(loanInfo.getPid()));
loanInfoVo.setMobile(tuomin(loanInfo.getMobile()));
if (DateUtils.parseDate("yyyy-MM-dd'T'hh:mm:ss",loanInfoVo.getIssueDate()).getTime() < DateUtils.parseDate("yyyy-MM-dd'T'hh:mm:ss",loanInfoVo.getAccountOpenDate()).getTime()){
if (DateUtils.parseDate("yyyy-MM-dd'T'HH:mm:ss",loanInfoVo.getIssueDate()).getTime() < DateUtils.parseDate("yyyy-MM-dd'T'HH:mm:ss",loanInfoVo.getAccountOpenDate()).getTime()){
loanInfoVo.setAccountOpenDate(loanInfoVo.getIssueDate());
loanInfoVo.setApplyDate(loanInfoVo.getIssueDate());
}
......@@ -1629,7 +1629,7 @@ public class BaiHangZhuDaiService {
log.error("量化派助贷TO百行报送-放款信息异常, recordId: {} , loanId: {} ", id, loanInfo.getLoanId(), e);
}
}
File file = new File("F:\\9_QFNEW\\baihang-report\\D3\\量子数科科技有限公司_D2_"+endTime.split("T")[0].replaceAll("-","")+"_0002"+".txt");
File file = new File("D3-3S\\量子数科科技有限公司_D2_"+endTime.split("T")[0].replaceAll("-","")+"_0002"+".txt");
FileUtils.writeLines(file,reportList);
createFile(file.getName());
log.info("量化派助贷TO百行报送-放款申请完成, 实际大小: {} , 报送成功大小: {} , 耗时: {} ", loanInfozdList.size(), atomicInteger.get(), sendWatch.stop().elapsed(TimeUnit.MILLISECONDS));
......@@ -1671,7 +1671,7 @@ public class BaiHangZhuDaiService {
RepaymentInfoZhuDai record = new RepaymentInfoZhuDai();
BeanUtils.copyProperties(repaymentLoanInfo, record);
record.setRecordId(id);
repaymentLoanInfoDbMapper.saveRepaymentLoanInfoLog(record);
// repaymentLoanInfoDbMapper.saveRepaymentLoanInfoLog(record);
} catch (Exception e) {
log.error("量化派助贷TO百行报送-实时还款保存记录异常", e);
}
......@@ -1694,7 +1694,7 @@ public class BaiHangZhuDaiService {
}
}
File file = new File("F:\\9_QFNEW\\baihang-report\\D3\\量子数科科技有限公司_D3_"+endTime.split("T")[0].replaceAll("-","")+"_"+UUID.randomUUID().toString()+".txt");
File file = new File("D3-3S\\量子数科科技有限公司_D3_"+endTime.split("T")[0].replaceAll("-","")+"_"+"0003"+".txt");
FileUtils.writeLines(file,reportList);
createFile(file.getName());
log.info("量化派助贷TO百行报送-还款申请完成 J: {} , 开始时间: {} , 结束时间: {} , 实际大小: {} , 报送成功大小: {} , 耗时: {} ", j, starTime, endTime, repaymentLoanInfos.size(), atomicInteger.get(), sendWatch.stop().elapsed(TimeUnit.MILLISECONDS));
......@@ -2429,7 +2429,7 @@ public class BaiHangZhuDaiService {
private static void createFile(String fileName){
String HOST = "F:\\9_QFNEW\\baihang-report\\D3\\";
String HOST = "D3-3S\\";
File host = new File(HOST);
if (!host.exists()){
host.mkdir();
......@@ -2456,11 +2456,12 @@ public class BaiHangZhuDaiService {
}
private static String tuomin(String s){
if (StringUtils.isNumeric(s) || s.contains("X") || s.contains("x")){
return s.substring(0,s.length()-4)+"0000";
}else {
return s.substring(0,1)+"零";
}
// if (StringUtils.isNumeric(s) || s.contains("X") || s.contains("x")){
// return s.substring(0,s.length()-4)+"0000";
// }else {
// return s.substring(0,1)+"零";
// }
return s;
}
}
......
......@@ -44,10 +44,10 @@ public class BaihangReportApplicationTests {
//2020-07-01
private void D2(){
String startTime = "2020-07-01",endTime = "2020-07-01";
String startTime = "2020-06-12",endTime = "2020-07-01";
Date startDate;
Date endDate = DateUtils.parseDate("yyyy-MM-dd",endTime);
while (endDate.getTime() < System.currentTimeMillis()){
while (endDate.getTime() < DateUtils.parseDate("yyyy-MM-dd","2020-07-02").getTime()){
log.info("开始报送D2----- {} -- {}",startTime,endTime);
zhuDaiService.apiSend("D2",startTime+"T00:00:00",endTime+"T00:00:00");
startDate = new Date(endDate.getTime());
......@@ -58,14 +58,14 @@ public class BaihangReportApplicationTests {
}
private void D3(){
String startTime = "2020-07-01",endTime = "2020-07-01";
String startTime = "2020-06-12",endTime = "2020-07-01";
Date startDate;
Date endDate = DateUtils.parseDate("yyyy-MM-dd",endTime);
while (endDate.getTime() < System.currentTimeMillis()){
log.info("开始报送D3----- {} -- {}",startTime,endTime);
zhuDaiService.apiSend("D3",startTime+"T00:00:00",endTime+"T00:00:00");
startDate = new Date(endDate.getTime());
endDate = org.apache.commons.lang3.time.DateUtils.addMonths(endDate,1);
endDate = org.apache.commons.lang3.time.DateUtils.addDays(endDate,10);
startTime = DateUtils.formatDate(startDate,"yyyy-MM-dd");
endTime = DateUtils.formatDate(endDate,"yyyy-MM-dd");
}
......
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