|
@@ -11,7 +11,6 @@ import com.qmth.boot.api.exception.ApiException;
|
|
|
import com.qmth.distributed.print.business.bean.dto.*;
|
|
|
import com.qmth.distributed.print.business.bean.examRule.CodeNameEnableValue;
|
|
|
import com.qmth.distributed.print.business.bean.examRule.FieldsDto;
|
|
|
-import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
|
|
|
import com.qmth.distributed.print.business.bean.params.DownloadPaperFileParam;
|
|
|
import com.qmth.distributed.print.business.bean.result.DictionaryResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.TSyncExamStudentScoreResult;
|
|
@@ -22,21 +21,15 @@ import com.qmth.distributed.print.business.enums.PaperFileDownloadExposureStatus
|
|
|
import com.qmth.distributed.print.business.enums.PrintPlanStatusEnum;
|
|
|
import com.qmth.distributed.print.business.service.*;
|
|
|
import com.qmth.distributed.print.business.templete.service.TaskLogicService;
|
|
|
-import com.qmth.distributed.print.business.util.CreatePdfUtil;
|
|
|
import com.qmth.distributed.print.business.util.pdf.CreatePdfNewUtil;
|
|
|
import com.qmth.teachcloud.common.annotation.ExcelDBFieldDesc;
|
|
|
import com.qmth.teachcloud.common.base.BaseEntity;
|
|
|
import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
|
|
|
-import com.qmth.teachcloud.common.bean.dto.excel.BasicStudentImportDto;
|
|
|
import com.qmth.teachcloud.common.bean.dto.excel.DescribeImportDto;
|
|
|
import com.qmth.teachcloud.common.bean.dto.excel.StatisticsImportDto;
|
|
|
import com.qmth.teachcloud.common.bean.dto.excel.SysUserImportDto;
|
|
|
-import com.qmth.teachcloud.common.bean.dto.excel.export.BasicStudentErrorExportDto;
|
|
|
import com.qmth.teachcloud.common.bean.dto.excel.export.SysUserErrorExportDto;
|
|
|
-import com.qmth.teachcloud.common.bean.dto.mark.MarkUser;
|
|
|
import com.qmth.teachcloud.common.bean.params.ArraysParams;
|
|
|
-import com.qmth.teachcloud.common.bean.params.UserSaveParams;
|
|
|
-import com.qmth.teachcloud.common.bean.result.ExcelResult;
|
|
|
import com.qmth.teachcloud.common.bean.vo.PaperInfoVo;
|
|
|
import com.qmth.teachcloud.common.bean.vo.PrintPathVo;
|
|
|
import com.qmth.teachcloud.common.config.DictionaryConfig;
|
|
@@ -46,13 +39,6 @@ import com.qmth.teachcloud.common.enums.*;
|
|
|
import com.qmth.teachcloud.common.service.*;
|
|
|
import com.qmth.teachcloud.common.util.*;
|
|
|
import com.qmth.teachcloud.common.util.excel.ExcelError;
|
|
|
-import com.qmth.teachcloud.mark.dto.mark.setting.MarkGroupDto;
|
|
|
-import com.qmth.teachcloud.mark.dto.mark.setting.MarkGroupSingleDto;
|
|
|
-import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
|
-import com.qmth.teachcloud.mark.service.MarkGroupService;
|
|
|
-import com.qmth.teachcloud.mark.service.MarkPaperService;
|
|
|
-import com.qmth.teachcloud.mark.service.MarkQuestionService;
|
|
|
-import com.qmth.teachcloud.mark.service.MarkStudentService;
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.io.FileUtils;
|
|
@@ -84,7 +70,6 @@ import java.nio.charset.StandardCharsets;
|
|
|
import java.util.*;
|
|
|
import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
/**
|
|
|
* @Description: 任务处理逻辑impl
|
|
@@ -106,38 +91,22 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
@Resource
|
|
|
ExamCardService examCardService;
|
|
|
@Resource
|
|
|
- ExamStudentService examStudentService;
|
|
|
- @Resource
|
|
|
BasicAttachmentService basicAttachmentService;
|
|
|
@Resource
|
|
|
ExamDetailService examDetailService;
|
|
|
@Resource
|
|
|
- CommonCacheService commonCacheService;
|
|
|
- @Resource
|
|
|
BasicCourseService basicCourseService;
|
|
|
@Resource
|
|
|
- CreatePdfUtil createPdfUtil;
|
|
|
- @Resource
|
|
|
CreatePdfNewUtil createPdfNewUtil;
|
|
|
@Resource
|
|
|
TBTaskPdfService tbTaskPdfService;
|
|
|
@Resource
|
|
|
- BasicCardRuleService basicCardRuleService;
|
|
|
- @Resource
|
|
|
- ExamDetailCourseService examDetailCourseService;
|
|
|
- @Resource
|
|
|
- BasicStudentService basicStudentService;
|
|
|
- @Resource
|
|
|
BasicRoleDataPermissionService basicRoleDataPermissionService;
|
|
|
@Resource
|
|
|
- BasicExamService basicExamService;
|
|
|
- @Resource
|
|
|
SysUserService sysUserService;
|
|
|
@Resource
|
|
|
FileStoreUtil fileStoreUtil;
|
|
|
@Resource
|
|
|
- BasicClazzService basicClazzService;
|
|
|
- @Resource
|
|
|
SysOrgService sysOrgService;
|
|
|
@Resource
|
|
|
TCStatisticsService tcStatisticsService;
|
|
@@ -155,21 +124,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
@Resource
|
|
|
DictionaryConfig dictionaryConfig;
|
|
|
@Resource
|
|
|
- BasicPrintConfigService basicPrintConfigService;
|
|
|
- @Resource
|
|
|
FileUploadService fileUploadService;
|
|
|
- @Resource
|
|
|
- BasicExamStudentService basicExamStudentService;
|
|
|
- @Resource
|
|
|
- MarkPaperService markPaperService;
|
|
|
- @Resource
|
|
|
- MarkStudentService markStudentService;
|
|
|
- @Resource
|
|
|
- MarkQuestionService markQuestionService;
|
|
|
- @Resource
|
|
|
- MarkGroupService markGroupService;
|
|
|
- @Resource
|
|
|
- SysRoleService sysRoleService;
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
@@ -623,6 +578,7 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
}
|
|
|
return map;
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public Map<String, Object> executeExportPaperAndCardLogic(Map<String, Object> map) {
|
|
|
String zipLocalRootPath = null;
|
|
@@ -730,79 +686,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Transactional
|
|
|
- @Override
|
|
|
- public Map<String, Object> executeImportBasicStudentLogic(Map<String, Object> map) throws Exception {
|
|
|
- InputStream inputStream = (InputStream) map.get("inputStream");
|
|
|
- List<String> studentCodeList = new ArrayList<>();
|
|
|
- List<BasicStudentErrorExportDto> errorDataList = new ArrayList<>();
|
|
|
- AtomicInteger totalInteger = new AtomicInteger(0);
|
|
|
- AtomicInteger successInteger = new AtomicInteger(0);
|
|
|
- List<LinkedMultiValueMap<Integer, Object>> finalList = ExcelUtil.excelReader(inputStream, Lists.newArrayList(BasicStudentImportDto.class, DescribeImportDto.class), (finalExcelList, finalColumnNameList, finalExcelErrorList) -> {
|
|
|
- Map<String, String> checkCodeMap = new HashMap<>();
|
|
|
- for (int i = 0; i < finalExcelList.size(); i++) {
|
|
|
- LinkedMultiValueMap<Integer, Object> excelMap = finalExcelList.get(i);
|
|
|
- List<Object> basicStudentImportDtoList = excelMap.get(i);
|
|
|
- // 将要删除的异常数据
|
|
|
- List<BasicStudentImportDto> willRemoveList = new ArrayList<>();
|
|
|
- for (int y = 0; y < Objects.requireNonNull(basicStudentImportDtoList).size(); y++) {
|
|
|
- // 行索引
|
|
|
- Integer rowIndex = y + 1;
|
|
|
- BasicStudentImportDto basicStudentImportDto = (BasicStudentImportDto) basicStudentImportDtoList.get(y);
|
|
|
- basicStudentImportDto.setRowIndex(rowIndex);
|
|
|
- totalInteger.getAndIncrement();
|
|
|
-
|
|
|
- BasicStudentErrorExportDto basicStudentErrorExportDto = new BasicStudentErrorExportDto();
|
|
|
- BeanUtils.copyProperties(basicStudentImportDto, basicStudentErrorExportDto);
|
|
|
-
|
|
|
-
|
|
|
- String studentName = StringUtils.isNotBlank(basicStudentImportDto.getStudentName()) ? basicStudentImportDto.getStudentName().trim() : null;
|
|
|
- String studentCode = StringUtils.isNotBlank(basicStudentImportDto.getStudentCode()) ? basicStudentImportDto.getStudentCode().trim() : null;
|
|
|
- studentCodeList.add(studentCode);
|
|
|
-
|
|
|
- StringJoiner errorStringJoiner = new StringJoiner(";");
|
|
|
- // 必填字段校验
|
|
|
- String errorStringEmpty = ExcelUtil.checkExcelField(basicStudentImportDto);
|
|
|
- if (errorStringEmpty.length() > 0) {
|
|
|
- errorStringJoiner.add(errorStringEmpty);
|
|
|
- }
|
|
|
-
|
|
|
- // 检验学号
|
|
|
- if (SystemConstant.strNotNull(studentCode)) {
|
|
|
- if (checkCodeMap.containsKey(studentCode)) {
|
|
|
- errorStringJoiner.add("学号[" + studentCode + "]查询到多条数据");
|
|
|
- } else {
|
|
|
- checkCodeMap.put(studentCode, studentName);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (Objects.nonNull(studentCode) && !studentCode.matches(SystemConstant.REGULAR_EXPRESSION_OF_CODE1)) {
|
|
|
- errorStringJoiner.add("学号[" + studentCode + "]不符合规范");
|
|
|
- }
|
|
|
- String errorString = errorStringJoiner.toString();
|
|
|
- if (errorString.length() > 0) {
|
|
|
- basicStudentErrorExportDto.setErrorMsg(errorString);
|
|
|
- errorDataList.add(basicStudentErrorExportDto);
|
|
|
- willRemoveList.add(basicStudentImportDto);
|
|
|
- } else {
|
|
|
- // 校验通过的数据
|
|
|
- successInteger.getAndIncrement();
|
|
|
- }
|
|
|
- }
|
|
|
- basicStudentImportDtoList.removeAll(willRemoveList);
|
|
|
- }
|
|
|
- if (!errorDataList.isEmpty()) {
|
|
|
- map.put(SystemConstant.ERROR_DATA_LIST, errorDataList);
|
|
|
- }
|
|
|
- map.put("studentCodeList", studentCodeList);
|
|
|
- map.put(SystemConstant.DATA_COUNT, totalInteger.get());
|
|
|
- map.put(SystemConstant.SUCCESS_DATA_COUNT, successInteger.get());
|
|
|
- map.put(SystemConstant.ERROR_DATA_COUNT, errorDataList.size());
|
|
|
- return finalExcelList;
|
|
|
- }, 2);
|
|
|
- return basicStudentService.executeBasicStudentImportLogic(finalList, map);
|
|
|
- }
|
|
|
-
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public Map<String, Object> executeImportSysUserLogic(Map<String, Object> map) throws Exception {
|
|
@@ -1288,608 +1171,6 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
return map;
|
|
|
}
|
|
|
|
|
|
- @Transactional
|
|
|
- @Override
|
|
|
- public Map<String, Object> executeImportBasicExamStudentLogic(Map<String, Object> map) throws Exception {
|
|
|
- SysUser requestUser = (SysUser) map.get(SystemConstant.USER);
|
|
|
- InputStream inputStream = (InputStream) map.get("inputStream");
|
|
|
- Long examId = SystemConstant.convertIdToLong(String.valueOf(map.get("examId")));
|
|
|
- Long schoolId = requestUser.getSchoolId();
|
|
|
- BasicExam basicExam = basicExamService.getById(examId);
|
|
|
- if (Objects.isNull(basicExam)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("考试不存在");
|
|
|
- }
|
|
|
- Long semesterId = SystemConstant.convertIdToLong(basicExam.getSemesterId());
|
|
|
-
|
|
|
- List<BasicExamStudent> dbData = basicExamStudentService.list(new QueryWrapper<BasicExamStudent>().lambda()
|
|
|
- .select(BasicExamStudent::getId, BasicExamStudent::getExamId, BasicExamStudent::getCourseCode,
|
|
|
- BasicExamStudent::getStudentCode, BasicExamStudent::getPaperNumber).eq(BasicExamStudent::getSchoolId, schoolId).eq(BasicExamStudent::getExamId, examId));
|
|
|
-
|
|
|
- // 数据库中学生学号和id对应关系
|
|
|
- Map<String, Long> studentCodeIdMap = dbData.stream().collect(Collectors.toMap(
|
|
|
- k -> k.getExamId() + SystemConstant.HYPHEN + k.getCourseCode() + SystemConstant.HYPHEN + k.getStudentCode(),
|
|
|
- BaseEntity::getId));
|
|
|
- Map<String, String> paperNumberCourseCodeMap = dbData.stream().filter(e -> SystemConstant.strNotNull(e.getPaperNumber())).collect(
|
|
|
- Collectors.toMap(BasicExamStudent::getPaperNumber, BasicExamStudent::getCourseCode, (o1, o2) -> o1));
|
|
|
-
|
|
|
- // excel中学生学号和学生字典对象关系
|
|
|
- Map<String, BasicExamStudent> studentCodeObjMap = new HashMap<>();
|
|
|
- AtomicInteger successInteger = new AtomicInteger(0);
|
|
|
- AtomicInteger exceptionInteger = new AtomicInteger(0);
|
|
|
-
|
|
|
- ExcelResult<BasicExamStudentDto> excelResult = ConvertUtil.analyzeExcel(inputStream, BasicExamStudentDto.class,
|
|
|
- true, 1);
|
|
|
- List<BasicExamStudentDto> basicExamStudentDtoList = excelResult.getDatasource();
|
|
|
- List<String> oldPaperNumberList = new ArrayList<>();
|
|
|
- for (BasicExamStudentDto basicExamStudentDto : basicExamStudentDtoList) {
|
|
|
- List<String> errorMsgList = new ArrayList<>();
|
|
|
- // 行索引
|
|
|
- String courseCode = basicExamStudentDto.getCourseCode();
|
|
|
- String studentName = basicExamStudentDto.getStudentName();
|
|
|
- String studentCode = basicExamStudentDto.getStudentCode();
|
|
|
- String college = basicExamStudentDto.getCollege();
|
|
|
- String major = basicExamStudentDto.getMajor();
|
|
|
- String teachClazz = basicExamStudentDto.getTeachClazz();
|
|
|
- String paperNumber = basicExamStudentDto.getPaperNumber();
|
|
|
- String teacherName = basicExamStudentDto.getTeacherName();
|
|
|
- String teacherCode = basicExamStudentDto.getTeacherCode();
|
|
|
- String examDate = basicExamStudentDto.getExamDate();
|
|
|
- String examTime = basicExamStudentDto.getExamTime();
|
|
|
- String examPlace = basicExamStudentDto.getExamPlace();
|
|
|
- String examRoom = basicExamStudentDto.getExamRoom();
|
|
|
-
|
|
|
- Long examStartTime = null;
|
|
|
- Long examEndTime = null;
|
|
|
- try {
|
|
|
- if (SystemConstant.strNotNull(examDate) && SystemConstant.strNotNull(examTime)) {
|
|
|
- Map<String, Object> timeMap = ConvertUtil.analyzeStartAndEndTime(examDate, examTime);
|
|
|
- examStartTime = SystemConstant.convertIdToLong(String.valueOf(timeMap.get("startTime")));
|
|
|
- examEndTime = SystemConstant.convertIdToLong(String.valueOf(timeMap.get("endTime")));
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- errorMsgList.add(e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- if (SystemConstant.strNotNull(paperNumber) && SystemConstant.strNotNull(courseCode)) {
|
|
|
- if (paperNumberCourseCodeMap.containsKey(paperNumber)) {
|
|
|
- if (!Objects.equals(paperNumberCourseCodeMap.get(paperNumber), courseCode)) {
|
|
|
- errorMsgList.add(String.format("试卷编号和课程编号不匹配:试卷编号[%s]已经存在于课程[%s]下", paperNumber,
|
|
|
- paperNumberCourseCodeMap.get(paperNumber)));
|
|
|
- }
|
|
|
- } else {
|
|
|
- paperNumberCourseCodeMap.put(paperNumber, courseCode);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- String key = examId + SystemConstant.HYPHEN + courseCode + SystemConstant.HYPHEN + studentCode;
|
|
|
- Long id = null;
|
|
|
- if (studentCodeIdMap.containsKey(key)) {
|
|
|
- id = studentCodeIdMap.get(key);
|
|
|
- }
|
|
|
- BasicExamStudentParam basicExamStudentParam = new BasicExamStudentParam();
|
|
|
- basicExamStudentParam.setId(id);
|
|
|
- basicExamStudentParam.setSemesterId(semesterId);
|
|
|
- basicExamStudentParam.setExamId(examId);
|
|
|
-// basicExamStudentParam.setCourseId(courseCode);
|
|
|
- basicExamStudentParam.setStudentName(studentName);
|
|
|
- basicExamStudentParam.setStudentCode(studentCode);
|
|
|
- basicExamStudentParam.setCollege(college);
|
|
|
- basicExamStudentParam.setMajor(major);
|
|
|
- basicExamStudentParam.setTeachClazz(teachClazz);
|
|
|
- basicExamStudentParam.setPaperNumber(paperNumber);
|
|
|
- basicExamStudentParam.setTeacherName(teacherName);
|
|
|
- basicExamStudentParam.setTeacherCode(teacherCode);
|
|
|
- basicExamStudentParam.setExamStartTime(examStartTime);
|
|
|
- basicExamStudentParam.setExamEndTime(examEndTime);
|
|
|
- basicExamStudentParam.setExamPlace(examPlace);
|
|
|
- basicExamStudentParam.setExamRoom(examRoom);
|
|
|
- try {
|
|
|
- BasicExamStudent basicExamStudent = basicExamStudentService.editEntityHelp(basicExamStudentParam,
|
|
|
- basicExam, oldPaperNumberList, requestUser);
|
|
|
- // 考试课程下学号重复 后面的替换前面的
|
|
|
- studentCodeObjMap.put(key, basicExamStudent);
|
|
|
- } catch (Exception e) {
|
|
|
- errorMsgList.add(e.getMessage());
|
|
|
- }
|
|
|
- String excelAnalyzeError = basicExamStudentDto.getErrorMsg();
|
|
|
- if (SystemConstant.strNotNull(excelAnalyzeError)) {
|
|
|
- exceptionInteger.getAndIncrement();
|
|
|
- if (CollectionUtils.isNotEmpty(errorMsgList)) {
|
|
|
- basicExamStudentDto.setErrorMsg(excelAnalyzeError + ";" + String.join(";", errorMsgList));
|
|
|
- }
|
|
|
- } else if (CollectionUtils.isNotEmpty(errorMsgList)) {
|
|
|
- exceptionInteger.getAndIncrement();
|
|
|
- basicExamStudentDto.setErrorMsg(String.join(";", errorMsgList));
|
|
|
- } else {
|
|
|
- successInteger.getAndIncrement();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (basicExamStudentDtoList.stream().anyMatch(e -> SystemConstant.strNotNull(e.getErrorMsg()))) {
|
|
|
- map.put(SystemConstant.ERROR_DATA_LIST, basicExamStudentDtoList);
|
|
|
- } else {
|
|
|
- List<BasicExamStudent> basicExamStudentList = new ArrayList<>(studentCodeObjMap.values());
|
|
|
- map.put(SystemConstant.DATASOURCE, basicExamStudentList);
|
|
|
- }
|
|
|
- map.put(SystemConstant.DATA_COUNT, basicExamStudentDtoList.size());
|
|
|
- map.put(SystemConstant.SUCCESS_DATA_COUNT, successInteger.get());
|
|
|
- map.put(SystemConstant.ERROR_DATA_COUNT, exceptionInteger.get());
|
|
|
- map.put("oldPaperNumberList", oldPaperNumberList);
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- @Transactional
|
|
|
- @Override
|
|
|
- public void saveMarkStudent(Long examId, List<BasicExamStudent> basicExamStudentList) {
|
|
|
- SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- Long requestUserId = requestUser.getId();
|
|
|
-
|
|
|
- Map<String, List<BasicExamStudent>> stringMap = basicExamStudentList.stream().collect(Collectors.groupingBy(BasicExamStudent::getPaperNumber));
|
|
|
-
|
|
|
- for (Map.Entry<String, List<BasicExamStudent>> entry : stringMap.entrySet()) {
|
|
|
- BasicExamStudent basicExamStudent = entry.getValue().get(0);
|
|
|
- MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, entry.getKey());
|
|
|
- if (markPaper == null) {
|
|
|
- BasicCourse basicCourse = basicCourseService.getByCode(basicExamStudent.getCourseCode());
|
|
|
- markPaper = new MarkPaper(examId, basicExamStudent.getCourseId(), entry.getKey(), String.valueOf(System.currentTimeMillis()), requestUserId, SystemConstant.DEFAULT_PAPER_TYPE_A);
|
|
|
- markPaperService.save(markPaper);
|
|
|
- }
|
|
|
- Set<String> secretNumberSet = new HashSet<>();
|
|
|
- MarkPaper finalMarkPaper = markPaper;
|
|
|
- entry.getValue().forEach(m -> markStudentService.updateByBasicExamStudent(m, finalMarkPaper, secretNumberSet));
|
|
|
- markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(examId, entry.getKey(), SystemConstant.DEFAULT_PAPER_TYPE_A);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- @Transactional
|
|
|
- @Override
|
|
|
- public Map<String, Object> executeImportObjectiveStructLogic(Map<String, Object> map) throws Exception {
|
|
|
- SysUser requestUser = (SysUser) map.get(SystemConstant.USER);
|
|
|
- InputStream inputStream = (InputStream) map.get("inputStream");
|
|
|
- Long examId = SystemConstant.convertIdToLong(String.valueOf(map.get("examId")));
|
|
|
- Long schoolId = requestUser.getSchoolId();
|
|
|
- BasicExam basicExam = basicExamService.getById(examId);
|
|
|
- if (Objects.isNull(basicExam)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("考试不存在");
|
|
|
- }
|
|
|
- if (!ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("仅针对模式4的考试可以导入");
|
|
|
- }
|
|
|
- // 课程编号名称校验
|
|
|
- Map<String, String> courseCheckMap = basicCourseService.list(
|
|
|
- new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)).stream()
|
|
|
- .collect(Collectors.toMap(BasicCourse::getCode, BasicCourse::getName));
|
|
|
- List<MarkPaper> markPaperList = markPaperService.list(
|
|
|
- new QueryWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId));
|
|
|
- // 题号重复校验
|
|
|
- // 导入的客观题题号集合
|
|
|
- Set<String> questionNumberCheckSet = new HashSet<>();
|
|
|
- // 客观题选项个数在大题下一致性校验
|
|
|
- Map<String, Integer> questionOptionCountMap = new HashMap<>();
|
|
|
- // 该试卷已存在的主观题题号集合
|
|
|
- Set<String> dbSubjectiveQuestionNumberSet = markQuestionService.list(
|
|
|
- new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
|
|
|
- .eq(MarkQuestion::getObjective, false)).stream()
|
|
|
- .map(e -> e.getPaperNumber() + SystemConstant.HYPHEN + e.getMainNumber() + SystemConstant.HYPHEN + e.getSubNumber()).collect(Collectors.toSet());
|
|
|
-
|
|
|
- ExcelResult<ObjectiveStructDto> excelResult = ConvertUtil.analyzeExcel(inputStream, ObjectiveStructDto.class,
|
|
|
- true, 0);
|
|
|
- List<ObjectiveStructDto> objectiveStructDtoList = excelResult.getDatasource();
|
|
|
- List<MarkQuestion> markQuestionList = new ArrayList<>();
|
|
|
- for (ObjectiveStructDto objectiveStructDto : objectiveStructDtoList) {
|
|
|
- List<String> logicErrorList = new ArrayList<>();
|
|
|
- // 公共异常提示
|
|
|
- String logicErrorCommonNotice = "";
|
|
|
-
|
|
|
- String courseCode = objectiveStructDto.getCourseCode();
|
|
|
- String courseName = objectiveStructDto.getCourseName();
|
|
|
- String paperNumber = objectiveStructDto.getPaperNumber();
|
|
|
- String mainTitle = objectiveStructDto.getMainTitle();
|
|
|
- Integer mainNumber = objectiveStructDto.getMainNumber();
|
|
|
- Integer subNumber = objectiveStructDto.getSubNumber();
|
|
|
- String answer = objectiveStructDto.getAnswer();
|
|
|
- Integer optionCount = objectiveStructDto.getOptionCount();
|
|
|
- Double totalScore = objectiveStructDto.getTotalScore();
|
|
|
- Integer questionType = objectiveStructDto.getQuestionType();
|
|
|
- String errorMsg = objectiveStructDto.getErrorMsg();
|
|
|
-
|
|
|
- // 1.题号重复校验
|
|
|
- if (SystemConstant.strNotNull(paperNumber) && mainNumber != null && subNumber != null) {
|
|
|
- logicErrorCommonNotice = String.format("课程代码为[%s],试卷编号为[%s],大题号为[%s],小题号为[%s]的数据异常 : ", courseCode, paperNumber, mainNumber,
|
|
|
- subNumber);
|
|
|
- String questionNumberKey = courseCode + SystemConstant.HYPHEN + paperNumber + SystemConstant.HYPHEN + mainNumber + SystemConstant.HYPHEN + subNumber;
|
|
|
- if (questionNumberCheckSet.contains(questionNumberKey)) {
|
|
|
- logicErrorList.add("excel中题号重复");
|
|
|
- } else {
|
|
|
- questionNumberCheckSet.add(questionNumberKey);
|
|
|
- }
|
|
|
- if (dbSubjectiveQuestionNumberSet.contains(questionNumberKey)) {
|
|
|
- logicErrorList.add("该题号已存在主观题中");
|
|
|
- }
|
|
|
- String mainQuestionKey = paperNumber + SystemConstant.HYPHEN + mainNumber;
|
|
|
- if (questionOptionCountMap.containsKey(mainQuestionKey)) {
|
|
|
- if (!Objects.equals(questionOptionCountMap.get(mainQuestionKey), optionCount)) {
|
|
|
- logicErrorList.add("选项个数和该大题中的其他小题不一致");
|
|
|
- }
|
|
|
- } else {
|
|
|
- questionOptionCountMap.put(mainQuestionKey, optionCount);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 2.校验课程编号,课程名称,试卷在考试下是否存在
|
|
|
- if (SystemConstant.strNotNull(courseCode) && SystemConstant.strNotNull(courseName) && SystemConstant.strNotNull(paperNumber)) {
|
|
|
- if (!courseCheckMap.containsKey(courseCode)) {
|
|
|
- logicErrorList.add("课程编号不存在");
|
|
|
- } else if (!courseCheckMap.get(courseCode).equals(courseName)) {
|
|
|
- logicErrorList.add("课程编号名称不匹配");
|
|
|
- }
|
|
|
- if (markPaperList.stream().noneMatch(m -> m.getPaperNumber().equals(paperNumber) && m.getCourseCode().equals(courseCode))) {
|
|
|
- logicErrorList.add("考试课程中不存在该试卷,请先创建试卷");
|
|
|
- }
|
|
|
- }
|
|
|
- // 3.选项越界校验
|
|
|
- List<String> optionScope = new ArrayList<>();
|
|
|
- try {
|
|
|
- for (int j = 1; j <= optionCount; j++) {
|
|
|
- String code = OptionsEnum.getCodeByIndex(j);
|
|
|
- optionScope.add(code);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
|
- }
|
|
|
-
|
|
|
- // 答案选项越界校验
|
|
|
- List<String> answerList = Arrays.asList(answer.split(""));
|
|
|
- if (CollectionUtils.isNotEmpty(answerList)) {
|
|
|
- for (String cell : answerList) {
|
|
|
- String outOfBoundsException = String.format("答案[%s]错误。答案只能从[%s]中选择", cell, String.join("", optionScope));
|
|
|
- try {
|
|
|
- OptionsEnum optionsEnum = OptionsEnum.getByCode(cell);
|
|
|
- int optionIndex = optionsEnum.getIndex();
|
|
|
- if (optionIndex > optionCount) {
|
|
|
- // 答案选项超出范围
|
|
|
- logicErrorList.add(outOfBoundsException);
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logicErrorList.add(outOfBoundsException);
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- logicErrorList.add("答案必填");
|
|
|
- }
|
|
|
-
|
|
|
- // 4.判断答案是否符合题型
|
|
|
- if (questionType != null && SystemConstant.strNotNull(answer)) {
|
|
|
- switch (questionType) {
|
|
|
- case 1:
|
|
|
- if (answer.length() > 1) {
|
|
|
- logicErrorList.add("单选题答案只能有一个");
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- break;
|
|
|
- case 3:
|
|
|
- if (optionCount != 2) {
|
|
|
- logicErrorList.add("判断题[选项个数]只能为2");
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- logicErrorList.add("[题型(1-单选,2-多选,3-判断)]必须从1、2、3中填写");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 整理异常信息
|
|
|
- if (CollectionUtils.isNotEmpty(logicErrorList)) {
|
|
|
- if (SystemConstant.strNotNull(errorMsg)) {
|
|
|
- errorMsg = errorMsg + "、" + logicErrorCommonNotice + String.join("、", logicErrorList);
|
|
|
- } else {
|
|
|
- errorMsg = logicErrorCommonNotice + String.join("、", logicErrorList);
|
|
|
- }
|
|
|
- objectiveStructDto.setErrorMsg(errorMsg);
|
|
|
- } else {
|
|
|
- MarkQuestion markQuestion = new MarkQuestion();
|
|
|
- markQuestion.setExamId(examId);
|
|
|
- markQuestion.setPaperNumber(paperNumber);
|
|
|
- markQuestion.setPaperType(OptionsEnum.A.getCode());
|
|
|
- markQuestion.setObjective(true);
|
|
|
- markQuestion.setMainNumber(mainNumber);
|
|
|
- markQuestion.setSubNumber(subNumber);
|
|
|
- markQuestion.setMainTitle(mainTitle);
|
|
|
- markQuestion.setAnswer(answer);
|
|
|
- markQuestion.setOptionCount(optionCount);
|
|
|
- markQuestion.setTotalScore(totalScore);
|
|
|
- markQuestion.setObjectivePolicy(ObjectivePolicy.NONE);
|
|
|
- markQuestion.setQuestionType(questionType);
|
|
|
- markQuestionList.add(markQuestion);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (objectiveStructDtoList.stream().anyMatch(e -> SystemConstant.strNotNull(e.getErrorMsg()))) {
|
|
|
- // 抛出excel解析异常
|
|
|
- throw ExceptionResultEnum.ERROR.exception(
|
|
|
- objectiveStructDtoList.stream().map(ObjectiveStructDto::getErrorMsg).filter(SystemConstant::strNotNull).collect(Collectors.joining(System.lineSeparator())));
|
|
|
- } else {
|
|
|
- // 保存客观题结构
|
|
|
- Map<String, List<MarkQuestion>> markQuestionMap = markQuestionList.stream().collect(Collectors.groupingBy(MarkQuestion::getPaperNumber));
|
|
|
- markQuestionMap.forEach((k, v) -> {
|
|
|
- // 优先删除该试卷编号下的客观题
|
|
|
- markQuestionService.remove(new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
|
|
|
- .eq(MarkQuestion::getPaperNumber, k).eq(MarkQuestion::getObjective, true));
|
|
|
- // 保存客观题
|
|
|
- markQuestionService.saveBatch(v);
|
|
|
- markQuestionService.updateMarkPaperScore(examId, k, null);
|
|
|
- });
|
|
|
- }
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
- @Transactional
|
|
|
- @Override
|
|
|
- public Map<String, Object> executeImportSubjectiveStructLogic(Map<String, Object> map) throws Exception {
|
|
|
- SysUser requestUser = (SysUser) map.get(SystemConstant.USER);
|
|
|
- InputStream inputStream = (InputStream) map.get("inputStream");
|
|
|
- Long examId = SystemConstant.convertIdToLong(String.valueOf(map.get("examId")));
|
|
|
- Long schoolId = requestUser.getSchoolId();
|
|
|
- BasicExam basicExam = basicExamService.getById(examId);
|
|
|
- if (Objects.isNull(basicExam)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("考试不存在");
|
|
|
- }
|
|
|
- if (!ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("仅针对模式4的考试可以导入");
|
|
|
- }
|
|
|
- SysRole markerRole = sysRoleService.getOne(
|
|
|
- new QueryWrapper<SysRole>().lambda().eq(SysRole::getType, RoleTypeEnum.MARKER));
|
|
|
- if (Objects.isNull(markerRole)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("缺少评卷员角色");
|
|
|
- }
|
|
|
-
|
|
|
- // 课程编号名称校验
|
|
|
- Map<String, String> courseCheckMap = basicCourseService.list(
|
|
|
- new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)).stream()
|
|
|
- .collect(Collectors.toMap(BasicCourse::getCode, BasicCourse::getName));
|
|
|
- List<MarkPaper> markPaperList = markPaperService.list(
|
|
|
- new QueryWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId));
|
|
|
- // 题号重复校验
|
|
|
- // 导入的客观题题号集合
|
|
|
- Set<String> questionNumberCheckSet = new HashSet<>();
|
|
|
- // 该试卷已存在的客观题题号集合
|
|
|
- Set<String> dbObjectiveQuestionNumberSet = markQuestionService.list(
|
|
|
- new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
|
|
|
- .eq(MarkQuestion::getObjective, true)).stream()
|
|
|
- .map(e -> e.getPaperNumber() + SystemConstant.HYPHEN + e.getMainNumber() + SystemConstant.HYPHEN + e.getSubNumber()).collect(Collectors.toSet());
|
|
|
-
|
|
|
- ExcelResult<SubjectiveStructDto> excelResult = ConvertUtil.analyzeExcel(inputStream, SubjectiveStructDto.class,
|
|
|
- true, 0);
|
|
|
- List<SubjectiveStructDto> subjectiveStructDtoList = excelResult.getDatasource();
|
|
|
- for (SubjectiveStructDto subjectiveStructDto : subjectiveStructDtoList) {
|
|
|
- List<String> excelErrorList = new ArrayList<>();
|
|
|
- // 公共异常提示
|
|
|
- String excelErrorCommonNotice = "";
|
|
|
-
|
|
|
- String courseCode = subjectiveStructDto.getCourseCode();
|
|
|
- String courseName = subjectiveStructDto.getCourseName();
|
|
|
- String paperNumber = subjectiveStructDto.getPaperNumber();
|
|
|
- Integer mainNumber = subjectiveStructDto.getMainNumber();
|
|
|
- Integer subNumber = subjectiveStructDto.getSubNumber();
|
|
|
- Integer markerCount = subjectiveStructDto.getMarkerCount();
|
|
|
- String markerCodes = subjectiveStructDto.getMarkerCodes();
|
|
|
- String errorMsg = subjectiveStructDto.getErrorMsg();
|
|
|
-
|
|
|
- // 1.题号重复校验
|
|
|
- if (SystemConstant.strNotNull(paperNumber) && mainNumber != null && subNumber != null) {
|
|
|
- excelErrorCommonNotice = String.format("课程代码为[%s],试卷编号为[%s],大题号为[%s],小题号为[%s]的数据异常 : ", courseCode, paperNumber, mainNumber,
|
|
|
- subNumber);
|
|
|
- String questionNumberKey = courseCode + SystemConstant.HYPHEN + paperNumber + SystemConstant.HYPHEN + mainNumber + SystemConstant.HYPHEN + subNumber;
|
|
|
- if (questionNumberCheckSet.contains(questionNumberKey)) {
|
|
|
- excelErrorList.add("excel中题号重复");
|
|
|
- } else {
|
|
|
- questionNumberCheckSet.add(questionNumberKey);
|
|
|
- }
|
|
|
- if (dbObjectiveQuestionNumberSet.contains(questionNumberKey)) {
|
|
|
- excelErrorList.add("该题号已存在客观题中");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 2.校验课程代码,课程名称,试卷在考试下是否存在
|
|
|
- if (SystemConstant.strNotNull(courseCode) && SystemConstant.strNotNull(courseName) && SystemConstant.strNotNull(paperNumber)) {
|
|
|
- if (!courseCheckMap.containsKey(courseCode)) {
|
|
|
- excelErrorList.add("课程代码不存在");
|
|
|
- } else if (!courseCheckMap.get(courseCode).equals(courseName)) {
|
|
|
- excelErrorList.add("课程代码名称不匹配");
|
|
|
- }
|
|
|
- if (markPaperList.stream().noneMatch(m -> m.getPaperNumber().equals(paperNumber) && m.getCourseCode().equals(courseCode))) {
|
|
|
- excelErrorList.add("考试课程中不存在该试卷,请先创建试卷");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 3.评卷员校验
|
|
|
- if (Objects.isNull(markerCount) && Objects.isNull(markerCodes)) {
|
|
|
- excelErrorList.add("[评卷员数量(系统生成)]和[绑定工号(英文逗号分隔)]不能同时为空");
|
|
|
- }
|
|
|
-
|
|
|
- // 整理异常信息
|
|
|
- if (CollectionUtils.isNotEmpty(excelErrorList)) {
|
|
|
- if (SystemConstant.strNotNull(errorMsg)) {
|
|
|
- errorMsg = errorMsg + "、" + excelErrorCommonNotice + String.join("、", excelErrorList);
|
|
|
- } else {
|
|
|
- errorMsg = excelErrorCommonNotice + String.join("、", excelErrorList);
|
|
|
- }
|
|
|
- subjectiveStructDto.setErrorMsg(errorMsg);
|
|
|
- }
|
|
|
- }
|
|
|
- if (subjectiveStructDtoList.stream().anyMatch(e -> SystemConstant.strNotNull(e.getErrorMsg()))) {
|
|
|
- // 抛出excel解析异常
|
|
|
- throw ExceptionResultEnum.ERROR.exception(
|
|
|
- subjectiveStructDtoList.stream().map(SubjectiveStructDto::getErrorMsg).filter(SystemConstant::strNotNull).collect(Collectors.joining(System.lineSeparator())));
|
|
|
- } else {
|
|
|
- List<String> paperErrorList = new ArrayList<>();
|
|
|
- // 试卷编号-> 题目集合 Map
|
|
|
- Map<String, List<SubjectiveStructDto>> paperQuestionsMap = subjectiveStructDtoList.stream().collect(Collectors.groupingBy(SubjectiveStructDto::getPaperNumber));
|
|
|
- paperQuestionsMap.forEach((paperNumber, paperQuestionList) -> {
|
|
|
- if (markGroupService.countByExamIdAndPaperNumber(examId, paperNumber) > 0) {
|
|
|
- paperErrorList.add(String.format("[试卷编号]%s,已存在分组,请先删除该试卷的所有分组再导入试题", paperNumber));
|
|
|
- } else {
|
|
|
- // 优先删除该试卷的主观题
|
|
|
- markQuestionService.remove(
|
|
|
- new QueryWrapper<MarkQuestion>().lambda().eq(MarkQuestion::getExamId, examId)
|
|
|
- .eq(MarkQuestion::getPaperNumber, paperNumber).eq(MarkQuestion::getObjective, false));
|
|
|
-
|
|
|
- // 试卷下分组集合
|
|
|
- List<Integer> groupNumberList = paperQuestionList.stream().map(SubjectiveStructDto::getGroupNumber)
|
|
|
- .distinct().sorted().collect(Collectors.toList());
|
|
|
-
|
|
|
- // 评卷员序号
|
|
|
- AtomicInteger markerNumber = new AtomicInteger(0);
|
|
|
- for (Integer groupNumber : groupNumberList) {
|
|
|
- List<String> groupErrorList = new ArrayList<>();
|
|
|
- // 分组下题目集合
|
|
|
- List<SubjectiveStructDto> groupQuestionList = paperQuestionList.stream()
|
|
|
- .filter(e -> e.getGroupNumber().equals(groupNumber)).collect(Collectors.toList());
|
|
|
-
|
|
|
- String paperNumberGroupNumberNotice = String.format("[试卷编号]%s,[评卷分组(只能用小写数字)]%s,的", paperNumber,
|
|
|
- groupNumber);
|
|
|
-
|
|
|
- String orgName = null;
|
|
|
- Long orgId = null;
|
|
|
- BasicCourse basicCourse = basicCourseService.getOne(
|
|
|
- new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId, schoolId)
|
|
|
- .eq(BasicCourse::getCode, groupQuestionList.get(0).getCourseCode()));
|
|
|
- if (Objects.isNull(basicCourse)) {
|
|
|
- groupErrorList.add("[课程代码]不存在");
|
|
|
- } else {
|
|
|
- Long teachingRoomId = basicCourse.getTeachingRoomId();
|
|
|
- SysOrg sysOrg = sysOrgService.getById(teachingRoomId);
|
|
|
- if (Objects.isNull(sysOrg)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("无法找到机构");
|
|
|
- }
|
|
|
- orgName = sysOrg.getName();
|
|
|
- orgId = sysOrg.getId();
|
|
|
- }
|
|
|
- Integer markerCount = null;
|
|
|
- String markerCodes = null;
|
|
|
- List<Integer> markerCountList = groupQuestionList.stream().map(SubjectiveStructDto::getMarkerCount).distinct().collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(markerCountList)) {
|
|
|
- if (markerCountList.size() > 1) {
|
|
|
- groupErrorList.add("[评卷员数量(系统生成)]不一致");
|
|
|
- } else if (markerCountList.size() == 1) {
|
|
|
- markerCount = markerCountList.get(0);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- List<String> markerCodesList = groupQuestionList.stream().map(SubjectiveStructDto::getMarkerCodes).distinct().collect(Collectors.toList());
|
|
|
- if (CollectionUtils.isNotEmpty(markerCodesList)) {
|
|
|
- if (markerCodesList.size() > 1) {
|
|
|
- groupErrorList.add("[绑定工号(英文逗号分隔)]不一致");
|
|
|
- } else if (markerCodesList.size() == 1) {
|
|
|
- markerCodes = markerCodesList.get(0);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 组装评卷员信息
|
|
|
- List<MarkUser> markUsers = new ArrayList<>();
|
|
|
- if (SystemConstant.strNotNull(markerCodes)) {
|
|
|
- // 优先以绑定工号为准
|
|
|
- String[] markerCodeArray = markerCodes.split(SystemConstant.COMMA);
|
|
|
- for (String markerCode : markerCodeArray) {
|
|
|
- SysUser sysUser = sysUserService.getOne(
|
|
|
- new QueryWrapper<SysUser>().lambda().eq(SysUser::getSchoolId, schoolId).eq(SysUser::getLoginName, markerCode).last(SystemConstant.LIMIT1));
|
|
|
- if (Objects.isNull(sysUser)) {
|
|
|
- groupErrorList.add(paperNumberGroupNumberNotice + String.format(
|
|
|
- "[绑定工号(英文逗号分隔)]中的%s,在系统中不存在请先创建用户", markerCode));
|
|
|
- } else {
|
|
|
- // 添加评卷员信息
|
|
|
- MarkUser markUser = new MarkUser();
|
|
|
- markUser.setUserId(sysUser.getId());
|
|
|
- markUser.setLoginName(sysUser.getLoginName());
|
|
|
- markUser.setName(sysUser.getRealName());
|
|
|
- markUser.setOrgName(orgName);
|
|
|
- markUsers.add(markUser);
|
|
|
- }
|
|
|
- }
|
|
|
- } else if (Objects.nonNull(markerCount) && markerCount > 0) {
|
|
|
- // 没有绑定工号且评卷员生成数量大于0,生成评卷员(或使用之前工号相同的评卷员)
|
|
|
- for (int i = 0; i < markerCount; i++) {
|
|
|
- int num = markerNumber.incrementAndGet();
|
|
|
- if (num > 99) {
|
|
|
- paperErrorList.add("[试卷编号]%s的[评卷员数量(系统生成)]总有效数量不能超过99");
|
|
|
- break;
|
|
|
- }
|
|
|
- String markerCode = paperNumber + String.format("%02d", num);
|
|
|
-
|
|
|
- SysUser sysUser = sysUserService.getOne(
|
|
|
- new QueryWrapper<SysUser>().lambda().eq(SysUser::getSchoolId, schoolId).eq(SysUser::getLoginName, markerCode).last(SystemConstant.LIMIT1));
|
|
|
-
|
|
|
- MarkUser markUser = new MarkUser();
|
|
|
- markUser.setLoginName(markerCode);
|
|
|
- markUser.setOrgName(orgName);
|
|
|
- markUsers.add(markUser);
|
|
|
- if (Objects.nonNull(sysUser)) {
|
|
|
- markUser.setUserId(sysUser.getId());
|
|
|
- markUser.setName(sysUser.getRealName());
|
|
|
- } else {
|
|
|
- // 创建用户
|
|
|
- UserSaveParams userSaveParams = new UserSaveParams();
|
|
|
- userSaveParams.setSchoolId(schoolId);
|
|
|
- userSaveParams.setLoginName(markerCode);
|
|
|
- userSaveParams.setRealName(markerCode);
|
|
|
- userSaveParams.setCode(markerCode);
|
|
|
- userSaveParams.setPassword(SystemConstant.DEFAULT_PASSWORD);
|
|
|
- userSaveParams.setOrgId(orgId);
|
|
|
- userSaveParams.setEnable(true);
|
|
|
- userSaveParams.setRoleIds(new Long[]{markerRole.getId()});
|
|
|
- try {
|
|
|
- markUser.setUserId(sysUserService.saveUser(userSaveParams));
|
|
|
- markUser.setName(markerCode);
|
|
|
- } catch (IllegalAccessException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- if (CollectionUtils.isEmpty(groupErrorList) && CollectionUtils.isEmpty(paperErrorList)) {
|
|
|
- // 创建评卷试题
|
|
|
- List<MarkQuestion> markQuestionList = paperQuestionList.stream().filter(e -> groupNumber.equals(e.getGroupNumber())).flatMap(e -> {
|
|
|
- MarkQuestion markQuestion = new MarkQuestion();
|
|
|
- markQuestion.setExamId(examId);
|
|
|
- markQuestion.setPaperNumber(paperNumber);
|
|
|
- markQuestion.setPaperType(OptionsEnum.A.getCode());
|
|
|
- markQuestion.setObjective(false);
|
|
|
- markQuestion.setMainNumber(e.getMainNumber());
|
|
|
- markQuestion.setSubNumber(e.getSubNumber());
|
|
|
- markQuestion.setMainTitle(e.getMainTitle());
|
|
|
- markQuestion.setTotalScore(e.getTotalScore());
|
|
|
- markQuestion.setIntervalScore(e.getIntervalScore());
|
|
|
- markQuestion.setQuestionType(QuestionType.QUESTION_ANSWER.getValue());
|
|
|
- return Stream.of(markQuestion);
|
|
|
- }).collect(Collectors.toList());
|
|
|
- markQuestionService.saveBatch(markQuestionList);
|
|
|
-
|
|
|
- MarkGroupDto markGroupDto = new MarkGroupDto();
|
|
|
- markGroupDto.setDoubleEnable(false);
|
|
|
- markGroupDto.setGroupNumber(groupNumber);
|
|
|
- markGroupDto.setMarkers(markUsers);
|
|
|
- markGroupDto.setQuestions(markQuestionList);
|
|
|
- markGroupDto.setPictureConfigs(new ArrayList<>());
|
|
|
- MarkGroupSingleDto markGroupSingleDto = new MarkGroupSingleDto();
|
|
|
- markGroupSingleDto.setExamId(examId);
|
|
|
- markGroupSingleDto.setPaperNumber(paperNumber);
|
|
|
- markGroupSingleDto.setGroupInfo(markGroupDto);
|
|
|
- markGroupService.saveGroup(markGroupSingleDto);
|
|
|
- }
|
|
|
- if (CollectionUtils.isNotEmpty(groupErrorList)) {
|
|
|
- String groupErrorMsg = paperNumberGroupNumberNotice + String.join(",", groupErrorList);
|
|
|
- paperErrorList.add(groupErrorMsg);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- if (CollectionUtils.isNotEmpty(paperErrorList)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.join(System.lineSeparator(), paperErrorList));
|
|
|
- }
|
|
|
- }
|
|
|
- return map;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 验证机构是否存在
|
|
|
*
|
|
@@ -1993,16 +1274,16 @@ public class TaskLogicServiceImpl implements TaskLogicService {
|
|
|
clazz.setId(teachClazz.getId());
|
|
|
clazz.setName(teachClazz.getClazzName());
|
|
|
} else {
|
|
|
- QueryWrapper<BasicClazz> basicClazzQueryWrapper = new QueryWrapper<>();
|
|
|
- basicClazzQueryWrapper.lambda().eq(BasicClazz::getSchoolId, schoolId)
|
|
|
- .eq(BasicClazz::getClazzName, key)
|
|
|
- .eq(BasicClazz::getEnable, true);
|
|
|
- BasicClazz basicClazz = basicClazzService.getOne(basicClazzQueryWrapper);
|
|
|
- if (Objects.nonNull(basicClazz)) {
|
|
|
- clazz = new DictionaryResult();
|
|
|
- clazz.setId(basicClazz.getId());
|
|
|
- clazz.setName(basicClazz.getClazzName());
|
|
|
- }
|
|
|
+// QueryWrapper<BasicClazz> basicClazzQueryWrapper = new QueryWrapper<>();
|
|
|
+// basicClazzQueryWrapper.lambda().eq(BasicClazz::getSchoolId, schoolId)
|
|
|
+// .eq(BasicClazz::getClazzName, key)
|
|
|
+// .eq(BasicClazz::getEnable, true);
|
|
|
+// BasicClazz basicClazz = basicClazzService.getOne(basicClazzQueryWrapper);
|
|
|
+// if (Objects.nonNull(basicClazz)) {
|
|
|
+// clazz = new DictionaryResult();
|
|
|
+// clazz.setId(basicClazz.getId());
|
|
|
+// clazz.setName(basicClazz.getClazzName());
|
|
|
+// }
|
|
|
}
|
|
|
} else {
|
|
|
clazz = clazzMap.get(key);
|