wenminjie
2026-08-03 ddc84625dcdb22a1ec2407f6adc7eb2e7a839ef0
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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<PageResult<DependentCardApplyAdminResponse>> 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<DependentCardApplyAdminResponse> 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<DependentCardApplyAdminResponse> 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<List<DependentCardApplyStatusLogResponse>> statusLogs(@PathVariable Long id) {
        return ApiResponse.success(service.statusLogs(id));
    }
}