|  |  | 
 |  |  | 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.apache.logging.log4j.LogManager; | 
 |  |  | import org.apache.logging.log4j.Logger; | 
 |  |  | 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 | 
 |  |  | 
 |  |  |  * @LastEditTime 2023/12/21 20:28 | 
 |  |  |  * @Description | 
 |  |  |  */ | 
 |  |  | @Slf4j | 
 |  |  | @Component() | 
 |  |  | public class CommandResultDeal { | 
 |  |  |  | 
 |  |  |     private static final Logger log = LogManager.getLogger(CommandResultDeal.class.getName()); | 
 |  |  |  | 
 |  |  |     private RestTemplate restTemplate; | 
 |  |  |  | 
 |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     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 { |