liu
22 小时以前 46287520465b5664a1ddb0256537857cfd1cfc15
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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<Integer> {
 
    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);
    }
 
}