|
@@ -1,6 +1,7 @@
|
|
package com.qmth.distributed.print.business.service.impl;
|
|
package com.qmth.distributed.print.business.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
@@ -166,11 +167,11 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
}
|
|
}
|
|
|
|
|
|
Set<String> paperNumberSet = basicExamStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperNumber())).map(BasicExamStudent::getPaperNumber).collect(Collectors.toSet());
|
|
Set<String> paperNumberSet = basicExamStudentList.stream().filter(m -> StringUtils.isNotBlank(m.getPaperNumber())).map(BasicExamStudent::getPaperNumber).collect(Collectors.toSet());
|
|
- if(CollectionUtils.isNotEmpty(paperNumberSet)){
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(paperNumberSet)) {
|
|
Long examId = basicExamStudentList.get(0).getExamId();
|
|
Long examId = basicExamStudentList.get(0).getExamId();
|
|
for (String paperNumber : paperNumberSet) {
|
|
for (String paperNumber : paperNumberSet) {
|
|
MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
|
|
MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(examId, paperNumber);
|
|
- if(markPaper == null){
|
|
|
|
|
|
+ if (markPaper == null) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
// 更新扫描数据
|
|
// 更新扫描数据
|
|
@@ -279,6 +280,7 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
if (StringUtils.isNotBlank(dbBasicExamStudent.getPaperType()) && dbBasicExamStudent.getPaperNumber().equals(paperType)) {
|
|
if (StringUtils.isNotBlank(dbBasicExamStudent.getPaperType()) && dbBasicExamStudent.getPaperNumber().equals(paperType)) {
|
|
throw ExceptionResultEnum.ERROR.exception("不允许修改卷型");
|
|
throw ExceptionResultEnum.ERROR.exception("不允许修改卷型");
|
|
}
|
|
}
|
|
|
|
+
|
|
basicExamStudent.updateInfo(requestUserId);
|
|
basicExamStudent.updateInfo(requestUserId);
|
|
} else {
|
|
} else {
|
|
// 新增 (学号在考试课程下唯一)
|
|
// 新增 (学号在考试课程下唯一)
|
|
@@ -287,18 +289,29 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
.eq(BasicExamStudent::getStudentCode, basicExamStudent.getStudentCode())) > 0) {
|
|
.eq(BasicExamStudent::getStudentCode, basicExamStudent.getStudentCode())) > 0) {
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("学号[%s]考生已存在", basicExamStudent.getStudentCode()));
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("学号[%s]考生已存在", basicExamStudent.getStudentCode()));
|
|
}
|
|
}
|
|
- // 试卷编号绑定其它课程
|
|
|
|
|
|
+ basicExamStudent.insertInfo(requestUserId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 试卷编号绑定其它课程
|
|
|
|
+ if (StringUtils.isNotBlank(basicExamStudent.getPaperNumber())) {
|
|
|
|
+ if(StringUtils.isBlank(basicExamStudent.getExamPlace())){
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("校区(考点)必填");
|
|
|
|
+ }
|
|
if (this.count(new QueryWrapper<BasicExamStudent>().lambda()
|
|
if (this.count(new QueryWrapper<BasicExamStudent>().lambda()
|
|
.eq(BasicExamStudent::getExamId, basicExamStudent.getExamId()).eq(BasicExamStudent::getPaperNumber, basicExamStudent.getPaperNumber())
|
|
.eq(BasicExamStudent::getExamId, basicExamStudent.getExamId()).eq(BasicExamStudent::getPaperNumber, basicExamStudent.getPaperNumber())
|
|
.ne(BasicExamStudent::getCourseId, basicExamStudent.getCourseId())) > 0) {
|
|
.ne(BasicExamStudent::getCourseId, basicExamStudent.getCourseId())) > 0) {
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("试卷编号[%s]已绑定其它课程", basicExamStudent.getPaperNumber()));
|
|
throw ExceptionResultEnum.ERROR.exception(String.format("试卷编号[%s]已绑定其它课程", basicExamStudent.getPaperNumber()));
|
|
}
|
|
}
|
|
- if (this.count(new QueryWrapper<BasicExamStudent>().lambda()
|
|
|
|
- .eq(BasicExamStudent::getExamId, basicExamStudent.getExamId()).eq(BasicExamStudent::getPaperNumber, basicExamStudent.getPaperNumber())
|
|
|
|
- .ne(BasicExamStudent::getExamStartTime, basicExamStudent.getExamStartTime()).ne(BasicExamStudent::getExamEndTime, basicExamStudent.getExamEndTime())) > 0) {
|
|
|
|
- throw ExceptionResultEnum.ERROR.exception(String.format("试卷编号[%s]有不同考试时间", basicExamStudent.getPaperNumber()));
|
|
|
|
|
|
+ QueryWrapper<BasicExamStudent> queryWrapper = new QueryWrapper<>();
|
|
|
|
+ LambdaQueryWrapper<BasicExamStudent> lambda = queryWrapper.lambda();
|
|
|
|
+ lambda.eq(BasicExamStudent::getExamId, basicExamStudent.getExamId()).eq(BasicExamStudent::getPaperNumber, basicExamStudent.getPaperNumber())
|
|
|
|
+ .and(m -> m.ne(BasicExamStudent::getExamStartTime, basicExamStudent.getExamStartTime()).or().ne(BasicExamStudent::getExamEndTime, basicExamStudent.getExamEndTime()));
|
|
|
|
+ if (basicExamStudent.getId() != null) {
|
|
|
|
+ lambda.ne(BasicExamStudent::getId, basicExamStudent.getId());
|
|
|
|
+ }
|
|
|
|
+ if (this.count(queryWrapper) > 0) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(String.format("试卷编号[%s]存在不同考试时间", basicExamStudent.getPaperNumber()));
|
|
}
|
|
}
|
|
- basicExamStudent.insertInfo(requestUserId);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
parserRequiredField(basicExamStudent);
|
|
parserRequiredField(basicExamStudent);
|
|
@@ -495,10 +508,19 @@ public class BasicExamStudentServiceImpl extends ServiceImpl<BasicExamStudentMap
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void clearPaperNumberAndPaperType(List<Long> ids) {
|
|
|
|
|
|
+ public void clearPaperNumberAndPaperTypeById(List<Long> ids) {
|
|
UpdateWrapper<BasicExamStudent> updateWrapper = new UpdateWrapper<>();
|
|
UpdateWrapper<BasicExamStudent> updateWrapper = new UpdateWrapper<>();
|
|
updateWrapper.lambda().set(BasicExamStudent::getPaperType, null)
|
|
updateWrapper.lambda().set(BasicExamStudent::getPaperType, null)
|
|
.in(BasicExamStudent::getId, ids);
|
|
.in(BasicExamStudent::getId, ids);
|
|
this.update(updateWrapper);
|
|
this.update(updateWrapper);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void clearPaperNumberAndPaperTypeByExamIdAndPaperNumber(Long examId, String paperNumber) {
|
|
|
|
+ UpdateWrapper<BasicExamStudent> updateWrapper = new UpdateWrapper<>();
|
|
|
|
+ updateWrapper.lambda().set(BasicExamStudent::getPaperType, null)
|
|
|
|
+ .eq(BasicExamStudent::getExamId, examId)
|
|
|
|
+ .eq(BasicExamStudent::getPaperNumber, paperNumber);
|
|
|
|
+ this.update(updateWrapper);
|
|
|
|
+ }
|
|
}
|
|
}
|