From 2cba01a6b6f67cfa97d0c4e0cc589302fab817ba Mon Sep 17 00:00:00 2001
From: aix <vip_xiaobin810@163.com>
Date: Wed, 24 Jul 2024 11:41:37 +0800
Subject: [PATCH] 查询有变形水库
---
skjcmanager/skjcmanager-ops/skjcmanager-resource/src/main/java/cn/gistack/resource/builder/oss/OssBuilder.java | 84 +++++++++++++++++++++++++++++-------------
1 files changed, 58 insertions(+), 26 deletions(-)
diff --git a/skjcmanager/skjcmanager-ops/skjcmanager-resource/src/main/java/cn/gistack/resource/builder/oss/OssBuilder.java b/skjcmanager/skjcmanager-ops/skjcmanager-resource/src/main/java/cn/gistack/resource/builder/oss/OssBuilder.java
index 03c99e3..675d48a 100644
--- a/skjcmanager/skjcmanager-ops/skjcmanager-resource/src/main/java/cn/gistack/resource/builder/oss/OssBuilder.java
+++ b/skjcmanager/skjcmanager-ops/skjcmanager-resource/src/main/java/cn/gistack/resource/builder/oss/OssBuilder.java
@@ -16,7 +16,9 @@
*/
package cn.gistack.resource.builder.oss;
+import cn.gistack.common.constant.CommonConstant;
import cn.gistack.resource.rule.MyOssRule;
+import cn.gistack.resource.rule.PanoramaOSSRule;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springblade.core.cache.utils.CacheUtil;
@@ -86,6 +88,12 @@
return templateByPath(StringPool.EMPTY,prefixPath);
}
+
+
+ public OssTemplate templateByPrefixPathPanorama(String prefixPath ,String resGuid) {
+ return templateByPathPanorama(StringPool.EMPTY,prefixPath,resGuid);
+ }
+
/**
* 获取template
*
@@ -94,6 +102,11 @@
*/
public OssTemplate template(String code) {
String tenantId = AuthUtil.getTenantId();
+
+ if (StringUtil.isBlank(tenantId)){
+ tenantId = "000000";
+ }
+
Oss oss = getOss(tenantId, code);
Oss ossCached = ossPool.get(tenantId);
OssTemplate template = templatePool.get(tenantId);
@@ -137,34 +150,53 @@
public OssTemplate templateByPath(String code,String prefixPath) {
String tenantId = AuthUtil.getTenantId();
Oss oss = getOss(tenantId, code);
- Oss ossCached = ossPool.get(tenantId);
OssTemplate template = templatePool.get(tenantId);
- // 若为空或者不一致,则重新加载
- if (Func.hasEmpty(template, ossCached) || !oss.getEndpoint().equals(ossCached.getEndpoint()) || !oss.getAccessKey().equals(ossCached.getAccessKey())) {
- synchronized (OssBuilder.class) {
- template = templatePool.get(tenantId);
- if (Func.hasEmpty(template, ossCached) || !oss.getEndpoint().equals(ossCached.getEndpoint()) || !oss.getAccessKey().equals(ossCached.getAccessKey())) {
- OssRule ossRule;
- // 若采用默认设置则开启多租户模式, 若是用户自定义oss则不开启
- if (oss.getEndpoint().equals(ossProperties.getEndpoint()) && oss.getAccessKey().equals(ossProperties.getAccessKey()) && ossProperties.getTenantMode()) {
- ossRule = new MyOssRule(Boolean.TRUE,prefixPath);
- } else {
- ossRule = new MyOssRule(Boolean.FALSE,prefixPath);
- }
- if (oss.getCategory() == OssEnum.MINIO.getCategory()) {
- template = MinioOssBuilder.template(oss, ossRule);
- } else if (oss.getCategory() == OssEnum.QINIU.getCategory()) {
- template = QiniuOssBuilder.template(oss, ossRule);
- } else if (oss.getCategory() == OssEnum.ALI.getCategory()) {
- template = AliOssBuilder.template(oss, ossRule);
- } else if (oss.getCategory() == OssEnum.TENCENT.getCategory()) {
- template = TencentOssBuilder.template(oss, ossRule);
- }
- templatePool.put(tenantId, template);
- ossPool.put(tenantId, oss);
- }
- }
+ template = templatePool.get(tenantId);
+ OssRule ossRule = new MyOssRule(Boolean.FALSE,prefixPath);
+ if (oss.getCategory() == OssEnum.MINIO.getCategory()) {
+ template = MinioOssBuilder.template(oss, ossRule);
+ } else if (oss.getCategory() == OssEnum.QINIU.getCategory()) {
+ template = QiniuOssBuilder.template(oss, ossRule);
+ } else if (oss.getCategory() == OssEnum.ALI.getCategory()) {
+ template = AliOssBuilder.template(oss, ossRule);
+ } else if (oss.getCategory() == OssEnum.TENCENT.getCategory()) {
+ template = TencentOssBuilder.template(oss, ossRule);
}
+ templatePool.put(tenantId, template);
+ ossPool.put(tenantId, oss);
+ return template;
+ }
+
+ /**
+ * 全景图片上传
+ * @param code
+ * @param prefixPath
+ * @return
+ */
+ public OssTemplate templateByPathPanorama(String code,String prefixPath,String resGuid) {
+ String tenantId = AuthUtil.getTenantId();
+// System.err.println("tenantId:"+tenantId);
+ if (StringUtil.isBlank(tenantId)){
+ tenantId = "000000";
+ }
+
+ Oss oss = getOss(tenantId, code);
+
+
+ OssTemplate template = null;
+// template = templatePool.get(tenantId);
+ PanoramaOSSRule ossRule = new PanoramaOSSRule(Boolean.FALSE,prefixPath,resGuid);
+ if (oss.getCategory() == OssEnum.MINIO.getCategory()) {
+ template = MinioOssBuilder.template(oss, ossRule);
+ } else if (oss.getCategory() == OssEnum.QINIU.getCategory()) {
+ template = QiniuOssBuilder.template(oss, ossRule);
+ } else if (oss.getCategory() == OssEnum.ALI.getCategory()) {
+ template = AliOssBuilder.template(oss, ossRule);
+ } else if (oss.getCategory() == OssEnum.TENCENT.getCategory()) {
+ template = TencentOssBuilder.template(oss, ossRule);
+ }
+// templatePool.put(tenantId, template);
+// ossPool.put(tenantId, oss);
return template;
}
--
Gitblit v1.9.3