From d88ce8f933df6a533eddb06f0f2e340a2c697001 Mon Sep 17 00:00:00 2001
From: zrj <646384940@qq.com>
Date: Fri, 30 Aug 2024 18:15:25 +0800
Subject: [PATCH] 修改生成环境数据库连接配置

---
 src/main/java/org/springblade/modules/mechanism/controller/MechanismController.java |   29 +++++++++++++++++++++--------
 1 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/src/main/java/org/springblade/modules/mechanism/controller/MechanismController.java b/src/main/java/org/springblade/modules/mechanism/controller/MechanismController.java
index 1a7caf9..8335307 100644
--- a/src/main/java/org/springblade/modules/mechanism/controller/MechanismController.java
+++ b/src/main/java/org/springblade/modules/mechanism/controller/MechanismController.java
@@ -16,6 +16,7 @@
  */
 package org.springblade.modules.mechanism.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.google.zxing.WriterException;
 import io.minio.*;
 import io.minio.errors.*;
@@ -35,6 +36,8 @@
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.modules.resource.builder.oss.OssBuilder;
+import org.springblade.modules.resource.entity.Oss;
+import org.springblade.modules.resource.service.IOssService;
 import org.springframework.web.bind.annotation.*;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.springblade.modules.mechanism.entity.Mechanism;
@@ -42,7 +45,7 @@
 import org.springblade.modules.mechanism.service.IMechanismService;
 import org.springblade.core.boot.ctrl.BladeController;
 import springfox.documentation.annotations.ApiIgnore;
-import sun.misc.BASE64Encoder;
+//import sun.misc.BASE64Encoder;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -68,6 +71,8 @@
 public class MechanismController extends BladeController {
 
 	private final IMechanismService mechanismService;
+
+	private final IOssService ossService;
 
 	/**
 	 * 对象存储构建类
@@ -135,7 +140,7 @@
 		String type = URLEncoder.encode(mechanism.getType(), "UTF-8");
 		String mtype = URLEncoder.encode(mechanism.getMtype(), "UTF-8");
 		String loutype = URLEncoder.encode(mechanism.getLoutype(), "UTF-8");
-		String xtype = URLEncoder.encode(mechanism.getXtype(), "UTF-8");
+		String campus = URLEncoder.encode(mechanism.getCampus(), "UTF-8");
 		String heading = URLEncoder.encode(mechanism.getHeading(), "UTF-8");
 		String pitch = URLEncoder.encode(mechanism.getPitch(), "UTF-8");
 		String roll = URLEncoder.encode(mechanism.getRoll(), "UTF-8");
@@ -152,7 +157,7 @@
 			"&type=" + type +
 			"&mtype=" + mtype +
 			"&loutype=" + loutype +
-			"&xtype=" + xtype +
+			"&campus=" + campus +
 			"&heading=" + heading +
 			"&pitch=" + pitch +
 			"&roll=" + roll +
@@ -223,11 +228,18 @@
 	}
 
 	private String upload(ByteArrayInputStream in) throws IOException, InvalidKeyException, InvalidResponseException, InsufficientDataException, NoSuchAlgorithmException, ServerException, InternalException, XmlParserException, ErrorResponseException {
+		QueryWrapper<Oss> wrapper = new QueryWrapper<>();
+		wrapper.eq("is_deleted",0);
+		Oss one = ossService.getOne(wrapper);
 		//填写你文件上传的地址以及相应信息
-		String url = "http://106.225.193.35:2081";
-		String access = "zhbaadmin";
-		String secret = "zhbapassword";
-		String bucket = "zhxy";
+//		String url = "http://106.225.193.35:2081";
+//		String access = "zhbaadmin";
+//		String secret = "zhbapassword";
+//		String bucket = "zhxy";
+		String url = one.getEndpoint();
+		String access = one.getAccessKey();
+		String secret = one.getSecretKey();
+		String bucket = one.getBucketName();
 		MinioClient minioClient =
 			MinioClient.builder()
 				.endpoint(url)
@@ -253,7 +265,8 @@
 				.build());
 
 		//文件推送
-		String urls = "https://dev.jxpskj.com:8023/zhxy/"+newName;
+//		String urls = "https://dev.jxpskj.com:8023/zhxy/"+newName;
+		String urls = url + "/"+ bucket + "/" + newName;
 		//返回
 		return urls;
 	}

--
Gitblit v1.9.3