From 3d0df51d47d7f68944cba544d4b89fd4958c0f86 Mon Sep 17 00:00:00 2001 From: "tanfengling@x-ri.com" <123456> Date: Tue, 11 Nov 2025 11:46:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E9=83=A8=E9=97=A8=E3=80=91=E7=9B=98?= =?UTF-8?q?=E7=82=B9=E8=A1=A8=E8=AE=BE=E7=BD=AE=E9=BB=98=E8=AE=A4=E6=B3=9B?= =?UTF-8?q?=E5=BE=AE=E5=AE=A1=E6=89=B9=E7=8A=B6=E6=80=81=E5=92=8C=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E5=88=9B=E5=BB=BA=E9=83=A8=E9=97=A8=20=E3=80=90?= =?UTF-8?q?=E6=B3=9B=E5=BE=AE=E6=8E=A5=E5=8F=A3=E3=80=91=E6=8E=A8=E9=80=81?= =?UTF-8?q?=E4=BB=98=E6=AC=BE=E7=8A=B6=E6=80=81=E6=9B=B4=E6=96=B0=E6=8E=A8?= =?UTF-8?q?=E9=80=81=E7=9A=84=E6=A0=87=E8=AF=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../plugin/form/im/InvCountBillPLugin.java | 19 ++++++++ .../cas/PaymentbillPushPaystateOp.java | 8 +++- lc123/cloud/app/plugin/trd/FWImpl.java | 46 ++++++++++++------- 3 files changed, 55 insertions(+), 18 deletions(-) diff --git a/lc123/cloud/app/plugin/form/im/InvCountBillPLugin.java b/lc123/cloud/app/plugin/form/im/InvCountBillPLugin.java index d426258..57511b2 100644 --- a/lc123/cloud/app/plugin/form/im/InvCountBillPLugin.java +++ b/lc123/cloud/app/plugin/form/im/InvCountBillPLugin.java @@ -1,6 +1,11 @@ package tqq9.lc123.cloud.app.plugin.form.im; import kd.bos.bill.AbstractBillPlugIn; +import kd.bos.dataentity.entity.DynamicObject; +import kd.bos.dataentity.entity.DynamicObjectCollection; +import kd.bos.orm.query.QCP; +import kd.bos.orm.query.QFilter; +import kd.bos.servicehelper.BusinessDataServiceHelper; import java.util.EventObject; @@ -15,5 +20,19 @@ public class InvCountBillPLugin extends AbstractBillPlugIn { super.afterCreateNewData(e); //给泛微审批状态设置初始默认值--待提交 this.getModel().setValue("tqq9_fwstate", "A"); + //设置创建部门 + DynamicObject creator = (DynamicObject) this.getModel().getValue("creator"); + if(creator != null){ + DynamicObject bos_user = BusinessDataServiceHelper.loadSingle("bos_user", new QFilter[]{new QFilter("id", QCP.equals, creator.getLong("id"))}); + DynamicObjectCollection entryentity = bos_user.getDynamicObjectCollection("entryentity"); + DynamicObject dept = null; + for (DynamicObject dynamicObject : entryentity) { + boolean ispartjob = dynamicObject.getBoolean("ispartjob"); + if (!ispartjob) { + dept = dynamicObject.getDynamicObject("dpt"); + } + } + this.getModel().setValue("tqq9_dept", dept); + } } } diff --git a/lc123/cloud/app/plugin/operate/cas/PaymentbillPushPaystateOp.java b/lc123/cloud/app/plugin/operate/cas/PaymentbillPushPaystateOp.java index dcdb533..dffd53f 100644 --- a/lc123/cloud/app/plugin/operate/cas/PaymentbillPushPaystateOp.java +++ b/lc123/cloud/app/plugin/operate/cas/PaymentbillPushPaystateOp.java @@ -37,10 +37,14 @@ public class PaymentbillPushPaystateOp extends AbstractOperationServicePlugIn { if ("1".equals(status)) { dataEntity.set("tqq9_ispushfw", true); SaveServiceHelper.save(new DynamicObject[]{dataEntity}); + }else{ + dataEntity.set("tqq9_ispushfw", false); + SaveServiceHelper.save(new DynamicObject[]{dataEntity}); } + }else{ + dataEntity.set("tqq9_ispushfw", false); + SaveServiceHelper.save(new DynamicObject[]{dataEntity}); } - } - } } diff --git a/lc123/cloud/app/plugin/trd/FWImpl.java b/lc123/cloud/app/plugin/trd/FWImpl.java index 51c70a1..62329a3 100644 --- a/lc123/cloud/app/plugin/trd/FWImpl.java +++ b/lc123/cloud/app/plugin/trd/FWImpl.java @@ -1,5 +1,7 @@ package tqq9.lc123.cloud.app.plugin.trd; +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpUtil; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; @@ -10,7 +12,6 @@ import kd.bos.orm.query.QFilter; import kd.bos.servicehelper.AttachmentServiceHelper; import kd.bos.servicehelper.BusinessDataServiceHelper; import org.apache.commons.lang3.StringUtils; -import scala.Dynamic; import tqq9.lc123.cloud.app.plugin.utils.ConfigUtils; import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils; import tqq9.lc123.cloud.app.plugin.utils.FWUtils; @@ -593,7 +594,10 @@ public class FWImpl { String tqq9_fwrequestid = dataEntity.getString("tqq9_fwrequestid");//泛微流程ID if(StringUtils.isNotBlank(tqq9_fwrequestid)){ Date paydate = dataEntity.getDate("paydate");//付款日期 - String jyrq = sdf.format(paydate); + String jyrq = ""; + if(paydate != null){ + jyrq = sdf.format(paydate); + } String jyzy = dataEntity.getString("description");//摘要 String tqq9_cwztfkzt = dataEntity.getString("tqq9_cwztfkzt");//财务中台付款状态 @@ -618,21 +622,31 @@ public class FWImpl { String tqq9_dzhdbh = dataEntity.getString("tqq9_dzhdbh");//电子回单编号 String tqq9_digital_receipt = dataEntity.getString("tqq9_digital_receipt");//电子回单编号 String filename = ""; - try { - URL url = new URL(tqq9_digital_receipt); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); - // 尝试从响应头获取 - String disposition = conn.getHeaderField("Content-Disposition"); - if (disposition != null && disposition.contains("filename=")) { - filename = disposition.split("filename=")[1].replace("\"", "").trim(); - } - } catch (MalformedURLException ex) { - throw new RuntimeException(ex); - } catch (IOException ex) { - throw new RuntimeException(ex); + HttpRequest request = HttpRequest.get(tqq9_digital_receipt); + HttpResponse response = request.execute(); + String contentDisposition = response.header("Content-Disposition"); + if (contentDisposition != null && contentDisposition.contains("filename=")) { + filename = contentDisposition.split("filename=")[1].replace("\"", ""); } + +// List> attachments = AttachmentServiceHelper.getAttachments("cas_paybill", dataEntity.getPkValue(), "attachmentpanel"); +// for (Map attachment : attachments) { +// String filePath = (String) attachment.get("url"); +// System.out.println(); +// } + byte[] bytes = HttpUtil.downloadBytes(tqq9_digital_receipt); + String content = cn.hutool.core.codec.Base64.encode(bytes); if(StringUtils.isBlank(filename)){ - filename = "银行电子回单"+new Date().getTime()+".pdf"; + filename = "银行电子回单"+new Date().getTime(); + String hz = ".jpg"; + if(tqq9_digital_receipt.contains(".pdf")){ + hz = ".pdf"; + }else if(tqq9_digital_receipt.contains(".jpeg")){ + hz = ".jpeg"; + }else if(tqq9_digital_receipt.contains(".png")){ + hz = ".png"; + } + filename = filename + hz; } JSONObject mainTable = new JSONObject(); @@ -644,7 +658,7 @@ public class FWImpl { JSONArray files = new JSONArray(); JSONObject file = new JSONObject(); file.put("name", filename); - file.put("content", tqq9_digital_receipt); + file.put("content", content); files.add(file); mainTable.put("dzhdwj", files);