|
@@ -14,6 +14,7 @@ import com.qxgmat.data.relation.entity.UserNoteCourseRelation;
|
|
|
import com.qxgmat.data.relation.entity.UserQuestionRelation;
|
|
|
import com.qxgmat.service.UserNoteCourseService;
|
|
|
import com.qxgmat.service.UserNoteQuestionService;
|
|
|
+import com.qxgmat.service.UserQuestionService;
|
|
|
import com.qxgmat.service.inline.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -42,6 +43,9 @@ public class ExportService {
|
|
|
@Autowired
|
|
|
private UserAskQuestionService userAskQuestionService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private UserQuestionService userQuestionService;
|
|
|
+
|
|
|
@Resource
|
|
|
private UserExportService userExportService;
|
|
|
|
|
@@ -91,7 +95,8 @@ public class ExportService {
|
|
|
.userId(userId)
|
|
|
.type(ExportType.QUESTION_COLLECT.key)
|
|
|
.setting(setting)
|
|
|
- .no(count)
|
|
|
+ .content(content)
|
|
|
+ .no(count+1)
|
|
|
.build();
|
|
|
return userExportService.add(export);
|
|
|
}
|
|
@@ -141,7 +146,8 @@ public class ExportService {
|
|
|
.userId(userId)
|
|
|
.type(ExportType.QUESTION_ERROR.key)
|
|
|
.setting(setting)
|
|
|
- .no(count)
|
|
|
+ .content(content)
|
|
|
+ .no(count + 1)
|
|
|
.build();
|
|
|
return userExportService.add(export);
|
|
|
}
|
|
@@ -189,7 +195,8 @@ public class ExportService {
|
|
|
.userId(userId)
|
|
|
.type(ExportType.NOTE_QUESTION.key)
|
|
|
.setting(setting)
|
|
|
- .no(count)
|
|
|
+ .content(content)
|
|
|
+ .no(count + 1)
|
|
|
.build();
|
|
|
return userExportService.add(export);
|
|
|
}
|
|
@@ -219,19 +226,23 @@ public class ExportService {
|
|
|
.userId(userId)
|
|
|
.type(ExportType.NOTE_COURSE.key)
|
|
|
.setting(setting)
|
|
|
- .no(count)
|
|
|
.content(content)
|
|
|
+ .no(count + 1)
|
|
|
.build();
|
|
|
|
|
|
return userExportService.add(export);
|
|
|
}
|
|
|
|
|
|
private List<UserQuestionRelation> listByQuestionNoIds(Integer userId, Collection questionNoIds, boolean needAnswer){
|
|
|
+ List<QuestionNo> questionNoList = questionNoService.select(questionNoIds);
|
|
|
+ Collection questionIds = Transform.getIds(questionNoList, QuestionNo.class, "questionId");
|
|
|
+
|
|
|
List<UserQuestion> userQuestionList = null;
|
|
|
if (needAnswer){
|
|
|
// 查询所有id的最后一次做题记录
|
|
|
-
|
|
|
+ userQuestionList = userQuestionService.listWithLast(userId, questionIds);
|
|
|
}else{
|
|
|
+ userQuestionList = new ArrayList<>();
|
|
|
for(Object questionNoId : questionNoIds){
|
|
|
userQuestionList.add(UserQuestion.builder()
|
|
|
.questionNoId((Integer)questionNoId)
|
|
@@ -239,12 +250,9 @@ public class ExportService {
|
|
|
}
|
|
|
}
|
|
|
List<UserQuestionRelation> relationList = Transform.convert(userQuestionList, UserQuestionRelation.class);
|
|
|
-
|
|
|
- List<QuestionNo> questionNoList = questionNoService.select(questionNoIds);
|
|
|
Transform.combine(relationList, questionNoList, UserQuestionRelation.class, "questionNoId", "questionNo", QuestionNo.class, "id");
|
|
|
Map questionNoMap = Transform.getMap(questionNoList, QuestionNo.class, "id", "questionId");
|
|
|
Transform.combine(relationList, questionNoMap, UserQuestionRelation.class, "questionNoId", "questionId");
|
|
|
- Collection questionIds = Transform.getIds(questionNoList, QuestionNo.class, "questionId");
|
|
|
List<Question> questionList = questionService.select(questionIds);
|
|
|
Transform.combine(relationList, questionList, UserQuestionRelation.class, "questionId", "question", Question.class, "id");
|
|
|
|