Commit 2955f857 authored by fangxinjiang's avatar fangxinjiang

代码优化

parent 5c2066c5
......@@ -109,4 +109,26 @@ public class HttpDaprUtil {
stringBuffer.append(param);
}
public static <T> R<T> invokeMethodGetR(String appUrl,
String appId,
String method,
String param) {
// 实例化 RestTemplate
initResTemplate();
// 初始化请求URL
initUrl(appUrl, appId, method, param);
ResponseEntity<R> res;
try {
res = restTemplate.getForEntity(stringBuffer.toString(), R.class);
} catch (Exception e) {
return R.failed("获取信息失败:" + e.getMessage());
}
if (null != res && CommonConstants.SUCCESS == res.getStatusCodeValue()) {
return (R)res.getBody();
} else {
return R.failed("获取信息失败!");
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment