|
@@ -3,11 +3,14 @@ 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.CloudTeacherOrderDao;
|
|
|
import com.ym.mec.biz.dal.dao.SysMusicScoreAccompanimentDao;
|
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
|
+import com.ym.mec.biz.dal.enums.ClientEnum;
|
|
|
import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
|
|
|
import com.ym.mec.biz.service.CbsMusicScoreCategoriesService;
|
|
|
import com.ym.mec.biz.service.InstrumentService;
|
|
|
+import com.ym.mec.biz.service.MemberRankCategoryMapperService;
|
|
|
import com.ym.mec.biz.service.SysMusicScoreAccompanimentService;
|
|
|
import com.ym.mec.biz.service.SysMusicScoreService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
@@ -18,6 +21,7 @@ import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import com.ym.mec.util.collection.MapUtil;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -36,6 +40,13 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Strin
|
|
|
private SysMusicScoreService sysMusicScoreService;
|
|
|
@Resource
|
|
|
private InstrumentService instrumentService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CloudTeacherOrderDao cloudTeacherOrderDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private MemberRankCategoryMapperService memberRankCategoryMapperService;
|
|
|
+
|
|
|
@Override
|
|
|
public BaseDAO<String, SysMusicScoreAccompaniment> getDAO() {
|
|
|
return sysMusicScoreAccompanimentDao;
|
|
@@ -347,7 +358,37 @@ public class SysMusicScoreAccompanimentServiceImpl extends BaseServiceImpl<Strin
|
|
|
}
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
- return this.queryAccPage(params);
|
|
|
+ List<SysMusicScoreAccompaniment> accompaniments = this.queryAccPage(params);
|
|
|
+
|
|
|
+ // 根据用户会员判断是否锁定,免费曲目为试用
|
|
|
+ if (queryInfo.getUserType()!=null && ClientEnum.STUDENT==queryInfo.getUserType()) {
|
|
|
+ // 查询有效的会员
|
|
|
+ List<Integer> activationVipIds = cloudTeacherOrderDao.getActivationVipIds(queryInfo.getUserId());
|
|
|
+
|
|
|
+ // 获取会员的曲目分类
|
|
|
+ List<MemberRankCategoryMapper> categoryMapperList = memberRankCategoryMapperService.getByMemberRankId(activationVipIds);
|
|
|
+ if (CollectionUtils.isEmpty(categoryMapperList)) {
|
|
|
+ categoryMapperList = new ArrayList<>();
|
|
|
+ }
|
|
|
+ List<Integer> categoryIds = categoryMapperList.stream().map(MemberRankCategoryMapper::getCategoryId).distinct().collect(Collectors.toList());
|
|
|
+
|
|
|
+ // 判断曲目是否在分类中
|
|
|
+ for (SysMusicScoreAccompaniment row : accompaniments) {
|
|
|
+ if (categoryIds.contains(row.getCategoriesId())) {
|
|
|
+ row.setUseStatus("UNLOCK");
|
|
|
+ } else if (StringUtils.isBlank(row.getRankIds())) {
|
|
|
+ row.setUseStatus("FREE");
|
|
|
+ } else {
|
|
|
+ row.setUseStatus("LOCK");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (SysMusicScoreAccompaniment item : accompaniments) {
|
|
|
+ item.setUseStatus("UNLOCK");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return accompaniments;
|
|
|
}
|
|
|
|
|
|
@Override
|