package com.moral.api.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; import javax.validation.Valid; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.moral.api.dto.OnlineRatePageCond; import com.moral.api.service.DeviceService; import com.moral.api.vo.OnlineRateVo; import com.moral.constant.ResultMessage; /** * Description //todo * * @author swb * @ClassName DeviceOnlineRateController * @date 2024.01.26 10:02 */ @RestController @RequestMapping("/onlineRate") @Api(tags = {"设备在线率"}) public class DeviceOnlineRateController { @Autowired private DeviceService deviceService; @PostMapping("/page") @ApiOperation("分页") public ResultMessage page(@Valid @RequestBody OnlineRatePageCond onlineRatePageCond) { List rsList = deviceService.getPage(onlineRatePageCond); // PageResult result = new PageResult<>(page); // result.setList(page.getRecords()); return ResultMessage.ok(rsList); } @GetMapping("/detail") @ApiOperation("详情") public ResultMessage get(@RequestParam @ApiParam(value = "mac",name = "mac")String mac, @RequestParam @ApiParam(value = "startTime",name = "开始时间") String startTime, @RequestParam @ApiParam(value = "endTime",name = "结束时间") String endTime, @RequestParam @ApiParam(value = "type",name = "时间类型") String type){ Map detail = deviceService.detail(mac, startTime, endTime, type); return ResultMessage.ok(detail); } @GetMapping("state") @ApiOperation("当前在线率") public ResultMessage state(Integer organizationId){ Map start = deviceService.getStart(organizationId); return ResultMessage.ok(start); } }