Răsfoiți Sursa

更新缺考状态

xiatian 1 an în urmă
părinte
comite
0b1243b267

+ 23 - 12
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/ScanStudentController.java

@@ -1,19 +1,23 @@
 package com.qmth.distributed.print.api.mark;
 
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 import com.qmth.boot.api.constant.ApiConstant;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
+import com.qmth.teachcloud.mark.bean.student.AbsentManualUpdateVo;
 import com.qmth.teachcloud.mark.bean.student.StudentQuery;
 import com.qmth.teachcloud.mark.service.MarkStudentService;
+
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
 
 /**
  * <p>
@@ -27,12 +31,19 @@ import org.springframework.web.bind.annotation.RestController;
 @RestController
 @RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_SCAN + "/student")
 public class ScanStudentController {
-    @Autowired
-    private MarkStudentService markStudentService;
+	@Autowired
+	private MarkStudentService markStudentService;
+
+	@ApiOperation(value = "考生查询")
+	@RequestMapping(value = "find", method = RequestMethod.POST)
+	public Result student(@Validated StudentQuery query) {
+		return ResultUtil.ok(markStudentService.findOne(query));
+	}
 
-    @ApiOperation(value = "考生查询")
-    @RequestMapping(value = "find", method = RequestMethod.POST)
-    public Result student(@Validated StudentQuery query) {
-        return ResultUtil.ok(markStudentService.findOne(query));
-    }
+	@ApiOperation(value = "更新缺考状态")
+	@PostMapping("absent/update")
+	public AbsentManualUpdateVo absentManualUpdate(@RequestParam Long examId, @RequestParam String coursePaperId,
+			@RequestParam String studentCode) {
+		return markStudentService.absentManualUpdate(examId, coursePaperId,studentCode);
+	}
 }

+ 39 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/student/AbsentManualUpdateVo.java

@@ -0,0 +1,39 @@
+package com.qmth.teachcloud.mark.bean.student;
+
+import com.qmth.teachcloud.common.enums.ScanStatus;
+
+public class AbsentManualUpdateVo {
+
+    
+    private ScanStatus status;
+    
+    
+    private long updateTime;
+
+
+	public ScanStatus getStatus() {
+		return status;
+	}
+
+
+	public void setStatus(ScanStatus status) {
+		this.status = status;
+	}
+
+
+	public long getUpdateTime() {
+		return updateTime;
+	}
+
+
+	public void setUpdateTime(long updateTime) {
+		this.updateTime = updateTime;
+	}
+    public static AbsentManualUpdateVo create(ScanStatus st) {
+    	AbsentManualUpdateVo vo = new AbsentManualUpdateVo();
+        vo.setUpdateTime(System.currentTimeMillis());
+        vo.setStatus(st);
+        return vo;
+    }
+
+}

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

@@ -15,6 +15,7 @@ import com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryDomain;
 import com.qmth.teachcloud.mark.bean.scananswer.AnswerQueryVo;
 import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamCheckInfoVo;
 import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamInfoVo;
+import com.qmth.teachcloud.mark.bean.student.AbsentManualUpdateVo;
 import com.qmth.teachcloud.mark.bean.student.StudentQuery;
 import com.qmth.teachcloud.mark.bean.student.StudentVo;
 import com.qmth.teachcloud.mark.dto.mark.score.SheetUrlDto;
@@ -82,4 +83,6 @@ public interface MarkStudentService extends IService<MarkStudent> {
 	UpdateTimeVo omrEdit(Long userId,OmrEditDomain domain);
 
 	MarkStudent findByExamIdAndStudentCode(Long examId, String studentCode);
+
+	AbsentManualUpdateVo absentManualUpdate(Long examId, String coursePaperId, String studentCode);
 }

+ 20 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/MarkStudentServiceImpl.java

@@ -18,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -43,6 +44,7 @@ import com.qmth.teachcloud.mark.bean.scananswer.StudentPaperVo;
 import com.qmth.teachcloud.mark.bean.scanexaminfo.CheckTask;
 import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamCheckInfoVo;
 import com.qmth.teachcloud.mark.bean.scanexaminfo.ScanExamInfoVo;
+import com.qmth.teachcloud.mark.bean.student.AbsentManualUpdateVo;
 import com.qmth.teachcloud.mark.bean.student.StudentQuery;
 import com.qmth.teachcloud.mark.bean.student.StudentVo;
 import com.qmth.teachcloud.mark.dto.mark.ScoreInfo;
@@ -628,4 +630,22 @@ public class MarkStudentServiceImpl extends ServiceImpl<MarkStudentMapper, MarkS
         queryWrapper.lambda().eq(MarkStudent::getStudentCode, studentCode);
         return baseMapper.selectOne(queryWrapper);
     }
+
+    @Transactional
+	@Override
+	public AbsentManualUpdateVo absentManualUpdate(Long examId, String coursePaperId, String studentCode) {
+    	MarkStudent student = findByExamIdAndCoursePaperIdAndStudentCode(examId, coursePaperId, studentCode);
+        if (student == null) {
+            throw new ParameterException("考生未找到");
+        }
+        if (student.getScanStatus() != ScanStatus.UNEXIST) {
+            throw new ParameterException("考生不是未扫描状态");
+        }
+        LambdaUpdateWrapper<MarkStudent> lw = new LambdaUpdateWrapper<>();
+        lw.set(MarkStudent::getScanStatus, ScanStatus.MANUAL_ABSENT);
+        lw.eq(MarkStudent::getId, student.getId());
+        lw.eq(MarkStudent::getScanStatus, ScanStatus.UNEXIST);
+        update(lw);
+        return AbsentManualUpdateVo.create(ScanStatus.MANUAL_ABSENT);
+	}
 }