|
@@ -13,17 +13,13 @@ import com.qmth.distributed.print.business.enums.*;
|
|
|
import com.qmth.distributed.print.business.mapper.ExamTaskDetailMapper;
|
|
|
import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
|
|
|
-import com.qmth.teachcloud.common.bean.dto.MqDto;
|
|
|
-import com.qmth.teachcloud.common.bean.result.TbTaskDetailResult;
|
|
|
import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.SysOrg;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
-import com.qmth.teachcloud.common.entity.TBTask;
|
|
|
import com.qmth.teachcloud.common.enums.*;
|
|
|
import com.qmth.teachcloud.common.service.*;
|
|
|
import com.qmth.teachcloud.common.util.ExamTaskUtil;
|
|
|
-import com.qmth.teachcloud.common.util.RedisUtil;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
import com.qmth.teachcloud.mark.service.MarkService;
|
|
|
import com.qmth.teachcloud.mark.service.ScanPaperService;
|
|
@@ -31,7 +27,6 @@ import org.activiti.engine.TaskService;
|
|
|
import org.activiti.engine.task.Task;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
-import org.springframework.context.annotation.Lazy;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
@@ -385,45 +380,43 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
|
|
|
List<ExamDetail> examDetailList = examDetailService.listByCourseCodeAndPaperNumber(examTask.getSchoolId(), examTask.getExamId(), examTask.getCourseCode(), examTask.getPaperNumber());
|
|
|
if (CollectionUtils.isNotEmpty(examDetailList)) {
|
|
|
ExamTaskDetail taskDetail = this.getByExamTaskId(examTaskDetail.getExamTaskId());
|
|
|
- if (StringUtils.isNotBlank(taskDetail.getExposedPaperType())) {
|
|
|
- List<Long> examDetailIds = examDetailList.stream().map(ExamDetail::getId).collect(Collectors.toList());
|
|
|
- QueryWrapper<ExamDetailCourse> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.lambda().in(ExamDetailCourse::getExamDetailId, examDetailIds);
|
|
|
- List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.list(queryWrapper);
|
|
|
- Set<String> paperTypeSet = new HashSet<>();
|
|
|
- for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
|
|
|
- // 考场内任一课程有扫描数据,不允许打回
|
|
|
- boolean isScanPaper = scanPaperService.isScanByExamIdAndPaperNumber(examTask.getExamId(), examDetailCourse.getPaperNumber());
|
|
|
- if (isScanPaper) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("有课程已开始扫描,无法打回");
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(examDetailCourse.getPaperType())) {
|
|
|
- paperTypeSet.addAll(Arrays.asList(examDetailCourse.getPaperType().split(",")));
|
|
|
- }
|
|
|
+ List<Long> examDetailIds = examDetailList.stream().map(ExamDetail::getId).collect(Collectors.toList());
|
|
|
+ QueryWrapper<ExamDetailCourse> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().in(ExamDetailCourse::getExamDetailId, examDetailIds);
|
|
|
+ List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.list(queryWrapper);
|
|
|
+ Set<String> paperTypeSet = new HashSet<>();
|
|
|
+ for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
|
|
|
+ // 考场内任一课程有扫描数据,不允许打回
|
|
|
+ boolean isScanPaper = scanPaperService.isScanByExamIdAndPaperNumber(examTask.getExamId(), examDetailCourse.getPaperNumber());
|
|
|
+ if (isScanPaper) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("有课程已开始扫描,无法打回");
|
|
|
}
|
|
|
-
|
|
|
- // 已打印任务,必须先作废,未打印任务,必须先撤回。才允许打回
|
|
|
- long count = examDetailList.stream().filter(m -> (ExamDetailStatusEnum.FINISH.equals(m.getStatus()) && m.getNormal()) || ExamDetailStatusEnum.WAITING.equals(m.getStatus())).count();
|
|
|
- if (count > 0) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("印刷任务有已打印且未作废或者未撤回数据,无法打回");
|
|
|
+ if (StringUtils.isNotBlank(examDetailCourse.getPaperType())) {
|
|
|
+ paperTypeSet.addAll(Arrays.asList(examDetailCourse.getPaperType().split(",")));
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- // 修改已曝光和未曝光类型
|
|
|
- List<String> exposedPaperTypeList = new ArrayList<>(Arrays.asList(taskDetail.getExposedPaperType().split(",")));
|
|
|
- List<String> unexposedPaperTypeList = StringUtils.isNotBlank(taskDetail.getUnexposedPaperType()) ? new ArrayList<>(Arrays.asList(taskDetail.getUnexposedPaperType().split(","))) : new ArrayList<>();
|
|
|
- for (String exposePaperType : paperTypeSet) {
|
|
|
- if (exposedPaperTypeList.contains(exposePaperType)) {
|
|
|
- exposedPaperTypeList.remove(exposePaperType);
|
|
|
- unexposedPaperTypeList.add(exposePaperType);
|
|
|
- }
|
|
|
+ // 已打印任务,必须先作废,未打印任务,必须先撤回。才允许打回
|
|
|
+ long count = examDetailList.stream().filter(m -> ExamDetailStatusEnum.FINISH.equals(m.getStatus()) || ExamDetailStatusEnum.WAITING.equals(m.getStatus())).count();
|
|
|
+ if (count > 0) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷任务有已打印或待印刷数据,无法打回");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 修改已曝光和未曝光类型
|
|
|
+ List<String> exposedPaperTypeList = new ArrayList<>(Arrays.asList(taskDetail.getExposedPaperType().split(",")));
|
|
|
+ List<String> unexposedPaperTypeList = StringUtils.isNotBlank(taskDetail.getUnexposedPaperType()) ? new ArrayList<>(Arrays.asList(taskDetail.getUnexposedPaperType().split(","))) : new ArrayList<>();
|
|
|
+ for (String exposePaperType : paperTypeSet) {
|
|
|
+ if (exposedPaperTypeList.contains(exposePaperType)) {
|
|
|
+ exposedPaperTypeList.remove(exposePaperType);
|
|
|
+ unexposedPaperTypeList.add(exposePaperType);
|
|
|
}
|
|
|
- exposedPaperTypeList.sort(Comparator.comparing(String::toString));
|
|
|
- unexposedPaperTypeList.sort(Comparator.comparing(String::toString));
|
|
|
- taskDetail.setExposedPaperType(CollectionUtils.isEmpty(exposedPaperTypeList) ? null : String.join(",", exposedPaperTypeList));
|
|
|
- taskDetail.setUnexposedPaperType(String.join(",", unexposedPaperTypeList));
|
|
|
- taskDetail.setRelatePaperType(null);
|
|
|
- this.updateById(taskDetail);
|
|
|
}
|
|
|
+ exposedPaperTypeList.sort(Comparator.comparing(String::toString));
|
|
|
+ unexposedPaperTypeList.sort(Comparator.comparing(String::toString));
|
|
|
+ taskDetail.setExposedPaperType(CollectionUtils.isEmpty(exposedPaperTypeList) ? null : String.join(",", exposedPaperTypeList));
|
|
|
+ taskDetail.setUnexposedPaperType(String.join(",", unexposedPaperTypeList));
|
|
|
+ taskDetail.setRelatePaperType(null);
|
|
|
+ this.updateById(taskDetail);
|
|
|
|
|
|
StringJoiner stringJoiner = new StringJoiner("_");
|
|
|
stringJoiner.add(String.valueOf(examTask.getExamId())).add(examTask.getPaperNumber()).add(String.valueOf(examDetailList.get(0).getExamStartTime())).add(String.valueOf(examDetailList.get(0).getExamEndTime()));
|
|
@@ -687,6 +680,30 @@ public class ExamTaskDetailServiceImpl extends ServiceImpl<ExamTaskDetailMapper,
|
|
|
return this.getByExamTaskId(examTask.getId());
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public void updateExposePaperType(Long examId, List<ExamDetailCourse> examDetailCourses) {
|
|
|
+ // 更新曝光卷型、未曝光卷型
|
|
|
+ for (ExamDetailCourse examDetailCourse : examDetailCourses) {
|
|
|
+ ExamTaskDetail examTaskDetail = this.getByExamIdAndCourseCodeAndPaperNumber(examId, examDetailCourse.getCourseCode(), examDetailCourse.getPaperNumber());
|
|
|
+ // 考生使用卷型
|
|
|
+ List<String> studentPaperTypes = examStudentService.listPaperTypeByExamDetailCourseId(String.valueOf(examDetailCourse.getId()));
|
|
|
+ List<String> paperTypeList = Objects.isNull(examTaskDetail.getPaperType()) ? new ArrayList<>() : Arrays.asList(examTaskDetail.getPaperType().split(","));
|
|
|
+ List<String> exposedPaperTypeList = Objects.isNull(examTaskDetail.getExposedPaperType()) ? new ArrayList<>() : Arrays.asList(examTaskDetail.getExposedPaperType().split(","));
|
|
|
+ // 曝光卷型
|
|
|
+ List<String> unionList = (List<String>) CollectionUtils.union(exposedPaperTypeList, studentPaperTypes);
|
|
|
+ // 未曝光卷型
|
|
|
+ List<String> subtractList = (List<String>) CollectionUtils.subtract(paperTypeList, unionList);
|
|
|
+ UpdateWrapper<ExamTaskDetail> examTaskDetailUpdateWrapper = new UpdateWrapper<>();
|
|
|
+ String exposedPaper = String.join(",", unionList);
|
|
|
+ String unexposedPaper = String.join(",", subtractList);
|
|
|
+ examTaskDetailUpdateWrapper.lambda()
|
|
|
+ .set(ExamTaskDetail::getExposedPaperType, StringUtils.isBlank(exposedPaper) ? null : exposedPaper)
|
|
|
+ .set(ExamTaskDetail::getUnexposedPaperType, StringUtils.isBlank(unexposedPaper) ? null : unexposedPaper)
|
|
|
+ .eq(ExamTaskDetail::getExamTaskId, examTaskDetail.getExamTaskId());
|
|
|
+ this.update(examTaskDetailUpdateWrapper);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 卷库校验
|
|
|
*
|