|
@@ -1,28 +1,14 @@
|
|
package com.qmth.distributed.print.business.templete.execute;
|
|
package com.qmth.distributed.print.business.templete.execute;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
-import com.qmth.distributed.print.business.bean.dto.FieldsDto;
|
|
|
|
-import com.qmth.distributed.print.business.entity.*;
|
|
|
|
|
|
+import com.qmth.distributed.print.business.entity.TBTask;
|
|
import com.qmth.distributed.print.business.enums.TaskResultEnum;
|
|
import com.qmth.distributed.print.business.enums.TaskResultEnum;
|
|
import com.qmth.distributed.print.business.enums.TaskStatusEnum;
|
|
import com.qmth.distributed.print.business.enums.TaskStatusEnum;
|
|
-import com.qmth.distributed.print.business.service.ExamDetailCourseService;
|
|
|
|
-import com.qmth.distributed.print.business.service.ExamDetailService;
|
|
|
|
-import com.qmth.distributed.print.business.service.ExamPrintPlanService;
|
|
|
|
-import com.qmth.distributed.print.business.service.ExamStudentService;
|
|
|
|
import com.qmth.distributed.print.business.templete.importData.AsyncImportTaskTemplete;
|
|
import com.qmth.distributed.print.business.templete.importData.AsyncImportTaskTemplete;
|
|
|
|
+import com.qmth.distributed.print.business.templete.service.TaskLogicService;
|
|
import com.qmth.distributed.print.common.contant.SystemConstant;
|
|
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.Result;
|
|
import com.qmth.distributed.print.common.util.ResultUtil;
|
|
import com.qmth.distributed.print.common.util.ResultUtil;
|
|
-import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
|
-import org.apache.poi.ss.usermodel.CellType;
|
|
|
|
-import org.apache.poi.ss.usermodel.Row;
|
|
|
|
-import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
-import org.apache.poi.ss.usermodel.Workbook;
|
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -31,9 +17,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
import java.io.InputStream;
|
|
import java.io.InputStream;
|
|
import java.text.MessageFormat;
|
|
import java.text.MessageFormat;
|
|
-import java.util.*;
|
|
|
|
-import java.util.stream.Collectors;
|
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.StringJoiner;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @Description: 考务数据导入模板
|
|
* @Description: 考务数据导入模板
|
|
@@ -43,13 +28,7 @@ import java.util.stream.Stream;
|
|
@Service
|
|
@Service
|
|
public class AsyncExaminationImportTemplateService extends AsyncImportTaskTemplete {
|
|
public class AsyncExaminationImportTemplateService extends AsyncImportTaskTemplete {
|
|
@Resource
|
|
@Resource
|
|
- private ExamDetailService examDetailService;
|
|
|
|
- @Resource
|
|
|
|
- private ExamPrintPlanService examPrintPlanService;
|
|
|
|
- @Resource
|
|
|
|
- private ExamDetailCourseService examDetailCourseService;
|
|
|
|
- @Resource
|
|
|
|
- private ExamStudentService examStudentService;
|
|
|
|
|
|
+ private TaskLogicService taskLogicService;
|
|
|
|
|
|
private final static Logger log = LoggerFactory.getLogger(AsyncExaminationImportTemplateService.class);
|
|
private final static Logger log = LoggerFactory.getLogger(AsyncExaminationImportTemplateService.class);
|
|
|
|
|
|
@@ -59,160 +38,15 @@ public class AsyncExaminationImportTemplateService extends AsyncImportTaskTemple
|
|
@Override
|
|
@Override
|
|
public Result importTask(Map<String, Object> map) throws Exception {
|
|
public Result importTask(Map<String, Object> map) throws Exception {
|
|
TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
|
|
TBTask tbTask = (TBTask) map.get(SystemConstant.TASK);
|
|
- Long printPlanId = tbTask.getPrintPlanId();
|
|
|
|
- Long userId = tbTask.getCreateId();
|
|
|
|
- ExamPrintPlan examPrintPlan = examPrintPlanService.getById(printPlanId);
|
|
|
|
-
|
|
|
|
- if (examPrintPlan == null){
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("印刷计划不存在printPlanId : " + printPlanId);
|
|
|
|
- }
|
|
|
|
- String printPlanName = examPrintPlan.getName();
|
|
|
|
- Long schoolId = tbTask.getSchoolId();
|
|
|
|
-
|
|
|
|
- System.out.println("------开始----------");
|
|
|
|
InputStream inputStream = super.getUploadFileInputStream(tbTask);
|
|
InputStream inputStream = super.getUploadFileInputStream(tbTask);
|
|
- System.out.println("------结束----------");
|
|
|
|
|
|
+ map.put("inputStream",inputStream);
|
|
|
|
+
|
|
StringJoiner stringJoinerSummary = new StringJoiner("\n")
|
|
StringJoiner stringJoinerSummary = new StringJoiner("\n")
|
|
.add(MessageFormat.format("{0}{1}{2}", FORMAT_TIME, BEGIN_TITLE, OBJ_TITLE));
|
|
.add(MessageFormat.format("{0}{1}{2}", FORMAT_TIME, BEGIN_TITLE, OBJ_TITLE));
|
|
tbTask.setStatus(TaskStatusEnum.RUNNING);
|
|
tbTask.setStatus(TaskStatusEnum.RUNNING);
|
|
|
|
|
|
-
|
|
|
|
- // 该学校有效考务数据
|
|
|
|
- List<FieldsDto> fieldsDtoList = examDetailService.findExaminationFields(schoolId);
|
|
|
|
- if (fieldsDtoList.size() == 0) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("该学校没有设置考务数据");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
try {
|
|
try {
|
|
- String importFilePath = tbTask.getImportFilePath();
|
|
|
|
- Map importFilePathMap = JSONObject.parseObject(importFilePath);
|
|
|
|
- String path = String.valueOf(importFilePathMap.get("path"));
|
|
|
|
- System.out.println("path = " + path);
|
|
|
|
- Workbook workbook = null;
|
|
|
|
- if (path.endsWith(SystemConstant.XLSX)) {
|
|
|
|
- workbook = new XSSFWorkbook(inputStream);
|
|
|
|
- } else if (path.endsWith("xls")) {
|
|
|
|
- workbook = new HSSFWorkbook(inputStream);
|
|
|
|
- } else {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("文件格式异常");
|
|
|
|
- }
|
|
|
|
- // 读取第一个工作表
|
|
|
|
- Sheet sheet = workbook.getSheetAt(0);
|
|
|
|
- // 获取sheet行数
|
|
|
|
- int totalRows = sheet.getPhysicalNumberOfRows();
|
|
|
|
- // 获取sheet列数
|
|
|
|
- int totalCells = 0;
|
|
|
|
- if (totalRows > 1 && sheet.getRow(0) != null) {
|
|
|
|
- totalCells = sheet.getRow(0).getPhysicalNumberOfCells();
|
|
|
|
- }
|
|
|
|
- System.out.println("行 : " + totalRows + "\n列 : " + totalCells);
|
|
|
|
- Row head = sheet.getRow(0);
|
|
|
|
- List<String> headList = new ArrayList<>();
|
|
|
|
- // 将必填字段匹配excel解析的表头索引
|
|
|
|
- for (int i = 0; i < totalCells; i++) {
|
|
|
|
- String cellValue = head.getCell(i).getStringCellValue();
|
|
|
|
- for (FieldsDto fieldsDto : fieldsDtoList) {
|
|
|
|
- if (cellValue.equals(fieldsDto.getName())) {
|
|
|
|
- fieldsDto.setIndex(i);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- headList.add(cellValue);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 搜索所有有效字段 excel中的表头是否包含
|
|
|
|
- for (FieldsDto fieldsDto : fieldsDtoList) {
|
|
|
|
- if (!headList.contains(fieldsDto.getName())) {
|
|
|
|
- System.out.println("exception " + fieldsDto.getName());
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("学校考务必填字段 :'" + fieldsDto.getName() + "' 不存在");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- System.out.println("headList : " + headList);
|
|
|
|
- System.out.println("fieldsDtoList : " + JSONObject.toJSONString(fieldsDtoList));
|
|
|
|
-
|
|
|
|
- List<Map<String, Object>> dataList = new ArrayList<>();
|
|
|
|
-
|
|
|
|
- for (int r = 1; r < totalRows; r++) {
|
|
|
|
- Row row = sheet.getRow(r);
|
|
|
|
-
|
|
|
|
- String studentCode = null;
|
|
|
|
- String studentName = null;
|
|
|
|
- String courseCode = null;
|
|
|
|
- String courseName = null;
|
|
|
|
- String examPlace = null;
|
|
|
|
- String examRoom = null;
|
|
|
|
- String examDate = null;
|
|
|
|
- String examTime = null;
|
|
|
|
- String paperNumber = null;
|
|
|
|
- List<FieldsDto> secondaryFieldList = new ArrayList<>();
|
|
|
|
- for (FieldsDto fieldsDto : fieldsDtoList) {
|
|
|
|
- String name = fieldsDto.getName();
|
|
|
|
- String code = fieldsDto.getCode();
|
|
|
|
- int index = fieldsDto.getIndex();
|
|
|
|
- String level = fieldsDto.getLevel();
|
|
|
|
- if ("学号".equals(name)) {
|
|
|
|
- studentCode = row.getCell(index).getStringCellValue();
|
|
|
|
- } else if ("姓名".equals(name)) {
|
|
|
|
- studentName = row.getCell(index).getStringCellValue();
|
|
|
|
- } else if ("课程代码".equals(name)) {
|
|
|
|
- courseCode = row.getCell(index).getStringCellValue();
|
|
|
|
- } else if ("课程名称".equals(name)) {
|
|
|
|
- courseName = row.getCell(index).getStringCellValue();
|
|
|
|
- } else if ("考点".equals(name)) {
|
|
|
|
- examPlace = row.getCell(index).getStringCellValue();
|
|
|
|
- } else if ("考场".equals(name)) {
|
|
|
|
- examRoom = row.getCell(index).getStringCellValue();
|
|
|
|
- } else if ("考试日期".equals(name)) {
|
|
|
|
- row.getCell(index).setCellType(CellType.STRING);
|
|
|
|
- examDate = row.getCell(index).getStringCellValue();
|
|
|
|
- } else if ("考试时间".equals(name)) {
|
|
|
|
- row.getCell(index).setCellType(CellType.STRING);
|
|
|
|
- examTime = row.getCell(index).getStringCellValue();
|
|
|
|
- } else if ("试卷编号".equals(name)) {
|
|
|
|
- paperNumber = row.getCell(index).getStringCellValue();
|
|
|
|
- } else {
|
|
|
|
- if ("primary".equals(level)) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("有数据库不需要的必选字段 : " + name);
|
|
|
|
- }
|
|
|
|
- if ("secondary".equals(level)) {
|
|
|
|
- // 备选字段处理
|
|
|
|
- FieldsDto secondaryField = new FieldsDto();
|
|
|
|
- secondaryField.setLevel(level);
|
|
|
|
- secondaryField.setCode(code);
|
|
|
|
- secondaryField.setName(name);
|
|
|
|
- secondaryField.setEnable(true);
|
|
|
|
- secondaryField.setValue(row.getCell(index).getStringCellValue());
|
|
|
|
- secondaryFieldList.add(secondaryField);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
- dataMap.put("studentCode", studentCode);
|
|
|
|
- dataMap.put("studentName", studentName);
|
|
|
|
- // TODO: 2021/4/9 校验课程
|
|
|
|
- dataMap.put("courseCode", courseCode);
|
|
|
|
- dataMap.put("courseName", courseName);
|
|
|
|
- dataMap.put("examPlace", examPlace);
|
|
|
|
- dataMap.put("examRoom", examRoom);
|
|
|
|
- // TODO: 2021/4/9 解析时间
|
|
|
|
- dataMap.put("examDate", examDate);
|
|
|
|
- dataMap.put("examTime", examTime);
|
|
|
|
- dataMap.put("paperNumber", paperNumber);
|
|
|
|
- dataMap.put("secondaryFieldList", secondaryFieldList);
|
|
|
|
- dataMap.put("schoolId", schoolId);
|
|
|
|
- dataMap.put("printPlanId", printPlanId);
|
|
|
|
- dataMap.put("printPlanName", printPlanName);
|
|
|
|
- dataList.add(dataMap);
|
|
|
|
- }
|
|
|
|
- System.out.println("dataList = " + JSON.toJSONString(dataList));
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- // 组装exam_detail数据
|
|
|
|
- this.disposeExamDetailByExaminationExcel(dataList,userId);
|
|
|
|
- // 组装exam_detail_course数据
|
|
|
|
- this.disposeExamDetailCourseByExaminationExcel(dataList,userId);
|
|
|
|
- // 组装exam_student数据
|
|
|
|
- this.disposeExamStudentByExaminationExcel(dataList,userId);
|
|
|
|
|
|
+ taskLogicService.executeImportExaminationLogic(map);
|
|
stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", FORMAT_TIME, FINISH_TITLE, 111, FINISH_SIZE));
|
|
stringJoinerSummary.add(MessageFormat.format("{0}{1}{2}{3}", FORMAT_TIME, FINISH_TITLE, 111, FINISH_SIZE));
|
|
tbTask.setResult(TaskResultEnum.SUCCESS);
|
|
tbTask.setResult(TaskResultEnum.SUCCESS);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
@@ -230,153 +64,4 @@ public class AsyncExaminationImportTemplateService extends AsyncImportTaskTemple
|
|
}
|
|
}
|
|
return ResultUtil.ok(map);
|
|
return ResultUtil.ok(map);
|
|
}
|
|
}
|
|
-
|
|
|
|
- private void disposeExamDetailByExaminationExcel(List<Map<String, Object>> dataList,Long userId){
|
|
|
|
- List<Map<String, Object>> examDetailKeyList = dataList.stream().flatMap(e -> {
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- map.put("schoolId",e.get("schoolId"));
|
|
|
|
- map.put("printPlanId",e.get("printPlanId"));
|
|
|
|
- map.put("printPlanName",e.get("printPlanName"));
|
|
|
|
- map.put("examPlace",e.get("examPlace"));
|
|
|
|
- map.put("examRoom",e.get("examRoom"));
|
|
|
|
- map.put("examDate",e.get("examDate"));
|
|
|
|
- map.put("examTime",e.get("examTime"));
|
|
|
|
- return Stream.of(map);
|
|
|
|
- }).distinct().collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
- System.out.println("examDetailKeyList = " + JSON.toJSONString(examDetailKeyList));
|
|
|
|
-
|
|
|
|
- List<ExamDetail> examDetailList = new ArrayList<>();
|
|
|
|
- for (Map<String, Object> map : examDetailKeyList) {
|
|
|
|
- String examPlace = String.valueOf(map.get("examPlace"));
|
|
|
|
- String examRoom = String.valueOf(map.get("examRoom"));
|
|
|
|
- String examDate = String.valueOf(map.get("examDate"));
|
|
|
|
- String examTime = String.valueOf(map.get("examTime"));
|
|
|
|
- System.out.println("dataList : " + JSON.toJSONString(dataList));
|
|
|
|
- System.out.println(examPlace + examRoom + examDate + examTime);
|
|
|
|
- long totalSubjects = dataList.stream()
|
|
|
|
- .filter(e -> String.valueOf(e.get("examPlace")).equals(examPlace) &&
|
|
|
|
- String.valueOf(e.get("examRoom")).equals(examRoom) &&
|
|
|
|
- String.valueOf(e.get("examDate")).equals(examDate) &&
|
|
|
|
- String.valueOf(e.get("examTime")).equals(examTime)).count();
|
|
|
|
-
|
|
|
|
- System.out.println("totalSubjects" + totalSubjects);
|
|
|
|
- ExamDetail examDetail = new ExamDetail();
|
|
|
|
- examDetail.setId(SystemConstant.getDbUuid());
|
|
|
|
- examDetail.setExamName("");
|
|
|
|
- examDetail.setSchoolId(Long.valueOf(String.valueOf(map.get("schoolId"))));
|
|
|
|
- examDetail.setPrintPlanId(Long.valueOf(String.valueOf(map.get("printPlanId"))));
|
|
|
|
- examDetail.setPrintPlanName(String.valueOf(map.get("printPlanName")));
|
|
|
|
- examDetail.setExamPlace(examPlace);
|
|
|
|
- examDetail.setExamRoom(examRoom);
|
|
|
|
- examDetail.setTotalSubjects(Math.toIntExact(totalSubjects));
|
|
|
|
- // TODO: 2021/4/9 解析日期和时间
|
|
|
|
- examDetail.setExamStartTime(1L);
|
|
|
|
- examDetail.setExamEndTime(2L);
|
|
|
|
- examDetail.setCreateId(userId);
|
|
|
|
- examDetail.setUpdateId(userId);
|
|
|
|
- examDetailList.add(examDetail);
|
|
|
|
- }
|
|
|
|
- examDetailService.saveBatch(examDetailList);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void disposeExamDetailCourseByExaminationExcel(List<Map<String, Object>> dataList,Long userId){
|
|
|
|
-
|
|
|
|
- List<Map<String, Object>> examDetailKeyList = dataList.stream().flatMap(e -> {
|
|
|
|
- Map<String, Object> map = new HashMap<>();
|
|
|
|
- map.put("schoolId",e.get("schoolId"));
|
|
|
|
- map.put("printPlanId",e.get("printPlanId"));
|
|
|
|
- map.put("examPlace",e.get("examPlace"));
|
|
|
|
- map.put("examRoom",e.get("examRoom"));
|
|
|
|
- map.put("examDate",e.get("examDate"));
|
|
|
|
- map.put("examTime",e.get("examTime"));
|
|
|
|
- map.put("courseCode",e.get("courseCode"));
|
|
|
|
- map.put("courseName",e.get("courseName"));
|
|
|
|
- map.put("paperNumber",e.get("paperNumber"));
|
|
|
|
- return Stream.of(map);
|
|
|
|
- }).distinct().collect(Collectors.toList());
|
|
|
|
-
|
|
|
|
- List<ExamDetailCourse> examDetailCourseList = new ArrayList<>();
|
|
|
|
- for (Map<String, Object> map : examDetailKeyList) {
|
|
|
|
- Long schoolId = Long.valueOf(String.valueOf(map.get("schoolId")));
|
|
|
|
- Long printPlanId = Long.valueOf(String.valueOf(map.get("printPlanId")));
|
|
|
|
- String examPlace = String.valueOf(map.get("examPlace"));
|
|
|
|
- String examRoom = String.valueOf(map.get("examRoom"));
|
|
|
|
- Long examStartTime = 1L;
|
|
|
|
- Long examEndTime = 2L;
|
|
|
|
- String courseCode = String.valueOf(map.get("courseCode"));
|
|
|
|
- String courseName = String.valueOf(map.get("courseName"));
|
|
|
|
- String paperNumber = String.valueOf(map.get("paperNumber"));
|
|
|
|
- List<ExamDetail> examDetailList = examDetailService.list(new QueryWrapper<ExamDetail>().lambda()
|
|
|
|
- .eq(ExamDetail::getPrintPlanId,printPlanId)
|
|
|
|
- .eq(ExamDetail::getExamPlace,examPlace)
|
|
|
|
- .eq(ExamDetail::getExamRoom,examRoom)
|
|
|
|
- .eq(ExamDetail::getExamStartTime,examStartTime)
|
|
|
|
- .eq(ExamDetail::getExamEndTime,examEndTime));
|
|
|
|
- if (examDetailList.size() != 1){
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("无法找到新增的考务场次数据");
|
|
|
|
- }
|
|
|
|
- Long examDetailId = examDetailList.get(0).getId();
|
|
|
|
- ExamDetailCourse examDetailCourse = new ExamDetailCourse();
|
|
|
|
- examDetailCourse.setId(SystemConstant.getDbUuid());
|
|
|
|
- examDetailCourse.setSchoolId(schoolId);
|
|
|
|
- examDetailCourse.setExamDetailId(examDetailId);
|
|
|
|
- examDetailCourse.setCourseCode(courseCode);
|
|
|
|
- examDetailCourse.setCourseName(courseName);
|
|
|
|
- examDetailCourse.setPaperNumber(paperNumber);
|
|
|
|
- examDetailCourse.setCreateId(userId);
|
|
|
|
- examDetailCourse.setUpdateId(userId);
|
|
|
|
- examDetailCourseList.add(examDetailCourse);
|
|
|
|
- }
|
|
|
|
- examDetailCourseService.saveBatch(examDetailCourseList);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void disposeExamStudentByExaminationExcel(List<Map<String, Object>> dataList,Long userId){
|
|
|
|
- List<ExamStudent> examStudentList = new ArrayList<>();
|
|
|
|
- for (Map<String, Object> map : dataList) {
|
|
|
|
- Long schoolId = Long.valueOf(String.valueOf(map.get("schoolId")));
|
|
|
|
- Long printPlanId = Long.valueOf(String.valueOf(map.get("printPlanId")));
|
|
|
|
- String examPlace = String.valueOf(map.get("examPlace"));
|
|
|
|
- String examRoom = String.valueOf(map.get("examRoom"));
|
|
|
|
- Long examStartTime = 1L;
|
|
|
|
- Long examEndTime = 2L;
|
|
|
|
- String courseCode = String.valueOf(map.get("courseCode"));
|
|
|
|
- String courseName = String.valueOf(map.get("courseName"));
|
|
|
|
- String paperNumber = String.valueOf(map.get("paperNumber"));
|
|
|
|
- String studentName = String.valueOf(map.get("studentName"));
|
|
|
|
- String studentCode = String.valueOf(map.get("studentCode"));
|
|
|
|
- List<ExamDetail> examDetailList = examDetailService.list(new QueryWrapper<ExamDetail>().lambda()
|
|
|
|
- .eq(ExamDetail::getPrintPlanId,printPlanId)
|
|
|
|
- .eq(ExamDetail::getExamPlace,examPlace)
|
|
|
|
- .eq(ExamDetail::getExamRoom,examRoom)
|
|
|
|
- .eq(ExamDetail::getExamStartTime,examStartTime)
|
|
|
|
- .eq(ExamDetail::getExamEndTime,examEndTime));
|
|
|
|
- if (examDetailList.size() != 1){
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("无法找到新增的考务场次数据");
|
|
|
|
- }
|
|
|
|
- Long examDetailId = examDetailList.get(0).getId();
|
|
|
|
- List<ExamDetailCourse> examDetailCourseList = examDetailCourseService.list(new QueryWrapper<ExamDetailCourse>().lambda()
|
|
|
|
- .eq(ExamDetailCourse::getExamDetailId,examDetailId)
|
|
|
|
- .eq(ExamDetailCourse::getCourseCode,courseCode)
|
|
|
|
- .eq(ExamDetailCourse::getCourseName,courseName)
|
|
|
|
- .eq(ExamDetailCourse::getPaperNumber,paperNumber));
|
|
|
|
- if (examDetailCourseList.size() != 1){
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception("无法找到新增的考务科目数据");
|
|
|
|
- }
|
|
|
|
- Long examDetailCourseId = examDetailCourseList.get(0).getId();
|
|
|
|
-
|
|
|
|
- ExamStudent examStudent = new ExamStudent();
|
|
|
|
- examStudent.setId(SystemConstant.getDbUuid());
|
|
|
|
- examStudent.setSchoolId(schoolId);
|
|
|
|
- examStudent.setExamDetailCourseId(examDetailCourseId);
|
|
|
|
- examStudent.setStudentName(studentName);
|
|
|
|
- examStudent.setStudentCode(studentCode);
|
|
|
|
- examStudent.setTicketNumber("");
|
|
|
|
- examStudent.setSiteNumber("");
|
|
|
|
- examStudent.setCreateId(userId);
|
|
|
|
- examStudent.setUpdateId(userId);
|
|
|
|
- examStudentList.add(examStudent);
|
|
|
|
- }
|
|
|
|
- examStudentService.saveBatch(examStudentList);
|
|
|
|
- }
|
|
|
|
}
|
|
}
|