ImportValidateTemplate.txt
1.71 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
41
42
43
44
45
46
47
48
49
50
51
package weaver.formmode.interfaces.impl;
import java.util.Map;
import weaver.file.ExcelParseForPOI;
import weaver.formmode.interfaces.ImportPreInterfaceForPOIAction;
import weaver.general.Util;
import weaver.hrm.User;
/**
* 说明
* 修改时
* 类名要与文件名保持一致
* class文件存放位置与路径保持一致。
* 请把编译后的class文件,放在对应的目录中才能生效
* 注意 同一路径下java名不能相同。
* @author Administrator
*
*/
public class ImportValidateTemplate implements ImportPreInterfaceForPOIAction{
@Override
public String checkImportData(Map<String, Object> param, User user, ExcelParseForPOI excelParse) {
// 获取模块ID
Integer modeId = Util.getIntValue(param.get("modeid").toString());
//表单id
Integer formId = Util.getIntValue(param.get("formid").toString());
// 获取当前登录人员ID
Integer userId = user.getUID();
//获取第 sheetindex 个sheet的第row行第col列的单元格的值 (下标都是从1开始)
String value = excelParse.getValue("1", 2, 2);
//日期类型
// String valuedate =excelParse.getDateValue(sheetindex, row, col);
//时间类型
// String valuetime =excelParse.getTimeValue(sheetindex, row, col);
//日期时间类型
// String valuedatetime =excelParse.getDateTimeValue(sheetindex, row, col);
// Cell cell = excelParse.getCell(sheetindex, row, col);
//书写校验逻辑 返回空则表示校验通过,否则验证不通过,不允许导入
if (value.startsWith("测试")) {
return "第一个sheet第一行数据的第2个单元格不允许以[测试]开头";
}
return "";
}
}