yangys
2024-05-11 522dafb06be3374f27d087c370bcf06027e0f1cc
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
package com.qianwen.smartman.modules.mdc.enums;
 
import java.util.stream.Stream;
 
/**
 * 反馈状态
 */
public enum FeedbackStatus {
    WAIT_SYNC("待执行", 1),
    SYNCING("执行中", 2),
    SYNCED("执行完成", 3);
    
    private final String name;
    private final Integer value;
 
    FeedbackStatus(String name, int value) {
        this.name = name;
        this.value = Integer.valueOf(value);
    }
 
    public Integer getValue() {
        return this.value;
    }
 
    public String getName() {
        return this.name;
    }
 
    public FeedbackStatus of(final Integer value) {
        if (value == null) {
            return null;
        }
        
        return Stream.<FeedbackStatus>of(values()).filter(item -> (item.getValue().intValue() == value.intValue())).findFirst().orElse(null);
        /*
        return (FeedbackStatus) Stream.of((Object[]) values()).filter(item -> {
            return item.getValue().intValue() == value.intValue();
        }).findFirst().orElse(null);*/
    }
}