| | |
| | | @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)); |
| | | |
| | |
| | | @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<>(); |
| | |
| | | // 获取到优惠券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())) |
| | |
| | | @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()) { |
| | |
| | | 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()); |
| | | } |
| | | } |
| | | } |
| | |
| | | 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; |
| | |
| | | } |
| | | 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); |