|
@@ -2,18 +2,22 @@ package com.yonge.cooleshow.website.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
-import com.yonge.cooleshow.auth.api.dto.RealnameAuthReq;
|
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
-import com.yonge.cooleshow.auth.api.enums.SysUserType;
|
|
|
+import com.yonge.cooleshow.biz.dal.dto.MusicSheetDto;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.MusicAlbumSearch;
|
|
|
+import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetSearch;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.StudentMusicSheetSearch;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.ChargeTypeEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.YesOrNoEnum;
|
|
|
-import com.yonge.cooleshow.biz.dal.service.AppVersionInfoService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.MusicAlbumService;
|
|
|
import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
|
|
|
import com.yonge.cooleshow.biz.dal.support.PageUtil;
|
|
|
-import com.yonge.cooleshow.biz.dal.vo.*;
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.AlbumAndSheetVo;
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.MusicAlbumVo;
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.MusicSheetVo;
|
|
|
+import com.yonge.cooleshow.biz.dal.vo.MusicSheetWebsiteDetailVo;
|
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
import com.yonge.toolset.base.page.PageInfo;
|
|
@@ -27,6 +31,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.util.Date;
|
|
|
|
|
|
/**
|
|
|
* 曲谱表 web 控制层
|
|
@@ -44,77 +49,6 @@ public class MusicSheetController extends BaseController {
|
|
|
@Autowired
|
|
|
private MusicSheetService musicSheetService;
|
|
|
|
|
|
- @Autowired
|
|
|
- private MusicAlbumService musicAlbumService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private AppVersionInfoService appVersionInfoService;
|
|
|
-
|
|
|
- /**
|
|
|
- * 查询单条
|
|
|
- */
|
|
|
- @GetMapping("/detail/{id}")
|
|
|
- @ApiOperation(value = "详情", notes = "传入musicTag")
|
|
|
- public HttpResponseResult<MusicSheetDetailVo> detail(@ApiParam(value = "曲谱编号", required = true) @PathVariable("id") Long id) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
- return succeed(musicSheetService.detail(id, sysUser, SysUserType.STUDENT));
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "分页查询", httpMethod="POST", consumes="application/json", produces="application/json")
|
|
|
- @PostMapping(value="/list", consumes="application/json", produces="application/json")
|
|
|
- public HttpResponseResult<PageInfo<MusicSheetVo>> list(@RequestBody StudentMusicSheetSearch query) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
- // 检查app版本
|
|
|
- query.setAuditVersion(YesOrNoEnum.NO);
|
|
|
-
|
|
|
-
|
|
|
- // 学生 只能看通过审核 并且 启用的 曲目
|
|
|
- query.setState(YesOrNoEnum.YES);
|
|
|
- query.setAuditStatus(AuthStatusEnum.PASS);
|
|
|
- query.setStudentId(sysUser.getId());
|
|
|
- IPage<MusicSheetVo> musicSheetVoIPage = musicSheetService.selectStudentPage(PageUtil.getPage(query), query);
|
|
|
- return succeed(PageUtil.pageInfo(musicSheetVoIPage));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- @ApiOperation(value = "乐谱(专辑和曲目同时查询)分页查询", httpMethod="POST", consumes="application/json", produces="application/json")
|
|
|
- @PostMapping(value="/albumAndSheetList", consumes="application/json", produces="application/json")
|
|
|
- public HttpResponseResult<AlbumAndSheetVo> albumAndSheetList(@RequestBody StudentMusicSheetSearch query) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
-
|
|
|
- // 学生 只能看通过审核 并且 启用的 曲目
|
|
|
- query.setState(YesOrNoEnum.YES);
|
|
|
- query.setAuditVersion(YesOrNoEnum.NO);
|
|
|
- query.setAuditStatus(AuthStatusEnum.PASS);
|
|
|
- query.setStudentId(sysUser.getId());
|
|
|
- query.setRows(query.getSheetRow());
|
|
|
- IPage<MusicSheetVo> musicSheetVoIPage = musicSheetService.selectStudentPage(PageUtil.getPage(query), query);
|
|
|
-
|
|
|
- MusicAlbumSearch musicAlbumSearch = new MusicAlbumSearch();
|
|
|
- musicAlbumSearch.setAlbumStatus(YesOrNoEnum.YES);
|
|
|
- musicAlbumSearch.setSortBy(1);
|
|
|
- musicAlbumSearch.setIdAndName(query.getIdAndName());
|
|
|
- musicAlbumSearch.setAuditVersion(YesOrNoEnum.NO);
|
|
|
- musicAlbumSearch.setAlbumTagIds(query.getMusicTagIds());
|
|
|
- musicAlbumSearch.setPage(query.getPage());
|
|
|
- musicAlbumSearch.setRows(query.getAlbumRow());
|
|
|
- IPage<MusicAlbumVo> musicAlbumVoIPage = musicAlbumService.selectPage(PageUtil.getPage(musicAlbumSearch), musicAlbumSearch);
|
|
|
-
|
|
|
- AlbumAndSheetVo albumAndSheetVo = new AlbumAndSheetVo();
|
|
|
- albumAndSheetVo.setMusicSheetList(PageUtil.pageInfo(musicSheetVoIPage));
|
|
|
- albumAndSheetVo.setMusicAlbumList(PageUtil.pageInfo(musicAlbumVoIPage));
|
|
|
- return succeed(albumAndSheetVo);
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 曲目收藏
|
|
|
*/
|
|
@@ -134,7 +68,7 @@ public class MusicSheetController extends BaseController {
|
|
|
* 我的单曲,收藏单曲
|
|
|
*/
|
|
|
@GetMapping("/my")
|
|
|
- @ApiOperation(value = "我的单曲")
|
|
|
+ @ApiOperation(value = "学生-我的单曲")
|
|
|
public HttpResponseResult<PageInfo<MusicSheetVo>> myMusic(QueryInfo query) {
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
if (sysUser == null || sysUser.getId() == null) {
|
|
@@ -153,7 +87,7 @@ public class MusicSheetController extends BaseController {
|
|
|
* 我的单曲,收藏单曲
|
|
|
*/
|
|
|
@GetMapping("/favorite")
|
|
|
- @ApiOperation(value = "收藏单曲")
|
|
|
+ @ApiOperation(value = "学生-收藏单曲")
|
|
|
public HttpResponseResult<PageInfo<MusicSheetVo>> favoriteMusic(QueryInfo query) {
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
if (sysUser == null || sysUser.getId() == null) {
|
|
@@ -167,61 +101,44 @@ public class MusicSheetController extends BaseController {
|
|
|
return succeed(PageUtil.pageInfo(sheetVoIPage));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 最近练习
|
|
|
- */
|
|
|
- @GetMapping("/practice")
|
|
|
- @ApiOperation(value = "最近练习")
|
|
|
- public HttpResponseResult<PageInfo<MusicSheetVo>> practiceMusic(QueryInfo query) {
|
|
|
+ @ApiOperation(value = "老师-个人中心-曲目分页查询", httpMethod="POST", consumes="application/json", produces="application/json")
|
|
|
+ @PostMapping(value="/teacher/list", consumes="application/json", produces="application/json")
|
|
|
+ public HttpResponseResult<PageInfo<MusicSheetVo>> list(@RequestBody MusicSheetSearch query) {
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
if (sysUser == null || sysUser.getId() == null) {
|
|
|
return failed("用户信息获取失败");
|
|
|
}
|
|
|
- StudentMusicSheetSearch search = new StudentMusicSheetSearch();
|
|
|
- search.setStudentId(sysUser.getId());
|
|
|
- search.setState(YesOrNoEnum.YES);
|
|
|
- search.setAuditStatus(AuthStatusEnum.PASS);
|
|
|
- IPage<MusicSheetVo> sheetVoIPage = musicSheetService.practiceMusic(PageUtil.getPage(query),search);
|
|
|
- return succeed(PageUtil.pageInfo(sheetVoIPage));
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * 检查实名认证
|
|
|
- */
|
|
|
- @GetMapping("/realNameAuth/check")
|
|
|
- @ApiOperation(value = "检查实名认证")
|
|
|
- public HttpResponseResult<CheckVo> realNameAuthCheck() {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
+ // 设置只查老师用户 状态为启用
|
|
|
+ query.setCreateBy(sysUser.getId());
|
|
|
+ if (query.getAuditStatus() != null && AuthStatusEnum.PASS.getCode().equals(query.getAuditStatus().getCode())) {
|
|
|
+ query.setState(YesOrNoEnum.YES);
|
|
|
}
|
|
|
|
|
|
- CheckVo checkVo = new CheckVo();
|
|
|
- if (StringUtil.isEmpty(sysUser.getIdCardNo())) {
|
|
|
- checkVo.setCheck(YesOrNoEnum.NO);
|
|
|
- } else {
|
|
|
- checkVo.setCheck(YesOrNoEnum.YES);
|
|
|
- }
|
|
|
- return succeed(checkVo);
|
|
|
+ IPage<MusicSheetVo> musicSheetVoIPage = musicSheetService.selectPage(PageUtil.getPage(query), query);
|
|
|
+ return succeed(PageUtil.pageInfo(musicSheetVoIPage));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- /**
|
|
|
- * 实名认证
|
|
|
- */
|
|
|
- @PostMapping(value = "/realNameAuth" ,consumes="application/json", produces="application/json")
|
|
|
- @ApiOperation(value = "实名认证", httpMethod="POST",consumes="application/json", produces="application/json")
|
|
|
- public HttpResponseResult<IdcardInfoExtractor> realNameAuth(@Valid @RequestBody RealnameAuthReq realNameAuthDto) {
|
|
|
+ @ApiOperation(value = "老师新增曲目", httpMethod="POST", consumes="application/json", produces="application/json")
|
|
|
+ @PostMapping(value="/create", consumes="application/json", produces="application/json")
|
|
|
+ public HttpResponseResult<Object> create(@Valid @RequestBody MusicSheetDto musicSheetDto) {
|
|
|
SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
if (sysUser == null || sysUser.getId() == null) {
|
|
|
return failed("用户信息获取失败");
|
|
|
}
|
|
|
|
|
|
- return sysUserFeignService.realNameAuth(realNameAuthDto);
|
|
|
- }
|
|
|
-
|
|
|
+ if (ChargeTypeEnum.CHARGE.getCode().equals(musicSheetDto.getChargeType().getCode())
|
|
|
+ && musicSheetDto.getMusicPrice()==null){
|
|
|
+ return failed("此曲谱为收费曲谱,需要提供价格");
|
|
|
+ }
|
|
|
|
|
|
+ musicSheetDto.setUserId(sysUser.getId());
|
|
|
+ musicSheetDto.setAuditStatus(AuthStatusEnum.DOING);
|
|
|
+ musicSheetDto.setSubmitAuditTime(new Date());
|
|
|
+ musicSheetDto.setSourceType(SourceTypeEnum.TEACHER);
|
|
|
|
|
|
+ musicSheetDto.setCreateBy(sysUser.getId());
|
|
|
+ musicSheetDto.setCreateTime(new Date());
|
|
|
+ musicSheetService.saveMusicSheet(musicSheetDto,sysUser.getId());
|
|
|
+ return succeed("新增曲谱成功");
|
|
|
+ }
|
|
|
}
|