Browse Source

add. 卷型检查

caozixuan 8 months ago
parent
commit
cc6594cd31

+ 6 - 1
distributed-print-business/src/main/resources/db/log/czx.sql

@@ -65,4 +65,9 @@ UPDATE mark_student
 SET 
     paper_type_check_status = 'NORMAL'
 WHERE
-    paper_type_check_status = '';
+    paper_type_check_status = '';
+    
+INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3073', '卷型检查任务-状态数量', '/api/scan/student/paper_type_check/status/count', 'URL', '970', '41', 'AUTH', '1', '1', '1');
+INSERT INTO sys_privilege (id, name, url, type, parent_id, sequence, property, enable, default_auth, front_display) VALUES ('3074', '卷型检查任务-任务确认', '/api/scan/student/paper_type_check/confirm', 'URL', '970', '42', 'AUTH', '1', '1', '1');
+UPDATE sys_privilege SET related = '971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,1007,1009,1010,1148,3072,3073,3074' WHERE (id = '970');
+UPDATE sys_privilege SET related = '971,972,973,974,975,976,977,978,979,980,981,982,983,984,985,986,987,988,989,990,991,992,993,994,995,996,997,998,999,1000,1001,1002,1003,1004,1005,1007,1009,1010,1148,3072,3073,3074' WHERE (id = '1006');

+ 27 - 18
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/ScanStudentController.java

@@ -4,22 +4,20 @@ import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
 import com.qmth.teachcloud.common.enums.ScanStatus;
-import com.qmth.teachcloud.common.enums.mark.MarkPaperStatus;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.mark.bean.UpdateTimeVo;
 import com.qmth.teachcloud.mark.bean.student.AbsentManualUpdateVo;
 import com.qmth.teachcloud.mark.bean.student.StudentQuery;
-import com.qmth.teachcloud.mark.entity.MarkPaper;
 import com.qmth.teachcloud.mark.entity.MarkStudent;
 import com.qmth.teachcloud.mark.service.MarkStudentService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
 /**
@@ -34,7 +32,8 @@ import javax.servlet.http.HttpServletResponse;
 @RestController
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_SCAN + "/student")
 public class ScanStudentController extends BaseController {
-    @Autowired
+
+    @Resource
     private MarkStudentService markStudentService;
 
     @ApiOperation(value = "考生查询")
@@ -46,18 +45,16 @@ public class ScanStudentController extends BaseController {
     @ApiOperation(value = "更新缺考状态")
     @PostMapping("absent/update")
     public AbsentManualUpdateVo absentManualUpdate(@ApiParam(name = "考试ID", required = true) @RequestParam Long examId,
-                                                   @ApiParam(name = "课程试卷号", required = true) @RequestParam String coursePaperId,
-                                                   @ApiParam(name = "学号", required = true) @RequestParam String studentCode,
-                                                   @ApiParam(name = "状态", required = true) @RequestParam ScanStatus status) {
+            @ApiParam(name = "课程试卷号", required = true) @RequestParam String coursePaperId, @ApiParam(name = "学号", required = true) @RequestParam String studentCode,
+            @ApiParam(name = "状态", required = true) @RequestParam ScanStatus status) {
         validMarkPaperForScan(examId, coursePaperId);
         return markStudentService.absentManualUpdate(examId, coursePaperId, studentCode, status);
     }
+
     @ApiOperation(value = "更新漏扫状态")
     @PostMapping("missScan/update")
-    public Result missScanUpdate(@ApiParam(name = "考试ID", required = true) @RequestParam Long examId,
-                                                   @ApiParam(name = "课程试卷号", required = true) @RequestParam String coursePaperId,
-                                                   @ApiParam(name = "学号", required = true) @RequestParam String studentCode,
-                                                   @ApiParam(name = "状态", required = true) @RequestParam Boolean missScan) {
+    public Result missScanUpdate(@ApiParam(name = "考试ID", required = true) @RequestParam Long examId, @ApiParam(name = "课程试卷号", required = true) @RequestParam String coursePaperId,
+            @ApiParam(name = "学号", required = true) @RequestParam String studentCode, @ApiParam(name = "状态", required = true) @RequestParam Boolean missScan) {
         validMarkPaperForScan(examId, coursePaperId);
         return ResultUtil.success(markStudentService.missScanUpdate(examId, coursePaperId, studentCode, missScan));
     }
@@ -75,9 +72,8 @@ public class ScanStudentController extends BaseController {
 
     @ApiOperation(value = "识别缺考-任务确认")
     @PostMapping("confirm")
-    public UpdateTimeVo confirm(@RequestParam Long examId, @RequestParam String coursePaperId,
-                                @RequestParam String studentCode,
-                                @RequestParam(required = false) Boolean omrAbsent) {
+    public UpdateTimeVo confirm(@RequestParam Long examId, @RequestParam String coursePaperId, @RequestParam String studentCode,
+            @RequestParam(required = false) Boolean omrAbsent) {
         validMarkPaperForScan(examId, coursePaperId);
         return markStudentService.confirm(examId, coursePaperId, studentCode, omrAbsent);
     }
@@ -87,10 +83,23 @@ public class ScanStudentController extends BaseController {
      */
     @ApiOperation(value = "未扫描-导出")
     @RequestMapping(value = "/unexist/export", method = RequestMethod.POST)
