parent
18b2ce25da
commit
f5a2b242ff
@ -0,0 +1,100 @@
|
|||||||
|
package com.luoo.music.controller;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
|
||||||
|
import com.apifan.common.random.RandomSource;
|
||||||
|
import com.apifan.common.random.entity.Poem;
|
||||||
|
import com.luoo.music.dao.CommentDao;
|
||||||
|
import com.luoo.music.dao.TagDao;
|
||||||
|
import com.luoo.music.dto.request.JournalQueryReq;
|
||||||
|
import com.luoo.music.dto.response.JournalFilterDTO;
|
||||||
|
import com.luoo.music.dto.response.JournalRespDTO;
|
||||||
|
import com.luoo.music.dto.response.SearchCategoryDTO;
|
||||||
|
import com.luoo.music.dto.response.TotalCommentVo;
|
||||||
|
import com.luoo.music.pojo.Comment;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.core.io.ClassPathResource;
|
||||||
|
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.aggregation.Aggregation;
|
||||||
|
import org.springframework.data.mongodb.core.aggregation.AggregationResults;
|
||||||
|
import org.springframework.data.mongodb.core.query.Criteria;
|
||||||
|
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.JournalSongService;
|
||||||
|
import com.luoo.music.service.TagService;
|
||||||
|
import com.luoo.music.service.UserCollectInfoService;
|
||||||
|
import annotation.GlobalInterceptor;
|
||||||
|
import annotation.VerifyParam;
|
||||||
|
import api.PageResult;
|
||||||
|
import api.Result;
|
||||||
|
import constants.Constants;
|
||||||
|
import dto.UserLoginDto;
|
||||||
|
import enums.CollectTypeEnum;
|
||||||
|
import enums.DateTimePatternEnum;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import util.DateUtil;
|
||||||
|
import util.JwtUtil;
|
||||||
|
import util.StringTools;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 控制器层
|
||||||
|
*
|
||||||
|
* @author Administrator
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@CrossOrigin
|
||||||
|
@Api(tags = "雀跃APP搜索 APIs")
|
||||||
|
@RequestMapping("/search")
|
||||||
|
public class SearchController {
|
||||||
|
@Autowired
|
||||||
|
private UserCollectInfoService userCollectInfoService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JournalController journalController;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JournalService journalService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JournalSongService journalSongService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TagService tagService;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation(value = "1.查询搜索大类", notes = "如 ‘民谣’,‘电子’")
|
||||||
|
@GetMapping("/category")
|
||||||
|
@GlobalInterceptor
|
||||||
|
public Result<List<SearchCategoryDTO>> getCategory() {
|
||||||
|
List<Tag> tags=tagService.getLevel1Tags();
|
||||||
|
List<SearchCategoryDTO> searchCategoryDTOs=tags.stream().map(this::getSearchCategoryDTO).collect(Collectors.toList());
|
||||||
|
return Result.success(searchCategoryDTOs);
|
||||||
|
}
|
||||||
|
private SearchCategoryDTO getSearchCategoryDTO(Tag tag) {
|
||||||
|
SearchCategoryDTO searchCategoryDTO=new SearchCategoryDTO();
|
||||||
|
BeanUtils.copyProperties(tag, searchCategoryDTO);
|
||||||
|
return searchCategoryDTO;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.luoo.music.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SearchCategoryDTO {
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
private String id;
|
||||||
|
@ApiModelProperty(value = "中文名")
|
||||||
|
private String nameCh;
|
||||||
|
@ApiModelProperty(value = "英文名")
|
||||||
|
private String nameEn;
|
||||||
|
@ApiModelProperty(value = "图片路径")
|
||||||
|
private String image;
|
||||||
|
@ApiModelProperty(value = "说明文案")
|
||||||
|
private String description;
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
package com.luoo.music.dto.response;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class TagDTO {
|
||||||
|
@ApiModelProperty(value = "ID")
|
||||||
|
private String id;
|
||||||
|
@ApiModelProperty(value = "中文名")
|
||||||
|
private String name;
|
||||||
|
}
|
Loading…
Reference in new issue