From f9f87648af2a80dd15d0dd711e6a532d0896f94a Mon Sep 17 00:00:00 2001 From: FCL Date: Thu, 25 Dec 2025 14:20:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E6=8A=A5=E5=91=8A=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=BB=84=E8=A3=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReportDocumentDataServiceImpl.java | 27 +++++++++++++------ 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java index 1f73d76..b903881 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataServiceImpl.java @@ -96,7 +96,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService if(!dataListByKey.isEmpty()) dataListGroup.add(dataListByKey); } - if(dataListGroup.isEmpty()) + if(dataListGroup.isEmpty() && !dataList.isEmpty()) dataListGroup.add(dataList); JSONArray rowList = new JSONArray(); for(int i = 0; i < dataListGroup.size(); i++){ @@ -141,7 +141,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService } } //以下为空白 - if(rowList.size() < maxRowCount){ + if(rowList.size() < maxRowCount && !rowList.isEmpty()){ JSONObject t = new JSONObject(); t.put(colPrefix + "01", emptyText); putEmptyData(t, 2,10); @@ -199,7 +199,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService int rowLength = rowList.size(); if(rowLength <= maxRowCount){ pageRowList.add(rowList); - return pageRowList; + return assemblePageResult(mainData, pageRowList, maxRowCount); } JSONArray remainingRows = new JSONArray(); remainingRows.addAll(rowList); @@ -244,18 +244,20 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService if(pageRow.size() < maxRowCount){ JSONObject t = new JSONObject(); t.put(colPrefix + "01", emptyText); + putEmptyData(t, 2,10); pageRow.add(t.clone()); } - /* + return assemblePageResult(mainData, pageRowList, maxRowCount); + } + /* * 修改数据结构 - [ - { + [{ "headerData": {}, "tableList": [{},] - }, - ] + },] * */ + private JSONArray assemblePageResult(ReportDocumentMainDO mainData, JSONArray pageRowList, Integer maxRowCount){ JSONArray result = new JSONArray(); String formData = mainData.getFormData(); String signatureData = mainData.getDocumentSignature(); @@ -266,6 +268,13 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService formDataJson = JSONObject.parseObject(formData); if(!ObjectUtils.isEmpty(signatureJsonStr)) hasSignatureData = true; + //在最后一页填充空行 + JSONArray pageRow = pageRowList.getJSONArray(pageRowList.size() - 1); + while(pageRow.size() < maxRowCount){ + JSONObject t = new JSONObject(); + putEmptyData(t, 1,10); + pageRow.add(t.clone()); + } for(int i=0;i