新增移动端接口
|
Before Width: | Height: | Size: 268 KiB |
|
Before Width: | Height: | Size: 1.9 MiB After Width: | Height: | Size: 3.6 MiB |
|
After Width: | Height: | Size: 1.0 MiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 2.7 MiB |
|
Before Width: | Height: | Size: 369 KiB |
|
After Width: | Height: | Size: 151 KiB |
|
Before Width: | Height: | Size: 706 KiB After Width: | Height: | Size: 939 KiB |
|
Before Width: | Height: | Size: 211 KiB After Width: | Height: | Size: 416 KiB |
|
Before Width: | Height: | Size: 514 KiB After Width: | Height: | Size: 986 KiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 2.5 MiB |
|
Before Width: | Height: | Size: 731 KiB After Width: | Height: | Size: 731 KiB |
@ -0,0 +1,86 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.common.validator.ValidatorUtils;
|
||||
import com.hongshu.common.validator.group.AddGroup;
|
||||
import com.hongshu.common.validator.group.UpdateGroup;
|
||||
import com.hongshu.web.domain.dto.AlbumDTO;
|
||||
import com.hongshu.web.domain.entity.WebAlbum;
|
||||
import com.hongshu.web.domain.vo.AlbumVo;
|
||||
import com.hongshu.web.service.IWebAlbumService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 专辑
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RequestMapping("/app/album")
|
||||
@RestController
|
||||
public class AppAlbumController {
|
||||
|
||||
@Autowired
|
||||
private IWebAlbumService albumService;
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户ID获取专辑
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
@GetMapping("getAlbumByUserId/{currentPage}/{pageSize}")
|
||||
public Result<?> getAlbumByUserId(@PathVariable long currentPage, @PathVariable long pageSize, String userId) {
|
||||
Page<WebAlbum> page = albumService.getAlbumByUserId(currentPage, pageSize, userId);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存专辑
|
||||
*
|
||||
* @param albumDTO 专辑
|
||||
*/
|
||||
@PostMapping("saveAlbum")
|
||||
public Result<?> saveAlbumByDTO(@RequestBody AlbumDTO albumDTO) {
|
||||
ValidatorUtils.validateEntity(albumDTO, AddGroup.class);
|
||||
albumService.saveAlbum(albumDTO);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据专辑ID获取专辑
|
||||
*
|
||||
* @param albumId 专辑ID
|
||||
*/
|
||||
@GetMapping("getAlbumById")
|
||||
public Result<?> getAlbumById(String albumId) {
|
||||
AlbumVo albumVo = albumService.getAlbumById(albumId);
|
||||
return Result.ok(albumVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除专辑
|
||||
*
|
||||
* @param albumId 专辑ID
|
||||
*/
|
||||
@GetMapping("deleteAlbum")
|
||||
public Result<?> deleteAlbum(String albumId) {
|
||||
albumService.deleteAlbum(albumId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新专辑
|
||||
*
|
||||
* @param albumDTO 专辑
|
||||
*/
|
||||
@PostMapping("updateAlbum")
|
||||
public Result<?> updateAlbum(@RequestBody AlbumDTO albumDTO) {
|
||||
ValidatorUtils.validateEntity(albumDTO, UpdateGroup.class);
|
||||
albumService.updateAlbum(albumDTO);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.web.domain.dto.BrowseRecordDTO;
|
||||
import com.hongshu.web.domain.vo.NoteSearchVo;
|
||||
import com.hongshu.web.service.IWebBrowseRecordService;
|
||||
import io.swagger.annotations.Api;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 浏览记录
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/browseRecord")
|
||||
@Api(tags = "浏览记录")
|
||||
public class AppBrowseRecordController {
|
||||
|
||||
@Autowired
|
||||
private IWebBrowseRecordService browseRecordService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取浏览记录
|
||||
*/
|
||||
@RequestMapping("getAllBrowseRecordByUser/{page}/{limit}")
|
||||
public Result<?> getAllBrowseRecordByUser(@PathVariable("page") long page, @PathVariable("limit") long limit, String uid) {
|
||||
List<NoteSearchVo> browseRecordVoList = browseRecordService.getAllBrowseRecordByUser(page, limit, uid);
|
||||
return Result.ok(browseRecordVoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加浏览记录
|
||||
*/
|
||||
@RequestMapping("addBrowseRecord")
|
||||
public Result<?> addBrowseRecord(@RequestBody BrowseRecordDTO browseRecordDTO) {
|
||||
browseRecordService.addBrowseRecord(browseRecordDTO);
|
||||
return Result.ok(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除浏览记录
|
||||
*/
|
||||
@RequestMapping("delRecord/{uid}")
|
||||
public Result<?> delRecord(@RequestBody List<String> idList, @PathVariable String uid) {
|
||||
browseRecordService.delRecord(uid, idList);
|
||||
return Result.ok(null);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,36 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.common.validator.myVaildator.noLogin.NoLoginIntercept;
|
||||
import com.hongshu.web.domain.vo.CategoryVo;
|
||||
import com.hongshu.web.service.IWebCategoryService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分类
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RequestMapping("/app/category")
|
||||
@RestController
|
||||
public class AppCategoryController {
|
||||
|
||||
@Autowired
|
||||
private IWebCategoryService categoryService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取树形分类数据
|
||||
*/
|
||||
@GetMapping("getCategoryTreeData")
|
||||
@NoLoginIntercept
|
||||
public Result<?> getCategoryTreeData() {
|
||||
List<CategoryVo> categoryList = categoryService.getCategoryTreeData();
|
||||
return Result.ok(categoryList);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.common.validator.myVaildator.noLogin.NoLoginIntercept;
|
||||
import com.hongshu.web.domain.entity.WebChat;
|
||||
import com.hongshu.web.domain.vo.ChatUserRelationVo;
|
||||
import com.hongshu.web.service.IWebChatService;
|
||||
import com.hongshu.web.websocket.im.CountMessage;
|
||||
import com.hongshu.web.websocket.im.Message;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 聊天
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RequestMapping("/app/im/chat")
|
||||
@RestController
|
||||
public class AppChatController {
|
||||
|
||||
@Autowired
|
||||
private IWebChatService chatService;
|
||||
|
||||
|
||||
/**
|
||||
* 发送消息
|
||||
*
|
||||
* @param message 消息实体
|
||||
*/
|
||||
@PostMapping("sendMsg")
|
||||
@NoLoginIntercept
|
||||
public Result<?> sendMsg(@RequestBody Message message) {
|
||||
chatService.sendMsg(message);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的聊天记录
|
||||
*
|
||||
* @param currentPage 分页
|
||||
* @param pageSize 分页数
|
||||
* @param acceptUid 接收方用户ID
|
||||
*/
|
||||
@GetMapping("getAllChatRecord/{currentPage}/{pageSize}")
|
||||
public Result<?> getAllChatRecord(@PathVariable long currentPage, @PathVariable long pageSize, String acceptUid) {
|
||||
Page<WebChat> page = chatService.getAllChatRecord(currentPage, pageSize, acceptUid);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户下所有聊天的用户信息
|
||||
*/
|
||||
@GetMapping("getChatUserList")
|
||||
public Result<?> getChatUserList() {
|
||||
List<ChatUserRelationVo> list = chatService.getChatUserList();
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有聊天记录数量
|
||||
*/
|
||||
@GetMapping("getCountMessage")
|
||||
public Result<?> getCountMessage() {
|
||||
CountMessage countMessage = chatService.getCountMessage();
|
||||
return Result.ok(countMessage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除聊天
|
||||
*/
|
||||
@GetMapping("deleteMsg")
|
||||
public String deleteMsg() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除所有聊天记录
|
||||
*/
|
||||
@GetMapping("deleteAllChatRecord")
|
||||
public String deleteAllChatRecord() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除所有聊天用户
|
||||
*/
|
||||
@GetMapping("deleteChatUser")
|
||||
public String deleteChatUser() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除聊天数量
|
||||
*
|
||||
* @param sendUid 发送方用户ID
|
||||
* @param type 类型
|
||||
*/
|
||||
@GetMapping("clearMessageCount")
|
||||
public Result<?> clearMessageCount(String sendUid, Integer type) {
|
||||
chatService.clearMessageCount(sendUid, type);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 关闭聊天
|
||||
*
|
||||
* @param sendUid 发送方用户ID
|
||||
*/
|
||||
@RequestMapping("closeChat/{sendUid}")
|
||||
public boolean closeChat(@PathVariable("sendUid") String sendUid) {
|
||||
return chatService.closeChat(sendUid);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,135 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.common.validator.ValidatorUtils;
|
||||
import com.hongshu.common.validator.group.AddGroup;
|
||||
import com.hongshu.web.domain.dto.CommentDTO;
|
||||
import com.hongshu.web.domain.vo.CommentVo;
|
||||
import com.hongshu.web.service.IWebCommentService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 评论
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RequestMapping("/app/comment")
|
||||
@RestController
|
||||
public class AppCommentController {
|
||||
|
||||
@Autowired
|
||||
private IWebCommentService commentService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有一级分类
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
* @param noteId 笔记ID
|
||||
*/
|
||||
@GetMapping("getOneCommentByNoteId/{currentPage}/{pageSize}")
|
||||
public Result<?> getOneCommentByNoteId(@PathVariable long currentPage, @PathVariable long pageSize, String noteId) {
|
||||
Page<CommentVo> pageInfo = commentService.getOneCommentByNoteId(currentPage, pageSize, noteId);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前评论
|
||||
*
|
||||
* @param commentId 评论ID
|
||||
*/
|
||||
@GetMapping("getCommentById")
|
||||
public Result<?> getCommentById(String commentId) {
|
||||
return Result.ok(commentService.getCommentById(commentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存评论
|
||||
*
|
||||
* @param commentDTO 评论
|
||||
*/
|
||||
@PostMapping("saveCommentByDTO")
|
||||
public Result<?> saveCommentByDTO(@RequestBody CommentDTO commentDTO) {
|
||||
ValidatorUtils.validateEntity(commentDTO, AddGroup.class);
|
||||
CommentVo commentVo = commentService.saveCommentByDTO(commentDTO);
|
||||
return Result.ok(commentVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据评论ID同步评论集
|
||||
*
|
||||
* @param commentIds 评论ID数据集
|
||||
*/
|
||||
@PostMapping("syncCommentByIds")
|
||||
public Result<?> syncCommentByIds(@RequestBody List<String> commentIds) {
|
||||
commentService.syncCommentByIds(commentIds);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据一级评论ID获取所有二级评论
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
* @param oneCommentId 一级评论ID
|
||||
*/
|
||||
@GetMapping("getTwoCommentByOneCommentId/{currentPage}/{pageSize}")
|
||||
public Result<?> getTwoCommentByOneCommentId(@PathVariable long currentPage, @PathVariable long pageSize, String oneCommentId) {
|
||||
IPage<CommentVo> pageInfo = commentService.getTwoCommentByOneCommentId(currentPage, pageSize, oneCommentId);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户通知的评论集
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
*/
|
||||
@GetMapping("getNoticeComment/{currentPage}/{pageSize}")
|
||||
public Result<?> getNoticeComment(@PathVariable long currentPage, @PathVariable long pageSize) {
|
||||
IPage<CommentVo> pageInfo = commentService.getNoticeComment(currentPage, pageSize);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有的一级评论并携带二级评论
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
* @param noteId 笔记ID
|
||||
*/
|
||||
@GetMapping("getCommentWithCommentByNoteId/{currentPage}/{pageSize}")
|
||||
public Result<?> getCommentWithCommentByNoteId(@PathVariable long currentPage, @PathVariable long pageSize, String noteId) {
|
||||
Page<CommentVo> pageInfo = commentService.getCommentWithCommentByNoteId(currentPage, pageSize, noteId);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自动滚动到当前评论
|
||||
*
|
||||
* @param commentId 评论ID
|
||||
*/
|
||||
@GetMapping("scrollComment")
|
||||
public Result<?> scrollComment(String commentId) {
|
||||
Map<String, Object> resMap = commentService.scrollComment(commentId);
|
||||
return Result.ok(resMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除评论
|
||||
*
|
||||
* @param commentId 评论ID
|
||||
*/
|
||||
@GetMapping("deleteCommentById")
|
||||
public Result<?> deleteCommentById(String commentId) {
|
||||
commentService.deleteCommentById(commentId);
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.common.validator.myVaildator.noLogin.NoLoginIntercept;
|
||||
import com.hongshu.web.domain.dto.EsNoteDTO;
|
||||
import com.hongshu.web.domain.entity.WebCategory;
|
||||
import com.hongshu.web.domain.entity.WebUser;
|
||||
import com.hongshu.web.domain.vo.NoteSearchVo;
|
||||
import com.hongshu.web.service.IWebEsNoteService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ES
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/es/note")
|
||||
public class AppEsNoteController {
|
||||
|
||||
@Autowired
|
||||
private IWebEsNoteService esNoteService;
|
||||
|
||||
|
||||
/**
|
||||
* 搜索对应的笔记
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
* @param esNoteDTO 笔记
|
||||
*/
|
||||
@NoLoginIntercept
|
||||
@PostMapping("getNoteByDTO/{currentPage}/{pageSize}")
|
||||
public Result<?> getNoteByDTO(@PathVariable long currentPage, @PathVariable long pageSize, @RequestBody EsNoteDTO esNoteDTO) {
|
||||
Page<NoteSearchVo> page = esNoteService.getNoteByDTO(currentPage, pageSize, esNoteDTO);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索对应的笔记
|
||||
*
|
||||
* @param esNoteDTO 笔记
|
||||
*/
|
||||
@NoLoginIntercept
|
||||
@PostMapping("getCategoryAgg")
|
||||
public Result<?> getCategoryAgg(@RequestBody EsNoteDTO esNoteDTO) {
|
||||
List<WebCategory> categoryList = esNoteService.getCategoryAgg(esNoteDTO);
|
||||
return Result.ok(categoryList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取推荐笔记
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
*/
|
||||
@NoLoginIntercept
|
||||
@GetMapping("getRecommendNote/{currentPage}/{pageSize}")
|
||||
public Result<?> getRecommendNote(@PathVariable long currentPage, @PathVariable long pageSize) {
|
||||
Page<NoteSearchVo> page = esNoteService.getRecommendNote(currentPage, pageSize);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取推荐用户
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
*/
|
||||
@NoLoginIntercept
|
||||
@GetMapping("getRecommendUser/{currentPage}/{pageSize}")
|
||||
public Result<?> getRecommendUser(@PathVariable long currentPage, @PathVariable long pageSize) {
|
||||
Page<WebUser> page = esNoteService.getRecommendUser(currentPage, pageSize);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取热榜笔记
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
*/
|
||||
@NoLoginIntercept
|
||||
@GetMapping("getHotNote/{currentPage}/{pageSize}")
|
||||
public Result<?> getHotNote(@PathVariable long currentPage, @PathVariable long pageSize) {
|
||||
Page<NoteSearchVo> page = esNoteService.getHotNote(currentPage, pageSize);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加笔记
|
||||
*
|
||||
* @param noteSearchVo 笔记
|
||||
*/
|
||||
@PostMapping("addNote")
|
||||
public void addNote(@RequestBody NoteSearchVo noteSearchVo) {
|
||||
esNoteService.addNote(noteSearchVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改笔记
|
||||
*
|
||||
* @param noteSearchVo 笔记
|
||||
*/
|
||||
@PostMapping("updateNote")
|
||||
public void updateNote(@RequestBody NoteSearchVo noteSearchVo) {
|
||||
esNoteService.updateNote(noteSearchVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除es中的笔记
|
||||
*
|
||||
* @param noteId 笔记ID
|
||||
*/
|
||||
@RequestMapping("deleteNote/{noteId}")
|
||||
public void deleteNote(@PathVariable String noteId) {
|
||||
esNoteService.deleteNote(noteId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量增加笔记
|
||||
*/
|
||||
@PostMapping("addNoteBulkData")
|
||||
@NoLoginIntercept
|
||||
public void addNoteBulkData() {
|
||||
esNoteService.addNoteBulkData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空笔记
|
||||
*/
|
||||
@DeleteMapping("delNoteBulkData")
|
||||
@NoLoginIntercept
|
||||
public void delNoteBulkData() {
|
||||
esNoteService.delNoteBulkData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置
|
||||
*/
|
||||
@PostMapping("refreshNoteData")
|
||||
@NoLoginIntercept
|
||||
public Result<?> refreshNoteData() {
|
||||
esNoteService.refreshNoteData();
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,66 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.common.validator.myVaildator.noLogin.NoLoginIntercept;
|
||||
import com.hongshu.web.domain.dto.EsRecordDTO;
|
||||
import com.hongshu.web.service.IWebEsRecordService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* ES
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RequestMapping("/app/es/record")
|
||||
@RestController
|
||||
public class AppEsRecordController {
|
||||
|
||||
@Autowired
|
||||
private IWebEsRecordService esRecordService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取搜索记录
|
||||
*/
|
||||
@GetMapping("getRecordByKeyWord")
|
||||
public Result<?> getRecordByKeyWord(EsRecordDTO esRecordDTO) {
|
||||
return Result.ok(esRecordService.getRecordByKeyWord(esRecordDTO));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门搜索
|
||||
*/
|
||||
@NoLoginIntercept
|
||||
@GetMapping("getHotRecord")
|
||||
public Result<?> getHotRecord() {
|
||||
return Result.ok(esRecordService.getHotRecord());
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加搜索记录
|
||||
*/
|
||||
@PostMapping("addRecord")
|
||||
public Result<?> addRecord(@RequestBody EsRecordDTO esRecordDTO) {
|
||||
esRecordService.addRecord(esRecordDTO);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除搜索记录
|
||||
*/
|
||||
@PostMapping("clearRecord")
|
||||
public Result<?> clearRecordByUser(@RequestBody EsRecordDTO esRecordDTO) {
|
||||
esRecordService.clearRecordByUser(esRecordDTO);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空搜索记录
|
||||
*/
|
||||
@PostMapping("clearAllRecord")
|
||||
public Result<?> clearAllRecord() {
|
||||
esRecordService.clearAllRecord();
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,97 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.web.domain.vo.FollowerVo;
|
||||
import com.hongshu.web.domain.vo.TrendVo;
|
||||
import com.hongshu.web.service.IWebFollowerService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 关注
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RequestMapping("/app/follower")
|
||||
@RestController
|
||||
public class AppFollowerController {
|
||||
|
||||
@Autowired
|
||||
IWebFollowerService followerService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取关注用户的所有动态
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
*/
|
||||
@GetMapping("getFollowTrend/{currentPage}/{pageSize}")
|
||||
public Result<?> getFollowTrend(@PathVariable long currentPage, @PathVariable long pageSize) {
|
||||
Page<TrendVo> pageInfo = followerService.getFollowTrend(currentPage, pageSize);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取关注列表
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
*/
|
||||
@GetMapping("getFollowList/{currentPage}/{pageSize}")
|
||||
public Result<?> getFollowList(@PathVariable long currentPage, @PathVariable long pageSize) {
|
||||
Page<TrendVo> pageInfo = followerService.getFollowList(currentPage, pageSize);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户所有的关注和粉丝
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
* @param type 类型
|
||||
*/
|
||||
@GetMapping("getFriend/{currentPage}/{pageSize}")
|
||||
public Result<?> getFriend(@PathVariable long currentPage, @PathVariable long pageSize, String uid, Integer type) {
|
||||
Page<FollowerVo> pageInfo = followerService.getFriend(currentPage, pageSize, uid, type);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关注用户
|
||||
*
|
||||
* @param followerId 关注用户ID
|
||||
*/
|
||||
@GetMapping("followById")
|
||||
public Result<?> followById(String followerId) {
|
||||
followerService.followById(followerId);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前用户是否关注
|
||||
*
|
||||
* @param followerId 关注的用户ID
|
||||
*/
|
||||
@GetMapping("isFollow")
|
||||
public Result<?> isFollow(String followerId) {
|
||||
boolean flag = followerService.isFollow(followerId);
|
||||
return Result.ok(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户的最新关注信息
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
*/
|
||||
@GetMapping("getNoticeFollower/{currentPage}/{pageSize}")
|
||||
public Result<?> getNoticeFollower(@PathVariable long currentPage, @PathVariable long pageSize) {
|
||||
Page<FollowerVo> pageInfo = followerService.getNoticeFollower(currentPage, pageSize);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.common.validator.ValidatorUtils;
|
||||
import com.hongshu.common.validator.group.AddGroup;
|
||||
import com.hongshu.web.domain.dto.LikeOrCollectionDTO;
|
||||
import com.hongshu.web.domain.vo.LikeOrCollectionVo;
|
||||
import com.hongshu.web.service.IWebLikeOrCollectionService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 点赞/收藏
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RequestMapping("/app/likeOrCollection")
|
||||
@RestController
|
||||
public class AppLikeOrCollectionController {
|
||||
|
||||
@Autowired
|
||||
IWebLikeOrCollectionService likeOrCollectionService;
|
||||
|
||||
|
||||
/**
|
||||
* 点赞或收藏
|
||||
*
|
||||
* @param likeOrCollectionDTO 点赞收藏实体
|
||||
*/
|
||||
@PostMapping("likeOrCollectionByDTO")
|
||||
public Result<?> likeOrCollectionByDTO(@RequestBody LikeOrCollectionDTO likeOrCollectionDTO) {
|
||||
ValidatorUtils.validateEntity(likeOrCollectionDTO, AddGroup.class);
|
||||
likeOrCollectionService.likeOrCollectionByDTO(likeOrCollectionDTO);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否点赞或收藏
|
||||
*
|
||||
* @param likeOrCollectionDTO 点赞收藏实体
|
||||
*/
|
||||
@PostMapping("isLikeOrCollection")
|
||||
public Result<?> isLikeOrCollection(@RequestBody LikeOrCollectionDTO likeOrCollectionDTO) {
|
||||
boolean flag = likeOrCollectionService.isLikeOrCollection(likeOrCollectionDTO);
|
||||
return Result.ok(flag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户最新的点赞和收藏信息
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
*/
|
||||
@GetMapping("getNoticeLikeOrCollection/{currentPage}/{pageSize}")
|
||||
public Result<?> getNoticeLikeOrCollection(@PathVariable long currentPage, @PathVariable long pageSize) {
|
||||
Page<LikeOrCollectionVo> pageInfo = likeOrCollectionService.getNoticeLikeOrCollection(currentPage, pageSize);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,96 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.common.validator.myVaildator.noLogin.NoLoginIntercept;
|
||||
import com.hongshu.web.domain.vo.NoteVo;
|
||||
import com.hongshu.web.service.IWebNoteService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 笔记
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RequestMapping("/app/note")
|
||||
@RestController
|
||||
public class AppNoteController {
|
||||
|
||||
@Autowired
|
||||
private IWebNoteService noteService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取笔记
|
||||
*
|
||||
* @param noteId 笔记ID
|
||||
*/
|
||||
@GetMapping("getNoteById")
|
||||
@NoLoginIntercept
|
||||
public Result<?> getNoteById(String noteId) {
|
||||
NoteVo noteVo = noteService.getNoteById(noteId);
|
||||
return Result.ok(noteVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增笔记
|
||||
*
|
||||
* @param noteData 笔记对象
|
||||
* @param files 图片文件
|
||||
*/
|
||||
@PostMapping("saveNoteByDTO")
|
||||
public Result<?> saveNoteByDTO(@RequestParam("noteData") String noteData, @RequestParam("uploadFiles") MultipartFile[] files) {
|
||||
noteService.saveNoteByDTO(noteData, files);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除笔记
|
||||
*
|
||||
* @param noteIds 笔记ID集合
|
||||
*/
|
||||
@PostMapping("deleteNoteByIds")
|
||||
public Result<?> deleteNoteByIds(@RequestBody List<String> noteIds) {
|
||||
noteService.deleteNoteByIds(noteIds);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新笔记
|
||||
*
|
||||
* @param noteData 笔记对象
|
||||
* @param files 图片文件
|
||||
*/
|
||||
@PostMapping("updateNoteByDTO")
|
||||
public Result<?> updateNoteByDTO(@RequestParam("noteData") String noteData, @RequestParam("uploadFiles") MultipartFile[] files) {
|
||||
noteService.updateNoteByDTO(noteData, files);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取热门笔记
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
*/
|
||||
@GetMapping("getHotPage/{currentPage}/{pageSize}")
|
||||
public Result<?> getHotPage(@PathVariable long currentPage, @PathVariable long pageSize) {
|
||||
Page<NoteVo> pageInfo = noteService.getHotPage(currentPage, pageSize);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 置顶笔记
|
||||
*
|
||||
* @param noteId 笔记ID
|
||||
*/
|
||||
@GetMapping("pinnedNote")
|
||||
public Result<?> pinnedNote(String noteId) {
|
||||
boolean flag = noteService.pinnedNote(noteId);
|
||||
return Result.ok(flag);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.web.domain.entity.WebTag;
|
||||
import com.hongshu.web.domain.vo.NoteVo;
|
||||
import com.hongshu.web.domain.vo.TagVo;
|
||||
import com.hongshu.web.service.IWebTagService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 标签
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RequestMapping("/app/tag")
|
||||
@RestController
|
||||
public class AppTagController {
|
||||
|
||||
@Autowired
|
||||
private IWebTagService tagService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取热门标签
|
||||
*/
|
||||
@GetMapping("getHotTagList")
|
||||
public Result<?> getHotTagList() {
|
||||
List<TagVo> voList = tagService.getHotTagList();
|
||||
return Result.ok(voList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关键词获取标签
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
* @param keyword 关键词
|
||||
*/
|
||||
@GetMapping("getTagByKeyword/{currentPage}/{pageSize}")
|
||||
public Result<?> getTagByKeyword(@PathVariable long currentPage, @PathVariable long pageSize, String keyword) {
|
||||
Page<WebTag> page = tagService.getTagByKeyword(currentPage, pageSize, keyword);
|
||||
return Result.ok(page);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前标签信息
|
||||
*
|
||||
* @param tagId 标签ID
|
||||
*/
|
||||
@GetMapping("getTagById")
|
||||
public Result<?> getTagById(String tagId) {
|
||||
WebTag tag = tagService.getById(tagId);
|
||||
return Result.ok(tag);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据标签ID获取图片信息
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
* @param tagId 标签id
|
||||
* @param type 类型
|
||||
*/
|
||||
@GetMapping("getNoteByTagId/{currentPage}/{pageSize}")
|
||||
public Result<?> getNoteByTagId(@PathVariable long currentPage, @PathVariable long pageSize, String tagId, Integer type) {
|
||||
Page<NoteVo> imgDetailVoList = tagService.getNoteByTagId(currentPage, pageSize, tagId, type);
|
||||
return Result.ok(imgDetailVoList);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,113 @@
|
||||
package com.hongshu.web.controller.app;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.hongshu.common.constant.HttpStatus;
|
||||
import com.hongshu.common.core.page.TableDataInfo;
|
||||
import com.hongshu.common.enums.Result;
|
||||
import com.hongshu.web.domain.entity.WebUser;
|
||||
import com.hongshu.web.domain.vo.NoteSearchVo;
|
||||
import com.hongshu.web.service.IWebUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static com.hongshu.common.utils.PageUtils.startPage;
|
||||
|
||||
/**
|
||||
* 用户
|
||||
*
|
||||
* @author: hongshu
|
||||
*/
|
||||
@RequestMapping("/app/user")
|
||||
@RestController
|
||||
public class AppUserController {
|
||||
|
||||
@Autowired
|
||||
private IWebUserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取当前用户信息
|
||||
*
|
||||
* @param currentPage 当前页
|
||||
* @param pageSize 分页数
|
||||
* @param userId 用户ID
|
||||
* @param type 类型
|
||||
*/
|
||||
@GetMapping("getTrendByUser/{currentPage}/{pageSize}")
|
||||
public Result<?> getTrendByUser(@PathVariable long currentPage, @PathVariable long pageSize, String userId, Integer type) {
|
||||
Page<NoteSearchVo> pageInfo = userService.getTrendByUser(currentPage, pageSize, userId, type);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
@GetMapping("getUserById")
|
||||
public Result<?> getUserById(String userId) {
|
||||
WebUser user = userService.getUserById(userId);
|
||||
return Result.ok(user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户信息
|
||||
*
|
||||
* @param user 用户
|
||||
*/
|
||||
@PostMapping("updateUser")
|
||||
public Result<?> updateUser(@RequestBody WebUser user) {
|
||||
WebUser updateUser = userService.updateUser(user);
|
||||
return Result.ok(updateUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查找用户信息
|
||||
*
|
||||
* @param keyword 关键词
|
||||
*/
|
||||
@GetMapping("getUserByKeyword/{currentPage}/{pageSize}")
|
||||
public Result<?> getUserByKeyword(@PathVariable long currentPage, @PathVariable long pageSize, String keyword) {
|
||||
Page<WebUser> pageInfo = userService.getUserByKeyword(currentPage, pageSize, keyword);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存用户的搜索记录
|
||||
*
|
||||
* @param keyword 关键词
|
||||
*/
|
||||
@GetMapping("saveUserSearchRecord")
|
||||
public Result<?> saveUserSearchRecord(String keyword) {
|
||||
userService.saveUserSearchRecord(keyword);
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员列表
|
||||
*
|
||||
* @param user 用户
|
||||
*/
|
||||
@GetMapping("getUserList")
|
||||
public TableDataInfo getUserList(WebUser user) {
|
||||
startPage();
|
||||
List<WebUser> userList = userService.getUserList(user);
|
||||
return getDataTable(userList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 响应请求分页数据
|
||||
*/
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
protected TableDataInfo getDataTable(List<?> list) {
|
||||
TableDataInfo rspData = new TableDataInfo();
|
||||
rspData.setCode(HttpStatus.SUCCESS);
|
||||
rspData.setMsg("查询成功");
|
||||
rspData.setRows(list);
|
||||
rspData.setTotal(new PageInfo(list).getTotal());
|
||||
return rspData;
|
||||
}
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
restart.include.json=/com.alibaba.fastjson2.*.jar
|
||||
@ -1,61 +0,0 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
# 主库数据源
|
||||
master:
|
||||
url: jdbc:mysql://localhost:3306/hongshu?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||
username: root
|
||||
password: Myj950501
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: false
|
||||
url:
|
||||
username:
|
||||
password:
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置连接超时时间
|
||||
connectTimeout: 30000
|
||||
# 配置网络超时时间
|
||||
socketTimeout: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1 FROM DUAL
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: true
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username: hongshu
|
||||
login-password: 123456
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: true
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
||||
@ -1,8 +0,0 @@
|
||||
Application Version: ${hongshu.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
||||
__ __
|
||||
/ /_ ____ ____ ____ ______/ /_ __ __
|
||||
/ __ \/ __ \/ __ \/ __ `/ ___/ __ \/ / / /
|
||||
/ / / / /_/ / / / / /_/ (__ ) / / / /_/ /
|
||||
/_/ /_/\____/_/ /_/\__, /____/_/ /_/\__,_/
|
||||
/____/
|
||||