|
|
|
@ -5,17 +5,13 @@ import java.util.concurrent.TimeUnit;
|
|
|
|
|
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;
|
|
|
|
|
import com.luoo.music.dto.response.JournalRespDTO;
|
|
|
|
|
import com.luoo.music.dto.response.SongRespDTO;
|
|
|
|
|
import com.luoo.music.dto.response.TagDTO;
|
|
|
|
|
import io.swagger.annotations.*;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
|
@ -23,9 +19,10 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import com.luoo.music.pojo.Journal;
|
|
|
|
|
import com.luoo.music.pojo.Tag;
|
|
|
|
|
import com.luoo.music.service.JournalService;
|
|
|
|
|
import com.luoo.music.service.UserCollectInfoService;
|
|
|
|
|
import com.luoo.music.util.DeviceTypeUtil;
|
|
|
|
|
|
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
|
import annotation.VerifyParam;
|
|
|
|
|
import api.PageResult;
|
|
|
|
@ -74,12 +71,12 @@ public class JournalController {
|
|
|
|
|
@GlobalInterceptor
|
|
|
|
|
public Result<PageResult<JournalRespDTO>> page(
|
|
|
|
|
@RequestHeader(value = "Authorization", required = false) String authorization,
|
|
|
|
|
@RequestHeader(value = "device_type", required = false) String deviceType,
|
|
|
|
|
@VerifyParam JournalQueryReq queryReq) {
|
|
|
|
|
UserLoginDto user = jwtUtil.getUserLoginDto(authorization);
|
|
|
|
|
updateQuery(user,queryReq);
|
|
|
|
|
updateQuery(deviceType,user,queryReq);
|
|
|
|
|
Long count = journalService.countJournal(queryReq);
|
|
|
|
|
List<JournalRespDTO> pageList=journalService.queryJournalByPage(queryReq);
|
|
|
|
|
// pageList = pageList.stream().map(journalRespDTO -> randomCDN(journalRespDTO)).collect(Collectors.toList());
|
|
|
|
|
Set<String> journalCollectSet = getJournalCollectSet(user);
|
|
|
|
|
updateCollectStatus(pageList,journalCollectSet);
|
|
|
|
|
return Result.success(new PageResult<JournalRespDTO>(count, pageList));
|
|
|
|
@ -94,7 +91,10 @@ public class JournalController {
|
|
|
|
|
private Set<String> getJournalCollectSet(UserLoginDto user) {
|
|
|
|
|
return null == user ? Collections.emptySet():getJournalCollectSet(user.getUserId());
|
|
|
|
|
}
|
|
|
|
|
private void updateQuery(UserLoginDto user, JournalQueryReq queryReq) {
|
|
|
|
|
private void updateQuery(String deviceType, UserLoginDto user, JournalQueryReq queryReq) {
|
|
|
|
|
if(DeviceTypeUtil.isWeb(deviceType)) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (null == user) {
|
|
|
|
|
queryReq.setCategoryId(null);
|
|
|
|
|
queryReq.setPageNum(1);
|
|
|
|
|