广州市综治平台后端
xusd
2025-06-07 36306491396230522fa20585c2621a7fc899849a
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package cn.huge.base.common.constant;
 
/**
 * @title: 附件类型枚举类
 * @description: 附件类型枚举类
 * @company: hugeinfo
 * @author: liyj
 * @time: 2021-11-05 16:51:48
 * @version: 1.0.0
 */
public enum FileCatEnum {
  NULL("22_00017-0","未分类"),
  AUDIO("22_00017-1", "音频"),
  VIDEO("22_00017-2", "视频"),
  IMAGE("22_00017-3", "图片"),
  WORD("22_00017-4", "Word文档"),
  EXCEL("22_00017-5", "Excel表格"),
  PDF("22_00017-6", "PDF"),
  TXT("22_00017-7", "txt文本"),
  ZIP("22_00017--8", "压缩文件"),
  POWERPOINT("22_00017-9", "PowerPoint"),
  UNKNOWN("22_00017-99", "其它文件");
 
  /**
   * 代码编号
   */
  private String index;
 
  /**
   * 名称
   */
  private String des;
 
  public String getIndex() {
    return index;
  }
 
  public void setIndex(String index) {
    this.index = index;
  }
 
  public String getDes() {
    return des;
  }
 
  public void setDes(String des) {
    this.des = des;
  }
 
  /**
   * 构造方法
   * @param index
   * @param des
   */
  FileCatEnum(String index, String des) {
    this.index = index;
    this.des = des;
  }
 
  /**
   * 静态方法
   * @param id
   * @return
   */
  public static FileCatEnum getById(final String index) {
    switch (index) {
      case "22_00017-0":
        return NULL;
      case "22_00017-1":
        return AUDIO;
      case "22_00017-2":
        return VIDEO;
      case "22_00017-3":
        return IMAGE;
      case "22_00017-4":
        return WORD;
      case "22_00017-5":
        return EXCEL;
      case "22_00017-6":
        return PDF;
      case "22_00017-7":
        return TXT;
      case "22_00017-8":
        return ZIP;
      case "22_00017-9":
        return POWERPOINT;
      default:
        return UNKNOWN;
    }
  }
 
  /**
   * 根据后缀获取分类
   * @param suffix 后缀
   * @return String
   */
  public static String getFileCat(String suffix) {
    if (suffix.equalsIgnoreCase(FileConsts.mp3)) {
      return FileCatEnum.AUDIO.getIndex();
    }else if (suffix.equalsIgnoreCase(FileConsts.mp4) ||
            suffix.equalsIgnoreCase(FileConsts.avi) ||
            suffix.equalsIgnoreCase(FileConsts.mp2)) {
      return FileCatEnum.VIDEO.getIndex();
    }else if (suffix.equalsIgnoreCase(FileConsts.gif) ||
            suffix.equalsIgnoreCase(FileConsts.jpeg) ||
            suffix.equalsIgnoreCase(FileConsts.jpg) ||
            suffix.equalsIgnoreCase(FileConsts.png) ||
            suffix.equalsIgnoreCase(FileConsts.bmp)) {
      return FileCatEnum.IMAGE.getIndex();
    }else if (suffix.equalsIgnoreCase(FileConsts.docx) ||
            suffix.equalsIgnoreCase(FileConsts.doc)) {
      return FileCatEnum.WORD.getIndex();
    }else if (suffix.equalsIgnoreCase(FileConsts.xla) ||
            suffix.equalsIgnoreCase(FileConsts.xlc)||
            suffix.equalsIgnoreCase(FileConsts.xlm)||
            suffix.equalsIgnoreCase(FileConsts.xls)||
            suffix.equalsIgnoreCase(FileConsts.xlt)||
            suffix.equalsIgnoreCase(FileConsts.xlw)) {
      return FileCatEnum.EXCEL.getIndex();
    } else if (suffix.equalsIgnoreCase(FileConsts.pptx) ||
            suffix.equalsIgnoreCase(FileConsts.ppt)) {
      return FileCatEnum.POWERPOINT.getIndex();
    }else if (suffix.equalsIgnoreCase(FileConsts.pdf)) {
      return FileCatEnum.PDF.getIndex();
    }else if (suffix.equalsIgnoreCase(FileConsts.zip) ||
            suffix.equalsIgnoreCase(FileConsts.tar)) {
      return FileCatEnum.ZIP.getIndex();
    }else if (suffix.equalsIgnoreCase(FileConsts.txt)) {
      return FileCatEnum.TXT.getIndex();
    }else if (suffix.equalsIgnoreCase(FileConsts.html) ||
            suffix.equalsIgnoreCase(FileConsts.vsd)||
            suffix.equalsIgnoreCase(FileConsts.xml)) {
      return FileCatEnum.UNKNOWN.getIndex();
    }else{
      return  FileCatEnum.NULL.getIndex();
    }
  }
}