package com.yihu.hos.controllers; import com.yihu.hos.services.ServerService; import com.yihu.hos.web.framework.model.Result; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import javax.annotation.Resource; @Controller @RequestMapping("/server") public class ServerController { @Resource(name = ServerService.BEAN_ID) private ServerService serverService; @RequestMapping(value = "/qps/mapReduce", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "计算qps", produces = "application/json", notes = "计算qps") public Result mapReduce( @ApiParam(name = "beginTime", value = "开始时间", required = true) @RequestParam(value = "beginTime") String beginTime, @ApiParam(name = "endTime", value = "结束时间", required = true) @RequestParam(value = "endTime") String endTime) { return serverService.mapReduce(beginTime, endTime); } @RequestMapping(value = "/qps/aggregate", method = RequestMethod.POST) @ResponseBody @ApiOperation(value = "获取qps", produces = "application/json", notes = "获取qps") public Result aggregate( @ApiParam(name = "beginTime", value = "开始时间", required = true) @RequestParam(value = "beginTime") String beginTime, @ApiParam(name = "endTime", value = "结束时间", required = true) @RequestParam(value = "endTime") String endTime) { return serverService.aggregate(beginTime, endTime); } }