Ver código fonte

管乐迷曲目来源内容平台

zouxuan 9 meses atrás
pai
commit
6df753b7f1

+ 185 - 0
mec-application/src/main/java/com/ym/mec/web/controller/MusicSheetApplicationExtendController.java

@@ -0,0 +1,185 @@
+package com.ym.mec.web.controller;
+
+import com.alibaba.fastjson.JSONObject;
+import com.dayaedu.cbs.openfeign.client.MusicFeignClientService;
+import com.dayaedu.cbs.openfeign.properties.OpenFeignClientConfigProperties;
+import com.dayaedu.cbs.openfeign.service.CbsMusicSheetService;
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetApplicationExtendClientWrapper;
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetCategoryWrapper;
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetExtendWrapper;
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
+import com.microsvc.toolkit.common.response.paging.PageInfo;
+import com.microsvc.toolkit.common.response.template.R;
+import com.microsvc.toolkit.common.webportal.exception.BizException;
+import com.ym.mec.biz.dal.entity.SysMusicScore;
+import com.ym.mec.biz.service.SysMusicScoreService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections.CollectionUtils;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.validation.annotation.Validated;
+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.RestController;
+
+import javax.annotation.Resource;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("${app-config.url.admin:}/musicSheetApplicationExtend")
+@Api(tags = "曲目应用拓展表")
+public class MusicSheetApplicationExtendController {
+
+    @Resource
+    private MusicFeignClientService musicFeignClientService;
+
+
+    @Resource
+    private CbsMusicSheetService cbsMusicSheetService;
+
+    @Resource
+    private OpenFeignClientConfigProperties openFeignClientConfigProperties;
+
+    @Resource
+    private SysMusicScoreService sysMusicScoreService;
+
+    @PreAuthorize("@pcs.hasPermissions('musicSheetApplicationExtend/pageByApplication')")
+    @PostMapping({"/pageByApplication"})
+    public R<PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> musicSheetPageByApplication(@RequestBody CbsMusicSheetWrapper.MusicSheetApplicationQuery var1) {
+        var1.setApplicationId(Long.parseLong(openFeignClientConfigProperties.getAppId()));
+        try {
+            PageInfo<CbsMusicSheetWrapper.MusicSheetApplication> feignedData = this.musicFeignClientService.musicSheetPageByApplication(var1).feignData();
+            List<CbsMusicSheetWrapper.MusicSheetApplication> rows = feignedData.getRows();
+            if (CollectionUtils.isEmpty(rows)) {
+                return R.from(feignedData);
+            }
+            List<Long> cbsMusicIds = rows.stream().map(CbsMusicSheetWrapper.MusicSheetApplication::getId).collect(Collectors.toList());
+            List<SysMusicScore> musicSheetList = sysMusicScoreService.getDao().findByCbsId(cbsMusicIds);
+            Map<String, SysMusicScore> map = musicSheetList.stream().collect(Collectors.toMap(SysMusicScore::getCbsMusicSheetId, o -> o, (o1, o2) -> o1));
+
+            for (CbsMusicSheetWrapper.MusicSheetApplication row : rows) {
+                SysMusicScore musicSheet = map.get(row.getId().toString());
+                if (Objects.nonNull(musicSheet)) {
+                    row.setBizId(musicSheet.getId().longValue());
+                }
+            }
+            feignedData.setRows(rows);
+            return R.from(feignedData);
+        } catch (Exception e) {
+            log.error("查询曲目应用拓展表异常", e);
+            if (e instanceof BizException) {
+                throw e;
+            }
+            throw BizException.from("内容平台服务异常");
+        }
+    }
+
+
+    @ApiOperation(value = "修改应用扩展信息", notes = "曲目应用拓展表- 传入 MusicSheetApplicationExtendWrapper.MusicSheetApplicationExtend")
+    @PreAuthorize("@pcs.hasPermissions('musicSheetApplicationExtend/update')")
+    @PostMapping("/update")
+    public R<JSONObject> update(@RequestBody CbsMusicSheetApplicationExtendClientWrapper.AddMusicSheetApplicationExtend addMusicSheetApplicationExtend) {
+
+        // 更新数据
+        addMusicSheetApplicationExtend.setApplicationId(Long.parseLong(openFeignClientConfigProperties.getAppId()));
+        try {
+
+            musicFeignClientService.musicSheetApplicationExtendUpdate(addMusicSheetApplicationExtend).feignData();
+        } catch (Exception e) {
+            log.error("修改应用扩展信息异常", e);
+            if (e instanceof BizException) {
+                throw e;
+            }
+            throw BizException.from("内容平台服务异常");
+        }
+
+        return R.defaultR();
+    }
+
+
+    @ApiOperation(value = "启/停用", notes = "曲目应用拓展表- 传入 MusicSheetApplicationExtendWrapper.MusicSheetApplicationExtend")
+    @PreAuthorize("@pcs.hasPermissions('musicSheetApplicationExtend/status')")
+    @PostMapping("/status")
+    public R<JSONObject> status(@Validated @RequestBody CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus status) {
+
+        // 更新数据
+        try {
+
+            musicFeignClientService.musicSheetApplicationExtendStatus(status).feignData();
+        } catch (Exception e) {
+            log.error("启/停用异常", e);
+            if (e instanceof BizException) {
+                throw e;
+            }
+            throw BizException.from("内容平台服务异常");
+        }
+
+        return R.defaultR();
+    }
+
+
+    @ApiOperation(value = "批量保存扩展信息")
+    @PreAuthorize("@pcs.hasPermissions('musicSheetApplicationExtend/saveBatch')")
+    @PostMapping("/saveBatch")
+    public R<JSONObject> saveBatch(@RequestBody List<CbsMusicSheetApplicationExtendClientWrapper.AddMusicSheetApplicationExtend> list) {
+
+        if (CollectionUtils.isEmpty(list)) {
+            throw BizException.from("参数错误");
+        }
+        for (CbsMusicSheetApplicationExtendClientWrapper.AddMusicSheetApplicationExtend addMusicSheetApplicationExtend : list) {
+            addMusicSheetApplicationExtend.setApplicationId(Long.parseLong(openFeignClientConfigProperties.getAppId()));
+        }
+        // 更新数据
+        try {
+            musicFeignClientService.musicSheetApplicationExtendSaveBatch(list).feignData();
+        } catch (Exception e) {
+            log.error("批量保存扩展信息异常", e);
+            if (e instanceof BizException) {
+                throw e;
+            }
+            throw BizException.from("内容平台服务异常");
+        }
+
+        return R.defaultR();
+    }
+
+
+    @ApiOperation(value = "应用分类列表")
+    @PostMapping("/categoryList")
+    public R<List<CbsMusicSheetCategoryWrapper.MusicSheetCategory>> categoryList() {
+
+        return R.from(cbsMusicSheetService.categoryList(new CbsMusicSheetCategoryWrapper.MusicSheetCategoryQuery()));
+
+    }
+
+    @ApiOperation(value = "所属人信息查询")
+    @PostMapping("/ownerList")
+    public R<PageInfo<CbsMusicSheetExtendWrapper.MusicSheetExtend>> ownerList(@RequestBody CbsMusicSheetExtendWrapper.MusicSheetExtendQuery queryInfo) {
+
+        return R.from(cbsMusicSheetService.ownerList(queryInfo));
+    }
+
+    @ApiOperation(value = "查询曲目适用项目的扩展信息")
+    @PostMapping("/applicationExtendInfo")
+    public R<CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtend> applicationExtendInfo(@RequestBody @Validated CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendQuery query) {
+        if (query == null || query.getMusicSheetId() == null) {
+            throw BizException.from("参数错误");
+        }
+        query.setApplicationId(Long.parseLong(openFeignClientConfigProperties.getAppId()));
+        R<List<CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtend>> listR = musicFeignClientService.musicSheetApplicationExtendApplicationExtendInfo(query);
+        List<CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtend> data = listR.feignData();
+        if (CollectionUtils.isNotEmpty(data)) {
+            return R.from(data.get(0));
+        } else {
+            throw new BizException("扩展信息不存在");
+        }
+    }
+
+}

