|
@@ -9,6 +9,7 @@ import com.qmth.distributed.print.business.bean.result.CourseWeightResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.EditResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.report.PaperStructDimensionResult;
|
|
|
import com.qmth.distributed.print.business.entity.TCPaperStruct;
|
|
|
+import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
|
import com.qmth.distributed.print.business.service.TCFinalScoreService;
|
|
|
import com.qmth.distributed.print.business.service.TCPaperStructService;
|
|
|
import com.qmth.distributed.print.business.service.TRBasicInfoService;
|
|
@@ -20,7 +21,6 @@ import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
|
|
|
import com.qmth.teachcloud.common.util.*;
|
|
|
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;
|
|
@@ -39,6 +39,7 @@ import java.math.BigDecimal;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -64,13 +65,10 @@ public class TCPaperStructController {
|
|
|
TCPaperStructService tcPaperStructService;
|
|
|
|
|
|
@Resource
|
|
|
- MarkPaperService markPaperService;
|
|
|
-
|
|
|
- @Resource
|
|
|
- RedisUtil redisUtil;
|
|
|
+ TRBasicInfoService trBasicInfoService;
|
|
|
|
|
|
@Resource
|
|
|
- TRBasicInfoService trBasicInfoService;
|
|
|
+ PrintCommonService printCommonService;
|
|
|
|
|
|
@ApiOperation(value = "导入试卷结构")
|
|
|
@RequestMapping(value = "/final_score/paper_struct/import", method = RequestMethod.POST)
|
|
@@ -103,17 +101,23 @@ public class TCPaperStructController {
|
|
|
throw ExceptionResultEnum.ERROR.exception("一个题只能属于一个目标");
|
|
|
}
|
|
|
}
|
|
|
- Double score = paperStructParams.getPaperStruct().stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
|
|
|
+ List<PaperStructDimensionResult> paperStructDimensionResultList = paperStructParams.getPaperStruct();
|
|
|
+ Double score = paperStructDimensionResultList.stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
|
|
|
if (new BigDecimal(score).compareTo(c.getTotalWeight()) == 1) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]知识点小题总分大于该课程目标分,请重新设置");
|
|
|
}
|
|
|
+ paperStructDimensionResultList.stream().filter(s -> {
|
|
|
+ if (Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())) {
|
|
|
+ s.getTargetList().stream().peek(e -> e.setQuestionScoreSum(score)).collect(Collectors.toList());
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
}
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
TCPaperStruct tcPaperStructDb = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber());
|
|
|
if (Objects.isNull(tcPaperStructDb)) {
|
|
|
- MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(paperStructParams.getExamId(), paperStructParams.getPaperNumber());
|
|
|
- Objects.requireNonNull(markPaper, "未找到科目信息");
|
|
|
-
|
|
|
+ MarkPaper markPaper = printCommonService.getMarkPaper(paperStructParams.getExamId(), paperStructParams.getPaperNumber());
|
|
|
tcPaperStructDb = new TCPaperStruct(paperStructParams.getExamId(), paperStructParams.getCourseCode(), markPaper.getCourseName(), paperStructParams.getPaperNumber(), JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId(), courseWeightResult.getDimensionSign());
|
|
|
tcPaperStructService.save(tcPaperStructDb);
|
|
|
} else {
|
|
@@ -121,9 +125,7 @@ public class TCPaperStructController {
|
|
|
BeanUtils.copyProperties(tcPaperStructDb, tcPaperStructSource);
|
|
|
tcPaperStructDb.updateInfo(JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId());
|
|
|
if (!tcPaperStructDb.equals(tcPaperStructSource)) {
|
|
|
- if (Objects.nonNull(tcPaperStructDb.getDimensionSign()) && tcPaperStructDb.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue()) {
|
|
|
- trBasicInfoService.clearReportData(tcPaperStructDb.getExamId(), tcPaperStructDb.getCourseCode(), tcPaperStructDb.getPaperNumber(), false);
|
|
|
- }
|
|
|
+ trBasicInfoService.clearReportData(tcPaperStructDb.getExamId(), tcPaperStructDb.getCourseCode(), tcPaperStructDb.getPaperNumber(), false);
|
|
|
tcPaperStructDb.setDimensionSign(courseWeightResult.getDimensionSign());
|
|
|
tcPaperStructService.updateById(tcPaperStructDb);
|
|
|
}
|
|
@@ -143,7 +145,7 @@ public class TCPaperStructController {
|
|
|
TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
|
if (Objects.isNull(tcPaperStruct)) {
|
|
|
List<MarkQuestion> markQuestionList = markQuestionService.listQuestionByExamIdAndPaperNumberAndPaperType(examId, paperNumber, null);
|
|
|
- if (CollectionUtils.isEmpty(markQuestionList)) {
|
|
|
+ if (!CollectionUtils.isEmpty(markQuestionList)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到试卷结构");
|
|
|
}
|
|
|
paperStructDimensionResultList = new ArrayList<>(markQuestionList.size());
|