xyc
3 天以前 53052625c7c520744a4ca061e204ec9594ca67f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.emergencyrepair.business.controller;
 
import com.emergencyrepair.business.dto.report.ReportContractorDto;
import com.emergencyrepair.business.dto.report.ReportMetricDto;
import com.emergencyrepair.business.dto.report.ReportOverviewDto;
import com.emergencyrepair.business.dto.report.ReportTeamDto;
import com.emergencyrepair.business.dto.report.ReportTrendDto;
import com.emergencyrepair.business.service.ReportService;
import com.emergencyrepair.common.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import java.util.List;
 
@RestController
@RequestMapping("/api/reports")
@RequiredArgsConstructor
public class ReportController {
    private final ReportService reportService;
 
    @GetMapping("/overview")
    public Result<ReportOverviewDto> overview() {
        return Result.ok(reportService.overview());
    }
 
    @GetMapping("/top-equipment")
    public Result<List<ReportMetricDto>> topEquipment() {
        return Result.ok(reportService.topEquipment());
    }
 
    @GetMapping("/by-team")
    public Result<List<ReportTeamDto>> byTeam() {
        return Result.ok(reportService.byTeam());
    }
 
    @GetMapping("/contractors")
    public Result<List<ReportContractorDto>> contractors() {
        return Result.ok(reportService.contractors());
    }
 
    @GetMapping("/yearly-trend")
    public Result<List<ReportTrendDto>> yearlyTrend() {
        return Result.ok(reportService.yearlyTrend());
    }
}