推送数据类型错误
This commit is contained in:
+11
-9
@@ -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<String, String> body = new HashMap<>();
|
||||
body.put("copyCode",businessPartnerDTO.getCorpCode());
|
||||
body.put("copyName",businessPartnerDTO.getCorpName());
|
||||
// 构建单个对象
|
||||
Map<String, String> item = new HashMap<>();
|
||||
item.put("corpCode", businessPartnerDTO.getCorpCode());
|
||||
item.put("corpName", businessPartnerDTO.getCorpName());
|
||||
|
||||
// 包装成数组
|
||||
List<Map<String, String>> 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);
|
||||
|
||||
Reference in New Issue
Block a user