|
@@ -7,16 +7,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qmth.distributed.print.business.bean.dto.BasicExamStudentDto;
|
|
|
import com.qmth.distributed.print.business.bean.params.BasicExamStudentParam;
|
|
|
import com.qmth.distributed.print.business.bean.result.BasicExamStudentResult;
|
|
|
-import com.qmth.distributed.print.business.entity.BasicTeachClazz;
|
|
|
import com.qmth.distributed.print.business.mapper.BasicExamStudentMapper;
|
|
|
+import com.qmth.distributed.print.business.service.BasicExamService;
|
|
|
import com.qmth.distributed.print.business.service.BasicExamStudentService;
|
|
|
import com.qmth.distributed.print.business.service.BasicTeachClazzService;
|
|
|
import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
-import com.qmth.teachcloud.common.entity.BasicCourse;
|
|
|
-import com.qmth.teachcloud.common.entity.BasicExamStudent;
|
|
|
-import com.qmth.teachcloud.common.entity.BasicSchool;
|
|
|
-import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
+import com.qmth.teachcloud.common.entity.*;
|
|
|
+import com.qmth.teachcloud.common.enums.ExamModelEnum;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
import com.qmth.teachcloud.common.service.BasicRoleDataPermissionService;
|
|
@@ -25,7 +23,9 @@ import com.qmth.teachcloud.common.service.SysUserService;
|
|
|
import com.qmth.teachcloud.common.util.ConvertUtil;
|
|
|
import com.qmth.teachcloud.common.util.ExcelUtil;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
+import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
|
import com.qmth.teachcloud.mark.entity.MarkStudent;
|
|
|
+import com.qmth.teachcloud.mark.service.MarkPaperService;
|
|
|
import com.qmth.teachcloud.mark.service.MarkStudentService;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -61,7 +61,11 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
@Resource
|
|
|
private CommonCacheService commonCacheService;
|
|
|
@Resource
|
|
|
+ private MarkPaperService markPaperService;
|
|
|
+ @Resource
|
|
|
private MarkStudentService markStudentService;
|
|
|
+ @Resource
|
|
|
+ private BasicExamService basicExamService;
|
|
|
|
|
|
@Override
|
|
|
public IPage<BasicExamStudentResult> page(SysUser requestUser, Long semesterId, Long examId, String courseCode,
|
|
@@ -127,11 +131,19 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
@Transactional
|
|
|
@Override
|
|
|
public Long save(BasicExamStudentParam basicExamStudentParam, SysUser requestUser) {
|
|
|
- BasicExamStudent basicExamStudent = this.editEntityHelp(basicExamStudentParam, requestUser);
|
|
|
+ BasicExam basicExam = basicExamService.getById(basicExamStudentParam.getExamId());
|
|
|
+ BasicExamStudent basicExamStudent = this.editEntityHelp(basicExamStudentParam, basicExam, requestUser);
|
|
|
this.saveOrUpdate(basicExamStudent);
|
|
|
if (StringUtils.isNotBlank(basicExamStudent.getPaperNumber())) {
|
|
|
+ MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber());
|
|
|
+ if (markPaper == null) {
|
|
|
+ BasicCourse basicCourse = basicCourseService.getByCode(basicExamStudent.getCourseCode());
|
|
|
+ markPaper = new MarkPaper(basicExamStudent.getExamId(), basicExamStudent.getCourseCode(), basicCourse.getName(), basicExamStudent.getPaperNumber(), String.valueOf(System.currentTimeMillis()), requestUser.getId(), SystemConstant.DEFAULT_PAPER_TYPE_A);
|
|
|
+ markPaperService.save(markPaper);
|
|
|
+ }
|
|
|
// 同步更新扫描阅卷考生表
|
|
|
- markStudentService.updateByBasicExamStudent(basicExamStudent, new HashSet<>());
|
|
|
+ markStudentService.updateByBasicExamStudent(basicExamStudent, markPaper, new HashSet<>());
|
|
|
+ markPaperService.updateStudentCountByExamIdAndPaperNumberAndPaperType(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), SystemConstant.DEFAULT_PAPER_TYPE_A);
|
|
|
}
|
|
|
return basicExamStudent.getId();
|
|
|
}
|
|
@@ -165,7 +177,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
List<BasicExamStudent> basicExamStudentList = this.listByIds(idList);
|
|
|
for (BasicExamStudent basicExamStudent : basicExamStudentList) {
|
|
|
MarkStudent markStudent = markStudentService.findByExamIdAndPaperNumberAndStudentCode(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), basicExamStudent.getStudentCode());
|
|
|
- if(markStudent!= null && !markStudent.getUpload()){
|
|
|
+ if (markStudent != null && !markStudent.getUpload()) {
|
|
|
markStudentService.deleteByExamIdAndPaperNumberAndStudentCode(basicExamStudent.getExamId(), basicExamStudent.getPaperNumber(), basicExamStudent.getStudentCode());
|
|
|
}
|
|
|
}
|
|
@@ -182,7 +194,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
* @return 考生对象
|
|
|
*/
|
|
|
@Override
|
|
|
- public BasicExamStudent editEntityHelp(BasicExamStudentParam basicExamStudentParam, SysUser requestUser) {
|
|
|
+ public BasicExamStudent editEntityHelp(BasicExamStudentParam basicExamStudentParam, BasicExam basicExam, SysUser requestUser) {
|
|
|
List<String> errorMsgList = new ArrayList<>();
|
|
|
Long schoolId = requestUser.getSchoolId();
|
|
|
Long requestUserId = requestUser.getId();
|
|
@@ -206,35 +218,35 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
|
|
|
// 校验1 学期、考试、课程为下拉框,姓名、学号、教学班为文本框,均必填;
|
|
|
if (!SystemConstant.longNotNull(semesterId)) {
|
|
|
- errorMsgList.add("缺少学期id");
|
|
|
+ errorMsgList.add("请选择学期");
|
|
|
}
|
|
|
if (!SystemConstant.longNotNull(examId)) {
|
|
|
- errorMsgList.add("缺少考试id");
|
|
|
+ errorMsgList.add("请选择考试");
|
|
|
}
|
|
|
if (!SystemConstant.strNotNull(courseCode)) {
|
|
|
- errorMsgList.add("缺少课程编号");
|
|
|
+ errorMsgList.add("请选择课程");
|
|
|
}
|
|
|
BasicCourse basicCourse = basicCourseService.findByCourseCode(courseCode, schoolId);
|
|
|
if (Objects.isNull(basicCourse)) {
|
|
|
- errorMsgList.add(String.format("缺少课程编号为[%s]", courseCode));
|
|
|
+ errorMsgList.add(String.format("课程代码[%s]在课程管理中不存在", courseCode));
|
|
|
}
|
|
|
|
|
|
if (!SystemConstant.strNotNull(studentName)) {
|
|
|
- errorMsgList.add("缺少学生姓名");
|
|
|
+ errorMsgList.add("姓名必填");
|
|
|
}
|
|
|
if (!SystemConstant.strNotNull(studentCode)) {
|
|
|
- errorMsgList.add("缺少学号");
|
|
|
+ errorMsgList.add("学号必填");
|
|
|
}
|
|
|
if (!SystemConstant.strNotNull(teachClazz)) {
|
|
|
- errorMsgList.add("缺少教学班名称");
|
|
|
+ errorMsgList.add("教学班必填");
|
|
|
}
|
|
|
|
|
|
Long teacherId = null;
|
|
|
if (SystemConstant.strNotNull(teacherCode) && !SystemConstant.strNotNull(teacherName)) {
|
|
|
- errorMsgList.add("存在任课老师工号,但缺少任课老师姓名");
|
|
|
+ errorMsgList.add("任课老师必填");
|
|
|
}
|
|
|
if (SystemConstant.strNotNull(teacherName) && !SystemConstant.strNotNull(teacherCode)) {
|
|
|
- errorMsgList.add("存在任课老师姓名,但缺少任课老师工号");
|
|
|
+ errorMsgList.add("任课老师工号必填");
|
|
|
}
|
|
|
if (SystemConstant.strNotNull(teacherName) && SystemConstant.strNotNull(teacherCode)) {
|
|
|
// 存在教师信息,根据工号查询,不存在报错(缺少机构信息没法直接创建教师)
|
|
@@ -243,7 +255,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
.eq(SysUser::getCode, teacherCode).eq(SysUser::getRealName, teacherName)
|
|
|
.last(SystemConstant.LIMIT1));
|
|
|
if (Objects.isNull(teacher)) {
|
|
|
- errorMsgList.add(String.format("工号为[%s],姓名为[%s]的老师不存在,请先创建", teacherCode, teacherName));
|
|
|
+ errorMsgList.add(String.format("任课老师工号[%s],任课老师[%s]在用户管理中不存在", teacherCode, teacherName));
|
|
|
} else {
|
|
|
teacherId = teacher.getId();
|
|
|
}
|
|
@@ -253,21 +265,21 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
|
BasicSchool basicSchool = commonCacheService.schoolCache(schoolId);
|
|
|
boolean needPaperNumber = basicSchool.getHasPaperNumber();
|
|
|
if (SystemConstant.strNotNull(paperNumber)) {
|
|
|
- String hasPaperNumberError = "存在试卷编号时: ";
|
|
|
+ String hasPaperNumberError = "试卷编号不为空时: ";
|
|
|
if (!SystemConstant.strNotNull(teacherCode) || !SystemConstant.strNotNull(teacherName)) {
|
|
|
- errorMsgList.add(hasPaperNumberError + "缺少任课教师信息");
|
|
|
+ errorMsgList.add(hasPaperNumberError + "任课老师、任课老师工号必填");
|
|
|
}
|
|
|
if (!SystemConstant.longNotNull(examStartTime) || !SystemConstant.longNotNull(examEndTime)) {
|
|
|
- errorMsgList.add(hasPaperNumberError + "缺少考试时间");
|
|
|
+ errorMsgList.add(hasPaperNumberError + "考试时间必填");
|
|
|
}
|
|
|
if (!SystemConstant.strNotNull(examPlace)) {
|
|
|
- errorMsgList.add(hasPaperNumberError + "缺少考点信息");
|
|
|
+ errorMsgList.add(hasPaperNumberError + "考点(校区)必填");
|
|
|
}
|
|
|
if (!SystemConstant.strNotNull(examRoom)) {
|
|
|
- errorMsgList.add(hasPaperNumberError + "缺少考场信息");
|
|
|
+ errorMsgList.add(hasPaperNumberError + "考场(考试教室)必填");
|
|
|
}
|
|
|
- } else if (needPaperNumber) {
|
|
|
- errorMsgList.add("缺少试卷编号");
|
|
|
+ } else if (needPaperNumber || ExamModelEnum.MODEL4.equals(basicExam.getExamModel())) {
|
|
|
+ errorMsgList.add("试卷编号必填");
|
|
|
}
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(errorMsgList)) {
|