|
@@ -10,6 +10,7 @@ import com.qxgmat.data.constants.enums.QuestionType;
|
|
|
import com.qxgmat.data.constants.enums.ServiceKey;
|
|
|
import com.qxgmat.data.constants.enums.logic.ExerciseLogic;
|
|
|
import com.qxgmat.data.constants.enums.module.*;
|
|
|
+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.QuestionNoRelation;
|
|
@@ -121,13 +122,24 @@ public class QuestionController {
|
|
|
|
|
|
@RequestMapping(value = "/search/stem", method = RequestMethod.GET)
|
|
|
@ApiOperation(value = "搜索题目编号列表:题干搜索", httpMethod = "GET")
|
|
|
- public Response<PageMessage<QuestionBaseExtendDto>> searchStem(
|
|
|
+ public Response<PageMessage<QuestionNoDetailDto>> searchStem(
|
|
|
@RequestParam(required = false, defaultValue = "1") int page,
|
|
|
- @RequestParam(required = false, defaultValue = "100") int size,
|
|
|
- @RequestParam(required = true) String keyword,
|
|
|
+ @RequestParam(required = false, defaultValue = "10") int size,
|
|
|
+ @RequestParam(required = false) String keyword,
|
|
|
+ @RequestParam(required = false) String[] questionTypes,
|
|
|
+ @RequestParam(required = false) String module,
|
|
|
+ @RequestParam(required = false) Integer[] structIds,
|
|
|
+ @RequestParam(required = false) String place,
|
|
|
+ @RequestParam(required = false) String difficult,
|
|
|
+ @RequestParam(required = false, defaultValue = "id") String order, // collect_number, correct, time, relation_score
|
|
|
+ @RequestParam(required = false, defaultValue = "desc") String direction,
|
|
|
HttpSession session) {
|
|
|
- PageResult<QuestionNoRelation> p = questionNoService.searchStem(page, size, keyword);
|
|
|
- List<QuestionBaseExtendDto> pr = Transform.convert(p, QuestionBaseExtendDto.class);
|
|
|
+ // 过滤千行cat的数据
|
|
|
+ List<ExaminationStruct> structs = examinationStructService.main();
|
|
|
+ ExaminationStruct qxCatStruct = structs.stream().filter((row)-> row.getExtend().equals(ServiceKey.QX_CAT.key)).findFirst().get();
|
|
|
+
|
|
|
+ Page<QuestionNoRelation> p = questionNoService.searchStemFulltext(page, size, keyword, questionTypes, module, structIds, place, difficult, qxCatStruct.getId(), order, DirectionStatus.ValueOf(direction));
|
|
|
+ List<QuestionNoDetailDto> pr = Transform.convert(p, QuestionNoDetailDto.class);
|
|
|
|
|
|
return ResponseHelp.success(pr, page, size, p.getTotal());
|
|
|
}
|
|
@@ -136,10 +148,14 @@ public class QuestionController {
|
|
|
@ApiOperation(value = "搜索题目编号列表:题目编号搜索", httpMethod = "GET")
|
|
|
public Response<PageMessage<QuestionNoDto>> searchNo(
|
|
|
@RequestParam(required = false, defaultValue = "1") int page,
|
|
|
- @RequestParam(required = false, defaultValue = "100") int size,
|
|
|
+ @RequestParam(required = false, defaultValue = "5") int size,
|
|
|
@RequestParam(required = true) String keyword,
|
|
|
HttpSession session) {
|
|
|
- PageResult<QuestionNoRelation> p = questionNoService.searchNo(page, size, keyword, null);
|
|
|
+ // 过滤千行cat的数据
|
|
|
+ List<ExaminationStruct> structs = examinationStructService.main();
|
|
|
+ ExaminationStruct qxCatStruct = structs.stream().filter((row)-> row.getExtend().equals(ServiceKey.QX_CAT.key)).findFirst().get();
|
|
|
+
|
|
|
+ Page<QuestionNo> p = questionNoService.searchNoFulltext(page, size, keyword, qxCatStruct.getId());
|
|
|
List<QuestionNoDto> pr = Transform.convert(p, QuestionNoDto.class);
|
|
|
|
|
|
return ResponseHelp.success(pr, page, size, p.getTotal());
|
|
@@ -166,11 +182,13 @@ public class QuestionController {
|
|
|
dto.setQuestion(Transform.convert(question, QuestionDetailExtendDto.class));
|
|
|
dto.setQuestionNo(Transform.convert(questionNo, QuestionNoExtendDto.class));
|
|
|
|
|
|
- UserCollectQuestion collect = userCollectQuestionService.getByUserAndQuestion(user.getId(), userQuestion.getQuestionId());
|
|
|
- dto.setCollect(collect != null);
|
|
|
+ if (user!=null){
|
|
|
+ UserCollectQuestion collect = userCollectQuestionService.getByUserAndQuestion(user.getId(), userQuestion.getQuestionId());
|
|
|
+ dto.setCollect(collect != null);
|
|
|
|
|
|
- UserNoteQuestion userNoteQuestion = userNoteQuestionService.getByUserAndQuestion(user.getId(), userQuestion.getQuestionId());
|
|
|
- dto.setNote(Transform.convert(userNoteQuestion, UserNoteQuestionExtendDto.class));
|
|
|
+ UserNoteQuestion userNoteQuestion = userNoteQuestionService.getByUserAndQuestion(user.getId(), userQuestion.getQuestionId());
|
|
|
+ dto.setNote(Transform.convert(userNoteQuestion, UserNoteQuestionExtendDto.class));
|
|
|
+ }
|
|
|
|
|
|
List<UserAskQuestion> userAskQuestionList = userAskQuestionService.listByQuestion(userQuestion.getQuestionId(), true);
|
|
|
dto.setAsks(Transform.convert(userAskQuestionList, UserAskQuestionExtendDto.class));
|
|
@@ -185,10 +203,13 @@ public class QuestionController {
|
|
|
dto.setQuestionNos(Transform.convert(questionNoList, QuestionNoExtendDto.class));
|
|
|
|
|
|
// 获取提问权限
|
|
|
- Integer recordId = questionFlowService.questionRelationCourse(user.getId(), null, QuestionType.ValueOf(question.getQuestionType()));
|
|
|
- if (recordId != null){
|
|
|
- dto.setQuestionStatus(1);
|
|
|
- }else{
|
|
|
+ if (user!= null){
|
|
|
+ Integer recordId = questionFlowService.questionRelationCourse(user.getId(), null, QuestionType.ValueOf(question.getQuestionType()));
|
|
|
+ if (recordId != null){
|
|
|
+ dto.setQuestionStatus(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(dto.getQuestionStatus() == null){
|
|
|
Integer id = questionNo.getModuleStruct()[questionNo.getModuleStruct().length - 1];
|
|
|
QuestionNoModule questionNoModule = QuestionNoModule.ValueOf(questionNo.getModule());
|
|
|
// 获取基本当前权限
|
|
@@ -568,11 +589,13 @@ public class QuestionController {
|
|
|
Question question = questionService.get(userQuestion.getQuestionId());
|
|
|
dto.setQuestion(Transform.convert(question, QuestionDetailExtendDto.class));
|
|
|
|
|
|
- UserCollectQuestion collect = userCollectQuestionService.getByUserAndQuestion(user.getId(), userQuestion.getQuestionId());
|
|
|
- dto.setCollect(collect != null);
|
|
|
+ if (user != null){
|
|
|
+ UserCollectQuestion collect = userCollectQuestionService.getByUserAndQuestion(user.getId(), userQuestion.getQuestionId());
|
|
|
+ dto.setCollect(collect != null);
|
|
|
|
|
|
- UserNoteQuestion userNoteQuestion = userNoteQuestionService.getByUserAndQuestion(user.getId(), userQuestion.getQuestionId());
|
|
|
- dto.setNote(Transform.convert(userNoteQuestion, UserNoteQuestionExtendDto.class));
|
|
|
+ UserNoteQuestion userNoteQuestion = userNoteQuestionService.getByUserAndQuestion(user.getId(), userQuestion.getQuestionId());
|
|
|
+ dto.setNote(Transform.convert(userNoteQuestion, UserNoteQuestionExtendDto.class));
|
|
|
+ }
|
|
|
|
|
|
List<UserAskQuestion> userAskQuestionList = userAskQuestionService.listByQuestion(userQuestion.getQuestionId(), true);
|
|
|
dto.setAsks(Transform.convert(userAskQuestionList, UserAskQuestionExtendDto.class));
|
|
@@ -600,11 +623,14 @@ public class QuestionController {
|
|
|
break;
|
|
|
}
|
|
|
// 获取提问权限
|
|
|
- PaperOrigin origin= PaperOrigin.ValueOf(userReport.getPaperOrigin());
|
|
|
- Integer recordId = questionFlowService.questionRelationCourse(user.getId(), origin == PaperOrigin.PREVIEW ? userReport.getOriginId() : null, QuestionType.ValueOf(question.getQuestionType()));
|
|
|
- if (recordId != null){
|
|
|
- dto.setQuestionStatus(1);
|
|
|
- }else{
|
|
|
+ PaperOrigin origin = PaperOrigin.ValueOf(userReport.getPaperOrigin());
|
|
|
+ if (user != null){
|
|
|
+ Integer recordId = questionFlowService.questionRelationCourse(user.getId(), origin == PaperOrigin.PREVIEW ? userReport.getOriginId() : null, QuestionType.ValueOf(question.getQuestionType()));
|
|
|
+ if (recordId != null){
|
|
|
+ dto.setQuestionStatus(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (dto.getQuestionStatus() == null){
|
|
|
// 获取基本当前权限
|
|
|
switch(origin){
|
|
|
case EXAMINATION:
|
|
@@ -630,7 +656,6 @@ public class QuestionController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
return ResponseHelp.success(dto);
|
|
|
}
|
|
|
|