|
@@ -1,5 +1,6 @@
|
|
|
package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -939,6 +940,20 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
map.computeIfAbsent(SystemConstant.APPROVE_REMARK, v -> sysUser.getRealName() + "(" + remark + ")" + FlowApprovePassEnum.CANCEL.getTitle());
|
|
|
map.computeIfAbsent(SystemConstant.APPROVE_SETUP, v -> FlowApproveSetupEnum.SUBMIT.getSetup());
|
|
|
activitiService.taskApprove(map);
|
|
|
+
|
|
|
+ // 清除cardId
|
|
|
+ ExamTaskDetail examTaskDetail = examTaskDetailService.getByExamTaskId(examTask.getId());
|
|
|
+ String paperAttachmentIds = examTaskDetail.getPaperAttachmentIds();
|
|
|
+ if (StringUtils.isNotBlank(paperAttachmentIds)) {
|
|
|
+ List<JSONObject> objects = JSON.parseArray(paperAttachmentIds, JSONObject.class);
|
|
|
+ for (JSONObject object : objects) {
|
|
|
+ object.put("cardId", "");
|
|
|
+ object.put("cardType", "");
|
|
|
+ object.put("cardTitle", "");
|
|
|
+ }
|
|
|
+ examTaskDetail.setPaperAttachmentIds(JSON.toJSONString(objects));
|
|
|
+ examTaskDetailService.updateById(examTaskDetail);
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
|
|
@@ -1546,7 +1561,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
throw ExceptionResultEnum.ERROR.exception("未查到考试信息");
|
|
|
}
|
|
|
|
|
|
- BasicCourse basicCourse = basicCourseService.findByCourseCode(examTask.getCourseCode(),schoolId);
|
|
|
+ BasicCourse basicCourse = basicCourseService.findByCourseCode(examTask.getCourseCode(), schoolId);
|
|
|
|
|
|
if (ExamModelEnum.MODEL1.equals(basicExam.getExamModel()) || ExamModelEnum.MODEL2.equals(basicExam.getExamModel())) {
|
|
|
// 创建印刷计划
|
|
@@ -1591,8 +1606,8 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
examDetail.setOrgId(sysUser.getOrgId());
|
|
|
examDetail.setPrintPlanId(examPrintPlan.getId());
|
|
|
examDetail.setPrintPlanName(examPrintPlan.getName());
|
|
|
- examDetail.setExamPlace(StringUtils.isBlank(examDetailList.getExamPlace()) ? "考点" + i : examDetailList.getExamPlace()); // 默认填充班级所在校区
|
|
|
- examDetail.setExamRoom(StringUtils.isBlank(examDetailList.getExamRoom()) ? clazzName : examDetailList.getExamRoom()); // 默认填充班级
|
|
|
+ examDetail.setExamPlace(examDetailList.getExamPlace()); // 无默认值
|
|
|
+ examDetail.setExamRoom(examDetailList.getExamRoom()); // 无默认值
|
|
|
examDetail.setStatus(ExamDetailStatusEnum.NEW);
|
|
|
examDetail.setExamStartTime(examDetailParams.getExamStartTime());
|
|
|
examDetail.setExamEndTime(examDetailParams.getExamEndTime());
|
|
@@ -1728,7 +1743,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
SysOrg schoolOrg = schoolOrgList.get(0);
|
|
|
List<SysOrg> collegeList = orgList.stream().filter(e -> Objects.equals(schoolOrg.getId(), e.getParentId())).collect(Collectors.toList());
|
|
|
SysOrg college = new SysOrg();
|
|
|
- if (collegeList.size() == 1){
|
|
|
+ if (collegeList.size() == 1) {
|
|
|
college = collegeList.get(0);
|
|
|
}
|
|
|
|
|
@@ -1754,7 +1769,7 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
// ---- 组装Dto
|
|
|
ExamTaskApprovalFormDto examTaskApprovalFormDto = new ExamTaskApprovalFormDto();
|
|
|
BasicInfo basicInfo = new BasicInfo();
|
|
|
- if (Objects.nonNull(college)){
|
|
|
+ if (Objects.nonNull(college)) {
|
|
|
basicInfo.setCollegeId(college.getId());
|
|
|
basicInfo.setCollegeName(college.getName());
|
|
|
}
|
|
@@ -1856,15 +1871,20 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
- public List<ExamTaskStudentObjectResult> findExamTaskStudentObject(ExamObjectType examObjectType, Long basicCourseId, SysUser requestUser) throws Exception {
|
|
|
+ public List<ExamTaskStudentObjectResult> findExamTaskStudentObject(ExamObjectType examObjectType, String courseCode, SysUser requestUser) throws Exception {
|
|
|
Long schoolId = requestUser.getSchoolId();
|
|
|
Long userId = requestUser.getId();
|
|
|
List<ExamTaskStudentObjectResult> result = new ArrayList<>();
|
|
|
switch (examObjectType) {
|
|
|
case TEACH_CLAZZ_STUDENT:
|
|
|
- if (!SystemConstant.longNotNull(basicCourseId)) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("缺少考试课程id");
|
|
|
+ if (!SystemConstant.strNotNull(courseCode)) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("缺少考试课程编号");
|
|
|
}
|
|
|
+ BasicCourse basicCourse = basicCourseService.getOne(new QueryWrapper<BasicCourse>().lambda().eq(BasicCourse::getSchoolId,schoolId).eq(BasicCourse::getCode,courseCode));
|
|
|
+ if (Objects.isNull(basicCourse)){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("找不到课程编号对应的课程");
|
|
|
+ }
|
|
|
+ Long basicCourseId = basicCourse.getId();
|
|
|
TeachCourse teachCourse = teachCourseService.getOne(new QueryWrapper<TeachCourse>().lambda().eq(TeachCourse::getSchoolId, schoolId).eq(TeachCourse::getBasicCourseId, basicCourseId));
|
|
|
if (Objects.nonNull(teachCourse)) {
|
|
|
// 教学班对象
|
|
@@ -2012,8 +2032,56 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
}
|
|
|
return finalExcelList;
|
|
|
});
|
|
|
+ // 校验已经有的考生所在部门的信息是否正确
|
|
|
+ // 导入的excel创建或查询的学生集合
|
|
|
+ List<BasicStudentResult> studentDatasource = basicStudentService.basicStudentList(requestUser.getSchoolId(), null, null, null, null);
|
|
|
+
|
|
|
+ List<ExamStudentImportDto> existStudentList = examStudentImportDtoList
|
|
|
+ .stream()
|
|
|
+ .filter(e -> studentDatasource.stream().map(BasicStudentResult::getStudentCode).collect(Collectors.toList()).contains(e.getStudentCode()))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ for (ExamStudentImportDto examStudentImportDto : existStudentList) {
|
|
|
+ String studentName = examStudentImportDto.getStudentName();
|
|
|
+ String studentCode = examStudentImportDto.getStudentCode();
|
|
|
+ String impCollegeName = examStudentImportDto.getCollegeName();
|
|
|
+ String impMajorName = examStudentImportDto.getMajorName();
|
|
|
+ String impClazzName = examStudentImportDto.getClazzName();
|
|
|
+
|
|
|
+
|
|
|
+ List<BasicStudentResult> basicStudentList = studentDatasource.stream().filter(e -> e.getStudentCode().equals(studentCode)).collect(Collectors.toList());
|
|
|
+ if (basicStudentList.size() != 1){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("学号为:" + studentCode + "的考生数据异常");
|
|
|
+ }
|
|
|
+ BasicStudentResult basicStudent = basicStudentList.get(0);
|
|
|
+
|
|
|
+ String realityCollegeName = basicStudent.getCollegeName();
|
|
|
+ String realityMajorName = basicStudent.getMajorName();
|
|
|
+ String realityClazzName = basicStudent.getClazz();
|
|
|
+
|
|
|
+ // 学院核对
|
|
|
+ if (!impCollegeName.equals(realityCollegeName)){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("导入的考生【" + studentName + "(" + studentCode + ")】所在学院【" + impCollegeName +
|
|
|
+ "】与该考生实际所在学院【" + realityCollegeName + "】不符,请检验excel数据是否异常或联系管理员核对");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 专业核对
|
|
|
+ if (!impMajorName.equals(realityMajorName)){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("导入的考生【" + studentName + "(" + studentCode + ")】所在专业【" + impMajorName +
|
|
|
+ "】与该考生实际所在专业【" + realityMajorName + "】不符,请检验excel数据是否异常或联系管理员核对");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 班级核对
|
|
|
+ if (!impClazzName.equals(realityClazzName)){
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("导入的考生【" + studentName + "(" + studentCode + ")】所在班级【" + impClazzName +
|
|
|
+ "】与该考生实际所在班级【" + realityClazzName + "】不符,请检验excel数据是否异常或联系管理员核对");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 去掉已存在的学生集合
|
|
|
+ List<ExamStudentImportDto> willAddStudentList = new ArrayList<>(examStudentImportDtoList);
|
|
|
+ willAddStudentList.removeAll(existStudentList);
|
|
|
+
|
|
|
// 创建基础学生信息
|
|
|
- List<BasicStudentExtrasParam> basicStudentExtrasParamList = examStudentImportDtoList.stream().flatMap(e -> {
|
|
|
+ List<BasicStudentExtrasParam> basicStudentExtrasParamList = willAddStudentList.stream().flatMap(e -> {
|
|
|
BasicStudentExtrasParam basicStudentExtrasParam = new BasicStudentExtrasParam();
|
|
|
basicStudentExtrasParam.setStudentName(e.getStudentName());
|
|
|
basicStudentExtrasParam.setStudentCode(e.getStudentCode());
|
|
@@ -2030,30 +2098,30 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
List<ExamTaskExamStudentImportResult> result = new ArrayList<>();
|
|
|
|
|
|
List<String> studentCodeDatasource = examStudentImportDtoList.stream().map(ExamStudentImportDto::getStudentCode).distinct().collect(Collectors.toList());
|
|
|
- List<String> examRoomDatasource = examStudentImportDtoList.stream().map(ExamStudentImportDto::getExamRoom).distinct().collect(Collectors.toList());
|
|
|
// 导入的excel创建或查询的学生集合
|
|
|
List<BasicStudentResult> basicStudentResultDatasource = basicStudentService.basicStudentList(requestUser.getSchoolId(), null, null, null, studentCodeDatasource);
|
|
|
|
|
|
- for (String examRoom : examRoomDatasource) {
|
|
|
- // 考点
|
|
|
- List<String> examPlaceList = examStudentImportDtoList
|
|
|
- .stream()
|
|
|
- .filter(e -> examRoom.equals(e.getExamRoom()))
|
|
|
- .map(ExamStudentImportDto::getExamPlace)
|
|
|
- .distinct()
|
|
|
- .collect(Collectors.toList());
|
|
|
- if (examPlaceList.size() > 1) {
|
|
|
- throw ExceptionResultEnum.ERROR.exception("异常:考场对应多个考点");
|
|
|
- }
|
|
|
- String examPlace = examPlaceList.get(0);
|
|
|
+ // 考试对象键(考点、考场)
|
|
|
+ List<Map<String,String>> examObjectKeyList = examStudentImportDtoList.stream().flatMap(e -> {
|
|
|
+ Map<String,String> key = new HashMap<>();
|
|
|
+ key.put("examPlace",e.getExamPlace());
|
|
|
+ key.put("examRoom",e.getExamRoom());
|
|
|
+ return Stream.of(key);
|
|
|
+ }).distinct().collect(Collectors.toList());
|
|
|
|
|
|
+ for (Map<String,String> key : examObjectKeyList) {
|
|
|
+ // 考点
|
|
|
+ String examPlace = key.get("examPlace");
|
|
|
+ // 考场
|
|
|
+ String examRoom = key.get("examRoom");
|
|
|
|
|
|
- // 该考场学号集合
|
|
|
+ // 该考试对象考生考号集合
|
|
|
List<String> studentCodeList = examStudentImportDtoList.stream()
|
|
|
- .filter(e -> examRoom.equals(e.getExamRoom()))
|
|
|
+ .filter(e -> examPlace.equals(e.getExamPlace()) && examRoom.equals(e.getExamRoom()))
|
|
|
.map(ExamStudentImportDto::getStudentCode)
|
|
|
.distinct()
|
|
|
.collect(Collectors.toList());
|
|
|
+
|
|
|
List<ExamTaskStudentObjectResult> examTaskStudentObjectResultList = new ArrayList<>();
|
|
|
List<BasicStudentResult> basicStudentResultList = basicStudentResultDatasource.stream().filter(e -> studentCodeList.contains(e.getStudentCode())).collect(Collectors.toList());
|
|
|
List<Long> basicClazzIdList = basicStudentResultList.stream().map(BasicStudentResult::getClazzId).distinct().collect(Collectors.toList());
|
|
@@ -2077,13 +2145,14 @@ public class ExamTaskServiceImpl extends ServiceImpl<ExamTaskMapper, ExamTask> i
|
|
|
examTaskStudentObjectResult.setStudentInfoList(studentInfoList);
|
|
|
examTaskStudentObjectResult.setStudentClazzType(ExamObjectType.IMPORT_STUDENT.getStudentClazzType());
|
|
|
examTaskStudentObjectResultList.add(examTaskStudentObjectResult);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
|
|
|
ExamTaskExamStudentImportResult examTaskExamStudentImportResult = new ExamTaskExamStudentImportResult();
|
|
|
examTaskExamStudentImportResult.setExamRoom(examRoom);
|
|
|
- examTaskExamStudentImportResult.setExamPlace(examPlace);
|
|
|
+ if (SystemConstant.strNotNull(examPlace)) {
|
|
|
+ examTaskExamStudentImportResult.setExamPlace(examPlace);
|
|
|
+ }
|
|
|
examTaskExamStudentImportResult.setExamTaskStudentObjectResultList(examTaskStudentObjectResultList);
|
|
|
result.add(examTaskExamStudentImportResult);
|
|
|
}
|