Parcourir la source

Merge remote-tracking branch 'origin/master'

Joburgess il y a 5 ans
Parent
commit
92e1f55704

+ 54 - 0
mec-common/common-core/src/main/java/com/ym/mec/common/enums/TransTypeEnum.java

@@ -0,0 +1,54 @@
+package com.ym.mec.common.enums;
+
+import java.util.Arrays;
+
+/**
+ * @program: mec
+ * @description: 提现/充值交易类型
+ * @author: xw
+ * @create: 2019-09-24 16:00
+ */
+public enum TransTypeEnum {
+
+    WECHAT(1, "微信"),
+    ALIPAY(2, "支付宝"),
+    FAST_PAYMENT(3, "快捷支付");
+
+    private Integer code;
+
+    private String description;
+
+    TransTypeEnum(Integer code, String description) {
+        this.code = code;
+        this.description = description;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public void setCode(Integer code) {
+        this.code = code;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    /**
+     * 根据枚举值获取枚举信息
+     *
+     * @param code 枚举值
+     * @return 枚举信息
+     */
+    public static String getDescriptionByCode(Integer code) {
+        return Arrays.stream(TransTypeEnum.values())
+                .filter(billStatusEnum -> billStatusEnum.getCode().equals(code))
+                .findFirst()
+                .map(TransTypeEnum::getDescription).orElse(null);
+    }
+}