liujie
2023-10-31 904cfe3bad14c27857a062849fc92dd85035c524
cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
@@ -228,7 +228,28 @@
    @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())){
                    if(collect.size()>1){
                        map.put("size",1);
                    }else {
                        map.put("size",0);
                    }
                    mapList.add(map);
                }
            }
        }else {
            mapList = mapList1;
        }
        if (mapList.size() > 0){
            for (Map<String, Object> stringObjectMap : mapList) {
                Integer o = (Integer) stringObjectMap.get("id");
@@ -248,6 +269,22 @@
    @PostMapping("/base/coupon/queryCouponListSearch1")
    public List<Map<String,Object>> getCouponListOfSearch1(@RequestBody CouponListOfSearch ofSearch){
        List<Map<String, Object>> mapList = couponService.queryCouponListOfSearch1(ofSearch);
        Date currentDate = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String currentDateStr = sdf.format(currentDate);
        // Iterate over the mapList and remove entries where endTime is less than the current date
        Iterator<Map<String, Object>> iterator = mapList.iterator();
        while (iterator.hasNext()) {
            Map<String, Object> map = iterator.next();
            String endTime = (String) map.get("endTime");
            if (endTime.compareTo(currentDateStr) < 0) {
                iterator.remove();
            }
        }
        if (mapList.size() > 0){
            for (Map<String, Object> stringObjectMap : mapList) {
                Integer o = (Integer) stringObjectMap.get("id");
@@ -271,11 +308,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());
                    }
                }
            }
        }
@@ -483,6 +523,18 @@
                coupon.setPublisherType(1);
                coupon.setCityManagerId(dataVo.getCityManagerId());
            }
            if(dataVo.getObjType()!=1){
                coupon.setAuditStatus(1);
            }
            if (dataVo.getUserType()==1){
                coupon.setAuditStatus(2);
            }else{
                coupon.setAuditStatus(1);
            }
            if(dataVo.getObjType()!=1){
                coupon.setAuditStatus(1);
            }
            boolean save = couponService.save(coupon);
            if (save){
                if (dataVo.getCompany() == 3){