# AdjNotifyConfigTypeEnum.java

    package cloud.wconnect.frontoffice.cons.adjustment;

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

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

    /**
     * 通知配置类型枚举类
     *
     * @author lichen
     * @date 2024/11/12
     */
    @Getter
    @AllArgsConstructor
    public enum AdjNotifyConfigTypeEnum {

        /**
         * 草稿数据统计通知，用于通知责任人处理草稿数据
         */
        DRAFT_STATISTICS(1, "adjustment.notify.subject.draft-statistics"),
        /**
         * 待审批汇总通知
         */
        APPROVING_DAILY_SUMMARY(2, "adjustment.notify.subject.wait-for-approving-daily-summary"),
        /**
         * 报告缺失通知
         */
        REPORT_MISSED(3, NotifySubjectI18nCons.MISSING_REPORT),
        /**
         * 草稿数据按类型统计通知
         */
        DRAFT_STATISTICS_EACH_TYPE(4,"adjustment.notify.subject.draft-statistics-each-type"),
        /**
         * 审批通过的通知
         */
        APPROVED(5,NotifySubjectI18nCons.APPROVAL_PASSED),
        /**
         * Sales类型待审批通知，用于通知审批人审批
         */
        SALES_WAIT_FOR_APPROVING(6,NotifySubjectI18nCons.WAITING_FOR_APPROVAL),
        /**
         * Front desk类型待审批通知，用于通知审批人审批
         */
        FRONT_DESK_WAIT_FOR_APPROVING(7,NotifySubjectI18nCons.WAITING_FOR_APPROVAL),
        /**
         * Accouting类型待审批通知，用于通知审批人审批
         */
        ACCOUTING_WAIT_FOR_APPROVING(8,NotifySubjectI18nCons.WAITING_FOR_APPROVAL),

        /**
         * 9.审批人员禁用通知
         */
        APPROVAL_PERSON_DISABLED(9, "adjustment.notify.subject.approval-person-disabled");

        /**
         * 通知类型
         */
        private int type;

        /**
         * 默认通知主题的国际化code
         */
        private String defaultSubjectI18nCode;

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

        /**
         * 根据adjustment的类型获取审批通知类型
         *
         * @param requestType 调账类型
         * @return int
         * @author lichen
         * @date 2024/11/13
         */
        public static int getTypeByRequestType(int requestType){
            if(requestType == AdjTypeEnum.SALES.getAdjType()){
                return AdjNotifyConfigTypeEnum.SALES_WAIT_FOR_APPROVING.getType();
            }else if(requestType == AdjTypeEnum.FRONT_DESK.getAdjType()){
                return AdjNotifyConfigTypeEnum.FRONT_DESK_WAIT_FOR_APPROVING.getType();
            }else{
                return AdjNotifyConfigTypeEnum.ACCOUTING_WAIT_FOR_APPROVING.getType();
            }
        }
    }