|
@@ -13,6 +13,7 @@ import com.qxgmat.data.constants.enums.module.PaperOrigin;
|
|
|
import com.qxgmat.data.constants.enums.module.QuestionModule;
|
|
|
import com.qxgmat.data.constants.enums.status.DirectionStatus;
|
|
|
import com.qxgmat.data.dao.entity.*;
|
|
|
+import com.qxgmat.data.inline.UserQuestionStat;
|
|
|
import com.qxgmat.data.relation.entity.*;
|
|
|
import com.qxgmat.dto.extend.*;
|
|
|
import com.qxgmat.dto.request.*;
|
|
@@ -74,6 +75,9 @@ public class MyController {
|
|
|
private ClassCourseNoService classCourseNoService;
|
|
|
|
|
|
@Autowired
|
|
|
+ private QuestionService questionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
private QuestionNoService questionNoService;
|
|
|
|
|
|
@Autowired
|
|
@@ -498,12 +502,35 @@ public class MyController {
|
|
|
@RequestParam(required = false, defaultValue = "desc") String direction,
|
|
|
HttpSession session) {
|
|
|
User user = (User) shiroHelp.getLoginUser();
|
|
|
- PageResult<UserCollectQuestionRelation> p = userCollectQuestionService.listQuestion(page, size, user.getId(), QuestionModule.ValueOf(module), QuestionType.ValueOf(type), startTime, endTime, order, DirectionStatus.ValueOf(direction));
|
|
|
+ QuestionModule questionModule = QuestionModule.ValueOf(module);
|
|
|
+ PageResult<UserCollectQuestionRelation> p = userCollectQuestionService.listQuestion(page, size, user.getId(), questionModule, QuestionType.ValueOf(type), startTime, endTime, order, DirectionStatus.ValueOf(direction));
|
|
|
|
|
|
List<UserCollectQuestionDto> pr = Transform.convert(p, UserCollectQuestionDto.class);
|
|
|
|
|
|
- // todo 绑定做题数据
|
|
|
+ // 获取题目信息
|
|
|
+ Collection questionIds = Transform.getIds(pr, UserCollectQuestionDto.class, "questionId");
|
|
|
+ List<Question> questionList = questionService.select(questionIds);
|
|
|
+ Transform.combine(pr, questionList, UserCollectQuestionDto.class, "questionId", "question", Question.class, "id", QuestionExtendDto.class);
|
|
|
|
|
|
+ Collection questionNoIds = Transform.getIds(pr, UserCollectQuestionDto.class, "questionNoId");
|
|
|
+ switch(questionModule){
|
|
|
+ case BASE:
|
|
|
+ List<QuestionNo> questionNoList = questionNoService.select(questionNoIds);
|
|
|
+ Transform.combine(pr, questionNoList, UserCollectQuestionDto.class, "questionNoId", "questionNo", QuestionNo.class, "id", QuestionNoExtendDto.class);
|
|
|
+ break;
|
|
|
+ case SENTENCE:
|
|
|
+ List<SentenceQuestion> sentenceQuestionList = sentenceQuestionService.select(questionNoIds);
|
|
|
+ Transform.combine(pr, sentenceQuestionList, UserCollectQuestionDto.class, "questionNoId", "questionNo", SentenceQuestion.class, "id", QuestionNoExtendDto.class);
|
|
|
+ break;
|
|
|
+ case TEXTBOOK:
|
|
|
+ List<TextbookQuestion> textbookQuestionList = textbookQuestionService.select(questionNoIds);
|
|
|
+ Transform.combine(pr, textbookQuestionList, UserCollectQuestionDto.class, "questionNoId", "questionNo", TextbookQuestion.class, "id", QuestionNoExtendDto.class);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ // 绑定题目统计
|
|
|
+ Map<Object, UserQuestionStat> stats = userQuestionService.statQuestionMap(questionIds);
|
|
|
+ Transform.combine(pr, stats, UserCollectQuestionDto.class, "questionId", "stat");
|
|
|
|
|
|
return ResponseHelp.success(pr, page, size, p.getTotal());
|
|
|
}
|
|
@@ -517,10 +544,30 @@ public class MyController {
|
|
|
@RequestParam(required = false) Number category
|
|
|
) {
|
|
|
User user = (User) shiroHelp.getLoginUser();
|
|
|
+ QuestionModule questionModule = QuestionModule.ValueOf(module);
|
|
|
PageResult<UserQuestion> p = userQuestionService.listError(page, size, user.getId());
|
|
|
List<UserQuestionErrorListDto> pr = Transform.convert(p, UserQuestionErrorListDto.class);
|
|
|
|
|
|
- // todo 绑定数据
|
|
|
+ // 获取题目信息
|
|
|
+ Collection questionIds = Transform.getIds(pr, UserQuestionErrorListDto.class, "questionId");
|
|
|
+ List<Question> questionList = questionService.select(questionIds);
|
|
|
+ Transform.combine(pr, questionList, UserQuestionErrorListDto.class, "questionId", "question", Question.class, "id", QuestionExtendDto.class);
|
|
|
+
|
|
|
+ Collection questionNoIds = Transform.getIds(pr, UserQuestionErrorListDto.class, "questionNoId");
|
|
|
+ switch(questionModule){
|
|
|
+ case BASE:
|
|
|
+ List<QuestionNo> questionNoList = questionNoService.select(questionNoIds);
|
|
|
+ Transform.combine(pr, questionNoList, UserQuestionErrorListDto.class, "questionNoId", "questionNo", QuestionNo.class, "id", QuestionNoExtendDto.class);
|
|
|
+ break;
|
|
|
+ case SENTENCE:
|
|
|
+ List<SentenceQuestion> sentenceQuestionList = sentenceQuestionService.select(questionNoIds);
|
|
|
+ Transform.combine(pr, sentenceQuestionList, UserQuestionErrorListDto.class, "questionNoId", "questionNo", SentenceQuestion.class, "id", QuestionNoExtendDto.class);
|
|
|
+ break;
|
|
|
+ case TEXTBOOK:
|
|
|
+ List<TextbookQuestion> textbookQuestionList = textbookQuestionService.select(questionNoIds);
|
|
|
+ Transform.combine(pr, textbookQuestionList, UserQuestionErrorListDto.class, "questionNoId", "questionNo", TextbookQuestion.class, "id", QuestionNoExtendDto.class);
|
|
|
+ break;
|
|
|
+ }
|
|
|
|
|
|
return ResponseHelp.success(pr, page, size, p.getTotal());
|
|
|
}
|
|
@@ -567,9 +614,9 @@ public class MyController {
|
|
|
return ResponseHelp.success(true);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/note", method = RequestMethod.PUT)
|
|
|
+ @RequestMapping(value = "/note/question", method = RequestMethod.PUT)
|
|
|
@ApiOperation(value = "更新笔记", notes = "更新笔记", httpMethod = "PUT")
|
|
|
- public Response<Boolean> updateNote(@RequestBody @Validated UserNoteDto dto) {
|
|
|
+ public Response<Boolean> updateNoteQuestion(@RequestBody @Validated UserNoteDto dto) {
|
|
|
UserNoteQuestion entity = Transform.dtoToEntity(dto);
|
|
|
User user = (User) shiroHelp.getLoginUser();
|
|
|
entity.setUserId(user.getId());
|
|
@@ -599,9 +646,9 @@ public class MyController {
|
|
|
return ResponseHelp.success(true);
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/note/list", method = RequestMethod.GET)
|
|
|
- @ApiOperation(value = "获取笔记列表", notes = "获取笔记列表", httpMethod = "GET")
|
|
|
- public Response<PageMessage<UserNoteDetailDto>> listNote(
|
|
|
+ @RequestMapping(value = "/note/question/list", method = RequestMethod.GET)
|
|
|
+ @ApiOperation(value = "获取题目笔记列表", notes = "获取笔记列表", httpMethod = "GET")
|
|
|
+ public Response<PageMessage<UserNoteQuestionDto>> listNoteQuestion(
|
|
|
@RequestParam(required = false, defaultValue = "1") int page,
|
|
|
@RequestParam(required = false, defaultValue = "100") int size,
|
|
|
@RequestParam(required = true) String module,
|
|
@@ -612,11 +659,30 @@ public class MyController {
|
|
|
@RequestParam(required = false, defaultValue = "desc") String direction,
|
|
|
HttpSession session) {
|
|
|
User user = (User) shiroHelp.getLoginUser();
|
|
|
- PageResult<UserNoteQuestionRelation> p = userNoteQuestionService.list(page, size, user.getId(), QuestionModule.ValueOf(module), QuestionType.ValueOf(type), startTime, endTime, order, DirectionStatus.ValueOf(direction));
|
|
|
- List<UserNoteDetailDto> pr = Transform.convert(p, UserNoteDetailDto.class);
|
|
|
+ QuestionModule questionModule = QuestionModule.ValueOf(module);
|
|
|
+ PageResult<UserNoteQuestionRelation> p = userNoteQuestionService.list(page, size, user.getId(), questionModule, QuestionType.ValueOf(type), startTime, endTime, order, DirectionStatus.ValueOf(direction));
|
|
|
+ List<UserNoteQuestionDto> pr = Transform.convert(p, UserNoteQuestionDto.class);
|
|
|
|
|
|
- // todo 绑定数据
|
|
|
+ // 获取题目信息
|
|
|
+ Collection questionIds = Transform.getIds(pr, UserNoteQuestionDto.class, "questionId");
|
|
|
+ List<Question> questionList = questionService.select(questionIds);
|
|
|
+ Transform.combine(pr, questionList, UserNoteQuestionDto.class, "questionId", "question", Question.class, "id", QuestionExtendDto.class);
|
|
|
|
|
|
+ Collection questionNoIds = Transform.getIds(pr, UserQuestionErrorListDto.class, "questionNoId");
|
|
|
+ switch(questionModule){
|
|
|
+ case BASE:
|
|
|
+ List<QuestionNo> questionNoList = questionNoService.select(questionNoIds);
|
|
|
+ Transform.combine(pr, questionNoList, UserQuestionErrorListDto.class, "questionNoId", "questionNo", QuestionNo.class, "id", QuestionNoExtendDto.class);
|
|
|
+ break;
|
|
|
+ case SENTENCE:
|
|
|
+ List<SentenceQuestion> sentenceQuestionList = sentenceQuestionService.select(questionNoIds);
|
|
|
+ Transform.combine(pr, sentenceQuestionList, UserQuestionErrorListDto.class, "questionNoId", "questionNo", SentenceQuestion.class, "id", QuestionNoExtendDto.class);
|
|
|
+ break;
|
|
|
+ case TEXTBOOK:
|
|
|
+ List<TextbookQuestion> textbookQuestionList = textbookQuestionService.select(questionNoIds);
|
|
|
+ Transform.combine(pr, textbookQuestionList, UserQuestionErrorListDto.class, "questionNoId", "questionNo", TextbookQuestion.class, "id", QuestionNoExtendDto.class);
|
|
|
+ break;
|
|
|
+ }
|
|
|
return ResponseHelp.success(pr, page, size, p.getTotal());
|
|
|
}
|
|
|
|
|
@@ -625,16 +691,16 @@ public class MyController {
|
|
|
public Response<PageMessage<UserPaperDto>> reportList(
|
|
|
@RequestParam(required = false, defaultValue = "1") int page,
|
|
|
@RequestParam(required = false, defaultValue = "100") int size,
|
|
|
- @RequestParam(required = true) String module,
|
|
|
- @RequestParam(required = false) String type,
|
|
|
+ @RequestParam(required = true) String origin,
|
|
|
+ @RequestParam(required = false) Integer structId,
|
|
|
@RequestParam(required = false) String startTime,
|
|
|
@RequestParam(required = false) String endTime,
|
|
|
@RequestParam(required = false, defaultValue = "id") String order,
|
|
|
@RequestParam(required = false, defaultValue = "desc") String direction,
|
|
|
HttpSession session) {
|
|
|
User user = (User) shiroHelp.getLoginUser();
|
|
|
- PageResult<UserPaper> p = userPaperService.list(page, size, user.getId(), PaperModule.ValueOf(module), QuestionType.ValueOf(type), startTime, endTime, order, DirectionStatus.ValueOf(direction));
|
|
|
-
|
|
|
+ PaperOrigin paperOrigin = PaperOrigin.ValueOf(origin);
|
|
|
+ PageResult<UserPaper> p = userPaperService.list(page, size, user.getId(), paperOrigin, structId, startTime, endTime, order, DirectionStatus.ValueOf(direction));
|
|
|
List<UserPaperDto> pr = Transform.convert(p, UserPaperDto.class);
|
|
|
|
|
|
Collection paperIds = Transform.getIds(p, UserPaper.class, "id");
|
|
@@ -644,14 +710,12 @@ public class MyController {
|
|
|
|
|
|
// 错题 -> 题型
|
|
|
|
|
|
- // 模考 -> 分数
|
|
|
-
|
|
|
return ResponseHelp.success(pr, page, size, p.getTotal());
|
|
|
}
|
|
|
|
|
|
- @RequestMapping(value = "/ask", method = RequestMethod.POST)
|
|
|
+ @RequestMapping(value = "/ask/question", method = RequestMethod.POST)
|
|
|
@ApiOperation(value = "添加提问", notes = "添加提问", httpMethod = "POST")
|
|
|
- public Response<Boolean> addAsk(@RequestBody @Validated UserAskDto dto) {
|
|
|
+ public Response<Boolean> addAskQuestion(@RequestBody @Validated UserAskDto dto) {
|
|
|
UserAskQuestion entity = Transform.dtoToEntity(dto);
|
|
|
User user = (User) shiroHelp.getLoginUser();
|
|
|
entity.setUserId(user.getId());
|