- 原方法
if (docFileName.lastIndexOf("xls") == -1
&& docFileName.lastIndexOf("txt") == -1
&& docFileName.lastIndexOf("csv") == -1) {
log.info(tag + "批付文件类型格式错误");
request.setAttribute(Globals.RES_MSG, "文件类型格式错误!");
return false;
}
- 修改后
if (!docFileName.endsWith("xls")
&& !docFileName.endsWith("txt")
&& !docFileName.endsWith("csv")) {
log.info(tag + "批付文件类型格式错误");
request.setAttribute(Globals.RES_MSG, "文件类型格式错误!");
return false;
}