lzy 1 settimana fa
parent
commit
32fee2740c

+ 0 - 2
src/main/java/com/futu/course/common/intercepter/AuthIntercepter.java

@@ -81,8 +81,6 @@ public class AuthIntercepter implements HandlerInterceptor {
                 throw new RRException("token过期", 101);
             }
 
-
-
         } catch (RRException e) {
             log.info("调用了异常通知" + e.getMessage());
             throw e;

+ 5 - 0
src/main/java/com/futu/course/course/domain/Course.java

@@ -37,6 +37,8 @@ public class Course implements Serializable {
      */
     private Long teacherId;
 
+    private String describe;
+
     /**
      * 分类
      */
@@ -91,6 +93,7 @@ public class Course implements Serializable {
             && (this.getTitle() == null ? other.getTitle() == null : this.getTitle().equals(other.getTitle()))
             && (this.getShopId() == null ? other.getShopId() == null : this.getShopId().equals(other.getShopId()))
             && (this.getTeacherId() == null ? other.getTeacherId() == null : this.getTeacherId().equals(other.getTeacherId()))
+            && (this.getDescribe() == null ? other.getDescribe() == null : this.getDescribe().equals(other.getDescribe()))
             && (this.getCategoryId() == null ? other.getCategoryId() == null : this.getCategoryId().equals(other.getCategoryId()))
             && (this.getPrice() == null ? other.getPrice() == null : this.getPrice().equals(other.getPrice()))
             && (this.getCoverImg() == null ? other.getCoverImg() == null : this.getCoverImg().equals(other.getCoverImg()))
@@ -108,6 +111,7 @@ public class Course implements Serializable {
         result = prime * result + ((getTitle() == null) ? 0 : getTitle().hashCode());
         result = prime * result + ((getShopId() == null) ? 0 : getShopId().hashCode());
         result = prime * result + ((getTeacherId() == null) ? 0 : getTeacherId().hashCode());
+        result = prime * result + ((getDescribe() == null) ? 0 : getDescribe().hashCode());
         result = prime * result + ((getCategoryId() == null) ? 0 : getCategoryId().hashCode());
         result = prime * result + ((getPrice() == null) ? 0 : getPrice().hashCode());
         result = prime * result + ((getCoverImg() == null) ? 0 : getCoverImg().hashCode());
@@ -128,6 +132,7 @@ public class Course implements Serializable {
         sb.append(", title=").append(title);
         sb.append(", shopId=").append(shopId);
         sb.append(", teacherId=").append(teacherId);
+        sb.append(", describe=").append(describe);
         sb.append(", categoryId=").append(categoryId);
         sb.append(", price=").append(price);
         sb.append(", coverImg=").append(coverImg);

+ 15 - 3
src/main/java/com/futu/course/cupons/controller/CouponController.java

@@ -2,7 +2,9 @@ package com.futu.course.cupons.controller;
 
 import com.futu.course.common.entity.R;
 import com.futu.course.cupons.domain.Coupon;
+import com.futu.course.cupons.dto.CouponDto;
 import com.futu.course.cupons.service.CouponService;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -19,10 +21,20 @@ public class CouponController {
 
 //    可以使用的优惠券
     @RequestMapping("/findAll")
-    public R findAll(BigDecimal primary){
-        List<Coupon> all = couponService.findAll(primary);
-        return R.ok(all);
+    public R findAll(@RequestBody CouponDto primary){
+        return couponService.findAll(primary);
     }
 
 
+
+
+
+
+
+
+
+
+
+
+
 }

+ 15 - 0
src/main/java/com/futu/course/cupons/dto/CouponDto.java

@@ -0,0 +1,15 @@
+package com.futu.course.cupons.dto;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class CouponDto {
+
+    private  BigDecimal primary;
+}

+ 12 - 1
src/main/java/com/futu/course/cupons/service/CouponService.java

@@ -1,7 +1,9 @@
 package com.futu.course.cupons.service;
 
+import com.futu.course.common.entity.R;
 import com.futu.course.cupons.domain.Coupon;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.futu.course.cupons.dto.CouponDto;
 
 import java.math.BigDecimal;
 import java.util.List;
@@ -14,7 +16,16 @@ import java.util.List;
 public interface CouponService extends IService<Coupon> {
 
 //    获取能使用的优惠券
-    public List<Coupon> findAll(BigDecimal primary);
+    R findAll(CouponDto primary);
+
+
+
+
+
+//    订单界面
+
+
+
 
 
 

+ 18 - 5
src/main/java/com/futu/course/cupons/service/impl/CouponServiceImpl.java

@@ -3,8 +3,10 @@ package com.futu.course.cupons.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.futu.course.common.entity.R;
 import com.futu.course.common.utils.CopyUtil;
 import com.futu.course.cupons.domain.Coupon;
+import com.futu.course.cupons.dto.CouponDto;
 import com.futu.course.cupons.service.CouponService;
 import com.futu.course.cupons.mapper.CouponMapper;
 import com.futu.course.user.domain.User;
@@ -34,21 +36,32 @@ public class CouponServiceImpl extends ServiceImpl<CouponMapper, Coupon>
     private RedisTemplate redisTemplate;
 
     @Override
-    public List<Coupon> findAll(BigDecimal primary) {
+    public R findAll(CouponDto primary) {
         User user = (User) redisTemplate.opsForValue().get("user");
         List<Long> objects = userCouponMapper.selectObjs(new QueryWrapper<UserCoupon>().eq("user_id", user.getId()).eq("status", 0).select("coupon_id"));
         if (objects == null){
-            return null;
+            return R.failed("没有优惠券");
         }
         List<Coupon> list=new ArrayList<>();
         for (Long i:objects){
-            list.add(this.baseMapper.selectOne(new QueryWrapper<Coupon>().eq("id",i).ge("condition_amount",primary)));
+            list.add(this.baseMapper.selectOne(new QueryWrapper<Coupon>().eq("id",i).ge("condition_amount",primary.getPrimary())));
         }
         if (list==null){
-            return null;
+            return R.failed("没有可用的优惠券");
         }
-        return list;
+        return R.ok(list);
     }
+
+
+
+
+
+
+
+
+
+
+
 }