CustomerFollowTypeEnum.java 1.54 KB
package cn.fw.valhalla.sdk.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.Getter;

/**
 * @author : kurisu
 * @className : CustomerFollowTypeEnum
 * @description : 跟进类型
 * @date: 2022-01-10 17:37
 */
public enum CustomerFollowTypeEnum {
    /**
     * 例保
     */
    RM(2, "流失客户"),
    /**
     * 续保
     */
    IR(4, "续保"),
    ;

    /**
     * 值
     */
    private final Integer value;
    /**
     * 名称
     */
    @Getter
    private final String name;

    CustomerFollowTypeEnum(final Integer value, final String name) {
        this.value = value;
        this.name = name;
    }

    /**
     * 根据枚举值获取枚举对象
     */
    @JsonCreator
    public static CustomerFollowTypeEnum ofValue(final Integer value) {
        for (final CustomerFollowTypeEnum typeEnum : CustomerFollowTypeEnum.values()) {
            if (typeEnum.value.equals(value)) {
                return typeEnum;
            }
        }
        return null;
    }

    /**
     * 获取描述
     *
     * @return 值
     */
    @JsonCreator
    public static String getNameByVale(final Integer value) {
        for (final CustomerFollowTypeEnum typeEnum : CustomerFollowTypeEnum.values()) {
            if (typeEnum.value.equals(value)) {
                return typeEnum.getName();
            }
        }
        return "";
    }

    /**
     * 获取值
     *
     * @return 值
     */
    @JsonValue
    public Integer getValue() {
        return value;
    }
}