GroupInfoExcelData.java
1.1 KB
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.taover.bazhuayun.analysis.script.goodscollect;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import com.taover.bazhuayun.analysis.util.ExcelUtil;
public class GroupInfoExcelData {
private GroupInfoExcelDataHeader header;
private List<GroupInfoExcelDataRow> rowList = new ArrayList<GroupInfoExcelDataRow>();
public void load(String groupInfoFilePath) throws Exception {
if(groupInfoFilePath == null) {
throw new Exception("groupInfoFilePath is null");
}
File groupInfoFile = new File(groupInfoFilePath);
if(!groupInfoFile.exists()) {
throw new Exception("groupinfofile not exists");
}
List<List<Object>> data = ExcelUtil.readExcelSheet(groupInfoFile, false);
if(data.size() > 0) {
header = new GroupInfoExcelDataHeader(data.get(0));
}
for(int i=1; i<data.size(); ++i) {
this.rowList.add(new GroupInfoExcelDataRow(this.header, data.get(i)));
}
}
public GroupInfoExcelDataRow findByFileName(String fileName) {
for(GroupInfoExcelDataRow item: rowList) {
if(item.getFilePath().contains(fileName)) {
return item;
}
}
return null;
}
}