Browse Source

fix cache缓存枚举处理方法修复

18339543638 3 năm trước cách đây
mục cha
commit
5742cf719a

+ 1 - 1
coffee-admin/src/main/resources/application.yml

@@ -64,7 +64,7 @@ mybatis-plus:
     dbConfig:
       idType: ASSIGN_ID
   configuration:
-    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    log-impl: org.apache.ibatis.logging.nologging.NoLoggingImpl
     default-enum-type-handler: com.baomidou.mybatisplus.core.handlers.MybatisEnumTypeHandler
   type-aliases-package: com.coffee.bus.entity
 

+ 13 - 1
coffee-common/src/main/java/com/coffee/common/cache/ClusterConfigStorage.java

@@ -2,6 +2,7 @@ package com.coffee.common.cache;
 
 import cn.hutool.core.util.StrUtil;
 import cn.hutool.extra.spring.SpringUtil;
+import com.baomidou.mybatisplus.annotation.IEnum;
 import com.coffee.common.cache.value.Value;
 import org.springframework.cache.Cache;
 import org.springframework.cache.CacheManager;
@@ -34,7 +35,15 @@ public class ClusterConfigStorage implements ConfigStorage {
         if (CollectionUtils.isEmpty(values)) {
             return true;
         }
-        boundHashOperations.putAll(values);
+        HashMap<String, Object> map = new HashMap<>();
+        values.forEach((k,v)->{
+            if(v instanceof IEnum){
+                map.put(k,((IEnum) v).getValue());
+            }else {
+                map.put(k,v);
+            }
+        });
+        boundHashOperations.putAll(map);
         return true;
     }
 
@@ -46,6 +55,9 @@ public class ClusterConfigStorage implements ConfigStorage {
         if(value==null){
             boundHashOperations.delete(key);
         }else {
+            if(value instanceof IEnum){
+                value=((IEnum) value).getValue();
+            }
             boundHashOperations.put(key,value);
         }
         return true;

+ 30 - 0
coffee-common/src/main/java/com/coffee/common/cache/value/SimpleValue.java

@@ -1,9 +1,15 @@
 package com.coffee.common.cache.value;
 
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.EnumUtil;
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.annotation.IEnum;
 import lombok.AllArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.yaml.snakeyaml.util.EnumUtils;
+
 import java.lang.reflect.Array;
+import java.lang.reflect.Field;
 import java.util.*;
 
 @AllArgsConstructor(staticName = "of")
@@ -52,6 +58,30 @@ public class SimpleValue implements Value {
                 return (T) source;
             }
         }
+        if(IEnum.class.isAssignableFrom(targetClass)){
+            if (targetClass.isEnum()) {
+                T[] enumConstants = targetClass.getEnumConstants();
+                for (T enumConstant : enumConstants) {
+                    try {
+                        Field value = enumConstant.getClass().getDeclaredField("value");
+                        value.setAccessible(true);
+                        try {
+                            if(ObjectUtil.equal(value.get(enumConstant),source)){
+                                return enumConstant;
+                            }
+                        } catch (IllegalAccessException e) {
+                            log.error("枚举类转换失败,[value]值无法获取,{}",targetClass.getName());
+                            return null;
+                        }
+                    } catch (NoSuchFieldException e) {
+                        log.error("枚举类转换失败,不存在[value]值,{}",targetClass.getName());
+                        return null;
+                    }
+                }
+            }else {
+                return null;
+            }
+        }
         if (Collection.class.isAssignableFrom(targetClass)) {
             Collection collection = newCollection(targetClass);
             Collection sourceCollection;

+ 3 - 2
coffee-common/src/main/java/com/coffee/common/crud/BaseService.java

@@ -10,6 +10,7 @@ import cn.hutool.db.sql.Order;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.enums.SqlMethod;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.metadata.TableInfo;
 import com.baomidou.mybatisplus.core.metadata.TableInfoHelper;
 import com.baomidou.mybatisplus.core.toolkit.Assert;
@@ -202,12 +203,12 @@ public abstract class BaseService<M extends BaseMapper<E>, E,PK extends Serializ
         return false;
     }
 
