REM:
1. 增加了登录接口异常调试信息,定位出错设备
2. 增加了接口超时时间,由1秒改到3秒
3. 版本更新到 2.0.8.5
This commit is contained in:
HuangXin 2021-10-22 17:56:15 +08:00
parent f7c74a6511
commit eed53ba388
3 changed files with 26 additions and 25 deletions

View File

@ -17,7 +17,7 @@
</parent>
<groupId>com.dispose</groupId>
<artifactId>dispose_platform</artifactId>
<version>2.0.8.4</version>
<version>2.0.8.5</version>
<name>dispose_platform</name>
<description>Dispose Platform</description>
<dependencies>

View File

@ -170,12 +170,12 @@ public class PengXinAbilityImpl implements DisposeAbility {
}
reqItems.add(PengXinStartTaskItem.builder()
.type(getPengXinTaskType(capType))
.disposeObject(disposeObject)
.objectType(getPengXinObjectType(objectType))
.disposeTime(duration)
.taskReqId(String.valueOf(taskReqId++))
.build());
.type(getPengXinTaskType(capType))
.disposeObject(disposeObject)
.objectType(getPengXinObjectType(objectType))
.disposeTime(duration)
.taskReqId(String.valueOf(taskReqId++))
.build());
ProtocolRespDTO<PengXinStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
@ -243,7 +243,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
}
ProtocolRespDTO<PengXinStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
new String[]{taskId});
new String[]{taskId});
// 判断是否token过期
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
@ -283,18 +283,18 @@ public class PengXinAbilityImpl implements DisposeAbility {
@Override
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
return new MulReturnType<>(ErrorCode.ERR_OK,
DeviceFirewareInfo.builder()
.vendor("PengXin")
.model("Unknown")
.firmware("Unknown")
.os("Linux Server")
.kernel("Linux")
.arch("x86_64")
.version("Unknown")
.memory(-1)
.freeMemory(-1)
.cpuUsed(-1)
.build());
DeviceFirewareInfo.builder()
.vendor("PengXin")
.model("Unknown")
.firmware("Unknown")
.os("Linux Server")
.kernel("Linux")
.arch("x86_64")
.version("Unknown")
.memory(-1)
.freeMemory(-1)
.cpuUsed(-1)
.build());
}
/**
@ -463,7 +463,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
String url = urlRootPath + "dispose_device/task/get";
ProtocolRespDTO<PengXinTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token,
new String[]{taskId});
new String[]{taskId});
// 判断是否token过期
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
@ -478,7 +478,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
}
return new MulReturnType<>(ErrorCode.ERR_OK,
rspInfo.getMsgContent().getItems().get(0).getTaskStatus());
rspInfo.getMsgContent().getItems().get(0).getTaskStatus());
} else {
return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, -1L);
}
@ -491,14 +491,15 @@ public class PengXinAbilityImpl implements DisposeAbility {
* Upgrade token.
*/
private void upgradeToken() {
String url = urlRootPath + "dispose_device/auth/login";
try {
String url = urlRootPath + "dispose_device/auth/login";
ProtocolRespDTO<PengXinLoginRsp> logInfo = restfulInterface.login(url, username, password);
if (logInfo != null && logInfo.getMsgContent().getStatus() == ErrorCode.ERR_OK.getCode()) {
this.token = logInfo.getMsgContent().getToken();
}
} catch (Exception ignored) {
} catch (Exception ex) {
log.error("Exception: {}, {}", url, ex.getMessage());
}
}

View File

@ -36,7 +36,7 @@ public class RestfulInterface {
/**
* The constant timeOutValue.
*/
private static int timeOutValue = 1000;
private static int timeOutValue = 3000;
/**
* Instantiates a new Restful interface.