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 submit( @Valid @RequestBody DependentCardApplyRequest request ) { return ApiResponse.success(service.submit(request)); } @Operation(summary = "查询家属附属卡申请", description = "不返回已解绑记录;手机号中间4位统一显示为****") @GetMapping public ApiResponse> list( @RequestParam Long talentCardId ) { return ApiResponse.success(service.list(talentCardId)); } @Operation( summary = "查询家属附属卡申请详情", description = "查询本人主卡下单条申请的完整信息(身份证号、手机号不脱敏),用于驳回后修改重新提交的回显" ) @GetMapping("/{id}") public ApiResponse detail( @PathVariable Long id, @RequestParam Long talentCardId ) { return ApiResponse.success(service.detail(id, talentCardId)); } @Operation( summary = "修改重新提交被驳回的家属附属卡申请", description = "仅已驳回的申请可以重新提交;系统更新原申请记录,保留申请编号并将状态恢复为待审核" ) @PostMapping("/{id}/resubmit") public ApiResponse 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 unbind( @PathVariable Long id, @Valid @RequestBody DependentCardUnbindRequest request ) { return ApiResponse.success(service.unbind(id, request)); } }