From 0bfb36b83ff37edb6b5725e9a3f47e806988e0e7 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Thu, 12 Dec 2024 18:07:00 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E4=B8=8B=E8=BD=BD=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1310029125222400]工单中心下载报错 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1310029125222400 --- .../workcenter/WorkcenterDataExportApi.java | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/src/main/java/neatlogic/module/process/api/workcenter/WorkcenterDataExportApi.java b/src/main/java/neatlogic/module/process/api/workcenter/WorkcenterDataExportApi.java index 0fdac2804..f274e5d93 100644 --- a/src/main/java/neatlogic/module/process/api/workcenter/WorkcenterDataExportApi.java +++ b/src/main/java/neatlogic/module/process/api/workcenter/WorkcenterDataExportApi.java @@ -308,20 +308,24 @@ public class WorkcenterDataExportApi extends PrivateBinaryStreamApiComponentBase // POI不允许重复创建Row,遍历到表格类属性时,需要创建多个Row,把这些Row记录下来,待到下一个表格类属性时,重复使用这些Row Map rowMap = new HashMap<>(); for (FormAttributeVo formAttributeVo : formAttributeList) { - IFormAttributeDataConversionHandler handler = FormAttributeDataConversionHandlerFactory.getHandler(formAttributeVo.getHandler()); - if (handler == null) { + String handler = formAttributeVo.getHandler(); + ProcessTaskFormAttributeDataVo formAttributeDataVo = processTaskFormAttributeDataMap.get(formAttributeVo.getLabel()); + if (formAttributeDataVo != null && StringUtils.isNotBlank(formAttributeDataVo.getHandler())) { + handler = formAttributeDataVo.getHandler(); + } + IFormAttributeDataConversionHandler formAttributeDataConversionHandler = FormAttributeDataConversionHandlerFactory.getHandler(handler); + if (formAttributeDataConversionHandler == null) { continue; } Object detailedData = ""; - ProcessTaskFormAttributeDataVo formAttributeDataVo = processTaskFormAttributeDataMap.get(formAttributeVo.getLabel()); // 因为表头中已经有了当前组件的label,所以如果当前工单表单中没有当前组件或组件值为null,那么使用空串来占位,防止后续组件前移 if (formAttributeDataVo != null && formAttributeDataVo.getData() != null) { - detailedData = handler.dataTransformationForExcel(formAttributeDataVo, formAttributeVo.getConfig()); + detailedData = formAttributeDataConversionHandler.dataTransformationForExcel(formAttributeDataVo, formAttributeVo.getConfig());// } if (detailedData == null) { detailedData = ""; } - int excelHeadLength = handler.getExcelHeadLength(formAttributeVo.getConfig()); + int excelHeadLength = formAttributeDataConversionHandler.getExcelHeadLength(formAttributeVo.getConfig()); // excelHeadLength > 1表示该表单属性为表格类属性,需要生成嵌套表格 if (excelHeadLength > 1 && StringUtils.isNotBlank(detailedData.toString())) { JSONObject jsonObject = (JSONObject) detailedData; @@ -354,7 +358,7 @@ public class WorkcenterDataExportApi extends PrivateBinaryStreamApiComponentBase Set keySet = value.keySet(); for (String head : headKeyList) { if (!keySet.contains(head)) { - value.put(head, new JSONObject()); + value.put(head, ""); } } Set> entrySet = value.entrySet(); @@ -363,19 +367,19 @@ public class WorkcenterDataExportApi extends PrivateBinaryStreamApiComponentBase for (Map.Entry entry : entrySet) { if (valueMap.getKey().equals(entry.getKey())) { Cell cell = contentRow.createCell(formCellIndex + k + 1); - JSONObject entryValue = (JSONObject) entry.getValue(); - String _value = ""; - if (entryValue != null) { - Object text = entryValue.get("text"); - if (text != null) { - if (text instanceof List) { - _value = String.join("", ((List) text)); - } else { - _value = text.toString(); - } - } - } - cell.setCellValue(_value); +// JSONObject entryValue = (JSONObject) entry.getValue(); +// String _value = ""; +// if (entryValue != null) { +// Object text = entryValue.get("text"); +// if (text != null) { +// if (text instanceof List) { +// _value = String.join("", ((List) text)); +// } else { +// _value = text.toString(); +// } +// } +// } + cell.setCellValue(entry.getValue().toString()); k++; } } -- Gitee From cf7fa63dbe71e613929dc9b50c3e8b34c5dc2950 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Thu, 12 Dec 2024 18:11:29 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=B7=A5=E5=8D=95?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E4=B8=8B=E8=BD=BD=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1310029125222400]工单中心下载报错 http://192.168.0.96:8090/demo/rdm.html#/bug-detail/939050947543040/939050947543057/1310029125222400 --- .../module/process/api/workcenter/WorkcenterDataExportApi.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/neatlogic/module/process/api/workcenter/WorkcenterDataExportApi.java b/src/main/java/neatlogic/module/process/api/workcenter/WorkcenterDataExportApi.java index f274e5d93..a755285ce 100644 --- a/src/main/java/neatlogic/module/process/api/workcenter/WorkcenterDataExportApi.java +++ b/src/main/java/neatlogic/module/process/api/workcenter/WorkcenterDataExportApi.java @@ -320,7 +320,7 @@ public class WorkcenterDataExportApi extends PrivateBinaryStreamApiComponentBase Object detailedData = ""; // 因为表头中已经有了当前组件的label,所以如果当前工单表单中没有当前组件或组件值为null,那么使用空串来占位,防止后续组件前移 if (formAttributeDataVo != null && formAttributeDataVo.getData() != null) { - detailedData = formAttributeDataConversionHandler.dataTransformationForExcel(formAttributeDataVo, formAttributeVo.getConfig());// + detailedData = formAttributeDataConversionHandler.dataTransformationForExcel(formAttributeDataVo, formAttributeVo.getConfig()); } if (detailedData == null) { detailedData = ""; -- Gitee