diff --git a/sql/mysql/member_poinit_20230809积分四张表结构调整.sql b/sql/mysql/member_poinit_20230809积分四张表结构调整.sql deleted file mode 100644 index 86483d77f..000000000 --- a/sql/mysql/member_poinit_20230809积分四张表结构调整.sql +++ /dev/null @@ -1,140 +0,0 @@ -/* - Navicat Premium Data Transfer - - Source Server : docer-master-root(3308) - Source Server Type : MySQL - Source Server Version : 80030 - Source Host : 10.211.55.5:3308 - Source Schema : mall - - Target Server Type : MySQL - Target Server Version : 80030 - File Encoding : 65001 - - Date: 09/08/2023 22:41:36 -*/ - -SET NAMES utf8mb4; -SET FOREIGN_KEY_CHECKS = 0; - --- ---------------------------- --- Table structure for member_point_config --- ---------------------------- -DROP TABLE IF EXISTS `member_point_config`; -CREATE TABLE `member_point_config` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `trade_deduct_enable` bit(1) DEFAULT NULL COMMENT '1 开启积分抵扣\n0 关闭积分抵扣', - `trade_deduct_unit_price` int DEFAULT NULL COMMENT '积分抵扣(单位:分)', - `trade_deduct_max_price` int DEFAULT NULL COMMENT '积分抵扣最大值', - `trade_give_point` int DEFAULT NULL COMMENT '1元赠送多少分', - `creator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建人', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `updater` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '更新人', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '变更时间', - `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户id', - `deleted` bit(1) DEFAULT b'0' COMMENT '是否被删除 0 未删除 1已删除', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='会员积分配置表'; - --- ---------------------------- --- Records of member_point_config --- ---------------------------- -BEGIN; -INSERT INTO `member_point_config` (`id`, `trade_deduct_enable`, `trade_deduct_unit_price`, `trade_deduct_max_price`, `trade_give_point`, `creator`, `create_time`, `updater`, `update_time`, `tenant_id`, `deleted`) VALUES (5, b'1', 12504, 1234, 1234, '1', '2023-08-09 22:27:42', '1', '2023-08-09 22:32:55', '1', b'0'); -COMMIT; - --- ---------------------------- --- Table structure for member_point_record --- ---------------------------- -DROP TABLE IF EXISTS `member_point_record`; -CREATE TABLE `member_point_record` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键', - `biz_id` varchar(255) DEFAULT NULL COMMENT '业务编码', - `biz_type` varchar(255) DEFAULT NULL COMMENT '业务类型', - `title` varchar(255) DEFAULT NULL COMMENT '积分标题', - `description` varchar(5000) DEFAULT NULL COMMENT '积分描述', - `point` int DEFAULT NULL COMMENT '积分', - `total_point` int NOT NULL COMMENT '变动后的积分', - `status` int DEFAULT NULL COMMENT '状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款)\n', - `user_id` bigint DEFAULT NULL COMMENT '用户id', - `freezing_time` datetime DEFAULT NULL COMMENT '冻结时间', - `thawing_time` datetime DEFAULT NULL COMMENT '解冻时间', - `create_time` datetime DEFAULT NULL COMMENT '发生时间', - `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户', - `deleted` int DEFAULT '0' COMMENT '是否删除', - `creator` varchar(255) DEFAULT NULL COMMENT '创建用户', - `updater` varchar(255) DEFAULT NULL COMMENT '更新用户', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - PRIMARY KEY (`id`), - KEY `index_userId` (`user_id`), - KEY `index_title` (`title`) USING BTREE -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户积分记录'; - --- ---------------------------- --- Records of member_point_record --- ---------------------------- -BEGIN; -INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `status`, `user_id`, `freezing_time`, `thawing_time`, `create_time`, `tenant_id`, `deleted`, `creator`, `updater`, `update_time`) VALUES (1, '1', '1', '12', NULL, 212, 12, 1, 247, '2023-06-13 00:00:00', '2023-06-20 00:00:00', '2023-06-10 12:38:48', '1', 1, '1', '1', '2023-08-09 12:30:36'); -INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `status`, `user_id`, `freezing_time`, `thawing_time`, `create_time`, `tenant_id`, `deleted`, `creator`, `updater`, `update_time`) VALUES (2, '12', '1', '这是一个测试', '我是描述', 1212, 12, 2, 247, '2023-06-28 00:00:00', NULL, '2023-06-10 12:42:48', '1', 0, '1', '1', '2023-08-09 12:31:45'); -INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `status`, `user_id`, `freezing_time`, `thawing_time`, `create_time`, `tenant_id`, `deleted`, `creator`, `updater`, `update_time`) VALUES (3, '12', '1', '12', '我是一个描述', 12, 12, 1, 248, '2023-06-27 00:00:00', '2023-06-23 00:00:00', '2023-06-10 20:06:48', '1', 0, '1', '1', '2023-08-09 12:31:41'); -INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `status`, `user_id`, `freezing_time`, `thawing_time`, `create_time`, `tenant_id`, `deleted`, `creator`, `updater`, `update_time`) VALUES (4, '12', '1', '描述2', '我是一个描述', -12, 12, 1, 248, '2023-08-09 11:21:00', '2023-09-13 00:00:00', '2023-06-10 20:06:48', '1', 0, '1', '1', '2023-08-09 12:57:28'); -COMMIT; - --- ---------------------------- --- Table structure for member_sign_in_config --- ---------------------------- -DROP TABLE IF EXISTS `member_sign_in_config`; -CREATE TABLE `member_sign_in_config` ( - `id` int NOT NULL AUTO_INCREMENT COMMENT '规则自增主键', - `day` int DEFAULT NULL COMMENT '签到第x天', - `point` int DEFAULT NULL COMMENT '签到天数对应分数', - `create_time` datetime DEFAULT NULL COMMENT '创建时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '变更时间', - `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户id', - `enable` tinyint(1) DEFAULT NULL COMMENT '是否启用 1启用,0未启动', - `deleted` int DEFAULT '0' COMMENT '是否删除', - `creator` varchar(255) DEFAULT NULL COMMENT '创建人', - `updater` varchar(255) DEFAULT NULL COMMENT '变更人', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='积分签到规则'; - --- ---------------------------- --- Records of member_sign_in_config --- ---------------------------- -BEGIN; -INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `enable`, `deleted`, `creator`, `updater`) VALUES (1, 4, 10, '2023-06-10 11:34:43', '2023-08-08 15:10:03', '1', 1, 0, '1', '1'); -INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `enable`, `deleted`, `creator`, `updater`) VALUES (2, 2, 20, '2023-06-10 11:34:59', '2023-08-08 13:39:54', '1', 1, 1, '1', '1'); -INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `enable`, `deleted`, `creator`, `updater`) VALUES (3, 7, 1001, '2023-06-10 17:47:45', '2023-08-08 15:09:55', '1', 0, 0, '1', '1'); -INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `enable`, `deleted`, `creator`, `updater`) VALUES (4, 6, 12121, '2023-06-10 17:47:55', '2023-08-08 15:09:47', '1', 0, 0, '1', '1'); -INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `enable`, `deleted`, `creator`, `updater`) VALUES (5, 2, 12, '2023-06-10 19:54:52', '2023-08-08 15:10:03', '1', 1, 0, '1', '1'); -COMMIT; - --- ---------------------------- --- Table structure for member_sign_in_record --- ---------------------------- -DROP TABLE IF EXISTS `member_sign_in_record`; -CREATE TABLE `member_sign_in_record` ( - `id` bigint NOT NULL AUTO_INCREMENT COMMENT '签到自增id', - `user_id` bigint DEFAULT NULL COMMENT '签到用户', - `day` int DEFAULT NULL COMMENT '第几天签到', - `point` int DEFAULT NULL COMMENT '签到的分数', - `create_time` datetime DEFAULT NULL COMMENT '签到时间', - `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '变更时间', - `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户id', - `deleted` int DEFAULT '0' COMMENT '是否删除', - `creator` varchar(255) DEFAULT NULL COMMENT '创建人', - `updater` varchar(255) DEFAULT NULL COMMENT '更新人', - PRIMARY KEY (`id`) -) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户签到积分'; - --- ---------------------------- --- Records of member_sign_in_record --- ---------------------------- -BEGIN; -INSERT INTO `member_sign_in_record` (`id`, `user_id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (1, 247, 1, 123, '2023-06-10 12:58:18', '2023-08-09 08:51:31', '1', 1, '1', '1'); -INSERT INTO `member_sign_in_record` (`id`, `user_id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (2, 247, 12, 12, '2023-06-10 19:56:39', '2023-08-09 08:51:32', '1', 1, '1', '1'); -INSERT INTO `member_sign_in_record` (`id`, `user_id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (3, 1, 12, 1212, '2023-06-10 20:01:17', '2023-08-09 08:05:07', '1', 1, '1', '1'); -INSERT INTO `member_sign_in_record` (`id`, `user_id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (4, 247, 12, 1212, '2023-06-10 20:01:27', '2023-08-09 08:51:34', '1', 0, '1', '1'); -COMMIT; - -SET FOREIGN_KEY_CHECKS = 1; diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/point/MemberPointBizTypeEnum.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/point/MemberPointBizTypeEnum.java new file mode 100644 index 000000000..65e4c6c34 --- /dev/null +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/point/MemberPointBizTypeEnum.java @@ -0,0 +1,34 @@ +package cn.iocoder.yudao.module.member.enums.point; + +import cn.iocoder.yudao.framework.common.core.IntArrayValuable; +import lombok.AllArgsConstructor; +import lombok.Getter; + +/** + * 会员积分的业务类型枚举 + * + * @author 芋道源码 + */ +@AllArgsConstructor +@Getter +public enum MemberPointBizTypeEnum implements IntArrayValuable { + + SIGN(1, "签到"), + ORDER_BUY(10, "订单消费"), + ORDER_CANCEL(11, "订单取消"); // 退回积分 + + /** + * 类型 + */ + private final Integer type; + /** + * 名字 + */ + private final String name; + + @Override + public int[] array() { + return new int[0]; + } + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java index 1e46bfc2b..705b72ec3 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java @@ -16,12 +16,9 @@ public class MemberPointRecordPageReqVO extends PageParam { private String nickname; @Schema(description = "业务类型", example = "1") - private String bizType; + private Integer bizType; @Schema(description = "积分标题", example = "呵呵") private String title; - @Schema(description = "积分状态", example = "1") - private Integer status; - } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java index cc5de30e5..6714aa87f 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java @@ -1,14 +1,10 @@ package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.*; -import org.springframework.format.annotation.DateTimeFormat; +import lombok.Data; -import javax.validation.constraints.NotNull; import java.time.LocalDateTime; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; - @Schema(description = "管理后台 - 用户积分记录 Response VO") @Data public class MemberPointRecordRespVO { @@ -26,7 +22,7 @@ public class MemberPointRecordRespVO { private String bizId; @Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - private String bizType; + private Integer bizType; @Schema(description = "积分标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜") private String title; @@ -40,17 +36,6 @@ public class MemberPointRecordRespVO { @Schema(description = "变动后的积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") private Integer totalPoint; - @Schema(description = "积分状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - private Integer status; - - @Schema(description = "冻结时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime freezingTime; - - @Schema(description = "解冻时间") - @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) - private LocalDateTime thawingTime; - @Schema(description = "发生时间", requiredMode = Schema.RequiredMode.REQUIRED) private LocalDateTime createTime; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java index 53b89383a..f884f08d8 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java @@ -1,13 +1,12 @@ package cn.iocoder.yudao.module.member.dal.dataobject.point; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum; import com.baomidou.mybatisplus.annotation.KeySequence; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; -import java.time.LocalDateTime; - /** * 用户积分记录 DO * @@ -42,10 +41,10 @@ public class MemberPointRecordDO extends BaseDO { /** * 业务类型 * - * 枚举 {@link TODO biz_type 对应枚举,然后改成 int 类型哈} - * TODO @qingxia:这个改成 Integer,然后搞个枚举 + * 枚举 {@link MemberPointBizTypeEnum} */ - private String bizType; + private Integer bizType; + /** * 积分标题 */ @@ -54,29 +53,17 @@ public class MemberPointRecordDO extends BaseDO { * 积分描述 */ private String description; + /** - * 积分 正数表示获得积分 负数表示消耗积分 + * 变动积分 + * + * 1、正数表示获得积分 + * 2、负数表示消耗积分 */ private Integer point; /** * 变动后的积分 */ private Integer totalPoint; - /** - * 状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款) - * - * 枚举 {@link point_status 对应的类} - * TODO @qingxia:搞个枚举 - */ - private Integer status; - - /** - * 冻结时间 - */ - private LocalDateTime freezingTime; - /** - * 解冻时间 - */ - private LocalDateTime thawingTime; } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java index f3b05ebf2..aaaad2563 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java @@ -22,7 +22,6 @@ public interface MemberPointRecordMapper extends BaseMapperX