|
|
@ -33,6 +33,7 @@ import annotation.GlobalInterceptor;
|
|
|
|
import annotation.VerifyParam;
|
|
|
|
import annotation.VerifyParam;
|
|
|
|
import api.PageResult;
|
|
|
|
import api.PageResult;
|
|
|
|
import api.Result;
|
|
|
|
import api.Result;
|
|
|
|
|
|
|
|
import api.StatusCode;
|
|
|
|
import constants.Constants;
|
|
|
|
import constants.Constants;
|
|
|
|
import dto.UserLoginDto;
|
|
|
|
import dto.UserLoginDto;
|
|
|
|
import enums.CollectTypeEnum;
|
|
|
|
import enums.CollectTypeEnum;
|
|
|
@ -154,11 +155,12 @@ public class JournalController {
|
|
|
|
public Result<JournalRespDTO> findById(
|
|
|
|
public Result<JournalRespDTO> findById(
|
|
|
|
@RequestHeader(value = "Authorization", required = false) String authorization,
|
|
|
|
@RequestHeader(value = "Authorization", required = false) String authorization,
|
|
|
|
@PathVariable @VerifyParam(required = true) String id) {
|
|
|
|
@PathVariable @VerifyParam(required = true) String id) {
|
|
|
|
UserLoginDto user = jwtUtil.getUserLoginDto(authorization);
|
|
|
|
|
|
|
|
if (null == user && !journalService.isLatest10ByJournalId(id)) {
|
|
|
|
|
|
|
|
return Result.unauthorized(null);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
Journal journal = journalService.findById(id);
|
|
|
|
Journal journal = journalService.findById(id);
|
|
|
|
|
|
|
|
if(null==journal) {
|
|
|
|
|
|
|
|
return Result.failed(StatusCode.MUSIC_COMMON_FAILED,"根据id无法找到期刊, id: "+id);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
UserLoginDto user = jwtUtil.getUserLoginDto(authorization);
|
|
|
|
|
|
|
|
|
|
|
|
JournalRespDTO journalRespDTO=JournalMapper.getJournalRespDTO(journal, Collections.emptySet(),mongoTemplate,redisTemplate,commentDao);
|
|
|
|
JournalRespDTO journalRespDTO=JournalMapper.getJournalRespDTO(journal, Collections.emptySet(),mongoTemplate,redisTemplate,commentDao);
|
|
|
|
boolean isCollect=null == user ? false:userCollectInfoService.isCollect(user.getUserId(),id, CollectTypeEnum.JOURNAL);
|
|
|
|
boolean isCollect=null == user ? false:userCollectInfoService.isCollect(user.getUserId(),id, CollectTypeEnum.JOURNAL);
|
|
|
|
journalRespDTO.setHaveCollect(isCollect);
|
|
|
|
journalRespDTO.setHaveCollect(isCollect);
|
|
|
|