-    public void exportUnexist(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
-                              @ApiParam(value = "课程ID") @RequestParam(required = false) Long courseId,
-                              @ApiParam(value = "试卷编号") @RequestParam(required = false) String coursePaperId,
-                              HttpServletResponse response) {
+    public void exportUnexist(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId, @ApiParam(value = "课程ID") @RequestParam(required = false) Long courseId,
+            @ApiParam(value = "试卷编号") @RequestParam(required = false) String coursePaperId, HttpServletResponse response) {
         markStudentService.exportUnexist(examId, courseId, coursePaperId, response);
     }
+
+    @ApiOperation(value = "卷型检查任务-状态数量")
+    @RequestMapping(value = "/paper_type_check/status/count", method = RequestMethod.POST)
+    public Result paperTypeCheckStatusCount(@ApiParam(value = "考试ID", required = true) @RequestParam Long examId,
+            @ApiParam(value = "课程ID") @RequestParam(required = false) Long courseId,
+            @ApiParam(value = "课程试卷编号") @RequestParam(required = false) String coursePaperId) {
+        return ResultUtil.ok(markStudentService.getStatus(examId, courseId, coursePaperId));
+    }
+
+    @ApiOperation(value = "卷型检查任务-任务确认")
+    @PostMapping("/paper_type_check/confirm")
+    public Result paperTypeCheckConfirm(@ApiParam(name = "考生id", required = true) @RequestParam Long studentId,
+            @ApiParam(name = "卷型", required = true) @RequestParam String paperType) {
+        return ResultUtil.ok(markStudentService.disposePaperTypeCheck(studentId, paperType));
+    }
 }

+ 4 - 3
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/answerbatch/AnswerPage.java

@@ -2,6 +2,7 @@ package com.qmth.teachcloud.mark.bean.answerbatch;
 
 import com.qmth.teachcloud.mark.bean.ArrayResult;
 import com.qmth.teachcloud.mark.bean.BoolResult;
+import com.qmth.teachcloud.mark.bean.StringResult;
 import io.swagger.annotations.ApiModelProperty;
 
 import javax.validation.constraints.Min;
