From 4beed66d31755142dd69f0294fd8521f7797b66a Mon Sep 17 00:00:00 2001
From: xuhy <3313886187@qq.com>
Date: 星期三, 03 九月 2025 16:39:36 +0800
Subject: [PATCH] bug修改

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java |   65 ++++++++++++++++++++++++--------
 1 files changed, 48 insertions(+), 17 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
index ac388e0..dfd9990 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/ShopServiceImpl.java
@@ -75,6 +75,8 @@
     private GoodsShopMapper goodsShopMapper;
     @Resource
     private GoodsShopService goodsShopService;
+    @Resource
+    private GoodsEvaluateMapper goodsEvaluateMapper;
 
 
     /**
@@ -225,7 +227,9 @@
     public PageInfo<ShopBalanceStatementVO> getShopBalanceStatementList(Integer shopId, LocalDateTime startTime, LocalDateTime endTime, Integer type, Integer pageCurr, Integer pageSize) {
         PageInfo<ShopBalanceStatementVO> pageInfo = new PageInfo<>(pageCurr, pageSize);
         List<ShopBalanceStatementVO> ShopBalanceStatementList = shopBalanceStatementMapper.getShopBalanceStatementList(pageInfo, shopId, startTime, endTime, type);
+
         for (ShopBalanceStatementVO shopBalanceStatementVO : ShopBalanceStatementList) {
+            log.error(shopBalanceStatementVO.toString());
             BigDecimal historicalBalance = shopBalanceStatementVO.getHistoricalBalance();
             BigDecimal balance = shopBalanceStatementVO.getBalance();
             if (historicalBalance != null && balance != null) {
@@ -256,15 +260,17 @@
                 ));
         for (GoodsVO good : distinctGoods) {
             //价格
-            Price price = getPrice( good.getGoodsId());
-            if(null != price){
-                //秒杀活动
-                good.setSellingPrice(price.getCash());
-                good.setIntegral(price.getPoint());
-                good.setStartTime(price.getStartTime());
-                good.setEndTime(price.getEndTime());
-                good.setPurchaseLimit(price.getPurchaseLimit());
-            }
+//            Price price = getPrice( good.getGoodsId());
+//            if(null != price){
+//                //秒杀活动
+//                good.setSellingPrice(price.getCash());
+//                good.setIntegral(price.getPoint());
+//                good.setStartTime(price.getStartTime());
+//                good.setEndTime(price.getEndTime());
+//                good.setPurchaseLimit(price.getPurchaseLimit());
+//            }
+            Integer point = getPoint(good.getSellingPrice());
+            good.setIntegral(point);
             Integer data = orderClient.getGoodsSaleNum(good.getGoodsId(), 1).getData();
             good.setSaleNum(data);
         }
@@ -293,14 +299,16 @@
         goodsVO.setEditNum(goods.getPurchaseLimit());
 
         //计算所需价格和积分
-        Price price = getPrice( goods.getId());
-        if(null != price){
-            //在秒杀活动时间段内
-            goodsVO.setSellingPrice(price.getCash());
-            goodsVO.setIntegral(price.getPoint());
-            goodsVO.setStartTime(price.getStartTime());
-            goodsVO.setEndTime(price.getEndTime());
-        }
+//        Price price = getPrice( goods.getId());
+//        if(null != price){
+//            //在秒杀活动时间段内
+//            goodsVO.setSellingPrice(price.getCash());
+//            goodsVO.setIntegral(price.getPoint());
+//            goodsVO.setStartTime(price.getStartTime());
+//            goodsVO.setEndTime(price.getEndTime());
+//        }
+        Integer point = getPoint(goodsVO.getSellingPrice());
+        goodsVO.setIntegral(point);
         //已售数量
         Integer data = orderClient.getGoodsSaleNum(goods.getId(), 1).getData();
         goodsVO.setSaleNum(data);
@@ -319,6 +327,7 @@
         //一个商品只有一个秒杀活动
         SeckillActivityInfo seckillActivityInfo = seckillActivityInfoService.getOne(new LambdaQueryWrapper<SeckillActivityInfo>()
                 .eq(SeckillActivityInfo::getGoodId, goodsId)
+                        .eq(SeckillActivityInfo::getIsShelves,1)
                 .eq(SeckillActivityInfo::getDelFlag, 0));
         //商品是否开启秒杀活动
         goodsVO.setIsSkillActivity(0);
@@ -331,6 +340,14 @@
             goodsVO.setEditActivityPrice(one.getSellingPrice());
         }
 
+        //商品评价
+        GoodsEvaluate goodsEvaluateOne = goodsEvaluateMapper.getGoodsEvaluateOne(goods.getId());
+        if(goodsEvaluateOne != null){
+            AppUser appUserById = appUserClient.getAppUserById(goodsEvaluateOne.getAppUserId());
+            goodsEvaluateOne.setUserName(appUserById.getName());
+            goodsEvaluateOne.setAvatar(appUserById.getAvatar());
+            goodsVO.setGoodsEvaluate(goodsEvaluateOne);
+        }
         return goodsVO;
 
     }
@@ -357,6 +374,9 @@
         goodsShop.setGoodsId(goods.getId());
         goodsShop.setShopId(addGoodsDTO.getShopId());
         Shop shop = shopMapper.selectById(addGoodsDTO.getShopId());
+        if(shop==null){
+            throw new ServiceException("门店不存在");
+        }
         goodsShop.setShopName(shop.getName());
         goodsShop.setOwnerName(shop.getShopManager());
         goodsShop.setPhone(shop.getPhone());
@@ -454,6 +474,17 @@
         return goods.getId();
     }
 
+    @Override
+    public PageInfo<ShopBalanceListVO> getBalanceList(String name, Integer pageCurr, Integer pageSize) {
+        PageInfo<ShopBalanceListVO> pageInfo = new PageInfo<>(pageCurr, pageSize);
+
+        List<ShopBalanceListVO> list = shopMapper.getBalanceList(pageInfo,name);
+
+
+        pageInfo.setRecords(list);
+        return pageInfo;
+    }
+
     /**
      * 获取商品当前的价格,就是看当前商品是否在秒杀活动中
      */

--
Gitblit v1.7.1