图像标注
This commit is contained in:
parent
fbcd2c48ac
commit
7f24b11d32
|
|
@ -49,7 +49,9 @@ public class UserOperaVo {
|
|||
* 是否去微软
|
||||
*/
|
||||
private String isSure;
|
||||
|
||||
/**
|
||||
* 图片集合
|
||||
*/
|
||||
private List<UploadFileVo> fileVoList;
|
||||
/**
|
||||
* 图片id的集合
|
||||
|
|
|
|||
|
|
@ -86,4 +86,18 @@ public interface ImageCaptionMapper {
|
|||
* @return
|
||||
*/
|
||||
List<AlgorithmVo> getSelected();
|
||||
|
||||
/**
|
||||
* 查询历史全部记录
|
||||
* @param userOperaVo
|
||||
* @return
|
||||
*/
|
||||
List<UserOperaVo> getImageListHistory(UserOperaVo userOperaVo);
|
||||
|
||||
/**
|
||||
* 查询每个批次的图片数量
|
||||
* @param userOperaVo2
|
||||
* @return
|
||||
*/
|
||||
List<UploadFileVo> getImageListDetailsHistory(UserOperaVo userOperaVo2);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,30 +51,33 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
*/
|
||||
@Override
|
||||
public AjaxResult addImageInfo(MultipartFile[] multipartFile, AlgorithmVo vo) {
|
||||
try{
|
||||
String createTime=DateUtils.getTime();
|
||||
if(multipartFile == null || multipartFile.length == 0){
|
||||
return AjaxResult.error("请上传图片");
|
||||
}
|
||||
if(StringUtils.isEmpty(vo.getParam())){
|
||||
return AjaxResult.error("请至少选择一个算法!");
|
||||
}
|
||||
String userId="1";
|
||||
// String userId= SecurityUtils.getUserId().toString();
|
||||
String operaName=vo.getParam();
|
||||
//操作日期
|
||||
String path="image/"+year+"/"+month+"/"+day+"/";
|
||||
List<SysFile> fileList=new ArrayList<>();
|
||||
//文件路径
|
||||
|
||||
//1 图片标注
|
||||
UserOperaVo userOperaVo=new UserOperaVo(userId,operaName,createTime,"1");
|
||||
Integer addOperaNum=mapper.addUserOperaVo(userOperaVo);
|
||||
if(addOperaNum==null || addOperaNum==0){
|
||||
return AjaxResult.error("操作添加失败!");
|
||||
}else{
|
||||
try{
|
||||
String createTime=DateUtils.getTime();
|
||||
if(multipartFile == null || multipartFile.length == 0){
|
||||
return AjaxResult.error("请上传图片");
|
||||
}
|
||||
if(StringUtils.isEmpty(vo.getParam())){
|
||||
return AjaxResult.error("请至少选择一个算法!");
|
||||
}
|
||||
// String userId="1";
|
||||
String userId= SecurityUtils.getUserId().toString();
|
||||
String operaName=vo.getParam();
|
||||
//操作日期
|
||||
String path="image/"+year+"/"+month+"/"+day+"/";
|
||||
List<SysFile> fileList=new ArrayList<>();
|
||||
//文件路径
|
||||
UserOperaVo userOperaVo=new UserOperaVo(userId,operaName,createTime,"1");
|
||||
if(StringUtils.isEmpty(vo.getId())){
|
||||
//1 图片标注
|
||||
Integer addOperaNum=mapper.addUserOperaVo(userOperaVo);
|
||||
if(addOperaNum==null || addOperaNum==0){
|
||||
return AjaxResult.error("操作添加失败!");
|
||||
}
|
||||
}else{
|
||||
userOperaVo.setId(vo.getId());
|
||||
}
|
||||
//操作记录
|
||||
vo.setImageNum(fileList.size());
|
||||
vo.setImageNum(multipartFile.length);
|
||||
vo.setBzNum(0);
|
||||
vo.setWbzNum(0);
|
||||
vo.setIsSure("0");
|
||||
|
|
@ -87,6 +90,7 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
if(addedAlgorithmNum==null || addedAlgorithmNum==0){
|
||||
return AjaxResult.error("操作记录添加失败!");
|
||||
}else{
|
||||
//文件上传标记
|
||||
for (MultipartFile file : multipartFile) {
|
||||
String originFileName = file.getOriginalFilename();
|
||||
String suffix=StringUtils.substringAfterLast(originFileName, ".");
|
||||
|
|
@ -107,8 +111,6 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
}
|
||||
mapper.addUpLoadImage(fileList,vo.getId(),createTime,"1");
|
||||
}
|
||||
|
||||
|
||||
//TODO 调用算法识别 ,然后进行图片更换
|
||||
List<ImageRecognize> list= algorithmService.getImageList(fileList,operaName);
|
||||
//更新标记的数量 和未标记的数量,同时更新 标记图片地址
|
||||
|
|
@ -126,15 +128,18 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
vo.setBzNum(bjNum);
|
||||
vo.setWbzNum(wbjNum);
|
||||
mapper.updateAlgorithm(vo);
|
||||
// 查询数据历史集合
|
||||
List<UserOperaVo> hisImageList=mapper.getImageListHistory(userOperaVo);
|
||||
for (UserOperaVo userOperaVo2 : hisImageList) {
|
||||
//查询 每次历史的 图片集合
|
||||
List<UploadFileVo> fileVoList=mapper.getImageListDetailsHistory(userOperaVo2);
|
||||
for (UploadFileVo obj : fileVoList) {
|
||||
String url=minioUtil.getFileUrl(obj.getBucketName(),obj.getBjFilePath(),60*60*7);
|
||||
obj.setBjUrl(url);
|
||||
}
|
||||
userOperaVo2.setFileVoList(fileVoList);
|
||||
}
|
||||
List<UserOperaVo> list=mapper.getImageList(userOperaVo);
|
||||
List<UploadFileVo> fileVoList=mapper.getImageListDetails(userOperaVo);
|
||||
for (UploadFileVo obj : fileVoList) {
|
||||
String url=minioUtil.getFileUrl(obj.getBucketName(),obj.getBjFilePath(),60*60*7);
|
||||
obj.setBjUrl(url);
|
||||
}
|
||||
list.get(0).setFileVoList(fileVoList);
|
||||
return AjaxResult.success(list.get(0));
|
||||
return AjaxResult.success(hisImageList);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
|
|
@ -154,8 +159,8 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
if(multipartFile == null || multipartFile.length == 0){
|
||||
return AjaxResult.error("请上传图片");
|
||||
}
|
||||
String userId="1";
|
||||
// String userId= SecurityUtils.getUserId().toString();
|
||||
|
||||
String userId= SecurityUtils.getUserId().toString();
|
||||
String operaName=DateUtils.getDate();
|
||||
//操作日期
|
||||
String path="image/"+year+"/"+month+"/"+day+"/";
|
||||
|
|
@ -163,12 +168,18 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
|
||||
//1 图片标注
|
||||
UserOperaVo userOperaVo=new UserOperaVo(userId,operaName,createTime,"2");
|
||||
Integer addOperaNum=mapper.addUserOperaVo(userOperaVo);
|
||||
if(addOperaNum==null || addOperaNum==0){
|
||||
return AjaxResult.error("操作添加失败!");
|
||||
//文件路径
|
||||
if(StringUtils.isEmpty(vo.getId())){
|
||||
//1 图片标注
|
||||
Integer addOperaNum=mapper.addUserOperaVo(userOperaVo);
|
||||
if(addOperaNum==null || addOperaNum==0){
|
||||
return AjaxResult.error("操作添加失败!");
|
||||
}
|
||||
}else{
|
||||
userOperaVo.setId(vo.getId());
|
||||
}
|
||||
//操作记录
|
||||
vo.setImageNum(fileList.size());
|
||||
vo.setImageNum(multipartFile.length);
|
||||
vo.setBzNum(0);
|
||||
vo.setWbzNum(0);
|
||||
vo.setIsSure("1");
|
||||
|
|
@ -203,20 +214,24 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
//图片存储
|
||||
mapper.addUpLoadImage(fileList,vo.getId(),createTime,"2");
|
||||
}
|
||||
}
|
||||
//TODO 调用算法进行照片评估
|
||||
List<ImageRecognize> list= algorithmService.getImageRecognizeList(fileList,operaName);
|
||||
for (ImageRecognize sysFile : list) {
|
||||
mapper.addImageRecognize(sysFile);
|
||||
}
|
||||
List<UserOperaVo> userOperaVos=mapper.getImageList(userOperaVo);
|
||||
List<UploadFileVo> fileVoList=mapper.getImageListDetails(userOperaVo);
|
||||
for (UploadFileVo obj : fileVoList) {
|
||||
String url=minioUtil.getFileUrl(obj.getBucketName(),obj.getBjFilePath(),60*60*7);
|
||||
obj.setBjUrl(url);
|
||||
|
||||
// 查询数据历史集合
|
||||
List<UserOperaVo> hisImageList=mapper.getImageListHistory(userOperaVo);
|
||||
for (UserOperaVo userOperaVo2 : hisImageList) {
|
||||
//查询 每次历史的 图片集合
|
||||
List<UploadFileVo> fileVoList=mapper.getImageListDetailsHistory(userOperaVo2);
|
||||
for (UploadFileVo obj : fileVoList) {
|
||||
String url=minioUtil.getFileUrl(obj.getBucketName(),obj.getBjFilePath(),60*60*7);
|
||||
obj.setBjUrl(url);
|
||||
}
|
||||
userOperaVo2.setFileVoList(fileVoList);
|
||||
}
|
||||
userOperaVos.get(0).setFileVoList(fileVoList);
|
||||
return AjaxResult.success(userOperaVos.get(0));
|
||||
return AjaxResult.success(hisImageList);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
|
|
@ -233,7 +248,6 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
try{
|
||||
vo.setUserId(SecurityUtils.getUserId().toString());
|
||||
List<UserOperaVo> list=mapper.getImageList(vo);
|
||||
|
||||
return AjaxResult.success(list);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
|
|
@ -250,13 +264,18 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
@Override
|
||||
public AjaxResult getImageListDetails(UserOperaVo vo) {
|
||||
try{
|
||||
List<UploadFileVo> list=mapper.getImageListDetails(vo);
|
||||
for (UploadFileVo userOperaVo : list) {
|
||||
String url=minioUtil.getFileUrl(userOperaVo.getBucketName(),userOperaVo.getBjFilePath(),60*60*7);
|
||||
userOperaVo.setBjUrl(url);
|
||||
|
||||
// 查询数据历史集合
|
||||
List<UserOperaVo> hisImageList=mapper.getImageListHistory(vo);
|
||||
for (UserOperaVo userOperaVo2 : hisImageList) {
|
||||
//查询 每次历史的 图片集合
|
||||
List<UploadFileVo> fileVoList=mapper.getImageListDetailsHistory(userOperaVo2);
|
||||
for (UploadFileVo obj : fileVoList) {
|
||||
String url=minioUtil.getFileUrl(obj.getBucketName(),obj.getBjFilePath(),60*60*7);
|
||||
obj.setBjUrl(url);
|
||||
}
|
||||
userOperaVo2.setFileVoList(fileVoList);
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
return AjaxResult.success(hisImageList);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
id, algorithm_id,original_name,file_path,bucket_name,
|
||||
file_name,is_active,create_time,file_type,bj_file_path,file_size
|
||||
) values
|
||||
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.id}, #{id},#{item.originName},#{item.url},#{item.bucketName},#{item.name},0,#{createTime},'1',#{item.bjFilePath},#{item.fileSize} )
|
||||
</foreach>
|
||||
|
|
@ -58,23 +57,31 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<update id="updateImage">
|
||||
update tb_upload_file set is_active=1
|
||||
where id in
|
||||
<foreach collection="list" item="item" close=")" open="(" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<foreach collection="list" item="item" close=")" open="(" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
<select id="getImageList" resultType="com.bonus.business.domain.UserOperaVo">
|
||||
select tuo.id, tuo.type, tuo.oper_name operaName,
|
||||
tuo.oper_time operaTime, tuo.user_id , tuo.oper_type,
|
||||
tam.image_num imageNum ,tam.bz_num bzNum,tam.wbz_num wbzNum,tam.is_sure isSure
|
||||
tuo.oper_time operaTime, tuo.user_id , tuo.oper_type
|
||||
from tb_user_oper tuo
|
||||
left join tb_algorithm tam on tam.oper_id=tuo.id
|
||||
where tuo.type=#{operaType}
|
||||
and DATE(tuo.oper_time) >= CURDATE() - INTERVAL 1 MONTH
|
||||
and DATE(tuo.oper_time) >= CURDATE() - INTERVAL 1 MONTH
|
||||
and tuo.user_id=#{userId}
|
||||
<if test="id!=null and id!=''">
|
||||
and tuo.id=#{id}
|
||||
</if>
|
||||
<if test="id!=null and id!=''">
|
||||
and tuo.id=#{id}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getImageListHistory" resultType="com.bonus.business.domain.UserOperaVo">
|
||||
select tam.id, tam.oper_type, tam.name operaName,
|
||||
tam.create_time operaTime, tam.user_id , tam.oper_type,
|
||||
tam.image_num imageNum ,tam.bz_num bzNum,tam.wbz_num wbzNum,tam.is_sure isSure
|
||||
from tb_algorithm tam
|
||||
where tam.oper_type=#{operaType}
|
||||
and tam.user_id=#{userId} and tam.oper_id=#{id}
|
||||
</select>
|
||||
|
||||
<select id="getImageListDetails" resultType="com.bonus.file.vo.UploadFileVo">
|
||||
select file.id imageId,
|
||||
file.algorithm_id algorithmId, file.original_name originalName,
|
||||
|
|
@ -90,6 +97,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE file.algorithm_id=#{id}
|
||||
</select>
|
||||
|
||||
<select id="getImageListDetailsHistory" resultType="com.bonus.file.vo.UploadFileVo">
|
||||
select file.id imageId,
|
||||
file.algorithm_id algorithmId, file.original_name originalName,
|
||||
file.file_path filePath,
|
||||
file.bucket_name bucketName, file.file_name fileName,
|
||||
file.is_active isActive, file.file_type fileType,
|
||||
file.bj_file_path bjFilePath, file.file_size fileSize,
|
||||
tir.content_image contentImage,tir.overall_score overallScore,tir.clarity,
|
||||
tir.cleanliness,tir.compress_marks compressMarks,tir.impression,
|
||||
tir.balance,tir.detail,tir.type
|
||||
from tb_upload_file file
|
||||
left join tb_image_recognize tir on tir.image_id=file.id
|
||||
WHERE file.algorithm_id=#{id}
|
||||
</select>
|
||||
|
||||
<select id="getImageListById" resultType="com.bonus.file.vo.UploadFileVo">
|
||||
select file.id ,
|
||||
file.algorithm_id algorithmId, file.original_name originalName,
|
||||
|
|
@ -116,4 +138,5 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
from tb_algorithm_config
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue