in src/main/java/com/datacompare/service/CompareService.java [187:222]
private void summary(String executedTableName, StringBuilder data, String executionStartedAt, long rowNo,
List<String> columnList, CompareResult dto, AppProperties appProperties) {
String result = (dto.getResult() != null) ? dto.getResult() : "NA";
String timeTaken = new DateUtil().timeDiffFormatted(dto.getTimeTaken());
timeTaken = (timeTaken != null) ? timeTaken : "";
long sourceTableCount = dto.getRowCountSource();
long targetTableCount = dto.getRowCountTarget();
long matchedRows = 0;
long missingRows = dto.getSourceFailedRowCount();
long unmatchedRows = dto.getValueMismatchCount();
long invalidRows = dto.getTargetFailedRowCount();
String reason = null;
if("Detail".equals(appProperties.getReportType())) {
matchedRows = sourceTableCount - unmatchedRows - missingRows;
reason = (dto.getReason() != null) ? dto.getReason()
: ((sourceTableCount == matchedRows && sourceTableCount > 0 && !"Failed".equals(dto.getResult()))
? "Data Matched" : "");
dto.setReason(reason);
dto.setMatchedRowCount(matchedRows);
} else if("Basic".equals(appProperties.getReportType())) {
reason = (dto.getReason() != null) ? dto.getReason()
: ((sourceTableCount == targetTableCount) ? "Counts Matched" : "Counts Mismatch");
dto.setReason(reason);
}
logSummary(dto, appProperties.getReportType());
prepareSummaryReport(data, appProperties, columnList, dto, rowNo, sourceTableCount, targetTableCount,
matchedRows, missingRows, unmatchedRows, invalidRows, executedTableName, result, reason, timeTaken,
executionStartedAt);
}