Commit da4fa819 by 潘诗林

宁波财资接入优加:添加主体枚举类

1 parent d27e6185
package cn.com.glsx.dj.financial.enums;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
/**
* 宁波银行主体信息枚举
* @author pansl
*/
@Getter
@AllArgsConstructor
public enum NbCbCustEnum {
/**
* 广联主体
*/
GL_CUST(1, "9000919969", "9865fe2c-1ba3-4e9c-af8a-24d2a8e0eafc", "嘀加主账户"),
/**
* 优加主体
*/
YJ_CUST(2, "9002368118", "3b37996d-cdad-4448-b595-74ac5c3c965d", "优加");
/**
* 客户类型
*/
private final Integer custType;
/**
* 客户 ID
*/
private final String custId;
/**
* AppKey
*/
private final String appKey;
/**
* 描述
*/
private final String description;
private static final Map<String, NbCbCustEnum> CUST_MAP = new HashMap<>();
static {
for (NbCbCustEnum item : values()) {
CUST_MAP.put(item.getCustId(), item);
}
}
/**
* 根据客户类型获取枚举
* @param custType 客户类型
* @return NbCbCustEnum
*/
public static NbCbCustEnum getByCustType(Integer custType) {
if (custType == null) {
return null;
}
for (NbCbCustEnum item : values()) {
if (item.custType.equals(custType)) {
return item;
}
}
return null;
}
/**
* 根据客户 ID 获取枚举
* @param custId 客户 ID
* @return NbCbCustEnum
*/
public static String getAppKeyByCustId(String custId) {
if (custId == null || custId.isEmpty()) {
return null;
}
NbCbCustEnum nbCbCustEnum = CUST_MAP.get(custId);
if(Objects.nonNull(nbCbCustEnum)){
return nbCbCustEnum.getAppKey() ;
}
return null;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!