开发一个springboot+vue的项目【增加铃声制作的功能】

简介: 该版本加入了个人歌曲上传、根据歌曲制作铃声、铃声随机浏览、上传歌曲管理员复核。该版本是用户是可以上传歌曲的,然后可以查看个人上传的歌曲,上传歌曲后,管理员进行审核。

一,系统功能介绍


该版本加入了个人歌曲上传、根据歌曲制作铃声、铃声随机浏览、上传歌曲管理员复核。


该版本是用户是可以上传歌曲的,然后可以查看个人上传的歌曲,上传歌曲后,管理员进行审核。


1.1. 登陆后才可以上传歌曲


微信图片_20221009220430.png

1.2. 已上传歌曲清单


登陆后,点击我的音乐->我的上传浏览已上传的歌曲清单,显示基本信息和审核状态和意见;


微信图片_20221009220437.png

1.3. 上传歌曲


点击添加歌曲,录入歌名、歌手、简介、歌词及选择本地mp3歌曲,点击确定完成上传。


微信图片_20221009220444.png

点击刷新,可看到已经上传成功。


微信图片_20221009220444.png

1.4. 审核列表


登陆管理员后台,点击歌曲审核,可看到已有刚上传的歌曲十年,可变更图片,同时可审核通过和拒绝。


微信图片_20221009220447.png

1.5. 审核通过


点击通过,弹出歌手选择界面,选择对应歌手,点击确定即可完成审核


微信图片_20221009220450.png

1.6. 审核拒绝


点击拒绝,弹出拒绝理由填写界面,录入对应理由,点击确定,完成歌曲审核拒绝。


微信图片_20221009220453.png

1.7. 上传人审核结果查看


审核通过的显示审核通过,审核拒绝的显示审核拒绝并展示审核意见。


微信图片_20221009220457.png

1.8 制作铃声


针对正在播放的歌曲点击制作铃声,可进入铃声制作界面

注:登陆后才可以制作铃声,只有歌曲才可以制作铃声,


微信图片_20221009220500.png

1.9 铃声制作


拖动左右时间定位戳,确定铃声长度,可点击播放按钮反复播放调整,点击生成铃声。


微信图片_20221009220504.png

填写铃声名称,铃声简介,铃声展示图片,点击确定,即可完成铃声制作



微信图片_20221009220507.png

1.10 铃声制作列表


我的音乐->我的铃声中可查看自己制作的铃声。


微信图片_20221009220511.png

1.11 铃声浏览


点击铃声页面,即可左右浏览全网已制作的铃声,切换时会同步播放铃声


微信图片_20221009220515.png


二,视频展示


微信图片_20221009220519.png

微信图片_20221009220522.png

微信图片_20221009220945.png


当然,如果你想看在线的,也可以看:


https://www.bilibili.com/video/BV15541177pE?spm_id_from=333.999.0.0


三,核心代码展示


@RestController
public class AdminController {
    @Autowired
    private AdminService adminService;
    /**
     * 判断是否登录成功
     */
    @RequestMapping(value = "/admin/login/status",method = RequestMethod.POST)
    public Object loginStatus(HttpServletRequest request, HttpSession session){
        JSONObject jsonObject = new JSONObject();
        String name = request.getParameter("name");
        String password = request.getParameter("password");
        boolean flag = adminService.verifyPassword(name,password);
        if(flag){
            jsonObject.put(Consts.CODE,1);
            jsonObject.put(Consts.MSG,"登录成功");
            session.setAttribute(Consts.NAME,name);
            return jsonObject;
        }
        jsonObject.put(Consts.CODE,0);
        jsonObject.put(Consts.MSG,"用户名或密码错误");
        return jsonObject;
    }
}


/**
 * 收藏控制类
 */
