|
@@ -4,14 +4,14 @@ import com.alibaba.fastjson.JSONObject;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.google.gson.Gson;
|
|
import com.google.gson.Gson;
|
|
import com.qmth.distributed.print.business.bean.dto.excel.UserImportDto;
|
|
import com.qmth.distributed.print.business.bean.dto.excel.UserImportDto;
|
|
-import com.qmth.distributed.print.business.entity.BasicSchool;
|
|
|
|
-import com.qmth.distributed.print.business.entity.SysUser;
|
|
|
|
-import com.qmth.distributed.print.business.service.BasicSchoolService;
|
|
|
|
-import com.qmth.distributed.print.business.service.CommonService;
|
|
|
|
-import com.qmth.distributed.print.business.service.SysUserService;
|
|
|
|
|
|
+import com.qmth.distributed.print.business.entity.*;
|
|
|
|
+import com.qmth.distributed.print.business.enums.ExamCardStatusEnum;
|
|
|
|
+import com.qmth.distributed.print.business.enums.ExamStatusEnum;
|
|
|
|
+import com.qmth.distributed.print.business.service.*;
|
|
import com.qmth.distributed.print.business.templete.service.TaskLogicService;
|
|
import com.qmth.distributed.print.business.templete.service.TaskLogicService;
|
|
import com.qmth.distributed.print.business.util.ServletUtil;
|
|
import com.qmth.distributed.print.business.util.ServletUtil;
|
|
import com.qmth.distributed.print.business.util.excel.ExcelError;
|
|
import com.qmth.distributed.print.business.util.excel.ExcelError;
|
|
|
|
+import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
|
|
import com.qmth.distributed.print.common.enums.ExceptionResultEnum;
|
|
import com.qmth.distributed.print.common.util.Base64Util;
|
|
import com.qmth.distributed.print.common.util.Base64Util;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -22,6 +22,8 @@ import javax.annotation.Resource;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
|
|
+import java.util.Set;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 任务处理逻辑impl
|
|
* @Description: 任务处理逻辑impl
|
|
@@ -42,6 +44,30 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
@Resource
|
|
@Resource
|
|
CommonService commonService;
|
|
CommonService commonService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ ExamDetailService detailService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ ExamDetailCourseService detailCourseService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ ExamPrintPlanService examPrintPlanService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ ExamTaskService examTaskService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ ExamTaskDetailService examTaskDetailService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ ExamCardService examCardService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ ExamCardDetailService examCardDetailService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ ExamStudentService examStudentService;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 执行导入用户逻辑
|
|
* 执行导入用户逻辑
|
|
*
|
|
*
|
|
@@ -100,7 +126,73 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional
|
|
public Map<String, Object> executeCreatePdfLogic(Map<String, Object> map) {
|
|
public Map<String, Object> executeCreatePdfLogic(Map<String, Object> map) {
|
|
- return null;
|
|
|
|
|
|
+ TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
|
|
|
|
+ SysUser sysUser = (SysUser) map.get(SystemConstant.USER);
|
|
|
|
+ //查询printPlan
|
|
|
|
+ ExamPrintPlan examPrintPlan = examPrintPlanService.getById(tbTask.getPrintPlanId());
|
|
|
|
+ if (Objects.isNull(examPrintPlan)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("印刷计划为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //查询examDetail
|
|
|
|
+ QueryWrapper<ExamDetail> examDetailQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ examDetailQueryWrapper.lambda().eq(ExamDetail::getSchoolId, sysUser.getSchoolId())
|
|
|
|
+ .eq(ExamDetail::getPrintPlanId, tbTask.getPrintPlanId());
|
|
|
|
+ ExamDetail examDetail = detailService.getOne(examDetailQueryWrapper);
|
|
|
|
+ if (Objects.isNull(examDetail)) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("考务计划为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //查询examDetailCourse
|
|
|
|
+ QueryWrapper<ExamDetailCourse> examDetailCourseQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ examDetailCourseQueryWrapper.lambda().eq(ExamDetailCourse::getExamDetailId, examDetail.getId());
|
|
|
|
+ List<ExamDetailCourse> examDetailCourseList = detailCourseService.list(examDetailCourseQueryWrapper);
|
|
|
|
+
|
|
|
|
+ for (ExamDetailCourse examDetailCourse : examDetailCourseList) {
|
|
|
|
+ //查询试卷
|
|
|
|
+ QueryWrapper<ExamTask> examTaskQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ examTaskQueryWrapper.lambda().eq(ExamTask::getSchoolId, sysUser.getSchoolId())
|
|
|
|
+ .eq(ExamTask::getCourseCode, examDetailCourse.getCourseCode())
|
|
|
|
+ .eq(ExamTask::getCourseName, examDetailCourse.getCourseName())
|
|
|
|
+ .eq(ExamTask::getPaperNumber, examDetailCourse.getPaperNumber())
|
|
|
|
+ .eq(ExamTask::getEnable, true)
|
|
|
|
+ .eq(ExamTask::getStatus, ExamStatusEnum.FINISH);
|
|
|
|
+ List<ExamTask> examTaskList = examTaskService.list(examTaskQueryWrapper);
|
|
|
|
+ if (Objects.isNull(examTaskList) || examTaskList.size() == 0) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("命题任务为空");
|
|
|
|
+ }
|
|
|
|
+ Set<Long> examTaskIds = examTaskList.stream().map(s -> s.getId()).collect(Collectors.toSet());
|
|
|
|
+
|
|
|
|
+ QueryWrapper<ExamTaskDetail> examTaskDetailQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ examTaskDetailQueryWrapper.lambda().in(ExamTaskDetail::getExamTaskId, examTaskIds)
|
|
|
|
+ .eq(ExamTaskDetail::getEnable, true);
|
|
|
|
+ List<ExamTaskDetail> examTaskDetailList = examTaskDetailService.list(examTaskDetailQueryWrapper);
|
|
|
|
+ Set<Long> examTaskDetailIds = examTaskDetailList.stream().map(s -> s.getId()).collect(Collectors.toSet());
|
|
|
|
+
|
|
|
|
+ //查询题卡
|
|
|
|
+ QueryWrapper<ExamCard> examCardQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ examCardQueryWrapper.lambda().eq(ExamCard::getSchoolId, sysUser.getSchoolId())
|
|
|
|
+ .eq(ExamCard::getCourseCode, examDetailCourse.getCourseCode())
|
|
|
|
+ .eq(ExamCard::getCourseName, examDetailCourse.getCourseName())
|
|
|
|
+ .eq(ExamCard::getStatus, ExamCardStatusEnum.SUBMIT);
|
|
|
|
+ List<ExamCard> examCardList = examCardService.list(examCardQueryWrapper);
|
|
|
|
+ if (Objects.isNull(examCardList) || examCardList.size() == 0) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("题卡为空");
|
|
|
|
+ }
|
|
|
|
+ Set<Long> examCardIds = examCardList.stream().map(s -> s.getId()).collect(Collectors.toSet());
|
|
|
|
+
|
|
|
|
+ QueryWrapper<ExamCardDetail> examCardDetailQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ examCardDetailQueryWrapper.lambda().in(ExamCardDetail::getCardId, examCardIds);
|
|
|
|
+ List<ExamCardDetail> examCardDetailList = examCardDetailService.list(examCardDetailQueryWrapper);
|
|
|
|
+
|
|
|
|
+ //查询考生
|
|
|
|
+ QueryWrapper<ExamStudent> examStudentQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ examStudentQueryWrapper.lambda().eq(ExamStudent::getSchoolId, sysUser.getSchoolId())
|
|
|
|
+ .in(ExamStudent::getExamDetailCourseId, examTaskDetailIds);
|
|
|
|
+ List<ExamStudent> examStudentList = examStudentService.list(examStudentQueryWrapper);
|
|
|
|
+ }
|
|
|
|
+ return map;
|
|
}
|
|
}
|
|
}
|
|
}
|