|
@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
|
+import com.google.gson.reflect.TypeToken;
|
|
|
import com.qmth.boot.api.annotation.Aac;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
@@ -16,6 +17,7 @@ import com.qmth.distributed.print.business.bean.dto.TCUsualScoreDto;
|
|
|
import com.qmth.distributed.print.business.bean.dto.report.*;
|
|
|
import com.qmth.distributed.print.business.bean.result.CourseWeightResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.ScoreResult;
|
|
|
+import com.qmth.distributed.print.business.bean.result.report.PaperStructDimensionResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.report.ReportChangeResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.report.ReportResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.report.word.CourseBasicBean;
|
|
@@ -30,14 +32,12 @@ import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicSchool;
|
|
|
import com.qmth.teachcloud.common.entity.SysConfig;
|
|
|
import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.enums.ImportTemplateEnum;
|
|
|
import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
|
|
|
import com.qmth.teachcloud.common.service.CommonCacheService;
|
|
|
import com.qmth.teachcloud.common.service.FileUploadService;
|
|
|
-import com.qmth.teachcloud.common.util.FileUtil;
|
|
|
-import com.qmth.teachcloud.common.util.Result;
|
|
|
-import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
-import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
+import com.qmth.teachcloud.common.util.*;
|
|
|
import com.qmth.teachcloud.mark.entity.MarkPaper;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
@@ -54,6 +54,7 @@ import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -114,15 +115,27 @@ public class TRBasicInfoController {
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
TRBasicInfo trBasicInfo = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId).eq(TRBasicInfo::getCourseCode, courseCode).eq(TRBasicInfo::getPaperNumber, paperNumber));
|
|
|
|
|
|
+ CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(examId, courseCode);
|
|
|
+ TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
|
+ if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
|
|
|
+ List<PaperStructDimensionResult> paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
|
|
|
+ }.getType());
|
|
|
+ for (CourseWeightDto c : courseWeightResult.getSubmitForm()) {
|
|
|
+ Double score = paperStructDimensionResultList.stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
|
|
|
+ if (new BigDecimal(score).compareTo(c.getTotalWeight()) != 0) {
|
|
|
+ trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]知识点小题总分大于该课程目标分,请重新设置");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
if (Objects.isNull(trBasicInfo)) {
|
|
|
- trBasicInfo = trBasicInfoService.getReportView(trBasicInfo, markPaper, sysUser.getId());
|
|
|
+ trBasicInfo = trBasicInfoService.getReportView(trBasicInfo, markPaper, sysUser.getId(), courseWeightResult);
|
|
|
} else {
|
|
|
- CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(examId, courseCode);
|
|
|
ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = Objects.nonNull(trBasicInfo.getCourseEvaluationResult()) ? JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class) : null;
|
|
|
if (Objects.nonNull(reportCourseEvaluationResultDto.getWeightSettingSign()) && reportCourseEvaluationResultDto.getWeightSettingSign().longValue() != courseWeightResult.getWeightSettingSign().longValue()) {
|
|
|
- TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
|
trBasicInfoService.clearReportData(examId, courseCode, paperNumber, Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue() ? true : false);
|
|
|
- trBasicInfo = trBasicInfoService.getReportView(trBasicInfo, markPaper, sysUser.getId());
|
|
|
+ trBasicInfo = trBasicInfoService.getReportView(trBasicInfo, markPaper, sysUser.getId(), courseWeightResult);
|
|
|
} else {
|
|
|
ReportCourseBasicInfoDto reportCourseBasicInfoDto = new ReportCourseBasicInfoDto(trBasicInfo);
|
|
|
ReportCourseEvaluationSpreadDto reportCourseEvaluationSpreadDto = Objects.nonNull(trBasicInfo.getCourseEvaluationSpread()) ? JSONObject.parseObject(trBasicInfo.getCourseEvaluationSpread(), ReportCourseEvaluationSpreadDto.class) : null;
|
|
@@ -158,7 +171,7 @@ public class TRBasicInfoController {
|
|
|
if (Objects.isNull(trBasicInfoDb)) {
|
|
|
trBasicInfoDb = new TRBasicInfo(trBasicInfo, sysUser.getId());
|
|
|
MarkPaper markPaper = printCommonService.getMarkPaper(trBasicInfo.getExamId(), trBasicInfo.getPaperNumber());
|
|
|
- trBasicInfoDb = trBasicInfoService.getReportView(trBasicInfoDb, markPaper, sysUser.getId());
|
|
|
+ trBasicInfoDb = trBasicInfoService.getReportView(trBasicInfoDb, markPaper, sysUser.getId(), trBasicInfoService.findCourseWeightResultRmi(trBasicInfo.getExamId(), trBasicInfo.getCourseCode()));
|
|
|
} else {
|
|
|
trBasicInfoDb.updateInfo(trBasicInfo, sysUser.getId());
|
|
|
}
|
|
@@ -184,10 +197,22 @@ public class TRBasicInfoController {
|
|
|
Objects.requireNonNull(trBasicInfo.getCourseEvaluationResultDetail(), "没有课程考生信息");
|
|
|
|
|
|
CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(examId, courseCode);
|
|
|
+ TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
|
+ if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
|
|
|
+ List<PaperStructDimensionResult> paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
|
|
|
+ }.getType());
|
|
|
+ for (CourseWeightDto c : courseWeightResult.getSubmitForm()) {
|
|
|
+ Double score = paperStructDimensionResultList.stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
|
|
|
+ if (new BigDecimal(score).compareTo(c.getTotalWeight()) != 0) {
|
|
|
+ trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("[" + c.getCourseTargetName() + "]知识点小题总分大于该课程目标分,请重新设置");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class);
|
|
|
if (Objects.nonNull(reportCourseEvaluationResultDto.getWeightSettingSign()) && reportCourseEvaluationResultDto.getWeightSettingSign().longValue() != courseWeightResult.getWeightSettingSign().longValue()) {
|
|
|
printCommonService.getMarkPaper(examId, paperNumber);
|
|
|
- TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
|
trBasicInfoService.clearReportData(examId, courseCode, paperNumber, Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue() ? true : false);
|
|
|
this.reportView(examId, courseCode, paperNumber);
|
|
|
this.reportExport(examId, courseCode, paperNumber);
|
|
@@ -267,7 +292,8 @@ public class TRBasicInfoController {
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "下载成功", response = Object.class)})
|
|
|
public Result reportDataChange(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
|
|
|
@ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
|
|
|
- @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
|
|
|
+ @ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber,
|
|
|
+ @ApiParam(value = "true:报告,false:成绩管理", required = true) @RequestParam boolean report) throws IOException {
|
|
|
ReportChangeResult reportChangeResult = new ReportChangeResult();
|
|
|
List<TCUsualScore> tcUsualScoreList = tcUsualScoreService.list(new QueryWrapper<TCUsualScore>().lambda().eq(TCUsualScore::getExamId, examId).eq(TCUsualScore::getCourseCode, courseCode).eq(TCUsualScore::getPaperNumber, paperNumber));
|
|
|
if (CollectionUtils.isNotEmpty(tcUsualScoreList)) {
|
|
@@ -312,6 +338,26 @@ public class TRBasicInfoController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ if (!report) {
|
|
|
+ TCPaperStruct tcPaperStruct = tcPaperStructService.queryByExamIdAndCourseCodeAndPaperNumber(examId, courseCode, paperNumber);
|
|
|
+ if (Objects.nonNull(tcPaperStruct) && Objects.nonNull(tcPaperStruct.getPaperStructDimension())) {
|
|
|
+ List<PaperStructDimensionResult> paperStructDimensionResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStructDimension(), new TypeToken<List<PaperStructDimensionResult>>() {
|
|
|
+ }.getType());
|
|
|
+ StringJoiner stringJoiner = new StringJoiner("");
|
|
|
+ for (CourseWeightDto c : courseWeightDtoList) {
|
|
|
+ Double score = paperStructDimensionResultList.stream().filter(s -> Objects.equals(s.getCourseTargetName(), c.getCourseTargetName())).mapToDouble(PaperStructDimensionResult::getScore).sum();
|
|
|
+ if (new BigDecimal(score).compareTo(c.getTotalWeight()) != 0) {
|
|
|
+ reportChangeResult.setTargetScoreChange(true);
|
|
|
+ stringJoiner.add("[").add(c.getCourseTargetName()).add("]").add("知识点小题总分大于该课程目标分,请重新设置").add("\r\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (reportChangeResult.isTargetScoreChange()) {
|
|
|
+ trBasicInfoService.clearReportData(examId, courseCode, paperNumber, false);
|
|
|
+ reportChangeResult.setTargetScoreChangeStr(stringJoiner.toString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
return ResultUtil.ok(reportChangeResult);
|
|
|
}
|