|
@@ -3,13 +3,14 @@ package edu.math.diagnosis.controller;
|
|
|
import edu.math.diagnosis.entity.Paper;
|
|
|
import edu.math.diagnosis.entity.PaperResult;
|
|
|
import edu.math.diagnosis.entity.UserInfo;
|
|
|
-import edu.math.diagnosis.model.Constants;
|
|
|
import edu.math.diagnosis.model.Result;
|
|
|
import edu.math.diagnosis.service.PaperResultService;
|
|
|
import edu.math.diagnosis.service.PaperService;
|
|
|
+import edu.math.diagnosis.service.SubjectService;
|
|
|
import edu.math.diagnosis.service.UserService;
|
|
|
import edu.math.diagnosis.util.CommonUtil;
|
|
|
import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
@@ -30,6 +31,8 @@ public class ReportController {
|
|
|
private PaperService paperService;
|
|
|
@Resource
|
|
|
private PaperResultService paperResultService;
|
|
|
+ @Resource
|
|
|
+ private SubjectService subjectService;
|
|
|
|
|
|
@GetMapping("generate")
|
|
|
public Result generateAll() {
|
|
@@ -43,21 +46,38 @@ public class ReportController {
|
|
|
}
|
|
|
|
|
|
@GetMapping("userInfo")
|
|
|
+ @ApiOperation("获取报告中用户的个人信息")
|
|
|
public Result userInfo(Long uid, Long pid) {
|
|
|
UserInfo info = userService.getSimpleUser(uid);
|
|
|
+ if (info == null) {
|
|
|
+ return Result.fail("未找到用户");
|
|
|
+ }
|
|
|
Paper paper = paperService.getOnePaper(pid);
|
|
|
+ if (paper == null) {
|
|
|
+ return Result.fail("未找到试卷");
|
|
|
+ }
|
|
|
List<PaperResult> paperResults = paperResultService.findByUidAndPid(String.valueOf(pid), String.valueOf(uid));
|
|
|
if (CommonUtil.isEmpty(paperResults)) {
|
|
|
- return Result.fail("未找到提交的试卷");
|
|
|
+ return Result.fail("未找到提交的试卷结果");
|
|
|
}
|
|
|
PaperResult paperResult = paperResults.get(0);
|
|
|
Map<String, Object> result = new HashMap<>();
|
|
|
result.put("name", info.getName());
|
|
|
result.put("grade", paper.getGrade());
|
|
|
- result.put("subject", Constants.SUBJECT_MAS);
|
|
|
+ result.put("subject", subjectService.get(paper.getSubjectId()));
|
|
|
result.put("diagnosisTime", paperResult.getCreatetime());
|
|
|
result.put("code", paperResult.getCode());
|
|
|
+ result.put("paperResultId", paperResult.getId());
|
|
|
return Result.ok(result);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+// private Result check()
|
|
|
+
|
|
|
+ @GetMapping("globalResult")
|
|
|
+ public Result globalResult(Long paperResultId) {
|
|
|
+
|
|
|
+ return Result.fail("not implements");
|
|
|
+ }
|
|
|
+
|
|
|
}
|