优化代码结构

This commit is contained in:
ajaxfan
2021-04-09 17:53:43 +08:00
parent 36855664a2
commit 88fa5eb9d5
2 changed files with 4 additions and 5 deletions

View File

@ -128,7 +128,7 @@ public class DefaultAttachmentClient implements AttachmentClient {
// 创建压缩文件流
createCompressionStream(list, out);
return Optional.ofNullable(out.toByteArray());
return Optional.of(out.toByteArray());
} catch (IOException e) {
log.error(e.getMessage());
}
@ -177,8 +177,8 @@ public class DefaultAttachmentClient implements AttachmentClient {
// 创建压缩文件流
createCompressionStream(list, out);
return Optional.ofNullable(new DownloadEntity()
.setFilename(String.format("%s.zip", UUID.randomUUID())).setStream(out.toByteArray()));
return Optional.of(new DownloadEntity().setFilename(String.format("%s.zip", UUID.randomUUID()))
.setStream(out.toByteArray()));
} catch (IOException e) {
log.error(e.getMessage());
}