提交 cf92dc40 authored 作者: 李炎's avatar 李炎

测试http

上级 89505b68
...@@ -77,7 +77,10 @@ public class KingdeeLogUtil { ...@@ -77,7 +77,10 @@ public class KingdeeLogUtil {
Map map = ThreadLocalConfig.get(); Map map = ThreadLocalConfig.get();
Kingdeelog kingdeelog = new Kingdeelog(); Kingdeelog kingdeelog = new Kingdeelog();
if (!ObjectUtils.isEmpty(map)) { if (!ObjectUtils.isEmpty(map)) {
long costime = Long.valueOf(map.get("Costime").toString()); System.out.println("<==========Log2Local" + map);
Object o = map.get("Costime");
String s = o.toString();
long costime = Long.valueOf(s);
kingdeelog.setCostTime(costime); kingdeelog.setCostTime(costime);
} }
//设置金蝶云请求日志 //设置金蝶云请求日志
......
...@@ -32,12 +32,31 @@ public class KingdeeApiClient { ...@@ -32,12 +32,31 @@ public class KingdeeApiClient {
public <T> T execute(String servicename, Object[] parameters, Class<T> returnType) throws Exception { public <T> T execute(String servicename, Object[] parameters, Class<T> returnType) throws Exception {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
T execute = api.execute(servicename, parameters, returnType); T execute = api.execute(servicename, parameters, returnType);
long endTime = System.currentTimeMillis(); long duration = System.currentTimeMillis() - startTime;
long duration = endTime - startTime; log.info("<======sdk请求耗时:" + duration + "毫秒");
log.info("请求耗时:" + duration + "毫秒");
execute(servicename, parameters);
return execute; return execute;
} }
public void execute(String serviceName, Object[] parameters) throws Exception {
String cookie = HttpUtil.login(this._serverUrl);
log.info("cookie:" + cookie);
Map<String, Object> header = new HashMap<>(1);
header.put("cookie", cookie);
Map<String, Object> request = new HashMap<>(1);
request.put("parameters", parameters);
String url = this._serverUrl + serviceName + ".common.kdsvc";
String requestStr = JsonUtil.toString(request);
long start = System.currentTimeMillis();
ResponseEntity<String> responseEntity = HttpUtil.httpPost(url, header, requestStr);
long costTime = System.currentTimeMillis() - start;
log.info("<======模拟http耗时:" + String.valueOf(costTime));
log.info("Body_" + responseEntity.getBody());
}
public String checkAuthInfo() { public String checkAuthInfo() {
try { try {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论