diff --git a/README.md b/README.md index e69de29b..dba4e63b 100644 Binary files a/README.md and b/README.md differ diff --git a/alops-common/src/main/java/com/alops/common/core/domain/ListResultVO.java b/alops-common/src/main/java/com/alops/common/core/domain/ListResultVO.java new file mode 100644 index 00000000..7bae1e58 --- /dev/null +++ b/alops-common/src/main/java/com/alops/common/core/domain/ListResultVO.java @@ -0,0 +1,28 @@ +package com.alops.common.core.domain; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.io.Serializable; +import java.util.List; + +//分页列表数据 +@Data +@EqualsAndHashCode(callSuper = false) +public class ListResultVO implements Serializable { + + private static final long serialVersionUID = -8896090499552990782L; + + //列表数据 + private List list; + + //记录总数 + private Long total; + + //每页记录数 + private Long pageSize; + + //当前页码 + private Long current; + +} diff --git a/alops-common/src/main/java/com/alops/common/core/domain/ResultVO.java b/alops-common/src/main/java/com/alops/common/core/domain/ResultVO.java new file mode 100644 index 00000000..05ff03a4 --- /dev/null +++ b/alops-common/src/main/java/com/alops/common/core/domain/ResultVO.java @@ -0,0 +1,24 @@ +package com.alops.common.core.domain; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; + +/** + * 统一的接口返回数据格式 + */ +@Data +@JsonIgnoreProperties(value = { "hibernateLazyInitializer"}) +public class ResultVO { + + // 错误码 + private Integer code; + + // 错误信息 + private String msg; + + // 数据 + @JsonInclude(JsonInclude.Include.NON_EMPTY) + private T data; + +} diff --git a/alops-common/src/main/java/com/alops/common/core/domain/entity/CodeMsg.java b/alops-common/src/main/java/com/alops/common/core/domain/entity/CodeMsg.java new file mode 100644 index 00000000..13a2ff82 --- /dev/null +++ b/alops-common/src/main/java/com/alops/common/core/domain/entity/CodeMsg.java @@ -0,0 +1,190 @@ +package com.alops.common.core.domain.entity; + +import lombok.Data; +import org.springframework.validation.BindingResult; +import org.springframework.validation.ObjectError; + +import java.util.List; + +/** + * 状态码与错误消息类 + * + * 将所有的状态码和错误信息集中到该类当中,便于查阅 + * 借助GlobalException将错误的信息抛给全局异常处理器,处理器将错误信息转换为Response返回给前端 + */ +@Data +public class CodeMsg { + + public final static CodeMsg SERVER_ERROR = new CodeMsg(500, "服务器错误"); + public final static CodeMsg BIND_ERROR = new CodeMsg(500, "参数错误:%s"); + + /** + * 用户权限 100XX + */ + public final static CodeMsg USER_NEED_LOGIN = new CodeMsg(10000, "尚未登录,请登录。"); + public final static CodeMsg USERNAME_REQUIRE_NOT_NULL = new CodeMsg(10001, "用户名不能为空"); + public final static CodeMsg PASSWORD_REQUIRE_NOT_NULL = new CodeMsg(10002, "用户密码不能为空"); + public final static CodeMsg USER_NOT_FOUND = new CodeMsg(10003, "该用户不存在。"); + public final static CodeMsg USERNAME_OR_PASSWORD_ERROR = new CodeMsg(10004, "用户名或密码错误"); + public final static CodeMsg USER_IS_LOCKED = new CodeMsg(10005, "当前IP已被锁定,请1小时后再试。"); + public final static CodeMsg USER_CREDENTIALS_EXPIRED = new CodeMsg(10006, "用户登录凭证过期,请重新登录。"); + public final static CodeMsg USER_ACCOUNT_EXPIRED = new CodeMsg(10007, "用户账号过期,请联系管理员。"); + public final static CodeMsg USER_IS_DISABLED = new CodeMsg(10008, "该用户已被禁用,请联系管理员。"); + public final static CodeMsg USER_BAD_CREDENTIALS = new CodeMsg(10009, "无效的登录凭证,请尝试重新登录"); + public final static CodeMsg USER_TOKEN_EXPIRED = new CodeMsg(10010, "用户凭证已过期,请联系管理员。"); + public final static CodeMsg NOT_GET_CURRENT_USER_INFO = new CodeMsg(10011, "无法获取当前用户信息。"); + public final static CodeMsg CAN_NOT_DATA_ACCESS = new CodeMsg(10012, "当前用户没有访问相关数据的权限。"); + public final static CodeMsg NOT_BIND_WECHAT = new CodeMsg(10013, "当前用户尚未绑定微信号。"); + public final static CodeMsg BIND_USER_FAIL = new CodeMsg(10014, "绑定用户失败 %s"); + public final static CodeMsg LOGIN_FAIL = new CodeMsg(10015, "登录失败,未知原因。"); + public final static CodeMsg CAN_NOT_GET_OPEN_ID = new CodeMsg(10016, "无法获取 OpenID。"); + public final static CodeMsg BIND_USER_FAIL2 = new CodeMsg(10017, "绑定用户失败 %s"); + public final static CodeMsg CAPTCHA_IS_NOT_RIGHT = new CodeMsg(10018, "验证码错误。"); + public final static CodeMsg CAPTCHA_IS_EMPTY = new CodeMsg(10019, "验证码不能为空。"); + public final static CodeMsg CAPTCHA_IS_EXPIRED = new CodeMsg(10020, "验证码已过期。"); + public static final CodeMsg TEMP_TOKEN_NOT_FOUND = new CodeMsg(10021,"无法获取临时授权"); + public static final CodeMsg TEMP_TOKEN_EXPIRED = new CodeMsg(10022,"临时授权已过期"); + + /** + * 基本操作 101XX + */ + public final static CodeMsg FETCH_ERROR = new CodeMsg(10100, "获取数据失败"); + public final static CodeMsg ADD_ERROR = new CodeMsg(10101, "添加失败%s"); + public final static CodeMsg MODIFY_ERROR = new CodeMsg(10102, "修改失败"); + public final static CodeMsg DELETE_ERROR = new CodeMsg(10103, "删除失败"); + public final static CodeMsg DELETE_ERROR_RELATION_DATA = new CodeMsg(101031, "存在关联业务数据,删除或禁用失败"); + public final static CodeMsg REPEAT_RECORD = new CodeMsg(10104, "字段与已有记录重复"); + public final static CodeMsg ENABLE_OR_DISABLE_ERROR = new CodeMsg(10105, "启用或禁用出错。"); + public final static CodeMsg CAN_FOUND_DICT = new CodeMsg(10106, "找不到字典。"); + public final static CodeMsg FORM_ERROR = new CodeMsg(10107, "表单参数错误"); + public static final CodeMsg MORE_THAN_ONE_ITEM = new CodeMsg(10108, "多余一条数据被查出"); + public static final CodeMsg ALREADY_EXIST_ITEM = new CodeMsg(10109, "数据重复"); + + /** + * 角色管理 102XX + */ + public final static CodeMsg ENABLE_OR_DISABLE_ROLE_ERROR = new CodeMsg(10201, "启用或禁用出错。"); + + /** + * 组织结构管理 103XX + */ + public final static CodeMsg CAN_NOT_SET_CHILDREN_UNIT_AS_PARENT = new CodeMsg(10301, "不能够将单位自身或其下级单位设置为上级单位。"); + public final static CodeMsg NOT_FOUND_UNIT = new CodeMsg(10302, "找不到对应的单位==%s。"); + public static final CodeMsg COMPANY_UNIT_CODE_OVERFLOW = new CodeMsg(10303, "公司类型单位编码溢出"); + public static final CodeMsg NON_COMPANY_UNIT_CODE_OVERFLOW = new CodeMsg(10304, "非公司类型单位编码溢出"); + + /** + * 设备信息 201XX + */ + public static final CodeMsg NOT_FOUND_ATTRIBUTION_UNIT = new CodeMsg(20101, "无法获取所属单位"); + public static final CodeMsg CAN_NOT_GENERATE_EQUIPMENT_CODE = new CodeMsg(20102, "无法生成新的设备编码"); + public static final CodeMsg NEW_EQUIPMENT_CODE_ILLEGAL = new CodeMsg(20103, "新的设备编码不合法或已存在"); + public static final CodeMsg NOT_FOUND_LEVEL1_CATEGORY_CODE = new CodeMsg(20104, "无法获取一级分类编码"); + public static final CodeMsg NOT_FOUND_LEVEL2_CATEGORY_CODE = new CodeMsg(20105, "无法获取二级分类编码"); + public static final CodeMsg NOT_FOUND_UNIT_CODE = new CodeMsg(20106, "无法获取设备所属单位编码"); + public static final CodeMsg EQUIPMENT_SERIAL_CODE_OVERFLOW = new CodeMsg(20107, "设备序号超出范围"); + public static final CodeMsg NOT_FOUND_EQUIPMENT = new CodeMsg(20110, "无法获取设备信息"); + public static final CodeMsg NOT_FOUND_PARENT_EQUIPMENT = new CodeMsg(20110, "无法获取父设备信息"); + + public static final CodeMsg ALREADY_EXIST_EQUIPMENT = new CodeMsg(20111, "当前使用单位下设备名称已存在,请更换"); + + + public static final CodeMsg THIS_EQUIPMENT_ALREADY_BIND_QRCODE = new CodeMsg(20113, "该设备已经绑定过二维码"); + public static final CodeMsg QRCODE_ALREADY_BIND_OTHER_EQUIPMENT = new CodeMsg(20114, "该二维码已经绑定到其它设备"); + public static final CodeMsg MODIFY_EQUIPMENT_CODE_FAIL = new CodeMsg(20115, "修改设备编码失败"); + public static final CodeMsg EQUIPMENT_CATEGORY_NOT_CHANGE = new CodeMsg(20116, "设备分类没有改变"); + public static final CodeMsg SAVEPLACE_CANNOT_FOUND = new CodeMsg(20117, "存放地点不存在===%s");; + public static final CodeMsg SAVEPLACE_UNIT_NULL = new CodeMsg(20118, "存放地点的所属单位不存在");; + public static final CodeMsg SAVEPLACE_ADD_ERROR = new CodeMsg(20119, "未选择单位");; + public static final CodeMsg NAME_PARENTS_IS_EXIST = new CodeMsg(20120, "同名父设备已存在====%s");; + public static final CodeMsg DUPLICATED_NAMED_EQUIPMENT = new CodeMsg(20121, "父设备命名重复===%s"); + public static final CodeMsg NO_ITEM = new CodeMsg(20122, "该二维码未绑定设备"); + + /** + * 设备分类管理 202XX + */ + public final static CodeMsg NOT_FOUND_EQUIPMENT_CATEGORY = new CodeMsg(20201, "找不到该设备分类====%s"); + public static final CodeMsg CATEGORY_1_CODE_OVERFLOW = new CodeMsg(20303, "一级设备分类编码溢出"); + public static final CodeMsg CATEGORY_2_CODE_OVERFLOW = new CodeMsg(20304, "二级设备分类编码溢出"); + + /** + * 存放地点 203XX + */ + public static final CodeMsg NOT_FOUND_SAVE_PLACE = new CodeMsg(20301, "找不到对应的存放地点"); + + /** + * 制造厂商 204XX + */ + public static final CodeMsg NOT_FOUND_MANUFACTURER = new CodeMsg(20401, "找不到对应的制造厂商==%s"); + + /*** + * 设备导入导出模块 205XX + */ + public final static CodeMsg FILE_FORMAT_ERROR = new CodeMsg(20501, "文件格式错误,选择xlsx或xls"); + public final static CodeMsg FILE_NOT_NULL = new CodeMsg(20502, "上传文件不能为空,请重新选择文件"); + public static final CodeMsg FILE_TOO_LARGE = new CodeMsg(20503,"上传的文件大小超出了限制"); + public static final CodeMsg FILE_IMPORT_ERROR = new CodeMsg(20504,"上传文件失败");; + public static final CodeMsg TEMPLATE_ERROR = new CodeMsg(20505,"导入模板未设置任何列头"); + public static final CodeMsg NONAUTHORIZED_IMPORT_ERROR = new CodeMsg(20506, "导入失败,当前用户不是公司设备管理员"); + public final static CodeMsg WRITE_ERRMSG_ERROR = new CodeMsg(20507, "错误文件写入异常:【%s】"); + public final static CodeMsg READ_FILE_ERROR = new CodeMsg(20507, "读取文件异常:【%s】"); + + /** + * 设备调拨 300XX + */ + public final static CodeMsg EQUIPMENT_DATA_INCONSISTENCY = new CodeMsg(30001, "确认设备列表与调拨申请中设备列表不一致"); + public final static CodeMsg ALLOT_APPLY_UNPERMITED = new CodeMsg(30002, "调拨申请单状态不是审批完成"); + public final static CodeMsg ALLOT_APPLY_NEED_SUBMIT = new CodeMsg(30003, "调拨申请单尚未提交"); + public final static CodeMsg ALLOT_APPLY_UNREJECTED = new CodeMsg(30004, "调拨申请单不是驳回状态"); + public final static CodeMsg NULL_APPLYID_RESUBMIT = new CodeMsg(30005, "调拨申请单重新提交时申请单ID不可为空"); + public final static CodeMsg ALLOT_APPLY_IS_NULL = new CodeMsg(30006, "调拨申请单不存在"); + + public final static CodeMsg ALLOT_APPLY_WRONG_PERMISSION = new CodeMsg(30007, "当前用户没有权限处理该申请单"); + public final static CodeMsg ALLOT_APPLY_SAME_COMPANY = new CodeMsg(30008, "调拨申请单只针对跨公司调拨,请选择其他调入公司"); + public final static CodeMsg NOT_FOUND_AUDIT_UNIT = new CodeMsg(30009, "找不到上级审批单位"); + public final static CodeMsg NEED_AT_LEAST_ONE_ALLOC_EQUIPMENT = new CodeMsg(30010, "至少需要选中一个设备"); + public final static CodeMsg ALLOT_APPLY_NOT_FOUND = new CodeMsg(30011, "找不到对应的调拨申请"); + + /** + * 设备盘点 301XX + */ + public final static CodeMsg OVERLAP_ERROR = new CodeMsg(30101, "所添加盘点任务的起止时间与数据库中存在重叠"); + public final static CodeMsg OUT_RANGE_ERROR = new CodeMsg(30102, "该设备在本次盘点范围外"); + public final static CodeMsg OWNERSHIP_ERROR = new CodeMsg(30103, "该设备使用单位异常"); + + /** + * 设备报废 302XX + */ + public final static CodeMsg ABANDON_APPLY_NOT_FOUND_ERROR = new CodeMsg(30201, "找不到此条报废申请"); + + // 状态码 + private Integer code; + + // 错误信息 + private String msg; + + public CodeMsg(Integer code, String msg) { + this.code = code; + this.msg = msg; + } + + public CodeMsg fillArgs(Object... args) { + String message = String.format(msg, args); + return new CodeMsg(code, message); + } + + public CodeMsg fillFieldError(BindingResult bindingResult) { + String defaultMessage = ""; + + if (bindingResult.hasErrors()) { + List allErrors = bindingResult.getAllErrors(); + + if (!allErrors.isEmpty()) { + defaultMessage = allErrors.get(0).getDefaultMessage(); + } + } + + String message = String.format(msg, defaultMessage); + return new CodeMsg(code, message); + } +} diff --git a/alops-common/src/main/java/com/alops/common/exception/BusinessException.java b/alops-common/src/main/java/com/alops/common/exception/BusinessException.java new file mode 100644 index 00000000..b5e0be55 --- /dev/null +++ b/alops-common/src/main/java/com/alops/common/exception/BusinessException.java @@ -0,0 +1,33 @@ +package com.alops.common.exception; + +import com.alops.common.core.domain.entity.CodeMsg; + +/** + * 业务逻辑处理异常 + * 借助 + */ +public class BusinessException extends RuntimeException { + + private static final long serialVersionUID = 1L; + + private CodeMsg codeMsg; + + public BusinessException(CodeMsg codeMsg) { + super(codeMsg.getMsg()); + this.codeMsg = codeMsg; + } + + public BusinessException(String codeMsg) { + super(codeMsg); + CodeMsg codeMsg1=new CodeMsg(500, codeMsg); + this.codeMsg = codeMsg1; + } + + public CodeMsg getCodeMsg() { + return codeMsg; + } + + public void setCodeMsg(CodeMsg codeMsg) { + this.codeMsg = codeMsg; + } +} diff --git a/alops-common/src/main/java/com/alops/common/utils/ResultUtils.java b/alops-common/src/main/java/com/alops/common/utils/ResultUtils.java new file mode 100644 index 00000000..23586522 --- /dev/null +++ b/alops-common/src/main/java/com/alops/common/utils/ResultUtils.java @@ -0,0 +1,39 @@ +package com.alops.common.utils; + + +import com.alops.common.core.domain.ResultVO; +import com.alops.common.core.domain.entity.CodeMsg; + +public class ResultUtils { + + // 成功 + public static ResultVO success(String msg, T data) { + ResultVO resultVO = new ResultVO<>(); + resultVO.setCode(0); + resultVO.setMsg(msg); + resultVO.setData(data); + + return resultVO; + } + + // 错误 + public static ResultVO error(CodeMsg codeMsg) { + ResultVO resultVO = new ResultVO<>(); + resultVO.setCode(codeMsg.getCode()); + resultVO.setMsg(codeMsg.getMsg()); + resultVO.setData(null); + + return resultVO; + } + + // 错误 + public static ResultVO error(String codeMsg) { + ResultVO resultVO = new ResultVO<>(); + resultVO.setCode(500); + resultVO.setMsg(codeMsg); + resultVO.setData(null); + + return resultVO; + } + +} diff --git a/~$数据集和页面.docx b/~$数据集和页面.docx new file mode 100644 index 00000000..04bd2b75 Binary files /dev/null and b/~$数据集和页面.docx differ diff --git a/数据库表与接口文档.docx b/数据库表与接口文档.docx new file mode 100644 index 00000000..8b86c572 Binary files /dev/null and b/数据库表与接口文档.docx differ diff --git a/数据集和页面.docx b/数据集和页面.docx new file mode 100644 index 00000000..5dde08d9 Binary files /dev/null and b/数据集和页面.docx differ diff --git a/设备信息.docx b/设备信息.docx new file mode 100644 index 00000000..1d4f7346 Binary files /dev/null and b/设备信息.docx differ diff --git a/设备型号.docx b/设备型号.docx new file mode 100644 index 00000000..65e5c330 Binary files /dev/null and b/设备型号.docx differ diff --git a/需求.html b/需求.html new file mode 100644 index 00000000..5307cb5a --- /dev/null +++ b/需求.html @@ -0,0 +1,572 @@ + + + + + + 华为企业网络设备状态监控数据表 + + + + +
+ + +
+

