Browse Source

sku返回打样费

fgd 1 year ago
parent
commit
83c27d04a3

+ 10 - 5
sd-business/src/main/java/com/sd/business/entity/sku/vo/SkuSpecVo.java

@@ -38,6 +38,16 @@ public class SkuSpecVo extends SkuSpec {
     private String sharedFolder;
 
     /**
+     * 商品名称
+     */
+    private String wlnSkuName;
+
+    /**
+     * 库存数量
+     */
+    private BigDecimal inventoryQuantity;
+
+    /**
      * 包材
      */
     private List<SkuSpecLinkVo> packagingMaterialList;
@@ -47,9 +57,4 @@ public class SkuSpecVo extends SkuSpec {
      */
     private List<SkuSpecLinkVo> expressPackingList;
 
-    /**
-     * 库存数量
-     */
-    private BigDecimal inventoryQuantity;
-
 }

+ 4 - 0
sd-business/src/main/java/com/sd/business/service/sku/impl/SkuSpecServiceImpl.java

@@ -641,6 +641,8 @@ public class SkuSpecServiceImpl extends ServiceImpl<SkuSpecMapper, SkuSpec> impl
         List<SkuSpecVo> skuSpecVoList = BeanUtil.copyToList(skuSpecList, SkuSpecVo.class);
 
         // sku规格关联
+        List<Long> skuIds = skuSpecList.stream().map(SkuSpec::getSkuId).distinct().collect(Collectors.toList());
+        Map<Long, String> skuMap = skuService.mapKV(BaseIdPo::getId, Sku::getName, q -> q.in(BaseIdPo::getId, skuIds));
         List<Long> skuSpecIds = skuSpecList.stream().map(BaseIdPo::getId).collect(Collectors.toList());
         List<SkuSpecLink> skuSpecLinkList = skuSpecLinkService.list(q -> q.in(SkuSpecLink::getSkuSpecId, skuSpecIds));
 
@@ -694,6 +696,8 @@ public class SkuSpecServiceImpl extends ServiceImpl<SkuSpecMapper, SkuSpec> impl
 
             // 赋值库存数量
             item.setInventoryQuantity(inventoryMap.getOrDefault(item.getBomSpecId(), BigDecimal.ZERO));
+            // 赋值商品名称
+            item.setWlnSkuName(skuMap.getOrDefault(item.getSkuId(), null));
         }
 
         return skuSpecVoList;