|
@@ -52,6 +52,7 @@ public class ExportExamCaptureTask implements Task {
|
|
|
|
|
|
for (Long examId : examIds) {
|
|
|
// 按考试ID分批导出
|
|
|
+ System.out.println("\n********************\n");
|
|
|
|
|
|
Long nextMinId = 0L;
|
|
|
while (true) {
|
|
@@ -67,6 +68,8 @@ public class ExportExamCaptureTask implements Task {
|
|
|
|
|
|
allList.addAll(this.queryCaptures(list));
|
|
|
}
|
|
|
+
|
|
|
+ System.out.println("\n********************\n");
|
|
|
}
|
|
|
|
|
|
final String filePath = this.tempDir() + File.separator + "比对结果列表-" + System.currentTimeMillis() + ".xlsx";
|
|
@@ -75,8 +78,8 @@ public class ExportExamCaptureTask implements Task {
|
|
|
log.info("task end...");
|
|
|
}
|
|
|
|
|
|
- private List<ExamCaptureInfo> queryCaptures(List<ExamCaptureInfo> list) {
|
|
|
- Map<Long, ExamCaptureInfo> examRecordDataMaps = list.stream().collect(Collectors.toMap(ExamCaptureInfo::getExamRecordDataId, v -> v, (k, v) -> v));
|
|
|
+ private List<ExamCaptureInfo> queryCaptures(List<ExamCaptureInfo> examRecords) {
|
|
|
+ Map<Long, ExamCaptureInfo> examRecordDataMaps = examRecords.stream().collect(Collectors.toMap(ExamCaptureInfo::getExamRecordDataId, v -> v, (k, v) -> v));
|
|
|
|
|
|
StringBuilder querySql = new StringBuilder()
|
|
|
.append("select exam_record_data_id, face_compare_result, faceliveness_result, file_url, creation_time ")
|
|
@@ -85,14 +88,38 @@ public class ExportExamCaptureTask implements Task {
|
|
|
|
|
|
List<ExamCaptureInfo> captures = jdbcTemplate.query(querySql.toString(), new BeanPropertyRowMapper(ExamCaptureInfo.class));
|
|
|
|
|
|
+ List<ExamCaptureInfo> okCaptures = new ArrayList<>();
|
|
|
for (ExamCaptureInfo capture : captures) {
|
|
|
- ExamCaptureInfo info = examRecordDataMaps.get(capture.getExamRecordDataId());
|
|
|
- capture.setExamStudentId(info.getExamStudentId());
|
|
|
- capture.setPhotoPath(this.fixPhotoUrl(info.getPhotoPath()));
|
|
|
- capture.setFileUrl(this.fixPhotoUrl(capture.getFileUrl()));
|
|
|
+ if (StringUtils.isEmpty(capture.getFaceCompareResult()) || StringUtils.isEmpty(capture.getFacelivenessResult())) {
|
|
|
+ // 过滤空值数据
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
+ ExamCaptureInfo okInfo = new ExamCaptureInfo();
|
|
|
+
|
|
|
+ ExamCaptureInfo examRecord = examRecordDataMaps.get(capture.getExamRecordDataId());
|
|
|
+ okInfo.setExamRecordDataId(capture.getExamRecordDataId());
|
|
|
+ okInfo.setExamStudentId(examRecord.getExamStudentId());
|
|
|
+ okInfo.setPhotoPath(this.fixPhotoUrl(examRecord.getPhotoPath()));
|
|
|
+ okInfo.setFileUrl(this.fixPhotoUrl(capture.getFileUrl()));
|
|
|
+ okInfo.setFaceCompareResult(capture.getFaceCompareResult());
|
|
|
+ okInfo.setFacelivenessResult(capture.getFacelivenessResult());
|
|
|
+
|
|
|
+ okCaptures.add(okInfo);
|
|
|
}
|
|
|
|
|
|
- return captures;
|
|
|
+ // 过滤单条数据
|
|
|
+ /*Map<Long, List<ExamCaptureInfo>> groupCaptures = okCaptures.stream().collect(Collectors.groupingBy(ExamCaptureInfo::getExamStudentId));
|
|
|
+ List<ExamCaptureInfo> finalCaptures = new ArrayList<>();
|
|
|
+ for (Map.Entry<Long, List<ExamCaptureInfo>> entry : groupCaptures.entrySet()) {
|
|
|
+ if (entry.getValue().size() > 1) {
|
|
|
+ finalCaptures.addAll(entry.getValue());
|
|
|
+ }
|
|
|
+ }*/
|
|
|
+
|
|
|
+ log.info(String.format("curExamRecordDataSize = %s, curCaptureSize = %s, okCaptures = %s, finalCaptures = %s",
|
|
|
+ examRecords.size(), captures.size(), okCaptures.size(), okCaptures.size()));
|
|
|
+ return okCaptures;
|
|
|
}
|
|
|
|
|
|
private String fixPhotoUrl(String url) {
|
|
@@ -122,7 +149,7 @@ public class ExportExamCaptureTask implements Task {
|
|
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
|
|
- @Excel(name = "examRecordDataId", orderNum = "0", width = 20)
|
|
|
+ // @Excel(name = "examRecordDataId", orderNum = "0", width = 20)
|
|
|
private Long examRecordDataId;
|
|
|
|
|
|
@Excel(name = "examStudentId", orderNum = "0", width = 20)
|