| | |
| | | package com.dy.rtuMw.web.comResult; |
| | | |
| | | import com.dy.common.mw.protocol.Command; |
| | | import com.dy.common.mw.protocol.Data; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.HttpMethod; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.http.*; |
| | | import org.springframework.http.converter.StringHttpMessageConverter; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.web.client.RestTemplate; |
| | | import org.springframework.web.util.UriComponentsBuilder; |
| | | |
| | | import java.nio.charset.StandardCharsets; |
| | | |
| | | /** |
| | | * @Author liurunyu |
| | |
| | | } |
| | | |
| | | public void deal(Data data) { |
| | | if (data.rtuResultSendWebUrl != null && !data.rtuResultSendWebUrl.trim().equals("")) { |
| | | if (data.rtuResultSendWebUrl != null |
| | | && !data.rtuResultSendWebUrl.trim().equals("") |
| | | && !data.rtuResultSendWebUrl.trim().equals(Command.ignoreRtuResultSendWebUrl)) { |
| | | String url = UriComponentsBuilder.fromUriString(data.rtuResultSendWebUrl) |
| | | .build() |
| | | .toUriString(); |
| | | restTemplate.getMessageConverters().set(1,new StringHttpMessageConverter(StandardCharsets.UTF_8)); |
| | | HttpHeaders headers = new HttpHeaders(); |
| | | headers.setContentType(MediaType.parseMediaType("application/json;charset=UTF-8")); |
| | | HttpEntity<?> httpEntity = new HttpEntity<>(data, headers); |
| | | ResponseEntity<WebResponseVo> response = null; |
| | | try { |