wangwei 7 years ago
parent
commit
faccb6f429

+ 5 - 8
examcloud-core-basic-api-provider/src/main/java/cn/com/qmth/examcloud/core/basic/api/controller/StudentFaceInfoController.java

@@ -1,11 +1,7 @@
 package cn.com.qmth.examcloud.core.basic.api.controller;
 
-import io.swagger.annotations.ApiOperation;
-
 import java.util.Date;
 
-import javax.servlet.http.HttpServletRequest;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -20,13 +16,14 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 
+import cn.com.qmth.examcloud.commons.base.exception.StatusException;
 import cn.com.qmth.examcloud.commons.base.util.ErrorMsg;
-import cn.com.qmth.examcloud.commons.web.security.entity.AccessUser;
 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.entity.Student;
 import cn.com.qmth.examcloud.core.basic.dao.entity.StudentFaceInfo;
 import cn.com.qmth.examcloud.core.basic.service.impl.StudentFaceInfoService;
+import io.swagger.annotations.ApiOperation;
 
 /**
  * 学生照片API
@@ -48,18 +45,18 @@ public class StudentFaceInfoController {
 
 	@ApiOperation(value = "按身份证查询", notes = "查询")
 	@GetMapping("/identityNumber")
-	public ResponseEntity findByIdentityNumber(@RequestParam String identityNumber,
+	public StudentFaceInfo findByIdentityNumber(@RequestParam String identityNumber,
 			@RequestParam Long orgId) {
 		Student student = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber, orgId);
 		if (student == null) {
-			return new ResponseEntity(new ErrorMsg("该学生不存在"), HttpStatus.OK);
+			throw new StatusException("B-520110", "该学生不存在");
 		}
 		StudentFaceInfo studentFaceInfo = studentFaceInfoRepo.findByStudentId(student.getId());
 		if (studentFaceInfo == null) {
 			studentFaceInfo = new StudentFaceInfo();
 			studentFaceInfo.setStudent(student);
 		}
-		return new ResponseEntity(studentFaceInfo, HttpStatus.OK);
+		return studentFaceInfo;
 	}
 
 	@ApiOperation(value = "按学号查询", notes = "查询")