|
@@ -158,7 +158,7 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
//查询我的专辑
|
|
//查询我的专辑
|
|
IPage page1 = albumInfoMapper.findAllAlbumInfoByOwnerIds(queryFilter.getPage(), queryFilter.getParams(), params);
|
|
IPage page1 = albumInfoMapper.findAllAlbumInfoByOwnerIds(queryFilter.getPage(), queryFilter.getParams(), params);
|
|
List<AlbumInfo> records = page1.getRecords();
|
|
List<AlbumInfo> records = page1.getRecords();
|
|
- List<AlbumInfoVo> albumInfoVoList = pageInfo(records);
|
|
|
|
|
|
+ List<AlbumInfoVo> albumInfoVoList = pageInfo(records,null);
|
|
page1.setRecords(albumInfoVoList);
|
|
page1.setRecords(albumInfoVoList);
|
|
return page1;
|
|
return page1;
|
|
case "2":
|
|
case "2":
|
|
@@ -174,7 +174,7 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
List<AlbumInfo> collect = ownerIdsList.stream().distinct().collect(Collectors.toList());
|
|
List<AlbumInfo> collect = ownerIdsList.stream().distinct().collect(Collectors.toList());
|
|
Page page2 = PageListUtils.getPages(queryFilter.getPage().getCurrent(), queryFilter.getPage().getSize(), collect);
|
|
Page page2 = PageListUtils.getPages(queryFilter.getPage().getCurrent(), queryFilter.getPage().getSize(), collect);
|
|
List<AlbumInfo> recordslist = page2.getRecords();
|
|
List<AlbumInfo> recordslist = page2.getRecords();
|
|
- List<AlbumInfoVo> albumInfoVoListResult = pageInfo(recordslist);
|
|
|
|
|
|
+ List<AlbumInfoVo> albumInfoVoListResult = pageInfo(recordslist,null);
|
|
albumInfoVoListResult.stream().filter(e -> !e.getOwnerId().equals(userId)).forEach(h -> h.setVersionState(2));
|
|
albumInfoVoListResult.stream().filter(e -> !e.getOwnerId().equals(userId)).forEach(h -> h.setVersionState(2));
|
|
page2.setRecords(albumInfoVoListResult);
|
|
page2.setRecords(albumInfoVoListResult);
|
|
return page2;
|
|
return page2;
|
|
@@ -183,7 +183,7 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
queryFilter.getParams().put("userId", userService.queryLoginUser());
|
|
queryFilter.getParams().put("userId", userService.queryLoginUser());
|
|
IPage page3 = albumInfoMapper.findAllAlbumInfoYelpByUserId(queryFilter.getPage(), queryFilter.getParams(), params);
|
|
IPage page3 = albumInfoMapper.findAllAlbumInfoYelpByUserId(queryFilter.getPage(), queryFilter.getParams(), params);
|
|
List<AlbumInfo> result = page3.getRecords();
|
|
List<AlbumInfo> result = page3.getRecords();
|
|
- List<AlbumInfoVo> albumInfoVoList3 = pageInfo(result);
|
|
|
|
|
|
+ List<AlbumInfoVo> albumInfoVoList3 = pageInfo(result,null);
|
|
//不是我创建的专辑(状态设置为2 已发布)
|
|
//不是我创建的专辑(状态设置为2 已发布)
|
|
albumInfoVoList3.stream().filter(e -> !e.getOwnerId().equals(userId)).forEach(h -> {
|
|
albumInfoVoList3.stream().filter(e -> !e.getOwnerId().equals(userId)).forEach(h -> {
|
|
h.setVersionState(2);
|
|
h.setVersionState(2);
|
|
@@ -193,31 +193,11 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
return page3;
|
|
return page3;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- List<AlbumInfo> collect = albumInfoMapper.findAllAlbumInfo(queryFilter.getParams(), params);
|
|
|
|
- //List<AlbumInfo> collect = page.getRecords();
|
|
|
|
- List<AlbumInfoVo> albumInfoVoList = pageInfo(collect);
|
|
|
|
- if (queryFilter.getParams().containsKey("state")){
|
|
|
|
- switch ((String) queryFilter.getParams().get("state")){
|
|
|
|
- case "0":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().filter(e -> e.getState() == 0).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "1":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().filter(e -> e.getVersionState() == 1).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "2":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().filter(e -> e.getVersionState() == 2).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "4":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().filter(e -> e.getVersionState() == 4).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- //排序
|
|
|
|
- if (StringUtils.isNotEmpty((String) queryFilter.getParams().get("orderBySql"))){
|
|
|
|
- albumInfoVoList = albumInfoSort((String) queryFilter.getParams().get("orderBySql"),albumInfoVoList);
|
|
|
|
- }
|
|
|
|
- //page.setRecords(albumInfoVoList);
|
|
|
|
- return PageListUtils.getPages(queryFilter.getPage().getCurrent(), queryFilter.getPage().getSize(),albumInfoVoList);
|
|
|
|
|
|
+ IPage page = albumInfoMapper.findAllAlbumInfo(queryFilter.getPage(),queryFilter.getParams(), queryFilter.getSortSql());
|
|
|
|
+ List<AlbumInfo> collect = page.getRecords();
|
|
|
|
+ List<AlbumInfoVo> albumInfoVoList = pageInfo(collect,"manager");
|
|
|
|
+ page.setRecords(albumInfoVoList);
|
|
|
|
+ return page;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -226,7 +206,7 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
* @param collect
|
|
* @param collect
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- private List<AlbumInfoVo> pageInfo(List<AlbumInfo> collect) {
|
|
|
|
|
|
+ private List<AlbumInfoVo> pageInfo(List<AlbumInfo> collect,String manager) {
|
|
String userId = userService.queryLoginUser();
|
|
String userId = userService.queryLoginUser();
|
|
List<AlbumInfoVo> albumInfoVoList = collect.parallelStream().map(e -> {
|
|
List<AlbumInfoVo> albumInfoVoList = collect.parallelStream().map(e -> {
|
|
AlbumInfoVo albumInfoVo = new AlbumInfoVo();
|
|
AlbumInfoVo albumInfoVo = new AlbumInfoVo();
|
|
@@ -245,38 +225,42 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
}, threadPoolExecutor);
|
|
}, threadPoolExecutor);
|
|
//专辑收录知识量(当前生效版本各个目录中知识数量总和)
|
|
//专辑收录知识量(当前生效版本各个目录中知识数量总和)
|
|
CompletableFuture<Void> countKnowledgeCompletableFuture = CompletableFuture.runAsync(() -> {
|
|
CompletableFuture<Void> countKnowledgeCompletableFuture = CompletableFuture.runAsync(() -> {
|
|
- AlbumVersion albumVersion = albumVersionMapper.
|
|
|
|
- selectOne(new LambdaQueryWrapper<AlbumVersion>().
|
|
|
|
- eq(AlbumVersion::getAlbumId, e.getPkId()).
|
|
|
|
- eq(AlbumVersion::getState, 2));
|
|
|
|
- //没有生效的专辑(第一次创建专辑时的情况)
|
|
|
|
- if (albumVersion == null) {
|
|
|
|
- AlbumVersion albumVersionFirst = albumVersionMapper.
|
|
|
|
|
|
+ if (manager == null) {
|
|
|
|
+ AlbumVersion albumVersion = albumVersionMapper.
|
|
selectOne(new LambdaQueryWrapper<AlbumVersion>().
|
|
selectOne(new LambdaQueryWrapper<AlbumVersion>().
|
|
eq(AlbumVersion::getAlbumId, e.getPkId()).
|
|
eq(AlbumVersion::getAlbumId, e.getPkId()).
|
|
- eq(AlbumVersion::getState, 1));
|
|
|
|
- if (albumVersionFirst == null) {
|
|
|
|
- AlbumVersion albumVersionFour = albumVersionMapper.
|
|
|
|
|
|
+ eq(AlbumVersion::getState, 2));
|
|
|
|
+ //没有生效的专辑(第一次创建专辑时的情况)
|
|
|
|
+ if (albumVersion == null) {
|
|
|
|
+ AlbumVersion albumVersionFirst = albumVersionMapper.
|
|
selectOne(new LambdaQueryWrapper<AlbumVersion>().
|
|
selectOne(new LambdaQueryWrapper<AlbumVersion>().
|
|
eq(AlbumVersion::getAlbumId, e.getPkId()).
|
|
eq(AlbumVersion::getAlbumId, e.getPkId()).
|
|
- eq(AlbumVersion::getState, 4));
|
|
|
|
- Integer countKnowledge = albumInfoMapper.selectCountKnowledge(e.getPkId(), albumVersionFour.getPkId());
|
|
|
|
- albumInfoVo.setKnowledgeTotal(countKnowledge);
|
|
|
|
|
|
+ eq(AlbumVersion::getState, 1));
|
|
|
|
+ if (albumVersionFirst == null) {
|
|
|
|
+ AlbumVersion albumVersionFour = albumVersionMapper.
|
|
|
|
+ selectOne(new LambdaQueryWrapper<AlbumVersion>().
|
|
|
|
+ eq(AlbumVersion::getAlbumId, e.getPkId()).
|
|
|
|
+ eq(AlbumVersion::getState, 4));
|
|
|
|
+ Integer countKnowledge = albumInfoMapper.selectCountKnowledge(e.getPkId(), albumVersionFour.getPkId());
|
|
|
|
+ albumInfoVo.setKnowledgeTotal(countKnowledge);
|
|
|
|
+ } else {
|
|
|
|
+ Integer countKnowledge = albumInfoMapper.selectCountKnowledge(e.getPkId(), albumVersionFirst.getPkId());
|
|
|
|
+ albumInfoVo.setKnowledgeTotal(countKnowledge);
|
|
|
|
+ }
|
|
} else {
|
|
} else {
|
|
- Integer countKnowledge = albumInfoMapper.selectCountKnowledge(e.getPkId(), albumVersionFirst.getPkId());
|
|
|
|
|
|
+ Integer countKnowledge = albumInfoMapper.selectCountKnowledge(e.getPkId(), albumVersion.getPkId());
|
|
albumInfoVo.setKnowledgeTotal(countKnowledge);
|
|
albumInfoVo.setKnowledgeTotal(countKnowledge);
|
|
}
|
|
}
|
|
- } else {
|
|
|
|
- Integer countKnowledge = albumInfoMapper.selectCountKnowledge(e.getPkId(), albumVersion.getPkId());
|
|
|
|
- albumInfoVo.setKnowledgeTotal(countKnowledge);
|
|
|
|
}
|
|
}
|
|
}, threadPoolExecutor);
|
|
}, threadPoolExecutor);
|
|
//专辑点评量(当前专辑中通过审核的点评量总和)
|
|
//专辑点评量(当前专辑中通过审核的点评量总和)
|
|
CompletableFuture<Void> countYelpCompletableFuture = CompletableFuture.runAsync(() -> {
|
|
CompletableFuture<Void> countYelpCompletableFuture = CompletableFuture.runAsync(() -> {
|
|
- Integer countYelp = albumYelpMapper.selectCount(new LambdaQueryWrapper<AlbumYelp>().
|
|
|
|
- eq(AlbumYelp::getAlbumId, e.getPkId()).
|
|
|
|
- eq(AlbumYelp::getState, 1));
|
|
|
|
- albumInfoVo.setYelpTotal(countYelp);
|
|
|
|
|
|
+ if (manager == null) {
|
|
|
|
+ Integer countYelp = albumYelpMapper.selectCount(new LambdaQueryWrapper<AlbumYelp>().
|
|
|
|
+ eq(AlbumYelp::getAlbumId, e.getPkId()).
|
|
|
|
+ eq(AlbumYelp::getState, 1));
|
|
|
|
+ albumInfoVo.setYelpTotal(countYelp);
|
|
|
|
+ }
|
|
}, threadPoolExecutor);
|
|
}, threadPoolExecutor);
|
|
//其他参数
|
|
//其他参数
|
|
CompletableFuture<Void> anotherCompletableFuture = CompletableFuture.runAsync(() -> {
|
|
CompletableFuture<Void> anotherCompletableFuture = CompletableFuture.runAsync(() -> {
|
|
@@ -329,42 +313,6 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
return albumInfoVoList;
|
|
return albumInfoVoList;
|
|
}
|
|
}
|
|
|
|
|
|
- private List<AlbumInfoVo> albumInfoSort(String sort,List<AlbumInfoVo> albumInfoVoList){
|
|
|
|
- switch (sort) {
|
|
|
|
- case "knowledgeTotal desc":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().sorted((t1, t2) -> t2.getKnowledgeTotal().compareTo(t1.getKnowledgeTotal())).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "knowledgeTotal asc":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().sorted(Comparator.comparing(AlbumInfoVo::getKnowledgeTotal)).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "yelpTotal desc":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().sorted((t1, t2) -> t2.getYelpTotal().compareTo(t1.getYelpTotal())).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "yelpTotal asc":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().sorted(Comparator.comparing(AlbumInfoVo::getYelpTotal)).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "views desc":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().sorted((t1, t2) -> t2.getViews().compareTo(t1.getViews())).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "views asc":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().sorted(Comparator.comparing(AlbumInfoVo::getViews)).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "createTime desc":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().sorted((t1, t2) -> t2.getCreateTime().compareTo(t1.getCreateTime())).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "createTime asc":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().sorted(Comparator.comparing(AlbumInfoVo::getCreateTime)).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "updateTime desc":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().sorted((t1, t2) -> t2.getUpdateTime().compareTo(t1.getUpdateTime())).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- case "updateTime asc":
|
|
|
|
- albumInfoVoList = albumInfoVoList.stream().sorted(Comparator.comparing(AlbumInfoVo::getUpdateTime)).collect(Collectors.toList());
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- return albumInfoVoList;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
* 专辑详情
|
|
* 专辑详情
|
|
*
|
|
*
|