package com.talentcard.server.business.admin; import java.util.List; import com.talentcard.server.business.PageResult; import com.talentcard.server.business.admin.auth.AdminAuthInterceptor; import com.talentcard.server.common.ApiResponse; import com.talentcard.server.request.DependentCardAuditRequest; import com.talentcard.server.response.DependentCardApplyAdminResponse; import com.talentcard.server.response.DependentCardApplyStatusLogResponse; import com.talentcard.server.service.DependentCardApplyAdminService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.validation.Valid; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestAttribute; 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; @Tag(name = "管理后台-家属附属卡审核", description = "家属附属卡申请查询、审核和状态记录") @RestController @RequestMapping("/api/admin/dependent-card-applies") public class DependentCardApplyAdminController { private final DependentCardApplyAdminService service; public DependentCardApplyAdminController(DependentCardApplyAdminService service) { this.service = service; } @Operation(summary = "分页查询家属附属卡申请") @GetMapping public ApiResponse> page( @RequestParam(required = false) Long talentCardId, @RequestParam(required = false) Integer status, @RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "10") int size ) { return ApiResponse.success(service.page(talentCardId, status, page, size)); } @Operation(summary = "查询家属附属卡申请详情") @GetMapping("/{id}") public ApiResponse detail(@PathVariable Long id) { return ApiResponse.success(service.detail(id)); } @Operation(summary = "审核家属附属卡申请", description = "仅待审核申请可以变更为通过或驳回") @ApiResponses({ @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "审核成功"), @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "400", description = "审核参数不正确"), @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", description = "申请不存在"), @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "409", description = "状态冲突或绑定名额已满") }) @PatchMapping("/{id}/audit") public ApiResponse audit( @PathVariable Long id, @Valid @RequestBody DependentCardAuditRequest request, @RequestAttribute(AdminAuthInterceptor.OPERATOR_ID_ATTRIBUTE) Long operatorId ) { return ApiResponse.success(service.audit(id, request, operatorId)); } @Operation(summary = "查询家属附属卡申请状态记录") @GetMapping("/{id}/status-logs") public ApiResponse> statusLogs(@PathVariable Long id) { return ApiResponse.success(service.statusLogs(id)); } }