# AccountTypeEnum.java

    package cloud.wconnect.finance.cons.pl;

    import cloud.wconnect.commonlib.cons.BaseErrorCodeEnum;
    import cloud.wconnect.commonlib.exception.BadRequestException;
    import lombok.AllArgsConstructor;
    import lombok.Getter;

    /**
     * Account Type Enum
     *
     * @author lichen
     * @date 2025/9/26
     */
    @AllArgsConstructor
    @Getter
    public enum AccountTypeEnum {

        INCOME(1, "Income"),
        EXPENSE(2, "Expense");

        private int type;

        private String m3AccountType;

        /**
         * 通过M3 Account Type获取Account Type
         *
         * @param m3AccountType M3 Account Type
         * @return int
         * @author lichen
         * @date 2025/9/26
         */
        public static int getTypeByM3AccountType(String m3AccountType) {
            for (AccountTypeEnum value : values()) {
                if (value.m3AccountType.equals(m3AccountType)) {
                    return value.type;
                }
            }
            //抛出参数错误异常
            throw new IllegalArgumentException("m3AccountType is not exist");
        }
    }