提交代码实现v1.0
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.labelsys.backend.controller;
|
||||
|
||||
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.AnnotationTaskPageQuery;
|
||||
import com.labelsys.backend.dto.request.CreateAnnotationTaskRequest;
|
||||
import com.labelsys.backend.dto.request.UpdateAnnotationTaskRequest;
|
||||
import com.labelsys.backend.dto.response.AnnotationTaskResponse;
|
||||
import com.labelsys.backend.service.AnnotationTaskService;
|
||||
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.DeleteMapping;
|
||||
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.PutMapping;
|
||||
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-tasks")
|
||||
@RequiredArgsConstructor
|
||||
public class AnnotationTaskController {
|
||||
|
||||
private final AnnotationTaskService annotationTaskService;
|
||||
|
||||
@Operation(summary = "创建标注任务")
|
||||
@PostMapping
|
||||
public Result<AnnotationTaskResponse> create(@Valid @RequestBody CreateAnnotationTaskRequest request) {
|
||||
return Result.success(annotationTaskService.createTask(UserContext.requireUser(), request));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新标注任务")
|
||||
@PutMapping("/{id}")
|
||||
public Result<AnnotationTaskResponse> update(@PathVariable Long id, @Valid @RequestBody UpdateAnnotationTaskRequest request) {
|
||||
return Result.success(annotationTaskService.updateTask(UserContext.requireUser(), id, request));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询标注任务")
|
||||
@GetMapping
|
||||
public Result<PageResult<AnnotationTaskResponse>> page(AnnotationTaskPageQuery query) {
|
||||
return Result.success(annotationTaskService.pageTasks(UserContext.requireUser(), query));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询标注任务详情")
|
||||
@GetMapping("/{id}")
|
||||
public Result<AnnotationTaskResponse> detail(@PathVariable Long id) {
|
||||
return Result.success(annotationTaskService.getTask(UserContext.requireUser(), id));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除标注任务")
|
||||
@DeleteMapping("/{id}")
|
||||
public Result<Void> delete(@PathVariable Long id) {
|
||||
annotationTaskService.deleteTask(UserContext.requireUser(), id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.labelsys.backend.controller;
|
||||
|
||||
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.SourceResourcePageQuery;
|
||||
import com.labelsys.backend.dto.request.SourceUploadRequest;
|
||||
import com.labelsys.backend.dto.response.SourceResourceResponse;
|
||||
import com.labelsys.backend.dto.response.SourceUploadResponse;
|
||||
import com.labelsys.backend.service.SourceResourceService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "资源管理")
|
||||
@RestController
|
||||
@RequestMapping("/api/source-resources")
|
||||
@RequiredArgsConstructor
|
||||
public class SourceResourceController {
|
||||
|
||||
private final SourceResourceService sourceResourceService;
|
||||
|
||||
@Operation(summary = "上传资源")
|
||||
@PostMapping("/upload")
|
||||
public Result<SourceUploadResponse> upload(@ModelAttribute SourceUploadRequest request) {
|
||||
return Result.success(sourceResourceService.upload(UserContext.requireUser(), request));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询资源")
|
||||
@GetMapping
|
||||
public Result<PageResult<SourceResourceResponse>> page(SourceResourcePageQuery query) {
|
||||
return Result.success(sourceResourceService.pageResources(UserContext.requireUser(), query));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询资源详情")
|
||||
@GetMapping("/{id}")
|
||||
public Result<SourceResourceResponse> detail(@PathVariable Long id) {
|
||||
return Result.success(sourceResourceService.getResource(UserContext.requireUser(), id));
|
||||
}
|
||||
|
||||
@Operation(summary = "删除资源")
|
||||
@DeleteMapping("/{id}")
|
||||
public Result<Void> delete(@PathVariable Long id) {
|
||||
sourceResourceService.deleteResource(UserContext.requireUser(), id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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.SaveSysConfigRequest;
|
||||
import com.labelsys.backend.dto.request.SysConfigPageQuery;
|
||||
import com.labelsys.backend.dto.response.SysConfigResponse;
|
||||
import com.labelsys.backend.enums.UserPosition;
|
||||
import com.labelsys.backend.service.SysConfigService;
|
||||
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.PutMapping;
|
||||
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/sys-configs")
|
||||
@RequiredArgsConstructor
|
||||
public class SysConfigController {
|
||||
|
||||
private final SysConfigService sysConfigService;
|
||||
|
||||
@Operation(summary = "创建系统配置")
|
||||
@RequirePosition(UserPosition.ADMIN)
|
||||
@PostMapping
|
||||
public Result<SysConfigResponse> create(@Valid @RequestBody SaveSysConfigRequest request) {
|
||||
return Result.success(sysConfigService.toResponse(sysConfigService.saveConfig(UserContext.requireUser(), request)));
|
||||
}
|
||||
|
||||
@Operation(summary = "更新系统配置")
|
||||
@RequirePosition(UserPosition.ADMIN)
|
||||
@PutMapping("/{id}")
|
||||
public Result<SysConfigResponse> update(@PathVariable Long id, @Valid @RequestBody SaveSysConfigRequest request) {
|
||||
return Result.success(sysConfigService.toResponse(sysConfigService.updateConfig(UserContext.requireUser(), id, request)));
|
||||
}
|
||||
|
||||
@Operation(summary = "分页查询系统配置")
|
||||
@GetMapping
|
||||
public Result<PageResult<SysConfigResponse>> page(SysConfigPageQuery query) {
|
||||
return Result.success(sysConfigService.pageConfigs(UserContext.requireUser(), query));
|
||||
}
|
||||
|
||||
@Operation(summary = "查询系统配置详情")
|
||||
@GetMapping("/{id}")
|
||||
public Result<SysConfigResponse> detail(@PathVariable Long id) {
|
||||
return Result.success(sysConfigService.getConfig(UserContext.requireUser(), id));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user