解决创建标注任务时 任务、标注人和文件的关联关系表插入失败的问题

This commit is contained in:
weiweiw 2024-11-28 08:45:38 +08:00
parent d2e44c042b
commit fca8d47163
6 changed files with 163 additions and 122 deletions

View File

@ -1,12 +1,8 @@
package com.bonus.ai.controller.dataset;
import com.bonus.ai.client.AnnotationParam;
import com.bonus.ai.domain.DataSetBasicFileEntity;
import com.bonus.ai.domain.dataset.AnnotationSubTaskEntity;
import com.bonus.ai.domain.dataset.AnnotationTaskAnnotatorEntity;
import com.bonus.ai.domain.dataset.AnnotationTaskEntity;
import com.bonus.ai.domain.dataset.DataSetEntity;
import com.bonus.ai.service.DataSetBasicFileService;
import com.bonus.ai.service.dataset.AnnotationTaskService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
@ -17,7 +13,6 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**

View File

@ -1,43 +0,0 @@
package com.bonus.ai.domain.dataset;
import com.bonus.ai.domain.enums.AnnotationFileStatus;
import lombok.Data;
import java.util.Date;
@Data
public class AnnotationSubTaskEntity {
AnnotationSubTaskEntity(Long taskId, Long datasetId, Long annotatorId, Long reviewerId, Long fileId){
this.taskId = taskId;
this.datasetId = datasetId;
this.annotatorId = annotatorId;
this.reviewerId = reviewerId;
this.fileId = fileId;
}
/**任务名称*/
private Long taskId;
/**数据集id*/
private Long datasetId;
/**标注人员id*/
private Long annotatorId;
/**审核人员id*/
private Long reviewerId;
/**文件id*/
private Long fileId;
/**文件标注状态*/
private AnnotationFileStatus annotateFileStatus;
/**标注结果*/
private String annotationResult;
/**标注来源0人工标注1智能标注*/
private String annotationSource;
/**审核驳回原因*/
private String auditFailedReason;
/**标注时间*/
private Date annotationTime;
/**审核时间*/
private Date reviewTime;
}

View File

