feat[通用模块]:getViewUrlByName在文件存储中fileName,小程序二维码生成并上传逻辑完善,二维码管理后台功能实现以及其他逻辑优化

This commit is contained in:
2025-02-14 16:44:44 +08:00
parent 62c372c456
commit d02ec0f324
15 changed files with 362 additions and 70 deletions
@@ -91,18 +91,18 @@ public class OssTemplate implements InitializingBean {
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(size);
objectMetadata.setContentType(contentType);
PutObjectRequest putObjectRequest = new PutObjectRequest(fileProperties.getCos().getBucketName(), objectName, is, objectMetadata);
PutObjectRequest putObjectRequest = new PutObjectRequest(fileProperties.getOss().getBucketName(), objectName, is, objectMetadata);
ossClient.putObject(putObjectRequest);
ObjectInfo obj = new ObjectInfo();
obj.setObjectPath(fileProperties.getCos().getBucketName() + PATH_SPLIT + objectName);
obj.setObjectUrl(fileProperties.getCos().getEndpoint() + PATH_SPLIT + obj.getObjectPath());
obj.setObjectPath(fileProperties.getOss().getBucketName() + PATH_SPLIT + objectName);
obj.setObjectUrl(fileProperties.getOss().getEndpoint() + PATH_SPLIT + obj.getObjectPath());
return obj;
}
public void delete(String objectName) {
delete(fileProperties.getCos().getBucketName(), objectName);
delete(fileProperties.getOss().getBucketName(), objectName);
}
public void delete(String bucketName, String objectName) {
@@ -132,7 +132,7 @@ public class OssTemplate implements InitializingBean {
public String getViewUrl(String objectName, int expires) {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.MINUTE, expires);
URL url = ossClient.generatePresignedUrl(fileProperties.getCos().getBucketName(), objectName, cal.getTime());
URL url = ossClient.generatePresignedUrl(fileProperties.getOss().getBucketName(), objectName, cal.getTime());
return url.toString();
}
@@ -167,7 +167,7 @@ public class OssTemplate implements InitializingBean {
}
public void out(String objectName, OutputStream os) {
out(fileProperties.getS3().getBucketName(), objectName, os);
out(fileProperties.getOss().getBucketName(), objectName, os);
}
/**