# TaNotifyTypeEnum.java

    package cloud.wconnect.finance.cons.ta;

    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 TaNotifyTypeEnum {
        // 1: 比对异常
        COMPARE_EXCEPTION(1, "ta.notify.subject.data-comparison-exception", "ta.notify.type.compare-exception"),
        // 2: Credit Card 报告缺失
        MISSING_REPORT_CREDIT_CARD(2, NotifySubjectI18nCons.MISSING_REPORT, "ta.notify.type.miss-report.credit-card"),
        // 3: OTA 报告缺失
        MISSING_REPORT_OTA(3, NotifySubjectI18nCons.MISSING_REPORT, "ta.notify.type.miss-report.ota"),
        // 4: Portal 报告缺失
        MISSING_REPORT_PORTAL(4, NotifySubjectI18nCons.MISSING_REPORT, "ta.notify.type.miss-report.portal");

        /**
         * 通知类型
         */
        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<TaNotifyTypeEnum> optional = Arrays.stream(TaNotifyTypeEnum.values())
                    .filter(item -> item.getType() == type).findFirst();
            return optional.isEmpty() ? "" : optional.get().getDefaultSubjectI18nCode();
        }
    }