会员积分代码提交
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
package com.czg.account.dto.points;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 会员积分变动记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
public class MemberPointsLogDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 摘要信息(如:兑换某个商品/消费多少钱/充值多少钱/新会员赠送积分等)
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 浮动类型 add-累加 subtract-扣减
|
||||
*/
|
||||
private String floatType;
|
||||
/**
|
||||
* 浮动积分(非0正负数)
|
||||
*/
|
||||
private Integer floatPoints;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String headImg;
|
||||
/**
|
||||
* 用户手机号码
|
||||
*/
|
||||
private String phone;
|
||||
/**
|
||||
* 查询开始日期 yyyy-MM-dd
|
||||
*/
|
||||
private String beginDate;
|
||||
/**
|
||||
* 查询结束日期 yyyy-MM-dd
|
||||
*/
|
||||
private String endDate;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.czg.account.dto.points;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 获取会员可用积分
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2024-10-26 11:40
|
||||
*/
|
||||
@Data
|
||||
public class OrderDeductionPointsDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 本单最多可抵扣多少积分
|
||||
*/
|
||||
private Integer maxUsablePoints;
|
||||
/**
|
||||
* 根据策略计算出的最少可以抵扣的金额
|
||||
*/
|
||||
private BigDecimal minDeductionAmount;
|
||||
/**
|
||||
* 根据策略计算出的最多可以抵扣的金额
|
||||
*/
|
||||
private BigDecimal maxDeductionAmount;
|
||||
/**
|
||||
* 下单实付抵扣门槛(实付金额不低于这个值)
|
||||
*/
|
||||
private BigDecimal minPaymentAmount;
|
||||
/**
|
||||
* 下单积分抵扣门槛(每次使用不低于这个值)
|
||||
*/
|
||||
private Integer minDeductionPoints;
|
||||
/**
|
||||
* 会员账户积分
|
||||
*/
|
||||
private Integer accountPoints;
|
||||
/**
|
||||
* 订单金额 (扣除各类折扣)
|
||||
*/
|
||||
private BigDecimal orderAmount;
|
||||
/**
|
||||
* 使用的积分数量
|
||||
*/
|
||||
private Integer usedPoints;
|
||||
/**
|
||||
* 实际抵扣的金额
|
||||
*/
|
||||
private Integer deductionAmount;
|
||||
/**
|
||||
* 下单抵扣积分比例 1元=?积分
|
||||
*/
|
||||
private Integer equivalentPoints;
|
||||
/**
|
||||
* 不可抵扣原因
|
||||
*/
|
||||
private String unusableReason;
|
||||
/**
|
||||
* 是否可用 1-可用 0-不可用
|
||||
*/
|
||||
private Boolean usable;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.czg.account.dto.points;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import jakarta.validation.constraints.DecimalMax;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 积分基本设置
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
public class PointsBasicSettingDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
@NotNull(message = "店铺id不能为空", groups = InsertGroup.class)
|
||||
private Long shopId;
|
||||
/**
|
||||
* 开启消费赠送积分 1-开启 0-关闭
|
||||
*/
|
||||
@NotNull(message = "开启消费赠送积分不能为空", groups = DefaultGroup.class)
|
||||
private Integer enableRewards;
|
||||
/**
|
||||
* 赠积分适用群体 all-全部 vip-仅会员
|
||||
*/
|
||||
@NotNull(message = "赠积分适用群体不能为空", groups = DefaultGroup.class)
|
||||
private String rewardsGroup;
|
||||
/**
|
||||
* 每消费xx元赠送1积分
|
||||
*/
|
||||
@NotNull(message = "每消费xx元赠送1积分不能为空", groups = DefaultGroup.class)
|
||||
private BigDecimal consumeAmount;
|
||||
/**
|
||||
* 开启下单积分抵扣 1-开启 0-关闭
|
||||
*/
|
||||
@NotNull(message = "开启下单积分抵扣不能为空", groups = DefaultGroup.class)
|
||||
private Integer enableDeduction;
|
||||
/**
|
||||
* 抵扣适用群体 all-全部 vip-仅会员
|
||||
*/
|
||||
@NotBlank(message = "抵扣适用群体不能为空", groups = DefaultGroup.class)
|
||||
private String deductionGroup;
|
||||
/**
|
||||
* 下单实付抵扣门槛
|
||||
*/
|
||||
@NotNull(message = "下单实付抵扣门槛不能为空", groups = DefaultGroup.class)
|
||||
@DecimalMin(value = "0", inclusive = false, message = "下单实付抵扣门槛不能小于0")
|
||||
private BigDecimal minPaymentAmount;
|
||||
/**
|
||||
* 下单最高抵扣比例
|
||||
*/
|
||||
@NotNull(message = "下单最高抵扣比例不能为空", groups = DefaultGroup.class)
|
||||
@DecimalMin(value = "0", inclusive = false, message = "下单最高抵扣比例不能小于等于0")
|
||||
@DecimalMax(value = "100", message = "下单最高抵扣比例不能大于100")
|
||||
private BigDecimal maxDeductionRatio;
|
||||
/**
|
||||
* 下单抵扣积分比例 1元=?积分
|
||||
*/
|
||||
@NotNull(message = "下单抵扣积分比例不能为空", groups = DefaultGroup.class)
|
||||
private Integer equivalentPoints;
|
||||
/**
|
||||
* 开启积分商城
|
||||
*/
|
||||
@NotNull(message = "开启积分商城不能为空", groups = DefaultGroup.class)
|
||||
private Integer enablePointsMall;
|
||||
/**
|
||||
* 浏览模式 list-列表 grid-宫格
|
||||
*/
|
||||
@NotBlank(message = "浏览模式不能为空", groups = DefaultGroup.class)
|
||||
private String browseMode;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
package com.czg.account.dto.points;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 积分兑换记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
public class PointsExchangeRecordDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 积分商品id
|
||||
*/
|
||||
private Long pointsGoodsId;
|
||||
/**
|
||||
* 积分商品名称
|
||||
*/
|
||||
private String pointsGoodsName;
|
||||
/**
|
||||
* 商品图片URL
|
||||
*/
|
||||
private String goodsImageUrl;
|
||||
/**
|
||||
* 领取方式 self-自取 post-邮寄
|
||||
*/
|
||||
private String pickupMethod;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 会员头像
|
||||
*/
|
||||
private String avatarUrl;
|
||||
/**
|
||||
* 消耗积分
|
||||
*/
|
||||
private Integer spendPoints;
|
||||
/**
|
||||
* 额外支付
|
||||
*/
|
||||
private BigDecimal extraPaymentAmount;
|
||||
/**
|
||||
* 兑换券券码
|
||||
*/
|
||||
private String couponCode;
|
||||
/**
|
||||
* 支付平台订单号
|
||||
*/
|
||||
private String payOrderId;
|
||||
/**
|
||||
* 渠道订单号(微信/支付宝订单号)
|
||||
*/
|
||||
private String channelTradeNo;
|
||||
/**
|
||||
* 支付方式 积分支付/积分+微信/积分+支付宝
|
||||
*/
|
||||
private String payMethod;
|
||||
/**
|
||||
* 支付类型 POINTS-积分 WECHAT-微信 ALIPAY-支付宝 UNIONPAY-银联云闪付
|
||||
*/
|
||||
private String payType;
|
||||
/**
|
||||
* 状态 unpaid-待支付 waiting-待自取 done-已完成 cancel-已取消
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 取消/退款原因
|
||||
*/
|
||||
private String cancelOrRefundReason;
|
||||
/**
|
||||
* 取消/退款时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime cancelOrRefundTime;
|
||||
/**
|
||||
* 实际支付时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime payTime;
|
||||
/**
|
||||
* 创建时间(下单时间)
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间(核销时间)
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.czg.account.dto.points;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.czg.validator.group.DefaultGroup;
|
||||
import com.czg.validator.group.InsertGroup;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Null;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 积分商品设置
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
public class PointsGoodsSettingDTO implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Null(message = "ID必须为空", groups = InsertGroup.class)
|
||||
@NotNull(message = "ID不能为空", groups = UpdateGroup.class)
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
@NotNull(message = "店铺id不能为空", groups = DefaultGroup.class)
|
||||
private Long shopId;
|
||||
/**
|
||||
* 商品类型 physical-实物 coupon-优惠劵
|
||||
*/
|
||||
@NotBlank(message = "商品类型不能为空", groups = DefaultGroup.class)
|
||||
private String goodsCategory;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
@NotBlank(message = "商品名称不能为空", groups = DefaultGroup.class)
|
||||
private String goodsName;
|
||||
/**
|
||||
* 商品图片URL
|
||||
*/
|
||||
private String goodsImageUrl;
|
||||
/**
|
||||
* 所需积分
|
||||
*/
|
||||
@NotNull(message = "所需积分不能为空", groups = DefaultGroup.class)
|
||||
private Integer requiredPoints;
|
||||
/**
|
||||
* 额外价格
|
||||
*/
|
||||
@NotNull(message = "额外价格不能为空", groups = DefaultGroup.class)
|
||||
private BigDecimal extraPrice;
|
||||
/**
|
||||
* 排序(权重),数字越高,显示约靠前
|
||||
*/
|
||||
@NotNull(message = "排序(权重)不能为空", groups = DefaultGroup.class)
|
||||
private Integer sort;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
@NotNull(message = "数量不能为空", groups = DefaultGroup.class)
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 商品详情
|
||||
*/
|
||||
private String goodsDescription;
|
||||
/**
|
||||
* 累计兑换数量
|
||||
*/
|
||||
private Integer totalExchangeCount;
|
||||
/**
|
||||
* 是否上架 1-是 0-否
|
||||
*/
|
||||
@NotNull(message = "是否上架不能为空", groups = DefaultGroup.class)
|
||||
private Integer status;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 逻辑删除标志 1-是 0-否
|
||||
*/
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.czg.account.entity;
|
||||
|
||||
import com.alibaba.fastjson2.annotation.JSONField;
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 会员积分
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 2.0 2024-10-25
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_shop_user")
|
||||
public class MemberPoints implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 会员id
|
||||
*/
|
||||
@Column(value = "id")
|
||||
private Long userId;
|
||||
/**
|
||||
* 会员名称
|
||||
*/
|
||||
@Column("nick_name")
|
||||
private String nickName;
|
||||
/**
|
||||
* 会员头像
|
||||
*/
|
||||
@Column("head_img")
|
||||
private String headImg;
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
@Column("phone")
|
||||
private String phone;
|
||||
/**
|
||||
* 账户积分
|
||||
*/
|
||||
@Column("account_points")
|
||||
private Integer accountPoints;
|
||||
/**
|
||||
* 最近一次积分变动时间
|
||||
*/
|
||||
@Column("last_points_change_time")
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastPointsChangeTime;
|
||||
/**
|
||||
* 最近一次浮动积分
|
||||
*/
|
||||
@Column("last_float_points")
|
||||
private Integer lastFloatPoints;
|
||||
/**
|
||||
* 是否会员 1-是 0-否
|
||||
*/
|
||||
@Column("is_vip")
|
||||
private Integer vip;
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.czg.account.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 会员积分变动记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_member_points_log")
|
||||
public class MemberPointsLog implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 摘要信息(如:兑换某个商品/消费多少钱/充值多少钱/新会员赠送积分等)
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 浮动类型 add-累加 subtract-扣减
|
||||
*/
|
||||
private String floatType;
|
||||
/**
|
||||
* 浮动积分(非0正负数)
|
||||
*/
|
||||
private Integer floatPoints;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -4,17 +4,16 @@ 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.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 积分基本设置 实体类。
|
||||
*
|
||||
@@ -34,7 +33,7 @@ public class PointsBasicSetting implements Serializable {
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
@Id(keyType = KeyType.Auto)
|
||||
@Id(keyType = KeyType.None)
|
||||
private Long shopId;
|
||||
|
||||
/**
|
||||
@@ -90,7 +89,7 @@ public class PointsBasicSetting implements Serializable {
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
package com.czg.account.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import com.mybatisflex.core.keygen.KeyGenerators;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 积分兑换记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_points_exchange_record")
|
||||
public class PointsExchangeRecord implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
|
||||
private Long id;
|
||||
/**
|
||||
* 订单编号
|
||||
*/
|
||||
private String orderNo;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 积分商品id
|
||||
*/
|
||||
private Long pointsGoodsId;
|
||||
/**
|
||||
* 积分商品名称
|
||||
*/
|
||||
private String pointsGoodsName;
|
||||
/**
|
||||
* 商品图片URL
|
||||
*/
|
||||
private String goodsImageUrl;
|
||||
/**
|
||||
* 领取方式 self-自取 post-邮寄
|
||||
*/
|
||||
private String pickupMethod;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
/**
|
||||
* 手机号码
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 会员头像
|
||||
*/
|
||||
private String avatarUrl;
|
||||
/**
|
||||
* 消耗积分
|
||||
*/
|
||||
private Integer spendPoints;
|
||||
/**
|
||||
* 额外支付
|
||||
*/
|
||||
private BigDecimal extraPaymentAmount;
|
||||
/**
|
||||
* 兑换券券码
|
||||
*/
|
||||
private String couponCode;
|
||||
/**
|
||||
* 支付平台订单号
|
||||
*/
|
||||
private String payOrderId;
|
||||
/**
|
||||
* 渠道订单号(微信/支付宝订单号)
|
||||
*/
|
||||
private String channelTradeNo;
|
||||
/**
|
||||
* 支付方式 积分支付/积分+微信/积分+支付宝
|
||||
*/
|
||||
private String payMethod;
|
||||
/**
|
||||
* 支付类型 POINTS-积分 WECHAT-微信 ALIPAY-支付宝 UNIONPAY-银联云闪付
|
||||
*/
|
||||
private String payType;
|
||||
/**
|
||||
* 状态 unpaid-待支付 waiting-待自取 done-已完成 cancel-已取消
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 取消/退款原因
|
||||
*/
|
||||
private String cancelOrRefundReason;
|
||||
/**
|
||||
* 取消/退款时间
|
||||
*/
|
||||
private LocalDateTime cancelOrRefundTime;
|
||||
/**
|
||||
* 实际支付时间
|
||||
*/
|
||||
private LocalDateTime payTime;
|
||||
/**
|
||||
* 创建时间(下单时间)
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间(核销时间)
|
||||
*/
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 次数
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
private Long count;
|
||||
/**
|
||||
* 总额
|
||||
*/
|
||||
@Column(ignore = true)
|
||||
private BigDecimal totalAmount;
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.czg.account.entity;
|
||||
|
||||
import com.mybatisflex.annotation.Column;
|
||||
import com.mybatisflex.annotation.Id;
|
||||
import com.mybatisflex.annotation.KeyType;
|
||||
import com.mybatisflex.annotation.Table;
|
||||
import com.mybatisflex.core.keygen.KeyGenerators;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 积分商品设置
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
@Data
|
||||
@Table("tb_points_goods_setting")
|
||||
public class PointsGoodsSetting implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@Id(keyType = KeyType.Generator, value = KeyGenerators.snowFlakeId)
|
||||
private Long id;
|
||||
/**
|
||||
* 店铺id
|
||||
*/
|
||||
private Long shopId;
|
||||
/**
|
||||
* 商品类型 physical-实物 coupon-优惠劵
|
||||
*/
|
||||
private String goodsCategory;
|
||||
/**
|
||||
* 商品名称
|
||||
*/
|
||||
private String goodsName;
|
||||
/**
|
||||
* 商品图片URL
|
||||
*/
|
||||
private String goodsImageUrl;
|
||||
/**
|
||||
* 所需积分
|
||||
*/
|
||||
private Integer requiredPoints;
|
||||
/**
|
||||
* 额外价格
|
||||
*/
|
||||
private BigDecimal extraPrice;
|
||||
/**
|
||||
* 排序(权重),数字越高,显示约靠前
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
private Integer quantity;
|
||||
/**
|
||||
* 商品详情
|
||||
*/
|
||||
private String goodsDescription;
|
||||
/**
|
||||
* 累计兑换数量
|
||||
*/
|
||||
private Integer totalExchangeCount;
|
||||
/**
|
||||
* 是否上架 1-是 0-否
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()")
|
||||
private LocalDateTime createTime;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@Column(onInsertValue = "now()", onUpdateValue = "now()")
|
||||
private LocalDateTime updateTime;
|
||||
/**
|
||||
* 逻辑删除标志 1-是 0-否
|
||||
*/
|
||||
@Column(onInsertValue = "0")
|
||||
private Integer delFlag;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.czg.account.enums;
|
||||
|
||||
/**
|
||||
* 抵扣适用群体枚举
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-02-25 17:50
|
||||
*/
|
||||
public enum PointUserGroupEnum {
|
||||
/**
|
||||
* 全部用户
|
||||
*/
|
||||
ALL("all"),
|
||||
|
||||
/**
|
||||
* 仅会员
|
||||
*/
|
||||
VIP("vip");
|
||||
|
||||
private String value;
|
||||
|
||||
PointUserGroupEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.czg.account.enums;
|
||||
|
||||
/**
|
||||
* 积分兑换状态枚举
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-02-25 15:37
|
||||
*/
|
||||
public enum PointsExchangeStatusEnum {
|
||||
/**
|
||||
* 待支付
|
||||
*/
|
||||
UNPAID("unpaid"),
|
||||
/**
|
||||
* 待自取
|
||||
*/
|
||||
WAITING("waiting"),
|
||||
/**
|
||||
* 已完成
|
||||
*/
|
||||
DONE("done"),
|
||||
/**
|
||||
* 已取消
|
||||
*/
|
||||
CANCEL("cancel");
|
||||
|
||||
private String value;
|
||||
|
||||
PointsExchangeStatusEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String value() {
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.czg.account.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 消费赠送积分入参
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-02-25 18:20
|
||||
*/
|
||||
@Data
|
||||
public class ConsumeAwardPointsParam implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 订单ID
|
||||
*/
|
||||
private Long orderId;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.czg.account.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 会员积分查询入参
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-02-25 17:18
|
||||
*/
|
||||
@Data
|
||||
public class MemberPointsParam implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
private String nickName;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.czg.account.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 支付完成扣减积分入参
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-02-25 18:07
|
||||
*/
|
||||
@Data
|
||||
public class PayedDeductPointsParam implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 消耗积分
|
||||
*/
|
||||
private Integer points;
|
||||
/**
|
||||
* 摘要信息(如:兑换某个商品/消费多少钱/充值多少钱/新会员赠送积分等)
|
||||
*/
|
||||
private String content;
|
||||
/**
|
||||
* 订单ID(可为空)
|
||||
*/
|
||||
private Long orderId;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.czg.account.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 积分兑换 - 取消/退款入参
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-02-25 15:29
|
||||
*/
|
||||
@Data
|
||||
public class PointsExchangeCfParam implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
/**
|
||||
* 取消或退款原因
|
||||
*/
|
||||
private String cancelOrRefundReason;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.czg.account.param;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 兑换记录查询入侵
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-02-25 14:08
|
||||
*/
|
||||
@Data
|
||||
public class PointsExchangeRecordParam implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 查询关键字
|
||||
*/
|
||||
private String keywords;
|
||||
/**
|
||||
* 查询开始日期 格式 yyyy-MM-dd
|
||||
*/
|
||||
private String beginDate;
|
||||
/**
|
||||
* 查询结束日期 格式 yyyy-MM-dd
|
||||
*/
|
||||
private String endDate;
|
||||
/**
|
||||
* 领取方式 self-自取 post-邮寄
|
||||
*/
|
||||
private String pickupMethod;
|
||||
/**
|
||||
* 状态 unpaid-待支付 waiting-待自取 done-已完成 cancel-已取消
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 用户id
|
||||
*/
|
||||
private Long userId;
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.points.MemberPointsLogDTO;
|
||||
import com.czg.account.entity.MemberPointsLog;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
/**
|
||||
* 会员积分变动记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
public interface MemberPointsLogService extends IService<MemberPointsLog> {
|
||||
|
||||
Page<MemberPointsLogDTO> getMemberPointsLogPage(MemberPointsLogDTO param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,99 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.points.OrderDeductionPointsDTO;
|
||||
import com.czg.account.entity.MemberPoints;
|
||||
import com.czg.account.param.MemberPointsParam;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 会员积分
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
public interface MemberPointsService extends IService<MemberPoints> {
|
||||
|
||||
/**
|
||||
* 会员积分分页
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
Page<MemberPoints> getMemberPointsPage(MemberPointsParam param);
|
||||
|
||||
/**
|
||||
* 初始化会员积分
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return 会员积分等信息
|
||||
*/
|
||||
MemberPoints initMemberPoints(Long userId);
|
||||
|
||||
/**
|
||||
* 获取会员积分等信息
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return 会员积分等信息
|
||||
*/
|
||||
MemberPoints getMemberPoints(Long userId);
|
||||
|
||||
/**
|
||||
* 根据用户id及订单金额计算可抵扣积分及可抵扣金额
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param orderAmount 订单金额
|
||||
* @return 积分及金额
|
||||
*/
|
||||
OrderDeductionPointsDTO getMemberUsablePoints(Long userId, BigDecimal orderAmount);
|
||||
|
||||
/**
|
||||
* 根据抵扣金额计算抵扣积分
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param orderAmount 订单金额
|
||||
* @param deductionAmount 抵扣金额
|
||||
*/
|
||||
int calcUsedPoints(Long userId, BigDecimal orderAmount, BigDecimal deductionAmount);
|
||||
|
||||
/**
|
||||
* 根据抵扣积分计算抵扣金额
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param orderAmount 订单金额
|
||||
* @param points 抵扣积分
|
||||
*/
|
||||
BigDecimal calcDeductionAmount(Long userId, BigDecimal orderAmount, int points);
|
||||
|
||||
/**
|
||||
* 扣除积分
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param points 积分
|
||||
* @param content 摘要信息(如:兑换积分商品/积分抵扣账单/消费赠送积分/新会员送积分/储值赠送积分)
|
||||
* @param orderId 订单id,可以为空
|
||||
*/
|
||||
boolean deductPoints(Long userId, int points, String content, Long orderId);
|
||||
|
||||
/**
|
||||
* 追加积分
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param points 积分
|
||||
* @param content 摘要信息(如:兑换积分商品/积分抵扣账单/消费赠送积分/新会员送积分/储值赠送积分)
|
||||
* @param orderId 订单id,可以为空
|
||||
* @return 成功/失败
|
||||
*/
|
||||
boolean addPoints(Long userId, int points, String content, Long orderId);
|
||||
|
||||
/**
|
||||
* 消费赠送积分
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param orderId 订单id
|
||||
*/
|
||||
void consumeAwardPoints(Long userId, Long orderId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.points.PointsExchangeRecordDTO;
|
||||
import com.czg.account.entity.PointsExchangeRecord;
|
||||
import com.czg.account.param.PointsExchangeCfParam;
|
||||
import com.czg.account.param.PointsExchangeRecordParam;
|
||||
import com.czg.account.vo.PointsExchangeSummaryVo;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
/**
|
||||
* 积分兑换记录
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
public interface PointsExchangeRecordService extends IService<PointsExchangeRecord> {
|
||||
|
||||
/**
|
||||
* 获取积分兑换记录分页
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return 分页数据
|
||||
*/
|
||||
Page<PointsExchangeRecordDTO> getPointsExchangeRecordPage(PointsExchangeRecordParam param);
|
||||
|
||||
/**
|
||||
* 获取积分兑换记录详情
|
||||
*
|
||||
* @param id 兑换记录id
|
||||
* @return 兑换记录详情
|
||||
*/
|
||||
PointsExchangeRecordDTO getPointsExchangeRecordById(Long id);
|
||||
|
||||
/**
|
||||
* 核销券码
|
||||
*
|
||||
* @param couponCode 券码
|
||||
*/
|
||||
void checkout(String couponCode);
|
||||
|
||||
/**
|
||||
* 取消
|
||||
*
|
||||
* @param param 兑换记录
|
||||
*/
|
||||
void cancel(PointsExchangeCfParam param);
|
||||
|
||||
/**
|
||||
* 退款
|
||||
*
|
||||
* @param param 兑换记录
|
||||
*/
|
||||
void refund(PointsExchangeCfParam param);
|
||||
|
||||
/**
|
||||
* 统计兑换记录
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return 统计结果
|
||||
*/
|
||||
PointsExchangeSummaryVo total(PointsExchangeRecordParam param);
|
||||
|
||||
/**
|
||||
* 自动取消
|
||||
*/
|
||||
void authCancel();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.czg.account.service;
|
||||
|
||||
import com.czg.account.dto.points.PointsGoodsSettingDTO;
|
||||
import com.czg.account.entity.PointsGoodsSetting;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.service.IService;
|
||||
|
||||
/**
|
||||
* 积分商品设置
|
||||
*
|
||||
* @author Tankaikai tankaikai@aliyun.com
|
||||
* @since 1.0 2025-02-25
|
||||
*/
|
||||
public interface PointsGoodsSettingService extends IService<PointsGoodsSetting> {
|
||||
/**
|
||||
* 获取积分商品设置分页
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return 分页结果
|
||||
*/
|
||||
Page<PointsGoodsSettingDTO> getPointsGoodsSettingPage(PointsGoodsSettingDTO param);
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.czg.account.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 积分兑换汇总VO
|
||||
*
|
||||
* @author tankaikai
|
||||
* @since 2025-02-25 14:05
|
||||
*/
|
||||
@Data
|
||||
public class PointsExchangeSummaryVo implements Serializable {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 次数
|
||||
*/
|
||||
private Long count;
|
||||
/**
|
||||
* 金额
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
}
|
||||
Reference in New Issue
Block a user