|
@@ -14,10 +14,7 @@ import com.ym.mec.biz.dal.dto.SysMusicScoreMetronomeTranscod;
|
|
import com.ym.mec.biz.dal.dto.SysMusicScoreTranscod;
|
|
import com.ym.mec.biz.dal.dto.SysMusicScoreTranscod;
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
import com.ym.mec.biz.dal.entity.*;
|
|
import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
|
|
import com.ym.mec.biz.dal.page.SysExamSongQueryInfo;
|
|
-import com.ym.mec.biz.service.OrganizationService;
|
|
|
|
-import com.ym.mec.biz.service.SysMusicScoreCategoriesService;
|
|
|
|
-import com.ym.mec.biz.service.SysMusicScoreService;
|
|
|
|
-import com.ym.mec.biz.service.UploadFileService;
|
|
|
|
|
|
+import com.ym.mec.biz.service.*;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
import com.ym.mec.common.entity.UploadReturnBean;
|
|
import com.ym.mec.common.entity.UploadReturnBean;
|
|
import com.ym.mec.common.exception.BizException;
|
|
import com.ym.mec.common.exception.BizException;
|
|
@@ -52,7 +49,7 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
@Resource
|
|
@Resource
|
|
private SysMusicScoreAccompanimentDao sysMusicScoreAccompanimentDao;
|
|
private SysMusicScoreAccompanimentDao sysMusicScoreAccompanimentDao;
|
|
@Resource
|
|
@Resource
|
|
- private SysUserFeignService sysUserFeignService;
|
|
|
|
|
|
+ private SysUserService sysUserService;
|
|
@Resource
|
|
@Resource
|
|
private SysMusicScoreCategoriesDao sysMusicScoreCategoriesDao;
|
|
private SysMusicScoreCategoriesDao sysMusicScoreCategoriesDao;
|
|
@Resource
|
|
@Resource
|
|
@@ -123,12 +120,8 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
@Override
|
|
@Override
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
public void add(MusicScoreDto musicScoreDto) {
|
|
public void add(MusicScoreDto musicScoreDto) {
|
|
- SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
- if (sysUser == null) {
|
|
|
|
- throw new BizException("请登录");
|
|
|
|
- }
|
|
|
|
SysMusicScore sysMusicScore = musicScoreDto.getSysMusicScore();
|
|
SysMusicScore sysMusicScore = musicScoreDto.getSysMusicScore();
|
|
- sysMusicScore.setCreateUserId(sysUser.getId());
|
|
|
|
|
|
+ sysMusicScore.setCreateUserId(sysUserService.getUserId());
|
|
sysMusicScoreDao.insert(sysMusicScore);
|
|
sysMusicScoreDao.insert(sysMusicScore);
|
|
List<SysMusicScoreAccompaniment> sysMusicScoreAccompaniments = musicScoreDto.getSysMusicScoreAccompaniments();
|
|
List<SysMusicScoreAccompaniment> sysMusicScoreAccompaniments = musicScoreDto.getSysMusicScoreAccompaniments();
|
|
if (sysMusicScoreAccompaniments != null && sysMusicScoreAccompaniments.size() > 0) {
|
|
if (sysMusicScoreAccompaniments != null && sysMusicScoreAccompaniments.size() > 0) {
|
|
@@ -158,6 +151,10 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
if (sysMusicScore == null) {
|
|
if (sysMusicScore == null) {
|
|
throw new BizException("曲目不存在");
|
|
throw new BizException("曲目不存在");
|
|
}
|
|
}
|
|
|
|
+ Integer userId = sysUserService.getUserId();
|
|
|
|
+ if (!Objects.equals(sysMusicScore.getCreateUserId(), userId)) {
|
|
|
|
+ throw new BizException("无权限删除");
|
|
|
|
+ }
|
|
sysMusicScoreDao.delete(id);
|
|
sysMusicScoreDao.delete(id);
|
|
sysMusicScoreAccompanimentDao.deleteBySongId(id);
|
|
sysMusicScoreAccompanimentDao.deleteBySongId(id);
|
|
Integer categoriesId = sysMusicScore.getMusicScoreCategoriesId();
|
|
Integer categoriesId = sysMusicScore.getMusicScoreCategoriesId();
|
|
@@ -195,25 +192,6 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- private void dealMusicScoreParam(SysExamSongQueryInfo queryInfo){
|
|
|
|
- queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
|
|
|
|
- if(queryInfo.getCategoriesId() != null){
|
|
|
|
- List<Integer> categoriesIdList = new ArrayList<>();
|
|
|
|
- Integer categoriesId = Integer.parseInt(queryInfo.getCategoriesId());
|
|
|
|
-
|
|
|
|
- SysMusicScoreCategories sysMusicScoreCategories = sysMusicScoreCategoriesService.get(categoriesId);
|
|
|
|
-
|
|
|
|
- if(sysMusicScoreCategories == null){
|
|
|
|
- throw new BizException("分类找不到");
|
|
|
|
- }
|
|
|
|
- categoriesIdList.add(categoriesId);
|
|
|
|
- sysMusicScoreCategories = sysMusicScoreCategoriesService.getChildTree(sysMusicScoreCategories);
|
|
|
|
- getAllCategoryIdList(categoriesIdList, sysMusicScoreCategories.getSysMusicScoreCategoriesList());
|
|
|
|
-
|
|
|
|
- queryInfo.setCategoriesIdList(categoriesIdList);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void dealMusicScoreData(List<SysMusicScore> records){
|
|
private void dealMusicScoreData(List<SysMusicScore> records){
|
|
if (CollectionUtils.isNotEmpty(records)) {
|
|
if (CollectionUtils.isNotEmpty(records)) {
|
|
List<Long> cbsMusicSheetIds = records.stream().map(e -> e.getCbsMusicSheetId()).collect(Collectors.toList());
|
|
List<Long> cbsMusicSheetIds = records.stream().map(e -> e.getCbsMusicSheetId()).collect(Collectors.toList());
|
|
@@ -307,7 +285,8 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
@Override
|
|
@Override
|
|
public List<SysMusicScore> queryMusicScoreAll(SysExamSongQueryInfo queryInfo) {
|
|
public List<SysMusicScore> queryMusicScoreAll(SysExamSongQueryInfo queryInfo) {
|
|
//封装查询参数
|
|
//封装查询参数
|
|
- dealMusicScoreParam(queryInfo);
|
|
|
|
|
|
+ queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
|
|
|
|
+ this.initCategoryIds(queryInfo);
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
Map<String, Object> params = new HashMap<String, Object>();
|
|
MapUtil.populateMap(params, queryInfo);
|
|
MapUtil.populateMap(params, queryInfo);
|
|
|
|
|
|
@@ -320,7 +299,8 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
@Override
|
|
@Override
|
|
public PageInfo<SysMusicScore> queryMusicScorePage(SysExamSongQueryInfo queryInfo) {
|
|
public PageInfo<SysMusicScore> queryMusicScorePage(SysExamSongQueryInfo queryInfo) {
|
|
//封装查询参数
|
|
//封装查询参数
|
|
- dealMusicScoreParam(queryInfo);
|
|
|
|
|
|
+ queryInfo.setOrganId(organizationService.getEmployeeOrgan(queryInfo.getOrganId()));
|
|
|
|
+ this.initCategoryIds(queryInfo);
|
|
|
|
|
|
PageInfo<SysMusicScore> sysMusicScorePageInfo = queryPage(queryInfo);
|
|
PageInfo<SysMusicScore> sysMusicScorePageInfo = queryPage(queryInfo);
|
|
List<SysMusicScore> rows = sysMusicScorePageInfo.getRows();
|
|
List<SysMusicScore> rows = sysMusicScorePageInfo.getRows();
|
|
@@ -329,20 +309,14 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
return sysMusicScorePageInfo;
|
|
return sysMusicScorePageInfo;
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public PageInfo<SysMusicScore> queryMusicScorePageInfo(SysExamSongQueryInfo queryInfo) {
|
|
|
|
- if (queryInfo.getCategoriesId() != null) {
|
|
|
|
|
|
+ private void initCategoryIds(SysExamSongQueryInfo queryInfo){
|
|
|
|
+ if(StringUtils.isNotEmpty(queryInfo.getCategoriesId())){
|
|
List<Integer> categoriesIdList = new ArrayList<>();
|
|
List<Integer> categoriesIdList = new ArrayList<>();
|
|
- Integer categoriesId = null;
|
|
|
|
- if (StringUtils.isNotEmpty(queryInfo.getCategoriesId())) {
|
|
|
|
- categoriesId = Integer.parseInt(queryInfo.getCategoriesId());
|
|
|
|
- }
|
|
|
|
- //List<SysMusicScoreCategories> scoreCategories = sysMusicScoreCategoriesService.queryTree(musicScoreQueryInfo);
|
|
|
|
|
|
+ Integer categoriesId = Integer.parseInt(queryInfo.getCategoriesId());
|
|
|
|
|
|
SysMusicScoreCategories sysMusicScoreCategories = sysMusicScoreCategoriesService.get(categoriesId);
|
|
SysMusicScoreCategories sysMusicScoreCategories = sysMusicScoreCategoriesService.get(categoriesId);
|
|
|
|
|
|
- if (sysMusicScoreCategories == null) {
|
|
|
|
|
|
+ if(sysMusicScoreCategories == null){
|
|
throw new BizException("分类找不到");
|
|
throw new BizException("分类找不到");
|
|
}
|
|
}
|
|
categoriesIdList.add(categoriesId);
|
|
categoriesIdList.add(categoriesId);
|
|
@@ -350,12 +324,20 @@ public class SysMusicScoreServiceImpl extends BaseServiceImpl<Integer, SysMusicS
|
|
getAllCategoryIdList(categoriesIdList, sysMusicScoreCategories.getSysMusicScoreCategoriesList());
|
|
getAllCategoryIdList(categoriesIdList, sysMusicScoreCategories.getSysMusicScoreCategoriesList());
|
|
|
|
|
|
queryInfo.setCategoriesIdList(categoriesIdList);
|
|
queryInfo.setCategoriesIdList(categoriesIdList);
|
|
- }else {
|
|
|
|
- if(queryInfo.getCategoriesId() == null){
|
|
|
|
- return new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
- return this.queryPage(queryInfo);
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public PageInfo<SysMusicScore> queryMusicScorePageInfo(SysExamSongQueryInfo queryInfo) {
|
|
|
|
+ this.initCategoryIds(queryInfo);
|
|
|
|
+ if(CollectionUtils.isEmpty(queryInfo.getCategoriesIdList())){
|
|
|
|
+ return new PageInfo<>(queryInfo.getPage(), queryInfo.getRows());
|
|
|
|
+ }
|
|
|
|
+ PageInfo<SysMusicScore> pageInfo = this.queryPage(queryInfo);
|
|
|
|
+ List<SysMusicScore> rows = pageInfo.getRows();
|
|
|
|
+ dealMusicScoreData(rows);
|
|
|
|
+ return pageInfo;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|