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