|
|
@@ -0,0 +1,65 @@
|
|
|
+package com.xunmei.common.core.enums.iot;
|
|
|
+
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import io.netty.util.internal.StringUtil;
|
|
|
+import lombok.AllArgsConstructor;
|
|
|
+import lombok.Getter;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Optional;
|
|
|
+
|
|
|
+@Getter
|
|
|
+@AllArgsConstructor
|
|
|
+public enum SmsNotifyType {
|
|
|
+
|
|
|
+ EXPIRY_REMINDER("10100", "临期提醒"),
|
|
|
+
|
|
|
+ OVERDUE_REMINDER("10200", "逾期提醒"),
|
|
|
+
|
|
|
+ WATER_DRAINAGE_ALARM("4184", "水浸告警"),
|
|
|
+
|
|
|
+ HUMIDITY_TEMPERATURE_ALARM("4183", "温湿度告警"),
|
|
|
+
|
|
|
+ SMOKE_ALARM("4182", "烟感告警"),
|
|
|
+
|
|
|
+ Infrared_Alarm("4181", "红外告警"),
|
|
|
+
|
|
|
+ GAS_ALARM("41885", "燃气告警"),
|
|
|
+
|
|
|
+ ALARM_OF_THEFT("41881", "盗情告警"),
|
|
|
+
|
|
|
+ DOOR_MAGNET_ALARM("4188", "门磁告警"),
|
|
|
+
|
|
|
+ ;
|
|
|
+
|
|
|
+ private final String code;
|
|
|
+
|
|
|
+
|
|
|
+ private final String desc;
|
|
|
+
|
|
|
+ private static final Map<String, SmsNotifyType> enumMap = new LinkedHashMap<>();
|
|
|
+
|
|
|
+ static {
|
|
|
+ for (SmsNotifyType enumNode : SmsNotifyType.values()) {
|
|
|
+ enumMap.put(enumNode.code, enumNode);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //根据key找value
|
|
|
+ public static String getDesc(String code) {
|
|
|
+ SmsNotifyType e = enumMap.get(code);
|
|
|
+ return e != null ? e.getDesc() : "";
|
|
|
+ }
|
|
|
+ //根据value找key
|
|
|
+ public static String getCode(String desc) {
|
|
|
+ Optional<SmsNotifyType> optional = Arrays.stream(SmsNotifyType.values()).filter(r -> ObjectUtil.equal(r.getDesc(), desc)).findAny();
|
|
|
+ return optional.isPresent() ? optional.get().getCode() : StringUtil.EMPTY_STRING;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static SmsNotifyType getSensorTypeEnum(String code) {
|
|
|
+ return enumMap.get(code);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|