deason 3 年之前
父節點
當前提交
4572be378d

+ 7 - 0
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamFaceLivenessVerifyServiceImpl.java

@@ -1,6 +1,7 @@
 package cn.com.qmth.examcloud.core.oe.student.service.impl;
 
 import cn.com.qmth.examcloud.commons.exception.StatusException;
+import cn.com.qmth.examcloud.commons.util.FileUtil;
 import cn.com.qmth.examcloud.commons.util.PathUtil;
 import cn.com.qmth.examcloud.core.oe.student.base.utils.CommonUtil;
 import cn.com.qmth.examcloud.core.oe.student.base.utils.FileDisposeUtil;
@@ -163,7 +164,9 @@ public class ExamFaceLivenessVerifyServiceImpl implements ExamFaceLivenessVerify
         try {
             httpClient = HttpPoolUtil.getHttpClient();
             HttpPost httpPost = new HttpPost(PropertyHolder.getString("app.faceid.get_token_url"));
+
             File basePhotoFile = getStudentBasePhotoFile(studentId);
+
             MultipartEntityBuilder multipartEntityBuilder = getMultipartEntityBuilder(bizNo, basePhotoFile);
             HttpEntity httpEntity = multipartEntityBuilder.build();
             httpPost.setEntity(httpEntity);
@@ -301,6 +304,10 @@ public class ExamFaceLivenessVerifyServiceImpl implements ExamFaceLivenessVerify
         String photoUrl = studentBean.getPhotoPath();
         String photoName = systemProperties.getDataDir() + "/" + photoUrl.substring(photoUrl.lastIndexOf("/") + 1);
         photoName = PathUtil.getCanonicalPath(photoName);
+
+        // 文件夹不存在时创建
+        FileUtil.makeDirs(systemProperties.getDataDir());
+
         FileDisposeUtil.saveUrlAs(photoUrl, photoName);
         return new File(photoName);
     }