Commit 2bf861b8 authored by 郝彦辉's avatar 郝彦辉

D3筛选替换reqId

parent 37965533
......@@ -130,4 +130,10 @@ public class ManualToolController {
return manualToolService.check_D2loanId_InD3WanJie(d3LoanIdFile,d2File,notWJFileName);
}
@RequestMapping("/newD3ReplaceReqId")
public String newD3ReplaceReqId(String newD3FilePath, String newD3FileNames, String oldD3ReqIdFile, String newD3InFileName, String newD3NotInFileName){
manualToolService.newD3ReplaceReqId(newD3FilePath,newD3FileNames,oldD3ReqIdFile,newD3InFileName,newD3NotInFileName);
return "调用结束";
}
}
......@@ -1812,6 +1812,91 @@ public class ManualToolService implements CommonSuperService {
}
public void newD3ReplaceReqId(String newD3FilePath, String newD3FileNames, String oldD3ReqIdFile, String newD3InFileName, String newD3NotInFileName) {
try{
List<String> oldD3ReqIdFileList = ReadOrWriteTxt.readTxtList(oldD3ReqIdFile);
Map<String,String> oldD3_reqIdMap = new HashMap<>(oldD3ReqIdFileList.size());
String[] tmpArry = null;
for (String reqIdMsg : oldD3ReqIdFileList){
//SP117934268911419343386834|2|2018-07-18T00:00:00|ts:normal|ls:1=bcc7c1b0a39a4c79a8622adc7c735bea
if(reqIdMsg.length()<5){
continue;
}
tmpArry = reqIdMsg.split("[=]");
oldD3_reqIdMap.put(tmpArry[1], tmpArry[0]);
}
log.info("newD3ReplaceReqId listSize: {} , mapSize: {} ", oldD3ReqIdFileList.size(), oldD3_reqIdMap.size());
oldD3ReqIdFileList = null;
String[] all_id3_fileNames = newD3FileNames.split(",");
List<String> d3lineList = null;
RepaymentInfoZhuDai repaymentLoanInfo = null;
for(String fileName : all_id3_fileNames){
if(!newD3FilePath.endsWith("/")){
newD3FilePath = newD3FilePath + "/";
}
d3lineList = ReadOrWriteTxt.readTxtList(newD3FilePath + fileName);
int have = 0, notHave=0, listSize=d3lineList.size();
log.info(fileName+" lineList size:"+d3lineList.size());
for(int i=0;i<d3lineList.size();i++){
try {
String d3JsonStr = d3lineList.get(i);
if(d3JsonStr.length()<30){//#singleLoanRepayInfo
continue;
}
repaymentLoanInfo = new Gson().fromJson(d3JsonStr, new TypeToken<RepaymentInfoZhuDai>(){}.getType());
String key_replace = repaymentLoanInfo.getLoanId()+"|"+repaymentLoanInfo.getTermNo()+"|"+repaymentLoanInfo.getStatusConfirmAt()
+"|ts:"+repaymentLoanInfo.getTermStatus()+"|ls:"+repaymentLoanInfo.getLoanStatus();
if(oldD3_reqIdMap.containsKey(key_replace)){//找到了
have++;
repaymentLoanInfo.setReqID(oldD3_reqIdMap.get(key_replace));
repaymentLoanInfo.setOpCode("M");
//是要删除,D3_035
FileUtils.write(new File(newD3InFileName), JSON.toJSONString(repaymentLoanInfo)+"\r\n", "UTF-8", true);
oldD3_reqIdMap.remove(key_replace);
}else{
notHave++;
FileUtils.write(new File(newD3NotInFileName), JSON.toJSONString(repaymentLoanInfo)+"\r\n", "UTF-8", true);
}
} catch (Exception e) {
log.error(fileName+":筛选替换 error,", e);
}
}
log.info(fileName+":筛选替换 end, listSize: {} , have: {} , notHave: {} , 合计: {} ", listSize,have,notHave,(have+notHave));
d3lineList = null;
repaymentLoanInfo = null;
have=0;notHave=0;listSize=0;
Thread.sleep(1500);
}
if(oldD3_reqIdMap.size()>0){
log.warn("oldD3_reqIdMap IS NOT EMPTY:"+oldD3_reqIdMap.size());
int wr = 0;
for(String key : oldD3_reqIdMap.keySet()){
log.info("oldD3_reqIdMap wr:"+(wr++));
try {
FileUtils.write(new File(newD3FilePath+"oldD3_reqIdMap.txt"), oldD3_reqIdMap.get(key)+"="+oldD3_reqIdMap+"\r\n", "UTF-8", true);
} catch (IOException e) {
log.error("oldD3_reqIdMap 写入 error ", e);
}
}
}
}catch (Exception e){
log.error("newD3ReplaceReqId Error",e);
}
log.info("All newD3ReplaceReqId() end.");
}
public static void main(String[] args) {
......
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