62 lines
2.8 KiB
Java
62 lines
2.8 KiB
Java
|
|
package com.labelsys.backend.controller;
|
||
|
|
|
||
|
|
import com.labelsys.backend.annotation.RequirePosition;
|
||
|
|
import com.labelsys.backend.common.Result;
|
||
|
|
import com.labelsys.backend.context.UserContext;
|
||
|
|
import com.labelsys.backend.dto.common.PageResult;
|
||
|
|
import com.labelsys.backend.dto.request.AnnotationResultPageQuery;
|
||
|
|
import com.labelsys.backend.dto.request.MergeReviewResultRequest;
|
||
|
|
import com.labelsys.backend.dto.response.AnnotationResultCompareResponse;
|
||
|
|
import com.labelsys.backend.dto.response.AnnotationResultResponse;
|
||
|
|
import com.labelsys.backend.dto.response.MergeReviewResultResponse;
|
||
|
|
import com.labelsys.backend.enums.UserPosition;
|
||
|
|
import com.labelsys.backend.service.AnnotationResultArchiveService;
|
||
|
|
import com.labelsys.backend.service.AnnotationResultService;
|
||
|
|
import io.swagger.v3.oas.annotations.Operation;
|
||
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||
|
|
import jakarta.validation.Valid;
|
||
|
|
import lombok.RequiredArgsConstructor;
|
||
|
|
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.RestController;
|
||
|
|
|
||
|
|
@Tag(name = "标注结果管理")
|
||
|
|
@RestController
|
||
|
|
@RequestMapping("/api/annotation-results")
|
||
|
|
@RequiredArgsConstructor
|
||
|
|
public class AnnotationResultController {
|
||
|
|
|
||
|
|
private final AnnotationResultService annotationResultService;
|
||
|
|
private final AnnotationResultArchiveService annotationResultArchiveService;
|
||
|
|
|
||
|
|
@Operation(summary = "分页查询标注结果")
|
||
|
|
@GetMapping
|
||
|
|
public Result<PageResult<AnnotationResultResponse>> page(AnnotationResultPageQuery query) {
|
||
|
|
return Result.success(annotationResultService.pageResults(UserContext.requireUser(), query));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Operation(summary = "查询标注结果详情")
|
||
|
|
@GetMapping("/{id}")
|
||
|
|
public Result<AnnotationResultResponse> detail(@PathVariable Long id) {
|
||
|
|
return Result.success(annotationResultService.getResult(UserContext.requireUser(), id));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Operation(summary = "查询标注结果比对信息")
|
||
|
|
@RequirePosition(UserPosition.REVIEWER)
|
||
|
|
@GetMapping("/{id}/compare")
|
||
|
|
public Result<AnnotationResultCompareResponse> compare(@PathVariable Long id) {
|
||
|
|
return Result.success(annotationResultService.compareResult(UserContext.requireUser(), id));
|
||
|
|
}
|
||
|
|
|
||
|
|
@Operation(summary = "提交合并审核结果")
|
||
|
|
@RequirePosition(UserPosition.REVIEWER)
|
||
|
|
@PostMapping("/{id}/merge-review")
|
||
|
|
public Result<MergeReviewResultResponse> mergeReview(@PathVariable Long id,
|
||
|
|
@Valid @RequestBody MergeReviewResultRequest request) {
|
||
|
|
return Result.success(annotationResultArchiveService.mergeReview(UserContext.requireUser(), id, request));
|
||
|
|
}
|
||
|
|
}
|