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