Compare commits
2 Commits
98565c9150
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ed305d5bee | ||
|
|
813614df58 |
@@ -44,36 +44,39 @@ public class FileController extends BaseController {
|
||||
// 获取文件字节
|
||||
if (objectName.equals("musicFile")) {
|
||||
LoginUser userInfo = SecurityUtils.getLoginUser();
|
||||
if (userInfo == null){
|
||||
response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
|
||||
return;
|
||||
}
|
||||
SysUser sysUser = userInfo.getUser();
|
||||
if (sysUser == null) {
|
||||
// if (userInfo == null){
|
||||
// response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
// response.setContentType("application/json;charset=UTF-8");
|
||||
// response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
|
||||
// return;
|
||||
// }
|
||||
// SysUser sysUser = userInfo.getUser();
|
||||
//if (sysUser == null) {
|
||||
// if (StrUtil.isBlank(musicId)) {
|
||||
// response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
|
||||
// response.setContentType("application/json;charset=UTF-8");
|
||||
// response.getWriter().write("{\"code\":400,\"msg\":\"音乐ID不能为空\"}");
|
||||
// return;
|
||||
// }
|
||||
ShopUser shopUser = userInfo.getShopUser();
|
||||
if (shopUser == null) {
|
||||
response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
|
||||
return;
|
||||
}else{
|
||||
// 检查会员时间
|
||||
if (!MusicUtil.getShopIsVip(shopUser)) {
|
||||
if (shopUser.getVip() == 1){
|
||||
// 会员已过期修改为非会员
|
||||
shopUser.setVip(2L);
|
||||
shopUserMapper.updateShopUser(shopUser);
|
||||
}
|
||||
}
|
||||
}
|
||||
//MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
|
||||
|
||||
|
||||
//ShopUser shopUser = userInfo.getShopUser();
|
||||
// if (shopUser == null) {
|
||||
// response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||
// response.setContentType("application/json;charset=UTF-8");
|
||||
// response.getWriter().write("{\"code\":401,\"msg\":\"用户未登录\"}");
|
||||
// return;
|
||||
// }else{
|
||||
// // 检查会员时间
|
||||
// if (!MusicUtil.getShopIsVip(shopUser)) {
|
||||
// if (shopUser.getVip() == 1){
|
||||
// // 会员已过期修改为非会员
|
||||
// shopUser.setVip(2L);
|
||||
// shopUserMapper.updateShopUser(shopUser);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//shopUser = shopUserMapper.selectShopUserByUserId(userId);
|
||||
// MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
|
||||
//
|
||||
@@ -93,7 +96,7 @@ public class FileController extends BaseController {
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
// 设置响应头
|
||||
|
||||
@@ -5,8 +5,10 @@ import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.MusicInfo;
|
||||
import com.ruoyi.common.core.domain.entity.Notifications;
|
||||
import com.ruoyi.common.core.domain.entity.PlaStatus;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.system.mapper.PlaStatusMapper;
|
||||
import com.ruoyi.system.service.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -93,4 +95,13 @@ public class IndexController extends BaseController {
|
||||
List<Notifications> result = notificationsService.selectNotificationsByUserId(userId);
|
||||
return AjaxResult.success(result);
|
||||
}
|
||||
|
||||
@Autowired
|
||||
private PlaStatusMapper plaStatusMapper;
|
||||
|
||||
@GetMapping("/palStatus")
|
||||
public AjaxResult palStatus(){
|
||||
PlaStatus plaStatus = plaStatusMapper.selectPlaStatusById(1L);
|
||||
return AjaxResult.success(plaStatus.getShareStatus());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,17 +114,20 @@ public class MusicController extends BaseController {
|
||||
@RequestMapping("/getMusicInfo/{musicId}")
|
||||
public AjaxResult getMusicInfo(@PathVariable String musicId){
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
if (userId == null){
|
||||
return AjaxResult.error(401,"用户未登录或用户ID为空");
|
||||
}
|
||||
MusicInfo musicInfo = musicService.getMusicInfo(userId, musicId);
|
||||
if (musicInfo != null){
|
||||
// 增加历史
|
||||
musicService.addHistoryMusic(musicId);
|
||||
return AjaxResult.success(musicInfo);
|
||||
if (userId != null){
|
||||
MusicInfo musicInfo = musicService.getMusicInfo(userId, musicId);
|
||||
if (musicInfo != null){
|
||||
// 增加历史
|
||||
musicService.addHistoryMusic(musicId);
|
||||
return AjaxResult.success(musicInfo);
|
||||
}else {
|
||||
return new AjaxResult(HttpStatus.USER_VIP_EXPIRE, "请开通会员");
|
||||
}
|
||||
}else {
|
||||
return new AjaxResult(HttpStatus.USER_VIP_EXPIRE, "请开通会员");
|
||||
MusicInfo musicInfo = musicService.getMusicInfo(null, musicId);
|
||||
return AjaxResult.success(musicInfo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 新增用户混音
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: pro
|
||||
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 pla_status
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-30
|
||||
*/
|
||||
@Data
|
||||
public class PlaStatus extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** $column.columnComment */
|
||||
private Long id;
|
||||
|
||||
/** $column.columnComment */
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private Boolean shareStatus;
|
||||
|
||||
}
|
||||
@@ -145,7 +145,9 @@ public class SecurityConfig
|
||||
"/client/index/getCategory","/client/index/re/bind/music","/client/index/re/music",
|
||||
"/client/version/getLastVersion","/client/search/list","/client/music/find","/client" +
|
||||
"/index/getCategory","/client/index/cate/music/**","/client/consult/list",
|
||||
"/client/index/re/music/**","/client/share/list").permitAll()
|
||||
"/client/index/re/music/**","/client/share/list","/file/download/**",
|
||||
"/client/music/getMusicInfo/**","/client/music/getPrevMusicId","/client/music" +
|
||||
"/getNextMusicId","/client/index/palStatus").permitAll()
|
||||
// 静态资源,可匿名访问
|
||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.PlaStatus;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2025-11-30
|
||||
*/
|
||||
public interface PlaStatusMapper
|
||||
{
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 【请填写功能名称】
|
||||
*/
|
||||
public PlaStatus selectPlaStatusById(Long id);
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】列表
|
||||
*
|
||||
* @param plaStatus 【请填写功能名称】
|
||||
* @return 【请填写功能名称】集合
|
||||
*/
|
||||
public List<PlaStatus> selectPlaStatusList(PlaStatus plaStatus);
|
||||
|
||||
/**
|
||||
* 新增【请填写功能名称】
|
||||
*
|
||||
* @param plaStatus 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertPlaStatus(PlaStatus plaStatus);
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*
|
||||
* @param plaStatus 【请填写功能名称】
|
||||
* @return 结果
|
||||
*/
|
||||
public int updatePlaStatus(PlaStatus plaStatus);
|
||||
|
||||
/**
|
||||
* 删除【请填写功能名称】
|
||||
*
|
||||
* @param id 【请填写功能名称】主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePlaStatusById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deletePlaStatusByIds(Long[] ids);
|
||||
}
|
||||
@@ -23,8 +23,7 @@ import java.util.stream.Collectors;
|
||||
* @date 2025-07-15
|
||||
*/
|
||||
@Service
|
||||
public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
{
|
||||
public class MusicInfoServiceImpl implements IMusicInfoService {
|
||||
@Autowired
|
||||
private MusicInfoMapper musicInfoMapper;
|
||||
@Autowired
|
||||
@@ -38,8 +37,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
@Autowired
|
||||
private ShopUserMapper shopUserMapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 查询音乐信息
|
||||
*
|
||||
@@ -47,8 +44,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
* @return 音乐信息
|
||||
*/
|
||||
@Override
|
||||
public MusicInfo selectMusicInfoById(String id)
|
||||
{
|
||||
public MusicInfo selectMusicInfoById(String id) {
|
||||
return musicInfoMapper.selectMusicInfoById(id);
|
||||
}
|
||||
|
||||
@@ -59,8 +55,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
* @return 音乐信息
|
||||
*/
|
||||
@Override
|
||||
public List<MusicInfo> selectMusicInfoList(MusicInfo musicInfo)
|
||||
{
|
||||
public List<MusicInfo> selectMusicInfoList(MusicInfo musicInfo) {
|
||||
return musicInfoMapper.selectMusicInfoList(musicInfo);
|
||||
}
|
||||
|
||||
@@ -71,8 +66,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertMusicInfo(MusicInfo musicInfo)
|
||||
{
|
||||
public int insertMusicInfo(MusicInfo musicInfo) {
|
||||
|
||||
musicInfo.setCreateTime(DateUtils.getNowDate());
|
||||
musicInfo.setMusicId(IdUtil.getSnowflakeNextId());
|
||||
@@ -89,8 +83,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateMusicInfo(MusicInfo musicInfo)
|
||||
{
|
||||
public int updateMusicInfo(MusicInfo musicInfo) {
|
||||
musicInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
return musicInfoMapper.updateMusicInfo(musicInfo);
|
||||
}
|
||||
@@ -102,8 +95,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMusicInfoByIds(String[] ids)
|
||||
{
|
||||
public int deleteMusicInfoByIds(String[] ids) {
|
||||
return musicInfoMapper.deleteMusicInfoByIds(ids);
|
||||
}
|
||||
|
||||
@@ -114,8 +106,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteMusicInfoById(String id)
|
||||
{
|
||||
public int deleteMusicInfoById(String id) {
|
||||
return musicInfoMapper.deleteMusicInfoById(id);
|
||||
}
|
||||
|
||||
@@ -126,8 +117,8 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MusicInfo> selectMusicInfoByCid(String categoryId,MusicInfo musicInfo) {
|
||||
return musicInfoMapper.selectMusicInfoByCid(categoryId,musicInfo);
|
||||
public List<MusicInfo> selectMusicInfoByCid(String categoryId, MusicInfo musicInfo) {
|
||||
return musicInfoMapper.selectMusicInfoByCid(categoryId, musicInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -139,11 +130,11 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
public int addLikeMusic(String musicId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
//查找是否已经存在我喜欢的音乐
|
||||
UserLikeMusic userLikeMusic = musicInfoMapper.selectMusicAndUserLike(userId,musicId);
|
||||
if (userLikeMusic != null){
|
||||
UserLikeMusic userLikeMusic = musicInfoMapper.selectMusicAndUserLike(userId, musicId);
|
||||
if (userLikeMusic != null) {
|
||||
return 1;
|
||||
}
|
||||
return musicInfoMapper.insertLikeMusic(userId,musicId);
|
||||
return musicInfoMapper.insertLikeMusic(userId, musicId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -154,15 +145,15 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
@Override
|
||||
public int cancelLikeMusic(String[] musicId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
return musicInfoMapper.delLikeMusic(userId,musicId);
|
||||
return musicInfoMapper.delLikeMusic(userId, musicId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addHistoryMusic(String musicId) {
|
||||
Long userId = SecurityUtils.getUserId();
|
||||
// 先删除在田间
|
||||
musicInfoMapper.delHistoryUAndM(userId,musicId);
|
||||
return musicInfoMapper.insertHistory(userId,musicId);
|
||||
musicInfoMapper.delHistoryUAndM(userId, musicId);
|
||||
return musicInfoMapper.insertHistory(userId, musicId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,20 +171,21 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
// 查询是否是用户喜欢
|
||||
UserLikeMusic userLikeMusic = userLikeMusicMapper.selectUserLikeMusicAndUserId(userId, musicId);
|
||||
if (userLikeMusic != null){
|
||||
musicInfo.setLike(true);
|
||||
}
|
||||
// 查询是否是用户分类
|
||||
UserCollect userCollect = userCollectMapper.selectUserCollectAndUserId(userId, musicId);
|
||||
if (userCollect != null){
|
||||
musicInfo.setCollect(true);
|
||||
musicInfo.setUserCollect(userCollect);
|
||||
if (userId != null) {
|
||||
// 查询是否是用户喜欢
|
||||
UserLikeMusic userLikeMusic = userLikeMusicMapper.selectUserLikeMusicAndUserId(userId, musicId);
|
||||
if (userLikeMusic != null) {
|
||||
musicInfo.setLike(true);
|
||||
}
|
||||
// 查询是否是用户分类
|
||||
UserCollect userCollect = userCollectMapper.selectUserCollectAndUserId(userId, musicId);
|
||||
if (userCollect != null) {
|
||||
musicInfo.setCollect(true);
|
||||
musicInfo.setUserCollect(userCollect);
|
||||
}
|
||||
}
|
||||
// 判断是否是是混音
|
||||
if (musicInfo.getMusicType().equals(MusicType.MIXING.getMusicType())){
|
||||
if (musicInfo.getMusicType().equals(MusicType.MIXING.getMusicType())) {
|
||||
// 查询混音相关信息
|
||||
MusicSceneRelate relateInfo = relateMapper.selectByMusicId(musicId);
|
||||
String sceneIds = relateInfo.getSceneIds();
|
||||
@@ -208,7 +200,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
@Override
|
||||
public MusicInfo addMixMusicInfo(MusicMaxReq param) {
|
||||
//TODO:
|
||||
// Long userId = SecurityUtils.getUserId();
|
||||
// Long userId = SecurityUtils.getUserId();
|
||||
Long userId = 10000L;
|
||||
//String musicId = String.valueOf(param.getMusicId());
|
||||
String sceneIds = param.getSceneIds();
|
||||
@@ -217,22 +209,22 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
// 新增混音音乐标签
|
||||
//MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
|
||||
//if (musicInfo != null){
|
||||
long newMusicId = IdUtil.getSnowflakeNextId();
|
||||
param.setMusicId(newMusicId);
|
||||
if (param.getName() == null || (param.getName()).isEmpty()){
|
||||
param.setName(userName + DateUtil.current());
|
||||
}
|
||||
param.setMusicType(MusicType.MIXING.getMusicType());
|
||||
//param.setMusicAddr(musicInfo.getMusicAddr());
|
||||
musicInfoMapper.insertMusicInfo(param);
|
||||
MusicSceneRelate musicSceneRelate = new MusicSceneRelate();
|
||||
musicSceneRelate.setMusicId(String.valueOf(newMusicId));
|
||||
musicSceneRelate.setSceneIds(sceneIds);
|
||||
musicSceneRelate.setUserId(userId);
|
||||
musicSceneRelate.setSceneInfo(sceneJson);
|
||||
//musicSceneRelate.setSourceMusicId(musicId);
|
||||
relateMapper.insertMusicSceneRelate(musicSceneRelate);
|
||||
return param;
|
||||
long newMusicId = IdUtil.getSnowflakeNextId();
|
||||
param.setMusicId(newMusicId);
|
||||
if (param.getName() == null || (param.getName()).isEmpty()) {
|
||||
param.setName(userName + DateUtil.current());
|
||||
}
|
||||
param.setMusicType(MusicType.MIXING.getMusicType());
|
||||
//param.setMusicAddr(musicInfo.getMusicAddr());
|
||||
musicInfoMapper.insertMusicInfo(param);
|
||||
MusicSceneRelate musicSceneRelate = new MusicSceneRelate();
|
||||
musicSceneRelate.setMusicId(String.valueOf(newMusicId));
|
||||
musicSceneRelate.setSceneIds(sceneIds);
|
||||
musicSceneRelate.setUserId(userId);
|
||||
musicSceneRelate.setSceneInfo(sceneJson);
|
||||
//musicSceneRelate.setSourceMusicId(musicId);
|
||||
relateMapper.insertMusicSceneRelate(musicSceneRelate);
|
||||
return param;
|
||||
//}
|
||||
//return null;
|
||||
}
|
||||
@@ -246,7 +238,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
String sourceMusicId = param.getSourceMusicId();
|
||||
// 查询混音音乐
|
||||
MusicInfo musicInfo = musicInfoMapper.selectByMusicId(String.valueOf(musicId));
|
||||
if (musicInfo != null){
|
||||
if (musicInfo != null) {
|
||||
// 先删除在新增
|
||||
relateMapper.deleteByMusicId(musicId);
|
||||
//musicSceneMapper.selectMusicSceneById()
|
||||
@@ -265,18 +257,18 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
|
||||
@Override
|
||||
public List<MusicInfo> selectMusicInfoByReId(String reId) {
|
||||
return musicInfoMapper.selectMusicInfoByReId(reId);
|
||||
return musicInfoMapper.selectMusicInfoByReId(reId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上一首播放的音乐ID
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param playMode 播放模式:1-顺序播放,2-随机播放
|
||||
* @param playlistType 播放列表类型:1-历史播放,2-分类播放,3-推荐播放,4-收藏播放,5-喜欢播放
|
||||
* @param categoryId 分类ID,当playlistType=2时必填
|
||||
* @param collectId 收藏ID,当playlistType=4时必填
|
||||
* @param reId 推荐ID,当playlistType=3时必填
|
||||
* @param userId 用户ID
|
||||
* @param playMode 播放模式:1-顺序播放,2-随机播放
|
||||
* @param playlistType 播放列表类型:1-历史播放,2-分类播放,3-推荐播放,4-收藏播放,5-喜欢播放
|
||||
* @param categoryId 分类ID,当playlistType=2时必填
|
||||
* @param collectId 收藏ID,当playlistType=4时必填
|
||||
* @param reId 推荐ID,当playlistType=3时必填
|
||||
* @param currentMusicId 当前播放的音乐ID,用于顺序播放时获取上一首
|
||||
* @return 上一首音乐ID
|
||||
*/
|
||||
@@ -284,44 +276,47 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
public String getPrevMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
|
||||
List<MusicInfo> musicList = null;
|
||||
|
||||
// 根据播放列表类型获取对应的音乐列表
|
||||
switch (playlistType) {
|
||||
case 1: // 历史播放
|
||||
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
|
||||
break;
|
||||
case 2: // 分类播放
|
||||
if (categoryId == null || categoryId.isEmpty()) {
|
||||
return null; // 分类播放必须提供分类ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId,new MusicInfo());
|
||||
break;
|
||||
case 3: // 推荐播放
|
||||
if (reId == null || reId.isEmpty()) {
|
||||
return null; // 推荐播放必须提供推荐ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectRecommendMusicByReId(reId);
|
||||
break;
|
||||
case 4: // 收藏播放
|
||||
if (collectId == null || collectId.isEmpty()) {
|
||||
return null; // 收藏播放必须提供收藏ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicByCollectId(collectId);
|
||||
break;
|
||||
case 5: // 喜欢播放
|
||||
musicList = musicInfoMapper.selectLikeMusicByUser(userId);
|
||||
break;
|
||||
case 6: // 喜欢播放
|
||||
return musicInfoMapper.selectListRandomMusic(currentMusicId);
|
||||
default:
|
||||
return null;
|
||||
if (userId != null) {
|
||||
switch (playlistType) {
|
||||
case 1: // 历史播放
|
||||
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
|
||||
break;
|
||||
case 2: // 分类播放
|
||||
if (categoryId == null || categoryId.isEmpty()) {
|
||||
return null; // 分类播放必须提供分类ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId, new MusicInfo());
|
||||
break;
|
||||
case 3: // 推荐播放
|
||||
if (reId == null || reId.isEmpty()) {
|
||||
return null; // 推荐播放必须提供推荐ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectRecommendMusicByReId(reId);
|
||||
break;
|
||||
case 4: // 收藏播放
|
||||
if (collectId == null || collectId.isEmpty()) {
|
||||
return null; // 收藏播放必须提供收藏ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicByCollectId(collectId);
|
||||
break;
|
||||
case 5: // 喜欢播放
|
||||
musicList = musicInfoMapper.selectLikeMusicByUser(userId);
|
||||
break;
|
||||
case 6: // 喜欢播放
|
||||
return musicInfoMapper.selectListRandomMusic(currentMusicId);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return musicInfoMapper.selectListRandomMusic(currentMusicId);
|
||||
}
|
||||
// 根据播放列表类型获取对应的音乐列表
|
||||
|
||||
// 如果列表为空,返回null
|
||||
if (musicList == null || musicList.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
// 根据播放模式获取上一首音乐ID
|
||||
if (playMode == 1) { // 顺序播放
|
||||
// 按照ID排序列表
|
||||
@@ -331,8 +326,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
return idA.compareTo(idB);
|
||||
});
|
||||
|
||||
|
||||
|
||||
// 如果没有当前音乐ID,返回列表中的最后一首
|
||||
if (currentMusicId == null || currentMusicId.isEmpty()) {
|
||||
return musicList.get(musicList.size() - 1).getMusicId().toString();
|
||||
@@ -369,11 +362,11 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
/**
|
||||
* 获取下一首播放的音乐ID
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param playMode 播放模式:1-顺序播放,2-随机播放
|
||||
* @param playlistType 播放列表类型:1-历史播放,2-分类播放,3-推荐播放,4-收藏播放,5-喜欢播放 6-列表随机
|
||||
* @param categoryId 分类ID,当playlistType=2时必填
|
||||
* @param collectId 收藏ID,当playlistType=4时必填
|
||||
* @param userId 用户ID
|
||||
* @param playMode 播放模式:1-顺序播放,2-随机播放
|
||||
* @param playlistType 播放列表类型:1-历史播放,2-分类播放,3-推荐播放,4-收藏播放,5-喜欢播放 6-列表随机
|
||||
* @param categoryId 分类ID,当playlistType=2时必填
|
||||
* @param collectId 收藏ID,当playlistType=4时必填
|
||||
* @param currentMusicId 当前播放的音乐ID,用于顺序播放时获取下一首
|
||||
* @return 下一首音乐ID
|
||||
*/
|
||||
@@ -381,36 +374,40 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
public String getNextMusicId(Long userId, Integer playMode, Integer playlistType, String categoryId, String collectId, String reId, String currentMusicId) {
|
||||
List<MusicInfo> musicList = null;
|
||||
|
||||
// 根据播放列表类型获取对应的音乐列表
|
||||
switch (playlistType) {
|
||||
case 1: // 历史播放
|
||||
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
|
||||
break;
|
||||
case 2: // 分类播放
|
||||
if (categoryId == null || categoryId.isEmpty()) {
|
||||
return null; // 分类播放必须提供分类ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId,new MusicInfo());
|
||||
break;
|
||||
case 3: // 推荐播放
|
||||
if (reId == null || reId.isEmpty()) {
|
||||
return null; // 推荐播放必须提供推荐ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectRecommendMusicByReId(reId);
|
||||
break;
|
||||
case 4: // 收藏播放
|
||||
if (collectId == null || collectId.isEmpty()) {
|
||||
return null; // 收藏播放必须提供收藏ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicByCollectId(collectId);
|
||||
break;
|
||||
case 5: // 喜欢播放
|
||||
musicList = musicInfoMapper.selectLikeMusicByUser(userId);
|
||||
break;
|
||||
case 6: // 喜欢播放
|
||||
return musicInfoMapper.selectListRandomMusic(currentMusicId);
|
||||
default:
|
||||
return null;
|
||||
if (userId != null) {
|
||||
// 根据播放列表类型获取对应的音乐列表
|
||||
switch (playlistType) {
|
||||
case 1: // 历史播放
|
||||
musicList = musicInfoMapper.selectHistoryMusicByUser(userId);
|
||||
break;
|
||||
case 2: // 分类播放
|
||||
if (categoryId == null || categoryId.isEmpty()) {
|
||||
return null; // 分类播放必须提供分类ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicInfoByCid(categoryId, new MusicInfo());
|
||||
break;
|
||||
case 3: // 推荐播放
|
||||
if (reId == null || reId.isEmpty()) {
|
||||
return null; // 推荐播放必须提供推荐ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectRecommendMusicByReId(reId);
|
||||
break;
|
||||
case 4: // 收藏播放
|
||||
if (collectId == null || collectId.isEmpty()) {
|
||||
return null; // 收藏播放必须提供收藏ID
|
||||
}
|
||||
musicList = musicInfoMapper.selectMusicByCollectId(collectId);
|
||||
break;
|
||||
case 5: // 喜欢播放
|
||||
musicList = musicInfoMapper.selectLikeMusicByUser(userId);
|
||||
break;
|
||||
case 6: // 喜欢播放
|
||||
return musicInfoMapper.selectListRandomMusic(currentMusicId);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return musicInfoMapper.selectListRandomMusic(currentMusicId);
|
||||
}
|
||||
|
||||
// 如果列表为空,返回null
|
||||
@@ -468,7 +465,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户ID查询喜欢的音乐数量
|
||||
*
|
||||
@@ -500,7 +496,6 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
@Override
|
||||
public List<MusicInfo> findLikeSearch(String search) {
|
||||
|
||||
|
||||
// 根据作者名称或音乐名称模糊搜索音乐
|
||||
List<MusicInfo> musicList = musicInfoMapper.selectMusicInfoBySearch(search);
|
||||
|
||||
@@ -524,9 +519,9 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
}
|
||||
|
||||
//TODO: 待完善
|
||||
public Map<String, String> getMixMusicInfo(String musicId){
|
||||
public Map<String, String> getMixMusicInfo(String musicId) {
|
||||
MusicInfo musicInfo = musicInfoMapper.selectByMusicId(musicId);
|
||||
if (musicInfo.getMusicType().equals(MusicType.MIXING.getMusicType())){
|
||||
if (musicInfo.getMusicType().equals(MusicType.MIXING.getMusicType())) {
|
||||
// 获取混音信息
|
||||
relateMapper.selectByMusicId(musicId);
|
||||
|
||||
@@ -537,7 +532,7 @@ public class MusicInfoServiceImpl implements IMusicInfoService
|
||||
@Override
|
||||
public MusicInfo selectUserLikeMusic(String musicId, Long userId) {
|
||||
MusicInfo musicInfo = musicInfoMapper.selectUserLikeMusic(musicId, userId);
|
||||
if (musicInfo != null){
|
||||
if (musicInfo != null) {
|
||||
musicInfo.setLike(true);
|
||||
return musicInfo;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||
orderInfo.setOrderName(request.getOrderName());
|
||||
orderInfo.setUserId(loginUser.getUserId());
|
||||
Product product = productMapper.selectProductByPageType(request.getPackageType());
|
||||
orderInfo.setAmount(new BigDecimal("0.01"));
|
||||
orderInfo.setAmount(product.getCurrentPrice());
|
||||
orderInfo.setPayType(request.getPayType());
|
||||
orderInfo.setPackageType(request.getPackageType());
|
||||
orderInfo.setDeviceType(request.getDeviceType());
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.PlaStatusMapper">
|
||||
|
||||
<resultMap type="PlaStatus" id="PlaStatusResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="shareStatus" column="share_status" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectPlaStatusVo">
|
||||
select id, share_status from pla_status
|
||||
</sql>
|
||||
|
||||
<select id="selectPlaStatusList" parameterType="PlaStatus" resultMap="PlaStatusResult">
|
||||
<include refid="selectPlaStatusVo"/>
|
||||
<where>
|
||||
<if test="shareStatus != null "> and share_status = #{shareStatus}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectPlaStatusById" parameterType="Long" resultMap="PlaStatusResult">
|
||||
<include refid="selectPlaStatusVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertPlaStatus" parameterType="PlaStatus" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into pla_status
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="shareStatus != null">share_status,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="shareStatus != null">#{shareStatus},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updatePlaStatus" parameterType="PlaStatus">
|
||||
update pla_status
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="shareStatus != null">share_status = #{shareStatus},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deletePlaStatusById" parameterType="Long">
|
||||
delete from pla_status where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deletePlaStatusByIds" parameterType="String">
|
||||
delete from pla_status where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user