|
@@ -808,7 +808,8 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
if (Objects.nonNull(fileIdObj)) {
|
|
if (Objects.nonNull(fileIdObj)) {
|
|
fileId = (String) fileIdObj;
|
|
fileId = (String) fileIdObj;
|
|
} else {
|
|
} else {
|
|
- fileId = "7a3213f88d7146e88f1508b61dcb3202";
|
|
|
|
|
|
+// fileId = "7a3213f88d7146e88f1508b61dcb3202";//1057加拿大模板
|
|
|
|
+ fileId = "45f4b5330f8e47298a4b297b4fabe539";//1075沙特模板
|
|
}
|
|
}
|
|
Object projectObj = map.get("projectId");
|
|
Object projectObj = map.get("projectId");
|
|
Object machineNoObj = map.get("machineNo");
|
|
Object machineNoObj = map.get("machineNo");
|
|
@@ -1078,10 +1079,11 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
cloneDocA.getLastSection().getBody().getLastParagraph().appendChild(new Run(cloneDocA, "\f")); // 分节符
|
|
cloneDocA.getLastSection().getBody().getLastParagraph().appendChild(new Run(cloneDocA, "\f")); // 分节符
|
|
// 在副本上合并文档B
|
|
// 在副本上合并文档B
|
|
cloneDocA.appendDocument(doc, ImportFormatMode.KEEP_SOURCE_FORMATTING);
|
|
cloneDocA.appendDocument(doc, ImportFormatMode.KEEP_SOURCE_FORMATTING);
|
|
|
|
+ int beforePageCount = cloneDocA.getPageCount();
|
|
//刷新目录
|
|
//刷新目录
|
|
- refreshTableOfContents(cloneDocA);
|
|
|
|
|
|
+ cloneDocA.updateFields();
|
|
// 获取第一个文档的总页数
|
|
// 获取第一个文档的总页数
|
|
- int firstDocPageCount = cloneDocA.getPageCount() - doc.getPageCount();
|
|
|
|
|
|
+ int firstDocPageCount = cloneDocA.getPageCount() - beforePageCount + 2;
|
|
// 获取第二部分的第一节
|
|
// 获取第二部分的第一节
|
|
Section sectionPart2 = cloneDocA.getSections().get(cloneDocA.getSections().getCount() - 1);
|
|
Section sectionPart2 = cloneDocA.getSections().get(cloneDocA.getSections().getCount() - 1);
|
|
// 设置第二部分的页码起始值为第一部分的页数加 1
|
|
// 设置第二部分的页码起始值为第一部分的页数加 1
|
|
@@ -1112,8 +1114,12 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
// 将第一页页眉的内容克隆到当前页眉
|
|
// 将第一页页眉的内容克隆到当前页眉
|
|
for (Node node : firstPageHeader.getChildNodes(NodeType.ANY, true).toArray()) {
|
|
for (Node node : firstPageHeader.getChildNodes(NodeType.ANY, true).toArray()) {
|
|
Node clonedNode = node.deepClone(true);
|
|
Node clonedNode = node.deepClone(true);
|
|
|
|
+// if (StringUtils.isNotBlank(clonedNode.getText())) {
|
|
currentHeader.appendChild(clonedNode);
|
|
currentHeader.appendChild(clonedNode);
|
|
|
|
+// }
|
|
|
|
+// if (node.getNodeType() == NodeType.TABLE) {
|
|
break;
|
|
break;
|
|
|
|
+// }
|
|
}
|
|
}
|
|
// 复制第一页页脚的内容到当前页脚
|
|
// 复制第一页页脚的内容到当前页脚
|
|
for (Node node : firstPageFooter.getChildNodes(NodeType.ANY, true).toArray()) {
|
|
for (Node node : firstPageFooter.getChildNodes(NodeType.ANY, true).toArray()) {
|
|
@@ -1123,7 +1129,7 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
}
|
|
}
|
|
}
|
|
}
|
|
//刷新目录
|
|
//刷新目录
|
|
- refreshTableOfContents(cloneDocA);
|
|
|
|
|
|
+ cloneDocA.updateFields();
|
|
|
|
|
|
if ("export".equals(exportType)) {
|
|
if ("export".equals(exportType)) {
|
|
exportWord(cloneDocA, response);
|
|
exportWord(cloneDocA, response);
|
|
@@ -1134,24 +1140,6 @@ public class ZhcxCommissionCheckServiceImpl extends ServiceImpl<ZhcxCommissionCh
|
|
return R.ok();
|
|
return R.ok();
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 刷新文档中的所有目录
|
|
|
|
- */
|
|
|
|
- private static void refreshTableOfContents(Document doc) throws Exception {
|
|
|
|
- // 遍历文档中的所有字段
|
|
|
|
- for (com.aspose.words.Field field : doc.getRange().getFields()) {
|
|
|
|
- // 检查字段是否为目录字段(TOC)
|
|
|
|
- if (field.getType() == FieldType.FIELD_TOC) {
|
|
|
|
- // 更新目录字段
|
|
|
|
- field.update();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 如果需要更新整个文档的布局(例如页码变化)
|
|
|
|
- doc.updateFields();
|
|
|
|
- doc.updatePageLayout();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private int sort1(List<String> parts1, List<String> parts2) {
|
|
private int sort1(List<String> parts1, List<String> parts2) {
|
|
int length1 = parts1.size();
|
|
int length1 = parts1.size();
|
|
int length2 = parts2.size();
|
|
int length2 = parts2.size();
|