S3Util 工具类修改
This commit is contained in:
@@ -17,7 +17,7 @@ public enum CreditsEventsEnum {
|
||||
INIT_YEARLY("init_yearly", "6000"),
|
||||
INIT_MONTHLY("init_monthly", "5000"),
|
||||
INIT_TRIAL("init_trial", "100"),
|
||||
INIT_WEEKLY("init_weekly","10000"),
|
||||
INIT_WEEKLY("init_weekly","6000"),
|
||||
|
||||
// SUPER_RESOLUTION("Super Resolution","30"),
|
||||
SUPER_RESOLUTION("Super Resolution","10"),
|
||||
|
||||
@@ -1,20 +1,24 @@
|
||||
package com.ai.da.common.task;
|
||||
|
||||
import com.ai.da.service.AccountService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AccountTask {
|
||||
|
||||
@Resource
|
||||
private AccountService accountService;
|
||||
|
||||
/** 每周日晚上刷新 年付用户、月付用户的积分 */
|
||||
// @Scheduled(cron = "59 59 23 ? * SUN")
|
||||
@Scheduled(cron = "59 59 23 ? * SUN")
|
||||
// @Scheduled(cron = "59 59 23 * * ?")
|
||||
public void refreshCreditsMonthly(){
|
||||
log.info("每周日晚11:59:59刷新付费用户积分为 6000");
|
||||
accountService.refreshCreditsWeekly();
|
||||
}
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ public class MinioUtil {
|
||||
* @param expiry 过期时间(单位:分)
|
||||
* @return 文件的临时URL,如果出现异常则返回null
|
||||
*/
|
||||
public String getPresignedUrl(String bucketName, String fileName, int expiry) {
|
||||
public String getPreSignedUrl(String bucketName, String fileName, int expiry) {
|
||||
try {
|
||||
return minioClient.getPresignedObjectUrl(
|
||||
GetPresignedObjectUrlArgs.builder()
|
||||
@@ -389,7 +389,7 @@ public class MinioUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public String getPresignedUrl(String path, int expiry) {
|
||||
public String getPreSignedUrl(String path, int expiry) {
|
||||
if (LocalCacheUtils.getPresignedUrlCache(path) != null) {
|
||||
return LocalCacheUtils.getPresignedUrlCache(path);
|
||||
} else {
|
||||
@@ -399,7 +399,7 @@ public class MinioUtil {
|
||||
int index = path.indexOf("/");
|
||||
String bucketName = path.substring(0, index);
|
||||
String fileName = path.substring(index + 1);
|
||||
String presignedUrl = getPresignedUrl(bucketName, fileName, expiry);
|
||||
String presignedUrl = getPreSignedUrl(bucketName, fileName, expiry);
|
||||
LocalCacheUtils.setPresignedUrlCache(path, presignedUrl);
|
||||
return presignedUrl;
|
||||
}
|
||||
@@ -422,7 +422,7 @@ public class MinioUtil {
|
||||
fileName.append("/");
|
||||
}
|
||||
}
|
||||
return getPresignedUrl(bucketName, String.valueOf(fileName), expiry);
|
||||
return getPreSignedUrl(bucketName, String.valueOf(fileName), expiry);
|
||||
}
|
||||
|
||||
public boolean doesObjectExist(String bucketName, String objectName) {
|
||||
|
||||
@@ -104,11 +104,11 @@ public class S3Util {
|
||||
.contentType("image/png")
|
||||
.contentLength((long) in.available())
|
||||
.key(fileName)
|
||||
// .acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.build();
|
||||
s3Client.putObject(putObjectRequest, RequestBody.fromInputStream(in, in.available()));
|
||||
|
||||
log.info("上传的位置:桶 - {},路径 - {}", bucketName, fileName);
|
||||
log.info("uploadImageFromBase64 上传的位置:桶 - {},路径 - {}", bucketName, fileName);
|
||||
return bucketName + "/" + fileName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -132,18 +132,19 @@ public class S3Util {
|
||||
.contentType(file.getContentType())
|
||||
.contentLength(file.getSize())
|
||||
.key(fileName)
|
||||
// .acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.build();
|
||||
s3Client.putObject(putObjectRequest, RequestBody.fromInputStream(file.getInputStream(), file.getSize()));
|
||||
|
||||
log.info("上传的位置:桶 - {},路径 - {}", bucketName, fileName);
|
||||
log.info("upload 上传的位置:桶 - {},路径 - {}", bucketName, fileName);
|
||||
return bucketName + "/" + fileName;
|
||||
} catch (Exception e) {
|
||||
log.error("上传文件到S3失败 异常:{}", e.getMessage());
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// todo
|
||||
|
||||
// todo
|
||||
public String upload(String bucketName, String path, MultipartFile file, String copy) {
|
||||
S3Client s3Client = getS3Client();
|
||||
InputStream in = null;
|
||||
@@ -155,10 +156,10 @@ public class S3Util {
|
||||
.contentType(file.getContentType())
|
||||
.contentLength(file.getSize())
|
||||
.key(path)
|
||||
// .acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.build();
|
||||
s3Client.putObject(putObjectRequest, RequestBody.fromInputStream(file.getInputStream(), file.getSize()));
|
||||
|
||||
log.info("upload-copy 上传的位置:桶 - {},路径 - {}", bucketName, path);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
@@ -195,6 +196,7 @@ public class S3Util {
|
||||
// ResponseBytes<GetObjectResponse> objectBytes = s3.getObjectAsBytes(objectRequest);
|
||||
ResponseBytes<GetObjectResponse> objectAsBytes = s3Client.getObjectAsBytes(objectRequest);
|
||||
byte[] data = objectAsBytes.asByteArray();
|
||||
log.info("download 下载图片位置:桶 - {},路径 - {}", bucketName, objectName);
|
||||
return new ByteArrayInputStream(data);
|
||||
|
||||
/*// Write the data to a local file.
|
||||
@@ -263,6 +265,9 @@ public class S3Util {
|
||||
String preSignatureUrl = "";
|
||||
try {
|
||||
S3Presigner s3PreSigner = getS3PreSigner();
|
||||
S3Client s3Client = getS3Client();
|
||||
setObjectAcl(s3Client, bucket, keyName, ObjectCannedACL.PUBLIC_READ);
|
||||
|
||||
GetObjectRequest getObjectRequest = GetObjectRequest.builder()
|
||||
.bucket(bucket)
|
||||
.key(keyName)
|
||||
@@ -286,13 +291,20 @@ public class S3Util {
|
||||
s3PreSigner.presignGetObject(getObjectPresignRequest);
|
||||
|
||||
preSignatureUrl = String.valueOf(presignedGetObjectRequest.url());
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("生成预签名URL失败,异常:{}", e.getMessage());
|
||||
}
|
||||
return preSignatureUrl;
|
||||
}
|
||||
|
||||
public static void setObjectAcl(S3Client s3, String bucketName, String keyName, ObjectCannedACL acl) {
|
||||
PutObjectAclRequest aclRequest = PutObjectAclRequest.builder()
|
||||
.bucket(bucketName)
|
||||
.key(keyName)
|
||||
.acl(acl)
|
||||
.build();
|
||||
s3.putObjectAcl(aclRequest);
|
||||
}
|
||||
public boolean doesObjectExist(String bucketName, String objectName) {
|
||||
try {
|
||||
S3Client s3Client = getS3Client();
|
||||
@@ -309,7 +321,7 @@ public class S3Util {
|
||||
}
|
||||
}
|
||||
|
||||
public String base64UploadToPath(String base64, String bucketName, String path){
|
||||
public String base64UploadToPath(String base64, String bucketName, String path) {
|
||||
S3Client s3Client = getS3Client();
|
||||
String[] parts = base64.split(",");
|
||||
String imageType = parts[0].split("/")[1].split(";")[0];
|
||||
@@ -317,9 +329,9 @@ public class S3Util {
|
||||
|
||||
byte[] imageBytes = Base64.getDecoder().decode(base64Data);
|
||||
String fileName;
|
||||
if (!StringUtil.isNullOrEmpty(path)){
|
||||
if (!StringUtil.isNullOrEmpty(path)) {
|
||||
fileName = path + "." + imageType; // or any other image format
|
||||
}else {
|
||||
} else {
|
||||
fileName = UUID.randomUUID() + "." + imageType;
|
||||
}
|
||||
|
||||
@@ -329,11 +341,11 @@ public class S3Util {
|
||||
.contentType("image/" + imageType)
|
||||
.contentLength((long) in.available())
|
||||
.key(fileName)
|
||||
// .acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.acl(ObjectCannedACL.PUBLIC_READ)
|
||||
.build();
|
||||
s3Client.putObject(putObjectRequest, RequestBody.fromInputStream(in, in.available()));
|
||||
|
||||
log.info("上传的位置:桶 - {},路径 - {}", bucketName, fileName);
|
||||
log.info("base64UploadToPath 上传的位置:桶 - {},路径 - {}", bucketName, fileName);
|
||||
return bucketName + "/" + fileName;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -163,7 +163,7 @@ public class LibraryController {
|
||||
Response<String> response = new Response();
|
||||
log.info("Models打点预览入参####{}", JSON.toJSONString(modelsDotDTO));
|
||||
String url = libraryModelPointService.modelsDot(modelsDotDTO);
|
||||
response.setData(minioUtil.getPresignedUrl(url, 24 * 60));
|
||||
response.setData(minioUtil.getPreSignedUrl(url, 24 * 60));
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ public class SavedCollectionController {
|
||||
List<UserLikeVO> details = groupDetailMap.get(group.getId());
|
||||
for (UserLikeVO detail : details) {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(detail.getDesignOutfitId());
|
||||
detail.setUrl(minioUtil.getPresignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
detail.setUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
}
|
||||
userLikeGroupVO.setGroupDetails(details);
|
||||
userLikeGroupVO.setSketchCount(CollectionUtils.isEmpty(details) ? 0 : details.size());
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ai.da.mapper.primary.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@@ -24,11 +25,13 @@ public class BaseEntity implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
/**
|
||||
|
||||
@@ -29,7 +29,7 @@ public class DesignPythonItemPrint {
|
||||
* 是否打点
|
||||
*/
|
||||
@ApiModelProperty("是否打点 是传true 否则false")
|
||||
private Boolean IfSingle;
|
||||
private Boolean ifSingle;
|
||||
|
||||
|
||||
@ApiModelProperty("print的位置 传 [[0.2, 0.2]]")
|
||||
@@ -43,14 +43,14 @@ public class DesignPythonItemPrint {
|
||||
|
||||
@JSONField(name = "IfSingle")
|
||||
public Boolean getIfSingle() {
|
||||
return IfSingle;
|
||||
return ifSingle;
|
||||
}
|
||||
|
||||
public DesignPythonItemPrint(String singlePath, String level1Type, Float scale, Boolean ifSingle) {
|
||||
this.path = singlePath;
|
||||
this.level1Type = level1Type;
|
||||
this.scale = scale;
|
||||
IfSingle = ifSingle;
|
||||
this.ifSingle = ifSingle;
|
||||
}
|
||||
|
||||
public DesignPythonItemPrint() {
|
||||
@@ -62,6 +62,6 @@ public class DesignPythonItemPrint {
|
||||
|
||||
public DesignPythonItemPrint(List<String> print_path_list, Boolean ifSingle) {
|
||||
this.print_path_list = print_path_list;
|
||||
IfSingle = ifSingle;
|
||||
this.ifSingle = ifSingle;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +223,7 @@ public class ChatRobotServiceImpl implements ChatRobotService {
|
||||
if (!CollectionUtils.isEmpty(libraryList)) {
|
||||
chatRobotLibraryVO.setId(libraryList.get(0).getId());
|
||||
}
|
||||
String aidaSysImage = minioUtil.getPresignedUrl(bucketName + "/" + path, 24 * 60);
|
||||
String aidaSysImage = minioUtil.getPreSignedUrl(bucketName + "/" + path, 24 * 60);
|
||||
chatRobotLibraryVO.setUrl(bucketName + "/" + path);
|
||||
chatRobotLibraryVO.setPresignedUrl(aidaSysImage);
|
||||
chatRobotLibraryVOList.add(chatRobotLibraryVO);
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.minio.errors.MinioException;
|
||||
import io.netty.util.internal.StringUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -35,8 +34,6 @@ import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
@@ -105,7 +102,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
saveOne(collectionElement);
|
||||
CollectionElementVO collectionElementVO = CopyUtil.copyObject(collectionElement, CollectionElementVO.class);
|
||||
collectionElementVO.setMinIOPath(collectionElementVO.getUrl());
|
||||
collectionElementVO.setUrl(minioUtil.getPresignedUrl(collectionElementVO.getUrl(), 24 * 60));
|
||||
collectionElementVO.setUrl(minioUtil.getPreSignedUrl(collectionElementVO.getUrl(), 24 * 60));
|
||||
collectionElementVO.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
|
||||
return collectionElementVO;
|
||||
}
|
||||
@@ -246,7 +243,7 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
// collectionGeneratePrint.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
|
||||
// return collectionGeneratePrint;
|
||||
return new GenerateCollectionItemVO(generateDetail.getId(),
|
||||
minioUtil.getPresignedUrl(generateUrl, 24 * 60),
|
||||
minioUtil.getPreSignedUrl(generateUrl, 24 * 60),
|
||||
generateDetail.getIsLike().equals((byte) 0) ? Boolean.FALSE : Boolean.TRUE);
|
||||
}
|
||||
|
||||
@@ -339,9 +336,12 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
element.setHasPin((byte) 0);
|
||||
try {
|
||||
element.setMd5(MD5Utils.encryptFile(minioUtil.download(path)));
|
||||
} catch (MinioException | IOException e) {
|
||||
}catch (Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
/* catch (MinioException | IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
|
||||
//按时区计算
|
||||
element.setCreateDate(DateUtil.getByTimeZone(timeZone));
|
||||
@@ -881,9 +881,11 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
String md5;
|
||||
try {
|
||||
md5 = MD5Utils.encryptFile(minioUtil.download(url));
|
||||
} catch (MinioException | IOException e) {
|
||||
} catch (Exception e){
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}/*catch (MinioException | IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}*/
|
||||
// 通过MD5来确认当前图片是否有被like过,避免重复like
|
||||
List<Map<String, Long>> libraryIds = generateDetailMapper.getLibraryIdThroughMD5(md5, CollectionLevel1TypeEnum.PRINT_BOARD.getRealName());
|
||||
if (libraryIds.isEmpty()){
|
||||
|
||||
@@ -80,7 +80,7 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
|
||||
CollectionElement byId = collectionElementService.getById(response.getMoodTemplateId());
|
||||
if (Objects.nonNull(byId)) {
|
||||
response.setMoodTemplateName(byId.getName());
|
||||
response.setMoodTemplateUrl(minioUtil.getPresignedUrl(byId.getUrl(), 24 * 60));
|
||||
response.setMoodTemplateUrl(minioUtil.getPreSignedUrl(byId.getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
Map<String, List<CollectionElement>> maps = collectionElements
|
||||
@@ -95,27 +95,27 @@ public class CollectionServiceImpl extends ServiceImpl<CollectionMapper, Collect
|
||||
case MOOD_BOARD:
|
||||
response.setMoodBoards(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> {
|
||||
d.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
|
||||
d.setUrl(minioUtil.getPresignedUrl(o.getUrl(), 24 * 60));
|
||||
d.setUrl(minioUtil.getPreSignedUrl(o.getUrl(), 24 * 60));
|
||||
}));
|
||||
break;
|
||||
case PRINT_BOARD:
|
||||
response.setPrintBoards(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> {
|
||||
d.setIsPin(o.getHasPin());
|
||||
d.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
|
||||
d.setUrl(minioUtil.getPresignedUrl(o.getUrl(), 24 * 60));
|
||||
d.setUrl(minioUtil.getPreSignedUrl(o.getUrl(), 24 * 60));
|
||||
}));
|
||||
break;
|
||||
case SKETCH_BOARD:
|
||||
response.setSketchBoards(CopyUtil.copyList(v, CollectionElementVO.class, (o, d) -> {
|
||||
d.setIsPin(o.getHasPin());
|
||||
d.setDesignType(DesignTypeEnum.COLLECTION.getRealName());
|
||||
d.setUrl(minioUtil.getPresignedUrl(o.getUrl(), 24 * 60));
|
||||
d.setUrl(minioUtil.getPreSignedUrl(o.getUrl(), 24 * 60));
|
||||
String url = o.getUrl();
|
||||
if (url.contains(".")) {
|
||||
String[] split = url.split("\\.");
|
||||
d.setUrlWithWhiteSide(minioUtil.getPresignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||
d.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||
}else {
|
||||
d.setUrlWithWhiteSide(minioUtil.getPresignedUrl(url + "-show", 24 * 60));
|
||||
d.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(url + "-show", 24 * 60));
|
||||
}
|
||||
}));
|
||||
break;
|
||||
|
||||
@@ -8,10 +8,7 @@ import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
|
||||
import com.ai.da.common.enums.SingleOverallEnum;
|
||||
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.DateUtil;
|
||||
import com.ai.da.common.utils.MD5Utils;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.primary.DesignItemMapper;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.*;
|
||||
@@ -536,7 +533,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
}
|
||||
|
||||
return assembleDesignSingleResponse(designItem.getId(),
|
||||
minioUtil.getPresignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60),
|
||||
minioUtil.getPreSignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60),
|
||||
outfit.getString("synthesis_url"),
|
||||
designSingleIncludeLayersDTO.getDesignSingleItemDTOList(),
|
||||
detailsVO,
|
||||
@@ -591,7 +588,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
|
||||
// 4、合成图层
|
||||
String synthesisUrl = pythonService.composeLayers(outfitDetailPythonItems);
|
||||
designItemLayer.setDesignItemUrl(minioUtil.getPresignedUrl(synthesisUrl, 24 * 60));
|
||||
designItemLayer.setDesignItemUrl(minioUtil.getPreSignedUrl(synthesisUrl, 24 * 60));
|
||||
|
||||
// 5、更新数据库,根据designItemId更新designItemUrl
|
||||
designItem.setUpdateDate(DateUtil.getByTimeZone(positionAndScaleVO.getTimeZone()));
|
||||
@@ -627,10 +624,10 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
}
|
||||
layer.setImageSize(imageSize);
|
||||
if (!StringUtil.isNullOrEmpty(layer.getImageUrl())) {
|
||||
layer.setImageUrl(minioUtil.getPresignedUrl(layer.getImageUrl(), 24 * 60));
|
||||
layer.setImageUrl(minioUtil.getPreSignedUrl(layer.getImageUrl(), 24 * 60));
|
||||
}
|
||||
if (!StringUtil.isNullOrEmpty(layer.getMaskUrl())) {
|
||||
layer.setMaskUrl(minioUtil.getPresignedUrl(layer.getMaskUrl(), 24 * 60));
|
||||
layer.setMaskUrl(minioUtil.getPreSignedUrl(layer.getMaskUrl(), 24 * 60));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -662,7 +659,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
// 图片用于修改前后的一键对比
|
||||
designSingleVO.setDesignItemUrl(designItemUrl);
|
||||
// 当前全身图
|
||||
designSingleVO.setCurrentFullBodyView(minioUtil.getPresignedUrl(currentFullBodyView, 24 * 60));
|
||||
designSingleVO.setCurrentFullBodyView(minioUtil.getPreSignedUrl(currentFullBodyView, 24 * 60));
|
||||
designSingleVO.setClothes(clothes);
|
||||
|
||||
// 获取每个单品的id是否被改变过,该状态需要再返回给前端
|
||||
@@ -677,7 +674,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemClothesDetailVO.setChanged(idChanged.get(singleItem.getId()));
|
||||
designItemClothesDetailVO.setDesignType(idDesignType.get(singleItem.getId()));
|
||||
designItemClothesDetailVO.setType(singleItem.getType());
|
||||
designItemClothesDetailVO.setPath(minioUtil.getPresignedUrl(singleItem.getPath(), 24 * 60));
|
||||
designItemClothesDetailVO.setPath(minioUtil.getPreSignedUrl(singleItem.getPath(), 24 * 60));
|
||||
designItemClothesDetailVO.setMinIOPath(singleItem.getPath());
|
||||
designItemClothesDetailVO.setColor(panToneService.getPantoneByRgb(singleItem.getColor()));
|
||||
designItemClothesDetailVO.setPrintObject(singleItem.getPrintObject());
|
||||
@@ -785,7 +782,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designSingleIncludeLayersDTO.getDesignSingleItemDTOList().forEach(designSingleItem -> {
|
||||
|
||||
if (!StringUtil.isNullOrEmpty(designSingleItem.getDesignType()) && designSingleItem.getDesignType().equals("Collection")){
|
||||
String path = minioUtil.getPresignedUrl(designSingleItem.getPath(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
String path = minioUtil.getPreSignedUrl(designSingleItem.getPath(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
try {
|
||||
String md5 = MD5Utils.encryptFile(path, false);
|
||||
// 先判断是否需要被加入到library
|
||||
@@ -814,7 +811,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
// 添加print到library
|
||||
designSingleItem.getPrintObject().getPrints().forEach(print -> {
|
||||
if (!StringUtil.isNullOrEmpty(print.getDesignType()) && print.getDesignType().equals("Collection")){
|
||||
String path = minioUtil.getPresignedUrl(print.getMinIOPath(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
String path = minioUtil.getPreSignedUrl(print.getMinIOPath(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME);
|
||||
try {
|
||||
String md5 = MD5Utils.encryptFile(path, false);
|
||||
// 先判断是否已被加入到library
|
||||
|
||||
@@ -382,9 +382,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
String url = byId.getUrl();
|
||||
if (url.contains(".")) {
|
||||
String[] split = url.split("\\.");
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||
}else {
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(url + "-show", 24 * 60));
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(url + "-show", 24 * 60));
|
||||
}
|
||||
result.add(vo);
|
||||
}else if (collectionSketchDTO.getDesignType().equals(DesignTypeEnum.GENERATE.getRealName())) {
|
||||
@@ -393,9 +393,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
String url = generateDetail.getUrl();
|
||||
if (url.contains(".")) {
|
||||
String[] split = url.split("\\.");
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||
}else {
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(url + "-show", 24 * 60));
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(url + "-show", 24 * 60));
|
||||
}
|
||||
result.add(vo);
|
||||
}
|
||||
@@ -411,9 +411,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
String url = byId.getUrl();
|
||||
if (url.contains(".")) {
|
||||
String[] split = url.split("\\.");
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(split[0] + "-show." + split[1], 24 * 60));
|
||||
}else {
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPresignedUrl(url + "-show", 24 * 60));
|
||||
vo.setUrlWithWhiteSide(minioUtil.getPreSignedUrl(url + "-show", 24 * 60));
|
||||
}
|
||||
result.add(vo);
|
||||
}
|
||||
@@ -597,7 +597,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
String designUrl = designPythonOutfit.getDesignUrl();
|
||||
if (!StringUtils.isEmpty(designUrl) && designUrl.contains("/")) {
|
||||
int firstIndex = designUrl.indexOf("/");
|
||||
designCollectionItemVO.setDesignOutfitUrl(minioUtil.getPresignedUrl(designUrl.substring(0, firstIndex) + "/" + designUrl.substring(firstIndex + 1), 24 * 60));
|
||||
designCollectionItemVO.setDesignOutfitUrl(minioUtil.getPreSignedUrl(designUrl.substring(0, firstIndex) + "/" + designUrl.substring(firstIndex + 1), 24 * 60));
|
||||
}
|
||||
//response
|
||||
designCollectionItems.add(designCollectionItemVO);
|
||||
@@ -997,7 +997,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
.collect(Collectors.toList());
|
||||
response.setClothes(CopyUtil.copyList(filterDetail, DesignItemClothesDetailVO.class, (o, d) -> {
|
||||
d.setId(o.getId());
|
||||
d.setPath(minioUtil.getPresignedUrl(o.getPath(), 24 * 60));
|
||||
d.setPath(minioUtil.getPreSignedUrl(o.getPath(), 24 * 60));
|
||||
d.setMinIOPath(o.getPath());
|
||||
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
||||
d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class));
|
||||
@@ -1025,12 +1025,12 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
// todo 不确定businessId的作用,暂时取消传递,查看影响
|
||||
// d.setId(o.getBusinessId());
|
||||
d.setId(0L);
|
||||
d.setPath(minioUtil.getPresignedUrl(o.getPath(), 24 * 60));
|
||||
d.setPath(minioUtil.getPreSignedUrl(o.getPath(), 24 * 60));
|
||||
d.setMinIOPath(o.getPath());
|
||||
d.setPrintObject(new DesignPythonItemPrint());
|
||||
}));
|
||||
return editDesignItemLayer(flag, designPythonOutfit,
|
||||
minioUtil.getPresignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60),
|
||||
minioUtil.getPreSignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60),
|
||||
editResponseColor(designItemDetails, response));
|
||||
}
|
||||
|
||||
@@ -1169,7 +1169,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
});
|
||||
|
||||
// 2、将查询出的图层信息填充到designItemDetailVO中
|
||||
designItemDetailVO.setDesignItemUrl(minioUtil.getPresignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
designItemDetailVO.setDesignItemUrl(minioUtil.getPreSignedUrl(designPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
// 2.1 填充clothes
|
||||
designItemDetailVO.getClothes().forEach(c -> {
|
||||
// String type = c.getType().toLowerCase();
|
||||
@@ -1209,7 +1209,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designSinglePrint.setLocation(JSONArray.parseArray(detailPrint.getPosition(), Double.class));
|
||||
designSinglePrint.setAngle(detailPrint.getAngle());
|
||||
designSinglePrint.setPriority(detailPrint.getPriority());
|
||||
designSinglePrint.setPath(minioUtil.getPresignedUrl(detailPrint.getPath(), 24 * 60));
|
||||
designSinglePrint.setPath(minioUtil.getPreSignedUrl(detailPrint.getPath(), 24 * 60));
|
||||
designSinglePrint.setMinIOPath(detailPrint.getPath());
|
||||
designSinglePrint.setScale(detailPrint.getScale());
|
||||
prints.add(designSinglePrint);
|
||||
@@ -1220,7 +1220,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
if (print.getSingleOrOverall().equals("single")) {
|
||||
prints.add(new DesignSinglePrint(
|
||||
print.getLevel2Type(),
|
||||
minioUtil.getPresignedUrl(print.getPath(), 24 * 60),
|
||||
minioUtil.getPreSignedUrl(print.getPath(), 24 * 60),
|
||||
print.getPath(),
|
||||
JSONArray.parseArray(print.getPosition(), Double.class),
|
||||
print.getScale(),
|
||||
@@ -1250,13 +1250,13 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
List<Long> modelFromLibIds = designs.stream().filter(design -> design.getModelType().equals("Library")).map(Design::getTemplateId).collect(Collectors.toList());
|
||||
if (!CollectionUtil.isEmpty(modelFromLibIds)){
|
||||
models.addAll(libraryService.getByIds(modelFromLibIds).stream()
|
||||
.map(d -> minioUtil.getPresignedUrl(d.getUrl(), 24 * 60))
|
||||
.map(d -> minioUtil.getPreSignedUrl(d.getUrl(), 24 * 60))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
List<Long> modelFromSysIds = designs.stream().filter(design -> design.getModelType().equals("System")).map(Design::getTemplateId).collect(Collectors.toList());
|
||||
if (!CollectionUtil.isEmpty(modelFromSysIds)){
|
||||
models.addAll(sysFileService.getByIds(modelFromSysIds).stream()
|
||||
.map(d -> minioUtil.getPresignedUrl(d.getUrl(), 24 * 60))
|
||||
.map(d -> minioUtil.getPreSignedUrl(d.getUrl(), 24 * 60))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
|
||||
@@ -213,7 +213,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
}
|
||||
}
|
||||
// Generate generate = selectByUniqueId(taskId);
|
||||
String md5 = MD5Utils.encryptFile(minioUtil.getPresignedUrl(url, 24 * 60), Boolean.FALSE);
|
||||
String md5 = MD5Utils.encryptFile(minioUtil.getPreSignedUrl(url, 24 * 60), Boolean.FALSE);
|
||||
// 通过MD5值和level1Type,判断不同level1Type下相同的图片是否被like过
|
||||
List<Map<String, Long>> libraryIdList = generateDetailMapper.getLibraryIdThroughMD5(md5, generate.getLevel1Type());
|
||||
if (!libraryIdList.isEmpty()) {
|
||||
@@ -543,7 +543,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
collectionElement.setName(name);
|
||||
collectionElement.setUrl(path);
|
||||
collectionElement.setHasPin((byte) 0);
|
||||
collectionElement.setMd5(MD5Utils.encryptFile(minioUtil.getPresignedUrl(path, 24 * 60), Boolean.FALSE));
|
||||
collectionElement.setMd5(MD5Utils.encryptFile(minioUtil.getPreSignedUrl(path, 24 * 60), Boolean.FALSE));
|
||||
collectionElement.setCreateDate(DateUtil.getByTimeZone(generateThroughImageTextDTO.getTimeZone()));
|
||||
collectionElementService.save(collectionElement);
|
||||
|
||||
@@ -633,7 +633,7 @@ public class GenerateServiceImpl extends ServiceImpl<GenerateMapper, Generate> i
|
||||
if (url.substring(url.lastIndexOf("/") + 1).equals("white_image.jpg")) {
|
||||
generateResultVO.setStatus("Invalid");
|
||||
} else {
|
||||
generateResultVO.setUrl(minioUtil.getPresignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
generateResultVO.setUrl(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
}
|
||||
} else if (Objects.isNull(generateResultVO)) {
|
||||
generateResultVO = new GenerateResultVO();
|
||||
|
||||
@@ -8,10 +8,7 @@ import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.enums.*;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.ResultEnum;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.DateUtil;
|
||||
import com.ai.da.common.utils.FileUtil;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.*;
|
||||
@@ -209,7 +206,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
QueryLibraryPageVO libraryPageVO = CopyUtil.copyObject(library, QueryLibraryPageVO.class);
|
||||
libraryPageVO.setDesignType(DesignTypeEnum.LIBRARY.getRealName());
|
||||
libraryPageVO.setMinIOPath(library.getUrl());
|
||||
libraryPageVO.setUrl(minioUtil.getPresignedUrl(library.getUrl(), 24 * 60));
|
||||
libraryPageVO.setUrl(minioUtil.getPreSignedUrl(library.getUrl(), 24 * 60));
|
||||
if (finalMap != null && finalMap.containsKey(library.getId())) {
|
||||
libraryPageVO.setLibraryModelPoint(finalMap.get(library.getId()));
|
||||
}
|
||||
@@ -273,7 +270,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
Library library = resolveData(libraryUploadDTO, userInfo, newFilePath);
|
||||
LibraryUpdateVo libraryUpdateVo = CopyUtil.copyObject(library, LibraryUpdateVo.class);
|
||||
libraryUpdateVo.setMinIOPath(libraryUpdateVo.getUrl());
|
||||
libraryUpdateVo.setUrl(minioUtil.getPresignedUrl(newFilePath, 24 * 60));
|
||||
libraryUpdateVo.setUrl(minioUtil.getPreSignedUrl(newFilePath, 24 * 60));
|
||||
libraryUpdateVo.setCheckMd5(Boolean.TRUE);
|
||||
return libraryUpdateVo;
|
||||
} else if (libraryUploadDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
||||
@@ -284,7 +281,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
Library library = resolveData(libraryUploadDTO, userInfo, newFilePath);
|
||||
LibraryUpdateVo libraryUpdateVo = CopyUtil.copyObject(library, LibraryUpdateVo.class);
|
||||
libraryUpdateVo.setMinIOPath(libraryUpdateVo.getUrl());
|
||||
libraryUpdateVo.setUrl(minioUtil.getPresignedUrl(newFilePath, 24 * 60));
|
||||
libraryUpdateVo.setUrl(minioUtil.getPreSignedUrl(newFilePath, 24 * 60));
|
||||
libraryUpdateVo.setCheckMd5(Boolean.TRUE);
|
||||
return libraryUpdateVo;
|
||||
} else {
|
||||
@@ -299,7 +296,7 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
Library library = resolveData(libraryUploadDTO, userInfo, filePath);
|
||||
LibraryUpdateVo libraryUpdateVo = CopyUtil.copyObject(library, LibraryUpdateVo.class);
|
||||
libraryUpdateVo.setMinIOPath(libraryUpdateVo.getUrl());
|
||||
libraryUpdateVo.setUrl(minioUtil.getPresignedUrl(libraryUpdateVo.getUrl(), 24 * 60));
|
||||
libraryUpdateVo.setUrl(minioUtil.getPreSignedUrl(libraryUpdateVo.getUrl(), 24 * 60));
|
||||
libraryUpdateVo.setCheckMd5(Boolean.TRUE);
|
||||
return libraryUpdateVo;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.ai.da.service.impl;
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.Response;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.common.utils.RedisUtil;
|
||||
@@ -34,7 +33,6 @@ import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio> implements PortfolioService {
|
||||
@@ -395,7 +393,7 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
if (portfolio != null) {
|
||||
PortfolioVO vo = CopyUtil.copyObject(portfolio, PortfolioVO.class);
|
||||
Canvas canvas = canvasMapper.selectById(vo.getCanvasId());
|
||||
vo.setCanvasUrl(minioUtil.getPresignedUrl(canvas.getUrl(), 24 * 60));
|
||||
vo.setCanvasUrl(minioUtil.getPreSignedUrl(canvas.getUrl(), 24 * 60));
|
||||
vo.setLikeNum(redisUtil.getLikeCount(vo.getId()));
|
||||
vo.setViewNums(redisUtil.getViewCount(vo.getId()));
|
||||
return vo;
|
||||
@@ -417,19 +415,19 @@ public class PortfolioServiceImpl extends ServiceImpl<PortfolioMapper, Portfolio
|
||||
if (StringUtils.isEmpty(element.getUrl())) {
|
||||
continue;
|
||||
}
|
||||
element.setUrl(minioUtil.getPresignedUrl(element.getUrl(), 24 * 60));
|
||||
element.setUrl(minioUtil.getPreSignedUrl(element.getUrl(), 24 * 60));
|
||||
}
|
||||
vo.setCollectionElementList(collectionElementList);
|
||||
QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(TDesignPythonOutfit::getCollectionId, portfolio.getCollectionId());
|
||||
List<TDesignPythonOutfit> designPythonOutfitList = designPythonOutfitMapper.selectList(qw);
|
||||
for (TDesignPythonOutfit tDesignPythonOutfit : designPythonOutfitList) {
|
||||
tDesignPythonOutfit.setDesignUrl(minioUtil.getPresignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
tDesignPythonOutfit.setDesignUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
}
|
||||
vo.setDesignPythonOutfitList(designPythonOutfitList);
|
||||
}
|
||||
Canvas canvas = canvasMapper.selectById(vo.getCanvasId());
|
||||
vo.setCanvasUrl(minioUtil.getPresignedUrl(canvas.getUrl(), 24 * 60));
|
||||
vo.setCanvasUrl(minioUtil.getPreSignedUrl(canvas.getUrl(), 24 * 60));
|
||||
vo.setLikeNum(redisUtil.getLikeCount(vo.getId()));
|
||||
boolean postLikedByUser = redisUtil.isPostLikedByUser(portfolioDTO.getId(), userHolder.getId());
|
||||
if (postLikedByUser) {
|
||||
|
||||
@@ -33,7 +33,7 @@ import static com.ai.da.common.enums.LayersPriorityEnum.BODY;
|
||||
public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPythonOutfitDetailMapper, TDesignPythonOutfitDetail> implements ITDesignPythonOutfitDetailService {
|
||||
|
||||
@Resource
|
||||
private MinioUtil minIoUtil;
|
||||
private MinioUtil minioUtil;
|
||||
|
||||
@Override
|
||||
public IPage<TDesignPythonOutfitDetailVO> selectTDesignPythonOutfitDetailPage(IPage<TDesignPythonOutfitDetailVO> page, TDesignPythonOutfitDetailVO tDesignPythonOutfitDetail) {
|
||||
@@ -57,9 +57,9 @@ public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPyt
|
||||
DesignPythonOutfitVO designPythonOutfitVO = CopyUtil.copyObject(detail, DesignPythonOutfitVO.class);
|
||||
designPythonOutfitVO.setPosition(StringUtil.isNullOrEmpty(detail.getPosition()) ? null : (List<Long>) JSON.parse(detail.getPosition()));
|
||||
designPythonOutfitVO.setImageSize(StringUtil.isNullOrEmpty(detail.getImageSize()) ? null : (List<Long>) JSON.parse(detail.getImageSize()));
|
||||
designPythonOutfitVO.setImageUrl(StringUtil.isNullOrEmpty(detail.getImageUrl()) ? null : minIoUtil.getPresignedUrl(detail.getImageUrl(), 24 * 60));
|
||||
designPythonOutfitVO.setImageUrl(StringUtil.isNullOrEmpty(detail.getImageUrl()) ? null : minioUtil.getPreSignedUrl(detail.getImageUrl(), 24 * 60));
|
||||
designPythonOutfitVO.setImageMinioUrl(StringUtil.isNullOrEmpty(detail.getImageUrl()) ? null : detail.getImageUrl());
|
||||
designPythonOutfitVO.setMaskUrl(StringUtil.isNullOrEmpty(detail.getMaskUrl()) ? null : minIoUtil.getPresignedUrl(detail.getMaskUrl(), 24 * 60));
|
||||
designPythonOutfitVO.setMaskUrl(StringUtil.isNullOrEmpty(detail.getMaskUrl()) ? null : minioUtil.getPreSignedUrl(detail.getMaskUrl(), 24 * 60));
|
||||
designPythonOutfitVO.setMaskMinioUrl(StringUtil.isNullOrEmpty(detail.getMaskUrl()) ? null : detail.getMaskUrl());
|
||||
// designPythonOutfitVO.setScale(Float.parseFloat(detail.getScale()));
|
||||
designPythonOutfitVO.setScale(modifyScale(detail.getScale()));
|
||||
|
||||
@@ -62,8 +62,8 @@ public class TaskListServiceImpl extends ServiceImpl<TaskListMapper, TaskList> i
|
||||
taskDTOS.add(new TaskDTO<>());
|
||||
} else {
|
||||
SuperResolutionDTO inputParam = taskDTO.getInputParam();
|
||||
inputParam.setImages(minioUtil.getPresignedUrl(inputParam.getImages(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
taskDTO.setOutputImage(StringUtil.isNullOrEmpty(taskDTO.getOutputImage()) ? null : minioUtil.getPresignedUrl(taskDTO.getOutputImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
inputParam.setImages(minioUtil.getPreSignedUrl(inputParam.getImages(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
taskDTO.setOutputImage(StringUtil.isNullOrEmpty(taskDTO.getOutputImage()) ? null : minioUtil.getPreSignedUrl(taskDTO.getOutputImage(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
taskDTOS.add(taskDTO);
|
||||
}
|
||||
});
|
||||
@@ -105,8 +105,8 @@ public class TaskListServiceImpl extends ServiceImpl<TaskListMapper, TaskList> i
|
||||
// 成功失败的都返回
|
||||
TaskVO task = new TaskVO();
|
||||
task.setImageName(s.getInputUrl().substring(s.getInputUrl().lastIndexOf("/") + 1));
|
||||
task.setInputImage(minioUtil.getPresignedUrl(s.getInputUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
task.setOutputImage(StringUtil.isNullOrEmpty(s.getOutputUrl()) ? null : minioUtil.getPresignedUrl(s.getOutputUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
task.setInputImage(minioUtil.getPreSignedUrl(s.getInputUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
task.setOutputImage(StringUtil.isNullOrEmpty(s.getOutputUrl()) ? null : minioUtil.getPreSignedUrl(s.getOutputUrl(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
task.setStatus(s.getStatus());
|
||||
task.setTaskId(s.getTaskId());
|
||||
task.setCreateDate(s.getCreateTime().format(dateTimeFormatter));
|
||||
|
||||
@@ -5,13 +5,9 @@ import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.constant.CommonConstant;
|
||||
import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.enums.CreditsEventsEnum;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.DateUtil;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.common.utils.RedisUtil;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.ExportSaveDTO;
|
||||
import com.ai.da.model.dto.ProductImageLikeDTO;
|
||||
import com.ai.da.model.dto.ToProductImageDTO;
|
||||
import com.ai.da.model.vo.*;
|
||||
@@ -144,7 +140,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
int index = o.getUrl().lastIndexOf("/");
|
||||
o.setPictureName(o.getUrl().substring(index + 1));
|
||||
}
|
||||
o.setDesignOutfitUrl(minioUtil.getPresignedUrl(o.getUrl(), 24 * 60));
|
||||
o.setDesignOutfitUrl(minioUtil.getPreSignedUrl(o.getUrl(), 24 * 60));
|
||||
QueryWrapper<TDesignPythonOutfit> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(TDesignPythonOutfit::getDesignItemId, o.getDesignItemId());
|
||||
List<TDesignPythonOutfit> tDesignPythonOutfits = designPythonOutfitMapper.selectList(qw);
|
||||
@@ -313,7 +309,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
toProductElement.setCreateTime(LocalDateTime.now());
|
||||
toProductElementMapper.insert(toProductElement);
|
||||
ToProductElementVO toProductElementVO = CopyUtil.copyObject(toProductElement, ToProductElementVO.class);
|
||||
toProductElementVO.setUrl(minioUtil.getPresignedUrl(toProductElementVO.getUrl(), 24 * 60));
|
||||
toProductElementVO.setUrl(minioUtil.getPreSignedUrl(toProductElementVO.getUrl(), 24 * 60));
|
||||
return toProductElementVO;
|
||||
}
|
||||
|
||||
@@ -345,7 +341,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
if (url.substring(url.lastIndexOf("/") + 1).equals("white_image.jpg")) {
|
||||
magicToolResultVO.setStatus("Invalid");
|
||||
} else {
|
||||
magicToolResultVO.setUrl(minioUtil.getPresignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
magicToolResultVO.setUrl(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
|
||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectOne(qw);
|
||||
@@ -354,10 +350,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}
|
||||
if (toProductImageResult.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResult.getElementId());
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPresignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
}else {
|
||||
UserLike userLike = userLikeMapper.selectById(toProductImageResult.getElementId());
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPresignedUrl(userLike.getUrl(), 24 * 60));
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(userLike.getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
} else if (Objects.isNull(magicToolResultVO)) {
|
||||
@@ -385,7 +381,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
String type = jsonObject1.getString("type");
|
||||
if (type.equals("image")) {
|
||||
String minioUrl = jsonObject1.getString("minioUrl");
|
||||
jsonObject1.put("src", minioUtil.getPresignedUrl(minioUrl, 24 * 60));
|
||||
jsonObject1.put("src", minioUtil.getPreSignedUrl(minioUrl, 24 * 60));
|
||||
}
|
||||
objects.set(i, jsonObject1);
|
||||
}
|
||||
@@ -406,7 +402,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
CanvasElementUpload canvasElementUpload = new CanvasElementUpload();
|
||||
String url = minioUtil.upload("aida-users", userHolder.getId() + "/canvasElementUpload", file);
|
||||
canvasElementUpload.setUrl(url);
|
||||
canvasElementUpload.setMinioUrl(minioUtil.getPresignedUrl(url, 24 * 60));
|
||||
canvasElementUpload.setMinioUrl(minioUtil.getPreSignedUrl(url, 24 * 60));
|
||||
return canvasElementUpload;
|
||||
}
|
||||
|
||||
@@ -417,7 +413,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
qw.lambda().eq(ToProductImageResult::getUserLikeGroupId, toProductImageDTO.getUserLikeGroupId());
|
||||
List<ToProductImageResult> toProductImageResults = toProductImageResultMapper.selectList(qw);
|
||||
for (ToProductImageResult toProductImageResult : toProductImageResults) {
|
||||
toProductImageResult.setUrl(minioUtil.getPresignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||
toProductImageResult.setUrl(minioUtil.getPreSignedUrl(toProductImageResult.getUrl(), 24 * 60));
|
||||
}
|
||||
return toProductImageResults;
|
||||
}
|
||||
@@ -505,7 +501,7 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
if (url.substring(url.lastIndexOf("/") + 1).equals("white_image.jpg")) {
|
||||
magicToolResultVO.setStatus("Invalid");
|
||||
} else {
|
||||
magicToolResultVO.setUrl(minioUtil.getPresignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
magicToolResultVO.setUrl(minioUtil.getPreSignedUrl(url, CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
QueryWrapper<ToProductImageResult> qw = new QueryWrapper<>();
|
||||
qw.lambda().eq(ToProductImageResult::getTaskId, taskId);
|
||||
ToProductImageResult toProductImageResult = toProductImageResultMapper.selectOne(qw);
|
||||
@@ -514,10 +510,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
}
|
||||
if (toProductImageResult.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResult.getElementId());
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPresignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
}else {
|
||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResult.getElementId());
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPresignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
} else if (Objects.isNull(magicToolResultVO)) {
|
||||
|
||||
@@ -5,10 +5,7 @@ import com.ai.da.common.context.UserContext;
|
||||
import com.ai.da.common.enums.LibraryLevel1TypeEnum;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.response.ResultEnum;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.FileUtil;
|
||||
import com.ai.da.common.utils.MD5Utils;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.primary.*;
|
||||
import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.WorkspaceDTO;
|
||||
@@ -31,7 +28,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.naming.Context;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.util.*;
|
||||
@@ -207,16 +203,16 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
WorkspaceVO workspaceVO = CopyUtil.copyObject(o, WorkspaceVO.class);
|
||||
if (o.getMannequinFemaleId() != null) {
|
||||
if (o.getMannequinFemaleType().equals(ModelType.SYSTEM.getValue())) {
|
||||
workspaceVO.setFemalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(o.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
workspaceVO.setFemalePresignedUrl(minioUtil.getPreSignedUrl(sysFileMapper.selectById(o.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
} else if (o.getMannequinFemaleType().equals(ModelType.LIBRARY.getValue())) {
|
||||
workspaceVO.setFemalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(o.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
workspaceVO.setFemalePresignedUrl(minioUtil.getPreSignedUrl(libraryMapper.selectById(o.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
if (o.getMannequinMaleId() != null) {
|
||||
if (o.getMannequinMaleType().equals(ModelType.SYSTEM.getValue())) {
|
||||
workspaceVO.setMalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(o.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
workspaceVO.setMalePresignedUrl(minioUtil.getPreSignedUrl(sysFileMapper.selectById(o.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
} else if (o.getMannequinMaleType().equals(ModelType.LIBRARY.getValue())) {
|
||||
workspaceVO.setMalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(o.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
workspaceVO.setMalePresignedUrl(minioUtil.getPreSignedUrl(libraryMapper.selectById(o.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
Sex sex = Sex.getSex(workspaceVO.getSex());
|
||||
@@ -235,16 +231,16 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
WorkspaceVO workspaceVO = CopyUtil.copyObject(o, WorkspaceVO.class);
|
||||
if (o.getMannequinFemaleId() != null) {
|
||||
if (o.getMannequinFemaleType().equals(ModelType.SYSTEM.getValue())) {
|
||||
workspaceVO.setFemalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(o.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
workspaceVO.setFemalePresignedUrl(minioUtil.getPreSignedUrl(sysFileMapper.selectById(o.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
} else if (o.getMannequinFemaleType().equals(ModelType.LIBRARY.getValue())) {
|
||||
workspaceVO.setFemalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(o.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
workspaceVO.setFemalePresignedUrl(minioUtil.getPreSignedUrl(libraryMapper.selectById(o.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
if (o.getMannequinMaleId() != null) {
|
||||
if (o.getMannequinMaleType().equals(ModelType.SYSTEM.getValue())) {
|
||||
workspaceVO.setMalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(o.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
workspaceVO.setMalePresignedUrl(minioUtil.getPreSignedUrl(sysFileMapper.selectById(o.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
} else if (o.getMannequinMaleType().equals(ModelType.LIBRARY.getValue())) {
|
||||
workspaceVO.setMalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(o.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
workspaceVO.setMalePresignedUrl(minioUtil.getPreSignedUrl(libraryMapper.selectById(o.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
Sex sex = Sex.getSex(workspaceVO.getSex());
|
||||
@@ -295,16 +291,16 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
WorkspaceVO vo = CopyUtil.copyObject(newIsLastIndex, WorkspaceVO.class);
|
||||
if (vo.getMannequinFemaleId() != null) {
|
||||
if (vo.getMannequinFemaleType().equals(ModelType.SYSTEM.getValue())) {
|
||||
vo.setFemalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
vo.setFemalePresignedUrl(minioUtil.getPreSignedUrl(sysFileMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
} else if (vo.getMannequinFemaleType().equals(ModelType.LIBRARY.getValue())) {
|
||||
vo.setFemalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
vo.setFemalePresignedUrl(minioUtil.getPreSignedUrl(libraryMapper.selectById(vo.getMannequinFemaleId()).getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
if (vo.getMannequinMaleId() != null) {
|
||||
if (vo.getMannequinMaleType().equals(ModelType.SYSTEM.getValue())) {
|
||||
vo.setMalePresignedUrl(minioUtil.getPresignedUrl(sysFileMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
vo.setMalePresignedUrl(minioUtil.getPreSignedUrl(sysFileMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
} else if (vo.getMannequinMaleType().equals(ModelType.LIBRARY.getValue())) {
|
||||
vo.setMalePresignedUrl(minioUtil.getPresignedUrl(libraryMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
vo.setMalePresignedUrl(minioUtil.getPreSignedUrl(libraryMapper.selectById(vo.getMannequinMaleId()).getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
Sex sex = Sex.getSex(vo.getSex());
|
||||
@@ -346,7 +342,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
ModelVO modelVO = new ModelVO();
|
||||
modelVO.setId(library.getId());
|
||||
modelVO.setUrl(library.getUrl());
|
||||
modelVO.setPresignedUrl(minioUtil.getPresignedUrl(library.getUrl(), 24 * 60));
|
||||
modelVO.setPresignedUrl(minioUtil.getPreSignedUrl(library.getUrl(), 24 * 60));
|
||||
modelVOList.add(modelVO);
|
||||
}
|
||||
ModelsVO vo = new ModelsVO();
|
||||
@@ -371,7 +367,7 @@ public class WorkspaceServiceImpl extends ServiceImpl<WorkspaceMapper, Workspace
|
||||
ModelVO modelVO = new ModelVO();
|
||||
modelVO.setId(sysFile.getId());
|
||||
modelVO.setUrl(sysFile.getUrl());
|
||||
modelVO.setPresignedUrl(minioUtil.getPresignedUrl(sysFile.getUrl(), 24 * 60));
|
||||
modelVO.setPresignedUrl(minioUtil.getPreSignedUrl(sysFile.getUrl(), 24 * 60));
|
||||
modelVOList.add(modelVO);
|
||||
}
|
||||
ModelsVO vo = new ModelsVO();
|
||||
|
||||
Reference in New Issue
Block a user