飞道的博客

短视频社交|电影点播平台Springboot+vue+ElementUI前后端分离

493人阅读  评论(0)

作者主页:编程指南针

作者简介:Java领域优质创作者、CSDN博客专家 、掘金特邀作者、多年架构师设计经验、腾讯课堂常驻讲师

主要内容:Java项目、毕业设计、简历模板、学习资料、面试题库、技术互助

收藏点赞不迷路  关注作者有好处

文末获取源码 

项目编号:BS-PT-071

一,项目简介

本项目基于Springboot+vue开发实现了一个电影点播和短视频分享平台,名为爱奇艺影视平台系统。系统开发采用前后端分离的模式开发实现,分为前端系统用户功能模块和后台系统用户功能模块。

前端用户的主要功能:

1.注册登陆

2.全文检索

3.视频播放

4.点赞收藏

5.弹幕播放

6.评论影视

7.关注作者

8.视频上传

9.个人中心管理等等

后台用户的主要功能:

1.用户管理

2.视频管理

3.视频审核

4.播放量统计图形报表

5.分类管理等等

二,环境介绍

语言环境:Java:  jdk1.8

数据库:Mysql: mysql5.7

应用服务器:Tomcat:  tomcat8.5.31

开发工具:IDEA或eclipse

后台开发技术:Springboot+Mybatis

前端开发技术:vue+ElementUI

三,系统展示

前端系统展示

 

注册登陆

播放视频

个人中心

消息中心

视频中心

视频上传

后台管理模块

用户管理

播放量统计

视频管理

视频审核

视频分类管理

