|
@@ -8,8 +8,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.qmth.distributed.print.business.bean.BasicExamStudentQuery;
|
|
import com.qmth.distributed.print.business.bean.BasicExamStudentQuery;
|
|
import com.qmth.distributed.print.business.bean.dto.BasicExamStudentDto;
|
|
import com.qmth.distributed.print.business.bean.dto.BasicExamStudentDto;
|
|
|
|
+import com.qmth.distributed.print.business.bean.dto.DeleteBasicExamStudentStatusDto;
|
|
import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
|
|
import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
|
|
-import com.qmth.distributed.print.business.bean.params.TeachCourseSelectParam;
|
|
|
|
import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
|
|
import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
|
|
import com.qmth.distributed.print.business.entity.BasicExamRule;
|
|
import com.qmth.distributed.print.business.entity.BasicExamRule;
|
|
import com.qmth.distributed.print.business.entity.ExamStudent;
|
|
import com.qmth.distributed.print.business.entity.ExamStudent;
|
|
@@ -29,7 +29,6 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.service.*;
|
|
import com.qmth.teachcloud.common.util.ConvertUtil;
|
|
import com.qmth.teachcloud.common.util.ConvertUtil;
|
|
import com.qmth.teachcloud.common.util.ExcelUtil;
|
|
import com.qmth.teachcloud.common.util.ExcelUtil;
|
|
-import com.qmth.teachcloud.common.util.RegexUtil;
|
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
import com.qmth.teachcloud.mark.entity.MarkStudent;
|
|
import com.qmth.teachcloud.mark.entity.MarkStudent;
|
|
@@ -87,7 +86,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public IPage<BasicExamStudentResult> page(Long semesterId, Long examId, Long courseId,
|
|
public IPage<BasicExamStudentResult> page(Long semesterId, Long examId, Long courseId,
|
|
- String teacher, String college, String major, String teachClazz, String examStudentInfo, int pageNumber,
|
|
|
|
|
|
+ String teacher, String college, String major, String teachClassName, String className, String examStudentInfo, int pageNumber,
|
|
int pageSize) {
|
|
int pageSize) {
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
|
|
|
@@ -95,12 +94,13 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
college = SystemConstant.translateSpecificSign(college);
|
|
college = SystemConstant.translateSpecificSign(college);
|
|
major = SystemConstant.translateSpecificSign(major);
|
|
major = SystemConstant.translateSpecificSign(major);
|
|
examStudentInfo = SystemConstant.translateSpecificSign(examStudentInfo);
|
|
examStudentInfo = SystemConstant.translateSpecificSign(examStudentInfo);
|
|
- teachClazz = SystemConstant.translateSpecificSign(teachClazz);
|
|
|
|
|
|
+ teachClassName = SystemConstant.translateSpecificSign(teachClassName);
|
|
|
|
+ className = SystemConstant.translateSpecificSign(className);
|
|
|
|
|
|
DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(requestUser.getSchoolId(), requestUser.getId(),
|
|
DataPermissionRule dpr = basicRoleDataPermissionService.findDataPermission(requestUser.getSchoolId(), requestUser.getId(),
|
|
ServletUtil.getRequest().getServletPath());
|
|
ServletUtil.getRequest().getServletPath());
|
|
IPage<BasicExamStudentResult> page = this.baseMapper.findBasicExamStudentPage(new Page<>(pageNumber, pageSize),
|
|
IPage<BasicExamStudentResult> page = this.baseMapper.findBasicExamStudentPage(new Page<>(pageNumber, pageSize),
|
|
- requestUser.getSchoolId(), semesterId, examId, courseId, teacher, college, major, teachClazz, examStudentInfo, dpr);
|
|
|
|
|
|
+ requestUser.getSchoolId(), semesterId, examId, courseId, teacher, college, major, teachClassName, className, examStudentInfo, dpr);
|
|
for (BasicExamStudentResult record : page.getRecords()) {
|
|
for (BasicExamStudentResult record : page.getRecords()) {
|
|
Long examStartTime = record.getExamStartTime();
|
|
Long examStartTime = record.getExamStartTime();
|
|
Long examEndTime = record.getExamEndTime();
|
|
Long examEndTime = record.getExamEndTime();
|
|
@@ -152,46 +152,13 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
List<String> oldPaperNumberList = new ArrayList<>();
|
|
List<String> oldPaperNumberList = new ArrayList<>();
|
|
BasicExamStudent basicExamStudent = this.editEntityHelp(basicExamStudentParam, basicExam, oldPaperNumberList, requestUser);
|
|
BasicExamStudent basicExamStudent = this.editEntityHelp(basicExamStudentParam, basicExam, oldPaperNumberList, requestUser);
|
|
this.saveOrUpdate(basicExamStudent);
|
|
this.saveOrUpdate(basicExamStudent);
|
|
- MarkPaper markPaper = null;
|
|
|
|
- if (ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
|
|
|
|
- if (StringUtils.isBlank(basicExamStudent.getPaperNumber())) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("试卷编号不能为空");
|
|
|
|
- }
|
|
|
|
- markPaper = markPaperService.getByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber());
|
|
|
|
- if (markPaper == null) {
|
|
|
|
- // 模式4,不存在试卷,则创建
|
|
|
|
- markPaper = new MarkPaper(basicExamStudent.getExamId(), basicExamStudent.getCourseId(), basicExamStudent.getPaperNumber(), String.valueOf(System.currentTimeMillis()), requestUser.getId(), SystemConstant.DEFAULT_PAPER_TYPE_A);
|
|
|
|
- markPaperService.save(markPaper);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- if (StringUtils.isNotBlank(basicExamStudent.getPaperNumber())) {
|
|
|
|
- markPaper = markPaperService.getByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (markPaper != null) {
|
|
|
|
- // 同步更新扫描阅卷考生表
|
|
|
|
- markStudentService.updateByBasicExamStudent(basicExamStudent, markPaper, new HashSet<>());
|
|
|
|
- markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), SystemConstant.DEFAULT_PAPER_TYPE_A);
|
|
|
|
- if (basicExamStudentOld != null) {
|
|
|
|
- markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(basicExamStudent.getExamId(), basicExamStudentOld.getPaperNumber(), SystemConstant.DEFAULT_PAPER_TYPE_A);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (ExamModelEnum.MODEL4.equals(basicExam.getExamModel()) && basicExamStudentOld != null) {
|
|
|
|
- markPaperService.deleteByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudentOld.getPaperNumber(), true);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
+ // 更新扫描阅卷数据
|
|
|
|
+ this.updateMarkData(basicExam.getId(), Arrays.asList(basicExamStudent), Arrays.asList(basicExamStudentOld.getPaperNumber()), requestUser.getId());
|
|
// 自动创建课程管理数据
|
|
// 自动创建课程管理数据
|
|
teachCourseService.batchCreateTeachCourse(basicExamStudent.getSchoolId(), basicExamStudent.getExamId(), Arrays.asList(basicExamStudent));
|
|
teachCourseService.batchCreateTeachCourse(basicExamStudent.getSchoolId(), basicExamStudent.getExamId(), Arrays.asList(basicExamStudent));
|
|
return basicExamStudent.getId();
|
|
return basicExamStudent.getId();
|
|
}
|
|
}
|
|
|
|
|
|
- @Transactional
|
|
|
|
- @Override
|
|
|
|
- public void buildImportObjects(Map<String, Object> map) {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@Override
|
|
@Override
|
|
public void exportLogic(HttpServletResponse response, Long semesterId, Long examId, Long courseId, String teacher, String college, String major, String teachClazz, String examStudentInfo)
|
|
public void exportLogic(HttpServletResponse response, Long semesterId, Long examId, Long courseId, String teacher, String college, String major, String teachClazz, String examStudentInfo)
|
|
throws Exception {
|
|
throws Exception {
|
|
@@ -228,9 +195,12 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
}
|
|
}
|
|
}
|
|
}
|
|
markStudentService.deleteByExamIdAndPaperNumberAndStudentCode(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), basicExamStudent.getStudentCode());
|
|
markStudentService.deleteByExamIdAndPaperNumberAndStudentCode(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), basicExamStudent.getStudentCode());
|
|
- BasicExam basicExam = basicExamService.getById(basicExamStudent.getExamId());
|
|
|
|
- if (ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
|
|
|
|
- markPaperService.deleteByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), true);
|
|
|
|
|
|
+ // 更新扫描数据
|
|
|
|
+ long count = markStudentService.countByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), null);
|
|
|
|
+ if (count == 0) {
|
|
|
|
+ markPaperService.deleteByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber());
|
|
|
|
+ } else {
|
|
|
|
+ markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), null);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.removeByIds(idList);
|
|
this.removeByIds(idList);
|
|
@@ -288,7 +258,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
}
|
|
}
|
|
|
|
|
|
// 校验试卷编号和卷型
|
|
// 校验试卷编号和卷型
|
|
- if (StringUtils.isNoneBlank(basicExamStudentParam.getPaperNumber(), basicExamStudentParam.getPaperType())) {
|
|
|
|
|
|
+ if (!ExamModelEnum.MODEL4.equals(basicExam.getExamModel()) && StringUtils.isNoneBlank(basicExamStudentParam.getPaperNumber(), basicExamStudentParam.getPaperType())) {
|
|
// 不传课程ID
|
|
// 不传课程ID
|
|
ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamIdAndCourseIdAndPaperNumber(basicExamStudentParam.getExamId(), null, basicExamStudentParam.getPaperNumber());
|
|
ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamIdAndCourseIdAndPaperNumber(basicExamStudentParam.getExamId(), null, basicExamStudentParam.getPaperNumber());
|
|
if (examTaskDetail != null) {
|
|
if (examTaskDetail != null) {
|
|
@@ -445,4 +415,57 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
.eq(BasicExamStudent::getId, examStudent.getBasicStudentId()));
|
|
.eq(BasicExamStudent::getId, examStudent.getBasicStudentId()));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void updateMarkData(Long examId, List<BasicExamStudent> basicExamStudentList, List<String> oldPaperNumberList, Long createId) {
|
|
|
|
+ BasicExam basicExam = basicExamService.getById(examId);
|
|
|
|
+ Map<String, List<BasicExamStudent>> stringMap = basicExamStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperNumber())).collect(Collectors.groupingBy(BasicExamStudent::getPaperNumber));
|
|
|
|
+ for (Map.Entry<String, List<BasicExamStudent>> entry : stringMap.entrySet()) {
|
|
|
|
+ BasicExamStudent basicExamStudent = entry.getValue().get(0);
|
|
|
|
+ MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumberAndPaperType(examId, entry.getKey(), null);
|
|
|
|
+ if (markPaper == null && ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
|
|
|
|
+ String paperType = SystemConstant.DEFAULT_PAPER_TYPE_A;
|
|
|
|
+ markPaper = new MarkPaper(examId, basicExamStudent.getCourseId(), entry.getKey(), String.valueOf(System.currentTimeMillis()), createId, paperType);
|
|
|
|
+ markPaperService.save(markPaper);
|
|
|
|
+ }
|
|
|
|
+ if (markPaper != null) {
|
|
|
|
+ Set<String> secretNumberSet = new HashSet<>();
|
|
|
|
+ MarkPaper finalMarkPaper = markPaper;
|
|
|
|
+ entry.getValue().forEach(m -> markStudentService.updateByBasicExamStudent(m, finalMarkPaper, secretNumberSet));
|
|
|
|
+ markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examId, entry.getKey(), markPaper.getPaperType());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 更新历史数据试卷编号
|
|
|
|
+ if (CollectionUtils.isNotEmpty(oldPaperNumberList)) {
|
|
|
|
+ for (String paperNumber : oldPaperNumberList) {
|
|
|
|
+ long studentCount = markStudentService.countByExamIdAndPaperNumber(examId, paperNumber, null);
|
|
|
|
+ if (studentCount > 0) {
|
|
|
|
+ markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
|
|
|
|
+ } else {
|
|
|
|
+ markPaperService.deleteByExamIdAndPaperNumber(examId, paperNumber);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public List<DeleteBasicExamStudentStatusDto> getStudentMarkStatus(List<Long> idList) {
|
|
|
|
+ List<BasicExamStudent> basicExamStudentList = this.listByIds(idList);
|
|
|
|
+ List<DeleteBasicExamStudentStatusDto> list = new ArrayList<>();
|
|
|
|
+ for (BasicExamStudent basicExamStudent : basicExamStudentList) {
|
|
|
|
+ BasicCourse basicCourse = basicCourseService.getById(basicExamStudent.getCourseId());
|
|
|
|
+ SysOrg sysOrg = sysOrgService.getById(basicCourse != null ? basicCourse.getTeachingRoomId() : null);
|
|
|
|
+ List<MarkStudent> markStudentList = markStudentService.listByStudentId(basicExamStudent.getId());
|
|
|
|
+ if (CollectionUtils.isNotEmpty(markStudentList)) {
|
|
|
|
+ for (MarkStudent markStudent : markStudentList) {
|
|
|
|
+ DeleteBasicExamStudentStatusDto deleteBasicExamStudentStatusDto = new DeleteBasicExamStudentStatusDto(basicExamStudent.getStudentName(), basicExamStudent.getStudentCode(), basicCourse != null ? basicCourse.getCode() : null, basicCourse != null ? basicCourse.getName() : null, sysOrg != null ? sysOrg.getName() : null);
|
|
|
|
+ deleteBasicExamStudentStatusDto.setScanStatus(markStudent.getUpload() != null ? markStudent.getUpload() : false);
|
|
|
|
+ deleteBasicExamStudentStatusDto.setMarkTaskStatus(markTaskService.countByStudentId(markStudent.getId()) > 0);
|
|
|
|
+ list.add(deleteBasicExamStudentStatusDto);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return list;
|
|
|
|
+ }
|
|
}
|
|
}
|