-    public Page<E> list(QueryParamEntity<E> param) {
+    public IPage<E> list(QueryParamEntity<E> param) {
         //是否为分页查询
         if(ObjectUtil.isNotNull(param.getPage())){
             QueryWrapper<E> wrapper = build(param);
             Page<E> page = param.getPage();
-            page.setCurrent(page.getCurrent()>0?page.getCurrent()-1:0);
+//            page.setCurrent(page.getCurrent()>0?page.getCurrent()-1:0);
             return this.page(page,wrapper);
         }else {
             try {

+ 0 - 2
coffee-system/src/main/java/com/coffee/bus/entity/BusInfusionHistoryEntity.java

@@ -315,6 +315,4 @@ public class BusInfusionHistoryEntity extends TenantGenericEntity<String,String>
 
     }
 
-    @Override
-    public void setCreateTime(Date createTime){};
 }

+ 122 - 111
coffee-system/src/main/java/com/coffee/bus/websocket/listener/DeviceInfoListener.java

@@ -9,6 +9,7 @@ import cn.hutool.crypto.SignUtil;
 import cn.hutool.crypto.asymmetric.Sign;
 import cn.hutool.crypto.asymmetric.SignAlgorithm;
 import cn.hutool.extra.spring.SpringUtil;
+import com.baomidou.mybatisplus.annotation.IEnum;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
@@ -27,6 +28,7 @@ import com.coffee.bus.registry.patient.PatientRegistry;
 import com.coffee.bus.registry.patient.bean.DeviceTimeSmallInfo;
 import com.coffee.bus.registry.patient.bean.PatientCacheInfo;
 import com.coffee.bus.service.*;
+import com.coffee.bus.websocket.DeviceConflictHandler;
 import com.coffee.common.config.websocket.WebSocketConstant;
 import com.coffee.common.enums.SexEnum;
 import lombok.AllArgsConstructor;
@@ -454,7 +456,7 @@ public class DeviceInfoListener {
 
     public static int count=1;
     public static long mark=System.currentTimeMillis();
-//    @Scheduled(cron = "0/20 * * * * ?")
+    @Scheduled(cron = "0/10 * * * * ?")
     public void send() throws InterruptedException {
 //        List<BusDeviceRunningEntity> list = deviceUsingService.list();
 //        list.forEach(pump->{
@@ -485,6 +487,7 @@ public class DeviceInfoListener {
         pump.setPcaTotalCount(pump.getPcaInvalidCount()+pump.getPcaValidCount());
         pump.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
 
+        pump.setAlarm(DeviceAlarmEnum.Bubble);
         pump.setPulseDose(RandomUtil.randomInt(100));
         pump.setPulseLockTime(RandomUtil.randomInt(100));
         pump.setPulseFirstLockTime(RandomUtil.randomInt(100));
@@ -500,116 +503,117 @@ public class DeviceInfoListener {
 
         SpringUtil.publishEvent(new DeviceInfoEvent(this,pump,pump.getDeviceId()));
 
-        Thread.sleep(5000);
-
-        BusDeviceRunningEntity pump1 = new BusDeviceRunningEntity();
-        pump1.setDeviceId("456");
-        pump1.setType(DeviceTypeEnum.continuous);
-        pump1.setClassification(String.valueOf(mark));
-        pump1.setPatientCode("456");
-        pump1.setTotalDose(RandomUtil.randomInt(100));
-        pump1.setFirstDose(RandomUtil.randomInt(100));
-        pump1.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setInputDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setAppendDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setAppendLockTime(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setMaxDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setSelfControlCount(RandomUtil.randomInt(100));
-        pump1.setSelfControlLockTime(RandomUtil.randomInt(100));
-        pump1.setFirstDose(RandomUtil.randomInt(100));
-        pump1.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setSelfControlLockTime(RandomUtil.randomInt(100));
-        pump1.setPcaValidCount(RandomUtil.randomInt(100));
-        pump1.setPcaInvalidCount(RandomUtil.randomInt(100));
-        pump1.setPcaTotalCount(pump.getPcaInvalidCount()+pump.getPcaValidCount());
-        pump1.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-
-        pump1.setPulseDose(RandomUtil.randomInt(100));
-        pump1.setPulseLockTime(RandomUtil.randomInt(100));
-        pump1.setPulseFirstLockTime(RandomUtil.randomInt(100));
-        pump1.setFlowAdjustRate(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setFlowCount(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setFlowDownCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setFlowDownLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setFlowUpCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump1.setFlowUpLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-
-        pump1.setUploadTime(new Date());
-        Thread.sleep(5000);
-
-        BusDeviceRunningEntity pump2 = new BusDeviceRunningEntity();
-        pump2.setType(DeviceTypeEnum.continuous);
-        pump2.setDeviceId("456");
-        pump2.setClassification(String.valueOf(mark));
-        pump2.setPatientCode("789");
-        pump2.setTotalDose(RandomUtil.randomInt(100));
-        pump2.setFirstDose(RandomUtil.randomInt(100));
-        pump2.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setInputDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setAppendDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setAppendLockTime(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setMaxDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setSelfControlCount(RandomUtil.randomInt(100));
-        pump2.setSelfControlLockTime(RandomUtil.randomInt(100));
-        pump2.setFirstDose(RandomUtil.randomInt(100));
-        pump2.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setSelfControlLockTime(RandomUtil.randomInt(100));
-        pump2.setPcaValidCount(RandomUtil.randomInt(100));
-        pump2.setPcaInvalidCount(RandomUtil.randomInt(100));
-        pump2.setPcaTotalCount(pump.getPcaInvalidCount()+pump.getPcaValidCount());
-        pump2.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-
-        pump2.setPulseDose(RandomUtil.randomInt(100));
-        pump2.setPulseLockTime(RandomUtil.randomInt(100));
-        pump2.setPulseFirstLockTime(RandomUtil.randomInt(100));
-        pump2.setFlowAdjustRate(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setFlowCount(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setFlowDownCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setFlowDownLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setFlowUpCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump2.setFlowUpLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-
-        pump2.setUploadTime(new Date());
-
-        Thread.sleep(5000);
-
-        BusDeviceRunningEntity pump3 = new BusDeviceRunningEntity();
-        pump3.setDeviceId("456");
-        pump3.setClassification(String.valueOf(mark));
-        pump3.setType(DeviceTypeEnum.continuous);
-        pump3.setPatientCode("456");
-        pump3.setTotalDose(RandomUtil.randomInt(100));
-        pump3.setFirstDose(RandomUtil.randomInt(100));
-        pump3.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setInputDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setAppendDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setAppendLockTime(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setMaxDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setSelfControlCount(RandomUtil.randomInt(100));
-        pump3.setSelfControlLockTime(RandomUtil.randomInt(100));
-        pump3.setFirstDose(RandomUtil.randomInt(100));
-        pump3.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setSelfControlLockTime(RandomUtil.randomInt(100));
-        pump3.setPcaValidCount(RandomUtil.randomInt(100));
-        pump3.setPcaInvalidCount(RandomUtil.randomInt(100));
-        pump3.setPcaTotalCount(pump.getPcaInvalidCount()+pump.getPcaValidCount());
-        pump3.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-
-        pump3.setPulseDose(RandomUtil.randomInt(100));
-        pump3.setPulseLockTime(RandomUtil.randomInt(100));
-        pump3.setPulseFirstLockTime(RandomUtil.randomInt(100));
-        pump3.setFlowAdjustRate(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setFlowCount(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setFlowDownCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setFlowDownLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setFlowUpCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-        pump3.setFlowUpLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
-
-        pump3.setUploadTime(new Date());
-        SpringUtil.publishEvent(new DeviceInfoEvent(this,pump3,pump3.getDeviceId()));
+//        Thread.sleep(5000);
+//
+//        BusDeviceRunningEntity pump1 = new BusDeviceRunningEntity();
+//        pump1.setDeviceId("456");
+//        pump1.setType(DeviceTypeEnum.continuous);
+//        pump1.setClassification(String.valueOf(mark));
+//        pump1.setPatientCode("456");
+//        pump1.setTotalDose(RandomUtil.randomInt(100));
+//        pump1.setFirstDose(RandomUtil.randomInt(100));
+//        pump1.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setInputDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setAppendDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setAppendLockTime(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setMaxDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setSelfControlCount(RandomUtil.randomInt(100));
+//        pump1.setSelfControlLockTime(RandomUtil.randomInt(100));
+//        pump1.setFirstDose(RandomUtil.randomInt(100));
+//        pump1.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setSelfControlLockTime(RandomUtil.randomInt(100));
+//        pump1.setPcaValidCount(RandomUtil.randomInt(100));
+//        pump1.setPcaInvalidCount(RandomUtil.randomInt(100));
+//        pump1.setPcaTotalCount(pump.getPcaInvalidCount()+pump.getPcaValidCount());
+//        pump1.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//
+//
+//        pump1.setPulseDose(RandomUtil.randomInt(100));
+//        pump1.setPulseLockTime(RandomUtil.randomInt(100));
+//        pump1.setPulseFirstLockTime(RandomUtil.randomInt(100));
+//        pump1.setFlowAdjustRate(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setFlowCount(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setFlowDownCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setFlowDownLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setFlowUpCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump1.setFlowUpLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//
+//        pump1.setUploadTime(new Date());
+//        Thread.sleep(5000);
+//
+//        BusDeviceRunningEntity pump2 = new BusDeviceRunningEntity();
+//        pump2.setType(DeviceTypeEnum.continuous);
+//        pump2.setDeviceId("456");
+//        pump2.setClassification(String.valueOf(mark));
+//        pump2.setPatientCode("789");
+//        pump2.setTotalDose(RandomUtil.randomInt(100));
+//        pump2.setFirstDose(RandomUtil.randomInt(100));
+//        pump2.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setInputDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setAppendDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setAppendLockTime(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setMaxDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setSelfControlCount(RandomUtil.randomInt(100));
+//        pump2.setSelfControlLockTime(RandomUtil.randomInt(100));
+//        pump2.setFirstDose(RandomUtil.randomInt(100));
+//        pump2.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setSelfControlLockTime(RandomUtil.randomInt(100));
+//        pump2.setPcaValidCount(RandomUtil.randomInt(100));
+//        pump2.setPcaInvalidCount(RandomUtil.randomInt(100));
+//        pump2.setPcaTotalCount(pump.getPcaInvalidCount()+pump.getPcaValidCount());
+//        pump2.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//
+//        pump2.setPulseDose(RandomUtil.randomInt(100));
+//        pump2.setPulseLockTime(RandomUtil.randomInt(100));
+//        pump2.setPulseFirstLockTime(RandomUtil.randomInt(100));
+//        pump2.setFlowAdjustRate(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setFlowCount(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setFlowDownCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setFlowDownLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setFlowUpCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump2.setFlowUpLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//
+//        pump2.setUploadTime(new Date());
+//
+//        Thread.sleep(5000);
+//
+//        BusDeviceRunningEntity pump3 = new BusDeviceRunningEntity();
+//        pump3.setDeviceId("456");
+//        pump3.setClassification(String.valueOf(mark));
+//        pump3.setType(DeviceTypeEnum.continuous);
+//        pump3.setPatientCode("456");
+//        pump3.setTotalDose(RandomUtil.randomInt(100));
+//        pump3.setFirstDose(RandomUtil.randomInt(100));
+//        pump3.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setInputDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setAppendDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setAppendLockTime(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setMaxDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setSelfControlCount(RandomUtil.randomInt(100));
+//        pump3.setSelfControlLockTime(RandomUtil.randomInt(100));
+//        pump3.setFirstDose(RandomUtil.randomInt(100));
+//        pump3.setRemainDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setSelfControlLockTime(RandomUtil.randomInt(100));
+//        pump3.setPcaValidCount(RandomUtil.randomInt(100));
+//        pump3.setPcaInvalidCount(RandomUtil.randomInt(100));
+//        pump3.setPcaTotalCount(pump.getPcaInvalidCount()+pump.getPcaValidCount());
+//        pump3.setContinueDose(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//
+//        pump3.setPulseDose(RandomUtil.randomInt(100));
+//        pump3.setPulseLockTime(RandomUtil.randomInt(100));
+//        pump3.setPulseFirstLockTime(RandomUtil.randomInt(100));
+//        pump3.setFlowAdjustRate(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setFlowCount(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setFlowDownCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setFlowDownLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setFlowUpCycle(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//        pump3.setFlowUpLimit(BigDecimal.valueOf(RandomUtil.randomInt(100)));
+//
+//        pump3.setUploadTime(new Date());
+//        SpringUtil.publishEvent(new DeviceInfoEvent(this,pump3,pump3.getDeviceId()));
 //        });
         Thread.sleep(5000);
         String now = DateUtil.yesterday().toString();
@@ -628,4 +632,11 @@ public class DeviceInfoListener {
         SpringUtil.publishEvent(new HisEvent(this,Arrays.asList(clinic),clinic.getTenantId()));
 
     }
+
+    public static void main(String[] args) {
+        DeviceAlarmEnum[] enumConstants = DeviceAlarmEnum.class.getEnumConstants();
+        for (DeviceAlarmEnum enumConstant : enumConstants) {
+
+        }
+    }
 }