# DatasourceEnum.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/5/15
     */
    @Getter
    @AllArgsConstructor
    public enum DatasourceEnum {

        GOOGLE(1, "rate-shop.datasource.google"),
        EXPEDIA(2, "rate-shop.datasource.expedia"),
        OPTIMAND(3, "rate-shop.datasource.optimand"),
        MERLIN(4, "rate-shop.datasource.merlin"),
        LIGHTHOUSE(5,"rate-shop.datasource.lighthouse");

        private int datasourceId;

        private String i18nCode;

        /**
         * 获取国际化code
         *
         * @param datasourceId 数据源ID
         * @return java.lang.String
         * @author lichen
         * @date 2024/5/15
         */
        public static String getI18nCode(int datasourceId) {
            Optional<DatasourceEnum> optional = Arrays.stream(DatasourceEnum.values()).filter(item -> item.getDatasourceId() == datasourceId).findFirst();
            return optional.isPresent() ? optional.get().getI18nCode() : "";
        }

    }