|
|
@@ -1,10 +1,10 @@
|
|
|
package com.ruoyi.web.controller.front;
|
|
|
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.ruoyi.common.core.content.VistorContextHolder;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
import com.ruoyi.common.core.domain.AjaxResult2;
|
|
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
|
|
-import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.utils.NumberUtils;
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
import com.ruoyi.dz.domain.DzControl;
|
|
|
@@ -33,6 +33,7 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -132,7 +133,7 @@ public class FrontPaperController {
|
|
|
|
|
|
@ApiOperation("05 取模拟卷列表")
|
|
|
@GetMapping("/list")
|
|
|
- public AjaxResult2<List<LearnPaper>> list(LearnPaper learnPaper) {
|
|
|
+ public AjaxResult2<List<JSONObject>> list(LearnPaper learnPaper) {
|
|
|
SysUser sysUser = SecurityUtils.getLoginUser().getUser();
|
|
|
learnPaper.setPaperType(PaperType.Simulated.name());
|
|
|
String subjectKey = NumberUtils.isPositive(learnPaper.getSubjectId()) ? String.valueOf(sysUser.getExamMajor()) : "0";
|
|
|
@@ -140,6 +141,11 @@ public class FrontPaperController {
|
|
|
learnPaper.setDirectKey(sysUser.getExamType().name() + "_" + subjectKey);
|
|
|
learnPaper.setSubjectId(null);
|
|
|
List<LearnPaper> list = learnPaperService.selectLearnPaperList(learnPaper);
|
|
|
- return AjaxResult2.success(list);
|
|
|
+ Map<Long, String> subjectMap = dzSubjectService.selectDzSubjectList(new DzSubject()).stream().collect(Collectors.toMap(DzSubject::getSubjectId, DzSubject::getSubjectName));
|
|
|
+ List<JSONObject> jsonList = list.stream().map(t -> {
|
|
|
+ JSONObject o = JSONObject.from(t);
|
|
|
+ o.put("subjectName", subjectMap.get(t.getSubjectId()));
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return AjaxResult2.success(jsonList);
|
|
|
}
|
|
|
}
|