# MarketDemandLevelEnum.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/1/25
     */
    @Getter
    @AllArgsConstructor
    public enum MarketDemandLevelEnum {

        LEVEL_1(1, "rate-shop.market-demand.level1"),

        LEVEL_2(2, "rate-shop.market-demand.level2"),

        LEVEL_3(3, "rate-shop.market-demand.level3");

        /**
         * 级别
         */
        private int level;

        /**
         * 国际化code
         */
        private String i18nCode;

        /**
         * 获取级别描述
         *
         * @param level 级别
         * @return java.lang.String
         * @author lichen
         * @date 2024/1/25
         */
        public static String getI18nCode(int level) {
            Optional<MarketDemandLevelEnum> optional = Arrays.stream(MarketDemandLevelEnum.values()).filter(item -> item.getLevel() == level).findFirst();
            return optional.isPresent() ? optional.get().getI18nCode() : "";
        }

    }