Browse Source

优化oss租户模式逻辑

test
smallchill 6 years ago
parent
commit
de03ad7846
  1. 2
      blade-ops/blade-resource/src/main/java/org/springblade/resource/config/OssConfiguration.java
  2. 9
      blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java

2
blade-ops/blade-resource/src/main/java/org/springblade/resource/config/OssConfiguration.java

@ -20,6 +20,7 @@ import lombok.AllArgsConstructor;
import org.springblade.core.oss.props.OssProperties;
import org.springblade.resource.builder.OssBuilder;
import org.springblade.resource.mapper.OssMapper;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -30,6 +31,7 @@ import org.springframework.context.annotation.Configuration;
*/
@Configuration
@AllArgsConstructor
@EnableConfigurationProperties(OssProperties.class)
public class OssConfiguration {
private OssProperties ossProperties;

9
blade-ops/blade-resource/src/main/java/org/springblade/resource/endpoint/OssEndpoint.java

@ -19,6 +19,7 @@ package org.springblade.resource.endpoint;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import lombok.SneakyThrows;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.oss.model.OssFile;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
@ -126,8 +127,8 @@ public class OssEndpoint {
@SneakyThrows
@PostMapping("/put-file")
public R<OssFile> putFile(@RequestParam MultipartFile file) {
ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
return R.data(ossBuilder.template().statFile(file.getOriginalFilename()));
BladeFile bladeFile = ossBuilder.template().putFile(file.getOriginalFilename(), file.getInputStream());
return R.data(ossBuilder.template().statFile(bladeFile.getName()));
}
/**
@ -140,8 +141,8 @@ public class OssEndpoint {
@SneakyThrows
@PostMapping("/put-file-by-name")
public R<OssFile> putFile(@RequestParam String fileName, @RequestParam MultipartFile file) {
ossBuilder.template().putFile(fileName, file.getInputStream());
return R.data(ossBuilder.template().statFile(fileName));
BladeFile bladeFile = ossBuilder.template().putFile(fileName, file.getInputStream());
return R.data(ossBuilder.template().statFile(bladeFile.getName()));
}
/**

Loading…
Cancel
Save