bug修改
This commit is contained in:
parent
6e9a29284a
commit
19962803e5
|
|
@ -6,6 +6,7 @@ import com.bonus.business.domain.UserOperaVo;
|
|||
import com.bonus.common.core.controller.BaseController;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.common.core.page.TableDataInfo;
|
||||
import com.bonus.file.vo.UploadFileVo;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -29,11 +30,11 @@ public class ImageCaptionController extends BaseController {
|
|||
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UserOperaVo config)
|
||||
public TableDataInfo list(UserOperaVo vo)
|
||||
{
|
||||
startPage();
|
||||
// List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(null);
|
||||
List<UploadFileVo> list = service.getAllImagelist(vo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -64,4 +64,15 @@ public class AlgorithmVo {
|
|||
*/
|
||||
private String userId;
|
||||
|
||||
public static void addSource(AlgorithmVo vo, int length, String operaId, String createTime, String operaType, String userId, String operaName) {
|
||||
vo.setBzNum(0);
|
||||
vo.setWbzNum(0);
|
||||
vo.setIsSure("0");
|
||||
vo.setImageNum(length);
|
||||
vo.setOperaType(operaType);
|
||||
vo.setOperaId(operaId);
|
||||
vo.setOperaId(userId);
|
||||
vo.setCreateTime(createTime);
|
||||
vo.setName(operaName);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ public class UserOperaVo {
|
|||
*/
|
||||
private List<String> imageId;
|
||||
|
||||
private String createUser;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -100,4 +100,11 @@ public interface ImageCaptionMapper {
|
|||
* @return
|
||||
*/
|
||||
List<UploadFileVo> getImageListDetailsHistory(UserOperaVo userOperaVo2);
|
||||
|
||||
/**
|
||||
* 查询全部图片集合
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
List<UploadFileVo> getAllImageList(UserOperaVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,9 +4,11 @@ package com.bonus.business.service;
|
|||
import com.bonus.business.domain.AlgorithmVo;
|
||||
import com.bonus.business.domain.UserOperaVo;
|
||||
import com.bonus.common.core.domain.AjaxResult;
|
||||
import com.bonus.file.vo.UploadFileVo;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
public interface ImageCaptionService {
|
||||
|
||||
|
|
@ -60,4 +62,12 @@ public interface ImageCaptionService {
|
|||
* @return
|
||||
*/
|
||||
AjaxResult getSelected(UserOperaVo vo);
|
||||
|
||||
|
||||
/**
|
||||
* 查询全部图片集合
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
List<UploadFileVo> getAllImagelist(UserOperaVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import org.springframework.web.multipart.MultipartFile;
|
|||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
|
|
@ -28,8 +29,6 @@ import java.util.List;
|
|||
public class ImageCaptionServiceImpl implements ImageCaptionService {
|
||||
@Autowired
|
||||
private ImageCaptionMapper mapper;
|
||||
@Resource
|
||||
private MinioClient minioClient;
|
||||
|
||||
@Autowired
|
||||
private MinioUtil minioUtil;
|
||||
|
|
@ -43,6 +42,10 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
|
||||
public String year=DateUtils.getCurrentYear();
|
||||
|
||||
public final static String BJ_TYPE="1";
|
||||
|
||||
|
||||
public final static String PG_TYPE="2";
|
||||
/**
|
||||
* 图像上传接口
|
||||
* @param multipartFile
|
||||
|
|
@ -59,86 +62,21 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
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(multipartFile.length);
|
||||
vo.setBzNum(0);
|
||||
vo.setWbzNum(0);
|
||||
vo.setIsSure("0");
|
||||
vo.setOperaId(userOperaVo.getId());
|
||||
vo.setCreateTime(createTime);
|
||||
vo.setOperaType("1");
|
||||
vo.setUserId(userId);
|
||||
vo.setName(operaName);
|
||||
Integer addedAlgorithmNum= mapper.addAlgorithm(vo);
|
||||
if(addedAlgorithmNum==null || addedAlgorithmNum==0){
|
||||
return AjaxResult.error("操作记录添加失败!");
|
||||
}else{
|
||||
//文件上传标记
|
||||
for (MultipartFile file : multipartFile) {
|
||||
String originFileName = file.getOriginalFilename();
|
||||
String suffix=StringUtils.substringAfterLast(originFileName, ".");
|
||||
String uuid = StringUtils.randomUUID();
|
||||
String folderPath= path+uuid+"."+suffix;
|
||||
// 获取文件大小(字节)
|
||||
long sizeInBytes = file.getSize();
|
||||
// 转换为可读格式(如KB/MB)
|
||||
String humanReadableSize = convertToHumanReadable(sizeInBytes);
|
||||
SysFile sysFile=minioUtil.uploadFile(file,folderPath);
|
||||
sysFile.setOriginName(originFileName);
|
||||
sysFile.setFileSize(humanReadableSize);
|
||||
sysFile.setId(StringUtils.randomUUID());
|
||||
fileList.add(sysFile);
|
||||
}
|
||||
if(fileList.size()!=multipartFile.length){
|
||||
return AjaxResult.error("文件上传失败!");
|
||||
}
|
||||
mapper.addUpLoadImage(fileList,vo.getId(),createTime,"1");
|
||||
UserOperaVo userOperaVo=new UserOperaVo(userId,operaName,createTime,BJ_TYPE);
|
||||
AjaxResult result= addOperaData(multipartFile,vo,userId,operaName,createTime,BJ_TYPE);
|
||||
if(result.isError()){
|
||||
return result;
|
||||
}
|
||||
//TODO 调用算法识别 ,然后进行图片更换
|
||||
List<ImageRecognize> list= algorithmService.getImageList(fileList,operaName);
|
||||
//更新标记的数量 和未标记的数量,同时更新 标记图片地址
|
||||
int bjNum=0;
|
||||
int wbjNum=0;
|
||||
for (ImageRecognize imageRecognize : list) {
|
||||
if(StringUtils.isEmpty(imageRecognize.getType())){
|
||||
wbjNum++;
|
||||
}else{
|
||||
bjNum++;
|
||||
}
|
||||
mapper.updateImageAddress(imageRecognize);
|
||||
mapper.addImageRecognize(imageRecognize);
|
||||
}
|
||||
vo.setBzNum(bjNum);
|
||||
vo.setWbzNum(wbjNum);
|
||||
mapper.updateAlgorithm(vo);
|
||||
updateImage(list,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> hisImageList=getUploadFileList(userOperaVo);
|
||||
return AjaxResult.success(hisImageList);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
|
|
@ -146,7 +84,6 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增评估数据
|
||||
* @param multipartFile
|
||||
|
|
@ -156,6 +93,7 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
@Override
|
||||
public AjaxResult addImageEvaluate(MultipartFile[] multipartFile, AlgorithmVo vo) {
|
||||
try{
|
||||
List<SysFile> fileList=new ArrayList<>();
|
||||
String createTime=DateUtils.getTime();
|
||||
if(multipartFile == null || multipartFile.length == 0){
|
||||
return AjaxResult.error("请上传图片");
|
||||
|
|
@ -163,53 +101,11 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
String userId= SecurityUtils.getUserId().toString();
|
||||
String operaName=DateUtils.getDate();
|
||||
//操作日期
|
||||
String path="image/"+year+"/"+month+"/"+day+"/";
|
||||
List<SysFile> fileList=new ArrayList<>();
|
||||
//文件路径
|
||||
UserOperaVo userOperaVo=new UserOperaVo(userId,operaName,createTime,"2");
|
||||
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(multipartFile.length);
|
||||
vo.setBzNum(0);
|
||||
vo.setWbzNum(0);
|
||||
vo.setIsSure("0");
|
||||
vo.setOperaId(userOperaVo.getId());
|
||||
vo.setCreateTime(createTime);
|
||||
vo.setOperaType("2");
|
||||
vo.setUserId(userId);
|
||||
vo.setName(operaName);
|
||||
Integer addedAlgorithmNum= mapper.addAlgorithm(vo);
|
||||
if(addedAlgorithmNum==null || addedAlgorithmNum==0){
|
||||
return AjaxResult.error("操作记录添加失败!");
|
||||
}else{
|
||||
//文件上传标记
|
||||
for (MultipartFile file : multipartFile) {
|
||||
String originFileName = file.getOriginalFilename();
|
||||
String suffix=StringUtils.substringAfterLast(originFileName, ".");
|
||||
String uuid = StringUtils.randomUUID();
|
||||
String folderPath= path+uuid+"."+suffix;
|
||||
// 获取文件大小(字节)
|
||||
long sizeInBytes = file.getSize();
|
||||
// 转换为可读格式(如KB/MB)
|
||||
String humanReadableSize = convertToHumanReadable(sizeInBytes);
|
||||
SysFile sysFile=minioUtil.uploadFile(file,folderPath);
|
||||
sysFile.setOriginName(originFileName);
|
||||
sysFile.setFileSize(humanReadableSize);
|
||||
sysFile.setId(StringUtils.randomUUID());
|
||||
fileList.add(sysFile);
|
||||
}
|
||||
if(fileList.size()!=multipartFile.length){
|
||||
return AjaxResult.error("文件上传失败!");
|
||||
}
|
||||
mapper.addUpLoadImage(fileList,vo.getId(),createTime,"2");
|
||||
UserOperaVo userOperaVo=new UserOperaVo(userId,operaName,createTime,PG_TYPE);
|
||||
AjaxResult result= addOperaData(multipartFile,vo,userId,operaName,createTime,PG_TYPE);
|
||||
if(result.isError()){
|
||||
return result;
|
||||
}
|
||||
//TODO 调用算法识别 ,然后进行图片更换
|
||||
List<ImageRecognize> list= algorithmService.getImageRecognizeList(fileList,operaName);
|
||||
|
|
@ -217,18 +113,8 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
for (ImageRecognize imageRecognize : list) {
|
||||
mapper.addImageRecognize(imageRecognize);
|
||||
}
|
||||
|
||||
// 查询数据历史集合
|
||||
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.getFilePath(),60*60*7);
|
||||
obj.setBjUrl(url);
|
||||
}
|
||||
userOperaVo2.setFileVoList(fileVoList);
|
||||
}
|
||||
List<UserOperaVo> hisImageList=getUploadFileList(userOperaVo);
|
||||
return AjaxResult.success(hisImageList);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
|
|
@ -236,6 +122,135 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
return AjaxResult.error("操作失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加记录数据
|
||||
* @param multipartFile
|
||||
* @param vo
|
||||
* @param userId
|
||||
* @param operaName
|
||||
* @param createTime
|
||||
* @param operaType
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult addOperaData(MultipartFile[] multipartFile, AlgorithmVo vo,String userId,String operaName,String createTime,String operaType) {
|
||||
try{
|
||||
//文件路径
|
||||
String path="image/"+year+"/"+month+"/"+day+"/";
|
||||
List<SysFile> fileList=new ArrayList<>();
|
||||
UserOperaVo userOperaVo=new UserOperaVo(userId,operaName,createTime,BJ_TYPE);
|
||||
if(StringUtils.isEmpty(vo.getId())){
|
||||
Integer addOperaNum=mapper.addUserOperaVo(userOperaVo);
|
||||
if(addOperaNum==null || addOperaNum==0){
|
||||
return AjaxResult.error("操作添加失败!");
|
||||
}
|
||||
}else{
|
||||
userOperaVo.setId(vo.getId());
|
||||
}
|
||||
AlgorithmVo.addSource(vo,multipartFile.length,userOperaVo.getId(),createTime,BJ_TYPE,userId,operaName);
|
||||
//操作记录
|
||||
Integer addedAlgorithmNum= mapper.addAlgorithm(vo);
|
||||
if(addedAlgorithmNum==null || addedAlgorithmNum==0){
|
||||
return AjaxResult.error("操作记录添加失败!");
|
||||
}else{
|
||||
AjaxResult result=ImageMultipartFile(multipartFile,path,createTime,userId,fileList,vo.getId(),BJ_TYPE);
|
||||
if(result.isError()){
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新图片数据
|
||||
* @param list
|
||||
* @param vo
|
||||
*/
|
||||
public void updateImage(List<ImageRecognize> list,AlgorithmVo vo){
|
||||
// 统计有类型和无类型的记录数量
|
||||
int typedCount = 0;
|
||||
int untypedCount = 0;
|
||||
// 批量操作的数据容器
|
||||
for (ImageRecognize imageRecognize : list) {
|
||||
// 类型判断与计数,使用工具类确保空字符串也被视为无类型
|
||||
if (StringUtils.isBlank(imageRecognize.getType())) {
|
||||
untypedCount++;
|
||||
} else {
|
||||
typedCount++;
|
||||
}
|
||||
//跟新图片地址
|
||||
mapper.updateImageAddress(imageRecognize);
|
||||
//添加记录
|
||||
mapper.addImageRecognize(imageRecognize);
|
||||
}
|
||||
vo.setBzNum(typedCount);
|
||||
vo.setWbzNum(untypedCount);
|
||||
mapper.updateAlgorithm(vo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取上传后图片数据
|
||||
* @param userOperaVo
|
||||
* @return
|
||||
*/
|
||||
public List<UserOperaVo> getUploadFileList(UserOperaVo userOperaVo){
|
||||
try{
|
||||
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);
|
||||
}
|
||||
return hisImageList;
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件处理类
|
||||
* @param multipartFile
|
||||
* @param path
|
||||
* @param createTime
|
||||
* @param userId
|
||||
* @param fileList
|
||||
* @param id
|
||||
* @param operaType
|
||||
* @return
|
||||
*/
|
||||
public AjaxResult ImageMultipartFile(MultipartFile[] multipartFile ,String path,String createTime,String userId,List<SysFile> fileList ,String id,String operaType){
|
||||
try{
|
||||
for (MultipartFile file : multipartFile) {
|
||||
String originFileName = file.getOriginalFilename();
|
||||
String suffix=StringUtils.substringAfterLast(originFileName, ".");
|
||||
String uuid = StringUtils.randomUUID();
|
||||
String folderPath= path+uuid+"."+suffix;
|
||||
// 获取文件大小(字节)
|
||||
long sizeInBytes = file.getSize();
|
||||
// 转换为可读格式(如KB/MB)
|
||||
String humanReadableSize = convertToHumanReadable(sizeInBytes);
|
||||
SysFile sysFile=minioUtil.uploadFile(file,folderPath);
|
||||
SysFile.addSource(sysFile,userId,originFileName,humanReadableSize);
|
||||
fileList.add(sysFile);
|
||||
}
|
||||
if(fileList.size()!=multipartFile.length){
|
||||
return AjaxResult.error("文件上传失败!");
|
||||
}
|
||||
mapper.addUpLoadImage(fileList,id,createTime,operaType);
|
||||
return AjaxResult.success("上传成功!");
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return AjaxResult.error("文件上传失败!");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
@ -266,16 +281,7 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
try{
|
||||
// 查询数据历史集合
|
||||
vo.setUserId(SecurityUtils.getUserId().toString());
|
||||
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);
|
||||
}
|
||||
List<UserOperaVo> hisImageList= getUploadFileList(vo);
|
||||
return AjaxResult.success(hisImageList);
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
|
|
@ -291,6 +297,7 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
@Override
|
||||
public AjaxResult updateImageSure(UserOperaVo vo) {
|
||||
try{
|
||||
vo.setUserId(SecurityUtils.getUserId().toString());
|
||||
mapper.updateAlgorithmSure(vo);
|
||||
//跟新图片状态
|
||||
mapper.updateImage(vo.getImageId());
|
||||
|
|
@ -337,6 +344,31 @@ public class ImageCaptionServiceImpl implements ImageCaptionService {
|
|||
return AjaxResult.success(new ArrayList<AlgorithmVo>());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询全部图片集合
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<UploadFileVo> getAllImagelist(UserOperaVo vo) {
|
||||
try{
|
||||
vo.setUserId(SecurityUtils.getUserId().toString());
|
||||
List<UploadFileVo> fileVoList=mapper.getAllImageList(vo);
|
||||
for (UploadFileVo obj : fileVoList) {
|
||||
String url;
|
||||
if(BJ_TYPE.equals(obj.getType())){
|
||||
url = minioUtil.getFileUrl(obj.getBucketName(), obj.getBjFilePath(), 60 * 60 * 7);
|
||||
}else{
|
||||
url = minioUtil.getFileUrl(obj.getBucketName(), obj.getFilePath(), 60 * 60 * 7);
|
||||
}
|
||||
obj.setBjUrl(url);
|
||||
}
|
||||
return fileVoList;
|
||||
}catch (Exception e){
|
||||
log.error(e.getMessage(),e);
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 辅助方法:字节转可读格式
|
||||
private String convertToHumanReadable(long bytes) {
|
||||
|
|
|
|||
|
|
@ -22,12 +22,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<insert id="addUpLoadImage">
|
||||
insert into tb_upload_file(
|
||||
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,create_user
|
||||
) 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} )
|
||||
(#{item.id}, #{id},#{item.originName},#{item.url},#{item.bucketName},
|
||||
#{item.name},0,#{createTime},#{operaType},#{item.bjFilePath},#{item.fileSize},#{item.createUser} )
|
||||
</foreach>
|
||||
|
||||
</insert>
|
||||
<insert id="addImageRecognize">
|
||||
insert into tb_image_recognize(
|
||||
|
|
@ -51,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
update tb_upload_file set bj_file_path=#{imagePath} where id=#{imageId}
|
||||
</update>
|
||||
<update id="updateAlgorithmSure">
|
||||
update tb_algorithm set is_sure=#{isSure} where oper_id=#{id}
|
||||
update tb_algorithm set is_sure=#{isSure}, sure_user=#{createUser} where oper_id=#{id}
|
||||
|
||||
</update>
|
||||
<update id="updateImage">
|
||||
|
|
@ -73,14 +73,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!--依据操作记录查询查询详情-->
|
||||
<select id="getImageListHistory" resultType="com.bonus.business.domain.UserOperaVo">
|
||||
select tam.id, tam.oper_type, tam.name operaName,tam.oper_id operaId,
|
||||
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_id=#{id}
|
||||
where 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,
|
||||
|
|
@ -136,6 +137,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
algorithm_url algorithmUrl
|
||||
from tb_algorithm_config
|
||||
</select>
|
||||
<!--查询图片-->
|
||||
<select id="getAllImageList" 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,su.user_name userName
|
||||
from tb_algorithm tam
|
||||
left join tb_upload_file file on file.algorithm_id=tam.id
|
||||
left join tb_image_recognize tir on tir.image_id=file.id
|
||||
left join sys_user su on su.user_id=tam.sure_user
|
||||
where file.type=#{operaType}
|
||||
<if test='createUser!=null and createUser!=""'>
|
||||
and tam.user_id=#{createUser}
|
||||
</if>
|
||||
<!--查询确认的 和去确认不需要的-->
|
||||
<if test='operaType==1 or operaType=="1"'>
|
||||
and file.is_active='0' and tam.is_sure=1
|
||||
</if>
|
||||
<if test="operaTime!=null and operaTime!=''">
|
||||
and DATE(tam.create_time) =#{operaTime}
|
||||
</if>
|
||||
<if test="operaName!=null and operaName!=''">
|
||||
and tir.content_image like concat('%',#{operaName},'%')
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.file.config;
|
||||
|
||||
import com.bonus.common.utils.StringUtils;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
|
@ -44,6 +45,24 @@ public class SysFile
|
|||
* 标记数据
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createUser;
|
||||
|
||||
/**
|
||||
* 添加属性
|
||||
* @param sysFile
|
||||
* @param userId
|
||||
* @param originFileName
|
||||
* @param humanReadableSize
|
||||
*/
|
||||
public static void addSource(SysFile sysFile, String userId, String originFileName, String humanReadableSize) {
|
||||
sysFile.setOriginName(originFileName);
|
||||
sysFile.setFileSize(humanReadableSize);
|
||||
sysFile.setId(StringUtils.randomUUID());
|
||||
sysFile.setCreateUser(userId);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -99,7 +99,6 @@ public class MinioUtil {
|
|||
* @throws Exception 若上传过程中发生异常
|
||||
*/
|
||||
public SysFile uploadFile(MultipartFile file, String folderPath) throws Exception {
|
||||
|
||||
if (file.getSize() < 10 * 1024 * 1024L) {
|
||||
InputStream inputStream = file.getInputStream();
|
||||
minioClient.putObject(PutObjectArgs.builder()
|
||||
|
|
@ -113,7 +112,6 @@ public class MinioUtil {
|
|||
} else {
|
||||
uploadLargeFile(folderPath, file);
|
||||
}
|
||||
|
||||
return SysFile.builder()
|
||||
.name(file.getOriginalFilename())
|
||||
.bucketName(minioConfig.getBucketName())
|
||||
|
|
|
|||
|
|
@ -84,6 +84,14 @@ public class UploadFileVo {
|
|||
private String type;
|
||||
|
||||
private String fileType;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createUser;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
Reference in New Issue