|
|
@@ -11,8 +11,10 @@ import com.sundot.airport.exam.domain.DailyTask;
|
|
11
|
11
|
import com.sundot.airport.exam.domain.DailyTaskDetail;
|
|
12
|
12
|
import com.sundot.airport.exam.dto.DailyTaskAdminQueryDTO;
|
|
13
|
13
|
import com.sundot.airport.exam.enums.DailyTaskStatusEnum;
|
|
|
14
|
+import com.sundot.airport.exam.domain.QuesOpt;
|
|
14
|
15
|
import com.sundot.airport.exam.mapper.DailyTaskDetailMapper;
|
|
15
|
16
|
import com.sundot.airport.exam.mapper.DailyTaskMapper;
|
|
|
17
|
+import com.sundot.airport.exam.mapper.QuesOptMapper;
|
|
16
|
18
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
17
|
19
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
18
|
20
|
import org.springframework.web.bind.annotation.*;
|
|
|
@@ -38,6 +40,9 @@ public class DailyTaskAdminController extends BaseController {
|
|
38
|
40
|
@Autowired
|
|
39
|
41
|
private DailyTaskDetailMapper dailyTaskDetailMapper;
|
|
40
|
42
|
|
|
|
43
|
+ @Autowired
|
|
|
44
|
+ private QuesOptMapper quesOptMapper;
|
|
|
45
|
+
|
|
41
|
46
|
/**
|
|
42
|
47
|
* 查询任务列表(管理员)
|
|
43
|
48
|
* 支持多条件筛选
|
|
|
@@ -144,10 +149,38 @@ public class DailyTaskAdminController extends BaseController {
|
|
144
|
149
|
wrapper.orderByAsc(DailyTaskDetail::getDtdQuestionNo);
|
|
145
|
150
|
List<DailyTaskDetail> details = dailyTaskDetailMapper.selectList(wrapper);
|
|
146
|
151
|
|
|
|
152
|
+ // 查询所有题目的选项
|
|
|
153
|
+ Map<String, List<Map<String, Object>>> optionsMap = new HashMap<>();
|
|
|
154
|
+ if (!details.isEmpty()) {
|
|
|
155
|
+ // 收集所有题目ID
|
|
|
156
|
+ List<String> quesIds = details.stream()
|
|
|
157
|
+ .map(DailyTaskDetail::getDtdQuesId)
|
|
|
158
|
+ .filter(id -> id != null && !id.isEmpty())
|
|
|
159
|
+ .distinct()
|
|
|
160
|
+ .collect(Collectors.toList());
|
|
|
161
|
+
|
|
|
162
|
+ if (!quesIds.isEmpty()) {
|
|
|
163
|
+ // 查询这些题目的选项(使用自定义方法,忽略逻辑删除条件)
|
|
|
164
|
+ List<QuesOpt> allOptions = quesOptMapper.selectByQuesIds(quesIds);
|
|
|
165
|
+
|
|
|
166
|
+ // 按题目ID分组
|
|
|
167
|
+ for (QuesOpt opt : allOptions) {
|
|
|
168
|
+ String quId = opt.getQuId();
|
|
|
169
|
+ optionsMap.computeIfAbsent(quId, k -> new ArrayList<>());
|
|
|
170
|
+ Map<String, Object> optInfo = new HashMap<>();
|
|
|
171
|
+ optInfo.put("sort", opt.getSort());
|
|
|
172
|
+ optInfo.put("content", opt.getQoOption());
|
|
|
173
|
+ optInfo.put("isCorrect", opt.getQoCorrect());
|
|
|
174
|
+ optionsMap.get(quId).add(optInfo);
|
|
|
175
|
+ }
|
|
|
176
|
+ }
|
|
|
177
|
+ }
|
|
|
178
|
+
|
|
147
|
179
|
// 组装返回结果
|
|
148
|
180
|
AjaxResult result = AjaxResult.success();
|
|
149
|
181
|
result.put("task", task);
|
|
150
|
182
|
result.put("details", details);
|
|
|
183
|
+ result.put("optionsMap", optionsMap);
|
|
151
|
184
|
return result;
|
|
152
|
185
|
}
|
|
153
|
186
|
|