From cc28fb9a147f653228dbc7e1e1c2d9d521e368b3 Mon Sep 17 00:00:00 2001 From: wangkang Date: Wed, 10 May 2017 14:26:23 +0800 Subject: [PATCH] =?UTF-8?q?rms=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/egridcloud/udf/rms/Rms.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/Rms.java b/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/Rms.java index 5ce7aca..e663ea4 100644 --- a/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/Rms.java +++ b/udf-starter-rms/src/main/java/com/egridcloud/udf/rms/Rms.java @@ -6,6 +6,9 @@ */ package com.egridcloud.udf.rms; +import java.util.HashMap; +import java.util.Map; + import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -15,6 +18,7 @@ import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; +import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; @@ -61,11 +65,13 @@ public class Rms { * @param input 输入参数 * @param uriParam uri参数 * @param uriVariables rest参数 + * @param responseType 返回类型 * @param 输入类型 * @param 输出类型 * @return 服务结果 */ - public O call(String serviceCode, I input, String uriParam, Object... uriVariables) { + public ResponseEntity call(String serviceCode, I input, String uriParam, Map uriVariables, + ParameterizedTypeReference responseType) { //构建请求路径 String path = getRmsUrl(serviceCode); //获得请求方法 @@ -80,8 +86,8 @@ public class Rms { HttpEntity requestEntity = new HttpEntity<>(input, httpHeaders); //请求并且返回 LOGGER.info("rms url : {} , method : {} ", path, method); - return restTemplate.exchange(path, HttpMethod.resolve(method), requestEntity, new ParameterizedTypeReference() { - }, uriVariables).getBody(); + return restTemplate.exchange(path, HttpMethod.resolve(method), requestEntity, responseType, + uriVariables != null ? uriVariables : new HashMap()); } /**