From c56363f9023e645fea648de128298ac529167b9a Mon Sep 17 00:00:00 2001 From: liwen Date: Tue, 14 May 2024 11:01:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=96=87=E4=BB=B6=E7=9A=84=E8=B6=85=E9=93=BE=E6=8E=A5=E6=9C=89?= =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E6=97=B6=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/RehearsalRecordServiceImpl.java | 5 ++++- .../java/com/hnac/hzims/safeproduct/utils/BaseUtil.java | 14 ++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java index 55aaf12..2b9b50c 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/RehearsalRecordServiceImpl.java @@ -161,7 +161,10 @@ public class RehearsalRecordServiceImpl extends ServiceImpl iterator = p.getRuns().iterator(); - while (iterator.hasNext()) { - XWPFRun r = iterator.next(); - String text = r.getText(0); + for (int index = 0; index < p.getRuns().size(); index++) { + XWPFRun run = p.getRuns().get(index); + String text = run.getText(0); if (findText.equals(text)) { - r.setText("", 0); // 清除原有文本 - XWPFParagraph paragraph = r.getParagraph(); + run.setText("", 0); // 清除原有文本 + XWPFParagraph paragraph = run.getParagraph(); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); String name = jsonObject.getString("name"); String url = jsonObject.getString("url"); - url = URLEncoder.encode(url, "UTF-8"); String id = paragraph.getDocument().getPackagePart().addExternalRelationship(url, XWPFRelation.HYPERLINK.getRelation()).getId(); CTHyperlink cLink = paragraph.getCTP().addNewHyperlink(); cLink.setId(id); @@ -148,7 +146,7 @@ public class BaseUtil { CTR ctr = CTR.Factory.newInstance(); ctr.setTArray(new CTText[]{ctText}); cLink.setRArray(new CTR[]{ctr}); - if (i