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