Commit e4b25a58 authored by 郝彦辉's avatar 郝彦辉

接口报送bug

parent eeb3110c
......@@ -143,8 +143,8 @@ public class ManualToolController {
}
@RequestMapping("/d3_saveLog")
public String d3_saveLog(String d3FilePath, String d3JsonFileNames, String reqIdLogName, String no_reqId_start){
manualToolService.d3_saveLog(d3FilePath,d3JsonFileNames,reqIdLogName,no_reqId_start);
public String d3_saveLog(String d3FilePath, String d3JsonFileNames, String reqIdLogName, String no_reqId_start, String isHaveRecordId){
manualToolService.d3_saveLog(d3FilePath,d3JsonFileNames,reqIdLogName,no_reqId_start,isHaveRecordId);
return "d3_saveLog调用结束";
}
......
......@@ -2017,7 +2017,7 @@ public class ManualToolService implements CommonSuperService {
}
@Async
public void d3_saveLog(String d3FilePath, String d3JsonFileNames, String reqIdLogName, String no_reqId_start) {
public void d3_saveLog(String d3FilePath, String d3JsonFileNames, String reqIdLogName, String no_reqId_start, String isHaveRecordId) {
try{
boolean haveReqID = false;
List<String> reqID_Str_List = null;
......@@ -2042,6 +2042,11 @@ public class ManualToolService implements CommonSuperService {
log.info("param haveReqID: {} , reqID_Str_List: {} , reqID_Map: {} ", haveReqID, (reqID_Str_List!=null ? reqID_Str_List.size() : "null"), (reqID_Map!=null ? reqID_Map.size() : "null"));
reqID_Str_List = null;
boolean haveRecordId = false;
if(StringUtils.isNotEmpty(isHaveRecordId) && isHaveRecordId.equals("true")){
haveRecordId = true;
}
int no_reqId = 0;
if(StringUtils.isNotEmpty(no_reqId_start)){
......@@ -2072,8 +2077,11 @@ public class ManualToolService implements CommonSuperService {
}
repaymentLoanInfo = new Gson().fromJson(d3JsonStr, new TypeToken<RepaymentInfoZhuDai>(){}.getType());
repaymentLoanInfo.setRecordId(repaymentLoanInfo.getReqID());
repaymentLoanInfo.setReqID(null);
if(!haveRecordId){
repaymentLoanInfo.setRecordId(repaymentLoanInfo.getReqID());
repaymentLoanInfo.setReqID(null);
}
if(haveReqID && reqID_Map.containsKey(repaymentLoanInfo.getRecordId())){
repaymentLoanInfo.setReqID(reqID_Map.get(repaymentLoanInfo.getRecordId()));
......@@ -2098,7 +2106,7 @@ public class ManualToolService implements CommonSuperService {
log.error("保存还款数据处理异常, fileName: {} , DATA: {} ", fileName, d3lineList.get(i), e);
}
}
log.info(fileName+"<<<<<<保存还款数据记录结束, listSize: {} , saveCount: {} , tmp_not_recordId: {} ", listSize, saveCount);
log.info(fileName+"<<<<<<保存还款数据记录结束, listSize: {} , saveCount: {} , tmp_not_recordId: {} ", listSize, saveCount, tmp_not_recordId);
d3lineList = null;
repaymentLoanInfo = null;
saveCount=0;tmp_not_recordId=0;listSize=0;
......@@ -2340,6 +2348,93 @@ public class ManualToolService implements CommonSuperService {
System.out.println("build_key() D3 end.");
}
private static void newReqId_to_oldReqId22() {
try{
List<String> newReqIdList = ReadOrWriteTxt.readTxtList("D:\\JavaTeam\\test\\compare\\new_key\\in_tmp_D3_reqId.tmp");
Map<String,String> oldD3_reqIdMap = new HashMap<>(newReqIdList.size());
String[] tmpArry = null;
int mcount = 0;
for (String reqIdMsg : newReqIdList){
//oldReqID=5852774,newReqID=c9da322d32944ffa9e1e509f97b17371
if(reqIdMsg.length()<5){
continue;
}
tmpArry = reqIdMsg.split(",");
oldD3_reqIdMap.put(tmpArry[1].split("=")[1], tmpArry[0].split("=")[1]);
mcount++;
}
log.info("newReqId_to_oldReqId listSize: {} , mapSize: {} ", newReqIdList.size(), mcount);
newReqIdList = null;
String reqIdPath = "D:\\JavaTeam\\test\\compare\\new_key\\json\\";
//"in_new_ok_new1_D3.txt","in_new_ok_new2_D3.txt","in_new_ok_new3_D3.txt", "in_new_ok_new4_D3.txt","in_new_ok_new5_D3.txt"
String[] all_reqId_fileNames = {"in_new_ok_new4_D3.txt","in_new_ok_new5_D3.txt"};
manualGC();
List<String> d3lineList = null;
RepaymentInfoZhuDai repaymentLoanInfo = null;
for(String fileName : all_reqId_fileNames){
d3lineList = ReadOrWriteTxt.readTxtList(reqIdPath + 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 {
log.info(fileName+"S:"+i);
if(d3lineList.get(i).length()<30){
continue;
}
repaymentLoanInfo = new Gson().fromJson(d3lineList.get(i), new TypeToken<RepaymentInfoZhuDai>(){}.getType());
if(oldD3_reqIdMap.containsKey(repaymentLoanInfo.getReqID())){//找到了
have++;
repaymentLoanInfo.setRecordId(repaymentLoanInfo.getReqID());
repaymentLoanInfo.setReqID(oldD3_reqIdMap.get(repaymentLoanInfo.getReqID()));
FileUtils.write(new File(reqIdPath + "table_"+fileName),
JSON.toJSONString(repaymentLoanInfo)+"\r\n", "UTF-8", true);
oldD3_reqIdMap.remove(repaymentLoanInfo.getRecordId());
}else{
notHave++;
FileUtils.write(new File(reqIdPath + "no_table_"+fileName),
d3lineList.get(i)+"\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;
manualGC();
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(reqIdPath + "table_reqIdMapnotEmpty.tmp"),
"oldReqID="+oldD3_reqIdMap.get(key)+",newReqID="+key+"\r\n", "UTF-8", true);
} catch (IOException e) {
log.error("oldD3_reqIdMap 写入 error ", e);
}
}
}
}catch (Exception e){
log.error("newD3ReplaceReqId 异常",e);
}
log.info("All newD3ReplaceReqId() end.");
}
public static void main(String[] args) {
// List<String> lineList = ReadOrWriteTxt.readTxtList("D:\\用户目录\\Downloads\\D2_M_01.txt");
......@@ -2400,7 +2495,9 @@ public class ManualToolService implements CommonSuperService {
//newReqId_to_oldReqId();
build_20191225D3();
//build_20191225D3();
newReqId_to_oldReqId22();
}
......
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