@ -1,12 +1,15 @@
package com.bonus.ai.domain.dataset;
import com.bonus.common.core.web.domain.BaseEntity;
import lombok.Data;
import org.springframework.stereotype.Component;
import java.util.Date;
@Data
@Component
public class AnnotationTaskAnnotatorEntity {
/**
* @author wangvivi
*/
public class AnnotationTaskAnnotatorEntity extends BaseEntity {
private Long annotatorId; // 标注人员
private Long reviewerId; // 审核人员
@ -22,8 +25,116 @@ public class AnnotationTaskAnnotatorEntity {
private Date annotationTime; // 标注时间
private Date reviewTime; // 审核时间
private String auditFailedReason; // 审核驳回原因
private String createBy; // 创建者
private String updateBy; // 更新者
private Date updateTime; // 更新时间
private Date createTime; // 创建时间
public Long getAnnotatorId() {
return annotatorId;
}
public void setAnnotatorId(Long annotatorId) {
this.annotatorId = annotatorId;
}
public Long getReviewerId() {
return reviewerId;
}
public void setReviewerId(Long reviewerId) {
this.reviewerId = reviewerId;
}
public Long getTaskId() {
return taskId;
}
public void setTaskId(Long taskId) {
this.taskId = taskId;
}
public Long getFileId() {
return fileId;
}
public void setFileId(Long fileId) {
this.fileId = fileId;
}
public String getFileUrl() {
return fileUrl;
}
public void setFileUrl(String fileUrl) {
this.fileUrl = fileUrl;
}
public Long getLabelStudioTaskId() {
return labelStudioTaskId;
}
public void setLabelStudioTaskId(Long labelStudioTaskId) {
this.labelStudioTaskId = labelStudioTaskId;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getAnnotationStatus() {
return annotationStatus;
}
public void setAnnotationStatus(String annotationStatus) {
this.annotationStatus = annotationStatus;
}
public String getAnnotationResult() {
return annotationResult;
}
public void setAnnotationResult(String annotationResult) {
this.annotationResult = annotationResult;
}
public String getAnnotationResource() {
return annotationResource;
}
public void setAnnotationResource(String annotationResource) {
this.annotationResource = annotationResource;
}
public String getDelFlag() {
return delFlag;
}
public void setDelFlag(String delFlag) {
this.delFlag = delFlag;
}
public Date getAnnotationTime() {
return annotationTime;
}
public void setAnnotationTime(Date annotationTime) {
this.annotationTime = annotationTime;
}
public Date getReviewTime() {
return reviewTime;
}
public void setReviewTime(Date reviewTime) {
this.reviewTime = reviewTime;
}
public String getAuditFailedReason() {
return auditFailedReason;
}
public void setAuditFailedReason(String auditFailedReason) {
this.auditFailedReason = auditFailedReason;
}
}

View File

@ -52,7 +52,7 @@ public class AnnotationTaskEntity extends BaseEntity {
private List<Long> reviewers;
/**分配后子任务,一个标注文件对应一个子任务*/
private List<AnnotationSubTaskEntity> subAnnotationTasks;
private List<AnnotationTaskAnnotatorEntity> subAnnotationTasks;
/**用于查询目的*/
/**根据任务id标注人id或审核人id 和文件标注状态返回满足条件的文件列表*/

View File

@ -1,11 +1,8 @@
package com.bonus.ai.service.dataset;
import com.bonus.ai.domain.DataSetBasicFileEntity;
import com.bonus.ai.domain.dataset.AnnotationSubTaskEntity;
import com.bonus.ai.domain.dataset.AnnotationTaskAnnotatorEntity;
import com.bonus.ai.domain.dataset.AnnotationTaskEntity;
import com.bonus.ai.domain.dataset.DataSetEntity;
import com.bonus.common.core.web.page.TableDataInfo;
import java.io.IOException;
import java.util.List;

View File

@ -143,10 +143,12 @@
<if test="annotateTaskStatus != null">annotation_status,</if>
<if test="labelStudioProjectId != null">label_studio_project_id,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
create_time,
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="startTime != null and startTime !=''">start_time,</if>
<if test="endTime != null and endTime !=''">end_time,</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="datasetId != null">#{datasetId},</if>
@ -160,10 +162,12 @@
<if test="annotateTaskStatus != null">#{annotateTaskStatus},</if>
<if test="labelStudioProjectId != null">#{labelStudioProjectId},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
sysdate(),
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="startTime != null and startTime !=''"> STR_TO_DATE(#{startTime}, '%Y-%m-%d %H:%i:%s'),</if>
<if test="endTime != null and endTime !=''"> STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s'),</if>
</trim>
</insert>
@ -171,69 +175,45 @@
<insert id="insertAnnotTaskannotator" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskAnnotatorEntity">
INSERT INTO ai_annotation_task_annotator_map
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskId != null">
task_id ,
</if>
<if test="fileId != null">
file_id ,
</if>
<if test="fileUrl != null">
file_url ,
</if>
<if test="labelStudioTaskId != null">
label_studio_task_id,
</if>
<if test="annotatorId != null">
annotator_id ,
</if>
<if test="reviewerId != null">
reviewer_id ,
</if>
<if test="description != null and description != ''">
description ,
</if>
<if test="annotationStatus != null">
annotation_status ,
</if>
<if test="annotationResult != null">
annotation_result ,
</if>
<if test="annotationResource != null">
annotation_resource ,
</if>
<if test="taskId != null">task_id ,</if>
<if test="fileId != null">file_id ,</if>
<if test="fileUrl != null">file_url ,</if>
<if test="labelStudioTaskId != null">label_studio_task_id,</if>
<if test="annotatorId != null">annotator_id ,</if>
<if test="reviewerId != null">reviewer_id ,</if>
<if test="description != null and description != ''">description ,</if>
<if test="annotationStatus != null">annotation_status ,</if>
<if test="auditFailedReason != null">audit_failed_reason ,</if>
<if test="annotationResult != null">annotation_result ,</if>
<if test="annotationResource != null">annotation_resource, </if>
<if test="annotationTime != null">annotation_time ,</if>
<if test="reviewTime != null">review_time ,</if>
<if test="delFlag != null">del_flag,</if>
create_time,
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
VALUES
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="taskId != null">
#{taskId},
</if>
<if test="fileId != null">
#{fileId},
</if>
<if test="fileUrl != null">
#{fileUrl},
</if>
<if test="labelStudioTaskId != null">
#{labelStudioTaskId},
</if>
<if test="annotatorId != null">
#{annotatorId},
</if>
<if test="reviewerId != null">
#{reviewerId},
</if>
<if test="description != null and entity.description != ''">
#{description} ,
</if>
<if test="annotationStatus != null">
#{annotationStatus},
</if>
<if test="annotationResult != null">
#{annotationResult},
</if>
<if test="annotationResource != null">
#{annotationResource},
</if>
<if test="taskId != null">#{taskId},</if>
<if test="fileId != null">#{fileId},</if>
<if test="fileUrl != null">#{fileUrl},</if>
<if test="labelStudioTaskId != null">#{labelStudioTaskId},</if>
<if test="annotatorId != null">#{annotatorId},</if>
<if test="reviewerId != null">#{reviewerId},</if>
<if test="description != null and description != ''">#{description} ,</if>
<if test="annotationStatus != null">#{annotationStatus},</if>
<if test="auditFailedReason != null">#{auditFailedReason} ,</if>
<if test="annotationResult != null">#{annotationResult},</if>
<if test="annotationResource != null">#{annotationResource},</if>
<if test="annotationTime != null">#{annotationTime} ,</if>
<if test="reviewTime != null">#{reviewTime} ,</if>
<if test="delFlag != null">#{delFlag},</if>
sysdate(),
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
@ -254,7 +234,8 @@
<if test="labelStudioProjectId != null">label_studio_project_id = #{labelStudioProjectId},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
update_time = sysdate(),
<if test="startTime != null and startTime !=''"> start_time = STR_TO_DATE(#{startTime}, '%Y-%m-%d %H:%i:%s'),</if>
<if test="endTime != null and endTime !=''"> end_time= STR_TO_DATE(#{startTime}, '%Y-%m-%d %H:%i:%s'),</if>
</set>
WHERE task_id = #{taskId}
</update>