zhaoxian 1 gadu atpakaļ
vecāks
revīzija
5842c036ae

+ 0 - 5
jeecg-boot-module-system/pom.xml

@@ -148,11 +148,6 @@
 			<version>1.4.2</version>
 		</dependency>
 		<dependency>
-			<groupId>com.monitorjbl</groupId>
-			<artifactId>xlsx-streamer</artifactId>
-			<version>2.2.0</version>
-		</dependency>
-		<dependency>
 			<groupId>org.bytedeco</groupId>
 			<artifactId>javacv-platform</artifactId>
 			<version>1.4.2</version>

+ 0 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/material/controller/FirstDeliveryValidController.java

@@ -45,11 +45,6 @@ public class FirstDeliveryValidController {
             if (Check.isNull(file)) {
                 return Result.error("执行失败,请上传应用Excel文件");
             }
-            String fileName = file.getOriginalFilename();
-            String substring = fileName.substring(fileName.lastIndexOf(".") + 1).toUpperCase();
-            if (!"XLSX".equals(substring)) {
-                return Result.error("请上传正确格式的文件,仅支持扩展名.xlsx");
-            }
             return firstDeliveryValidService.importExcelMaterials(file);
         } catch (Exception e) {
             e.printStackTrace();

+ 2 - 61
jeecg-boot-module-system/src/main/java/cn/com/ctop/toutiao/modules/material/service/impl/FirstDeliveryValidServiceImpl.java

@@ -51,9 +51,8 @@ public class FirstDeliveryValidServiceImpl implements FirstDeliveryValidService
         List<FirstDeliveryValidMaterials> dataList = new ArrayList<>();
         StringBuffer path = new StringBuffer();
         try {
-            path.append(downloadPath).append(DateUtils.getNowDate(DateUtils.SHORT_FORMAT)).append("/").append(UUID.randomUUID().toString()).append("/");
-            log.info("-------下载到服务器地址:{}", path.toString());
-            List<JSONObject> list = this.analysisBIGBIGFile(file, path.toString());
+            String fileName = file.getOriginalFilename();
+            List<JSONObject> list = this.analysisFile(file, fileName);
             LoadFileUtil.delFile(path.toString());
             for (JSONObject object : list) {
                 FirstDeliveryValidMaterials material = new FirstDeliveryValidMaterials(object);
@@ -209,64 +208,6 @@ public class FirstDeliveryValidServiceImpl implements FirstDeliveryValidService
         page.setTotal(total);
         return Result.OK(page);
     }
-
-
-    public List<JSONObject> analysisBIGBIGFile(MultipartFile mfile, String path) throws Exception {
-        InputStream is = null;
-        String newFileUrl = FileUtil.approvalFile(mfile, path);
-        List<JSONObject> list = null;
-        try {
-            File file = new File(newFileUrl);
-            is = new FileInputStream(file);
-            Workbook workbook = StreamingReader.builder()
-                    .rowCacheSize(20000)
-                    .bufferSize(4096)
-                    .open(is);
-            ExportExcelUtils eeu = new ExportExcelUtils();
-            //最后一列(列数)
-            int lastCellNum = 0;
-            // list存储数据集
-            list = new ArrayList<>();
-            for (Sheet sheet : workbook) {
-                // sheet.getLastRowNum()获取最后一个非空行的行下标,比如总行数为n,则返回的为n-1
-                int sumPageNum = (sheet.getLastRowNum() + 1) / 20000 + 1;       //计算分片数
-                for (int i = 1; i <= sumPageNum; i++) {     //读取每片范围内的内容
-                    try {
-                        int minRowNum = 20000 * (i - 1) + 1;    //计算每片读取的行数范围
-                        int maxRowNum = 20000 * i;
-                        for (Row row : sheet) {
-                            if (lastCellNum == 0) {
-                                lastCellNum = row.getLastCellNum();
-                            }
-                            if (row != null) {
-                                Map<String, Object> columnValueMap = new HashMap<>();
-                                if (row.getRowNum() >= minRowNum && row.getRowNum() <= maxRowNum) {//控制每片读取的行
-                                    //每行数据对象,按照顺序从0到(lastCellNum-1)记录
-                                    JSONObject cellEntity = new JSONObject();
-                                    for (int k = 0; k < lastCellNum; k++) {
-                                        cellEntity.put(String.valueOf(k), eeu.getCellValue2(row.getCell(k)));
-                                    }
-                                    list.add(cellEntity);
-                                    if (row.getRowNum() == maxRowNum) {//读取到每片最大行数限制,跳出,执行数据写入
-                                        break;
-                                    }
-                                }
-                            }
-                        }
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                }
-            }
-            workbook.close();
-        } catch (Exception e) {
-            e.printStackTrace();
-        } finally {
-            IOUtils.closeQuietly(is);
-        }
-        return list;
-    }
-
     public static List<JSONObject> analysisFile(MultipartFile file, String fileName) throws Exception {
         JSONObject returnJson = new JSONObject();
         Workbook workbook = null;