shinnosuke
4 天以前 38e39c50dcca12534c4efe2b49355a97c396b507
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package com.talentcard.server.business.portal;
 
import java.util.List;
 
import com.talentcard.server.common.ApiResponse;
import com.talentcard.server.request.DependentCardApplyRequest;
import com.talentcard.server.request.DependentCardUnbindRequest;
import com.talentcard.server.response.DependentCardApplyDetailResponse;
import com.talentcard.server.response.DependentCardApplyItemResponse;
import com.talentcard.server.response.DependentCardApplyResponse;
import com.talentcard.server.service.DependentCardApplyService;
 
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.PathVariable;
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;
 
@Tag(name = "家属附属卡申请", description = "小程序家属附属卡申请、查询与解绑")
@RestController
@RequestMapping("/api/app/family-cards/applications")
public class DependentCardApplyController {
 
    private final DependentCardApplyService service;
 
    public DependentCardApplyController(DependentCardApplyService service) {
        this.service = service;
    }
 
    @Operation(
            summary = "提交家属附属卡申请",
            description = "仅已开通权限的卓越人才卡可申请;每张主卡最多绑定2个家属,状态0/1/2的申请累计最多3个"
    )
    @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 = "无申请权限、绑定名额已满或累计申请已达到3个"),
            @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "500", description = "申请保存失败")
    })
    @PostMapping
    public ApiResponse<DependentCardApplyResponse> submit(
            @Valid @RequestBody DependentCardApplyRequest request
    ) {
        return ApiResponse.success(service.submit(request));
    }
 
    @Operation(summary = "查询家属附属卡申请", description = "不返回已解绑记录;手机号中间4位统一显示为****")
    @GetMapping
    public ApiResponse<List<DependentCardApplyItemResponse>> list(
            @RequestParam Long talentCardId
    ) {
        return ApiResponse.success(service.list(talentCardId));
    }
 
 
    @Operation(
            summary = "查询家属附属卡申请详情",
            description = "查询本人主卡下单条申请的完整信息(身份证号、手机号不脱敏),用于驳回后修改重新提交的回显"
    )
    @GetMapping("/{id}")
    public ApiResponse<DependentCardApplyDetailResponse> detail(
            @PathVariable Long id,
            @RequestParam Long talentCardId
    ) {
        return ApiResponse.success(service.detail(id, talentCardId));
    }
 
    @Operation(
            summary = "修改重新提交被驳回的家属附属卡申请",
            description = "仅已驳回的申请可以重新提交;系统更新原申请记录,保留申请编号并将状态恢复为待审核"
    )
    @PostMapping("/{id}/resubmit")
    public ApiResponse<DependentCardApplyItemResponse> resubmit(
            @PathVariable Long id,
            @Valid @RequestBody DependentCardApplyRequest request
    ) {
        return ApiResponse.success(service.resubmit(id, request));
    }
    @Operation(summary = "解绑家属附属卡", description = "仅已通过审核的家属附属卡可以解绑")
    @ApiResponses({
            @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "解绑成功"),
            @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "404", description = "申请不存在"),
            @io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "409", description = "当前状态不允许解绑")
    })
    @PostMapping("/{id}/unbind")
    public ApiResponse<DependentCardApplyItemResponse> unbind(
            @PathVariable Long id,
            @Valid @RequestBody DependentCardUnbindRequest request
    ) {
        return ApiResponse.success(service.unbind(id, request));
    }
}