四,核心代码展示


  
  1. package com.hu.video.controller;
  2. import com.hu.video.service.IAdminEChartService;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.stereotype.Controller;
  5. import org.springframework.web.bind.annotation.RequestMapping;
  6. import org.springframework.web.bind.annotation.ResponseBody;
  7. import java.util.List;
  8. /**
  9. * @author znz
  10. */
  11. @Controller
  12. @RequestMapping("admin")
  13. public class AdminEChartController {
  14. @Autowired
  15. private IAdminEChartService adminEChartService;
  16. @RequestMapping("getFilmData")
  17. @ResponseBody
  18. public List<String> getFilmData () {
  19. return adminEChartService.getFilmData();
  20. }
  21. @RequestMapping("getData")
  22. @ResponseBody
  23. public List<Integer> getData () {
  24. return adminEChartService.getData();
  25. }
  26. }


  
  1. package com.hu.video.controller;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import com.hu.video.entity.Admin;
  5. import com.hu.video.entity.TUser;
  6. import com.hu.video.entity.dto.UserStateDTO;
  7. import com.hu.video.service.IAdminUserService;
  8. import com.hu.video.service.IUserService;
  9. import com.hu.video.util.MsgResponse;
  10. import com.hu.video.util.VueUtil;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.web.bind.annotation.*;
  13. import org.springframework.web.multipart.MultipartFile;
  14. import javax.servlet.http.HttpSession;
  15. import java.io.File;
  16. import java.io.IOException;
  17. import java.util.List;
  18. @RequestMapping("admin")
  19. @RestController
  20. public class AdminUserController {
  21. @Autowired
  22. private IAdminUserService adminUserService;
  23. @Autowired
  24. private IUserService userService;
  25. @RequestMapping("login")
  26. public MsgResponse login (@RequestBody Admin admin, HttpSession session) {
  27. Admin admin1 = adminUserService.login(admin);
  28. if (admin1 == null) {
  29. return MsgResponse.fail( "密码错误");
  30. }
  31. session.setAttribute( "admin", admin);
  32. return MsgResponse.success( "登录成功", null);
  33. }
  34. @RequestMapping("list")
  35. public List<UserStateDTO> userList () {
  36. return adminUserService.userList();
  37. }
  38. @RequestMapping("getUserById")
  39. public UserStateDTO getUserById (Long id) {
  40. return adminUserService.getUserById(id);
  41. }
  42. @RequestMapping(value = "editUser", method = RequestMethod.POST)
  43. public void editUser (@RequestBody TUser tUser) {
  44. adminUserService.editUser(tUser);
  45. }
  46. @RequestMapping("deleteUser/{id}")
  47. public String deleteUser (@PathVariable Long id) {
  48. adminUserService.deleteUser(id);
  49. return "success";
  50. }
  51. @RequestMapping(value = "addUser", method = RequestMethod.POST)
  52. public String addUser (@RequestBody TUser tUser) {
  53. adminUserService.addUser(tUser);
  54. return "success";
  55. }
  56. /*---------上传头像--------*/
  57. @ResponseBody
  58. @RequestMapping("upload")
  59. public VueUtil upload (@RequestParam MultipartFile avatar, Long userId) {
  60. String workplace = System.getProperty( "user.dir");
  61. //获取上传时候的文件名
  62. String suffix = avatar.getOriginalFilename().substring(avatar.getOriginalFilename().indexOf( "."));
  63. String fileName = "icon" + String.valueOf(userId) + suffix;
  64. File newFile = new File(workplace + "/src/main/resources/static/uimages/" + fileName);
  65. userService.updateUserIcon( "/user/getIcon/" + fileName,userId);
  66. try {
  67. avatar.transferTo(newFile);
  68. System.out.println( "success");
  69. Object res = "http://localhost:8081/user/getIcon/icon" + userId + suffix;
  70. System.out.println(res);
  71. return VueUtil.success( "上传成功",res);
  72. } catch (IOException e) {
  73. e.printStackTrace();
  74. return VueUtil.fail( "上传失败");
  75. }
  76. }
  77. @RequestMapping(value = "searchUser", method = RequestMethod.GET)
  78. public PageInfo<UserStateDTO> searchUser (int pageNum, int pageSize,String username) {
  79. //调用一个pageHelper的一个静态方法
  80. PageHelper.startPage(pageNum, pageSize);
  81. //用户记录
  82. List<UserStateDTO> userStateDTOS = adminUserService.getUserByName(username);
  83. //获得 用户分页
  84. PageInfo<UserStateDTO> pageInfo = new PageInfo<UserStateDTO>(userStateDTOS);
  85. return pageInfo;
  86. }
  87. /**
  88. * 获得分页对象, pageNum是当前页数, pageSize是分页大小
  89. * @param pageNum
  90. * @param pageSize
  91. * @return
  92. */
  93. @RequestMapping(value = "pageInfo", method = RequestMethod.GET)
  94. public PageInfo<UserStateDTO> getPageInfo (int pageNum, int pageSize) {
  95. //调用一个pageHelper的一个静态方法
  96. PageHelper.startPage(pageNum, pageSize);
  97. //用户记录
  98. List<UserStateDTO> userStateDTOS = adminUserService.userList();
  99. //获得 用户分页
  100. PageInfo<UserStateDTO> pageInfo = new PageInfo<UserStateDTO>(userStateDTOS);
  101. return pageInfo;
  102. }
  103. }


  
  1. package com.hu.video.controller;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import com.hu.video.entity.TState;
  5. import com.hu.video.entity.TUser;
  6. import com.hu.video.entity.TVideo;
  7. import com.hu.video.entity.TVideotype;
  8. import com.hu.video.entity.dto.VideoInfoDTO;
  9. import com.hu.video.service.IAdminVideoService;
  10. import com.hu.video.service.IStateService;
  11. import com.hu.video.service.IVideoService;
  12. import com.hu.video.service.IVideoTypeService;
  13. import com.hu.video.util.DateUtil;
  14. import com.hu.video.util.MsgResponse;
  15. import com.hu.video.util.VueUtil;
  16. import com.mysql.jdbc.log.Log;
  17. import org.springframework.beans.factory.annotation.Autowired;
  18. import org.springframework.web.bind.annotation.*;
  19. import org.springframework.web.multipart.MultipartFile;
  20. import java.io.File;
  21. import java.io.IOException;
  22. import java.util.List;
  23. @RestController
  24. @RequestMapping("admin")
  25. public class AdminVideoController {
  26. @Autowired
  27. private IAdminVideoService adminVideoService;
  28. @Autowired
  29. private IStateService stateService;
  30. @Autowired
  31. private IVideoService videoService;
  32. @Autowired
  33. private IVideoTypeService videoTypeService;
  34. private static String aVideoTitle;
  35. @RequestMapping("deleteVideo/{id}")
  36. public String deleteVideo (@PathVariable Long id) {
  37. adminVideoService.deleteVideo(id);
  38. return "success";
  39. }
  40. @RequestMapping("editVideo")
  41. public String editVideo (@RequestBody TVideo video) {
  42. adminVideoService.editVideo(video);
  43. return "success";
  44. }
  45. @RequestMapping("getVideoById")
  46. public VideoInfoDTO getVideoById (Long id) {
  47. return adminVideoService.getVideoById(id);
  48. }
  49. @RequestMapping("getStateList")
  50. public List<TState> getStateList () {
  51. return adminVideoService.getStateList();
  52. }
  53. @RequestMapping("getVideoTypeList")
  54. public List<TVideotype> getVideoTypeList () {
  55. return adminVideoService.getVideoTypeList();
  56. }
  57. @RequestMapping("restoreVideo/{id}")
  58. public String restoreVideo (@PathVariable Long id) {
  59. adminVideoService.restoreVideo(id);
  60. return "success";
  61. }
  62. @RequestMapping("rdeleteVideo/{id}")
  63. public String rdeleteVideo (@PathVariable Long id) {
  64. adminVideoService.rdeleteVideo(id);
  65. return "success";
  66. }
  67. @RequestMapping("addVideo")
  68. public String addVideo (@RequestParam String videoTitle,@RequestParam Long videoStateId,
  69. @RequestParam String videoInfo, @RequestParam Long videoTypeId) {
  70. TUser user = new TUser();
  71. user.setUserId( 1L);
  72. TVideo video = new TVideo();
  73. video.setUser(user);
  74. TState state = stateService.getStateByStateId(videoStateId);
  75. video.setVideoState(state);
  76. video.setVideoType(videoTypeService.getVideoTypeByVideoTypeId(videoTypeId));
  77. video.setVideoInfo(videoInfo);
  78. video.setVideoTitle(videoTitle);
  79. aVideoTitle = videoTitle;
  80. videoService.addVideo(video);
  81. return "200";
  82. }
  83. @RequestMapping(value = "searchVideo", method = RequestMethod.GET)
  84. public PageInfo<VideoInfoDTO> searchVideo (int pageNum, int pageSize, String videoName) {
  85. //调用一个pageHelper的一个静态方法
  86. PageHelper.startPage(pageNum, pageSize);
  87. //视频记录
  88. List<VideoInfoDTO> videoInfoDTOs = adminVideoService.getiVideoByTitle(videoName);
  89. //获得 视频分页
  90. PageInfo<VideoInfoDTO> vidoePageInfo = new PageInfo<VideoInfoDTO>(videoInfoDTOs);
  91. return vidoePageInfo;
  92. }
  93. /**
  94. * 获得分页对象, pageNum是当前页数, pageSize是分页大小
  95. *
  96. * @param pageNum
  97. * @param pageSize
  98. * @return
  99. */
  100. @RequestMapping(value = "videoPageInfo", method = RequestMethod.GET)
  101. public PageInfo<VideoInfoDTO> getPageInfo (int pageNum, int pageSize) {
  102. //调用一个pageHelper的一个静态方法
  103. PageHelper.startPage(pageNum, pageSize);
  104. //视频记录
  105. List<VideoInfoDTO> videoInfoDTOs = adminVideoService.videoList();
  106. //获得 视频分页
  107. PageInfo<VideoInfoDTO> vidoePageInfo = new PageInfo<VideoInfoDTO>(videoInfoDTOs);
  108. return vidoePageInfo;
  109. }
  110. @RequestMapping(value = "underVideoPageInfo", method = RequestMethod.GET)
  111. public PageInfo<VideoInfoDTO> underVideoPageInfo (int pageNum, int pageSize) {
  112. //调用一个pageHelper的一个静态方法
  113. PageHelper.startPage(pageNum, pageSize);
  114. //视频记录
  115. List<VideoInfoDTO> videoInfoDTOs = adminVideoService.underVideoList();
  116. //获得 视频分页
  117. PageInfo<VideoInfoDTO> vidoePageInfo = new PageInfo<VideoInfoDTO>(videoInfoDTOs);
  118. return vidoePageInfo;
  119. }
  120. @RequestMapping("adminVideoUpload")
  121. public MsgResponse adminVideoUpload (@RequestParam MultipartFile file) {
  122. String workplace = System.getProperty( "user.dir");
  123. String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().indexOf( "."));
  124. String path = "/static/video/" + DateUtil.currentDateFormatString() + suffix;
  125. File newFile = new File(workplace + "/src/main/resources" + path);
  126. Long videoId = videoService.getVideoLastId(aVideoTitle);
  127. videoService.updateVideoPath(path, videoId);
  128. try {
  129. file.transferTo(newFile);
  130. return MsgResponse.success( "上传成功", "http://localhost:8081" + path);
  131. } catch (IOException e) {
  132. e.printStackTrace();
  133. return MsgResponse.fail( "上传失败");
  134. }
  135. }
  136. @RequestMapping("editThumbnailImageUpload")
  137. public VueUtil editThumbnailImageUpload (@RequestParam MultipartFile avatar, Long videoId) {
  138. String workplace = System.getProperty( "user.dir");
  139. String suffix = avatar.getOriginalFilename().substring(avatar.getOriginalFilename().indexOf( "."));
  140. String fileName = "video" + String.valueOf(videoId) + suffix;
  141. File newFile = new File(workplace + "/src/main/resources/static/vimages/" + fileName);
  142. videoService.adminUpdateVideoImage( "/video/getVideoImage/" + fileName, videoId);
  143. try {
  144. avatar.transferTo(newFile);
  145. System.out.println( "success");
  146. Object res = "http://localhost:8081/video/getVideoImage/video" + videoId + suffix;
  147. return VueUtil.success( "上传成功", res);
  148. } catch (IOException e) {
  149. e.printStackTrace();
  150. return VueUtil.fail( "上传失败");
  151. }
  152. }
  153. @RequestMapping("thumbnailImageupload")
  154. public VueUtil thumbnailImageupload (@RequestParam MultipartFile avatar) {
  155. String workplace = System.getProperty( "user.dir");
  156. Long videoId = videoService.getVideoLastId(aVideoTitle);
  157. String suffix = avatar.getOriginalFilename().substring(avatar.getOriginalFilename().indexOf( "."));
  158. String fileName = "video" + String.valueOf(videoId) + suffix;
  159. File newFile = new File(workplace + "/src/main/resources/static/vimages/" + fileName);
  160. videoService.adminUpdateVideoImage( "/video/getVideoImage/" + fileName, videoId);
  161. try {
  162. avatar.transferTo(newFile);
  163. System.out.println( "success");
  164. Object res = "http://localhost:8081/video/getVideoImage/video" + videoId + suffix;
  165. return VueUtil.success( "上传成功", res);
  166. } catch (IOException e) {
  167. e.printStackTrace();
  168. return VueUtil.fail( "上传失败");
  169. }
  170. }
  171. }


  
  1. package com.hu.video.controller;
  2. import com.github.pagehelper.PageHelper;
  3. import com.github.pagehelper.PageInfo;
  4. import com.hu.video.entity.TVideotype;
  5. import com.hu.video.service.IAdminVideoTypeService;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.web.bind.annotation.*;
  8. import java.util.List;
  9. @RestController
  10. @RequestMapping("admin")
  11. public class AdminVideoTypeController {
  12. @Autowired
  13. private IAdminVideoTypeService adminVideoTypeService;
  14. @RequestMapping(value = "searchVideoType", method = RequestMethod.GET)
  15. public PageInfo<TVideotype> searchVideoType (int pageNum, int pageSize, String typeName) {
  16. //调用一个pageHelper的一个静态方法
  17. PageHelper.startPage(pageNum, pageSize);
  18. //视频记录
  19. List<TVideotype> videoTypes = adminVideoTypeService.getVideoTypeByName(typeName);
  20. //获得 视频分页
  21. PageInfo<TVideotype> vidoeTypeInfo = new PageInfo<TVideotype>(videoTypes);
  22. return vidoeTypeInfo;
  23. }
  24. @RequestMapping(value = "categoryPageInfo", method = RequestMethod.GET)
  25. public PageInfo<TVideotype> categoryPageInfo (int pageNum, int pageSize) {
  26. //调用一个pageHelper的一个静态方法
  27. PageHelper.startPage(pageNum, pageSize);
  28. //视频记录
  29. List<TVideotype> videoTypes = adminVideoTypeService.categoryList();
  30. //获得 视频分页
  31. PageInfo<TVideotype> vidoeTypeInfo = new PageInfo<TVideotype>(videoTypes);
  32. return vidoeTypeInfo;
  33. }
  34. @RequestMapping("addcategory")
  35. public String addVideoType (@RequestBody TVideotype videotype) {
  36. boolean flag = adminVideoTypeService.addVideoType(videotype);
  37. return flag ? "200" : "404";
  38. }
  39. @RequestMapping("getCategory")
  40. public TVideotype getCategory (Long id) {
  41. return adminVideoTypeService.getCategoryById(id);
  42. }
  43. @RequestMapping("deleteCategory/{id}")
  44. public String deleteCategory (@PathVariable("id") Long id) {
  45. boolean flag = adminVideoTypeService.deleteCategoryById(id);
  46. return flag ? "success" : "fail";
  47. }
  48. }

