|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.gson.reflect.TypeToken;
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
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.EditResult;
|
|
|
import com.qmth.distributed.print.business.bean.result.report.PaperStructResult;
|
|
|
import com.qmth.distributed.print.business.entity.TCFinalScore;
|
|
@@ -19,8 +20,11 @@ import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
|
|
|
import com.qmth.teachcloud.common.util.GsonUtil;
|
|
|
+import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
+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.slf4j.Logger;
|
|
@@ -66,6 +70,9 @@ public class TCFinalScoreController {
|
|
|
@Resource
|
|
|
TCPaperStructService tcPaperStructService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ MarkPaperService markPaperService;
|
|
|
+
|
|
|
@ApiOperation(value = "导入期末成绩-模板下载")
|
|
|
@RequestMapping(value = "/final_score/template_download", method = RequestMethod.POST)
|
|
|
@OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.EXPORT)
|
|
@@ -173,11 +180,32 @@ public class TCFinalScoreController {
|
|
|
@OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "试卷蓝图保存", response = Object.class)})
|
|
|
@Transactional
|
|
|
- public Object finalScorePaperStructSave(@ApiParam(value = "试卷蓝图结构", required = true) @Valid @RequestBody List<PaperStructResult> paperStructResultList, BindingResult bindingResult) throws IOException {
|
|
|
+ public Object finalScorePaperStructSave(@ApiParam(value = "试卷蓝图结构", required = true) @Valid @RequestBody PaperStructParams paperStructParams, BindingResult bindingResult) throws IOException {
|
|
|
if (bindingResult.hasErrors()) {
|
|
|
return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
}
|
|
|
- return ResultUtil.ok(true);
|
|
|
+ for (PaperStructResult paperStructResult : paperStructParams.getPaperStruct()) {
|
|
|
+ if (Objects.isNull(paperStructResult.getMainNumber())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("大题号为空");
|
|
|
+ }
|
|
|
+ if (Objects.isNull(paperStructResult.getSubNumber())) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("小题号为空");
|
|
|
+ }
|
|
|
+ if (!CollectionUtils.isEmpty(paperStructResult.getTargetList()) && paperStructResult.getTargetList().size() > 1) {
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("一个题只能属于一个目标");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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)) {
|
|
|
+ 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());
|
|
|
+ } else {
|
|
|
+ tcPaperStruct.updateInfo(JacksonUtil.parseJson(paperStructParams.getPaperStruct()), sysUser.getId());
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(tcPaperStructService.saveOrUpdate(tcPaperStruct));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "期末成绩试卷蓝图查询")
|