mirror of
https://github.com/yanlongqi/jhinno-openapi-java-sdk.git
synced 2026-03-22 06:15:10 +08:00
Compare commits
27 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
683037c60d | ||
|
|
b09feb2cb5 | ||
|
|
d2d80d4988 | ||
|
|
12cdeba2eb | ||
|
|
3abfd182f9 | ||
|
|
a125e7c493 | ||
|
|
53f7ea1c92 | ||
|
|
4752f8e577 | ||
|
|
76933effe3 | ||
|
|
88333ed930 | ||
|
|
0c2e7b96ec | ||
|
|
206ea8ac5a | ||
|
|
3b2ea5f061 | ||
|
|
3343aa9ca4 | ||
|
|
b0c104a1c9 | ||
|
|
fcb78277fe | ||
| 59ca7bfe4a | |||
|
|
98c1bb8d9f | ||
|
|
31b9a53799 | ||
|
|
2765639cff | ||
|
|
85aef61455 | ||
|
|
9aecf0b6a2 | ||
|
|
4054c373b1 | ||
|
|
72f508c14f | ||
|
|
9ae5d9acd2 | ||
|
|
58209849dc | ||
|
|
55838a455f |
31
.github/workflows/release.yml
vendored
Normal file
31
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
name: deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
# 支持手动触发构建
|
||||||
|
workflow_dispatch:
|
||||||
|
release:
|
||||||
|
types: [released]
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 拉取源码
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Set up Apache Maven Central
|
||||||
|
uses: actions/setup-java@v4
|
||||||
|
with:
|
||||||
|
java-version: 8.0.302+8
|
||||||
|
distribution: 'temurin'
|
||||||
|
cache: maven
|
||||||
|
server-id: central
|
||||||
|
server-username: MAVEN_USERNAME
|
||||||
|
server-password: MAVEN_CENTRAL_TOKEN
|
||||||
|
gpg-passphrase: MAVEN_GPG_PASSPHRASE
|
||||||
|
gpg-private-key: ${{ secrets.GPG_SECRET }}
|
||||||
|
- name: Publish to Apache Maven Central
|
||||||
|
run: mvn deploy
|
||||||
|
env:
|
||||||
|
MAVEN_USERNAME: ${{ secrets.OSSRH_USER }}
|
||||||
|
MAVEN_CENTRAL_TOKEN: ${{ secrets.OSSRH_PASSWORD }}
|
||||||
|
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSWORD }}
|
||||||
244
README.md
244
README.md
@@ -1,22 +1,23 @@
|
|||||||
# 1. Jhinno OpenAPI SDK for Java
|
# 1. Jhinno OpenAPI SDK for Java
|
||||||
|
|
||||||
针对Java的景行API SDK使Java开发人员能够轻松使用景行API接口。您可以在几分钟内开始通过Maven或jar文件使用它。
|
针对 Java 的景行 API SDK 使 Java 开发人员能够轻松使用景行 API 接口。您可以在几分钟内开始通过 Maven 或 jar 文件使用它。
|
||||||
|
|
||||||
- [仓库地址:https://github.com/yanlongqi/jhinno-openapi-java-sdk](https://github.com/yanlongqi/jhinno-openapi-java-sdk)
|
- [仓库地址:https://github.com/yanlongqi/jhinno-openapi-java-sdk](https://github.com/yanlongqi/jhinno-openapi-java-sdk)
|
||||||
- [开发文档:https://jhinno-sdk-doc.yuchat.top/apidocs](https://jhinno-sdk-doc.yuchat.top/apidocs)
|
- [jar 包下载:https://github.com/yanlongqi/jhinno-openapi-java-sdk/releases](https://github.com/yanlongqi/jhinno-openapi-java-sdk/releases)
|
||||||
- [jar包下载:https://github.com/yanlongqi/jhinno-openapi-java-sdk/releases](https://github.com/yanlongqi/jhinno-openapi-java-sdk/releases)
|
|
||||||
|
|
||||||
## 1.1 必要条件
|
## 1.1 必要条件
|
||||||
|
|
||||||
- Java 1.8 or later
|
- Java 1.8 or later
|
||||||
- Maven
|
- Maven
|
||||||
|
|
||||||
## 1.2 支持的Appform的版本
|
## 1.2 支持的 Appform 的版本
|
||||||
|
|
||||||
1. JH_Appform_6.0_Release
|
1. JH_Appform_6.0_Release
|
||||||
2. JH_Appform_6.0_SP1_Release
|
2. JH_Appform_6.0_SP1_Release
|
||||||
3. JH_Appform_6.1_Release
|
3. JH_Appform_6.1_Release
|
||||||
3. JH_Appform_6.2_Release(6.2以前用1.x.x版本)
|
4. JH_Appform_6.2_Release(使用: release-2.0.3)
|
||||||
|
5. JH_Appform_6.3_Release(使用: release-2.0.4)
|
||||||
|
5. JH_Appform_6.3_Release(使用: release-2.0.5)
|
||||||
|
|
||||||
# 2. 快速开始
|
# 2. 快速开始
|
||||||
|
|
||||||
@@ -24,9 +25,9 @@
|
|||||||
|
|
||||||
### 2.1.1 安装
|
### 2.1.1 安装
|
||||||
|
|
||||||
建议在您的项目中使用Jhinno OpenAPI SDK for Java的方法是从Maven中使用它。:
|
建议在您的项目中使用 Jhinno OpenAPI SDK for Java 的方法是从 Maven 中使用它。:
|
||||||
|
|
||||||
#### 方法一:通过命令将jar包导入本地Maven仓库(无网络开发额外配置)
|
#### 方法一:通过命令将 jar 包导入本地 Maven 仓库
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
||||||
@@ -42,12 +43,13 @@ 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-sources.jar 为源码包,添加可方便查看SDK代码的注释。
|
> - jhinno-openapi-java-sdk-x.x.x.jar 为 SDK 的 jar 包。
|
||||||
> - jhinno-openapi-sdk-spring-boot-starter-x.x.x.jar 为SDK的spring-boot-starter的jar包。
|
> - jhinno-openapi-java-sdk-x.x.x-sources.jar 为源码包,添加可方便查看 SDK 代码的注释。
|
||||||
> - jhinno-openapi-sdk-spring-boot-starter-x.x.x-sources.jar 为SDK的spring-boot-starter的源码包。
|
> - 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 的源码包。
|
||||||
|
|
||||||
#### 方法二:通过源码导入(无网络开发额外配置)
|
#### 方法二:通过源码导入
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/yanlongqi/jhinno-openapi-java-sdk.git
|
git clone https://github.com/yanlongqi/jhinno-openapi-java-sdk.git
|
||||||
@@ -66,16 +68,21 @@ mvn clean install
|
|||||||
</dependency>
|
</dependency>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### 方法三:直接使用 jar 包
|
||||||
|
|
||||||
|
如果开发环境没有网络,或者没有使用 maven 的构建工具,则可以使用 jar 包的方式导入。下载`dependency-jar.zip`和`jhinno-openapi-java-sdk-2.0.3-sources.jar`、`jhinno-openapi-java-sdk-2.0.3.jar`导入到你的 java 项目的 lib 里面。如果你的项目是 SpringBoot 项目,则还需要导入`jhinno-openapi-sdk-spring-boot-starter-2.0.3.jar`、`jhinno-openapi-sdk-spring-boot-starter-2.0.3-sources.jar
|
||||||
|
`这两个 jar 包。
|
||||||
|
|
||||||
### 2.1.3 配置
|
### 2.1.3 配置
|
||||||
|
|
||||||
在SpringBoot的`application.properties`或`application.yml`里面配置
|
在 SpringBoot 的`application.properties`或`application.yml`里面配置
|
||||||
|
|
||||||
#### 2.1.3.1 application.yaml
|
#### 2.1.3.1 application.yaml
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
jhinno:
|
jhinno:
|
||||||
openapi:
|
openapi:
|
||||||
server-url: https://172.17.0.5/appform
|
server-url: https://172.17.0.5
|
||||||
access-key: xxxxx
|
access-key: xxxxx
|
||||||
access-key-secret: xxxx
|
access-key-secret: xxxx
|
||||||
auth-type: access_secret_mode
|
auth-type: access_secret_mode
|
||||||
@@ -84,7 +91,7 @@ jhinno:
|
|||||||
#### 2.1.3.2 application.properties
|
#### 2.1.3.2 application.properties
|
||||||
|
|
||||||
```properties
|
```properties
|
||||||
jhinno.openapi.server-url=https://{appform服务器的地址}/appform
|
jhinno.openapi.server-url=https://{appform服务器的地址}
|
||||||
jhinno.openapi.access-key=xxxxx
|
jhinno.openapi.access-key=xxxxx
|
||||||
jhinno.openapi.access-key-secret=xxxx
|
jhinno.openapi.access-key-secret=xxxx
|
||||||
jhinno.openapi.auth-type=access_secret_mode
|
jhinno.openapi.auth-type=access_secret_mode
|
||||||
@@ -92,10 +99,13 @@ jhinno.openapi.auth-type=access_secret_mode
|
|||||||
```
|
```
|
||||||
|
|
||||||
> 注:
|
> 注:
|
||||||
> - 其中`jhinno.openapi.server-url`为景行接口服务的BaseUrl;
|
>
|
||||||
> - `auth-type` 认证类型,`token_mode`(Token认证) 和 `access_secret_mode`(AccessKey认证);Appform Release 6.2 `token_mode`
|
> - 其中`jhinno.openapi.server-url`为景行接口服务的 BaseUrl;
|
||||||
|
> - `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`源码。
|
||||||
|
|
||||||
@@ -127,9 +137,9 @@ public class DemoUserSDK {
|
|||||||
|
|
||||||
### 2.2.1 安装
|
### 2.2.1 安装
|
||||||
|
|
||||||
建议在您的项目中使用Jhinno OpenAPI SDK for Java的方法是从Maven中使用它。:
|
建议在您的项目中使用 Jhinno OpenAPI SDK for Java 的方法是从 Maven 中使用它。:
|
||||||
|
|
||||||
#### 方法一:通过命令将jar包导入本地Maven仓库(无网络开发额外配置)
|
#### 方法一:通过命令将 jar 包导入本地 Maven 仓库(无网络开发额外配置)
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
|
|
||||||
@@ -140,8 +150,9 @@ 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-sources.jar 为源码包,添加可方便查看SDK代码的注释。
|
> - jhinno-openapi-java-sdk-x.x.x.jar 为 SDK 的 jar 包。
|
||||||
|
> - jhinno-openapi-java-sdk-x.x.x-sources.jar 为源码包,添加可方便查看 SDK 代码的注释。
|
||||||
|
|
||||||
#### 方法二:通过源码导入(无网络开发额外配置)
|
#### 方法二:通过源码导入(无网络开发额外配置)
|
||||||
|
|
||||||
@@ -164,33 +175,25 @@ mvn clean install
|
|||||||
|
|
||||||
### 2.2.3 配置
|
### 2.2.3 配置
|
||||||
|
|
||||||
spring.xml添加以下内容
|
spring.xml 添加以下内容
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<beans>
|
<beans>
|
||||||
<bean id="apiClient" class="com.jhinno.sdk.openapi.client.JHApiClient" init-method="initDefaultApiClient">
|
<bean id="apiClient" class="com.jhinno.sdk.openapi.client.JHApiClient" init-method="initDefaultApiClient">
|
||||||
<constructor-arg value="https://172.17.0.5/appform"/>
|
<constructor-arg value="https://172.17.0.5"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="appApiExecution" class="com.jhinno.sdk.openapi.api.app.JHAppApiExecution">
|
<bean id="requestExecution" class="com.jhinno.sdk.openapi.api.JHRequestExecution">
|
||||||
<constructor-arg ref="apiClient"/>
|
<constructor-arg ref="apiClient" />
|
||||||
</bean>
|
|
||||||
<bean id="dataApiExecution" class="com.jhinno.sdk.openapi.api.data.JHDataApiExecution">
|
|
||||||
<constructor-arg ref="apiClient"/>
|
|
||||||
</bean>
|
|
||||||
<bean id="fileApiExecution" class="com.jhinno.sdk.openapi.api.file.JHFileApiExecution">
|
|
||||||
<constructor-arg ref="apiClient"/>
|
|
||||||
</bean>
|
|
||||||
<bean id="jhJobApiExecution" class="com.jhinno.sdk.openapi.api.job.JHJobApiExecution">
|
|
||||||
<constructor-arg ref="apiClient"/>
|
|
||||||
</bean>
|
|
||||||
<bean id="departmentApiExecution" class="com.jhinno.sdk.openapi.api.organization.JHDepartmentApiExecution">
|
|
||||||
<constructor-arg ref="apiClient"/>
|
|
||||||
</bean>
|
|
||||||
<bean id="userApiExecution" class="com.jhinno.sdk.openapi.api.organization.JHUserApiExecution">
|
|
||||||
<constructor-arg ref="apiClient"/>
|
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
|
<bean id="appApiExecution" class="com.jhinno.sdk.openapi.api.app.JHAppApiExecution" init-method="init"></bean>
|
||||||
|
<bean id="dataApiExecution" class="com.jhinno.sdk.openapi.api.data.JHDataApiExecution" init-method="init"></bean>
|
||||||
|
<bean id="fileApiExecution" class="com.jhinno.sdk.openapi.api.file.JHFileApiExecution" init-method="init"></bean>
|
||||||
|
<bean id="jhJobApiExecution" class="com.jhinno.sdk.openapi.api.job.JHJobApiExecution" init-method="init"></bean>
|
||||||
|
<bean id="departmentApiExecution" class="com.jhinno.sdk.openapi.api.organization.JHDepartmentApiExecution" init-method="init"></bean>
|
||||||
|
<bean id="userApiExecution" class="com.jhinno.sdk.openapi.api.organization.JHUserApiExecution" init-method="init"></bean>
|
||||||
</beans>
|
</beans>
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -218,7 +221,7 @@ public class DemoUserSDK {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## 2.3 普通java项目
|
## 2.3 普通 java 项目
|
||||||
|
|
||||||
### 2.3.1 安装
|
### 2.3.1 安装
|
||||||
|
|
||||||
@@ -243,97 +246,166 @@ public class DemoUserSDK {
|
|||||||
|
|
||||||
具体的使用步骤如下:
|
具体的使用步骤如下:
|
||||||
|
|
||||||
1. 创建一个`JHApiClient`客户端,此为HTTP连接池,为确保资源浪费,需保证全局唯一,每次创建执行器都使用个客户端。
|
1. 创建一个`JHApiClient`客户端,此为 HTTP 连接池,为确保资源浪费,需保证全局唯一,每次创建执行器都使用个客户端。
|
||||||
2. 创建接口的执行器,即:`JHxxxApiExecution`,如:`JHAppApiExecution`。
|
2. 创建接口的执行器,即:`JHxxxApiExecution`,如:`JHAppApiExecution`。
|
||||||
3. 调用接口执行器的方法,使用景行接口资源,如下代码片段。
|
3. 调用接口执行器的方法,使用景行接口资源,如下代码片段。
|
||||||
|
|
||||||
```java
|
```java
|
||||||
|
|
||||||
public class DemoUserSDK {
|
public class JHApiUtile {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JHApiClient 是一个HTTP连接池,开发者需要复用
|
* 创建一个API执行器管理器
|
||||||
* 其中https://172.17.0.5/appform为景行API服务的地址
|
|
||||||
* 注意: JHApiClient为内置的http连接池,系统只需要初始化一份即可(单例调用)。
|
|
||||||
*/
|
*/
|
||||||
public static final JHApiClient client = new JHApiClient("https://172.17.0.5/appform");
|
public static final JHApiExecutionManage API_EXECUTION_MANAGE = new JHApiExecutionManage("https://192.168.87.24");
|
||||||
|
|
||||||
public static final Map<Class<? extends JHApiExecution>, JHApiExecution> jhApiClientMap = new HashMap<>();
|
|
||||||
|
|
||||||
public static final String ACCESS_KEY = "3f03747f147942bd8debd81b6c9c6a80";
|
public static final String ACCESS_KEY = "3f03747f147942bd8debd81b6c9c6a80";
|
||||||
|
|
||||||
public static final String ACCESS_KEY_SECRET = "e0681859b91c499eb1d2c8e09cea3242";
|
public static final String ACCESS_KEY_SECRET = "e0681859b91c499eb1d2c8e09cea3242";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
client.initDefaultApiClient();
|
// 配置API执行器管理器,设置认证信息等。
|
||||||
jhApiClientMap.put(JHAppApiExecution.class, new JHAppApiExecution());
|
API_EXECUTRON_MANAGE.configureApiExecution(t -> {
|
||||||
jhApiClientMap.put(JHDataApiExecution.class, new JHDataApiExecution());
|
// 默认为使用Token模式,如何使用的Token模式,则不需要配置ACCESS_KEY和ACCESS_KEY SECRET
|
||||||
jhApiClientMap.put(JHFileApiExecution.class, new JHFileApiExecution());
|
// t.setAuthType(AuthType.ACCESS_KEY);
|
||||||
jhApiClientMap.put(JHJobApiExecution.class, new JHJobApiExecution());
|
t.setAccessKey(ACCESS_KEY);
|
||||||
jhApiClientMap.put(JHDepartmentApiExecution.class, new JHDepartmentApiExecution());
|
t.setAccessKeySecret(ACCESS_KEY_SECRET);
|
||||||
jhApiClientMap.put(JHUserApiExecution.class, new JHUserApiExecution());
|
|
||||||
|
|
||||||
jhApiClientMap.forEach((k, v) -> {
|
|
||||||
v.setJhApiClient(client);
|
|
||||||
v.setAuthType(AuthType.ACCESS_SECRET_MODE);
|
|
||||||
v.setAccessKey(ACCESS_KEY);
|
|
||||||
v.setAccessKeySecret(ACCESS_KEY_SECRET);
|
|
||||||
v.setUsedServerTime(true);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
// 初始化一个调用调用景行会话服务接口执行器
|
// 从API执行器管理器取出调用应用相关接口的执行器
|
||||||
JHAppApiExecution jhAppApiExecution = (JHAppApiExecution) jhApiClientMap.get(JHAppApiExecution.class);
|
JHAppApiExecution jhAppApiExecution = JHClientConfig.API_EXECUTION_MANAGE.getApiExecution(JHAppApiExecution.class);
|
||||||
|
|
||||||
// 调用启动会话的接口
|
// 调用启动会话的接口
|
||||||
AppStartedInfo appStartedInfo = jhAppApiExecution.desktopStart("jhadmin", "linux_desktop", new AppStartRequest());
|
jhAppApiExecution.desktopStart("jhadmin", "linux_desktop");
|
||||||
|
|
||||||
// 打印接口的调用结果
|
|
||||||
System.out.println(appStartedInfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
# 3. 支持SDK的扩展
|
# 3. 支持 SDK 的扩展
|
||||||
|
|
||||||
如果是基于景行定制的接口,本SDK没有包含这些方法,因此您可以基于`JHApiExecution`快速进行扩展,具体的扩展步骤如下:
|
如果是基于景行定制的接口,本 SDK 没有包含这些方法,因此您可以基于`JHApiExecution`快速进行扩展,具体的扩展步骤如下:
|
||||||
|
|
||||||
- 新建需要扩展的执行器命名为`JHxxxApiExecution`,并继承`JHApiExecution`;
|
- 新建需要扩展的执行器命名为`JHxxxApiExecution`,并继承`JHApiExecution`;
|
||||||
- 编写基于接口调用的方法;
|
- 编写基于接口调用的方法;
|
||||||
|
|
||||||
父类提供了封装好的`get`、`post`、`put`、`delete`方法,可以直接使用,而不考虑token的问题
|
父类提供了封装好的`get`、`post`、`put`、`delete`方法,可以直接使用,而不考虑 token 的问题
|
||||||
|
|
||||||
|
## 3.1 SpringBoot 项目
|
||||||
|
|
||||||
|
### 3.1.1 方式一
|
||||||
|
|
||||||
|
通过实现`JHApiExecution`接口,实现自定义的`JHDemoApiExecution`,并注册到 Spring 容器中。
|
||||||
|
|
||||||
```java
|
```java
|
||||||
/**
|
/**
|
||||||
* 注意:一下代码为伪代码,需要根据实际的情况进行修改,其示例代码可参照SDK中JHApiExecution子类的实现
|
* 注意:一下代码为伪代码,需要根据实际的情况进行修改,其示例代码可参照SDK中JHDemoApiExecution子类的实现
|
||||||
*/
|
*/
|
||||||
public class JHAppApiExecution extends JHApiExecution {
|
@Component
|
||||||
|
public class JHDemoApiExecution extends JHApiExecution {
|
||||||
|
|
||||||
/**
|
private JHRequestExecution execution;
|
||||||
* 获取一个执行器的实例
|
|
||||||
*
|
@Override
|
||||||
* @param jhApiClient 请求的客户端
|
public void init(JHRequestExecution execution) {
|
||||||
*/
|
this.execution = execution;
|
||||||
public JHAppApiExecution(JHApiClient jhApiClient) {
|
|
||||||
super(jhApiClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public XxxDTO getXXXX(String username, String demoParams) {
|
public XxxDTO getXXXX(String username, String demoParams) {
|
||||||
|
|
||||||
return get("/demo/path", username, new TypeReference<ResponseResult<XxxDTO>>() {
|
return execution.get("/demo/path", username, new TypeReference<ResponseResult<XxxDTO>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### 3.1.2 方式二
|
||||||
|
|
||||||
|
通过注入 `JHRequestExecution` 的方式来注入
|
||||||
|
|
||||||
|
```java
|
||||||
|
/**
|
||||||
|
* 注意:一下代码为伪代码,需要根据实际的情况进行修改,其示例代码可参照SDK中JHDemoApiExecution子类的实现
|
||||||
|
*/
|
||||||
|
public class JHDemoApiExecution extends JHApiExecution {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JHRequestExecution execution;
|
||||||
|
|
||||||
|
public XxxDTO getXXXX(String username, String demoParams) {
|
||||||
|
|
||||||
|
// ResponseResult<XxxDTO> 可以参照接口文档定义自己的数据传输对象
|
||||||
|
return execution.get("/demo/path", username, new TypeReference<ResponseResult<XxxDTO>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
# 3.2 非 SpringBoot 项目
|
||||||
|
|
||||||
|
```java
|
||||||
|
/**
|
||||||
|
* 注意:一下代码为伪代码,需要根据实际的情况进行修改,其示例代码可参照SDK中JHDemoApiExecution子类的实现
|
||||||
|
*/
|
||||||
|
public class JHDemoApiExecution extends JHApiExecution {
|
||||||
|
|
||||||
|
private JHRequestExecution execution;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(JHRequestExecution execution) {
|
||||||
|
this.execution = execution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public XxxDTO getXXXX(String username, String demoParams) {
|
||||||
|
|
||||||
|
return execution.get("/demo/path", username, new TypeReference<ResponseResult<XxxDTO>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class JHApiUtile {
|
||||||
|
|
||||||
|
public static final JHApiExecutionManage API_EXECUTION_MANAGE = new JHApiExecutionManage("https://192.168.87.24");
|
||||||
|
|
||||||
|
public static final String ACCESS_KEY = "3f03747f147942bd8debd81b6c9c6a80";
|
||||||
|
|
||||||
|
public static final String ACCESS_KEY_SECRET = "e0681859b91c499eb1d2c8e09cea3242";
|
||||||
|
|
||||||
|
static {
|
||||||
|
// 配置API执行器管理器,设置认证信息等。
|
||||||
|
API_EXECUTRON_MANAGE.configureApiExecution(t -> {
|
||||||
|
// 默认为使用Token模式,如何使用的Token模式,则不需要配置ACCESS_KEY和ACCESS_KEY SECRET
|
||||||
|
// t.setAuthType(AuthType.ACCESS_KEY);
|
||||||
|
t.setAccessKey(ACCESS_KEY);
|
||||||
|
t.setAccessKeySecret(ACCESS_KEY_SECRET);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 注册自定义的API执行器,会自动配置你自定义的执行器
|
||||||
|
API_EXECUTRON_MANAGE.registerApiExecution(new JHDemoApiExecution());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
// 从API执行器管理器取出调用应用相关接口的执行器
|
||||||
|
JHDemoApiExecution jhAppApiExecution = JHClientConfig.API_EXECUTION_MANAGE.getApiExecution(JHDemoApiExecution.class);
|
||||||
|
|
||||||
|
// 调用启动会话的接口
|
||||||
|
jhAppApiExecution.getXXXX("jhadmin", "xxxx");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
# 4. 构建
|
# 4. 构建
|
||||||
|
|
||||||
一旦您检出代码,就可以使用Maven构建它。使用以下命令进行构建:
|
一旦您检出代码,就可以使用 Maven 构建它。使用以下命令进行构建:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
mvn clean package
|
mvn clean package
|
||||||
@@ -341,8 +413,8 @@ mvn clean package
|
|||||||
|
|
||||||
# 5. 代码贡献
|
# 5. 代码贡献
|
||||||
|
|
||||||
- 代码必须格式化,使用IDEA自带的格式即可;
|
- 代码必须格式化,使用 IDEA 自带的格式即可;
|
||||||
- 请求路径必须放在一个单独的const类中统一维护,具体可参考现有代码提交;
|
- 请求路径必须放在一个单独的 const 类中统一维护,具体可参考现有代码提交;
|
||||||
- 封装新的接口是需要继承`JHApiExecution`,调用父类的辅助方法辅助封装;
|
- 封装新的接口是需要继承`JHApiExecution`,调用父类的辅助方法辅助封装;
|
||||||
|
|
||||||
# 6. 作者
|
# 6. 作者
|
||||||
|
|||||||
@@ -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.3</version>
|
<version>2.0.5</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.3</version>
|
<version>2.0.5</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@@ -77,53 +77,4 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<compileSourceRoots>src/main/java</compileSourceRoots>
|
|
||||||
<source>${maven.compiler.source}</source>
|
|
||||||
<target>${maven.compiler.target}</target>
|
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok-maven-plugin</artifactId>
|
|
||||||
<version>1.18.0.0</version>
|
|
||||||
<configuration>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
<sourceDirectory>src/main/java</sourceDirectory>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<sourcepath>target/generated-sources/delombok</sourcepath>
|
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
|
||||||
<docencoding>${project.build.sourceEncoding}</docencoding>
|
|
||||||
<charset>${project.build.sourceEncoding}</charset>
|
|
||||||
<doclint>none</doclint>
|
|
||||||
<tags>
|
|
||||||
<tag>
|
|
||||||
<name>date</name>
|
|
||||||
<placement>X</placement>
|
|
||||||
</tag>
|
|
||||||
</tags>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -2,17 +2,18 @@ package com.jhinno.sdk.openapi;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 目前Appform的认证类型有两个,Token模式和AK/SK的模式。
|
* 目前Appform的认证类型有两个,Token模式和AK/SK的模式。
|
||||||
|
* 使用AK/SK的模式需要应用门户安装API接口安全插件,并且需要配置AK/SK信息。
|
||||||
* 推荐使用AK/SK的模式,Token模式后续将被弃用
|
* 推荐使用AK/SK的模式,Token模式后续将被弃用
|
||||||
*/
|
*/
|
||||||
public enum AuthType {
|
public enum AuthType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Token模式
|
* Token模式,不推荐使用,后续将被弃用
|
||||||
*/
|
*/
|
||||||
TOKEN_MODE,
|
TOKEN_MODE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AK/SK模式
|
* AK/SK模式,推荐使用,但需要服务端安装接口安全插件
|
||||||
*/
|
*/
|
||||||
ACCESS_SECRET_MODE,
|
ACCESS_SECRET_MODE,
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.jhinno.sdk.openapi;
|
||||||
|
|
||||||
|
import com.jhinno.sdk.openapi.api.JHRequestExecution;
|
||||||
|
|
||||||
|
public interface JHApiExecution {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化API执行器
|
||||||
|
*/
|
||||||
|
void init(JHRequestExecution execution);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.jhinno.sdk.openapi;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.jhinno.sdk.openapi.api.JHRequestExecution;
|
||||||
|
import com.jhinno.sdk.openapi.api.app.JHAppApiExecution;
|
||||||
|
import com.jhinno.sdk.openapi.api.data.JHDataApiExecution;
|
||||||
|
import com.jhinno.sdk.openapi.api.file.JHFileApiExecution;
|
||||||
|
import com.jhinno.sdk.openapi.api.job.JHJobApiExecution;
|
||||||
|
import com.jhinno.sdk.openapi.api.organization.JHDepartmentApiExecution;
|
||||||
|
import com.jhinno.sdk.openapi.api.organization.JHUserApiExecution;
|
||||||
|
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||||
|
import com.jhinno.sdk.openapi.client.JHApiHttpClient;
|
||||||
|
|
||||||
|
public class JHApiExecutionManage {
|
||||||
|
|
||||||
|
public static final Map<Class<? extends JHApiExecution>, JHApiExecution> API_CLIENT_MAP = new HashMap<>();
|
||||||
|
public final JHRequestExecution EXECUTION;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建一个带有默认HTTP客户端的API执行管理器
|
||||||
|
*
|
||||||
|
* @param appformBaseUrl 景行API的URL
|
||||||
|
*/
|
||||||
|
public JHApiExecutionManage(String appformBaseUrl) {
|
||||||
|
JHApiClient client = new JHApiClient(appformBaseUrl);
|
||||||
|
client.initDefaultApiClient();
|
||||||
|
EXECUTION = new JHRequestExecution(client);
|
||||||
|
initApiExecution();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建一个带有自定义HTTP客户端的API执行管理器
|
||||||
|
*
|
||||||
|
* @param httpClient 自定义HTTP客户端
|
||||||
|
* @param appformBaseUrl 景行API的URL
|
||||||
|
*/
|
||||||
|
public JHApiExecutionManage(JHApiHttpClient httpClient, String appformBaseUrl) {
|
||||||
|
JHApiClient client = new JHApiClient(appformBaseUrl);
|
||||||
|
client.setApiHttpClient(httpClient);
|
||||||
|
EXECUTION = new JHRequestExecution(client);
|
||||||
|
EXECUTION.setAuthType(AuthType.TOKEN_MODE);
|
||||||
|
initApiExecution();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化默认的执行器
|
||||||
|
*/
|
||||||
|
private void initApiExecution() {
|
||||||
|
API_CLIENT_MAP.put(JHAppApiExecution.class, new JHAppApiExecution());
|
||||||
|
API_CLIENT_MAP.put(JHDataApiExecution.class, new JHDataApiExecution());
|
||||||
|
API_CLIENT_MAP.put(JHFileApiExecution.class, new JHFileApiExecution());
|
||||||
|
API_CLIENT_MAP.put(JHJobApiExecution.class, new JHJobApiExecution());
|
||||||
|
API_CLIENT_MAP.put(JHDepartmentApiExecution.class, new JHDepartmentApiExecution());
|
||||||
|
API_CLIENT_MAP.put(JHUserApiExecution.class, new JHUserApiExecution());
|
||||||
|
API_CLIENT_MAP.forEach((key, value) -> {
|
||||||
|
value.init(EXECUTION);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置API执行器
|
||||||
|
*
|
||||||
|
* @param configurator API执行器配置器
|
||||||
|
*/
|
||||||
|
public void configureApiExecution(ApiExecutionConfigurator configurator) {
|
||||||
|
configurator.configure(EXECUTION);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 注册自定义的执行器
|
||||||
|
*
|
||||||
|
* @param execution 自定义的执行器实例
|
||||||
|
*/
|
||||||
|
public void registerApiExecution(JHApiExecution execution) {
|
||||||
|
execution.init(EXECUTION);
|
||||||
|
API_CLIENT_MAP.put(execution.getClass(), execution);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取一个特定的执行器用于调用接口
|
||||||
|
*
|
||||||
|
* @param <T> 执行器的类型
|
||||||
|
* @param clazz 执行器的类
|
||||||
|
* @return 执行器实例
|
||||||
|
*/
|
||||||
|
public <T extends JHApiExecution> T getApiExecution(Class<? extends T> clazz) {
|
||||||
|
return (T) API_CLIENT_MAP.get(clazz);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API执行器配置器接口,用于配置API执行器的参数
|
||||||
|
*/
|
||||||
|
public static interface ApiExecutionConfigurator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 配置API执行器的参数
|
||||||
|
*
|
||||||
|
* @param execution API执行器实例
|
||||||
|
*/
|
||||||
|
void configure(JHRequestExecution execution);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,8 +31,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
* 对于定制接口,可参考以下步骤封装调用方法
|
* 对于定制接口,可参考以下步骤封装调用方法
|
||||||
* <ol>
|
* <ol>
|
||||||
* <li>定义一个const类同来存放接口的路径,方便后期的维护,如:{@link AppPathConstant}</li>
|
* <li>定义一个const类同来存放接口的路径,方便后期的维护,如:{@link AppPathConstant}</li>
|
||||||
* <li>继承{@link JHApiExecution},如:{@link JHAppApiExecution}</li>
|
* <li>继承{@link JHRequestExecution},如:{@link JHAppApiExecution}</li>
|
||||||
* <li>参考{@link JHAppApiExecution}中封装的方法,调用{@link JHApiExecution}中的get、post、put、delete等对新的接口封装</li>
|
* <li>参考{@link JHAppApiExecution}中封装的方法,调用{@link JHRequestExecution}中的get、post、put、delete等对新的接口封装</li>
|
||||||
* </ol>
|
* </ol>
|
||||||
*
|
*
|
||||||
* @author yanlongqi
|
* @author yanlongqi
|
||||||
@@ -41,8 +41,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class JHApiExecution {
|
public class JHRequestExecution {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JHApiClient实例
|
* JHApiClient实例
|
||||||
@@ -59,7 +58,6 @@ public class JHApiExecution {
|
|||||||
*/
|
*/
|
||||||
private int tokenResidueTime = DefaultHttpClientConfig.DEFAULT_TOKEN_RESIDUE_TIME;
|
private int tokenResidueTime = DefaultHttpClientConfig.DEFAULT_TOKEN_RESIDUE_TIME;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否使用服务器时间,开启可能会导致请求过慢,但是不会太慢,默认token会有缓存
|
* 是否使用服务器时间,开启可能会导致请求过慢,但是不会太慢,默认token会有缓存
|
||||||
*/
|
*/
|
||||||
@@ -74,7 +72,7 @@ public class JHApiExecution {
|
|||||||
/**
|
/**
|
||||||
* 接口请求的认证类型
|
* 接口请求的认证类型
|
||||||
*/
|
*/
|
||||||
private AuthType authType = AuthType.ACCESS_SECRET_MODE;
|
private AuthType authType = AuthType.TOKEN_MODE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 访问密钥
|
* 访问密钥
|
||||||
@@ -86,17 +84,15 @@ public class JHApiExecution {
|
|||||||
*/
|
*/
|
||||||
private String accessKeySecret;
|
private String accessKeySecret;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取一个执行器的实例
|
* 获取一个执行器的实例
|
||||||
*
|
*
|
||||||
* @param jhApiClient 请求的客户端
|
* @param jhApiClient 请求的客户端
|
||||||
*/
|
*/
|
||||||
protected JHApiExecution(JHApiClient jhApiClient) {
|
public JHRequestExecution(JHApiClient jhApiClient) {
|
||||||
this.jhApiClient = jhApiClient;
|
this.jhApiClient = jhApiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户令牌的缓存
|
* 用户令牌的缓存
|
||||||
*/
|
*/
|
||||||
@@ -127,13 +123,15 @@ public class JHApiExecution {
|
|||||||
int tokenEffectiveTime = (tokenTimeout - tokenResidueTime) * 60 * 1000;
|
int tokenEffectiveTime = (tokenTimeout - tokenResidueTime) * 60 * 1000;
|
||||||
|
|
||||||
// 如果是强制获取、用户令牌为空、用户令牌过期等,则获取令牌
|
// 如果是强制获取、用户令牌为空、用户令牌过期等,则获取令牌
|
||||||
if (isForceGetToken || tokenInfo == null || System.currentTimeMillis() - tokenInfo.getCurrentTimestamp() > tokenEffectiveTime) {
|
if (isForceGetToken || tokenInfo == null
|
||||||
|
|| System.currentTimeMillis() - tokenInfo.getCurrentTimestamp() > tokenEffectiveTime) {
|
||||||
Map<String, Object> params = new HashMap<>(2);
|
Map<String, Object> params = new HashMap<>(2);
|
||||||
params.put("timeout", tokenTimeout);
|
params.put("timeout", tokenTimeout);
|
||||||
String currentTimeMillis = getCurrentTimeMillis();
|
String currentTimeMillis = getCurrentTimeMillis();
|
||||||
String beforeEncryption = String.format(CommonConstant.TokenUserFormat, username, currentTimeMillis);
|
String beforeEncryption = String.format(CommonConstant.TokenUserFormat, username, currentTimeMillis);
|
||||||
try {
|
try {
|
||||||
SecretKeySpec secretKey = new SecretKeySpec(CommonConstant.DEFAULT_AES_KEY.getBytes(StandardCharsets.UTF_8), CommonConstant.AES_ALGORITHM);
|
SecretKeySpec secretKey = new SecretKeySpec(
|
||||||
|
CommonConstant.DEFAULT_AES_KEY.getBytes(StandardCharsets.UTF_8), CommonConstant.AES_ALGORITHM);
|
||||||
Cipher cipher = Cipher.getInstance(CommonConstant.AES_ECB_PADDING);
|
Cipher cipher = Cipher.getInstance(CommonConstant.AES_ECB_PADDING);
|
||||||
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
cipher.init(Cipher.ENCRYPT_MODE, secretKey);
|
||||||
byte[] encryptBytes = cipher.doFinal(beforeEncryption.getBytes(StandardCharsets.UTF_8));
|
byte[] encryptBytes = cipher.doFinal(beforeEncryption.getBytes(StandardCharsets.UTF_8));
|
||||||
@@ -154,7 +152,6 @@ public class JHApiExecution {
|
|||||||
return tokenInfo.getToken();
|
return tokenInfo.getToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -165,7 +162,6 @@ public class JHApiExecution {
|
|||||||
return jhApiClient.getAppformServerCurrentTimeMillis();
|
return jhApiClient.getAppformServerCurrentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构建一个带token的请求头
|
* 构建一个带token的请求头
|
||||||
*
|
*
|
||||||
@@ -173,7 +169,7 @@ public class JHApiExecution {
|
|||||||
* @param isContentType 是否携带默认的Content-type,默认为{@link ContentType#APPLICATION_JSON}
|
* @param isContentType 是否携带默认的Content-type,默认为{@link ContentType#APPLICATION_JSON}
|
||||||
* @return 请求头
|
* @return 请求头
|
||||||
*/
|
*/
|
||||||
protected Map<String, Object> getHeaders(String username, boolean isContentType) {
|
public Map<String, Object> getHeaders(String username, boolean isContentType) {
|
||||||
Map<String, Object> headers = new HashMap<>();
|
Map<String, Object> headers = new HashMap<>();
|
||||||
// 默认请求json数据
|
// 默认请求json数据
|
||||||
if (isContentType) {
|
if (isContentType) {
|
||||||
@@ -202,7 +198,6 @@ public class JHApiExecution {
|
|||||||
return headers;
|
return headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取签名
|
* 获取签名
|
||||||
*
|
*
|
||||||
@@ -211,11 +206,13 @@ public class JHApiExecution {
|
|||||||
* @return 签名
|
* @return 签名
|
||||||
*/
|
*/
|
||||||
public String getsSignature(String username, String currentTimeMillis) {
|
public String getsSignature(String username, String currentTimeMillis) {
|
||||||
SecretKeySpec secretKey = new SecretKeySpec(accessKeySecret.getBytes(StandardCharsets.UTF_8), CommonConstant.HMAC_SHA_256_ALGORITHM);
|
SecretKeySpec secretKey = new SecretKeySpec(accessKeySecret.getBytes(StandardCharsets.UTF_8),
|
||||||
|
CommonConstant.HMAC_SHA_256_ALGORITHM);
|
||||||
try {
|
try {
|
||||||
Mac mac = Mac.getInstance(CommonConstant.HMAC_SHA_256_ALGORITHM);
|
Mac mac = Mac.getInstance(CommonConstant.HMAC_SHA_256_ALGORITHM);
|
||||||
mac.init(secretKey);
|
mac.init(secretKey);
|
||||||
String beforeSignature = String.format(CommonConstant.SIGNATURE_FORMAT, accessKey, username, currentTimeMillis);
|
String beforeSignature = String.format(CommonConstant.SIGNATURE_FORMAT, accessKey, username,
|
||||||
|
currentTimeMillis);
|
||||||
byte[] digest = mac.doFinal(beforeSignature.getBytes(StandardCharsets.UTF_8));
|
byte[] digest = mac.doFinal(beforeSignature.getBytes(StandardCharsets.UTF_8));
|
||||||
return Hex.encodeHexString(digest);
|
return Hex.encodeHexString(digest);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -229,7 +226,7 @@ public class JHApiExecution {
|
|||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @return 请求头
|
* @return 请求头
|
||||||
*/
|
*/
|
||||||
protected Map<String, Object> getHeaders(String username) {
|
public Map<String, Object> getHeaders(String username) {
|
||||||
return getHeaders(username, true);
|
return getHeaders(username, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +259,6 @@ public class JHApiExecution {
|
|||||||
return result.getData();
|
return result.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起一个有返回值的POST请求
|
* 发起一个有返回值的POST请求
|
||||||
*
|
*
|
||||||
@@ -282,7 +278,6 @@ public class JHApiExecution {
|
|||||||
return result.getData();
|
return result.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起一个有返回值的POST请求
|
* 发起一个有返回值的POST请求
|
||||||
*
|
*
|
||||||
@@ -296,7 +291,6 @@ public class JHApiExecution {
|
|||||||
return post(path, username, null, type);
|
return post(path, username, null, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起一个没有返回值的POST请求
|
* 发起一个没有返回值的POST请求
|
||||||
*
|
*
|
||||||
@@ -306,14 +300,14 @@ public class JHApiExecution {
|
|||||||
* @param <B> 请求体数据类型
|
* @param <B> 请求体数据类型
|
||||||
*/
|
*/
|
||||||
public <B> void post(String path, String username, B body) {
|
public <B> void post(String path, String username, B body) {
|
||||||
ResponseResult<?> result = jhApiClient.post(path, body, getHeaders(username), new TypeReference<ResponseResult<?>>() {
|
ResponseResult<?> result = jhApiClient.post(path, body, getHeaders(username),
|
||||||
|
new TypeReference<ResponseResult<?>>() {
|
||||||
});
|
});
|
||||||
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起一个没有请求体,没有数据返回的POST请求
|
* 发起一个没有请求体,没有数据返回的POST请求
|
||||||
*
|
*
|
||||||
@@ -325,7 +319,6 @@ public class JHApiExecution {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起一个有返回值的PUT请求
|
* 发起一个有返回值的PUT请求
|
||||||
*
|
*
|
||||||
@@ -345,7 +338,6 @@ public class JHApiExecution {
|
|||||||
return result.getData();
|
return result.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起一个有返回值的PUT请求
|
* 发起一个有返回值的PUT请求
|
||||||
*
|
*
|
||||||
@@ -368,14 +360,14 @@ public class JHApiExecution {
|
|||||||
* @param <B> 请求体数据类型
|
* @param <B> 请求体数据类型
|
||||||
*/
|
*/
|
||||||
public <B> void put(String path, String username, B body) {
|
public <B> void put(String path, String username, B body) {
|
||||||
ResponseResult<?> result = jhApiClient.put(path, body, getHeaders(username), new TypeReference<ResponseResult<?>>() {
|
ResponseResult<?> result = jhApiClient.put(path, body, getHeaders(username),
|
||||||
|
new TypeReference<ResponseResult<?>>() {
|
||||||
});
|
});
|
||||||
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起一个没有请求体,没有数据返回的PUT请求
|
* 发起一个没有请求体,没有数据返回的PUT请求
|
||||||
*
|
*
|
||||||
@@ -387,7 +379,6 @@ public class JHApiExecution {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起一个DELETE请求,有数据返回
|
* 发起一个DELETE请求,有数据返回
|
||||||
*
|
*
|
||||||
@@ -405,7 +396,6 @@ public class JHApiExecution {
|
|||||||
return result.getData();
|
return result.getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发起一个DELETE请求,没有数据返回
|
* 发起一个DELETE请求,没有数据返回
|
||||||
*
|
*
|
||||||
@@ -413,14 +403,14 @@ public class JHApiExecution {
|
|||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
*/
|
*/
|
||||||
public void delete(String path, String username) {
|
public void delete(String path, String username) {
|
||||||
ResponseResult<?> result = jhApiClient.delete(path, getHeaders(username), new TypeReference<ResponseResult<?>>() {
|
ResponseResult<?> result = jhApiClient.delete(path, getHeaders(username),
|
||||||
|
new TypeReference<ResponseResult<?>>() {
|
||||||
});
|
});
|
||||||
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 退出用户的登录,释放许可,当用户退出登录后,建议清除用户的token信息
|
* 退出用户的登录,释放许可,当用户退出登录后,建议清除用户的token信息
|
||||||
*
|
*
|
||||||
@@ -11,86 +11,86 @@ public class AppPathConstant {
|
|||||||
/**
|
/**
|
||||||
* 申请会话
|
* 申请会话
|
||||||
*/
|
*/
|
||||||
public static final String APPS_START_PATH = "/ws/api/apps/{appId}/start";
|
public static final String APPS_START_PATH = "/appform/ws/api/apps/{appId}/start";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询会列表
|
* 查询会列表
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_ALL_PATH = "/ws/api/apps/sessions/all";
|
public static final String APPS_SESSIONS_ALL_PATH = "/appform/ws/api/apps/sessions/all";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用参数查询会话列表
|
* 使用参数查询会话列表
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_PATH = "/ws/api/apps/sessions";
|
public static final String APPS_SESSIONS_PATH = "/appform/ws/api/apps/sessions";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据会话id列表查询会话列表
|
* 根据会话id列表查询会话列表
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_IDS_PATH = "/ws/api/apps/listBySessionIds";
|
public static final String APPS_SESSIONS_IDS_PATH = "/appform/ws/api/apps/listBySessionIds";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据会话名称查询会话列表
|
* 根据会话名称查询会话列表
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_NAME_PATH = "/ws/api/apps/listBySessionName";
|
public static final String APPS_SESSIONS_NAME_PATH = "/appform/ws/api/apps/listBySessionName";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 会话共享
|
* 会话共享
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_SHARE_PATH = "/ws/api/apps/sessions/{sessionId}/share";
|
public static final String APPS_SESSIONS_SHARE_PATH = "/appform/ws/api/apps/sessions/{sessionId}/share";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消会话共享
|
* 取消会话共享
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_CANCEL_SHARE_PATH = "/ws/api/apps/sessions/{sessionId}/share_cancel";
|
public static final String APPS_SESSIONS_CANCEL_SHARE_PATH = "/appform/ws/api/apps/sessions/{sessionId}/share_cancel";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 传递会话的操作权
|
* 传递会话的操作权
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_OPERATION_TRANSFER_PATH = "/ws/api/apps/sessions/{sessionId}/operation_transfer";
|
public static final String APPS_SESSIONS_OPERATION_TRANSFER_PATH = "/appform/ws/api/apps/sessions/{sessionId}/operation_transfer";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 连接会话
|
* 连接会话
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_CONNECT_JHAPP_PATH = "/ws/api/apps/sessions/{sessionId}/connect";
|
public static final String APPS_SESSIONS_CONNECT_JHAPP_PATH = "/appform/ws/api/apps/sessions/{sessionId}/connect";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 断开会话连接(作业/应用)
|
* 断开会话连接(作业/应用)
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_DISCONNECT_PATH = "/ws/api/apps/sessions/{sessionId}/disconnect";
|
public static final String APPS_SESSIONS_DISCONNECT_PATH = "/appform/ws/api/apps/sessions/{sessionId}/disconnect";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量断开会话
|
* 批量断开会话
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_DISCONNECT_IDS_PATH = "/ws/api/apps/sessions/disconnect";
|
public static final String APPS_SESSIONS_DISCONNECT_IDS_PATH = "/appform/ws/api/apps/sessions/disconnect";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注销会话
|
* 注销会话
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_DESTROY_PATH = "/ws/api/apps/sessions/{sessionId}/close";
|
public static final String APPS_SESSIONS_DESTROY_PATH = "/appform/ws/api/apps/sessions/{sessionId}/close";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量注销会话
|
* 批量注销会话
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SESSIONS_DESTROY_IDS_PATH = "/ws/api/apps/sessions/close";
|
public static final String APPS_SESSIONS_DESTROY_IDS_PATH = "/appform/ws/api/apps/sessions/close";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询应用列表
|
* 查询应用列表
|
||||||
*/
|
*/
|
||||||
public static final String APPS_LIST_PATH = "/ws/api/apps";
|
public static final String APPS_LIST_PATH = "/appform/ws/api/apps";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取应用链接URL
|
* 获取应用链接URL
|
||||||
*/
|
*/
|
||||||
public static final String APPS_GET_URL_PATH = "/ws/api/apps/{appName}/url";
|
public static final String APPS_GET_URL_PATH = "/appform/ws/api/apps/{appName}/url";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -104,7 +104,7 @@ public class AppPathConstant {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* 该接口目前在Solutions下面维护,未经过产品的测试
|
* 该接口目前在Solutions下面维护,未经过产品的测试
|
||||||
*/
|
*/
|
||||||
public static final String APP_USE_LABEL_PATH = "/ws/api/app/use_label/apps";
|
public static final String APP_USE_LABEL_PATH = "/appform/ws/api/app/use_label/apps";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -112,5 +112,5 @@ public class AppPathConstant {
|
|||||||
* <p/>
|
* <p/>
|
||||||
* 该接口目前在Solutions下面维护,未经过产品的测试
|
* 该接口目前在Solutions下面维护,未经过产品的测试
|
||||||
*/
|
*/
|
||||||
public static final String APPS_SUFFIXES_PATH = "/ws/api/apps/suffixes";
|
public static final String APPS_SUFFIXES_PATH = "/appform/ws/api/apps/suffixes";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ 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.AuthType;
|
||||||
import com.jhinno.sdk.openapi.CommonConstant;
|
import com.jhinno.sdk.openapi.CommonConstant;
|
||||||
|
import com.jhinno.sdk.openapi.JHApiExecution;
|
||||||
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.JHRequestExecution;
|
||||||
import com.jhinno.sdk.openapi.api.ResponseResult;
|
import com.jhinno.sdk.openapi.api.ResponseResult;
|
||||||
import com.jhinno.sdk.openapi.client.JHApiClient;
|
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||||
import com.jhinno.sdk.openapi.utils.CollectionUtil;
|
import com.jhinno.sdk.openapi.utils.CollectionUtil;
|
||||||
import lombok.NoArgsConstructor;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -23,16 +23,12 @@ import java.util.Map;
|
|||||||
* @author yanlongqi
|
* @author yanlongqi
|
||||||
* @date 2024/2/1 16:26
|
* @date 2024/2/1 16:26
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
public class JHAppApiExecution implements JHApiExecution {
|
||||||
public class JHAppApiExecution extends JHApiExecution {
|
|
||||||
|
|
||||||
/**
|
private JHRequestExecution execution;
|
||||||
* 获取一个执行器的实例
|
|
||||||
*
|
public void init(JHRequestExecution execution) {
|
||||||
* @param jhApiClient 请求的客户端
|
this.execution = execution;
|
||||||
*/
|
|
||||||
public JHAppApiExecution(JHApiClient jhApiClient) {
|
|
||||||
super(jhApiClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,12 +48,14 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
* <li>使用HTML的iframe标签的src</li>
|
* <li>使用HTML的iframe标签的src</li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* 以下是使用的伪代码:
|
* 以下是使用的伪代码:
|
||||||
|
*
|
||||||
* <pre class="code">
|
* <pre class="code">
|
||||||
* // 使用a标签实例代码
|
* // 使用a标签实例代码
|
||||||
* var a = document.createElement("a");
|
* var a = document.createElement("a");
|
||||||
* a.href = "{@link AppStartedInfo#getJhappUrl()}";
|
* a.href = "{@link AppStartedInfo#getJhappUrl()}";
|
||||||
* a.click();
|
* a.click();
|
||||||
* </pre>
|
* </pre>
|
||||||
|
*
|
||||||
* <pre class="code">
|
* <pre class="code">
|
||||||
* // 使用iframe标签实例代码
|
* // 使用iframe标签实例代码
|
||||||
* var iframe = document.createElement("iframe");
|
* var iframe = document.createElement("iframe");
|
||||||
@@ -71,6 +69,7 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
* 并使用js生产的时间,具体的参数见 {@link AppStartRequest#setCurrentTimestamp(String)}
|
* 并使用js生产的时间,具体的参数见 {@link AppStartRequest#setCurrentTimestamp(String)}
|
||||||
*
|
*
|
||||||
* <h4>通过浏览器启动</h4>
|
* <h4>通过浏览器启动</h4>
|
||||||
|
*
|
||||||
* <pre class="code">
|
* <pre class="code">
|
||||||
* window.open("{@link AppStartedInfo#getWebSessionUrl()}}")
|
* window.open("{@link AppStartedInfo#getWebSessionUrl()}}")
|
||||||
* </pre>
|
* </pre>
|
||||||
@@ -82,7 +81,8 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
*/
|
*/
|
||||||
public AppStartedInfo desktopStart(String username, String appId, AppStartRequest appStartRequest) {
|
public AppStartedInfo desktopStart(String username, String appId, AppStartRequest appStartRequest) {
|
||||||
String path = AppPathConstant.APPS_START_PATH.replace("{appId}", appId);
|
String path = AppPathConstant.APPS_START_PATH.replace("{appId}", appId);
|
||||||
List<AppStartedInfo> data = post(path, username, appStartRequest, new TypeReference<ResponseResult<List<AppStartedInfo>>>() {
|
List<AppStartedInfo> data = execution.post(path, username, appStartRequest,
|
||||||
|
new TypeReference<ResponseResult<List<AppStartedInfo>>>() {
|
||||||
});
|
});
|
||||||
if (CollectionUtil.isEmpty(data)) {
|
if (CollectionUtil.isEmpty(data)) {
|
||||||
throw new ServiceException(path, 500, "获取到的会话信息为空");
|
throw new ServiceException(path, 500, "获取到的会话信息为空");
|
||||||
@@ -94,17 +94,17 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
|
|
||||||
public String getWebSessionUrl(String username, String desktopId) {
|
public String getWebSessionUrl(String username, String desktopId) {
|
||||||
String webSessionUrlPath = AppPathConstant.WEB_SESSION_URL_PATH.replace("{desktopId}", desktopId);
|
String webSessionUrlPath = AppPathConstant.WEB_SESSION_URL_PATH.replace("{desktopId}", desktopId);
|
||||||
String url = getJhApiClient().getUrl(webSessionUrlPath);
|
String url = execution.getJhApiClient().getUrl(webSessionUrlPath);
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
AuthType authType = getAuthType();
|
AuthType authType = execution.getAuthType();
|
||||||
if (authType == AuthType.TOKEN_MODE) {
|
if (authType == AuthType.TOKEN_MODE) {
|
||||||
params.put(CommonConstant.TOKEN, getToken(username));
|
params.put(CommonConstant.TOKEN, execution.getToken(username));
|
||||||
} else if (authType == AuthType.ACCESS_SECRET_MODE) {
|
} else if (authType == AuthType.ACCESS_SECRET_MODE) {
|
||||||
params.put(CommonConstant.USERNAME, username);
|
params.put(CommonConstant.USERNAME, username);
|
||||||
params.put(CommonConstant.ACCESS_KEY, getAccessKey());
|
params.put(CommonConstant.ACCESS_KEY, execution.getAccessKey());
|
||||||
String currentTimeMillis = getCurrentTimeMillis();
|
String currentTimeMillis = execution.getCurrentTimeMillis();
|
||||||
params.put(CommonConstant.CURRENT_TIME_MILLIS, currentTimeMillis);
|
params.put(CommonConstant.CURRENT_TIME_MILLIS, currentTimeMillis);
|
||||||
params.put(CommonConstant.SIGNATURE, getsSignature(username, currentTimeMillis));
|
params.put(CommonConstant.SIGNATURE, execution.getsSignature(username, currentTimeMillis));
|
||||||
}
|
}
|
||||||
return JHApiClient.getUrl(url, params);
|
return JHApiClient.getUrl(url, params);
|
||||||
}
|
}
|
||||||
@@ -131,11 +131,11 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
* @return 会话列表
|
* @return 会话列表
|
||||||
*/
|
*/
|
||||||
public List<SessionInfo> getDesktopList(String username) {
|
public List<SessionInfo> getDesktopList(String username) {
|
||||||
return get(AppPathConstant.APPS_SESSIONS_ALL_PATH, username, new TypeReference<ResponseResult<List<SessionInfo>>>() {
|
return execution.get(AppPathConstant.APPS_SESSIONS_ALL_PATH, username,
|
||||||
|
new TypeReference<ResponseResult<List<SessionInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用参数查询会话列表
|
* 使用参数查询会话列表
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -157,11 +157,10 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
params.put("sessionName", sessionName);
|
params.put("sessionName", sessionName);
|
||||||
}
|
}
|
||||||
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_PATH, params);
|
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<SessionInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<SessionInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据会话列表查询会话列表
|
* 根据会话列表查询会话列表
|
||||||
* <p>
|
* <p>
|
||||||
@@ -179,7 +178,7 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
}
|
}
|
||||||
params.put("sessionIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, ids));
|
params.put("sessionIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, ids));
|
||||||
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_IDS_PATH, params);
|
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_IDS_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<SessionInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<SessionInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +200,7 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
}
|
}
|
||||||
params.put("sessionName", sessionName);
|
params.put("sessionName", sessionName);
|
||||||
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_NAME_PATH, params);
|
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_NAME_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<SessionInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<SessionInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,7 +218,8 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
* @param interacts 协作者列表 (非必填)
|
* @param interacts 协作者列表 (非必填)
|
||||||
* @param isTransfer 是否传递操作权(不确定,需要咨询产品,非必填)
|
* @param isTransfer 是否传递操作权(不确定,需要咨询产品,非必填)
|
||||||
*/
|
*/
|
||||||
public void shareDesktop(String username, String sessionId, List<String> observers, List<String> interacts, String isTransfer) {
|
public void shareDesktop(String username, String sessionId, List<String> observers, List<String> interacts,
|
||||||
|
String isTransfer) {
|
||||||
if (StringUtils.isBlank(sessionId)) {
|
if (StringUtils.isBlank(sessionId)) {
|
||||||
throw new ArgsException("sessionId为必填字段");
|
throw new ArgsException("sessionId为必填字段");
|
||||||
}
|
}
|
||||||
@@ -233,11 +233,11 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
if (StringUtils.isBlank(isTransfer)) {
|
if (StringUtils.isBlank(isTransfer)) {
|
||||||
params.put("isTransfer", isTransfer);
|
params.put("isTransfer", isTransfer);
|
||||||
}
|
}
|
||||||
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_SHARE_PATH.replace("{sessionId}", sessionId), params);
|
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_SHARE_PATH.replace("{sessionId}", sessionId),
|
||||||
post(path, username);
|
params);
|
||||||
|
execution.post(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 取消会话共享
|
* 取消会话共享
|
||||||
* <ul>
|
* <ul>
|
||||||
@@ -253,7 +253,7 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("sessionId为必填字段");
|
throw new ArgsException("sessionId为必填字段");
|
||||||
}
|
}
|
||||||
String path = AppPathConstant.APPS_SESSIONS_CANCEL_SHARE_PATH.replace("{sessionId}", sessionId);
|
String path = AppPathConstant.APPS_SESSIONS_CANCEL_SHARE_PATH.replace("{sessionId}", sessionId);
|
||||||
put(path, username);
|
execution.put(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -278,10 +278,9 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("interact", interact);
|
params.put("interact", interact);
|
||||||
path = JHApiClient.getUrl(path, params);
|
path = JHApiClient.getUrl(path, params);
|
||||||
put(path, username);
|
execution.put(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 连接会话
|
* 连接会话
|
||||||
*
|
*
|
||||||
@@ -294,7 +293,8 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("sessionId为必填字段");
|
throw new ArgsException("sessionId为必填字段");
|
||||||
}
|
}
|
||||||
String path = AppPathConstant.APPS_SESSIONS_CONNECT_JHAPP_PATH.replace("{sessionId}", sessionId);
|
String path = AppPathConstant.APPS_SESSIONS_CONNECT_JHAPP_PATH.replace("{sessionId}", sessionId);
|
||||||
List<AppStartedInfo> list = get(path, username, new TypeReference<ResponseResult<List<AppStartedInfo>>>() {
|
List<AppStartedInfo> list = execution.get(path, username,
|
||||||
|
new TypeReference<ResponseResult<List<AppStartedInfo>>>() {
|
||||||
});
|
});
|
||||||
if (CollectionUtil.isEmpty(list)) {
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
throw new ServiceException(path, 500, "获取到的会话信息为空");
|
throw new ServiceException(path, 500, "获取到的会话信息为空");
|
||||||
@@ -305,7 +305,6 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
return appStartedInfo;
|
return appStartedInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 断开会话连接(作业/应用)
|
* 断开会话连接(作业/应用)
|
||||||
* <p>
|
* <p>
|
||||||
@@ -320,10 +319,9 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("sessionId为必填字段");
|
throw new ArgsException("sessionId为必填字段");
|
||||||
}
|
}
|
||||||
String path = AppPathConstant.APPS_SESSIONS_DISCONNECT_PATH.replace("{sessionId}", sessionId);
|
String path = AppPathConstant.APPS_SESSIONS_DISCONNECT_PATH.replace("{sessionId}", sessionId);
|
||||||
put(path, username);
|
execution.put(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过应用id批量断开会话(作业/应用)
|
* 通过应用id批量断开会话(作业/应用)
|
||||||
* <p>
|
* <p>
|
||||||
@@ -340,10 +338,9 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("sessionIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, sessionIds));
|
params.put("sessionIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, sessionIds));
|
||||||
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_DISCONNECT_IDS_PATH, params);
|
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_DISCONNECT_IDS_PATH, params);
|
||||||
put(path, username);
|
execution.put(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注销会话
|
* 注销会话
|
||||||
* <p>
|
* <p>
|
||||||
@@ -358,10 +355,9 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("sessionId为必填字段");
|
throw new ArgsException("sessionId为必填字段");
|
||||||
}
|
}
|
||||||
String path = AppPathConstant.APPS_SESSIONS_DESTROY_PATH.replace("{sessionId}", sessionId);
|
String path = AppPathConstant.APPS_SESSIONS_DESTROY_PATH.replace("{sessionId}", sessionId);
|
||||||
put(path, username);
|
execution.put(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量注销会话
|
* 批量注销会话
|
||||||
*
|
*
|
||||||
@@ -375,10 +371,9 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("sessionIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, sessionIds));
|
params.put("sessionIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, sessionIds));
|
||||||
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_DESTROY_IDS_PATH, params);
|
String path = JHApiClient.getUrl(AppPathConstant.APPS_SESSIONS_DESTROY_IDS_PATH, params);
|
||||||
put(path, username);
|
execution.put(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前用户的应用列表
|
* 获取当前用户的应用列表
|
||||||
*
|
*
|
||||||
@@ -386,11 +381,11 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
* @return 应用列表
|
* @return 应用列表
|
||||||
*/
|
*/
|
||||||
public List<AppInfo> getAppList(String username) {
|
public List<AppInfo> getAppList(String username) {
|
||||||
return get(AppPathConstant.APPS_LIST_PATH, username, new TypeReference<ResponseResult<List<AppInfo>>>() {
|
return execution.get(AppPathConstant.APPS_LIST_PATH, username,
|
||||||
|
new TypeReference<ResponseResult<List<AppInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取应用链接
|
* 获取应用链接
|
||||||
*
|
*
|
||||||
@@ -403,7 +398,8 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("appName为必填字段");
|
throw new ArgsException("appName为必填字段");
|
||||||
}
|
}
|
||||||
String path = AppPathConstant.APPS_GET_URL_PATH.replace("{appName}", appName);
|
String path = AppPathConstant.APPS_GET_URL_PATH.replace("{appName}", appName);
|
||||||
List<Map<String, String>> apps = get(path, username, new TypeReference<ResponseResult<List<Map<String, String>>>>() {
|
List<Map<String, String>> apps = execution.get(path, username,
|
||||||
|
new TypeReference<ResponseResult<List<Map<String, String>>>>() {
|
||||||
});
|
});
|
||||||
if (CollectionUtil.isEmpty(apps)) {
|
if (CollectionUtil.isEmpty(apps)) {
|
||||||
throw new ServiceException(path, 500, "应用信息为空!");
|
throw new ServiceException(path, 500, "应用信息为空!");
|
||||||
@@ -435,7 +431,7 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
params.put("suffixes", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, suffixes));
|
params.put("suffixes", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, suffixes));
|
||||||
}
|
}
|
||||||
String path = JHApiClient.getUrl(AppPathConstant.APPS_SUFFIXES_PATH, params);
|
String path = JHApiClient.getUrl(AppPathConstant.APPS_SUFFIXES_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<AppstoreAppInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<AppstoreAppInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +446,6 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
return getUseLabelList(username, Arrays.asList(labels));
|
return getUseLabelList(username, Arrays.asList(labels));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用途查询应用
|
* 根据用途查询应用
|
||||||
*
|
*
|
||||||
@@ -464,7 +459,7 @@ public class JHAppApiExecution extends JHApiExecution {
|
|||||||
params.put("use_labels", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, labels));
|
params.put("use_labels", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, labels));
|
||||||
}
|
}
|
||||||
String path = JHApiClient.getUrl(AppPathConstant.APP_USE_LABEL_PATH, params);
|
String path = JHApiClient.getUrl(AppPathConstant.APP_USE_LABEL_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<UseLabelInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<UseLabelInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,22 +11,22 @@ public class AuthPathConstant {
|
|||||||
/**
|
/**
|
||||||
* 获取用户token
|
* 获取用户token
|
||||||
*/
|
*/
|
||||||
public static final String AUTH_TOKEN_PATH = "/ws/api/auth/token";
|
public static final String AUTH_TOKEN_PATH = "/appform/ws/api/auth/token";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 注销token
|
* 注销token
|
||||||
*/
|
*/
|
||||||
public static final String AUTH_LOGOUT = "/ws/api/auth/logout";
|
public static final String AUTH_LOGOUT = "/appform/ws/api/auth/logout";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户注册
|
* 用户注册
|
||||||
*/
|
*/
|
||||||
public static final String AUTH_REGISTER = "/ws/api/auth/register";
|
public static final String AUTH_REGISTER = "/appform/ws/api/auth/register";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试服务器是否可用
|
* 测试服务器是否可用
|
||||||
*/
|
*/
|
||||||
public static final String PING = "/ws/api/ping";
|
public static final String PING = "/appform/ws/api/ping";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,32 +11,32 @@ public class DataPathConstant {
|
|||||||
/**
|
/**
|
||||||
* 根据用户scope查询数据目录列表
|
* 根据用户scope查询数据目录列表
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SPOOLERS_PATH = "/ws/api/spoolers";
|
public static final String DATA_SPOOLERS_PATH = "/appform/ws/api/spoolers";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据作业id查数据目录信息
|
* 根据作业id查数据目录信息
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SPOOLER_JOB_ID_PATH = "/ws/api/spooler/{jobId}";
|
public static final String DATA_SPOOLER_JOB_ID_PATH = "/appform/ws/api/spooler/{jobId}";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据作业id集合查询数据目录列表
|
* 根据作业id集合查询数据目录列表
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SPOOLERS_LIST_PATH = "/ws/api/spoolers/list";
|
public static final String DATA_SPOOLERS_LIST_PATH = "/appform/ws/api/spoolers/list";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据数据目录名称查询数据目录列表
|
* 根据数据目录名称查询数据目录列表
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SPOOLERS_NAME_PATH = "/ws/api/spoolers/name";
|
public static final String DATA_SPOOLERS_NAME_PATH = "/appform/ws/api/spoolers/name";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 立即删除数据目录
|
* 立即删除数据目录
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SPOOLERS_DELETE_ID_PATH = "/ws/api/spooler/del/{id}";
|
public static final String DATA_SPOOLERS_DELETE_ID_PATH = "/appform/ws/api/spooler/del/{id}";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置过期时间删除数据目录
|
* 设置过期时间删除数据目录
|
||||||
*/
|
*/
|
||||||
public static final String DATA_SPOOLERS_PURGE_PATH = "/ws/api/spooler/purge";
|
public static final String DATA_SPOOLERS_PURGE_PATH = "/appform/ws/api/spooler/purge";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package com.jhinno.sdk.openapi.api.data;
|
|||||||
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.CommonConstant;
|
import com.jhinno.sdk.openapi.CommonConstant;
|
||||||
|
import com.jhinno.sdk.openapi.JHApiExecution;
|
||||||
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.JHRequestExecution;
|
||||||
import com.jhinno.sdk.openapi.api.ResponseResult;
|
import com.jhinno.sdk.openapi.api.ResponseResult;
|
||||||
import com.jhinno.sdk.openapi.client.JHApiClient;
|
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||||
import com.jhinno.sdk.openapi.utils.CollectionUtil;
|
import com.jhinno.sdk.openapi.utils.CollectionUtil;
|
||||||
@@ -23,15 +24,12 @@ import java.util.Map;
|
|||||||
* @date 2024/2/4 17:09
|
* @date 2024/2/4 17:09
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class JHDataApiExecution extends JHApiExecution {
|
public class JHDataApiExecution implements JHApiExecution {
|
||||||
|
|
||||||
/**
|
private JHRequestExecution execution;
|
||||||
* 获取一个执行器的实例
|
|
||||||
*
|
public void init(JHRequestExecution execution) {
|
||||||
* @param jhApiClient 请求的客户端
|
this.execution = execution;
|
||||||
*/
|
|
||||||
public JHDataApiExecution(JHApiClient jhApiClient) {
|
|
||||||
super(jhApiClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -41,11 +39,11 @@ public class JHDataApiExecution extends JHApiExecution {
|
|||||||
* @return 用户数据目录列表
|
* @return 用户数据目录列表
|
||||||
*/
|
*/
|
||||||
public List<SpoolerDataInfo> getSpoolersData(String username) {
|
public List<SpoolerDataInfo> getSpoolersData(String username) {
|
||||||
return get(DataPathConstant.DATA_SPOOLERS_PATH, username, new TypeReference<ResponseResult<List<SpoolerDataInfo>>>() {
|
return execution.get(DataPathConstant.DATA_SPOOLERS_PATH, username,
|
||||||
|
new TypeReference<ResponseResult<List<SpoolerDataInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据作业id查作业数据目录信息
|
* 根据作业id查作业数据目录信息
|
||||||
*
|
*
|
||||||
@@ -58,7 +56,8 @@ public class JHDataApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("jobId不能为空!");
|
throw new ArgsException("jobId不能为空!");
|
||||||
}
|
}
|
||||||
String path = DataPathConstant.DATA_SPOOLER_JOB_ID_PATH.replace("{jobId}", jobId);
|
String path = DataPathConstant.DATA_SPOOLER_JOB_ID_PATH.replace("{jobId}", jobId);
|
||||||
List<SpoolerDataInfo> list = get(path, username, new TypeReference<ResponseResult<List<SpoolerDataInfo>>>() {
|
List<SpoolerDataInfo> list = execution.get(path, username,
|
||||||
|
new TypeReference<ResponseResult<List<SpoolerDataInfo>>>() {
|
||||||
});
|
});
|
||||||
if (CollectionUtil.isEmpty(list)) {
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
throw new ServiceException(path, 500, "作业数据目录信息为空!");
|
throw new ServiceException(path, 500, "作业数据目录信息为空!");
|
||||||
@@ -80,7 +79,7 @@ public class JHDataApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("jobIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, jobIds));
|
params.put("jobIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, jobIds));
|
||||||
String path = JHApiClient.getUrl(DataPathConstant.DATA_SPOOLERS_LIST_PATH, params);
|
String path = JHApiClient.getUrl(DataPathConstant.DATA_SPOOLERS_LIST_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<SpoolerDataInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<SpoolerDataInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +97,8 @@ public class JHDataApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("name", dataName);
|
params.put("name", dataName);
|
||||||
String path = JHApiClient.getUrl(DataPathConstant.DATA_SPOOLERS_NAME_PATH, params);
|
String path = JHApiClient.getUrl(DataPathConstant.DATA_SPOOLERS_NAME_PATH, params);
|
||||||
List<SpoolerDataInfo> list = get(path, username, new TypeReference<ResponseResult<List<SpoolerDataInfo>>>() {
|
List<SpoolerDataInfo> list = execution.get(path, username,
|
||||||
|
new TypeReference<ResponseResult<List<SpoolerDataInfo>>>() {
|
||||||
});
|
});
|
||||||
if (CollectionUtil.isEmpty(list)) {
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
throw new ServiceException(path, 500, "作业数据目录信息为空!");
|
throw new ServiceException(path, 500, "作业数据目录信息为空!");
|
||||||
@@ -106,7 +106,6 @@ public class JHDataApiExecution extends JHApiExecution {
|
|||||||
return list.get(0);
|
return list.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 立即删除作业数据目录
|
* 立即删除作业数据目录
|
||||||
*
|
*
|
||||||
@@ -118,11 +117,10 @@ public class JHDataApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("jobId不能为空!");
|
throw new ArgsException("jobId不能为空!");
|
||||||
}
|
}
|
||||||
String path = DataPathConstant.DATA_SPOOLERS_DELETE_ID_PATH.replace("{id}", jobId);
|
String path = DataPathConstant.DATA_SPOOLERS_DELETE_ID_PATH.replace("{id}", jobId);
|
||||||
get(path, username, new TypeReference<ResponseResult<Object>>() {
|
execution.get(path, username, new TypeReference<ResponseResult<Object>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置用户数据目录的过期时间,也给以通过设置过期时间来删除用户数据区
|
* 设置用户数据目录的过期时间,也给以通过设置过期时间来删除用户数据区
|
||||||
*
|
*
|
||||||
@@ -141,7 +139,7 @@ public class JHDataApiExecution extends JHApiExecution {
|
|||||||
params.put("id", jobId);
|
params.put("id", jobId);
|
||||||
params.put("expiration_time", expirationTime);
|
params.put("expiration_time", expirationTime);
|
||||||
String path = JHApiClient.getUrl(DataPathConstant.DATA_SPOOLERS_PURGE_PATH, params);
|
String path = JHApiClient.getUrl(DataPathConstant.DATA_SPOOLERS_PURGE_PATH, params);
|
||||||
get(path, username, new TypeReference<ResponseResult<Object>>() {
|
execution.get(path, username, new TypeReference<ResponseResult<Object>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,56 +12,56 @@ public class FilePathConstant {
|
|||||||
/**
|
/**
|
||||||
* 重命名文件
|
* 重命名文件
|
||||||
*/
|
*/
|
||||||
public static final String FILE_RENAME_PATH = "/ws/api/files/rename";
|
public static final String FILE_RENAME_PATH = "/appform/ws/api/files/rename";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除文件
|
* 删除文件
|
||||||
*/
|
*/
|
||||||
public static final String FILE_DELETE_PATH = "/ws/api/files/delete";
|
public static final String FILE_DELETE_PATH = "/appform/ws/api/files/delete";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拷贝文件
|
* 拷贝文件
|
||||||
*/
|
*/
|
||||||
public static final String FILE_COPY_PATH = "/ws/api/files/copy";
|
public static final String FILE_COPY_PATH = "/appform/ws/api/files/copy";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件列表
|
* 获取文件列表
|
||||||
*/
|
*/
|
||||||
public static final String FILE_LIST_PATH = "/ws/api/files";
|
public static final String FILE_LIST_PATH = "/appform/ws/api/files";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文件夹
|
* 创建文件夹
|
||||||
*/
|
*/
|
||||||
public static final String FILE_MKDIR_PATH = "/ws/api/files/mkdir";
|
public static final String FILE_MKDIR_PATH = "/appform/ws/api/files/mkdir";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文件
|
* 创建文件
|
||||||
*/
|
*/
|
||||||
public static final String FILE_MKFILE_PATH = "/ws/api/files/mkfile";
|
public static final String FILE_MKFILE_PATH = "/appform/ws/api/files/mkfile";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件上传
|
* 文件上传
|
||||||
*/
|
*/
|
||||||
public static final String FILE_UPLOAD_PATH = "/ws/api/files/upload";
|
public static final String FILE_UPLOAD_PATH = "/appform/ws/api/files/upload";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件下载
|
* 文件下载
|
||||||
*/
|
*/
|
||||||
public static final String FILE_DOWNLOAD_PATH = "/ws/api/files/download";
|
public static final String FILE_DOWNLOAD_PATH = "/appform/ws/api/files/download";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 压缩文件
|
* 压缩文件
|
||||||
*/
|
*/
|
||||||
public static final String FILE_COMPRESS_PATH = "/ws/api/files/compress";
|
public static final String FILE_COMPRESS_PATH = "/appform/ws/api/files/compress";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解压文件
|
* 解压文件
|
||||||
*/
|
*/
|
||||||
public static final String FILE_UNCOMPRESS_PATH = "/ws/api/files/uncompress";
|
public static final String FILE_UNCOMPRESS_PATH = "/appform/ws/api/files/uncompress";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package com.jhinno.sdk.openapi.api.file;
|
|||||||
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.CommonConstant;
|
import com.jhinno.sdk.openapi.CommonConstant;
|
||||||
|
import com.jhinno.sdk.openapi.JHApiExecution;
|
||||||
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.JHRequestExecution;
|
||||||
import com.jhinno.sdk.openapi.api.ResponseResult;
|
import com.jhinno.sdk.openapi.api.ResponseResult;
|
||||||
import com.jhinno.sdk.openapi.client.JHApiClient;
|
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||||
import com.jhinno.sdk.openapi.utils.CollectionUtil;
|
import com.jhinno.sdk.openapi.utils.CollectionUtil;
|
||||||
@@ -14,6 +15,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -26,13 +28,14 @@ import java.util.Map;
|
|||||||
* @date 2024/2/4 18:58
|
* @date 2024/2/4 18:58
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class JHFileApiExecution extends JHApiExecution {
|
public class JHFileApiExecution implements JHApiExecution {
|
||||||
|
|
||||||
public JHFileApiExecution(JHApiClient jhApiClient) {
|
private JHRequestExecution execution;
|
||||||
super(jhApiClient);
|
|
||||||
|
public void init(JHRequestExecution execution) {
|
||||||
|
this.execution = execution;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 重命名文件
|
* 重命名文件
|
||||||
*
|
*
|
||||||
@@ -50,10 +53,9 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> body = new HashMap<>(2);
|
Map<String, Object> body = new HashMap<>(2);
|
||||||
body.put("oldFileName", sourceFileNamePath);
|
body.put("oldFileName", sourceFileNamePath);
|
||||||
body.put("newFileName", targetFileName);
|
body.put("newFileName", targetFileName);
|
||||||
put(FilePathConstant.FILE_RENAME_PATH, username, body);
|
execution.put(FilePathConstant.FILE_RENAME_PATH, username, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除文件
|
* 删除文件
|
||||||
*
|
*
|
||||||
@@ -67,10 +69,9 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("fileName", sourceFilePath);
|
params.put("fileName", sourceFilePath);
|
||||||
String path = JHApiClient.getUrl(FilePathConstant.FILE_DELETE_PATH, params);
|
String path = JHApiClient.getUrl(FilePathConstant.FILE_DELETE_PATH, params);
|
||||||
delete(path, username);
|
execution.delete(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拷贝文件到目标文件夹
|
* 拷贝文件到目标文件夹
|
||||||
*
|
*
|
||||||
@@ -88,10 +89,9 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> body = new HashMap<>(2);
|
Map<String, Object> body = new HashMap<>(2);
|
||||||
body.put("sourceFileName", sourceFilePath);
|
body.put("sourceFileName", sourceFilePath);
|
||||||
body.put("targetDirectory", targetDirectoryPath);
|
body.put("targetDirectory", targetDirectoryPath);
|
||||||
put(FilePathConstant.FILE_COPY_PATH, username, body);
|
execution.put(FilePathConstant.FILE_COPY_PATH, username, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件列表
|
* 获取文件列表
|
||||||
*
|
*
|
||||||
@@ -106,11 +106,10 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("dir", dirPath);
|
params.put("dir", dirPath);
|
||||||
String path = JHApiClient.getUrl(FilePathConstant.FILE_LIST_PATH, params);
|
String path = JHApiClient.getUrl(FilePathConstant.FILE_LIST_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<FileInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<FileInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文件夹
|
* 创建文件夹
|
||||||
*
|
*
|
||||||
@@ -128,7 +127,8 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
if (isForce != null) {
|
if (isForce != null) {
|
||||||
body.put("isForce", isForce.toString());
|
body.put("isForce", isForce.toString());
|
||||||
}
|
}
|
||||||
Map<String, String> result = post(FilePathConstant.FILE_MKDIR_PATH, username, body, new TypeReference<ResponseResult<Map<String, String>>>() {
|
Map<String, String> result = execution.post(FilePathConstant.FILE_MKDIR_PATH, username, body,
|
||||||
|
new TypeReference<ResponseResult<Map<String, String>>>() {
|
||||||
});
|
});
|
||||||
if (CollectionUtil.isEmpty(result)) {
|
if (CollectionUtil.isEmpty(result)) {
|
||||||
return null;
|
return null;
|
||||||
@@ -136,7 +136,6 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
return result.get("dirPath");
|
return result.get("dirPath");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建文件夹,默认不强制新建
|
* 新建文件夹,默认不强制新建
|
||||||
*
|
*
|
||||||
@@ -148,7 +147,6 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
return mkdir(username, dirPath, null);
|
return mkdir(username, dirPath, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建文件
|
* 创建文件
|
||||||
*
|
*
|
||||||
@@ -162,7 +160,8 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
}
|
}
|
||||||
Map<String, Object> body = new HashMap<>(1);
|
Map<String, Object> body = new HashMap<>(1);
|
||||||
body.put("filePath", filePath);
|
body.put("filePath", filePath);
|
||||||
Map<String, String> result = post(FilePathConstant.FILE_MKFILE_PATH, username, body, new TypeReference<ResponseResult<Map<String, String>>>() {
|
Map<String, String> result = execution.post(FilePathConstant.FILE_MKFILE_PATH, username, body,
|
||||||
|
new TypeReference<ResponseResult<Map<String, String>>>() {
|
||||||
});
|
});
|
||||||
if (CollectionUtil.isEmpty(result)) {
|
if (CollectionUtil.isEmpty(result)) {
|
||||||
return null;
|
return null;
|
||||||
@@ -195,26 +194,25 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
body.put("isCover", isCover);
|
body.put("isCover", isCover);
|
||||||
}
|
}
|
||||||
body.put("uploadPath", uploadPath);
|
body.put("uploadPath", uploadPath);
|
||||||
|
ResponseResult<Object> result = execution.getJhApiClient().upload(
|
||||||
ResponseResult<Object> result = getJhApiClient().upload(
|
|
||||||
FilePathConstant.FILE_UPLOAD_PATH,
|
FilePathConstant.FILE_UPLOAD_PATH,
|
||||||
"file",
|
"file",
|
||||||
fileName,
|
fileName,
|
||||||
is,
|
is,
|
||||||
getHeaders(username, false),
|
execution.getHeaders(username, false),
|
||||||
body,
|
body,
|
||||||
new TypeReference<ResponseResult<Object>>() {
|
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());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文件(不覆盖源文件)
|
* 上传文件(不覆盖源文件)
|
||||||
* <p>源文件目录下存在相同文件则会报错</p>
|
* <p>
|
||||||
|
* 源文件目录下存在相同文件则会报错
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @param is 文件流
|
* @param is 文件流
|
||||||
@@ -232,7 +230,8 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
* @param uploadPath 上传路径,服务器路径
|
* @param uploadPath 上传路径,服务器路径
|
||||||
* @param isCover 是否覆盖(非必填,默认:false)
|
* @param isCover 是否覆盖(非必填,默认:false)
|
||||||
*/
|
*/
|
||||||
public void uploadFile(String username, String path, String fileName, String uploadPath, Boolean isCover) throws FileNotFoundException {
|
public void uploadFile(String username, String path, String fileName, String uploadPath, Boolean isCover)
|
||||||
|
throws FileNotFoundException {
|
||||||
if (StringUtils.isBlank(path)) {
|
if (StringUtils.isBlank(path)) {
|
||||||
throw new ArgsException("path是必填参数");
|
throw new ArgsException("path是必填参数");
|
||||||
}
|
}
|
||||||
@@ -241,25 +240,25 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
uploadFile(username, fileInputStream, fileName, uploadPath, isCover);
|
uploadFile(username, fileInputStream, fileName, uploadPath, isCover);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @param path 本地文件路径
|
* @param path 本地文件路径
|
||||||
* @param fileName 文件名
|
* @param fileName 文件名
|
||||||
* @param uploadPath 上传路径,服务器路径
|
* @param uploadPath 上传路径,服务器路径
|
||||||
*/
|
*/
|
||||||
public void uploadFile(String username, String path, String fileName, String uploadPath) throws FileNotFoundException {
|
public void uploadFile(String username, String path, String fileName, String uploadPath)
|
||||||
|
throws FileNotFoundException {
|
||||||
uploadFile(username, path, fileName, uploadPath, null);
|
uploadFile(username, path, fileName, uploadPath, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @param path 本地文件路径
|
* @param path 本地文件路径
|
||||||
* @param uploadPath 上传路径,服务器路径
|
* @param uploadPath 上传路径,服务器路径
|
||||||
* @param isCover 是否覆盖(非必填,默认:false)
|
* @param isCover 是否覆盖(非必填,默认:false)
|
||||||
*/
|
*/
|
||||||
public void uploadFile(String username, String path, String uploadPath, Boolean isCover) throws FileNotFoundException {
|
public void uploadFile(String username, String path, String uploadPath, Boolean isCover)
|
||||||
|
throws FileNotFoundException {
|
||||||
File file = new File(path);
|
File file = new File(path);
|
||||||
uploadFile(username, path, file.getName(), uploadPath, isCover);
|
uploadFile(username, path, file.getName(), uploadPath, isCover);
|
||||||
}
|
}
|
||||||
@@ -274,7 +273,6 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
uploadFile(username, path, file.getName(), uploadPath, null);
|
uploadFile(username, path, file.getName(), uploadPath, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件下载地址
|
* 获取文件下载地址
|
||||||
*
|
*
|
||||||
@@ -283,13 +281,27 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
* @return 文件地址信息
|
* @return 文件地址信息
|
||||||
*/
|
*/
|
||||||
public String getFileDownloadUrl(String username, String filePath) {
|
public String getFileDownloadUrl(String username, String filePath) {
|
||||||
|
return getFileDownloadUrl(username, filePath, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件下载地址
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @param filePath 文件路径
|
||||||
|
* @param forceDownload 是否强制下载,打开密级之后未标密的文件无法下载,可以通过设置当前参数为true来强制下载,默认:false
|
||||||
|
* @return 文件地址信息
|
||||||
|
*/
|
||||||
|
public String getFileDownloadUrl(String username, String filePath, Boolean forceDownload) {
|
||||||
if (StringUtils.isBlank(filePath)) {
|
if (StringUtils.isBlank(filePath)) {
|
||||||
throw new ArgsException("filePath不能为空!");
|
throw new ArgsException("filePath不能为空!");
|
||||||
}
|
}
|
||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("filePath", filePath);
|
params.put("filePath", filePath);
|
||||||
|
params.put("forceDownload", forceDownload);
|
||||||
String path = JHApiClient.getUrl(FilePathConstant.FILE_DOWNLOAD_PATH, params);
|
String path = JHApiClient.getUrl(FilePathConstant.FILE_DOWNLOAD_PATH, params);
|
||||||
Map<String, String> downloadInfo = get(path, username, new TypeReference<ResponseResult<Map<String, String>>>() {
|
Map<String, String> downloadInfo = execution.get(path, username,
|
||||||
|
new TypeReference<ResponseResult<Map<String, String>>>() {
|
||||||
});
|
});
|
||||||
if (CollectionUtil.isEmpty(downloadInfo)) {
|
if (CollectionUtil.isEmpty(downloadInfo)) {
|
||||||
return null;
|
return null;
|
||||||
@@ -297,6 +309,32 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
return downloadInfo.get("url");
|
return downloadInfo.get("url");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件输入流
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @param filePath 文件路径
|
||||||
|
* @return 文件流
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public InputStream getFileInputStream(String username, String filePath) throws IOException {
|
||||||
|
return getFileInputStream(username, filePath, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取文件输入流
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @param filePath 文件路径
|
||||||
|
* @param forceDownload 是否强制下载,打开密级之后未标密的文件无法下载,可以通过设置当前参数为true来强制下载,默认:false
|
||||||
|
* @return 文件流
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public InputStream getFileInputStream(String username, String filePath, Boolean forceDownload) throws IOException {
|
||||||
|
String fileUrl = getFileDownloadUrl(username, filePath, forceDownload);
|
||||||
|
return execution.getJhApiClient().getApiHttpClient().get(fileUrl, null);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件压缩
|
* 文件压缩
|
||||||
*
|
*
|
||||||
@@ -319,10 +357,9 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
params.put("compressType", compressType);
|
params.put("compressType", compressType);
|
||||||
}
|
}
|
||||||
String path = JHApiClient.getUrl(FilePathConstant.FILE_COMPRESS_PATH, params);
|
String path = JHApiClient.getUrl(FilePathConstant.FILE_COMPRESS_PATH, params);
|
||||||
post(path, username);
|
execution.post(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 文件压缩
|
* 文件压缩
|
||||||
*
|
*
|
||||||
@@ -344,7 +381,8 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
* @param password 密码
|
* @param password 密码
|
||||||
* @param compressType 压缩类型 (未使用以后扩展)
|
* @param compressType 压缩类型 (未使用以后扩展)
|
||||||
*/
|
*/
|
||||||
public void uncompress(String username, String sourceFilePath, String targetDirPath, Boolean isCover, String password, String compressType) {
|
public void uncompress(String username, String sourceFilePath, String targetDirPath, Boolean isCover,
|
||||||
|
String password, String compressType) {
|
||||||
if (StringUtils.isBlank(sourceFilePath)) {
|
if (StringUtils.isBlank(sourceFilePath)) {
|
||||||
throw new ArgsException("sourceFilePath不能为空!");
|
throw new ArgsException("sourceFilePath不能为空!");
|
||||||
}
|
}
|
||||||
@@ -364,10 +402,9 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
params.put("compressType", compressType);
|
params.put("compressType", compressType);
|
||||||
}
|
}
|
||||||
String path = JHApiClient.getUrl(FilePathConstant.FILE_UNCOMPRESS_PATH, params);
|
String path = JHApiClient.getUrl(FilePathConstant.FILE_UNCOMPRESS_PATH, params);
|
||||||
post(path, username);
|
execution.post(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解压文件
|
* 解压文件
|
||||||
*
|
*
|
||||||
@@ -377,7 +414,8 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
* @param isCover 是否覆盖
|
* @param isCover 是否覆盖
|
||||||
* @param password 密码
|
* @param password 密码
|
||||||
*/
|
*/
|
||||||
public void uncompress(String username, String sourceFilePath, String targetDirPath, Boolean isCover, String password) {
|
public void uncompress(String username, String sourceFilePath, String targetDirPath, Boolean isCover,
|
||||||
|
String password) {
|
||||||
uncompress(username, sourceFilePath, targetDirPath, isCover, password, null);
|
uncompress(username, sourceFilePath, targetDirPath, isCover, password, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,5 +442,3 @@ public class JHFileApiExecution extends JHApiExecution {
|
|||||||
uncompress(username, sourceFilePath, targetDirPath, null);
|
uncompress(username, sourceFilePath, targetDirPath, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ package com.jhinno.sdk.openapi.api.job;
|
|||||||
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.CommonConstant;
|
import com.jhinno.sdk.openapi.CommonConstant;
|
||||||
|
import com.jhinno.sdk.openapi.JHApiExecution;
|
||||||
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.JHRequestExecution;
|
||||||
import com.jhinno.sdk.openapi.api.ResponseResult;
|
import com.jhinno.sdk.openapi.api.ResponseResult;
|
||||||
import com.jhinno.sdk.openapi.api.file.FileInfo;
|
import com.jhinno.sdk.openapi.api.file.FileInfo;
|
||||||
import com.jhinno.sdk.openapi.client.JHApiClient;
|
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||||
@@ -22,15 +23,12 @@ import java.util.Map;
|
|||||||
* @date 2024/2/5 18:44
|
* @date 2024/2/5 18:44
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class JHJobApiExecution extends JHApiExecution {
|
public class JHJobApiExecution implements JHApiExecution {
|
||||||
|
|
||||||
/**
|
private JHRequestExecution execution;
|
||||||
* 获取一个执行器的实例
|
|
||||||
*
|
public void init(JHRequestExecution execution) {
|
||||||
* @param jhApiClient 请求的客户端
|
this.execution = execution;
|
||||||
*/
|
|
||||||
public JHJobApiExecution(JHApiClient jhApiClient) {
|
|
||||||
super(jhApiClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -52,7 +50,8 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
map.put("appId", appId);
|
map.put("appId", appId);
|
||||||
map.put("params", JsonUtil.objectToString(params));
|
map.put("params", JsonUtil.objectToString(params));
|
||||||
String path = JHApiClient.getUrl(JobPathConstant.JOB_SUBMIT_PATH, map);
|
String path = JHApiClient.getUrl(JobPathConstant.JOB_SUBMIT_PATH, map);
|
||||||
List<Map<String, String>> result = post(path, username, new TypeReference<ResponseResult<List<Map<String, String>>>>() {
|
List<Map<String, String>> result = execution.post(path, username,
|
||||||
|
new TypeReference<ResponseResult<List<Map<String, String>>>>() {
|
||||||
});
|
});
|
||||||
if (CollectionUtil.isEmpty(result)) {
|
if (CollectionUtil.isEmpty(result)) {
|
||||||
throw new ServiceException(path, 500, "作业提交返回为空!");
|
throw new ServiceException(path, 500, "作业提交返回为空!");
|
||||||
@@ -72,13 +71,15 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("jobId不能为空!");
|
throw new ArgsException("jobId不能为空!");
|
||||||
}
|
}
|
||||||
String path = JobPathConstant.JOB_FIND_JOB_FILES_PATH.replace("{jobId}", jobId);
|
String path = JobPathConstant.JOB_FIND_JOB_FILES_PATH.replace("{jobId}", jobId);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<FileInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<FileInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询作业列表
|
* 分页查询作业列表
|
||||||
* <p>作业名、作业状态等为非必填自动,如果为空则没有添加该查询条件</p>
|
* <p>
|
||||||
|
* 注:name、status、condition均为删选条件,condition为 高级筛选
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @param page 页码(非必填,默认:1)
|
* @param page 页码(非必填,默认:1)
|
||||||
@@ -89,7 +90,8 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
* @return 作业列表
|
* @return 作业列表
|
||||||
* @see JobStatusEnum
|
* @see JobStatusEnum
|
||||||
*/
|
*/
|
||||||
public PageJobInfo getJobPage(String username, Integer page, Integer pageSize, String name, JobStatusEnum status, Map<String, Object> condition) {
|
public PageJobInfo getJobPage(String username, Integer page, Integer pageSize, String name, JobStatusEnum status,
|
||||||
|
Map<String, Object> condition) {
|
||||||
Map<String, Object> params = new HashMap<>(5);
|
Map<String, Object> params = new HashMap<>(5);
|
||||||
if (page != null) {
|
if (page != null) {
|
||||||
params.put("page", page);
|
params.put("page", page);
|
||||||
@@ -107,13 +109,15 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
params.put("condition", JsonUtil.objectToString(params));
|
params.put("condition", JsonUtil.objectToString(params));
|
||||||
}
|
}
|
||||||
String path = JHApiClient.getUrl(JobPathConstant.JOB_PAGE_PATH, params);
|
String path = JHApiClient.getUrl(JobPathConstant.JOB_PAGE_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<PageJobInfo>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<PageJobInfo>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询作业列表
|
* 分页查询作业列表
|
||||||
* <p>作业名、作业状态等为非必填自动,如果为空则没有添加该查询条件</p>
|
* <p>
|
||||||
|
* 注:name、status、condition均为删选条件,condition为 高级筛选
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param username 用户名
|
* @param username 用户名
|
||||||
* @param page 页码(非必填,默认:1)
|
* @param page 页码(非必填,默认:1)
|
||||||
@@ -124,10 +128,71 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
* @return 作业列表
|
* @return 作业列表
|
||||||
* @see JobStatusEnum
|
* @see JobStatusEnum
|
||||||
*/
|
*/
|
||||||
public PageJobInfo getJobPage(String username, Integer page, Integer pageSize, String name, String status, Map<String, Object> condition) {
|
public PageJobInfo getJobPage(String username, Integer page, Integer pageSize, String name, String status,
|
||||||
|
Map<String, Object> condition) {
|
||||||
return getJobPage(username, page, pageSize, name, JobStatusEnum.getJobStatus(status), condition);
|
return getJobPage(username, page, pageSize, name, JobStatusEnum.getJobStatus(status), condition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询作业列表
|
||||||
|
* <p>
|
||||||
|
* 注:name、status、condition均为删选条件,condition为 高级筛选
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @param page 页码(非必填,默认:1)
|
||||||
|
* @param pageSize 每页大小(非必填,默认:20)
|
||||||
|
* @param name 作业名(非必填)
|
||||||
|
* @param status 作业名(非必填)
|
||||||
|
* @param condition 作业状态(非必填),取值见{@link JobStatusEnum#getJobStatus(String)}
|
||||||
|
* @return 作业列表
|
||||||
|
* @see JobStatusEnum
|
||||||
|
*/
|
||||||
|
public PageJobInfo getHistoryJobs(String username, Integer page, Integer pageSize, String name,
|
||||||
|
JobStatusEnum status, Map<String, Object> condition) {
|
||||||
|
|
||||||
|
Map<String, Object> params = new HashMap<>(5);
|
||||||
|
if (page != null) {
|
||||||
|
params.put("page", page);
|
||||||
|
}
|
||||||
|
if (pageSize != null) {
|
||||||
|
params.put("pageSize", pageSize);
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(name)) {
|
||||||
|
params.put("jobName", name);
|
||||||
|
}
|
||||||
|
if (status != null) {
|
||||||
|
params.put("status", status.getStatus());
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(condition)) {
|
||||||
|
params.put("condition", JsonUtil.objectToString(params));
|
||||||
|
}
|
||||||
|
|
||||||
|
String path = JHApiClient.getUrl(JobPathConstant.JOB_HISTORY_JOBS_PATH, params);
|
||||||
|
return execution.get(path, username, new TypeReference<ResponseResult<PageJobInfo>>() {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页查询作业列表
|
||||||
|
* <p>
|
||||||
|
* 注:name、status、condition均为删选条件,condition为 高级筛选
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @param username 用户名
|
||||||
|
* @param page 页码(非必填,默认:1)
|
||||||
|
* @param pageSize 每页大小(非必填,默认:20)
|
||||||
|
* @param name 作业名(非必填)
|
||||||
|
* @param status 作业名(非必填)
|
||||||
|
* @param condition 作业状态(非必填),取值见{@link JobStatusEnum#getJobStatus(String)}
|
||||||
|
* @return 作业列表
|
||||||
|
* @see JobStatusEnum
|
||||||
|
*/
|
||||||
|
public PageJobInfo getHistoryJobs(String username, Integer page, Integer pageSize, String name, String status,
|
||||||
|
Map<String, Object> condition) {
|
||||||
|
return getHistoryJobs(username, page, pageSize, name, JobStatusEnum.getJobStatus(status), condition);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询作业详情
|
* 查询作业详情
|
||||||
*
|
*
|
||||||
@@ -140,11 +205,10 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("jobId不能为空!");
|
throw new ArgsException("jobId不能为空!");
|
||||||
}
|
}
|
||||||
String path = JobPathConstant.JOB_DETAIL_INFO_PATH.replace("{jobId}", jobId);
|
String path = JobPathConstant.JOB_DETAIL_INFO_PATH.replace("{jobId}", jobId);
|
||||||
return get(path, username, new TypeReference<ResponseResult<JobInfo>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<JobInfo>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页检索作业名称查询作业信息
|
* 分页检索作业名称查询作业信息
|
||||||
*
|
*
|
||||||
@@ -168,11 +232,10 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String path = JHApiClient.getUrl(JobPathConstant.JOB_LIST_BY_NAME_PATH, params);
|
String path = JHApiClient.getUrl(JobPathConstant.JOB_LIST_BY_NAME_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<JobInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<JobInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页检索作业状态
|
* 分页检索作业状态
|
||||||
* <p>
|
* <p>
|
||||||
@@ -195,12 +258,12 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
if (pageSize != null) {
|
if (pageSize != null) {
|
||||||
params.put("pageSize", pageSize);
|
params.put("pageSize", pageSize);
|
||||||
}
|
}
|
||||||
String path = JHApiClient.getUrl(JobPathConstant.JOB_LIST_BY_STATUS_PATH.replace("{status}", status.getStatus()), params);
|
String path = JHApiClient
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<JobInfo>>>() {
|
.getUrl(JobPathConstant.JOB_LIST_BY_STATUS_PATH.replace("{status}", status.getStatus()), params);
|
||||||
|
return execution.get(path, username, new TypeReference<ResponseResult<List<JobInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作业的状态(必填),
|
* 作业的状态(必填),
|
||||||
*
|
*
|
||||||
@@ -215,7 +278,6 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
return getJobsByStatus(username, JobStatusEnum.getJobStatus(status), page, pageSize);
|
return getJobsByStatus(username, JobStatusEnum.getJobStatus(status), page, pageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过作业id列表查询作业列表
|
* 通过作业id列表查询作业列表
|
||||||
*
|
*
|
||||||
@@ -230,14 +292,15 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("jobIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, jobIds));
|
params.put("jobIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, jobIds));
|
||||||
String path = JHApiClient.getUrl(JobPathConstant.JOB_LIST_BY_IDS_PATH, params);
|
String path = JHApiClient.getUrl(JobPathConstant.JOB_LIST_BY_IDS_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<JobInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<JobInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作作业
|
* 操作作业
|
||||||
* <p>
|
* <p>
|
||||||
* {@link JobActionEnum} 中的 静态方法{@link JobActionEnum#getJobAction(String)}可以将前端的字符转换为{@link JobActionEnum}对象
|
* {@link JobActionEnum} 中的
|
||||||
|
* 静态方法{@link JobActionEnum#getJobAction(String)}可以将前端的字符转换为{@link JobActionEnum}对象
|
||||||
* <p>
|
* <p>
|
||||||
* 或者使用{@link #action(String, String, String)}直接操作,但最终还是调的这个方法,我们只不过是内部做了转换而已
|
* 或者使用{@link #action(String, String, String)}直接操作,但最终还是调的这个方法,我们只不过是内部做了转换而已
|
||||||
*
|
*
|
||||||
@@ -254,7 +317,7 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("jobId不能为空!");
|
throw new ArgsException("jobId不能为空!");
|
||||||
}
|
}
|
||||||
String path = JobPathConstant.JOB_ACTION_PATH.replace("{jobId}", jobId).replace("{action}", action.getAction());
|
String path = JobPathConstant.JOB_ACTION_PATH.replace("{jobId}", jobId).replace("{action}", action.getAction());
|
||||||
put(path, username);
|
execution.put(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -268,11 +331,11 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
action(username, JobActionEnum.getJobAction(action), jobId);
|
action(username, JobActionEnum.getJobAction(action), jobId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量操作作业
|
* 批量操作作业
|
||||||
* <p>
|
* <p>
|
||||||
* {@link JobsActionEnum} 中的 静态方法{@link JobsActionEnum#getJobAction(String)}可以将前端的字符转换为{@link JobsActionEnum}对象
|
* {@link JobsActionEnum} 中的
|
||||||
|
* 静态方法{@link JobsActionEnum#getJobAction(String)}可以将前端的字符转换为{@link JobsActionEnum}对象
|
||||||
* <p>
|
* <p>
|
||||||
* 或者使用{@link #actions(String, String, List)}直接操作,但最终还是调的这个方法,我们只不过是内部做了转换而已
|
* 或者使用{@link #actions(String, String, List)}直接操作,但最终还是调的这个方法,我们只不过是内部做了转换而已
|
||||||
*
|
*
|
||||||
@@ -289,8 +352,9 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
}
|
}
|
||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("jobIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, jobIds));
|
params.put("jobIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, jobIds));
|
||||||
String path = JHApiClient.getUrl(JobPathConstant.JOB_ACTION_IDS_PATH.replace("{action}", action.getAction()), params);
|
String path = JHApiClient.getUrl(JobPathConstant.JOB_ACTION_IDS_PATH.replace("{action}", action.getAction()),
|
||||||
put(path, username);
|
params);
|
||||||
|
execution.put(path, username);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -304,7 +368,6 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
actions(username, JobsActionEnum.getJobAction(action), jobIds);
|
actions(username, JobsActionEnum.getJobAction(action), jobIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询制定作业的作业历史
|
* 查询制定作业的作业历史
|
||||||
*
|
*
|
||||||
@@ -317,7 +380,8 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("jobId不能为空!");
|
throw new ArgsException("jobId不能为空!");
|
||||||
}
|
}
|
||||||
String path = JobPathConstant.JOB_HISTORY_PATH.replace("{jobId}", jobId);
|
String path = JobPathConstant.JOB_HISTORY_PATH.replace("{jobId}", jobId);
|
||||||
List<JobHistoryInfo> list = get(path, username, new TypeReference<ResponseResult<List<JobHistoryInfo>>>() {
|
List<JobHistoryInfo> list = execution.get(path, username,
|
||||||
|
new TypeReference<ResponseResult<List<JobHistoryInfo>>>() {
|
||||||
});
|
});
|
||||||
if (CollectionUtil.isEmpty(list)) {
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
throw new ServiceException(path, 500, "历史作业信息不存在!");
|
throw new ServiceException(path, 500, "历史作业信息不存在!");
|
||||||
@@ -325,7 +389,6 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
return list.get(0);
|
return list.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过多个id查询作业历史列表
|
* 通过多个id查询作业历史列表
|
||||||
*
|
*
|
||||||
@@ -340,7 +403,7 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
params.put("jobIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, jobIds));
|
params.put("jobIds", String.join(CommonConstant.NORMAL_CHARACTER_COMMA, jobIds));
|
||||||
String path = JHApiClient.getUrl(JobPathConstant.JOB_HISTORY_IDS_PATH, params);
|
String path = JHApiClient.getUrl(JobPathConstant.JOB_HISTORY_IDS_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<JobHistoryInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<JobHistoryInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +419,8 @@ 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 = getJhApiClient().get(path, getHeaders(username), new TypeReference<ResponseResult<String>>() {
|
ResponseResult<String> result = execution.getJhApiClient().get(path, execution.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());
|
||||||
@@ -368,7 +432,6 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
return result.getMessage();
|
return result.getMessage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 连接作业会话
|
* 连接作业会话
|
||||||
*
|
*
|
||||||
@@ -381,7 +444,7 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("jobId不能为空!");
|
throw new ArgsException("jobId不能为空!");
|
||||||
}
|
}
|
||||||
String path = JobPathConstant.JOB_CONNECT_SESSION_PATH.replace("{jobId}", jobId);
|
String path = JobPathConstant.JOB_CONNECT_SESSION_PATH.replace("{jobId}", jobId);
|
||||||
return post(path, username, new TypeReference<ResponseResult<Object>>() {
|
return execution.post(path, username, new TypeReference<ResponseResult<Object>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,7 +459,7 @@ public class JHJobApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("appId不能为空!");
|
throw new ArgsException("appId不能为空!");
|
||||||
}
|
}
|
||||||
String path = JobPathConstant.JOB_GET_APP_FORM_PATH.replace("{appId}", appId);
|
String path = JobPathConstant.JOB_GET_APP_FORM_PATH.replace("{appId}", appId);
|
||||||
return get(path, username, new TypeReference<ResponseResult<List<JobAppFormItemInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<List<JobAppFormItemInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,86 +8,80 @@ package com.jhinno.sdk.openapi.api.job;
|
|||||||
*/
|
*/
|
||||||
public class JobPathConstant {
|
public class JobPathConstant {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 提交作业
|
* 提交作业
|
||||||
*/
|
*/
|
||||||
public static final String JOB_SUBMIT_PATH = "/ws/api/jobs/jsub";
|
public static final String JOB_SUBMIT_PATH = "/appform/ws/api/jobs/jsub";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用作业id查询作业列表
|
* 使用作业id查询作业列表
|
||||||
*/
|
*/
|
||||||
public static final String JOB_FIND_JOB_FILES_PATH = "/ws/api/jobs/{jobId}/files";
|
public static final String JOB_FIND_JOB_FILES_PATH = "/appform/ws/api/jobs/{jobId}/files";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询作业列表
|
* 分页查询作业列表
|
||||||
*/
|
*/
|
||||||
public static final String JOB_PAGE_PATH = "/ws/api/jobs/page";
|
public static final String JOB_PAGE_PATH = "/appform/ws/api/jobs/page";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询历史作业列表
|
||||||
|
*/
|
||||||
|
public static final String JOB_HISTORY_JOBS_PATH = "/appform/ws/api/jobs/historyPage";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询作业详情
|
* 查询作业详情
|
||||||
*/
|
*/
|
||||||
public static final String JOB_DETAIL_INFO_PATH = "/ws/api/jobs/{jobId}";
|
public static final String JOB_DETAIL_INFO_PATH = "/appform/ws/api/jobs/{jobId}";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页检索作业名
|
* 分页检索作业名
|
||||||
*/
|
*/
|
||||||
public static final String JOB_LIST_BY_NAME_PATH = "/ws/api/jobs/byName";
|
public static final String JOB_LIST_BY_NAME_PATH = "/appform/ws/api/jobs/byName";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作业号检索作业列表
|
* 作业号检索作业列表
|
||||||
*/
|
*/
|
||||||
public static final String JOB_LIST_BY_STATUS_PATH = "/ws/api/jobs/byStatus/{status}";
|
public static final String JOB_LIST_BY_STATUS_PATH = "/appform/ws/api/jobs/byStatus/{status}";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过作业号查询作业列表
|
* 通过作业号查询作业列表
|
||||||
*/
|
*/
|
||||||
public static final String JOB_LIST_BY_IDS_PATH = "/ws/api/jobs/list";
|
public static final String JOB_LIST_BY_IDS_PATH = "/appform/ws/api/jobs/list";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 作业操作
|
* 作业操作
|
||||||
*/
|
*/
|
||||||
public static final String JOB_ACTION_PATH = "/ws/api/jobs/{jobId}/{action}";
|
public static final String JOB_ACTION_PATH = "/appform/ws/api/jobs/{jobId}/{action}";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量操作作业
|
* 批量操作作业
|
||||||
*/
|
*/
|
||||||
public static final String JOB_ACTION_IDS_PATH = "/ws/api/jobs/{action}";
|
public static final String JOB_ACTION_IDS_PATH = "/appform/ws/api/jobs/{action}";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取作业历史
|
* 获取作业历史
|
||||||
*/
|
*/
|
||||||
public static final String JOB_HISTORY_PATH = "/ws/api/jobs/{jobId}/hist";
|
public static final String JOB_HISTORY_PATH = "/appform/ws/api/jobs/{jobId}/hist";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过多个作业号查询作业历史
|
* 通过多个作业号查询作业历史
|
||||||
*/
|
*/
|
||||||
public static final String JOB_HISTORY_IDS_PATH = "/ws/api/jobs/hist";
|
public static final String JOB_HISTORY_IDS_PATH = "/appform/ws/api/jobs/hist";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取作业动态输出
|
* 获取作业动态输出
|
||||||
*/
|
*/
|
||||||
public static final String JOB_PEEK_PATH = "/ws/api/jobs/{jobId}/peek";
|
public static final String JOB_PEEK_PATH = "/appform/ws/api/jobs/{jobId}/peek";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 连接作业会话
|
* 连接作业会话
|
||||||
*/
|
*/
|
||||||
public static final String JOB_CONNECT_SESSION_PATH = "/ws/api/jobs/{jobId}/connect";
|
public static final String JOB_CONNECT_SESSION_PATH = "/appform/ws/api/jobs/{jobId}/connect";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取作业表单
|
* 获取作业表单
|
||||||
* <p/>
|
* <p/>
|
||||||
* 该接口目前在Solutions下面维护,未经过产品的测试
|
* 该接口目前在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 = "/appform/ws/api/jobs/{appId}/form_params";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,6 @@ public enum JobStatusEnum {
|
|||||||
EXIT("EXIT", "退出"),
|
EXIT("EXIT", "退出"),
|
||||||
UNKNOWN_UNKWN("UNKNOWN#UNKWN", "状态不明");
|
UNKNOWN_UNKWN("UNKNOWN#UNKWN", "状态不明");
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态标识
|
* 状态标识
|
||||||
*/
|
*/
|
||||||
@@ -39,7 +38,6 @@ public enum JobStatusEnum {
|
|||||||
*/
|
*/
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用标号获得JobStatusEnum对象
|
* 使用标号获得JobStatusEnum对象
|
||||||
*
|
*
|
||||||
@@ -49,7 +47,7 @@ public enum JobStatusEnum {
|
|||||||
*/
|
*/
|
||||||
public static JobStatusEnum getJobStatus(String status) {
|
public static JobStatusEnum getJobStatus(String status) {
|
||||||
if (StringUtils.isBlank(status)) {
|
if (StringUtils.isBlank(status)) {
|
||||||
throw new ArgsException("作业状态不能为空!");
|
return null;
|
||||||
}
|
}
|
||||||
for (JobStatusEnum value : values()) {
|
for (JobStatusEnum value : values()) {
|
||||||
if (StringUtils.equals(status, value.getStatus())) {
|
if (StringUtils.equals(status, value.getStatus())) {
|
||||||
|
|||||||
@@ -11,11 +11,11 @@ public class DepartmentPathConstant {
|
|||||||
/**
|
/**
|
||||||
* 组织
|
* 组织
|
||||||
*/
|
*/
|
||||||
public static final String DEPARTMENT_PATH = "/ws/api/deps";
|
public static final String DEPARTMENT_PATH = "/appform/ws/api/deps";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组织名称操作组织
|
* 组织名称操作组织
|
||||||
*/
|
*/
|
||||||
public static final String DEPARTMENT_NAME_PATH = "/ws/api/deps/{depName}";
|
public static final String DEPARTMENT_NAME_PATH = "/appform/ws/api/deps/{depName}";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ package com.jhinno.sdk.openapi.api.organization;
|
|||||||
|
|
||||||
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.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.api.ResponseResult;
|
||||||
import com.jhinno.sdk.openapi.client.JHApiClient;
|
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -20,18 +20,14 @@ import java.util.Map;
|
|||||||
* @date 2024/2/6 17:37
|
* @date 2024/2/6 17:37
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class JHDepartmentApiExecution extends JHApiExecution {
|
public class JHDepartmentApiExecution implements JHApiExecution {
|
||||||
|
|
||||||
/**
|
private JHRequestExecution execution;
|
||||||
* 获取一个执行器的实例
|
|
||||||
*
|
public void init(JHRequestExecution execution) {
|
||||||
* @param jhApiClient 请求的客户端
|
this.execution = execution;
|
||||||
*/
|
|
||||||
public JHDepartmentApiExecution(JHApiClient jhApiClient) {
|
|
||||||
super(jhApiClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询用户列表
|
* 查询用户列表
|
||||||
*
|
*
|
||||||
@@ -39,11 +35,11 @@ public class JHDepartmentApiExecution extends JHApiExecution {
|
|||||||
* @return 用户列表
|
* @return 用户列表
|
||||||
*/
|
*/
|
||||||
public List<Map<String, Object>> getDepartmentList(String username) {
|
public List<Map<String, Object>> getDepartmentList(String username) {
|
||||||
return get(DepartmentPathConstant.DEPARTMENT_PATH, username, new TypeReference<ResponseResult<List<Map<String, Object>>>>() {
|
return execution.get(DepartmentPathConstant.DEPARTMENT_PATH, username,
|
||||||
|
new TypeReference<ResponseResult<List<Map<String, Object>>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加部门
|
* 添加部门
|
||||||
*
|
*
|
||||||
@@ -51,10 +47,9 @@ public class JHDepartmentApiExecution extends JHApiExecution {
|
|||||||
* @param departmentInfo 部门信息
|
* @param departmentInfo 部门信息
|
||||||
*/
|
*/
|
||||||
public void addDepartment(String username, AddUpdateDepartment departmentInfo) {
|
public void addDepartment(String username, AddUpdateDepartment departmentInfo) {
|
||||||
post(DepartmentPathConstant.DEPARTMENT_PATH, username, departmentInfo);
|
execution.post(DepartmentPathConstant.DEPARTMENT_PATH, username, departmentInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改部门信息
|
* 修改部门信息
|
||||||
*
|
*
|
||||||
@@ -66,10 +61,9 @@ public class JHDepartmentApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("departmentInfo中的depName不能为空!");
|
throw new ArgsException("departmentInfo中的depName不能为空!");
|
||||||
}
|
}
|
||||||
String path = DepartmentPathConstant.DEPARTMENT_NAME_PATH.replace("{depName}", departmentInfo.getDepName());
|
String path = DepartmentPathConstant.DEPARTMENT_NAME_PATH.replace("{depName}", departmentInfo.getDepName());
|
||||||
put(path, username, departmentInfo);
|
execution.put(path, username, departmentInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除部门信息
|
* 删除部门信息
|
||||||
*
|
*
|
||||||
@@ -81,6 +75,6 @@ public class JHDepartmentApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("departmentName不能为空!");
|
throw new ArgsException("departmentName不能为空!");
|
||||||
}
|
}
|
||||||
String path = DepartmentPathConstant.DEPARTMENT_NAME_PATH.replace("{depName}", departmentName);
|
String path = DepartmentPathConstant.DEPARTMENT_NAME_PATH.replace("{depName}", departmentName);
|
||||||
delete(path, username);
|
execution.delete(path, username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ package com.jhinno.sdk.openapi.api.organization;
|
|||||||
|
|
||||||
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.api.JHApiExecution;
|
import com.jhinno.sdk.openapi.JHApiExecution;
|
||||||
|
import com.jhinno.sdk.openapi.api.JHRequestExecution;
|
||||||
import com.jhinno.sdk.openapi.api.PageResult;
|
import com.jhinno.sdk.openapi.api.PageResult;
|
||||||
import com.jhinno.sdk.openapi.api.ResponseResult;
|
import com.jhinno.sdk.openapi.api.ResponseResult;
|
||||||
import com.jhinno.sdk.openapi.client.JHApiClient;
|
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||||
@@ -21,16 +22,13 @@ import java.util.Map;
|
|||||||
* @date 2024/2/6 17:37
|
* @date 2024/2/6 17:37
|
||||||
*/
|
*/
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
public class JHUserApiExecution extends JHApiExecution {
|
public class JHUserApiExecution implements JHApiExecution {
|
||||||
/**
|
|
||||||
* 获取一个执行器的实例
|
|
||||||
*
|
|
||||||
* @param jhApiClient 请求的客户端
|
|
||||||
*/
|
|
||||||
public JHUserApiExecution(JHApiClient jhApiClient) {
|
|
||||||
super(jhApiClient);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
private JHRequestExecution execution;
|
||||||
|
|
||||||
|
public void init(JHRequestExecution execution) {
|
||||||
|
this.execution = execution;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询用户列表
|
* 分页查询用户列表
|
||||||
@@ -53,7 +51,7 @@ public class JHUserApiExecution extends JHApiExecution {
|
|||||||
params.put("userConf", userConf);
|
params.put("userConf", userConf);
|
||||||
}
|
}
|
||||||
String path = JHApiClient.getUrl(UserPathConstant.USERS_PATH, params);
|
String path = JHApiClient.getUrl(UserPathConstant.USERS_PATH, params);
|
||||||
return get(path, username, new TypeReference<ResponseResult<PageResult<UserInfo>>>() {
|
return execution.get(path, username, new TypeReference<ResponseResult<PageResult<UserInfo>>>() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -64,7 +62,7 @@ public class JHUserApiExecution extends JHApiExecution {
|
|||||||
* @param userInfo 用户信息
|
* @param userInfo 用户信息
|
||||||
*/
|
*/
|
||||||
public void addUser(String username, AddUpdateUserInfo userInfo) {
|
public void addUser(String username, AddUpdateUserInfo userInfo) {
|
||||||
post(UserPathConstant.USERS_PATH, username, userInfo);
|
execution.post(UserPathConstant.USERS_PATH, username, userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,10 +76,9 @@ public class JHUserApiExecution extends JHApiExecution {
|
|||||||
throw new ArgsException("userInfo中userName的值不能为空");
|
throw new ArgsException("userInfo中userName的值不能为空");
|
||||||
}
|
}
|
||||||
String path = UserPathConstant.USERS_USERNAME_PATH.replace("{username}", userInfo.getUserName());
|
String path = UserPathConstant.USERS_USERNAME_PATH.replace("{username}", userInfo.getUserName());
|
||||||
put(path, username, userInfo);
|
execution.put(path, username, userInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改或重置用户密码
|
* 修改或重置用户密码
|
||||||
*
|
*
|
||||||
@@ -98,7 +95,8 @@ public class JHUserApiExecution extends JHApiExecution {
|
|||||||
* @param password 新密码
|
* @param password 新密码
|
||||||
* @param type 类型,(非必填,取值见{@link UpdateUserPasswordType})
|
* @param type 类型,(非必填,取值见{@link UpdateUserPasswordType})
|
||||||
*/
|
*/
|
||||||
public void updateUserPassword(String username, String updatePasswordUsername, String oldPassword, String password, String type) {
|
public void updateUserPassword(String username, String updatePasswordUsername, String oldPassword, String password,
|
||||||
|
String type) {
|
||||||
if (StringUtils.isBlank(updatePasswordUsername)) {
|
if (StringUtils.isBlank(updatePasswordUsername)) {
|
||||||
throw new ArgsException("updatePasswordUsername不能为空");
|
throw new ArgsException("updatePasswordUsername不能为空");
|
||||||
}
|
}
|
||||||
@@ -111,10 +109,9 @@ public class JHUserApiExecution extends JHApiExecution {
|
|||||||
params.put("type", type);
|
params.put("type", type);
|
||||||
}
|
}
|
||||||
params.put("password", password);
|
params.put("password", password);
|
||||||
put(path, username, params);
|
execution.put(path, username, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户的密码
|
* 修改用户的密码
|
||||||
*
|
*
|
||||||
@@ -123,7 +120,8 @@ public class JHUserApiExecution extends JHApiExecution {
|
|||||||
* @param oldPassword 旧密码
|
* @param oldPassword 旧密码
|
||||||
* @param password 新密码
|
* @param password 新密码
|
||||||
*/
|
*/
|
||||||
public void updateUserPassword(String username, String updatePasswordUsername, String oldPassword, String password) {
|
public void updateUserPassword(String username, String updatePasswordUsername, String oldPassword,
|
||||||
|
String password) {
|
||||||
updateUserPassword(username, updatePasswordUsername, oldPassword, password, null);
|
updateUserPassword(username, updatePasswordUsername, oldPassword, password, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +133,8 @@ public class JHUserApiExecution extends JHApiExecution {
|
|||||||
* @param password 新的用户密码
|
* @param password 新的用户密码
|
||||||
*/
|
*/
|
||||||
public void resetForceUpdatePassword(String username, String updatePasswordUsername, String password) {
|
public void resetForceUpdatePassword(String username, String updatePasswordUsername, String password) {
|
||||||
updateUserPassword(username, updatePasswordUsername, null, password, UpdateUserPasswordType.FORCE_UPDATE_PASSWORD_TYPE);
|
updateUserPassword(username, updatePasswordUsername, null, password,
|
||||||
|
UpdateUserPasswordType.FORCE_UPDATE_PASSWORD_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,10 +145,10 @@ public class JHUserApiExecution extends JHApiExecution {
|
|||||||
* @param password 新的用户密码
|
* @param password 新的用户密码
|
||||||
*/
|
*/
|
||||||
public void resetPassword(String username, String updatePasswordUsername, String password) {
|
public void resetPassword(String username, String updatePasswordUsername, String password) {
|
||||||
updateUserPassword(username, updatePasswordUsername, null, password, UpdateUserPasswordType.RESET_UPDATE_PASSWORD_TYPE);
|
updateUserPassword(username, updatePasswordUsername, null, password,
|
||||||
|
UpdateUserPasswordType.RESET_UPDATE_PASSWORD_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除用户
|
* 删除用户
|
||||||
*
|
*
|
||||||
@@ -160,7 +159,7 @@ public class JHUserApiExecution extends JHApiExecution {
|
|||||||
if (StringUtils.isBlank(deleteUsername)) {
|
if (StringUtils.isBlank(deleteUsername)) {
|
||||||
throw new ArgsException("deleteUsername不能为空");
|
throw new ArgsException("deleteUsername不能为空");
|
||||||
}
|
}
|
||||||
delete(UserPathConstant.USERS_USERNAME_PATH.replace("{username}", deleteUsername), username);
|
execution.delete(UserPathConstant.USERS_USERNAME_PATH.replace("{username}", deleteUsername), username);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,18 +11,18 @@ public class UserPathConstant {
|
|||||||
/**
|
/**
|
||||||
* 查询用户和修改用户
|
* 查询用户和修改用户
|
||||||
*/
|
*/
|
||||||
public static final String USERS_PATH = "/ws/api/users";
|
public static final String USERS_PATH = "/appform/ws/api/users";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改用户和删除用户
|
* 修改用户和删除用户
|
||||||
*/
|
*/
|
||||||
public static final String USERS_USERNAME_PATH = "/ws/api/users/{username}";
|
public static final String USERS_USERNAME_PATH = "/appform/ws/api/users/{username}";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户密码操作
|
* 用户密码操作
|
||||||
*/
|
*/
|
||||||
public static final String USERS_RESET_PASSWORD_PATH = "/ws/api/users/{username}/password/password_reset";
|
public static final String USERS_RESET_PASSWORD_PATH = "/appform/ws/api/users/{username}/password/password_reset";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.jhinno.sdk.openapi.test;
|
package com.jhinno.sdk.openapi.test;
|
||||||
|
|
||||||
import com.jhinno.sdk.openapi.AuthType;
|
import com.jhinno.sdk.openapi.AuthType;
|
||||||
import com.jhinno.sdk.openapi.api.JHApiExecution;
|
import com.jhinno.sdk.openapi.JHApiExecutionManage;
|
||||||
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;
|
||||||
@@ -22,31 +22,21 @@ import java.util.Map;
|
|||||||
public class JHClientConfig {
|
public class JHClientConfig {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化JHApi客户端
|
* 创建一个API执行器管理器
|
||||||
*/
|
*/
|
||||||
public static final JHApiClient client = new JHApiClient("https://172.17.0.5/appform");
|
public static final JHApiExecutionManage API_EXECUTRON_MANAGE = new JHApiExecutionManage(
|
||||||
|
"https://192.168.87.24");
|
||||||
public static final Map<Class<? extends JHApiExecution>, JHApiExecution> jhApiClientMap = new HashMap<>();
|
|
||||||
|
|
||||||
public static final String ACCESS_KEY = "3f03747f147942bd8debd81b6c9c6a80";
|
public static final String ACCESS_KEY = "3f03747f147942bd8debd81b6c9c6a80";
|
||||||
|
|
||||||
public static final String ACCESS_KEY_SECRET = "e0681859b91c499eb1d2c8e09cea3242";
|
public static final String ACCESS_KEY_SECRET = "e0681859b91c499eb1d2c8e09cea3242";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
client.initDefaultApiClient();
|
API_EXECUTRON_MANAGE.configureApiExecution(t -> {
|
||||||
jhApiClientMap.put(JHAppApiExecution.class, new JHAppApiExecution());
|
// 默认为使用Token模式,如何使用的Token模式,则不需要配置ACCESS_KEY和ACCESS_KEY SECRET
|
||||||
jhApiClientMap.put(JHDataApiExecution.class, new JHDataApiExecution());
|
// t.setAuthType(AuthType.ACCESS_KEY);
|
||||||
jhApiClientMap.put(JHFileApiExecution.class, new JHFileApiExecution());
|
t.setAccessKey(ACCESS_KEY);
|
||||||
jhApiClientMap.put(JHJobApiExecution.class, new JHJobApiExecution());
|
t.setAccessKeySecret(ACCESS_KEY_SECRET);
|
||||||
jhApiClientMap.put(JHDepartmentApiExecution.class, new JHDepartmentApiExecution());
|
|
||||||
jhApiClientMap.put(JHUserApiExecution.class, new JHUserApiExecution());
|
|
||||||
|
|
||||||
jhApiClientMap.forEach((k, v) -> {
|
|
||||||
v.setJhApiClient(client);
|
|
||||||
v.setAuthType(AuthType.ACCESS_SECRET_MODE);
|
|
||||||
v.setAccessKey(ACCESS_KEY);
|
|
||||||
v.setAccessKeySecret(ACCESS_KEY_SECRET);
|
|
||||||
v.setUsedServerTime(true);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,11 +16,11 @@ import java.util.List;
|
|||||||
|
|
||||||
public class AppApiTest {
|
public class AppApiTest {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得一个调用应用接口的执行器
|
* 获得一个调用应用接口的执行器
|
||||||
*/
|
*/
|
||||||
public static final JHAppApiExecution jhAppApiExecution = (JHAppApiExecution) JHClientConfig.jhApiClientMap.get(JHAppApiExecution.class);
|
public static final JHAppApiExecution jhAppApiExecution = JHClientConfig.API_EXECUTRON_MANAGE
|
||||||
|
.getApiExecution(JHAppApiExecution.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测测试使用自定义的参数启动jhadmin的Linux桌面
|
* 测测试使用自定义的参数启动jhadmin的Linux桌面
|
||||||
@@ -42,7 +42,6 @@ public class AppApiTest {
|
|||||||
System.out.println(appStartedInfo);
|
System.out.println(appStartedInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试获取用户jhadmin的会话列表
|
* 测试获取用户jhadmin的会话列表
|
||||||
*/
|
*/
|
||||||
@@ -61,13 +60,13 @@ public class AppApiTest {
|
|||||||
System.out.println(desktopList);
|
System.out.println(desktopList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试根据会话列表查询会话列表
|
* 测试根据会话列表查询会话列表
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetDesktopsById() {
|
public void testGetDesktopsById() {
|
||||||
List<SessionInfo> desktopList = jhAppApiExecution.getDesktopsById("jhadmin", Arrays.asList("7649", "7637", "123"));
|
List<SessionInfo> desktopList = jhAppApiExecution.getDesktopsById("jhadmin",
|
||||||
|
Arrays.asList("7649", "7637", "123"));
|
||||||
System.out.println(desktopList);
|
System.out.println(desktopList);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,7 +79,6 @@ public class AppApiTest {
|
|||||||
System.out.println(desktopList);
|
System.out.println(desktopList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试会话共享
|
* 测试会话共享
|
||||||
*/
|
*/
|
||||||
@@ -105,7 +103,6 @@ public class AppApiTest {
|
|||||||
jhAppApiExecution.transferOperatorRight("jhadmin", "7649", "123");
|
jhAppApiExecution.transferOperatorRight("jhadmin", "7649", "123");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试链接会话
|
* 测试链接会话
|
||||||
*/
|
*/
|
||||||
@@ -115,7 +112,6 @@ public class AppApiTest {
|
|||||||
System.out.println(appStartedInfo);
|
System.out.println(appStartedInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试断开会话的连接
|
* 测试断开会话的连接
|
||||||
*/
|
*/
|
||||||
@@ -132,16 +128,14 @@ public class AppApiTest {
|
|||||||
jhAppApiExecution.disconnectSessionByIds("jhadmin", Arrays.asList("123", "456"));
|
jhAppApiExecution.disconnectSessionByIds("jhadmin", Arrays.asList("123", "456"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试注销会话
|
* 测试注销会话
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDestroySession() {
|
public void testDestroySession() {
|
||||||
jhAppApiExecution.destroySession("jhadmin", "4856");
|
jhAppApiExecution.destroySession("jhadmin", "63");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试批量注销会话
|
* 测试批量注销会话
|
||||||
*/
|
*/
|
||||||
@@ -159,7 +153,6 @@ public class AppApiTest {
|
|||||||
System.out.println(appList);
|
System.out.println(appList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试获取应用链接
|
* 测试获取应用链接
|
||||||
*/
|
*/
|
||||||
@@ -168,7 +161,6 @@ public class AppApiTest {
|
|||||||
System.out.println(jhAppApiExecution.getAppUrl("jhadmin", "myjobmana"));
|
System.out.println(jhAppApiExecution.getAppUrl("jhadmin", "myjobmana"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试根据文件后缀取应用列表
|
* 测试根据文件后缀取应用列表
|
||||||
*/
|
*/
|
||||||
@@ -177,7 +169,6 @@ public class AppApiTest {
|
|||||||
System.out.println(jhAppApiExecution.getAppInfoSuffixList("test", ".sh"));
|
System.out.println(jhAppApiExecution.getAppInfoSuffixList("test", ".sh"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试根据用途获取应用列表
|
* 测试根据用途获取应用列表
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -14,7 +14,8 @@ import java.util.Arrays;
|
|||||||
*/
|
*/
|
||||||
public class DataApiTest {
|
public class DataApiTest {
|
||||||
|
|
||||||
public static final JHDataApiExecution execution = (JHDataApiExecution) JHClientConfig.jhApiClientMap.get(JHDataApiExecution.class);
|
public static final JHDataApiExecution execution =JHClientConfig.API_EXECUTRON_MANAGE
|
||||||
|
.getApiExecution(JHDataApiExecution.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试获取作业数据区目录列表
|
* 测试获取作业数据区目录列表
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.jhinno.sdk.openapi.test.file;
|
package com.jhinno.sdk.openapi.test.file;
|
||||||
|
|
||||||
|
|
||||||
import com.jhinno.sdk.openapi.api.file.FileInfo;
|
import com.jhinno.sdk.openapi.api.file.FileInfo;
|
||||||
import com.jhinno.sdk.openapi.api.file.JHFileApiExecution;
|
import com.jhinno.sdk.openapi.api.file.JHFileApiExecution;
|
||||||
import com.jhinno.sdk.openapi.test.JHClientConfig;
|
import com.jhinno.sdk.openapi.test.JHClientConfig;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@@ -17,8 +17,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class FileApiTest {
|
public class FileApiTest {
|
||||||
|
|
||||||
private static final JHFileApiExecution execution = (JHFileApiExecution) JHClientConfig.jhApiClientMap.get(JHFileApiExecution.class);
|
private static final JHFileApiExecution execution = JHClientConfig.API_EXECUTRON_MANAGE
|
||||||
|
.getApiExecution(JHFileApiExecution.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试重命名文件或文件夹
|
* 测试重命名文件或文件夹
|
||||||
@@ -44,7 +44,6 @@ public class FileApiTest {
|
|||||||
execution.copyFile("lqyan", "/apps/JHDP/lqyan/PSUserService.class", "/apps/JHDP/lqyan/temp");
|
execution.copyFile("lqyan", "/apps/JHDP/lqyan/PSUserService.class", "/apps/JHDP/lqyan/temp");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试获取文件列表
|
* 测试获取文件列表
|
||||||
*/
|
*/
|
||||||
@@ -62,7 +61,6 @@ public class FileApiTest {
|
|||||||
System.out.println(execution.mkdir("jhadmin", "$HOMEtest1", true));
|
System.out.println(execution.mkdir("jhadmin", "$HOMEtest1", true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新建文件夹不强制新建
|
* 新建文件夹不强制新建
|
||||||
*/
|
*/
|
||||||
@@ -71,7 +69,6 @@ public class FileApiTest {
|
|||||||
System.out.println(execution.mkdir("lqyan", "/apps/JHDP/lqyan/temp/bbb/ddd"));
|
System.out.println(execution.mkdir("lqyan", "/apps/JHDP/lqyan/temp/bbb/ddd"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试新建文件(接口执行失败)
|
* 测试新建文件(接口执行失败)
|
||||||
*/
|
*/
|
||||||
@@ -80,7 +77,6 @@ public class FileApiTest {
|
|||||||
System.out.println(execution.mkFile("lqyan", "/apps/JHDP/lqyan/temp/ddd.txt"));
|
System.out.println(execution.mkFile("lqyan", "/apps/JHDP/lqyan/temp/ddd.txt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试文件上传 (是否覆盖存在问题)
|
* 测试文件上传 (是否覆盖存在问题)
|
||||||
*/
|
*/
|
||||||
@@ -91,7 +87,6 @@ public class FileApiTest {
|
|||||||
execution.uploadFile("jhadmin", fileInputStream, file.getName(), "$HOME", true);
|
execution.uploadFile("jhadmin", fileInputStream, file.getName(), "$HOME", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试上传文件,(不覆盖源文件,如果isCover是true,上传后的文件有数字下标)
|
* 测试上传文件,(不覆盖源文件,如果isCover是true,上传后的文件有数字下标)
|
||||||
*/
|
*/
|
||||||
@@ -110,13 +105,20 @@ public class FileApiTest {
|
|||||||
System.out.println(execution.getFileDownloadUrl("jhadmin", "$HOME/aa2a.sh"));
|
System.out.println(execution.getFileDownloadUrl("jhadmin", "$HOME/aa2a.sh"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetFileStream() throws IOException {
|
||||||
|
InputStream in = execution.getFileInputStream("jhadmin", "$HOME/aaa.sh");
|
||||||
|
byte[] bytes = new byte[1024];
|
||||||
|
while (in.read(bytes) != -1) {
|
||||||
|
System.out.println(new String(bytes));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCompress() {
|
public void testCompress() {
|
||||||
execution.compress("jhadmin", "$HOME/temp", "$HOME/temp.zip");
|
execution.compress("jhadmin", "$HOME/temp", "$HOME/temp.zip");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testUncompress() {
|
public void testUncompress() {
|
||||||
execution.uncompress("jhadmin", "$HOME/temp.zip", "$HOME/test");
|
execution.uncompress("jhadmin", "$HOME/temp.zip", "$HOME/test");
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class JobApiTest {
|
public class JobApiTest {
|
||||||
|
|
||||||
private static final JHJobApiExecution execution = (JHJobApiExecution) JHClientConfig.jhApiClientMap.get(JHJobApiExecution.class);
|
private static final JHJobApiExecution execution = JHClientConfig.API_EXECUTRON_MANAGE
|
||||||
|
.getApiExecution(JHJobApiExecution.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试提交作业
|
* 测试提交作业
|
||||||
@@ -30,7 +31,6 @@ public class JobApiTest {
|
|||||||
System.out.println(execution.submit("jhadmin", "common_sub", params));
|
System.out.println(execution.submit("jhadmin", "common_sub", params));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试根据作业id查询作业文件列表
|
* 测试根据作业id查询作业文件列表
|
||||||
*/
|
*/
|
||||||
@@ -39,14 +39,22 @@ public class JobApiTest {
|
|||||||
System.out.println(execution.getJobFilesById("jhadmin", "42"));
|
System.out.println(execution.getJobFilesById("jhadmin", "42"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试分页查询作业列表
|
* 测试分页查询作业列表
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetJobPage() {
|
public void testGetJobPage() {
|
||||||
PageJobInfo jhadmin = execution.getJobPage("jhadmin", 1, 5, null, JobStatusEnum.DONE, null);
|
PageJobInfo pages = execution.getJobPage("jhadmin", 1, 5, null, JobStatusEnum.DONE, null);
|
||||||
System.out.println(jhadmin);
|
System.out.println(pages);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试查询历史作业列表
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testGetHistoryJobs() {
|
||||||
|
PageJobInfo pages = execution.getHistoryJobs("jhadmin", 1, 5, null, JobStatusEnum.DONE, null);
|
||||||
|
System.out.println(pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +65,6 @@ public class JobApiTest {
|
|||||||
System.out.println(execution.getJobDetail("jhadmin", "42"));
|
System.out.println(execution.getJobDetail("jhadmin", "42"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试使用作业名称检索
|
* 测试使用作业名称检索
|
||||||
*/
|
*/
|
||||||
@@ -74,7 +81,6 @@ public class JobApiTest {
|
|||||||
System.out.println(execution.getJobsByStatus("jhadmin", JobStatusEnum.DONE, 1, 10));
|
System.out.println(execution.getJobsByStatus("jhadmin", JobStatusEnum.DONE, 1, 10));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试使用作业拆id列表查询作业
|
* 测试使用作业拆id列表查询作业
|
||||||
*/
|
*/
|
||||||
@@ -83,7 +89,6 @@ public class JobApiTest {
|
|||||||
System.out.println(execution.getJobsByIds("jhadmin", Arrays.asList("42", "41")));
|
System.out.println(execution.getJobsByIds("jhadmin", Arrays.asList("42", "41")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试查询作业历史
|
* 测试查询作业历史
|
||||||
*/
|
*/
|
||||||
@@ -93,7 +98,6 @@ public class JobApiTest {
|
|||||||
System.out.println(result);
|
System.out.println(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试通过多个子哦也好查询作业历史
|
* 测试通过多个子哦也好查询作业历史
|
||||||
*/
|
*/
|
||||||
@@ -112,7 +116,6 @@ public class JobApiTest {
|
|||||||
System.out.println("peek = " + peek);
|
System.out.println("peek = " + peek);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 测试会话连接(目前没有测试条件)
|
* 测试会话连接(目前没有测试条件)
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -13,7 +13,8 @@ import org.junit.Test;
|
|||||||
*/
|
*/
|
||||||
public class DepartmentApiTest {
|
public class DepartmentApiTest {
|
||||||
|
|
||||||
private static final JHDepartmentApiExecution execution = (JHDepartmentApiExecution) JHClientConfig.jhApiClientMap.get(JHDepartmentApiExecution.class);
|
private static final JHDepartmentApiExecution execution = JHClientConfig.API_EXECUTRON_MANAGE
|
||||||
|
.getApiExecution(JHDepartmentApiExecution.class);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ import org.junit.Test;
|
|||||||
*/
|
*/
|
||||||
public class UserApiTest {
|
public class UserApiTest {
|
||||||
|
|
||||||
private static final JHUserApiExecution execution = (JHUserApiExecution) JHClientConfig.jhApiClientMap.get(JHUserApiExecution.class);
|
private static final JHUserApiExecution execution = JHClientConfig.API_EXECUTRON_MANAGE
|
||||||
|
.getApiExecution(JHUserApiExecution.class);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>cim.jhinno</groupId>
|
<groupId>cim.jhinno</groupId>
|
||||||
<artifactId>jhinno-openapi-sdk-spring-boot-example</artifactId>
|
<artifactId>jhinno-openapi-sdk-spring-boot-example</artifactId>
|
||||||
<version>2.0.3</version>
|
<version>2.0.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<name>Jhinno OpenAPI SDK for Java SpringBoot Example</name>
|
<name>Jhinno OpenAPI SDK for Java SpringBoot Example</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>
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
<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>2.0.3</version>
|
<version>2.0.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,17 +1,27 @@
|
|||||||
package com.jhinno.sdk.openapi.example.api.extend;
|
package com.jhinno.sdk.openapi.example.api.extend;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
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.api.ResponseResult;
|
||||||
import com.jhinno.sdk.openapi.client.JHApiClient;
|
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class JHFileApiExtendExecution extends JHApiExecution {
|
@Component
|
||||||
|
public class JHFileApiExtendExecution implements JHApiExecution {
|
||||||
|
|
||||||
public static String GET_FILE_ENV_PATH = "/ws/api/files/path/{env}";
|
private JHRequestExecution execution;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init(JHRequestExecution execution) {
|
||||||
|
this.execution = execution;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String GET_FILE_ENV_PATH = "/appform/ws/api/files/path/{env}";
|
||||||
|
|
||||||
public FilePath getFileEnvPath(String username, FileEnvType env, FileSystemType type) {
|
public FilePath getFileEnvPath(String username, FileEnvType env, FileSystemType type) {
|
||||||
Map<String, Object> params = new HashMap<>(1);
|
Map<String, Object> params = new HashMap<>(1);
|
||||||
@@ -19,11 +29,12 @@ public class JHFileApiExtendExecution extends JHApiExecution {
|
|||||||
params.put("type", type.getType());
|
params.put("type", type.getType());
|
||||||
}
|
}
|
||||||
String url = JHApiClient.getUrl(GET_FILE_ENV_PATH.replace("{env}", env.getEnv()), params);
|
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) {
|
public FilePath getFileHomeEnvPath(String username, FileSystemType type) {
|
||||||
return getFileEnvPath(username, FileEnvType.HOME_ENV, 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:
|
jhinno:
|
||||||
openapi:
|
openapi:
|
||||||
server-url: https://172.17.0.5/appform
|
server-url: https://192.168.0.22
|
||||||
auth-type: access_secret_mode
|
auth-type: token_mode
|
||||||
access-key: 3f03747f147942bd8debd81b6c9c6a80
|
access-key: 3f03747f147942bd8debd81b6c9c6a80
|
||||||
access-key-secret: e0681859b91c499eb1d2c8e09cea3242
|
access-key-secret: e0681859b91c499eb1d2c8e09cea3242
|
||||||
@@ -5,6 +5,7 @@ import com.jhinno.sdk.openapi.example.api.extend.JHFileApiExtendExecution;
|
|||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import com.jhinno.sdk.openapi.api.app.JHAppApiExecution;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class JHFileApiExtendTest {
|
public class JHFileApiExtendTest {
|
||||||
@@ -12,8 +13,17 @@ public class JHFileApiExtendTest {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private JHFileApiExtendExecution jhFileApiExtendExecution;
|
private JHFileApiExtendExecution jhFileApiExtendExecution;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JHAppApiExecution jhAppApiExecution;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void testGetFileHomeEnvPath() {
|
void testGetFileHomeEnvPath() {
|
||||||
System.out.println(jhFileApiExtendExecution.getFileHomeEnvPath("jhadmin", FileSystemType.SYSTEM_TYPE_LINUX));
|
System.out.println(jhFileApiExtendExecution.getFileHomeEnvPath("jhadmin", FileSystemType.SYSTEM_TYPE_LINUX));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testStartApp() {
|
||||||
|
jhAppApiExecution.desktopStart("jhadmin","linux_desktop");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.3</version>
|
<version>2.0.5</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,14 +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.3</version>
|
<version>2.0.5</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.3</version>
|
<version>2.0.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -45,52 +45,4 @@
|
|||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<compileSourceRoots>src/main/java</compileSourceRoots>
|
|
||||||
<source>${maven.compiler.source}</source>
|
|
||||||
<target>${maven.compiler.target}</target>
|
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-jar-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok-maven-plugin</artifactId>
|
|
||||||
<version>1.18.0.0</version>
|
|
||||||
<configuration>
|
|
||||||
<encoding>UTF-8</encoding>
|
|
||||||
<sourceDirectory>src/main/java</sourceDirectory>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-javadoc-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<sourcepath>target/generated-sources/delombok</sourcepath>
|
|
||||||
<encoding>${project.build.sourceEncoding}</encoding>
|
|
||||||
<docencoding>${project.build.sourceEncoding}</docencoding>
|
|
||||||
<charset>${project.build.sourceEncoding}</charset>
|
|
||||||
<doclint>none</doclint>
|
|
||||||
<tags>
|
|
||||||
<tag>
|
|
||||||
<name>date</name>
|
|
||||||
<placement>X</placement>
|
|
||||||
</tag>
|
|
||||||
</tags>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.jhinno.sdk.openapi.autoconfigure;
|
package com.jhinno.sdk.openapi.autoconfigure;
|
||||||
|
|
||||||
|
import com.jhinno.sdk.openapi.api.JHRequestExecution;
|
||||||
import com.jhinno.sdk.openapi.client.JHApiClient;
|
import com.jhinno.sdk.openapi.client.JHApiClient;
|
||||||
import com.jhinno.sdk.openapi.client.JHApiHttpClientImpl;
|
import com.jhinno.sdk.openapi.client.JHApiHttpClientImpl;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
@@ -17,7 +18,6 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
@EnableConfigurationProperties(JHOpenapiProperties.class)
|
@EnableConfigurationProperties(JHOpenapiProperties.class)
|
||||||
public class JHOpenapiClientAutoConfigure {
|
public class JHOpenapiClientAutoConfigure {
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnMissingBean
|
@ConditionalOnMissingBean
|
||||||
public JHApiClient jhApiClient(JHOpenapiProperties properties) {
|
public JHApiClient jhApiClient(JHOpenapiProperties properties) {
|
||||||
@@ -34,4 +34,17 @@ public class JHOpenapiClientAutoConfigure {
|
|||||||
return jhApiClient;
|
return jhApiClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public JHRequestExecution requestExecution(JHApiClient jhApiClient, JHOpenapiProperties properties) {
|
||||||
|
JHRequestExecution requestExecution = new JHRequestExecution(jhApiClient);
|
||||||
|
requestExecution.setForceGetToken(properties.isForceGetToken());
|
||||||
|
requestExecution.setAuthType(properties.getAuthType());
|
||||||
|
requestExecution.setAccessKey(properties.getAccessKey());
|
||||||
|
requestExecution.setAccessKeySecret(properties.getAccessKeySecret());
|
||||||
|
requestExecution.setTokenTimeout(properties.getTokenTimeout());
|
||||||
|
requestExecution.setTokenResidueTime(properties.getTokenResidueTime());
|
||||||
|
requestExecution.setUsedServerTime(properties.isUsedServerTime());
|
||||||
|
return requestExecution;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
package com.jhinno.sdk.openapi.autoconfigure;
|
package com.jhinno.sdk.openapi.autoconfigure;
|
||||||
|
|
||||||
|
import com.jhinno.sdk.openapi.JHApiExecution;
|
||||||
|
import com.jhinno.sdk.openapi.api.JHRequestExecution;
|
||||||
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.utils.JHOpenApiConfig;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@@ -19,37 +22,45 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class JHOpenapiExecutionAutoconfigure {
|
public class JHOpenapiExecutionAutoconfigure implements BeanPostProcessor {
|
||||||
|
|
||||||
|
private final JHRequestExecution jhRequestExecution;
|
||||||
|
|
||||||
@Bean
|
public Object postProcessBeforeInitialization(Object bean, String beanName) {
|
||||||
public JHAppApiExecution appApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
if (bean instanceof JHApiExecution) {
|
||||||
return jhOpenApiConfig.configJHApiExecution(new JHAppApiExecution());
|
((JHApiExecution) bean).init(jhRequestExecution);
|
||||||
|
}
|
||||||
|
return bean;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JHDataApiExecution dataApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
public JHAppApiExecution appApiExecution() {
|
||||||
return jhOpenApiConfig.configJHApiExecution(new JHDataApiExecution());
|
return new JHAppApiExecution();
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public JHFileApiExecution fileApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
|
||||||
return jhOpenApiConfig.configJHApiExecution(new JHFileApiExecution());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JHJobApiExecution jobApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
public JHDataApiExecution dataApiExecution() {
|
||||||
return jhOpenApiConfig.configJHApiExecution(new JHJobApiExecution());
|
return new JHDataApiExecution();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JHDepartmentApiExecution departmentApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
public JHFileApiExecution fileApiExecution() {
|
||||||
return jhOpenApiConfig.configJHApiExecution(new JHDepartmentApiExecution());
|
return new JHFileApiExecution();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public JHUserApiExecution userApiExecution(JHOpenApiConfig jhOpenApiConfig) {
|
public JHJobApiExecution jobApiExecution() {
|
||||||
return jhOpenApiConfig.configJHApiExecution(new JHUserApiExecution());
|
return new JHJobApiExecution();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public JHDepartmentApiExecution departmentApiExecution() {
|
||||||
|
return new JHDepartmentApiExecution();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public JHUserApiExecution userApiExecution() {
|
||||||
|
return new JHUserApiExecution();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
|
|||||||
public class JHOpenapiProperties {
|
public class JHOpenapiProperties {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接口服务的BaseURL, 列如:https://192.168.87.20/appform
|
* 接口服务的BaseURL, 列如:https://192.168.87.20
|
||||||
*/
|
*/
|
||||||
private String serverUrl;
|
private String serverUrl;
|
||||||
|
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
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,4 +1,3 @@
|
|||||||
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,3 +1,2 @@
|
|||||||
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
|
||||||
66
pom.xml
66
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<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.3</version>
|
<version>2.0.5</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>
|
||||||
@@ -33,19 +33,40 @@
|
|||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.sonatype.central</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>central-publishing-maven-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
<version>0.5.0</version>
|
<version>3.1.0</version>
|
||||||
<extensions>true</extensions>
|
<executions>
|
||||||
<configuration>
|
<execution>
|
||||||
<publishingServerId>central</publishingServerId>
|
<phase>package</phase>
|
||||||
<autoPublish>true</autoPublish>
|
<goals>
|
||||||
</configuration>
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.2.0</version>
|
||||||
|
<configuration>
|
||||||
|
<show>private</show>
|
||||||
|
<nohelp>true</nohelp>
|
||||||
|
<charset>UTF-8</charset>
|
||||||
|
<encoding>UTF-8</encoding>
|
||||||
|
<docencoding>UTF-8</docencoding>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>compile</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
@@ -57,28 +78,25 @@
|
|||||||
<goals>
|
<goals>
|
||||||
<goal>sign</goal>
|
<goal>sign</goal>
|
||||||
</goals>
|
</goals>
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<gpgArguments>
|
<gpgArguments>
|
||||||
<arg>--pinentry-mode</arg>
|
<arg>--pinentry-mode</arg>
|
||||||
<arg>loopback</arg>
|
<arg>loopback</arg>
|
||||||
</gpgArguments>
|
</gpgArguments>
|
||||||
</configuration>
|
</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>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.sonatype.central</groupId>
|
||||||
|
<artifactId>central-publishing-maven-plugin</artifactId>
|
||||||
|
<version>0.7.0</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<publishingServerId>central</publishingServerId>
|
||||||
|
<autoPublish>true</autoPublish>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user