YuanPan hace 8 años
padre
commit
5303181c09

+ 12 - 2
core-api/src/main/java/cn/com/qmth/examcloud/service/core/api/StudentFaceInfoApi.java

@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiOperation;
 
 import java.util.Date;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
@@ -30,6 +32,8 @@ import cn.com.qmth.examcloud.service.core.service.StudentFaceInfoService;
 @RequestMapping("${app.api.root}/studentFaceInfo")
 public class StudentFaceInfoApi {
 
+    private static final Logger LOG = LoggerFactory.getLogger(StudentFaceInfoApi.class);
+
     @Autowired
     StudentFaceInfoRepo studentFaceInfoRepo;
     @Autowired
@@ -82,8 +86,14 @@ public class StudentFaceInfoApi {
     @ApiOperation(value = "更新学生照片信息", notes = "更新")
     @PutMapping
     public ResponseEntity update(@RequestBody StudentFaceInfo studentFaceInfo) {
-        studentFaceInfo.setUpdateTime(new Date());
-        return new ResponseEntity(studentFaceInfoRepo.save(studentFaceInfo), HttpStatus.OK);
+        StudentFaceInfo studentFaceInfo4Update = studentFaceInfoRepo.findByStudentId(studentFaceInfo.getStudent().getId());
+        LOG.info("根据学生id" + studentFaceInfo.getStudent().getId() + "找到照片信息:" + studentFaceInfo4Update.getId());
+        studentFaceInfo4Update.setUpdateTime(new Date());
+        studentFaceInfo4Update.setPhotoMD5(studentFaceInfo.getPhotoMD5());
+        studentFaceInfo4Update.setFaceToken(studentFaceInfo.getFaceToken());
+        studentFaceInfo4Update.setFaceSetToken(studentFaceInfo.getFaceSetToken());
+
+        return new ResponseEntity(studentFaceInfoRepo.save(studentFaceInfo4Update), HttpStatus.OK);
     }
 
 }