package enumeration; import lombok.Getter; import java.util.Arrays; import java.util.List; /** * @author gonghl * @since 2024/7/25 上午 10:50 */ @Getter public enum ContractRule { CONTRACT_RULE_Online(1,"设备平均在线率", 0), CONTRACT_RULE_Monitor(2,"前端感知源治理工作", 0), CONTRACT_RULE_Monitor_Time(null,"时钟同步", 2), CONTRACT_RULE_Monitor_OSD(null,"OSD标识", 2), CONTRACT_RULE_Monitor_OneFile(null,"一机一档", 2), CONTRACT_RULE_Store(3,"存储故障", 0), CONTRACT_RULE_Store_24H(null,"因存储设备、云存储软件等引起平台不能正常查看历史图像,须在24小时排除故障,单次故障在24小时以内", 3), CONTRACT_RULE_Store_48H(null,"因存储设备、云存储软件等引起平台不能正常查看历史图像,须在24小时排除故障,单次故障在48小时以内", 3), CONTRACT_RULE_Store_Important(null,"因视频或者图片丢失导致重要案事件不能回放或查看", 3), CONTRACT_RULE_Site(4,"对于前端点位异常情况的处理", 0), CONTRACT_RULE_Site_Error(null,"镜头故障或污染或树枝遮挡或枪机视角偏移正常角度或补光灯应亮未亮", 4), CONTRACT_RULE_VideoRecord(5,"确保录像完整不定期对所有点位录像完整性抽查", 0), CONTRACT_RULE_PicComplete(6,"确保图片完整不定期对所有人脸车辆以及智能前端抓拍的图片完整性抽查", 0), CONTRACT_RULE_PicComplete_PicUnuseful(null,"发现后台存储不能调取前端设备图片", 6), ; private final Integer id; private final String name; private final Integer parentId; ContractRule(Integer id, String name, Integer parentId) { this.id = id; this.name = name; this.parentId = parentId; } public static List getParent() { return Arrays.stream(ContractRule.values()).filter(contractRule -> contractRule.parentId ==0).toList(); } public static List getChildren(ContractRule parent) { return Arrays.stream(ContractRule.values()).filter(contractRule -> parent.id.equals(contractRule.parentId)).toList(); } }