|
@@ -1,12 +1,10 @@
|
|
|
package com.qmth.distributed.print.api;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
import com.qmth.boot.api.exception.ApiException;
|
|
|
-import com.qmth.distributed.print.business.bean.dto.report.ReportCourseEvaluationResultDto;
|
|
|
import com.qmth.distributed.print.business.bean.excel.ExcelField;
|
|
|
import com.qmth.distributed.print.business.bean.params.report.PaperStructParams;
|
|
|
import com.qmth.distributed.print.business.bean.result.CourseWeightResult;
|
|
@@ -14,8 +12,10 @@ import com.qmth.distributed.print.business.bean.result.EditResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.report.PaperStructResult;
|
|
|
import com.qmth.distributed.print.business.entity.TCFinalScore;
|
|
|
import com.qmth.distributed.print.business.entity.TCPaperStruct;
|
|
|
-import com.qmth.distributed.print.business.entity.TRBasicInfo;
|
|
|
-import com.qmth.distributed.print.business.service.*;
|
|
|
+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;
|
|
|
import com.qmth.teachcloud.common.annotation.OperationLogDetail;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.MarkQuestion;
|
|
@@ -78,9 +78,6 @@ public class TCFinalScoreController {
|
|
|
@Resource
|
|
|
TRBasicInfoService trBasicInfoService;
|
|
|
|
|
|
- @Resource
|
|
|
- TRExamStudentService trExamStudentService;
|
|
|
-
|
|
|
@ApiOperation(value = "导入期末成绩-模板下载")
|
|
|
@RequestMapping(value = "/final_score/template_download", method = RequestMethod.POST)
|
|
|
@OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EXPORT)
|
|
@@ -253,18 +250,22 @@ public class TCFinalScoreController {
|
|
|
}
|
|
|
SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
TCPaperStruct tcPaperStructDb = tcPaperStructService.getOne(new QueryWrapper<TCPaperStruct>().lambda().eq(TCPaperStruct::getExamId, paperStructParams.getExamId()).eq(TCPaperStruct::getCourseCode, paperStructParams.getCourseCode()).eq(TCPaperStruct::getPaperNumber, paperStructParams.getPaperNumber()));
|
|
|
+ CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(paperStructParams.getExamId(), paperStructParams.getCourseCode());
|
|
|
if (Objects.isNull(tcPaperStructDb)) {
|
|
|
MarkPaper markPaper = markPaperService.getByExamIdAndPaperNumber(paperStructParams.getExamId(), paperStructParams.getPaperNumber());
|
|
|
Objects.requireNonNull(markPaper, "未找到科目信息");
|
|
|
|
|
|
- tcPaperStructDb = 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(), courseWeightResult.getDimensionSign());
|
|
|
tcPaperStructService.save(tcPaperStructDb);
|
|
|
} else {
|
|
|
TCPaperStruct tcPaperStructSource = new TCPaperStruct();
|
|
|
BeanUtils.copyProperties(tcPaperStructDb, tcPaperStructSource);
|
|
|
tcPaperStructDb.updateInfo(JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId());
|
|
|
if (!tcPaperStructDb.equals(tcPaperStructSource)) {
|
|
|
- trBasicInfoService.clearReportData(paperStructParams.getExamId(), paperStructParams.getCourseCode(), paperStructParams.getPaperNumber(), false);
|
|
|
+ if (Objects.nonNull(tcPaperStructDb.getDimensionSign()) && tcPaperStructDb.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue()) {
|
|
|
+ trBasicInfoService.clearReportData(tcPaperStructDb.getExamId(), tcPaperStructDb.getCourseCode(), tcPaperStructDb.getPaperNumber(), true);
|
|
|
+ }
|
|
|
+ tcPaperStructDb.setDimensionSign(courseWeightResult.getDimensionSign());
|
|
|
tcPaperStructService.updateById(tcPaperStructDb);
|
|
|
}
|
|
|
}
|
|
@@ -278,15 +279,6 @@ public class TCFinalScoreController {
|
|
|
public Object finalScorePaperStructQuery(@ApiParam(value = "考试id", required = true) @RequestParam Long examId,
|
|
|
@ApiParam(value = "科目编码", required = true) @RequestParam String courseCode,
|
|
|
@ApiParam(value = "试卷编号", required = true) @RequestParam String paperNumber) throws IOException {
|
|
|
- TRBasicInfo trBasicInfo = trBasicInfoService.getOne(new QueryWrapper<TRBasicInfo>().lambda().eq(TRBasicInfo::getExamId, examId).eq(TRBasicInfo::getCourseCode, courseCode).eq(TRBasicInfo::getPaperNumber, paperNumber));
|
|
|
- if (Objects.nonNull(trBasicInfo)) {
|
|
|
- ReportCourseEvaluationResultDto reportCourseEvaluationResultDto = JSONObject.parseObject(trBasicInfo.getCourseEvaluationResult(), ReportCourseEvaluationResultDto.class);
|
|
|
- CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(examId, courseCode);
|
|
|
- if (Objects.nonNull(reportCourseEvaluationResultDto.getDimensionSign()) && reportCourseEvaluationResultDto.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue()) {
|
|
|
- trBasicInfoService.clearReportData(examId, courseCode, paperNumber, true);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
List<PaperStructResult> paperStructResultList = null;
|
|
|
TCPaperStruct tcPaperStruct = tcPaperStructService.getOne(new QueryWrapper<TCPaperStruct>().lambda().eq(TCPaperStruct::getExamId, examId).eq(TCPaperStruct::getCourseCode, courseCode).eq(TCPaperStruct::getPaperNumber, paperNumber));
|
|
|
if (Objects.isNull(tcPaperStruct)) {
|
|
@@ -299,9 +291,15 @@ public class TCFinalScoreController {
|
|
|
paperStructResultList.add(new PaperStructResult(markQuestion.getMainNumber(), markQuestion.getSubNumber(), markQuestion.getTotalScore()));
|
|
|
}
|
|
|
} else {
|
|
|
- if (Objects.nonNull(tcPaperStruct.getPaperStruct())) {
|
|
|
- paperStructResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStruct(), new TypeToken<List<PaperStructResult>>() {
|
|
|
- }.getType());
|
|
|
+ CourseWeightResult courseWeightResult = trBasicInfoService.findCourseWeightResultRmi(examId, courseCode);
|
|
|
+ if (Objects.nonNull(tcPaperStruct.getDimensionSign()) && tcPaperStruct.getDimensionSign().longValue() != courseWeightResult.getDimensionSign().longValue()) {
|
|
|
+ trBasicInfoService.clearReportData(examId, courseCode, paperNumber, true);
|
|
|
+ return this.finalScorePaperStructQuery(examId, courseCode, paperNumber);
|
|
|
+ } else {
|
|
|
+ if (Objects.nonNull(tcPaperStruct.getPaperStruct())) {
|
|
|
+ paperStructResultList = GsonUtil.fromJson(tcPaperStruct.getPaperStruct(), new TypeToken<List<PaperStructResult>>() {
|
|
|
+ }.getType());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return ResultUtil.ok(paperStructResultList);
|