|
@@ -23,11 +23,11 @@ import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
|
import com.qmth.teachcloud.mark.service.MarkPaperService;
|
|
|
import com.qmth.teachcloud.mark.service.MarkQuestionService;
|
|
|
import io.swagger.annotations.*;
|
|
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
-import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -242,18 +242,24 @@ public class TCFinalScoreController {
|
|
|
}
|
|
|
}
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
- TCPaperStruct tcPaperStruct = tcPaperStructService.getOne(new QueryWrapper<TCPaperStruct>().lambda().eq(TCPaperStruct::getExamId, paperStructParams.getExamId()).eq(TCPaperStruct::getCourseCode, paperStructParams.getCourseCode()).eq(TCPaperStruct::getPaperNumber, paperStructParams.getPaperNumber()));
|
|
|
- if (Objects.isNull(tcPaperStruct)) {
|
|
|
+ TCPaperStruct tcPaperStructDb = tcPaperStructService.getOne(new QueryWrapper<TCPaperStruct>().lambda().eq(TCPaperStruct::getExamId, paperStructParams.getExamId()).eq(TCPaperStruct::getCourseCode, paperStructParams.getCourseCode()).eq(TCPaperStruct::getPaperNumber, paperStructParams.getPaperNumber()));
|
|
|
+ if (Objects.isNull(tcPaperStructDb)) {
|
|
|
MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(paperStructParams.getExamId(), paperStructParams.getPaperNumber());
|
|
|
Objects.requireNonNull(markPaper, "未找到科目信息");
|
|
|
|
|
|
- tcPaperStruct = new TCPaperStruct(paperStructParams.getExamId(), paperStructParams.getCourseCode(), markPaper.getCourseName(), paperStructParams.getPaperNumber(), JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId());
|
|
|
+ tcPaperStructDb = new TCPaperStruct(paperStructParams.getExamId(), paperStructParams.getCourseCode(), markPaper.getCourseName(), paperStructParams.getPaperNumber(), JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId());
|
|
|
+ tcPaperStructService.save(tcPaperStructDb);
|
|
|
} else {
|
|
|
- tcPaperStruct.updateInfo(JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId());
|
|
|
+ TCPaperStruct tcPaperStructSource = new TCPaperStruct();
|
|
|
+ BeanUtils.copyProperties(tcPaperStructDb, tcPaperStructSource);
|
|
|
+ tcPaperStructDb.updateInfo(JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId());
|
|
|
+ if (!tcPaperStructDb.equals(tcPaperStructSource)) {
|
|
|
+ trExamStudentService.remove(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber());
|
|
|
+ trBasicInfoService.remove(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber());
|
|
|
+ tcPaperStructService.updateById(tcPaperStructDb);
|
|
|
+ }
|
|
|
}
|
|
|
- trExamStudentService.remove(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber());
|
|
|
- trBasicInfoService.remove(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber());
|
|
|
- return ResultUtil.ok(tcPaperStructService.saveOrUpdate(tcPaperStruct));
|
|
|
+ return ResultUtil.ok(true);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "期末成绩试卷蓝图查询")
|
|
@@ -264,7 +270,6 @@ public class TCFinalScoreController {
|
|
|
@ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
|
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
|
|
|
List<PaperStructResult> paperStructResultList = null;
|
|
|
-// org.apache.commons.collections4.CollectionUtils.isEqualCollection()
|
|
|
TCPaperStruct tcPaperStruct = tcPaperStructService.getOne(new QueryWrapper<TCPaperStruct>().lambda().eq(TCPaperStruct::getExamId, examId).eq(TCPaperStruct::getCourseCode, courseCode).eq(TCPaperStruct::getPaperNumber, paperNumber));
|
|
|
if (Objects.isNull(tcPaperStruct)) {
|
|
|
List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
|