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