mirror of
https://github.com/yanlongqi/jhinno-openapi-java-sdk.git
synced 2026-03-22 06:15:10 +08:00
Compare commits
8 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bfb613c15f | ||
|
|
4f2490e797 | ||
|
|
88d7b7b65c | ||
|
|
753a40a6d0 | ||
|
|
0c9e98247c | ||
|
|
d134b8dc70 | ||
|
|
3686d17f9d | ||
|
|
75c7e02253 |
61
README.md
61
README.md
@@ -26,22 +26,7 @@
|
|||||||
|
|
||||||
建议在您的项目中使用Jhinno OpenAPI SDK for Java的方法是从Maven中使用它。:
|
建议在您的项目中使用Jhinno OpenAPI SDK for Java的方法是从Maven中使用它。:
|
||||||
|
|
||||||
#### 方法一:通过Maven仓库安装
|
#### 方法一:通过命令将jar包导入本地Maven仓库(无网络开发额外配置)
|
||||||
|
|
||||||
> 添加仓库地址(改方案为备用方案,后续会上传至Maven中央仓库,目前不影响正常使用)
|
|
||||||
|
|
||||||
```xml
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>jhinno-nexus</id>
|
|
||||||
<name>jhinno-nexus</name>
|
|
||||||
<url>https://jhinno-nexus.yuchat.top/repository/maven-releases</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 方法二:通过命令将jar包导入本地Maven仓库
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
||||||
@@ -62,6 +47,14 @@ mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file -Dfile="E:/
|
|||||||
> - jhinno-openapi-sdk-spring-boot-starter-x.x.x.jar 为SDK的spring-boot-starter的jar包。
|
> - jhinno-openapi-sdk-spring-boot-starter-x.x.x.jar 为SDK的spring-boot-starter的jar包。
|
||||||
> - jhinno-openapi-sdk-spring-boot-starter-x.x.x-sources.jar 为SDK的spring-boot-starter的源码包。
|
> - jhinno-openapi-sdk-spring-boot-starter-x.x.x-sources.jar 为SDK的spring-boot-starter的源码包。
|
||||||
|
|
||||||
|
#### 方法二:通过源码导入(无网络开发额外配置)
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/yanlongqi/jhinno-openapi-java-sdk.git
|
||||||
|
cd jhinno-openapi-java-sdk
|
||||||
|
mvn clean install
|
||||||
|
```
|
||||||
|
|
||||||
### 2.1.2 引入`jhinno-openapi-sdk-spring-boot-starter`坐标
|
### 2.1.2 引入`jhinno-openapi-sdk-spring-boot-starter`坐标
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
@@ -69,7 +62,7 @@ mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file -Dfile="E:/
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jhinno</groupId>
|
<groupId>com.jhinno</groupId>
|
||||||
<artifactId>jhinno-openapi-sdk-spring-boot-starter</artifactId>
|
<artifactId>jhinno-openapi-sdk-spring-boot-starter</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${最新的版本号}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -100,7 +93,8 @@ jhinno.openapi.auth-type=access_secret_mode
|
|||||||
|
|
||||||
> 注:
|
> 注:
|
||||||
> - 其中`jhinno.openapi.server-url`为景行接口服务的BaseUrl;
|
> - 其中`jhinno.openapi.server-url`为景行接口服务的BaseUrl;
|
||||||
> - `auth-type` 认证类型,`token_mode`(Token认证) 和 `access_secret_mode`(AccessKey认证);Appform Release 6.2 `token_mode`作为过渡,将会弃用;
|
> - `auth-type` 认证类型,`token_mode`(Token认证) 和 `access_secret_mode`(AccessKey认证);Appform Release 6.2 `token_mode`
|
||||||
|
作为过渡,将会弃用;
|
||||||
> - `jhinno.openapi.used-server-time`是否获取服务器时间来请求token,关闭可提高获取token的时间,但打开有可能因为服务器时间不准确而导致token获取失败的问题。
|
> - `jhinno.openapi.used-server-time`是否获取服务器时间来请求token,关闭可提高获取token的时间,但打开有可能因为服务器时间不准确而导致token获取失败的问题。
|
||||||
> - `access-key` 和 `access-key-secret` 作为访问接口的凭证,需要提供集成商名称、系统名称、负责人姓名、负责电话电话信息申请。
|
> - `access-key` 和 `access-key-secret` 作为访问接口的凭证,需要提供集成商名称、系统名称、负责人姓名、负责电话电话信息申请。
|
||||||
> - 更多配置见`com.jhinno.sdk.openapi.autoconfigure.JHOpenapiProperties`源码。
|
> - 更多配置见`com.jhinno.sdk.openapi.autoconfigure.JHOpenapiProperties`源码。
|
||||||
@@ -135,22 +129,7 @@ public class DemoUserSDK {
|
|||||||
|
|
||||||
建议在您的项目中使用Jhinno OpenAPI SDK for Java的方法是从Maven中使用它。:
|
建议在您的项目中使用Jhinno OpenAPI SDK for Java的方法是从Maven中使用它。:
|
||||||
|
|
||||||
#### 方法一:通过Maven仓库安装
|
#### 方法一:通过命令将jar包导入本地Maven仓库(无网络开发额外配置)
|
||||||
|
|
||||||
> 添加仓库地址(改方案为备用方案,后续会上传至Maven中央仓库,目前不影响正常使用)
|
|
||||||
|
|
||||||
```xml
|
|
||||||
|
|
||||||
<repositories>
|
|
||||||
<repository>
|
|
||||||
<id>jhinno-nexus</id>
|
|
||||||
<name>jhinno-nexus</name>
|
|
||||||
<url>https://jhinno-nexus.yuchat.top/repository/maven-releases</url>
|
|
||||||
</repository>
|
|
||||||
</repositories>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 方法二:通过命令将jar包导入本地Maven仓库
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
||||||
@@ -164,6 +143,14 @@ mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file -Dfile="E:/
|
|||||||
> - jhinno-openapi-java-sdk-x.x.x.jar 为SDK的jar包。
|
> - jhinno-openapi-java-sdk-x.x.x.jar 为SDK的jar包。
|
||||||
> - jhinno-openapi-java-sdk-x.x.x-sources.jar 为源码包,添加可方便查看SDK代码的注释。
|
> - jhinno-openapi-java-sdk-x.x.x-sources.jar 为源码包,添加可方便查看SDK代码的注释。
|
||||||
|
|
||||||
|
#### 方法二:通过源码导入(无网络开发额外配置)
|
||||||
|
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/yanlongqi/jhinno-openapi-java-sdk.git
|
||||||
|
cd jhinno-openapi-java-sdk
|
||||||
|
mvn clean install
|
||||||
|
```
|
||||||
|
|
||||||
### 2.2.2 引入`jhinno-openapi-java-sdk`坐标
|
### 2.2.2 引入`jhinno-openapi-java-sdk`坐标
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
@@ -171,7 +158,7 @@ mvn org.apache.maven.plugins:maven-install-plugin:3.1.1:install-file -Dfile="E:/
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jhinno</groupId>
|
<groupId>com.jhinno</groupId>
|
||||||
<artifactId>jhinno-openapi-java-sdk</artifactId>
|
<artifactId>jhinno-openapi-java-sdk</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>${最新的版本号}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -244,7 +231,7 @@ public class DemoUserSDK {
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jhinno</groupId>
|
<groupId>com.jhinno</groupId>
|
||||||
<artifactId>jhinno-openapi-java-sdk</artifactId>
|
<artifactId>jhinno-openapi-java-sdk</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>${最新的版本号}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -349,7 +336,7 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
一旦您检出代码,就可以使用Maven构建它。使用以下命令进行构建:
|
一旦您检出代码,就可以使用Maven构建它。使用以下命令进行构建:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
mvn clean package -DskipTests -P product
|
mvn clean package
|
||||||
```
|
```
|
||||||
|
|
||||||
# 5. 代码贡献
|
# 5. 代码贡献
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>jhinno-openapi-java-sdk</artifactId>
|
<artifactId>jhinno-openapi-java-sdk</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>Jhinno OpenAPI SDK for Java</name>
|
<name>Jhinno OpenAPI SDK for Java</name>
|
||||||
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
|
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.jhinno</groupId>
|
<groupId>com.jhinno</groupId>
|
||||||
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
|
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -77,19 +77,13 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>jhinno-releases</id>
|
|
||||||
<url>http://192.168.87.22:8081/repository/maven-releases</url>
|
|
||||||
</repository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<compileSourceRoots>src/main/java</compileSourceRoots>
|
||||||
<source>${maven.compiler.source}</source>
|
<source>${maven.compiler.source}</source>
|
||||||
<target>${maven.compiler.target}</target>
|
<target>${maven.compiler.target}</target>
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
@@ -129,36 +123,7 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
<version>3.3.0</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-sources</id>
|
|
||||||
<goals>
|
|
||||||
<goal>jar-no-fork</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<id>lqyan</id>
|
|
||||||
<name>lqyan</name>
|
|
||||||
<email>lqyan@jhinno.com</email>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>The Apache License, Version 2.0</name>
|
|
||||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -57,6 +57,12 @@ public class CommonConstant {
|
|||||||
*/
|
*/
|
||||||
public static final String CURRENT_TIME_MILLIS = "currentTimeMillis";
|
public static final String CURRENT_TIME_MILLIS = "currentTimeMillis";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* TOKEN
|
||||||
|
*/
|
||||||
|
public static final String TOKEN = "token";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 签名加密格式
|
* 签名加密格式
|
||||||
* <ul>
|
* <ul>
|
||||||
|
|||||||
@@ -43,10 +43,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class JHApiExecution {
|
public class JHApiExecution {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JHApiClient实例
|
* JHApiClient实例
|
||||||
*/
|
*/
|
||||||
public JHApiClient jhApiClient;
|
private JHApiClient jhApiClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* token的超时时间
|
* token的超时时间
|
||||||
@@ -157,7 +158,7 @@ public class JHApiExecution {
|
|||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private String getCurrentTimeMillis() {
|
public String getCurrentTimeMillis() {
|
||||||
if (authType == AuthType.ACCESS_SECRET_MODE || !isUsedServerTime) {
|
if (authType == AuthType.ACCESS_SECRET_MODE || !isUsedServerTime) {
|
||||||
return String.valueOf(System.currentTimeMillis());
|
return String.valueOf(System.currentTimeMillis());
|
||||||
}
|
}
|
||||||
@@ -196,7 +197,7 @@ public class JHApiExecution {
|
|||||||
headers.put(CommonConstant.CURRENT_TIME_MILLIS, currentTimeMillis);
|
headers.put(CommonConstant.CURRENT_TIME_MILLIS, currentTimeMillis);
|
||||||
headers.put(CommonConstant.SIGNATURE, getsSignature(username, currentTimeMillis));
|
headers.put(CommonConstant.SIGNATURE, getsSignature(username, currentTimeMillis));
|
||||||
} else if (authType == AuthType.TOKEN_MODE && StringUtils.isNotBlank(username)) {
|
} else if (authType == AuthType.TOKEN_MODE && StringUtils.isNotBlank(username)) {
|
||||||
headers.put("token", getToken(username));
|
headers.put(CommonConstant.TOKEN, getToken(username));
|
||||||
}
|
}
|
||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,4 +91,26 @@ public class AppPathConstant {
|
|||||||
* 获取应用链接URL
|
* 获取应用链接URL
|
||||||
*/
|
*/
|
||||||
public static final String APPS_GET_URL_PATH = "/ws/api/apps/{appName}/url";
|
public static final String APPS_GET_URL_PATH = "/ws/api/apps/{appName}/url";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WEB启动会话URL
|
||||||
|
*/
|
||||||
|
public static final String WEB_SESSION_URL_PATH = "/pageapi/apps/webclient/gui/{desktopId}";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用途查询应用
|
||||||
|
* <p/>
|
||||||
|
* 该接口目前在Solutions下面维护,未经过产品的测试
|
||||||
|
*/
|
||||||
|
public static final String APP_USE_LABEL_PATH = "/ws/api/app/use_label/apps";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文件后缀查询应用
|
||||||
|
* <p/>
|
||||||
|
* 该接口目前在Solutions下面维护,未经过产品的测试
|
||||||
|
*/
|
||||||
|
public static final String APPS_SUFFIXES_PATH = "/ws/api/apps/suffixes";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,4 +34,9 @@ public class AppStartedInfo {
|
|||||||
* 作业id(有可能出现,但不是太明白)
|
* 作业id(有可能出现,但不是太明白)
|
||||||
*/
|
*/
|
||||||
private String jobId;
|
private String jobId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WEB 启动会话URL
|
||||||
|
*/
|
||||||
|
private String webSessionUrl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,121 @@
|
|||||||
|
package com.jhinno.sdk.openapi.api.app;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class AppstoreAppInfo {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应ID
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用图标
|
||||||
|
*/
|
||||||
|
private String image;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用类型
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用版本
|
||||||
|
*/
|
||||||
|
private String version;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用状态
|
||||||
|
*/
|
||||||
|
private Boolean status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否 使用
|
||||||
|
*/
|
||||||
|
private Boolean isUsed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CPU使用
|
||||||
|
*/
|
||||||
|
private String cpuUsage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 空闲内存
|
||||||
|
*/
|
||||||
|
private String idleMem;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private String idleTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用路径
|
||||||
|
*/
|
||||||
|
private String appPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 工作路径
|
||||||
|
*/
|
||||||
|
private String appCwd;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发布时间
|
||||||
|
*/
|
||||||
|
private String appReleaseTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动选项
|
||||||
|
*/
|
||||||
|
private String appStartOpt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动前缀
|
||||||
|
*/
|
||||||
|
private String appStartPrefix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动后缀
|
||||||
|
*/
|
||||||
|
private String appStartSuffix;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用详情
|
||||||
|
*/
|
||||||
|
private String appDetail;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动数量
|
||||||
|
*/
|
||||||
|
private String startNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用途英文名
|
||||||
|
*/
|
||||||
|
private String useLabelEnStr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用途中文名
|
||||||
|
*/
|
||||||
|
private String useLabelCnStr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用系统
|
||||||
|
*/
|
||||||
|
private String appOs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 申请状态
|
||||||
|
*/
|
||||||
|
private String applyStatus;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.jhinno.sdk.openapi.api.app;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.jhinno.sdk.openapi.ArgsException;
|
import com.jhinno.sdk.openapi.ArgsException;
|
||||||
|
import com.jhinno.sdk.openapi.AuthType;
|
||||||
import com.jhinno.sdk.openapi.CommonConstant;
|
import com.jhinno.sdk.openapi.CommonConstant;
|
||||||
import com.jhinno.sdk.openapi.ServiceException;
|
import com.jhinno.sdk.openapi.ServiceException;
|
||||||
import com.jhinno.sdk.openapi.api.JHApiExecution;
|
import com.jhinno.sdk.openapi.api.JHApiExecution;
|
||||||
@@ -11,6 +12,7 @@ import com.jhinno.sdk.openapi.utils.CollectionUtil;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -35,8 +37,10 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动一个会话
|
* 启动一个会话
|
||||||
|
*
|
||||||
|
* <h4>一、通过JHClient启动</h4>
|
||||||
* <p>
|
* <p>
|
||||||
* 改方法返回一个重要的参数{@link AppStartedInfo#getJhappUrl()}(拉起景行客户端协议的URL)。
|
* 方法返回一个重要的参数{@link AppStartedInfo#getJhappUrl()}(拉起景行客户端协议的URL)。
|
||||||
* <p>
|
* <p>
|
||||||
* 测试:将该URL复制粘贴到浏览器的地址栏进行访问即可启动会话。
|
* 测试:将该URL复制粘贴到浏览器的地址栏进行访问即可启动会话。
|
||||||
*
|
*
|
||||||
@@ -61,6 +65,16 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
* iframe.src = "{@link AppStartedInfo#getJhappUrl()}";
|
* iframe.src = "{@link AppStartedInfo#getJhappUrl()}";
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
|
* <p>
|
||||||
|
* 注意:如果使用JHAppClient启动应用的,并且没有做浏览器端和服务器没有做时间同步,
|
||||||
|
* 那么 {@link AppStartRequest#setCurrentTimestamp(String)} 参数必传,
|
||||||
|
* 并使用js生产的时间,具体的参数见 {@link AppStartRequest#setCurrentTimestamp(String)}
|
||||||
|
*
|
||||||
|
* <h4>通过浏览器启动</h4>
|
||||||
|
* <pre class="code">
|
||||||
|
* window.open("{@link AppStartedInfo#getWebSessionUrl()}}")
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @param appId 应用拆
|
* @param appId 应用拆
|
||||||
* @param appStartRequest 启动参数
|
* @param appStartRequest 启动参数
|
||||||
@@ -73,7 +87,26 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
if (CollectionUtil.isEmpty(data)) {
|
if (CollectionUtil.isEmpty(data)) {
|
||||||
throw new ServiceException(path, 500, "获取到的会话信息为空");
|
throw new ServiceException(path, 500, "获取到的会话信息为空");
|
||||||
}
|
}
|
||||||
return data.get(0);
|
AppStartedInfo appStartedInfo = data.get(0);
|
||||||
|
appStartedInfo.setWebSessionUrl(getWebSessionUrl(username, appStartedInfo.getDesktopId()));
|
||||||
|
return appStartedInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getWebSessionUrl(String username, String desktopId) {
|
||||||
|
String webSessionUrlPath = AppPathConstant.WEB_SESSION_URL_PATH.replace("{desktopId}", desktopId);
|
||||||
|
String url = getJhApiClient().getUrl(webSessionUrlPath);
|
||||||
|
Map<String, Object> params = new HashMap<>();
|
||||||
|
AuthType authType = getAuthType();
|
||||||
|
if (authType == AuthType.TOKEN_MODE) {
|
||||||
|
params.put(CommonConstant.TOKEN, getToken(username));
|
||||||
|
} else if (authType == AuthType.ACCESS_SECRET_MODE) {
|
||||||
|
params.put(CommonConstant.USERNAME, username);
|
||||||
|
params.put(CommonConstant.ACCESS_KEY, getAccessKey());
|
||||||
|
String currentTimeMillis = getCurrentTimeMillis();
|
||||||
|
params.put(CommonConstant.CURRENT_TIME_MILLIS, currentTimeMillis);
|
||||||
|
params.put(CommonConstant.SIGNATURE, getsSignature(username, currentTimeMillis));
|
||||||
|
}
|
||||||
|
return JHApiClient.getUrl(url, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -266,7 +299,10 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
if (CollectionUtil.isEmpty(list)) {
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
throw new ServiceException(path, 500, "获取到的会话信息为空");
|
throw new ServiceException(path, 500, "获取到的会话信息为空");
|
||||||
}
|
}
|
||||||
return list.get(0);
|
|
||||||
|
AppStartedInfo appStartedInfo = list.get(0);
|
||||||
|
appStartedInfo.setWebSessionUrl(getWebSessionUrl(username, sessionId));
|
||||||
|
return appStartedInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -358,7 +394,7 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
/**
|
/**
|
||||||
* 获取应用链接
|
* 获取应用链接
|
||||||
*
|
*
|
||||||
* @param username 应户名
|
* @param username 用户名
|
||||||
* @param appName 应用名
|
* @param appName 应用名
|
||||||
* @return 应用链接地址
|
* @return 应用链接地址
|
||||||
*/
|
*/
|
||||||
@@ -374,4 +410,61 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
}
|
}
|
||||||
return apps.get(0).get("url");
|
return apps.get(0).get("url");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文件后缀查询应用
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @param suffixes 文件后缀列表
|
||||||
|
* @return 应用列表
|
||||||
|
*/
|
||||||
|
public List<AppstoreAppInfo> getAppInfoSuffixList(String username, String... suffixes) {
|
||||||
|
return getAppInfoSuffixList(username, Arrays.asList(suffixes));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据文件后缀查询应用
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @param suffixes 文件后缀列表
|
||||||
|
* @return 应用列表
|
||||||
|
*/
|
||||||
|
public List<AppstoreAppInfo> getAppInfoSuffixList(String username, List<String> suffixes) {
|
||||||
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
|
if (CollectionUtil.isNotEmpty(suffixes)) {
|
||||||
|
params.put("suffixes", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, suffixes));
|
||||||
|
}
|
||||||
|
String path = JHApiClient.getUrl(AppPathConstant.APPS_SUFFIXES_PATH, params);
|
||||||
|
return get(path, username, new TypeReference<ResponseResult<List<AppstoreAppInfo>>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用途查询应用
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @param labels 用途列表
|
||||||
|
* @return 应用列表
|
||||||
|
*/
|
||||||
|
public List<UseLabelInfo> getUseLabelList(String username, String... labels) {
|
||||||
|
return getUseLabelList(username, Arrays.asList(labels));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据用途查询应用
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @param labels 用途列表
|
||||||
|
* @return 应用列表
|
||||||
|
*/
|
||||||
|
public List<UseLabelInfo> getUseLabelList(String username, List<String> labels) {
|
||||||
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
|
if (CollectionUtil.isNotEmpty(labels)) {
|
||||||
|
params.put("use_labels", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, labels));
|
||||||
|
}
|
||||||
|
String path = JHApiClient.getUrl(AppPathConstant.APP_USE_LABEL_PATH, params);
|
||||||
|
return get(path, username, new TypeReference<ResponseResult<List<UseLabelInfo>>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.jhinno.sdk.openapi.api.app;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UseLabelInfo {
|
||||||
|
/**
|
||||||
|
* 用途id
|
||||||
|
*/
|
||||||
|
private String useLabelId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用途名称
|
||||||
|
*/
|
||||||
|
private String useLabelName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用途图片
|
||||||
|
*/
|
||||||
|
private String useLabelIcon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用途app列表
|
||||||
|
*/
|
||||||
|
private List<AppstoreAppInfo> apps;
|
||||||
|
}
|
||||||
@@ -196,8 +196,16 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
}
|
}
|
||||||
body.put("uploadPath", uploadPath);
|
body.put("uploadPath", uploadPath);
|
||||||
|
|
||||||
ResponseResult<Object> result = jhApiClient.upload(FilePathConstant.FILE_UPLOAD_PATH, "file", fileName, is, getHeaders(username, false), body, new TypeReference<ResponseResult<Object>>() {
|
ResponseResult<Object> result = getJhApiClient().upload(
|
||||||
});
|
FilePathConstant.FILE_UPLOAD_PATH,
|
||||||
|
"file",
|
||||||
|
fileName,
|
||||||
|
is,
|
||||||
|
getHeaders(username, false),
|
||||||
|
body,
|
||||||
|
new TypeReference<ResponseResult<Object>>() {
|
||||||
|
}
|
||||||
|
);
|
||||||
if (StringUtils.equals(result.getResult(), CommonConstant.FAILED)) {
|
if (StringUtils.equals(result.getResult(), CommonConstant.FAILED)) {
|
||||||
throw new ServiceException(FilePathConstant.FILE_UPLOAD_PATH, result.getCode(), result.getMessage());
|
throw new ServiceException(FilePathConstant.FILE_UPLOAD_PATH, result.getCode(), result.getMessage());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.jhinno.sdk.openapi.utils.JsonUtil;
|
|||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import com.jhinno.sdk.openapi.utils.CollectionUtil;
|
import com.jhinno.sdk.openapi.utils.CollectionUtil;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -355,7 +356,7 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("jobId不能为空!");
|
throw new ArgsException("jobId不能为空!");
|
||||||
}
|
}
|
||||||
String path = JobPathConstant.JOB_PEEK_PATH.replace("{jobId}", jobId);
|
String path = JobPathConstant.JOB_PEEK_PATH.replace("{jobId}", jobId);
|
||||||
ResponseResult<String> result = jhApiClient.get(path, getHeaders(username), new TypeReference<ResponseResult<String>>() {
|
ResponseResult<String> result = getJhApiClient().get(path, getHeaders(username), new TypeReference<ResponseResult<String>>() {
|
||||||
});
|
});
|
||||||
if (StringUtils.equals(result.getResult(), CommonConstant.FAILED)) {
|
if (StringUtils.equals(result.getResult(), CommonConstant.FAILED)) {
|
||||||
throw new ServiceException(path, result.getCode(), result.getMessage());
|
throw new ServiceException(path, result.getCode(), result.getMessage());
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ public class JobPathConstant {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取作业表单
|
* 获取作业表单
|
||||||
|
* <p/>
|
||||||
|
* 该接口目前在Solutions下面维护,未经过产品的测试
|
||||||
*/
|
*/
|
||||||
public static final String JOB_GET_APP_FORM_PATH = "/ws/api/jobs/{appId}/form_params";
|
public static final String JOB_GET_APP_FORM_PATH = "/ws/api/jobs/{appId}/form_params";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -168,4 +168,21 @@ public class AppApiTest {
|
|||||||
System.out.println(jhAppApiExecution.getAppUrl("jhadmin", "myjobmana"));
|
System.out.println(jhAppApiExecution.getAppUrl("jhadmin", "myjobmana"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试根据文件后缀取应用列表
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetAppInfoSuffixList() {
|
||||||
|
System.out.println(jhAppApiExecution.getAppInfoSuffixList("test", ".sh"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试根据用途获取应用列表
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetUseLabelList() {
|
||||||
|
System.out.println(jhAppApiExecution.getUseLabelList("jhadmin"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
75
jhinno-openapi-sdk-spring-boot-example/pom.xml
Normal file
75
jhinno-openapi-sdk-spring-boot-example/pom.xml
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>cim.jhinno</groupId>
|
||||||
|
<artifactId>jhinno-openapi-sdk-spring-boot-example</artifactId>
|
||||||
|
<version>2.0.3</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>Jhinno OpenAPI SDK for Java SpringBoot Example</name>
|
||||||
|
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
|
||||||
|
<url>http://jhinno.com</url>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
|
<version>2.7.18</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jhinno</groupId>
|
||||||
|
<artifactId>jhinno-openapi-sdk-spring-boot-starter</artifactId>
|
||||||
|
<version>2.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<scope>provided</scope>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<includeSystemScope>true</includeSystemScope>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<id>lqyan</id>
|
||||||
|
<name>lqyan</name>
|
||||||
|
<email>lqyan@jhinno.com</email>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>The Apache License, Version 2.0</name>
|
||||||
|
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.jhinno.sdk.openapi.example;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class ExampleApplication {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ExampleApplication.class, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.jhinno.sdk.openapi.example.api.extend;
|
||||||
|
|
||||||
|
public enum FileEnvType {
|
||||||
|
|
||||||
|
HOME_ENV{
|
||||||
|
@Override
|
||||||
|
public String getEnv() {
|
||||||
|
return "home";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SPOOLER_ENV{
|
||||||
|
@Override
|
||||||
|
public String getEnv() {
|
||||||
|
return "spooler";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public abstract String getEnv();
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.jhinno.sdk.openapi.example.api.extend;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class FilePath {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件路径
|
||||||
|
*/
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.jhinno.sdk.openapi.example.api.extend;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum FileSystemType {
|
||||||
|
|
||||||
|
SYSTEM_TYPE_LINUX {
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return "linux";
|
||||||
|
}
|
||||||
|
},
|
||||||
|
SYSTEM_TYPE_WINDOWS {
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return "windows";
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public abstract String getType();
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
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.api.ResponseResult;
|
||||||
|
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class JHFileApiExtendExecution extends JHApiExecution {
|
||||||
|
|
||||||
|
public static String GET_FILE_ENV_PATH = "/ws/api/files/path/{env}";
|
||||||
|
|
||||||
|
public FilePath getFileEnvPath(String username, FileEnvType env, FileSystemType type) {
|
||||||
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
|
if (StringUtils.isNotBlank(type.getType())) {
|
||||||
|
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>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public FilePath getFileHomeEnvPath(String username, FileSystemType type) {
|
||||||
|
return getFileEnvPath(username, FileEnvType.HOME_ENV, type);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
jhinno:
|
||||||
|
openapi:
|
||||||
|
server-url: https://172.17.0.5/appform
|
||||||
|
auth-type: access_secret_mode
|
||||||
|
access-key: 3f03747f147942bd8debd81b6c9c6a80
|
||||||
|
access-key-secret: e0681859b91c499eb1d2c8e09cea3242
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.jhinno.sdk.openapi.example.test.extend;
|
||||||
|
|
||||||
|
import com.jhinno.sdk.openapi.example.api.extend.FileSystemType;
|
||||||
|
import com.jhinno.sdk.openapi.example.api.extend.JHFileApiExtendExecution;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
public class JHFileApiExtendTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JHFileApiExtendExecution jhFileApiExtendExecution;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testGetFileHomeEnvPath() {
|
||||||
|
System.out.println(jhFileApiExtendExecution.getFileHomeEnvPath("jhadmin", FileSystemType.SYSTEM_TYPE_LINUX));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<artifactId>jhinno-openapi-sdk-spring-boot-starter</artifactId>
|
<artifactId>jhinno-openapi-sdk-spring-boot-starter</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.3</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>Jhinno OpenAPI SDK for Java SpringBoot Starter</name>
|
<name>Jhinno OpenAPI SDK for Java SpringBoot Starter</name>
|
||||||
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
|
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
|
||||||
@@ -14,15 +14,14 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.jhinno</groupId>
|
<groupId>com.jhinno</groupId>
|
||||||
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
|
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.3</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.jhinno</groupId>
|
<groupId>com.jhinno</groupId>
|
||||||
<artifactId>jhinno-openapi-java-sdk</artifactId>
|
<artifactId>jhinno-openapi-java-sdk</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -44,22 +43,15 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>jhinno-releases</id>
|
|
||||||
<url>http://192.168.87.22:8081/repository/maven-releases</url>
|
|
||||||
</repository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<compileSourceRoots>src/main/java</compileSourceRoots>
|
||||||
<source>${maven.compiler.source}</source>
|
<source>${maven.compiler.source}</source>
|
||||||
<target>${maven.compiler.target}</target>
|
<target>${maven.compiler.target}</target>
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
@@ -84,7 +76,6 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
<version>3.6.3</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<sourcepath>target/generated-sources/delombok</sourcepath>
|
<sourcepath>target/generated-sources/delombok</sourcepath>
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
<encoding>${project.build.sourceEncoding}</encoding>
|
||||||
@@ -99,38 +90,7 @@
|
|||||||
</tags>
|
</tags>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
|
||||||
<version>3.3.0</version>
|
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<id>attach-sources</id>
|
|
||||||
<goals>
|
|
||||||
<goal>jar-no-fork</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<id>lqyan</id>
|
|
||||||
<name>lqyan</name>
|
|
||||||
<email>lqyan@jhinno.com</email>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>The Apache License, Version 2.0</name>
|
|
||||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
package com.jhinno.sdk.openapi.autoconfigure;
|
package com.jhinno.sdk.openapi.autoconfigure;
|
||||||
|
|
||||||
import com.jhinno.sdk.openapi.api.JHApiExecution;
|
|
||||||
import com.jhinno.sdk.openapi.api.app.JHAppApiExecution;
|
import com.jhinno.sdk.openapi.api.app.JHAppApiExecution;
|
||||||
import com.jhinno.sdk.openapi.api.data.JHDataApiExecution;
|
import com.jhinno.sdk.openapi.api.data.JHDataApiExecution;
|
||||||
import com.jhinno.sdk.openapi.api.file.JHFileApiExecution;
|
import com.jhinno.sdk.openapi.api.file.JHFileApiExecution;
|
||||||
import com.jhinno.sdk.openapi.api.job.JHJobApiExecution;
|
import com.jhinno.sdk.openapi.api.job.JHJobApiExecution;
|
||||||
import com.jhinno.sdk.openapi.api.organization.JHDepartmentApiExecution;
|
import com.jhinno.sdk.openapi.api.organization.JHDepartmentApiExecution;
|
||||||
import com.jhinno.sdk.openapi.api.organization.JHUserApiExecution;
|
import com.jhinno.sdk.openapi.api.organization.JHUserApiExecution;
|
||||||
import com.jhinno.sdk.openapi.client.JHApiClient;
|
import com.jhinno.sdk.openapi.utils.JHOpenApiConfig;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -23,61 +22,34 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
public class JHOpenapiExecutionAutoconfigure {
|
public class JHOpenapiExecutionAutoconfigure {
|
||||||
|
|
||||||
|
|
||||||
private final JHOpenapiProperties properties;
|
@Bean
|
||||||
private final JHApiClient client;
|
public JHAppApiExecution appApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
||||||
|
return jhOpenApiConfig.configJHApiExecution(new JHAppApiExecution());
|
||||||
|
|
||||||
public void init(JHApiExecution apiExecution) {
|
|
||||||
apiExecution.setJhApiClient(client);
|
|
||||||
apiExecution.setForceGetToken(properties.isForceGetToken());
|
|
||||||
apiExecution.setAuthType(properties.getAuthType());
|
|
||||||
apiExecution.setAccessKey(properties.getAccessKey());
|
|
||||||
apiExecution.setAccessKeySecret(properties.getAccessKeySecret());
|
|
||||||
apiExecution.setTokenTimeout(properties.getTokenTimeout());
|
|
||||||
apiExecution.setTokenResidueTime(properties.getTokenResidueTime());
|
|
||||||
apiExecution.setUsedServerTime(properties.isUsedServerTime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JHAppApiExecution appApiExecution() {
|
public JHDataApiExecution dataApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
||||||
JHAppApiExecution jhAppApiExecution = new JHAppApiExecution();
|
return jhOpenApiConfig.configJHApiExecution(new JHDataApiExecution());
|
||||||
init(jhAppApiExecution);
|
|
||||||
return jhAppApiExecution;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public JHDataApiExecution dataApiExecution() {
|
|
||||||
JHDataApiExecution dataApiExecution = new JHDataApiExecution();
|
|
||||||
init(dataApiExecution);
|
|
||||||
return dataApiExecution;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JHFileApiExecution fileApiExecution() {
|
public JHFileApiExecution fileApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
||||||
JHFileApiExecution fileApiExecution = new JHFileApiExecution();
|
return jhOpenApiConfig.configJHApiExecution(new JHFileApiExecution());
|
||||||
init(fileApiExecution);
|
|
||||||
return fileApiExecution;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JHJobApiExecution jobApiExecution() {
|
public JHJobApiExecution jobApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
||||||
JHJobApiExecution jobApiExecution = new JHJobApiExecution();
|
return jhOpenApiConfig.configJHApiExecution(new JHJobApiExecution());
|
||||||
init(jobApiExecution);
|
|
||||||
return jobApiExecution;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JHDepartmentApiExecution departmentApiExecution() {
|
public JHDepartmentApiExecution departmentApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
||||||
JHDepartmentApiExecution departmentApiExecution = new JHDepartmentApiExecution();
|
return jhOpenApiConfig.configJHApiExecution(new JHDepartmentApiExecution());
|
||||||
init(departmentApiExecution);
|
|
||||||
return departmentApiExecution;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JHUserApiExecution userApiExecution() {
|
public JHUserApiExecution userApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
||||||
JHUserApiExecution userApiExecution = new JHUserApiExecution();
|
return jhOpenApiConfig.configJHApiExecution(new JHUserApiExecution());
|
||||||
init(userApiExecution);
|
|
||||||
return userApiExecution;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.jhinno.sdk.openapi.utils;
|
||||||
|
|
||||||
|
import com.jhinno.sdk.openapi.api.JHApiExecution;
|
||||||
|
import com.jhinno.sdk.openapi.autoconfigure.JHOpenapiProperties;
|
||||||
|
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class JHOpenApiConfig {
|
||||||
|
|
||||||
|
private final JHApiClient client;
|
||||||
|
private final JHOpenapiProperties properties;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置执行器
|
||||||
|
*
|
||||||
|
* @param execution 执行器
|
||||||
|
* @param <T> 执行器类型
|
||||||
|
* @return 配置的执行器
|
||||||
|
*/
|
||||||
|
public <T extends JHApiExecution> T configJHApiExecution(T execution) {
|
||||||
|
execution.setJhApiClient(client);
|
||||||
|
execution.setForceGetToken(properties.isForceGetToken());
|
||||||
|
execution.setAuthType(properties.getAuthType());
|
||||||
|
execution.setAccessKey(properties.getAccessKey());
|
||||||
|
execution.setAccessKeySecret(properties.getAccessKeySecret());
|
||||||
|
execution.setTokenTimeout(properties.getTokenTimeout());
|
||||||
|
execution.setTokenResidueTime(properties.getTokenResidueTime());
|
||||||
|
execution.setUsedServerTime(properties.isUsedServerTime());
|
||||||
|
return execution;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||||
com.jhinno.sdk.openapi.autoconfigure.JHOpenapiClientAutoConfigure,\
|
com.jhinno.sdk.openapi.autoconfigure.JHOpenapiClientAutoConfigure,\
|
||||||
|
com.jhinno.sdk.openapi.utils.JHOpenApiConfig,\
|
||||||
com.jhinno.sdk.openapi.autoconfigure.JHOpenapiExecutionAutoconfigure
|
com.jhinno.sdk.openapi.autoconfigure.JHOpenapiExecutionAutoconfigure
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
com.jhinno.sdk.openapi.autoconfigure.JHOpenapiClientAutoConfigure
|
com.jhinno.sdk.openapi.autoconfigure.JHOpenapiClientAutoConfigure
|
||||||
|
com.jhinno.sdk.openapi.utils.JHOpenApiConfig
|
||||||
com.jhinno.sdk.openapi.autoconfigure.JHOpenapiExecutionAutoconfigure
|
com.jhinno.sdk.openapi.autoconfigure.JHOpenapiExecutionAutoconfigure
|
||||||
74
pom.xml
74
pom.xml
@@ -6,11 +6,11 @@
|
|||||||
|
|
||||||
<groupId>com.jhinno</groupId>
|
<groupId>com.jhinno</groupId>
|
||||||
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
|
<artifactId>jhinno-openapi-java-sdk-parent</artifactId>
|
||||||
<version>2.0.0</version>
|
<version>2.0.3</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>Jhinno OpenAPI SDK for Java parent</name>
|
<name>Jhinno OpenAPI SDK for Java parent</name>
|
||||||
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
|
<description>The Jhinno OpenAPI SDK for Java used for accessing Jhinno OpenApi Service</description>
|
||||||
<url>http://jhinno.com</url>
|
<url>https://github.com/yanlongqi/jhinno-openapi-java-sdk</url>
|
||||||
|
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@@ -27,19 +27,61 @@
|
|||||||
<version>2.7.18</version>
|
<version>2.7.18</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
|
|
||||||
<distributionManagement>
|
|
||||||
<repository>
|
|
||||||
<id>jhinno-releases</id>
|
|
||||||
<url>http://192.168.87.22:8081/repository/maven-releases</url>
|
|
||||||
</repository>
|
|
||||||
</distributionManagement>
|
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>jhinno-openapi-java-sdk</module>
|
<module>jhinno-openapi-java-sdk</module>
|
||||||
<module>jhinno-openapi-sdk-spring-boot-starter</module>
|
<module>jhinno-openapi-sdk-spring-boot-starter</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.sonatype.central</groupId>
|
||||||
|
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||||
|
<version>0.5.0</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<publishingServerId>central</publishingServerId>
|
||||||
|
<autoPublish>true</autoPublish>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<version>1.6</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<gpgArguments>
|
||||||
|
<arg>--pinentry-mode</arg>
|
||||||
|
<arg>loopback</arg>
|
||||||
|
</gpgArguments>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
<developer>
|
<developer>
|
||||||
@@ -56,4 +98,16 @@
|
|||||||
</license>
|
</license>
|
||||||
</licenses>
|
</licenses>
|
||||||
|
|
||||||
|
<issueManagement>
|
||||||
|
<system>github</system>
|
||||||
|
<url>https://github.com/yanlongqi/jhinno-openapi-java-sdk/issues</url>
|
||||||
|
</issueManagement>
|
||||||
|
|
||||||
|
<scm>
|
||||||
|
<connection>scm:git:https://github.com/yanlongqi/jhinno-openapi-java-sdk.git</connection>
|
||||||
|
<developerConnection>scm:git:https://github.com/yanlongqi/jhinno-openapi-java-sdk.git</developerConnection>
|
||||||
|
<url>https://github.com/yanlongqi/jhinno-openapi-java-sdk</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
Reference in New Issue
Block a user