package com.iplatform.base.controller; import com.iplatform.base.SystemController; import com.iplatform.base.service.ApiTimeServiceImpl; import com.iplatform.model.vo.ApiTime; import com.walker.infrastructure.utils.StringUtils; import com.walker.web.ResponseValue; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.List; @RestController @RequestMapping("/test/api") public class ApiTimeController extends SystemController { private ApiTimeServiceImpl apiTimeService; @Autowired public ApiTimeController(ApiTimeServiceImpl apiTimeService){ this.apiTimeService = apiTimeService; } /** * 查询接口调用时间记录 * @param currentDate 当前日期,如:20240229(可选) * @param maxSize 限制返回记录最大条数,如:200(可选) * @param cost 条件:最小花费时间,毫秒,超过该时间的记录,如:200(可选) * @return */ @RequestMapping("/time") public ResponseValue getCostMostList(String currentDate, String cost, String maxSize){ Integer dateValue = null; Integer maxSizeValue = null; Long costValue = null; if(StringUtils.isNotEmpty(currentDate)){ dateValue = Integer.parseInt(currentDate); } if(StringUtils.isNotEmpty(maxSize)){ maxSizeValue = Integer.parseInt(maxSize); } if(StringUtils.isNotEmpty(cost)){ costValue = Long.parseLong(cost); } List data = this.apiTimeService.queryCostList(dateValue, maxSizeValue, costValue); return ResponseValue.success(data); } }