From 920292cfacf602f6d2c1cb85518ed5a6b0051de6 Mon Sep 17 00:00:00 2001 From: FCL Date: Tue, 9 Dec 2025 14:39:13 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=E6=8A=A5=E5=91=8A=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E7=AE=97=E6=B3=95=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4=EF=BC=9B?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E9=A1=B5=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/ReportDocumentDataController.java | 8 +- .../service/ReportDocumentDataService.java | 2 +- .../ReportDocumentDataServiceImpl.java | 161 +++++++++++++----- 3 files changed, 118 insertions(+), 53 deletions(-) diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/controller/admin/ReportDocumentDataController.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/controller/admin/ReportDocumentDataController.java index ccc2c5f..0fcf629 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/controller/admin/ReportDocumentDataController.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/controller/admin/ReportDocumentDataController.java @@ -62,16 +62,12 @@ public class ReportDocumentDataController extends AbstractFileUploadController i @GetMapping("/queryReportDetail") @Operation(summary = "查询报告明细数据") @Parameter(name = "mainId", description = "报告id", required = true, example = "1024") - public CommonResult> queryReportDetail(@RequestParam("mainId") Long mainId) { + public CommonResult queryReportDetail(@RequestParam("mainId") Long mainId, @RequestParam(name = "pageFlag", required = false) String pageFlag) { ReportDocumentMainDO mainDO = reportDocumentMainService.getReportDocumentMain(mainId); Long typeId = mainDO.getReportDocumentTypeId(); ReportDocumentTypeDO typeDO = reportDocumentTypeService.getReportDocumentType(typeId); - Long confId = typeDO.getConfigReportTypeId(); -// Map param = new HashMap<>(); -// List list = reportDocumentDataService.listByMainDataId(mainId).getData(); -// return success(BeanUtils.toBean(list, ReportDocumentDataRespVO.class)); - CommonResult> result = reportDocumentDataService.assembleDynamicData(mainDO, typeDO); + CommonResult result = reportDocumentDataService.assembleDynamicData(mainDO, typeDO, pageFlag); return result; } diff --git a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataService.java b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataService.java index db821ef..48ad350 100644 --- a/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataService.java +++ b/zt-module-qms/zt-module-qms-server/src/main/java/com/zt/plat/module/qms/business/reportdoc/service/ReportDocumentDataService.java @@ -19,7 +19,7 @@ import java.util.List; */ public interface ReportDocumentDataService { - CommonResult> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO reportConfig); + CommonResult assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO reportConfig, String pageFlag); CommonResult> listByMainDataId(Long mainDataId); CommonResult countMainDataId(Long mainDataId); 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 7ea9b88..ee794e6 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 @@ -44,6 +44,13 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService private final String colPrefix = "col"; private final String sampleCodeKey = "SMP_CD"; private final String sampleNameKey = "SMP_NAME"; + private final String sampleNameAndCodeKey = "SMP_NAME_CD"; + private final String entrustSampleNameKey = "ENTT_SMP_NAME"; + private final String entrustSampleCodeKey = "ENTT_SMP_CD"; + private final String entrustSampleNameCodeKey = "ENTT_SMP_NAME_CD"; + private final String rowTypeKey = "rowType"; //行类型 + private final String rowTypeTitle = "title"; //行类型-标题 + private final String rowTypeLimit = "limit"; //行类型-检出限 private final String rangeKey = "minLimitValue"; private final String emptyText = "以下为空白"; @@ -52,7 +59,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService * 组装动态报表数据 * */ @Override - public CommonResult> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO typeDO) { + public CommonResult assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO typeDO, String pageFlag) { if(typeDO == null || typeDO.getConfigReportTypeId() == null) return CommonResult.error(REPORT_DOCUMENT_TYPE_NOT_EXISTS.getCode(), "报告配置为空,或未配置报表类型,请联系管理员处理!"); String customConfig = typeDO.getCustomConfig(); @@ -85,7 +92,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService } if(dataListGroup.isEmpty()) dataListGroup.add(dataList); - List rowList = new ArrayList<>(); + JSONArray rowList = new JSONArray(); for(int i = 0; i < dataListGroup.size(); i++){ List dataListByKey = dataListGroup.get(i); //处理字段,提取有数据的字段 @@ -121,7 +128,11 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService //处理空数据,填充/ rowList = assembleEmpty(configJson, rowList); - //todo 处理数据分页 + //处理数据分页 + if("1".equals(pageFlag)){ + JSONArray pageRowList = assemblePageRowList(rowList, configJson); + return CommonResult.success(pageRowList); + } //以下为空白 if(rowList.size() < maxRowCount){ @@ -137,8 +148,70 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService return CommonResult.success(rowList); } - private List assembleEmpty(JSONObject configJson, List rowList){ - JSONArray fixedCol = configJson.getJSONArray("fixedCol"); //固定列,举例:["sampleName", "sampleCode"] + /* + * 处理分页 + * + * */ + private JSONArray assemblePageRowList(JSONArray rowList, JSONObject configJson){ + JSONArray pageRowList = new JSONArray(); + Integer maxRowCount = 20; + String maxRowCountStr = configJson.getString("maxRowCount"); //最大行数 + if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr); + int rowLength = rowList.size(); + if(rowLength <= maxRowCount){ + pageRowList.add(rowList); + return pageRowList; + } + JSONArray remainingRows = new JSONArray(); + remainingRows.addAll(rowList); + while(remainingRows.size() > 0){ + JSONArray pageRow = new JSONArray(); + for(int i = 0; i < maxRowCount ; i++){ + if(remainingRows.isEmpty()) + break; + pageRow.add(remainingRows.getJSONObject(0)); + remainingRows.remove(0); + } + /* + 在每页开头插入“标题行” + 如果最后一行是标题,直接移到下一页;如果不是,往上寻找最近的“标题行” + */ + JSONObject lastTitleRow = pageRow.getJSONObject(pageRow.size() - 1); + String rowType = lastTitleRow.getString(rowTypeKey); + if(rowTypeTitle.equals(rowType)){ + //如果最后一行是“标题行”,移除 + pageRow.remove(pageRow.size() - 1); + }else { + for(int i = pageRow.size() - 1; i >= 0; i--){ + JSONObject t = pageRow.getJSONObject(i); + rowType = t.getString(rowTypeKey); + if(rowTypeTitle.equals(rowType)){ + lastTitleRow = t; + break; + } + } + } + if(!remainingRows.isEmpty()){ + JSONObject firstRemainingRow = remainingRows.getJSONObject(0); + if(!rowTypeTitle.equals(firstRemainingRow.getString(rowTypeKey))){ + remainingRows.add(0, lastTitleRow); + } + } + pageRowList.add(pageRow); + } + + //在最后一页插入“以下为空” + JSONArray pageRow = pageRowList.getJSONArray(pageRowList.size() - 1); + if(pageRow.size() < maxRowCount){ + JSONObject t = new JSONObject(); + t.put(colPrefix + "01", emptyText); + pageRow.add(t.clone()); + } + return pageRowList; + } + + private JSONArray assembleEmpty(JSONObject configJson, JSONArray rowList){ + JSONArray fixedCol = configJson.getJSONArray("fixedCol"); //固定列,举例:["SMP_NAME", "SMP_CD"] if(fixedCol == null) fixedCol = new JSONArray(); JSONArray fixedColRight = configJson.getJSONArray("fixedColRight"); //右侧固定列 if(fixedColRight == null) fixedColRight = new JSONArray(); @@ -150,7 +223,8 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService fixedColCount_left = fixedCol.size(); fixedColCount_right = fixedColRight.size(); - for(JSONObject row : rowList){ + for(int i = 0; i < rowList.size(); i++){ + JSONObject row = rowList.getJSONObject(i); if(" ".equals(row.getString(colPrefix + "01"))) continue; int colIndex = 1; @@ -169,15 +243,15 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService * @param fieldList 要显示的字段列表。固定字段在最前 * @param customConfig 报告配置项 * */ - private List assembleStep1(List rowList, List fieldList, List dataList, String customConfig, int groupIndex){ + private JSONArray assembleStep1(JSONArray rowList, List fieldList, List dataList, String customConfig, int groupIndex){ if(dataList.isEmpty()) - return new ArrayList<>(); + return new JSONArray(); JSONObject jsonObject = JSONObject.parseObject(customConfig); Integer dynamicColCount = 3; Integer fixedColCount_left = 0; String dynamicColCountStr = jsonObject.getString("dynamicColCount"); //动态列(检测项)数量 - JSONArray fixedCol = jsonObject.getJSONArray("fixedCol"); //固定列,举例:["sampleName", "sampleCode"] + JSONArray fixedCol = jsonObject.getJSONArray("fixedCol"); //固定列,举例:["SMP_NAME", "SMP_CD"] if(fixedCol == null) fixedCol = new JSONArray(); JSONArray fixedColRight = jsonObject.getJSONArray("fixedColRight"); //右侧固定列 if(fixedColRight == null) fixedColRight = new JSONArray(); @@ -225,7 +299,9 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService for(int i = 0; i < dynamicFieldListGroup.size(); i++){ List dynamicFieldList = dynamicFieldListGroup.get(i); t = new JSONObject(); + t.put(rowTypeKey, rowTypeTitle); r = new JSONObject(); + r.put(rowTypeKey, rowTypeLimit); colIndex = fixedColCount_left + 1; //第二组以后,从固定列数开始 for(ConfigReportFieldDO fieldDO : dynamicFieldList) { String field = fieldDO.getField(); @@ -267,7 +343,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService * @param * * */ - private void addTitleToRowList(JSONArray fixedCol, JSONArray fixedColRight, Integer dynamicColCount, JSONObject t, List rowList, List fieldList){ + private void addTitleToRowList(JSONArray fixedCol, JSONArray fixedColRight, Integer dynamicColCount, JSONObject t, JSONArray rowList, List fieldList){ //处理固定列 int index = 1; String colKey = ""; @@ -281,12 +357,12 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService String field = fieldDO.getField(); if (FIELD_DYNAMIC.equals(fieldType) || FIELD_CALCULATED.equals(fieldType)) continue; - if("sampleNameCode".equals( col) && "SMP_NAME_CD".equals(field) - || "sampleName".equals( col) && "SMP_NAME".equals(field) - || "sampleCode".equals( col) && "SMP_CD".equals(field) - || "entrustSampleName".equals( col) && "ENTT_SMP_NAME".equals(field) - || "entrustSampleCode".equals( col) && "ENTT_SMP_CD".equals(field) - || "entrustSampleNameCode".equals( col) && "ENTT_SMP_NAME_CD".equals(field)){ + if(sampleNameAndCodeKey.equals( col) && sampleNameAndCodeKey.equals(field) + || sampleNameKey.equals( col) && sampleNameKey.equals(field) + || sampleCodeKey.equals( col) && sampleCodeKey.equals(field) + || entrustSampleNameKey.equals( col) && entrustSampleNameKey.equals(field) + || entrustSampleCodeKey.equals( col) && entrustSampleCodeKey.equals(field) + || entrustSampleNameCodeKey.equals( col) && entrustSampleNameCodeKey.equals(field)){ colKey = parseNumToString(index, 2); } if(!ObjectUtils.isEmpty(colKey)){ @@ -306,12 +382,12 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService String field = fieldDO.getField(); if (FIELD_DYNAMIC.equals(fieldType) || FIELD_CALCULATED.equals(fieldType)) continue; - if("sampleNameCode".equals( col) && "SMP_NAME_CD".equals(field) - || "sampleName".equals( col) && "SMP_NAME".equals(field) - || "sampleCode".equals( col) && "SMP_CD".equals(field) - || "entrustSampleName".equals( col) && "ENTT_SMP_NAME".equals(field) - || "entrustSampleCode".equals( col) && "ENTT_SMP_CD".equals(field) - || "entrustSampleNameCode".equals( col) && "ENTT_SMP_NAME_CD".equals(field)){ + if(sampleNameAndCodeKey.equals( col) && sampleNameAndCodeKey.equals(field) + || sampleNameKey.equals( col) && sampleNameKey.equals(field) + || sampleCodeKey.equals( col) && sampleCodeKey.equals(field) + || entrustSampleNameKey.equals( col) && entrustSampleNameKey.equals(field) + || entrustSampleCodeKey.equals( col) && entrustSampleCodeKey.equals(field) + || entrustSampleNameCodeKey.equals( col) && entrustSampleNameCodeKey.equals(field)){ colKey = parseNumToString(index, 2); } if(!ObjectUtils.isEmpty(colKey)){ @@ -324,7 +400,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService } //添加行数据 - private void addDataToRowList(JSONArray fixedCol, JSONArray fixedColRight, List fieldList, List dataList, List rowList, int fixedColCount, int dynamicColCount, String hasRemark){ + private void addDataToRowList(JSONArray fixedCol, JSONArray fixedColRight, List fieldList, List dataList, JSONArray rowList, int fixedColCount, int dynamicColCount, String hasRemark){ int colIndex = 0; JSONObject t = new JSONObject(); for(ReportDocumentDataDO dataDO : dataList){ @@ -385,19 +461,19 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService for(int i=0;i rowList){ - rowList.add(r.clone()); - } private String parseNumToString(int num, int len){ StringBuilder sb = new StringBuilder(); @@ -448,7 +517,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService /** * 组装固定检测项的数据,以检测项作为数据Key * */ - private List assembleFixedFieldsData(List fieldList, List dataList, String customConfig){ + private JSONArray assembleFixedFieldsData(List fieldList, List dataList, String customConfig){ JSONObject jsonObject = JSONObject.parseObject(customConfig); Integer maxRowCount = 3; @@ -459,7 +528,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService JSONArray fixedFieldsArray = JSONArray.parseArray(fixedFields); if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr); - List rowList = new ArrayList<>(); + JSONArray rowList = new JSONArray(); for(int i = 0; i < maxRowCount; i++){ JSONObject row = new JSONObject(); row.put("sampleNameCode", " "); @@ -520,7 +589,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService * 组装纵表数据 * 第1列固定为:元素; 第2列:方法检出限(%);第三列开始为各个样品 * */ - private List assembleVerticalData(List fieldList, List dataList, String customConfig){ + private JSONArray assembleVerticalData(List fieldList, List dataList, String customConfig){ JSONObject jsonObject = JSONObject.parseObject(customConfig); Integer dynamicColCount = 3; Integer fixedColCount = 2; @@ -539,7 +608,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService if(!ObjectUtils.isEmpty(content)){ firstData = JSONObject.parseObject(content); } - List rowList = new ArrayList<>(); + JSONArray rowList = new JSONArray(); //处理第一行-样品编号 int colIndex = fixedColCount + 1; int rowIndex = 1; From 9f4369bcb21ff3cb8e472cc9672d3a18f79d37a2 Mon Sep 17 00:00:00 2001 From: FCL Date: Tue, 9 Dec 2025 15:46:00 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=E6=8A=A5=E5=91=8A=E7=BA=B5=E8=A1=A8?= =?UTF-8?q?=E7=BB=86=E8=8A=82=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReportDocumentDataServiceImpl.java | 41 ++++++++++--------- 1 file changed, 21 insertions(+), 20 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 ee794e6..b3392a8 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 @@ -64,6 +64,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService return CommonResult.error(REPORT_DOCUMENT_TYPE_NOT_EXISTS.getCode(), "报告配置为空,或未配置报表类型,请联系管理员处理!"); String customConfig = typeDO.getCustomConfig(); JSONObject configJson = JSONObject.parseObject(customConfig); + String verticalFlag = configJson.getString("verticalFlag"); String maxRowCountStr = configJson.getString("maxRowCount"); //最大行数 Integer maxRowCount = 3; if(!ObjectUtils.isEmpty(maxRowCountStr)) @@ -125,15 +126,16 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService } assembleStep1(rowList, fieldList, dataListByKey, customConfig, i); //处理后的组数对象 } - //处理空数据,填充/ - rowList = assembleEmpty(configJson, rowList); + if(!"1".equals(verticalFlag)){ + //处理空数据,填充/ + rowList = assembleEmpty(configJson, rowList); - //处理数据分页 - if("1".equals(pageFlag)){ - JSONArray pageRowList = assemblePageRowList(rowList, configJson); - return CommonResult.success(pageRowList); + //处理数据分页 + if("1".equals(pageFlag)){ + JSONArray pageRowList = assemblePageRowList(rowList, configJson); + return CommonResult.success(pageRowList); + } } - //以下为空白 if(rowList.size() < maxRowCount){ JSONObject t = new JSONObject(); @@ -260,10 +262,10 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService String verticalFlag = jsonObject.getString("verticalFlag"); //vertical-纵表, 否则为横表 String fixedFields = jsonObject.getString("fixedFields"); //固定检测项。如果固定检测项,则以检测项作为数据Key if("1".equals(verticalFlag)){ //纵表 - return assembleVerticalData(fieldList, dataList, customConfig); + return assembleVerticalData(rowList, fieldList, dataList, customConfig); } if(!ObjectUtils.isEmpty(fixedFields)){ //固定列 - return assembleFixedFieldsData(fieldList, dataList, customConfig); + return assembleFixedFieldsData(rowList, fieldList, dataList, customConfig); } if(!ObjectUtils.isEmpty(dynamicColCountStr)) dynamicColCount = Integer.parseInt(dynamicColCountStr); fixedColCount_left = fixedCol.size(); @@ -517,7 +519,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService /** * 组装固定检测项的数据,以检测项作为数据Key * */ - private JSONArray assembleFixedFieldsData(List fieldList, List dataList, String customConfig){ + private JSONArray assembleFixedFieldsData(JSONArray rowList, List fieldList, List dataList, String customConfig){ JSONObject jsonObject = JSONObject.parseObject(customConfig); Integer maxRowCount = 3; @@ -527,8 +529,6 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService String fixedFields = jsonObject.getString("fixedFields"); //固定检测项。如果固定检测项,则以检测项作为数据Key JSONArray fixedFieldsArray = JSONArray.parseArray(fixedFields); if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr); - - JSONArray rowList = new JSONArray(); for(int i = 0; i < maxRowCount; i++){ JSONObject row = new JSONObject(); row.put("sampleNameCode", " "); @@ -589,17 +589,15 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService * 组装纵表数据 * 第1列固定为:元素; 第2列:方法检出限(%);第三列开始为各个样品 * */ - private JSONArray assembleVerticalData(List fieldList, List dataList, String customConfig){ + private JSONArray assembleVerticalData(JSONArray rowList, List fieldList, List dataList, String customConfig){ JSONObject jsonObject = JSONObject.parseObject(customConfig); Integer dynamicColCount = 3; - Integer fixedColCount = 2; - Integer maxRowCount = 3; - String dynamicColCountStr = jsonObject.getString("dynamicColCount"); //动态列(检测项)数量 - String fixedColCountStr = jsonObject.getString("fixedColCount"); //固定列(样品名称、样品编号等)数量 - String maxRowCountStr = jsonObject.getString("maxRowCount"); //最大行数 - String nameCodeType = jsonObject.getString("nameCodeType"); //名称、编号处理方式:merge-合并, name-只显示名称, code-只显示编号, split-2列分开显示 + Integer fixedColCount = 1; + Integer maxRowCount = 20; String hasRemark = jsonObject.getString("hasRemark"); //是否有备注 String hasRange = jsonObject.getString("hasRange"); //是否有检出限 + if("1".equals(hasRange)) + fixedColCount ++; //取数据第一行,用于处理方法检出限 String content = ""; if(!ObjectUtils.isEmpty(dataList)) @@ -608,11 +606,14 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService if(!ObjectUtils.isEmpty(content)){ firstData = JSONObject.parseObject(content); } - JSONArray rowList = new JSONArray(); //处理第一行-样品编号 int colIndex = fixedColCount + 1; int rowIndex = 1; JSONObject t = new JSONObject(); + t.put(colPrefix + "01", "元素"); + if("1".equals(hasRange)){ + t.put(colPrefix + "02", "方法检出限"); + } for(ReportDocumentDataDO dataDO : dataList){ String colKey = parseNumToString(colIndex, 2); t.put(colPrefix + colKey, dataDO.getSampleCode());