From 96c138a2a6df24e22767aea7bd63a42c07a108ce Mon Sep 17 00:00:00 2001 From: zhaoqing <1670883518@qq.com> Date: Fri, 15 May 2026 16:32:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E9=80=81=E6=95=B0=E6=8D=AE=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessPartnerApplicationService.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessPartner/BusinessPartnerApplicationService.java b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessPartner/BusinessPartnerApplicationService.java index 5ce1d0038..db78414eb 100644 --- a/mhd_oms/src/main/java/com/mhd/oms/application/service/businessPartner/BusinessPartnerApplicationService.java +++ b/mhd_oms/src/main/java/com/mhd/oms/application/service/businessPartner/BusinessPartnerApplicationService.java @@ -24,10 +24,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.IOException; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; @Service @Slf4j @@ -91,14 +88,19 @@ public class BusinessPartnerApplicationService { for (BusinessPartnerDTO businessPartnerDTO :businessPartnerDTOList){ - Map body = new HashMap<>(); - body.put("copyCode",businessPartnerDTO.getCorpCode()); - body.put("copyName",businessPartnerDTO.getCorpName()); + // 构建单个对象 + Map item = new HashMap<>(); + item.put("corpCode", businessPartnerDTO.getCorpCode()); + item.put("corpName", businessPartnerDTO.getCorpName()); + +// 包装成数组 + List> bodyList = new ArrayList<>(); + bodyList.add(item); GwLog gwLog = new GwLog(); gwLog.setType("商业合作伙伴"); gwLog.setBusinessId(Long.valueOf(businessPartnerDTO.getShipperId())); - gwLog.setRequestBody(JSONObject.toJSONString(body)); + gwLog.setRequestBody(JSONObject.toJSONString(bodyList)); gwLog.setResponseBody(""); gwLog.setStatus(1); gwLog.setSendTime(new Date()); @@ -114,7 +116,7 @@ public class BusinessPartnerApplicationService { CloseableHttpClient httpClient = HttpClients.createDefault(); HttpPost httpPost = new HttpPost(PUSH_API_URL); - StringEntity postingString = new StringEntity(JSONObject.toJSONString(body),"UTF-8"); + StringEntity postingString = new StringEntity(JSONObject.toJSONString(bodyList),"UTF-8"); httpPost.setEntity(postingString); httpPost.setHeader("Content-type", "application/json"); httpPost.setHeader("apiName", API_NAME);