Merge remote-tracking branch 'origin/dev/dev' into dev/dev
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -24,7 +24,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;
|
||||
@@ -36,8 +35,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;
|
||||
@@ -106,7 +103,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;
|
||||
}
|
||||
@@ -247,7 +244,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);
|
||||
}
|
||||
|
||||
@@ -340,9 +337,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));
|
||||
@@ -888,9 +888,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.*;
|
||||
@@ -264,7 +261,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// todo check这个方法是否还在用
|
||||
private DesignCollectionItemVO saveSingleDesignItemAndDetail(DesignPythonObjects pythonObjects
|
||||
, Long designId, Long designItemId, Long collectionId, AuthPrincipalVo userInfo, String timeZone) {
|
||||
DesignCollectionItemVO response = new DesignCollectionItemVO();
|
||||
@@ -298,7 +295,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemDetail.setBusinessId(0L);
|
||||
}
|
||||
designItemDetail.setIconPath(detail.getIcon());
|
||||
DesignPythonItemPrint printObject = detail.getPrint();
|
||||
// todo
|
||||
DesignPythonItemPrint printObject = detail.getPrint().getSingle();
|
||||
designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
designItemDetail.setPrintJson(JSON.toJSONString(printObject));
|
||||
designItemDetails.add(designItemDetail);
|
||||
@@ -315,7 +313,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
|
||||
private List<TDesignPythonOutfitDetail> saveDesignSingleItemDetailAndLayers(DesignPythonObjects pythonObjects
|
||||
, Long designId, Long designItemId, Long userId
|
||||
, JSONObject outfit, String timeZone, List<DesignSingleItemDTO> designSingleItemDTOList) {
|
||||
, JSONObject outfit, String timeZone, List<DesignSingleItemDTO> designSingleItemDTOList
|
||||
, Map<String, String> categoryAndUndividedLayer) {
|
||||
|
||||
DesignItem designItem = new DesignItem();
|
||||
// String url = pythonObjects.getObjects().get(0).getBasic().getSave_name();
|
||||
@@ -346,8 +345,10 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemDetail.setPriority(0);
|
||||
}
|
||||
designItemDetail.setIconPath(detail.getIcon());
|
||||
DesignPythonItemPrint printObject = detail.getPrint();
|
||||
designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
designItemDetail.setUndividedLayer(categoryAndUndividedLayer.get(detail.getType().toLowerCase()));
|
||||
// 印花存储在design_item_detail_print表中 这里还要存吗?
|
||||
// DesignPythonItemPrint printObject = detail.getPrintToPython();
|
||||
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
// 当有多个印花后,返回的printObject太长,导致存储到数据库时报错
|
||||
// designItemDetail.setPrintJson(JSON.toJSONString(printObject));
|
||||
designItemDetails.add(designItemDetail);
|
||||
@@ -509,14 +510,17 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
throw new BusinessException("priority.cannot.be.repeated");
|
||||
}
|
||||
|
||||
JSONArray layers = outfit.getJSONArray("layers");
|
||||
Map<String, String> categoryAndUndividedLayer = setTypeAndUndividedLayer(layers);
|
||||
if (!designSingleIncludeLayersDTO.getIsPreview()) {
|
||||
// 更新及保存图层信息
|
||||
tDesignPythonOutfitDetails = saveDesignSingleItemDetailAndLayers(objects, design.getId(), designSingleIncludeLayersDTO.getDesignItemId(),
|
||||
userId, outfit, designSingleIncludeLayersDTO.getTimeZone(), designSingleIncludeLayersDTO.getDesignSingleItemDTOList());
|
||||
tDesignPythonOutfitDetails = saveDesignSingleItemDetailAndLayers(objects, design.getId(), designSingleIncludeLayersDTO.getDesignItemId()
|
||||
, userId, outfit, designSingleIncludeLayersDTO.getTimeZone()
|
||||
, designSingleIncludeLayersDTO.getDesignSingleItemDTOList()
|
||||
, categoryAndUndividedLayer);
|
||||
|
||||
saveCollectionElement(designSingleIncludeLayersDTO);
|
||||
} else {
|
||||
JSONArray layers = outfit.getJSONArray("layers");
|
||||
tDesignPythonOutfitDetails = setTDesignPythonOutfitDetailList(layers, designItem.getDesignId(), null, userId, priorityOffset);
|
||||
}
|
||||
|
||||
@@ -536,11 +540,12 @@ 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,
|
||||
design.getSingleOverall());
|
||||
design.getSingleOverall(),
|
||||
categoryAndUndividedLayer);
|
||||
}
|
||||
|
||||
private void sketchBase64ToPath(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO){
|
||||
@@ -563,6 +568,16 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
});
|
||||
}
|
||||
|
||||
private Map<String, String> setTypeAndUndividedLayer(JSONArray layers){
|
||||
HashMap<String, String> categoryAndLayer = new HashMap<>();
|
||||
for (int i = 0; i < layers.size(); i++) {
|
||||
JSONObject jsonObject = layers.getJSONObject(i);
|
||||
String category = jsonObject.getString("image_category").split("_")[0];
|
||||
if (!category.equals("body") && !categoryAndLayer.containsKey(category)) categoryAndLayer.put(category, jsonObject.getString("pattern_image_url"));
|
||||
}
|
||||
return categoryAndLayer;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ComposeLayersVO editLayersPositionAndScale(EditLayersPositionAndScaleVO positionAndScaleVO) throws IOException {
|
||||
@@ -591,7 +606,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 +642,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));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -653,7 +668,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
String currentFullBodyView,
|
||||
List<DesignSingleItemDTO> designSingleItemDTOList,
|
||||
List<DesignPythonOutfitVO> layersObject,
|
||||
String singleOrOverall) {
|
||||
String singleOrOverall,
|
||||
Map<String, String> categoryAndUndividedLayer) {
|
||||
|
||||
DesignSingleVO designSingleVO = new DesignSingleVO();
|
||||
ArrayList<DesignItemClothesDetailVO> clothes = new ArrayList<>();
|
||||
@@ -662,7 +678,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 +693,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());
|
||||
@@ -687,6 +703,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
&& (flag ? Boolean.TRUE : singleItem.getPriority().equals(layers.getPriority())))
|
||||
).collect(Collectors.toList()));
|
||||
designItemClothesDetailVO.setGradient(singleItem.getGradient());
|
||||
if (categoryAndUndividedLayer.containsKey(singleItem.getType().toLowerCase())) designItemClothesDetailVO.setUndividedLayer(minioUtil.getPreSignedUrl(categoryAndUndividedLayer.get(singleItem.getType().toLowerCase()), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
body.setLayersObject(layersObject.stream().filter(layers -> layers.getImageCategory().equals("body")).collect(Collectors.toList()));
|
||||
|
||||
clothes.add(designItemClothesDetailVO);
|
||||
@@ -718,20 +735,16 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
String printType,
|
||||
Map<Integer, Long> designItemDetailTypeIdMap,
|
||||
String timeZone){
|
||||
|
||||
// todo 这边这样做对吗
|
||||
DesignSinglePrintDTO printObject;
|
||||
if (printType.equals("print")){
|
||||
printObject = designSingleItem.getPrintObject();
|
||||
}else {
|
||||
printObject = designSingleItem.getTrims();
|
||||
if (Objects.isNull(printObject.getIfSingle())){
|
||||
printObject.setIfSingle(Boolean.FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
if (printObject.getIfSingle().equals(Boolean.FALSE)
|
||||
&& CollectionUtil.isEmpty(printObject.getPrints())) {
|
||||
return;
|
||||
} else {
|
||||
if (!CollectionUtil.isEmpty(printObject.getPrints())) {
|
||||
// 2、有印花,添加到list
|
||||
printObject.getPrints().forEach(print -> {
|
||||
// 2.1 判断是否第一次添加印花,是:直接添加
|
||||
@@ -746,7 +759,7 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
designItemDetailPrint.setLevel2Type(print.getLevel2Type());
|
||||
designItemDetailPrint.setPath(print.getMinIOPath());
|
||||
designItemDetailPrint.setScale(print.getScale());
|
||||
designItemDetailPrint.setSingleOrOverall(printType.equals("print") ? printObject.getIfSingle() ? "single" : "overall" : "single");
|
||||
designItemDetailPrint.setSingleOrOverall(printType.equals("print") ? print.getIfSingle() ? "single" : "overall" : "single");
|
||||
designItemDetailPrint.setCreateDate(LocalDateTime.now(ZoneId.of(timeZone)));
|
||||
// single、overall模式下都有position、angle和priority
|
||||
designItemDetailPrint.setPosition(print.getLocation().toString());
|
||||
@@ -785,7 +798,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 +827,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
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
||||
import com.ai.da.common.config.FileProperties;
|
||||
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.*;
|
||||
import com.ai.da.common.utils.*;
|
||||
@@ -382,9 +383,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 +394,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 +412,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 +598,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);
|
||||
@@ -623,10 +624,13 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
}
|
||||
designItemDetail.setIconPath(detail.getIcon());
|
||||
designItemDetail.setPriority(typePriority.get(detail.getType().toLowerCase()));
|
||||
DesignPythonItemPrint printObject = detail.getPrint();
|
||||
designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
if (!detail.getType().equals("Body")){
|
||||
DesignPythonItemPrint printObject = detail.getPrint().getOverall();
|
||||
// designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
designItemDetail.setPrintPath(CollectionUtils.isEmpty(printObject.getPrint_path_list()) ? "" : printObject.getPrint_path_list().get(0));
|
||||
}
|
||||
designItemDetailService.save(designItemDetail);
|
||||
if (!SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType()) && designItemDetail.getPrintPath() != null) {
|
||||
if (!SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType()) && !StringUtil.isNullOrEmpty(designItemDetail.getPrintPath())) {
|
||||
DesignItemDetailPrint print = new DesignItemDetailPrint();
|
||||
print.setDesignItemDetailId(designItemDetail.getId());
|
||||
print.setPrintType("print");
|
||||
@@ -686,7 +690,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
designItemDetail.setBusinessId(0L);
|
||||
}
|
||||
designItemDetail.setIconPath(detail.getIcon());
|
||||
DesignPythonItemPrint printObject = detail.getPrint();
|
||||
DesignPythonItemPrint printObject = detail.getPrint().getOverall();
|
||||
designItemDetail.setPrintPath(Objects.isNull(printObject) ? "" : printObject.getPath());
|
||||
designItemDetails.add(designItemDetail);
|
||||
});
|
||||
@@ -997,10 +1001,11 @@ 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, true));
|
||||
d.setPath(minioUtil.getPreSignedUrl(o.getPath(), 24 * 60, true));
|
||||
d.setMinIOPath(o.getPath());
|
||||
d.setLevel1Type(converTypeToLevel1(o.getType()));
|
||||
d.setGradient(JSONObject.parseObject(o.getGradientString(), Gradient.class));
|
||||
if (!StringUtil.isNullOrEmpty(o.getUndividedLayer())) d.setUndividedLayer(minioUtil.getPreSignedUrl(o.getUndividedLayer(), CommonConstant.MINIO_IMAGE_EXPIRE_TIME));
|
||||
// 根据designItemDetailId获取印花
|
||||
List<DesignItemDetailPrint> prints = designItemDetailPrintService.getByDesignItemDetailId(o.getId(), "print");
|
||||
// 判断有无印花
|
||||
@@ -1025,12 +1030,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 +1174,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();
|
||||
@@ -1204,29 +1209,31 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
if (designItemDetailPrints.size() == 1) {
|
||||
DesignItemDetailPrint detailPrint = designItemDetailPrints.get(0);
|
||||
DesignSinglePrint designSinglePrint = new DesignSinglePrint();
|
||||
designSinglePrintDTO.setIfSingle(detailPrint.getSingleOrOverall().equals("single") ? Boolean.TRUE : Boolean.FALSE);
|
||||
// designSinglePrintDTO.setIfSingle(detailPrint.getSingleOrOverall().equals("single") ? Boolean.TRUE : Boolean.FALSE);
|
||||
designSinglePrint.setLevel2Type(detailPrint.getLevel2Type());
|
||||
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());
|
||||
designSinglePrint.setIfSingle(detailPrint.getSingleOrOverall().equals("single") ? Boolean.TRUE : Boolean.FALSE);
|
||||
prints.add(designSinglePrint);
|
||||
} else {
|
||||
// single模式下多个印花
|
||||
designSinglePrintDTO.setIfSingle(Boolean.TRUE);
|
||||
// designSinglePrintDTO.setIfSingle(Boolean.TRUE);
|
||||
designItemDetailPrints.forEach(print -> {
|
||||
if (print.getSingleOrOverall().equals("single")) {
|
||||
prints.add(new DesignSinglePrint(
|
||||
print.getLevel2Type(),
|
||||
minioUtil.getPresignedUrl(print.getPath(), 24 * 60),
|
||||
print.getPath(),
|
||||
JSONArray.parseArray(print.getPosition(), Double.class),
|
||||
print.getScale(),
|
||||
print.getAngle(),
|
||||
print.getPriority()));
|
||||
}
|
||||
// if (print.getSingleOrOverall().equals("single")) {
|
||||
prints.add(new DesignSinglePrint(
|
||||
print.getLevel2Type(),
|
||||
minioUtil.getPreSignedUrl(print.getPath(), 24 * 60),
|
||||
print.getPath(),
|
||||
JSONArray.parseArray(print.getPosition(), Double.class),
|
||||
print.getScale(),
|
||||
print.getAngle(),
|
||||
print.getPriority(),
|
||||
print.getSingleOrOverall().equals("single") ? Boolean.TRUE : Boolean.FALSE));
|
||||
// }
|
||||
});
|
||||
}
|
||||
designSinglePrintDTO.setPrints(prints);
|
||||
@@ -1250,13 +1257,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())) {
|
||||
@@ -285,7 +282,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 {
|
||||
@@ -300,7 +297,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;
|
||||
@@ -35,7 +34,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 {
|
||||
@@ -438,7 +436,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()));
|
||||
Long accountId = vo.getAccountId();
|
||||
@@ -465,19 +463,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()));
|
||||
if (userHolder == null) {
|
||||
vo.setIsLike(0);
|
||||
|
||||
@@ -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,10 +5,7 @@ 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.ProductImageLikeDTO;
|
||||
@@ -143,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);
|
||||
@@ -322,7 +319,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;
|
||||
}
|
||||
|
||||
@@ -354,7 +351,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);
|
||||
@@ -366,10 +363,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
magicToolResultVO.setElementType(toProductImageResult.getElementType());
|
||||
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 {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResult.getElementId());
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPresignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
magicToolResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
} else if (Objects.isNull(magicToolResultVO)) {
|
||||
@@ -397,7 +394,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);
|
||||
}
|
||||
@@ -418,7 +415,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;
|
||||
}
|
||||
|
||||
@@ -429,19 +426,19 @@ 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));
|
||||
}
|
||||
List<ToProductImageResultVO> toProductImageResultVOS = CopyUtil.copyList(toProductImageResults, ToProductImageResultVO.class);
|
||||
for (ToProductImageResultVO toProductImageResultVO : toProductImageResultVOS) {
|
||||
if (toProductImageResultVO.getElementType().equals("ProductElement")) {
|
||||
ToProductElement toProductElement = toProductElementMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPresignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductElement.getUrl(), 24 * 60));
|
||||
}else if ((toProductImageResultVO.getElementType().equals("DesignOutfit"))) {
|
||||
TDesignPythonOutfit tDesignPythonOutfit = designPythonOutfitMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPresignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(tDesignPythonOutfit.getDesignUrl(), 24 * 60));
|
||||
}else {
|
||||
ToProductImageResult toProductImageResult1 = toProductImageResultMapper.selectById(toProductImageResultVO.getElementId());
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPresignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
||||
toProductImageResultVO.setSourceUrl(minioUtil.getPreSignedUrl(toProductImageResult1.getUrl(), 24 * 60));
|
||||
}
|
||||
}
|
||||
return toProductImageResultVOS;
|
||||
@@ -552,7 +549,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);
|
||||
@@ -564,10 +561,10 @@ public class UserLikeGroupServiceImpl extends ServiceImpl<UserLikeGroupMapper, U
|
||||
magicToolResultVO.setElementType(toProductImageResult.getElementType());
|
||||
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