Browse Source

推送url debug

master
PoffyZhang 1 year ago
parent
commit
ea497c3389
1 changed files with 15 additions and 2 deletions
  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 View File

@@ -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());


Loading…
Cancel
Save