44323
2023-11-23 acad524bfb7f376c09ff8e6600fab207780156e1
cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java
@@ -108,7 +108,9 @@
    @ResponseBody
    @PostMapping("/coupon/queryCouponByUser/{userId}")
    public List<Integer> queryCouponByUser(@PathVariable("userId") Integer userId){
        List<Coupon> list = couponService.list(new QueryWrapper<Coupon>().eq("distributionMethod", 2).eq("userPopulation",2)
        System.err.println("到达了赠送优惠价");
        List<Coupon> list = couponService.list(new QueryWrapper<Coupon>().eq("distributionMethod", 2)
                .le("startTime", new Date()).ge("endTime", new Date()).eq("auditStatus", 2)
                .eq("state", 1));
@@ -305,6 +307,7 @@
    @PostMapping("/base/coupon/queryCouponListSearch")
    public List<Map<String,Object>> getCouponListOfSearch(@RequestBody CouponListOfSearch ofSearch){
        List<Map<String, Object>> mapList1 = couponService.queryCouponListOfSearch(ofSearch);
        List<Map<String, Object>> mapList = new ArrayList<>();
        if (ofSearch.getStoreIds()==null){
            ArrayList<Integer> list = new ArrayList<>();
@@ -322,7 +325,7 @@
                        // 获取到优惠券id 查询这个优惠券指定了哪些城市
                        Integer id = Integer.parseInt(String.valueOf(map.get("id")));
                        // 获取到运营商管理的省和市
                        List<TOperatorCity> cityByOperatorId = operatorClient.getCityByOperatorId(ofSearch.getOperatorId());
                        List<TOperatorCity> cityByOperatorId = ofSearch.getOperatorCities();
                        // 拿到运营商市的code集合
                        List<String> collect = cityByOperatorId.stream().filter(t -> t.getPid() != 0)
                                .map(tOperatorCity -> Integer.toString(tOperatorCity.getCode()))
@@ -396,12 +399,11 @@
    @ResponseBody
    @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()) {
@@ -438,11 +440,7 @@
                Integer publisherType = (Integer) stringObjectMap.get("publisherType");
                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());
                    }
                }
            }
@@ -609,10 +607,7 @@
                    case 1:
                        coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints()));
                        break;
                    case 2:
                        coupon.setCash(dataVo.getRequiredCash());
                        coupon.setIntegral(BigDecimal.valueOf(dataVo.getRequiredPoints()));
                        break;
                    case 3:
                        coupon.setCash(dataVo.getRequiredCash());
                        break;
@@ -647,21 +642,18 @@
            }
            if (dataVo.getUserType() == 1){
                coupon.setPublisherType(2);
                coupon.setAuditStatus(2);
                coupon.setCityManagerId(dataVo.getCityManagerId());
            }
            if (dataVo.getUserType() == 2){
                coupon.setPublisherType(1);
                coupon.setAuditStatus(1);
                coupon.setCityManagerId(dataVo.getCityManagerId());
            }
            if(dataVo.getObjType()!=1){
            if (dataVo.getUserType() == 3){
                coupon.setPublisherType(3);
                coupon.setAuditStatus(1);
            }
            if (dataVo.getUserType()==1){
                coupon.setAuditStatus(2);
            }else{
                coupon.setAuditStatus(1);
            }
            if(dataVo.getObjType()!=1){
                coupon.setAuditStatus(1);
                coupon.setCityManagerId(dataVo.getCityManagerId());
            }
            boolean save = couponService.save(coupon);