From d89283912fdc937f5da3497868f5c5c065e73b2a Mon Sep 17 00:00:00 2001 From: zoujiangtao Date: Mon, 11 Nov 2024 16:21:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=BA=EF=BC=9A=E9=82=B9?= =?UTF-8?q?=E6=B1=9F=E6=B6=9B=20=E4=BF=AE=E6=94=B9=E5=86=85=E5=AE=B9?= =?UTF-8?q?=EF=BC=9AAPI=E5=85=A5=E5=8F=82=E5=87=BA=E5=8F=82=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=20=E4=BF=AE=E6=94=B9=E6=97=B6=E9=97=B4=EF=BC=9A2024/1?= =?UTF-8?q?1/11?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sys/plugin/api/PayBillApiSavePlugin.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/api/PayBillApiSavePlugin.java b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/api/PayBillApiSavePlugin.java index 29da733..db952ff 100644 --- a/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/api/PayBillApiSavePlugin.java +++ b/sys/shkd-sys-sys/src/main/java/shkd/sys/sys/plugin/api/PayBillApiSavePlugin.java @@ -1,5 +1,8 @@ package shkd.sys.sys.plugin.api; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import kd.bos.dataentity.entity.DynamicObject; @@ -22,9 +25,12 @@ import java.util.Map; */ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin { private static final long serialVersionUID = 7055073356277386444L; + private String shkd_businessid; + private String shkd_businessnumber; @Override public List> preHandleRequestData(List> reqData) { + //付款处理 → 收款人ID payee → 付款银行.编码 payerbank_number payeetype 收款人类型 → payeenumber 收款人编码 //payeracctbank_number 付款银行账号.number @@ -33,6 +39,7 @@ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin //重复支付校验 + String objectType;//对象类型(收/付人类型) String objectNumber;//对象编码(收/付人编码) String fieldName1;//字段名称(收/付人ID) @@ -40,6 +47,7 @@ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin String bankNumber;//(收/付款银行账号.number) String fieldName2;//字段名称(收/付款银行.number) for (Map map : reqData) { + Object payeetype = map.get("payeetype");//如果是收款人类型 则为付款处理保存接口 Object payertype = map.get("payertype");//如果是付款人类型 则为收款处理保存接口 if (payeetype != null) { @@ -67,7 +75,8 @@ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin map.put(fieldName1, dynamicObject.getString("id")); map.put(fieldName2, amAccountbank.getDynamicObject("bank").getString("number")); } - + shkd_businessid = map.get("shkd_businessid").toString(); + shkd_businessnumber = map.get("shkd_businessnumber").toString(); // shkd_businessid // shkd_businessnumber // shkd_businessname @@ -81,7 +90,15 @@ public class PayBillApiSavePlugin implements ApiSavePlugin, ApiSerializerPlugin if (contentType.contains(MediaType.APPLICATION_JSON)) { //返回text文本 String responseStr = new ObjectMapper().writeValueAsString(response); - return new SerializerResult(MediaType.TEXT_PLAIN, "实际返回:" + responseStr); + JSONObject jsonObject = JSON.parseObject(responseStr); + // 获取 data 节点 + JSONObject data = jsonObject.getJSONObject("data"); + + // 获取 result 节点 + JSONArray result = data.getJSONArray("result"); + result.getJSONObject(0).put("shkd_businessid", shkd_businessid); + result.getJSONObject(0).put("shkd_businessnumber", shkd_businessnumber); + return new SerializerResult(MediaType.TEXT_PLAIN, jsonObject.toJSONString()); } else { //其他类型的出参序列化 return null;