|
@@ -1,24 +1,27 @@
|
|
|
package com.qmth.distributed.print.api;
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
|
import com.qmth.distributed.print.business.bean.params.ArraysParams;
|
|
|
+import com.qmth.distributed.print.business.bean.result.EditResult;
|
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
|
import com.qmth.distributed.print.business.enums.*;
|
|
|
import com.qmth.distributed.print.business.service.*;
|
|
|
+import com.qmth.distributed.print.business.templete.execute.AsyncPaperReviewPdfExportService;
|
|
|
import com.qmth.distributed.print.business.templete.execute.AsyncTaskReviewSampleExportService;
|
|
|
import com.qmth.distributed.print.business.util.ServletUtil;
|
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
|
import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.distributed.print.common.util.Result;
|
|
|
import com.qmth.distributed.print.common.util.ResultUtil;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
-import io.swagger.annotations.ApiParam;
|
|
|
+import io.swagger.annotations.*;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -66,6 +69,10 @@ public class ExamTaskController {
|
|
|
|
|
|
@Resource
|
|
|
private BasicMessageService basicMessageService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ AsyncPaperReviewPdfExportService asyncPaperReviewPdfExportService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询
|
|
|
*
|
|
@@ -159,7 +166,7 @@ public class ExamTaskController {
|
|
|
public Result save(@RequestBody ExamTask examTask) {
|
|
|
ExamTask task = examTaskService.saveExamTask(examTask);
|
|
|
//发送短信
|
|
|
- if(task.getId() != null){
|
|
|
+ if (task.getId() != null) {
|
|
|
basicMessageService.sendNoticeTaskCreate(task);
|
|
|
}
|
|
|
return ResultUtil.ok(true);
|
|
@@ -206,7 +213,7 @@ public class ExamTaskController {
|
|
|
@RequestMapping(value = "/save_batch", method = RequestMethod.POST)
|
|
|
public Result saveBatch(@RequestBody ExamTask task) {
|
|
|
List<ExamTask> examTasks = examTaskService.saveBatch(task);
|
|
|
- if(examTasks != null && examTasks.size() > 0){
|
|
|
+ if (examTasks != null && examTasks.size() > 0) {
|
|
|
// 发送短信
|
|
|
ExamTask[] tasks = examTasks.toArray(new ExamTask[examTasks.size()]);
|
|
|
basicMessageService.sendNoticeTaskCreate(tasks);
|
|
@@ -291,7 +298,7 @@ public class ExamTaskController {
|
|
|
commonService.checkData(examTask.getSchoolId(), examTask.getCourseCode(), examTask.getPaperNumber(), (SysUser) ServletUtil.getRequestUser());
|
|
|
}
|
|
|
//待审核状态,发送短信
|
|
|
- if(ExamStatusEnum.SUBMIT.equals(examTask.getStatus())){
|
|
|
+ if (ExamStatusEnum.SUBMIT.equals(examTask.getStatus())) {
|
|
|
basicMessageService.sendNoticeTaskAuditCreateOrReview(examTask, MessageEnum.NOTICE_OF_AUDIT_CREATED);
|
|
|
}
|
|
|
|
|
@@ -384,10 +391,10 @@ public class ExamTaskController {
|
|
|
// 校验是否可以提交打印状态
|
|
|
commonService.checkData(examTask.getSchoolId(), examTask.getCourseCode(), examTask.getPaperNumber(), sysUser);
|
|
|
// 发送审核通过短信通知
|
|
|
- basicMessageService.noticeOfExamTaskAudit(examTaskIdList, MessageEnum.NOTICE_OF_AUDIT_PASS,sysUser);
|
|
|
- }else if (isSuccess && taskReviewLog.getReviewStatus().name().equals(ReviewStatusEnum.NOT_PASS.name())){
|
|
|
+ basicMessageService.noticeOfExamTaskAudit(examTaskIdList, MessageEnum.NOTICE_OF_AUDIT_PASS, sysUser);
|
|
|
+ } else if (isSuccess && taskReviewLog.getReviewStatus().name().equals(ReviewStatusEnum.NOT_PASS.name())) {
|
|
|
// 发送审核不通过短信通知
|
|
|
- basicMessageService.noticeOfExamTaskAudit(examTaskIdList, MessageEnum.NOTICE_OF_AUDIT_NOT_PASS,sysUser);
|
|
|
+ basicMessageService.noticeOfExamTaskAudit(examTaskIdList, MessageEnum.NOTICE_OF_AUDIT_NOT_PASS, sysUser);
|
|
|
}
|
|
|
return ResultUtil.ok(isSuccess);
|
|
|
}
|
|
@@ -406,10 +413,10 @@ public class ExamTaskController {
|
|
|
boolean isSuccess = examTaskService.taskReviewSaveBatch(taskReviewLog);
|
|
|
if (isSuccess && taskReviewLog.getReviewStatus().name().equals(ReviewStatusEnum.PASS.name())) {
|
|
|
// 发送审核通过短信通知
|
|
|
- basicMessageService.noticeOfExamTaskAudit(examTaskIdList, MessageEnum.NOTICE_OF_AUDIT_PASS,sysUser);
|
|
|
- }else if (isSuccess && taskReviewLog.getReviewStatus().name().equals(ReviewStatusEnum.NOT_PASS.name())){
|
|
|
+ basicMessageService.noticeOfExamTaskAudit(examTaskIdList, MessageEnum.NOTICE_OF_AUDIT_PASS, sysUser);
|
|
|
+ } else if (isSuccess && taskReviewLog.getReviewStatus().name().equals(ReviewStatusEnum.NOT_PASS.name())) {
|
|
|
// 发送审核不通过短信通知
|
|
|
- basicMessageService.noticeOfExamTaskAudit(examTaskIdList, MessageEnum.NOTICE_OF_AUDIT_NOT_PASS,sysUser);
|
|
|
+ basicMessageService.noticeOfExamTaskAudit(examTaskIdList, MessageEnum.NOTICE_OF_AUDIT_NOT_PASS, sysUser);
|
|
|
}
|
|
|
return ResultUtil.ok(isSuccess);
|
|
|
}
|
|
@@ -422,7 +429,7 @@ public class ExamTaskController {
|
|
|
}
|
|
|
Long[] ids = arraysParams.getIds();
|
|
|
Map<String, Object> map = tbTaskService.saveTask(TaskTypeEnum.SAMPLE_EXPORT);
|
|
|
- map.put("ids",ids);
|
|
|
+ map.put("ids", ids);
|
|
|
asyncTaskReviewSampleExportService.exportTask(map);
|
|
|
TBTask tbTask = Objects.nonNull(map.get(SystemConstant.TASK)) ? (TBTask) map.get(SystemConstant.TASK) : null;
|
|
|
return Objects.nonNull(tbTask) ? ResultUtil.ok(tbTask.getId()) : ResultUtil.error("创建任务失败");
|
|
@@ -454,6 +461,7 @@ public class ExamTaskController {
|
|
|
|
|
|
/**
|
|
|
* 下载
|
|
|
+ *
|
|
|
* @param response
|
|
|
* @param examTaskId
|
|
|
*/
|
|
@@ -474,13 +482,13 @@ public class ExamTaskController {
|
|
|
public Result taskPaperEnable(@RequestBody ExamTaskDetail examTaskDetail) throws IOException {
|
|
|
boolean isSuccess = examTaskDetailService.enable(examTaskDetail);
|
|
|
// 启用,触发考场生成pdf
|
|
|
- if(examTaskDetail.getEnable()){
|
|
|
+ if (examTaskDetail.getEnable()) {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
ExamTask examTask = examTaskService.getById(examTaskDetail.getId());
|
|
|
// 校验课程关联考场,是否已经提交打印
|
|
|
Boolean isCreate = commonService.checkExamDetailStatus(examTask.getSchoolId(), null, examTask.getCourseCode(), examTask.getPaperNumber());
|
|
|
// 校验是否可以提交打印状态
|
|
|
- if(isCreate) {
|
|
|
+ if (isCreate) {
|
|
|
commonService.checkData(examTask.getSchoolId(), examTask.getCourseCode(), examTask.getPaperNumber(), sysUser);
|
|
|
}
|
|
|
}
|
|
@@ -489,6 +497,7 @@ public class ExamTaskController {
|
|
|
|
|
|
/**
|
|
|
* 卷库查询-卷库修改
|
|
|
+ *
|
|
|
* @param examTaskDetail
|
|
|
* @return
|
|
|
*/
|
|
@@ -496,9 +505,9 @@ public class ExamTaskController {
|
|
|
@RequestMapping(value = "/paper_update", method = RequestMethod.POST)
|
|
|
public Result taskPaperUpdate(@RequestBody ExamTaskDetail examTaskDetail) throws IOException {
|
|
|
boolean isSuccess = examTaskDetailService.paperUpdate(examTaskDetail);
|
|
|
- if(isSuccess){
|
|
|
+ if (isSuccess) {
|
|
|
ExamTask examTask = examTaskService.getById(examTaskDetail.getExamTaskId());
|
|
|
- if(examTask.getReview()){
|
|
|
+ if (examTask.getReview()) {
|
|
|
// 发送短信
|
|
|
basicMessageService.sendNoticeTaskAuditCreateOrReview(examTask, MessageEnum.NOTICE_OF_AUDIT_REVIEW);
|
|
|
} else {
|
|
@@ -506,12 +515,45 @@ public class ExamTaskController {
|
|
|
// 校验课程关联考场,是否已经提交打印
|
|
|
Boolean isCreate = commonService.checkExamDetailStatus(examTask.getSchoolId(), null, examTask.getCourseCode(), examTask.getPaperNumber());
|
|
|
// 校验是否可以提交打印状态
|
|
|
- if(isCreate) {
|
|
|
+ if (isCreate) {
|
|
|
commonService.checkData(examTask.getSchoolId(), examTask.getCourseCode(), examTask.getPaperNumber(), sysUser);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return ResultUtil.ok(isSuccess);
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation(value = "卷库查询-批量下载试卷PDF、题卡")
|
|
|
+ @RequestMapping(value = "/task_download_pdf", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "返回信息", response = EditResult.class)})
|
|
|
+ public Result taskDownloadPdf(@RequestParam(value = "courseCode", required = false) String courseCode,
|
|
|
+ @RequestParam(value = "paperNumber", required = false) String paperNumber,
|
|
|
+ @RequestParam(value = "startTime", required = false) Long startTime,
|
|
|
+ @RequestParam(value = "endTime", required = false) Long endTime) throws Exception {
|
|
|
+ Long schoolId = Long.valueOf(ServletUtil.getRequestHeaderSchoolId().toString());
|
|
|
+ QueryWrapper<ExamTask> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.lambda().eq(ExamTask::getSchoolId, schoolId).eq(ExamTask::getStatus, ExamStatusEnum.FINISH);
|
|
|
+ if(StringUtils.isNotBlank(courseCode)){
|
|
|
+ queryWrapper.lambda().eq(ExamTask::getCourseCode, courseCode);
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotBlank(paperNumber)){
|
|
|
+ queryWrapper.lambda().eq(ExamTask::getPaperNumber, paperNumber);
|
|
|
+ }
|
|
|
+ if(startTime != null){
|
|
|
+ queryWrapper.lambda().ge(ExamTask::getCreateTime, startTime);
|
|
|
+ }
|
|
|
+ if(endTime != null){
|
|
|
+ queryWrapper.lambda().le(ExamTask::getCreateTime, endTime);
|
|
|
+ }
|
|
|
+ List<ExamTask> examTasks = examTaskService.list(queryWrapper);
|
|
|
+ if (CollectionUtils.isEmpty(examTasks)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("没有可导出数据");
|
|
|
+ }
|
|
|
+ Map<String, Object> map = tbTaskService.saveTask(TaskTypeEnum.PAPER_AND_CARD_PDF_DOWNLOAD, null, (SysUser) ServletUtil.getRequestUser());
|
|
|
+ map.put("examTasks", examTasks);
|
|
|
+ asyncPaperReviewPdfExportService.exportTask(map);
|
|
|
+ TBTask tbTask = Objects.nonNull(map.get(SystemConstant.TASK)) ? (TBTask) map.get(SystemConstant.TASK) : null;
|
|
|
+ return Objects.nonNull(tbTask) ? ResultUtil.ok(new EditResult(tbTask.getId())) : ResultUtil.error("创建任务失败");
|
|
|
+ }
|
|
|
}
|
|
|
|