package com.tofly.xrtygis.em;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.util.StringUtils;

/**
 * 数字中文转换
 *
 * @author JF
 */
@Getter
@AllArgsConstructor
public enum NumberChangeEnum {
    /**
     *
     */
    NUMBER_ONE("1", "一"),
    NUMBER_TWO("2", "二"),
    NUMBER_THREE("3", "三"),
    NUMBER_FOUR("4", "四"),
    NUMBER_FIVE("5", "五"),
    NUMBER_SIX("6", "六"),
    NUMBER_SEVEN("7", "七"),
    NUMBER_EIGHT("8", "八"),
    NUMBER_NINE("9", "九"),
    NUMBER_TEN("10", "十");
    /**
     * 编码
     */
    String code;
    /**
     * 内容
     */
    String value;

    public static String getCodeForValue(String code) {
        String path = "";
        if (StringUtils.isEmpty(code)) {
            return path;
        }

        for (NumberChangeEnum e : NumberChangeEnum.values()) {
            if (e.code.equalsIgnoreCase(code)) {
                path = e.value;
                break;
            }
        }
        return path;
    }
}
