|
@@ -1,5 +1,16 @@
|
|
|
package com.qmth.teachcloud.mark.service.impl;
|
|
|
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
+
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+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;
|
|
@@ -28,15 +39,6 @@ import com.qmth.teachcloud.mark.enums.LockType;
|
|
|
import com.qmth.teachcloud.mark.enums.OmrTaskStatus;
|
|
|
import com.qmth.teachcloud.mark.mapper.ScanOmrTaskMapper;
|
|
|
import com.qmth.teachcloud.mark.service.*;
|
|
|
-import org.apache.commons.collections4.CollectionUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import javax.validation.constraints.NotNull;
|
|
|
-import java.util.*;
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -48,22 +50,31 @@ import java.util.stream.Collectors;
|
|
|
*/
|
|
|
@Service
|
|
|
public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanOmrTask> implements ScanOmrTaskService {
|
|
|
+
|
|
|
@Autowired
|
|
|
private ScanStudentPaperService studentPaperService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private MarkStudentService studentService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ScanPaperService paperService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ScanPaperPageService pageService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private ConcurrentService concurrentService;
|
|
|
+
|
|
|
@Autowired
|
|
|
private MarkQuestionService questionService;
|
|
|
+
|
|
|
@Resource
|
|
|
private MarkPaperService markPaperService;
|
|
|
+
|
|
|
@Resource
|
|
|
private TeachcloudCommonService teachcloudCommonService;
|
|
|
+
|
|
|
@Resource
|
|
|
private BasicRoleDataPermissionService basicRoleDataPermissionService;
|
|
|
|
|
@@ -127,28 +138,28 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
pageDto.setItems(items);
|
|
|
}
|
|
|
// 卷型空选
|
|
|
-// if (ConditionType.PAPER_TYPE_BLANK.equals(c)) {
|
|
|
-// if (pageEntity.getPaperType() != null
|
|
|
-// && pageEntity.getPaperType().getResult().contains(OMR_BLANK)) {
|
|
|
-// OmrTaskItem item = new OmrTaskItem();
|
|
|
-// item.setIndex(1);
|
|
|
-// item.setField(OmrField.PAPER_TYPE);
|
|
|
-// item.setOmrResult(pageEntity.getPaperType().getResult());
|
|
|
-// items.add(item);
|
|
|
-// }
|
|
|
-// }
|
|
|
+ // if (ConditionType.PAPER_TYPE_BLANK.equals(c)) {
|
|
|
+ // if (pageEntity.getPaperType() != null
|
|
|
+ // && pageEntity.getPaperType().getResult().contains(OMR_BLANK)) {
|
|
|
+ // OmrTaskItem item = new OmrTaskItem();
|
|
|
+ // item.setIndex(1);
|
|
|
+ // item.setField(OmrField.PAPER_TYPE);
|
|
|
+ // item.setOmrResult(pageEntity.getPaperType().getResult());
|
|
|
+ // items.add(item);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
// 卷型多选
|
|
|
-// if (ConditionType.PAPER_TYPE_EXCEED.equals(c)) {
|
|
|
-// if ((!pageEntity.getPaperType().getResult().contains(OMR_SUSPECT)
|
|
|
-// && pageEntity.getPaperType().getResult().length() > 2)
|
|
|
-// || (pageEntity.getPaperType().getResult().contains(OMR_SUSPECT)
|
|
|
-// && pageEntity.getPaperType().getResult().length() > 1)) {
|
|
|
-// OmrTaskItem item = new OmrTaskItem();
|
|
|
-// item.setField(OmrField.PAPER_TYPE);
|
|
|
-// item.setOmrResult(pageEntity.getPaperType().getResult());
|
|
|
-// items.add(item);
|
|
|
-// }
|
|
|
-// }
|
|
|
+ // if (ConditionType.PAPER_TYPE_EXCEED.equals(c)) {
|
|
|
+ // if ((!pageEntity.getPaperType().getResult().contains(OMR_SUSPECT)
|
|
|
+ // && pageEntity.getPaperType().getResult().length() > 2)
|
|
|
+ // || (pageEntity.getPaperType().getResult().contains(OMR_SUSPECT)
|
|
|
+ // && pageEntity.getPaperType().getResult().length() > 1)) {
|
|
|
+ // OmrTaskItem item = new OmrTaskItem();
|
|
|
+ // item.setField(OmrField.PAPER_TYPE);
|
|
|
+ // item.setOmrResult(pageEntity.getPaperType().getResult());
|
|
|
+ // items.add(item);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
if (ConditionType.QUESTION_MULTI_BLANK.equals(c)) {
|
|
|
List<MarkQuestion> questiongList = questionService
|
|
|
.listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(student.getExamId(),
|
|
@@ -205,8 +216,8 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if (ConditionType.QUESTION_SINGLE_EXCEED.equals(c)
|
|
|
- && ScanStatus.SCANNED.equals(student.getScanStatus()) && !allObjectiveBlank) {
|
|
|
+ if (ConditionType.QUESTION_SINGLE_EXCEED.equals(c) && ScanStatus.SCANNED.equals(student.getScanStatus())
|
|
|
+ && !allObjectiveBlank) {
|
|
|
List<MarkQuestion> questiongList = questionService
|
|
|
.listByExamIdAndPaperNumberAndPaperIndexAndPageIndex(student.getExamId(),
|
|
|
student.getPaperNumber(), spe.getPaperIndex(), pageEntity.getPageIndex());
|
|
@@ -219,7 +230,8 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
String result = pageEntity.getQuestion().getResult().get(i);
|
|
|
MarkQuestion question = questiongList.get(i);
|
|
|
- if (question.getQuestionType().equals(QuestionType.SINGLE.getValue()) && result != null && result.length() > 1) {
|
|
|
+ if (question.getQuestionType().equals(QuestionType.SINGLE.getValue()) && result != null
|
|
|
+ && result.length() > 1) {
|
|
|
OmrTaskItem item = new OmrTaskItem();
|
|
|
item.setIndex(i + 1);
|
|
|
item.setField(OmrField.QUESTION);
|
|
@@ -387,36 +399,36 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
for (OmrTaskPage taskPage : task.getPages()) {
|
|
|
ScanOmrTaskPageDto page = new ScanOmrTaskPageDto();
|
|
|
Map<Integer, List<String>> question = new HashMap<>();
|
|
|
- Map<Integer, List<String>> selective = new HashMap<>();
|
|
|
+ // Map<Integer, List<String>> selective = new HashMap<>();
|
|
|
for (OmrTaskItem item : taskPage.getItems()) {
|
|
|
- if (OmrField.ABSENT.equals(item.getField())) {
|
|
|
- page.setAbsent(getBooleanItem(item));
|
|
|
- }
|
|
|
- if (OmrField.BREACH.equals(item.getField())) {
|
|
|
- page.setBreach(getBooleanItem(item));
|
|
|
- }
|
|
|
- if (OmrField.PAPER_TYPE.equals(item.getField())) {
|
|
|
- page.setPaperType(getStringItem(item));
|
|
|
- }
|
|
|
+ // if (OmrField.ABSENT.equals(item.getField())) {
|
|
|
+ // page.setAbsent(getBooleanItem(item));
|
|
|
+ // }
|
|
|
+ // if (OmrField.BREACH.equals(item.getField())) {
|
|
|
+ // page.setBreach(getBooleanItem(item));
|
|
|
+ // }
|
|
|
+ // if (OmrField.PAPER_TYPE.equals(item.getField())) {
|
|
|
+ // page.setPaperType(getStringItem(item));
|
|
|
+ // }
|
|
|
if (OmrField.QUESTION.equals(item.getField())) {
|
|
|
List<String> content = getStringItem(item);
|
|
|
if (content != null) {
|
|
|
question.put(item.getIndex(), content);
|
|
|
}
|
|
|
}
|
|
|
- if (OmrField.SELECTIVE.equals(item.getField())) {
|
|
|
- List<String> content = getStringItem(item);
|
|
|
- if (content != null) {
|
|
|
- selective.put(item.getIndex(), content);
|
|
|
- }
|
|
|
- }
|
|
|
+ // if (OmrField.SELECTIVE.equals(item.getField())) {
|
|
|
+ // List<String> content = getStringItem(item);
|
|
|
+ // if (content != null) {
|
|
|
+ // selective.put(item.getIndex(), content);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
if (question.size() > 0) {
|
|
|
page.setQuestion(question);
|
|
|
}
|
|
|
- if (selective.size() > 0) {
|
|
|
- page.setSelective(selective);
|
|
|
- }
|
|
|
+ // if (selective.size() > 0) {
|
|
|
+ // page.setSelective(selective);
|
|
|
+ // }
|
|
|
// 有需要仲裁的数据才返回结构
|
|
|
if (page.getAbsent() != null || page.getBreach() != null || page.getPaperType() != null
|
|
|
|| page.getQuestion() != null || page.getSelective() != null) {
|
|
@@ -434,7 +446,7 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
}
|
|
|
|
|
|
private List<String> getStringItem(OmrTaskItem item) {
|
|
|
- //只取最新的值
|
|
|
+ // 只取最新的值
|
|
|
List<String> value = new ArrayList<>();
|
|
|
if (item.getSecondResult() != null) {
|
|
|
value.add(item.getSecondResult());
|
|
@@ -476,7 +488,8 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
if (markStudent == null) {
|
|
|
throw new ParameterException("考生不存在");
|
|
|
}
|
|
|
- MarkPaper markPaper = markPaperService.getByExamIdAndCoursePaperId(markStudent.getExamId(), markStudent.getCoursePaperId());
|
|
|
+ MarkPaper markPaper = markPaperService.getByExamIdAndCoursePaperId(markStudent.getExamId(),
|
|
|
+ markStudent.getCoursePaperId());
|
|
|
if (markPaper == null) {
|
|
|
throw new ParameterException("课程不存在");
|
|
|
}
|
|
@@ -492,18 +505,18 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
throw new ParameterException("page[" + page.getIndex() + "]不存在");
|
|
|
}
|
|
|
for (OmrTaskItem item : page.getItems()) {
|
|
|
- if (OmrField.ABSENT.equals(item.getField())) {
|
|
|
- if (pageVo.getAbsent() == null) {
|
|
|
- throw new ParameterException("page[" + page.getIndex() + "].absent不存在");
|
|
|
- }
|
|
|
- item.setFirstResult(pageVo.getAbsent().toString());
|
|
|
- }
|
|
|
- if (OmrField.BREACH.equals(item.getField())) {
|
|
|
- if (pageVo.getBreach() == null) {
|
|
|
- throw new ParameterException("page[" + page.getIndex() + "].breach不存在");
|
|
|
- }
|
|
|
- item.setFirstResult(pageVo.getBreach().toString());
|
|
|
- }
|
|
|
+ // if (OmrField.ABSENT.equals(item.getField())) {
|
|
|
+ // if (pageVo.getAbsent() == null) {
|
|
|
+ // throw new ParameterException("page[" + page.getIndex() + "].absent不存在");
|
|
|
+ // }
|
|
|
+ // item.setFirstResult(pageVo.getAbsent().toString());
|
|
|
+ // }
|
|
|
+ // if (OmrField.BREACH.equals(item.getField())) {
|
|
|
+ // if (pageVo.getBreach() == null) {
|
|
|
+ // throw new ParameterException("page[" + page.getIndex() + "].breach不存在");
|
|
|
+ // }
|
|
|
+ // item.setFirstResult(pageVo.getBreach().toString());
|
|
|
+ // }
|
|
|
if (OmrField.QUESTION.equals(item.getField())) {
|
|
|
String content = pageVo.getQuestion() != null ? pageVo.getQuestion().get(item.getIndex())
|
|
|
: null;
|
|
@@ -513,15 +526,16 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
}
|
|
|
item.setFirstResult(content);
|
|
|
}
|
|
|
- if (OmrField.SELECTIVE.equals(item.getField())) {
|
|
|
- String content = pageVo.getSelective() != null ? pageVo.getSelective().get(item.getIndex())
|
|
|
- : null;
|
|
|
- if (content == null) {
|
|
|
- throw new ParameterException(
|
|
|
- "page[" + page.getIndex() + "].selective[" + item.getIndex() + "]不存在");
|
|
|
- }
|
|
|
- item.setFirstResult(content);
|
|
|
- }
|
|
|
+ // if (OmrField.SELECTIVE.equals(item.getField())) {
|
|
|
+ // String content = pageVo.getSelective() != null ?
|
|
|
+ // pageVo.getSelective().get(item.getIndex())
|
|
|
+ // : null;
|
|
|
+ // if (content == null) {
|
|
|
+ // throw new ParameterException(
|
|
|
+ // "page[" + page.getIndex() + "].selective[" + item.getIndex() + "]不存在");
|
|
|
+ // }
|
|
|
+ // item.setFirstResult(content);
|
|
|
+ // }
|
|
|
}
|
|
|
}
|
|
|
task.setStatus(OmrTaskStatus.PROCESSED);
|
|
@@ -559,22 +573,27 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
}
|
|
|
}
|
|
|
paperService.savePaperAndPages(paper, pages);
|
|
|
- studentService.updateStudentByPaper(userId, sp.getStudentId(), false);
|
|
|
+ studentService.updateStudentAnswer(sp.getStudentId());
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public ScanOmrTaskStatusDto getStatus(Long examId, String courseCode, String coursePaperId) {
|
|
|
SysUser user = (SysUser) ServletUtil.getRequestUser();
|
|
|
- DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(user.getSchoolId(), user.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
+ DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(user.getSchoolId(), user.getId(),
|
|
|
+ ServletUtil.getRequest().getServletPath());
|
|
|
ScanOmrTaskStatusDto status = new ScanOmrTaskStatusDto();
|
|
|
- status.setFinishCount(this.getFinishStudentCountByExamAndUserId(examId, courseCode, coursePaperId, OmrTaskStatus.PROCESSED.name(), dpr));
|
|
|
- status.setTodoCount(this.getFinishStudentCountByExamAndUserId(examId, courseCode, coursePaperId, OmrTaskStatus.WAITING.name(), dpr));
|
|
|
+ status.setFinishCount(this.getFinishStudentCountByExamAndUserId(examId, courseCode, coursePaperId,
|
|
|
+ OmrTaskStatus.PROCESSED.name(), dpr));
|
|
|
+ status.setTodoCount(this.getFinishStudentCountByExamAndUserId(examId, courseCode, coursePaperId,
|
|
|
+ OmrTaskStatus.WAITING.name(), dpr));
|
|
|
return status;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int getFinishStudentCountByExamAndUserId(Long examId, String courseCode, String coursePaperId, String status, DataPermissionRule dpr) {
|
|
|
- return this.baseMapper.getStudentCountByExamAndStatusAndUserId(examId, courseCode, coursePaperId, status, MarkPaperStatus.FORMAL.name(), dpr);
|
|
|
+ public int getFinishStudentCountByExamAndUserId(Long examId, String courseCode, String coursePaperId, String status,
|
|
|
+ DataPermissionRule dpr) {
|
|
|
+ return this.baseMapper.getStudentCountByExamAndStatusAndUserId(examId, courseCode, coursePaperId, status,
|
|
|
+ MarkPaperStatus.FORMAL.name(), dpr);
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@@ -598,7 +617,8 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int getCount(Long examId, OmrTaskStatus status, String courseCode, String coursePaperId, MarkPaperStatus markPaperStatus, DataPermissionRule dpr) {
|
|
|
+ public int getCount(Long examId, OmrTaskStatus status, String courseCode, String coursePaperId,
|
|
|
+ MarkPaperStatus markPaperStatus, DataPermissionRule dpr) {
|
|
|
ScanOmrTask scanOmrTask = new ScanOmrTask();
|
|
|
scanOmrTask.setExamId(examId);
|
|
|
scanOmrTask.setCourseCode(courseCode);
|
|
@@ -611,8 +631,10 @@ public class ScanOmrTaskServiceImpl extends ServiceImpl<ScanOmrTaskMapper, ScanO
|
|
|
@Override
|
|
|
public List<ScanStudentDto> list(Long examId, String courseCode, String coursePaperId, OmrTaskStatus status) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(), sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
- return this.baseMapper.listByExamIdAndStatusAndUserId(examId, courseCode, coursePaperId, status, MarkPaperStatus.FORMAL.name(), dpr);
|
|
|
+ DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(sysUser.getSchoolId(),
|
|
|
+ sysUser.getId(), ServletUtil.getRequest().getServletPath());
|
|
|
+ return this.baseMapper.listByExamIdAndStatusAndUserId(examId, courseCode, coursePaperId, status,
|
|
|
+ MarkPaperStatus.FORMAL.name(), dpr);
|
|
|
}
|
|
|
|
|
|
@Override
|