# SvaNotifyTypeEnum.java

    package cloud.wconnect.workperformance.cons.sva;

    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/12
     */
    @Getter
    @AllArgsConstructor
    public enum SvaNotifyTypeEnum {

        // 1: 数据权限申请
        DATA_PERMISSION_APPLY(1, NotifySubjectI18nCons.DATA_PERMISSION_APPLY, "sva.notify.type.data-permission-apply"),
        // 2: Employee 报告缺失
        MISSING_REPORT_EMPLOYEE(2, NotifySubjectI18nCons.MISSING_REPORT, "sva.notify.type.miss-report.employee"),
        // 3: AV 实际工时 报告缺失
        MISSING_REPORT_AV_ACTUAL(3, NotifySubjectI18nCons.MISSING_REPORT, "sva.notify.type.miss-report.actual-hour-work"),
        // 4: Operating 报告缺失
        MISSING_REPORT_OPERATING(4, NotifySubjectI18nCons.MISSING_REPORT, "sva.notify.type.miss-report.operating-statistics"),
        // 5: Sales Forecast 数据缺失
        MISSING_DATA_SALES_FORECAST(5, NotifySubjectI18nCons.MISSING_DATA, "sva.notify.type.miss-data.sales-forecast"),
        // 6: AV 预计工时 报告缺失
        MISSING_REPORT_AV_SCHEDULE(6, NotifySubjectI18nCons.MISSING_REPORT, "sva.notify.type.miss-report.schedule-hour-work");

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