优化代码结构
This commit is contained in:
@ -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());
|
||||
}
|
||||
|
Reference in New Issue
Block a user