|
@@ -32,19 +32,19 @@ public class ReadExcelUtils {
|
|
public static Integer textExcel(String filePath) throws IOException {
|
|
public static Integer textExcel(String filePath) throws IOException {
|
|
//判断文件是否存在
|
|
//判断文件是否存在
|
|
if (filePath == null || filePath.equals("")) {
|
|
if (filePath == null || filePath.equals("")) {
|
|
- //return -1;
|
|
|
|
- ThrowException.throwXiaoShiException("文件上传失败,服务器忙请稍后再试!");
|
|
|
|
|
|
+ return -1;
|
|
|
|
+// ThrowException.throwXiaoShiException("文件上传失败,服务器忙请稍后再试!");
|
|
}
|
|
}
|
|
File file = new File(filePath);
|
|
File file = new File(filePath);
|
|
if (!file.exists()) {
|
|
if (!file.exists()) {
|
|
- //return -1;
|
|
|
|
- ThrowException.throwXiaoShiException("文件上传失败,服务器忙请稍后再试!");
|
|
|
|
|
|
+ return -1;
|
|
|
|
+// ThrowException.throwXiaoShiException("文件上传失败,服务器忙请稍后再试!");
|
|
}
|
|
}
|
|
|
|
|
|
// 检测是否为excel文件
|
|
// 检测是否为excel文件
|
|
if (!filePath.endsWith(".xls") && !filePath.endsWith(".xlsx") && !filePath.endsWith(".XLS") && !filePath.endsWith(".XLSX")) {
|
|
if (!filePath.endsWith(".xls") && !filePath.endsWith(".xlsx") && !filePath.endsWith(".XLS") && !filePath.endsWith(".XLSX")) {
|
|
- //return -1;
|
|
|
|
- ThrowException.throwXiaoShiException("请上传Excel文件!");
|
|
|
|
|
|
+ return -1;
|
|
|
|
+// ThrowException.throwXiaoShiException("请上传Excel文件!");
|
|
}
|
|
}
|
|
|
|
|
|
InputStream fis = new FileInputStream(file);
|
|
InputStream fis = new FileInputStream(file);
|
|
@@ -61,14 +61,14 @@ public class ReadExcelUtils {
|
|
//读取总行数
|
|
//读取总行数
|
|
int rows = sheet.getPhysicalNumberOfRows();
|
|
int rows = sheet.getPhysicalNumberOfRows();
|
|
if (rows <= 0) {
|
|
if (rows <= 0) {
|
|
- //return -2;
|
|
|
|
- ThrowException.throwXiaoShiException("文件内容格式不正确!");
|
|
|
|
|
|
+ return -2;
|
|
|
|
+// ThrowException.throwXiaoShiException("文件内容格式不正确!");
|
|
}
|
|
}
|
|
|
|
|
|
Row firstRow = sheet.getRow(0);
|
|
Row firstRow = sheet.getRow(0);
|
|
if (!firstRow.getCell(0).getStringCellValue().equals("公开(公告)号")) {
|
|
if (!firstRow.getCell(0).getStringCellValue().equals("公开(公告)号")) {
|
|
- //return -2;
|
|
|
|
- ThrowException.throwXiaoShiException("文件内容格式不正确!");
|
|
|
|
|
|
+ return -2;
|
|
|
|
+// ThrowException.throwXiaoShiException("文件内容格式不正确!");
|
|
}
|
|
}
|
|
|
|
|
|
//返回文件总行数-1(即专利总数量)
|
|
//返回文件总行数-1(即专利总数量)
|