BUGFIX: design generate处理;
This commit is contained in:
@@ -8,6 +8,7 @@ import com.ai.da.common.enums.*;
|
||||
import com.ai.da.common.response.PageBaseResponse;
|
||||
import com.ai.da.common.utils.*;
|
||||
import com.ai.da.mapper.CollectionElementMapper;
|
||||
import com.ai.da.mapper.GenerateDetailMapper;
|
||||
import com.ai.da.mapper.entity.*;
|
||||
import com.ai.da.mapper.entity.Collection;
|
||||
import com.ai.da.model.dto.*;
|
||||
@@ -66,8 +67,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
private LibraryService libraryService;
|
||||
@Resource
|
||||
private SysFileService sysFileService;
|
||||
|
||||
@Resource
|
||||
private GenerateService generateService;
|
||||
private GenerateDetailMapper generateDetailMapper;
|
||||
@Resource
|
||||
private LibraryModelPointService libraryModelPointService;
|
||||
@Resource
|
||||
@@ -346,9 +348,9 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
.map(DesignCollectionElementDTO::getId)
|
||||
.collect((Collectors.toList()));
|
||||
if (CollectionUtil.isNotEmpty(generateIds)) {
|
||||
List<Generate> generateList = generateService.listByIds(generateIds);
|
||||
if (CollectionUtil.isNotEmpty(generateList)) {
|
||||
generateCollectionElements.addAll(covertGeneratesToCollections(generateList, null));
|
||||
List<GenerateDetail> generateDetailList = generateDetailMapper.selectBatchIds(generateIds);
|
||||
if (CollectionUtil.isNotEmpty(generateDetailList)) {
|
||||
generateCollectionElements.addAll(covertGeneratesToCollections(generateDetailList, null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -389,12 +391,12 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
.map(DesignCollectionPrintElementDTO::getId)
|
||||
.collect((Collectors.toList()));
|
||||
if (CollectionUtil.isNotEmpty(generateIds)) {
|
||||
List<Generate> generateList = generateService.listByIds(generateIds);
|
||||
if (CollectionUtil.isNotEmpty(generateList)) {
|
||||
List<GenerateDetail> generateDetailList = generateDetailMapper.selectBatchIds(generateIds);
|
||||
if (CollectionUtil.isNotEmpty(generateDetailList)) {
|
||||
Map<Long, DesignCollectionPrintElementDTO> idToMap = designDTO.getPrintBoards()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(DesignCollectionPrintElementDTO::getId, v -> v));
|
||||
generateCollectionElements.addAll(covertGeneratesToPrintCollections(generateList, idToMap));
|
||||
generateCollectionElements.addAll(covertGeneratesToPrintCollections(generateDetailList, idToMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -466,12 +468,12 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
.map(CollectionSketchDTO::getSketchBoardId)
|
||||
.collect((Collectors.toList()));
|
||||
if (CollectionUtil.isNotEmpty(generateIds)) {
|
||||
List<Generate> generateList = generateService.listByIds(generateIds);
|
||||
if (CollectionUtil.isNotEmpty(generateList)) {
|
||||
List<GenerateDetail> generateDetailList = generateDetailMapper.selectBatchIds(generateIds);
|
||||
if (CollectionUtil.isNotEmpty(generateDetailList)) {
|
||||
Map<Long, CollectionSketchDTO> idToMap = designDTO.getSketchBoards()
|
||||
.stream()
|
||||
.collect(Collectors.toMap(CollectionSketchDTO::getSketchBoardId, v -> v));
|
||||
generateCollectionElements.addAll(covertGeneratesToCollections(generateList, idToMap));
|
||||
generateCollectionElements.addAll(covertGeneratesToCollections(generateDetailList, idToMap));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -580,8 +582,8 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
});
|
||||
}
|
||||
|
||||
private List<CollectionElement> covertGeneratesToCollections(List<Generate> generates, Map<Long, CollectionSketchDTO> idToMap) {
|
||||
return CopyUtil.copyList(generates, CollectionElement.class, (o, d) -> {
|
||||
private List<CollectionElement> covertGeneratesToCollections(List<GenerateDetail> generateDetailList, Map<Long, CollectionSketchDTO> idToMap) {
|
||||
return CopyUtil.copyList(generateDetailList, CollectionElement.class, (o, d) -> {
|
||||
if (null != idToMap) {
|
||||
CollectionSketchDTO sketchDTO = idToMap.get(o.getId());
|
||||
d.setLevel2Type(sketchDTO.getLevel2Type());
|
||||
@@ -599,8 +601,8 @@ public class CollectionElementServiceImpl extends ServiceImpl<CollectionElementM
|
||||
});
|
||||
}
|
||||
|
||||
private List<CollectionElement> covertGeneratesToPrintCollections(List<Generate> generates, Map<Long, DesignCollectionPrintElementDTO> idToMap) {
|
||||
return CopyUtil.copyList(generates, CollectionElement.class, (o, d) -> {
|
||||
private List<CollectionElement> covertGeneratesToPrintCollections(List<GenerateDetail> generateDetailList, Map<Long, DesignCollectionPrintElementDTO> idToMap) {
|
||||
return CopyUtil.copyList(generateDetailList, CollectionElement.class, (o, d) -> {
|
||||
if (null != idToMap) {
|
||||
DesignCollectionPrintElementDTO printDTO = idToMap.get(o.getId());
|
||||
d.setHasPin(printDTO.getIsPin());
|
||||
|
||||
Reference in New Issue
Block a user