From 329445dcf3c91f4fae749d1798d6a03e510a0b2f Mon Sep 17 00:00:00 2001 From: chenshaoxin <1981897232@qq.com> Date: Tue, 12 Nov 2024 14:58:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4=20?= =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BA=BA=EF=BC=9A=E9=99=88=E7=BB=8D=E9=91=AB?= =?UTF-8?q?=20=E6=97=B6=E9=97=B4=EF=BC=9A2024/11/11=20=2017=EF=BC=9A00=20?= =?UTF-8?q?=E5=86=85=E5=AE=B9=EF=BC=9A=E6=88=90=E6=9C=AC=E6=B5=8B=E7=AE=97?= =?UTF-8?q?bug=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../formplugin/RecosMeasurecosFormPlugin.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java b/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java index b11983e..f99efeb 100644 --- a/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java +++ b/main/java/shkd/repc/recos/formplugin/RecosMeasurecosFormPlugin.java @@ -6,6 +6,7 @@ import kd.bos.dataentity.serialization.SerializationUtils; import kd.bos.dataentity.utils.StringUtils; import kd.bos.entity.datamodel.IDataModel; import kd.bos.entity.plugin.Plugin; +import kd.bos.fileservice.FileServiceFactory; import kd.bos.form.FormShowParameter; import kd.bos.form.IFormView; import kd.bos.form.control.AttachmentPanel; @@ -30,9 +31,10 @@ import kd.repc.recos.formplugin.measure.measureci.ReMeasureCIEditPlugin; import org.apache.poi.ss.usermodel.*; import shkd.repc.recos.domain.Calculation; -import java.io.FileInputStream; -import java.io.IOException; +import java.io.*; import java.math.BigDecimal; +import java.net.URL; +import java.net.URLConnection; import java.util.*; import java.util.regex.Pattern; import java.util.stream.Collectors; @@ -81,14 +83,17 @@ public class RecosMeasurecosFormPlugin extends AbstractFormPlugin implements Upl this.getView().showSuccessNotification("请先保存"); return; } - - AttachmentPanel attachmentpanelap = this.getView().getControl("attachmentpanelap"); - List> attachments = attachmentpanelap.getAttachmentData(); + List> attachments = AttachmentServiceHelper.getAttachments("recos_measurecost", this.getModel().getValue("id"), "attachmentpanelap"); +// AttachmentPanel attachmentpanelap = this.getView().getControl("attachmentpanelap"); +// List> attachments = attachmentpanelap.getAttachmentData(); for (Map attachment : attachments) { AttachmentDto attachmentDto = AttachmentServiceHelper.getAttachmentInfoByAttPk(attachment.get("attPkId")); - String fileUrl = attachmentDto.getResourcePath();//真实路径 + String url = attachment.get("url").toString(); +// String fileUrl = attachmentDto.getResourcePath();//真实路径 try { - FileInputStream in = new FileInputStream(fileUrl); + URLConnection urlConnection = new URL(url).openConnection(); + InputStream in = urlConnection.getInputStream(); +// FileInputStream in = new FileInputStream(fileUrl); Workbook workbook = WorkbookFactory.create(in); for (Sheet sheet : workbook) { List arrayList = new ArrayList<>();//修改的集合