From c90a8ac772937f8f084356ea1f04c5dba1d9e5d5 Mon Sep 17 00:00:00 2001
From: luodangjia <luodangjia>
Date: 星期五, 24 一月 2025 11:15:33 +0800
Subject: [PATCH] 12.18

---
 ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java |   56 ++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
index 45d27ed..0efbcaf 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/GoodsServiceImpl.java
@@ -92,6 +92,8 @@
 
 
 
+
+
     @Override
     public PageInfo<GoodsVO> goodsList(Goods search) {
         Integer vipId = 0;
@@ -127,13 +129,13 @@
                     @Override
                     public int compare(GoodsVO o1, GoodsVO o2) {
                         if(null != o1.getSellingPrice() && null != o2.getSellingPrice()){
-                            return o1.getSellingPrice().compareTo(o2.getSellingPrice()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
+                            return o1.getSellingPrice().compareTo(o2.getSellingPrice()) * ("desc".equals(search.getIsAsc()) ? -1 : 1);
                         }
                         if(null == o1.getSellingPrice() && null != o2.getSellingPrice()){
-                            return BigDecimal.ZERO.compareTo(o2.getSellingPrice()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
+                            return BigDecimal.ZERO.compareTo(o2.getSellingPrice()) * ("desc".equals(search.getIsAsc()) ? -1 : 1);
                         }
                         if(null != o1.getSellingPrice() && null == o2.getSellingPrice()){
-                            return o1.getSellingPrice().compareTo(BigDecimal.ZERO) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
+                            return o1.getSellingPrice().compareTo(BigDecimal.ZERO) * ("desc".equals(search.getIsAsc()) ? -1 : 1);
                         }
                         return 0;
                     }
@@ -144,13 +146,13 @@
                     @Override
                     public int compare(GoodsVO o1, GoodsVO o2) {
                         if(null != o1.getIntegral() && null != o2.getIntegral()){
-                            return o1.getIntegral().compareTo(o2.getIntegral()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
+                            return o1.getIntegral().compareTo(o2.getIntegral()) * ("desc".equals(search.getIsAsc()) ? -1 : 1);
                         }
                         if(null == o1.getIntegral() && null != o2.getIntegral()){
-                            return Integer.valueOf(0).compareTo(o2.getIntegral()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
+                            return Integer.valueOf(0).compareTo(o2.getIntegral()) * ("desc".equals(search.getIsAsc()) ? -1 : 1);
                         }
                         if(null != o1.getIntegral() && null == o2.getIntegral()){
-                            return o1.getIntegral().compareTo(Integer.valueOf(0)) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
+                            return o1.getIntegral().compareTo(Integer.valueOf(0)) * ("desc".equals(search.getIsAsc()) ? -1 : 1);
                         }
                         return 0;
                     }
@@ -160,7 +162,7 @@
                 list.sort(new Comparator<GoodsVO>() {
                     @Override
                     public int compare(GoodsVO o1, GoodsVO o2) {
-                        return o1.getSaleNum().compareTo(o2.getSaleNum()) * (StringUtils.isNotEmpty(search.getIsAsc()) ? -1 : 1);
+                        return o1.getSaleNum().compareTo(o2.getSaleNum()) * ("desc".equals(search.getIsAsc()) ? -1 : 1);
                     }
                 });
             }
@@ -291,9 +293,9 @@
     @Override
     public List<Goods> getGoodsListByShopId(PageInfo<Goods> pageInfo, Integer shopId) {
         Integer vipId = 0;
-        String provinceCode = null;
-        String cityCode = null;
-        String districtCode = null;
+        String provinceCode = "0";
+        String cityCode = "0";
+        String districtCode = "0";
         String token = SecurityUtils.getToken(ServletUtils.getRequest());
         if(StringUtils.isNotEmpty(token)){
             Long userid = tokenService.getLoginUserApplet().getUserid();
@@ -585,20 +587,37 @@
             if(null == bargainPriceDetail){
                 //没有门店特价,判断地区价格配置
                 LambdaQueryWrapper<GoodsArea> queryWrapper = new LambdaQueryWrapper<GoodsArea>().eq(GoodsArea::getGoodsId, goodsId).eq(GoodsArea::getVip, vip);
+                if(StringUtils.isNotEmpty(provinceCode)){
+                    queryWrapper.eq(GoodsArea::getProvinceCode, provinceCode);
+                }
+                if(StringUtils.isNotEmpty(cityCode)){
+                    queryWrapper.eq(GoodsArea::getCityCode, cityCode);
+                }
                 if(StringUtils.isNotEmpty(districtCode)){
                     queryWrapper.eq(GoodsArea::getDistrictsCode, districtCode);
                 }
-                if(StringUtils.isNotEmpty(cityCode)){
-                    queryWrapper.and(i -> i.eq(GoodsArea::getCityCode, cityCode).or().isNull(GoodsArea::getCityCode));
-                }
-                if(StringUtils.isNotEmpty(provinceCode)){
-                    queryWrapper.and(i -> i.eq(GoodsArea::getProvinceCode, provinceCode).or().isNull(GoodsArea::getProvinceCode));
-                }
                 GoodsArea goodsArea = goodsAreaService.getOne(queryWrapper);
-                if(null == goodsArea){
+                if(goodsArea == null){
+                    queryWrapper = new LambdaQueryWrapper<GoodsArea>().eq(GoodsArea::getGoodsId, goodsId).eq(GoodsArea::getVip, vip);
+                    if(StringUtils.isNotEmpty(provinceCode)){
+                        queryWrapper.eq(GoodsArea::getProvinceCode, provinceCode);
+                    }
+                    if(StringUtils.isNotEmpty(cityCode)){
+                        queryWrapper.eq(GoodsArea::getCityCode, cityCode);
+                    }
+                    goodsArea = goodsAreaService.getOne(queryWrapper);
+                }
+                if(goodsArea == null){
+                    queryWrapper = new LambdaQueryWrapper<GoodsArea>().eq(GoodsArea::getGoodsId, goodsId).eq(GoodsArea::getVip, vip);
+                    if(StringUtils.isNotEmpty(provinceCode)){
+                        queryWrapper.eq(GoodsArea::getProvinceCode, provinceCode);
+                    }
+                    goodsArea = goodsAreaService.getOne(queryWrapper);
+                }
+                if(null == goodsArea || (null == goodsArea.getCashPayment() && null == goodsArea.getPointPayment())){
                     //没有地区价格,则使用会员价格
                     GoodsVip goodsVip = goodsVipService.getOne(new LambdaQueryWrapper<GoodsVip>().eq(GoodsVip::getGoodsId, goodsId).eq(GoodsVip::getVip, vip));
-                    if(null == goodsVip){
+                    if(null == goodsVip || (null == goodsVip.getCashPayment() && null == goodsVip.getPointPayment())){
                         //没有配置价格,直接使用原始基础价格
                         return null;
                     }else{
@@ -654,4 +673,5 @@
         }
         return price;
     }
+
 }

--
Gitblit v1.7.1