From ff8187becf73051c8d1dbc0e4738388c4c932b3e Mon Sep 17 00:00:00 2001 From: "tanfengling@x-ri.com" <123456> Date: Wed, 5 Nov 2025 17:49:21 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E6=B3=9B=E5=BE=AE=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E3=80=91=E5=BF=AB=E9=80=92=E5=8D=95=E5=8F=B7=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=EF=BC=8C=E4=BB=98=E6=AC=BE=E7=8A=B6=E6=80=81=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cas/PaymentbillPushPaystateOp.java | 90 +++++++++++++++++++ .../operate/im/OtherOutPushExprnoOp.java | 19 ++-- lc123/cloud/app/plugin/trd/FWImpl.java | 23 +++-- .../app/plugin/utils/FWRestfulUtils.java | 5 +- 4 files changed, 116 insertions(+), 21 deletions(-) diff --git a/lc123/cloud/app/plugin/operate/cas/PaymentbillPushPaystateOp.java b/lc123/cloud/app/plugin/operate/cas/PaymentbillPushPaystateOp.java index 53625c2..499be85 100644 --- a/lc123/cloud/app/plugin/operate/cas/PaymentbillPushPaystateOp.java +++ b/lc123/cloud/app/plugin/operate/cas/PaymentbillPushPaystateOp.java @@ -1,12 +1,102 @@ package tqq9.lc123.cloud.app.plugin.operate.cas; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import kd.bos.dataentity.entity.DynamicObject; import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.args.AfterOperationArgs; +import kd.bos.servicehelper.BusinessDataServiceHelper; +import org.apache.commons.lang3.StringUtils; +import tqq9.lc123.cloud.app.plugin.utils.FWRestfulUtils; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.net.MalformedURLException; +import java.net.URL; +import java.text.SimpleDateFormat; +import java.util.Date; + +/** + * 付款单付款状态回传泛微kd.bos.form.plugin.bdctrl.AssignQueryPluginNew + */ public class PaymentbillPushPaystateOp extends AbstractOperationServicePlugIn { @Override public void afterExecuteOperationTransaction(AfterOperationArgs e) { super.afterExecuteOperationTransaction(e); + DynamicObject[] dataEntities = e.getDataEntities(); + for (DynamicObject dataEntity : dataEntities) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + dataEntity = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(), dataEntity.getDynamicObjectType().getName()); + String tqq9_fwrequestid = dataEntity.getString("tqq9_fwrequestid");//泛微流程ID + if(StringUtils.isNotBlank(tqq9_fwrequestid)){ + Date paydate = dataEntity.getDate("paydate");//付款日期 + String jyrq = sdf.format(paydate); + String jyzy = dataEntity.getString("description");//摘要 + String tqq9_cwztfkzt = dataEntity.getString("tqq9_cwztfkzt");//财务中台付款状态 + + // [0:中台接收成功, + // 1:中台接收失败, + // 2:发送E企明成功, + // 3:发送E企明失败, + // 4:交易成功:E企明付款成功, 交易成功:E企明付款成功。-D + // 5:交易失败:E企明付款失败, 交易失败:E企明付款失败。-F + // 6:交易处理中:E企明付款处理中, 交易处理中:E企明付款处理中。-E + // 7:交易退回:E企明付款被退回] 交易退回:E企明付款被退回。-G + String fkzt = null; + if("D".equals(tqq9_cwztfkzt)){ + fkzt = "4"; + }else if("F".equals(tqq9_cwztfkzt)){ + fkzt = "5"; + }else if("E".equals(tqq9_cwztfkzt)){ + fkzt = "6"; + }else if("G".equals(tqq9_cwztfkzt)){ + fkzt = "7"; + } + 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); + } + if(StringUtils.isBlank(filename)){ + filename = "银行电子回单"+new Date().getTime()+".pdf"; + } + + JSONObject mainTable = new JSONObject(); + mainTable.put("lcid", tqq9_fwrequestid); + mainTable.put("fkzt", fkzt); + mainTable.put("dzhdwjbh", tqq9_dzhdbh); + mainTable.put("jyrq", jyrq); + mainTable.put("jyzy", jyzy); + JSONArray files = new JSONArray(); + JSONObject file = new JSONObject(); + file.put("name", filename); + file.put("content", tqq9_digital_receipt); + files.add(file); + mainTable.put("dzhdwj", files); + + String billno = dataEntity.getString("billno"); + DynamicObject creator = dataEntity.getDynamicObject("creator"); + creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(),"bos_user"); + String tqq9_fwuserid = creator.getString("tqq9_fwuserid"); + + FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); + fwRestfulUtils.pushData(mainTable, tqq9_fwuserid, billno, "cas_paybill"); + + } + + } + } } diff --git a/lc123/cloud/app/plugin/operate/im/OtherOutPushExprnoOp.java b/lc123/cloud/app/plugin/operate/im/OtherOutPushExprnoOp.java index 7b9bbab..406387b 100644 --- a/lc123/cloud/app/plugin/operate/im/OtherOutPushExprnoOp.java +++ b/lc123/cloud/app/plugin/operate/im/OtherOutPushExprnoOp.java @@ -35,16 +35,19 @@ public class OtherOutPushExprnoOp extends AbstractOperationServicePlugIn { String billno = dataEntity.getString("billno"); String tqq9_fwrequestid = dataEntity.getString("tqq9_fwrequestid"); - JSONObject mainTable = new JSONObject(); - mainTable.put("lcid", tqq9_fwrequestid); - mainTable.put("kddh", kddh); + if(StringUtils.isNotBlank(tqq9_fwrequestid)){ + JSONObject mainTable = new JSONObject(); + mainTable.put("lcid", tqq9_fwrequestid); + mainTable.put("kddh", kddh); - DynamicObject creator = dataEntity.getDynamicObject("creator"); - creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(),"bos_user"); - String tqq9_fwuserid = creator.getString("tqq9_fwuserid"); + DynamicObject creator = dataEntity.getDynamicObject("creator"); + creator = BusinessDataServiceHelper.loadSingle(creator.getPkValue(),"bos_user"); + String tqq9_fwuserid = creator.getString("tqq9_fwuserid"); + + FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); + String resultStr = fwRestfulUtils.pushData(mainTable, tqq9_fwuserid, billno, "im_otheroutbill"); + } - FWRestfulUtils fwRestfulUtils = new FWRestfulUtils(); - String resultStr = fwRestfulUtils.pushData(mainTable, tqq9_fwuserid, billno, "im_otheroutbill"); } } diff --git a/lc123/cloud/app/plugin/trd/FWImpl.java b/lc123/cloud/app/plugin/trd/FWImpl.java index c7a5691..64bf8bd 100644 --- a/lc123/cloud/app/plugin/trd/FWImpl.java +++ b/lc123/cloud/app/plugin/trd/FWImpl.java @@ -531,7 +531,7 @@ public class FWImpl { String filePath = (String) attachment.get("url"); String fileName = (String) attachment.get("name"); byte[] bytes = HttpUtil.downloadBytes(filePath); - String str = "base64:" + cn.hutool.core.codec.Base64.encode(bytes); + String str = cn.hutool.core.codec.Base64.encode(bytes);//"base64:" + JSONObject fj = new JSONObject(); fj.put("content", str); fj.put("name", fileName); @@ -3901,7 +3901,6 @@ public class FWImpl { String orgNumber = org.getString("number"); String ywgz = FWUtils.getFwOrgNumberByKdOrgNumber(orgNumber);//业务归属 - String kczz = ywgz;//库存组织 String djlx = null;//单据类型 DynamicObject billtype = bill.getDynamicObject("billtype");//单据类型 if (null != billtype) { @@ -4131,7 +4130,7 @@ public class FWImpl { m6.put("fieldValue", ywgz); JSONObject m7 = new JSONObject();// m7.put("fieldName", "kczz"); - m7.put("fieldValue", kczz); + m7.put("fieldValue", ywgz); JSONObject m8 = new JSONObject();// m8.put("fieldName", "djlx"); m8.put("fieldValue", djlx); @@ -5358,24 +5357,24 @@ public class FWImpl { }else if ("5".equals(materialtype)){ wllx = "特征件"; } - String ywzx = ""; + String ywzxdx = ""; DynamicObjectCollection serviceattribute = bill.getDynamicObjectCollection("serviceattribute"); for (DynamicObject attribute : serviceattribute) { long id = attribute.getLong("fbasedataid.id"); attribute = BusinessDataServiceHelper.loadSingle(id, "bd_serviceattribute", "id,name,number,operatorid"); String number = attribute.getString("number"); if(number.contains("1001")){ - ywzx = ywzx + ",0"; + ywzxdx = ywzxdx + ",0"; }else if (number.equals("2001")){ - ywzx = ywzx + ",1"; + ywzxdx = ywzxdx + ",1"; }else if (number.equals("2002")){ - ywzx = ywzx + ",2"; + ywzxdx = ywzxdx + ",2"; }else if (number.equals("2003")){ - ywzx = ywzx + ",3"; + ywzxdx = ywzxdx + ",3"; } } - if(StringUtils.isNotBlank(ywzx)){ - ywzx = ywzx.substring(1); + if(StringUtils.isNotBlank(ywzxdx)){ + ywzxdx = ywzxdx.substring(1); } String ym = bill.getString("tqq9_ym"); String ssbm = null; @@ -5502,8 +5501,8 @@ public class FWImpl { m27.put("fieldName", "wllx"); m27.put("fieldValue", wllx); JSONObject m28 = new JSONObject(); - m28.put("fieldName", "ywzx"); - m28.put("fieldValue", ywzx); + m28.put("fieldName", "ywzxdx"); + m28.put("fieldValue", ywzxdx); JSONObject m29 = new JSONObject(); m29.put("fieldName", "ym"); m29.put("fieldValue", ym); diff --git a/lc123/cloud/app/plugin/utils/FWRestfulUtils.java b/lc123/cloud/app/plugin/utils/FWRestfulUtils.java index 6439523..f5eb4fd 100644 --- a/lc123/cloud/app/plugin/utils/FWRestfulUtils.java +++ b/lc123/cloud/app/plugin/utils/FWRestfulUtils.java @@ -80,8 +80,11 @@ public class FWRestfulUtils { requestName = "推送仓库信息"; ourl = "api/cube/restful/interface/saveOrUpdateModeData/CK"; }else if("im_otheroutbill".equals(entityName)){ - requestName = "推送快递单号信息"; + requestName = "快递单号回传"; ourl = "api/cube/restful/interface/saveOrUpdateModeData/KDDHCX"; + }else if("cas_paybill".equals(entityName)){ + requestName = "付款状态回传"; + ourl = "api/cube/restful/interface/saveOrUpdateModeData/FKZTHC"; } System.out.println("===请求参数dataparam==="+dataParam);