|
@@ -10,8 +10,7 @@ import com.xhkjedu.sstudy.vo.question.UserBasketVo;
|
10
|
10
|
import org.springframework.stereotype.Service;
|
11
|
11
|
|
12
|
12
|
import javax.annotation.Resource;
|
13
|
|
-import java.util.ArrayList;
|
14
|
|
-import java.util.List;
|
|
13
|
+import java.util.*;
|
15
|
14
|
import java.util.stream.Collectors;
|
16
|
15
|
|
17
|
16
|
/**
|
|
@@ -63,6 +62,24 @@ public class UserBasketService {
|
63
|
62
|
//获取列表
|
64
|
63
|
public List <UserBasketVo> findAll(Integer userid, String subjectid) {
|
65
|
64
|
List<UserBasketVo> baskets = userBasketMapper.findAll(userid, subjectid);
|
|
65
|
+ List<String> questionids = new ArrayList<>();
|
|
66
|
+ for (UserBasketVo basket : baskets) {
|
|
67
|
+ questionids.addAll(basket.getQuestions().stream().filter(b -> b.getQlevel().equals(2)).map(
|
|
68
|
+ QuestionVo::getQuestionid).collect(Collectors.toList()));
|
|
69
|
+ }
|
|
70
|
+ if (N_Utils.isListNotEmpty(questionids)) {
|
|
71
|
+ List<Map<String, String>> sonList = questionMapper.listSonQuestionForSelect(String.join("','", questionids));
|
|
72
|
+ for (UserBasketVo basket : baskets) {
|
|
73
|
+ for (QuestionVo question : basket.getQuestions()) {
|
|
74
|
+ if (question.getQlevel().equals(2)) {
|
|
75
|
+ String questionid = question.getQuestionid();
|
|
76
|
+ List<Map> sonqlist = sonList.stream().filter(
|
|
77
|
+ s -> s.get("questionpid").equals(questionid)).collect(Collectors.toList());
|
|
78
|
+ question.setSonqlist(sonqlist);
|
|
79
|
+ }
|
|
80
|
+ }
|
|
81
|
+ }
|
|
82
|
+ }
|
66
|
83
|
String sujectname = subjectMapper.getSubjectnameById(subjectid);
|
67
|
84
|
//英语学科时处理听力题
|
68
|
85
|
if(sujectname.contains("英语")){
|