Quellcode durchsuchen

推送url debug

tags/24080901
PoffyZhang vor 1 Jahr
Ursprung
Commit
ea497c3389
1 geänderte Dateien mit 15 neuen und 2 gelöschten Zeilen
  1. +15
    -2
      pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java

+ 15
- 2
pmapi/src/main/java/com/ningdatech/pmapi/gov/manage/GovProjectCollectionManage.java Datei anzeigen

@@ -26,6 +26,9 @@ import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
@@ -408,7 +411,12 @@ public class GovProjectCollectionManage {
ProjectPushReq req = ProjectConvert.convert(saveDTO);
try{
log.info("推送消息体 {} ,{},{}",saveDTO.getBaseProjId(),url, JSON.toJSONString(req));
ResponseEntity<String> response = restTemplate.postForEntity(url, null, String.class, req);
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity<ProjectPushReq> formEntity = new HttpEntity<ProjectPushReq>(req, headers);
ResponseEntity<String> response = restTemplate.postForEntity(url, formEntity, String.class);
log.info("推送结果 {} :{}",saveDTO.getBaseProjId(),response);
}catch (Exception e){
log.info("推送失败,{}",e.getMessage());
@@ -425,7 +433,12 @@ public class GovProjectCollectionManage {
ProjectBaseInfoReq req = ProjectConvert.convertBase(baseinfo);
try{
log.info("推送消息体 {},{},{}",baseinfo.getBaseProjId(),url, JSON.toJSONString(req));
ResponseEntity<String> response = restTemplate.postForEntity(url, null, String.class, req);
HttpHeaders headers = new HttpHeaders();
MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
headers.setContentType(type);
headers.add("Accept", MediaType.APPLICATION_JSON.toString());
HttpEntity<ProjectBaseInfoReq> formEntity = new HttpEntity<ProjectBaseInfoReq>(req, headers);
ResponseEntity<String> response = restTemplate.postForEntity(url, formEntity, String.class);
log.info("推送结果 {} :{}",baseinfo.getBaseProjId(),response);
}catch (Exception e){
log.info("推送失败,{}",e.getMessage());


Laden…
Abbrechen
Speichern