-
ShiroHttpServletRequest shiroRequest = (ShiroHttpServletRequest) request;
-
CommonsMultipartResolver commonsMultipartResolver =
new
CommonsMultipartResolver();
-
MultipartHttpServletRequest multipartRequest = commonsMultipartResolver.resolveMultipart((HttpServletRequest) shiroRequest.getRequest());
-
-
Iterator<String> itr = multipartRequest.getFileNames();
-
MultipartFile multipartFile =
null
;
-
-
while
(itr.hasNext()) {
-
multipartFile = multipartRequest.getFile(itr.next());
-
String fileRealName = String.valueOf(
new
Date().getTime());
-
fileRealName = fileRealName + FileUtils.getSuffix(multipartFile.getOriginalFilename());
-
-
HSSFWorkbook hssfWorkbook =
new
HSSFWorkbook(multipartFile.getInputStream());
-
// xlsx
-
//XSSFWorkbook xssfWorkbook = new XSSFWorkbook(multipartFile.getInputStream());
-
-
if
(hssfWorkbook !=
null
) {
-
for
(
int
numSheet =
0
; numSheet < hssfWorkbook.getNumberOfSheets(); numSheet++) {
-
HSSFSheet hssfSheet = hssfWorkbook.getSheetAt(numSheet);
-
// xlsx
-
//XSSFSheet xssfSheet = xssfWorkbook.getSheetAt(numSheet);
-
-
// 循环行Row
-
for
(
int
rowNum =
0
; rowNum <= hssfSheet.getLastRowNum(); rowNum++) {
-
if
(rowNum ==
0
) {
-
continue
;
-
}
-
HSSFRow hssfRow = hssfSheet.getRow(rowNum);
-
if
(hssfRow ==
null
|| (hssfRow.getCell(
0
) ==
null
&& hssfRow.getCell(
1
) ==
null
&& hssfRow.getCell(
2
) ==
null
&& hssfRow.getCell(
3
) ==
null
&& hssfRow.getCell(
4
) ==
null
-
&& hssfRow.getCell(
5
) ==
null
&& hssfRow.getCell(
6
) ==
null
&& hssfRow.getCell(
7
) ==
null
&& hssfRow.getCell(
8
) ==
null
&& hssfRow.getCell(
9
) ==
null
)) {
-
continue
;
-
}
-
-
}
-
}
-
}
-
}
-
JSONObject obj =
new
JSONObject();
-
obj.put(
“title”
,
“123123”
);
-
return
obj;
-
}