🎨依赖调整,v1.0.1开启
This commit is contained in:
parent
73b3673758
commit
e4490407f7
25
pom.xml
25
pom.xml
|
@ -6,15 +6,15 @@
|
||||||
|
|
||||||
<groupId>net.javase.iot</groupId>
|
<groupId>net.javase.iot</groupId>
|
||||||
<artifactId>onenet-api</artifactId>
|
<artifactId>onenet-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.1</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<java.version>1.8</java.version>
|
<java.version>1.8</java.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<junit.version>4.13.1</junit.version>
|
<junit.version>4.13.1</junit.version>
|
||||||
<lombok.version>1.18.26</lombok.version>
|
<lombok.version>1.18.32</lombok.version>
|
||||||
<hutool.version>5.8.20</hutool.version>
|
<hutool.version>5.8.28</hutool.version>
|
||||||
<fastjson.version>2.0.23</fastjson.version>
|
<fastjson.version>2.0.23</fastjson.version>
|
||||||
<slf4j.version>1.7.30</slf4j.version>
|
<slf4j.version>1.7.30</slf4j.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>${lombok.version}</version>
|
<version>${lombok.version}</version>
|
||||||
<scope>compile</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- huTool 工具包 -->
|
<!-- huTool 工具包 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -60,6 +60,23 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>gitea</id>
|
||||||
|
<url>https://gitea.52it.vip/api/packages/Frank/maven</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
<distributionManagement>
|
||||||
|
<repository>
|
||||||
|
<id>gitea</id>
|
||||||
|
<url>https://gitea.52it.vip/api/packages/Frank/maven</url>
|
||||||
|
</repository>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>gitea</id>
|
||||||
|
<url>https://gitea.52it.vip/api/packages/Frank/maven</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<finalName>onenet-api</finalName>
|
<finalName>onenet-api</finalName>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|
|
@ -155,11 +155,22 @@ public class DeviceApi {
|
||||||
* @return {@link ApiResponse}
|
* @return {@link ApiResponse}
|
||||||
*/
|
*/
|
||||||
public static ApiResponse deviceOperationLog(Config config, DeviceStatusHistoryModel model) {
|
public static ApiResponse deviceOperationLog(Config config, DeviceStatusHistoryModel model) {
|
||||||
|
return deviceOperationLog(config, model.toMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备操作记录查询
|
||||||
|
*
|
||||||
|
* @param config {@link Config}
|
||||||
|
* @param query query参数
|
||||||
|
* @return {@link ApiResponse}
|
||||||
|
*/
|
||||||
|
public static ApiResponse deviceOperationLog(Config config, Map<String, Object> query) {
|
||||||
return ApiRequest.builder()
|
return ApiRequest.builder()
|
||||||
.api(ApiEnum.DEVICE_OPERATION_LOG.api())
|
.api(ApiEnum.DEVICE_OPERATION_LOG.api())
|
||||||
.method(Method.GET)
|
.method(Method.GET)
|
||||||
.signMethod(SignMethod.MD5)
|
.signMethod(SignMethod.MD5)
|
||||||
.query(model.toMap())
|
.query(query)
|
||||||
.userid(config.getUserid())
|
.userid(config.getUserid())
|
||||||
.build()
|
.build()
|
||||||
.send(config.getAccessKey());
|
.send(config.getAccessKey());
|
||||||
|
|
|
@ -6,6 +6,7 @@ package net.javase.onenet.exception;
|
||||||
* @author Frank
|
* @author Frank
|
||||||
*/
|
*/
|
||||||
public class ApiException extends RuntimeException {
|
public class ApiException extends RuntimeException {
|
||||||
|
private static final long serialVersionUID = 9095234958719589705L;
|
||||||
|
|
||||||
public ApiException() {
|
public ApiException() {
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ import lombok.Setter;
|
||||||
import net.javase.onenet.annotation.ApiParam;
|
import net.javase.onenet.annotation.ApiParam;
|
||||||
import net.javase.onenet.model.base.BaseModel;
|
import net.javase.onenet.model.base.BaseModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DeviceMoveModel
|
* DeviceMoveModel
|
||||||
*
|
*
|
||||||
|
@ -33,5 +35,5 @@ public class DeviceMoveModel extends BaseModel {
|
||||||
* 如["name_1", "name_2"],每个元素名称最长限制64位,数组元素不超过1000个
|
* 如["name_1", "name_2"],每个元素名称最长限制64位,数组元素不超过1000个
|
||||||
*/
|
*/
|
||||||
@ApiParam(name = "device_name")
|
@ApiParam(name = "device_name")
|
||||||
private String[] deviceName;
|
private List<String> deviceName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class Kv<K, V> {
|
public class Kv<K, V> {
|
||||||
|
|
||||||
private Map<K, V> map;
|
private final Map<K, V> map;
|
||||||
|
|
||||||
public Kv() {
|
public Kv() {
|
||||||
this.map = new HashMap<>();
|
this.map = new HashMap<>();
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class RequestUtil {
|
||||||
public static <T> T doRequest(ApiRequest req, String accessKey, Class<T> clazz) {
|
public static <T> T doRequest(ApiRequest req, String accessKey, Class<T> clazz) {
|
||||||
Method method = req.getMethod();
|
Method method = req.getMethod();
|
||||||
String url = req.getDomain().getDomain() + req.url();
|
String url = req.getDomain().getDomain() + req.url();
|
||||||
if (req.getQuery() != null && req.getQuery().size() > 0) {
|
if (req.getQuery() != null && !req.getQuery().isEmpty()) {
|
||||||
String query = URLUtil.buildQuery(req.getQuery(), StandardCharsets.UTF_8);
|
String query = URLUtil.buildQuery(req.getQuery(), StandardCharsets.UTF_8);
|
||||||
url += "?" + query;
|
url += "?" + query;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ public class RequestUtil {
|
||||||
if (req.getContentType() != null) {
|
if (req.getContentType() != null) {
|
||||||
request.contentType(req.getContentType().toString());
|
request.contentType(req.getContentType().toString());
|
||||||
}
|
}
|
||||||
if (req.getBody() != null && req.getBody().size() > 0) {
|
if (req.getBody() != null && !req.getBody().isEmpty()) {
|
||||||
request.body(JSONObject.toJSONString(req.getBody()));
|
request.body(JSONObject.toJSONString(req.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ public class RequestUtil {
|
||||||
public static void download(ApiRequest req, String accessKey, File target) {
|
public static void download(ApiRequest req, String accessKey, File target) {
|
||||||
Method method = req.getMethod();
|
Method method = req.getMethod();
|
||||||
String url = req.getDomain().getDomain() + req.url();
|
String url = req.getDomain().getDomain() + req.url();
|
||||||
if (req.getQuery() != null && req.getQuery().size() > 0) {
|
if (req.getQuery() != null && !req.getQuery().isEmpty()) {
|
||||||
String query = URLUtil.buildQuery(req.getQuery(), StandardCharsets.UTF_8);
|
String query = URLUtil.buildQuery(req.getQuery(), StandardCharsets.UTF_8);
|
||||||
url += "?" + query;
|
url += "?" + query;
|
||||||
}
|
}
|
||||||
|
@ -98,7 +98,7 @@ public class RequestUtil {
|
||||||
if (req.getContentType() != null) {
|
if (req.getContentType() != null) {
|
||||||
request.contentType(req.getContentType().toString());
|
request.contentType(req.getContentType().toString());
|
||||||
}
|
}
|
||||||
if (req.getBody() != null && req.getBody().size() > 0) {
|
if (req.getBody() != null && !req.getBody().isEmpty()) {
|
||||||
request.body(JSONObject.toJSONString(req.getBody()));
|
request.body(JSONObject.toJSONString(req.getBody()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user