| | |
| | | private SiteClient siteClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取购买课程可用优惠券列表 |
| | | * |
| | | * @param uid |
| | | * @param coursePackageId |
| | | * @return |
| | |
| | | if (type == 1) {//满减{"num1":1,"num2":1} |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | Double num1 = jsonObject.getDouble("conditionalAmount"); |
| | | if(price.compareTo(num1) < 0){ |
| | | if (price.compareTo(num1) < 0) { |
| | | continue; |
| | | } |
| | | couponListVo.setUseCondition("满¥" + num1 + "元可用"); |
| | |
| | | if (type == 2) {//代金券{"num1":1} |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | Double num1 = jsonObject.getDouble("conditionalAmount"); |
| | | if(num1==null){ |
| | | num1=0d; |
| | | if (num1 == null) { |
| | | num1 = 0d; |
| | | } |
| | | if(price.compareTo(num1) < 0){ |
| | | if (price.compareTo(num1) < 0) { |
| | | continue; |
| | | } |
| | | couponListVo.setUseCondition(""); |
| | |
| | | |
| | | /** |
| | | * 获取预约场地可用优惠券列表 |
| | | * |
| | | * @param siteId |
| | | * @param price |
| | | * @return |
| | |
| | | if (type == 1) {//满减{"num1":1,"num2":1} |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | Double num1 = jsonObject.getDouble("conditionalAmount"); |
| | | if(price.compareTo(num1) < 0){ |
| | | if (price.compareTo(num1) < 0) { |
| | | continue; |
| | | } |
| | | couponListVo.setUseCondition("满" + num1 + "元可用"); |
| | |
| | | if (type == 2) {//代金券{"num1":1} |
| | | JSONObject jsonObject = JSON.parseObject(content); |
| | | Double num1 = jsonObject.getDouble("conditionalAmount"); |
| | | if(num1==null){ |
| | | num1=0d; |
| | | if (num1 == null) { |
| | | num1 = 0d; |
| | | } |
| | | if(price.compareTo(num1) < 0){ |
| | | if (price.compareTo(num1) < 0) { |
| | | continue; |
| | | } |
| | | couponListVo.setUseCondition(""); |
| | |
| | | AppUser appUser = appClient.queryAppUser(uid); |
| | | if (null != appUser) { |
| | | List<UserCoupon> userCoupons = this.baseMapper.selectList(new QueryWrapper<UserCoupon>() |
| | | .eq("userId",appUser.getId() ) |
| | | .eq("userId", appUser.getId()) |
| | | .orderByDesc("insertTime")); |
| | | if (userCoupons.size() > 0){ |
| | | if (userCoupons.size() > 0) { |
| | | for (UserCoupon userCoupon : userCoupons) { |
| | | Coupon coupon = couponMapper.selectById(userCoupon.getCouponId()); |
| | | CouponPackageResp packageResp = new CouponPackageResp(); |
| | |
| | | packageResp.setName(coupon.getName()); |
| | | packageResp.setType(coupon.getType()); |
| | | packageResp.setUseCondition(coupon.getUseScope()); |
| | | switch (coupon.getUseScope()){ |
| | | switch (coupon.getUseScope()) { |
| | | case 1: |
| | | packageResp.setAvailable("全国通用"); |
| | | break; |
| | |
| | | case 3: |
| | | packageResp.setAvailable("指定门店可用"); |
| | | CouponStore couponStore = csMapper.selectOne(new QueryWrapper<CouponStore>() |
| | | .eq("couponId",coupon.getId()).last("limit 1")); |
| | | .eq("couponId", coupon.getId()).last("limit 1")); |
| | | StoreDetailOfCourse courseOfStore = storeClient.getCourseOfStore(couponStore.getStoreId()); |
| | | // packageResp.setCityOrStore(courseOfStore.getStoreName()+","+courseOfStore.getStoreAddr()); |
| | | packageResp.setCityOrStore(courseOfStore.getStoreName()); |
| | |
| | | // 满减券 |
| | | Double num1 = jsonObject.getDouble("conditionalAmount"); |
| | | Double num2 = jsonObject.getDouble("deductionAmount"); |
| | | ruleModel.setConditionalAmount("满"+num1+"可用"); |
| | | ruleModel.setDeductionAmount("¥ "+num2); |
| | | ruleModel.setConditionalAmount("满" + num1 + "可用"); |
| | | ruleModel.setDeductionAmount("¥ " + num2); |
| | | ruleModel.setExperienceName(""); |
| | | break; |
| | | case 2: |
| | | // 代金券 |
| | | Double jsonObjectDouble = jsonObject.getDouble("conditionalAmount"); |
| | | ruleModel.setConditionalAmount(""); |
| | | ruleModel.setDeductionAmount("¥ "+jsonObjectDouble); |
| | | ruleModel.setDeductionAmount("¥ " + jsonObjectDouble); |
| | | ruleModel.setExperienceName(""); |
| | | break; |
| | | case 3: |
| | |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); |
| | | packageResp.setEffectiveTime(simpleDateFormat.format(coupon.getEndTime())); |
| | | |
| | | if (userCoupon.getStatus() == 1){ |
| | | if (DateUtil.getDate().before(coupon.getEndTime())){ |
| | | if (userCoupon.getStatus() == 1) { |
| | | if (DateUtil.getDate().before(coupon.getEndTime())) { |
| | | packageResp.setUseStatus(1); |
| | | }else { |
| | | } else { |
| | | packageResp.setUseStatus(3); |
| | | } |
| | | } |
| | | if (userCoupon.getStatus() == 2){ |
| | | if (userCoupon.getStatus() == 2) { |
| | | packageResp.setUseStatus(2); |
| | | } |
| | | respList.add(packageResp); |
| | | } |
| | | if (null != req.getCouponType()){ |
| | | if (null != req.getCouponType()) { |
| | | respList = respList.stream() |
| | | .filter(couponPackageResp -> couponPackageResp.getType().equals(req.getCouponType())) |
| | | .collect(Collectors.toList()); |
| | | } |
| | | if (null != req.getUseStatus()){ |
| | | if (null != req.getUseStatus()) { |
| | | respList = respList.stream() |
| | | .filter(couponPackageResp -> couponPackageResp.getUseStatus().equals(req.getUseStatus())) |
| | | .collect(Collectors.toList()); |