1.缺陷手动标注修改,增加缺陷标注图片附件类型
This commit is contained in:
parent
105e339464
commit
a0b239f34e
|
@ -60,4 +60,7 @@ public class DefectReq implements Serializable {
|
||||||
|
|
||||||
@ApiModelProperty("维修建议")
|
@ApiModelProperty("维修建议")
|
||||||
private String repairIdea;
|
private String repairIdea;
|
||||||
|
|
||||||
|
@ApiModelProperty("附件id")
|
||||||
|
private String attachId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,5 +37,8 @@ public class DefectResp extends DefectReq implements Serializable {
|
||||||
@ApiModelProperty("来源描述")
|
@ApiModelProperty("来源描述")
|
||||||
private String sourceLabel;
|
private String sourceLabel;
|
||||||
|
|
||||||
|
@ApiModelProperty("缺陷附件路径")
|
||||||
|
private String attachPath;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ public enum AttachBusinessTypeEnum {
|
||||||
PROJECT_TASK("PROJECT_TASK", "项目任务"),
|
PROJECT_TASK("PROJECT_TASK", "项目任务"),
|
||||||
INSURANCE_FILE("insurance", "保险文件"),
|
INSURANCE_FILE("insurance", "保险文件"),
|
||||||
MODEL_FILE("model", "模型文件"),
|
MODEL_FILE("model", "模型文件"),
|
||||||
|
DEFECT_MARK_PIC("defect_mark_pic", "缺陷标注图片"),
|
||||||
;
|
;
|
||||||
private final String code;
|
private final String code;
|
||||||
private final String desc;
|
private final String desc;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.dite.znpt.service.impl;
|
package com.dite.znpt.service.impl;
|
||||||
|
|
||||||
import ai.onnxruntime.OrtException;
|
import ai.onnxruntime.OrtException;
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
@ -8,12 +9,14 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.dite.znpt.constant.Message;
|
import com.dite.znpt.constant.Message;
|
||||||
import com.dite.znpt.converts.Converts;
|
import com.dite.znpt.converts.Converts;
|
||||||
import com.dite.znpt.domain.bo.Detection;
|
import com.dite.znpt.domain.bo.Detection;
|
||||||
|
import com.dite.znpt.domain.entity.AttachInfoEntity;
|
||||||
import com.dite.znpt.domain.entity.DefectEntity;
|
import com.dite.znpt.domain.entity.DefectEntity;
|
||||||
import com.dite.znpt.domain.entity.ImageEntity;
|
import com.dite.znpt.domain.entity.ImageEntity;
|
||||||
import com.dite.znpt.domain.vo.*;
|
import com.dite.znpt.domain.vo.*;
|
||||||
import com.dite.znpt.enums.*;
|
import com.dite.znpt.enums.*;
|
||||||
import com.dite.znpt.exception.ServiceException;
|
import com.dite.znpt.exception.ServiceException;
|
||||||
import com.dite.znpt.mapper.DefectMapper;
|
import com.dite.znpt.mapper.DefectMapper;
|
||||||
|
import com.dite.znpt.service.AttachInfoService;
|
||||||
import com.dite.znpt.service.DefectService;
|
import com.dite.znpt.service.DefectService;
|
||||||
import com.dite.znpt.service.ImageService;
|
import com.dite.znpt.service.ImageService;
|
||||||
import com.dite.znpt.util.PageUtil;
|
import com.dite.znpt.util.PageUtil;
|
||||||
|
@ -43,6 +46,8 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
|
||||||
private ImageService imageService;
|
private ImageService imageService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private MultiModelYoloService multiModelYoloService;
|
private MultiModelYoloService multiModelYoloService;
|
||||||
|
@Autowired
|
||||||
|
private AttachInfoService attachInfoService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 功能描述:查询缺陷记录列表
|
* 功能描述:查询缺陷记录列表
|
||||||
|
@ -107,6 +112,7 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
|
||||||
DefectEntity defectEntity = Converts.INSTANCE.toDefectEntity(req);
|
DefectEntity defectEntity = Converts.INSTANCE.toDefectEntity(req);
|
||||||
defectEntity.setImageId(imageId);
|
defectEntity.setImageId(imageId);
|
||||||
defectEntity.setLabelInfo(JSONUtil.toJsonStr(req.getMarkInfo()));
|
defectEntity.setLabelInfo(JSONUtil.toJsonStr(req.getMarkInfo()));
|
||||||
|
attachInfoService.updateBusinessIdByAttachIds(defectEntity.getImageId(), ListUtil.of(req.getAttachId()), AttachBusinessTypeEnum.DEFECT_MARK_PIC);
|
||||||
this.save(defectEntity);
|
this.save(defectEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,6 +159,7 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
|
||||||
DefectEntity defectEntity = Converts.INSTANCE.toDefectEntity(req);
|
DefectEntity defectEntity = Converts.INSTANCE.toDefectEntity(req);
|
||||||
defectEntity.setLabelInfo(JSONUtil.toJsonStr(req.getMarkInfo()));
|
defectEntity.setLabelInfo(JSONUtil.toJsonStr(req.getMarkInfo()));
|
||||||
this.updateById(defectEntity);
|
this.updateById(defectEntity);
|
||||||
|
attachInfoService.updateBusinessIdByAttachIds(defectEntity.getImageId(), ListUtil.of(req.getAttachId()), AttachBusinessTypeEnum.DEFECT_MARK_PIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,6 +184,7 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
|
||||||
* @date 2025/07/04 10:55
|
* @date 2025/07/04 10:55
|
||||||
**/
|
**/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public List<DefectResp> detect(DefectMarkReq markReq) {
|
public List<DefectResp> detect(DefectMarkReq markReq) {
|
||||||
ImageEntity image = imageService.getById(markReq.getImageId());
|
ImageEntity image = imageService.getById(markReq.getImageId());
|
||||||
if (Objects.isNull(image)) {
|
if (Objects.isNull(image)) {
|
||||||
|
@ -184,7 +192,16 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
|
||||||
}
|
}
|
||||||
FilePathEnum pathEnum = image.getImagePath().contains("temp") ? FilePathEnum.IMAGE_TEMP : FilePathEnum.IMAGE;
|
FilePathEnum pathEnum = image.getImagePath().contains("temp") ? FilePathEnum.IMAGE_TEMP : FilePathEnum.IMAGE;
|
||||||
String inputPath = pathEnum.getFileAbsolutePath(image.getImagePath());
|
String inputPath = pathEnum.getFileAbsolutePath(image.getImagePath());
|
||||||
String outputPath = FileUtil.getParent(inputPath, 1).concat(FileUtil.mainName(inputPath)+"_mark").concat(StrUtil.DOT).concat(FileUtil.extName(inputPath));
|
// 写入attach同层级文件夹下
|
||||||
|
String attachPath = FilePathEnum.ATTACH.getUrlPath() + StrUtil.removePrefix(image.getImagePath(), pathEnum.getUrlPath());
|
||||||
|
String outputPath = FilePathEnum.ATTACH.getFileAbsolutePath(attachPath);
|
||||||
|
FileUtil.mkParentDirs(outputPath);
|
||||||
|
|
||||||
|
AttachInfoEntity attachInfo = new AttachInfoEntity();
|
||||||
|
attachInfo.setBusinessId(image.getImageId());
|
||||||
|
attachInfo.setAttachPath(attachPath);
|
||||||
|
attachInfo.setBusinessType(AttachBusinessTypeEnum.DEFECT_MARK_PIC.getCode());
|
||||||
|
attachInfoService.save(attachInfo);
|
||||||
try {
|
try {
|
||||||
List<Detection> detect = multiModelYoloService.detect(markReq.getModelId(), inputPath, outputPath, markReq.getConfThreshold());
|
List<Detection> detect = multiModelYoloService.detect(markReq.getModelId(), inputPath, outputPath, markReq.getConfThreshold());
|
||||||
List<DefectResp> respList = new ArrayList<>();
|
List<DefectResp> respList = new ArrayList<>();
|
||||||
|
@ -199,6 +216,8 @@ public class DefectServiceImpl extends ServiceImpl<DefectMapper, DefectEntity> i
|
||||||
resp.setMarkInfo(detection);
|
resp.setMarkInfo(detection);
|
||||||
resp.setRepairStatus(RepairStatusEnum.INCOMPLETE.getCode());
|
resp.setRepairStatus(RepairStatusEnum.INCOMPLETE.getCode());
|
||||||
resp.setRepairStatusLabel(RepairStatusEnum.INCOMPLETE.getDesc());
|
resp.setRepairStatusLabel(RepairStatusEnum.INCOMPLETE.getDesc());
|
||||||
|
resp.setAttachId(attachInfo.getAttachId());
|
||||||
|
resp.setAttachPath(attachPath);
|
||||||
respList.add(resp);
|
respList.add(resp);
|
||||||
}
|
}
|
||||||
return respList;
|
return respList;
|
||||||
|
|
Loading…
Reference in New Issue