Commit 5c60d373 authored by haoyanhui's avatar haoyanhui

方法整理&优化

parent a1f4ac15
...@@ -683,10 +683,10 @@ public class CleanningTransactionLogService { ...@@ -683,10 +683,10 @@ public class CleanningTransactionLogService {
Stopwatch queryStopwatch = Stopwatch.createStarted(); Stopwatch queryStopwatch = Stopwatch.createStarted();
List<TransactionLogPO> transactionLogPOList = riskDatasourceJdbcTemplate.query(TRANSACTION_SQL, new BeanPropertyRowMapper<>(TransactionLogPO.class)); List<TransactionLogPO> transactionLogPOList = riskDatasourceJdbcTemplate.query(TRANSACTION_SQL, new BeanPropertyRowMapper<>(TransactionLogPO.class));
log.info("transactionLog查询数据结束, startTime: {} , endTime: {} , size: {} , 耗时: {} ", startTime, endTime, CollectionUtils.isEmpty(transactionLogPOList) ? 0 : transactionLogPOList.size(), queryStopwatch.stop().elapsed(TimeUnit.MILLISECONDS)); log.info("transactionLog查询数据结束CCFByT, startTime: {} , endTime: {} , size: {} , 耗时: {} ", startTime, endTime, CollectionUtils.isEmpty(transactionLogPOList) ? 0 : transactionLogPOList.size(), queryStopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
if (CollectionUtils.isEmpty(transactionLogPOList)) { if (CollectionUtils.isEmpty(transactionLogPOList)) {
log.info("查询数据为空跳过, startTime: {} , endTime: {} ",startTime, endTime); log.info("查询数据为空跳过CCFByT, startTime: {} , endTime: {} ",startTime, endTime);
continue; continue;
} }
...@@ -703,13 +703,13 @@ public class CleanningTransactionLogService { ...@@ -703,13 +703,13 @@ public class CleanningTransactionLogService {
.append(format).toString(); .append(format).toString();
transactionLogPOMap.put(key, transactionLogPO); transactionLogPOMap.put(key, transactionLogPO);
} }
log.info("transactionLog组装数据完成, startTime: {} , 查询大小: {} , 组装后大小: {} , 耗时: {} ", startTime, transactionLogPOList.size(), transactionLogPOMap.size(), stopwatch.stop().elapsed(TimeUnit.MILLISECONDS)); log.info("transactionLog REMOVE数据完成CCFByT, startTime: {} , 查询大小: {} , 组装后大小: {} , 耗时: {} ", startTime, transactionLogPOList.size(), transactionLogPOMap.size(), stopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
Stopwatch callRStopwatch = Stopwatch.createStarted(); Stopwatch callRStopwatch = Stopwatch.createStarted();
String CALL_SQL = "select transaction_id, uuid, url_type, code, created_at " + String CALL_SQL = "select transaction_id, uuid, url_type, code, created_at " +
" from call_record where created_at >= '" + startTime + "' and created_at < '" + endTime + "' order by created_at desc;"; " from call_record where created_at >= '" + startTime + "' and created_at < '" + endTime + "' order by created_at desc;";
List<CallRecord1> queryResult = tidbRiskJdbcTemplate.query(CALL_SQL, new BeanPropertyRowMapper<>(CallRecord1.class)); List<CallRecord1> queryResult = tidbRiskJdbcTemplate.query(CALL_SQL, new BeanPropertyRowMapper<>(CallRecord1.class));
log.info("callRecord查询数据结束, startTime: {} , endTime: {} , size: {} , 耗时: {} ", startTime, endTime, CollectionUtils.isEmpty(queryResult) ? 0 : queryResult.size(), callRStopwatch.stop().elapsed(TimeUnit.MILLISECONDS)); log.info("callRecord查询数据结束CCFByT, startTime: {} , endTime: {} , size: {} , 耗时: {} ", startTime, endTime, CollectionUtils.isEmpty(queryResult) ? 0 : queryResult.size(), callRStopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
Map<String, CallRecord1> callRecord1Map = new HashMap<>(); Map<String, CallRecord1> callRecord1Map = new HashMap<>();
...@@ -725,7 +725,7 @@ public class CleanningTransactionLogService { ...@@ -725,7 +725,7 @@ public class CleanningTransactionLogService {
.append(format).toString(); .append(format).toString();
callRecord1Map.put(key, callRecord1); callRecord1Map.put(key, callRecord1);
} }
log.info("callRecord组装数据完成, startTime: {} , 查询大小: {} , 组装后大小: {} , 耗时: {} ", startTime, queryResult.size(), callRecord1Map.size(), callStopwatch.stop().elapsed(TimeUnit.MILLISECONDS)); log.info("callRecord组装数据完成CCFByT, startTime: {} , 查询大小: {} , 组装后大小: {} , 耗时: {} ", startTime, queryResult.size(), callRecord1Map.size(), callStopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
Stopwatch delStopwatch = Stopwatch.createStarted(); Stopwatch delStopwatch = Stopwatch.createStarted();
Iterator<Map.Entry<String, TransactionLogPO>> iterator = transactionLogPOMap.entrySet().iterator(); Iterator<Map.Entry<String, TransactionLogPO>> iterator = transactionLogPOMap.entrySet().iterator();
...@@ -737,7 +737,7 @@ public class CleanningTransactionLogService { ...@@ -737,7 +737,7 @@ public class CleanningTransactionLogService {
callRecord1Map.remove(key); callRecord1Map.remove(key);
} }
} }
log.info("去相同据完成, startTime: {} , callRecord1Map大小: {} , transactionLogPOMap大小: {} , 耗时: {} ", startTime, callRecord1Map.size(), transactionLogPOMap.size(), delStopwatch.stop().elapsed(TimeUnit.MILLISECONDS)); log.info("去相同据完成CCFByT, startTime: {} , callRecord1Map大小: {} , transactionLogPOMap大小: {} , 耗时: {} ", startTime, callRecord1Map.size(), transactionLogPOMap.size(), delStopwatch.stop().elapsed(TimeUnit.MILLISECONDS));
} }
String path = "/home/quant_group/baihang-report/logs/transaction_call/"; String path = "/home/quant_group/baihang-report/logs/transaction_call/";
...@@ -752,9 +752,9 @@ public class CleanningTransactionLogService { ...@@ -752,9 +752,9 @@ public class CleanningTransactionLogService {
e.printStackTrace(); e.printStackTrace();
} }
}); });
log.info("写入transaction_log多出的数据结束, startTime: {} , countNum: {} , Map大小: {} , 耗时: {} ",startTime, countNum.get(), transactionLogPOMap.size(), stopwatch1222.stop().elapsed(TimeUnit.MILLISECONDS)); log.info("写入transaction_log多出的数据结束CCFByT, startTime: {} , countNum: {} , Map大小: {} , 耗时: {} ",startTime, countNum.get(), transactionLogPOMap.size(), stopwatch1222.stop().elapsed(TimeUnit.MILLISECONDS));
}else{ }else{
log.info("写入transaction_log多出的数据结束, startTime: {} , transactionLogPOMap size is Empty!",startTime); log.info("写入transaction_log多出的数据结束CCFByT, startTime: {} , transactionLogPOMap size is Empty!",startTime);
} }
if (callRecord1Map.size()>0) { if (callRecord1Map.size()>0) {
...@@ -768,20 +768,20 @@ public class CleanningTransactionLogService { ...@@ -768,20 +768,20 @@ public class CleanningTransactionLogService {
e.printStackTrace(); e.printStackTrace();
} }
}); });
log.info("写入call_record多出的数据结束, startTime: {} , countNum: {} , Map大小: {} , 耗时: {} ",startTime, countNum3.get(), callRecord1Map.size(), stopwatch3.stop().elapsed(TimeUnit.MILLISECONDS)); log.info("写入call_record多出的数据结束CCFByT, startTime: {} , countNum: {} , Map大小: {} , 耗时: {} ",startTime, countNum3.get(), callRecord1Map.size(), stopwatch3.stop().elapsed(TimeUnit.MILLISECONDS));
}else{ }else{
log.info("写入call_record多出的数据结束, startTime: {} , transactionLogPOMap size is Empty!",startTime); log.info("写入call_record多出的数据结束CCFByT, startTime: {} , transactionLogPOMap size is Empty!",startTime);
} }
if(executeOnce){ if(executeOnce){
log.info("比较数据完成, newYnrTime: {} , isExecuteOnce: {} , startTime: {} , endTime: {} ,",newYnrTime, isExecuteOnce, startTime, endTime); log.info("比较数据完成CCFByT, newYnrTime: {} , isExecuteOnce: {} , startTime: {} , endTime: {} ,",newYnrTime, isExecuteOnce, startTime, endTime);
break; break;
} }
} }
log.info("----All比较数据完成----"); log.info("----All比较数据完成CCFByT----");
} catch (Exception e) { } catch (Exception e) {
log.error("比较数据异常", e); log.error("比较数据异常CCFByT", e);
} }
} }
......
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