五,项目总结

视频播放为人们提供了丰富的信息来源,并在一定程度上丰富了人们的精神文明。而传统的视频播放手段如电视播放、影院播放,都存在一定的局限性。人们亟需一种能够实时播放网络视频资源的产品,在线视频播放系统的出现大放异彩,它汇聚了众多网络视频资源,以方便、快捷的使用方式深深的吸引着广大使用者。网络视频系统出现的初期动机是人们对广播电视观看需求的增加,而广播电视又不能随人们心意进行推送播放视频。同时随着网络信息技术的不断更新迭代,网络在线视频播放系统更是层出不穷
与此同时人们逐渐发现现有的收看电视对自身来说是被动的,任何通过广播电台和电视台播放的节目都不能再满足一般观众的要求,所以在播放视频的需求上一般观看用户掌握了更多的选择权和主动权。有了广大用户的需求支持,越来越多的在线视频播放系统如雨后春笋一般争相推出。为了进一步解决所有人对电视节目的需求,为广大观众提供更多的选择。本课题旨在设计一个能够满足广大观众多元化需求的在线视频播放系统,在该系统中,用户可以根据自身需求搜素想看的视频,满足用户自身需求的同时赢得口碑,积累用户基数,从而开拓市场。
 


转载:https://blog.csdn.net/whirlwind526/article/details/127894340
查看评论
* 以上用户言论只代表其个人观点,不代表本网站的观点或立场