|
@@ -105,7 +105,7 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public String create(AlbumInfoDto albumInfoDto) {
|
|
|
AlbumInfo albumInfo = new AlbumInfo();
|
|
|
- BeanUtils.copyProperties(albumInfoDto,albumInfo);
|
|
|
+ BeanUtils.copyProperties(albumInfoDto, albumInfo);
|
|
|
albumInfo.setPkId(IdGenerator.getIdStr());
|
|
|
String userId = userService.queryLoginUser();
|
|
|
// 获取当前登录人用户信息
|
|
@@ -157,16 +157,16 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
|
case "2":
|
|
|
//我的专辑
|
|
|
QueryWrapper<AlbumInfo> queryWrapper = new QueryWrapper<>();
|
|
|
- queryWrapper.eq("OWNER_ID",userService.queryLoginUser());
|
|
|
- queryWrapper.eq("STATE",1);
|
|
|
- queryWrapper.like(StringUtils.isNotEmpty((String) queryFilter.getParams().get("name")),"NAME",(String) queryFilter.getParams().get("name"));
|
|
|
+ queryWrapper.eq("OWNER_ID", userService.queryLoginUser());
|
|
|
+ queryWrapper.eq("STATE", 1);
|
|
|
+ queryWrapper.like(StringUtils.isNotEmpty((String) queryFilter.getParams().get("name")), "NAME", (String) queryFilter.getParams().get("name"));
|
|
|
queryWrapper.orderByDesc("CREATE_TIME_");
|
|
|
List<AlbumInfo> ownerIdsList = albumInfoMapper.selectList(queryWrapper);
|
|
|
//已发布的专辑
|
|
|
map.put("versionState", 2);
|
|
|
queryFilter.setParams(map);
|
|
|
List<AlbumInfo> albumInfoList = albumInfoMapper.findAllAlbumInfoByVersionState(queryFilter.getPage(), queryFilter.getParams(), params);
|
|
|
- if (albumInfoList != null){
|
|
|
+ if (albumInfoList != null) {
|
|
|
ownerIdsList.addAll(albumInfoList);
|
|
|
}
|
|
|
List<AlbumInfo> collect = ownerIdsList.stream().distinct().collect(Collectors.toList());
|
|
@@ -176,7 +176,7 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
|
case "3":
|
|
|
// TODO: 2023/2/3 我点评过的专辑
|
|
|
map.put("scope", 3);
|
|
|
- map.put("scope","3");
|
|
|
+ map.put("scope", "3");
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -189,10 +189,11 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
|
|
|
|
/**
|
|
|
* 分页方法封装
|
|
|
+ *
|
|
|
* @param collect
|
|
|
* @return
|
|
|
*/
|
|
|
- private List<AlbumInfoVo> pageInfo(List<AlbumInfo> collect){
|
|
|
+ private List<AlbumInfoVo> pageInfo(List<AlbumInfo> collect) {
|
|
|
String userId = userService.queryLoginUser();
|
|
|
List<AlbumInfoVo> albumInfoVoList = collect.parallelStream().map(e -> {
|
|
|
AlbumInfoVo albumInfoVo = new AlbumInfoVo();
|
|
@@ -276,9 +277,9 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
|
}
|
|
|
//动作标记PC端
|
|
|
List<String> actionFlag = new ArrayList<>();
|
|
|
- if (albumVersions.get(0).getState() == 2 && e.getOwnerId().equals(userId)){
|
|
|
+ if (albumVersions.get(0).getState() == 2 && e.getOwnerId().equals(userId)) {
|
|
|
actionFlag.add("edit");
|
|
|
- } else if(albumVersions.get(0).getState() == 4 && e.getOwnerId().equals(userId)){
|
|
|
+ } else if (albumVersions.get(0).getState() == 4 && e.getOwnerId().equals(userId)) {
|
|
|
actionFlag.add("delete");
|
|
|
actionFlag.add("edit");
|
|
|
}
|
|
@@ -730,6 +731,7 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
|
|
|
|
/**
|
|
|
* 删除知识专辑
|
|
|
+ *
|
|
|
* @param ids
|
|
|
* @return
|
|
|
*/
|
|
@@ -752,4 +754,48 @@ public class AlbumInfoServiceImpl extends SuperServiceImpl<AlbumInfoMapper, Albu
|
|
|
albumYelpApproveService.deleteByAlbumId(ids);
|
|
|
return AlbumConst.DEL_SUCCESS;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 移除目录知识和删除点评和回复
|
|
|
+ *
|
|
|
+ * @param removeKnowledgeAndYelpDto
|
|
|
+ */
|
|
|
+ public void removeKnowledgeAndYelp(RemoveKnowledgeAndYelpDto removeKnowledgeAndYelpDto) {
|
|
|
+ //删除点评记录(如果是一级点评,则对应的回复一起删除)
|
|
|
+ if (CollectionUtils.isNotEmpty(removeKnowledgeAndYelpDto.getYelps())) {
|
|
|
+ List<String> yelps = removeKnowledgeAndYelpDto.getYelps();
|
|
|
+ yelps.stream().forEach(yelp -> {
|
|
|
+ //一级点评
|
|
|
+ AlbumYelp albumYelp = albumYelpService.get(yelp);
|
|
|
+ if (albumYelp.getType() == 1) {
|
|
|
+ //查询下级回复记录
|
|
|
+ List<AlbumYelp> albumYelpList = albumYelpService.findAll(new LambdaQueryWrapper<AlbumYelp>().
|
|
|
+ eq(AlbumYelp::getYelpId, yelp));
|
|
|
+ //收集Id
|
|
|
+ List<String> idList = albumYelpList.parallelStream().map(AlbumYelp::getPkId).collect(Collectors.toList());
|
|
|
+ //清除下级回复
|
|
|
+ albumYelpService.deleteByYelpId(yelp);
|
|
|
+ //清除自己
|
|
|
+ albumYelpService.deleteById(yelp);
|
|
|
+ //清除审批记录表
|
|
|
+ idList.add(yelp);
|
|
|
+ albumYelpApproveService.deleteByYelpId(idList);
|
|
|
+ } else {
|
|
|
+ //清除自己
|
|
|
+ albumYelpService.deleteById(yelp);
|
|
|
+ //清除审批记录表
|
|
|
+ List<String> ids = new ArrayList<>();
|
|
|
+ ids.add(yelp);
|
|
|
+ albumYelpApproveService.deleteByYelpId(ids);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ //清除目录表中知识
|
|
|
+ Map<String, List<String>> catalogueIdAndKnowledgeList = removeKnowledgeAndYelpDto.getCatalogueIdAndKnowledgeList();
|
|
|
+ if (catalogueIdAndKnowledgeList != null) {
|
|
|
+ catalogueIdAndKnowledgeList.forEach((k, v) ->
|
|
|
+ albumCatalogueKnowledgeMapper.deleteByCatalogueIds(k, v)
|
|
|
+ );
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|