sysParam 获取值问题

This commit is contained in:
2025-12-24 13:57:40 +08:00
parent 302504b891
commit 240d672211
12 changed files with 125 additions and 91 deletions

View File

@@ -14,6 +14,8 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author GYJoker
@@ -94,18 +96,19 @@ public class VersionController {
@GetMapping(value = "/getCredentials")
public CzgResult<Object> getCredentials() {
try {
Map<String, String> ossKeyMap = paramsService.getParamsByMap("ossKeySet", ParamCodeCst.OSS_KEY_SET);
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_ID。
.setAccessKeyId(paramsService.getSysParamValue(ParamCodeCst.AliYun.ALI_OSS_ACCESS_KEY))
.setAccessKeyId(ossKeyMap.get(ParamCodeCst.AliYun.ALI_OSS_ACCESS_KEY))
// 必填,请确保代码运行环境设置了环境变量 ALIBABA_CLOUD_ACCESS_KEY_SECRET。
.setAccessKeySecret(paramsService.getSysParamValue(ParamCodeCst.AliYun.ALI_OSS_ACCESS_SECRET));
.setAccessKeySecret(ossKeyMap.get(ParamCodeCst.AliYun.ALI_OSS_ACCESS_SECRET));
// Endpoint 请参考 https://api.aliyun.com/product/Sts
config.endpoint = paramsService.getSysParamValue(ParamCodeCst.AliYun.ALI_OSS_ENDPOINT);
config.endpoint = ossKeyMap.get(ParamCodeCst.AliYun.ALI_OSS_ENDPOINT);
com.aliyun.sts20150401.Client client = new com.aliyun.sts20150401.Client(config);
com.aliyun.sts20150401.models.AssumeRoleRequest assumeRoleRequest = new com.aliyun.sts20150401.models.AssumeRoleRequest();
assumeRoleRequest.setRoleArn(paramsService.getSysParamValue(ParamCodeCst.AliYun.ALI_OSS_ROLE_ARN));
assumeRoleRequest.setRoleArn(ossKeyMap.get(ParamCodeCst.AliYun.ALI_OSS_ROLE_ARN));
assumeRoleRequest.setRoleSessionName("test");
com.aliyun.teautil.models.RuntimeOptions runtime = new com.aliyun.teautil.models.RuntimeOptions();
// 复制代码运行请自行打印 API 的返回值