use of com.whoiszxl.cqrs.command.FileDeleteCommand in project shopzz by whoiszxl.
the class AbstractFileStrategy method delete.
@Override
public boolean delete(List<FileDeleteCommand> commandList) {
if (commandList.isEmpty()) {
return true;
}
boolean flag = false;
for (FileDeleteCommand fileDeleteCommand : commandList) {
try {
delete(fileDeleteCommand);
flag = true;
} catch (Exception e) {
log.error("删除文件失败", e);
}
}
return flag;
}
use of com.whoiszxl.cqrs.command.FileDeleteCommand in project shopzz by whoiszxl.
the class FileServiceImpl method delete.
@Override
public void delete(Long[] ids) {
if (ArrayUtils.isEmpty(ids)) {
ExceptionCatcher.catchValidateEx(ResponseResult.buildError("传参无效"));
}
List<FmsFile> fileList = list(Wrappers.<FmsFile>lambdaQuery().in(FmsFile::getId, ids));
if (fileList.isEmpty()) {
ExceptionCatcher.catchValidateEx(ResponseResult.buildError("传参无效"));
}
removeByIds(Arrays.asList(ids));
List<FileDeleteCommand> fileDeleteCommandList = fileList.stream().map(file -> {
FileDeleteCommand deleteCommand = new FileDeleteCommand();
deleteCommand.setRelativePath(file.getRelativePath());
deleteCommand.setFinalFileName(file.getFinalFileName());
deleteCommand.setId(file.getId());
return deleteCommand;
}).collect(Collectors.toList());
fileStrategy.delete(fileDeleteCommandList);
}
Aggregations