|
@@ -1,102 +0,0 @@
|
|
|
-package cn.com.qmth.examcloud.core.basic.api.controller;
|
|
|
-
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.http.HttpStatus;
|
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.PutMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-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.web.support.ControllerSupport;
|
|
|
-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.StudentRepo;
|
|
|
-import cn.com.qmth.examcloud.core.basic.dao.entity.StudentEntity;
|
|
|
-import cn.com.qmth.examcloud.core.basic.dao.entity.StudentFaceEntity;
|
|
|
-import cn.com.qmth.examcloud.core.basic.service.impl.StudentFaceInfoService;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-
|
|
|
-/**
|
|
|
- * 学生照片API
|
|
|
- */
|
|
|
-@Transactional
|
|
|
-@RestController
|
|
|
-@RequestMapping("${$rmp.ctr.basic}/studentFaceInfo")
|
|
|
-public class StudentFaceInfoController extends ControllerSupport {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- StudentFaceInfoRepo studentFaceInfoRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- StudentFaceInfoService studentFaceInfoService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- StudentRepo studentRepo;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- StudentFaceCloudService studentFaceCloudService;
|
|
|
-
|
|
|
- @ApiOperation(value = "按身份证查询", notes = "查询")
|
|
|
- @GetMapping("/identityNumber")
|
|
|
- public StudentFaceEntity findByIdentityNumber(@RequestParam String identityNumber,
|
|
|
- @RequestParam Long orgId) {
|
|
|
- StudentEntity student = studentRepo.findByIdentityNumberAndRootOrgId(identityNumber, orgId);
|
|
|
- if (student == null) {
|
|
|
- throw new StatusException("B-520110", "该学生不存在");
|
|
|
- }
|
|
|
- StudentFaceEntity studentFaceInfo = studentFaceInfoRepo.findByStudentId(student.getId());
|
|
|
-// if (studentFaceInfo == null) {
|
|
|
-// studentFaceInfo = new StudentFaceInfo();
|
|
|
-// studentFaceInfo.setStudent(student);
|
|
|
-// }
|
|
|
- return studentFaceInfo;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "按学号查询", notes = "查询")
|
|
|
- @GetMapping("/studentCode")
|
|
|
- public StudentFaceEntity findByStudentCode(@RequestParam Long orgId,
|
|
|
- @RequestParam String studentCode) {
|
|
|
- StudentEntity student = studentRepo.findByStudentCodeAndRootOrgId(studentCode, orgId);
|
|
|
- if (student == null) {
|
|
|
- throw new StatusException("B-450121", "学生不存在");
|
|
|
- }
|
|
|
- StudentFaceEntity studentFaceInfo = studentFaceInfoRepo.findByStudentId(student.getId());
|
|
|
-// if (studentFaceInfo == null) {
|
|
|
-// studentFaceInfo = new StudentFaceInfo();
|
|
|
-// studentFaceInfo.setStudent(student);
|
|
|
-// }
|
|
|
- return studentFaceInfo;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "按ID查询", notes = "ID查询")
|
|
|
- @GetMapping("/{id}")
|
|
|
- public ResponseEntity getById(@PathVariable Long id) {
|
|
|
- return new ResponseEntity(studentFaceInfoRepo.findOne(id), HttpStatus.OK);
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "新增学生照片信息", notes = "新增")
|
|
|
- @PostMapping
|
|
|
- public Long add(@RequestBody SaveStudentFaceInfoReq req) {
|
|
|
- req.setOperator(getAccessUser().getDisplayName());
|
|
|
- SaveStudentFaceInfoResp resp = studentFaceCloudService.saveStudentFaceInfo(req);
|
|
|
- return resp.getId();
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "更新学生照片信息", notes = "更新")
|
|
|
- @PutMapping
|
|
|
- public Long update(@RequestBody SaveStudentFaceInfoReq req) {
|
|
|
- req.setOperator(getAccessUser().getDisplayName());
|
|
|
- SaveStudentFaceInfoResp resp = studentFaceCloudService.saveStudentFaceInfo(req);
|
|
|
- return resp.getId();
|
|
|
- }
|
|
|
-
|
|
|
-}
|