|
@@ -28,6 +28,8 @@ import java.math.RoundingMode;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
@@ -70,6 +72,9 @@ public class QuotationEstimateServiceImpl extends ServiceImpl<QuotationEstimateM
|
|
|
quotationEstimateVos = new ArrayList<>();
|
|
|
List<QuotationProductBom> list1 = quotationProductBomService.list(q -> q.eq(QuotationProductBom::getQuotationProductId, quotationProductId));
|
|
|
|
|
|
+ List<Long> mIds = list1.stream().map(QuotationProductBom::getMaterialId).collect(Collectors.toList());
|
|
|
+ Map<Long, ProductInfo> materialInfoMap = productInfoService.mapKEntity(ProductInfo::getId, q -> q.in(ProductInfo::getId, mIds));
|
|
|
+
|
|
|
|
|
|
for (QuotationProductBom quotationProductBom : list1) {
|
|
|
QuotationEstimateVo quotationEstimate = new QuotationEstimateVo();
|
|
@@ -78,11 +83,10 @@ public class QuotationEstimateServiceImpl extends ServiceImpl<QuotationEstimateM
|
|
|
quotationEstimate.setMaterialId(quotationProductBom.getMaterialId());
|
|
|
quotationEstimate.setType(quotationProductBom.getType());
|
|
|
|
|
|
-
|
|
|
- if (ObjectUtil.equals(quotationProductBom.getType(), 1)) {
|
|
|
- ProductInfo productInfo = productInfoService.getById(quotationProductBom.getMaterialId());
|
|
|
- Assert.notEmpty(productInfo, "查询不到原材料信息");
|
|
|
- quotationProductBom.setPrice(productInfo.getPrice());
|
|
|
+
|
|
|
+ ProductInfo materialId = materialInfoMap.get(quotationProductBom.getMaterialId());
|
|
|
+ if (ObjectUtil.isNotEmpty(materialId)) {
|
|
|
+ quotationEstimate.setPrice(materialId.getPrice());
|
|
|
}
|
|
|
|
|
|
|