|
@@ -5,9 +5,6 @@ import java.util.List;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
-import net.sf.json.JSONArray;
|
|
|
-import net.sf.json.JSONObject;
|
|
|
-
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -21,6 +18,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import cn.com.qmth.stmms.api.dto.RefixStudent;
|
|
|
import cn.com.qmth.stmms.api.exception.ApiException;
|
|
|
+import cn.com.qmth.stmms.api.utils.ScanStudentA4Parameter;
|
|
|
import cn.com.qmth.stmms.api.utils.ScanStudentParameter;
|
|
|
import cn.com.qmth.stmms.biz.exam.model.CheckStudent;
|
|
|
import cn.com.qmth.stmms.biz.exam.model.Exam;
|
|
@@ -41,6 +39,8 @@ import cn.com.qmth.stmms.common.enums.LogType;
|
|
|
import cn.com.qmth.stmms.common.enums.Role;
|
|
|
import cn.com.qmth.stmms.common.utils.DateUtils;
|
|
|
import cn.com.qmth.stmms.common.utils.RequestUtils;
|
|
|
+import net.sf.json.JSONArray;
|
|
|
+import net.sf.json.JSONObject;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping("/api/scan")
|
|
@@ -65,6 +65,65 @@ public class ScanController extends BaseApiController {
|
|
|
|
|
|
private static final String PAPER_TYPES_REGEX = "[a-zA-Z#]";
|
|
|
|
|
|
+ /**
|
|
|
+ * 上传考生识别结果
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param examId
|
|
|
+ * @param scStudentParameter
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Logging(menu = "扫描端-考生识别上传(含A4数量)", type = LogType.UPDATE)
|
|
|
+ @RoleRequire({ Role.SCHOOL_ADMIN, Role.SCANNER, Role.SCAN_ADMIN })
|
|
|
+ @RequestMapping(value = "/student/a4/{examId}", method = RequestMethod.POST)
|
|
|
+ @ResponseBody
|
|
|
+ public JSONArray saveStudentWithA4(HttpServletRequest request, @PathVariable Integer examId,
|
|
|
+ @RequestBody ScanStudentA4Parameter[] scStudentParameter) {
|
|
|
+ ApiUser user = RequestUtils.getApiUser(request);
|
|
|
+ Exam exam = examService.findById(examId);
|
|
|
+ JSONArray array = new JSONArray();
|
|
|
+ // 判断上传权限
|
|
|
+ if (exam == null || !exam.getSchoolId().equals(user.getSchoolId())
|
|
|
+ || !ExamStatus.START.equals(exam.getStatus()) || !ExamType.SCAN_IMAGE.equals(exam.getType())) {
|
|
|
+ throw ApiException.EXAM_NOT_ACCESSIBLED;
|
|
|
+ }
|
|
|
+ if (scStudentParameter != null && scStudentParameter.length > 0) {
|
|
|
+ for (ScanStudentA4Parameter sc : scStudentParameter) {
|
|
|
+ ExamStudent student = studentService.findByExamIdAndExamNumber(examId, sc.getExamNumber());
|
|
|
+ if (student != null) {
|
|
|
+ student.setUpload(true);
|
|
|
+ student.setAbsent(sc.isAbsent());
|
|
|
+ student.setAnswers(sc.getAnswers().toUpperCase());
|
|
|
+ student.setBatchCode(sc.getBatchCode());
|
|
|
+ student.setSliceCount(sc.getSliceCount());
|
|
|
+ student.setSheetCount(sc.getSheetCount());
|
|
|
+ student.setA4Count(sc.getA4Count());
|
|
|
+ if (sc.getPaperType() != null) {
|
|
|
+ if (sc.getPaperType().matches(PAPER_TYPES_REGEX)) {
|
|
|
+ student.setPaperType(sc.getPaperType());
|
|
|
+ } else {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ student.setCardNumber(sc.getCardNumber());
|
|
|
+ // 同步更新评卷任务
|
|
|
+ if (saveUploadStudent(student)) {
|
|
|
+ JSONObject obj = new JSONObject();
|
|
|
+ obj.accumulate("examNumber", student.getExamNumber());
|
|
|
+ obj.accumulate("uploadTime", DateUtils.formatDateTime(student.getUploadTime()));
|
|
|
+ array.add(obj);
|
|
|
+ // 增加人工审核数据
|
|
|
+ if (sc.isManual()) {
|
|
|
+ checkStudentService.save(new CheckStudent(student.getId(), examId,
|
|
|
+ student.getSubjectCode(), CheckType.MANUAL));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return array;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 上传考生识别结果
|
|
|
*
|