|
|
|
@ -2,11 +2,15 @@ package com.msdw.tms.controller; |
|
|
|
|
|
|
|
|
|
import com.msdw.tms.api.EvaluationRecordControllerApi; |
|
|
|
|
import com.msdw.tms.common.utils.R; |
|
|
|
|
import com.msdw.tms.entity.FractionEntity; |
|
|
|
|
import com.msdw.tms.entity.vo.EvaluationRecordDetailVO; |
|
|
|
|
import com.msdw.tms.entity.vo.EvaluationRecordSubmitVO; |
|
|
|
|
import com.msdw.tms.entity.vo.EvaluationRecordVO; |
|
|
|
|
import com.msdw.tms.entity.vo.TMSEvaluationRecordVO; |
|
|
|
|
import com.msdw.tms.service.EvaluationRecordService; |
|
|
|
|
import com.msdw.tms.service.FractionEntityService; |
|
|
|
|
import com.msdw.tms.service.QuestionsService; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
@ -28,8 +32,9 @@ public class EvaluationRecordController implements EvaluationRecordControllerApi |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private QuestionsService questionsService; |
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
@Autowired |
|
|
|
|
private FractionEntityService fractionEntityService; |
|
|
|
|
// @Override
|
|
|
|
|
// @GetMapping("/has_notmade")
|
|
|
|
|
// public R hasNotMadeEvaluation(Integer userId) {
|
|
|
|
|
// boolean b = evaluationRecordService.hasNotMadeEvaluation(userId);
|
|
|
|
@ -52,53 +57,28 @@ public class EvaluationRecordController implements EvaluationRecordControllerApi |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@GetMapping("/start") |
|
|
|
|
public R startEvaluation(@RequestParam(value = "userId") Integer userId) { |
|
|
|
|
EvaluationRecordVO evaluationRecordVO = evaluationRecordService.startEvaluation(userId); |
|
|
|
|
public R startEvaluation(@RequestParam(value = "userId") Integer userId,Integer type) { |
|
|
|
|
TMSEvaluationRecordVO evaluationRecordVO = evaluationRecordService.startEvaluation(userId); |
|
|
|
|
evaluationRecordVO.setTypes(type); |
|
|
|
|
return R.ok().put("data", evaluationRecordVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@PostMapping("/previous") |
|
|
|
|
public R previousQuestion(@RequestBody EvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException { |
|
|
|
|
public R previousQuestion(@RequestBody TMSEvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException { |
|
|
|
|
Integer evaluationRecordId = evaluationRecordVO.getId(); |
|
|
|
|
String userAnswer = evaluationRecordVO.getUserAnswer(); |
|
|
|
|
Integer currentQuestionSortNo = evaluationRecordVO.getCurrentQuestionSortNo(); |
|
|
|
|
EvaluationRecordVO recordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo - 1); |
|
|
|
|
TMSEvaluationRecordVO recordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo - 1); |
|
|
|
|
return R.ok().put("data", recordVO); |
|
|
|
|
} |
|
|
|
|
// 备份:上一题/下一题/提交
|
|
|
|
|
// @Override
|
|
|
|
|
// @GetMapping("/previous")
|
|
|
|
|
// public R previousQuestion(@RequestParam("evaluationRecordId") Integer evaluationRecordId,
|
|
|
|
|
// @RequestParam("currentQuestionSortNo") Integer currentQuestionSortNo,
|
|
|
|
|
// @RequestParam(value = "userAnswer", required = false) String userAnswer) throws ExecutionException, InterruptedException {
|
|
|
|
|
// EvaluationRecordVO evaluationRecordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo - 1);
|
|
|
|
|
// return R.ok().put("data", evaluationRecordVO);
|
|
|
|
|
// }
|
|
|
|
|
// @Override
|
|
|
|
|
// @GetMapping("/next")
|
|
|
|
|
// public R nextQuestion(@RequestParam("evaluationRecordId") Integer evaluationRecordId,
|
|
|
|
|
// @RequestParam("currentQuestionSortNo") Integer currentQuestionSortNo,
|
|
|
|
|
// @RequestParam(value = "userAnswer", required = false) String userAnswer) throws ExecutionException, InterruptedException {
|
|
|
|
|
// EvaluationRecordVO evaluationRecordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo + 1);
|
|
|
|
|
// return R.ok().put("data", evaluationRecordVO);
|
|
|
|
|
// }
|
|
|
|
|
// @Override
|
|
|
|
|
// @GetMapping("/submit")
|
|
|
|
|
// public R submitEvaluation(@RequestParam("evaluationRecordId") Integer evaluationRecordId,
|
|
|
|
|
// @RequestParam("currentQuestionSortNo") Integer currentQuestionSortNo,
|
|
|
|
|
// @RequestParam(value = "userAnswer", required = false) String userAnswer,
|
|
|
|
|
// @RequestParam("userId") Integer userId) throws ExecutionException, InterruptedException {
|
|
|
|
|
// EvaluationRecordSubmitVO recordSubmitVO = evaluationRecordService.submitEvaluation(evaluationRecordId, currentQuestionSortNo, userAnswer, userId);
|
|
|
|
|
// return R.ok().put("data", recordSubmitVO);
|
|
|
|
|
// }
|
|
|
|
|
@Override |
|
|
|
|
@PostMapping("/next") |
|
|
|
|
public R nextQuestion(@RequestBody EvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException { |
|
|
|
|
public R nextQuestion(@RequestBody TMSEvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException { |
|
|
|
|
Integer evaluationRecordId = evaluationRecordVO.getId(); |
|
|
|
|
String userAnswer = evaluationRecordVO.getUserAnswer(); |
|
|
|
|
Integer currentQuestionSortNo = evaluationRecordVO.getCurrentQuestionSortNo(); |
|
|
|
|
EvaluationRecordVO recordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo + 1); |
|
|
|
|
TMSEvaluationRecordVO recordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo + 1); |
|
|
|
|
return R.ok().put("data", recordVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -111,12 +91,19 @@ public class EvaluationRecordController implements EvaluationRecordControllerApi |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
public R submitEvaluation(@RequestBody EvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException { |
|
|
|
|
public R submitEvaluation(@RequestBody TMSEvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException { |
|
|
|
|
Integer evaluationRecordId = evaluationRecordVO.getId(); |
|
|
|
|
String userAnswer = evaluationRecordVO.getUserAnswer(); |
|
|
|
|
Integer currentQuestionSortNo = evaluationRecordVO.getCurrentQuestionSortNo(); |
|
|
|
|
Integer userId = evaluationRecordVO.getUserId(); |
|
|
|
|
|
|
|
|
|
Integer types = evaluationRecordVO.getTypes(); |
|
|
|
|
EvaluationRecordSubmitVO recordSubmitVO = evaluationRecordService.submitEvaluation(evaluationRecordId, currentQuestionSortNo, userAnswer, userId); |
|
|
|
|
Integer totalScore = recordSubmitVO.getTotalScore(); |
|
|
|
|
FractionEntity fractionEntity = new FractionEntity(); |
|
|
|
|
FractionEntity fraction = fractionEntity.setUserId(userId).setFraction(totalScore).setTypes(types); |
|
|
|
|
fractionEntityService.insertRecord(fraction); |
|
|
|
|
|
|
|
|
|
return R.ok().put("data", recordSubmitVO); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -139,6 +126,146 @@ public class EvaluationRecordController implements EvaluationRecordControllerApi |
|
|
|
|
return R.ok().put("data", openExperiment); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@GetMapping("/openExercise") |
|
|
|
|
public R isOpenExercise(Integer userId){ |
|
|
|
|
Integer score = fractionEntityService.queryExerciseRecord(userId); |
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
@GetMapping("/openTeaching") |
|
|
|
|
public R isOpenTeaching(Integer userId){ |
|
|
|
|
Integer score = fractionEntityService.queryTeachingRecord(userId); |
|
|
|
|
return R.ok(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//// @Override
|
|
|
|
|
//// @GetMapping("/has_notmade")
|
|
|
|
|
//// public R hasNotMadeEvaluation(Integer userId) {
|
|
|
|
|
//// boolean b = evaluationRecordService.hasNotMadeEvaluation(userId);
|
|
|
|
|
//// return R.ok().put("data", b);
|
|
|
|
|
//// }
|
|
|
|
|
//
|
|
|
|
|
//// @Override
|
|
|
|
|
//// @GetMapping("/clean_time")
|
|
|
|
|
//// public R cleanRemainingTime(Integer userId) {
|
|
|
|
|
//// evaluationRecordService.cleanRemainingTime(userId);
|
|
|
|
|
//// return R.ok();
|
|
|
|
|
//// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// @GetMapping("/remaining")
|
|
|
|
|
// public R getEvaluationRemainingTime(Integer userId) {
|
|
|
|
|
// String remainingTime = questionsService.getEvaluationRemainingTime(userId);
|
|
|
|
|
// return R.ok().put("data", remainingTime);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// @GetMapping("/start")
|
|
|
|
|
// public R startEvaluation(@RequestParam(value = "userId") Integer userId,Integer type) {
|
|
|
|
|
// TMSEvaluationRecordVO evaluationRecordVO = evaluationRecordService.startEvaluation(userId);
|
|
|
|
|
// evaluationRecordVO.setType(type);
|
|
|
|
|
// return R.ok().put("data", evaluationRecordVO);
|
|
|
|
|
// }
|
|
|
|
|
//// @Override
|
|
|
|
|
//// @GetMapping("/start")
|
|
|
|
|
//// public R startEvaluation(@RequestParam(value = "userId") Integer userId) {
|
|
|
|
|
//// EvaluationRecordVO evaluationRecordVO = evaluationRecordService.startEvaluation(userId);
|
|
|
|
|
//// return R.ok().put("data", evaluationRecordVO);
|
|
|
|
|
//// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// @PostMapping("/previous")
|
|
|
|
|
// public R previousQuestion(@RequestBody EvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException {
|
|
|
|
|
// Integer evaluationRecordId = evaluationRecordVO.getId();
|
|
|
|
|
// String userAnswer = evaluationRecordVO.getUserAnswer();
|
|
|
|
|
// Integer currentQuestionSortNo = evaluationRecordVO.getCurrentQuestionSortNo();
|
|
|
|
|
// EvaluationRecordVO recordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo - 1);
|
|
|
|
|
// return R.ok().put("data", recordVO);
|
|
|
|
|
// }
|
|
|
|
|
//// @Override
|
|
|
|
|
//// @PostMapping("/previous")
|
|
|
|
|
//// public R previousQuestion(@RequestBody EvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException {
|
|
|
|
|
//// Integer evaluationRecordId = evaluationRecordVO.getId();
|
|
|
|
|
//// String userAnswer = evaluationRecordVO.getUserAnswer();
|
|
|
|
|
//// Integer currentQuestionSortNo = evaluationRecordVO.getCurrentQuestionSortNo();
|
|
|
|
|
//// EvaluationRecordVO recordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo - 1);
|
|
|
|
|
//// return R.ok().put("data", recordVO);
|
|
|
|
|
//// }
|
|
|
|
|
//// 备份:上一题/下一题/提交
|
|
|
|
|
//// @Override
|
|
|
|
|
//// @GetMapping("/previous")
|
|
|
|
|
//// public R previousQuestion(@RequestParam("evaluationRecordId") Integer evaluationRecordId,
|
|
|
|
|
//// @RequestParam("currentQuestionSortNo") Integer currentQuestionSortNo,
|
|
|
|
|
//// @RequestParam(value = "userAnswer", required = false) String userAnswer) throws ExecutionException, InterruptedException {
|
|
|
|
|
//// EvaluationRecordVO evaluationRecordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo - 1);
|
|
|
|
|
//// return R.ok().put("data", evaluationRecordVO);
|
|
|
|
|
//// }
|
|
|
|
|
//// @Override
|
|
|
|
|
//// @GetMapping("/next")
|
|
|
|
|
//// public R nextQuestion(@RequestParam("evaluationRecordId") Integer evaluationRecordId,
|
|
|
|
|
//// @RequestParam("currentQuestionSortNo") Integer currentQuestionSortNo,
|
|
|
|
|
//// @RequestParam(value = "userAnswer", required = false) String userAnswer) throws ExecutionException, InterruptedException {
|
|
|
|
|
//// EvaluationRecordVO evaluationRecordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo + 1);
|
|
|
|
|
//// return R.ok().put("data", evaluationRecordVO);
|
|
|
|
|
//// }
|
|
|
|
|
//// @Override
|
|
|
|
|
//// @GetMapping("/submit")
|
|
|
|
|
//// public R submitEvaluation(@RequestParam("evaluationRecordId") Integer evaluationRecordId,
|
|
|
|
|
//// @RequestParam("currentQuestionSortNo") Integer currentQuestionSortNo,
|
|
|
|
|
//// @RequestParam(value = "userAnswer", required = false) String userAnswer,
|
|
|
|
|
//// @RequestParam("userId") Integer userId) throws ExecutionException, InterruptedException {
|
|
|
|
|
//// EvaluationRecordSubmitVO recordSubmitVO = evaluationRecordService.submitEvaluation(evaluationRecordId, currentQuestionSortNo, userAnswer, userId);
|
|
|
|
|
//// return R.ok().put("data", recordSubmitVO);
|
|
|
|
|
//// }
|
|
|
|
|
// @Override
|
|
|
|
|
// @PostMapping("/next")
|
|
|
|
|
// public R nextQuestion(@RequestBody EvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException {
|
|
|
|
|
// Integer evaluationRecordId = evaluationRecordVO.getId();
|
|
|
|
|
// String userAnswer = evaluationRecordVO.getUserAnswer();
|
|
|
|
|
// Integer currentQuestionSortNo = evaluationRecordVO.getCurrentQuestionSortNo();
|
|
|
|
|
// EvaluationRecordVO recordVO = evaluationRecordService.convertQuestion(evaluationRecordId, currentQuestionSortNo, userAnswer, currentQuestionSortNo + 1);
|
|
|
|
|
// return R.ok().put("data", recordVO);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// @GetMapping("/not_made")
|
|
|
|
|
// public R selectNotMade(@RequestParam("evaluationRecordId") Integer evaluationRecordId) {
|
|
|
|
|
// String result = evaluationRecordService.selectNotMade(evaluationRecordId);
|
|
|
|
|
// return R.ok().put("data", result);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// @PostMapping("/submit")
|
|
|
|
|
// public R submitEvaluation(@RequestBody EvaluationRecordVO evaluationRecordVO) throws ExecutionException, InterruptedException {
|
|
|
|
|
// Integer evaluationRecordId = evaluationRecordVO.getId();
|
|
|
|
|
// String userAnswer = evaluationRecordVO.getUserAnswer();
|
|
|
|
|
// Integer currentQuestionSortNo = evaluationRecordVO.getCurrentQuestionSortNo();
|
|
|
|
|
// Integer userId = evaluationRecordVO.getUserId();
|
|
|
|
|
// EvaluationRecordSubmitVO recordSubmitVO = evaluationRecordService.submitEvaluation(evaluationRecordId, currentQuestionSortNo, userAnswer, userId);
|
|
|
|
|
// return R.ok().put("data", recordSubmitVO);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// @GetMapping("/detail")
|
|
|
|
|
// public R evaluationScoreDetail(Integer evaluationRecordId) throws ExecutionException, InterruptedException {
|
|
|
|
|
// EvaluationRecordDetailVO detailVO = evaluationRecordService.evaluationDetail(evaluationRecordId);
|
|
|
|
|
// return R.ok().put("data", detailVO);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 查询是否能够开启实验
|
|
|
|
|
// * @param userId
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// @Override
|
|
|
|
|
// @GetMapping("/can_experiment")
|
|
|
|
|
// public R isOpenExperiment(Integer userId) {
|
|
|
|
|
// boolean openExperiment = evaluationRecordService.isOpenExperiment(userId);
|
|
|
|
|
// return R.ok().put("data", openExperiment);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|