...
|
...
|
@@ -3,6 +3,7 @@ package com.monitor.javaserver.ctrl; |
|
|
import com.monitor.javaserver.client.JavaApiClient;
|
|
|
import com.monitor.javaserver.service.IJavaApiStatusService;
|
|
|
import com.monitor.model.page.PageResponse;
|
|
|
import com.monitor.model.request.JavaApiHisReq;
|
|
|
import com.monitor.model.request.JavaApiStatusReq;
|
|
|
import com.monitor.model.response.BaseResponse;
|
|
|
import com.monitor.model.response.JavaApiStatusRep;
|
...
|
...
|
@@ -23,9 +24,9 @@ import java.util.List; |
|
|
*/
|
|
|
@Controller
|
|
|
@RequestMapping("javaApiStatus")
|
|
|
public class JavaAppInfoCtrl {
|
|
|
public class JavaAppInfoStaticsCtrl {
|
|
|
|
|
|
Logger log = LoggerFactory.getLogger(JavaAppInfoCtrl.class);
|
|
|
Logger log = LoggerFactory.getLogger(JavaAppInfoStaticsCtrl.class);
|
|
|
@Autowired
|
|
|
IJavaApiStatusService javaApiStatusService;
|
|
|
|
...
|
...
|
@@ -98,34 +99,29 @@ public class JavaAppInfoCtrl { |
|
|
|
|
|
@RequestMapping("/queryhis")
|
|
|
@ResponseBody
|
|
|
public BaseResponse getJavaApiStatusHis(@RequestParam(required = false, defaultValue = "0") int api_id,
|
|
|
@RequestParam(required = false, defaultValue = "0") int mobj_id,
|
|
|
@RequestParam(required = false, defaultValue = "0") long start_time,
|
|
|
@RequestParam(required = false, defaultValue = "0") long end_time,
|
|
|
@RequestParam(required = false, defaultValue = "0") int page,
|
|
|
@RequestParam(required = false, defaultValue = "10") int pageSize) {
|
|
|
if (start_time == 0) {
|
|
|
return getJavaApiStatusHisLatest(api_id, mobj_id);
|
|
|
public BaseResponse getJavaApiStatusHis(@RequestBody JavaApiHisReq req) {
|
|
|
if (req.getStartTime() == 0) {
|
|
|
return getJavaApiStatusHisLatest(req.getApiId(), req.getMobjId());
|
|
|
}
|
|
|
|
|
|
if (end_time == 0)
|
|
|
end_time = System.currentTimeMillis();
|
|
|
if (req.getEndTime() == 0)
|
|
|
req.setEndTime( System.currentTimeMillis());
|
|
|
|
|
|
|
|
|
BaseResponse baseResponse = new BaseResponse();
|
|
|
PageResponse<JavaApiStatusRep> pageResponse = new PageResponse<JavaApiStatusRep>();
|
|
|
try {
|
|
|
|
|
|
int count = javaApiStatusService.countJavaApiStatusHisByTime(api_id, mobj_id, start_time, end_time);
|
|
|
int count = javaApiStatusService.countJavaApiStatusHisByTime(req);
|
|
|
|
|
|
List<JavaApiStatusRep> javaApiStatusRepList = javaApiStatusService.getJavaApiStatusHisByTime(api_id, mobj_id, start_time, end_time, page, pageSize);
|
|
|
List<JavaApiStatusRep> javaApiStatusRepList = javaApiStatusService.getJavaApiStatusHisByTime(req);
|
|
|
pageResponse.setRows(javaApiStatusRepList);
|
|
|
pageResponse.setCurrentPage(page);
|
|
|
pageResponse.setPageSize(pageSize);
|
|
|
pageResponse.setCurrentPage(req.getCurrentPage());
|
|
|
pageResponse.setPageSize(req.getPageSize());
|
|
|
pageResponse.setTotal(count);
|
|
|
baseResponse.setData(pageResponse);
|
|
|
} catch (Exception e) {
|
|
|
log.warn("queryhis failed apiId :{} mobjId:{} start_time:{} endTime:{} ,page:{} ", api_id, mobj_id, start_time, end_time, page, e);
|
|
|
log.warn("queryhis failed req {}", req, e);
|
|
|
baseResponse.setCode(400);
|
|
|
baseResponse.setMessage(e.getMessage());
|
|
|
}
|
...
|
...
|
|