Bladeren bron

商品改造导致的财务导出问题

zouxuan 5 maanden geleden
bovenliggende
commit
115c36da53
1 gewijzigde bestanden met toevoegingen van 5 en 2 verwijderingen
  1. 5 2
      mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

+ 5 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ExportServiceImpl.java

@@ -2830,7 +2830,10 @@ public class ExportServiceImpl implements ExportService {
         if (!CollectionUtils.isEmpty(sellOrders)) {
             sellOrderMap = sellOrders.stream().collect(Collectors.groupingBy(SellOrder::getOrderId));
             //获取商品列表
-            List<Goods> goodsList = goodsService.findGoodsByIds(sellOrders.stream().map(e -> e.getGoodsId().toString()).distinct().collect(Collectors.joining(",")));
+            List<Goods> goodsList = goodsService.findGoodsByIds(sellOrders.stream().filter(e->e.getGoodsSkuId()==null)
+                    .map(e -> e.getGoodsId().toString()).distinct().collect(Collectors.joining(",")));
+            goodsList.addAll(goodsService.findGoodsByIds(sellOrders.stream().filter(e->e.getGoodsSkuId() != null)
+                    .map(e -> e.getGoodsSkuId().toString()).distinct().collect(Collectors.joining(","))));
             goodsMap = goodsList.stream().collect(Collectors.toMap(Goods::getId, Function.identity()));
         }
 
@@ -3283,7 +3286,7 @@ public class ExportServiceImpl implements ExportService {
         } else if (basicOrder.getSaleAmount().compareTo(BigDecimal.ZERO) > 0) {
             //计算销售收入,排除商品编号是76的商品,其他的商品按分类统计
             for (SellOrder e : sellOrderList) {
-                this.setSaleFee(basicOrder, e, goodsMap.get(e.getGoodsId()));
+                this.setSaleFee(basicOrder, e, goodsMap.get(e.getGoodsSkuId() == null ? e.getGoodsId() : e.getGoodsSkuId()));
             }
         }
     }