瀏覽代碼

Merge branch 'zx_online_cbs' of http://git.dayaedu.com/yonge/cooleshow into zx_online_cbs

刘俊驰 1 年之前
父節點
當前提交
352762058b

+ 13 - 26
cooleshow-app/src/main/java/com/yonge/cooleshow/admin/controller/MusicSheetController.java

@@ -1,14 +1,13 @@
 package com.yonge.cooleshow.admin.controller;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetApplicationExtendClientWrapper;
 import com.microsvc.toolkit.common.response.template.R;
-import com.yonge.cooleshow.biz.dal.dto.AdjustModel;
 import com.yonge.cooleshow.biz.dal.dto.ReasonDto;
 import com.yonge.cooleshow.biz.dal.dto.search.MusicSheetSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.StudentMusicSheetOrderSearch;
 import com.yonge.cooleshow.biz.dal.dto.search.TeacherMusicSheetSearch;
-import com.yonge.cooleshow.biz.dal.entity.MusicSheet;
 import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 import com.yonge.cooleshow.biz.dal.enums.OrderTypeEnum;
 import com.yonge.cooleshow.biz.dal.service.MusicSheetService;
@@ -29,6 +28,8 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import javax.validation.Valid;
+import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.CompletableFuture;
 
 @RestController
@@ -53,7 +54,16 @@ public class MusicSheetController extends BaseController {
     @PostMapping(value="/list", consumes="application/json", produces="application/json")
     @PreAuthorize("@pcs.hasPermissions('music/sheet/list')")
     public HttpResponseResult<PageInfo<MusicSheetVo>> list(@RequestBody MusicSheetSearch query) {
-        return succeed(PageUtil.pageInfo(musicSheetService.selectCbsPage(PageUtil.getPage(query), query)));
+        PageInfo<MusicSheetVo> info = PageUtil.pageInfo(musicSheetService.selectCbsPage(PageUtil.getPage(query), query));
+        List<MusicSheetVo> rows = info.getRows();
+        List<MusicSheetVoResult> musicSheetVoResults = new ArrayList<>();
+        for (MusicSheetVo row : rows) {
+            MusicSheetVoResult musicSheetVoResult = JSON.parseObject(JSON.toJSONString(row), MusicSheetVoResult.class);
+            musicSheetVoResult.setCbsMusicSheetId(row.getCbsMusicSheetId().toString());
+            musicSheetVoResults.add(musicSheetVoResult);
+        }
+        com.yonge.cooleshow.biz.dal.dto.PageUtil.transPageInfo(info, musicSheetVoResults);
+        return succeed(info);
     }
 
     @ApiOperation(value = "修改应用扩展信息")
@@ -74,10 +84,6 @@ public class MusicSheetController extends BaseController {
         return status(musicSheetService.state(id,reasonDto.getReason(),ClientEnum.SYSTEM));
     }
 
-
-    /**
-     * 批量启用/停用
-     */
     @PostMapping("/stateList")
     @ApiOperation(value = "批量启用/停用")
     @PreAuthorize("@pcs.hasPermissions('music/sheet/stateList')")
@@ -129,25 +135,6 @@ public class MusicSheetController extends BaseController {
         return status(musicSheetService.top(id));
     }
 
-
-    /**
-     * 设置排序值 和加精
-     */
-    @PostMapping("/adjust")
-    @ApiOperation(value = "曲目调整设置")
-    public HttpResponseResult<Boolean> adjust(@RequestBody @Valid AdjustModel model) {
-
-        MusicSheet musicSheet = new MusicSheet();
-        musicSheet.setId(model.getId());
-        musicSheet.setSortNumber(model.getSort());
-        musicSheet.setExquisiteFlag(model.getExquisiteFlag());
-
-        musicSheetService.updateById(musicSheet);
-
-        return succeed();
-    }
-
-
     @ApiOperation(value = "数据同步", notes = "曲谱表- 修改曲目缓存 MusicSheetVo.MusicSheet")
     @PostMapping("/sync")
     public R<JSONObject> sync() {

+ 14 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/PageUtil.java

@@ -53,4 +53,18 @@ public class PageUtil {
         resultPage.setTotal(total);
         return resultPage;
     }
+
+    public static <T,E> com.microsvc.toolkit.common.response.paging.PageInfo<T> transPageInfo(PageInfo<E> source, List<T> rows) {
+        if (Objects.isNull(source)) {
+            return new com.microsvc.toolkit.common.response.paging.PageInfo<>();
+        }
+        int total = Integer.parseInt(String.valueOf(source.getTotal()));
+        int limit = Integer.parseInt(String.valueOf(source.getLimit()));
+        com.microsvc.toolkit.common.response.paging.PageInfo<T> resultPage = new com.microsvc.toolkit.common.response.paging.PageInfo<>();
+        resultPage.setRows(rows);
+        resultPage.setCurrent(Long.valueOf(source.getPageNo()).intValue());
+        resultPage.setLimit(limit);
+        resultPage.setTotal(total);
+        return resultPage;
+    }
 }

+ 2 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/MusicSheetServiceImpl.java

@@ -220,7 +220,6 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
                         .applicationId(Long.parseLong(openFeignClientConfigProperties.getAppId())).build());
         List<CbsMusicSheetWrapper.MusicSheetApplication> rows;
         try {
-
             PageInfo<CbsMusicSheetWrapper.MusicSheetApplication> musicSheetApplicationPageInfo = pageInfoR.feignData();
             rows = musicSheetApplicationPageInfo.getRows();
         }catch (Exception e) {
@@ -438,6 +437,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
         detailVo.setMusicTagNames(musicSheet1.getMusicTagNames());
         detailVo.setMusicImg(musicSheet1.getMusicImg());
         detailVo.setTitleImg(musicSheet1.getMusicCover());
+        detailVo.setPlaySpeed(musicSheet1.getPlaySpeed());
         List<CbsMusicSheetWrapper.MusicSheetAccompaniment> accompanimentList = musicSheet1.getMusicSheetAccompanimentList();
         if (CollectionUtils.isNotEmpty(accompanimentList)) {
             detailVo.setMetronomeUrl(accompanimentList.get(0).getAudioFileUrl());
@@ -480,6 +480,7 @@ public class MusicSheetServiceImpl extends ServiceImpl<MusicSheetDao, MusicSheet
             sheet.setMusicSheetType(MusicSheetTypeEnum.valueOf(musicSheetApplication.getMusicSheetType().name()));
         }
         sheet.setTitleImg(musicSheetApplication.getMusicCover());
+        sheet.setMusicImg(musicSheetApplication.getMusicImg());
         sheet.setUserId(musicSheetApplication.getUserId());
 //        if(musicSheetApplication.getSourceType() != null){
 //            sheet.setSourceType(musicSheetApplication.getSourceType() == EMusicSourceType.PERSON ? SourceTypeEnum.TEACHER :

+ 299 - 0
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/vo/MusicSheetVoResult.java

@@ -0,0 +1,299 @@
+package com.yonge.cooleshow.biz.dal.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
+import com.yonge.cooleshow.biz.dal.enums.*;
+import com.yonge.cooleshow.common.enums.YesOrNoEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import org.apache.commons.lang3.StringUtils;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Objects;
+
+@Data
+@ApiModel(value = "MusicSheetVo对象", description = "音乐曲目表查询视图对象")
+public class MusicSheetVoResult implements Serializable {
+
+    @ApiModelProperty("添加人")
+    private String addName;
+
+    @ApiModelProperty("添加头像(老师头像)")
+    private String addUserAvatar;
+
+    @ApiModelProperty("标签名")
+    private String musicTagNames;
+
+    @ApiModelProperty("声部名")
+    private String subjectNames;
+
+    @ApiModelProperty("收藏 0:否,1:是")
+    private YesOrNoEnum favorite = YesOrNoEnum.NO;
+
+    @ApiModelProperty("是否购买/VIP(0:否,1:是) ")
+    private YesOrNoEnum play;
+
+    @ApiModelProperty("专辑中曲目的排序号")
+    private Integer albumSortNumber;  //排序号
+
+    @ApiModelProperty("单曲专辑数")
+    private Integer albumNums;
+
+    @ApiModelProperty("曲目来源名")
+    private String  sourceName;
+
+    @ApiModelProperty("机构专辑ID,逗号隔开")
+    private String tenantAlbumId;
+
+    @ApiModelProperty("所属人信息")
+    private CbsMusicSheetWrapper.MusicSheetExtend musicSheetExtend;
+
+    @TableId(value = "id_", type = IdType.AUTO)
+    @ApiModelProperty(value = "主键id")
+    private Long id;  //主键ID
+
+    @TableField(value = "cbs_music_sheet_id_")
+    @ApiModelProperty(value = "内容平台曲目ID")
+    private String cbsMusicSheetId;  //主键ID
+
+    @NotBlank(message = "曲谱名称不能为空!")
+    @Size(max = 64, message = "曲谱名称长度不能超过64位!")
+    @TableField("music_sheet_name_")
+    @ApiModelProperty(value = "曲谱名称")
+    private String musicSheetName;  //曲谱名称
+
+
+    @NotBlank(message = "曲谱封面图不能为空!")
+    @TableField("title_img_")
+    @ApiModelProperty(value = "封面图")
+    private String titleImg;  //曲谱名称
+
+    @TableField("user_id_")
+    @ApiModelProperty(value = "曲谱来源(平台用户ID或者是老师ID)")
+    private Long userId;  //曲谱来源(平台用户ID或者是老师ID)
+
+    @TableField("notation_")
+    @ApiModelProperty("是否可以转简谱(0:否,1:是)")
+    private YesOrNoEnum notation;
+
+    @TableField("music_img_")
+    @ApiModelProperty("曲目图片")
+    private String musicImg;
+
+    @TableField("source_type_")
+    @ApiModelProperty(value = "曲目来源类型 TEACHER 老师 PLATFORM 平台")
+    private SourceTypeEnum sourceType;
+
+
+    @TableField("provider_type_")
+    @ApiModelProperty(value = "提供方 TENANT 机构 PLATFORM 平台")
+    private SourceTypeEnum providerType;
+
+    @NotBlank(message = "艺术家不能为空!")
+    @Size(max = 32, message = "艺术家长度不能超过32位!")
+    @TableField("composer_")
+    @ApiModelProperty(value = "艺术家")
+    private String composer;  //音乐家
+
+    @TableField("music_subject_")
+    @ApiModelProperty(value = "曲谱声部(适用的乐器,可能是多个,用逗号分隔)")
+    private String musicSubject;  //曲谱声部(适用的乐器,可能是多个,用逗号分隔)
+
+    @NotNull(message = "曲谱音频文件类型不能为空!")
+    @TableField("audio_type_")
+    @ApiModelProperty(value = "曲目音频类型 MP3:mp3, MIDI:midi,")
+    private AudioTypeEnum audioType;
+
+    @TableField("mp3_type_")
+    @ApiModelProperty(value = "mp3类型 MP3:mp3, MP3_METRONOME:MP3_METRONOME,")
+    private AudioTypeEnum mp3Type;
+
+
+    @TableField("favorite_count_")
+    @ApiModelProperty(value = "收藏数")
+    private Integer favoriteCount;
+
+
+    @ApiModelProperty("虚拟人数 ")
+    @TableField(value = "virtual_number_")
+    private Integer virtualNumber;
+
+    @NotBlank(message = "曲谱标签不能为空!")
+    @TableField("music_tag_")
+    @ApiModelProperty(value = "曲谱标签(多个标签用逗号分隔)")
+    private String musicTag;  //曲谱标签(多个标签用逗号分隔)
+
+    @NotNull(message = "伴奏类型不能为空!")
+    @TableField("accompaniment_type_")
+    @ApiModelProperty(value = "伴奏类型 HOMEMODE:自制伴奏  COMMON:普通伴奏")
+    private AccompanimentTypeEnum accompanimentType;
+
+    @TableField("play_speed_")
+    // @NotNull(message = "默认播放速度不能为空!")
+    @ApiModelProperty(value = "默认播放速度")
+    private String playSpeed;  //默认播放速度
+
+    @TableField("can_evaluate_")
+    @ApiModelProperty(value = "是否可以评测(0:否;1:是)")
+    private YesOrNoEnum canEvaluate;  //是否可以评测(0:否;1:是)
+
+    @TableField("show_fingering_")
+    @ApiModelProperty(value = "是否展示指法(0:否;1:是)")
+    private YesOrNoEnum showFingering;  //是否展示指法(0:否;1:是)
+
+    // @NotNull(message = "收费类型不能为空!")
+    @TableField("charge_type_")
+    @ApiModelProperty(value = "收费类型(FREE:免费;VIP:会员;CHARGE:单曲收费)")
+    private ChargeTypeEnum chargeType;  //收费类型(0:免费;1:会员;2:单曲收费)
+
+    @NotNull(message = "收费类型不能为空!")
+    @TableField("payment_type_")
+    @ApiModelProperty(value = "收费类型(FREE:免费;VIP:会员;CHARGE:单曲收费)")
+    private String paymentType;
+
+
+    @TableField("state_")
+    @ApiModelProperty(value = "曲目状态(0:停用,1:启用)")
+    private YesOrNoEnum state;
+
+    @TableField("reason_")
+    @ApiModelProperty(value = "曲目停用原因")
+    private String reason;
+
+    @TableField("audit_status_")
+    @ApiModelProperty(value = "审核状态(DOING:待审核;PASS:通过;UNPASS:未通过)")
+    private AuthStatusEnum auditStatus;
+
+    @TableField("submit_audit_time_")
+    @ApiModelProperty(value = "提交审核时间")
+    private Date submitAuditTime;
+
+    @TableField("first_pass_audit_time_")
+    @ApiModelProperty(value = "第一次通过审核时间")
+    private Date firstPassAuditTime;
+
+    @TableField("sort_number_")
+    @ApiModelProperty(value = "排序号")
+    private Integer sortNumber;  //排序号
+
+    @TableField("top_flag_")
+    @ApiModelProperty(value = "是否置顶(0:否;1:是)")
+    private YesOrNoEnum topFlag;  //是否置顶(0:否;1:是)
+
+    @TableField("hot_flag_")
+    @ApiModelProperty(value = "是否热门曲谱(0:否;1:是)")
+    private YesOrNoEnum hotFlag;  //是否热门曲谱(0:否;1:是)
+
+    @TableField("exquisite_flag_")
+    @ApiModelProperty(value = "精品标志(0:否;1:是)")
+    private YesOrNoEnum exquisiteFlag;
+
+    @TableField("music_price_")
+    @ApiModelProperty(value = "曲谱价格")
+    private java.math.BigDecimal musicPrice;  //曲谱价格
+
+    @TableField("audio_file_url_")
+    @ApiModelProperty(value = "音频文件存储路径")
+    private String audioFileUrl;  //音频文件存储路径
+
+    @NotBlank(message = "XML文件存储路径不能为空!")
+    @TableField("xml_file_url_")
+    @ApiModelProperty(value = "XML文件存储路径")
+    private String xmlFileUrl;  //XML文件存储路径
+
+
+    @TableField("midi_url_")
+    @ApiModelProperty(value = "midi路径")
+    private String midiUrl;  //XML文件存储路径
+
+
+    @TableField("metronome_url_")
+    @ApiModelProperty(value = "伴奏含节拍器路径")
+    private String metronomeUrl;  //XML文件存储路径
+
+
+    @TableField("url_")
+    @ApiModelProperty(value = "伴奏(不含节拍器)路径")
+    private String url;  //XML文件存储路径
+
+    @TableField("has_beat_")
+    @ApiModelProperty(value = "是否自带节拍器(0:否;1:是)")
+    private YesOrNoEnum hasBeat;  //是否自带节拍器(0:否;1:是)
+
+    @TableField("audit_version_")
+    @ApiModelProperty(value = "是否审核时可见 (0:否  1:是)")
+    private YesOrNoEnum auditVersion;
+
+    @TableField("create_time_")
+    @ApiModelProperty(value = "创建时间")
+    private java.util.Date createTime;  //创建时间
+
+    @TableField("create_by_")
+    @ApiModelProperty(value = "创建人(老师或者是后台平台用户)")
+    private Long createBy;  //创建人(老师或者是后台平台用户)
+
+    @TableField("update_time_")
+    @ApiModelProperty(value = "更新时间")
+    private java.util.Date updateTime;  //更新时间
+
+    @TableField("update_by_")
+    @ApiModelProperty(value = "更新人(老师或者是后台平台用户)")
+    private Long updateBy;  //更新人(老师或者是后台平台用户)
+
+    @TableField("remark_")
+    @ApiModelProperty(value = "备注")
+    private String remark;  //备注,填写未通过审核的原因
+
+
+    @TableField("ext_config_json_")
+    @ApiModelProperty("曲目配置信息")
+    private String extConfigJson;
+
+    @TableField("music_json_")
+    private String musicJSON;
+
+    @TableField("music_svg_")
+    private String musicSvg;
+
+    @TableField("music_jian_svg_")
+    private String musicJianSvg;
+
+    @TableField("music_first_svg_")
+    private String musicFirstSvg;
+
+    @TableField("first_tone_")
+    @ApiModelProperty("首调")
+    private String firstTone;
+
+    @TableField("fixed_tone_")
+    @ApiModelProperty("固定调")
+    private String fixedTone;
+
+    @TableField("del_flag_")
+    @ApiModelProperty(value = "假删除标识 0:未删除 1:已删除")
+    private Boolean delFlag;
+
+    @TableField("correct_time_")
+    @ApiModelProperty(value = "数据修复时间")
+    private Date correctTime;
+
+    //曲谱类型 SINGLE/CONCERT ,使用MusicSheetTypeEnum
+    @TableField("music_sheet_type_")
+    @ApiModelProperty(value = "曲谱类型(SINGLE:单曲,CONCERT:合奏)")
+    private MusicSheetTypeEnum musicSheetType;
+
+    public ChargeTypeEnum getChargeType() {
+        if (Objects.isNull(this.chargeType) && StringUtils.isNotEmpty(getPaymentType())) {
+
+            return ChargeTypeEnum.valueOf(getPaymentType().split(",")[0]);
+        }
+        return chargeType;
+    }
+}