From 421481822bff2c52816da34c031176bf85d6fc79 Mon Sep 17 00:00:00 2001 From: CaesarBao <445720029@qq.com> Date: Tue, 27 Feb 2024 11:14:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E6=BA=90=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nanjing/StationParaInfoController.java | 40 ++++++++++++------- .../StationParaInfo/StationParaInfo.html | 2 +- .../com/ruoyi/common/utils/poi/ExcelUtil.java | 1 + 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/StationParaInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/StationParaInfoController.java index 8c91e019..ccc84aaf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/StationParaInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/StationParaInfoController.java @@ -1,8 +1,12 @@ package com.ruoyi.web.controller.nanjing; +import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.common.enums.BusinessType; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.nanjing.domain.TBdSubstation; import com.ruoyi.nanjing.service.ITBdSubstationService; import com.ruoyi.nanjing.service.ITSyTracestateService; @@ -51,16 +55,23 @@ public class StationParaInfoController extends BaseController { String stationCode = request.getParameter("stationCode"); String beginTime = request.getParameter("beginTime"); String endTime = request.getParameter("endTime"); - String s = tracestateService.selectSemi(productBarcode); - if (s==null&& productBarcode.length()!=0){ - System.out.println(productBarcode.length()); - System.out.println("nulllllllllllllllllllllllllllllllllllllllllllllll"); - map.put("SemiBarcode", "qqqqqqqqqqqqqqqqqqqqqqqqqqqq"); + + String s = ""; + if(productBarcode.isEmpty()){ + } - else { - map.put("SemiBarcode", s); - System.out.println("s=="+s); - System.out.println("notnull"); + else{ + s = tracestateService.selectSemi(productBarcode); + if (s==null && productBarcode.length()!=0){ + System.out.println(productBarcode.length()); + System.out.println("nulllllllllllllllllllllllllllllllllllllllllllllll"); + map.put("SemiBarcode", "qqqqqqqqqqqqqqqqqqqqqqqqqqqq"); + } + else { + map.put("SemiBarcode", s); + System.out.println("s=="+s); + System.out.println("notnull"); + } } map.put("beginTime", beginTime); @@ -94,7 +105,6 @@ public class StationParaInfoController extends BaseController { } } - // @RequiresPermissions("nanjing:StationPara:export") // @Log(title = "产品码查询", businessType = BusinessType.EXPORT) @PostMapping("/export") @@ -108,10 +118,12 @@ public class StationParaInfoController extends BaseController { map.put("endTime", null); map.put("semiBarcode", semiBarcode); List list = tracestateService.selectStationPara(map); - for (int i = 0; i < list.size() ; i++) { - System.out.println(list.get(i)); - } +// for (int i = 0; i < list.size() ; i++) { +// System.out.println(list.get(i)); +// } + ExcelUtil util = new ExcelUtil(SysUser.class); + return util.exportExcel(list, "工位参数"); // try { // ByteArrayOutputStream os = new ByteArrayOutputStream(); // ExcelUtil.createWorkBook() @@ -120,6 +132,6 @@ public class StationParaInfoController extends BaseController { // }finally { // // } - return null; + //return null; } } diff --git a/ruoyi-admin/src/main/resources/templates/nanjing/StationParaInfo/StationParaInfo.html b/ruoyi-admin/src/main/resources/templates/nanjing/StationParaInfo/StationParaInfo.html index 34938a5f..71f8b527 100644 --- a/ruoyi-admin/src/main/resources/templates/nanjing/StationParaInfo/StationParaInfo.html +++ b/ruoyi-admin/src/main/resources/templates/nanjing/StationParaInfo/StationParaInfo.html @@ -34,7 +34,7 @@
  •  搜索 - + 导出
  • diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java index fe50c3f8..ca1358a9 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/poi/ExcelUtil.java @@ -887,6 +887,7 @@ public class ExcelUtil */ public void createSheet(double sheetNo, int index) { + this.sheet = wb.createSheet(); this.sheet = wb.createSheet(); this.styles = createStyles(wb); // 设置工作表的名称.