# EventDatasourceEnum.java

    package cloud.wconnect.rateshop.cons.rateshop;

    import lombok.AllArgsConstructor;
    import lombok.Getter;

    import java.util.Arrays;
    import java.util.Optional;

    /**
     * 事件源枚举类
     *
     * @author lichen
     * @date 2024/9/18
     */
    @Getter
    @AllArgsConstructor
    public enum EventDatasourceEnum {

        _10TIMES(1,"10times"),

        VIAGOGO(2, "viagogo");

        private Integer datasourceId;

        private String symbol;

        /**
         * 获取数据源对应的标识
         *
         * @param datasourceId 数据源ID
         * @return java.lang.String
         * @author lichen
         * @date 2024/9/18
         */
        public static String getSymbol(int datasourceId){
            Optional<EventDatasourceEnum> optional = Arrays.stream(EventDatasourceEnum.values())
                    .filter(item -> item.getDatasourceId() == datasourceId).findFirst();
            return optional.isEmpty() ? "" : optional.get().getSymbol();
        }

    }