错题修改
This commit is contained in:
parent
93f8534643
commit
6e3ae11687
|
|
@ -41,41 +41,38 @@ public class ApiPracticeController extends BaseController {
|
||||||
|
|
||||||
List<ExamPractice> list = examPracticeService.selectListFromWeb(examPractice);
|
List<ExamPractice> list = examPracticeService.selectListFromWeb(examPractice);
|
||||||
AjaxResult success = success("查询成功");
|
AjaxResult success = success("查询成功");
|
||||||
success.put("data",list);
|
success.put("data", list);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询练习具体的问题列表
|
* 查询练习具体的问题列表
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/v1/practice/info")
|
@GetMapping("/v1/practice/info")
|
||||||
public AjaxResult queryOne(@RequestParam Map<String,Object> map) {
|
public AjaxResult queryOne(@RequestParam Map<String, Object> map) {
|
||||||
List<ExamQuestionVO> result = examQuestionService.selectQuestionListByPracticeId(map);
|
List<ExamQuestionVO> result = examQuestionService.selectQuestionListByPracticeId(map);
|
||||||
if(map.containsKey("disorder")&&map.get("disorder").toString().equals("1")){
|
if (map.containsKey("disorder") && map.get("disorder").toString().equals("1")) {
|
||||||
Collections.shuffle(result);
|
Collections.shuffle(result);
|
||||||
}
|
}
|
||||||
AjaxResult success = success("查询成功");
|
AjaxResult success = success("查询成功");
|
||||||
success.put("data",result);
|
success.put("data", result);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存错题记录
|
* 保存错题记录
|
||||||
|
*
|
||||||
|
* @param questionId
|
||||||
|
* @return
|
||||||
* @description 练习时答错题就保存到错题记录中
|
* @description 练习时答错题就保存到错题记录中
|
||||||
* 传入问题id
|
* 传入问题id
|
||||||
* @param answers
|
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@PostMapping("/v1/practice/answer")
|
@PostMapping("/v1/practice/answer")
|
||||||
public AjaxResult answer(@RequestBody List<Map<String,Object>> answers) {
|
public AjaxResult answer(String questionId) {
|
||||||
int error = 0;
|
|
||||||
for (Map<String, Object> answer : answers) {
|
|
||||||
String questionId = answer.get("questionId").toString();
|
|
||||||
String userAnswer = answer.get("userAnswer").toString();
|
|
||||||
ExamQuestion examQuestion = examQuestionService.selectById(questionId);
|
|
||||||
if(!examQuestion.getAnswer().equals(userAnswer)){
|
|
||||||
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
||||||
examUserErrorQuestion.setExamQuestionId(Integer.parseInt(questionId));
|
examUserErrorQuestion.setExamQuestionId(Integer.parseInt(questionId));
|
||||||
examUserErrorQuestion.setVipUserId(Integer.parseInt(ShiroUtils.getUserId().toString()));
|
examUserErrorQuestion.setVipUserId(Integer.parseInt(ShiroUtils.getUserId().toString()));
|
||||||
|
|
@ -83,29 +80,29 @@ public class ApiPracticeController extends BaseController {
|
||||||
examUserErrorQuestion.setCreateDate(new Date());
|
examUserErrorQuestion.setCreateDate(new Date());
|
||||||
examUserErrorQuestion.setDelFlag("0");
|
examUserErrorQuestion.setDelFlag("0");
|
||||||
examUserErrorQuestionService.insert(examUserErrorQuestion);
|
examUserErrorQuestionService.insert(examUserErrorQuestion);
|
||||||
error++;
|
|
||||||
}
|
AjaxResult success = success("插入错题本成功");
|
||||||
}
|
|
||||||
AjaxResult success = success(error+"题进入错题本");
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询我的错题列表
|
* 查询我的错题列表
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/v1/practice/{userId}/error")
|
@GetMapping("/v1/practice/{userId}/error")
|
||||||
public AjaxResult answer(@PathVariable("userId") String userId) {
|
public AjaxResult queryError(@PathVariable("userId") String userId) {
|
||||||
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
||||||
examUserErrorQuestion.setVipUserId(Integer.parseInt(ShiroUtils.getUserId().toString()));
|
examUserErrorQuestion.setVipUserId(Integer.parseInt(ShiroUtils.getUserId().toString()));
|
||||||
List<ExamUserErrorQuestionVO> list = examUserErrorQuestionService.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
List<ExamUserErrorQuestionVO> list = examUserErrorQuestionService.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
||||||
AjaxResult success = success("查询成功");
|
AjaxResult success = success("查询成功");
|
||||||
success.put("data",list);
|
success.put("data", list);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询问题详情
|
* 查询问题详情
|
||||||
|
*
|
||||||
* @param id
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -113,7 +110,7 @@ public class ApiPracticeController extends BaseController {
|
||||||
public AjaxResult queryQuestion(@PathVariable("id") String id) {
|
public AjaxResult queryQuestion(@PathVariable("id") String id) {
|
||||||
ExamQuestionVO result = examQuestionService.selectQuestionDetail(id);
|
ExamQuestionVO result = examQuestionService.selectQuestionDetail(id);
|
||||||
AjaxResult success = success("查询成功");
|
AjaxResult success = success("查询成功");
|
||||||
success.put("data",result);
|
success.put("data", result);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue