|
@@ -2,11 +2,9 @@ package com.yonge.cooleshow.teacher.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
|
|
|
-import com.microsvc.toolkit.common.response.template.R;
|
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.AppMusicSheetVo;
|
|
|
-import com.yonge.cooleshow.biz.dal.dto.MusicSheetDto;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.MusicSheetRenderDto;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.ReasonDto;
|
|
|
import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetRelatedQueryInfo;
|
|
@@ -14,7 +12,6 @@ import com.yonge.cooleshow.biz.dal.dto.search.StudentMusicSheetSearch;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
|
|
|
import com.yonge.cooleshow.biz.dal.entity.Teacher;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.AuthStatusEnum;
|
|
|
-import com.yonge.cooleshow.biz.dal.enums.ChargeTypeEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.MusicSortType;
|
|
|
import com.yonge.cooleshow.biz.dal.enums.SourceTypeEnum;
|
|
@@ -39,16 +36,10 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import io.swagger.annotations.ApiParam;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.GetMapping;
|
|
|
-import org.springframework.web.bind.annotation.PathVariable;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestParam;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
@@ -64,19 +55,19 @@ import java.util.Optional;
|
|
|
@RequestMapping("${app-config.url.teacher:}/")
|
|
|
@Api(tags = "曲谱表 API接口")
|
|
|
public class MusicSheetController extends BaseController {
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private MusicSheetService musicSheetService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private AppVersionInfoService appVersionInfoService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private TeacherService teacherService;
|
|
|
|
|
|
- @Autowired
|
|
|
+ @Resource
|
|
|
private CbsMusicScoreService cbsMusicScoreService;
|
|
|
|
|
|
/**
|
|
@@ -103,64 +94,6 @@ public class MusicSheetController extends BaseController {
|
|
|
return succeed(detail);
|
|
|
}
|
|
|
|
|
|
- @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("用户信息获取失败");
|
|
|
- }
|
|
|
-
|
|
|
- if (ChargeTypeEnum.CHARGE.getCode().equals(musicSheetDto.getChargeType().getCode())
|
|
|
- && musicSheetDto.getMusicPrice()==null){
|
|
|
- return failed("此曲谱为收费曲谱,需要提供价格");
|
|
|
- }
|
|
|
- if (musicSheetDto.getNotation() == null) {
|
|
|
- musicSheetDto.setNotation(YesOrNoEnum.NO);
|
|
|
- }
|
|
|
-
|
|
|
- if (musicSheetDto.getProviderType() == null) {
|
|
|
- musicSheetDto.setProviderType(SourceTypeEnum.PLATFORM);
|
|
|
- }
|
|
|
- musicSheetDto.setUserId(sysUser.getId());
|
|
|
- musicSheetDto.setAuditStatus(AuthStatusEnum.DOING);
|
|
|
- musicSheetDto.setSubmitAuditTime(new Date());
|
|
|
- musicSheetDto.setSourceType(SourceTypeEnum.TEACHER);
|
|
|
- musicSheetDto.setFavoriteCount(0);
|
|
|
- musicSheetDto.setCreateBy(sysUser.getId());
|
|
|
- musicSheetDto.setCreateTime(new Date());
|
|
|
- musicSheetService.saveMusicSheet(musicSheetDto,sysUser.getId());
|
|
|
- return succeed("新增曲谱成功");
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "修改", httpMethod="POST", consumes="application/json", produces="application/json")
|
|
|
- @PostMapping(value="/update", consumes="application/json", produces="application/json")
|
|
|
- public HttpResponseResult<Object> update(@Valid @RequestBody MusicSheetDto musicSheet) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- if (sysUser == null || sysUser.getId() == null) {
|
|
|
- return failed("用户信息获取失败");
|
|
|
- }
|
|
|
- if (musicSheet.getId()==null){
|
|
|
- return failed("缺少ID");
|
|
|
- }
|
|
|
- if (musicSheet.getNotation() == null) {
|
|
|
- musicSheet.setNotation(YesOrNoEnum.NO);
|
|
|
- }
|
|
|
- musicSheet.setUserId(sysUser.getId());
|
|
|
- musicSheet.setSubmitAuditTime(new Date());
|
|
|
- musicSheet.setCreateTime(new Date());
|
|
|
- musicSheet.setCreateBy(sysUser.getId());
|
|
|
- musicSheet.setUpdateBy(sysUser.getId());
|
|
|
- musicSheet.setUpdateTime(new Date());
|
|
|
- musicSheet.setSubmitAuditTime(new Date());
|
|
|
- musicSheet.setAuditStatus(AuthStatusEnum.DOING);
|
|
|
- if ( musicSheetService.saveMusicSheet(musicSheet,sysUser.getId())){
|
|
|
- return succeed("修改成功");
|
|
|
- } else {
|
|
|
- return failed("修改失败");
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
@ApiOperation(value = "修改", httpMethod="POST", consumes="application/json", produces="application/json")
|
|
|
@PostMapping(value="/updateRenderFile", consumes="application/json", produces="application/json")
|
|
|
public HttpResponseResult<Object> updateRenderFile(@Valid @RequestBody MusicSheetRenderDto musicSheetRenderDto) {
|
|
@@ -191,7 +124,6 @@ public class MusicSheetController extends BaseController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "新增/修改", notes = "曲目表- 传入 MusicSheetWrapper.MusicSheet")
|
|
|
- @PreAuthorize("@auditsvc.hasPermissions('music/sheet/save', {'BACKEND'})")
|
|
|
@PostMapping("music/sheet/save")
|
|
|
public HttpResponseResult<Long> cbsAdd(@Validated @RequestBody CbsMusicSheetWrapper.AddMusicSheet addMusicSheet) {
|
|
|
return succeed(cbsMusicScoreService.musicSheetAdd(addMusicSheet));
|