shikeying
2024-01-11 3b67e947e36133e2a40eb2737b15ea375e157ea0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package com.walker.pay;
 
/**
 * 付款来源。
 * @author 时克英
 * @date 2023-01-12
 */
public enum PayFrom {
 
    Bank {
        public int getIndex(){
            return INDEX_BANK;
        }
        public String getName(){
            return NAME_BANK;
        }
    },
    AccountBalance {
        public int getIndex(){
            return INDEX_ACCOUNT_BALANCE;
        }
        public String getName(){
            return NAME_ACCOUNT_BALANCE;
        }
    },
    Credit {
        public int getIndex(){
            return INDEX_CREDIT;
        }
        public String getName(){
            return NAME_CREDIT;
        }
    },
    TokenMoney {
        public int getIndex(){
            return INDEX_TOKEN_MONEY;
        }
        public String getName(){
            return NAME_TOKEN_MONEY;
        }
    },
    Other {
        public int getIndex(){
            return INDEX_OTHER;
        }
        public String getName(){
            return NAME_OTHER;
        }
    };
 
    public int getIndex(){
        throw new AbstractMethodError();
    }
    public String getName(){
        throw new AbstractMethodError();
    }
 
    public static final PayFrom getType(int index){
        if(index == INDEX_BANK){
            return Bank;
        } else if(index == INDEX_ACCOUNT_BALANCE){
            return AccountBalance;
        } else if(index == INDEX_CREDIT){
            return Credit;
        } else if(index == INDEX_TOKEN_MONEY){
            return TokenMoney;
        } else if(index == INDEX_OTHER){
            return Other;
        } else {
            throw new UnsupportedOperationException("不支持的付款来源:" + index);
        }
    }
 
    public static final int INDEX_BANK = 0;
    public static final int INDEX_ACCOUNT_BALANCE = 1;
    public static final int INDEX_CREDIT = 2;
    public static final int INDEX_TOKEN_MONEY = 3;
    public static final int INDEX_OTHER = 9;
 
    public static final String NAME_BANK = "银行卡";
    public static final String NAME_ACCOUNT_BALANCE = "账户余额";
    public static final String NAME_CREDIT = "积分";
    public static final String NAME_TOKEN_MONEY = "代币";
    public static final String NAME_OTHER = "其他";
}