Эх сурвалжийг харах

答题卡扫描批次完成

xiatian 1 жил өмнө
parent
commit
63aa9a1f3d

+ 8 - 0
distributed-print/src/main/java/com/qmth/distributed/print/api/mark/ScanAnswerBatchController.java

@@ -6,6 +6,7 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.RequestBody;
 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;
@@ -17,6 +18,7 @@ import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.common.util.ServletUtil;
 import com.qmth.teachcloud.mark.bean.answerbatch.BatchCreateDomain;
 import com.qmth.teachcloud.mark.bean.answerbatch.BatchCreateVo;
+import com.qmth.teachcloud.mark.bean.answerbatch.BatchFinishVo;
 import com.qmth.teachcloud.mark.service.ScanBatchService;
 
 import io.swagger.annotations.Api;
@@ -51,4 +53,10 @@ public class ScanAnswerBatchController {
 		SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         return scanBatchService.batchCreate(domain,sysUser);
     }
+    
+    @ApiOperation(value = "答题卡扫描批次完成")
+    @RequestMapping(value = "finish", method = RequestMethod.POST)
+    public BatchFinishVo batchFinish(@RequestParam Long id) {
+        return scanBatchService.batchFinish(id);
+    }
 }

+ 25 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/bean/answerbatch/BatchFinishVo.java

@@ -0,0 +1,25 @@
+package com.qmth.teachcloud.mark.bean.answerbatch;
+
+import com.qmth.teachcloud.mark.enums.BatchStatus;
+
+public class BatchFinishVo {
+	private BatchStatus status;
+	private Long updateTime;
+	
+	
+	
+	public BatchStatus getStatus() {
+		return status;
+	}
+	public void setStatus(BatchStatus status) {
+		this.status = status;
+	}
+	public Long getUpdateTime() {
+		return updateTime;
+	}
+	public void setUpdateTime(Long updateTime) {
+		this.updateTime = updateTime;
+	}
+	
+	
+}

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

@@ -3,6 +3,7 @@ package com.qmth.teachcloud.mark.service;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.mark.bean.answerbatch.BatchCreateDomain;
 import com.qmth.teachcloud.mark.bean.answerbatch.BatchCreateVo;
+import com.qmth.teachcloud.mark.bean.answerbatch.BatchFinishVo;
 import com.qmth.teachcloud.mark.entity.ScanBatch;
 import com.baomidou.mybatisplus.extension.service.IService;
 
@@ -18,4 +19,6 @@ public interface ScanBatchService extends IService<ScanBatch> {
 
 	BatchCreateVo batchCreate(BatchCreateDomain domain,SysUser sysUser);
 
+	BatchFinishVo batchFinish(Long id);
+
 }

+ 19 - 0
teachcloud-mark/src/main/java/com/qmth/teachcloud/mark/service/impl/ScanBatchServiceImpl.java

@@ -13,6 +13,7 @@ import com.qmth.boot.core.exception.ParameterException;
 import com.qmth.teachcloud.common.entity.SysUser;
 import com.qmth.teachcloud.mark.bean.answerbatch.BatchCreateDomain;
 import com.qmth.teachcloud.mark.bean.answerbatch.BatchCreateVo;
+import com.qmth.teachcloud.mark.bean.answerbatch.BatchFinishVo;
 import com.qmth.teachcloud.mark.bean.answerbatch.Paper;
 import com.qmth.teachcloud.mark.bean.answerbatch.Rescan;
 import com.qmth.teachcloud.mark.bean.scanpaper.PaperVo;
@@ -111,4 +112,22 @@ public class ScanBatchServiceImpl extends ServiceImpl<ScanBatchMapper, ScanBatch
         return res;
     }
 
+	@Transactional
+	@Override
+	public BatchFinishVo batchFinish(Long id) {
+		ScanBatch entity = this.getById(id);
+        if (entity == null) {
+            throw new ParameterException("批次不存在");
+        }
+        if (BatchStatus.FINISH.equals(entity.getStatus())) {
+            throw new ParameterException("批次已经完成");
+        }
+		entity.setStatus(BatchStatus.FINISH);
+        this.saveOrUpdate(entity);
+        BatchFinishVo vo = new BatchFinishVo();
+        vo.setStatus(entity.getStatus());
+        vo.setUpdateTime(System.currentTimeMillis());
+        return vo;
+	}
+
 }