# MonthlyRevenueNotifyTypeEnum.java

    package cloud.wconnect.rateshop.cons.weeklymonthlyrevenue;

    import cloud.wconnect.commonlib.cons.NotifySubjectI18nCons;
    import lombok.AllArgsConstructor;
    import lombok.Getter;

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

    /**
     * Enum: Notify Type
     *
     * @author zc
     * @date 2024/11/14
     */
    @Getter
    @AllArgsConstructor
    public enum MonthlyRevenueNotifyTypeEnum {
        // History and Forecast 0d ~ 100d 报告缺失
        MISSING_REPORT_HISTORY_AND_FORECAST(1, NotifySubjectI18nCons.MISSING_REPORT, "monthly-revenue.notify.type.miss-report.history-and-forecast"),
        // Group Pickup -2d ~ 100d 报告缺失
        MISSING_REPORT_GROUP_PICKUP(2, NotifySubjectI18nCons.MISSING_REPORT, "monthly-revenue.notify.type.miss-report.group-pickup"),
        // Reservation Statistics -1 报告缺失
        MISSING_REPORT_RESERVATION_STATISTICS(3, NotifySubjectI18nCons.MISSING_REPORT, "monthly-revenue.notify.type.miss-report.reservation-statistics"),
        // Reservation Forecast 0 ~ 100d 报告缺失
        MISSING_REPORT_RESERVATION_FORECAST(4, NotifySubjectI18nCons.MISSING_REPORT, "monthly-revenue.notify.type.miss-report.reservation-forecast"),
        // Cancellation Summary -2 ~ -1 报告缺失
        MISSING_REPORT_CANCELLATION_SUMMARY(5, NotifySubjectI18nCons.MISSING_REPORT, "monthly-revenue.notify.type.miss-report.cancellation-summary"),
        // Manager Flash -1 报告缺失
        MISSING_REPORT_MANAGER_FLASH_ONE_DAY_AGO(6, NotifySubjectI18nCons.MISSING_REPORT, "monthly-revenue.notify.type.miss-report.manager-flash"),
        // Manager Flash -2 报告缺失
        MISSING_REPORT_MANAGER_FLASH_TWO_DAY_AGO(7, NotifySubjectI18nCons.MISSING_REPORT, "monthly-revenue.notify.type.miss-report.manager-flash");

        /**
         * 通知类型
         */
        private final Integer type;
        /**
         * 默认通知主题的国际化code
         */
        private final String defaultSubjectI18nCode;
        /**
         * 国际化code
         */
        private final String i18nCode;

        /**
         * 根据类型获取默认主题的国际化code
         *
         * @param type 类型
         * @return java.lang.String
         * @author zc
         * @date 2024/11/14
         */
        public static String getDefaultSubjectI18nCode(int type) {
            Optional<MonthlyRevenueNotifyTypeEnum> optional = Arrays.stream(MonthlyRevenueNotifyTypeEnum.values())
                    .filter(item -> item.getType() == type).findFirst();
            return optional.isEmpty() ? "" : optional.get().getDefaultSubjectI18nCode();
        }
    }