|
@@ -9,7 +9,6 @@ import com.qmth.distributed.print.business.bean.dto.ObjectiveStructDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.SubjectiveStructDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.importFile.BasicExamStudentImport;
|
|
|
import com.qmth.distributed.print.business.bean.dto.importFile.BasicExamStudentParseDto;
|
|
|
-import com.qmth.teachcloud.common.bean.examRule.CodeNameEnableValue;
|
|
|
import com.qmth.distributed.print.business.entity.BasicExamRule;
|
|
|
import com.qmth.distributed.print.business.enums.RequiredFieldsEnum;
|
|
|
import com.qmth.distributed.print.business.service.BasicExamRuleService;
|
|
@@ -18,6 +17,7 @@ import com.qmth.distributed.print.business.service.BasicExamStudentService;
|
|
|
import com.qmth.distributed.print.business.templete.service.ImportLogicService;
|
|
|
import com.qmth.teachcloud.common.base.BaseEntity;
|
|
|
import com.qmth.teachcloud.common.bean.dto.mark.MarkUser;
|
|
|
+import com.qmth.teachcloud.common.bean.examRule.CodeNameEnableDisabledValue;
|
|
|
import com.qmth.teachcloud.common.bean.params.UserSaveParams;
|
|
|
import com.qmth.teachcloud.common.bean.result.ExcelResult;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
@@ -139,7 +139,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
|
|
|
StringJoiner stringJoiner = new StringJoiner(";");
|
|
|
// 校验excel内容
|
|
|
basicExamStudentImport.getRequiredFieldList().forEach(m -> {
|
|
|
- if (m.getEnable() && StringUtils.isBlank(m.getValue())) {
|
|
|
+ if (m.getDisabled() && StringUtils.isBlank(m.getValue())) {
|
|
|
stringJoiner.add(m.getName() + "必填");
|
|
|
}
|
|
|
if (m.getCode().equals(RequiredFieldsEnum.PAPER_NUMBER.getCode()) && needPaperNumber) {
|
|
@@ -169,7 +169,7 @@ public class ImportLogicServiceImpl implements ImportLogicService {
|
|
|
List<SysOrg> sysOrgList = sysOrgService.getSecondOrg(schoolId, basicExamStudentImport.getTeachingRoomName());
|
|
|
if (CollectionUtils.isEmpty(sysOrgList)) {
|
|
|
stringJoiner.add("开课学院[" + basicExamStudentImport.getTeachingRoomName() + "]在学院层级不存在");
|
|
|
- } else {
|
|
|
+ } else if (sysOrgList.size() == 1) {
|
|
|
SysOrg sysOrg = sysOrgList.get(0);
|
|
|
// 校验课程代码和开课学院
|
|
|
BasicCourse basicCourse = basicCourseService.getByTeachRoomIdAndCode(sysOrg.getId(), basicExamStudentImport.getCourseCode());
|
|
@@ -179,6 +179,8 @@ public class ImportLogicServiceImpl implements ImportLogicService {
|
|
|
basicExamStudent.setCourseId(basicCourse.getId());
|
|
|
basicCourseIdMap.put(key, basicCourse.getId());
|
|
|
}
|
|
|
+ } else {
|
|
|
+ stringJoiner.add("开课学院[" + basicExamStudentImport.getTeachingRoomName() + "]存在多个");
|
|
|
}
|
|
|
} else {
|
|
|
basicExamStudent.setCourseId(basicCourseIdMap.get(key));
|
|
@@ -275,12 +277,12 @@ public class ImportLogicServiceImpl implements ImportLogicService {
|
|
|
} catch (IllegalAccessException e) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("表头为[" + entry.getKey() + "]的值赋值失败");
|
|
|
}
|
|
|
- basicExamStudentImport.getRequiredFieldList().add(new CodeNameEnableValue(enumResult.getCode(), enumResult.getName(), enumResult.getEnable(), entry.getValue()));
|
|
|
+ basicExamStudentImport.getRequiredFieldList().add(new CodeNameEnableDisabledValue(enumResult.getCode(), enumResult.getName(), enumResult.getEnable(), enumResult.getDisabled(), entry.getValue()));
|
|
|
}
|
|
|
// 扩展字段
|
|
|
if (extendMap.containsKey(entry.getKey())) {
|
|
|
EnumResult enumResult = extendMap.get(entry.getKey());
|
|
|
- basicExamStudentImport.getExtendFieldList().add(new CodeNameEnableValue(enumResult.getCode(), enumResult.getName(), enumResult.getEnable(), entry.getValue()));
|
|
|
+ basicExamStudentImport.getExtendFieldList().add(new CodeNameEnableDisabledValue(enumResult.getCode(), enumResult.getName(), enumResult.getEnable(), enumResult.getDisabled(), entry.getValue()));
|
|
|
}
|
|
|
}
|
|
|
list.add(basicExamStudentImport);
|
|
@@ -772,7 +774,6 @@ public class ImportLogicServiceImpl implements ImportLogicService {
|
|
|
if (Objects.isNull(basicExam)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("考试不存在");
|
|
|
}
|
|
|
- Long semesterId = SystemConstant.convertIdToLong(basicExam.getSemesterId());
|
|
|
|
|
|
SystemConstant.addSummary(stringJoinerSummary, "开始解析文件内容");
|
|
|
BasicExamStudentParseDto basicExamStudentParseDto;
|
|
@@ -794,9 +795,6 @@ public class ImportLogicServiceImpl implements ImportLogicService {
|
|
|
.eq(BasicExamStudent::getSchoolId, schoolId).eq(BasicExamStudent::getExamId, examId));
|
|
|
Map<String, Long> courseIdStudentCodeMap = basicExamStudentList.stream().collect(Collectors.toMap(k -> k.getCourseId() + SystemConstant.HYPHEN + k.getStudentCode(), BaseEntity::getId));
|
|
|
|
|
|
- BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
|
|
|
- boolean needPaperNumber = (basicSchool.getHasPaperNumber() != null && basicSchool.getHasPaperNumber()) || ExamModelEnum.MODEL4.equals(basicExam.getExamModel());
|
|
|
-
|
|
|
Map<String, Long> basicCourseIdMap = new HashMap<>();
|
|
|
// 是否有错误提示
|
|
|
boolean hasError = false;
|
|
@@ -852,8 +850,9 @@ public class ImportLogicServiceImpl implements ImportLogicService {
|
|
|
}
|
|
|
|
|
|
if (basicExamStudent.getCourseId() != null) {
|
|
|
- if (courseIdStudentCodeMap.containsKey(basicExamStudent.getCourseId() + SystemConstant.HYPHEN + basicExamStudent.getStudentCode())) {
|
|
|
- basicExamStudent.setId(courseIdStudentCodeMap.get(basicExamStudent.getCourseId() + SystemConstant.HYPHEN + basicExamStudent.getStudentCode()));
|
|
|
+ String studentKey = basicExamStudent.getCourseId() + SystemConstant.HYPHEN + basicExamStudentImport.getStudentCode();
|
|
|
+ if (courseIdStudentCodeMap.containsKey(studentKey)) {
|
|
|
+ basicExamStudent.setId(courseIdStudentCodeMap.get(studentKey));
|
|
|
} else {
|
|
|
stringJoiner.add(String.format("课程代码[%s],开课学院[%s],学号[%s]考生管理中不存在", basicExamStudentImport.getCourseCode(), basicExamStudentImport.getTeachingRoomName(), basicExamStudentImport.getStudentCode()));
|
|
|
}
|