| | |
| | | import com.oying.service.BucketStorageService; |
| | | import com.oying.domain.dto.BucketStorageQueryCriteria; |
| | | import com.oying.mapper.BucketStorageMapper; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | |
| | | private final BucketStorageMapper bucketStorageMapper; |
| | | private final ObsProperties properties; |
| | | private final FileProperties fileProperties; |
| | | @Value("${oying.enabled}") |
| | | private Boolean oyingEnabled; |
| | | |
| | | @Override |
| | | public PageResult<BucketStorage> queryAll(BucketStorageQueryCriteria criteria, Page<Object> page) { |
| | |
| | | String type = FileUtil.getFileType(suffix); |
| | | String reaName = System.currentTimeMillis() + "." + suffix; |
| | | String objectKey = type + "/" + reaName; |
| | | if (oyingEnabled) { |
| | | objectKey = "test/" +objectKey; |
| | | } |
| | | PutObjectResult result = ObsUtils.putObject(properties, file, objectKey, AccessControlList.REST_CANNED_PUBLIC_READ); |
| | | if (ObjectUtil.isNull(result)) { |
| | | throw new BadRequestException("上传失败"); |
| | |
| | | String type = FileUtil.getFileType(suffix); |
| | | String reaName = IdUtil.getSnowflake(1, 1).nextId() + "." + suffix; |
| | | String objectKey = type + "/" + reaName; |
| | | if (oyingEnabled) { |
| | | objectKey = "test/" +objectKey; |
| | | } |
| | | PutObjectResult result = ObsUtils.putObject(properties, FileUtil.toFile(file), objectKey, AccessControlList.REST_CANNED_PUBLIC_READ); |
| | | if (ObjectUtil.isNull(result)) { |
| | | throw new BadRequestException("上传失败"); |