REM:
1. 修复一处代码检测警告
This commit is contained in:
HuangXin 2021-10-09 10:47:48 +08:00
parent cbb1d29a63
commit 31265036f0
1 changed files with 29 additions and 26 deletions

View File

@ -172,12 +172,12 @@ public class PengXinAbilityImpl implements DisposeAbility {
} }
reqItems.add(PengXinStartTaskItem.builder() reqItems.add(PengXinStartTaskItem.builder()
.type(getPengXinTaskType(capType)) .type(getPengXinTaskType(capType))
.disposeObject(disposeObject) .disposeObject(disposeObject)
.objectType(getPengXinObjectType(objectType)) .objectType(getPengXinObjectType(objectType))
.disposeTime(duration) .disposeTime(duration)
.taskReqId(String.valueOf(taskReqId++)) .taskReqId(String.valueOf(taskReqId++))
.build()); .build());
ProtocolRespDTO<PengXinStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems); ProtocolRespDTO<PengXinStartTaskRsp> rspInfo = restfulInterface.startDisposeTask(url, token, reqItems);
@ -245,7 +245,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
} }
ProtocolRespDTO<PengXinStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token, ProtocolRespDTO<PengXinStopTaskRsp> rspInfo = restfulInterface.stopDisposeTask(url, token,
new String[]{taskId}); new String[]{taskId});
// 判断是否token过期 // 判断是否token过期
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) { if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
@ -285,18 +285,18 @@ public class PengXinAbilityImpl implements DisposeAbility {
@Override @Override
public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() { public MulReturnType<ErrorCode, DeviceFirewareInfo> getAbilityDeviceFireware() {
return new MulReturnType<>(ErrorCode.ERR_OK, return new MulReturnType<>(ErrorCode.ERR_OK,
DeviceFirewareInfo.builder() DeviceFirewareInfo.builder()
.vendor("PengXin") .vendor("PengXin")
.model("Unknown") .model("Unknown")
.firmware("Unknown") .firmware("Unknown")
.os("Linux Server") .os("Linux Server")
.kernel("Linux") .kernel("Linux")
.arch("x86_64") .arch("x86_64")
.version("Unknown") .version("Unknown")
.memory(-1) .memory(-1)
.freeMemory(-1) .freeMemory(-1)
.cpuUsed(-1) .cpuUsed(-1)
.build()); .build());
} }
/** /**
@ -459,7 +459,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
String url = urlRootPath + "dispose_device/task/get"; String url = urlRootPath + "dispose_device/task/get";
ProtocolRespDTO<PengXinTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token, ProtocolRespDTO<PengXinTaskStatusRsp> rspInfo = restfulInterface.getDeviceTaskStatus(url, token,
new String[]{taskId}); new String[]{taskId});
// 判断是否token过期 // 判断是否token过期
if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) { if (rspInfo != null && reLogin(rspInfo, rspInfo.getMsgContent().getItems().get(0).getStatus())) {
@ -474,7 +474,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
} }
return new MulReturnType<>(ErrorCode.ERR_OK, return new MulReturnType<>(ErrorCode.ERR_OK,
rspInfo.getMsgContent().getItems().get(0).getTaskStatus()); rspInfo.getMsgContent().getItems().get(0).getTaskStatus());
} else { } else {
return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, -1L); return new MulReturnType<>(ErrorCode.ERR_CALLDEVICE, -1L);
} }
@ -510,12 +510,15 @@ public class PengXinAbilityImpl implements DisposeAbility {
return true; return true;
} }
if (rspInfo.getCode() == HttpServletResponse.SC_OK && if (rspInfo.getCode() == HttpServletResponse.SC_OK) {
(status == ErrorCode.ERR_LOGOUT.getCode() || status == ErrorCode.ERR_TOKENTIMEOUT.getCode() || if (status == ErrorCode.ERR_LOGOUT.getCode() ||
status == ErrorCode.ERR_TOKENNOTFOUND.getCode())) { status == ErrorCode.ERR_TOKENTIMEOUT.getCode() ||
upgradeToken(); status == ErrorCode.ERR_TOKENNOTFOUND.getCode()) {
return true; upgradeToken();
return true;
}
} }
return false; return false;
} catch (Exception ignored) { } catch (Exception ignored) {
return false; return false;