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

接口报送bug

parent 3ec46974
......@@ -159,7 +159,7 @@ public class ExZhuDaiBaiHangReSendController {
@RequestMapping("/manual/buquan/mainLoanInfoSend")
public GlobalResponse mainLoanInfoSend(){
try{
baiHangZhuDaiService.sendHandLoaInfoReportToBaiHang(true,null);
baiHangZhuDaiService.sendHandLoaInfoReportToBaiHang2(true,null);
return GlobalResponse.generate("百行征信助贷模式手动报送D2数据成功");
}catch(Exception e){
log.error("百行征信助贷模式报送放款异常", e);
......
......@@ -481,6 +481,7 @@ public class BaiHangZhuDaiService {
* 创建人: yanhui.Hao <br/>
* 创建时间: 2019.10.29 <br/>
*/
@Deprecated
public void sendHandLoaInfoReportToBaiHang(boolean isReadFile, List<String> paramJsonStr) throws Exception {
Stopwatch sendWatch = Stopwatch.createStarted();
List<String> handLoanInfos = null;
......@@ -577,6 +578,76 @@ public class BaiHangZhuDaiService {
log.info("众信利民助贷模式TO百行手动报送放款记录结束, 大小: {} , 耗时: {} ", handLoanInfos.size(), ((sendWatch.stop().elapsed(TimeUnit.MILLISECONDS)/1000)+".s"));
}
//有账单日列表,和totalTerm
public void sendHandLoaInfoReportToBaiHang2(boolean isReadFile, List<String> paramJsonStr) throws Exception {
Stopwatch sendWatch = Stopwatch.createStarted();
List<String> handLoanInfos = null;
if(isReadFile){
handLoanInfos = FileUtils.readLines(new File(baihangHandD2DataUrl), "utf-8");
}else{
if(paramJsonStr==null || paramJsonStr.size()==0){
log.warn("众信利民助贷模式TO百行手动报送放款数据错误, paramJsonStr is Null , isReadFile: {} ",isReadFile);
return;
}else{
handLoanInfos = paramJsonStr;
}
}
for(int i=0;i<handLoanInfos.size();i++){
LoanInfoZhuDai loanInfozd_tmp = new Gson().fromJson(handLoanInfos.get(i), new TypeToken<LoanInfoZhuDai>(){}.getType());
log.info("众信利民助贷模式TO百行手动报送放款单个数据, {}", JSON.toJSONString(loanInfozd_tmp));
String loanInfoReqId = loanInfozd_tmp.getReqID();
/*List<String> targetRepaymentDayList = loanInfoMapper.findTargetRepaymentDayList(loanInfoReqId);
if(targetRepaymentDayList!=null && targetRepaymentDayList.size()>0){
loanInfozd_tmp.setTargetRepayDateList(String.join(",", targetRepaymentDayList));
//log.info("比较还款总期数&账单日列表totalTerm="+loanInfozd_tmp.getTotalTerm()+",targetRepaymentDayList size="+targetRepaymentDayList.size());
}else{
log.warn("比较还款总期数&账单日列表totalTerm="+loanInfozd_tmp.getTotalTerm()+",targetRepaymentDayList is null.");
}*/
/*String relationID = loanInfozd_tmp.getRelationID();
if(relationID!=null){
if(relationID.length()>36){ //长度[1,36]
//lhp_1911049771615765816566b49a2db1c429
if(relationID.startsWith("lhp_")){
String tmp = relationID.substring(4,relationID.length());
if(tmp.length()>35){
//lhp_1909279744718808613622e008da4c110000
loanInfozd_tmp.setRelationID("H"+tmp.substring(0,35));
}else{
loanInfozd_tmp.setRelationID("L"+tmp);
}
}else{
log.warn("众信利民助贷模式TO百行手动报送-数据不正确, 发现其他类型的relationID并且长度大于36, relationID: {} , loanInfoReqId: {} ", relationID, loanInfoReqId);
//continue;
loanInfozd_tmp.setRelationID("X"+relationID.substring(0,35));
}
}
}*/
try{
loanInfozd_tmp.setRecordId(loanInfozd_tmp.getReqID());
loanInfoDbMapper.saveLoanInfoRecordLog(loanInfozd_tmp);
}catch(Exception e){
log.error("众信利民助贷模式TO百行手动报送-放款申请保存记录失败, loanInfoReqId: {} , JSON: {} ", loanInfoReqId, JSON.toJSONString(loanInfozd_tmp), e);
}
loanInfozd_tmp.setRecordId(null);
String jsonStr = JSONObject.toJSONString(loanInfozd_tmp);
LoanInfoZhuDaiVo loanInfo = JSONObject.parseObject(jsonStr, LoanInfoZhuDaiVo.class);
FinTechAgencyBusinessZhuDai finTechAgencyBusiness = JSONObject.parseObject(jsonStr, FinTechAgencyBusinessZhuDai.class);
loanInfo.setFinTechAgencyBusiness(finTechAgencyBusiness);
loanInfo.setMobile(interfaceUploadClient(loanInfo.getMobile()));
loanInfo.setName(interfaceUploadClient(loanInfo.getName()));
loanInfo.setPid(interfaceUploadClient(loanInfo.getPid()));
String resultStr = iHttpService.postBaiHang(baiHangLoanInfoUrl, getHeader(), JSON.toJSONString(loanInfo));
log.info("众信利民助贷模式TO百行手动报送放款记录 loanInfoReqId: {} , loanId: {} , bean: {} , result: {} ", loanInfoReqId, loanInfo.getLoanId(), JSON.toJSONString(loanInfo), resultStr);
}
log.info("众信利民助贷模式TO百行手动报送放款记录结束, 大小: {} , 耗时: {} ", handLoanInfos.size(), ((sendWatch.stop().elapsed(TimeUnit.MILLISECONDS)/1000)+".s"));
}
/**
* 描述: 手动重新报送-部分还款D3逻辑问题数据 (手动报送D3) <br/>
......
......@@ -2112,6 +2112,194 @@ public class ManualToolService implements CommonSuperService {
}
private static void build_newkey_oldKey() {
try{
manualGC();
String keyPath = "D:\\JavaTeam\\test\\compare\\old_key\\";
String[] all_key_fileNames = {"replace_ok1_D3.txt","replace_ok2_D3.txt","replace_ok3_D3.txt"
,"replace_ok4_D3.txt","replace_ok5_D3.txt","replace_ok6_D3.txt","replace_ok9_D3.txt"};
List<String> oldD3ReqIdKeyList = null;
String[] tmpArry = null;
int allListSize = 0;
Map<String,String> oldD3_reqIdMap = new HashMap<>(759373+608369+665819+630843+617964+294057+83862);
for (String fileName : all_key_fileNames){
oldD3ReqIdKeyList = ReadOrWriteTxt.readTxtList(keyPath + fileName);
allListSize+=oldD3ReqIdKeyList.size();
for (String reqIdMsg : oldD3ReqIdKeyList){
//SP117934268911419343386834|2|2018-07-18T00:00:00|ts:normal|ls:1=bcc7c1b0a39a4c79a8622adc7c735bea
tmpArry = reqIdMsg.split("[=]");
if(tmpArry.length==2){
oldD3_reqIdMap.put(tmpArry[0], tmpArry[1]);
}else{
System.err.println(fileName + "," + reqIdMsg);
continue;
}
}
log.info(fileName+" listSize: {} , mapSize: {} ", oldD3ReqIdKeyList.size(), oldD3_reqIdMap.size());
}
log.info("All 读取结束 listSize: {} , mapSize: {} ", allListSize, oldD3_reqIdMap.size());
manualGC();
String newD3FilePath = "D:\\JavaTeam\\test\\compare\\new_json\\";
// {"ok_new1_D3.txt","ok_new2_D3.txt","ok_new3_D3.txt","ok_new4_D3.txt","ok_new5_D3.txt"};
String[] all_id3_fileNames = {"ok_new5_D3.txt"};
List<String> d3lineList = null;
RepaymentInfoZhuDai repaymentLoanInfo = null;
for(String fileName : all_id3_fileNames){
log.info("THE FILENAME:"+fileName);
d3lineList = ReadOrWriteTxt.readTxtList(newD3FilePath + fileName);
log.info(fileName+" lineList size:"+d3lineList.size());
int have = 0, notHave=0, listSize=d3lineList.size();
for(int i=0;i<d3lineList.size();i++){
System.out.println(fileName+":"+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++;
//是要删除,D3_035
FileUtils.write(new File(newD3FilePath+"in_new_"+fileName),
oldD3_reqIdMap.get(key_replace)+">>"+repaymentLoanInfo.getReqID()+"\r\n", "UTF-8", true);
oldD3_reqIdMap.remove(key_replace);
}else{
notHave++;
FileUtils.write(new File(newD3FilePath+"notIn_new_"+fileName), 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);
manualGC();
}
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 + "mapNotEmpty.txt"), key+"="+oldD3_reqIdMap.get(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.");
}
private static void newReqId_to_oldReqId() {
try{
List<String> newReqIdList = ReadOrWriteTxt.readTxtList("D:\\JavaTeam\\test\\compare\\new_key\\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=12c96907c2b740808847f03a8a156091
if(reqIdMsg.length()<5){
continue;
}
tmpArry = reqIdMsg.split("newReqID=");
oldD3_reqIdMap.put(tmpArry[1], tmpArry[0]);
mcount++;
}
log.info("newReqId_to_oldReqId listSize: {} , mapSize: {} ", newReqIdList.size(), mcount);
newReqIdList = null;
String reqIdPath = "D:\\JavaTeam\\test\\compare\\new_json\\";
String[] all_reqId_fileNames = {"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"};
manualGC();
List<String> d3lineList = null;
RepaymentInfoZhuDai repaymentLoanInfo = null;
String[] arry = 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);
//c9da322d32944ffa9e1e509f97b17371>>12c96907c2b740808847f03a8a156091
//old>>新
arry = d3lineList.get(i).split(">>");
if(arry.length!=2){
log.error(fileName+":"+d3lineList.get(i));
continue;
}
if(oldD3_reqIdMap.containsKey(arry[1])){//找到了
have++;
FileUtils.write(new File("D:\\JavaTeam\\test\\compare\\new_key\\in_tmp_D3_reqId.tmp"),
oldD3_reqIdMap.get(arry[1])+"newReqID="+arry[0]+"\r\n", "UTF-8", true);
oldD3_reqIdMap.remove(arry[1]);
}else{
notHave++;
FileUtils.write(new File("D:\\JavaTeam\\test\\compare\\new_key\\notIn_tmp_D3_reqId.tmp"),
oldD3_reqIdMap.get(arry[1])+"newReqID="+arry[0]+"\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;
arry = 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("D:\\JavaTeam\\test\\compare\\new_key\\reqIdMapnotEmpty.tmp"), key+"="+oldD3_reqIdMap.get(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");
// System.out.println("lineList:"+lineList.size());
......@@ -2165,7 +2353,11 @@ public class ManualToolService implements CommonSuperService {
//d3_logicerror_20191223();
build_key();
//build_key();
//build_newkey_oldKey();
newReqId_to_oldReqId();
}
......
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