From aa2423c7d134a869370ee2cb57ef4a1ac3daddec Mon Sep 17 00:00:00 2001 From: "Longjun.Tu" Date: Tue, 23 May 2023 19:00:25 +0800 Subject: [PATCH] =?UTF-8?q?refactor=EF=BC=9Aoss=E6=A8=A1=E5=9D=97=E5=BC=95?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/{manager => }/ICommonData.java | 2 +- .../iotkit/data/{manager => }/IOwnedData.java | 3 +- .../iotkit/data/manager/IAlertConfigData.java | 3 +- .../iotkit/data/manager/IAlertRecordData.java | 3 +- .../cc/iotkit/data/manager/ICategoryData.java | 1 + .../data/manager/IChannelConfigData.java | 1 + .../cc/iotkit/data/manager/IChannelData.java | 1 + .../data/manager/IChannelTemplateData.java | 1 + .../data/manager/IDeviceConfigData.java | 1 + .../iotkit/data/manager/IDeviceGroupData.java | 1 + .../iotkit/data/manager/IDeviceInfoData.java | 1 + .../cc/iotkit/data/manager/IHomeData.java | 1 + .../iotkit/data/manager/IOauthClientData.java | 1 + .../cc/iotkit/data/manager/IProductData.java | 1 + .../data/manager/IProductModelData.java | 1 + .../data/manager/IProtocolComponentData.java | 1 + .../data/manager/IProtocolConverterData.java | 1 + .../cc/iotkit/data/manager/IRuleInfoData.java | 1 + .../cc/iotkit/data/manager/ISpaceData.java | 1 + .../iotkit/data/manager/ISpaceDeviceData.java | 1 + .../cc/iotkit/data/manager/ITaskInfoData.java | 1 + .../iotkit/data/manager/IThingModelData.java | 1 + .../cc/iotkit/data/manager/IUserInfoData.java | 1 + .../data/manager/IVirtualDeviceData.java | 1 + .../cc/iotkit/data/system/ISysConfigData.java | 3 +- .../cc/iotkit/data/system/ISysDeptData.java | 2 +- .../cc/iotkit/data/system/ISysDictData.java | 2 +- .../iotkit/data/system/ISysDictTypeData.java | 2 +- .../data/system/ISysLogininforData.java | 2 +- .../cc/iotkit/data/system/ISysMenuData.java | 2 +- .../cc/iotkit/data/system/ISysNoticeData.java | 2 +- .../iotkit/data/system/ISysOperLogData.java | 2 +- .../cc/iotkit/data/service/CommonService.java | 2 +- iot-common/iot-common-oss/pom.xml | 16 ++ .../common/oss/constant/OssConstant.java | 38 +++ .../cc/iotkit/common/oss/core/OssClient.java | 245 ++++++++++++++++++ .../common/oss/entity/UploadResult.java | 24 ++ .../common/oss/enumd/AccessPolicyType.java | 55 ++++ .../iotkit/common/oss/enumd/PolicyType.java | 35 +++ .../common/oss/exception/OssException.java | 18 ++ .../iotkit/common/oss/factory/OssFactory.java | 64 +++++ .../common/oss/properties/OssProperties.java | 58 +++++ .../manager/service/DataOwnerService.java | 2 +- pom.xml | 7 + 44 files changed, 597 insertions(+), 15 deletions(-) rename iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/{manager => }/ICommonData.java (97%) rename iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/{manager => }/IOwnedData.java (93%) create mode 100644 iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/constant/OssConstant.java create mode 100644 iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/core/OssClient.java create mode 100644 iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/entity/UploadResult.java create mode 100644 iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/enumd/AccessPolicyType.java create mode 100644 iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/enumd/PolicyType.java create mode 100644 iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/exception/OssException.java create mode 100644 iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/factory/OssFactory.java create mode 100644 iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/properties/OssProperties.java diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ICommonData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/ICommonData.java similarity index 97% rename from iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ICommonData.java rename to iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/ICommonData.java index 51072aa1..f31e5e75 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ICommonData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/ICommonData.java @@ -7,7 +7,7 @@ * | Author: xw2sy@163.com * +---------------------------------------------------------------------- */ -package cc.iotkit.data.manager; +package cc.iotkit.data; import cc.iotkit.model.Id; import cc.iotkit.common.api.Paging; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IOwnedData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/IOwnedData.java similarity index 93% rename from iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IOwnedData.java rename to iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/IOwnedData.java index 46fc626a..95d999b6 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IOwnedData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/IOwnedData.java @@ -7,8 +7,9 @@ * | Author: xw2sy@163.com * +---------------------------------------------------------------------- */ -package cc.iotkit.data.manager; +package cc.iotkit.data; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.Owned; import cc.iotkit.common.api.Paging; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IAlertConfigData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IAlertConfigData.java index ef3d69fb..1f81d7e3 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IAlertConfigData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IAlertConfigData.java @@ -11,10 +11,11 @@ package cc.iotkit.data.manager; import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.Paging; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.alert.AlertConfig; -public interface IAlertConfigData extends ICommonData { +public interface IAlertConfigData extends ICommonData { Paging selectAlertConfigPage(PageRequest request); diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IAlertRecordData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IAlertRecordData.java index 469ae5c0..96ebb54c 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IAlertRecordData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IAlertRecordData.java @@ -11,10 +11,11 @@ package cc.iotkit.data.manager; import cc.iotkit.common.api.PageRequest; import cc.iotkit.common.api.Paging; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.alert.AlertRecord; -public interface IAlertRecordData extends ICommonData { +public interface IAlertRecordData extends ICommonData { Paging selectAlertConfigPage(PageRequest request); diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ICategoryData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ICategoryData.java index af612cc1..bc567145 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ICategoryData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ICategoryData.java @@ -9,6 +9,7 @@ */ package cc.iotkit.data.manager; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.product.Category; public interface ICategoryData extends ICommonData { diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelConfigData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelConfigData.java index 1222034e..5c550a8d 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelConfigData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelConfigData.java @@ -1,5 +1,6 @@ package cc.iotkit.data.manager; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.notify.ChannelConfig; /** diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelData.java index cbe8fda3..6fa92c44 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelData.java @@ -1,5 +1,6 @@ package cc.iotkit.data.manager; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.notify.Channel; /** diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelTemplateData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelTemplateData.java index 51e84d88..4dfbc4e1 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelTemplateData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IChannelTemplateData.java @@ -1,5 +1,6 @@ package cc.iotkit.data.manager; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.notify.ChannelTemplate; /** diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceConfigData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceConfigData.java index 1d115bd1..dfc6b57c 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceConfigData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceConfigData.java @@ -9,6 +9,7 @@ */ package cc.iotkit.data.manager; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.device.DeviceConfig; public interface IDeviceConfigData extends ICommonData { diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceGroupData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceGroupData.java index 6bcd63f7..cb084c73 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceGroupData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceGroupData.java @@ -10,6 +10,7 @@ package cc.iotkit.data.manager; import cc.iotkit.common.api.Paging; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.device.DeviceGroup; public interface IDeviceGroupData extends ICommonData { diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java index 2d03590b..cf9e5975 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IDeviceInfoData.java @@ -10,6 +10,7 @@ package cc.iotkit.data.manager; import cc.iotkit.common.api.Paging; +import cc.iotkit.data.IOwnedData; import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.stats.DataItem; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IHomeData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IHomeData.java index 6bc06c71..20aac035 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IHomeData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IHomeData.java @@ -9,6 +9,7 @@ */ package cc.iotkit.data.manager; +import cc.iotkit.data.IOwnedData; import cc.iotkit.model.space.Home; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IOauthClientData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IOauthClientData.java index fea0b5b5..0eaa0d4e 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IOauthClientData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IOauthClientData.java @@ -9,6 +9,7 @@ */ package cc.iotkit.data.manager; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.OauthClient; public interface IOauthClientData extends ICommonData { diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProductData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProductData.java index a0fbf18d..68da54b6 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProductData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProductData.java @@ -9,6 +9,7 @@ */ package cc.iotkit.data.manager; +import cc.iotkit.data.IOwnedData; import cc.iotkit.model.product.Product; import java.util.List; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProductModelData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProductModelData.java index 5b716f27..e8e80544 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProductModelData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProductModelData.java @@ -9,6 +9,7 @@ */ package cc.iotkit.data.manager; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.product.ProductModel; import java.util.List; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProtocolComponentData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProtocolComponentData.java index 80d96d22..7f8d9789 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProtocolComponentData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProtocolComponentData.java @@ -1,5 +1,6 @@ package cc.iotkit.data.manager; +import cc.iotkit.data.IOwnedData; import cc.iotkit.model.protocol.ProtocolComponent; import java.util.List; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProtocolConverterData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProtocolConverterData.java index 6642fd2a..d1c0ce8d 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProtocolConverterData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IProtocolConverterData.java @@ -1,5 +1,6 @@ package cc.iotkit.data.manager; +import cc.iotkit.data.IOwnedData; import cc.iotkit.model.protocol.ProtocolConverter; public interface IProtocolConverterData extends IOwnedData { diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IRuleInfoData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IRuleInfoData.java index 1259ac92..711dfbf8 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IRuleInfoData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IRuleInfoData.java @@ -1,6 +1,7 @@ package cc.iotkit.data.manager; import cc.iotkit.common.api.Paging; +import cc.iotkit.data.IOwnedData; import cc.iotkit.model.rule.RuleInfo; import java.util.List; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ISpaceData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ISpaceData.java index 8afbdb37..789451ba 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ISpaceData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ISpaceData.java @@ -9,6 +9,7 @@ */ package cc.iotkit.data.manager; +import cc.iotkit.data.IOwnedData; import cc.iotkit.model.space.Space; import java.util.List; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ISpaceDeviceData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ISpaceDeviceData.java index dcbe91b3..80e1ff23 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ISpaceDeviceData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ISpaceDeviceData.java @@ -9,6 +9,7 @@ */ package cc.iotkit.data.manager; +import cc.iotkit.data.IOwnedData; import cc.iotkit.model.space.SpaceDevice; import java.util.List; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ITaskInfoData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ITaskInfoData.java index 4fa0a8cb..9466878d 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ITaskInfoData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/ITaskInfoData.java @@ -1,5 +1,6 @@ package cc.iotkit.data.manager; +import cc.iotkit.data.IOwnedData; import cc.iotkit.model.rule.TaskInfo; public interface ITaskInfoData extends IOwnedData { diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IThingModelData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IThingModelData.java index d41b80cb..b1c6225f 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IThingModelData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IThingModelData.java @@ -1,5 +1,6 @@ package cc.iotkit.data.manager; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.product.ThingModel; public interface IThingModelData extends ICommonData { diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IUserInfoData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IUserInfoData.java index 8d19f5dc..1642fd96 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IUserInfoData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IUserInfoData.java @@ -9,6 +9,7 @@ */ package cc.iotkit.data.manager; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.UserInfo; import java.util.List; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IVirtualDeviceData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IVirtualDeviceData.java index 1a0f296e..c8c0bca9 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IVirtualDeviceData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/manager/IVirtualDeviceData.java @@ -10,6 +10,7 @@ package cc.iotkit.data.manager; import cc.iotkit.common.api.Paging; +import cc.iotkit.data.IOwnedData; import cc.iotkit.model.device.VirtualDevice; import java.util.List; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysConfigData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysConfigData.java index 85aeee11..f3dc7fae 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysConfigData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysConfigData.java @@ -1,7 +1,6 @@ package cc.iotkit.data.system; -import cc.iotkit.common.api.Paging; -import cc.iotkit.data.manager.ICommonData; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.system.SysConfig; /** diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDeptData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDeptData.java index 7b499408..0132ed92 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDeptData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDeptData.java @@ -1,7 +1,7 @@ package cc.iotkit.data.system; -import cc.iotkit.data.manager.ICommonData; +import cc.iotkit.data.ICommonData; import cc.iotkit.common.api.Paging; import cc.iotkit.model.system.SysDept; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDictData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDictData.java index 63c61e16..b6bfe85d 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDictData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDictData.java @@ -1,6 +1,6 @@ package cc.iotkit.data.system; -import cc.iotkit.data.manager.ICommonData; +import cc.iotkit.data.ICommonData; import cc.iotkit.common.api.Paging; import cc.iotkit.model.system.SysDictData; import cc.iotkit.model.system.SysDictType; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDictTypeData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDictTypeData.java index cfd8b08b..92b0f12e 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDictTypeData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysDictTypeData.java @@ -1,6 +1,6 @@ package cc.iotkit.data.system; -import cc.iotkit.data.manager.ICommonData; +import cc.iotkit.data.ICommonData; import cc.iotkit.common.api.Paging; import cc.iotkit.model.system.SysDictType; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysLogininforData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysLogininforData.java index 5dae7a91..98256f40 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysLogininforData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysLogininforData.java @@ -1,6 +1,6 @@ package cc.iotkit.data.system; -import cc.iotkit.data.manager.ICommonData; +import cc.iotkit.data.ICommonData; import cc.iotkit.common.api.Paging; import cc.iotkit.model.system.SysLogininfor; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysMenuData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysMenuData.java index d51138ec..393c6dd9 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysMenuData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysMenuData.java @@ -1,6 +1,6 @@ package cc.iotkit.data.system; -import cc.iotkit.data.manager.ICommonData; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.system.SysMenu; import java.util.List; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysNoticeData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysNoticeData.java index f70b619a..becf3007 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysNoticeData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysNoticeData.java @@ -1,6 +1,6 @@ package cc.iotkit.data.system; -import cc.iotkit.data.manager.ICommonData; +import cc.iotkit.data.ICommonData; import cc.iotkit.common.api.Paging; import cc.iotkit.model.system.SysNotice; diff --git a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysOperLogData.java b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysOperLogData.java index da9fae14..ad917a05 100644 --- a/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysOperLogData.java +++ b/iot-common/iot-common-dao/iot-data-service/src/main/java/cc/iotkit/data/system/ISysOperLogData.java @@ -1,6 +1,6 @@ package cc.iotkit.data.system; -import cc.iotkit.data.manager.ICommonData; +import cc.iotkit.data.ICommonData; import cc.iotkit.common.api.Paging; import cc.iotkit.model.system.SysOperLog; diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/CommonService.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/CommonService.java index f97695b9..807de04f 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/CommonService.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/CommonService.java @@ -9,7 +9,7 @@ */ package cc.iotkit.data.service; -import cc.iotkit.data.manager.ICommonData; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.Id; import cc.iotkit.common.api.Paging; import org.springframework.data.domain.Page; diff --git a/iot-common/iot-common-oss/pom.xml b/iot-common/iot-common-oss/pom.xml index 38135837..ba53ef7b 100644 --- a/iot-common/iot-common-oss/pom.xml +++ b/iot-common/iot-common-oss/pom.xml @@ -10,6 +10,22 @@ 4.0.0 iot-common-oss + + + com.amazonaws + aws-java-sdk-s3 + + + + cc.iotkit + iot-common-redis + + + + cc.iotkit + iot-common-core + + diff --git a/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/constant/OssConstant.java b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/constant/OssConstant.java new file mode 100644 index 00000000..1afba480 --- /dev/null +++ b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/constant/OssConstant.java @@ -0,0 +1,38 @@ +package cc.iotkit.common.oss.constant; + +import java.util.Arrays; +import java.util.List; + +/** + * 对象存储常量 + * + * @author Lion Li + */ +public interface OssConstant { + + /** + * 默认配置KEY + */ + String DEFAULT_CONFIG_KEY = "sys_oss:default_config"; + + /** + * 预览列表资源开关Key + */ + String PEREVIEW_LIST_RESOURCE_KEY = "sys.oss.previewListResource"; + + /** + * 系统数据ids + */ + List SYSTEM_DATA_IDS = Arrays.asList(1L, 2L, 3L, 4L); + + /** + * 云服务商 + */ + String[] CLOUD_SERVICE = new String[] {"aliyun", "qcloud", "qiniu", "obs"}; + + /** + * https 状态 + */ + String IS_HTTPS = "Y"; + +} diff --git a/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/core/OssClient.java b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/core/OssClient.java new file mode 100644 index 00000000..862bae46 --- /dev/null +++ b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/core/OssClient.java @@ -0,0 +1,245 @@ +package cc.iotkit.common.oss.core; + +import cc.iotkit.common.oss.constant.OssConstant; +import cc.iotkit.common.oss.exception.OssException; +import cc.iotkit.common.oss.properties.OssProperties; +import cn.hutool.core.io.IoUtil; +import cn.hutool.core.util.IdUtil; +import com.amazonaws.ClientConfiguration; +import com.amazonaws.HttpMethod; +import com.amazonaws.Protocol; +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSCredentialsProvider; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.client.builder.AwsClientBuilder; +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.AmazonS3Client; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; +import com.amazonaws.services.s3.model.*; +import org.dromara.common.core.utils.DateUtils; +import org.dromara.common.core.utils.StringUtils; +import cc.iotkit.common.oss.entity.UploadResult; +import cc.iotkit.common.oss.enumd.AccessPolicyType; +import cc.iotkit.common.oss.enumd.PolicyType; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.net.URL; +import java.util.Date; + +/** + * S3 存储协议 所有兼容S3协议的云厂商均支持 + * 阿里云 腾讯云 七牛云 minio + * + * @author Lion Li + */ +public class OssClient { + + private final String configKey; + + private final OssProperties properties; + + private final AmazonS3 client; + + public OssClient(String configKey, OssProperties ossProperties) { + this.configKey = configKey; + this.properties = ossProperties; + try { + AwsClientBuilder.EndpointConfiguration endpointConfig = + new AwsClientBuilder.EndpointConfiguration(properties.getEndpoint(), properties.getRegion()); + + AWSCredentials credentials = new BasicAWSCredentials(properties.getAccessKey(), properties.getSecretKey()); + AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); + ClientConfiguration clientConfig = new ClientConfiguration(); + if (OssConstant.IS_HTTPS.equals(properties.getIsHttps())) { + clientConfig.setProtocol(Protocol.HTTPS); + } else { + clientConfig.setProtocol(Protocol.HTTP); + } + AmazonS3ClientBuilder build = AmazonS3Client.builder() + .withEndpointConfiguration(endpointConfig) + .withClientConfiguration(clientConfig) + .withCredentials(credentialsProvider) + .disableChunkedEncoding(); + if (!StringUtils.containsAny(properties.getEndpoint(), OssConstant.CLOUD_SERVICE)) { + // minio 使用https限制使用域名访问 需要此配置 站点填域名 + build.enablePathStyleAccess(); + } + this.client = build.build(); + + createBucket(); + } catch (Exception e) { + if (e instanceof OssException) { + throw e; + } + throw new OssException("配置错误! 请检查系统配置:[" + e.getMessage() + "]"); + } + } + + public void createBucket() { + try { + String bucketName = properties.getBucketName(); + if (client.doesBucketExistV2(bucketName)) { + return; + } + CreateBucketRequest createBucketRequest = new CreateBucketRequest(bucketName); + AccessPolicyType accessPolicy = getAccessPolicy(); + createBucketRequest.setCannedAcl(accessPolicy.getAcl()); + client.createBucket(createBucketRequest); + client.setBucketPolicy(bucketName, getPolicy(bucketName, accessPolicy.getPolicyType())); + } catch (Exception e) { + throw new OssException("创建Bucket失败, 请核对配置信息:[" + e.getMessage() + "]"); + } + } + + public UploadResult upload(byte[] data, String path, String contentType) { + return upload(new ByteArrayInputStream(data), path, contentType); + } + + public UploadResult upload(InputStream inputStream, String path, String contentType) { + if (!(inputStream instanceof ByteArrayInputStream)) { + inputStream = new ByteArrayInputStream(IoUtil.readBytes(inputStream)); + } + try { + ObjectMetadata metadata = new ObjectMetadata(); + metadata.setContentType(contentType); + metadata.setContentLength(inputStream.available()); + PutObjectRequest putObjectRequest = new PutObjectRequest(properties.getBucketName(), path, inputStream, metadata); + // 设置上传对象的 Acl 为公共读 + putObjectRequest.setCannedAcl(getAccessPolicy().getAcl()); + client.putObject(putObjectRequest); + } catch (Exception e) { + throw new OssException("上传文件失败,请检查配置信息:[" + e.getMessage() + "]"); + } + return UploadResult.builder().url(getUrl() + "/" + path).filename(path).build(); + } + + public void delete(String path) { + path = path.replace(getUrl() + "/", ""); + try { + client.deleteObject(properties.getBucketName(), path); + } catch (Exception e) { + throw new OssException("删除文件失败,请检查配置信息:[" + e.getMessage() + "]"); + } + } + + public UploadResult uploadSuffix(byte[] data, String suffix, String contentType) { + return upload(data, getPath(properties.getPrefix(), suffix), contentType); + } + + public UploadResult uploadSuffix(InputStream inputStream, String suffix, String contentType) { + return upload(inputStream, getPath(properties.getPrefix(), suffix), contentType); + } + + /** + * 获取文件元数据 + * + * @param path 完整文件路径 + */ + public ObjectMetadata getObjectMetadata(String path) { + path = path.replace(getUrl() + "/", ""); + S3Object object = client.getObject(properties.getBucketName(), path); + return object.getObjectMetadata(); + } + + public InputStream getObjectContent(String path) { + path = path.replace(getUrl() + "/", ""); + S3Object object = client.getObject(properties.getBucketName(), path); + return object.getObjectContent(); + } + + public String getUrl() { + String domain = properties.getDomain(); + String endpoint = properties.getEndpoint(); + String header = OssConstant.IS_HTTPS.equals(properties.getIsHttps()) ? "https://" : "http://"; + // 云服务商直接返回 + if (StringUtils.containsAny(endpoint, OssConstant.CLOUD_SERVICE)) { + if (StringUtils.isNotBlank(domain)) { + return header + domain; + } + return header + properties.getBucketName() + "." + endpoint; + } + // minio 单独处理 + if (StringUtils.isNotBlank(domain)) { + return header + domain + "/" + properties.getBucketName(); + } + return header + endpoint + "/" + properties.getBucketName(); + } + + public String getPath(String prefix, String suffix) { + // 生成uuid + String uuid = IdUtil.fastSimpleUUID(); + // 文件路径 + String path = DateUtils.datePath() + "/" + uuid; + if (StringUtils.isNotBlank(prefix)) { + path = prefix + "/" + path; + } + return path + suffix; + } + + + public String getConfigKey() { + return configKey; + } + + /** + * 获取私有URL链接 + * + * @param objectKey 对象KEY + * @param second 授权时间 + */ + public String getPrivateUrl(String objectKey, Integer second) { + GeneratePresignedUrlRequest generatePresignedUrlRequest = + new GeneratePresignedUrlRequest(properties.getBucketName(), objectKey) + .withMethod(HttpMethod.GET) + .withExpiration(new Date(System.currentTimeMillis() + 1000L * second)); + URL url = client.generatePresignedUrl(generatePresignedUrlRequest); + return url.toString(); + } + + /** + * 检查配置是否相同 + */ + public boolean checkPropertiesSame(OssProperties properties) { + return this.properties.equals(properties); + } + + /** + * 获取当前桶权限类型 + * + * @return 当前桶权限类型code + */ + public AccessPolicyType getAccessPolicy() { + return AccessPolicyType.getByType(properties.getAccessPolicy()); + } + + private static String getPolicy(String bucketName, PolicyType policyType) { + StringBuilder builder = new StringBuilder(); + builder.append("{\n\"Statement\": [\n{\n\"Action\": [\n"); + builder.append(switch (policyType) { + case WRITE -> "\"s3:GetBucketLocation\",\n\"s3:ListBucketMultipartUploads\"\n"; + case READ_WRITE -> "\"s3:GetBucketLocation\",\n\"s3:ListBucket\",\n\"s3:ListBucketMultipartUploads\"\n"; + default -> "\"s3:GetBucketLocation\"\n"; + }); + builder.append("],\n\"Effect\": \"Allow\",\n\"Principal\": \"*\",\n\"Resource\": \"arn:aws:s3:::"); + builder.append(bucketName); + builder.append("\"\n},\n"); + if (policyType == PolicyType.READ) { + builder.append("{\n\"Action\": [\n\"s3:ListBucket\"\n],\n\"Effect\": \"Deny\",\n\"Principal\": \"*\",\n\"Resource\": \"arn:aws:s3:::"); + builder.append(bucketName); + builder.append("\"\n},\n"); + } + builder.append("{\n\"Action\": "); + builder.append(switch (policyType) { + case WRITE -> "[\n\"s3:AbortMultipartUpload\",\n\"s3:DeleteObject\",\n\"s3:ListMultipartUploadParts\",\n\"s3:PutObject\"\n],\n"; + case READ_WRITE -> "[\n\"s3:AbortMultipartUpload\",\n\"s3:DeleteObject\",\n\"s3:GetObject\",\n\"s3:ListMultipartUploadParts\",\n\"s3:PutObject\"\n],\n"; + default -> "\"s3:GetObject\",\n"; + }); + builder.append("\"Effect\": \"Allow\",\n\"Principal\": \"*\",\n\"Resource\": \"arn:aws:s3:::"); + builder.append(bucketName); + builder.append("/*\"\n}\n],\n\"Version\": \"2012-10-17\"\n}\n"); + return builder.toString(); + } + +} diff --git a/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/entity/UploadResult.java b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/entity/UploadResult.java new file mode 100644 index 00000000..e486ec0e --- /dev/null +++ b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/entity/UploadResult.java @@ -0,0 +1,24 @@ +package cc.iotkit.common.oss.entity; + +import lombok.Builder; +import lombok.Data; + +/** + * 上传返回体 + * + * @author Lion Li + */ +@Data +@Builder +public class UploadResult { + + /** + * 文件路径 + */ + private String url; + + /** + * 文件名 + */ + private String filename; +} diff --git a/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/enumd/AccessPolicyType.java b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/enumd/AccessPolicyType.java new file mode 100644 index 00000000..533cc412 --- /dev/null +++ b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/enumd/AccessPolicyType.java @@ -0,0 +1,55 @@ +package cc.iotkit.common.oss.enumd; + +import com.amazonaws.services.s3.model.CannedAccessControlList; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 桶访问策略配置 + * + * @author 陈賝 + */ +@Getter +@AllArgsConstructor +public enum AccessPolicyType { + + /** + * private + */ + PRIVATE("0", CannedAccessControlList.Private, PolicyType.WRITE), + + /** + * public + */ + PUBLIC("1", CannedAccessControlList.PublicRead, PolicyType.READ), + + /** + * custom + */ + CUSTOM("2",CannedAccessControlList.PublicRead, PolicyType.READ); + + /** + * 桶 权限类型 + */ + private final String type; + + /** + * 文件对象 权限类型 + */ + private final CannedAccessControlList acl; + + /** + * 桶策略类型 + */ + private final PolicyType policyType; + + public static AccessPolicyType getByType(String type) { + for (AccessPolicyType value : values()) { + if (value.getType().equals(type)) { + return value; + } + } + throw new RuntimeException("'type' not found By " + type); + } + +} diff --git a/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/enumd/PolicyType.java b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/enumd/PolicyType.java new file mode 100644 index 00000000..c838b050 --- /dev/null +++ b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/enumd/PolicyType.java @@ -0,0 +1,35 @@ +package cc.iotkit.common.oss.enumd; + +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * minio策略配置 + * + * @author Lion Li + */ +@Getter +@AllArgsConstructor +public enum PolicyType { + + /** + * 只读 + */ + READ("read-only"), + + /** + * 只写 + */ + WRITE("write-only"), + + /** + * 读写 + */ + READ_WRITE("read-write"); + + /** + * 类型 + */ + private final String type; + +} diff --git a/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/exception/OssException.java b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/exception/OssException.java new file mode 100644 index 00000000..fd3fdc8a --- /dev/null +++ b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/exception/OssException.java @@ -0,0 +1,18 @@ +package cc.iotkit.common.oss.exception; + + +/** + * OSS异常类 + * + * @author Lion Li + */ +public class OssException extends RuntimeException { + + + private static final long serialVersionUID = 1L; + + public OssException(String msg) { + super(msg); + } + +} diff --git a/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/factory/OssFactory.java b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/factory/OssFactory.java new file mode 100644 index 00000000..bade134e --- /dev/null +++ b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/factory/OssFactory.java @@ -0,0 +1,64 @@ +package cc.iotkit.common.oss.factory; + + +import cc.iotkit.common.constant.CacheNames; +import cc.iotkit.common.oss.constant.OssConstant; +import cc.iotkit.common.oss.core.OssClient; +import cc.iotkit.common.oss.exception.OssException; +import cc.iotkit.common.oss.properties.OssProperties; +import cc.iotkit.common.redis.utils.CacheUtils; +import cc.iotkit.common.redis.utils.RedisUtils; +import cc.iotkit.common.utils.JsonUtils; +import cc.iotkit.common.utils.StringUtils; +import lombok.extern.slf4j.Slf4j; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 文件上传Factory + * + * @author Lion Li + */ +@Slf4j +public class OssFactory { + + private static final Map CLIENT_CACHE = new ConcurrentHashMap<>(); + + /** + * 获取默认实例 + */ + public static OssClient instance() { + // 获取redis 默认类型 + String configKey = RedisUtils.getCacheObject(OssConstant.DEFAULT_CONFIG_KEY); + if (StringUtils.isEmpty(configKey)) { + throw new OssException("文件存储服务类型无法找到!"); + } + return instance(configKey); + } + + /** + * 根据类型获取实例 + */ + public static OssClient instance(String configKey) { + String json = CacheUtils.get(CacheNames.SYS_OSS_CONFIG, configKey); + if (json == null) { + throw new OssException("系统异常, '" + configKey + "'配置信息不存在!"); + } + OssProperties properties = JsonUtils.parseObject(json, OssProperties.class); + OssClient client = CLIENT_CACHE.get(configKey); + if (client == null) { + CLIENT_CACHE.put(configKey, new OssClient(configKey, properties)); + log.info("创建OSS实例 key => {}", configKey); + return CLIENT_CACHE.get(configKey); + } + // 配置不相同则重新构建 + if (!client.checkPropertiesSame(properties)) { + CLIENT_CACHE.put(configKey, new OssClient(configKey, properties)); + log.info("重载OSS实例 key => {}", configKey); + return CLIENT_CACHE.get(configKey); + } + return client; + } + +} diff --git a/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/properties/OssProperties.java b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/properties/OssProperties.java new file mode 100644 index 00000000..ab372c93 --- /dev/null +++ b/iot-common/iot-common-oss/src/main/java/cc/iotkit/common/oss/properties/OssProperties.java @@ -0,0 +1,58 @@ +package cc.iotkit.common.oss.properties; + +import lombok.Data; + +/** + * OSS对象存储 配置属性 + * + * @author Lion Li + */ +@Data +public class OssProperties { + + /** + * 访问站点 + */ + private String endpoint; + + /** + * 自定义域名 + */ + private String domain; + + /** + * 前缀 + */ + private String prefix; + + /** + * ACCESS_KEY + */ + private String accessKey; + + /** + * SECRET_KEY + */ + private String secretKey; + + /** + * 存储空间名 + */ + private String bucketName; + + /** + * 存储区域 + */ + private String region; + + /** + * 是否https(Y=是,N=否) + */ + private String isHttps; + + /** + * 桶权限类型(0private 1public 2custom) + */ + private String accessPolicy; + +} diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/DataOwnerService.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/DataOwnerService.java index a3a01db2..252c4b4e 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/DataOwnerService.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/DataOwnerService.java @@ -11,7 +11,7 @@ package cc.iotkit.manager.service; import cc.iotkit.common.enums.ErrCode; import cc.iotkit.common.exception.BizException; -import cc.iotkit.data.manager.ICommonData; +import cc.iotkit.data.ICommonData; import cc.iotkit.model.Owned; import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.utils.AuthUtil; diff --git a/pom.xml b/pom.xml index d9948e75..e56e456b 100755 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,7 @@ 1.9.3 2.13.1 3.7 + 1.12.400 2.11.0 1.14 5.8.18 @@ -71,6 +72,12 @@ ${lang3.version} + + com.amazonaws + aws-java-sdk-s3 + ${aws-java-sdk-s3.version} + + commons-io commons-io