From 88d56c7c74be121a11e3760e4fc7a058ea2f6c47 Mon Sep 17 00:00:00 2001
From: nickchange <126672920+nickchange@users.noreply.github.com>
Date: 星期四, 26 十月 2023 10:45:30 +0800
Subject: [PATCH] 10.26.2

---
 cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
index 208e0cb..d001de6 100644
--- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
+++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
@@ -228,7 +228,23 @@
     @ResponseBody
     @PostMapping("/base/coupon/queryCouponListSearch")
     public List<Map<String,Object>> getCouponListOfSearch(@RequestBody CouponListOfSearch ofSearch){
-        List<Map<String, Object>> mapList = couponService.queryCouponListOfSearch(ofSearch);
+        List<Map<String, Object>> mapList1 = couponService.queryCouponListOfSearch(ofSearch);
+        List<Map<String, Object>> mapList = new ArrayList<>();
+
+        if(ofSearch.getStoreId()!=null){
+            for (Map<String, Object> map : mapList1) {
+                List<CouponStore> id = couStoreService.list(new LambdaQueryWrapper<CouponStore>().eq(CouponStore::getCouponId, map.get("id").toString()));
+                List<Integer> collect = id.stream().map(CouponStore::getStoreId).collect(Collectors.toList());
+                if(collect.size()==0){
+                    collect.add(-1);
+                }
+                if(collect.contains(ofSearch.getStoreId())){
+                    mapList.add(map);
+                }
+            }
+        }else {
+            mapList = mapList1;
+        }
         if (mapList.size() > 0){
             for (Map<String, Object> stringObjectMap : mapList) {
                 Integer o = (Integer) stringObjectMap.get("id");
@@ -271,11 +287,14 @@
                 Object endTime = stringObjectMap.get("endTime");
                 stringObjectMap.put("timeValue",startTime + "至"+endTime);
                 Integer publisherType = (Integer) stringObjectMap.get("publisherType");
-                if ( publisherType == 1) {
-                    Integer cityManagerId = (Integer) stringObjectMap.get("cityManagerId");
-                    TCityManager byId = citClient.getById(cityManagerId);
-                    stringObjectMap.put("province", byId.getProvince());
-                    stringObjectMap.put("city", byId.getCity());
+                if (publisherType!=null) {
+                    if (publisherType == 1) {
+                        Integer cityManagerId = (Integer) stringObjectMap.get("cityManagerId");
+                        TCityManager byId = citClient.getById(cityManagerId);
+                        stringObjectMap.put("province", byId.getProvince());
+
+                        stringObjectMap.put("city", byId.getCity());
+                    }
                 }
             }
         }

--
Gitblit v1.7.1