package cn.iocoder.yudao.module.aftersales.enums; import cn.iocoder.yudao.framework.common.core.ArrayValuable; import lombok.AllArgsConstructor; import lombok.Getter; import java.util.Arrays; /** * 售后问题根因分类枚举 */ @Getter @AllArgsConstructor public enum AfterSaleRootCauseCategoryEnum implements ArrayValuable { DESIGN(1, "设计缺陷"), MATERIAL(2, "物料缺陷"), PROCESS(3, "工艺缺陷"), ASSEMBLY(4, "装配缺陷"), TRANSPORT(5, "运输损坏"), PACKAGING(6, "包装缺陷"), USAGE(7, "使用不当"), SOFTWARE(8, "软件缺陷"), OTHER(9, "其他"); public static final Integer[] ARRAYS = Arrays.stream(values()).map(AfterSaleRootCauseCategoryEnum::getType).toArray(Integer[]::new); /** * 根因分类 */ private final Integer type; /** * 根因分类名称 */ private final String name; @Override public Integer[] array() { return ARRAYS; } public static String getNameByType(Integer type) { return Arrays.stream(values()) .filter(item -> item.getType().equals(type)) .map(AfterSaleRootCauseCategoryEnum::getName) .findFirst().orElse(null); } }