xiaofei 10 kuukautta sitten
vanhempi
commit
f145e41051

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

@@ -44,4 +44,8 @@ public interface ExamStudentService extends IService<ExamStudent> {
     int countByExamIdAndCourseCode(Long examId, String courseCode);
 
     void downloadTemplate(HttpServletResponse response);
+
+    List<String> listByStoreType(Long examId, String courseCode);
+
+    List<ExamStudent> listByExamIdAndCourseCode(Long examId, String courseCode);
 }

+ 29 - 0
paper-library-business/src/main/java/com/qmth/paper/library/business/service/impl/ExamStudentServiceImpl.java

@@ -315,4 +315,33 @@ public class ExamStudentServiceImpl extends ServiceImpl<ExamStudentMapper, ExamS
         }
 
     }
+
+    @Override
+    public List<String> listByStoreType(Long examId, String courseCode) {
+        PaperScanTask paperScanTask = paperScanTaskService.getByExamIdAndCourseCode(examId, courseCode);
+        if (paperScanTask == null) {
+            throw ExceptionResultEnum.ERROR.exception("扫描任务不存在");
+        }
+        List<String> list = new ArrayList<>();
+        List<ExamStudent> examStudentList = this.listByExamIdAndCourseCode(examId, courseCode);
+        if (CollectionUtils.isNotEmpty(examStudentList)) {
+            // 按班级存储
+            if (StoreTypeEnum.CLASS.equals(paperScanTask.getStoreType())) {
+                list = examStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getClassName())).map(ExamStudent::getClassName).distinct().collect(Collectors.toList());
+            }
+            // 按考场存储
+            else if (StoreTypeEnum.ROOM.equals(paperScanTask.getStoreType())) {
+                list = examStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getExamRoom())).map(ExamStudent::getExamRoom).distinct().collect(Collectors.toList());
+            }
+        }
+        return list;
+    }
+
+    @Override
+    public List<ExamStudent> listByExamIdAndCourseCode(Long examId, String courseCode) {
+        QueryWrapper<ExamStudent> queryWrapper = new QueryWrapper<>();
+        queryWrapper.lambda().eq(ExamStudent::getExamId, examId)
+                .eq(ExamStudent::getCourseCode, courseCode);
+        return this.list(queryWrapper);
+    }
 }

+ 1 - 1
paper-library-common/src/main/resources/mapper/BasicFieldMapper.xml

@@ -9,7 +9,7 @@
         <result column="code" property="code" />
         <result column="name" property="name" />
         <result column="enable" property="enable" />
-        <result column="disable" property="disable" />
+        <result column="disabled" property="disabled" />
         <result column="basic_field" property="basicField" />
         <result column="create_id" property="createId" />
         <result column="create_time" property="createTime" />

+ 21 - 1
paper-library/src/main/java/com/qmth/paper/library/api/ClientController.java

@@ -6,6 +6,7 @@ import com.qmth.boot.api.annotation.Aac;
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.paper.library.business.bean.params.ClientLoginParam;
 import com.qmth.paper.library.business.service.ClientService;
+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;
@@ -49,6 +50,8 @@ public class ClientController {
     @Resource
     private BasicBatchNumberService basicBatchNumberService;
     @Resource
+    private ExamStudentService examStudentService;
+    @Resource
     private LibraryCommonService libraryCommonService;
 
     /**
@@ -122,11 +125,28 @@ public class ClientController {
         return ResultUtil.ok(clientService.otherUpload(paperScanTaskId, frontFile, frontMd5, versoFile, versoMd5));
     }
 
+    @ApiOperation(value = "根据学号获取考生信息")
+    @PostMapping("/student/get")
+    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
+    public Result getStudent(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
+                             @ApiParam(value = "课程代码", required = true) @RequestParam String courseCode,
+                             @ApiParam(value = "学号", required = true) @RequestParam String studentCode) {
+        return ResultUtil.ok(examStudentService.getByExamIdAndCourseCodeAndStudentCode(examId, courseCode, studentCode));
+    }
+
+    @ApiOperation(value = "获取考场/班级")
+    @PostMapping("/classroom/get")
+    @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
+    public Result getClassroom(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
+                               @ApiParam(value = "课程代码", required = true) @RequestParam String courseCode) {
+        return ResultUtil.ok(examStudentService.listByStoreType(examId, courseCode));
+    }
+
     @ApiOperation(value = "查询批次号")
     @PostMapping("/batch_no/get")
     @ApiResponses({@ApiResponse(code = 200, message = "查询成功", response = Result.class)})
     public Result getBatchNumber(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
-                              @ApiParam(value = "用户ID", required = true) @RequestParam Long userId) {
+                                 @ApiParam(value = "用户ID", required = true) @RequestParam Long userId) {
         return ResultUtil.ok(basicBatchNumberService.getOrAddByExamIdAndUserId(examId, userId));
     }
 }

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

@@ -4,7 +4,7 @@ CREATE TABLE `basic_field` (
      `code` VARCHAR(45) NOT NULL COMMENT '字段代码',
      `name` VARCHAR(45) NOT NULL COMMENT '字段名称',
      `enable` TINYINT(1) NOT NULL COMMENT '是否选中',
-     `disable` TINYINT(1) NOT NULL COMMENT '是否禁用',
+     `disabled` TINYINT(1) NOT NULL COMMENT '是否禁用',
      `basic_field` TINYINT(1) NOT NULL COMMENT '是否基础字段',
      `create_id` BIGINT(20) NULL,
      `create_time` BIGINT(20) NULL,
@@ -32,8 +32,8 @@ UPDATE `sys_privilege` SET `related` = '32,33' WHERE (`id` = '26');
 
 INSERT INTO `sys_privilege` (`id`, `name`, `url`, `type`, `parent_id`, `sequence`, `property`, `enable`, `default_auth`, `front_display`) VALUES ('567', '查询列表', '/api/admin/basic/filetype/list', 'URL', '560', '4', 'AUTH', '1', '1', '1');
 
-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 ('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');