Browse Source

增加优惠券接口定义

Eric 3 năm trước cách đây
mục cha
commit
7b2107d047

+ 43 - 0
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/controller/coupon/CouponInfoController.java

@@ -7,12 +7,18 @@ import com.yonge.cooleshow.common.entity.HttpResponseResult;
 import com.yonge.toolset.base.page.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import javax.validation.Valid;
 
 /**
  * <p>
@@ -41,4 +47,41 @@ public class CouponInfoController {
 
         return null;
     }
+
+    /**
+     * 优惠券详情信息
+     * @param id 优惠券ID
+     * @return HttpResponseResult<CouponInfoVO.CouponQueryInfo>
+     */
+    @GetMapping("/detail/{id}")
+    @ApiOperation(value = "优惠券详情", notes = "传入优惠券ID")
+    public HttpResponseResult<CouponInfoVO.CouponQueryInfo> findCouponById(@PathVariable("id") Long id) {
+        return null;
+    }
+
+    /**
+     * 新增或者更新优惠券信息
+     * - ID为空新增;否则进行更新
+     * @param info CouponInfoVO.CouponInfo
+     * @return HttpResponseResult<CouponInfoVO.CouponInfo>
+     */
+    @PostMapping("/save")
+    @ApiOperation(value = "新增或修改", notes = "CouponInfoVO.CouponInfo")
+    public HttpResponseResult<CouponInfoVO.CouponInfo> saveOrUpdate(@Valid @RequestBody CouponInfoVO.CouponInfo info) {
+        return null;
+    }
+
+    /**
+     * 启用/停用 优惠券
+     */
+    @GetMapping("/updateState")
+    @ApiOperation(value = "优惠券状态启/停用")
+    public HttpResponseResult<Boolean> updateCouponStateInfo(
+            @ApiParam(value = "优惠券ID", required = true) @RequestParam("couponId") Long couponId,
+            @ApiParam(value = "状态 0 停用 1 启用", required = true) @RequestParam("state") Integer state) {
+
+        return null;
+    }
+
+
 }

+ 146 - 1
cooleshow-user/user-admin/src/main/java/com/yonge/cooleshow/admin/io/request/coupon/CouponInfoVO.java

@@ -9,7 +9,9 @@ import lombok.Data;
 import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.time.LocalDateTime;
+import java.util.Date;
 
 /**
  * 优惠券信息
@@ -18,7 +20,7 @@ import java.time.LocalDateTime;
 public class CouponInfoVO {
 
     /**
-     * 优惠券信息
+     * 优惠券分页请求信息
      */
     @Data
     @NoArgsConstructor
@@ -40,6 +42,9 @@ public class CouponInfoVO {
         }
     }
 
+    /**
+     * 优惠券分页响应数据
+     */
     @Data
     @NoArgsConstructor
     @AllArgsConstructor
@@ -82,4 +87,144 @@ public class CouponInfoVO {
         @ApiModelProperty("创建时间")
         private LocalDateTime createdTime;
     }
+
+    /**
+     * 优惠券详情信息
+     */
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class CouponQueryInfo implements Serializable {
+
+        @ApiModelProperty("优惠券ID")
+        private Long id;
+
+        @ApiModelProperty("优惠券名称")
+        private String name;
+
+        @ApiModelProperty("优惠券编号")
+        private String serialNum;
+
+        @ApiModelProperty("描述")
+        private String describe;
+
+        @ApiModelProperty("客户端类型")
+        private String clientType;
+
+        @ApiModelProperty("可用品类")
+        private String category;
+
+        @ApiModelProperty("使用门槛")
+        private BigDecimal useLimit;
+
+        @ApiModelProperty("优惠金额")
+        private BigDecimal discountPrice;
+
+        @ApiModelProperty("优惠券类型")
+        private String couponType;
+
+        @ApiModelProperty("有效天数")
+        private Integer validDay;
+
+        @ApiModelProperty("生效时间")
+        private Long startTime;
+
+        @ApiModelProperty("失效时间")
+        private Long endTime;
+
+        @ApiModelProperty("库存量")
+        private Integer inventory;
+
+        @ApiModelProperty("领取次数限制")
+        private Integer quantityLimit;
+
+        @ApiModelProperty("启禁状态")
+        private Integer status;
+
+        @ApiModelProperty("更新用户")
+        private Long updatedBy;
+
+        @ApiModelProperty("更新时间")
+        private Long updateTime;
+
+        @ApiModelProperty("创建用户")
+        private Long createdBy;
+
+        @ApiModelProperty("创建时间")
+        private Date createdTime;
+
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+    }
+
+    /**
+     * 新增或更新优惠券信息
+     */
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    public static class CouponInfo implements Serializable {
+
+        @ApiModelProperty("优惠券ID")
+        private Long id;
+
+        @ApiModelProperty("优惠券名称")
+        private String name;
+
+        @ApiModelProperty("优惠券编号")
+        private String serialNum;
+
+        @ApiModelProperty("描述")
+        private String describe;
+
+        @ApiModelProperty("客户端类型")
+        private String clientType;
+
+        @ApiModelProperty("可用品类")
+        private String category;
+
+        @ApiModelProperty("使用门槛")
+        private BigDecimal useLimit;
+
+        @ApiModelProperty("优惠金额")
+        private BigDecimal discountPrice;
+
+        @ApiModelProperty("优惠券类型")
+        private String couponType;
+
+        @ApiModelProperty("有效天数")
+        private Integer validDay;
+
+        @ApiModelProperty("生效时间")
+        private Long startTime;
+
+        @ApiModelProperty("失效时间")
+        private Long endTime;
+
+        @ApiModelProperty("库存量")
+        private Integer inventory;
+
+        @ApiModelProperty("领取次数限制")
+        private Integer quantityLimit;
+
+        @ApiModelProperty("启禁状态")
+        private Integer status;
+
+        @ApiModelProperty("更新用户")
+        private Long updatedBy;
+
+        @ApiModelProperty("更新时间")
+        private Long updateTime;
+
+        @ApiModelProperty("创建用户")
+        private Long createdBy;
+
+        @ApiModelProperty("创建时间")
+        private Date createdTime;
+
+        public String jsonString() {
+            return JSON.toJSONString(this);
+        }
+    }
 }

+ 3 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/CouponInfo.java

@@ -6,7 +6,8 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
 import java.math.BigDecimal;
-import java.time.LocalDateTime;
+import java.util.Date;
+
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Getter;
@@ -102,7 +103,7 @@ public class CouponInfo implements Serializable {
 
     @ApiModelProperty("创建时间")
     @TableField("created_time_")
-    private LocalDateTime createdTime;
+    private Date createdTime;
 
 
 }