| | |
| | | }else{ |
| | | record.setMeetTheConditions("满"+byId.getMeetTheConditions()+"元可用"); |
| | | } |
| | | record.setCoverPicture(byId.getCoverPicture()); |
| | | record.setDetailsPicture(byId.getDetailsPicture()); |
| | | } |
| | | } |
| | | return AjaxResult.ok(data); |
| | |
| | | return AjaxResult.ok(tCouponService.pageList(dto)); |
| | | } |
| | | |
| | | @PostMapping(value = "/getCouponById") |
| | | public R<TCoupon> getCouponById(@RequestParam Integer id) { |
| | | return R.ok(tCouponService.getById(id)); |
| | | |
| | | } |
| | | /** |
| | | * 小程序远程调用 获取优惠券信息 |
| | | */ |
| | |
| | | TCoupon byId = tCouponService.getById(couponListVOVO.getCouponId()); |
| | | BeanUtils.copyProperties(byId,couponListVOVO); |
| | | couponListVOVO.setCouponName(byId.getName()); |
| | | // 根据预付金额 判断是否满足 |
| | | if (byId.getMeetTheConditions().compareTo(BigDecimal.ZERO) == 0){ |
| | | // 无门槛 |
| | | couponListVOVO.setIsUse(1); |
| | | }else if (couponListVOVO.getPayMoney().compareTo(byId.getMeetTheConditions()) < 0){ |
| | | couponListVOVO.setIsUse(0); |
| | | }else{ |
| | | couponListVOVO.setIsUse(1); |
| | | } |
| | | // 根据优惠券类型和预付金额 判断哪一个优惠券减免的金额最大 将其排在第一位 |
| | | if (couponListVOVO.getIsUse() == 1){ |
| | | switch (byId.getPreferentialMode()){ |
| | | case 1: |
| | | couponListVOVO.setMoney(byId.getDiscountAmount()); |
| | | break; |
| | | case 2: |
| | | |
| | | break; |
| | | } |
| | | }else{ |
| | | couponListVOVO.setMoney(BigDecimal.ZERO); |
| | | } |
| | | |
| | | } |
| | | return R.ok(list); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 根据id获取优惠券信息 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @PostMapping(value = "/getCouponById1/{id}") |
| | | public R<TCoupon> getCouponById1(@PathVariable(value = "id") Integer id){ |
| | | TCoupon coupon = tCouponService.getById(id); |
| | | return R.ok(coupon); |
| | | } |
| | | } |
| | | |