refactor(device): 重构 ArmCloudApiClient 类

- 格式化代码,提高可读性
- 优化 JSON 构建和解析逻辑
- 统一异常处理方式
- 简化部分代码结构,提高维护性
This commit is contained in:
yjj38 2025-07-11 10:59:48 +08:00
parent 237f07f968
commit c3467add0e
2 changed files with 202 additions and 196 deletions

View File

@ -302,15 +302,21 @@ public class ArmCloudApiClient {
json.put("page", page);
json.put("rows", rows);
if (armServerCode != null) json.put("armServerCode", armServerCode);
if (deviceCode != null) json.put("deviceCode", deviceCode);
if (armServerCode != null) {
json.put("armServerCode", armServerCode);
}
if (deviceCode != null) {
json.put("deviceCode", deviceCode);
}
if (padCodes != null && padCodes.length > 0) {
json.put("padCodes", new JSONArray(Arrays.asList(padCodes)));
}
if (groupIds != null && groupIds.length > 0) {
json.put("groupIds", new JSONArray(Arrays.asList(groupIds)));
}
if (idc != null) json.put("idc", idc);
if (idc != null) {
json.put("idc", idc);
}
} catch (JSONException e) {
LogFileUtil.logAndWrite(Log.ERROR, "ArmCloudApiClient", "getInstanceListInfo: JSON 构建失败", e);