|
@@ -1,5 +1,6 @@
|
|
|
package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
@@ -13,15 +14,19 @@ import com.qmth.distributed.print.business.bean.dto.approvalForm.*;
|
|
|
import com.qmth.distributed.print.business.bean.dto.examObject.ExamObjectDto;
|
|
|
import com.qmth.distributed.print.business.bean.params.*;
|
|
|
import com.qmth.distributed.print.business.bean.result.WorkResult;
|
|
|
+import com.qmth.distributed.print.business.bean.result.examTaskStudent.ExamTaskStudentObjectResult;
|
|
|
+import com.qmth.distributed.print.business.bean.result.examTaskStudent.StudentInfo;
|
|
|
import com.qmth.distributed.print.business.entity.*;
|
|
|
import com.qmth.distributed.print.business.enums.*;
|
|
|
import com.qmth.distributed.print.business.mapper.ExamTaskMapper;
|
|
|
import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.distributed.print.business.templete.execute.AsyncPaperReviewPdfExportService;
|
|
|
+import com.qmth.distributed.print.business.templete.service.TaskLogicService;
|
|
|
import com.qmth.distributed.print.business.util.CreatePdfUtil;
|
|
|
import com.qmth.distributed.print.business.util.HtmlToPdfUtil;
|
|
|
import com.qmth.teachcloud.common.bean.dto.BlurryUserDto;
|
|
|
import com.qmth.teachcloud.common.bean.dto.MqDto;
|
|
|
+import com.qmth.teachcloud.common.bean.result.BasicStudentResult;
|
|
|
import com.qmth.teachcloud.common.config.DictionaryConfig;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.*;
|
|
@@ -51,6 +56,7 @@ import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -186,6 +192,24 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
@Resource
|
|
|
DictionaryConfig dictionaryConfig;
|
|
|
|
|
|
+ @Resource
|
|
|
+ TeachStudentService teachStudentService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TeachClazzService teachClazzService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ BasicStudentService basicStudentService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ BasicClazzService basicClazzService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TeachCourseService teachCourseService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TaskLogicService taskLogicService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<ExamTask> listByCourseCode(Long schoolId, String code) {
|
|
|
QueryWrapper<ExamTask> queryWrapper = new QueryWrapper<>();
|
|
@@ -1581,7 +1605,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
examDetailCourseService.save(examDetailCourse);
|
|
|
|
|
|
// 更新实际考生数量
|
|
|
- List<ExamStudent> examStudents = printCommonService.createBatchStudent(schoolId, examDetailList.getExtendFields(), classIds, examDetailCourse.getId(), sysUser);
|
|
|
+ List<ExamTaskStudentObjectParam> examTaskStudentObjectParamList = examDetailList.getExamTaskStudentObjectParamList();
|
|
|
+ List<ExamStudent> examStudents = printCommonService.createBatchStudentByStudentList(schoolId,examDetailList.getExtendFields(),examTaskStudentObjectParamList,examDetailCourse.getId(),sysUser);
|
|
|
if (!CollectionUtils.isEmpty(examStudents)) {
|
|
|
examStudentService.insertBatch(examStudents);
|
|
|
}
|
|
@@ -1672,26 +1697,24 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
String paperNumber = examTask.getPaperNumber();
|
|
|
String paperName = basicSemesterService.getById(basicExamService.getById(examTask.getExamId()).getSemesterId()).getName();
|
|
|
Long teachingRoomId = examTask.getTeachingRoomId();
|
|
|
-// SysOrg teachingRoom = sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getId, teachingRoomId).eq(SysOrg::getType, OrgTypeEnum.TEACHING_ROOM));
|
|
|
-// if (Objects.isNull(teachingRoom)) {
|
|
|
-// throw ExceptionResultEnum.ERROR.exception("找不到教研室");
|
|
|
-// }
|
|
|
- SysOrg teachingRoom = null;
|
|
|
+ SysOrg teachingRoom = sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getId, teachingRoomId));
|
|
|
+ if (Objects.isNull(teachingRoom)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("找不到教研室");
|
|
|
+ }
|
|
|
String teachingRoomName = teachingRoom.getName();
|
|
|
|
|
|
// 查询教研室所在学院
|
|
|
-// List<SysOrg> collegeList = sysOrgService.findParentsByOrgId(teachingRoom.getId())
|
|
|
-// .stream()
|
|
|
-// .filter(e -> OrgTypeEnum.COLLEGE.equals(e.getType()))
|
|
|
-// .collect(Collectors.toList());
|
|
|
- List<SysOrg> collegeList = null;
|
|
|
-// List<SysOrg> collegeList = sysOrgService.findByConnectByParentId(teachingRoom.getId(),true)
|
|
|
-// .stream()
|
|
|
-// .filter(e -> OrgTypeEnum.COLLEGE.equals(e.getType()))
|
|
|
-// .collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isEmpty(collegeList)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("找不到学院");
|
|
|
+ List<SysOrg> orgList = sysOrgService.findParentsByOrgId(teachingRoom.getId());
|
|
|
+ List<SysOrg> schoolOrgList = orgList.stream().filter(e -> OrgTypeEnum.SCHOOL.equals(e.getType())).collect(Collectors.toList());
|
|
|
+ if (schoolOrgList.size() != 1){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("学校级机构信息异常");
|
|
|
+ }
|
|
|
+ SysOrg schoolOrg = schoolOrgList.get(0);
|
|
|
+ List<SysOrg> collegeList = orgList.stream().filter(e -> Objects.equals(schoolOrg.getId(), e.getParentId())).collect(Collectors.toList());
|
|
|
+ if (collegeList.size() != 1){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("学院级机构信息异常");
|
|
|
}
|
|
|
+
|
|
|
SysOrg college = collegeList.get(0);
|
|
|
|
|
|
|
|
@@ -1708,9 +1731,6 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
}
|
|
|
|
|
|
// 2.ExamRoomInfo 部分
|
|
|
-// List<PrintPlanStatusEnum> printPlanStatusEnumList = new ArrayList<>();
|
|
|
-// printPlanStatusEnumList.add(PrintPlanStatusEnum.PRINTING);
|
|
|
-// printPlanStatusEnumList.add(PrintPlanStatusEnum.PRINT_FINISH);
|
|
|
List<ExamPackageDetail> examPackageDetailDatasource = this.baseMapper.findExamPackageDetailByPaperNumber(schoolId, examTask.getExamId(), examTask.getCourseCode(), paperNumber, null);
|
|
|
if (examPackageDetailDatasource.size() == 0) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("缺少该命题任务对应的考务数据");
|
|
@@ -1818,6 +1838,132 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
return this.baseMapper.getByExamTaskId(examTaskId);
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ @Override
|
|
|
+ public List<ExamTaskStudentObjectResult> findExamTaskStudentObject(ExamObjectType examObjectType, Long basicCourseId, MultipartFile file, SysUser requestUser) throws Exception {
|
|
|
+ Long schoolId = requestUser.getSchoolId();
|
|
|
+ Long userId = requestUser.getId();
|
|
|
+ List<ExamTaskStudentObjectResult> result = new ArrayList<>();
|
|
|
+ switch (examObjectType) {
|
|
|
+ case TEACH_CLAZZ_STUDENT:
|
|
|
+ TeachCourse teachCourse = teachCourseService.getOne(new QueryWrapper<TeachCourse>().lambda().eq(TeachCourse::getSchoolId,schoolId).eq(TeachCourse::getBasicCourseId,basicCourseId));
|
|
|
+ if (Objects.isNull(teachCourse)){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到教学课程");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 教学班对象
|
|
|
+ List<TeachStudent> teachStudentDatasource = teachStudentService.list(new QueryWrapper<TeachStudent>().lambda().eq(TeachStudent::getSchoolId, schoolId).eq(TeachStudent::getUserId, userId).eq(TeachStudent::getTeachCourseId,teachCourse.getId()));
|
|
|
+
|
|
|
+ // 教学班id集合
|
|
|
+ List<Long> teachClazzIdList = teachStudentDatasource.stream().map(TeachStudent::getTeachClazzId).distinct().collect(Collectors.toList());
|
|
|
+ for (Long teachClazzId : teachClazzIdList) {
|
|
|
+ TeachClazz teachClazz = teachClazzService.getById(teachClazzId);
|
|
|
+ if (Objects.isNull(teachClazz)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("教学班数据异常");
|
|
|
+ }
|
|
|
+ List<TeachStudent> teachStudentList = teachStudentDatasource.stream().filter(e -> e.getTeachClazzId().equals(teachClazzId)).collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 获取学生信息数据
|
|
|
+ List<StudentInfo> studentInfoList = teachStudentList.stream().flatMap(e -> {
|
|
|
+ Long studentId = e.getStudentId();
|
|
|
+ if (!SystemConstant.longNotNull(studentId)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("教学学生数据异常");
|
|
|
+ }
|
|
|
+ BasicStudentResult basicStudentResult = basicStudentService.findById(studentId);
|
|
|
+ if (Objects.isNull(basicStudentResult)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("未找到对应的基础学生数据");
|
|
|
+ }
|
|
|
+ StudentInfo studentInfo = new StudentInfo();
|
|
|
+ studentInfo.setStudentId(studentId);
|
|
|
+ studentInfo.setStudentCode(basicStudentResult.getStudentCode());
|
|
|
+ studentInfo.setStudentName(basicStudentResult.getStudentName());
|
|
|
+ studentInfo.setCollegeName(basicStudentResult.getCollegeName());
|
|
|
+ studentInfo.setMajorName(basicStudentResult.getMajorName());
|
|
|
+ studentInfo.setTeachClazzId(teachClazzId);
|
|
|
+ studentInfo.setTeachClazzName(teachClazz.getTeachClazzName());
|
|
|
+ studentInfo.setBasicClazzId(basicStudentResult.getClazzId());
|
|
|
+ studentInfo.setBasicClazzName(basicStudentResult.getClazz());
|
|
|
+ return Stream.of(studentInfo);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ ExamTaskStudentObjectResult examTaskStudentObjectResult = new ExamTaskStudentObjectResult();
|
|
|
+ examTaskStudentObjectResult.setClazzId(teachClazzId);
|
|
|
+ examTaskStudentObjectResult.setClazzName(teachClazz.getTeachClazzName());
|
|
|
+ examTaskStudentObjectResult.setStudentInfoList(studentInfoList);
|
|
|
+ examTaskStudentObjectResult.setStudentClazzType(examObjectType.getStudentClazzType());
|
|
|
+ result.add(examTaskStudentObjectResult);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case BASIC_CLAZZ_STUDENT:
|
|
|
+ // 基础班级对象
|
|
|
+ List<BasicClazz> basicClazzList = basicClazzService.list(new QueryWrapper<BasicClazz>()
|
|
|
+ .lambda()
|
|
|
+ .eq(BasicClazz::getSchoolId, schoolId)
|
|
|
+ .eq(BasicClazz::getEnable, true)
|
|
|
+ .orderByAsc(BasicClazz::getClazzName));
|
|
|
+
|
|
|
+ for (BasicClazz basicClazz : basicClazzList) {
|
|
|
+ Long basicClazzId = basicClazz.getId();
|
|
|
+ List<BasicStudentResult> basicStudentResultList = basicStudentService.basicStudentList(schoolId, null, null, basicClazzId, null);
|
|
|
+ List<StudentInfo> studentInfoList = basicStudentResultList.stream().flatMap(e -> {
|
|
|
+ StudentInfo studentInfo = new StudentInfo();
|
|
|
+ studentInfo.setStudentId(e.getId());
|
|
|
+ studentInfo.setStudentCode(e.getStudentCode());
|
|
|
+ studentInfo.setStudentName(e.getStudentName());
|
|
|
+ studentInfo.setCollegeName(e.getCollegeName());
|
|
|
+ studentInfo.setMajorName(e.getMajorName());
|
|
|
+ studentInfo.setBasicClazzId(e.getClazzId());
|
|
|
+ studentInfo.setBasicClazzName(e.getClazz());
|
|
|
+ return Stream.of(studentInfo);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ ExamTaskStudentObjectResult examTaskStudentObjectResult = new ExamTaskStudentObjectResult();
|
|
|
+ examTaskStudentObjectResult.setClazzId(basicClazzId);
|
|
|
+ examTaskStudentObjectResult.setClazzName(basicClazz.getClazzName());
|
|
|
+ examTaskStudentObjectResult.setStudentInfoList(studentInfoList);
|
|
|
+ examTaskStudentObjectResult.setStudentClazzType(examObjectType.getStudentClazzType());
|
|
|
+ result.add(examTaskStudentObjectResult);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case IMPORT_STUDENT:
|
|
|
+ // 学生导入
|
|
|
+ if (Objects.isNull(file)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("缺少导入文件");
|
|
|
+ }
|
|
|
+ Map<String, Object> studentImportMap = new HashMap<>();
|
|
|
+ studentImportMap.put("inputStream", file.getInputStream());
|
|
|
+ studentImportMap.put(SystemConstant.SYS_USER, requestUser);
|
|
|
+ taskLogicService.executeImportBasicStudentLogic(studentImportMap);
|
|
|
+ List<String> studentCodeList = JSONObject.parseArray(JSON.toJSONString(studentImportMap.get("studentCodeList")),String.class);
|
|
|
+
|
|
|
+ // 导入的学生信息查询
|
|
|
+ List<BasicStudentResult> basicStudentResultDatasource = basicStudentService.basicStudentList(schoolId, null, null, null, studentCodeList);
|
|
|
+ List<Long> basicClazzIdList = basicStudentResultDatasource.stream().map(BasicStudentResult::getClazzId).distinct().collect(Collectors.toList());
|
|
|
+ for (Long basicClazzId : basicClazzIdList) {
|
|
|
+ List<BasicStudentResult> basicStudentResultList = basicStudentResultDatasource.stream()
|
|
|
+ .filter(e -> basicClazzId.equals(e.getClazzId())).collect(Collectors.toList());
|
|
|
+ List<StudentInfo> studentInfoList = basicStudentResultList.stream().flatMap(e -> {
|
|
|
+ StudentInfo studentInfo = new StudentInfo();
|
|
|
+ studentInfo.setStudentId(e.getId());
|
|
|
+ studentInfo.setStudentCode(e.getStudentCode());
|
|
|
+ studentInfo.setStudentName(e.getStudentName());
|
|
|
+ studentInfo.setCollegeName(e.getCollegeName());
|
|
|
+ studentInfo.setMajorName(e.getMajorName());
|
|
|
+ studentInfo.setBasicClazzId(e.getClazzId());
|
|
|
+ studentInfo.setBasicClazzName(e.getClazz());
|
|
|
+ return Stream.of(studentInfo);
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ ExamTaskStudentObjectResult examTaskStudentObjectResult = new ExamTaskStudentObjectResult();
|
|
|
+ examTaskStudentObjectResult.setClazzId(basicClazzId);
|
|
|
+ examTaskStudentObjectResult.setClazzName(basicClazzService.getById(basicClazzId).getClazzName());
|
|
|
+ examTaskStudentObjectResult.setStudentInfoList(studentInfoList);
|
|
|
+ examTaskStudentObjectResult.setStudentClazzType(examObjectType.getStudentClazzType());
|
|
|
+ result.add(examTaskStudentObjectResult);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 简单校验提交参数
|
|
|
*
|