+ 33 - 58
mec-application/src/main/java/com/ym/mec/web/controller/SysMusicScoreController.java

@@ -1,8 +1,10 @@
 package com.ym.mec.web.controller;
 
+import com.dayaedu.cbs.domain.wrapper.MusicSheetWrapper;
+import com.ym.mec.biz.dal.dto.ReasonDto;
 import com.ym.mec.biz.dal.entity.SysMusicScore;
-import com.ym.mec.biz.dal.entity.SysMusicScoreCategories;
 import com.ym.mec.biz.dal.enums.ClientTypeEnum;
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
 import com.ym.mec.biz.service.SysMusicScoreService;
 import com.ym.mec.common.controller.BaseController;
@@ -10,14 +12,12 @@ import com.ym.mec.common.entity.HttpResponseResult;
 import com.ym.mec.common.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
-import java.util.List;
 
 @RequestMapping("${app-config.url.web:}/sysMusicScore")
 @Api(tags = "曲库")
@@ -27,46 +27,14 @@ public class SysMusicScoreController extends BaseController {
     @Resource
     private SysMusicScoreService sysMusicScoreService;
 
-    /*@ApiOperation(value = "修改")
+    @ApiOperation(value = "修改应用扩展信息")
+    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/update', {'BACKEND'})")
     @PostMapping("/update")
-    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/update')")
-    public Object update(@RequestBody MusicScoreDto musicScoreDto) {
-        sysMusicScoreService.updateMusicScore(musicScoreDto);
-        return succeed();
-    }*/
-
-    @ApiOperation(value = "修改样式")
-    @PostMapping("/updateExtStyleConfigJson")
-    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/updateExtStyleConfigJson')")
-    public Object updateExtStyleConfigJson(Integer sysMusicScoreId,String extStyleConfigJson) {
-        sysMusicScoreService.updateExtStyleConfigJson(sysMusicScoreId, extStyleConfigJson);
-        return succeed();
-    }
-
-    @ApiOperation(value = "启用/停用")
-    @PostMapping("/show")
-    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/show')")
-    public HttpResponseResult<Object> update(Integer sysMusicScoreId, Integer showFlag) {
-        sysMusicScoreService.enable(sysMusicScoreId, showFlag);
+    public HttpResponseResult<Object> update(@RequestBody MusicSheetWrapper.MusicSheetApplicationExtendWrapper addMusicSheetApplicationExtend) {
+        sysMusicScoreService.updateCbs(addMusicSheetApplicationExtend);
         return succeed();
     }
 
-    /*@ApiOperation(value = "新增")
-    @PostMapping("/add")
-    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/add')")
-    public Object add(@RequestBody MusicScoreDto musicScoreDto) {
-        sysMusicScoreService.add(musicScoreDto);
-        return succeed();
-    }*/
-
-/*    @ApiOperation(value = "删除")
-    @PostMapping("/del")
-    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/del')")
-    public Object del(Integer id) {
-        sysMusicScoreService.del(id);
-        return succeed();
-    }*/
-
     @ApiOperation(value = "分页查询")
     @GetMapping("/queryPage")
     @PreAuthorize("@pcs.hasPermissions('sysMusicScore/queryPage')")
@@ -80,25 +48,32 @@ public class SysMusicScoreController extends BaseController {
         queryInfo.setType("COMMON");
         queryInfo.setShowFlag(1);
         queryInfo.setClientType(ClientTypeEnum.SMART_PRACTICE);
-//        return succeed(sysMusicScoreService.queryMusicScorePageInfo(queryInfo));
         return succeed(sysMusicScoreService.queryMusicScorePage(queryInfo));
     }
-    
-    private void getAllCategoryIdList(List<Integer> categoryIdList, List<SysMusicScoreCategories> sysMusicScoreCategoriesList){
-    	
-    	if(sysMusicScoreCategoriesList != null && sysMusicScoreCategoriesList.size() > 0){
-    		for(SysMusicScoreCategories sysMusicScoreCategories : sysMusicScoreCategoriesList){
-    			categoryIdList.add(sysMusicScoreCategories.getId());
-    			getAllCategoryIdList(categoryIdList, sysMusicScoreCategories.getSysMusicScoreCategoriesList());
-    		}
-    	}
+
+    @PostMapping("/state/{id}")
+    @ApiOperation(value = "启用/停用", notes = "传入id")
+    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/state')")
+    public HttpResponseResult<Boolean> state(@ApiParam(value = "曲目编号", required = true)  @PathVariable Integer id) {
+        if (id == null) {
+            return failed("参数不能为空");
+        }
+        return succeed(sysMusicScoreService.state(id));
     }
 
-    @ApiOperation(value = "转码")
-    @PostMapping("/transcod")
-    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/transcod')")
-    public Object transcod(Integer sysMusicScoreId) {
-        sysMusicScoreService.transcod(sysMusicScoreId);
-        return succeed();
+    @PostMapping("/stateList")
+    @ApiOperation(value = "批量启用/停用")
+    @PreAuthorize("@pcs.hasPermissions('sysMusicScore/stateList')")
+    public HttpResponseResult<Boolean> stateList(@RequestBody ReasonDto reasonDto) {
+        if (StringUtils.isEmpty(reasonDto.getMusicSheetIds())) {
+            return failed("参数不能为空");
+        }
+        if (reasonDto.getState() == null) {
+            return failed("启用/禁用状态不能为空");
+        }
+        if (reasonDto.getState().equals(YesOrNoEnum.NO) && StringUtils.isEmpty(reasonDto.getReason())) {
+            return failed("停用原因不能为空");
+        }
+        return succeed(sysMusicScoreService.stateList(reasonDto));
     }
 }

+ 0 - 10
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/SysMusicScoreDao.java

@@ -3,8 +3,6 @@ package com.ym.mec.biz.dal.dao;
 
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetApiWrapper;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetApplicationExtendWrapper;
-import com.ym.mec.biz.dal.dto.SysMusicScoreMetronomeTranscod;
-import com.ym.mec.biz.dal.dto.SysMusicScoreTranscod;
 import com.ym.mec.biz.dal.entity.SysMusicScore;
 import com.ym.mec.biz.dal.entity.SysMusicScoreAccompaniment;
 import com.ym.mec.common.dal.BaseDAO;
@@ -18,14 +16,6 @@ public interface SysMusicScoreDao extends BaseDAO<Integer, SysMusicScore> {
 
     int countBuyCategoriesIds(@Param("categoriesIds") String delCategoriesIds);
 
-    SysMusicScoreTranscod getTranscod(@Param("sysMusicScoreId") Integer sysMusicScoreId);
-
-    List<SysMusicScoreMetronomeTranscod> getMetronomeTranscod(@Param("sysMusicScoreId") Integer sysMusicScoreId);
-
-    int updateAccompanimentBySongId(@Param("param") SysMusicScoreAccompaniment param);
-
-    int updateExtStyleConfigJson(@Param("id") Integer id, @Param("extStyleConfigJson") String extStyleConfigJson);
-
     List<SysMusicScore> findByCbsId(@Param("cbsMusicSheetIds") List<Long> cbsMusicSheetIds);
 
     void updateBatchByCbsId(@Param("vos") List<CbsMusicSheetApplicationExtendWrapper.MusicSheetApplicationExtend> updateMusicScore);

+ 48 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/ReasonDto.java

@@ -0,0 +1,48 @@
+package com.ym.mec.biz.dal.dto;
+
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * Description
+ *
+ * @author liujunchi
+ * @date 2022-08-08
+ */
+@ApiModel("曲目下架原因")
+public class ReasonDto {
+
+    @ApiModelProperty("曲目下架原因")
+    private String  reason;
+
+    @ApiModelProperty("曲目id集合 逗号隔开")
+    private String musicSheetIds;
+
+    @ApiModelProperty("启用: 1 ,停用 : 0")
+    private YesOrNoEnum state;
+
+    public YesOrNoEnum getState() {
+        return state;
+    }
+
+    public void setState(YesOrNoEnum state) {
+        this.state = state;
+    }
+
+    public String getMusicSheetIds() {
+        return musicSheetIds;
+    }
+
+    public void setMusicSheetIds(String musicSheetIds) {
+        this.musicSheetIds = musicSheetIds;
+    }
+
+    public String getReason() {
+        return reason;
+    }
+
+    public void setReason(String reason) {
+        this.reason = reason;
+    }
+}

+ 0 - 44
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SysMusicScoreMetronomeTranscod.java

@@ -1,44 +0,0 @@
-package com.ym.mec.biz.dal.dto;
-
-public class SysMusicScoreMetronomeTranscod {
-    //sys_music_score_accompaniment.id_
-    private Integer id;
-    //sys_music_score_accompaniment.exam_song_id_
-    private Integer examSongId;
-    //原音MP3
-    private String mp3Url;
-    //原音MP3(含节拍器)
-    private String  metronomeMp3Url;
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public Integer getExamSongId() {
-        return examSongId;
-    }
-
-    public void setExamSongId(Integer examSongId) {
-        this.examSongId = examSongId;
-    }
-
-    public String getMp3Url() {
-        return mp3Url;
-    }
-
-    public void setMp3Url(String mp3Url) {
-        this.mp3Url = mp3Url;
-    }
-
-    public String getMetronomeMp3Url() {
-        return metronomeMp3Url;
-    }
-
-    public void setMetronomeMp3Url(String metronomeMp3Url) {
-        this.metronomeMp3Url = metronomeMp3Url;
-    }
-}

+ 0 - 47
mec-biz/src/main/java/com/ym/mec/biz/dal/dto/SysMusicScoreTranscod.java

@@ -1,47 +0,0 @@
-package com.ym.mec.biz.dal.dto;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SysMusicScoreTranscod {
-    //sys_music_score.id_
-    private Integer id;
-    //伴奏MP3
-    private String url;
-    //伴奏MP3(含节拍器)
-    private String  metronomeUrl;
-
-    private List<SysMusicScoreMetronomeTranscod> accompanimentList = new ArrayList<>();
-
-    public Integer getId() {
-        return id;
-    }
-
-    public void setId(Integer id) {
-        this.id = id;
-    }
-
-    public String getUrl() {
-        return url;
-    }
-
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    public String getMetronomeUrl() {
-        return metronomeUrl;
-    }
-
-    public void setMetronomeUrl(String metronomeUrl) {
-        this.metronomeUrl = metronomeUrl;
-    }
-
-    public List<SysMusicScoreMetronomeTranscod> getAccompanimentList() {
-        return accompanimentList;
-    }
-
-    public void setAccompanimentList(List<SysMusicScoreMetronomeTranscod> accompanimentList) {
-        this.accompanimentList = accompanimentList;
-    }
-}

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMusicScore.java

@@ -42,7 +42,7 @@ public class SysMusicScore {
 	private Integer id;
 
 	@ApiModelProperty(value = "内容平台曲目ID")
-	private Long cbsMusicSheetId;  //主键ID
+	private String cbsMusicSheetId;  //主键ID
 	
 	/**  */
 	private Integer musicScoreCategoriesId;

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/entity/SysMusicScoreAccompaniment.java

@@ -17,7 +17,7 @@ public class SysMusicScoreAccompaniment {
 	/**  */
 	private Integer examSongId;
 	/**  */
-	private Long cbsMusicSheetId;
+	private String cbsMusicSheetId;
 	
 	/**  */
 	private Integer subjectId;

+ 25 - 0
mec-biz/src/main/java/com/ym/mec/biz/dal/wrapper/MusicSheetWrapper.java

@@ -8,6 +8,7 @@ import com.microsvc.toolkit.common.response.paging.QueryInfo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.Optional;
 
@@ -199,6 +200,30 @@ public class MusicSheetWrapper {
     @NoArgsConstructor
     @AllArgsConstructor
     @ApiModel(" MusicSheet-管乐迷曲谱表")
+    public static class MusicSheetApplicationExtendWrapper {
+        @ApiModelProperty("曲目ID")
+        private @NotNull(
+                message = "曲目ID不能为空"
+        ) Long musicSheetId;
+
+        @ApiModelProperty("分类ID")
+        private Long musicSheetCategoryId;
+
+        @ApiModelProperty("启用状态")
+        private Boolean status;
+
+        @ApiModelProperty("排序")
+        private Integer sortNo;
+
+        @ApiModelProperty("收费类型(FREE:免费;VIP:会员;CHARGE:单曲收费)")
+        private String paymentType;
+    }
+
+    @Data
+    @Builder
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ApiModel(" MusicSheet-管乐迷曲谱表")
     public static class MecMusicSheet extends MusicSheet {
 
         @ApiModelProperty("曲目分类")

+ 7 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/SysMusicScoreService.java

@@ -4,9 +4,11 @@ package com.ym.mec.biz.service;
 import java.util.List;
 import java.util.Map;
 
+import com.dayaedu.cbs.domain.wrapper.MusicSheetWrapper;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.ym.mec.biz.dal.dao.SysMusicScoreDao;
 import com.ym.mec.biz.dal.dto.MusicScoreDto;
+import com.ym.mec.biz.dal.dto.ReasonDto;
 import com.ym.mec.biz.dal.entity.SysMusicScore;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
 import com.ym.mec.common.page.PageInfo;
@@ -16,13 +18,11 @@ public interface SysMusicScoreService extends BaseService<Integer, SysMusicScore
 
     SysMusicScoreDao getDao();
 
-    void updateMusicScore(MusicScoreDto musicScoreDto);
-
     void add(MusicScoreDto musicScoreDto);
 
     void del(Integer id);
 
-    List<CbsMusicSheetWrapper.MusicSheetApplication> queryCbsMusicSheetApplication(List<Long> cbsMusicSheetIds);
+    List<CbsMusicSheetWrapper.MusicSheetApplication> queryCbsMusicSheetApplication(List<String> cbsMusicSheetIds);
 
     List<SysMusicScore> queryMusicScoreAll(SysExamSongQueryInfo queryInfo);
 
@@ -30,11 +30,11 @@ public interface SysMusicScoreService extends BaseService<Integer, SysMusicScore
     
     PageInfo<SysMusicScore> queryMusicScorePageInfo(SysExamSongQueryInfo queryInfo);
 
-    void transcod(Integer sysMusicScoreId);
+    Map<Long, SysMusicScore> getMapByIds(List<Long> musicSheetIds);
 
-    int updateExtStyleConfigJson(Integer id, String extStyleConfigJson);
+    Boolean stateList(ReasonDto reasonDto);
 
-    Map<Long, SysMusicScore> getMapByIds(List<Long> musicSheetIds);
+    Boolean state(Integer id);
 
-    void enable(Integer sysMusicScoreId, Integer showFlag);
+    void updateCbs(MusicSheetWrapper.MusicSheetApplicationExtendWrapper addMusicSheetApplicationExtend);
 }

+ 6 - 7
mec-biz/src/main/java/com/ym/mec/biz/service/impl/CbsMusicSheetServiceImpl.java

@@ -10,7 +10,6 @@ import com.microsvc.toolkit.common.response.paging.QueryInfo;
 import com.ym.mec.biz.dal.dao.SysUserTenantDao;
 import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SysMusicScore;
-import com.ym.mec.biz.dal.entity.SysMusicScoreCategories;
 import com.ym.mec.biz.service.SubjectService;
 import com.ym.mec.biz.service.SysMusicScoreCategoriesService;
 import com.ym.mec.biz.service.SysMusicScoreService;
@@ -46,7 +45,7 @@ public class CbsMusicSheetServiceImpl implements CbsMusicSheetService {
         if (CollectionUtils.isEmpty(addMusicSheet)) {
             throw new BizException("请选择曲目信息");
         }
-        List<Long> cbsMusicSheetIds = addMusicSheet.stream().map(e -> e.getMusicSheetId()).collect(Collectors.toList());
+        List<Long> cbsMusicSheetIds = addMusicSheet.stream().map(CbsMusicSheetApplicationExtendWrapper.MusicSheetApplicationExtend::getMusicSheetId).collect(Collectors.toList());
         for (CbsMusicSheetApplicationExtendWrapper.MusicSheetApplicationExtend extend : addMusicSheet) {
             CbsMusicSheetApiWrapper.MusicSheetUpdate musicSheetUpdate = extend.getMusicSheetUpdate();
             if(StringUtils.isNotBlank(musicSheetUpdate.getSubjectIds())) {
@@ -60,19 +59,19 @@ public class CbsMusicSheetServiceImpl implements CbsMusicSheetService {
         //需要修改的曲目
         List<SysMusicScore> musicSheets = sysMusicScoreService.getDao().findByCbsId(cbsMusicSheetIds);
         if (CollectionUtils.isNotEmpty(musicSheets)){
-            List<Long> collect = musicSheets.stream().map(e -> e.getCbsMusicSheetId()).collect(Collectors.toList());
+            List<String> collect = musicSheets.stream().map(SysMusicScore::getCbsMusicSheetId).collect(Collectors.toList());
             //获取需要修改的曲目
             List<CbsMusicSheetApplicationExtendWrapper.MusicSheetApplicationExtend> updateMusicScore =
-                    addMusicSheet.stream().filter(e -> collect.contains(e.getMusicSheetId())).collect(Collectors.toList());
+                    addMusicSheet.stream().filter(e -> collect.contains(e.getMusicSheetId().toString())).collect(Collectors.toList());
             sysMusicScoreService.getDao().updateBatchByCbsId(updateMusicScore);
             //排除已经存在的曲目
-            addMusicSheet = addMusicSheet.stream().filter(e -> !collect.contains(e.getMusicSheetId())).collect(Collectors.toList());
+            addMusicSheet = addMusicSheet.stream().filter(e -> !collect.contains(e.getMusicSheetId().toString())).collect(Collectors.toList());
         }
         if(CollectionUtils.isNotEmpty(addMusicSheet)){
             sysMusicScoreService.getDao().batchInsert(addMusicSheet);
-            List<Long> cbsIds = addMusicSheet.stream().map(e -> e.getMusicSheetId()).collect(Collectors.toList());
+            List<Long> cbsIds = addMusicSheet.stream().map(CbsMusicSheetApplicationExtendWrapper.MusicSheetApplicationExtend::getMusicSheetId).collect(Collectors.toList());
             List<SysMusicScore> sysMusicScores = sysMusicScoreService.getDao().findByCbsId(cbsIds);
-            List<Integer> collect = sysMusicScores.stream().map(e -> e.getId()).collect(Collectors.toList());
+            List<Integer> collect = sysMusicScores.stream().map(SysMusicScore::getId).collect(Collectors.toList());
             sysMusicScoreService.getDao().batchInsertAccompaniment(collect);
         }
         return true;

+ 11 - 15
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreAccompanimentServiceImpl.java

@@ -3,7 +3,6 @@ package com.ym.mec.biz.service.impl;
 
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.ym.mec.auth.api.dto.MusicScoreQueryInfo;
-import com.ym.mec.biz.dal.dao.SubjectDao;
 import com.ym.mec.biz.dal.dao.SysMusicScoreAccompanimentDao;
 import com.ym.mec.biz.dal.entity.Subject;
 import com.ym.mec.biz.dal.entity.SysMusicScore;
@@ -36,8 +35,6 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 	@Resource
 	private SysMusicScoreAccompanimentDao sysMusicScoreAccompanimentDao;
 	@Resource
-	private SubjectDao subjectDao;
-	@Resource
 	private SysMusicScoreCategoriesService sysMusicScoreCategoriesService;
 	@Resource
 	private SysMusicScoreService sysMusicScoreService;
@@ -55,7 +52,7 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 		List<Integer> idList = new ArrayList<>();
 		idList.add(accompaniment.getId());
 		List<Integer> subjectIds = sysMusicScoreAccompanimentDao.findSubjectByMusicScoreId(accompaniment.getExamSongId(),idList);
-		if(subjectIds.size() > 0 && subjectIds.contains(accompaniment.getId())){
+		if(CollectionUtils.isNotEmpty(subjectIds) && subjectIds.contains(accompaniment.getId())){
 			throw new BizException("操作失败:请勿提交重复的伴奏声部");
 		}
 		sysMusicScoreAccompanimentDao.update(sysMusicScoreAccompaniment);
@@ -77,13 +74,13 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 		if(count == 0){
 			return result;
 		}
-		List<Long> cbsMusicSheetIds = accompaniments.stream().filter(e->e.getCbsMusicSheetId() != null)
-				.map(SysMusicScoreAccompaniment::getCbsMusicSheetId).collect(Collectors.toList());
+		List<String> cbsMusicSheetIds = accompaniments.stream().map(SysMusicScoreAccompaniment::getCbsMusicSheetId)
+				.filter(StringUtils::isNotEmpty).collect(Collectors.toList());
 		List<CbsMusicSheetWrapper.MusicSheetApplication> applications = sysMusicScoreService.queryCbsMusicSheetApplication(cbsMusicSheetIds);
 		if (CollectionUtils.isEmpty(applications)) {
 			throw new BizException("获取曲目信息失败");
 		}
-		Map<Long, CbsMusicSheetWrapper.MusicSheetApplication> applicationMap = applications.stream().collect(Collectors.toMap(CbsMusicSheetWrapper.MusicSheetApplication::getId, Function.identity()));
+		Map<String, CbsMusicSheetWrapper.MusicSheetApplication> applicationMap = applications.stream().collect(Collectors.toMap(e->e.getId().toString(), Function.identity()));
 		for (SysMusicScoreAccompaniment accompaniment : accompaniments) {
 			if(accompaniment.getCbsMusicSheetId() == null){
 				result.add(accompaniment);
@@ -104,7 +101,7 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 				record.setRankIds("FREE".equals(musicSheetApplication.getPaymentType()) ? "1" : null);
 				record.setClientType(accompaniment.getClientType());
 				record.setExamSongId(accompaniment.getExamSongId());
-				record.setCbsMusicSheetId(musicSheetApplication.getId());
+				record.setCbsMusicSheetId(musicSheetApplication.getId().toString());
 				record.setPlayMode(SysMusicScore.PlayMode.valueOf(musicSheetApplication.getPlayMode().getCode()));
 				record.setExtConfigJson(musicSheetApplication.getExtConfigJson());
 				record.setSubjectId(accompaniment.getSubjectId());
@@ -149,8 +146,8 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 			musicScoreQueryInfo.setEnable(queryInfo.getEnable());
 			musicScoreQueryInfo.setOrganId(queryInfo.getOrganId());
 			List<SysMusicScoreCategories> scoreCategories = sysMusicScoreCategoriesService.queryTree(musicScoreQueryInfo);
-			if(scoreCategories.size() > 0){
-				categoriesIdList = scoreCategories.stream().map(e->e.getId()).collect(Collectors.toList());
+			if(CollectionUtils.isNotEmpty(scoreCategories)){
+				categoriesIdList = scoreCategories.stream().map(SysMusicScoreCategories::getId).collect(Collectors.toList());
 			}else {
 				categoriesIdList.add(categoriesId);
 			}
@@ -176,15 +173,14 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
 			MusicScoreQueryInfo musicScoreQueryInfo = new MusicScoreQueryInfo();
 			musicScoreQueryInfo.setParentId(categoriesId);
 			List<SysMusicScoreCategories> scoreCategories = sysMusicScoreCategoriesService.queryTree(musicScoreQueryInfo);
-			if(scoreCategories.size() > 0){
-				List<SysMusicScoreCategories> allScoreCategories = new ArrayList<>();
-				allScoreCategories.addAll(scoreCategories);
+			if(CollectionUtils.isNotEmpty(scoreCategories)){
+                List<SysMusicScoreCategories> allScoreCategories = new ArrayList<>(scoreCategories);
 				for (SysMusicScoreCategories scoreCategory : scoreCategories) {
 					if(scoreCategory.getSysMusicScoreCategoriesList() != null){
 						allScoreCategories.addAll(scoreCategory.getSysMusicScoreCategoriesList());
 					}
 				}
-				categoriesIdList = allScoreCategories.stream().map(e->e.getId()).collect(Collectors.toList());
+				categoriesIdList = allScoreCategories.stream().map(SysMusicScoreCategories::getId).collect(Collectors.toList());
 			}else {
 				categoriesIdList.add(categoriesId);
 			}
@@ -232,7 +228,7 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Integ
     
     private void getAllCategoryIdList(List<Integer> categoryIdList, List<SysMusicScoreCategories> sysMusicScoreCategoriesList){
     	
-    	if(sysMusicScoreCategoriesList != null && sysMusicScoreCategoriesList.size() > 0){
+    	if(CollectionUtils.isNotEmpty(sysMusicScoreCategoriesList)){
     		for(SysMusicScoreCategories sysMusicScoreCategories : sysMusicScoreCategoriesList){
     			categoryIdList.add(sysMusicScoreCategories.getId());
     			getAllCategoryIdList(categoryIdList, sysMusicScoreCategories.getSysMusicScoreCategoriesList());

+ 70 - 182
mec-biz/src/main/java/com/ym/mec/biz/service/impl/SysMusicScoreServiceImpl.java

@@ -2,15 +2,21 @@ package com.ym.mec.biz.service.impl;
 
 
 import com.alibaba.fastjson.JSONObject;
+import com.dayaedu.cbs.common.enums.music.EMusicAvailableType;
+import com.dayaedu.cbs.domain.wrapper.MusicSheetWrapper;
 import com.dayaedu.cbs.openfeign.client.MusicFeignClientService;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetApplicationExtendClientWrapper;
 import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
 import com.microsvc.toolkit.common.response.template.R;
-import com.ym.mec.biz.dal.dao.*;
+import com.ym.mec.biz.dal.dao.SysMusicScoreAccompanimentDao;
+import com.ym.mec.biz.dal.dao.SysMusicScoreCategoriesDao;
+import com.ym.mec.biz.dal.dao.SysMusicScoreDao;
 import com.ym.mec.biz.dal.dto.MusicScoreDto;
-import com.ym.mec.biz.dal.dto.SysMusicScoreMetronomeTranscod;
-import com.ym.mec.biz.dal.dto.SysMusicScoreTranscod;
-import com.ym.mec.biz.dal.entity.*;
+import com.ym.mec.biz.dal.dto.ReasonDto;
+import com.ym.mec.biz.dal.entity.SysMusicScore;
+import com.ym.mec.biz.dal.entity.SysMusicScoreAccompaniment;
+import com.ym.mec.biz.dal.entity.SysMusicScoreCategories;
+import com.ym.mec.biz.dal.enums.YesOrNoEnum;
 import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
 import com.ym.mec.biz.service.*;
 import com.ym.mec.common.dal.BaseDAO;
@@ -51,12 +57,8 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
     @Resource
     private SysMusicScoreCategoriesDao sysMusicScoreCategoriesDao;
     @Resource
-    private SubjectDao subjectDao;
-    @Resource
     private SysMusicScoreCategoriesService sysMusicScoreCategoriesService;
     @Resource
-    private SysMusicScoreChangeLogDao sysMusicScoreChangeLogDao;
-    @Resource
     private IdGeneratorService idGeneratorService;
     @Resource
     private UploadFileService uploadFileService;
@@ -80,49 +82,12 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void updateMusicScore(MusicScoreDto musicScoreDto) {
-        SysMusicScore sysMusicScore = musicScoreDto.getSysMusicScore();
-        sysMusicScoreDao.update(sysMusicScore);
-        List<Integer> delExamSongAccompanimentIds = musicScoreDto.getDelExamSongAccompanimentIds();
-        if (delExamSongAccompanimentIds != null && delExamSongAccompanimentIds.size() > 0) {
-            sysMusicScoreAccompanimentDao.batchDel(delExamSongAccompanimentIds);
-        }
-        List<SysMusicScoreAccompaniment> sysMusicScoreAccompaniments = musicScoreDto.getSysMusicScoreAccompaniments();
-        if (sysMusicScoreAccompaniments != null && sysMusicScoreAccompaniments.size() > 0) {
-            List<Integer> subjectIdList = sysMusicScoreAccompaniments.stream().map(e -> e.getSubjectId()).collect(Collectors.toList());
-            subjectIdList.removeAll(Collections.singleton(null));
-
-            if (subjectIdList.size() > 0) {
-                List<Integer> idList = sysMusicScoreAccompaniments.stream().map(e -> e.getId()).collect(Collectors.toList());
-                List<Integer> subjectIds = sysMusicScoreAccompanimentDao.findSubjectByMusicScoreId(sysMusicScore.getId(), idList);
-                int subjectSize = subjectIds.size() + subjectIdList.size();
-                subjectIdList.addAll(subjectIds);
-                int size = new HashSet<>(subjectIdList).size();
-                if (size < subjectSize && !musicScoreDto.getMultitrack()) {
-                    throw new BizException("操作失败:请勿提交重复的伴奏声部");
-                }
-            }
-            //获取需要修改的伴奏
-            List<SysMusicScoreAccompaniment> updateCollect = sysMusicScoreAccompaniments.stream().filter(e -> e.getId() != null).collect(Collectors.toList());
-            if (updateCollect.size() > 0) {
-                sysMusicScoreAccompanimentDao.batchUpdate(updateCollect, sysMusicScore.getIsOpenMetronome());
-            }
-            //获取需要新增的伴奏
-            List<SysMusicScoreAccompaniment> addCollect = sysMusicScoreAccompaniments.stream().filter(e -> e.getId() == null).collect(Collectors.toList());
-            if (addCollect.size() > 0) {
-                sysMusicScoreAccompanimentDao.batchInsert(addCollect, sysMusicScore.getId(), sysMusicScore.getIsOpenMetronome());
-            }
-        }
-    }
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
     public void add(MusicScoreDto musicScoreDto) {
         SysMusicScore sysMusicScore = musicScoreDto.getSysMusicScore();
         sysMusicScore.setCreateUserId(sysUserService.getUserId());
         sysMusicScoreDao.insert(sysMusicScore);
         List<SysMusicScoreAccompaniment> sysMusicScoreAccompaniments = musicScoreDto.getSysMusicScoreAccompaniments();
-        if (sysMusicScoreAccompaniments != null && sysMusicScoreAccompaniments.size() > 0) {
+        if (CollectionUtils.isNotEmpty(sysMusicScoreAccompaniments)) {
             sysMusicScoreAccompaniments.forEach(e -> {
                 e.setIsOpenMetronome(sysMusicScore.getIsOpenMetronome());
             });
@@ -191,9 +156,9 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
     }
 
     @Override
-    public List<CbsMusicSheetWrapper.MusicSheetApplication> queryCbsMusicSheetApplication(List<Long> cbsMusicSheetIds){
+    public List<CbsMusicSheetWrapper.MusicSheetApplication> queryCbsMusicSheetApplication(List<String> cbsMusicSheetIds){
         CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
-        query.setMusicSheetIds(cbsMusicSheetIds);
+        query.setMusicSheetIds(cbsMusicSheetIds.stream().map(Long::parseLong).collect(Collectors.toList()));
         query.setDetailFlag(true);
         query.setDelFlag(true);
         query.setPage(1);
@@ -213,60 +178,36 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
 
     private void dealMusicScoreData(List<SysMusicScore> records){
         if (CollectionUtils.isNotEmpty(records)) {
-            List<Long> cbsMusicSheetIds = records.stream().map(e -> e.getCbsMusicSheetId()).collect(Collectors.toList());
+            List<String> cbsMusicSheetIds = records.stream().map(SysMusicScore::getCbsMusicSheetId).collect(Collectors.toList());
             List<CbsMusicSheetWrapper.MusicSheetApplication> applications = this.queryCbsMusicSheetApplication(cbsMusicSheetIds);
             if(CollectionUtils.isNotEmpty(applications)){
+                Set<Integer> categoriesIds = records.stream().map(SysMusicScore::getMusicScoreCategoriesId).collect(Collectors.toSet());
+                //获取分部列表
+                Map<Integer, String> organMap = MapUtil.convertMybatisMap(sysMusicScoreCategoriesDao.queryOrganByIds(categoriesIds));
+                Map<Integer, String> map = new HashMap<>(categoriesIds.size());
+                for (Integer categoriesId : categoriesIds) {
+                    if(null != categoriesId){
+                        map.put(categoriesId, getParentTreeName(categoriesId));
+                    }
+                }
                 Map<Long, CbsMusicSheetWrapper.MusicSheetApplication> musicSheetApplicationMap = applications
                         .stream().collect(Collectors.toMap(CbsMusicSheetWrapper.MusicSheetApplication::getId, Function.identity()));
-                List<Subject> subjects = subjectDao.queryCbsList(null);
-                Map<Long, Subject> subjectMap = subjects.stream().collect(Collectors.toMap(Subject::getCbsSubjectId, Function.identity()));
                 for (SysMusicScore record : records) {
-                    CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication = musicSheetApplicationMap.get(record.getCbsMusicSheetId());
+                    record.setCategoriesName(map.get(record.getMusicScoreCategoriesId()));
+                    record.setOrganName(organMap.get(record.getMusicScoreCategoriesId()));
+                    CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication = musicSheetApplicationMap.get(Long.parseLong(record.getCbsMusicSheetId()));
                     if(musicSheetApplication != null){
-                        this.initMusicSheetVo(record,musicSheetApplication,subjectMap);
+                        this.initMusicSheetVo(record,musicSheetApplication);
                     }
                 }
             }
-            Set<Integer> categoriesIds = records.stream().map(e -> e.getMusicScoreCategoriesId()).collect(Collectors.toSet());
-            //获取分部列表
-            Map<Integer, String> organMap = MapUtil.convertMybatisMap(sysMusicScoreCategoriesDao.queryOrganByIds(categoriesIds));
-            //获取声部列表
-            /*Set<Integer> subjectIds = rows.stream().map(e -> e.getSubjectId()).collect(Collectors.toSet());
-            subjectIds.removeAll(Collections.singleton(null));
-            Map<Long, String> subjectMap = new HashMap();
-            if (subjectIds.size() > 0) {
-                String ids = StringUtils.join(subjectIds, ",");
-                subjectMap = MapUtil.convertMybatisMap(subjectDao.findBySubjecIds(ids));
-            }*/
-            Map<Integer, String> map = new HashMap<>(categoriesIds.size());
-            for (Integer categoriesId : categoriesIds) {
-                if(null != categoriesId){
-                    map.put(categoriesId, getParentTreeName(categoriesId));
-                }
-            }
-            for (SysMusicScore row : records) {
-                row.setCategoriesName(map.get(row.getMusicScoreCategoriesId()));
-                row.setOrganName(organMap.get(row.getMusicScoreCategoriesId()));
-//                row.setSubjectName(subjectMap.get(row.getSubjectId()));
-            }
         }
     }
 
-    public void initMusicSheetVo(SysMusicScore record,CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication,Map<Long, Subject> subjectMap){
-        if(StringUtils.isNotEmpty(musicSheetApplication.getSubjectIds())){
-            StringBuffer sb = new StringBuffer();
-            for (String s : musicSheetApplication.getSubjectIds().split(",")) {
-                Subject subject = subjectMap.get(Long.parseLong(s));
-                if(subject != null){
-                    if (sb.length() > 0) {
-                        sb.append(",");
-                    }
-                    sb.append(subject.getName());
-                }
-            }
-            record.setSubjectName(sb.toString());
-        }
-        record.setCbsMusicSheetId(musicSheetApplication.getId());
+    public void initMusicSheetVo(SysMusicScore record,CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication){
+        record.setSubjectName(musicSheetApplication.getSubjectNames());
+        record.setRankIds(StringUtils.equals("FREE",musicSheetApplication.getPaymentType()) ? "" : "1");
+        record.setCbsMusicSheetId(musicSheetApplication.getId().toString());
         record.setPlayMode(SysMusicScore.PlayMode.valueOf(musicSheetApplication.getPlayMode().getCode()));
         record.setExtConfigJson(musicSheetApplication.getExtConfigJson());
         record.setExtStyleConfigJson(musicSheetApplication.getExtStyleConfigJson());
@@ -362,77 +303,6 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
     }
 
     @Override
-    public void transcod(Integer sysMusicScoreId) {
-        SysMusicScoreTranscod obj = sysMusicScoreDao.getTranscod(sysMusicScoreId);
-        if (obj == null) {
-            throw new BizException("曲目信息不存在");
-        }
-        List<SysMusicScoreMetronomeTranscod> metronomeTranscod = sysMusicScoreDao.getMetronomeTranscod(sysMusicScoreId);
-        obj.setAccompanimentList(metronomeTranscod);
-        //
-        String old = JSONObject.toJSONString(obj);
-        boolean flag = false;
-        String url = doTranscod(obj.getUrl());
-        if (StringUtils.isNotEmpty(url)) {
-            obj.setUrl(url);
-            flag = true;
-        }
-        String metronomeUrl = doTranscod(obj.getMetronomeUrl());
-        if (StringUtils.isNotEmpty(metronomeUrl)) {
-            obj.setMetronomeUrl(metronomeUrl);
-            flag = true;
-        }
-        if (flag) {
-            //更新obj
-            SysMusicScore sysMusicScore = new SysMusicScore();
-            sysMusicScore.setId(obj.getId());
-            sysMusicScore.setUrl(obj.getUrl());
-            sysMusicScore.setMetronomeUrl(obj.getMetronomeUrl());
-            sysMusicScoreDao.update(sysMusicScore);
-        }
-
-        for (SysMusicScoreMetronomeTranscod o : metronomeTranscod) {
-            Boolean subFlag = false;
-            String mp3Url = doTranscod(o.getMp3Url());
-            if (StringUtils.isNotEmpty(mp3Url)) {
-                o.setMp3Url(mp3Url);
-                flag = true;
-                subFlag = true;
-            }
-            String metronomeMp3Url = doTranscod(o.getMetronomeMp3Url());
-            if (StringUtils.isNotEmpty(metronomeMp3Url)) {
-                o.setMetronomeMp3Url(metronomeMp3Url);
-                flag = true;
-                subFlag = true;
-            }
-            if (subFlag) {
-                SysMusicScoreAccompaniment accompaniment = new SysMusicScoreAccompaniment();
-                accompaniment.setExamSongId(o.getId());
-                accompaniment.setMp3Url(o.getMp3Url());
-                accompaniment.setMetronomeMp3Url(o.getMetronomeMp3Url());
-                sysMusicScoreDao.updateAccompanimentBySongId(accompaniment);
-            }
-        }
-        if (!flag) {
-            return;
-        }
-        obj.setAccompanimentList(metronomeTranscod);
-        String now = JSONObject.toJSONString(obj);
-
-        //记录日志
-        SysMusicScoreChangeLog log = new SysMusicScoreChangeLog();
-        log.setSysMusicScoreId(obj.getId());
-        log.setChangeBefore(old);
-        log.setChangeAfter(now);
-        sysMusicScoreChangeLogDao.insert(log);
-    }
-
-    @Override
-	public int updateExtStyleConfigJson(Integer id, String extStyleConfigJson) {
-		return sysMusicScoreDao.updateExtStyleConfigJson(id, extStyleConfigJson);
-	}
-
-    @Override
     public Map<Long, SysMusicScore> getMapByIds(List<Long> musicSheetIds) {
         if (CollectionUtils.isEmpty(musicSheetIds)) {
             return new HashMap<>();
@@ -446,33 +316,51 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
     }
 
     @Override
-    public void enable(Integer sysMusicScoreId, Integer showFlag) {
-        SysMusicScore sysMusicScore = this.get(sysMusicScoreId);
-        if(sysMusicScore == null){
-            throw new BizException("曲目信息不存在");
-        }
-        CbsMusicSheetWrapper.MusicSheetApplicationQuery query = new CbsMusicSheetWrapper.MusicSheetApplicationQuery();
-        query.setApplicationId(applicationId);
-        query.setMusicSheetIds(Collections.singletonList(sysMusicScore.getCbsMusicSheetId()));
-        query.setDelFlag(true);
-        query.setPage(1);
-        query.setRows(1);
-        R<com.microsvc.toolkit.common.response.paging.PageInfo<CbsMusicSheetWrapper.MusicSheetApplication>> pageInfoR = musicFeignClientService.musicSheetPageByApplication(query);
-        if (pageInfoR.getCode() != 200) {
-            throw new BizException("获取曲目信息异常,{}", pageInfoR.getMessage());
+    public Boolean stateList(ReasonDto reasonDto) {
+        List<Integer> musicSheets = Arrays.stream(reasonDto.getMusicSheetIds().split(",")).map(Integer::parseInt).collect(Collectors.toList());
+        List<SysMusicScore> musicSheetList = sysMusicScoreDao.findByIds(musicSheets.stream().map(String::valueOf).collect(Collectors.joining(",")));
+
+        List<CbsMusicSheetWrapper.MusicSheetApplication> rows =
+                this.queryCbsMusicSheetApplication(musicSheetList.stream().map(e -> e.getCbsMusicSheetId()).collect(Collectors.toList()));
+        String applicationExtendIds = rows.stream().map(e -> e.getApplicationExtendId().toString()).collect(Collectors.joining(","));
+        CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus extendStatus = new CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus();
+        extendStatus.setIds(applicationExtendIds);
+        extendStatus.setStatus(reasonDto.getState()== YesOrNoEnum.YES);
+        R<JSONObject> jsonObjectR = musicFeignClientService.musicSheetApplicationExtendStatus(extendStatus);
+        if (jsonObjectR.getCode() != 200) {
+            throw new BizException("修改曲目状态失败,{}", jsonObjectR.getMessage());
         }
-        List<CbsMusicSheetWrapper.MusicSheetApplication> rows = pageInfoR.feignData().getRows();
-        if (CollectionUtils.isEmpty(rows)) {
-            throw new BizException("获取曲目信息失败");
+        return true;
+    }
+
+    @Override
+    public Boolean state(Integer id) {
+        SysMusicScore musicScore = sysMusicScoreDao.get(id);
+        if (musicScore == null) {
+            throw new BizException("曲目信息不存在");
         }
-        CbsMusicSheetWrapper.MusicSheetApplication musicSheetApplication = rows.get(0);
+        List<CbsMusicSheetWrapper.MusicSheetApplication> rows =
+                this.queryCbsMusicSheetApplication(Collections.singletonList(musicScore.getCbsMusicSheetId()));
+        String applicationExtendIds = rows.stream().map(e -> e.getApplicationExtendId().toString()).collect(Collectors.joining(","));
         CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus extendStatus = new CbsMusicSheetApplicationExtendClientWrapper.MusicSheetApplicationExtendStatus();
-        extendStatus.setIds(musicSheetApplication.getApplicationExtendId().toString());
-        extendStatus.setStatus(showFlag == 1);
+        extendStatus.setIds(applicationExtendIds);
+        extendStatus.setStatus(musicScore.getShowFlag() != 1);
         R<JSONObject> jsonObjectR = musicFeignClientService.musicSheetApplicationExtendStatus(extendStatus);
         if (jsonObjectR.getCode() != 200) {
             throw new BizException("修改曲目状态失败,{}", jsonObjectR.getMessage());
         }
+        return true;
+    }
+
+    @Override
+    public void updateCbs(MusicSheetWrapper.MusicSheetApplicationExtendWrapper addMusicSheetApplicationExtend) {
+        CbsMusicSheetApplicationExtendClientWrapper.AddMusicSheetApplicationExtend extend =
+                JSONObject.parseObject(JSONObject.toJSONString(addMusicSheetApplicationExtend), CbsMusicSheetApplicationExtendClientWrapper.AddMusicSheetApplicationExtend.class);
+        extend.setApplicationId(applicationId);
+        R<JSONObject> jsonObjectR = musicFeignClientService.musicSheetApplicationExtendUpdate(extend);
+        if (jsonObjectR.getCode() != 200) {
+            throw new BizException("修改失败,{}",jsonObjectR.getMessage());
+        }
     }
 
     /**
@@ -550,7 +438,7 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
 
     private void getAllCategoryIdList(List<Integer> categoryIdList, List<SysMusicScoreCategories> sysMusicScoreCategoriesList) {
 
-        if (sysMusicScoreCategoriesList != null && sysMusicScoreCategoriesList.size() > 0) {
+        if (CollectionUtils.isNotEmpty(sysMusicScoreCategoriesList)) {
             for (SysMusicScoreCategories sysMusicScoreCategories : sysMusicScoreCategoriesList) {
                 categoryIdList.add(sysMusicScoreCategories.getId());
                 getAllCategoryIdList(categoryIdList, sysMusicScoreCategories.getSysMusicScoreCategoriesList());

+ 0 - 35
mec-biz/src/main/resources/config/mybatis/SysMusicScoreMapper.xml

@@ -167,24 +167,6 @@
     <select id="countBuyCategoriesIds" resultType="java.lang.Integer">
 		SELECT COUNT(0) FROM sys_music_score WHERE FIND_IN_SET(music_score_categories_id_,#{categoriesIds}) AND del_flag_ = 0
 	</select>
-    <select id="getTranscod" resultType="com.ym.mec.biz.dal.dto.SysMusicScoreTranscod">
-		select
-			t.id_ as id,
-		   	t.url_ as url,
-		   	t.metronome_url_ as metronomeUrl
-		from sys_music_score t
-		where t.del_flag_ = 0 and t.id_ = #{sysMusicScoreId}
-	</select>
-
-	<select id="getMetronomeTranscod" resultType="com.ym.mec.biz.dal.dto.SysMusicScoreMetronomeTranscod">
-		select
-			smsa.id_ as id,
-			smsa.exam_song_id_ as examSongId,
-			smsa.mp3_url_ as mp3Url,
-			smsa.metronome_mp3_url_ as metronomeMp3Url
-		from sys_music_score_accompaniment smsa
-		where smsa.del_flag_ = 0 and smsa.exam_song_id_ = #{sysMusicScoreId}
-	</select>
 	<select id="findByCbsId" resultMap="SysMusicScore">
 		SELECT * FROM sys_music_score WHERE del_flag_ = 0
 		<if test="cbsMusicSheetIds != null">
@@ -195,23 +177,6 @@
 		</if>
 	</select>
 
-	<update id="updateAccompanimentBySongId">
-		update sys_music_score_accompaniment t
-		<set>
-			<if test="param.mp3Url != null and param.mp3Url != ''">
-				t.mp3_url_ = #{param.mp3Url},
-			</if>
-			<if test="param.metronomeMp3Url != null and param.metronomeMp3Url != ''">
-				t.metronome_mp3_url_ = #{param.metronomeMp3Url},
-			</if>
-		</set>
-		where t.exam_song_id_ = #{param.examSongId} and t.del_flag_ = 0
-	</update>
-
-	<update id="updateExtStyleConfigJson">
-		update sys_music_score ms set ms.ext_style_config_json_ = #{extStyleConfigJson}
-		where ms.id_ = #{id}
-	</update>
 	<update id="updateBatchByCbsId">
 		<foreach collection="vos" item="item" index="index" separator=";">
 			update sys_music_score set music_score_categories_id_ = #{item.musicSheetCategoryId},

+ 1 - 1
pom.xml

@@ -26,7 +26,7 @@
 		<docker.registry.repository>127.0.0.1:5000</docker.registry.repository>
 		<docker.maven.plugin.version>1.2.2</docker.maven.plugin.version>
 		<com.microsvc.toolkit.version>1.0.4</com.microsvc.toolkit.version>
-		<cbs.version>1.0.7</cbs.version>
+		<cbs.version>1.0.10</cbs.version>
 	</properties>
 
 	<dependencyManagement>