Commit 6f7f6d42 authored by 郝彦辉's avatar 郝彦辉

手动修复数据工具

parent fb83ec62
...@@ -404,5 +404,15 @@ public class ExZhuDaiBaiHangReSendController { ...@@ -404,5 +404,15 @@ public class ExZhuDaiBaiHangReSendController {
} }
} }
@RequestMapping("/manual/d3_build_ERR_M_05_D3_024")
public String d3_build_ERR_M_05_D3_024(String p3,String secretKey,String filePath){
if(manualToolService.checkSecretKey(p3,secretKey)){
baiHangZhuDaiService.d3_build_ERR_M_05_D3_024(filePath);
return "d3_build_ERR_M_05_D3_024任务调度完成";
}else{
return "d3_build_ERR_M_05_D3_024任务调度失败,参数错误";
}
}
} }
...@@ -2917,6 +2917,124 @@ public class BaiHangZhuDaiService { ...@@ -2917,6 +2917,124 @@ public class BaiHangZhuDaiService {
} }
//2020.06.12 原G_001修复后,1233 [{"errorCode":"D3_024"
@Async
public String d3_build_ERR_M_05_D3_024(String filePath) {
//写入文件的路径和前缀
String writeFilePath = "";
String file_= "";
if(filePath.lastIndexOf("/")!=-1){//linux
writeFilePath = filePath.substring(0,filePath.lastIndexOf("/")) + "/build20200612";
file_ = filePath.substring(filePath.lastIndexOf("/"), filePath.lastIndexOf("."));
}else{//windows
writeFilePath = filePath.substring(0,filePath.lastIndexOf("\\")) + "\\build20200612";
file_ = filePath.substring(filePath.lastIndexOf("\\"), filePath.lastIndexOf("."));
}
long starUtc = System.currentTimeMillis();
String SQL_QUERY_D3_log = " select d3.* from repayment_loan_info_zhudai d3 " +
" join tmp_d3_bh_send_log err on d3.record_id=err.req_id and err.op_code='M' and err.errorCode='G_001' " +
" where d3.created_at > '2020-06-04 21:50:00' and d3.created_at < '2020-06-05 00:00:00' " +
" and d3.op_code='M' " +
" and d3.term_status='normal' " +
" and d3.req_id in (37266878,37270414,37273400,37273547,37274173,37274293,37274854,37274890,37275043,37275532,37275574,37276303,37276414,37276755,37276815,37276872,37276890,37277376,37277565,37277628,37277757,37278027,37278156,37278392,37278542,37278653,37278938,37279040,37279331,37279646,37279697,37280078,37280144,37280264,37280701,37280746,37281106,37281133,37281199,37281253,37281454,37281613,37281625,37282141,37282360,37282627,37282750,37282852,37282864,37282876,37283436,37283535,37283601,37284168,37284195,37284285,37284588,37284678,37284972,37285044,37285155,37285176,37285329,37285524,37285752,37285857,37286181,37286265,37286316,37286490,37286697,37286900,37287212,37287239,37287705,37288086,37288590,37288872,37289199,37289303,37289774,37289840,37290074,37290133,37290172,37290301,37290331,37290604,37290769,37290916,37290928,37291138,37291249,37291516,37291555,37291603,37291690,37292122,37292134,37292296,37292518,37292551,37292881,37292965,37293091,37293791,37293974,37294067,37294307,37294340,37294394,37294571,37294694,37295379,37295583,37295679,37295964,37296084,37296210,37296414,37296507,37296762,37296852,37296924,37297341,37297362,37297494,37297821,37298061,37298151,37298313,37298490,37299327,37299468,37299609,37299699,37299858,37300500,37300542,37300806,37300950,37301115,37301169,37301235,37301337,37302139,37302574,37302994,37303075,37303294,37303306,37303366,37303827,37303998,37304151,37304763,37304922,37305356,37305503,37305617,37305662,37305722,37306193,37306460,37306691,37306742,37306808,37307366,37803233,37863704,37863969,37864005,37864182,37864250,37864301,37864322,37864334,37864346,37864396,37864561,37864591,37864911,37865010,37865031,37865075,37865099,37865226,37865288,37865395,37865629,37865703,37865733,37865754,37865775,37865818,37865845,37865934,37865946,37866025,37866221,37866541,37866592,37866654,37866782,37866948,37866960,37867030,37867093,37867120,37867346,37867481,37867511,37867681,37868019,37868121,37868151,37868184,37868286,37868369,37868389,37868532,37868660,37868779,37868855,37869075,37869280,37869370,37869382,37869738,37869750,37869771,37869804,37869845,37869952,37870421,37870433,37870454,37870573,37870713,37870811,37870892,37870918,37903742,37965121,37965225,37965902,37965974,37966413,37966617,37967104,37967464,37968086,37968460,37968872,37969016,37969205,37969546,37969636,37970266,37970311,37970565,37971075,37971212,37971479,37971506,37971665,37971812,37971973,37972057,37972096,37972254,37972555,37972851,37973337,37974035,37974178,37974263,37974320,37974359,37974653,37974926,37975016,37975181,37975193,37975223,37975283,37975379,37975833,37975869,37976225,37976518,37976569,37976677,37976868,37976880,37977207,37977234,37977692,37977757,37977865,37977961,37978237,37978291,37978797,37978904,37978988,37979153,37979183,37979380,37979401,37979478,37979658,37979747,37980077,37980098,37980786,37980915,37981028,37981448,37981598,37981856,37981889,37982376,37982814,37983620,37983713,37983920,37983959,37984079,37984166,37984262,37984661,37984884,37984978,37985059,37985416,37985545,37985620,37985665,37985782,37985830,37986043,37986070,37986109,37986130,37986151,37986163,37986226,37986308,37986329,38550765,38550777,38551146,38551215,38551416,38551437,38551908,38553030,38553828,38553927,38553948,38554179,38554854,38554959,38555115,38556303,38556345,38557650,38557920,38557974,38557986,38557998,38558481,38558514,38558649,38558970,38559198,38559300,38559768,38559858,38560209,38560710,38560812,38561958,38562039,38562216,38562360,38562468,38563119,38563167,38563491,38564346,38564412,38564502,38564712,38564811,38564931,38565237,38565675,38565693,38566413,38566524,38566857,38567184,38567714,38567753,38567894,38567948,38568038,38568260,38569253,38569376,38569601,38569892,38569904,38570216,38570855,38571212,38571560,38571788,38572103,38572262,38572358,39045948,39051917,39054169,39060354,39060398,39060494,39060524,39060692,39060840,39060870,39061013,39061293,39061368,39061386,39061398,39061613,39061637,39061658,39061739,39061798,39061816,39061935,39061977,39062212,39062241,39062304,39062316,39062328,39062388,39062449,39062545,39062554,39062586,39062637,39062688,39062697,39062706,39062721,39062730,39062748,39062875,39062935,39062971,39063070,39063091,39063588,39063618,39063627,39063661,39063768,39063871,39063933,39063990,39064029,39064077,39064246,39064309,39064351,39064422,39064443,39064563,39064572,39064584,39064722,39064767,39064896,39064905,39064965,39064974,39064983,39065039,39065048,39065162,39065263,39065302,39065347,39065395,39065467,39065654,39065775,39065784,39065913,39066000,39066075,39066162,39066192,39066269,39066308,39066320,39066514,39066718,39066838,39066850,39066901,39066922,39067158,39067250,39067305,39067314,39067323,39067392,39067467,39067488,39067533,39067551,39067596,39067686,39067707,39067728,39067740,39067821,39067848,39067857,39067878,39067996,39068077,39068086,39068456,39068495,39068513,39068531,39068557,39068662,39068971,39068983,39069049,39069079,39069156,39069203,39069257,39069281,39069293,39069344,39069358,39069420,39069432,39069456,39069465,39069495,39069637,39069689,39069742,39069802,39069826,39069837,39069902,39069920,39069944,39069962,39069980,39070022,39070109,39070118,39070130,39070228,39070318,39070327,39070347,39070359,39070377,39070386,39070401,39070410,39070466,39070566,39070585,39070594,39070612,39070642,39070674,39070698,39070710,39070722,39070731,39070740,39070782,39070848,39070857,39070871,39070891,39070900,39070936,39070945,39071035,39071094,39071112,39071127,39071147,39071186,39071207,39071228,39071237,39071263,39071284,39071316,39071396,39071546,39071603,39071612,39071630,39071651,39071675,39071711,39071744,39071753,39071795,39071804,39071822,39071831,39071840,39071852,39071881,39071892,39071910,39071928,39071966,39071978,39072074,39072085,39072130,39072139,39072157,39072263,39072290,39072299,39072310,39072351,39072375,39072384,39072405,39072434,39072479,39072511,39072523,39072546,39072630,39072663,39072672,39072708,39072717,39072810,39072873,39072946,39072985,39073012,39073062,39073074,39073095,39073173,39073236,39073272,39073290,39073302,39073320,39073356,39073377,39073395,39073443,39073485,39073550,39433852,39433879,39433951,39434032,39434476,39435743,39436412,39436499,39437081,39437114,39437417,39437435,39437600,39438059,39439197,39440702,39440816,39441145,39441752,39441899,39442331,39442379,39442460,39443170,39443790,39443823,39444045,39444476,39444485,39444731,39445448,39445762,39864843,39868842,39871875,40981548,40981683,40981716,40981746,40981911,40981920,40981953,40982019,40982025,40982034,40982079,40982637,40983009,40983015,40983162,40983228,40983234,40983288,40983321,40983564,40983789,40983870,40984131,40984290,40984386,40984485,40984512,40984554,40984764,40984950,40984956,40984971,40984992,40984998,40985046,40985055,40985082,40985124,40985229,40985298,40985613,40985829,40985973,40985991,40986048,40986126,40986138,40986318,40986423,40986438,40986969,40987131,40987161,40987314,40987398,40987479,40987509,40987737,40987854,40988055,40988064,40988085,40988178,40988763,40988817,40988943,40988976,40989216,40989336,40989375,40989381,40989729,40989831,40990158,40990329,40990626,40990674,40990695,40990737,40991046,40991151,40991178,40991208,40991220,40991274,40991370,40991586,40991640,40991649,40991736,40991850,40991952,40992054,40992078,40992084,40992126,40992135,40992159,40992282,40992291,40992333,40992342,40992435,40992570,40992636,40992687,40992960,40993083,40993125,40993155,40993230,40993377,40993671,40993689,40993836,40993887,40993944,40994028,40994157,40994199,40994268,40994514,40994523,40994577,40994784,40994805,40994838,40995090,40995141,40995297,40995318,40996083,40996179,40996530,40996590,40996773,40996779,40996893,40997031,40997064,40997403,40997499,40997562,40997793,40997952,40998099,40998459,40998777,40998834,40998873,40998891,40999002,40999161,40999317,40999353,40999368,40999401,40999632,40999812,40999836,40999932,41460088,41460208,41460343,41460349,41460379,41460529,41460724,41460982,41461555,41462023,41462197,41462815,41462872,41463202,41464021,41464429,41465056,41465119,41465125,41465563,41465698,41465989,41466088,41466682,41467204,41467366,41467852,41468374,41468752,41469148,41469313,41469505,41470399,41470729,41471761,41472163,41472433,41473048,41473351,41473417,41473876,41473948,41474221,41474257,41475229,41475292,41475763,41475904,41476147,41476183,41476465,41476579,41477173,41477182,41477749,41477902,41478152,41478218,41478524,41478728,41478827,41479538,41479589,41480599,41480890,41481676,41978185,41978905,41979001,41979106,41979211,41979292,41979331,41979988,41980114,41980843,41982148,41982862,41982958,41983129,41983204,41983222,41983285,41983321,41983414,41983489,41983585,41983615,41983648,41983699,41983735,41983741,41983789,41983795,41983813,41983825,41983892,41983894,41983984,41984122,41984137,41984335,41984434,41984461,41984470,41984488,41984503,41984548,41984554,41984602,41984734,41984809,41984968,41984998,41985004,41985073,41985100,41985106,41985295,41985391,41985478,41985652,41985658,41985673,41985835,41985877,41986021,41986060,41986087,41986144,41986291,41986312,41986324,41986375,41986408,41986477,41986588,41986660,41986723,41986909,41987068,41987143,41987191,41987248,41987308,41987425,41987449,41987608,41987665,41987809,41987818,41987992,41988139,41988178,41988280,41988343,41988550,41988646,41988652,41988811,41988817,41988886,41988937,41989054,41989162,41989168,41989270,41989420,41989555,41989627,41989633,41989723,41989729,41989747,41989771,41989798,41989828,41989843,41989858,41989969,41990083,41990125,41990155,41990215,41990269,41990314,41990377,41990389,41990395,41990452,41990545,41990641,41990668,41990713,41990719,41990749,41990815,41990872,41990923,41990950,41990962,41991007,41991076,41991175,41991595,41991631,41991637,41991676,41991682,41991934,41991970,41992015,41992117,41992210,41992240,41992306,41992405,41992474,41992480,41992519,41992579,41992585,41992603,41992621,41992639,41992663,41992732,41992750,41992864,41993107,41993161,41993284,41993341,41993389,41993473,41993524,41993641,41993815,41993821,41993875,41993893,41993911,41994019,41994043,41994109,41994160,41994175,41994205,41994232,41994295,41994451,41994532,41994538,41994583,41994607,41994622,41994628,41994634,41994655,41994754,41994844,41994850,41994865,41994892,41994997,41995129,41995135,41995189,41995195,41995339,41995345,41995432,41995438,41995665,41995671,41995713,41995827,41995833,41995839,41995857,41996064,41996097,41996199,41996241,41996265,41996310,41996409,41996541,41996559,41996565,41996586,41996673,41996871,41996883,41996988,41997003,41997579,41997600,41997666,41997702,41997708,41997747,41998005,41998569,41998581,41998812,41998836,41998842,41998857,41999136,41999223,41999247,41999307,41999361,41999478,41999637,41999781,42414350,42414467,42414773,42414953,42414959,42415145,42415595,42415973,42416012,42416114,42416351,42416525,42416558,42417404,42417479,42417590,42417794,42417926,42418004,42418034,42418325,42418379,42418544,42418640,42419090,42419252,42419309,42419543,42419621,42419735,42419798,42419918,42420005,42420149,42420179,42420209,42420428); ";
List<RepaymentInfoZhuDai> logBeanList = riskDatasourceJdbcTemplate.query(SQL_QUERY_D3_log, new Object[]{}, new RowMapper<RepaymentInfoZhuDai>() {
@Override
public RepaymentInfoZhuDai mapRow(ResultSet rs, int rowNum) throws SQLException {
RepaymentInfoZhuDai bean = new RepaymentInfoZhuDai();
bean.setRecordId(rs.getString("record_id"));
bean.setReqID(rs.getString("req_id"));
bean.setName(rs.getString("name"));
bean.setPid(rs.getString("pid"));
bean.setMobile(rs.getString("mobile"));
bean.setOpCode(rs.getString("op_code"));
bean.setUploadTs(rs.getString("upload_ts"));
bean.setLoanId(rs.getString("loan_id"));
bean.setTermNo(rs.getInt("term_no"));
bean.setTermStatus(rs.getString("term_status"));
bean.setTargetRepaymentDate(rs.getString("target_repayment_date"));
bean.setRealRepaymentDate(rs.getString("real_repayment_date"));
bean.setPlannedPayment(rs.getBigDecimal("planned_payment"));
bean.setTargetRepayment(rs.getBigDecimal("target_repayment"));
bean.setRealRepayment(rs.getBigDecimal("real_repayment"));
bean.setOverdueAmount(rs.getBigDecimal("overdue_amount"));
bean.setRemainingAmount(rs.getBigDecimal("remaining_amount"));
bean.setOverdueStatus(rs.getString("overdue_status"));
bean.setLoanStatus(rs.getInt("loan_status"));
bean.setStatusConfirmAt(rs.getString("status_confirm_at"));
return bean;
}
});
int fsize = logBeanList.size();
log.info("查询数据库结束err_D3_041, SQL: {} , 大小: {} , 耗时: {} ", filePath, fsize, (System.currentTimeMillis()-starUtc));
//String sql_d3_back_log = " select DISTINCT d3.record_id from repayment_loan_info_zhudai d3 where d3.loan_id=? and d3.term_no=? and d3.status_confirm_at=? and d3.op_code=? ; ";
String sql_d3_max_time = " select MAX(d3.status_confirm_at) as status_confirm_at, MAX(d3.upload_ts) as upload_ts from repayment_loan_info_zhudai d3 " +
"where d3.loan_id=? and d3.loan_status=3 and d3.`enable` >0; ";
for(int i=0; i< fsize; i++){
RepaymentInfoZhuDai repaymentLoanInfo = logBeanList.get(i);
String str_statusConfirmAt = repaymentLoanInfo.getStatusConfirmAt();
LocalDateTime loca_statusConfirmAt = LocalDateTime.parse(str_statusConfirmAt);
//String str_uploadTs = repaymentLoanInfo.getUploadTs();
//LocalDateTime loca_uploadTs = LocalDateTime.parse(str_uploadTs);
try {
List<RepaymentInfoZhuDai> d3_log_maxList = riskDatasourceJdbcTemplate.query(sql_d3_max_time, new Object[]{repaymentLoanInfo.getLoanId()}, new RowMapper<RepaymentInfoZhuDai>() {
@Override
public RepaymentInfoZhuDai mapRow(ResultSet rs, int rowNum) throws SQLException {
RepaymentInfoZhuDai bean = new RepaymentInfoZhuDai();
bean.setStatusConfirmAt(rs.getString("status_confirm_at"));
bean.setUploadTs(rs.getString("upload_ts"));
return bean;
}
});
if(d3_log_maxList!=null && d3_log_maxList.size()==1){
String max_str_statusConfirmAt = d3_log_maxList.get(0).getStatusConfirmAt();
LocalDateTime max_loca_statusConfirmAt = LocalDateTime.parse(max_str_statusConfirmAt);
if (max_loca_statusConfirmAt.compareTo(loca_statusConfirmAt) > 0) {
log.info("ERR_M05_D3_024根据LoanId&3查询status_confirm_at结束, 原sca: {} , maxsca: {} , LoanId: {} , termNo: {} ", str_statusConfirmAt, max_str_statusConfirmAt, repaymentLoanInfo.getLoanId(), repaymentLoanInfo.getTermNo());
repaymentLoanInfo.setStatusConfirmAt(max_str_statusConfirmAt);
repaymentLoanInfo.setUploadTs(max_str_statusConfirmAt);
}else {
log.warn("ERR_M05_D3_024根据LoanId&3查询status_confirm_at不是最大的, LoanId: {} , termNo: {} ", repaymentLoanInfo.getLoanId(), repaymentLoanInfo.getTermNo());
}
/*String max_str_uploadTs = d3_log_maxList.get(0).getUploadTs();
LocalDateTime max_loca_uploadTs = LocalDateTime.parse(max_str_uploadTs);
if (loca_uploadTs.compareTo(max_loca_uploadTs) > 0) {
log.warn("ERR_M05_D3_024根据LoanId&3查询uploadTs结束, 原sca: {} , maxsca: {} , LoanId: {} , termNo: {} ", str_statusConfirmAt, max_str_statusConfirmAt, repaymentLoanInfo.getLoanId(), repaymentLoanInfo.getTermNo());
repaymentLoanInfo.setStatusConfirmAt(max_str_statusConfirmAt);
}*/
}else{
log.warn("ERR_M05_D3_024根据LoanId&3查询status_confirm_at为空或大小大于1, LoanId: {} , termNo: {} ", repaymentLoanInfo.getLoanId(), repaymentLoanInfo.getTermNo());
this.wirteFile(writeFilePath + file_+ "_ERR_M05_D3_024_notFindTime.log", JSON.toJSONString(repaymentLoanInfo)+"\r\n");
continue;
}
}catch (Exception e){
log.error("Err_D3_041根据LoanId查询status_confirm_at异常, 原bean:{} ", JSONObject.toJSONString(repaymentLoanInfo), e);
}
//原始文件
this.wirteFile(writeFilePath + file_+ "_ERR_M05_D3_024_saveLog.txt", JSON.toJSONString(repaymentLoanInfo)+"\r\n");
//要报送的文件
//repaymentLoanInfo.setReqID(repaymentLoanInfo.getRecordId());
repaymentLoanInfo.setRecordId(null);
this.wirteFile(writeFilePath + file_+ "_ERR_M05_D3_024_ok.txt", JSON.toJSONString(repaymentLoanInfo)+"\r\n");
log.info("Err_D3_041处理i"+i);
}
log.info("ERR_M05_D3_024根据处理数据结束<<<");
return "ERR_M05_D3_024根据处理数据结束";
}
private static void check_ok_d3M_json(String filePath) { private static void check_ok_d3M_json(String filePath) {
...@@ -2940,11 +3058,12 @@ public class BaiHangZhuDaiService { ...@@ -2940,11 +3058,12 @@ public class BaiHangZhuDaiService {
continue; continue;
} }
RepaymentInfoZhuDai repaymentLoanInfo = new Gson().fromJson(strJson, new TypeToken<RepaymentInfoZhuDai>(){}.getType()); RepaymentInfoZhuDai repaymentLoanInfo = new Gson().fromJson(strJson, new TypeToken<RepaymentInfoZhuDai>(){}.getType());
if(repaymentLoanInfo.getReqID()==null){ /*if(repaymentLoanInfo.getReqID()==null){
repaymentLoanInfo.setReqID("no_0601D3045_"+i); repaymentLoanInfo.setReqID("no_0601D3045_"+i);
} }*/
repaymentLoanInfo.setRecordId(null);
wirteFile("D:\\用户目录\\Downloads\\d3_045_M_noReqId_saveLog.log", JSON.toJSONString(repaymentLoanInfo)+"\r\n"); wirteFile("D:\\用户目录\\Downloads\\M4_0610_xf_2982_Err_common_M_G_001_null_saveLog.log", JSON.toJSONString(repaymentLoanInfo)+"\r\n");
saveCount++; saveCount++;
log.info("执行:"+i); log.info("执行:"+i);
...@@ -2961,7 +3080,7 @@ public class BaiHangZhuDaiService { ...@@ -2961,7 +3080,7 @@ public class BaiHangZhuDaiService {
public static void main(String[] args) { public static void main(String[] args) {
// d3_build_my("C:\\Users\\Administrator\\Desktop\\百行报送\\0601报送日志\\d3_045_M.json", "C:\\Users\\Administrator\\Desktop\\百行报送\\0601报送日志\\d3_045_M.txt"); // d3_build_my("C:\\Users\\Administrator\\Desktop\\百行报送\\0601报送日志\\d3_045_M.json", "C:\\Users\\Administrator\\Desktop\\百行报送\\0601报送日志\\d3_045_M.txt");
check_ok_d3M_json("D:\\用户目录\\Downloads\\d3_045_M_noReqId_saveLog.txt"); check_ok_d3M_json("C:\\Users\\Administrator\\Desktop\\百行报送\\0601报送日志\\第四次M\\M4_0610_xf_2982_Err_common_M_G_001_null_saveLog.txt");
} }
} }
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