@RestController
@RequestMapping("/collect")
public class CollectController {
    @Autowired
    private CollectService CollectService;
    @Autowired
    private SongService songService;
    /**
     * 添加收藏
     */
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Object addCollect(HttpServletRequest request){
        JSONObject jsonObject = new JSONObject();
        String userId = request.getParameter("userId");           //用户id
        String type = request.getParameter("type");               //收藏类型(0歌曲1歌单)
        String songId = request.getParameter("songId");           //歌曲id
        if(songId==null||songId.equals("")){
            jsonObject.put(Consts.CODE,0);
            jsonObject.put(Consts.MSG,"收藏歌曲为空");
            return jsonObject;
        }
        if(CollectService.existSongId(Integer.parseInt(userId),Integer.parseInt(songId))){
            boolean status = CollectService.deleteByUserIdSongId(Integer.parseInt(userId), Integer.parseInt(songId));
            if (status) {
                jsonObject.put(Consts.CODE,2);
                jsonObject.put(Consts.MSG,"取消收藏");
            }
            return jsonObject;
        }
        //保存到收藏的对象中
        Collect Collect = new Collect();
        Collect.setUserId(Integer.parseInt(userId));
        Collect.setType(new Byte(type));
        Collect.setSongId(Integer.parseInt(songId));
        boolean flag = CollectService.insert(Collect);
        if(flag){   //保存成功
            jsonObject.put(Consts.CODE,1);
            jsonObject.put(Consts.MSG,"收藏成功");
            return jsonObject;
        }
        jsonObject.put(Consts.CODE,0);
        jsonObject.put(Consts.MSG,"收藏失败");
        return jsonObject;
    }
    /**
     * 删除收藏
     */
    @RequestMapping(value = "/delete",method = RequestMethod.GET)
    public Object deleteCollect(HttpServletRequest request){
        String userId = request.getParameter("userId");           //用户id
        String songId = request.getParameter("songId");           //歌曲id
        boolean flag = CollectService.deleteByUserIdSongId(Integer.parseInt(userId),Integer.parseInt(songId));
        return flag;
    }
    /**
     * 查询所有收藏
     */
    @RequestMapping(value = "/allCollect",method = RequestMethod.GET)
    public Object allCollect(HttpServletRequest request){
        return CollectService.allCollect();
    }
    /**
     * 查询某个用户的收藏列表
     */
    @RequestMapping(value = "/collectOfUserId",method = RequestMethod.GET)
    public Object collectOfUserId(HttpServletRequest request){
        String userId = request.getParameter("userId");          //用户id
        return CollectService.collectOfUserId(Integer.parseInt(userId));
    }
    /**
     * 获取歌曲的收藏量
     */
    @RequestMapping(value = "/getCollectCount",method = RequestMethod.GET)
    public Object getCollectCount(@RequestParam("userId") Integer userId) {
        List<Collect> collectList = CollectService.getCollectCount(userId);
        for (Collect collect : collectList) {
            List<Song> song = songService.getSongId(collect.getSongId());
            collect.setSongs(song);
        }
        return collectList;
    }


/**
 * 歌曲管理controller
 */
@RestController
@RequestMapping("/song")
public class SongController {
    @Autowired
    private SongService songService;
    /**
     * 添加歌曲
     */
    @RequestMapping(value = "/add",method = RequestMethod.POST)
    public Object addSong(HttpServletRequest request, @RequestParam("file")MultipartFile mpFile, @RequestParam("files")MultipartFile mvFile){
        JSONObject jsonObject = new JSONObject();
        //获取前端传来的参数
        String singerId = request.getParameter("singerId").trim();  //所属歌手id
        String name = request.getParameter("name").trim();          //歌名
        String introduction = request.getParameter("introduction").trim();          //简介
        String pic = "/img/songPic/tubiao.jpg";                     //默认图片
        String lyric = request.getParameter("lyric").trim();     //歌词
        //上传歌曲文件
        if(mpFile.isEmpty()){
            jsonObject.put(Consts.CODE,0);
            jsonObject.put(Consts.MSG,"歌曲上传失败");
            return jsonObject;
        }
        //文件名=当前时间到毫秒+原来的文件名
        String fileName = System.currentTimeMillis()+mpFile.getOriginalFilename();
        //文件路径
        String filePath = System.getProperty("user.dir")+System.getProperty("file.separator")+"song";
        //如果文件路径不存在,新增该路径
        File file1 = new File(filePath);
        if(!file1.exists()){
            file1.mkdir();
        }
        //实际的文件地址
        File dest = new File(filePath+System.getProperty("file.separator")+fileName);
        //存储到数据库里的相对文件地址
        String storeUrlPath = "/song/"+fileName;
        try {
            mpFile.transferTo(dest);
            Song song = new Song();
            song.setSingerId(Integer.parseInt(singerId));
            song.setName(name);
            song.setIntroduction(introduction);
            song.setPic(pic);
            song.setLyric(lyric);
            song.setUrl(storeUrlPath);
            if(!mvFile.isEmpty()){
              //文件名=当前时间到毫秒+原来的文件名
                String fileNames = System.currentTimeMillis()+mvFile.getOriginalFilename();
                //文件路径
                String filePaths = System.getProperty("user.dir")+System.getProperty("file.separator")+"mv";
                //如果文件路径不存在,新增该路径
                File file2 = new File(filePaths);
                if(!file2.exists()){
                    file2.mkdir();
                }
                //实际的文件地址
                File dests = new File(filePaths+System.getProperty("file.separator")+fileNames);
                mvFile.transferTo(dests);
                //存储到数据库里的相对文件地址
                String storeUrlPaths = "/mv/"+fileNames;
                song.setMvurl(storeUrlPaths);
            }
            boolean flag = songService.insert(song);
            if(flag){
                jsonObject.put(Consts.CODE,1);
                jsonObject.put(Consts.MSG,"保存成功");
                jsonObject.put("avator",storeUrlPath);
                return jsonObject;
            }
            jsonObject.put(Consts.CODE,0);
            jsonObject.put(Consts.MSG,"保存失败");
            return jsonObject;
        } catch (IOException e) {
            jsonObject.put(Consts.CODE,0);
            jsonObject.put(Consts.MSG,"保存失败"+e.getMessage());
        }finally {
            return jsonObject;
        }
    }


**
 * 歌单的歌曲管理controller
 */
@RestController
@RequestMapping("/listSong")
public class ListSongController {
    @Autowired
    private ListSongService listSongService;
    /**
     * 给歌单添加歌曲
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public Object addListSong(HttpServletRequest request) {
        JSONObject jsonObject = new JSONObject();
        //获取前端传来的参数
        String songId = request.getParameter("songId").trim();  //歌曲id
        Integer songListId = Integer.valueOf(request.getParameter("songListId").trim()); //歌单id
        List<ListSong> listSongs = listSongService.selectBySongId(songId);
        for (ListSong listSong : listSongs) {
            Integer id = listSong.getId();
            ListSong songlist = listSongService.selectByPrimaryKey(id);
            if (songlist.getSongListId().equals(songListId)) {
                jsonObject.put(Consts.CODE, 0);
                jsonObject.put(Consts.MSG, "添加失败,原因是:歌曲重复");
                return jsonObject;
            }
        }
        ListSong listSong1 = new ListSong();
        listSong1.setSongId(Integer.parseInt(songId));
        listSong1.setSongListId(songListId);
        boolean flag = listSongService.insert(listSong1);
        if (flag) {
            jsonObject.put(Consts.CODE, 1);
            jsonObject.put(Consts.MSG, "保存成功");
            return jsonObject;
        } else {
            jsonObject.put(Consts.CODE, 0);
            jsonObject.put(Consts.MSG, "保存失败");
        }
        return jsonObject;
    }
    /**
     * 根据歌单id查询歌曲
     */
    @RequestMapping(value = "/detail", method = RequestMethod.GET)
    public Object detail(HttpServletRequest request) {
        String songListId = request.getParameter("songListId");
        return listSongService.listSongOfSongListId(Integer.parseInt(songListId));
    }
    /**
     * 删除歌单里的歌曲
     */
    @RequestMapping(value = "/delete", method = RequestMethod.GET)
    public Object delete(HttpServletRequest request) {
        String songId = request.getParameter("songId").trim();                 //歌曲id
        String songListId = request.getParameter("songListId").trim();        //歌单id
        boolean flag = listSongService.deleteBySongIdAndSongListId(Integer.parseInt(songId), Integer.parseInt(songListId));
        return flag;
    }
目录
相关文章
|
10天前
|
Java Linux
Springboot 解决linux服务器下获取不到项目Resources下资源
Springboot 解决linux服务器下获取不到项目Resources下资源
|
18天前
|
Java API Spring
SpringBoot项目调用HTTP接口5种方式你了解多少?
SpringBoot项目调用HTTP接口5种方式你了解多少?
65 2
|
18天前
|
前端开发 JavaScript Java
6个SpringBoot 项目拿来就可以学习项目经验接私活
6个SpringBoot 项目拿来就可以学习项目经验接私活
29 0
|
21天前
|
Java Maven 微服务
springboot项目开启远程调试-jar包
springboot项目开启远程调试-jar包
17 0
|
16天前
|
Java 测试技术 数据库
基于SpringBoot+HTML实现登录注册功能模块
基于SpringBoot+HTML实现登录注册功能模块
|
1天前
|
人工智能 前端开发 Java
Java语言开发的AI智慧导诊系统源码springboot+redis 3D互联网智导诊系统源码
智慧导诊解决盲目就诊问题,减轻分诊工作压力。降低挂错号比例,优化就诊流程,有效提高线上线下医疗机构接诊效率。可通过人体画像选择症状部位,了解对应病症信息和推荐就医科室。
27 10
|
1天前
|
Java 关系型数据库 MySQL
一套java+ spring boot与vue+ mysql技术开发的UWB高精度工厂人员定位全套系统源码有应用案例
UWB (ULTRA WIDE BAND, UWB) 技术是一种无线载波通讯技术,它不采用正弦载波,而是利用纳秒级的非正弦波窄脉冲传输数据,因此其所占的频谱范围很宽。一套UWB精确定位系统,最高定位精度可达10cm,具有高精度,高动态,高容量,低功耗的应用。
一套java+ spring boot与vue+ mysql技术开发的UWB高精度工厂人员定位全套系统源码有应用案例
|
7天前
|
JSON 前端开发 Java
统一异常处理:让Spring Boot项目异常更优雅
统一异常处理:让Spring Boot项目异常更优雅
21 1
|
9天前
|
JavaScript
Vue 开发技巧·1
【4月更文挑战第2天】通过props解耦Vue组件与路由参数,避免使用`$route`导致的高耦合。在路由配置中设定`props: true`,如`{ path: /user/:id, component: User, props: true }`,使组件能直接通过`props`获取`params`。此外,功能组件是无状态、不可实例化的,依赖外部数据且无生命周期,提高渲染性能。通过上下文参数传递所需数据,如`{{item.title}} {{item.content}}`,在父组件中定义并传递`list`数据。
26 8
|
11天前
|
Java 容器
SpringBoot使用配置注解开启自动配置功能&整合spring-boot-configuration-processor
SpringBoot使用配置注解开启自动配置功能&整合spring-boot-configuration-processor
12 0