123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- package com.zanxiang.common.enums;
- /**
- * 支付方式枚举
- *
- * @author xufeng
- * @date 2022/6/9 10:41
- */
- public enum PayWayEnum {
- ALIPAY("Alipay", "支付宝", 1),
- WXPAY("Wxpay", "微信支付", 2),
- UNIONPAY("Unionpay", "银联支付", 3);
- private final String code;
- private final String name;
- private final Integer num;
- PayWayEnum(String code, String name, Integer num) {
- this.code = code;
- this.name = name;
- this.num = num;
- }
- public String getName() {
- return name;
- }
- public String getCode() {
- return code;
- }
- public Integer getNum() {
- return num;
- }
- /**
- * 通过num获取pay code
- *
- * @param num
- * @return code
- */
- public static String getCodeByNum(Integer num) {
- PayWayEnum[] values = PayWayEnum.values();
- for (int i = 0; i < values.length; i++) {
- if (values[i].getNum().equals(num))
- return values[i].getCode();
- }
- return "";
- }
- }
|