mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-08 12:39:05 +08:00
Merge remote-tracking branch 'gitee/jdk8-dev' into jdk8-dev
This commit is contained in:
commit
c8f076eb6d
60 files changed
+319
-298
No files matched your search
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-app-server</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-app-server-api</artifactId>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-app-server</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-app-server-biz</artifactId>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-app-server</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-auth</artifactId>
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-boot</artifactId>
|
||||
|
||||
-1
@@ -36,7 +36,6 @@ import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.security.authentication.AuthenticationManager;
|
||||
import org.springframework.security.config.Customizer;
|
||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||
import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer;
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-audit</artifactId>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<description>pigx 公共版本控制,在此pom定义的依赖,全局业务微服务不需要指定版本。</description>
|
||||
|
||||
<properties>
|
||||
<pigx.version>5.7.0</pigx.version>
|
||||
<pigx.version>5.8.0</pigx.version>
|
||||
<mybatis-plus.version>3.5.10.1</mybatis-plus.version>
|
||||
<mybatis-plus-join.version>1.5.2</mybatis-plus-join.version>
|
||||
<dynamic-ds.version>4.3.1</dynamic-ds.version>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-core</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-data</artifactId>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-encrypt-api</artifactId>
|
||||
|
||||
+11
-9
@@ -23,6 +23,7 @@ import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
|
||||
@@ -38,15 +39,16 @@ import java.util.function.Function;
|
||||
@UtilityClass
|
||||
public class ApiCryptoUtil {
|
||||
|
||||
/**
|
||||
* 密钥提取器
|
||||
*/
|
||||
public static final Map<EncryptType, Function<ApiEncryptProperties, String>> KEY_EXTRACTORS = Map.of(
|
||||
EncryptType.AES, ApiEncryptProperties::getAesKey,
|
||||
EncryptType.RSA, ApiEncryptProperties::getRsaPrivateKey,
|
||||
EncryptType.DES, ApiEncryptProperties::getDesKey,
|
||||
EncryptType.SM4, ApiEncryptProperties::getSm4Key
|
||||
);
|
||||
public static final Map<EncryptType, Function<ApiEncryptProperties, String>> KEY_EXTRACTORS;
|
||||
|
||||
static {
|
||||
Map<EncryptType, Function<ApiEncryptProperties, String>> map = new HashMap<>();
|
||||
map.put(EncryptType.AES, ApiEncryptProperties::getAesKey);
|
||||
map.put(EncryptType.RSA, ApiEncryptProperties::getRsaPrivateKey);
|
||||
map.put(EncryptType.DES, ApiEncryptProperties::getDesKey);
|
||||
map.put(EncryptType.SM4, ApiEncryptProperties::getSm4Key);
|
||||
KEY_EXTRACTORS = map;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-excel</artifactId>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-gateway</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-gray</artifactId>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-idempotent</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-job</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-log</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-oss</artifactId>
|
||||
|
||||
+39
-34
@@ -35,46 +35,51 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
@ConfigurationProperties(prefix = "oss")
|
||||
public class OssProperties {
|
||||
|
||||
/**
|
||||
* 对象存储服务的URL
|
||||
*/
|
||||
private String endpoint;
|
||||
/**
|
||||
* 对象存储服务的URL
|
||||
*/
|
||||
private String endpoint;
|
||||
|
||||
/**
|
||||
* 自定义域名
|
||||
*/
|
||||
private String customDomain;
|
||||
/**
|
||||
* 自定义域名
|
||||
*/
|
||||
private String customDomain;
|
||||
|
||||
/**
|
||||
* true path-style nginx 反向代理和S3默认支持 pathStyle {http://endpoint/bucketname} false
|
||||
* supports virtual-hosted-style 阿里云等需要配置为 virtual-hosted-style
|
||||
* 模式{http://bucketname.endpoint}
|
||||
*/
|
||||
private Boolean pathStyleAccess = true;
|
||||
/**
|
||||
* true path-style nginx 反向代理和S3默认支持 pathStyle {http://endpoint/bucketname} false
|
||||
* supports virtual-hosted-style 阿里云等需要配置为 virtual-hosted-style
|
||||
* 模式{http://bucketname.endpoint}
|
||||
*/
|
||||
private Boolean pathStyleAccess = true;
|
||||
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
private String appId;
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
private String appId;
|
||||
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String region;
|
||||
/**
|
||||
* 区域
|
||||
*/
|
||||
private String region;
|
||||
|
||||
/**
|
||||
* Access key就像用户ID,可以唯一标识你的账户
|
||||
*/
|
||||
private String accessKey;
|
||||
/**
|
||||
* Access key就像用户ID,可以唯一标识你的账户
|
||||
*/
|
||||
private String accessKey;
|
||||
|
||||
/**
|
||||
* Secret key是你账户的密码
|
||||
*/
|
||||
private String secretKey;
|
||||
/**
|
||||
* Secret key是你账户的密码
|
||||
*/
|
||||
private String secretKey;
|
||||
|
||||
/**
|
||||
* 最大线程数,默认: 100
|
||||
*/
|
||||
private Integer maxConnections = 100;
|
||||
/**
|
||||
* 最大线程数,默认: 100
|
||||
*/
|
||||
private Integer maxConnections = 100;
|
||||
|
||||
/**
|
||||
* 跳过 MD5 检查
|
||||
*/
|
||||
private boolean skipMd5Check;
|
||||
|
||||
}
|
||||
+212
-198
@@ -52,222 +52,236 @@ import java.util.*;
|
||||
@RequiredArgsConstructor
|
||||
public class OssTemplate implements InitializingBean, FileTemplate {
|
||||
|
||||
private final FileProperties properties;
|
||||
private final FileProperties properties;
|
||||
|
||||
private AmazonS3 amazonS3;
|
||||
private AmazonS3 amazonS3;
|
||||
|
||||
/**
|
||||
* 创建bucket
|
||||
* @param bucketName bucket名称
|
||||
*/
|
||||
@SneakyThrows
|
||||
public void createBucket(String bucketName) {
|
||||
if (!amazonS3.doesBucketExistV2(bucketName)) {
|
||||
amazonS3.createBucket((bucketName));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 创建bucket
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
*/
|
||||
@SneakyThrows
|
||||
public void createBucket(String bucketName) {
|
||||
if (!amazonS3.doesBucketExistV2(bucketName)) {
|
||||
amazonS3.createBucket((bucketName));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取全部bucket
|
||||
* <p>
|
||||
*
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
@SneakyThrows
|
||||
public List<Bucket> getAllBuckets() {
|
||||
return amazonS3.listBuckets();
|
||||
}
|
||||
/**
|
||||
* 获取全部bucket
|
||||
* <p>
|
||||
*
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
@SneakyThrows
|
||||
public List<Bucket> getAllBuckets() {
|
||||
return amazonS3.listBuckets();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bucketName bucket名称
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
@SneakyThrows
|
||||
public Optional<Bucket> getBucket(String bucketName) {
|
||||
return amazonS3.listBuckets().stream().filter(b -> b.getName().equals(bucketName)).findFirst();
|
||||
}
|
||||
/**
|
||||
* @param bucketName bucket名称
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
@SneakyThrows
|
||||
public Optional<Bucket> getBucket(String bucketName) {
|
||||
return amazonS3.listBuckets().stream().filter(b -> b.getName().equals(bucketName)).findFirst();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bucketName bucket名称
|
||||
* @see <a href=
|
||||
* "http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucket">AWS API
|
||||
* Documentation</a>
|
||||
*/
|
||||
@SneakyThrows
|
||||
public void removeBucket(String bucketName) {
|
||||
amazonS3.deleteBucket(bucketName);
|
||||
}
|
||||
/**
|
||||
* @param bucketName bucket名称
|
||||
* @see <a href=
|
||||
* "http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucket">AWS API
|
||||
* Documentation</a>
|
||||
*/
|
||||
@SneakyThrows
|
||||
public void removeBucket(String bucketName) {
|
||||
amazonS3.deleteBucket(bucketName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据文件前置查询文件
|
||||
* @param bucketName bucket名称
|
||||
* @param prefix 前缀
|
||||
* @param recursive 是否递归查询
|
||||
* @return S3ObjectSummary 列表
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
@SneakyThrows
|
||||
public List<S3ObjectSummary> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) {
|
||||
ObjectListing objectListing = amazonS3.listObjects(bucketName, prefix);
|
||||
return new ArrayList<>(objectListing.getObjectSummaries());
|
||||
}
|
||||
/**
|
||||
* 根据文件前置查询文件
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
* @param prefix 前缀
|
||||
* @param recursive 是否递归查询
|
||||
* @return S3ObjectSummary 列表
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
@SneakyThrows
|
||||
public List<S3ObjectSummary> getAllObjectsByPrefix(String bucketName, String prefix, boolean recursive) {
|
||||
ObjectListing objectListing = amazonS3.listObjects(bucketName, prefix);
|
||||
return new ArrayList<>(objectListing.getObjectSummaries());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件外链
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @param expires 过期时间 <=7
|
||||
* @return url
|
||||
* @see AmazonS3#generatePresignedUrl(String bucketName, String key, Date expiration)
|
||||
*/
|
||||
@SneakyThrows
|
||||
public String getObjectURL(String bucketName, String objectName, Integer expires) {
|
||||
Date date = new Date();
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.DAY_OF_MONTH, expires);
|
||||
URL url = amazonS3.generatePresignedUrl(bucketName, objectName, calendar.getTime());
|
||||
return url.toString();
|
||||
}
|
||||
/**
|
||||
* 获取文件外链
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @param expires 过期时间 <=7
|
||||
* @return url
|
||||
* @see AmazonS3#generatePresignedUrl(String bucketName, String key, Date expiration)
|
||||
*/
|
||||
@SneakyThrows
|
||||
public String getObjectURL(String bucketName, String objectName, Integer expires) {
|
||||
Date date = new Date();
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.DAY_OF_MONTH, expires);
|
||||
URL url = amazonS3.generatePresignedUrl(bucketName, objectName, calendar.getTime());
|
||||
return url.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @return 二进制流
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
@SneakyThrows
|
||||
public S3Object getObject(String bucketName, String objectName) {
|
||||
return amazonS3.getObject(bucketName, objectName);
|
||||
}
|
||||
/**
|
||||
* 获取文件
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @return 二进制流
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
@SneakyThrows
|
||||
public S3Object getObject(String bucketName, String objectName) {
|
||||
if (properties.getOss().isSkipMd5Check()) {
|
||||
System.setProperty("com.amazonaws.services.s3.disableGetObjectMD5Validation", "false");
|
||||
}
|
||||
return amazonS3.getObject(bucketName, objectName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件
|
||||
* @param bucketName bucket名称
|
||||
* @param dir 文件夹名称
|
||||
* @param objectName 文件名称
|
||||
* @return 二进制流 API Documentation</a>
|
||||
*/
|
||||
@Override
|
||||
public S3Object getObject(String bucketName, String dir, String objectName) {
|
||||
if (StrUtil.isNotBlank(dir)) {
|
||||
objectName = dir + FileUtil.FILE_SEPARATOR + objectName;
|
||||
}
|
||||
return getObject(bucketName, objectName);
|
||||
}
|
||||
/**
|
||||
* 获取文件
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
* @param dir 文件夹名称
|
||||
* @param objectName 文件名称
|
||||
* @return 二进制流 API Documentation</a>
|
||||
*/
|
||||
@Override
|
||||
public S3Object getObject(String bucketName, String dir, String objectName) {
|
||||
if (StrUtil.isNotBlank(dir)) {
|
||||
objectName = dir + FileUtil.FILE_SEPARATOR + objectName;
|
||||
}
|
||||
return getObject(bucketName, objectName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @param stream 文件流
|
||||
* @throws Exception
|
||||
*/
|
||||
public void putObject(String bucketName, String objectName, InputStream stream) throws Exception {
|
||||
putObject(bucketName, objectName, stream, stream.available(), "application/octet-stream");
|
||||
}
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @param stream 文件流
|
||||
* @throws Exception
|
||||
*/
|
||||
public void putObject(String bucketName, String objectName, InputStream stream) throws Exception {
|
||||
putObject(bucketName, objectName, stream, stream.available(), "application/octet-stream");
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @param stream 文件流
|
||||
* @param contextType 文件类型
|
||||
* @throws Exception
|
||||
*/
|
||||
public void putObject(String bucketName, String objectName, InputStream stream, String contextType)
|
||||
throws Exception {
|
||||
putObject(bucketName, objectName, stream, stream.available(), contextType);
|
||||
}
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @param stream 文件流
|
||||
* @param contextType 文件类型
|
||||
* @throws Exception
|
||||
*/
|
||||
public void putObject(String bucketName, String objectName, InputStream stream, String contextType)
|
||||
throws Exception {
|
||||
putObject(bucketName, objectName, stream, stream.available(), contextType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param bucketName bucket名称
|
||||
* @param dir 文件夹名称
|
||||
* @param objectName 文件名称
|
||||
* @param stream 文件流
|
||||
* @param contextType 文件类型
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void putObject(String bucketName, String dir, String objectName, InputStream stream, String contextType)
|
||||
throws Exception {
|
||||
if (StrUtil.isNotBlank(dir)) {
|
||||
// dir 路径为 a/b
|
||||
objectName = dir + FileUtil.FILE_SEPARATOR + objectName;
|
||||
}
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
* @param dir 文件夹名称
|
||||
* @param objectName 文件名称
|
||||
* @param stream 文件流
|
||||
* @param contextType 文件类型
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public void putObject(String bucketName, String dir, String objectName, InputStream stream, String contextType)
|
||||
throws Exception {
|
||||
if (StrUtil.isNotBlank(dir)) {
|
||||
// dir 路径为 a/b
|
||||
objectName = dir + FileUtil.FILE_SEPARATOR + objectName;
|
||||
}
|
||||
|
||||
putObject(bucketName, objectName, stream, stream.available(), contextType);
|
||||
}
|
||||
putObject(bucketName, objectName, stream, stream.available(), contextType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传文件
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @param stream 文件流
|
||||
* @param size 大小
|
||||
* @param contextType 类型
|
||||
* @throws Exception
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObject">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
public PutObjectResult putObject(String bucketName, String objectName, InputStream stream, long size,
|
||||
String contextType) throws Exception {
|
||||
// String fileName = getFileName(objectName);
|
||||
byte[] bytes = IOUtils.toByteArray(stream);
|
||||
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||
objectMetadata.setContentLength(size);
|
||||
objectMetadata.setContentType(contextType);
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
|
||||
// 上传
|
||||
return amazonS3.putObject(bucketName, objectName, byteArrayInputStream, objectMetadata);
|
||||
/**
|
||||
* 上传文件
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @param stream 文件流
|
||||
* @param size 大小
|
||||
* @param contextType 类型
|
||||
* @throws Exception
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObject">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
public PutObjectResult putObject(String bucketName, String objectName, InputStream stream, long size,
|
||||
String contextType) throws Exception {
|
||||
// String fileName = getFileName(objectName);
|
||||
byte[] bytes = IOUtils.toByteArray(stream);
|
||||
ObjectMetadata objectMetadata = new ObjectMetadata();
|
||||
objectMetadata.setContentLength(size);
|
||||
objectMetadata.setContentType(contextType);
|
||||
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
|
||||
// 上传
|
||||
return amazonS3.putObject(bucketName, objectName, byteArrayInputStream, objectMetadata);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件信息
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
public S3Object getObjectInfo(String bucketName, String objectName) throws Exception {
|
||||
@Cleanup
|
||||
S3Object object = amazonS3.getObject(bucketName, objectName);
|
||||
return object;
|
||||
}
|
||||
/**
|
||||
* 获取文件信息
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @see <a href="http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject">AWS
|
||||
* API Documentation</a>
|
||||
*/
|
||||
public S3Object getObjectInfo(String bucketName, String objectName) throws Exception {
|
||||
@Cleanup
|
||||
S3Object object = amazonS3.getObject(bucketName, objectName);
|
||||
return object;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除文件
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @throws Exception
|
||||
* @see <a href=
|
||||
* "http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObject">AWS API
|
||||
* Documentation</a>
|
||||
*/
|
||||
public void removeObject(String bucketName, String objectName) throws Exception {
|
||||
amazonS3.deleteObject(bucketName, objectName);
|
||||
}
|
||||
/**
|
||||
* 删除文件
|
||||
*
|
||||
* @param bucketName bucket名称
|
||||
* @param objectName 文件名称
|
||||
* @throws Exception
|
||||
* @see <a href=
|
||||
* "http://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObject">AWS API
|
||||
* Documentation</a>
|
||||
*/
|
||||
public void removeObject(String bucketName, String objectName) throws Exception {
|
||||
amazonS3.deleteObject(bucketName, objectName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration();
|
||||
clientConfiguration.setMaxConnections(properties.getOss().getMaxConnections());
|
||||
@Override
|
||||
public void afterPropertiesSet() {
|
||||
ClientConfiguration clientConfiguration = new ClientConfiguration();
|
||||
clientConfiguration.setMaxConnections(properties.getOss().getMaxConnections());
|
||||
|
||||
AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(
|
||||
properties.getOss().getEndpoint(), properties.getOss().getRegion());
|
||||
AWSCredentials awsCredentials = new BasicAWSCredentials(properties.getOss().getAccessKey(),
|
||||
properties.getOss().getSecretKey());
|
||||
AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
|
||||
this.amazonS3 = AmazonS3Client.builder().withEndpointConfiguration(endpointConfiguration)
|
||||
.withClientConfiguration(clientConfiguration).withCredentials(awsCredentialsProvider)
|
||||
.disableChunkedEncoding().withPathStyleAccessEnabled(properties.getOss().getPathStyleAccess()).build();
|
||||
}
|
||||
AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(
|
||||
properties.getOss().getEndpoint(), properties.getOss().getRegion());
|
||||
AWSCredentials awsCredentials = new BasicAWSCredentials(properties.getOss().getAccessKey(),
|
||||
properties.getOss().getSecretKey());
|
||||
AWSCredentialsProvider awsCredentialsProvider = new AWSStaticCredentialsProvider(awsCredentials);
|
||||
this.amazonS3 = AmazonS3Client.builder().withEndpointConfiguration(endpointConfiguration)
|
||||
.withClientConfiguration(clientConfiguration).withCredentials(awsCredentialsProvider)
|
||||
.disableChunkedEncoding().withPathStyleAccessEnabled(properties.getOss().getPathStyleAccess()).build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-seata</artifactId>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-security</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-sensitive</artifactId>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-sequence</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-sse</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-swagger</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-websocket</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common-xss</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-common</artifactId>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-flow-engine</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-flow-engine-api</artifactId>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-flow-engine</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-flow-engine-biz</artifactId>
|
||||
|
||||
+2
-1
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Component;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 来自表单
|
||||
@@ -37,7 +38,7 @@ public class AssignUserFormStrategyImpl implements AssignUserStrategy {
|
||||
if (variable != null && !StrUtil.isBlankIfStr(variable)) {
|
||||
String jsonString = objectMapper.writeValueAsString(variable);
|
||||
List<NodeUser> nodeUserDtoList = JSONUtil.toList(jsonString, NodeUser.class);
|
||||
assignList.addAll(nodeUserDtoList.stream().map(NodeUser::getId).toList());
|
||||
assignList.addAll(nodeUserDtoList.stream().map(NodeUser::getId).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
return assignList;
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-flow</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-flow-engine</artifactId>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-flow-task</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-flow-task-api</artifactId>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-flow-task</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-flow-task-biz</artifactId>
|
||||
|
||||
+1
-1
@@ -134,7 +134,7 @@ public class RemoteServiceImpl implements IRemoteService {
|
||||
.getData()
|
||||
.stream()
|
||||
.map(SysUser::getUserId)
|
||||
.toList();
|
||||
.collect(Collectors.toList());
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-flow</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-flow-task</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-flow</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-gateway</artifactId>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-register</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-upms</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-upms-api</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-upms</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-upms-biz</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-upms</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-codegen</artifactId>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-daemon-elastic-job</artifactId>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-jimu-platform</artifactId>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-monitor</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-mp-platform</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-pay-platform</artifactId>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-report-platform</artifactId>
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>pigx-seata-server</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-sentinel-dashboard</artifactId>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-xxl-job-admin</artifactId>
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx</artifactId>
|
||||
<version>5.7.0</version>
|
||||
<version>5.8.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-visual</artifactId>
|
||||
|
||||
Reference in new issue
Block a user