|
@@ -1,8 +1,6 @@
|
|
|
package cn.com.qmth.examcloud.exchange.outer.service.impl;
|
|
|
|
|
|
import java.io.File;
|
|
|
-import java.io.FileInputStream;
|
|
|
-import java.io.InputStream;
|
|
|
import java.net.URI;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -16,7 +14,6 @@ import org.apache.http.client.utils.URIBuilder;
|
|
|
import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
import org.apache.http.impl.client.HttpClients;
|
|
|
import org.apache.http.util.EntityUtils;
|
|
|
-import org.apache.poi.util.IOUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -26,7 +23,6 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.commons.base.exception.ExamCloudRuntimeException;
|
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLog;
|
|
|
import cn.com.qmth.examcloud.commons.base.logging.ExamCloudLogFactory;
|
|
@@ -96,18 +92,8 @@ public class FaceServiceImpl implements FaceService {
|
|
|
env.setFileSuffix(fileSuffix);
|
|
|
env.setRootOrgId(String.valueOf(rootOrgId));
|
|
|
env.setUserId(String.valueOf(id));
|
|
|
- InputStream in = null;
|
|
|
- String photoUrl = null;
|
|
|
- try {
|
|
|
- in = new FileInputStream(file);
|
|
|
- photoUrl = upyunService.writeFile("studentPhoto", env, in);
|
|
|
- } catch (StatusException e) {
|
|
|
- throw e;
|
|
|
- } catch (Exception e) {
|
|
|
- throw new ExamCloudRuntimeException(e);
|
|
|
- } finally {
|
|
|
- IOUtils.closeQuietly(in);
|
|
|
- }
|
|
|
+
|
|
|
+ String photoUrl = upyunService.writeFile("studentPhoto", env, file);
|
|
|
|
|
|
String faceToken = detect(photoUrl);
|
|
|
|