Commit 43a36f38 authored by jiawei's avatar jiawei

修改展板审核时,可以删除视频。

删除音频文件提交审核,报500错误
parent b4b0c3d9
......@@ -23,6 +23,7 @@ import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Consumer;
import java.util.stream.Collectors;
......@@ -393,7 +394,8 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
assetQueryWrapper.eq(Asset::getFileCat, FileCatEnum.EXHIBITION_BOARD_AUDIO.name());
assetQueryWrapper.eq(Asset::getPublished, true);
final List<Asset> assetList = this.assetMapper.selectList(assetQueryWrapper);
final Map<String, String> collect = assetList.stream().collect(Collectors.toMap(Asset::getId, Asset::getFileUrl));
// final Map<String, String> collect = assetList.stream().collect(Collectors.toMap(Asset::getId, Asset::getFileUrl));
final Set<String> collect = assetList.stream().map(Asset::getId).collect(Collectors.toSet());
for (String audioId : audioIdList) {
final Asset asset = this.assetMapper.selectById(audioId);
asset.setFileType(FileTypeEnum.AUDIO.name());
......@@ -406,7 +408,8 @@ public class AuditServiceImpl extends ServiceImpl<AuditMapper, Audit> implements
}
}
if (!collect.isEmpty()) {
this.assetMapper.deleteBatchIds(collect.keySet());
this.assetMapper.deleteBatchIds(collect);
// this.assetMapper.deleteBatchIds(collect.keySet());
}
}
final List<String> datumIdList = one.getDatumIdList();
......
......@@ -13,6 +13,7 @@ import cn.chnmuseum.party.service.*;
import cn.chnmuseum.party.web.controller.base.BaseController;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
......@@ -153,6 +154,9 @@ public class ExhibitionBoardController extends BaseController {
if (datumIdList == null || datumIdList.isEmpty()) {
return getFailResult("400", "参考资料文件必须上传");
}
//
removeNotInIds(audioIdList,exhibitionBoard.getId());
for (String audioId : audioIdList) {
final Asset asset = this.assetService.getById(audioId);
if (asset.getPublished()) {
......@@ -162,6 +166,9 @@ public class ExhibitionBoardController extends BaseController {
this.assetService.updateById(asset);
}
}
//
removeNotInIds(audioIdList,exhibitionBoard.getId());
for (String datumId : datumIdList) {
final Asset asset = this.assetService.getById(datumId);
if (asset.getPublished()) {
......@@ -194,6 +201,18 @@ public class ExhibitionBoardController extends BaseController {
return getSuccessResult();
}
/**
* 修改展板时,不在这个id集合李淼的 代表是要删除的
*
* @param assetIds
*/
public void removeNotInIds(List<String> assetIds,String refItemId) {
LambdaQueryWrapper<Asset> assetWrapper = new QueryWrapper<Asset>().lambda()
.eq(Asset::getRefItemId, refItemId)
.notIn(Asset::getId, assetIds);
boolean remove = assetService.remove(assetWrapper);
}
@PostMapping("/getList")
@RequiresAuthentication //@RequiresPermissions("exhibition:board:list")
@ApiOperation(value = "获取展板全部列表(无分页)", notes = "获取展板全部列表(无分页)")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment