From b3e0d0ea6c1e311566bab861b79cc9b9c6d25287 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期五, 15 三月 2024 09:49:03 +0800
Subject: [PATCH] 修改bug

---
 cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java |   90 ++++++++++++++++++++++++++++++++-------------
 1 files changed, 64 insertions(+), 26 deletions(-)

diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
index 83b204e..896d87c 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java
@@ -226,10 +226,12 @@
                 String endTime = (String) stringObjectMap.get("endTime");
                 stringObjectMap.put("timeValue", startTime + "至" + endTime);
                 int count1 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>()
-                        .eq(UserPointsMerchandise::getPointsMerchandiseId, o));
+                        .eq(UserPointsMerchandise::getPointsMerchandiseId, o)
+                        .eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1));
                 int count2 = upmseService.count(new LambdaQueryWrapper<UserPointsMerchandise>()
                         .eq(UserPointsMerchandise::getPointsMerchandiseId, o)
-                        .eq(UserPointsMerchandise::getStatus, 2));
+                        .eq(UserPointsMerchandise::getStatus, 2)
+                        .eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1));
                 stringObjectMap.put("hasExchangeQty", count1);
                 stringObjectMap.put("hasPickQty", count2);
 
@@ -909,7 +911,6 @@
                                         list4.add(43);
                                         detailsResponse.setRid(list4);
                                     }
-
                                 }
                             }
                             //======================================================
@@ -1548,6 +1549,7 @@
         List<Map<String, Object>> mapList = new ArrayList<>();
         LambdaQueryWrapper<UserPointsMerchandise> userPointsMerchandiseLambdaQueryWrapper = new LambdaQueryWrapper<>();
         userPointsMerchandiseLambdaQueryWrapper.eq(UserPointsMerchandise::getPointsMerchandiseId, pointMercharsPayedVo.getId());
+        userPointsMerchandiseLambdaQueryWrapper.eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1);
         if (ToolUtil.isNotEmpty(pointMercharsPayedVo.getStatus())) {
             userPointsMerchandiseLambdaQueryWrapper.eq(UserPointsMerchandise::getStatus, pointMercharsPayedVo.getStatus());
         }
@@ -1682,33 +1684,69 @@
         List<StoreVos> storeVos = new ArrayList<>();
         List<PointsMerchandiseStore> list = pmdstoService.list(new QueryWrapper<PointsMerchandiseStore>()
                 .eq("pointsMerchandiseId", id));
-        if (list.size() > 0) {
-            List<Integer> collect = list.stream().map(PointsMerchandiseStore::getStoreId).collect(Collectors.toList());
-            List<Integer> collect1 = list.stream().map(PointsMerchandiseStore::getSiteId).collect(Collectors.toList());
-            List<Store> stores = stoClient.queryStoreByIds(collect);
-            if (stores.size() > 0) {
-                int a = 0;
-                for (Store store : stores) {
-                    StoreVos storeVos1 = new StoreVos();
-                    storeVos1.setNum1(store.getProvince() + "省" + store.getCity() + "市");
-                    if (store.getOperatorId()==null){
-                        storeVos1.setNum2("平台");
-                    }else if (store.getOperatorId() == 0) {
-                        storeVos1.setNum2("平台");
-                    } else {
+        PointsMerchandise byId = pmdsService.getById(id);
 
-                        storeVos1.setNum2(store.getOName());
+        if (list.size() > 0) {
+
+            if (byId.getUseScope()==3){
+                // 如果是指定门店
+                List<Integer> collect = list.stream().map(PointsMerchandiseStore::getStoreId).collect(Collectors.toList());
+
+                List<Store> stores = stoClient.queryStoreByIds(collect);
+                if (stores.size() > 0) {
+                    int a = 0;
+                    for (Store store : stores) {
+                        StoreVos storeVos1 = new StoreVos();
+                        storeVos1.setNum1(store.getProvince() + "省" + store.getCity() + "市");
+                        if (store.getOperatorId()==null){
+                            storeVos1.setNum2("平台");
+                        }else if (store.getOperatorId() == 0) {
+                            storeVos1.setNum2("平台");
+                        } else {
+                            storeVos1.setNum2(store.getOName());
+                        }
+                        storeVos1.setNum3(store.getName());
+                        storeVos1.setNum4(store.getIds());
+                        storeVos.add(storeVos1);
                     }
-                    storeVos1.setNum3(store.getName());
-                    storeVos1.setNum4(store.getIds());
-                    if (collect1.get(a)!=null){
-                        Site site = siteClient.querySiteById(collect1.get(a));
-                        storeVos1.setNum5(site.getName());
-                    }
-                    storeVos1.setNum4(store.getIds());
-                    storeVos.add(storeVos1);
                 }
+            }else if (byId.getUseScope()==4){
+                // 如果是指定场地
+                List<Integer> collect1 = list.stream().map(PointsMerchandiseStore::getSiteId).distinct().collect(Collectors.toList());
+                int temp =0;
+                List<Integer> collect = list.stream().map(PointsMerchandiseStore::getStoreId).collect(Collectors.toList());
+                List<Store> stores1 = new ArrayList<>();
+                for (Integer integer : collect) {
+                    List<Integer> list1 = new ArrayList<>();
+                    list1.add(integer);
+                    List<Store> stores = stoClient.queryStoreByIds(list1);
+                    stores1.addAll(stores);
+                }
+                List<Store> stores = stoClient.queryStoreByIds(collect);
+                while (temp!=collect1.size()){
+                    for (Store store : stores1) {
+                        Integer integer = collect1.get(temp);
+                        Site site = siteClient.querySiteById(integer);
+                        StoreVos storeVos1 = new StoreVos();
+                        storeVos1.setNum5(site.getName());
+                        storeVos1.setNum1(store.getProvince() + "省" + store.getCity() + "市");
+                        if (store.getOperatorId()==null){
+                            storeVos1.setNum2("平台");
+                        }else if (store.getOperatorId() == 0) {
+                            storeVos1.setNum2("平台");
+                        } else {
+                            storeVos1.setNum2(store.getOName());
+                        }
+                        storeVos1.setNum3(store.getName());
+                        storeVos1.setNum4(store.getIds());
+                        storeVos.add(storeVos1);
+                        temp++;
+                    }
+                }
+
+
             }
+
         }
         return storeVos;
     }

--
Gitblit v1.7.1