|
@@ -11,6 +11,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.gson.Gson;
|
|
|
import com.qmth.boot.tools.excel.ExcelReader;
|
|
|
+import com.qmth.boot.tools.excel.ExcelWriter;
|
|
|
import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
|
import com.qmth.distributed.print.business.bean.dto.approvalForm.*;
|
|
@@ -30,7 +31,6 @@ import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.distributed.print.business.templete.execute.AsyncPaperReviewPdfExportService;
|
|
|
import com.qmth.distributed.print.business.util.CreatePdfUtil;
|
|
|
import com.qmth.distributed.print.business.util.ExamTaskUtil;
|
|
|
-import com.qmth.distributed.print.business.util.HtmlToJpgUtil;
|
|
|
import com.qmth.distributed.print.business.util.PdfUtil;
|
|
|
import com.qmth.teachcloud.common.bean.dto.AssignTeacherDto;
|
|
|
import com.qmth.teachcloud.common.bean.dto.BlurryUserDto;
|
|
@@ -49,7 +49,8 @@ import com.qmth.teachcloud.common.kit.TikuUtils;
|
|
|
import com.qmth.teachcloud.common.service.*;
|
|
|
import com.qmth.teachcloud.common.util.*;
|
|
|
import com.qmth.teachcloud.common.util.excel.ExcelError;
|
|
|
-import jdk.nashorn.internal.runtime.regexp.joni.ast.StringNode;
|
|
|
+import com.qmth.teachcloud.mark.enums.LockType;
|
|
|
+import com.qmth.teachcloud.mark.lock.LockService;
|
|
|
import org.activiti.engine.ActivitiObjectNotFoundException;
|
|
|
import org.activiti.engine.TaskService;
|
|
|
import org.activiti.engine.task.Task;
|
|
@@ -66,12 +67,14 @@ import org.springframework.util.LinkedMultiValueMap;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
@@ -117,7 +120,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
@Resource
|
|
|
private ExamDetailService examDetailService;
|
|
|
@Resource
|
|
|
- private HtmlToJpgUtil htmlToJpgUtil;
|
|
|
+ private ExamSyncService examSyncService;
|
|
|
@Resource
|
|
|
TBTaskService tbTaskService;
|
|
|
@Resource
|
|
@@ -172,6 +175,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
private FileUploadService fileUploadService;
|
|
|
@Resource
|
|
|
private TikuUtils tikuUtils;
|
|
|
+ @Resource
|
|
|
+ private LockService lockService;
|
|
|
|
|
|
@Override
|
|
|
public IPage<ExamTaskDto> list(Long semesterId, Long examId, Boolean enable, String status, Long openCollegeId, Long courseId, String paperNumber, Long startTime, Long endTime, String userName, Integer pageNumber, Integer pageSize) {
|
|
@@ -2030,6 +2035,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
public List<ExamDetail> matchBasicExamStudent(BasicExam basicExam, ExamTask examTask, SysUser sysUser) {
|
|
|
List<BasicExamStudent> basicExamStudentList = basicExamStudentService.listByExamIdAndCourseIdAndPaperNumber(examTask.getExamId(), examTask.getCourseId(), examTask.getPaperNumber());
|
|
|
if (CollectionUtils.isEmpty(basicExamStudentList)) {
|
|
|
+ logger.info("考试:{},试卷编号:{}未查询到考生", basicExam.getName(), examTask.getPaperNumber());
|
|
|
return null;
|
|
|
}
|
|
|
// 创建印刷计划
|
|
@@ -2394,6 +2400,47 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public boolean relateStudentByExamId(Long examId) {
|
|
|
+ BasicExam basicExam = basicExamService.getById(examId);
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+
|
|
|
+ if (basicExam != null) {
|
|
|
+ if (lockService.trylock(LockType.RELATE_STUDENTS, basicExam.getId())) {
|
|
|
+ examSyncService.relateStudentByExamTask(basicExam, sysUser);
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("关联考生任务正在进行中,请稍后再试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<ExamTask> listUnRelateStudentExamTask(Long examId) {
|
|
|
+ return this.baseMapper.listUnRelateStudentExamTask(examId);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void export(Long semesterId, Long examId, Long openCollegeId, Long courseId, String paperNumber, Long startTime, Long endTime, HttpServletResponse response) {
|
|
|
+ List<ExamTaskDetailDto> dtoList = this.listTaskPaper(semesterId, examId, openCollegeId, courseId, paperNumber, startTime, endTime);
|
|
|
+ try {
|
|
|
+ log.debug("导出Excel开始...");
|
|
|
+ response.setHeader("Content-Disposition",
|
|
|
+ "inline;filename=" + URLEncoder.encode("成绩导出", SystemConstant.CHARSET_NAME) + ".xlsx");
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
+ ServletOutputStream outputStream = response.getOutputStream();
|
|
|
+ ExcelWriter writer = ExcelWriter.create(ExcelType.XLSX);
|
|
|
+ writer.writeObjects("试卷清单", null, ExamTaskDetailDto.class, dtoList.listIterator());
|
|
|
+ writer.output(response.getOutputStream());
|
|
|
+ outputStream.flush();
|
|
|
+ outputStream.close();
|
|
|
+ log.debug("导出Excel结束");
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new RuntimeException(e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
private ExamTaskPaperData saveTikuPaperData(Long examId, Long paperId, String uuid, File zipFile) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
String zipDestPath = null;
|