mirror of
https://github.com/yanlongqi/jhinno-openapi-java-sdk.git
synced 2026-03-22 14:25:11 +08:00
feat(sdk): 项目使用优化和代码的优化
This commit is contained in:
@@ -1,15 +1,25 @@
|
||||
package com.jhinno.sdk.openapi.example.api.extend;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.jhinno.sdk.openapi.api.JHApiExecution;
|
||||
import com.jhinno.sdk.openapi.JHApiExecution;
|
||||
import com.jhinno.sdk.openapi.api.JHRequestExecution;
|
||||
import com.jhinno.sdk.openapi.api.ResponseResult;
|
||||
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class JHFileApiExtendExecution extends JHApiExecution {
|
||||
@Component
|
||||
public class JHFileApiExtendExecution implements JHApiExecution {
|
||||
|
||||
private JHRequestExecution execution;
|
||||
|
||||
@Override
|
||||
public void init(JHRequestExecution execution) {
|
||||
this.execution = execution;
|
||||
}
|
||||
|
||||
public static String GET_FILE_ENV_PATH = "/ws/api/files/path/{env}";
|
||||
|
||||
@@ -19,11 +29,12 @@ public class JHFileApiExtendExecution extends JHApiExecution {
|
||||
params.put("type", type.getType());
|
||||
}
|
||||
String url = JHApiClient.getUrl(GET_FILE_ENV_PATH.replace("{env}", env.getEnv()), params);
|
||||
return get(url, username, new TypeReference<ResponseResult<FilePath>>() {
|
||||
return execution.get(url, username, new TypeReference<ResponseResult<FilePath>>() {
|
||||
});
|
||||
}
|
||||
|
||||
public FilePath getFileHomeEnvPath(String username, FileSystemType type) {
|
||||
return getFileEnvPath(username, FileEnvType.HOME_ENV, type);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.jhinno.sdk.openapi.example.config;
|
||||
|
||||
import com.jhinno.sdk.openapi.example.api.extend.JHFileApiExtendExecution;
|
||||
import com.jhinno.sdk.openapi.utils.JHOpenApiConfig;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
|
||||
@Configuration
|
||||
@RequiredArgsConstructor
|
||||
public class JHOpenapiExecutionConfig {
|
||||
|
||||
|
||||
@Bean
|
||||
public JHFileApiExtendExecution fileApiExtendExecution(JHOpenApiConfig jhOpenApiConfig) {
|
||||
return jhOpenApiConfig.configJHApiExecution(new JHFileApiExtendExecution());
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
jhinno:
|
||||
openapi:
|
||||
server-url: https://172.17.0.5/appform
|
||||
auth-type: access_secret_mode
|
||||
server-url: https://192.168.87.24/appform
|
||||
auth-type: token_mode
|
||||
access-key: 3f03747f147942bd8debd81b6c9c6a80
|
||||
access-key-secret: e0681859b91c499eb1d2c8e09cea3242
|
||||
Reference in New Issue
Block a user