forked from baskbuddy/zhangshun
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
3.7 KiB
65 lines
3.7 KiB
package com.mydreamjob.careerprogress;
|
|
|
|
import com.mydreamjob.careerprogress.dto.CareerProgressResponse;
|
|
import com.mydreamjob.common.api.ApiResponse;
|
|
import com.mydreamjob.common.exception.BusinessException;
|
|
import com.mydreamjob.common.exception.ErrorCode;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
|
import io.swagger.v3.oas.annotations.responses.ApiResponses;
|
|
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
import jakarta.servlet.http.HttpServletRequest;
|
|
import lombok.RequiredArgsConstructor;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
/**
|
|
* 统一求职进度聚合接口(V34)。
|
|
*
|
|
* <p>仅 STUDENT 可访问;身份只取 JWT,不接受 userId/studentUserId/candidateId 等参数。
|
|
* 未登录 401;COMPANY/ADMIN 403/2002;参数非法 400/1001。</p>
|
|
*/
|
|
@Tag(name = "求职进度", description = "学生端聚合投递、面试、评分、Offer、竞争力排名与通知计数")
|
|
@RestController
|
|
@RequiredArgsConstructor
|
|
public class CareerProgressController {
|
|
|
|
/** R01-A4:身份只来自安全上下文,不接受请求参数传入的 userId。 */
|
|
private final com.mydreamjob.security.CurrentUserAccessor currentUserAccessor;
|
|
/** R01-A4:requestId 只来自过滤器规范化后的唯一产出点。 */
|
|
private final com.mydreamjob.common.logging.RequestIdAccessor requestIdAccessor;
|
|
|
|
private final CareerProgressService careerProgressService;
|
|
|
|
@Operation(
|
|
summary = "统一求职进度聚合",
|
|
description = "只读学生端接口:汇总当前学生的投递分页、岗位、下一场面试、最近已提交结构化面试评分、"
|
|
+ "可展示 Offer、同岗位竞争力排名,以及待办/通知计数(仅计数,不含通知详情)。"
|
|
+ "身份仅从 JWT/SecurityContext 获取。",
|
|
security = @SecurityRequirement(name = "bearerAuth"))
|
|
@ApiResponses({
|
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "200", description = "OK"),
|
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "400", description = "page/size/status 参数非法"),
|
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "401", description = "未登录"),
|
|
@io.swagger.v3.oas.annotations.responses.ApiResponse(responseCode = "403", description = "非 STUDENT 角色")
|
|
})
|
|
@GetMapping("/profile/me/career-progress")
|
|
public ResponseEntity<ApiResponse<CareerProgressResponse>> getCareerProgress(
|
|
@Parameter(name = "page", in = ParameterIn.QUERY, description = "页码,从 0 开始,默认 0")
|
|
@RequestParam(defaultValue = "0") int page,
|
|
@Parameter(name = "size", in = ParameterIn.QUERY, description = "每页条数,1–50,默认 20")
|
|
@RequestParam(defaultValue = "20") int size,
|
|
@Parameter(name = "status", in = ParameterIn.QUERY,
|
|
description = "投递状态过滤,可选 SUBMITTED/VIEWED/INTERVIEW/HIRED/REJECTED/WITHDRAWN")
|
|
@RequestParam(required = false) String status,
|
|
HttpServletRequest request) {
|
|
Long userId = currentUserAccessor.requireUserId();
|
|
CareerProgressResponse data = careerProgressService.getCareerProgress(userId, page, size, status);
|
|
return ResponseEntity.ok(ApiResponse.ok(data, requestIdAccessor.get(request)));
|
|
}
|
|
|
|
}
|