|
@@ -1,7 +1,5 @@
|
|
package cn.com.qmth.examcloud.core.basic.api.controller;
|
|
package cn.com.qmth.examcloud.core.basic.api.controller;
|
|
|
|
|
|
-import java.util.Date;
|
|
|
|
-
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -18,6 +16,9 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
import cn.com.qmth.examcloud.commons.base.util.ErrorMsg;
|
|
import cn.com.qmth.examcloud.commons.base.util.ErrorMsg;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.StudentFaceCloudService;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.request.SaveStudentFaceInfoReq;
|
|
|
|
+import cn.com.qmth.examcloud.core.basic.api.response.SaveStudentFaceInfoResp;
|
|
import cn.com.qmth.examcloud.core.basic.dao.StudentFaceInfoRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.StudentFaceInfoRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.StudentRepo;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Student;
|
|
import cn.com.qmth.examcloud.core.basic.dao.entity.Student;
|
|
@@ -43,6 +44,9 @@ public class StudentFaceInfoController {
|
|
@Autowired
|
|
@Autowired
|
|
StudentRepo studentRepo;
|
|
StudentRepo studentRepo;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ StudentFaceCloudService studentFaceCloudService;
|
|
|
|
+
|
|
@ApiOperation(value = "按身份证查询", notes = "查询")
|
|
@ApiOperation(value = "按身份证查询", notes = "查询")
|
|
@GetMapping("/identityNumber")
|
|
@GetMapping("/identityNumber")
|
|
public StudentFaceInfo findByIdentityNumber(@RequestParam String identityNumber,
|
|
public StudentFaceInfo findByIdentityNumber(@RequestParam String identityNumber,
|
|
@@ -83,30 +87,16 @@ public class StudentFaceInfoController {
|
|
|
|
|
|
@ApiOperation(value = "新增学生照片信息", notes = "新增")
|
|
@ApiOperation(value = "新增学生照片信息", notes = "新增")
|
|
@PostMapping
|
|
@PostMapping
|
|
- public StudentFaceInfo add(@RequestBody StudentFaceInfo studentFaceInfo) {
|
|
|
|
- StudentFaceInfo saved = studentFaceInfoService.save(studentFaceInfo);
|
|
|
|
- return saved;
|
|
|
|
|
|
+ public Long add(@RequestBody SaveStudentFaceInfoReq req) {
|
|
|
|
+ SaveStudentFaceInfoResp resp = studentFaceCloudService.saveStudentFaceInfo(req);
|
|
|
|
+ return resp.getId();
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更新学生照片信息", notes = "更新")
|
|
@ApiOperation(value = "更新学生照片信息", notes = "更新")
|
|
@PutMapping
|
|
@PutMapping
|
|
- public ResponseEntity update(@RequestBody StudentFaceInfo studentFaceInfo) {
|
|
|
|
- StudentFaceInfo studentFaceInfo4Update = studentFaceInfoRepo
|
|
|
|
- .findByStudentId(studentFaceInfo.getStudent().getId());
|
|
|
|
- LOG.info("根据学生id" + studentFaceInfo.getStudent().getId() + "找到照片信息:"
|
|
|
|
- + studentFaceInfo4Update.getId());
|
|
|
|
- studentFaceInfo4Update.setUpdateTime(new Date());
|
|
|
|
- studentFaceInfo4Update.setUpdateUser(studentFaceInfo.getUpdateUser());
|
|
|
|
- studentFaceInfo4Update.setCreateType(studentFaceInfo.getCreateType());
|
|
|
|
- studentFaceInfo4Update.setPhotoMD5(studentFaceInfo.getPhotoMD5());
|
|
|
|
- studentFaceInfo4Update.setFaceToken(studentFaceInfo.getFaceToken());
|
|
|
|
- studentFaceInfo4Update.setFaceSetToken(studentFaceInfo.getFaceSetToken());
|
|
|
|
- Student student = studentRepo.findOne(studentFaceInfo.getStudent().getId());
|
|
|
|
- if (student != null) {
|
|
|
|
- student.setPhotoPath(student.getIdentityNumber() + "/" + studentFaceInfo.getPhotoMD5());
|
|
|
|
- studentRepo.save(student);
|
|
|
|
- }
|
|
|
|
- return new ResponseEntity(studentFaceInfoRepo.save(studentFaceInfo4Update), HttpStatus.OK);
|
|
|
|
|
|
+ public Long update(@RequestBody SaveStudentFaceInfoReq req) {
|
|
|
|
+ SaveStudentFaceInfoResp resp = studentFaceCloudService.saveStudentFaceInfo(req);
|
|
|
|
+ return resp.getId();
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|