phpcjl
2024-12-13 ee83ebbb7ec065ccf9ed1935f9c0d725d24715c7
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/controller/GoodsBargainPriceController.java
@@ -64,8 +64,6 @@
    /**
     * 根据商品id和会员等级获取门店特价
     *
     * @param goodsBargainPrice
     * @return
     */
    @PostMapping("/getGoodsBargainPrice")
    public R<GoodsBargainPriceDetail> getGoodsBargainPrice(@RequestBody GetGoodsBargainPrice goodsBargainPrice) {
@@ -176,24 +174,22 @@
                .eq(!CollectionUtils.isEmpty(goodsIds), GoodsBargainPrice::getGoodsId, goodsId)
                .eq(auditStatus != null, GoodsBargainPrice::getAuditStatus, auditStatus));
        page.getRecords().forEach(goodsBargainPrice -> {
            goodsList.stream()
                    .filter(goods -> goods.getId().equals(goodsBargainPrice.getGoodsId()))
                    .findFirst().ifPresent(g -> {
                        GoodsCategory goodsCategory = goodsCategoryService.getById(g.getGoodsCategoryId());
                        Integer shopId = goodsBargainPrice.getShopId();
                        Shop shop = shopService.getById(shopId);
                        R<AppUser> r = appUserClient.getAppUserByPhone(shop.getPhone());
                        if (R.isError(r)){
                            throw new RuntimeException("获取店长信息失败");
                        }
                        goodsBargainPrice.setOwnerName(r.getData().getName());
                        goodsBargainPrice.setOwnerPhone(shop.getPhone());
                        goodsBargainPrice.setShopName(shop.getName());
                        goodsBargainPrice.setGoodsName(g.getName());
                        goodsBargainPrice.setCategoryName(goodsCategory.getName());
                    });
        });
        page.getRecords().forEach(goodsBargainPrice -> goodsList.stream()
                .filter(goods -> goods.getId().equals(goodsBargainPrice.getGoodsId()))
                .findFirst().ifPresent(g -> {
                    GoodsCategory goodsCategory = goodsCategoryService.getById(g.getGoodsCategoryId());
                    Integer shopId = goodsBargainPrice.getShopId();
                    Shop shop = shopService.getById(shopId);
                    R<AppUser> r = appUserClient.getAppUserByPhone(shop.getPhone());
                    if (R.isError(r)){
                        throw new RuntimeException("获取店长信息失败");
                    }
                    goodsBargainPrice.setOwnerName(r.getData().getName());
                    goodsBargainPrice.setOwnerPhone(shop.getPhone());
                    goodsBargainPrice.setShopName(shop.getName());
                    goodsBargainPrice.setGoodsName(g.getName());
                    goodsBargainPrice.setCategoryName(goodsCategory.getName());
                }));
        return R.ok(page);
    }