提交 8c2daa0f 编写于 作者: minghao.wu's avatar minghao.wu

feature: 下一道题目

上级 2751ba2e
...@@ -176,7 +176,9 @@ public class AnalysisController { ...@@ -176,7 +176,9 @@ public class AnalysisController {
/** /**
* 未认证用户直接返回 * 未认证用户直接返回
*/ */
if (!doctor.getStatus().equals(CommonConstants.DOCTOR_STATUS_3)) { if (!(doctor.getStatus().equals(CommonConstants.DOCTOR_STATUS_3) ||
doctor.getStatus().equals(CommonConstants.DOCTOR_STATUS_6) ||
doctor.getStatus().equals(CommonConstants.DOCTOR_STATUS_7)) ) {
return ReturnUtil.getPicaResponse(PicaResultCode.INTERFACE_FORBID_VISIT); return ReturnUtil.getPicaResponse(PicaResultCode.INTERFACE_FORBID_VISIT);
} }
...@@ -208,4 +210,40 @@ public class AnalysisController { ...@@ -208,4 +210,40 @@ public class AnalysisController {
return ReturnUtil.getPicaResponse(PicaResultCode.SUCCESS); return ReturnUtil.getPicaResponse(PicaResultCode.SUCCESS);
} }
@ApiOperation(value = "获取某一道题目的下一道题", response = PicaResponse.class)
@RequestMapping(value = "/nextExamTitle/{examTitleId}", method = RequestMethod.GET, produces = "application/json;charset=UTF-8")
public PicaResponse<ExamTitleReplyDto> nextReplyList(@PathVariable("examTitleId") Integer examTitleId,
@RequestHeader(required = false) String token) {
PICAUser user = null;
if (token != null) {
user = CommonUtils.getUserByToken(redisClient, token);
}
PicaResponse.Builder<ExamTitleReplyDto> builder = new PicaResponse.Builder<>();
try {
AnalysisRoundExamTitle analysisRoundExamTitle = analysisService.getAnanlysisRoundExamTitleById(examTitleId);
ExamTitleReplyDto examTitleReplyDto = new ExamTitleReplyDto();
ExamTitleDto examTitleDto = analysisService.getNextExamTitleDtoById(analysisRoundExamTitle.getRoundId(), examTitleId);
List<ReplyDto> replyDtoList = analysisService.getReplyListDtoByExamTitleId(examTitleDto.getExamTitleId(), user != null ? user.getId() : 0);
examTitleReplyDto.setAnalysisId(analysisRoundExamTitle.getAnalysisId());
examTitleReplyDto.setRoundId(analysisRoundExamTitle.getRoundId());
examTitleReplyDto.setExamTitle(examTitleDto);
examTitleReplyDto.setReplyList(replyDtoList);
builder.setData(examTitleReplyDto);
} catch (Exception e) {
e.printStackTrace();
return ReturnUtil.getPicaResponse(PicaResultCode.SYSTEM_INNER_ERROR);
}
return builder.build();
}
} }
...@@ -94,4 +94,12 @@ public interface CHCAnalysisService { ...@@ -94,4 +94,12 @@ public interface CHCAnalysisService {
* @return * @return
*/ */
Integer removeStarRecord(Integer replyId, Integer userId); Integer removeStarRecord(Integer replyId, Integer userId);
/**
* 获取当前题目的下一题目
* @param roundId 当前轮的id
* @param analysisRoundExamTitleId 当前题目的id
* @return 下一题目的id
*/
ExamTitleDto getNextExamTitleDtoById(Integer roundId, Integer analysisRoundExamTitleId);
} }
...@@ -307,4 +307,22 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService { ...@@ -307,4 +307,22 @@ public class CHCAnalysisServiceImpl implements CHCAnalysisService {
return 0; return 0;
} }
@Override
public ExamTitleDto getNextExamTitleDtoById(Integer roundId, Integer analysisRoundExamTitleId) {
List<AnalysisRoundExamTitle> roundExamTitleList = analysisRoundExamTitleMapper.selectExamTitleListByRoundId(roundId);
Integer examTitleCount = roundExamTitleList.size();
Integer idx = 0;
for (int i = 0; i < examTitleCount; ++ i) {
if (roundExamTitleList.get(i).getId() == analysisRoundExamTitleId) {
idx = i;
break;
}
}
idx = ((idx + 1) % examTitleCount);
return this.getExamTitleDtoById(roundExamTitleList.get(idx).getId());
}
} }
spring.profiles.active=test1 spring.profiles.active=dev
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册