Skip to content
This repository was archived by the owner on Jul 1, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 5 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,14 @@

   依赖[rice-toolkit](https://github.com/NicheToolkit/rice-toolkit/rice-toolkit-starter)组件下的基于[postgresql](https://www.postgresql.org/)数据库环境下的简单业务通用服务开发组件.

## Release介绍

- [File-Toolkit@1.0.3](https://github.com/NicheToolkit/file-toolkit/tree/master/release/1.0.3.md)

### v1.0.3 Release

1、修复`minio`依赖`okhttp3`版本为`4.8.1`。

2、升级`spring boot`版本至`2.6.6`版本。

3、优化文件上传异步处理,加快文件上传接口响应。

4、拆分`MinioUtils`工具至单独模块`file-toolkit-minio-utils`。

5、拆分文件模型定义相关`FileChunk`、`FileIndex`至单独模块`file-toolkit-common-starter`。

# [file-toolkit-test-web](https://github.com/NicheToolkit/file-toolkit/tree/master/file-toolkit-test-web)

[logback-spring.xml](https://github.com/NicheToolkit/file-toolkit/blob/master/file-toolkit-test-web/src/main/resources/logback-spring.xml)
默认日志配置文件调整,新增`LOGS_FILE`所有日志的到`./logs.log`文件的输出,方便同一个`Tomcat`服务器下部署多个`War`包时,查看单个服务的日志混乱的问题。

**Full Changelog**: https://github.com/NicheToolkit/file-toolkit/compare/v1.0.2...v1.0.3

## Maven Central

- [Maven Central Repository](https://search.maven.org/search?q=io.github.nichetoolkit)

- [Sonatype Central Repository](https://central.sonatype.dev/search?q=io.github.nichetoolkit)

## 依赖环境
> [Spring Boot](https://spring.io/projects/spring-boot) 2.6.6.RELEASE\
> [Spring Boot](https://spring.io/projects/spring-boot) 2.7.7.RELEASE\
> [Maven](https://maven.apache.org/) 3.6.0+\
> [JDK](https://www.oracle.com/java/technologies/downloads/#java8) 1.8\
> [PostgreSQL](https://www.postgresql.org/) 10.0+
Expand All @@ -49,7 +26,7 @@
<dependency>
<groupId>io.github.nichetoolkit</groupId>
<artifactId>file-toolkit-common-starter</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</dependency>
```

Expand All @@ -59,7 +36,7 @@
<dependency>
<groupId>io.github.nichetoolkit</groupId>
<artifactId>file-toolkit-service-starter</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</dependency>
```

Expand All @@ -69,7 +46,7 @@
<dependency>
<groupId>io.github.nichetoolkit</groupId>
<artifactId>file-toolkit-minio-starter</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</dependency>
```

Expand All @@ -79,7 +56,7 @@
<dependency>
<groupId>io.github.nichetoolkit</groupId>
<artifactId>file-toolkit-minio-utils</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</dependency>
```

Expand Down
8 changes: 4 additions & 4 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| Spring boot 2.6.6+ | :white_check_mark: |
| < 2.6.6 | :x: |
| Spring boot 2.7.7+ | :white_check_mark: |
| < 2.7.7 | :x: |
| Maven 3.6.0+ | :white_check_mark: |
| < 3.6.0 | :x: |
| JDK 1.8 | :white_check_mark: | |
| Rice-Toolkit 1.0.4+ | :white_check_mark: |
| < 1.0.4 | :x:
| Rice-Toolkit 1.0.5+ | :white_check_mark: |
| < 1.0.5 | :x:
## Reporting a Vulnerability

Use this section to tell people how to report a vulnerability.
Expand Down
4 changes: 2 additions & 2 deletions file-toolkit-common-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
<parent>
<groupId>io.github.nichetoolkit</groupId>
<artifactId>file-toolkit-parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

<artifactId>file-toolkit-common-starter</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<name>file-toolkit-common-starter</name>
<description>File toolkit common starter project for Spring Boot</description>
<properties>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package io.github.nichetoolkit.file.service;
package io.github.nichetoolkit.file.handle;

import io.github.nichetoolkit.rest.RestException;
import org.springframework.scheduling.annotation.Async;
Expand All @@ -8,11 +8,11 @@
import java.util.List;

/**
* <p>AsyncFileService</p>
* <p>FileStoreService</p>
* @author Cyan (snow22314@outlook.com)
* @version v1.0.0
*/
public abstract class AsyncFileService {
public abstract class FileStoreService {
@Async
abstract public void removeAll(List<String> fileIdList) throws RestException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @author Cyan (snow22314@outlook.com)
* @version v1.0.0
*/
public class ImageHelper {
public class ImageHandleHelper {

public static void write(BufferedImage bufferedImage, OutputStream outputStream) throws ImageWriteException {
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@
import lombok.EqualsAndHashCode;
import okhttp3.Headers;
import org.springframework.lang.NonNull;
import org.springframework.web.multipart.MultipartFile;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -111,7 +108,7 @@ public class FileIndex extends RiceInfoModel<FileIndex, FileIndexEntity> {
protected byte[] bytes;

@JsonIgnore
protected MultipartFile file;
protected File file;

public FileIndex() {
}
Expand All @@ -126,7 +123,7 @@ public InputStream inputStream() {
return new ByteArrayInputStream(this.bytes);
} else if (GeneralUtils.isNotEmpty(this.file)) {
try {
return this.file.getInputStream();
return new FileInputStream(this.file);
} catch (IOException ignored) {
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
import io.github.nichetoolkit.file.error.ImageReadException;
import io.github.nichetoolkit.file.error.ImageTransferException;
import io.github.nichetoolkit.file.error.ImageWriteException;
import io.github.nichetoolkit.file.helper.ImageHelper;
import io.github.nichetoolkit.file.helper.ImageHandleHelper;
import io.github.nichetoolkit.rest.util.GeneralUtils;
import io.github.nichetoolkit.rest.util.StreamUtils;
import lombok.extern.slf4j.Slf4j;
import net.coobird.thumbnailator.Thumbnails;

import javax.imageio.ImageIO;
import javax.swing.*;
import java.awt.*;
import java.awt.image.BufferedImage;
Expand All @@ -31,7 +30,7 @@ public class ImageUtils {

public static void write(BufferedImage bufferedImage, OutputStream outputStream) {
try {
ImageHelper.write(bufferedImage, outputStream);
ImageHandleHelper.write(bufferedImage, outputStream);
} catch (ImageWriteException exception) {
log.error("An error occurred during bufferedImage to write as outputStream!", exception);
exception.printStackTrace();
Expand All @@ -40,7 +39,7 @@ public static void write(BufferedImage bufferedImage, OutputStream outputStream)

public static void write(BufferedImage bufferedImage, String imagePath) {
try {
ImageHelper.write(bufferedImage, imagePath);
ImageHandleHelper.write(bufferedImage, imagePath);
} catch (ImageWriteException exception) {
log.error("An error occurred during bufferedImage to write as file!", exception);
exception.printStackTrace();
Expand All @@ -49,7 +48,7 @@ public static void write(BufferedImage bufferedImage, String imagePath) {

public static void write(BufferedImage bufferedImage, File file) {
try {
ImageHelper.write(bufferedImage, "png", file);
ImageHandleHelper.write(bufferedImage, "png", file);
} catch (ImageWriteException exception) {
log.error("An error occurred during bufferedImage to write as file!", exception);
exception.printStackTrace();
Expand All @@ -59,7 +58,7 @@ public static void write(BufferedImage bufferedImage, File file) {

public static void write(BufferedImage bufferedImage, String formatName, OutputStream outputStream) {
try {
ImageHelper.write(bufferedImage, formatName, outputStream);
ImageHandleHelper.write(bufferedImage, formatName, outputStream);
} catch (ImageWriteException exception) {
log.error("An error occurred during bufferedImage to write as outputStream!", exception);
exception.printStackTrace();
Expand All @@ -68,7 +67,7 @@ public static void write(BufferedImage bufferedImage, String formatName, OutputS

public static void write(BufferedImage bufferedImage, String formatName, String imagePath) {
try {
ImageHelper.write(bufferedImage, formatName, new File(imagePath));
ImageHandleHelper.write(bufferedImage, formatName, new File(imagePath));
} catch (ImageWriteException exception) {
log.error("An error occurred during bufferedImage to write as file!", exception);
exception.printStackTrace();
Expand All @@ -77,7 +76,7 @@ public static void write(BufferedImage bufferedImage, String formatName, String

public static void write(BufferedImage bufferedImage, String formatName, File file) {
try {
ImageHelper.write(bufferedImage, formatName, file);
ImageHandleHelper.write(bufferedImage, formatName, file);
} catch (ImageWriteException exception) {
log.error("An error occurred during bufferedImage to read as file!", exception);
exception.printStackTrace();
Expand All @@ -86,7 +85,7 @@ public static void write(BufferedImage bufferedImage, String formatName, File fi

public static BufferedImage read(InputStream inputStream) {
try {
return ImageHelper.read(inputStream);
return ImageHandleHelper.read(inputStream);
} catch (ImageReadException exception) {
log.error("An error occurred during inputStream to read as BufferedImage!", exception);
exception.printStackTrace();
Expand All @@ -96,7 +95,7 @@ public static BufferedImage read(InputStream inputStream) {

public static BufferedImage read(String imagePath) {
try {
return ImageHelper.read(imagePath);
return ImageHandleHelper.read(imagePath);
} catch (ImageReadException exception) {
log.error("An error occurred during file to read as BufferedImage!", exception);
exception.printStackTrace();
Expand All @@ -107,7 +106,7 @@ public static BufferedImage read(String imagePath) {

public static BufferedImage read(File file) {
try {
return ImageHelper.read(file);
return ImageHandleHelper.read(file);
} catch (ImageReadException exception) {
log.error("An error occurred during file to write as BufferedImage!", exception);
exception.printStackTrace();
Expand All @@ -117,7 +116,7 @@ public static BufferedImage read(File file) {

public static InputStream inputStream(BufferedImage bufferedImage) {
try {
return ImageHelper.inputStream(bufferedImage);
return ImageHandleHelper.inputStream(bufferedImage);
} catch (ImageTransferException exception) {
log.error("An error occurred during bufferedImage to transfer as inputStream!", exception);
exception.printStackTrace();
Expand All @@ -127,7 +126,7 @@ public static InputStream inputStream(BufferedImage bufferedImage) {

public static byte[] bytes(BufferedImage bufferedImage) {
try {
return ImageHelper.bytes(bufferedImage);
return ImageHandleHelper.bytes(bufferedImage);
} catch (ImageTransferException exception) {
log.error("An error occurred during bufferedImage to transfer as inputStream!", exception);
exception.printStackTrace();
Expand Down
Loading