|
|
@ -77,6 +77,7 @@ public class FuncCarApiServiceImpl implements IFuncCarApiService { |
|
|
|
lqw.eq(bo.getResponseTime() != null, FuncCarApi::getResponseTime, bo.getResponseTime()); |
|
|
|
LoginUser loginUser = LoginHelper.getLoginUser(); |
|
|
|
lqw.eq(FuncCarApi::getUserId, loginUser.getUserId()); |
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getType()), FuncCarApi::getType, bo.getType()); |
|
|
|
return lqw; |
|
|
|
} |
|
|
|
|
|
|
@ -127,6 +128,7 @@ public class FuncCarApiServiceImpl implements IFuncCarApiService { |
|
|
|
HttpResponse httpResponse = request.execute(); |
|
|
|
bo.setResponseTime(System.currentTimeMillis() - start); |
|
|
|
bo.setJsonResult(httpResponse.body()); |
|
|
|
bo.setType("compatibility"); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
@ -158,23 +160,24 @@ public class FuncCarApiServiceImpl implements IFuncCarApiService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public String checkApi(FuncCarApiDto bo) { |
|
|
|
public String checkApi(FuncCarApi add) { |
|
|
|
HttpRequest request; |
|
|
|
if(StringUtils.isEmpty(bo.getRequestMethod())){ |
|
|
|
request = HttpUtil.createRequest(Method.GET, bo.getApiUrl()); |
|
|
|
if(StringUtils.isEmpty(add.getRequestMethod())){ |
|
|
|
request = HttpUtil.createRequest(Method.GET, add.getApiUrl()); |
|
|
|
}else { |
|
|
|
if(bo.getRequestMethod().toLowerCase().contains("post")){ |
|
|
|
request = HttpUtil.createRequest(Method.POST, bo.getApiUrl()); |
|
|
|
if(add.getRequestMethod().toLowerCase().contains("post")){ |
|
|
|
request = HttpUtil.createRequest(Method.POST, add.getApiUrl()); |
|
|
|
}else { |
|
|
|
request = HttpUtil.createRequest(Method.GET, bo.getApiUrl()); |
|
|
|
request = HttpUtil.createRequest(Method.GET, add.getApiUrl()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
request.header(Header.CONNECTION,"keep-alive"); |
|
|
|
request.header(Header.ACCEPT,"*/*"); |
|
|
|
request.header(Header.CONTENT_TYPE,"application/json; charset=UTF-8"); |
|
|
|
request.header(Header.CACHE_CONTROL,"max-age=0"); |
|
|
|
request.header(Header.USER_AGENT,"Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0) "); |
|
|
|
|
|
|
|
request.body(add.getOperParam()); |
|
|
|
String body = ""; |
|
|
|
try { |
|
|
|
body = request.execute().body(); |
|
|
@ -193,6 +196,13 @@ public class FuncCarApiServiceImpl implements IFuncCarApiService { |
|
|
|
}catch (Exception e){ |
|
|
|
body = "api接口调用异常:"+ e.getMessage(); |
|
|
|
} |
|
|
|
|
|
|
|
add.setOperTime(new Date()); |
|
|
|
LoginUser loginUser = LoginHelper.getLoginUser(); |
|
|
|
add.setUserId(loginUser.getUserId()); |
|
|
|
add.setJsonResult(body); |
|
|
|
add.setType("checkApi"); |
|
|
|
baseMapper.insert(add); |
|
|
|
return body; |
|
|
|
} |
|
|
|
|
|
|
|