Merge remote-tracking branch 'origin/develop' into develop
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import com.ai.da.common.config.exception.BusinessException;
|
||||
import com.ai.da.common.enums.LayersPriorityEnum;
|
||||
import com.ai.da.mapper.DesignItemDetailMapper;
|
||||
import com.ai.da.mapper.entity.DesignItemDetail;
|
||||
import com.ai.da.service.DesignItemDetailService;
|
||||
@@ -13,6 +14,8 @@ import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static com.ai.da.common.enums.LayersPriorityEnum.BODY;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
*
|
||||
@@ -76,4 +79,21 @@ public class DesignItemDetailServiceImpl extends ServiceImpl<DesignItemDetailMap
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 旧系统不允许添加多件衣服,衣服图层没有优先级,
|
||||
* 升级为可以添加多件衣服后,衣服图层必须要有优先级,故出现不兼容的情况
|
||||
* 在这里为没有优先级的衣服添加默认优先级
|
||||
* @param designItemDetailList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void setDesignItemDetailPriority(List<DesignItemDetail> designItemDetailList){
|
||||
for (DesignItemDetail detail:designItemDetailList){
|
||||
if (!detail.getType().equals(BODY.getType()) && detail.getPriority().equals(BODY.getValue())){
|
||||
detail.setPriority(LayersPriorityEnum.getValueByType(detail.getType()).getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -667,4 +667,12 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
||||
});
|
||||
return composeLayerPythonItem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DesignItem> selectDesignIdById(List<Long> designItemIdList){
|
||||
QueryWrapper<DesignItem> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
queryWrapper.in("id",designItemIdList);
|
||||
return designItemMapper.selectList(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,7 @@ 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.context.UserContext;
|
||||
import com.ai.da.common.enums.CollectionLevel1TypeEnum;
|
||||
import com.ai.da.common.enums.DesignTypeEnum;
|
||||
import com.ai.da.common.enums.SingleOverallEnum;
|
||||
import com.ai.da.common.enums.SysFileLevel2TypeEnum;
|
||||
import com.ai.da.common.enums.*;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.DesignMapper;
|
||||
import com.ai.da.mapper.GenerateDetailMapper;
|
||||
@@ -46,6 +43,7 @@ import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ai.da.common.enums.LayersPriorityEnum.BODY;
|
||||
import static com.ai.da.python.vo.DesignPythonItem.*;
|
||||
|
||||
/**
|
||||
@@ -956,6 +954,9 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
flag = Boolean.TRUE;
|
||||
}
|
||||
|
||||
// 为没有优先级的衣服添加优先级
|
||||
designItemDetailService.setDesignItemDetailPriority(designItemDetails);
|
||||
|
||||
// 2、组装返回参数
|
||||
DesignItemDetailVO response = new DesignItemDetailVO();
|
||||
response.setSingleOverall(design.getSingleOverall());
|
||||
@@ -1131,6 +1132,10 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
log.error("Layer information is empty! DesignPythonOutfitId is " + designPythonOutfit.getId());
|
||||
throw new BusinessException("layer.information.not.found");
|
||||
}
|
||||
|
||||
// 为没有优先级的图层添加优先级
|
||||
designPythonOutfitDetailService.setDesignPythonOutfitDetailPriority(details);
|
||||
|
||||
details.forEach(detail -> {
|
||||
// List<Long> offset = new ArrayList<>();
|
||||
// if (StringUtil.isNullOrEmpty(detail.getOffset()) || detail.getOffset().equals("null")) {
|
||||
@@ -1205,4 +1210,41 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
||||
return designSinglePrintDTO;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getModel(List<Long> designItemIdList){
|
||||
ArrayList<String> models = new ArrayList<>();
|
||||
List<DesignItem> designIdById = designItemService.selectDesignIdById(designItemIdList);
|
||||
if (CollectionUtil.isEmpty(designIdById)){
|
||||
log.info("according to the designItemIdList cannot find the designIdList");
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
List<Long> designIdList = designIdById.stream().map(DesignItem::getDesignId).collect(Collectors.toList());
|
||||
List<Design> designs = selectList(designIdList);
|
||||
if (CollectionUtil.isEmpty(designIdList)){
|
||||
log.info("according to the designIdList cannot find the design");
|
||||
throw new BusinessException("design.not.found");
|
||||
}
|
||||
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))
|
||||
.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))
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
private List<Design> selectList(List<Long> designIdList){
|
||||
QueryWrapper<Design> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("id",designIdList);
|
||||
|
||||
return designMapper.selectList(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -260,4 +260,11 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> impl
|
||||
queryWrapper.in("url", urlList);
|
||||
return CopyUtil.copyList(sysFileMapper.selectList(queryWrapper), SysFileVO.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysFile> getByIds(List<Long> ids) {
|
||||
QueryWrapper<SysFile> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.in("id", ids);
|
||||
return sysFileMapper.selectList(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.ai.da.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ai.da.common.enums.LayersPriorityEnum;
|
||||
import com.ai.da.common.utils.CopyUtil;
|
||||
import com.ai.da.common.utils.MinioUtil;
|
||||
import com.ai.da.mapper.TDesignPythonOutfitDetailMapper;
|
||||
@@ -21,6 +22,8 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.ai.da.common.enums.LayersPriorityEnum.BODY;
|
||||
|
||||
/**
|
||||
* design item详情表 服务实现类
|
||||
*
|
||||
@@ -88,4 +91,14 @@ public class TDesignPythonOutfitDetailServiceImpl extends ServiceImpl<TDesignPyt
|
||||
baseMapper.update(null, updateWrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setDesignPythonOutfitDetailPriority(List<TDesignPythonOutfitDetail> details){
|
||||
for (TDesignPythonOutfitDetail detail:details){
|
||||
if (!detail.getImageCategory().equals(BODY.getRealName()) && detail.getPriority().equals(BODY.getValue())){
|
||||
detail.setPriority(LayersPriorityEnum.getValueByLayerCategory(detail.getImageCategory()).getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user