fix:进行design后library中可能会生成同样的图片
fix:ageGroup在designSingle时不会被存入数据库导致收藏页面不能显示完整
This commit is contained in:
@@ -124,4 +124,6 @@ public interface DesignService extends IService<Design> {
|
|||||||
Boolean cloudTaskNameUpdate(CloudTaskDTO cloudTaskDTO);
|
Boolean cloudTaskNameUpdate(CloudTaskDTO cloudTaskDTO);
|
||||||
|
|
||||||
Boolean cloudTaskDelete(CloudTaskDTO cloudTaskDTO);
|
Boolean cloudTaskDelete(CloudTaskDTO cloudTaskDTO);
|
||||||
|
|
||||||
|
String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -358,6 +358,16 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
|||||||
if (CollectionUtils.isEmpty(elements)) {
|
if (CollectionUtils.isEmpty(elements)) {
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
// 根据MD5去重:保留第一个出现的元素,其余重复MD5的丢弃
|
||||||
|
elements = elements.stream()
|
||||||
|
.collect(Collectors.collectingAndThen(
|
||||||
|
Collectors.toMap(
|
||||||
|
CollectionElement::getMd5,
|
||||||
|
e -> e,
|
||||||
|
(e1, e2) -> e1 // 冲突时保留第一个
|
||||||
|
),
|
||||||
|
map -> new ArrayList<>(map.values())
|
||||||
|
));
|
||||||
//获取已存在相同的library
|
//获取已存在相同的library
|
||||||
List<String> md5List = elements.stream().map(CollectionElement::getMd5).collect(Collectors.toList());
|
List<String> md5List = elements.stream().map(CollectionElement::getMd5).collect(Collectors.toList());
|
||||||
List<Library> existsLibrarys = libraryService.getByMD5List(md5List);
|
List<Library> existsLibrarys = libraryService.getByMD5List(md5List);
|
||||||
|
|||||||
@@ -1032,6 +1032,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
|
|||||||
library.setLevel1Type(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
|
library.setLevel1Type(CollectionLevel1TypeEnum.SKETCH_BOARD.getRealName());
|
||||||
library.setLevel2Type(designSingleItem.getType());
|
library.setLevel2Type(designSingleItem.getType());
|
||||||
library.setLevel3Type(designSingleIncludeLayersDTO.getGender());
|
library.setLevel3Type(designSingleIncludeLayersDTO.getGender());
|
||||||
|
String ageGroup = designService.getAgeGroupByProjectOrCollectionId(designSingleIncludeLayersDTO.getProjectId(), null);
|
||||||
|
library.setAgeGroup(ageGroup);
|
||||||
library.setUrl(designSingleItem.getPath());
|
library.setUrl(designSingleItem.getPath());
|
||||||
library.setName(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
library.setName(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")));
|
||||||
library.setMd5(md5);
|
library.setMd5(md5);
|
||||||
|
|||||||
@@ -419,7 +419,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
|
|||||||
return requestId;
|
return requestId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId){
|
public String getAgeGroupByProjectOrCollectionId(Long projectId, Long collectionId){
|
||||||
if (Objects.nonNull(projectId)){
|
if (Objects.nonNull(projectId)){
|
||||||
Workspace workspace = workspaceService.getWSByProjectId(projectId);
|
Workspace workspace = workspaceService.getWSByProjectId(projectId);
|
||||||
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){
|
if (workspace != null && !StringUtil.isNullOrEmpty(workspace.getAgeGroup())){
|
||||||
|
|||||||
@@ -789,7 +789,12 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
|||||||
} else {
|
} else {
|
||||||
library.setLevel3Type(uploadDTO.getModelSex());
|
library.setLevel3Type(uploadDTO.getModelSex());
|
||||||
}
|
}
|
||||||
library.setAgeGroup(uploadDTO.getAgeGroup());
|
if (uploadDTO.getLevel1Type().equals(LibraryLevel1TypeEnum.SKETCH_BOARD.getRealName())&&StringUtils.isEmpty(uploadDTO.getAgeGroup())) {
|
||||||
|
log.error("前端未传ageGroup");
|
||||||
|
library.setAgeGroup("Adult");
|
||||||
|
} else {
|
||||||
|
library.setAgeGroup(uploadDTO.getAgeGroup());
|
||||||
|
}
|
||||||
libraryMapper.insert(library);
|
libraryMapper.insert(library);
|
||||||
return library;
|
return library;
|
||||||
} else if (uploadDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
} else if (uploadDTO.getModelType().equals(ModelType.SYSTEM.getValue())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user