diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java index 5392c0a..18a3297 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/HygieneRecordServiceImpl.java @@ -194,8 +194,8 @@ public class HygieneRecordServiceImpl extends ServiceImpl params = BaseUtil.obj2Map(hygieneRecordDetailVO); String templateFile = "template/卫生自查表" + SafeProductConstant.DOCX_SUFFIX; - String wordPath = savePath + "/卫生自查表" + SafeProductConstant.DOCX_SUFFIX; - String pdfPath = savePath + "/卫生自查表" + SafeProductConstant.PDF_SUFFIX; + String wordPath = "D:/" + "/卫生自查表" + SafeProductConstant.DOCX_SUFFIX; + String pdfPath = "D:/" + "/卫生自查表" + SafeProductConstant.PDF_SUFFIX; BaseUtil.exportDocument(templateFile, params, wordPath, pdfPath, "",response); } diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java index c80b1ba..2c1755e 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/utils/BaseUtil.java @@ -144,10 +144,10 @@ public class BaseUtil { } } // 表格处理 - if (templatePath.equals("template/卫生自查表.docx")) { + if ("template/卫生自查表.docx".equals(templatePath)) { formatHygieneRecordTable(xwpfDocument); } - if (templatePath.equals("template/车辆检查表.docx")) { + if ("template/车辆检查表.docx".equals(templatePath)) { formatCarCheckRecordTable(xwpfDocument); } } catch (Exception e) { @@ -225,13 +225,18 @@ public class BaseUtil { List rows = table.getRows(); // 第三行到倒数第二行为需合并区域 for (int row = 3; row < rows.size() - 1;) { - XWPFTableCell startCell = rows.get(row).getCell(0); - String startText = startCell.getText(); + // 判断责任区和责任人是否完全一致,一致则合并 + XWPFTableCell startFirstCell = rows.get(row).getCell(0); + String startFirstText = startFirstCell.getText(); + XWPFTableCell startSecondCell = rows.get(row).getCell(1); + String startSecondText = startSecondCell.getText(); int index = row + 1; for (; index < rows.size(); index++) { - XWPFTableCell endCell = rows.get(index).getCell(0); - String endText = endCell.getText(); - if (!startText.equals(endText)) { + XWPFTableCell endFirstCell = rows.get(index).getCell(0); + String endFirstText = endFirstCell.getText(); + XWPFTableCell endSecondCell = rows.get(index).getCell(1); + String endSecondText = endSecondCell.getText(); + if (!startFirstText.equals(endFirstText) || !startSecondText.equals(endSecondText)) { break; } }