|
@@ -11,6 +11,7 @@ import com.qmth.distributed.print.business.bean.dto.TCFinalScoreDto;
|
|
import com.qmth.distributed.print.business.bean.excel.ExcelField;
|
|
import com.qmth.distributed.print.business.bean.excel.ExcelField;
|
|
import com.qmth.distributed.print.business.bean.excel.PaperStructDto;
|
|
import com.qmth.distributed.print.business.bean.excel.PaperStructDto;
|
|
import com.qmth.distributed.print.business.bean.result.EditResult;
|
|
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.TCFinalScore;
|
|
import com.qmth.distributed.print.business.entity.TCFinalScore;
|
|
import com.qmth.distributed.print.business.entity.TCPaperStruct;
|
|
import com.qmth.distributed.print.business.entity.TCPaperStruct;
|
|
import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
import com.qmth.distributed.print.business.service.PrintCommonService;
|
|
@@ -45,7 +46,10 @@ import javax.validation.Valid;
|
|
import javax.validation.constraints.Max;
|
|
import javax.validation.constraints.Max;
|
|
import javax.validation.constraints.Min;
|
|
import javax.validation.constraints.Min;
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
|
+import java.math.BigDecimal;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.function.Function;
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
@@ -157,7 +161,7 @@ public class TCFinalScoreController {
|
|
public Result finalScoreSyncChoosePaper(@ApiParam(value = "考试id") @RequestParam(required = false) Long examId,
|
|
public Result finalScoreSyncChoosePaper(@ApiParam(value = "考试id") @RequestParam(required = false) Long examId,
|
|
@ApiParam(value = "科目编码") @RequestParam(required = false) Long courseId) {
|
|
@ApiParam(value = "科目编码") @RequestParam(required = false) Long courseId) {
|
|
BasicCourse basicCourse = basicCourseService.getById(courseId);
|
|
BasicCourse basicCourse = basicCourseService.getById(courseId);
|
|
- if (Objects.isNull(basicCourse)){
|
|
|
|
|
|
+ if (Objects.isNull(basicCourse)) {
|
|
throw ExceptionResultEnum.ERROR.exception("未找到课程");
|
|
throw ExceptionResultEnum.ERROR.exception("未找到课程");
|
|
}
|
|
}
|
|
return ResultUtil.ok(markPaperService.list(new QueryWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId).eq(MarkPaper::getCourseCode, basicCourse.getCode()).eq(MarkPaper::getStatus, MarkPaperStatus.FINISH)));
|
|
return ResultUtil.ok(markPaperService.list(new QueryWrapper<MarkPaper>().lambda().eq(MarkPaper::getExamId, examId).eq(MarkPaper::getCourseCode, basicCourse.getCode()).eq(MarkPaper::getStatus, MarkPaperStatus.FINISH)));
|
|
@@ -238,6 +242,34 @@ public class TCFinalScoreController {
|
|
throw ExceptionResultEnum.ERROR.exception("分数总分不能大于试卷总分");
|
|
throw ExceptionResultEnum.ERROR.exception("分数总分不能大于试卷总分");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ TCPaperStruct tcPaperStruct = tcPaperStructService.queryPaperStruct(tcFinalScoreDb.getCultureProgramId(), tcFinalScoreDb.getCourseId(), tcFinalScoreDb.getPaperNumber());
|
|
|
|
+ Objects.requireNonNull(tcPaperStruct, "未找到试卷结构");
|
|
|
|
+
|
|
|
|
+ List<PaperStructDimensionResult> paperStructDimensionResultList = null;
|
|
|
|
+ if (Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
|
|
|
|
+ paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
|
|
|
|
+ }.getType());
|
|
|
|
+ } else {
|
|
|
|
+ List<PaperStructDto> paperStructDtoList = GsonUtil.fromJson(tcPaperStruct.getPaperStruct(), new TypeToken<List<PaperStructDto>>() {
|
|
|
|
+ }.getType());
|
|
|
|
+ paperStructDimensionResultList = new ArrayList<>(paperStructDtoList.size());
|
|
|
|
+ for (PaperStructDto paperStructDto : paperStructDtoList) {
|
|
|
|
+ paperStructDimensionResultList.add(new PaperStructDimensionResult(paperStructDto.getMainNumber(), paperStructDto.getSubNumber(), tcPaperStruct.getExamId(), tcPaperStruct.getPaperNumber(), new BigDecimal(paperStructDto.getScore())));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ Map<String, PaperStructDimensionResult> paperStructResultMap = paperStructDimensionResultList.stream().collect(Collectors.toMap(k -> k.getMainNumber() + "-" + k.getSubNumber(), Function.identity(), (dto1, dto2) -> dto1));
|
|
|
|
+
|
|
|
|
+ for (TCFinalScoreDto tcFinalScoreDto : tcFinalScoreDtoList) {
|
|
|
|
+ if (paperStructResultMap.containsKey(tcFinalScoreDto.getName().trim())) {
|
|
|
|
+ PaperStructDimensionResult paperStructDimensionResult = paperStructResultMap.get(tcFinalScoreDto.getName().trim());
|
|
|
|
+ BigDecimal paperScore = paperStructDimensionResult.getScore();
|
|
|
|
+ BigDecimal importScore = new BigDecimal(tcFinalScoreDto.getScore());
|
|
|
|
+ if (importScore.compareTo(paperScore) == 1) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("输入分数大于题号" + tcFinalScoreDto.getName() + "的总分");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
TCFinalScore tcFinalScoreSource = new TCFinalScore();
|
|
TCFinalScore tcFinalScoreSource = new TCFinalScore();
|
|
BeanUtils.copyProperties(tcFinalScoreDb, tcFinalScoreSource);
|
|
BeanUtils.copyProperties(tcFinalScoreDb, tcFinalScoreSource);
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|