BUGFIX: 代码优化;
This commit is contained in:
@@ -22,6 +22,7 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import io.swagger.annotations.ApiParam;
|
import io.swagger.annotations.ApiParam;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -50,6 +51,9 @@ public class LibraryController {
|
|||||||
@Resource
|
@Resource
|
||||||
private MinioUtil minioUtil;
|
private MinioUtil minioUtil;
|
||||||
|
|
||||||
|
@Value("${minio.bucketName.sysImage}")
|
||||||
|
private String sysImage;
|
||||||
|
|
||||||
@ApiOperation(value = "Library分页列表")
|
@ApiOperation(value = "Library分页列表")
|
||||||
@PostMapping("/queryLibraryPage")
|
@PostMapping("/queryLibraryPage")
|
||||||
public Response<PageBaseResponse<QueryLibraryPageVO>> queryLibraryPage(@Valid @RequestBody QueryLibraryPageDTO query) {
|
public Response<PageBaseResponse<QueryLibraryPageVO>> queryLibraryPage(@Valid @RequestBody QueryLibraryPageDTO query) {
|
||||||
@@ -118,7 +122,7 @@ public class LibraryController {
|
|||||||
Assert.notEmpty(librarys,"librarys does not exist!");
|
Assert.notEmpty(librarys,"librarys does not exist!");
|
||||||
libraryService.removeBatchByIds(deleteDTO.getLibraryIds());
|
libraryService.removeBatchByIds(deleteDTO.getLibraryIds());
|
||||||
for (Library library : librarys) {
|
for (Library library : librarys) {
|
||||||
if (library.getUrl().startsWith("aida-sys-image")) {
|
if (library.getUrl().startsWith(sysImage)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
minioUtil.deleteObject(library.getUrl());
|
minioUtil.deleteObject(library.getUrl());
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import com.google.gson.GsonBuilder;
|
|||||||
import io.minio.errors.MinioException;
|
import io.minio.errors.MinioException;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import okhttp3.*;
|
import okhttp3.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@@ -79,6 +80,9 @@ public class ChatRobotServiceImpl implements ChatRobotService {
|
|||||||
@Resource
|
@Resource
|
||||||
private LibraryMapper libraryMapper;
|
private LibraryMapper libraryMapper;
|
||||||
|
|
||||||
|
@Value("${minio.bucketName.sysImage}")
|
||||||
|
private String sysImage;
|
||||||
|
|
||||||
|
|
||||||
Gson gson = new GsonBuilder().create();
|
Gson gson = new GsonBuilder().create();
|
||||||
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
private final ExecutorService executorService = Executors.newSingleThreadExecutor();
|
||||||
@@ -198,7 +202,7 @@ public class ChatRobotServiceImpl implements ChatRobotService {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ChatRobotLibraryVO chatRobotLibraryVO = new ChatRobotLibraryVO();
|
ChatRobotLibraryVO chatRobotLibraryVO = new ChatRobotLibraryVO();
|
||||||
String bucketName = "aida-sys-image";
|
String bucketName = sysImage;
|
||||||
String path = "images/female/" + array.getString(i);
|
String path = "images/female/" + array.getString(i);
|
||||||
QueryWrapper<Library> qw = new QueryWrapper<>();
|
QueryWrapper<Library> qw = new QueryWrapper<>();
|
||||||
qw.lambda().eq(Library::getUrl, bucketName + "/" + path);
|
qw.lambda().eq(Library::getUrl, bucketName + "/" + path);
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ import javafx.scene.chart.ValueAxis;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.bouncycastle.LICENSE;
|
import org.bouncycastle.LICENSE;
|
||||||
import org.bouncycastle.cms.CMSAuthenticatedGenerator;
|
import org.bouncycastle.cms.CMSAuthenticatedGenerator;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.reactive.AbstractReactiveTransactionManager;
|
import org.springframework.transaction.reactive.AbstractReactiveTransactionManager;
|
||||||
@@ -72,6 +73,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
@Resource
|
@Resource
|
||||||
private MinioUtil minioUtil;
|
private MinioUtil minioUtil;
|
||||||
|
|
||||||
|
@Value("${minio.bucketName.collectionElement}")
|
||||||
|
private String collectionElement;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
@Override
|
@Override
|
||||||
public CollectionElementVO upload(CollectionElementUploadDTO uploadDTO) {
|
public CollectionElementVO upload(CollectionElementUploadDTO uploadDTO) {
|
||||||
@@ -81,7 +85,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
Assert.notNull(level1TypeEnum, "unknown parameter level1Type!");
|
Assert.notNull(level1TypeEnum, "unknown parameter level1Type!");
|
||||||
|
|
||||||
String objectName = userInfo.getId() + "/" + level1TypeEnum.getRealName();
|
String objectName = userInfo.getId() + "/" + level1TypeEnum.getRealName();
|
||||||
String path = minioUtil.upload("aida-collection-element", objectName, uploadDTO.getFile());
|
String path = minioUtil.upload(collectionElement, objectName, uploadDTO.getFile());
|
||||||
|
|
||||||
//保存element元素
|
//保存element元素
|
||||||
CollectionElement collectionElement = resolveData(uploadDTO, userInfo, path);
|
CollectionElement collectionElement = resolveData(uploadDTO, userInfo, path);
|
||||||
|
|||||||
@@ -60,11 +60,13 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
|||||||
private LibraryModelPointService libraryModelPointService;
|
private LibraryModelPointService libraryModelPointService;
|
||||||
@Resource
|
@Resource
|
||||||
private MinioUtil minioUtil;
|
private MinioUtil minioUtil;
|
||||||
@Value("${minio.bucketName.mannequins}")
|
|
||||||
private String mannequins;
|
|
||||||
@Value("${minio.bucketName.users}")
|
@Value("${minio.bucketName.users}")
|
||||||
private String users;
|
private String users;
|
||||||
|
|
||||||
|
@Value("${minio.bucketName.sysImage}")
|
||||||
|
private String sysImage;
|
||||||
|
|
||||||
private static List<String> top = Arrays.asList(CollectionLevel2TypeEnum.DRESS.getRealName(),
|
private static List<String> top = Arrays.asList(CollectionLevel2TypeEnum.DRESS.getRealName(),
|
||||||
CollectionLevel2TypeEnum.OUTWEAR.getRealName(),CollectionLevel2TypeEnum.BLOUSE.getRealName());
|
CollectionLevel2TypeEnum.OUTWEAR.getRealName(),CollectionLevel2TypeEnum.BLOUSE.getRealName());
|
||||||
private static List<String> bottom = Arrays.asList(CollectionLevel2TypeEnum.SKIRT.getRealName(),
|
private static List<String> bottom = Arrays.asList(CollectionLevel2TypeEnum.SKIRT.getRealName(),
|
||||||
@@ -187,7 +189,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
|||||||
libraryUpdateVo.setCheckMd5(Boolean.TRUE);
|
libraryUpdateVo.setCheckMd5(Boolean.TRUE);
|
||||||
return libraryUpdateVo;
|
return libraryUpdateVo;
|
||||||
}else if (libraryUploadDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
}else if (libraryUploadDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
||||||
bucketName = "aida-sys-image";
|
bucketName = sysImage;
|
||||||
path = "models/" + libraryUploadDTO.getModelSex().toLowerCase();
|
path = "models/" + libraryUploadDTO.getModelSex().toLowerCase();
|
||||||
String filePath = minioUtil.upload(bucketName, path, libraryUploadDTO.getFile());
|
String filePath = minioUtil.upload(bucketName, path, libraryUploadDTO.getFile());
|
||||||
String newFilePath = processMannequins(filePath);
|
String newFilePath = processMannequins(filePath);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import org.apache.commons.fileupload.FileItem;
|
import org.apache.commons.fileupload.FileItem;
|
||||||
import org.apache.commons.fileupload.FileItemFactory;
|
import org.apache.commons.fileupload.FileItemFactory;
|
||||||
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
@@ -69,8 +70,11 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
@Resource
|
@Resource
|
||||||
private MinioUtil minioUtil;
|
private MinioUtil minioUtil;
|
||||||
|
|
||||||
@Resource
|
@Value("${minio.bucketName.sysImage}")
|
||||||
private UserLikeMapper userLikeMapper;
|
private String sysImage;
|
||||||
|
|
||||||
|
@Value("${minio.bucketName.users}")
|
||||||
|
private String users;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -315,7 +319,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
File file = FileUtil.getFile(path);
|
File file = FileUtil.getFile(path);
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
String uploadMinioPath = sysFile.getLevel1Type().toLowerCase() + "/" + sysFile.getLevel2Type().toLowerCase() + "/" + file.getName();
|
String uploadMinioPath = sysFile.getLevel1Type().toLowerCase() + "/" + sysFile.getLevel2Type().toLowerCase() + "/" + file.getName();
|
||||||
String bucketName = "aida-sys-image";
|
String bucketName = sysImage;
|
||||||
boolean b = minioUtil.doesObjectExist(bucketName, uploadMinioPath);
|
boolean b = minioUtil.doesObjectExist(bucketName, uploadMinioPath);
|
||||||
if (!b) {
|
if (!b) {
|
||||||
FileItem a = getMultipartFile(file, file.getName());
|
FileItem a = getMultipartFile(file, file.getName());
|
||||||
@@ -347,7 +351,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
|||||||
} else {
|
} else {
|
||||||
sb.append(o.getAccountId() + "/").append(o.getLevel1Type().toLowerCase() + "/").append(o.getLevel2Type().toLowerCase() + "/").append(file.getName());
|
sb.append(o.getAccountId() + "/").append(o.getLevel1Type().toLowerCase() + "/").append(o.getLevel2Type().toLowerCase() + "/").append(file.getName());
|
||||||
}
|
}
|
||||||
String bucketName = "aida-users";
|
String bucketName = users;
|
||||||
boolean b = minioUtil.doesObjectExist(bucketName, sb.toString());
|
boolean b = minioUtil.doesObjectExist(bucketName, sb.toString());
|
||||||
if (!b) {
|
if (!b) {
|
||||||
FileItem a = getMultipartFile(file, file.getName());
|
FileItem a = getMultipartFile(file, file.getName());
|
||||||
|
|||||||
@@ -56,10 +56,10 @@ minio.endpoint=http://18.167.251.121:9000
|
|||||||
minio.accessKey=minioadmin
|
minio.accessKey=minioadmin
|
||||||
minio.secretKey=minioadmin
|
minio.secretKey=minioadmin
|
||||||
minio.bucketName.clothing=aida-clothing
|
minio.bucketName.clothing=aida-clothing
|
||||||
minio.bucketName.mannequins=aida-mannequins
|
|
||||||
minio.bucketName.results=aida-results
|
minio.bucketName.results=aida-results
|
||||||
minio.bucketName.sysImage=aida-sys-image
|
minio.bucketName.sysImage=aida-sys-image
|
||||||
minio.bucketName.users=aida-users
|
minio.bucketName.users=aida-users
|
||||||
|
minio.bucketName.collectionElement=aida-collection-element
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user