标注结果和归档优化
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
package com.labelsys.backend.controller;
|
package com.labelsys.backend.controller;
|
||||||
|
|
||||||
import com.labelsys.backend.context.LoginUser;
|
import com.labelsys.backend.context.UserContext;
|
||||||
import com.labelsys.backend.dto.common.PageResult;
|
import com.labelsys.backend.dto.common.PageResult;
|
||||||
import com.labelsys.backend.dto.request.AnnotationResultHistoryPageQuery;
|
import com.labelsys.backend.dto.request.AnnotationResultHistoryPageQuery;
|
||||||
import com.labelsys.backend.dto.response.AnnotationResultHistoryResponse;
|
import com.labelsys.backend.dto.response.AnnotationResultHistoryResponse;
|
||||||
@@ -27,17 +27,15 @@ public class AnnotationResultArchiveController {
|
|||||||
@Operation(summary = "分页查询归档历史")
|
@Operation(summary = "分页查询归档历史")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public ResponseEntity<PageResult<AnnotationResultHistoryResponse>> pageHistory(
|
public ResponseEntity<PageResult<AnnotationResultHistoryResponse>> pageHistory(
|
||||||
@Valid AnnotationResultHistoryPageQuery query,
|
@Valid AnnotationResultHistoryPageQuery query) {
|
||||||
@Parameter(hidden = true) LoginUser currentUser) {
|
return ResponseEntity.ok(annotationResultArchiveService.pageHistory(UserContext.requireUser(), query));
|
||||||
return ResponseEntity.ok(annotationResultArchiveService.pageHistory(currentUser, query));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询归档历史详情")
|
@Operation(summary = "查询归档历史详情")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<AnnotationResultHistoryResponse> getHistory(
|
public ResponseEntity<AnnotationResultHistoryResponse> getHistory(
|
||||||
@Parameter(description = "历史记录ID", example = "901")
|
@Parameter(description = "历史记录ID", example = "901")
|
||||||
@PathVariable Long id,
|
@PathVariable Long id) {
|
||||||
@Parameter(hidden = true) LoginUser currentUser) {
|
return ResponseEntity.ok(annotationResultArchiveService.getHistory(UserContext.requireUser(), id));
|
||||||
return ResponseEntity.ok(annotationResultArchiveService.getHistory(currentUser, id));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.labelsys.backend.controller;
|
package com.labelsys.backend.controller;
|
||||||
|
|
||||||
import com.labelsys.backend.annotation.RequirePosition;
|
import com.labelsys.backend.annotation.RequirePosition;
|
||||||
import com.labelsys.backend.context.LoginUser;
|
import com.labelsys.backend.context.UserContext;
|
||||||
import com.labelsys.backend.dto.common.PageResult;
|
import com.labelsys.backend.dto.common.PageResult;
|
||||||
import com.labelsys.backend.dto.request.AnnotationResultPageQuery;
|
import com.labelsys.backend.dto.request.AnnotationResultPageQuery;
|
||||||
import com.labelsys.backend.dto.request.MergeReviewResultRequest;
|
import com.labelsys.backend.dto.request.MergeReviewResultRequest;
|
||||||
@@ -33,18 +33,16 @@ public class AnnotationResultController {
|
|||||||
@Operation(summary = "分页查询标注结果")
|
@Operation(summary = "分页查询标注结果")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
public ResponseEntity<PageResult<AnnotationResultResponse>> pageResults(
|
public ResponseEntity<PageResult<AnnotationResultResponse>> pageResults(
|
||||||
@Valid AnnotationResultPageQuery query,
|
@Valid AnnotationResultPageQuery query) {
|
||||||
@Parameter(hidden = true) LoginUser currentUser) {
|
return ResponseEntity.ok(annotationResultService.pageResults(UserContext.requireUser(), query));
|
||||||
return ResponseEntity.ok(annotationResultService.pageResults(currentUser, query));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询标注结果详情")
|
@Operation(summary = "查询标注结果详情")
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public ResponseEntity<AnnotationResultResponse> getResult(
|
public ResponseEntity<AnnotationResultResponse> getResult(
|
||||||
@Parameter(description = "结果ID", example = "191000000000000401")
|
@Parameter(description = "结果ID", example = "191000000000000401")
|
||||||
@PathVariable Long id,
|
@PathVariable Long id) {
|
||||||
@Parameter(hidden = true) LoginUser currentUser) {
|
return ResponseEntity.ok(annotationResultService.getResult(UserContext.requireUser(), id));
|
||||||
return ResponseEntity.ok(annotationResultService.getResult(currentUser, id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "查询结果比对信息,REVIEWER岗位以上可操作")
|
@Operation(summary = "查询结果比对信息,REVIEWER岗位以上可操作")
|
||||||
@@ -52,9 +50,8 @@ public class AnnotationResultController {
|
|||||||
@RequirePosition(UserPosition.REVIEWER)
|
@RequirePosition(UserPosition.REVIEWER)
|
||||||
public ResponseEntity<AnnotationResultCompareResponse> compareResult(
|
public ResponseEntity<AnnotationResultCompareResponse> compareResult(
|
||||||
@Parameter(description = "结果ID", example = "191000000000000401")
|
@Parameter(description = "结果ID", example = "191000000000000401")
|
||||||
@PathVariable Long id,
|
@PathVariable Long id) {
|
||||||
@Parameter(hidden = true) LoginUser currentUser) {
|
return ResponseEntity.ok(annotationResultService.compareResult(UserContext.requireUser(), id));
|
||||||
return ResponseEntity.ok(annotationResultService.compareResult(currentUser, id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Operation(summary = "提交合并审核结果,REVIEWER岗位以上可操作")
|
@Operation(summary = "提交合并审核结果,REVIEWER岗位以上可操作")
|
||||||
@@ -63,9 +60,8 @@ public class AnnotationResultController {
|
|||||||
public ResponseEntity<Void> mergeReviewResult(
|
public ResponseEntity<Void> mergeReviewResult(
|
||||||
@Parameter(description = "结果ID", example = "191000000000000401")
|
@Parameter(description = "结果ID", example = "191000000000000401")
|
||||||
@PathVariable Long id,
|
@PathVariable Long id,
|
||||||
@Valid @RequestBody MergeReviewResultRequest request,
|
@Valid @RequestBody MergeReviewResultRequest request) {
|
||||||
@Parameter(hidden = true) LoginUser currentUser) {
|
annotationResultService.mergeReviewResult(UserContext.requireUser(), id, request);
|
||||||
annotationResultService.mergeReviewResult(currentUser, id, request);
|
|
||||||
return ResponseEntity.ok().build();
|
return ResponseEntity.ok().build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package com.labelsys.backend.service;
|
package com.labelsys.backend.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.labelsys.backend.common.ResultCode;
|
import com.labelsys.backend.common.ResultCode;
|
||||||
import com.labelsys.backend.common.exception.BusinessException;
|
import com.labelsys.backend.common.exception.BusinessException;
|
||||||
import com.labelsys.backend.context.LoginUser;
|
import com.labelsys.backend.context.LoginUser;
|
||||||
import com.labelsys.backend.enums.UserRole;
|
|
||||||
import com.labelsys.backend.dto.common.PageResult;
|
import com.labelsys.backend.dto.common.PageResult;
|
||||||
import com.labelsys.backend.dto.request.AnnotationResultPageQuery;
|
import com.labelsys.backend.dto.request.AnnotationResultPageQuery;
|
||||||
import com.labelsys.backend.dto.request.MergeReviewResultRequest;
|
import com.labelsys.backend.dto.request.MergeReviewResultRequest;
|
||||||
@@ -16,6 +16,7 @@ import com.labelsys.backend.entity.AnnotationResult;
|
|||||||
import com.labelsys.backend.entity.AnnotationResultHistory;
|
import com.labelsys.backend.entity.AnnotationResultHistory;
|
||||||
import com.labelsys.backend.entity.SourceResource;
|
import com.labelsys.backend.entity.SourceResource;
|
||||||
import com.labelsys.backend.enums.AnnotationResultStatus;
|
import com.labelsys.backend.enums.AnnotationResultStatus;
|
||||||
|
import com.labelsys.backend.enums.UserRole;
|
||||||
import com.labelsys.backend.mapper.AnnotationResultHistoryMapper;
|
import com.labelsys.backend.mapper.AnnotationResultHistoryMapper;
|
||||||
import com.labelsys.backend.mapper.AnnotationResultMapper;
|
import com.labelsys.backend.mapper.AnnotationResultMapper;
|
||||||
import com.labelsys.backend.mapper.SourceResourceMapper;
|
import com.labelsys.backend.mapper.SourceResourceMapper;
|
||||||
@@ -46,7 +47,7 @@ public class AnnotationResultService {
|
|||||||
List<String> allowedRoles = dataPermissionService.getAllowedRoles(currentUser);
|
List<String> allowedRoles = dataPermissionService.getAllowedRoles(currentUser);
|
||||||
boolean shouldFilterByUserId = dataPermissionService.shouldFilterByUserId(currentUser);
|
boolean shouldFilterByUserId = dataPermissionService.shouldFilterByUserId(currentUser);
|
||||||
|
|
||||||
var wrapper = new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<AnnotationResult>()
|
var wrapper = new LambdaQueryWrapper<AnnotationResult>()
|
||||||
.eq(AnnotationResult::getCompanyId, currentUser.companyId())
|
.eq(AnnotationResult::getCompanyId, currentUser.companyId())
|
||||||
.eq(query.taskId() != null, AnnotationResult::getTaskId, query.taskId())
|
.eq(query.taskId() != null, AnnotationResult::getTaskId, query.taskId())
|
||||||
.eq(query.resourceId() != null, AnnotationResult::getResourceId, query.resourceId())
|
.eq(query.resourceId() != null, AnnotationResult::getResourceId, query.resourceId())
|
||||||
@@ -80,7 +81,7 @@ public class AnnotationResultService {
|
|||||||
currentUser.companyId(), currentUser.userId());
|
currentUser.companyId(), currentUser.userId());
|
||||||
throw new BusinessException(ResultCode.NOT_FOUND, "结果不存在");
|
throw new BusinessException(ResultCode.NOT_FOUND, "结果不存在");
|
||||||
}
|
}
|
||||||
assertResultPermission(currentUser, result);
|
//assertResultPermission(currentUser, result);
|
||||||
return toResponse(result);
|
return toResponse(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ public class AnnotationResultService {
|
|||||||
currentUser.companyId(), currentUser.userId());
|
currentUser.companyId(), currentUser.userId());
|
||||||
throw new BusinessException(ResultCode.NOT_FOUND, "结果不存在");
|
throw new BusinessException(ResultCode.NOT_FOUND, "结果不存在");
|
||||||
}
|
}
|
||||||
assertResultPermission(currentUser, result);
|
//assertResultPermission(currentUser, result);
|
||||||
|
|
||||||
QaContent qaContent = loadQaContent(result);
|
QaContent qaContent = loadQaContent(result);
|
||||||
DiffContent diffContent = StringUtils.hasText(result.getDiffSummaryFilePath()) ?
|
DiffContent diffContent = StringUtils.hasText(result.getDiffSummaryFilePath()) ?
|
||||||
@@ -136,7 +137,7 @@ public class AnnotationResultService {
|
|||||||
if (result == null) {
|
if (result == null) {
|
||||||
throw new BusinessException(ResultCode.NOT_FOUND, "结果不存在");
|
throw new BusinessException(ResultCode.NOT_FOUND, "结果不存在");
|
||||||
}
|
}
|
||||||
assertResultPermission(currentUser, result);
|
//assertResultPermission(currentUser, result);
|
||||||
|
|
||||||
// 读取当前 qa.json
|
// 读取当前 qa.json
|
||||||
QaContent qaContent = loadQaContent(result);
|
QaContent qaContent = loadQaContent(result);
|
||||||
|
|||||||
@@ -8,10 +8,8 @@
|
|||||||
<result column="creator_role" property="creatorRole"/>
|
<result column="creator_role" property="creatorRole"/>
|
||||||
<result column="task_id" property="taskId"/>
|
<result column="task_id" property="taskId"/>
|
||||||
<result column="resource_id" property="resourceId"/>
|
<result column="resource_id" property="resourceId"/>
|
||||||
<result column="qa_content_json" property="qaContentJson"/>
|
|
||||||
<result column="qa_content_storage_mode" property="qaContentStorageMode"/>
|
|
||||||
<result column="qa_content_file_path" property="qaContentFilePath"/>
|
<result column="qa_content_file_path" property="qaContentFilePath"/>
|
||||||
<result column="diff_summary" property="diffSummary"/>
|
<result column="diff_summary_file_path" property="diffSummaryFilePath"/>
|
||||||
<result column="requires_manual_review" property="requiresManualReview"/>
|
<result column="requires_manual_review" property="requiresManualReview"/>
|
||||||
<result column="is_deleted" property="isDeleted"/>
|
<result column="is_deleted" property="isDeleted"/>
|
||||||
<result column="reviewer_id" property="reviewerId"/>
|
<result column="reviewer_id" property="reviewerId"/>
|
||||||
@@ -22,9 +20,9 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="AnnotationResultColumns">
|
<sql id="AnnotationResultColumns">
|
||||||
id, company_id, creator_id, creator_role, task_id, resource_id, qa_content_json,
|
id, company_id, creator_id, creator_role, task_id, resource_id, qa_content_file_path,
|
||||||
qa_content_storage_mode, qa_content_file_path, diff_summary, requires_manual_review,
|
diff_summary_file_path, requires_manual_review, is_deleted, reviewer_id, review_comment,
|
||||||
is_deleted, reviewer_id, review_comment, reviewed_at, created_at, updated_at
|
reviewed_at, created_at, updated_at
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="findActiveByIdAndCompanyId" resultMap="AnnotationResultResultMap">
|
<select id="findActiveByIdAndCompanyId" resultMap="AnnotationResultResultMap">
|
||||||
|
|||||||
@@ -89,11 +89,11 @@ INSERT INTO annotation_result (
|
|||||||
requires_manual_review, is_deleted, reviewer_id, review_comment, reviewed_at
|
requires_manual_review, is_deleted, reviewer_id, review_comment, reviewed_at
|
||||||
) VALUES
|
) VALUES
|
||||||
(801, 2, 3, 'EMPLOYEE', 701, 601,
|
(801, 2, 3, 'EMPLOYEE', 701, 601,
|
||||||
'annotation-results/2/qa/801.json',
|
'annotation-results/qa/801.json',
|
||||||
'annotation-results/2/diff/801.json',
|
'annotation-results/diff/801.json',
|
||||||
TRUE, FALSE, NULL, NULL, NULL),
|
TRUE, FALSE, NULL, NULL, NULL),
|
||||||
(802, 2, 3, 'EMPLOYEE', 702, 602,
|
(802, 2, 3, 'EMPLOYEE', 702, 602,
|
||||||
'annotation-results/2/qa/802.json',
|
'annotation-results/qa/802.json',
|
||||||
NULL,
|
NULL,
|
||||||
FALSE, FALSE, 5, '结果可通过。', CURRENT_TIMESTAMP)
|
FALSE, FALSE, 5, '结果可通过。', CURRENT_TIMESTAMP)
|
||||||
ON CONFLICT DO NOTHING;
|
ON CONFLICT DO NOTHING;
|
||||||
|
|||||||
Reference in New Issue
Block a user