123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- package com.zanxiang.common.enums;
- import lombok.Getter;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.stream.Collectors;
- /**
- * 支付设备类型
- *
- * @author xufeng
- * @date 2022/6/16 18:07
- */
- @Getter
- public enum PayDeviceEnum {
- /**
- * Pc端支付
- */
- PC_PAY(1, "pc", "Pc端支付"),
- /**
- * h5支付
- */
- H5_PAY(2, "h5", "Wap端h5支付"),
- /**
- * App支付
- */
- APP_PAY(3, "app", "App支付"),
- /**
- * 小程序支付
- */
- MINI_APP_PAY(4, "mp", "小程序支付"),
- /**
- * 小程序支付
- */
- MI_PAY(5, "miPay", "米大师支付");
- private Integer code;
- private String name;
- private String desc;
- PayDeviceEnum(Integer code, String name, String desc) {
- this.code = code;
- this.name = name;
- this.desc = desc;
- }
- public static String getCodeByNum(Integer code) {
- PayDeviceEnum[] values = PayDeviceEnum.values();
- for (int i = 0; i < values.length; i++) {
- if (values[i].getCode().equals(code)) {
- return values[i].getName();
- }
- }
- return "";
- }
- public static String getDescByNum(Integer code) {
- PayDeviceEnum[] values = PayDeviceEnum.values();
- for (int i = 0; i < values.length; i++) {
- if (values[i].getCode().equals(code)) {
- return values[i].getDesc();
- }
- }
- return "";
- }
- public static String getSqlCode(Integer code) {
- return "," + code + ",";
- }
- public static String getDesc(String obj) {
- List<String> Desc = new ArrayList<>(10);
- String str = obj.substring(1, obj.length() - 1);
- String[] strArr = str.split(",");
- for (int i = 0; i < strArr.length; i++) {
- String name = PayDeviceEnum.getDescByNum(Integer.valueOf(strArr[i]));
- Desc.add(name);
- }
- return Desc.stream().collect(Collectors.joining(","));
- }
- }
|