fix():增加支付字典枚举类
parent
fed1249f57
commit
b0a2b59e87
|
@ -0,0 +1,39 @@
|
||||||
|
package com.muyu.common.core.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum SysPayType {
|
||||||
|
|
||||||
|
ALPAY("aliPay","支付宝"),
|
||||||
|
WECHATPAY("wechatPay","微信支付"),
|
||||||
|
JDPAY("jdPay","京东支付");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String info;
|
||||||
|
|
||||||
|
SysPayType(String code,String info){
|
||||||
|
this.code=code;
|
||||||
|
this.info=info;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isCode(String code){
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.map(SysPayType::getCode)
|
||||||
|
.anyMatch(s->s.equals(code));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getInfoByCode(String code){
|
||||||
|
return Arrays.stream(values())
|
||||||
|
.filter(s->s.getCode().equals(code))
|
||||||
|
.findFirst()
|
||||||
|
.map(SysPayType::getInfo)
|
||||||
|
.orElseGet(()->"没有该渠道商");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue