群聊优惠券
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
|
||||
package com.czg.market.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.experimental.Accessors;
|
||||
import java.io.Serial;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-12-02
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Accessors(chain = true)
|
||||
public class ChatCouponDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 自定义文案
|
||||
*/
|
||||
@NotBlank(message = "自定义文案不能为空")
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 每人领取限量 默认1
|
||||
*/
|
||||
private Integer getLimit;
|
||||
|
||||
/**
|
||||
* 发放数量,-10086为不限量
|
||||
*/
|
||||
private Integer giveNum;
|
||||
/**
|
||||
* 券id
|
||||
*/
|
||||
@NotNull(message = "券id不能为空")
|
||||
private Long couponId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.czg.market.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description 群聊优惠券发放DTO
|
||||
*/
|
||||
@Data
|
||||
public class ChatCouponGrantDTO {
|
||||
|
||||
/**
|
||||
* 活动ID
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺用户ID
|
||||
*/
|
||||
private Long shopUserId;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.czg.market.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 实体类。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-12-02
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Table("chat_coupon")
|
||||
public class ChatCoupon implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 店铺Id
|
||||
*/
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
* 自定义文案
|
||||
*/
|
||||
private String title;
|
||||
|
||||
/**
|
||||
* 每人领取限量 默认1长
|
||||
*/
|
||||
private Integer getLimit;
|
||||
|
||||
/**
|
||||
* 发放数量,-10086为不限量
|
||||
*/
|
||||
private Integer giveNum;
|
||||
|
||||
/**
|
||||
* 剩余数量
|
||||
*/
|
||||
private Integer leftNum;
|
||||
|
||||
/**
|
||||
* 已使用数量
|
||||
*/
|
||||
private Integer useNum;
|
||||
|
||||
/**
|
||||
* 券id
|
||||
*/
|
||||
private Long couponId;
|
||||
/**
|
||||
* 优惠券json mk_shop_coupon_record 表的json字段
|
||||
*/
|
||||
private String couponJson;
|
||||
/**
|
||||
* 状态 1-发放中 3-已失效
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 删除状态 0-正常 1-已删除
|
||||
*/
|
||||
private Integer isDel;
|
||||
|
||||
}
|
||||
@@ -125,7 +125,7 @@ public class ShopCoupon implements Serializable {
|
||||
private String getType;
|
||||
|
||||
/**
|
||||
* 用户领取方式
|
||||
* 用户领取方式 首页home/用餐eat/订单order
|
||||
*/
|
||||
private String getMode;
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.czg.market.service;
|
||||
|
||||
import com.czg.market.dto.ChatCouponDTO;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.czg.market.vo.ChatCouponVO;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.market.entity.ChatCoupon;
|
||||
|
||||
/**
|
||||
* 服务层。
|
||||
*
|
||||
* @author ww
|
||||
* @since 2025-12-02
|
||||
*/
|
||||
public interface ChatCouponService extends IService<ChatCoupon> {
|
||||
|
||||
/**
|
||||
* 创建聊天优惠券发放活动
|
||||
*/
|
||||
void createChatCoupon(Long shopId, ChatCouponDTO chatCoupon);
|
||||
|
||||
/**
|
||||
* 分页查询聊天优惠券发放活动
|
||||
*/
|
||||
Page<ChatCouponVO> pageChatCoupon(Long shopId, Integer page, Integer size, Integer status);
|
||||
|
||||
/**
|
||||
* 失效
|
||||
*/
|
||||
void expiredChatCoupon(Long shopId, Long id);
|
||||
|
||||
/**
|
||||
* 发放优惠券
|
||||
*/
|
||||
void grantChatCoupon(Long id, Long shopUserId, Long userId);
|
||||
|
||||
/**
|
||||
* 分页查询优惠券发放记录
|
||||
*/
|
||||
Page<MkShopCouponRecord> grantChatCouponRecord(Long id, Integer status, Integer page, Integer size);
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.czg.account.vo.CouponReceiveVo;
|
||||
import com.czg.account.vo.UserCouponVo;
|
||||
import com.czg.market.dto.*;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.czg.market.entity.ShopCoupon;
|
||||
import com.czg.market.vo.UserCouponVO;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
@@ -65,4 +66,11 @@ public interface MkShopCouponRecordService extends IService<MkShopCouponRecord>
|
||||
|
||||
Boolean grant(Long shopId, MkRewardCouponDTO rewardCouponDTO, String source);
|
||||
|
||||
MkShopCouponRecord assembleRecord(Long chatCouponId, ShopCoupon coupon);
|
||||
|
||||
/**
|
||||
* 优惠券发放
|
||||
*/
|
||||
void grantChatCoupon(MkShopCouponRecord record, Integer number);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,12 +3,11 @@ package com.czg.market.service;
|
||||
import com.czg.account.vo.ShopInfoCouponVO;
|
||||
import com.czg.account.vo.UserCouponVo;
|
||||
import com.czg.market.dto.ShopCouponDTO;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.czg.market.entity.ShopCoupon;
|
||||
import com.czg.market.vo.ShopCouponPopUp;
|
||||
import com.czg.market.vo.UserCouponVO;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
import com.czg.market.entity.ShopCoupon;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -19,6 +18,14 @@ import java.util.List;
|
||||
* @since 2025-09-11
|
||||
*/
|
||||
public interface ShopCouponService extends IService<ShopCoupon> {
|
||||
/**
|
||||
* 群聊可发放优惠券列表
|
||||
*
|
||||
* @param shopId 店铺id
|
||||
* @param search 优惠券名称模糊搜索
|
||||
*/
|
||||
Page<ShopCouponDTO> chatCoupon(Long shopId, String search);
|
||||
|
||||
Page<ShopCouponDTO> getCouponPage(ShopCouponDTO param);
|
||||
|
||||
List<ShopCouponPopUp> getPopUp(Long shopId, Long userId, String getMode);
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.czg.market.vo;
|
||||
|
||||
import com.czg.market.entity.ChatCoupon;
|
||||
|
||||
/**
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
public class ChatCouponVO extends ChatCoupon {
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user