|
|
|
@ -1,6 +1,5 @@
|
|
|
|
|
package com.luoo.music.controller;
|
|
|
|
|
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.HashSet;
|
|
|
|
@ -13,6 +12,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
import com.luoo.music.dao.CommentDao;
|
|
|
|
|
import com.luoo.music.dto.mapper.CommentMapper;
|
|
|
|
|
import com.luoo.music.dto.mapper.JournalMapper;
|
|
|
|
|
import com.luoo.music.dto.request.CollectQueryReq;
|
|
|
|
|
import com.luoo.music.dto.request.JournalQueryReq;
|
|
|
|
|
import com.luoo.music.dto.response.CommentDTO;
|
|
|
|
|
import com.luoo.music.dto.response.JournalFilterDTO;
|
|
|
|
@ -21,10 +21,8 @@ import com.luoo.music.dto.response.TagDTO;
|
|
|
|
|
import io.swagger.annotations.*;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
import org.springframework.util.StopWatch;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import com.luoo.music.pojo.Journal;
|
|
|
|
|
import com.luoo.music.pojo.Tag;
|
|
|
|
@ -125,19 +123,13 @@ public class JournalController {
|
|
|
|
|
return set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "2.查询收藏期刊信息")
|
|
|
|
|
@ApiImplicitParams({ @ApiImplicitParam(name = "userId", value = "用户id", required = true),
|
|
|
|
|
@ApiImplicitParam(name = "pageNum", value = "分页: 页码,以1开始", required = true),
|
|
|
|
|
@ApiImplicitParam(name = "pageSize", value = "分页: 每页数量", required = true) })
|
|
|
|
|
@GetMapping("/collect/{userId}/{pageNum}/{pageSize}")
|
|
|
|
|
@ApiOperation(value = "2.查询收藏期刊信息", notes = "pageNum/pageSize不传或者小于1,则返回所有收藏刊")
|
|
|
|
|
@GetMapping("/collect")
|
|
|
|
|
@GlobalInterceptor(checkAppUserLogin = true)
|
|
|
|
|
public Result<PageResult<JournalRespDTO>> collectPage(
|
|
|
|
|
public Result<PageResult<JournalRespDTO>> collectJournals(
|
|
|
|
|
@RequestHeader(value = "Authorization", required = true) String authorization,
|
|
|
|
|
@PathVariable @VerifyParam(required = true) String userId,
|
|
|
|
|
@PathVariable @VerifyParam(required = true) Integer pageNum,
|
|
|
|
|
@PathVariable @VerifyParam(required = true) Integer pageSize) {
|
|
|
|
|
Pageable pageable = PageRequest.of(pageNum-1,pageSize);
|
|
|
|
|
List<String> objectIds=userCollectInfoService.findByUserIdAndCollectType(userId, CollectTypeEnum.JOURNAL, pageable);
|
|
|
|
|
@VerifyParam CollectQueryReq queryReq) {
|
|
|
|
|
List<String> objectIds= getObjectIds(queryReq);
|
|
|
|
|
if (objectIds.isEmpty()) {
|
|
|
|
|
return Result.success(new PageResult<JournalRespDTO>(0L, Collections.emptyList()));
|
|
|
|
|
}
|
|
|
|
@ -148,6 +140,14 @@ public class JournalController {
|
|
|
|
|
return Result.success(new PageResult<JournalRespDTO>(Long.valueOf(list.size()), list));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private List<String> getObjectIds(CollectQueryReq queryReq) {
|
|
|
|
|
if(null==queryReq.getPageNum()||queryReq.getPageNum()<1||null==queryReq.getPageSize()||queryReq.getPageSize()<1) {
|
|
|
|
|
return userCollectInfoService.findByUserIdAndCollectType(queryReq.getUserId(), CollectTypeEnum.JOURNAL);
|
|
|
|
|
}
|
|
|
|
|
PageRequest pageRequest = PageRequest.of(queryReq.getPageNum()-1, queryReq.getPageSize());
|
|
|
|
|
return userCollectInfoService.findByUserIdAndCollectType(queryReq.getUserId(), CollectTypeEnum.JOURNAL, pageRequest);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "3.根据期刊id查询期刊信息")
|
|
|
|
|
@GetMapping("/{id}")
|
|
|
|
|
@GlobalInterceptor
|
|
|
|
|