提交 f74bbf67 authored 作者: zjm's avatar zjm

fix(培训模块): 添加查询个人考卷的接口

添加查询个人考卷的接口
上级 471c68b1
......@@ -92,4 +92,13 @@ public class TestPaperController {
return ResponseEntity.ok(testPaperService.findByUserIdAndTrainId(securityUser.getCurrentUserInfo().getUserId(),trainId));
}
/**
* 查询个人考卷
*/
@GetMapping("/testPaper/user/{trainId}/{userId}")
@ApiOperation(value = "查询个人考卷,根据用户id,以及培训的id", notes = "查询个人考卷")
public ResponseEntity testPaperByIdAndtrainId(@PathVariable Integer trainId, @ApiIgnore @AuthenticationPrincipal SecurityUser securityUser, @PathVariable Integer userId) {
return ResponseEntity.ok(testPaperService.findByUserIdAndTrainId(userId,trainId));
}
}
......@@ -6,6 +6,7 @@ import com.tykj.dev.device.questionbank.service.ProblemService;
import com.tykj.dev.device.train.dao.TestPaperDao;
import com.tykj.dev.device.train.entity.GenerateTestPaper;
import com.tykj.dev.device.train.entity.TestPaper;
import com.tykj.dev.device.train.entity.TrainTheme;
import com.tykj.dev.device.train.entity.vo.ProblemVo;
import com.tykj.dev.device.train.entity.vo.TestPaperListVo;
import com.tykj.dev.device.train.entity.vo.TestPaperManagementListVo;
......@@ -14,6 +15,7 @@ import com.tykj.dev.device.train.service.TrainThemeService;
import com.tykj.dev.misc.base.BeanHelper;
import com.tykj.dev.misc.exception.ApiException;
import com.tykj.dev.misc.utils.JacksonUtil;
import org.hibernate.annotations.GenericGenerator;
import org.modelmapper.ModelMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
......@@ -72,7 +74,7 @@ public class TestPaperServiceImpl implements TestPaperService {
@Override
public TestPaper findByUserIdAndTrainId(Integer userId, Integer trainId) {
TestPaper testPaper= testPaperDao.findByTrainIdAndUserId(trainId,userId);
TestPaper testPaper= testPaperDao.findByTrainIdAndUserId(trainId,userId);
testPaper.setJudgeProblemList(JacksonUtil.readValue(testPaper.getJudgeProblem(), new TypeReference<List<ProblemVo>>() {
}));
testPaper.setChooseProblemList(JacksonUtil.readValue(testPaper.getChooseProblem(), new TypeReference<List<ProblemVo>>() {
......@@ -81,6 +83,9 @@ public class TestPaperServiceImpl implements TestPaperService {
}));
testPaper.setShortAnswerProblemList(JacksonUtil.readValue(testPaper.getShortAnswerProblem(), new TypeReference<List<ProblemVo>>() {
}));
TrainTheme trainTheme= trainThemeService.findById(trainId);
testPaper.setGenerateTestPaper(JacksonUtil.readValue(trainTheme.getGenerateTestPaperString(), new TypeReference<GenerateTestPaper>() {
}));
return testPaper;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论