enhance
This commit is contained in:
parent
5fbde0138e
commit
bee845a2d5
|
|
@ -173,7 +173,7 @@ public class AnnotationTaskController extends BaseController {
|
|||
|
||||
|
||||
|
||||
/**手工标注或审核
|
||||
/**手工标注
|
||||
* @param subTask 标注文件的信息
|
||||
* @return 返回影响的行数或错误信
|
||||
*/
|
||||
|
|
@ -188,6 +188,22 @@ public class AnnotationTaskController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
/**手工审核
|
||||
* @param subTask 标注文件的信息
|
||||
* @return 返回影响的行数或错误信
|
||||
*/
|
||||
@RequiresPermissions("dataCenter:task:audit")
|
||||
@PostMapping("/audit")
|
||||
public AjaxResult audit(@Validated @RequestBody AnnotationTaskAnnotatorEntity subTask) {
|
||||
int result = annotationTaskService.audit(subTask);
|
||||
if (result >0) {
|
||||
return AjaxResult.success("手工标注保存成功");
|
||||
}else {
|
||||
return AjaxResult.error("手工标注保存失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**智能标注,预留接口
|
||||
* @param subTask 标注文件的信息
|
||||
* @return 返回影响的行数或错误信
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ public class AnnotationTaskEntity extends BaseEntity {
|
|||
|
||||
/**删除标志(0代表存在 1代表删除) */
|
||||
private String delFlag;
|
||||
private String startTime;
|
||||
private String endTime;
|
||||
|
||||
|
||||
/**标注人员列表*/
|
||||
private List<Long> annotators;
|
||||
|
|
|
|||
|
|
@ -11,9 +11,11 @@ import com.bonus.ai.mapper.DatasetFileMapper;
|
|||
import com.bonus.ai.service.dataset.AnnotationTaskService;
|
||||
import com.bonus.ai.utils.AverageUtil;
|
||||
import com.bonus.common.core.utils.SpringUtils;
|
||||
import com.bonus.common.core.utils.StringUtils;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.catalina.security.SecurityUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -271,6 +273,7 @@ public class AnnotationTaskServiceImpl implements AnnotationTaskService {
|
|||
@Override
|
||||
public int manualAnnotate(AnnotationTaskAnnotatorEntity subTask) {
|
||||
try {
|
||||
subTask.setAnnotationResource("0");
|
||||
return annotationTaskMapper.updateAnnotationInfo(subTask);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
|
|
@ -279,6 +282,19 @@ public class AnnotationTaskServiceImpl implements AnnotationTaskService {
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int audit(AnnotationTaskAnnotatorEntity subTask){
|
||||
try {
|
||||
if (StringUtils.isEmpty(subTask.getAuditFailedReason())){
|
||||
subTask.setAuditFailedReason("");
|
||||
}
|
||||
return annotationTaskMapper.updateAnnotationInfo(subTask);
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* AI标注
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ public interface AnnotationTaskService {
|
|||
/**手工标注*/
|
||||
int manualAnnotate(AnnotationTaskAnnotatorEntity subTask);
|
||||
|
||||
/**手工审核*/
|
||||
int audit(AnnotationTaskAnnotatorEntity subTask);
|
||||
|
||||
/**AI自动标注*/
|
||||
int aiAnnotate(AnnotationTaskAnnotatorEntity subTask);
|
||||
|
||||
|
|
|
|||
|
|
@ -84,11 +84,13 @@
|
|||
SUM(CASE WHEN ap.annotation_status = '2' THEN 1 ELSE 0 END) AS status2Count,
|
||||
SUM(CASE WHEN ap.annotation_status = '3' THEN 1 ELSE 0 END) AS status3Count,
|
||||
COUNT(*) AS totalCount,
|
||||
atv.version_name as lastVersionName
|
||||
atv.version_name as lastVersionName,
|
||||
DATE_FORMAT(at.start_time, '%Y-%m-%d %H:%i:%s') AS startTime,
|
||||
DATE_FORMAT(at.end_time, '%Y-%m-%d %H:%i:%s') AS endTime
|
||||
FROM ai_annotation_task at
|
||||
left join ai_annotation_task_annotator_map ap on at.task_id = ap.task_id
|
||||
LEFT join ai_dataset ad on ad.dataset_id = at.dataset_id
|
||||
LEFT join sys_user su on su.user_id = at.create_by
|
||||
LEFT JOIN ai_annotation_task_annotator_map ap on at.task_id = ap.task_id
|
||||
LEFT JOIN ai_dataset ad on ad.dataset_id = at.dataset_id
|
||||
LEFT JOIN sys_user su on su.user_id = at.create_by
|
||||
LEFT JOIN (
|
||||
SELECT task_id, dataset_id, version_name
|
||||
FROM ai_dataset_version
|
||||
|
|
@ -102,6 +104,10 @@
|
|||
<if test="taskName != null and taskName != ''">
|
||||
AND at.task_name LIKE CONCAT('%', #{taskName}, '%')
|
||||
</if>
|
||||
<if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
|
||||
AND at.start_time >= STR_TO_DATE(#{startTime}, '%Y-%m-%d %H:%i:%s')
|
||||
AND STR_TO_DATE(#{endTime}, '%Y-%m-%d %H:%i:%s') >= at.end_time
|
||||
</if>
|
||||
<choose>
|
||||
<when test="annotatorId != null and annotatorId != '' and reviewerId != null and reviewerId != '' and createBy != null and createBy != ''">
|
||||
AND (ap.annotator_id = #{annotatorId} or ap.reviewer_id = #{reviewerId} or at.create_by = #{createBy})
|
||||
|
|
@ -160,6 +166,8 @@
|
|||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<!-- 插入标注任务,文件和标注人和审核人关联 关系表-->
|
||||
<insert id="insertAnnotTaskannotator" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskAnnotatorEntity">
|
||||
INSERT INTO ai_annotation_task_annotator_map
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
|
@ -195,7 +203,6 @@
|
|||
</if>
|
||||
</trim>
|
||||
VALUES
|
||||
<!-- <foreach collection="list" index="index" item="entity" separator=",">-->
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="taskId != null">
|
||||
#{taskId},
|
||||
|
|
@ -228,11 +235,10 @@
|
|||
#{annotationResource},
|
||||
</if>
|
||||
</trim>
|
||||
<!-- </foreach>-->
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- 根据任务ID更新标注任务 -->
|
||||
<!-- 根据任务ID更新标注任务详情 -->
|
||||
<update id="updateAnnotationTaskById" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskEntity">
|
||||
UPDATE ai_annotation_task
|
||||
<set>
|
||||
|
|
@ -260,12 +266,13 @@
|
|||
WHERE task_id = #{taskId}
|
||||
</update>
|
||||
|
||||
<!-- 根据taskid 返回由某人标注 或审核的的文件列表-->
|
||||
<!-- 根据taskid 返回由某人标注 或审核的的文件列表和文件详情-->
|
||||
<select id="getTaskBasicFile" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskEntity" resultType="com.bonus.ai.domain.DataSetBasicFileEntity">
|
||||
SELECT
|
||||
distinct adfm.file_id AS fileId,
|
||||
abf.file_name AS fileName,
|
||||
abf.file_size AS fileSize,
|
||||
abf.file_url AS fileUrl,
|
||||
adfm.create_time AS createTime,
|
||||
atap.annotation_status AS annotationStatus
|
||||
FROM ai_basic_file abf
|
||||
|
|
@ -287,6 +294,7 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据taskid 和fileid 返回审核驳回的原因-->
|
||||
<select id="getAuditFailReasonByFileId" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskEntity" resultType="String">
|
||||
SELECT
|
||||
atap.audit_failed_reason
|
||||
|
|
@ -297,17 +305,29 @@
|
|||
where abf.del_flag = '0' and aat.del_flag = '0' and aat.task_id = #{taskId} and adfm.file_id = #{fileId}
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID更新标注任务 -->
|
||||
<!-- 根据任务id和 文件id 更新标注内容和状态 -->
|
||||
<update id="updateAnnotationInfo" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskAnnotatorEntity">
|
||||
UPDATE ai_annotation_task_annotator_map
|
||||
<set>
|
||||
<if test="annotationResult != null and annotationResult != ''">annotation_result = #{annotationResult},</if>
|
||||
<if test="annotationResult != null and annotationResult != ''">
|
||||
annotation_result = #{annotationResult},
|
||||
annotation_time = sysdate(),
|
||||
annotateTaskStatus = '1',
|
||||
</if>
|
||||
<if test="auditFailedReason != null and auditFailedReason == ''">
|
||||
audit_failed_reason = #{auditFailedReason},
|
||||
review_time = sysdate(),
|
||||
annotation_status = '3',
|
||||
</if>
|
||||
<if test="annotateTaskStatus != null and annotateTaskStatus == '2'">
|
||||
annotateTaskStatus = #{annotateTaskStatus},
|
||||
review_time = sysdate(),
|
||||
</if>
|
||||
<if test="annotationResource != null and annotationResource != ''">annotation_resource = #{annotationResource},</if>
|
||||
<if test="annotateTaskStatus != null and annotateTaskStatus != ''">annotation_status = #{annotateTaskStatus},</if>
|
||||
<if test="labelStudioProjectId != null">label_studio_project_id = #{labelStudioProjectId},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
</set>
|
||||
WHERE task_id = #{taskId}
|
||||
WHERE task_id = #{taskId} and file_id = #{fileId}
|
||||
</update>
|
||||
|
||||
<select id="countStatusByTaskId" resultType="com.bonus.ai.domain.dataset.AnnotationFileStatusCount">
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ create table ai_annotation_task
|
|||
annotation_status char(1) default '0' comment '0未标注,1正在标注,2已标注,3正在审核,4已审核',
|
||||
label_studio_project_id bigint(20) comment "label studio 对应的projectId"
|
||||
del_flag char(1) default '0' comment '是否删除(0代表存在,1代表删除)',
|
||||
start_time datetime default null comment '任务开始时间',
|
||||
end_time datetime default null comment '任务结束时间',
|
||||
create_by varchar(64) default '' comment '创建者',
|
||||
update_by varchar(64) default '' comment '更新者',
|
||||
update_time datetime default null comment '更新时间',
|
||||
|
|
|
|||
Loading…
Reference in New Issue