@@ -26,7 +27,7 @@ public class AnswerPage {
     private String recogData;
 
     @ApiModelProperty(value = "卷型(没有识别到为'#',多识别为'AB')")
-    private String paperType;
+    private StringResult paperType;
 
     public Integer getIndex() {
         return index;
@@ -76,11 +77,11 @@ public class AnswerPage {
         this.recogData = recogData;
     }
 
-    public String getPaperType() {
+    public StringResult getPaperType() {
         return paperType;
     }
 
-    public void setPaperType(String paperType) {
+    public void setPaperType(StringResult paperType) {
         this.paperType = paperType;
     }
 }

+ 35 - 3
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/scananswer/AnswerPageVo.java

@@ -1,57 +1,89 @@
 package com.qmth.teachcloud.mark.bean.scananswer;
 
+import io.swagger.annotations.ApiModelProperty;
+
 import java.util.List;
 
 public class AnswerPageVo {
+
 	private Integer index;
-    private String sheetUri;
-    private List<String> sliceUri;
+
+	private String sheetUri;
+
+	private List<String> sliceUri;
+
 	private Boolean absent;
+
 	private Boolean breach;
+
 	private List<String> question;
+
 	private String recogData;
+
+	@ApiModelProperty("识别卷型")
+	private String paperType;
+
 	public Integer getIndex() {
 		return index;
 	}
+
 	public void setIndex(Integer index) {
 		this.index = index;
 	}
+
 	public Boolean getAbsent() {
 		return absent;
 	}
+
 	public void setAbsent(Boolean absent) {
 		this.absent = absent;
 	}
+
 	public Boolean getBreach() {
 		return breach;
 	}
+
 	public void setBreach(Boolean breach) {
 		this.breach = breach;
 	}
+
 	public List<String> getQuestion() {
 		return question;
 	}
+
 	public void setQuestion(List<String> question) {
 		this.question = question;
 	}
+
 	public String getSheetUri() {
 		return sheetUri;
 	}
+
 	public void setSheetUri(String sheetUri) {
 		this.sheetUri = sheetUri;
 	}
+
 	public List<String> getSliceUri() {
 		return sliceUri;
 	}
+
 	public void setSliceUri(List<String> sliceUri) {
 		this.sliceUri = sliceUri;
 	}
+
 	public String getRecogData() {
 		return recogData;
 	}
+
 	public void setRecogData(String recogData) {
 		this.recogData = recogData;
 	}
 
-	
+	public String getPaperType() {
+		return paperType;
+	}
+
+	public void setPaperType(String paperType) {
+		this.paperType = paperType;
+	}
 }

+ 11 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/scananswer/AnswerQueryVo.java

@@ -4,6 +4,7 @@ import java.util.List;
 
 import com.qmth.teachcloud.common.enums.ScanStatus;
 import com.qmth.teachcloud.mark.enums.ExamStatus;
+import io.swagger.annotations.ApiModelProperty;
 
 public class AnswerQueryVo {
 
@@ -50,6 +51,8 @@ public class AnswerQueryVo {
 	
 	private Integer cardPaperCount;
     private Boolean isAbsent;
+	@ApiModelProperty("识别卷型")
+	private String paperType;
 
 	private List<AnswerPaperVo> papers;
 
@@ -260,4 +263,12 @@ public class AnswerQueryVo {
 	public void setInvalid(Boolean invalid) {
 		this.invalid = invalid;
 	}
+
+	public String getPaperType() {
+		return paperType;
+	}
+
+	public void setPaperType(String paperType) {
+		this.paperType = paperType;
+	}
 }

+ 5 - 3
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/entity/ScanPaperPage.java

@@ -8,6 +8,7 @@ import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
 import com.qmth.teachcloud.mark.bean.ArrayResult;
 import com.qmth.teachcloud.mark.bean.BoolResult;
+import com.qmth.teachcloud.mark.bean.StringResult;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.collections4.CollectionUtils;
@@ -41,7 +42,8 @@ public class ScanPaperPage implements Serializable {
 	private BoolResult breach;
 
 	@ApiModelProperty("识别卷型")
-	private String paperType;
+	@TableField(value = "paper_type", typeHandler = JacksonTypeHandler.class)
+	private StringResult paperType;
 
 	@TableField(value = "question", typeHandler = JacksonTypeHandler.class)
 	private ArrayResult question;
@@ -95,11 +97,11 @@ public class ScanPaperPage implements Serializable {
 		this.breach = breach;
 	}
 
-	public String getPaperType() {
+	public StringResult getPaperType() {
 		return paperType;
 	}
 
-	public void setPaperType(String paperType) {
+	public void setPaperType(StringResult paperType) {
 		this.paperType = paperType;
 	}
 

+ 9 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/MarkStudentService.java

@@ -242,4 +242,13 @@ public interface MarkStudentService extends IService<MarkStudent> {
      * @return 已办和待办数量
      */
     ScanOmrTaskStatusDto getStatus(Long examId, Long courseId, String coursePaperId);
+
+    /**
+     * 处理卷型检查
+     *
+     * @param studentId 考生id
+     * @param paperType 试卷类型
+     * @return 更新时间
+     */
+    UpdateTimeVo disposePaperTypeCheck(Long studentId, String paperType);
 }

+ 19 - 1
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -34,6 +34,7 @@ import com.qmth.teachcloud.common.service.BasicRoleDataPermissionService;
 import com.qmth.teachcloud.common.service.FileUploadService;
 import com.qmth.teachcloud.common.service.TeachcloudCommonService;
 import com.qmth.teachcloud.common.util.*;
+import com.qmth.teachcloud.mark.bean.StringResult;
 import com.qmth.teachcloud.mark.bean.UpdateTimeVo;
 import com.qmth.teachcloud.mark.bean.archivescore.*;
 import com.qmth.teachcloud.mark.bean.omredit.OmrEditDomain;
@@ -572,11 +573,17 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
 
                 PaperTypeCheckStatus paperTypeCheckStatus = PaperTypeCheckStatus.NORMAL;
                 // 根据卷型识别结果更新考生卷型,如果卷型识别结果异常则添加到卷型检查中
-                String paperType = page.getPaperType();
+                StringResult paperTypeResult = page.getPaperType();
+                String paperType;
                 if (!openAb) {
                     // 不开启卷型默认A卷 正常
                     paperType = "A";
                 } else {
+                    if (Objects.isNull(paperTypeResult)){
+                        // 卷型为空 (正常不会出现这种情况)
+                        throw ExceptionResultEnum.ERROR.exception("开启卷型的试卷未检测到识别的卷型");
+                    }
+                    paperType = paperTypeResult.getResult();
                     if (!SystemConstant.strNotNull(paperType)) {
                         // 卷型为空 (正常不会出现这种情况)
                         throw ExceptionResultEnum.ERROR.exception("开启卷型的试卷未检测到识别的卷型");
@@ -992,6 +999,7 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
                             pageVo.setBreach(p.getBreach() != null ? p.getBreach().getResult() : null);
                             pageVo.setQuestion(p.getQuestion() != null ? p.getQuestion().getResult() : null);
                             pageVo.setRecogData(p.getRecogData());
+                            pageVo.setPaperType(p.getPaperType() != null ? p.getPaperType().getResult() : null);
                         }
                         pages.add(pageVo);
                     }
@@ -2202,4 +2210,14 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         result.setFinishCount(finishCount);
         return result;
     }
+
+    @Transactional
+    @Override
+    public UpdateTimeVo disposePaperTypeCheck(Long studentId, String paperType) {
+        UpdateWrapper<MarkStudent> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().eq(MarkStudent::getId, studentId).set(MarkStudent::getPaperType, paperType)
+                .set(MarkStudent::getPaperTypeCheckStatus, PaperTypeCheckStatus.PROCESSED);
+        this.update(updateWrapper);
+        return UpdateTimeVo.create();
+    }
 }

+ 8 - 1
teachcloud-mark/src/main/resources/mapper/MarkStudentMapper.xml

@@ -325,6 +325,12 @@
         <if test="query.studentCodeOrName != null and query.studentCodeOrName !=''">
             and (t.student_code=#{query.studentCodeOrName} or bes.student_name=#{query.studentCodeOrName})
         </if>
+        <if test="query.paperType != null and query.paperType != ''">
+            and t.paper_type=#{query.paperType}
+        </if>
+        <if test="query.paperTypeCheckStatus != null and query.paperTypeCheckStatus != ''">
+            and t.paper_type_check_status=#{paperTypeCheckStatus}
+        </if>
         <if test="dpr != null and dpr.requestUserId != null">
             AND t.create_id = #{dpr.requestUserId}
         </if>
@@ -351,7 +357,8 @@
                t.is_absent,
                t.scan_status status,
                t.paper_number coursePaperNumber,
-               c.paper_count cardPaperCount
+               c.paper_count cardPaperCount,
+               t.paper_type paperType
         from mark_student t
         inner join basic_exam_student bes on t.basic_student_id = bes.id
         left join scan_answer_card c on t.exam_id=c.exam_id and t.card_number=c.number