deason 2 years ago
parent
commit
e43e4923ab

+ 8 - 6
examcloud-core-oe-student-starter/src/test/java/cn/com/qmth/examcloud/core/oe/student/test/FaceVerifyTest.java

@@ -32,7 +32,9 @@ public class FaceVerifyTest {
 
     private static final FaceVerifyServiceImpl faceVerifyService;
 
-    private static final String dir = "D:\\home\\captures-0";
+    private static final String dir = "D:\\home\\captures";
+
+    private static final String fileName = "人脸比对-不通过";
 
     static {
         System.setProperty("log.commonLevel", "INFO");
@@ -48,7 +50,7 @@ public class FaceVerifyTest {
 
     // @Test
     public void demo() throws Exception {
-        String excelFile = "C:\\Users\\deason\\Desktop\\比对结果-不通过.xlsx";
+        String excelFile = dir + "/" + fileName + ".xlsx";
         List<String[]> lines = ExcelReader.readSheetBySax(excelFile, 1, 8);
 
         int batchNum = 10;
@@ -84,7 +86,7 @@ public class FaceVerifyTest {
 
         // 修改阈值,重新计算通过率
         // int passNum = 0;
-        // double passScore = 70d;
+        // double passScore = 75d;
         // for (Map.Entry<String, Double> entry : scores.entrySet()) {
         //     // System.out.println(entry.getKey() + " " + entry.getValue());
         //     if (entry.getValue() >= passScore) {
@@ -113,19 +115,19 @@ public class FaceVerifyTest {
                 try {
                     // System.out.println(Thread.currentThread().getName());
 
-                    String photoPath = dir + "/" + studentId + "/" + FileUtil.getFileName(photoUrl);
+                    String photoPath = dir + "/" + fileName + "/" + studentId + "/" + FileUtil.getFileName(photoUrl);
                     File photoFile = new File(photoPath);
                     if (!photoFile.exists()) {
                         FileUtil.saveImageToFile(photoUrl, photoPath);
                     }
 
-                    String capturePhotoPath = dir + "/" + studentId + "/" + FileUtil.getFileName(capturePhotoUrl);
+                    String capturePhotoPath = dir + "/" + fileName + "/" + studentId + "/" + FileUtil.getFileName(capturePhotoUrl);
                     File capturePhotoFile = new File(capturePhotoPath);
                     if (!capturePhotoFile.exists()) {
                         FileUtil.saveImageToFile(capturePhotoUrl, capturePhotoPath);
                     }
 
-                    String resultPath = dir + "/results/" + DigestUtils.md5Hex(studentId + capturePhotoUrl) + ".log";
+                    String resultPath = dir + "/" + fileName + "/results/" + DigestUtils.md5Hex(studentId + capturePhotoUrl) + ".log";
                     File resultFile = new File(resultPath);
                     if (resultFile.exists()) {
                         String x = FileUtil.readFile(resultFile).get(0);