57 lines
2.1 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package com.designhub.controller;
import com.designhub.common.Result;
import com.designhub.entity.Task;
import com.designhub.service.DesignerService;
import com.designhub.vo.DesignerStatsVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 设计师统计Controller
*/
@Tag(name = "设计师管理", description = "设计师统计和排行榜相关API")
@RestController
@RequestMapping("/api/designers")
@RequiredArgsConstructor
public class DesignerController {
private final DesignerService designerService;
@Operation(summary = "获取所有设计师统计信息")
@GetMapping("/stats")
public Result<List<DesignerStatsVO>> getAllDesignerStats(
@Parameter(description = "部门ID,不传则查询所有接单部门") @RequestParam(required = false) Long deptId
) {
return Result.success(designerService.getAllDesignerStats(deptId));
}
@Operation(summary = "获取单个设计师统计信息")
@GetMapping("/stats/{userId}")
public Result<DesignerStatsVO> getDesignerStats(@PathVariable Long userId) {
return Result.success(designerService.getDesignerStats(userId));
}
@Operation(summary = "获取排行榜")
@GetMapping("/leaderboard")
public Result<List<DesignerStatsVO>> getLeaderboard(
@RequestParam(required = false, defaultValue = "score") String type,
@RequestParam(required = false, defaultValue = "10") Integer limit,
@Parameter(description = "月份,格式:YYYY-MM,不传则查询当月") @RequestParam(required = false) String month
) {
return Result.success(designerService.getLeaderboard(type, limit, month));
}
@Operation(summary = "获取设计师进行中的任务列表")
@GetMapping("/{userId}/in-progress-tasks")
public Result<List<java.util.Map<String, Object>>> getDesignerInProgressTasks(@PathVariable Long userId) {
return Result.success(designerService.getDesignerInProgressTasks(userId));
}
}