华为企业网络设备状态监控系统

+

此表格详细列出了华为企业级交换机和路由器需要监控的关键数据指标,包含设备基本信息、事件日志、资源信息、故障告警、表项查询、密码管理和基础信息等七大类数据。

+
+ +
+
+ 设备状态监控数据指标总览 +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
监控类别监控项数据类型/描述补充说明
设备基本信息
设备名称字符串设备主机名
固件版本字符串(如:V200R019C10)display version
管理IPIPv4/IPv6地址带外管理地址
设备持续运行时长时间格式(如:365天12小时)display clock
单板在位状态枚举值(Online/Offline/Fault)display device
健康度百分比(0-100%)综合计算指标
设备温度数值(单位:℃)部分支持湿度(需设备支持)
接口信息结构化数据包含以下子项:
├─ 端口Up/Down布尔值(True/False)display interface brief
├─ 速率数值(单位:Mbps/Gbps)
├─ 双工模式枚举值(Full/Half/Auto)
├─ 入/出方向流量数值(单位:bps)
├─ 带宽占用率百分比
├─ 丢包率百分比关键告警指标
└─ 错包率百分比仅交换机/路由器支持
事件日志
设备上下线日志时间戳 + 事件描述Syslog 协议采集
系统上报日志结构化日志(含事件类型、级别)支持关键词过滤(如:接口震荡、CPU过载)
资源信息
CPU使用率百分比(5秒/1分钟/5分钟均值)SNMP display cpu-usage
内存使用率百分比(物理内存+交换内存)SNMP display memory-usage
风扇转速数值(单位:rpm) + 状态(Normal/Abnormal)display fan
电源输入/输出电压数值(单位:V) + 状态(Normal/UnderVoltage)display power
故障告警
告警信息结构化数据(级别、类型、描述) + 分级规则:1-6级(6级最高)
+ Syslog 协议采集 +
表项查询
VLAN信息列表数据包含以下字段:
├─ ManID字符串VLAN管理ID
├─ IP地址IPv4地址
└─ 子网掩码掩码格式(如:255.255.255.0)
路由表条目列表数据包含以下字段:
├─ 目的地址IPv4/IPv6网段display ip routing-table
├─ 子网掩码掩码格式
└─ 下一跳地址IPv4/IPv6地址
密码管理
当前密码脱敏字符串(如:Ad******min) + 安全规则:脱敏中间6位
+ NETCONF/API +
历史密码列表(最近5次) + 时间戳平台校验后可查看完整密码
基础信息
资产ID唯一标识符CMDB系统同步
设备类型枚举值(交换机/路由器)
厂家字符串(固定值:华为)
接口数量数值(物理+逻辑接口)
安装位置字符串(如:机房A-机柜3-U5)
设备管理员字符串(责任人姓名)
购买日期日期格式(YYYY-MM-DD)
质保期限日期格式
是否过保布尔值自动计算字段
服役年限数值(单位:年)
故障次数数值(累计)关联告警系统
维修次数数值(累计)
维修金额(累积总值)数值(单位:元)
+
+
+ +
+
+ 数据采集方式说明 +
+
+ + + + + + + + + + + + + + + + + + + + + +
采集方式适用监控数据
SNMP协议设备基础状态、资源信息(CPU/内存)、接口流量、设备温度
Syslog协议事件日志、故障告警、设备上下线记录
NETCONF/YANG模型表项查询(VLAN/路由表)、密码管理、高级配置信息
+
+
+ + +
+ + \ No newline at end of file