|
@@ -54,8 +54,6 @@ public class TenantAlbumController {
|
|
|
|
|
|
@Autowired
|
|
|
private TenantAlbumRefService tenantAlbumRefService;
|
|
|
- @Autowired
|
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
@Autowired
|
|
|
private TenantInfoService tenantInfoService;
|
|
@@ -98,6 +96,8 @@ public class TenantAlbumController {
|
|
|
vo.setTenantId(one.getTenantId());
|
|
|
//查询曲目表
|
|
|
|
|
|
+ TenantInfo tenantInfo = tenantInfoService.getById(one.getTenantId());
|
|
|
+ vo.setTenantName(tenantInfo.getName());
|
|
|
List<TenantAlbumMusic> tenantAlbumMusics = tenantAlbumMusicService.lambdaQuery()
|
|
|
.eq(TenantAlbumMusic::getTenantAlbumId, id)
|
|
|
.eq(TenantAlbumMusic::getDelFlag, false)
|
|
@@ -127,22 +127,39 @@ public class TenantAlbumController {
|
|
|
@ApiOperation(value = "新增专辑", notes = "新增专辑")
|
|
|
@PreAuthorize("@pcs.hasPermissions('tenantAlbum/save')")
|
|
|
public HttpResponseResult<Boolean> save(@Validated @RequestBody TenantAlbumVo.TenantAlbum album) {
|
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
- TenantInfo tenantInfo = tenantInfoService.lambdaQuery().eq(TenantInfo::getUserId, sysUser.getId())
|
|
|
- .last("limit 1").one();
|
|
|
- if (tenantInfo == null) {
|
|
|
- throw new BizException("非法请求");
|
|
|
- }
|
|
|
+ TenantAlbum tenantAlbum = JSON.parseObject(album.jsonString(), TenantAlbum.class);
|
|
|
+ List<TenantAlbumVo.MusicSheetData> musicSheetData = album.getMusicSheetData();
|
|
|
+
|
|
|
+ List<TenantAlbumWrapper.MusicSheetData> musicSheetDataList = musicSheetData.stream().map(next ->
|
|
|
+ JSON.parseObject(JSON.toJSONString(next), TenantAlbumWrapper.MusicSheetData.class))
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ tenantAlbumService.insertTenantAlbum(album.getTenantId(), tenantAlbum, musicSheetDataList);
|
|
|
+ return HttpResponseResult.succeed();
|
|
|
+ }
|
|
|
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperation(value = "修改专辑", notes = "修改专辑")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('tenantAlbum/save')")
|
|
|
+ public HttpResponseResult<Boolean> update(@Validated @RequestBody TenantAlbumVo.TenantAlbum album) {
|
|
|
TenantAlbum tenantAlbum = JSON.parseObject(album.jsonString(), TenantAlbum.class);
|
|
|
List<TenantAlbumVo.MusicSheetData> musicSheetData = album.getMusicSheetData();
|
|
|
|
|
|
List<TenantAlbumWrapper.MusicSheetData> musicSheetDataList = musicSheetData.stream().map(next ->
|
|
|
JSON.parseObject(JSON.toJSONString(next), TenantAlbumWrapper.MusicSheetData.class))
|
|
|
.collect(Collectors.toList());
|
|
|
- tenantAlbumService.insertTenantAlbum(tenantInfo.getId(), tenantAlbum, musicSheetDataList);
|
|
|
+ tenantAlbumService.updateAlbum(album.getTenantId(), tenantAlbum, musicSheetDataList);
|
|
|
return HttpResponseResult.succeed();
|
|
|
}
|
|
|
|
|
|
+ @PostMapping("/updateStatus")
|
|
|
+ @ApiOperation(value = "启用/冻结", notes = "启用/冻结")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('tenantAlbum/updateStatus')")
|
|
|
+ public HttpResponseResult<Boolean> updateStatus(@Validated @RequestBody TenantAlbumVo.UpdateStatus status) {
|
|
|
+ tenantAlbumService.lambdaUpdate()
|
|
|
+ .set(TenantAlbum::getStatus, status.getStatus())
|
|
|
+ .eq(TenantAlbum::getId, status.getId())
|
|
|
+ .update();
|
|
|
+ return HttpResponseResult.succeed();
|
|
|
+ }
|
|
|
|
|
|
}
|