Browse Source

1.0.5 update

xiaofei 11 months ago
parent
commit
e24a42bbf8

+ 0 - 5
paper-library-business/src/main/java/com/qmth/paper/library/business/entity/PaperLibraryOther.java

@@ -24,10 +24,6 @@ public class PaperLibraryOther extends BaseEntity implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
-    @ApiModelProperty(value = "主键")
-    @TableId(value = "id", type = IdType.INPUT)
-    private Long id;
-
     @ApiModelProperty(value = "扫描任务Id")
     private Long paperScanTaskId;
 
@@ -75,7 +71,6 @@ public class PaperLibraryOther extends BaseEntity implements Serializable {
     @Override
     public String toString() {
         return "PaperLibraryOther{" +
-                "id=" + id +
                 ", paperScanTaskId=" + paperScanTaskId +
                 ", path=" + path +
                 ", sequence=" + sequence +

+ 1 - 1
paper-library-business/src/main/java/com/qmth/paper/library/business/service/ClientService.java

@@ -16,5 +16,5 @@ public interface ClientService {
 
     boolean pictureUpload(Long paperScanTaskId, String studentCode, Integer x, Integer y, Integer width, Integer height, Integer rotate, MultipartFile frontFile, String frontMd5, MultipartFile versoFile, String versoMd5, Long scanUserId, String batchNo);
 
-    boolean otherUpload(Long paperScanTaskId, MultipartFile frontFile, String frontMd5, MultipartFile versoFile, String versoMd5);
+    boolean otherUpload(Long paperScanTaskId, MultipartFile frontFile, String frontMd5, MultipartFile versoFile, String versoMd5, Long fileTypeId, String classRoomName);
 }

+ 2 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/service/ExamStudentService.java

@@ -48,4 +48,6 @@ public interface ExamStudentService extends IService<ExamStudent> {
     List<String> listByStoreType(Long examId, String courseCode);
 
     List<ExamStudent> listByExamIdAndCourseCode(Long examId, String courseCode);
+
+    ExamStudent saveExamStudentFromClient(ExamStudent examStudent);
 }

+ 1 - 1
paper-library-business/src/main/java/com/qmth/paper/library/business/service/PaperLibraryCommonService.java

@@ -48,7 +48,7 @@ public interface PaperLibraryCommonService {
 
     PathSequenceVo saveLibraryFile(PaperScanTask paperScanTask, ExamStudent examStudent, UploadFileEnum uploadFileEnum, MultipartFile... files);
 
-    PathSequenceVo saveLibraryOtherFile(PaperScanTask paperScanTask, UploadFileEnum uploadFileEnum, MultipartFile... files);
+    PathSequenceVo saveLibraryOtherFile(PaperScanTask paperScanTask, UploadFileEnum uploadFileEnum, String fileNamePrefix, String classRoomName, MultipartFile... files);
 
     File downloadFile(String rootPath, String path, String uploadType, String type) throws FileNotFoundException;
 }

+ 3 - 1
paper-library-business/src/main/java/com/qmth/paper/library/business/service/PaperLibraryOtherService.java

@@ -1,7 +1,7 @@
 package com.qmth.paper.library.business.service;
 
-import com.qmth.paper.library.business.entity.PaperLibraryOther;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.qmth.paper.library.business.entity.PaperLibraryOther;
 
 /**
  * <p>
@@ -14,4 +14,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
 public interface PaperLibraryOtherService extends IService<PaperLibraryOther> {
 
     void removeByPaperScanTaskId(Long paperScanTaskId);
+
+    int getMaxSequence(Long paperScanTaskId, Long fileTypeId);
 }

+ 27 - 17
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/ClientServiceImpl.java

@@ -9,14 +9,12 @@ import com.qmth.paper.library.business.entity.PaperLibraryOther;
 import com.qmth.paper.library.business.entity.PaperScanTask;
 import com.qmth.paper.library.business.service.*;
 import com.qmth.paper.library.common.contant.SystemConstant;
-import com.qmth.paper.library.common.entity.BasicExam;
+import com.qmth.paper.library.common.entity.BasicFileType;
 import com.qmth.paper.library.common.entity.ExamStudent;
 import com.qmth.paper.library.common.entity.SysPrivilege;
 import com.qmth.paper.library.common.enums.ExceptionResultEnum;
-import com.qmth.paper.library.common.enums.StoreTypeEnum;
 import com.qmth.paper.library.common.enums.UploadFileEnum;
 import com.qmth.paper.library.common.service.BasicBatchNumberService;
-import com.qmth.paper.library.common.service.CommonCacheService;
 import com.qmth.paper.library.common.service.SysPrivilegeService;
 import com.qmth.paper.library.common.util.ServletUtil;
 import org.apache.commons.codec.digest.DigestUtils;
@@ -54,6 +52,8 @@ public class ClientServiceImpl implements ClientService {
     private BasicExamService basicExamService;
     @Resource
     private BasicBatchNumberService basicBatchNumberService;
+    @Resource
+    private BasicFileTypeService basicFileTypeService;
 
     @Override
     public PaperScanTask pageScanTask(Long examId, String courseCode) {
@@ -111,16 +111,17 @@ public class ClientServiceImpl implements ClientService {
             // 校验是否存在,不存在创建考生并绑定上
             ExamStudent examStudent = examStudentService.getByExamIdAndCourseCodeAndStudentCode(paperScanTask.getExamId(), paperScanTask.getCourseCode(), recognitionVo.getBindResult());
             if (examStudent == null) {
-                BasicExam basicExam = basicExamService.getById(paperScanTask.getExamId());
-                examStudent = new ExamStudent(schoolId, basicExam.getSemesterId(), basicExam.getId(), paperScanTask.getCourseCode(), paperScanTask.getCourseName(), recognitionVo.getBindResult(), studentCode, true, true);
-                if (StoreTypeEnum.ROOM.equals(paperScanTask.getStoreType())) {
-                    examStudent.setExamRoom(studentCode);
-                }
-                if (StoreTypeEnum.CLASS.equals(paperScanTask.getStoreType())) {
-                    examStudent.setClassName(studentCode);
-                }
-                // 保存考生
-                examStudentService.save(examStudent);
+                throw ExceptionResultEnum.ERROR.exception(String.format("课程[%s(%s)],学号[%s]的学生不存在", paperScanTask.getCourseName(), paperScanTask.getCourseCode(), studentCode));
+//                BasicExam basicExam = basicExamService.getById(paperScanTask.getExamId());
+//                examStudent = new ExamStudent(schoolId, basicExam.getSemesterId(), basicExam.getId(), paperScanTask.getCourseCode(), paperScanTask.getCourseName(), recognitionVo.getBindResult(), studentCode, true, true);
+//                if (StoreTypeEnum.ROOM.equals(paperScanTask.getStoreType())) {
+//                    examStudent.setExamRoom(studentCode);
+//                }
+//                if (StoreTypeEnum.CLASS.equals(paperScanTask.getStoreType())) {
+//                    examStudent.setClassName(studentCode);
+//                }
+//                // 保存考生
+//                examStudentService.save(examStudent);
             }
             paperLibrary.setStudentId(examStudent.getId());
             // 保存图片,生成路径
@@ -158,7 +159,7 @@ public class ClientServiceImpl implements ClientService {
     }
 
     @Override
-    public boolean otherUpload(Long paperScanTaskId, MultipartFile frontFile, String frontMd5, MultipartFile versoFile, String versoMd5) {
+    public boolean otherUpload(Long paperScanTaskId, MultipartFile frontFile, String frontMd5, MultipartFile versoFile, String versoMd5, Long fileTypeId, String classRoomName) {
         Long userId = Long.valueOf(ServletUtil.getRequestHeaderUserId().toString());
         if (Objects.isNull(frontFile) || frontFile.getSize() == 0) {
             throw ExceptionResultEnum.ERROR.exception("frontFile(正面图片)为空");
@@ -180,14 +181,23 @@ public class ClientServiceImpl implements ClientService {
             if (paperScanTask == null) {
                 throw ExceptionResultEnum.ERROR.exception("扫描任务不存在");
             }
-            // 保存图片,生成路径
-            PathSequenceVo pathSequenceVo = paperLibraryCommonService.saveLibraryOtherFile(paperScanTask, UploadFileEnum.IMAGE, frontFile, versoFile);
             PaperLibraryOther paperLibraryOther = new PaperLibraryOther();
             paperLibraryOther.setId(SystemConstant.getDbUuid());
             paperLibraryOther.setPaperScanTaskId(paperScanTaskId);
-            paperLibraryOther.setPath(pathSequenceVo.getPath());
             paperLibraryOther.setCreateId(userId);
             paperLibraryOther.setCreateTime(System.currentTimeMillis());
+
+            BasicFileType basicFileType = basicFileTypeService.getById(fileTypeId);
+            if (basicFileType == null) {
+                throw ExceptionResultEnum.ERROR.exception("文件类型不存在,请重新选择");
+            }
+
+            int maxSequence = paperLibraryOtherService.getMaxSequence(paperScanTaskId, fileTypeId);
+            paperLibraryOther.setSequence(maxSequence);
+            // 保存图片,生成路径
+            PathSequenceVo pathSequenceVo = paperLibraryCommonService.saveLibraryOtherFile(paperScanTask, UploadFileEnum.IMAGE, basicFileType.getName() + maxSequence, classRoomName, frontFile, versoFile);
+            paperLibraryOther.setPath(pathSequenceVo.getPath());
+
             return paperLibraryOtherService.save(paperLibraryOther);
         } catch (Exception e) {
             throw ExceptionResultEnum.ERROR.exception("保存图片失败:" + e.getMessage());

+ 80 - 14
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/ExamStudentServiceImpl.java

@@ -79,36 +79,39 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
     @Override
     public void saveBasicStudent(ExamStudent examStudent) {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        if (StringUtils.isBlank(examStudent.getStudentCode())) {
+            throw ExceptionResultEnum.ERROR.exception("学号必填");
+        }
+        if (StringUtils.isBlank(examStudent.getCourseCode())) {
+            throw ExceptionResultEnum.ERROR.exception("课程代码必填");
+        }
         // 验证
         ExamStudent byStudentCode = this.getByExamIdAndCourseCodeAndStudentCode(examStudent.getExamId(), examStudent.getCourseCode(), examStudent.getStudentCode());
         if (examStudent.getId() == null) {
-            if (StringUtils.isBlank(examStudent.getStudentCode())) {
-                throw ExceptionResultEnum.ERROR.exception("学号必填");
+            if (StringUtils.isBlank(examStudent.getCourseName())) {
+                throw ExceptionResultEnum.ERROR.exception("课程名称必填");
+            }
+            if (byStudentCode != null) {
+                throw ExceptionResultEnum.ERROR.exception(String.format("学号[%s]在课程%s(%s)下已存在", examStudent.getStudentCode(), examStudent.getCourseName(), examStudent.getCourseCode()));
             }
             // 学号去掉空格
             examStudent.setStudentCode(StringUtils.deleteWhitespace(examStudent.getStudentCode()));
             if (StringUtils.isBlank(examStudent.getStudentName())) {
                 throw ExceptionResultEnum.ERROR.exception("姓名必填");
             }
-            if (StringUtils.isBlank(examStudent.getCourseCode())) {
-                throw ExceptionResultEnum.ERROR.exception("课程代码必填");
-            }
             // 课程代码去掉空格
             examStudent.setCourseCode(StringUtils.deleteWhitespace(examStudent.getCourseCode()));
-            if (StringUtils.isBlank(examStudent.getCourseName())) {
-                throw ExceptionResultEnum.ERROR.exception("课程名称必填");
-            }
             // 课程名称去掉空格
             examStudent.setCourseName(StringUtils.deleteWhitespace(examStudent.getCourseName()));
 
             // 校验是否设置了存储方式
             SimpleObject recognitionTypeSimpleObject = commonCacheService.getSysSetting(sysUser.getSchoolId()).get(SysSettingConstant.RECOGNITION_TYPE);
             if (StringUtils.isBlank(recognitionTypeSimpleObject.getValue())) {
-                throw ExceptionResultEnum.ERROR.exception("识别方式未设置");
+                throw ExceptionResultEnum.ERROR.exception("识别方式未设置,请联系管理员设置");
             }
             SimpleObject storeTypeSimpleObject = commonCacheService.getSysSetting(sysUser.getSchoolId()).get(SysSettingConstant.STORE_TYPE);
             if (StringUtils.isBlank(storeTypeSimpleObject.getValue())) {
-                throw ExceptionResultEnum.ERROR.exception("文件存储方式未设置");
+                throw ExceptionResultEnum.ERROR.exception("文件存储方式未设置,请联系管理员设置");
             }
             RecognitionTypeEnum recognitionType = RecognitionTypeEnum.valueOf(recognitionTypeSimpleObject.getValue());
             StoreTypeEnum storeType = StoreTypeEnum.valueOf(storeTypeSimpleObject.getValue());
@@ -118,9 +121,7 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
             if (StoreTypeEnum.CLASS.equals(storeType) && StringUtils.isBlank(examStudent.getClassName())) {
                 throw ExceptionResultEnum.ERROR.exception("班级必填");
             }
-            if (byStudentCode != null) {
-                throw ExceptionResultEnum.ERROR.exception(String.format("学号[%s]在课程%s(%s)下已存在", examStudent.getStudentCode(), examStudent.getCourseName(), examStudent.getCourseCode()));
-            }
+
             examStudent.setId(SystemConstant.getDbUuid());
             examStudent.setSchoolId(sysUser.getSchoolId());
             examStudent.setCreateId(sysUser.getId());
@@ -153,7 +154,6 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
             examStudent.setUpdateTime(System.currentTimeMillis());
             this.updateById(examStudent);
         }
-
     }
 
     @Transactional(rollbackFor = Exception.class)
@@ -344,4 +344,70 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
                 .eq(ExamStudent::getCourseCode, courseCode);
         return this.list(queryWrapper);
     }
+
+    @Override
+    public ExamStudent saveExamStudentFromClient(ExamStudent examStudent) {
+        SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
+        if (StringUtils.isBlank(examStudent.getStudentCode())) {
+            throw ExceptionResultEnum.ERROR.exception("学号必填");
+        }
+        if (StringUtils.isBlank(examStudent.getCourseCode())) {
+            throw ExceptionResultEnum.ERROR.exception("课程代码必填");
+        }
+        // 验证
+        ExamStudent byStudentCode = this.getByExamIdAndCourseCodeAndStudentCode(examStudent.getExamId(), examStudent.getCourseCode(), examStudent.getStudentCode());
+        if (byStudentCode != null) {
+            return byStudentCode;
+        } else {
+            if (StringUtils.isBlank(examStudent.getCourseName())) {
+                throw ExceptionResultEnum.ERROR.exception("课程名称必填");
+            }
+            // 学号去掉空格
+            examStudent.setStudentCode(StringUtils.deleteWhitespace(examStudent.getStudentCode()));
+            if (StringUtils.isBlank(examStudent.getStudentName())) {
+                throw ExceptionResultEnum.ERROR.exception("姓名必填");
+            }
+            // 课程代码去掉空格
+            examStudent.setCourseCode(StringUtils.deleteWhitespace(examStudent.getCourseCode()));
+            // 课程名称去掉空格
+            examStudent.setCourseName(StringUtils.deleteWhitespace(examStudent.getCourseName()));
+
+            // 校验是否设置了存储方式
+            SimpleObject recognitionTypeSimpleObject = commonCacheService.getSysSetting(sysUser.getSchoolId()).get(SysSettingConstant.RECOGNITION_TYPE);
+            if (StringUtils.isBlank(recognitionTypeSimpleObject.getValue())) {
+                throw ExceptionResultEnum.ERROR.exception("识别方式未设置,请联系管理员设置");
+            }
+            SimpleObject storeTypeSimpleObject = commonCacheService.getSysSetting(sysUser.getSchoolId()).get(SysSettingConstant.STORE_TYPE);
+            if (StringUtils.isBlank(storeTypeSimpleObject.getValue())) {
+                throw ExceptionResultEnum.ERROR.exception("文件存储方式未设置,请联系管理员设置");
+            }
+            RecognitionTypeEnum recognitionType = RecognitionTypeEnum.valueOf(recognitionTypeSimpleObject.getValue());
+            StoreTypeEnum storeType = StoreTypeEnum.valueOf(storeTypeSimpleObject.getValue());
+            if (StoreTypeEnum.ROOM.equals(storeType) && StringUtils.isBlank(examStudent.getExamRoom())) {
+                throw ExceptionResultEnum.ERROR.exception("考场必填");
+            }
+            if (StoreTypeEnum.CLASS.equals(storeType) && StringUtils.isBlank(examStudent.getClassName())) {
+                throw ExceptionResultEnum.ERROR.exception("班级必填");
+            }
+
+            examStudent.setId(SystemConstant.getDbUuid());
+            examStudent.setSchoolId(sysUser.getSchoolId());
+            examStudent.setCreateId(sysUser.getId());
+            examStudent.setCreateTime(System.currentTimeMillis());
+
+            // 考场去掉空格
+            examStudent.setExamRoom(StringUtils.isNotBlank(examStudent.getExamRoom()) ? StringUtils.deleteWhitespace(examStudent.getExamRoom()) : null);
+            // 班级去掉空格
+            examStudent.setClassName(StringUtils.isNotBlank(examStudent.getClassName()) ? StringUtils.deleteWhitespace(examStudent.getClassName()) : null);
+            boolean save = this.save(examStudent);
+
+            if (save) {
+                // 保存课程
+                examCourseService.saveStudentCourse(examStudent.getExamId(), examStudent);
+                // 保存任务(存在则更新考生数量)
+                paperScanTaskService.addScanTask(examStudent.getExamId(), recognitionType, storeType, examStudent);
+            }
+            return examStudent;
+        }
+    }
 }

+ 3 - 4
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryCommonServiceImpl.java

@@ -329,22 +329,21 @@ public class PaperLibraryCommonServiceImpl implements PaperLibraryCommonService
     }
 
     @Override
-    public PathSequenceVo saveLibraryOtherFile(PaperScanTask paperScanTask, UploadFileEnum uploadFileEnum, MultipartFile... files) {
+    public PathSequenceVo saveLibraryOtherFile(PaperScanTask paperScanTask, UploadFileEnum uploadFileEnum, String fileNamePrefix, String classRoomName, MultipartFile... files) {
         BasicSchool basicSchool = basicSchoolService.getById(paperScanTask.getSchoolId());
         BasicExam basicExam = basicExamService.getById(paperScanTask.getExamId());
         BasicSemester basicSemester = basicSemesterService.getById(basicExam.getSemesterId());
         String courseNameCode = String.format("%s(%s)", paperScanTask.getCourseName(), paperScanTask.getCourseCode());
-        String rootPath = fileStoreUtil.buildPath(UploadFileEnum.IMAGE, false, basicSchool.getName(), basicSemester.getName(), basicExam.getName(), courseNameCode, "other");
+        String rootPath = fileStoreUtil.buildPath(UploadFileEnum.IMAGE, false, basicSchool.getName(), basicSemester.getName(), basicExam.getName(), courseNameCode, classRoomName, "other");
         // 根目录
         List<FilePathVo> objects = new ArrayList<>();
         try {
             int idx = 1;
-            String prefix = SystemConstant.getNanoId();
             for (MultipartFile file : files) {
                 String fileName = file.getOriginalFilename();
                 String suffix = fileName.substring(fileName.lastIndexOf("."));
                 // 目标文件名
-                String dirName = rootPath + File.separator + prefix + "-" + idx + suffix;
+                String dirName = rootPath + File.separator + fileNamePrefix + "-" + idx + suffix;
                 FilePathVo filePathVo = fileUploadService.uploadFile(file, uploadFileEnum, dirName);
                 objects.add(filePathVo);
                 idx++;

+ 31 - 2
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/PaperLibraryOtherServiceImpl.java

@@ -1,13 +1,17 @@
 package com.qmth.paper.library.business.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.qmth.paper.library.business.entity.PaperLibrary;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.paper.library.business.entity.PaperLibraryOther;
 import com.qmth.paper.library.business.mapper.PaperLibraryOtherMapper;
 import com.qmth.paper.library.business.service.PaperLibraryOtherService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.qmth.paper.library.common.enums.ExceptionResultEnum;
+import com.qmth.paper.library.common.lock.LockService;
+import com.qmth.paper.library.common.lock.LockType;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+
 /**
  * <p>
  * 其它文件库 服务实现类
@@ -19,10 +23,35 @@ import org.springframework.stereotype.Service;
 @Service
 public class PaperLibraryOtherServiceImpl extends ServiceImpl<PaperLibraryOtherMapper, PaperLibraryOther> implements PaperLibraryOtherService {
 
+    @Resource
+    private LockService lockService;
+
     @Override
     public void removeByPaperScanTaskId(Long paperScanTaskId) {
         QueryWrapper<PaperLibraryOther> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(PaperLibraryOther::getPaperScanTaskId, paperScanTaskId);
         this.remove(queryWrapper);
     }
+
+    @Override
+    public int getMaxSequence(Long paperScanTaskId, Long fileTypeId) {
+        try {
+            lockService.waitlock(LockType.GET_OTHER_SEQUENCE, paperScanTaskId, fileTypeId);
+            QueryWrapper<PaperLibraryOther> queryWrapper = new QueryWrapper<>();
+            queryWrapper.lambda().eq(PaperLibraryOther::getPaperScanTaskId, paperScanTaskId)
+                    .eq(PaperLibraryOther::getFileTypeId, fileTypeId)
+                    .orderByDesc(PaperLibraryOther::getSequence)
+                    .last(" limit 1");
+            PaperLibraryOther paperLibraryOther = this.getOne(queryWrapper);
+            if (paperLibraryOther == null || paperLibraryOther.getSequence() == null) {
+                return 1;
+            } else {
+                return paperLibraryOther.getSequence().intValue() + 1;
+            }
+        } catch (Exception e) {
+            throw ExceptionResultEnum.ERROR.exception("获取批次号失败:" + e.getMessage());
+        } finally {
+            lockService.unlock(LockType.GET_OTHER_SEQUENCE, paperScanTaskId, fileTypeId);
+        }
+    }
 }

+ 2 - 1
paper-library-common/src/main/java/com/qmth/paper/library/common/lock/LockType.java

@@ -4,7 +4,8 @@ public enum LockType {
     BIND_PAPER_TASK("绑定图片任务"),
     GET_SEQUENCE("获取图片自增数"),
     GET_ALPHABET("获取批次号前缀"),
-    SCAN_TASK_SEQUENCE("获取任务编号自增数");
+    GET_OTHER_SEQUENCE("获取其它文件批次顺序号"),
+    SCAN_TASK_SEQUENCE("获取任务编号顺序号");
 
     private String name;
 

+ 16 - 2
paper-library/src/main/java/com/qmth/paper/library/api/ClientController.java

@@ -10,6 +10,7 @@ import com.qmth.paper.library.business.service.ExamStudentService;
 import com.qmth.paper.library.common.bean.result.LoginResult;
 import com.qmth.paper.library.common.contant.ApiPrefixConstant;
 import com.qmth.paper.library.common.entity.BasicSchool;
+import com.qmth.paper.library.common.entity.ExamStudent;
 import com.qmth.paper.library.common.entity.SysUser;
 import com.qmth.paper.library.common.enums.AppSourceEnum;
 import com.qmth.paper.library.common.enums.ExceptionResultEnum;
@@ -121,8 +122,10 @@ public class ClientController {
                               @ApiParam(value = "正面图片", required = true) @RequestParam MultipartFile frontFile,
                               @ApiParam(value = "正面图片md5", required = true) @RequestParam String frontMd5,
                               @ApiParam(value = "背面图片", required = true) @RequestParam MultipartFile versoFile,
-                              @ApiParam(value = "背面图片md5", required = true) @RequestParam String versoMd5) {
-        return ResultUtil.ok(clientService.otherUpload(paperScanTaskId, frontFile, frontMd5, versoFile, versoMd5));
+                              @ApiParam(value = "背面图片md5", required = true) @RequestParam String versoMd5,
+                              @ApiParam(value = "文件类型ID", required = true) @RequestParam Long fileTypeId,
+                              @ApiParam(value = "考场/班级的名称", required = true) @RequestParam String classRoomName) {
+        return ResultUtil.ok(clientService.otherUpload(paperScanTaskId, frontFile, frontMd5, versoFile, versoMd5, fileTypeId, classRoomName));
     }
 
     @ApiOperation(value = "根据学号获取考生信息")
@@ -134,6 +137,17 @@ public class ClientController {
         return ResultUtil.ok(examStudentService.getByExamIdAndCourseCodeAndStudentCode(examId, courseCode, studentCode));
     }
 
+    @ApiOperation(value = "保存学生")
+    @PostMapping("/student/save")
+    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
+    public Result saveStudent(@Valid @RequestBody ExamStudent examStudent, BindingResult bindingResult) {
+        if (bindingResult.hasErrors()) {
+            return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
+        }
+        examStudentService.saveExamStudentFromClient(examStudent);
+        return ResultUtil.ok(true, "");
+    }
+
     @ApiOperation(value = "获取考场/班级")
     @PostMapping("/classroom/get")
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})

+ 2 - 1
paper-library/src/main/resources/db-log/xf.sql

@@ -35,7 +35,8 @@ INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('205', '根据学号获取考生信息', '/api/admin/client/student/get', 'URL', '200', '5','AUTH', '1', '1', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('206', '获取考场/班级', '/api/admin/client/classroom/get', 'URL', '200', '6', 'AUTH', '1', '1', '1');
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('207', '获取批次号', '/api/admin/client/batch_no/get', 'URL', '200', '7', 'AUTH', '1', '1', '1');
-UPDATE `sys_privilege` SET `related` = '30,202,203,204,205,206,207,565,567' WHERE (`id` = '200');
+INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('208', '新增学生', '/api/admin/client/student/save', 'URL', '200', '8', 'AUTH', '1', '1', '1');
+UPDATE `sys_privilege` SET `related` = '30,202,203,204,205,206,207,208,565,567' WHERE (`id` = '200');
 
 CREATE TABLE `basic_batch_number` (
         `exam_id` BIGINT(20) NOT NULL COMMENT '考试ID',