From 87a176aeb012db154a1b392db8be8877a43ffd9c Mon Sep 17 00:00:00 2001 From: zch Date: Tue, 18 Feb 2025 11:37:45 +0800 Subject: [PATCH] =?UTF-8?q?refactor(nanjing):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=97=B6=E6=AE=B5=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 调整时间输入框样式和布局 - 添加 laydate 日期选择器 - 修改导出按钮位置 - 优化导出功能,调整线程池配置 - 更新错误提示信息 - 移除冗余代码和注释 --- .../nanjing/SelectProRpListController.java | 27 +++++++-------- .../nanjing/ProRpList/SelectProRpList.html | 33 ++++++++++++++----- .../mapper/nanjing/TSyTracestateMapper.xml | 3 -- 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/SelectProRpListController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/SelectProRpListController.java index fefae028..f25f1def 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/SelectProRpListController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/nanjing/SelectProRpListController.java @@ -29,10 +29,6 @@ import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.utils.DateUtils; -import com.ruoyi.common.config.Global; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; /** * 时段统计 @@ -114,16 +110,15 @@ public class SelectProRpListController extends BaseController public AjaxResult export(ProRpList proRpList) { Map map = new HashMap<>(); - map.put("beginTime", proRpList.getParams().get("startTime")); - map.put("startTime", proRpList.getParams().get("startTime")); - map.put("endTime", proRpList.getParams().get("endTime")); - - map.put("productId", proRpList.getProductID()); - map.put("productType", proRpList.getProductType()); - map.put("state", proRpList.getState()); - map.put("semiBarcode", proRpList.getSemiBarcode()); + map.put("beginTime", proRpList.getParams().get("beginTime")); + map.put("endTime", proRpList.getParams().get("endTime")); TSyTracestate tSyTracestate = new TSyTracestate(); + + tSyTracestate.setProductID(proRpList.getProductID()); + tSyTracestate.setState(proRpList.getState()); + tSyTracestate.setBarcode(proRpList.getSemiBarcode()); + tSyTracestate.setParams(map); // 获取TSyTracestate列表 List list = tracestateService.selectTSyTracestateList(tSyTracestate); @@ -133,7 +128,7 @@ public class SelectProRpListController extends BaseController .collect(Collectors.toList()); // 优化线程池配置 - int BATCH_SIZE = 500; // 每批处理500条记录 + int BATCH_SIZE = 1600; // 每批处理1600条记录 // 计算最优线程数 int CPU_CORES = Runtime.getRuntime().availableProcessors(); @@ -141,7 +136,6 @@ public class SelectProRpListController extends BaseController Math.max(CPU_CORES / 4, 4), // CPU核心数的1/4,但不少于4个线程 8 // 最大不超过8个线程 ); - // 线程池配置 ThreadPoolExecutor executorService = new ThreadPoolExecutor( OPTIMAL_THREADS, // 核心线程数 @@ -177,7 +171,7 @@ public class SelectProRpListController extends BaseController } // 优化7:检查是否有足够的数据 if (printInfo.isEmpty()) { - return AjaxResult.error("未能成功获取数据,请重试或减少数据量"); + return AjaxResult.error("未能成功获取数据,请重试或减少数据量,或者该段时间无数据"); } // 创建 ExcelUtil 实例 @@ -186,7 +180,8 @@ public class SelectProRpListController extends BaseController Map> sheetDataMap = new HashMap<>(); sheetDataMap.put("时段查询", list); sheetDataMap.put("工位数据", printInfo); - String fileName = "data_" + DateUtils.dateTimeNow() + ".xlsx"; + String fileName = DateUtils.dateTimeNow() + ".xlsx"; + return excelUtil.exportMultiSheet(sheetDataMap, fileName); } catch (Exception e) { diff --git a/ruoyi-admin/src/main/resources/templates/nanjing/ProRpList/SelectProRpList.html b/ruoyi-admin/src/main/resources/templates/nanjing/ProRpList/SelectProRpList.html index 1fb0cbf3..0e8909c3 100644 --- a/ruoyi-admin/src/main/resources/templates/nanjing/ProRpList/SelectProRpList.html +++ b/ruoyi-admin/src/main/resources/templates/nanjing/ProRpList/SelectProRpList.html @@ -12,10 +12,10 @@
  • - - + + - - +
  • @@ -48,18 +48,16 @@
  •  搜索 - + + 导出 + +
-
@@ -213,6 +211,23 @@ } }); } + $(function(){ + + layui.use('laydate', function(){ + var laydate = layui.laydate; + laydate.render({ + elem: '#beginTime', + type: 'datetime', + trigger: 'click' + }); + laydate.render({ + elem: '#endTime', + type: 'datetime', + trigger: 'click' + }); + + }); + }); diff --git a/ruoyi-system/src/main/resources/mapper/nanjing/TSyTracestateMapper.xml b/ruoyi-system/src/main/resources/mapper/nanjing/TSyTracestateMapper.xml index c0b7a54f..6f740960 100644 --- a/ruoyi-system/src/main/resources/mapper/nanjing/TSyTracestateMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/nanjing/TSyTracestateMapper.xml @@ -139,9 +139,6 @@ and datediff(dd,#{params.beginTime},t1.beginTime)>= 0 - - and datediff(dd,#{params.startTime},t1.beginTime)>= 0 - and datediff(dd,t1.beginTime,#{params.endTime})>= 0