diff --git a/qodana.yaml b/qodana.yaml new file mode 100644 index 0000000..5224aea --- /dev/null +++ b/qodana.yaml @@ -0,0 +1,31 @@ +#-------------------------------------------------------------------------------# +# Qodana analysis is configured by qodana.yaml file # +# https://www.jetbrains.com/help/qodana/qodana-yaml.html # +#-------------------------------------------------------------------------------# +version: "1.0" + +#Specify inspection profile for code analysis +profile: + name: qodana.starter + +#Enable inspections +#include: +# - name: + +#Disable inspections +#exclude: +# - name: +# paths: +# - + +projectJDK: "17" #(Applied in CI/CD pipeline) + +#Execute shell command before Qodana execution (Applied in CI/CD pipeline) +#bootstrap: sh ./prepare-qodana.sh + +#Install IDE plugins before Qodana execution (Applied in CI/CD pipeline) +#plugins: +# - id: #(plugin id can be found at https://plugins.jetbrains.com) + +#Specify Qodana linter for analysis (Applied in CI/CD pipeline) +linter: jetbrains/qodana-jvm:latest diff --git a/src/main/java/com/mzaxd/bps/config/FastJsonRedisSerializer.java b/src/main/java/com/mzaxd/bps/config/FastJsonRedisSerializer.java index 16fc36f..8433d3f 100644 --- a/src/main/java/com/mzaxd/bps/config/FastJsonRedisSerializer.java +++ b/src/main/java/com/mzaxd/bps/config/FastJsonRedisSerializer.java @@ -41,7 +41,7 @@ public class FastJsonRedisSerializer implements RedisSerializer { @Override public T deserialize(byte[] bytes) throws SerializationException { - if (bytes == null || bytes.length <= 0) { + if (bytes == null || bytes.length == 0) { return null; } String str = new String(bytes, DEFAULT_CHARSET); diff --git a/src/main/java/com/mzaxd/bps/constant/OsConstant.java b/src/main/java/com/mzaxd/bps/constant/OsConstant.java deleted file mode 100644 index 46bb90c..0000000 --- a/src/main/java/com/mzaxd/bps/constant/OsConstant.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.mzaxd.bps.constant; - -/** - * @author Mzaxd - * @since 2023-02-05 11:38 - */ -public class OsConstant { - - /** - * 操作系统为Linux - */ - public static final String LINUX = "linux"; -} diff --git a/src/main/java/com/mzaxd/bps/constant/RabbitMqConstant.java b/src/main/java/com/mzaxd/bps/constant/RabbitMqConstant.java deleted file mode 100644 index 48990b7..0000000 --- a/src/main/java/com/mzaxd/bps/constant/RabbitMqConstant.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.mzaxd.bps.constant; - -/** - * @author root - */ -public class RabbitMqConstant { - - /** - * RabbitMQ的队列主题名称 - */ - public static final String DYNAMIC_DATA_TOPIC = "DynamicDataTopic"; - - /** - * RabbitMQ的direct交换机名称 - */ - public static final String DYNAMIC_DATA_EXCHANGE = "DynamicDataExchange"; - - /** - * RabbitMQ的direct交换机和队列绑定的匹配键 DirectRouting - */ - public static final String DYNAMIC_DATA_ROUTING = "DynamicDataRouting"; -} diff --git a/src/main/java/com/mzaxd/bps/constant/RedisConstant.java b/src/main/java/com/mzaxd/bps/constant/RedisConstant.java index 5e13156..0e61ba6 100644 --- a/src/main/java/com/mzaxd/bps/constant/RedisConstant.java +++ b/src/main/java/com/mzaxd/bps/constant/RedisConstant.java @@ -8,36 +8,21 @@ public class RedisConstant { /** * Redis Key * - * @author mzaxd * @date 2/7/23 12:59 PM - * @param null - */ - public static final String DYNAMIC_DATA = "dynamicData:"; - - /** - * Redis Key - * - * @author mzaxd - * @date 2/7/23 12:59 PM - * @param null */ public static final String NOTIFY_CONTAINER_IDS = "notify:containerIds"; /** * Redis Key * - * @author mzaxd * @date 2/7/23 12:59 PM - * @param null */ public static final String NOTIFY_HOST_IDS = "notify:hostIds"; /** * Redis Key * - * @author mzaxd * @date 2/7/23 12:59 PM - * @param null */ public static final String NOTIFY_VM_IDS = "notify:vmIds"; } diff --git a/src/main/java/com/mzaxd/bps/constant/SystemConstant.java b/src/main/java/com/mzaxd/bps/constant/SystemConstant.java index 055459f..133fff5 100644 --- a/src/main/java/com/mzaxd/bps/constant/SystemConstant.java +++ b/src/main/java/com/mzaxd/bps/constant/SystemConstant.java @@ -5,61 +5,6 @@ package com.mzaxd.bps.constant; */ public class SystemConstant { - /** - * 宿主机id等于0表示没有宿主机,即物理机 - */ - public static final Integer PHYSICAL_MACHINE = 0; - - /** - * 主机在线 - */ - public static final Integer HOST_MACHINE_STATE_ONLINE = 0; - - /** - * 主机离线 - */ - public static final Integer HOST_MACHINE_STATE_OFFLINE = 1; - - /** - * 主机睡眠 - */ - public static final Integer HOST_MACHINE_STATE_SLEEP = 2; - - /** - * 主机状态未知 - */ - public static final Integer HOST_MACHINE_STATE_UNKNOWN = 3; - - /** - * 物理机 host_machine_id 是 0 - */ - public static final Long HOST_MACHINE_ID_HOST = 0L; - - /** - * 成功id - */ - public static final Integer SUCCESS_CODE = 200; - - /** - * 容器正在运行 - */ - public static final Integer CONTAINER_STATE_RUNNING = 0; - - /** - * 容器停止 - */ - public static final Integer CONTAINER_STATE_EXITED = 1; - - /** - * 容器暂停 - */ - public static final Integer CONTAINER_STATE_PAUSED = 2; - - /** - * 容器状态未知 - */ - public static final Integer CONTAINER_STATE_UNKNOWN = 3; - /** * 正常状态(非第一次使用) 通用常量 */ @@ -70,36 +15,6 @@ public class SystemConstant { */ public static final String LOG_USER = "用户"; - /** - * 提醒方式-不提醒 - */ - public static final Integer NOTIFY_NO = 0; - - /** - * 提醒方式-浏览器 - */ - public static final Integer NOTIFY_BROWSER = 1; - - /** - * 提醒方式-邮件 - */ - public static final Integer NOTIFY_EMAIL = 2; - - /** - * 提醒方式-浏览器和邮件 - */ - public static final Integer NOTIFY_BROWSER_EMAIL = 3; - - /** - * 通知类型 掉线 - */ - public static final Integer OFFLINE_NOTIFICATION = 0; - - /** - * 通知类型 统计 - */ - public static final Integer STATISTICS_NOTIFICATION = 1; - /** * 未处理的通知 */ @@ -110,36 +25,6 @@ public class SystemConstant { */ public static final Integer NOTIFICATION_AFFIRM = 1; - /** - * 前端页面通知提醒页面对应的tab - */ - public static final Integer FRONTEND_NOTIFICATION_NOT_AFFIRM = 0; - - /** - * 前端页面通知提醒页面对应的tab - */ - public static final Integer FRONTEND_NOTIFICATION_AFFIRM = 1; - - /** - * 前端页面通知提醒页面对应的tab - */ - public static final Integer FRONTEND_NOTIFICATION_ALL = 2; - - /** - * 前端页面通知提醒页面对应的tab - */ - public static final Integer FRONTEND_NOTIFICATION_TYPE_OFFLINE = 3; - - /** - * 前端页面通知提醒页面对应的tab - */ - public static final Integer FRONTEND_NOTIFICATION_TYPE_STATISTICS = 4; - - /** - * 通知实例类型 无 - */ - public static final Integer INSTANCETYPE_NONE = 0; - /** * 通知实例类型 物理机 */ diff --git a/src/main/java/com/mzaxd/bps/constant/UrlConstant.java b/src/main/java/com/mzaxd/bps/constant/UrlConstant.java index 315acd3..57bc1c9 100644 --- a/src/main/java/com/mzaxd/bps/constant/UrlConstant.java +++ b/src/main/java/com/mzaxd/bps/constant/UrlConstant.java @@ -5,41 +5,6 @@ package com.mzaxd.bps.constant; */ public class UrlConstant { - /** - * isTrueUrl判断地址是否有效的链接 - */ - public static final String DETECTOR_IS_TRUE_URL = "/isTrueUrl"; - - /** - * 获取远程主机信息链接 - */ - public static final String DETECTOR_GET_INFO = "/getInfo"; - - /** - * 获取远程主机信息链接 - */ - public static final String DETECTOR_GET_DISK_INFO = "/getDiskInfo"; - - /** - * 获取远程主机信息链接 - */ - public static final String DETECTOR_GET_NETWORK_IF_INFO = "/getNetworkIfInfo"; - - /** - * 获取探测器uuid - */ - public static final String DETECTOR_GET_DETECTOR_ID = "/getDetectorID"; - - /** - * 通知探测器开始发送动态数据 - */ - public static final String DETECTOR_START_SEND_DYNAMIC_DATA = "/startSendDynamicDataFromMq"; - - /** - * 通知探测器停止发送动态数据 - */ - public static final String DETECTOR_STOP_SEND_DYNAMIC_DATA = "/stopSendDynamicDataFromMq"; - /** * 协议 */ diff --git a/src/main/java/com/mzaxd/bps/controller/OtherController.java b/src/main/java/com/mzaxd/bps/controller/OtherController.java index d06c398..70ce77f 100644 --- a/src/main/java/com/mzaxd/bps/controller/OtherController.java +++ b/src/main/java/com/mzaxd/bps/controller/OtherController.java @@ -10,7 +10,6 @@ import org.springframework.web.bind.annotation.RestController; import java.util.ArrayList; import java.util.List; -import java.util.stream.Collectors; /** * @author ThinkBook @@ -53,7 +52,7 @@ public class OtherController { if (searchItems != null) { List filteredItems = searchItems.stream() .filter(item -> item.getTitle().contains(str)) - .collect(Collectors.toList()); + .toList(); if (!filteredItems.isEmpty()) { result.addAll(filteredItems); } else {