|
@@ -25,10 +25,10 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
-import cn.com.qmth.stmms.common.annotation.ExcelField;
|
|
|
-
|
|
|
import com.google.common.collect.Lists;
|
|
|
|
|
|
+import cn.com.qmth.stmms.common.annotation.ExcelField;
|
|
|
+
|
|
|
/**
|
|
|
* 导入Excel文件(支持“XLS”和“XLSX”格式)
|
|
|
*
|
|
@@ -126,8 +126,8 @@ public class ImportExcel {
|
|
|
* @throws InvalidFormatException
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- public ImportExcel(MultipartFile multipartFile, int headerNum, int sheetIndex) throws InvalidFormatException,
|
|
|
- IOException {
|
|
|
+ public ImportExcel(MultipartFile multipartFile, int headerNum, int sheetIndex)
|
|
|
+ throws InvalidFormatException, IOException {
|
|
|
this(multipartFile.getOriginalFilename(), multipartFile.getInputStream(), headerNum, sheetIndex);
|
|
|
}
|
|
|
|
|
@@ -143,8 +143,8 @@ public class ImportExcel {
|
|
|
* @throws InvalidFormatException
|
|
|
* @throws IOException
|
|
|
*/
|
|
|
- public ImportExcel(String fileName, InputStream is, int headerNum, int sheetIndex) throws InvalidFormatException,
|
|
|
- IOException {
|
|
|
+ public ImportExcel(String fileName, InputStream is, int headerNum, int sheetIndex)
|
|
|
+ throws InvalidFormatException, IOException {
|
|
|
if (StringUtils.isBlank(fileName)) {
|
|
|
throw new RuntimeException("导入文档为空!");
|
|
|
} else if (fileName.toLowerCase().endsWith("xls")) {
|
|
@@ -353,11 +353,8 @@ public class ImportExcel {
|
|
|
val = ef.fieldType().getMethod("getValue", String.class).invoke(null, val.toString());
|
|
|
} else {
|
|
|
val = Class
|
|
|
- .forName(
|
|
|
- this.getClass()
|
|
|
- .getName()
|
|
|
- .replaceAll(this.getClass().getSimpleName(),
|
|
|
- "fieldtype." + valType.getSimpleName() + "Type"))
|
|
|
+ .forName(this.getClass().getName().replaceAll(this.getClass().getSimpleName(),
|
|
|
+ "fieldtype." + valType.getSimpleName() + "Type"))
|
|
|
.getMethod("getValue", String.class).invoke(null, val.toString());
|
|
|
}
|
|
|
}
|