Commit dd855d1f authored by haoyanhui's avatar haoyanhui

工具方法优化2

parent 4ef9e937
...@@ -339,4 +339,18 @@ public class ExZhuDaiBaiHangReSendController { ...@@ -339,4 +339,18 @@ public class ExZhuDaiBaiHangReSendController {
return "d3_saveDbLog任务调度失败,参数错误"; return "d3_saveDbLog任务调度失败,参数错误";
} }
} }
@RequestMapping("/manual/d3_build2")
public String d3_build2(String p3,String secretKey, String filePath, String writeFilePath){
if(StringUtils.isEmpty(writeFilePath)){
return "d3_build2任务调度失败,参数为空";
}
if(manualToolService.checkSecretKey(p3,secretKey)){
baiHangZhuDaiService.d3_build2(filePath, writeFilePath);
return "d3_build2任务调度完成";
}else{
return "d3_build2任务调度失败,参数错误";
}
}
} }
...@@ -40,6 +40,4 @@ public class RepaymentInfoZhuDai implements Serializable { ...@@ -40,6 +40,4 @@ public class RepaymentInfoZhuDai implements Serializable {
private String recordId; private String recordId;
public boolean getRecordId;
} }
...@@ -1858,6 +1858,7 @@ public class BaiHangZhuDaiService { ...@@ -1858,6 +1858,7 @@ public class BaiHangZhuDaiService {
} }
} }
//分析跑出来的D3存量,看那些是要M修改的,那些是要新增的
@Async @Async
public String d3CheckToJson(String filePath) { public String d3CheckToJson(String filePath) {
//写入文件的路径和前缀 //写入文件的路径和前缀
...@@ -2168,6 +2169,7 @@ public class BaiHangZhuDaiService { ...@@ -2168,6 +2169,7 @@ public class BaiHangZhuDaiService {
return "处理D3数据结束 "; return "处理D3数据结束 ";
} }
//检测存量跑出的A型D3,根据loan_id在不在D2日志中
@Async @Async
public String d3IsHaveD2(String filePath) { public String d3IsHaveD2(String filePath) {
//写入文件的路径和前缀 //写入文件的路径和前缀
...@@ -2234,6 +2236,7 @@ public class BaiHangZhuDaiService { ...@@ -2234,6 +2236,7 @@ public class BaiHangZhuDaiService {
} }
//将存量跑出来的数据保存日志表,并且RecordId赋值给ReqID
@Async @Async
public void d3_saveDbLog(String filePath, String writeFilePath) { public void d3_saveDbLog(String filePath, String writeFilePath) {
long starUtc = System.currentTimeMillis(); long starUtc = System.currentTimeMillis();
...@@ -2276,4 +2279,37 @@ public class BaiHangZhuDaiService { ...@@ -2276,4 +2279,37 @@ public class BaiHangZhuDaiService {
//d3_saveDbLog跑的数据多了"getRecordId":false, 去掉
@Async
public void d3_build2(String filePath, String writeFilePath) {
long starUtc = System.currentTimeMillis();
List<String> d3InfosList = null;
try {
d3InfosList = FileUtils.readLines(new File(filePath), "utf-8");
} catch (IOException e) {
e.printStackTrace();
}
int fsize = d3InfosList.size();
log.info("d3_build2读取文件: {} , 大小: {} , 耗时: {} ", filePath, fsize, (System.currentTimeMillis()-starUtc));
int saveCount=0;
for(int i=0; i< fsize; i++){
String strJson = d3InfosList.get(i);
try{
if(strJson.length() < 30 ){//#singleLoanRepayInfo
log.warn("d3InfosList筛选文件内容时发现数据错误, 文件: {} , 内容: {} ", filePath, strJson);
continue;
}
RepaymentInfoZhuDai repaymentLoanInfo = new Gson().fromJson(strJson, new TypeToken<RepaymentInfoZhuDai>(){}.getType());
this.wirteFile(writeFilePath, JSON.toJSONString(repaymentLoanInfo)+"\r\n");
saveCount++;
}catch (Exception e){
log.error("d3_build2写数据记录失败, fileName: {} , DATA: {} , 第i: {} ", filePath, strJson, i, e);
}
log.info("d3_build2写数据记录结束, 第i: {} <<<", i);
}
log.info("d3_build2写数据记录结束, 文件:{} ,list大小:{} , 保存成功:{} ", filePath, fsize, saveCount);
}
} }
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