{"id":507,"date":"2024-09-29T09:04:37","date_gmt":"2024-09-29T01:04:37","guid":{"rendered":"https:\/\/www.xieshuoshuo.top\/?p=507"},"modified":"2025-04-02T09:37:38","modified_gmt":"2025-04-02T01:37:38","slug":"java-excel-import-freight-data-guide","status":"publish","type":"post","link":"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/","title":{"rendered":"Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e"},"content":{"rendered":"\n<p>\u5728\u73b0\u5728\u505a\u7684Java\u9879\u76ee\u4e2d\uff0c\u5b58\u5728\u4e00\u4e2a\u9700\u6c42\uff0c\u5c31\u662f\u5ba2\u6237\u60f3\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e\uff0c\u5f53\u7136\uff0cExcel\u7684\u6a21\u677f\u7531\u6211\u4eec\u63d0\u4f9b\uff0c\u63a5\u4e0b\u6765\u5c31\u603b\u7ed3\u4e00\u4e0b\u600e\u4e48\u64cd\u4f5c\u5427<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. \u5f15\u5165\u4f9d\u8d56<\/h3>\n\n\n\n<p>\u9996\u5148\uff0c\u5728 <code>pom.xml<\/code> \u6587\u4ef6\u4e2d\u6dfb\u52a0 <code>Apache POI<\/code> \u7684\u4f9d\u8d56\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;dependency&gt;\n    &lt;groupId&gt;org.apache.poi&lt;\/groupId&gt;\n    &lt;artifactId&gt;poi-ooxml&lt;\/artifactId&gt;\n    &lt;version&gt;4.1.2&lt;\/version&gt; &lt;!-- \u8bf7\u4f7f\u7528\u5bf9\u5e94\u7684Java\u7248\u672c --&gt;\n    &lt;!-- Java8\u5efa\u8bae\u4f7f\u7528Apache POI\u7248\u672c3.17\u62164.1.2 --&gt;\n&lt;\/dependency&gt;<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.\u5b9a\u4e49DO\u7c7b<\/h3>\n\n\n\n<p>\u9996\u5148\u786e\u8ba4\u5ba2\u6237\u9700\u8981\u5bfc\u5165\u7684\u6570\u636e\u7c7b\u578b\u53ca\u5185\u5bb9\uff0c\u7136\u540e\u5bf9\u5e94\u7684\u6570\u636e\u5e93\u5b57\u6bb5\u53ca\u8868\u7ed3\u6784<br>\u672c\u6b21\u5ba2\u6237\u9700\u8981\u5bfc\u5165\u4ece\u67d0\u5730\u5230\u67d0\u5730\u7684\u9ed8\u8ba4\u8fd0\u8d39\uff0c\u90a3\u81f3\u5c11\u9700\u8981\u8003\u8651\u7701\u3001\u5e02\u3001\u53bf\u53ca\u8fd0\u8d39\u4ef7\u683c\u4e09\u4e2a\u5b57\u6bb5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>public class FreightPriceDO extends BaseDO {\n    \/**\n     * ID\n     *\/\n    private String id;\n    \/**\n     * \u7701\n     *\/\n    private String loadingProvinc;\n    \/**\n     * \u5e02\n     *\/\n    private String loadingCity;\n    \/**\n     * \u53bf\n     *\/\n    private String loadingCount;\n    \/**\n     * \u9ed8\u8ba4\u8fd0\u8d39\n     *\/\n    private BigDecimal freight;\n\n   \/\/\u5176\u4ed6\u5b57\u6bb5\n    ...\n\n}<\/code><\/pre>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>\u90a3\u4e48\u5bfc\u5165\u7684Excel\u4e5f\u5fc5\u987b\u5305\u542b\u7701\u3001\u5e02\u3001\u53bf\u3001\u8fd0\u8d39\u4ef7\u683c\u8fd9\u4e9b\u6570\u636e<\/p>\n<\/blockquote>\n\n\n\n<h3 class=\"wp-block-heading\">3. \u5b9e\u73b0 Excel \u5bfc\u5165\u529f\u80fd<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Service \u5c42\u5b9e\u73b0<\/h4>\n\n\n\n<p>\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65b9\u6cd5\u6765\u8bfb\u53d6 Excel \u6587\u4ef6\u4e2d\u7684\u6570\u636e\u5e76\u5c06\u5176\u4fdd\u5b58\u5230\u6570\u636e\u5e93\u4e2d\u3002\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    @Override\n    @Transactional\n    public void importFreightData(MultipartFile file) {\n        List&lt;FreightDO&gt; freightsToInsert = new ArrayList&lt;&gt;();\n\n        try (Workbook workbook = new XSSFWorkbook(file.getInputStream())) {\n            Sheet sheet = workbook.getSheetAt(0);\n            if (sheet == null || sheet.getPhysicalNumberOfRows() &lt;= 1) {\n                throw new RuntimeException(\"Excel\u4e2d\u65e0\u6570\u636e\");\n            }\n\n            List&lt;FreightDO&gt; existingFreights = freightMapper.selectList(null);\n            Map&lt;String, FreightDO&gt; existingFreightMap = existingFreights.stream()\n                    .collect(Collectors.toMap(\n                            f -&gt; f.getSupplygoodsSell() + \"|\" + f.getLoadingProvinc() + \"|\" + f.getLoadingCity() + \"|\" + f.getLoadingCount(),\n                            Function.identity(),\n                            (existing, replacement) -&gt; existing \/\/ \u4fdd\u7559\u7b2c\u4e00\u4e2a\u91cd\u590d\u6570\u636e\n                    ));\n\n            for (int i = 1; i &lt;= sheet.getLastRowNum(); i++) {\n                Row row = sheet.getRow(i);\n                if (row == null) continue;\n\n                String supplygoodsSell = getCellStringValue(row.getCell(0));\n                String loadingProvinc = getCellStringValue(row.getCell(1));\n                String loadingCity = getCellStringValue(row.getCell(2));\n                String loadingCount = getCellStringValue(row.getCell(3));\n                BigDecimal freightValue = BigDecimal.valueOf(Double.parseDouble(getCellStringValue(row.getCell(4))));\n\n                if (supplygoodsSell.isEmpty() &amp;&amp; loadingProvinc.isEmpty() &amp;&amp; loadingCity.isEmpty() &amp;&amp; loadingCount.isEmpty()) {\n                    continue;\n                }\n\n                String key = supplygoodsSell + \"|\" + loadingProvinc + \"|\" + loadingCity + \"|\" + loadingCount;\n\n                FreightDO freight = new FreightDO();\n                freight.setId(IdWorker.getIdStr());\n                freight.setSupplygoodsSell(supplygoodsSell);\n                freight.setLoadingProvinc(loadingProvinc);\n                freight.setLoadingCity(loadingCity);\n                freight.setLoadingCount(loadingCount);\n                freight.setFreight(freightValue);\n                freight.setCreateTime(LocalDateTime.now());\n                freight.setUpdateTime(LocalDateTime.now());\n                freight.setCreator(getLoginUserName());\n                freight.setUpdater(getLoginUserName());\n\n                if (existingFreightMap.containsKey(key)) {\n                    FreightDO existingPrice = existingFreightMap.get(key);\n                    existingPrice.setFreight(freight.getFreight());\n                    existingPrice.setUpdateTime(LocalDateTime.now());\n                    existingFreightMap.put(key, existingPrice); \/\/ \u66f4\u65b0Map\u4e2d\u7684\u5bf9\u8c61\n                } else {\n                    existingFreightMap.put(key, freight); \/\/ \u63d2\u5165\u65b0\u7684\u5bf9\u8c61\n                }\n            }\n\n            \/\/ \u8f6c\u6362\u4e3aList\n            freightsToInsert = new ArrayList&lt;&gt;(existingFreightMap.values());\n\n            \/\/ \u5206\u6279\u63d2\u5165\n            batchInsertFreights(freightsToInsert);\n\n        } catch (IOException e) {\n            log.error(\"\u65e0\u6cd5\u4ece Excel \u6587\u4ef6\u5bfc\u5165\u6570\u636e\", e);\n            throw new RuntimeException(\"\u65e0\u6cd5\u4ece Excel \u6587\u4ef6\u5bfc\u5165\u6570\u636e\", e);\n        }\n    }\n\n    private void batchInsertFreights(List&lt;FreightDO&gt; freightsToInsert) {\n        int batchSize = 300;  \/\/ \u6bcf\u6279\u6b21\u5927\u5c0f\n        for (int i = 0; i &lt; freightsToInsert.size(); i += batchSize) {\n            List&lt;FreightDO&gt; batchList = freightsToInsert.subList(i, Math.min(i + batchSize, freightsToInsert.size()));\n            try {\n                freightMapper.batchInsert(batchList);\n                log.info(\"\u6210\u529f\u63d2\u5165\u6279\u6b21 {} - {}\", i, Math.min(i + batchSize, freightsToInsert.size()));\n            } catch (Exception e) {\n                log.error(\"\u63d2\u5165\u6279\u6b21 {} - {} \u65f6\u53d1\u751f\u9519\u8bef: {}\", i, Math.min(i + batchSize, freightsToInsert.size()), e.getMessage());\n                throw new RuntimeException(\"\u6279\u91cf\u63d2\u5165\u6570\u636e\u5931\u8d25\", e);\n            }\n        }\n    }<\/code><\/pre>\n\n\n\n<p>\u6709\u4e9b\u5ba2\u6237\u5728\u5199\u5165Excel\u4e2d\u53ef\u80fd\u6ca1\u6709\u6309\u7167\u8981\u6c42\u7684\u683c\u5f0f\u5199\uff0c\u4f8b\u5982\u8fd0\u8d39\u8981\u6c42\u7684\u662f\u6570\u503c\u7c7b\u578b\uff0c\u4f46\u662f\u5ba2\u6237\u53ef\u80fd\u7c97\u5fc3\u5927\u610f\u5199\u4e86\u6c49\u5b57\uff0c\u90a3\u4e48\u6211\u4eec\u9700\u8981\u8fc7\u6ee4\u4e00\u4e0bExcel\u7684\u6570\u636e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    \/\/ \u8f85\u52a9\u65b9\u6cd5\uff1a\u6839\u636e\u5355\u5143\u683c\u7c7b\u578b\u83b7\u53d6\u5176\u503c\n    private String getCellStringValue(Cell cell) {\n        if (cell == null) return \"\";\n\n        \/\/ \u68c0\u67e5\u5355\u5143\u683c\u7684\u7c7b\u578b\u5e76\u8fdb\u884c\u76f8\u5e94\u5904\u7406\n        if (cell.getCellType() == CellType.STRING) {\n            return cell.getStringCellValue();\n        } else if (cell.getCellType() == CellType.NUMERIC) {\n            \/\/ \u4f7f\u7528 BigDecimal \u6765\u5904\u7406\u6570\u5b57\u683c\u5f0f\n            BigDecimal numericValue = BigDecimal.valueOf(cell.getNumericCellValue());\n\n            \/\/ \u68c0\u67e5\u5c0f\u6570\u90e8\u5206\u662f\u5426\u4e3a0\uff0c\u5982\u679c\u662f\u6574\u6570\uff0c\u5219\u4e0d\u4fdd\u7559\u5c0f\u6570\u70b9\n            if (numericValue.scale() &gt; 0 &amp;&amp; numericValue.stripTrailingZeros().scale() &lt;= 0) {\n                return numericValue.toBigInteger().toString(); \/\/ \u8f6c\u6362\u4e3a\u6574\u6570\u5b57\u7b26\u4e32\n            } else {\n                return numericValue.stripTrailingZeros().toPlainString(); \/\/ \u4fdd\u7559\u975e\u96f6\u5c0f\u6570\n            }\n        } else if (cell.getCellType() == CellType.BOOLEAN) {\n            return String.valueOf(cell.getBooleanCellValue());\n        } else if (cell.getCellType() == CellType.FORMULA) {\n            \/\/ \u5982\u679c\u662f\u516c\u5f0f\uff0c\u53ef\u4ee5\u9009\u62e9\u8ba1\u7b97\u516c\u5f0f\u6216\u83b7\u53d6\u516c\u5f0f\u6587\u672c\n            return cell.getCellFormula();\n        } else {\n            return \"\"; \/\/ \u5904\u7406\u7a7a\u5355\u5143\u683c\u548c\u5176\u4ed6\u7c7b\u578b\n        }\n    }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Mapper \u5c42\u5b9e\u73b0<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\n void batchInsert(@Param(\"list\") List&lt;FreightDO> freights);   \n\n   &lt;insert id=\"batchInsert\" parameterType=\"list\">\n        MERGE INTO FreightPriceDO ft\n        USING (\n        SELECT DISTINCT\n        temp.ID,  temp.LOADINGPROVINC, temp.LOADINGCITY,\n        temp.LOADINGCOUNT, temp.FREIGHT\n        FROM (\n        &lt;foreach collection=\"list\" item=\"item\" separator=\"UNION ALL\">\n            SELECT\n            #{item.id, jdbcType=VARCHAR} as ID,\n            #{item.loadingProvinc, jdbcType=VARCHAR} as LOADINGPROVINC,\n            #{item.loadingCity, jdbcType=VARCHAR} as LOADINGCITY,\n            #{item.loadingCount, jdbcType=VARCHAR} as LOADINGCOUNT,\n            #{item.freight, jdbcType=VARCHAR} as FREIGHT,\n            FROM DUAL\n        &lt;\/foreach>\n        ) temp\n        ) src\n        ON (\n        ft.LOADINGPROVINC = src.LOADINGPROVINC\n        AND ft.LOADINGCITY = src.LOADINGCITY\n        AND ft.LOADINGCOUNT = src.LOADINGCOUNT\n        AND ft.DELETED=0\n        )\n        WHEN MATCHED THEN\n        UPDATE SET\n        ft.FREIGHT = src.FREIGHT,\n        WHEN NOT MATCHED THEN\n        INSERT (ID,  LOADINGPROVINC, LOADINGCITY, LOADINGCOUNT, FREIGHT)\n        VALUES (src.ID, src.LOADINGPROVINC, src.LOADINGCITY, src.LOADINGCOUNT, src.FREIGHT)\n    &lt;\/insert><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. Controller \u5c42\u63a5\u6536 Excel \u6587\u4ef6<\/h3>\n\n\n\n<p>\u521b\u5efa\u4e00\u4e2a\u63a7\u5236\u5668\u65b9\u6cd5\u6765\u63a5\u6536 Excel \u6587\u4ef6\uff0c\u5e76\u8c03\u7528 Service \u5c42\u7684\u5bfc\u5165\u65b9\u6cd5\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>    @PostMapping(\"\/import\")\n    @Operation(summary = \"\u5bfc\u5165\u4ea7\u54c1\u8fd0\u8d39 Excel\")\n    @ApiAccessLog(operateType = EXPORT)\n    public ResponseEntity&lt;String&gt; importFreightData(@RequestParam(\"file\") MultipartFile file) {\n\n        Map&lt;String, Object&gt; response = new HashMap&lt;&gt;();\n        try {\n            freightService.importFreightData(file);\n\n            \/\/ \u8fd4\u56de\u8be6\u7ec6\u7684\u6210\u529f\u6d88\u606f\n            response.put(\"status\", \"success\");\n            response.put(\"message\", \"\u6570\u636e\u5bfc\u5165\u6210\u529f\u3002\");\n            return ResponseEntity.ok(response.toString());\n        } catch (RuntimeException e) {\n            \/\/ \u8fd4\u56de\u8be6\u7ec6\u7684\u8fd0\u884c\u65f6\u5f02\u5e38\u6d88\u606f\n            response.put(\"status\", \"error\");\n            response.put(\"message\", \"\u5f02\u5e38\uff1a\" + e.getMessage());\n            return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response.toString());\n        } catch (Exception e) {\n            \/\/ \u8fd4\u56de\u8be6\u7ec6\u7684\u901a\u7528\u5f02\u5e38\u6d88\u606f\n            response.put(\"status\", \"error\");\n            response.put(\"message\", \"\u5bfc\u5165\u6570\u636e\u5931\u8d25: \" + e.getMessage());\n            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response.toString());\n        }\n    }<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">5.Excel\u6a21\u677f<\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>\u7701<\/td><td>\u5e02<\/td><td>\u53bf<\/td><td>\u8fd0\u8d39<\/td><\/tr><tr><td>\u5317\u4eac\u5e02<\/td><td>\u5317\u4eac\u5e02<\/td><td>\u4e30\u53f0\u533a<\/td><td>20<\/td><\/tr><tr><td>...<\/td><td>...<\/td><td>...<\/td><td>...<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">6. \u6ce8\u610f\u4e8b\u9879<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Excel \u683c\u5f0f<\/strong>\uff1a\u786e\u4fdd\u4e0a\u4f20\u7684 Excel \u6587\u4ef6\u683c\u5f0f\u6b63\u786e\uff0c\u6570\u636e\u4ece\u7b2c\u4e00\u884c\u5f00\u59cb\uff0c\u7b2c\u4e00\u884c\u901a\u5e38\u662f\u6807\u9898\uff0c\u6570\u636e\u4ece\u7b2c\u4e8c\u884c\u5f00\u59cb\u3002<\/li>\n\n\n\n<li><strong>\u6570\u636e\u9a8c\u8bc1<\/strong>\uff1a\u5728\u8bfb\u53d6 Excel \u6587\u4ef6\u65f6\uff0c\u53ef\u4ee5\u6dfb\u52a0\u6570\u636e\u9a8c\u8bc1\u903b\u8f91\uff0c\u4f8b\u5982\u68c0\u67e5\u7a7a\u503c\u3001\u6570\u636e\u683c\u5f0f\u7b49\uff0c\u4ee5\u907f\u514d\u6570\u636e\u5f02\u5e38\u3002<\/li>\n\n\n\n<li><strong>\u5f02\u5e38\u5904\u7406<\/strong>\uff1a\u5728\u8bfb\u53d6\u548c\u5199\u5165\u6570\u636e\u5e93\u7684\u8fc7\u7a0b\u4e2d\uff0c\u6dfb\u52a0\u9002\u5f53\u7684\u5f02\u5e38\u5904\u7406\u903b\u8f91\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u73b0\u5728\u505a\u7684Java\u9879\u76ee\u4e2d\uff0c\u5b58\u5728\u4e00\u4e2a\u9700\u6c42\uff0c\u5c31\u662f\u5ba2\u6237\u60f3\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e\uff0c\u5f53\u7136\uff0cExcel\u7684\u6a21\u677f\u7531\u6211\u4eec\u63d0\u4f9b\uff0c\u63a5\u4e0b\u6765\u5c31\u603b\u7ed3\u4e00\u4e0b\u600e\u4e48\u64cd &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"emotion":"","emotion_color":"","title_style":"","license":"","footnotes":""},"categories":[34],"tags":[],"class_list":["post-507","post","type-post","status-publish","format-standard","hentry","category-java"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e - \u4ed6\u7684\u65e5\u5e38\u65f6\u5149<\/title>\n<meta name=\"description\" content=\"\u672c\u6559\u7a0b\u8be6\u7ec6\u6f14\u793a\u5982\u4f55\u5728 Spring Boot \u9879\u76ee\u4e2d\u901a\u8fc7 Apache POI \u5b9e\u73b0 Excel \u6570\u636e\u5bfc\u5165\u529f\u80fd\uff0c\u91cd\u70b9\u4ecb\u7ecd\u8fd0\u8d39\u6a21\u677f\u7684\u6570\u636e\u5904\u7406\u903b\u8f91\u3002\u5305\u542b\u4f9d\u8d56\u914d\u7f6e\u3001\u6570\u636e\u5b9e\u4f53\u5b9a\u4e49\u3001\u591a\u5c42\u6570\u636e\u6821\u9a8c\u3001\u6279\u91cf\u6570\u636e\u5e93\u64cd\u4f5c\u53ca\u5f02\u5e38\u5904\u7406\u65b9\u6848\uff0c\u786e\u4fdd\u9ad8\u6548\u5b89\u5168\u7684\u6570\u636e\u5bfc\u5165\u6d41\u7a0b\u3002\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e - \u4ed6\u7684\u65e5\u5e38\u65f6\u5149\" \/>\n<meta property=\"og:description\" content=\"\u672c\u6559\u7a0b\u8be6\u7ec6\u6f14\u793a\u5982\u4f55\u5728 Spring Boot \u9879\u76ee\u4e2d\u901a\u8fc7 Apache POI \u5b9e\u73b0 Excel \u6570\u636e\u5bfc\u5165\u529f\u80fd\uff0c\u91cd\u70b9\u4ecb\u7ecd\u8fd0\u8d39\u6a21\u677f\u7684\u6570\u636e\u5904\u7406\u903b\u8f91\u3002\u5305\u542b\u4f9d\u8d56\u914d\u7f6e\u3001\u6570\u636e\u5b9e\u4f53\u5b9a\u4e49\u3001\u591a\u5c42\u6570\u636e\u6821\u9a8c\u3001\u6279\u91cf\u6570\u636e\u5e93\u64cd\u4f5c\u53ca\u5f02\u5e38\u5904\u7406\u65b9\u6848\uff0c\u786e\u4fdd\u9ad8\u6548\u5b89\u5168\u7684\u6570\u636e\u5bfc\u5165\u6d41\u7a0b\u3002\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/\" \/>\n<meta property=\"og:site_name\" content=\"\u4ed6\u7684\u65e5\u5e38\u65f6\u5149\" \/>\n<meta property=\"article:published_time\" content=\"2024-09-29T01:04:37+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-04-02T01:37:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.17ci.com\/wp-content\/uploads\/2023\/12\/1702602409-logoko.png\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"xieshuoshuo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"xieshuoshuo\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.17ci.com\\\/index.php\\\/java-excel-import-freight-data-guide\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.17ci.com\\\/index.php\\\/java-excel-import-freight-data-guide\\\/\"},\"author\":{\"name\":\"xieshuoshuo\",\"@id\":\"https:\\\/\\\/www.17ci.com\\\/#\\\/schema\\\/person\\\/2b6d2c8bdf88e9055aba3abf2f2852b8\"},\"headline\":\"Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e\",\"datePublished\":\"2024-09-29T01:04:37+00:00\",\"dateModified\":\"2025-04-02T01:37:38+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.17ci.com\\\/index.php\\\/java-excel-import-freight-data-guide\\\/\"},\"wordCount\":21,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.17ci.com\\\/#\\\/schema\\\/person\\\/2b6d2c8bdf88e9055aba3abf2f2852b8\"},\"articleSection\":[\"Java\"],\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.17ci.com\\\/index.php\\\/java-excel-import-freight-data-guide\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.17ci.com\\\/index.php\\\/java-excel-import-freight-data-guide\\\/\",\"url\":\"https:\\\/\\\/www.17ci.com\\\/index.php\\\/java-excel-import-freight-data-guide\\\/\",\"name\":\"Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e - \u4ed6\u7684\u65e5\u5e38\u65f6\u5149\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.17ci.com\\\/#website\"},\"datePublished\":\"2024-09-29T01:04:37+00:00\",\"dateModified\":\"2025-04-02T01:37:38+00:00\",\"description\":\"\u672c\u6559\u7a0b\u8be6\u7ec6\u6f14\u793a\u5982\u4f55\u5728 Spring Boot \u9879\u76ee\u4e2d\u901a\u8fc7 Apache POI \u5b9e\u73b0 Excel \u6570\u636e\u5bfc\u5165\u529f\u80fd\uff0c\u91cd\u70b9\u4ecb\u7ecd\u8fd0\u8d39\u6a21\u677f\u7684\u6570\u636e\u5904\u7406\u903b\u8f91\u3002\u5305\u542b\u4f9d\u8d56\u914d\u7f6e\u3001\u6570\u636e\u5b9e\u4f53\u5b9a\u4e49\u3001\u591a\u5c42\u6570\u636e\u6821\u9a8c\u3001\u6279\u91cf\u6570\u636e\u5e93\u64cd\u4f5c\u53ca\u5f02\u5e38\u5904\u7406\u65b9\u6848\uff0c\u786e\u4fdd\u9ad8\u6548\u5b89\u5168\u7684\u6570\u636e\u5bfc\u5165\u6d41\u7a0b\u3002\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.17ci.com\\\/index.php\\\/java-excel-import-freight-data-guide\\\/#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.17ci.com\\\/index.php\\\/java-excel-import-freight-data-guide\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.17ci.com\\\/index.php\\\/java-excel-import-freight-data-guide\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\\\/\\\/www.17ci.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.17ci.com\\\/#website\",\"url\":\"https:\\\/\\\/www.17ci.com\\\/\",\"name\":\"\u4ed6\u7684\u65e5\u5e38\u65f6\u5149\",\"description\":\"\u832b\u832b\u4eba\u751f\uff0c\u597d\u50cf\u8352\u91ce...\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.17ci.com\\\/#\\\/schema\\\/person\\\/2b6d2c8bdf88e9055aba3abf2f2852b8\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.17ci.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-Hans\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.17ci.com\\\/#\\\/schema\\\/person\\\/2b6d2c8bdf88e9055aba3abf2f2852b8\",\"name\":\"xieshuoshuo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\\\/\\\/www.17ci.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/1702602405-avatar.jpg\",\"url\":\"https:\\\/\\\/www.17ci.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/1702602405-avatar.jpg\",\"contentUrl\":\"https:\\\/\\\/www.17ci.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/1702602405-avatar.jpg\",\"width\":1619,\"height\":1619,\"caption\":\"xieshuoshuo\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.17ci.com\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/1702602405-avatar.jpg\"},\"description\":\"\u8fd9\u662f\u4e00\u4e2a\u795e\u79d8\u4eba\u58eb\uff0c\u6216\u8bb8\u7528\u6307\u5b9a\u7684\u65b9\u5f0f\u53ef\u4ee5\u8054\u7cfb\u5230......\",\"sameAs\":[\"https:\\\/\\\/www.17ci.com\"],\"url\":\"https:\\\/\\\/www.17ci.com\\\/index.php\\\/author\\\/xieshuoshuo\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e - \u4ed6\u7684\u65e5\u5e38\u65f6\u5149","description":"\u672c\u6559\u7a0b\u8be6\u7ec6\u6f14\u793a\u5982\u4f55\u5728 Spring Boot \u9879\u76ee\u4e2d\u901a\u8fc7 Apache POI \u5b9e\u73b0 Excel \u6570\u636e\u5bfc\u5165\u529f\u80fd\uff0c\u91cd\u70b9\u4ecb\u7ecd\u8fd0\u8d39\u6a21\u677f\u7684\u6570\u636e\u5904\u7406\u903b\u8f91\u3002\u5305\u542b\u4f9d\u8d56\u914d\u7f6e\u3001\u6570\u636e\u5b9e\u4f53\u5b9a\u4e49\u3001\u591a\u5c42\u6570\u636e\u6821\u9a8c\u3001\u6279\u91cf\u6570\u636e\u5e93\u64cd\u4f5c\u53ca\u5f02\u5e38\u5904\u7406\u65b9\u6848\uff0c\u786e\u4fdd\u9ad8\u6548\u5b89\u5168\u7684\u6570\u636e\u5bfc\u5165\u6d41\u7a0b\u3002","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/","og_locale":"zh_CN","og_type":"article","og_title":"Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e - \u4ed6\u7684\u65e5\u5e38\u65f6\u5149","og_description":"\u672c\u6559\u7a0b\u8be6\u7ec6\u6f14\u793a\u5982\u4f55\u5728 Spring Boot \u9879\u76ee\u4e2d\u901a\u8fc7 Apache POI \u5b9e\u73b0 Excel \u6570\u636e\u5bfc\u5165\u529f\u80fd\uff0c\u91cd\u70b9\u4ecb\u7ecd\u8fd0\u8d39\u6a21\u677f\u7684\u6570\u636e\u5904\u7406\u903b\u8f91\u3002\u5305\u542b\u4f9d\u8d56\u914d\u7f6e\u3001\u6570\u636e\u5b9e\u4f53\u5b9a\u4e49\u3001\u591a\u5c42\u6570\u636e\u6821\u9a8c\u3001\u6279\u91cf\u6570\u636e\u5e93\u64cd\u4f5c\u53ca\u5f02\u5e38\u5904\u7406\u65b9\u6848\uff0c\u786e\u4fdd\u9ad8\u6548\u5b89\u5168\u7684\u6570\u636e\u5bfc\u5165\u6d41\u7a0b\u3002","og_url":"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/","og_site_name":"\u4ed6\u7684\u65e5\u5e38\u65f6\u5149","article_published_time":"2024-09-29T01:04:37+00:00","article_modified_time":"2025-04-02T01:37:38+00:00","og_image":[{"width":400,"height":400,"url":"https:\/\/www.17ci.com\/wp-content\/uploads\/2023\/12\/1702602409-logoko.png","type":"image\/png"}],"author":"xieshuoshuo","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"xieshuoshuo","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/#article","isPartOf":{"@id":"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/"},"author":{"name":"xieshuoshuo","@id":"https:\/\/www.17ci.com\/#\/schema\/person\/2b6d2c8bdf88e9055aba3abf2f2852b8"},"headline":"Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e","datePublished":"2024-09-29T01:04:37+00:00","dateModified":"2025-04-02T01:37:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/"},"wordCount":21,"commentCount":0,"publisher":{"@id":"https:\/\/www.17ci.com\/#\/schema\/person\/2b6d2c8bdf88e9055aba3abf2f2852b8"},"articleSection":["Java"],"inLanguage":"zh-Hans","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/","url":"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/","name":"Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e - \u4ed6\u7684\u65e5\u5e38\u65f6\u5149","isPartOf":{"@id":"https:\/\/www.17ci.com\/#website"},"datePublished":"2024-09-29T01:04:37+00:00","dateModified":"2025-04-02T01:37:38+00:00","description":"\u672c\u6559\u7a0b\u8be6\u7ec6\u6f14\u793a\u5982\u4f55\u5728 Spring Boot \u9879\u76ee\u4e2d\u901a\u8fc7 Apache POI \u5b9e\u73b0 Excel \u6570\u636e\u5bfc\u5165\u529f\u80fd\uff0c\u91cd\u70b9\u4ecb\u7ecd\u8fd0\u8d39\u6a21\u677f\u7684\u6570\u636e\u5904\u7406\u903b\u8f91\u3002\u5305\u542b\u4f9d\u8d56\u914d\u7f6e\u3001\u6570\u636e\u5b9e\u4f53\u5b9a\u4e49\u3001\u591a\u5c42\u6570\u636e\u6821\u9a8c\u3001\u6279\u91cf\u6570\u636e\u5e93\u64cd\u4f5c\u53ca\u5f02\u5e38\u5904\u7406\u65b9\u6848\uff0c\u786e\u4fdd\u9ad8\u6548\u5b89\u5168\u7684\u6570\u636e\u5bfc\u5165\u6d41\u7a0b\u3002","breadcrumb":{"@id":"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.17ci.com\/index.php\/java-excel-import-freight-data-guide\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.17ci.com\/"},{"@type":"ListItem","position":2,"name":"Java\u4ee3\u7801\u5b9e\u73b0Excel\u5bfc\u5165\u6570\u636e"}]},{"@type":"WebSite","@id":"https:\/\/www.17ci.com\/#website","url":"https:\/\/www.17ci.com\/","name":"\u4ed6\u7684\u65e5\u5e38\u65f6\u5149","description":"\u832b\u832b\u4eba\u751f\uff0c\u597d\u50cf\u8352\u91ce...","publisher":{"@id":"https:\/\/www.17ci.com\/#\/schema\/person\/2b6d2c8bdf88e9055aba3abf2f2852b8"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.17ci.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-Hans"},{"@type":["Person","Organization"],"@id":"https:\/\/www.17ci.com\/#\/schema\/person\/2b6d2c8bdf88e9055aba3abf2f2852b8","name":"xieshuoshuo","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.17ci.com\/wp-content\/uploads\/2023\/12\/1702602405-avatar.jpg","url":"https:\/\/www.17ci.com\/wp-content\/uploads\/2023\/12\/1702602405-avatar.jpg","contentUrl":"https:\/\/www.17ci.com\/wp-content\/uploads\/2023\/12\/1702602405-avatar.jpg","width":1619,"height":1619,"caption":"xieshuoshuo"},"logo":{"@id":"https:\/\/www.17ci.com\/wp-content\/uploads\/2023\/12\/1702602405-avatar.jpg"},"description":"\u8fd9\u662f\u4e00\u4e2a\u795e\u79d8\u4eba\u58eb\uff0c\u6216\u8bb8\u7528\u6307\u5b9a\u7684\u65b9\u5f0f\u53ef\u4ee5\u8054\u7cfb\u5230......","sameAs":["https:\/\/www.17ci.com"],"url":"https:\/\/www.17ci.com\/index.php\/author\/xieshuoshuo\/"}]}},"_links":{"self":[{"href":"https:\/\/www.17ci.com\/index.php\/wp-json\/wp\/v2\/posts\/507","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.17ci.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.17ci.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.17ci.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.17ci.com\/index.php\/wp-json\/wp\/v2\/comments?post=507"}],"version-history":[{"count":2,"href":"https:\/\/www.17ci.com\/index.php\/wp-json\/wp\/v2\/posts\/507\/revisions"}],"predecessor-version":[{"id":509,"href":"https:\/\/www.17ci.com\/index.php\/wp-json\/wp\/v2\/posts\/507\/revisions\/509"}],"wp:attachment":[{"href":"https:\/\/www.17ci.com\/index.php\/wp-json\/wp\/v2\/media?parent=507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.17ci.com\/index.php\/wp-json\/wp\/v2\/categories?post=507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.17ci.com\/index.php\/wp-json\/wp\/v2\/tags?post=507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}