All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.dahuatech.icc.brm.enums.CarBrandEnum Maven / Gradle / Ivy

There is a newer version: 1.0.13.7
Show newest version
package com.dahuatech.icc.brm.enums;


import java.util.ArrayList;
import java.util.List;

/**
 * 车辆品牌
 */
public enum CarBrandEnum {

//1	奥迪
//2	本田
//3	别克
//4	大众
//5	丰田
//6	宝马
//7	标致
//8	福特
//9	马自达
//10	尼桑
//11	现代
//12	铃木
//13	雪铁龙
//14	奔驰
//15	比亚迪
//16	吉利
//17	雷克萨斯
//18	雪佛兰
//19	奇瑞
//20	起亚
//21	夏利
//22	东风
//23	依维柯
//24	五菱
//25	金杯
//26	保时捷
//27	法拉利
//28	兰博基尼
//999	其他

    AUDI("1", "audi","奥迪"),
    HONDA("2", "honda","本田"),
    BUICK("3", "buick","别克"),
    PEOPLE("4", "people","大众"),
    TOYOTA("5", "toyota","丰田"),
    BMW("6", "bmw","宝马"),
    PRETTY("7", "pretty","标致"),
    FORD("8", "ford","福特"),
    MAZDA("9", "mazda","马自达"),
    NISSAN("10", "nissan","尼桑"),
    MODERN("11", "modern","现代"),
    SUZUKI("12", "suzuki","铃木"),
    CITROEN("13", "citroen","雪铁龙"),
    BENZ("14", "benz","奔驰"),
    BYD("15", "byd","比亚迪"),
    LUCKY("16", "lucky","吉利"),
    LEXUS("17", "lexus","雷克萨斯"),
    CHEVY("18", "chevy","雪佛兰"),
    CHERY("19", "chery","奇瑞"),
    KLA("20", "kla","起亚"),
    CHARADE("21", "charade","夏利"),
    EAST_WIND("22", "east_wind","东风"),
    LVECO("23", "lveco","依维柯"),
    FIVE("24", "five","五菱"),
    GOLDEN("25", "golden","金杯"),
    PORSCHE("26", "porsche","保时捷"),
    FERRARI("27", "ferrari","法拉利"),
    LAMBORGHINI("28", "lamborghini","兰博基尼"),
    UNKNOWN("0", "unknown","未识别"),
    OTHER("-1", "other","其他"),
    ;

    private String id;

    private String type;

    private String typeCN;

    CarBrandEnum(String id, String type,String typeCN) {
        this.id = id;
        this.type = type;
        this.typeCN = typeCN;
    }

    public String getId() {
        return id;
    }

    public String getType() {
        return type;
    }

    public String getTypeCN() {
        return typeCN;
    }

    public static String getTypeById(String id) {
        for(CarBrandEnum colorEnum : CarBrandEnum.values()) {
            if(colorEnum.getId().equals(id)) {
                return colorEnum.getType();
            }
        }

        return null;
    }

    public static String getTypeById(String id,String language) {
        for(CarBrandEnum colorEnum : CarBrandEnum.values()) {
            if(colorEnum.getId().equals(id)) {
                if("zh-cn".equals(language)) {
                    return colorEnum.getTypeCN();
                }else {
                    return colorEnum.getType();
                }
            }
        }

        return null;
    }

    public static String getIdByType(String type) {
        for (CarBrandEnum carBrandEnum : CarBrandEnum.values()) {
            if (carBrandEnum.getTypeCN().equals(type) || carBrandEnum.getType().equals(type)) {
                return carBrandEnum.getId();
            }
        }
        return null;
    }

    public static List getTypeListByIds(List ids) {
        if(ids == null || ids.size() == 0){
            return null;
        }

        List result = new ArrayList<>();
        for(String id : ids) {
            String type = CarBrandEnum.getTypeById(id);
            if(type != null && type.length() > 0) {
                result.add(type);
            }
        }

        return result;
    }

    public static List getAllTypes(){
        List typeList = new ArrayList<>();
        for(CarBrandEnum brandEnum : CarBrandEnum.values()) {
            typeList.add(brandEnum.getType());
        }
        return typeList;
    }

    public static List getAllTypesCN(){
        List typeList = new ArrayList<>();
        for(CarBrandEnum brandEnum : CarBrandEnum.values()) {
            typeList.add(brandEnum.getTypeCN());
        }
        return typeList;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy