ServerController.java 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. package com.yihu.hos.controllers;
  2. import com.yihu.hos.services.ServerService;
  3. import com.yihu.hos.web.framework.model.Result;
  4. import io.swagger.annotations.ApiOperation;
  5. import io.swagger.annotations.ApiParam;
  6. import org.springframework.stereotype.Controller;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.bind.annotation.RequestMethod;
  9. import org.springframework.web.bind.annotation.RequestParam;
  10. import org.springframework.web.bind.annotation.ResponseBody;
  11. import javax.annotation.Resource;
  12. @Controller
  13. @RequestMapping("/server")
  14. public class ServerController {
  15. @Resource(name = ServerService.BEAN_ID)
  16. private ServerService serverService;
  17. @RequestMapping(value = "/qps/mapReduce", method = RequestMethod.POST)
  18. @ResponseBody
  19. @ApiOperation(value = "计算qps", produces = "application/json", notes = "计算qps")
  20. public Result mapReduce(
  21. @ApiParam(name = "beginTime", value = "开始时间", required = true)
  22. @RequestParam(value = "beginTime") String beginTime,
  23. @ApiParam(name = "endTime", value = "结束时间", required = true)
  24. @RequestParam(value = "endTime") String endTime) {
  25. return serverService.mapReduce(beginTime, endTime);
  26. }
  27. @RequestMapping(value = "/qps/aggregate", method = RequestMethod.POST)
  28. @ResponseBody
  29. @ApiOperation(value = "获取qps", produces = "application/json", notes = "获取qps")
  30. public Result aggregate(
  31. @ApiParam(name = "beginTime", value = "开始时间", required = true)
  32. @RequestParam(value = "beginTime") String beginTime,
  33. @ApiParam(name = "endTime", value = "结束时间", required = true)
  34. @RequestParam(value = "endTime") String endTime) {
  35. return serverService.aggregate(beginTime, endTime);
  36. }
  37. }