xiangpei
5 天以前 b1383a4dcd8c1b228174e28fb8331ee078115cb8
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package cn.lili.modules.lmk.enums.general;
 
import cn.lili.modules.lmk.domain.vo.VideoOption;
import lombok.Getter;
import org.apache.commons.lang3.StringUtils;
 
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
 
/**
 * 视频支持的操作
 *
 * @author:xp
 * @date:2025/5/14 10:30
 */
@Getter
public enum VideoSupportOpEnum {
 
//    UP("UP", "发布"),
    DOWN("DOWN", "下架"),
    DELETE("DELETE", "删除"),
    EDIT("EDIT", "编辑"),
    ;
 
    private final String value;
 
 
    private final String desc;
 
    VideoSupportOpEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }
 
    /**
     * 根据视频状态获取到对应的操作
     *
     * @param status
     * @return
     */
    public static List<VideoOption> getVideoOpByStatus(String status) {
        if (VideoStatusEnum.AUDITING.getValue().equals(status)) {
            return Arrays.asList(new VideoOption(EDIT.value, EDIT.desc), new VideoOption(DELETE.value, DELETE.desc));
        } else if (VideoStatusEnum.DISABLE.getValue().equals(status)) {
            return Arrays.asList(new VideoOption(EDIT.value, EDIT.desc), new VideoOption(DELETE.value, DELETE.desc));
        } else if (VideoStatusEnum.PUBLISHED.getValue().equals(status)) {
            return Arrays.asList(new VideoOption(EDIT.value, EDIT.desc), new VideoOption(DOWN.value, DOWN.desc), new VideoOption(DELETE.value, DELETE.desc));
        } else if (VideoStatusEnum.REJECT.getValue().equals(status)) {
            return Arrays.asList(new VideoOption(EDIT.value, EDIT.desc), new VideoOption(DELETE.value, DELETE.desc));
        }
        return new ArrayList<>();
    }
 
    /**
     * 获取含义
     *
     * @param value
     * @return
     */
    public static String getDescByValue(String value) {
        if (StringUtils.isBlank(value)) {
            return null;
        }
        for (VideoSupportOpEnum e : VideoSupportOpEnum.values()){
            if (value.equals(e.getValue())) {
                return e.getDesc();
            }
        }
        return null;
    }
}