mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-25 16:51:52 +08:00
会员中心代码、sql脚本提交
1.合并积分模块只member module 2.初始化sql放入mysql/member_point.sql 3.添加会员中/会员积分、会员签到/xxx层级目录 4.删除无用的接口代码
This commit is contained in:
parent
e5c556f106
commit
c7ced55a6c
174
sql/mysql/optional/member_point.sql
Normal file
174
sql/mysql/optional/member_point.sql
Normal file
@ -0,0 +1,174 @@
|
||||
/*
|
||||
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: 28/06/2023 22:40:52
|
||||
*/
|
||||
|
||||
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` bigint 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=4 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 (1, b'1', 0, 10000, 1, '1', '2023-06-10 10:57:22', '1', '2023-06-10 03:06:58', '1', b'1');
|
||||
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 (2, b'1', 32, 10003, 1212, '1', '2023-06-10 11:07:12', '1', '2023-06-28 21:50:34', '1', b'0');
|
||||
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 (3, b'1', 12, 12, 12, '1', '2023-06-10 16:09:26', '1', '2023-06-10 08:10:53', '1', b'1');
|
||||
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 '业务类型',
|
||||
`type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '1增加 0扣减',
|
||||
`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` int 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=4 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`, `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', '1', '12', NULL, 212, 12, 1, 12, '2023-06-13 00:00:00', '2023-06-20 00:00:00', '2023-06-10 12:38:48', '1', 1, '1', '1', '2023-06-10 04:42:24');
|
||||
INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `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', '0', NULL, NULL, 1212, 12, 2, 12, '2023-06-28 00:00:00', NULL, '2023-06-10 12:42:48', '1', 0, '1', '1', '2023-06-10 12:43:04');
|
||||
INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `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', '1', '12', NULL, 12, 12, 1, 12, '2023-06-27 00:00:00', '2023-06-23 00:00:00', '2023-06-10 20:06:48', '1', 0, '1', '1', '2023-06-10 20:06:48');
|
||||
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',
|
||||
`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`, `deleted`, `creator`, `updater`) VALUES (1, 1, 10, '2023-06-10 11:34:43', '2023-06-10 11:34:43', '1', 0, '1', '1');
|
||||
INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (2, 2, 20, '2023-06-10 11:34:59', '2023-06-10 03:55:35', '1', 1, '1', '1');
|
||||
INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (3, 7, 1001, '2023-06-10 17:47:45', '2023-06-10 19:54:37', '1', 0, '1', '1');
|
||||
INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (4, 6, 12121, '2023-06-10 17:47:55', '2023-06-10 19:48:37', '1', 0, '1', '1');
|
||||
INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (5, 2, 12, '2023-06-10 19:54:52', '2023-06-10 19:54:52', '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` int 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, 121, 1, 123, '2023-06-10 12:58:18', '2023-06-10 04:59:00', '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, 12, 12, 12, '2023-06-10 19:56:39', '2023-06-10 11:56:45', '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, 12, 12, 1212, '2023-06-10 20:01:17', '2023-06-10 12:01:23', '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, 12, 12, 1212, '2023-06-10 20:01:27', '2023-06-10 20:01:27', '1', 0, '1', '1');
|
||||
COMMIT;
|
||||
|
||||
|
||||
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (170, '积分业务类型', 'member_point_biz_type', 0, '', '1', '2023-06-10 12:15:00', '1', '2023-06-28 13:48:20', b'0', '1970-01-01 00:00:00');
|
||||
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (171, '积分订单状态', 'member_point_status', 0, '', '1', '2023-06-10 12:16:27', '1', '2023-06-28 13:48:17', b'0', '1970-01-01 00:00:00');
|
||||
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (169, '是否抵扣积分', 'trade_deduct_enable', 0, NULL, '1', '2023-06-10 00:34:12', '1', '2023-06-10 04:14:20', b'1', '2023-06-10 12:14:20');
|
||||
|
||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1235, 1, '购物', '1', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:27', '1', '2023-06-28 13:48:28', b'0');
|
||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1236, 2, '签到', '2', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:48', '1', '2023-06-28 13:48:31', b'0');
|
||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1237, 1, '订单创建', '1', 'member_point_status', 0, '', '', '', '1', '2023-06-10 12:16:42', '1', '2023-06-28 13:48:34', b'0');
|
||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1238, 2, '冻结期', '2', 'member_point_status', 0, '', '', '', '1', '2023-06-10 12:16:58', '1', '2023-06-28 13:48:36', b'0');
|
||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1239, 3, '完成', '3', 'member_point_status', 0, '', '', '', '1', '2023-06-10 12:17:07', '1', '2023-06-28 13:48:38', b'0');
|
||||
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1240, 4, '失效(订单退款)', '4', 'member_point_status', 0, '', '', '', '1', '2023-06-10 12:17:21', '1', '2023-06-28 13:48:42', b'0');
|
||||
|
||||
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2162, '会员中心', '', 1, 55, 0, '/member', 'date-range', NULL, NULL, 0, b'1', b'1', b'1', '1', '2023-06-10 00:42:03', '1', '2023-06-28 21:52:34', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2175, '积分配置', '', 2, 0, 2199, 'config', '', 'member/point/config/index', 'PointConfig', 0, b'1', b'1', b'1', '', '2023-06-10 02:07:44', '1', '2023-06-27 22:50:59', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2176, '积分设置查询', 'point:config:query', 3, 1, 2175, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 02:07:44', '', '2023-06-10 02:07:44', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2177, '积分设置创建', 'point:config:save', 3, 2, 2175, '', '', '', '', 0, b'1', b'1', b'1', '', '2023-06-10 02:07:44', '1', '2023-06-27 20:32:31', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2181, '签到配置', '', 2, 2, 2200, 'sign-in-config', '', 'member/signin/config/index', 'SignInConfig', 0, b'1', b'1', b'1', '', '2023-06-10 03:26:12', '1', '2023-06-27 22:51:45', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2182, '积分签到规则查询', 'point:sign-in-config:query', 3, 1, 2181, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 03:26:12', '', '2023-06-10 03:26:12', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2183, '积分签到规则创建', 'point:sign-in-config:create', 3, 2, 2181, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 03:26:12', '', '2023-06-10 03:26:12', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2184, '积分签到规则更新', 'point:sign-in-config:update', 3, 3, 2181, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 03:26:12', '', '2023-06-10 03:26:12', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2185, '积分签到规则删除', 'point:sign-in-config:delete', 3, 4, 2181, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 03:26:12', '', '2023-06-10 03:26:12', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2186, '积分签到规则导出', 'point:sign-in-config:export', 3, 5, 2181, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 03:26:12', '', '2023-06-10 03:26:12', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2187, '积分记录', '', 2, 1, 2199, 'record', '', 'member/point/record/index', 'PointRecord', 0, b'1', b'1', b'1', '', '2023-06-10 04:18:50', '1', '2023-06-27 22:51:07', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2188, '用户积分记录查询', 'point:record:query', 3, 1, 2187, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 04:18:50', '', '2023-06-10 04:18:50', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2192, '用户积分记录导出', 'point:record:export', 3, 5, 2187, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 04:18:50', '', '2023-06-10 04:18:50', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2193, '签到记录', '', 2, 3, 2200, 'sign-in-record', '', 'member/signin/record/index', 'SignInRecord', 0, b'1', b'1', b'1', '', '2023-06-10 04:48:22', '1', '2023-06-27 22:51:54', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2194, '用户签到积分查询', 'point:sign-in-record:query', 3, 1, 2193, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 04:48:22', '', '2023-06-10 04:48:22', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2197, '用户签到积分删除', 'point:sign-in-record:delete', 3, 4, 2193, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 04:48:22', '', '2023-06-10 04:48:22', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2198, '用户签到积分导出', 'point:sign-in-record:export', 3, 5, 2193, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-06-10 04:48:22', '', '2023-06-10 04:48:22', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2199, '会员积分', '', 1, 1, 2162, 'point', '', '', '', 0, b'1', b'1', b'1', '1', '2023-06-27 22:48:51', '1', '2023-06-27 22:48:51', b'0');
|
||||
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2200, '会员签到', '', 1, 2, 2162, 'signin', '', '', '', 0, b'1', b'1', b'1', '1', '2023-06-27 22:49:53', '1', '2023-06-27 22:49:53', b'0');
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
@ -1,152 +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: 10/06/2023 20:13:57
|
||||
*/
|
||||
|
||||
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` int NOT NULL AUTO_INCREMENT COMMENT '自增主键',
|
||||
`trade_deduct_enable` int DEFAULT NULL COMMENT '1 开启积分抵扣\n0 关闭积分抵扣',
|
||||
`trade_deduct_unit_price` decimal(10,2) DEFAULT NULL COMMENT '积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元)',
|
||||
`trade_deduct_max_price` bigint DEFAULT NULL COMMENT '积分抵扣最大值',
|
||||
`trade_give_point` bigint DEFAULT NULL COMMENT '1元赠送多少分',
|
||||
`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 '是否被删除 0 未删除 1已删除',
|
||||
`creator` varchar(255) DEFAULT NULL COMMENT '创建人',
|
||||
`updater` varchar(255) DEFAULT NULL COMMENT '更新人',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 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`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (1, 1, 0.01, 10000, 1, '2023-06-10 10:57:22', '2023-06-10 03:06:58', '1', 1, '1', '1');
|
||||
INSERT INTO `member_point_config` (`id`, `trade_deduct_enable`, `trade_deduct_unit_price`, `trade_deduct_max_price`, `trade_give_point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (2, 1, 0.01, 10000, 10, '2023-06-10 11:07:12', '2023-06-10 11:07:12', '1', 0, '1', '1');
|
||||
INSERT INTO `member_point_config` (`id`, `trade_deduct_enable`, `trade_deduct_unit_price`, `trade_deduct_max_price`, `trade_give_point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (3, 1, 12.00, 12, 12, '2023-06-10 16:09:26', '2023-06-10 08:10:53', '1', 1, '1', '1');
|
||||
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 '业务类型',
|
||||
`type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '1增加 0扣减',
|
||||
`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` int 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=4 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`, `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', '1', '12', NULL, 212, 12, 1, 12, '2023-06-13 00:00:00', '2023-06-20 00:00:00', '2023-06-10 12:38:48', '1', 1, '1', '1', '2023-06-10 04:42:24');
|
||||
INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `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', '0', NULL, NULL, 1212, 12, 2, 12, '2023-06-28 00:00:00', NULL, '2023-06-10 12:42:48', '1', 0, '1', '1', '2023-06-10 12:43:04');
|
||||
INSERT INTO `member_point_record` (`id`, `biz_id`, `biz_type`, `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', '1', '12', NULL, 12, 12, 1, 12, '2023-06-27 00:00:00', '2023-06-23 00:00:00', '2023-06-10 20:06:48', '1', 0, '1', '1', '2023-06-10 20:06:48');
|
||||
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',
|
||||
`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`, `deleted`, `creator`, `updater`) VALUES (1, 1, 10, '2023-06-10 11:34:43', '2023-06-10 11:34:43', '1', 0, '1', '1');
|
||||
INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (2, 2, 20, '2023-06-10 11:34:59', '2023-06-10 03:55:35', '1', 1, '1', '1');
|
||||
INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (3, 7, 1001, '2023-06-10 17:47:45', '2023-06-10 19:54:37', '1', 0, '1', '1');
|
||||
INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (4, 6, 12121, '2023-06-10 17:47:55', '2023-06-10 19:48:37', '1', 0, '1', '1');
|
||||
INSERT INTO `member_sign_in_config` (`id`, `day`, `point`, `create_time`, `update_time`, `tenant_id`, `deleted`, `creator`, `updater`) VALUES (5, 2, 12, '2023-06-10 19:54:52', '2023-06-10 19:54:52', '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` int 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, 121, 1, 123, '2023-06-10 12:58:18', '2023-06-10 04:59:00', '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, 12, 12, 12, '2023-06-10 19:56:39', '2023-06-10 11:56:45', '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, 12, 12, 1212, '2023-06-10 20:01:17', '2023-06-10 12:01:23', '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, 12, 12, 1212, '2023-06-10 20:01:27', '2023-06-10 20:01:27', '1', 0, '1', '1');
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
|
||||
INSERT INTO `mall`.`system_dict_type` ( `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES ( '积分业务类型', 'point_biz_type', 0, '', '1', '2023-06-10 12:15:00', '1', '2023-06-10 04:25:07', b'0', '1970-01-01 00:00:00');
|
||||
INSERT INTO `mall`.`system_dict_type` ( `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES ( '积分订单状态', 'point_status', 0, '', '1', '2023-06-10 12:16:27', '1', '2023-06-10 12:16:27', b'0', '1970-01-01 00:00:00');
|
||||
|
||||
INSERT INTO `mall`.`system_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 1, '购物', '1', 'point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:27', '1', '2023-06-10 04:25:15', b'0');
|
||||
INSERT INTO `mall`.`system_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 2, '签到', '2', 'point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:48', '1', '2023-06-10 04:25:18', b'0');
|
||||
INSERT INTO `mall`.`system_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 1, '订单创建', '1', 'point_status', 0, '', '', '', '1', '2023-06-10 12:16:42', '1', '2023-06-10 12:16:42', b'0');
|
||||
INSERT INTO `mall`.`system_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 2, '冻结期', '2', 'point_status', 0, '', '', '', '1', '2023-06-10 12:16:58', '1', '2023-06-10 12:16:58', b'0');
|
||||
INSERT INTO `mall`.`system_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 3, '完成', '3', 'point_status', 0, '', '', '', '1', '2023-06-10 12:17:07', '1', '2023-06-10 12:17:07', b'0');
|
||||
INSERT INTO `mall`.`system_dict_data` ( `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ( 4, '失效(订单退款)', '4', 'point_status', 0, '', '', '', '1', '2023-06-10 12:17:21', '1', '2023-06-10 12:17:21', b'0');
|
@ -23,4 +23,17 @@ public interface ErrorCodeConstants {
|
||||
// ========== 用户收件地址 1004004000 ==========
|
||||
ErrorCode ADDRESS_NOT_EXISTS = new ErrorCode(1004004000, "用户收件地址不存在");
|
||||
|
||||
//========== 用户积分 1004005000 ==========
|
||||
ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1004005001, "积分设置不存在");
|
||||
|
||||
ErrorCode CONFIG_EXISTS = new ErrorCode(1004005002, "积分设置已存在,只允配置一条记录");
|
||||
|
||||
|
||||
ErrorCode SIGN_IN_CONFIG_NOT_EXISTS = new ErrorCode(1004005003, "签到天数规则不存在");
|
||||
ErrorCode SIGN_IN_CONFIG_EXISTS = new ErrorCode(1004005004, "签到天数规则已存在");
|
||||
|
||||
ErrorCode RECORD_NOT_EXISTS = new ErrorCode( 1004005005, "用户积分记录不存在");
|
||||
|
||||
ErrorCode SIGN_IN_RECORD_NOT_EXISTS = new ErrorCode(1004005006, "用户签到积分不存在");
|
||||
|
||||
}
|
||||
|
@ -84,6 +84,11 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -26,9 +26,9 @@ public class MemberPointConfigController {
|
||||
@Resource
|
||||
private MemberPointConfigService memberPointConfigService;
|
||||
|
||||
@PutMapping("/update")
|
||||
@PutMapping("/save")
|
||||
@Operation(summary = "保存会员积分配置")
|
||||
@PreAuthorize("@ss.hasPermission('member:point-config:save')")
|
||||
@PreAuthorize("@ss.hasPermission('point:config:save')")
|
||||
public CommonResult<Boolean> updateConfig(@Valid @RequestBody MemberPointConfigSaveReqVO saveReqVO) {
|
||||
memberPointConfigService.saveConfig(saveReqVO);
|
||||
return success(true);
|
||||
@ -36,7 +36,7 @@ public class MemberPointConfigController {
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员积分配置")
|
||||
@PreAuthorize("@ss.hasPermission('member:point-config:query')")
|
||||
@PreAuthorize("@ss.hasPermission('point:config:query')")
|
||||
public CommonResult<MemberPointConfigRespVO> getConfig() {
|
||||
MemberPointConfigDO config = memberPointConfigService.getConfig();
|
||||
return success(MemberPointConfigConvert.INSTANCE.convert(config));
|
||||
|
@ -0,0 +1,83 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.point;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.*;
|
||||
import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 用户积分记录")
|
||||
@RestController
|
||||
@RequestMapping("/point/record")
|
||||
@Validated
|
||||
public class MemberPointRecordController {
|
||||
|
||||
@Resource
|
||||
private MemberPointRecordService recordService;
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户积分记录")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:update')")
|
||||
public CommonResult<Boolean> updateRecord(@Valid @RequestBody MemberPointRecordUpdateReqVO updateReqVO) {
|
||||
recordService.updateRecord(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户积分记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:query')")
|
||||
public CommonResult<MemberPointRecordRespVO> getRecord(@RequestParam("id") Long id) {
|
||||
MemberPointRecordDO record = recordService.getRecord(id);
|
||||
return success(MemberPointRecordConvert.INSTANCE.convert(record));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得用户积分记录列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:query')")
|
||||
public CommonResult<List<MemberPointRecordRespVO>> getRecordList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<MemberPointRecordDO> list = recordService.getRecordList(ids);
|
||||
return success(MemberPointRecordConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户积分记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:query')")
|
||||
public CommonResult<PageResult<MemberPointRecordRespVO>> getRecordPage(@Valid MemberPointRecordPageReqVO pageVO) {
|
||||
PageResult<MemberPointRecordDO> pageResult = recordService.getRecordPage(pageVO);
|
||||
return success(MemberPointRecordConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出用户积分记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportRecordExcel(@Valid MemberPointRecordExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<MemberPointRecordDO> list = recordService.getRecordList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<MemberPointRecordExcelVO> datas = MemberPointRecordConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "用户积分记录.xls", "数据", MemberPointRecordExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -12,6 +12,8 @@ import java.math.BigDecimal;
|
||||
@Data
|
||||
public class MemberPointConfigBaseVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "积分抵扣开关", required = true, example = "true")
|
||||
private Boolean tradeDeductEnable;
|
||||
|
||||
|
@ -1,11 +1,8 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@ -17,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class PointRecordBaseVO {
|
||||
public class MemberPointRecordBaseVO {
|
||||
|
||||
@Schema(description = "业务编码", example = "22706")
|
||||
@NotNull(message = "业务编码不能为空")
|
@ -1,14 +1,12 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户积分记录创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PointRecordCreateReqVO extends PointRecordBaseVO {
|
||||
public class MemberPointRecordCreateReqVO extends MemberPointRecordBaseVO {
|
||||
|
||||
}
|
@ -1,11 +1,7 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
@ -19,7 +15,7 @@ import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
|
||||
* @author QingX
|
||||
*/
|
||||
@Data
|
||||
public class PointRecordExcelVO {
|
||||
public class MemberPointRecordExcelVO {
|
||||
|
||||
@ExcelProperty("自增主键")
|
||||
private Long id;
|
@ -1,13 +1,11 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
@Schema(description = "管理后台 - 用户积分记录 Excel 导出 Request VO,参数和 PointRecordPageReqVO 是一致的")
|
||||
@Data
|
||||
public class PointRecordExportReqVO {
|
||||
public class MemberPointRecordExportReqVO {
|
||||
|
||||
@Schema(description = "业务编码", example = "22706")
|
||||
private String bizId;
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
@ -9,7 +8,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PointRecordPageReqVO extends PageParam {
|
||||
public class MemberPointRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "业务编码", example = "22706")
|
||||
private String bizId;
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
@ -8,7 +8,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PointRecordRespVO extends PointRecordBaseVO {
|
||||
public class MemberPointRecordRespVO extends MemberPointRecordBaseVO {
|
||||
|
||||
@Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31457")
|
||||
private Long id;
|
@ -1,15 +1,15 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户积分记录更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class PointRecordUpdateReqVO extends PointRecordBaseVO {
|
||||
public class MemberPointRecordUpdateReqVO extends MemberPointRecordBaseVO {
|
||||
|
||||
@Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31457")
|
||||
@NotNull(message = "自增主键不能为空")
|
@ -1 +0,0 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
|
@ -1,54 +1,51 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinconfig;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.*;
|
||||
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInConfigConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
||||
import cn.iocoder.yudao.module.member.service.signin.MemberSignInConfigService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
|
||||
import cn.iocoder.yudao.module.point.convert.signinconfig.SignInConfigConvert;
|
||||
import cn.iocoder.yudao.module.point.service.signinconfig.SignInConfigService;
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 积分签到规则")
|
||||
@RestController
|
||||
@RequestMapping("/point/sign-in-config")
|
||||
@Validated
|
||||
public class SignInConfigController {
|
||||
public class MemberSignInConfigController {
|
||||
|
||||
@Resource
|
||||
private SignInConfigService signInConfigService;
|
||||
private MemberSignInConfigService memberSignInConfigService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建积分签到规则")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:create')")
|
||||
public CommonResult<Integer> createSignInConfig(@Valid @RequestBody SignInConfigCreateReqVO createReqVO) {
|
||||
return success(signInConfigService.createSignInConfig(createReqVO));
|
||||
public CommonResult<Integer> createSignInConfig(@Valid @RequestBody MemberSignInConfigCreateReqVO createReqVO) {
|
||||
return success(memberSignInConfigService.createSignInConfig(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新积分签到规则")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:update')")
|
||||
public CommonResult<Boolean> updateSignInConfig(@Valid @RequestBody SignInConfigUpdateReqVO updateReqVO) {
|
||||
signInConfigService.updateSignInConfig(updateReqVO);
|
||||
public CommonResult<Boolean> updateSignInConfig(@Valid @RequestBody MemberSignInConfigUpdateReqVO updateReqVO) {
|
||||
memberSignInConfigService.updateSignInConfig(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ -57,7 +54,7 @@ public class SignInConfigController {
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:delete')")
|
||||
public CommonResult<Boolean> deleteSignInConfig(@RequestParam("id") Integer id) {
|
||||
signInConfigService.deleteSignInConfig(id);
|
||||
memberSignInConfigService.deleteSignInConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@ -65,38 +62,38 @@ public class SignInConfigController {
|
||||
@Operation(summary = "获得积分签到规则")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
|
||||
public CommonResult<SignInConfigRespVO> getSignInConfig(@RequestParam("id") Integer id) {
|
||||
SignInConfigDO signInConfig = signInConfigService.getSignInConfig(id);
|
||||
return success(SignInConfigConvert.INSTANCE.convert(signInConfig));
|
||||
public CommonResult<MemberSignInConfigRespVO> getSignInConfig(@RequestParam("id") Integer id) {
|
||||
MemberSignInConfigDO signInConfig = memberSignInConfigService.getSignInConfig(id);
|
||||
return success(MemberSignInConfigConvert.INSTANCE.convert(signInConfig));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得积分签到规则列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
|
||||
public CommonResult<List<SignInConfigRespVO>> getSignInConfigList(@RequestParam("ids") Collection<Integer> ids) {
|
||||
List<SignInConfigDO> list = signInConfigService.getSignInConfigList(ids);
|
||||
return success(SignInConfigConvert.INSTANCE.convertList(list));
|
||||
public CommonResult<List<MemberSignInConfigRespVO>> getSignInConfigList(@RequestParam("ids") Collection<Integer> ids) {
|
||||
List<MemberSignInConfigDO> list = memberSignInConfigService.getSignInConfigList(ids);
|
||||
return success(MemberSignInConfigConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得积分签到规则分页")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
|
||||
public CommonResult<PageResult<SignInConfigRespVO>> getSignInConfigPage(@Valid SignInConfigPageReqVO pageVO) {
|
||||
PageResult<SignInConfigDO> pageResult = signInConfigService.getSignInConfigPage(pageVO);
|
||||
return success(SignInConfigConvert.INSTANCE.convertPage(pageResult));
|
||||
public CommonResult<PageResult<MemberSignInConfigRespVO>> getSignInConfigPage(@Valid MemberSignInConfigPageReqVO pageVO) {
|
||||
PageResult<MemberSignInConfigDO> pageResult = memberSignInConfigService.getSignInConfigPage(pageVO);
|
||||
return success(MemberSignInConfigConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出积分签到规则 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-config:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportSignInConfigExcel(@Valid SignInConfigExportReqVO exportReqVO,
|
||||
public void exportSignInConfigExcel(@Valid MemberSignInConfigExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<SignInConfigDO> list = signInConfigService.getSignInConfigList(exportReqVO);
|
||||
List<MemberSignInConfigDO> list = memberSignInConfigService.getSignInConfigList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<SignInConfigExcelVO> datas = SignInConfigConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "积分签到规则.xls", "数据", SignInConfigExcelVO.class, datas);
|
||||
List<MemberSignInConfigExcelVO> datas = MemberSignInConfigConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "积分签到规则.xls", "数据", MemberSignInConfigExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.*;
|
||||
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||
import cn.iocoder.yudao.module.member.service.signin.MemberSignInRecordService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 用户签到积分")
|
||||
@RestController
|
||||
@RequestMapping("/point/sign-in-record")
|
||||
@Validated
|
||||
public class MemberSignInRecordController {
|
||||
|
||||
@Resource
|
||||
private MemberSignInRecordService memberSignInRecordService;
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户签到积分")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:delete')")
|
||||
public CommonResult<Boolean> deleteSignInRecord(@RequestParam("id") Long id) {
|
||||
memberSignInRecordService.deleteSignInRecord(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户签到积分")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
|
||||
public CommonResult<MemberSignInRecordRespVO> getSignInRecord(@RequestParam("id") Long id) {
|
||||
MemberSignInRecordDO signInRecord = memberSignInRecordService.getSignInRecord(id);
|
||||
return success(MemberSignInRecordConvert.INSTANCE.convert(signInRecord));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得用户签到积分列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
|
||||
public CommonResult<List<MemberSignInRecordRespVO>> getSignInRecordList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<MemberSignInRecordDO> list = memberSignInRecordService.getSignInRecordList(ids);
|
||||
return success(MemberSignInRecordConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户签到积分分页")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
|
||||
public CommonResult<PageResult<MemberSignInRecordRespVO>> getSignInRecordPage(@Valid MemberSignInRecordPageReqVO pageVO) {
|
||||
PageResult<MemberSignInRecordDO> pageResult = memberSignInRecordService.getSignInRecordPage(pageVO);
|
||||
return success(MemberSignInRecordConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出用户签到积分 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportSignInRecordExcel(@Valid MemberSignInRecordExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<MemberSignInRecordDO> list = memberSignInRecordService.getSignInRecordList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<MemberSignInRecordExcelVO> datas = MemberSignInRecordConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "用户签到积分.xls", "数据", MemberSignInRecordExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -1,18 +1,14 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 积分签到规则 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SignInConfigBaseVO {
|
||||
public class MemberSignInConfigBaseVO {
|
||||
|
||||
@Schema(description = "签到第x天", example = "7")
|
||||
private Integer day;
|
@ -1,14 +1,12 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 积分签到规则创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SignInConfigCreateReqVO extends SignInConfigBaseVO {
|
||||
public class MemberSignInConfigCreateReqVO extends MemberSignInConfigBaseVO {
|
||||
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
@ -14,7 +12,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||
* @author QingX
|
||||
*/
|
||||
@Data
|
||||
public class SignInConfigExcelVO {
|
||||
public class MemberSignInConfigExcelVO {
|
||||
|
||||
@ExcelProperty("签到第x天")
|
||||
private Integer day;
|
@ -1,13 +1,11 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
@Schema(description = "管理后台 - 积分签到规则 Excel 导出 Request VO,参数和 SignInConfigPageReqVO 是一致的")
|
||||
@Data
|
||||
public class SignInConfigExportReqVO {
|
||||
public class MemberSignInConfigExportReqVO {
|
||||
|
||||
@Schema(description = "签到第x天", example = "7")
|
||||
private Integer day;
|
@ -1,7 +1,6 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
|
||||
@ -9,7 +8,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SignInConfigPageReqVO extends PageParam {
|
||||
public class MemberSignInConfigPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "签到第x天", example = "7")
|
||||
private Integer day;
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
@ -8,7 +8,7 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SignInConfigRespVO extends SignInConfigBaseVO {
|
||||
public class MemberSignInConfigRespVO extends MemberSignInConfigBaseVO {
|
||||
|
||||
@Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20937")
|
||||
private Integer id;
|
@ -1,15 +1,15 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 积分签到规则更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SignInConfigUpdateReqVO extends SignInConfigBaseVO {
|
||||
public class MemberSignInConfigUpdateReqVO extends MemberSignInConfigBaseVO {
|
||||
|
||||
@Schema(description = "规则自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "13653")
|
||||
@NotNull(message = "规则自增主键不能为空")
|
@ -1,18 +1,14 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 用户签到积分 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class SignInRecordBaseVO {
|
||||
public class MemberSignInRecordBaseVO {
|
||||
|
||||
@Schema(description = "签到用户", example = "6507")
|
||||
private Integer userId;
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 用户签到积分创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class MemberSignInRecordCreateReqVO extends MemberSignInRecordBaseVO {
|
||||
|
||||
}
|
@ -1,12 +1,9 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 用户签到积分 Excel VO
|
||||
@ -14,7 +11,7 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Data
|
||||
public class SignInRecordExcelVO {
|
||||
public class MemberSignInRecordExcelVO {
|
||||
|
||||
@ExcelProperty("签到自增id")
|
||||
private Long id;
|
@ -1,17 +1,16 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户签到积分 Excel 导出 Request VO,参数和 SignInRecordPageReqVO 是一致的")
|
||||
@Data
|
||||
public class SignInRecordExportReqVO {
|
||||
public class MemberSignInRecordExportReqVO {
|
||||
|
||||
@Schema(description = "签到用户", example = "6507")
|
||||
private Integer userId;
|
@ -1,10 +1,12 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@ -13,7 +15,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SignInRecordPageReqVO extends PageParam {
|
||||
public class MemberSignInRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "签到用户", example = "6507")
|
||||
private Integer userId;
|
@ -1,14 +1,17 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 用户签到积分 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SignInRecordRespVO extends SignInRecordBaseVO {
|
||||
public class MemberSignInRecordRespVO extends MemberSignInRecordBaseVO {
|
||||
|
||||
@Schema(description = "签到自增id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11903")
|
||||
private Long id;
|
@ -1,15 +1,17 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
|
||||
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 用户签到积分更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SignInRecordUpdateReqVO extends SignInRecordBaseVO {
|
||||
public class MemberSignInRecordUpdateReqVO extends MemberSignInRecordBaseVO {
|
||||
|
||||
@Schema(description = "签到自增id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11903")
|
||||
@NotNull(message = "签到自增id不能为空")
|
@ -1,7 +1,10 @@
|
||||
package cn.iocoder.yudao.module.member.convert.point;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
@ -17,4 +20,7 @@ public interface MemberPointConfigConvert {
|
||||
|
||||
MemberPointConfigRespVO convert(MemberPointConfigDO bean);
|
||||
|
||||
MemberPointConfigDO convert(MemberPointConfigSaveReqVO bean);
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.member.convert.point;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordExcelVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 用户积分记录 Convert
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberPointRecordConvert {
|
||||
|
||||
MemberPointRecordConvert INSTANCE = Mappers.getMapper(MemberPointRecordConvert.class);
|
||||
|
||||
MemberPointRecordDO convert(MemberPointRecordCreateReqVO bean);
|
||||
|
||||
MemberPointRecordDO convert(MemberPointRecordUpdateReqVO bean);
|
||||
|
||||
MemberPointRecordRespVO convert(MemberPointRecordDO bean);
|
||||
|
||||
List<MemberPointRecordRespVO> convertList(List<MemberPointRecordDO> list);
|
||||
|
||||
PageResult<MemberPointRecordRespVO> convertPage(PageResult<MemberPointRecordDO> page);
|
||||
|
||||
List<MemberPointRecordExcelVO> convertList02(List<MemberPointRecordDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.member.convert.signin;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.*;
|
||||
|
||||
/**
|
||||
* 积分签到规则 Convert
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberSignInConfigConvert {
|
||||
|
||||
MemberSignInConfigConvert INSTANCE = Mappers.getMapper(MemberSignInConfigConvert.class);
|
||||
|
||||
MemberSignInConfigDO convert(MemberSignInConfigCreateReqVO bean);
|
||||
|
||||
MemberSignInConfigDO convert(MemberSignInConfigUpdateReqVO bean);
|
||||
|
||||
MemberSignInConfigRespVO convert(MemberSignInConfigDO bean);
|
||||
|
||||
List<MemberSignInConfigRespVO> convertList(List<MemberSignInConfigDO> list);
|
||||
|
||||
PageResult<MemberSignInConfigRespVO> convertPage(PageResult<MemberSignInConfigDO> page);
|
||||
|
||||
List<MemberSignInConfigExcelVO> convertList02(List<MemberSignInConfigDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.member.convert.signin;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordExcelVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordRespVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 用户签到积分 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberSignInRecordConvert {
|
||||
|
||||
MemberSignInRecordConvert INSTANCE = Mappers.getMapper(MemberSignInRecordConvert.class);
|
||||
|
||||
MemberSignInRecordDO convert(MemberSignInRecordCreateReqVO bean);
|
||||
|
||||
MemberSignInRecordDO convert(MemberSignInRecordUpdateReqVO bean);
|
||||
|
||||
MemberSignInRecordRespVO convert(MemberSignInRecordDO bean);
|
||||
|
||||
List<MemberSignInRecordRespVO> convertList(List<MemberSignInRecordDO> list);
|
||||
|
||||
PageResult<MemberSignInRecordRespVO> convertPage(PageResult<MemberSignInRecordDO> page);
|
||||
|
||||
List<MemberSignInRecordExcelVO> convertList02(List<MemberSignInRecordDO> list);
|
||||
|
||||
}
|
@ -1,13 +1,12 @@
|
||||
package cn.iocoder.yudao.module.point.dal.dataobject.pointrecord;
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.point;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
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
|
||||
@ -22,7 +21,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PointRecordDO extends BaseDO {
|
||||
public class MemberPointRecordDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 自增主键
|
@ -1,11 +1,10 @@
|
||||
package cn.iocoder.yudao.module.point.dal.dataobject.signinconfig;
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.signin;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 积分签到规则 DO
|
||||
@ -20,7 +19,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SignInConfigDO extends BaseDO {
|
||||
public class MemberSignInConfigDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 规则自增主键
|
@ -1,11 +1,10 @@
|
||||
package cn.iocoder.yudao.module.point.dal.dataobject.signinrecord;
|
||||
package cn.iocoder.yudao.module.member.dal.dataobject.signin;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 用户签到积分 DO
|
||||
@ -20,7 +19,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SignInRecordDO extends BaseDO {
|
||||
public class MemberSignInRecordDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 签到自增id
|
@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.point;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordExportReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户积分记录 Mapper
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberPointRecordMapper extends BaseMapperX<MemberPointRecordDO> {
|
||||
|
||||
default PageResult<MemberPointRecordDO> selectPage(MemberPointRecordPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberPointRecordDO>()
|
||||
.eqIfPresent(MemberPointRecordDO::getBizId, reqVO.getBizId())
|
||||
.eqIfPresent(MemberPointRecordDO::getBizType, reqVO.getBizType())
|
||||
.eqIfPresent(MemberPointRecordDO::getType, reqVO.getType())
|
||||
.eqIfPresent(MemberPointRecordDO::getTitle, reqVO.getTitle())
|
||||
.eqIfPresent(MemberPointRecordDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(MemberPointRecordDO::getId));
|
||||
}
|
||||
|
||||
default List<MemberPointRecordDO> selectList(MemberPointRecordExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<MemberPointRecordDO>()
|
||||
.eqIfPresent(MemberPointRecordDO::getBizId, reqVO.getBizId())
|
||||
.eqIfPresent(MemberPointRecordDO::getBizType, reqVO.getBizType())
|
||||
.eqIfPresent(MemberPointRecordDO::getType, reqVO.getType())
|
||||
.eqIfPresent(MemberPointRecordDO::getTitle, reqVO.getTitle())
|
||||
.eqIfPresent(MemberPointRecordDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(MemberPointRecordDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.signin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigExportReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 积分签到规则 Mapper
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberSignInConfigMapper extends BaseMapperX<MemberSignInConfigDO> {
|
||||
|
||||
default PageResult<MemberSignInConfigDO> selectPage(MemberSignInConfigPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberSignInConfigDO>()
|
||||
.eqIfPresent(MemberSignInConfigDO::getDay, reqVO.getDay())
|
||||
.orderByAsc(MemberSignInConfigDO::getDay));
|
||||
}
|
||||
|
||||
default List<MemberSignInConfigDO> selectList(MemberSignInConfigExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<MemberSignInConfigDO>()
|
||||
.eqIfPresent(MemberSignInConfigDO::getDay, reqVO.getDay())
|
||||
.orderByDesc(MemberSignInConfigDO::getId));
|
||||
}
|
||||
|
||||
//
|
||||
default long selectSameDayNotSelf(MemberSignInConfigUpdateReqVO reqVO){
|
||||
return selectCount(new LambdaQueryWrapperX <MemberSignInConfigDO>()
|
||||
.ne(MemberSignInConfigDO::getId, reqVO.getId())
|
||||
.eq(MemberSignInConfigDO::getDay,reqVO.getDay())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.member.dal.mysql.signin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordExportReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户签到积分 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberSignInRecordMapper extends BaseMapperX<MemberSignInRecordDO> {
|
||||
|
||||
default PageResult<MemberSignInRecordDO> selectPage(MemberSignInRecordPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberSignInRecordDO>()
|
||||
.eqIfPresent(MemberSignInRecordDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(MemberSignInRecordDO::getDay, reqVO.getDay())
|
||||
.betweenIfPresent(MemberSignInRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MemberSignInRecordDO::getId));
|
||||
}
|
||||
|
||||
default List<MemberSignInRecordDO> selectList(MemberSignInRecordExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<MemberSignInRecordDO>()
|
||||
.eqIfPresent(MemberSignInRecordDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(MemberSignInRecordDO::getDay, reqVO.getDay())
|
||||
.betweenIfPresent(MemberSignInRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MemberSignInRecordDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -1,12 +1,15 @@
|
||||
package cn.iocoder.yudao.module.member.service.point;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigSaveReqVO;
|
||||
import cn.iocoder.yudao.module.member.convert.point.MemberPointConfigConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.point.MemberPointConfigMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 会员积分配置 Service 实现类
|
||||
@ -18,16 +21,23 @@ import javax.annotation.Resource;
|
||||
public class MemberPointConfigServiceImpl implements MemberPointConfigService {
|
||||
|
||||
@Resource
|
||||
private MemberPointConfigMapper memberPointConfigMapper;
|
||||
private MemberPointConfigMapper pointConfigMapper;
|
||||
|
||||
@Override
|
||||
public void saveConfig(MemberPointConfigSaveReqVO saveReqVO) {
|
||||
// TODO qingx:配置存在,则 update;不存在则 insert
|
||||
long total = pointConfigMapper.selectCount();
|
||||
MemberPointConfigDO pointConfigDO = MemberPointConfigConvert.INSTANCE.convert(saveReqVO);
|
||||
//大于0存在记录,则更新,否则插入
|
||||
if (total > 0) {
|
||||
pointConfigMapper.updateById(pointConfigDO);
|
||||
} else {
|
||||
pointConfigMapper.insert(pointConfigDO);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberPointConfigDO getConfig() {
|
||||
// TODO qingx:直接查询到一条;
|
||||
return null;
|
||||
List <MemberPointConfigDO> list = pointConfigMapper.selectList();
|
||||
return list == null ? null : list.get(0);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.member.service.point;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordExportReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 用户积分记录 Service 接口
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
public interface MemberPointRecordService {
|
||||
|
||||
|
||||
/**
|
||||
* 更新用户积分记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRecord(@Valid MemberPointRecordUpdateReqVO updateReqVO);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获得用户积分记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用户积分记录
|
||||
*/
|
||||
MemberPointRecordDO getRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户积分记录列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 用户积分记录列表
|
||||
*/
|
||||
List<MemberPointRecordDO> getRecordList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得用户积分记录分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户积分记录分页
|
||||
*/
|
||||
PageResult<MemberPointRecordDO> getRecordPage(MemberPointRecordPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得用户积分记录列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 用户积分记录列表
|
||||
*/
|
||||
List<MemberPointRecordDO> getRecordList(MemberPointRecordExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.member.service.point;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordExportReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.point.MemberPointRecordMapper;
|
||||
import cn.iocoder.yudao.module.member.enums.ErrorCodeConstants;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
|
||||
/**
|
||||
* 用户积分记录 Service 实现类
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberPointRecordServiceImpl implements MemberPointRecordService {
|
||||
|
||||
@Resource
|
||||
private MemberPointRecordMapper recordMapper;
|
||||
|
||||
@Override
|
||||
public void updateRecord(MemberPointRecordUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRecordExists(updateReqVO.getId());
|
||||
// 更新
|
||||
MemberPointRecordDO updateObj = MemberPointRecordConvert.INSTANCE.convert(updateReqVO);
|
||||
recordMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
|
||||
private void validateRecordExists(Long id) {
|
||||
if (recordMapper.selectById(id) == null) {
|
||||
throw exception(ErrorCodeConstants.RECORD_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberPointRecordDO getRecord(Long id) {
|
||||
return recordMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberPointRecordDO> getRecordList(Collection<Long> ids) {
|
||||
return recordMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MemberPointRecordDO> getRecordPage(MemberPointRecordPageReqVO pageReqVO) {
|
||||
return recordMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberPointRecordDO> getRecordList(MemberPointRecordExportReqVO exportReqVO) {
|
||||
return recordMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,13 @@
|
||||
package cn.iocoder.yudao.module.point.service.signinconfig;
|
||||
package cn.iocoder.yudao.module.member.service.signin;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigExportReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
@ -11,7 +15,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
public interface SignInConfigService {
|
||||
public interface MemberSignInConfigService {
|
||||
|
||||
/**
|
||||
* 创建积分签到规则
|
||||
@ -19,14 +23,14 @@ public interface SignInConfigService {
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Integer createSignInConfig(@Valid SignInConfigCreateReqVO createReqVO);
|
||||
Integer createSignInConfig(@Valid MemberSignInConfigCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新积分签到规则
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateSignInConfig(@Valid SignInConfigUpdateReqVO updateReqVO);
|
||||
void updateSignInConfig(@Valid MemberSignInConfigUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除积分签到规则
|
||||
@ -41,7 +45,7 @@ public interface SignInConfigService {
|
||||
* @param id 编号
|
||||
* @return 积分签到规则
|
||||
*/
|
||||
SignInConfigDO getSignInConfig(Integer id);
|
||||
MemberSignInConfigDO getSignInConfig(Integer id);
|
||||
|
||||
/**
|
||||
* 获得积分签到规则列表
|
||||
@ -49,7 +53,7 @@ public interface SignInConfigService {
|
||||
* @param ids 编号
|
||||
* @return 积分签到规则列表
|
||||
*/
|
||||
List<SignInConfigDO> getSignInConfigList(Collection<Integer> ids);
|
||||
List<MemberSignInConfigDO> getSignInConfigList(Collection<Integer> ids);
|
||||
|
||||
/**
|
||||
* 获得积分签到规则分页
|
||||
@ -57,7 +61,7 @@ public interface SignInConfigService {
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 积分签到规则分页
|
||||
*/
|
||||
PageResult<SignInConfigDO> getSignInConfigPage(SignInConfigPageReqVO pageReqVO);
|
||||
PageResult<MemberSignInConfigDO> getSignInConfigPage(MemberSignInConfigPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得积分签到规则列表, 用于 Excel 导出
|
||||
@ -65,6 +69,6 @@ public interface SignInConfigService {
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 积分签到规则列表
|
||||
*/
|
||||
List<SignInConfigDO> getSignInConfigList(SignInConfigExportReqVO exportReqVO);
|
||||
List<MemberSignInConfigDO> getSignInConfigList(MemberSignInConfigExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package cn.iocoder.yudao.module.member.service.signin;
|
||||
|
||||
import cn.iocoder.yudao.module.member.service.signin.MemberSignInConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInConfigConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInConfigMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 积分签到规则 Service 实现类
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberSignInConfigServiceImpl implements MemberSignInConfigService {
|
||||
|
||||
@Resource
|
||||
private MemberSignInConfigMapper memberSignInConfigMapper;
|
||||
|
||||
@Override
|
||||
public Integer createSignInConfig(MemberSignInConfigCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
MemberSignInConfigDO signInConfig = MemberSignInConfigConvert.INSTANCE.convert(createReqVO);
|
||||
//判断是否重复插入签到天数
|
||||
validateSignInConfigExistsDay(signInConfig.getDay());
|
||||
memberSignInConfigMapper.insert(signInConfig);
|
||||
// 返回
|
||||
return signInConfig.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSignInConfig(MemberSignInConfigUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateSignInConfigExists(updateReqVO.getId());
|
||||
//判断是否重复插入签到天数
|
||||
validateSignInConfigSameDayNotSelf(updateReqVO);
|
||||
// 判断更新的
|
||||
MemberSignInConfigDO updateObj = MemberSignInConfigConvert.INSTANCE.convert(updateReqVO);
|
||||
|
||||
|
||||
memberSignInConfigMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSignInConfig(Integer id) {
|
||||
// 校验存在
|
||||
validateSignInConfigExists(id);
|
||||
// 删除
|
||||
memberSignInConfigMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateSignInConfigExists(Integer id) {
|
||||
if (memberSignInConfigMapper.selectById(id) == null) {
|
||||
throw exception(SIGN_IN_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
//根据签到天数判断是否存在一个相同的天数
|
||||
private void validateSignInConfigExistsDay(Integer day) {
|
||||
if (memberSignInConfigMapper.selectCount(MemberSignInConfigDO::getDay,day)>0) {
|
||||
throw exception(SIGN_IN_CONFIG_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
//更新天数时判断是否有重复的天数,需要去除自己
|
||||
private void validateSignInConfigSameDayNotSelf(MemberSignInConfigUpdateReqVO reqVO) {
|
||||
if (memberSignInConfigMapper.selectSameDayNotSelf(reqVO)>0) {
|
||||
throw exception(SIGN_IN_CONFIG_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public MemberSignInConfigDO getSignInConfig(Integer id) {
|
||||
return memberSignInConfigMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberSignInConfigDO> getSignInConfigList(Collection<Integer> ids) {
|
||||
return memberSignInConfigMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MemberSignInConfigDO> getSignInConfigPage(MemberSignInConfigPageReqVO pageReqVO) {
|
||||
return memberSignInConfigMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberSignInConfigDO> getSignInConfigList(MemberSignInConfigExportReqVO exportReqVO) {
|
||||
return memberSignInConfigMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.member.service.signin;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.*;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 用户签到积分 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface MemberSignInRecordService {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户签到积分
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteSignInRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户签到积分
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用户签到积分
|
||||
*/
|
||||
MemberSignInRecordDO getSignInRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户签到积分列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 用户签到积分列表
|
||||
*/
|
||||
List<MemberSignInRecordDO> getSignInRecordList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得用户签到积分分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户签到积分分页
|
||||
*/
|
||||
PageResult<MemberSignInRecordDO> getSignInRecordPage(MemberSignInRecordPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得用户签到积分列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 用户签到积分列表
|
||||
*/
|
||||
List<MemberSignInRecordDO> getSignInRecordList(MemberSignInRecordExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package cn.iocoder.yudao.module.member.service.signin;
|
||||
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordCreateReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordExportReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
|
||||
import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInRecordMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 用户签到积分 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberSignInRecordServiceImpl implements MemberSignInRecordService {
|
||||
|
||||
@Resource
|
||||
private MemberSignInRecordMapper memberSignInRecordMapper;
|
||||
|
||||
@Override
|
||||
public void deleteSignInRecord(Long id) {
|
||||
// 校验存在
|
||||
validateSignInRecordExists(id);
|
||||
// 删除
|
||||
memberSignInRecordMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateSignInRecordExists(Long id) {
|
||||
if (memberSignInRecordMapper.selectById(id) == null) {
|
||||
throw exception(SIGN_IN_RECORD_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberSignInRecordDO getSignInRecord(Long id) {
|
||||
return memberSignInRecordMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberSignInRecordDO> getSignInRecordList(Collection<Long> ids) {
|
||||
return memberSignInRecordMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MemberSignInRecordDO> getSignInRecordPage(MemberSignInRecordPageReqVO pageReqVO) {
|
||||
return memberSignInRecordMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MemberSignInRecordDO> getSignInRecordList(MemberSignInRecordExportReqVO exportReqVO) {
|
||||
return memberSignInRecordMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>yudao-module-point</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
<module>yudao-module-point-api</module>
|
||||
</modules>
|
||||
|
||||
|
||||
</project>
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-point</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>yudao-module-point-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,27 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.enums;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* Pay 错误码 Core 枚举类
|
||||
*
|
||||
* pay 系统,使用 1-007-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(499, "积分设置不存在");
|
||||
|
||||
ErrorCode CONFIG_EXISTS = new ErrorCode(499, "积分设置已存在,只允配置一条记录");
|
||||
|
||||
|
||||
ErrorCode SIGN_IN_CONFIG_NOT_EXISTS = new ErrorCode(499, "签到天数规则不存在");
|
||||
ErrorCode SIGN_IN_CONFIG_EXISTS = new ErrorCode(499, "签到天数规则已存在");
|
||||
|
||||
ErrorCode RECORD_NOT_EXISTS = new ErrorCode( 499, "用户积分记录不存在");
|
||||
|
||||
ErrorCode SIGN_IN_RECORD_NOT_EXISTS = new ErrorCode(499, "用户签到积分不存在");
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,57 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-point</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>yudao-module-point-biz</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-module-point-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>cn.iocoder.boot</groupId>
|
||||
<artifactId>yudao-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -1,102 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.pointrecord;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
|
||||
import cn.iocoder.yudao.module.point.convert.pointrecord.PointRecordConvert;
|
||||
import cn.iocoder.yudao.module.point.service.pointrecord.PointRecordService;
|
||||
|
||||
@Tag(name = "管理后台 - 用户积分记录")
|
||||
@RestController
|
||||
@RequestMapping("/point/record")
|
||||
@Validated
|
||||
public class PointRecordController {
|
||||
|
||||
@Resource
|
||||
private PointRecordService recordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户积分记录")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:create')")
|
||||
public CommonResult<Long> createRecord(@Valid @RequestBody PointRecordCreateReqVO createReqVO) {
|
||||
return success(recordService.createRecord(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户积分记录")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:update')")
|
||||
public CommonResult<Boolean> updateRecord(@Valid @RequestBody PointRecordUpdateReqVO updateReqVO) {
|
||||
recordService.updateRecord(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户积分记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('point:record:delete')")
|
||||
public CommonResult<Boolean> deleteRecord(@RequestParam("id") Long id) {
|
||||
recordService.deleteRecord(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户积分记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:query')")
|
||||
public CommonResult<PointRecordRespVO> getRecord(@RequestParam("id") Long id) {
|
||||
PointRecordDO record = recordService.getRecord(id);
|
||||
return success(PointRecordConvert.INSTANCE.convert(record));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得用户积分记录列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:query')")
|
||||
public CommonResult<List<PointRecordRespVO>> getRecordList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<PointRecordDO> list = recordService.getRecordList(ids);
|
||||
return success(PointRecordConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户积分记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:query')")
|
||||
public CommonResult<PageResult<PointRecordRespVO>> getRecordPage(@Valid PointRecordPageReqVO pageVO) {
|
||||
PageResult<PointRecordDO> pageResult = recordService.getRecordPage(pageVO);
|
||||
return success(PointRecordConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出用户积分记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('point:record:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportRecordExcel(@Valid PointRecordExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<PointRecordDO> list = recordService.getRecordList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<PointRecordExcelVO> datas = PointRecordConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "用户积分记录.xls", "数据", PointRecordExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinrecord;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
|
||||
import cn.iocoder.yudao.module.point.convert.signinrecord.SignInRecordConvert;
|
||||
import cn.iocoder.yudao.module.point.service.signinrecord.SignInRecordService;
|
||||
|
||||
@Tag(name = "管理后台 - 用户签到积分")
|
||||
@RestController
|
||||
@RequestMapping("/point/sign-in-record")
|
||||
@Validated
|
||||
public class SignInRecordController {
|
||||
|
||||
@Resource
|
||||
private SignInRecordService signInRecordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户签到积分")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:create')")
|
||||
public CommonResult<Long> createSignInRecord(@Valid @RequestBody SignInRecordCreateReqVO createReqVO) {
|
||||
return success(signInRecordService.createSignInRecord(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户签到积分")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:update')")
|
||||
public CommonResult<Boolean> updateSignInRecord(@Valid @RequestBody SignInRecordUpdateReqVO updateReqVO) {
|
||||
signInRecordService.updateSignInRecord(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户签到积分")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:delete')")
|
||||
public CommonResult<Boolean> deleteSignInRecord(@RequestParam("id") Long id) {
|
||||
signInRecordService.deleteSignInRecord(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户签到积分")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
|
||||
public CommonResult<SignInRecordRespVO> getSignInRecord(@RequestParam("id") Long id) {
|
||||
SignInRecordDO signInRecord = signInRecordService.getSignInRecord(id);
|
||||
return success(SignInRecordConvert.INSTANCE.convert(signInRecord));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得用户签到积分列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
|
||||
public CommonResult<List<SignInRecordRespVO>> getSignInRecordList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<SignInRecordDO> list = signInRecordService.getSignInRecordList(ids);
|
||||
return success(SignInRecordConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户签到积分分页")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
|
||||
public CommonResult<PageResult<SignInRecordRespVO>> getSignInRecordPage(@Valid SignInRecordPageReqVO pageVO) {
|
||||
PageResult<SignInRecordDO> pageResult = signInRecordService.getSignInRecordPage(pageVO);
|
||||
return success(SignInRecordConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出用户签到积分 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('point:sign-in-record:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportSignInRecordExcel(@Valid SignInRecordExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<SignInRecordDO> list = signInRecordService.getSignInRecordList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<SignInRecordExcelVO> datas = SignInRecordConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "用户签到积分.xls", "数据", SignInRecordExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户签到积分创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class SignInRecordCreateReqVO extends SignInRecordBaseVO {
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.convert.pointrecord;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
|
||||
|
||||
/**
|
||||
* 用户积分记录 Convert
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Mapper
|
||||
public interface PointRecordConvert {
|
||||
|
||||
PointRecordConvert INSTANCE = Mappers.getMapper(PointRecordConvert.class);
|
||||
|
||||
PointRecordDO convert(PointRecordCreateReqVO bean);
|
||||
|
||||
PointRecordDO convert(PointRecordUpdateReqVO bean);
|
||||
|
||||
PointRecordRespVO convert(PointRecordDO bean);
|
||||
|
||||
List<PointRecordRespVO> convertList(List<PointRecordDO> list);
|
||||
|
||||
PageResult<PointRecordRespVO> convertPage(PageResult<PointRecordDO> page);
|
||||
|
||||
List<PointRecordExcelVO> convertList02(List<PointRecordDO> list);
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.convert.signinconfig;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
|
||||
|
||||
/**
|
||||
* 积分签到规则 Convert
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Mapper
|
||||
public interface SignInConfigConvert {
|
||||
|
||||
SignInConfigConvert INSTANCE = Mappers.getMapper(SignInConfigConvert.class);
|
||||
|
||||
SignInConfigDO convert(SignInConfigCreateReqVO bean);
|
||||
|
||||
SignInConfigDO convert(SignInConfigUpdateReqVO bean);
|
||||
|
||||
SignInConfigRespVO convert(SignInConfigDO bean);
|
||||
|
||||
List<SignInConfigRespVO> convertList(List<SignInConfigDO> list);
|
||||
|
||||
PageResult<SignInConfigRespVO> convertPage(PageResult<SignInConfigDO> page);
|
||||
|
||||
List<SignInConfigExcelVO> convertList02(List<SignInConfigDO> list);
|
||||
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.convert.signinrecord;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
|
||||
|
||||
/**
|
||||
* 用户签到积分 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface SignInRecordConvert {
|
||||
|
||||
SignInRecordConvert INSTANCE = Mappers.getMapper(SignInRecordConvert.class);
|
||||
|
||||
SignInRecordDO convert(SignInRecordCreateReqVO bean);
|
||||
|
||||
SignInRecordDO convert(SignInRecordUpdateReqVO bean);
|
||||
|
||||
SignInRecordRespVO convert(SignInRecordDO bean);
|
||||
|
||||
List<SignInRecordRespVO> convertList(List<SignInRecordDO> list);
|
||||
|
||||
PageResult<SignInRecordRespVO> convertPage(PageResult<SignInRecordDO> page);
|
||||
|
||||
List<SignInRecordExcelVO> convertList02(List<SignInRecordDO> list);
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.dal.mysql.pointrecord;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
|
||||
|
||||
/**
|
||||
* 用户积分记录 Mapper
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Mapper
|
||||
public interface PointRecordMapper extends BaseMapperX<PointRecordDO> {
|
||||
|
||||
default PageResult<PointRecordDO> selectPage(PointRecordPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PointRecordDO>()
|
||||
.eqIfPresent(PointRecordDO::getBizId, reqVO.getBizId())
|
||||
.eqIfPresent(PointRecordDO::getBizType, reqVO.getBizType())
|
||||
.eqIfPresent(PointRecordDO::getType, reqVO.getType())
|
||||
.eqIfPresent(PointRecordDO::getTitle, reqVO.getTitle())
|
||||
.eqIfPresent(PointRecordDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(PointRecordDO::getId));
|
||||
}
|
||||
|
||||
default List<PointRecordDO> selectList(PointRecordExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<PointRecordDO>()
|
||||
.eqIfPresent(PointRecordDO::getBizId, reqVO.getBizId())
|
||||
.eqIfPresent(PointRecordDO::getBizType, reqVO.getBizType())
|
||||
.eqIfPresent(PointRecordDO::getType, reqVO.getType())
|
||||
.eqIfPresent(PointRecordDO::getTitle, reqVO.getTitle())
|
||||
.eqIfPresent(PointRecordDO::getStatus, reqVO.getStatus())
|
||||
.orderByDesc(PointRecordDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.dal.mysql.signinconfig;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
|
||||
|
||||
/**
|
||||
* 积分签到规则 Mapper
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Mapper
|
||||
public interface SignInConfigMapper extends BaseMapperX<SignInConfigDO> {
|
||||
|
||||
default PageResult<SignInConfigDO> selectPage(SignInConfigPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<SignInConfigDO>()
|
||||
.eqIfPresent(SignInConfigDO::getDay, reqVO.getDay())
|
||||
.orderByAsc(SignInConfigDO::getDay));
|
||||
}
|
||||
|
||||
default List<SignInConfigDO> selectList(SignInConfigExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<SignInConfigDO>()
|
||||
.eqIfPresent(SignInConfigDO::getDay, reqVO.getDay())
|
||||
.orderByDesc(SignInConfigDO::getId));
|
||||
}
|
||||
|
||||
//
|
||||
default long selectSameDayNotSelf(SignInConfigUpdateReqVO reqVO){
|
||||
return selectCount(new LambdaQueryWrapperX <SignInConfigDO>()
|
||||
.ne(SignInConfigDO::getId, reqVO.getId())
|
||||
.eq(SignInConfigDO::getDay,reqVO.getDay())
|
||||
);
|
||||
}
|
||||
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.dal.mysql.signinrecord;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
|
||||
|
||||
/**
|
||||
* 用户签到积分 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface SignInRecordMapper extends BaseMapperX<SignInRecordDO> {
|
||||
|
||||
default PageResult<SignInRecordDO> selectPage(SignInRecordPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<SignInRecordDO>()
|
||||
.eqIfPresent(SignInRecordDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(SignInRecordDO::getDay, reqVO.getDay())
|
||||
.betweenIfPresent(SignInRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(SignInRecordDO::getId));
|
||||
}
|
||||
|
||||
default List<SignInRecordDO> selectList(SignInRecordExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<SignInRecordDO>()
|
||||
.eqIfPresent(SignInRecordDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(SignInRecordDO::getDay, reqVO.getDay())
|
||||
.betweenIfPresent(SignInRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(SignInRecordDO::getId));
|
||||
}
|
||||
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.service.pointrecord;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 用户积分记录 Service 接口
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
public interface PointRecordService {
|
||||
|
||||
/**
|
||||
* 创建用户积分记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createRecord(@Valid PointRecordCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新用户积分记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateRecord(@Valid PointRecordUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除用户积分记录
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户积分记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用户积分记录
|
||||
*/
|
||||
PointRecordDO getRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户积分记录列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 用户积分记录列表
|
||||
*/
|
||||
List<PointRecordDO> getRecordList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得用户积分记录分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户积分记录分页
|
||||
*/
|
||||
PageResult<PointRecordDO> getRecordPage(PointRecordPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得用户积分记录列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 用户积分记录列表
|
||||
*/
|
||||
List<PointRecordDO> getRecordList(PointRecordExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.service.pointrecord;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.point.convert.pointrecord.PointRecordConvert;
|
||||
import cn.iocoder.yudao.module.point.dal.mysql.pointrecord.PointRecordMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 用户积分记录 Service 实现类
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PointRecordServiceImpl implements PointRecordService {
|
||||
|
||||
@Resource
|
||||
private PointRecordMapper recordMapper;
|
||||
|
||||
@Override
|
||||
public Long createRecord(PointRecordCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
PointRecordDO record = PointRecordConvert.INSTANCE.convert(createReqVO);
|
||||
recordMapper.insert(record);
|
||||
// 返回
|
||||
return record.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateRecord(PointRecordUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateRecordExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PointRecordDO updateObj = PointRecordConvert.INSTANCE.convert(updateReqVO);
|
||||
recordMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteRecord(Long id) {
|
||||
// 校验存在
|
||||
validateRecordExists(id);
|
||||
// 删除
|
||||
recordMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateRecordExists(Long id) {
|
||||
if (recordMapper.selectById(id) == null) {
|
||||
throw exception(RECORD_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointRecordDO getRecord(Long id) {
|
||||
return recordMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PointRecordDO> getRecordList(Collection<Long> ids) {
|
||||
return recordMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PointRecordDO> getRecordPage(PointRecordPageReqVO pageReqVO) {
|
||||
return recordMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PointRecordDO> getRecordList(PointRecordExportReqVO exportReqVO) {
|
||||
return recordMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -1,102 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.service.signinconfig;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.point.convert.signinconfig.SignInConfigConvert;
|
||||
import cn.iocoder.yudao.module.point.dal.mysql.signinconfig.SignInConfigMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 积分签到规则 Service 实现类
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class SignInConfigServiceImpl implements SignInConfigService {
|
||||
|
||||
@Resource
|
||||
private SignInConfigMapper signInConfigMapper;
|
||||
|
||||
@Override
|
||||
public Integer createSignInConfig(SignInConfigCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
SignInConfigDO signInConfig = SignInConfigConvert.INSTANCE.convert(createReqVO);
|
||||
//判断是否重复插入签到天数
|
||||
validateSignInConfigExistsDay(signInConfig.getDay());
|
||||
signInConfigMapper.insert(signInConfig);
|
||||
// 返回
|
||||
return signInConfig.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSignInConfig(SignInConfigUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateSignInConfigExists(updateReqVO.getId());
|
||||
//判断是否重复插入签到天数
|
||||
validateSignInConfigSameDayNotSelf(updateReqVO);
|
||||
// 判断更新的
|
||||
SignInConfigDO updateObj = SignInConfigConvert.INSTANCE.convert(updateReqVO);
|
||||
|
||||
|
||||
signInConfigMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSignInConfig(Integer id) {
|
||||
// 校验存在
|
||||
validateSignInConfigExists(id);
|
||||
// 删除
|
||||
signInConfigMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateSignInConfigExists(Integer id) {
|
||||
if (signInConfigMapper.selectById(id) == null) {
|
||||
throw exception(SIGN_IN_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
//根据签到天数判断是否存在一个相同的天数
|
||||
private void validateSignInConfigExistsDay(Integer day) {
|
||||
if (signInConfigMapper.selectCount(SignInConfigDO::getDay,day)>0) {
|
||||
throw exception(SIGN_IN_CONFIG_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
//更新天数时判断是否有重复的天数,需要去除自己
|
||||
private void validateSignInConfigSameDayNotSelf(SignInConfigUpdateReqVO reqVO) {
|
||||
if (signInConfigMapper.selectSameDayNotSelf(reqVO)>0) {
|
||||
throw exception(SIGN_IN_CONFIG_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SignInConfigDO getSignInConfig(Integer id) {
|
||||
return signInConfigMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SignInConfigDO> getSignInConfigList(Collection<Integer> ids) {
|
||||
return signInConfigMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<SignInConfigDO> getSignInConfigPage(SignInConfigPageReqVO pageReqVO) {
|
||||
return signInConfigMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SignInConfigDO> getSignInConfigList(SignInConfigExportReqVO exportReqVO) {
|
||||
return signInConfigMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -1,70 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.service.signinrecord;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 用户签到积分 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface SignInRecordService {
|
||||
|
||||
/**
|
||||
* 创建用户签到积分
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createSignInRecord(@Valid SignInRecordCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新用户签到积分
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateSignInRecord(@Valid SignInRecordUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除用户签到积分
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteSignInRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户签到积分
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用户签到积分
|
||||
*/
|
||||
SignInRecordDO getSignInRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户签到积分列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 用户签到积分列表
|
||||
*/
|
||||
List<SignInRecordDO> getSignInRecordList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得用户签到积分分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户签到积分分页
|
||||
*/
|
||||
PageResult<SignInRecordDO> getSignInRecordPage(SignInRecordPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得用户签到积分列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 用户签到积分列表
|
||||
*/
|
||||
List<SignInRecordDO> getSignInRecordList(SignInRecordExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.service.signinrecord;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.point.convert.signinrecord.SignInRecordConvert;
|
||||
import cn.iocoder.yudao.module.point.dal.mysql.signinrecord.SignInRecordMapper;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 用户签到积分 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class SignInRecordServiceImpl implements SignInRecordService {
|
||||
|
||||
@Resource
|
||||
private SignInRecordMapper signInRecordMapper;
|
||||
|
||||
@Override
|
||||
public Long createSignInRecord(SignInRecordCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
SignInRecordDO signInRecord = SignInRecordConvert.INSTANCE.convert(createReqVO);
|
||||
signInRecordMapper.insert(signInRecord);
|
||||
// 返回
|
||||
return signInRecord.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSignInRecord(SignInRecordUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateSignInRecordExists(updateReqVO.getId());
|
||||
// 更新
|
||||
SignInRecordDO updateObj = SignInRecordConvert.INSTANCE.convert(updateReqVO);
|
||||
signInRecordMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteSignInRecord(Long id) {
|
||||
// 校验存在
|
||||
validateSignInRecordExists(id);
|
||||
// 删除
|
||||
signInRecordMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateSignInRecordExists(Long id) {
|
||||
if (signInRecordMapper.selectById(id) == null) {
|
||||
throw exception(SIGN_IN_RECORD_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SignInRecordDO getSignInRecord(Long id) {
|
||||
return signInRecordMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SignInRecordDO> getSignInRecordList(Collection<Long> ids) {
|
||||
return signInRecordMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<SignInRecordDO> getSignInRecordPage(SignInRecordPageReqVO pageReqVO) {
|
||||
return signInRecordMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SignInRecordDO> getSignInRecordList(SignInRecordExportReqVO exportReqVO) {
|
||||
return signInRecordMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -1,152 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.service.pointconfig;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO;
|
||||
import cn.iocoder.yudao.module.point.dal.mysql.pointconfig.PointConfigMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link PointConfigServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Import(PointConfigServiceImpl.class)
|
||||
public class PointConfigServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private PointConfigServiceImpl configService;
|
||||
|
||||
@Resource
|
||||
private PointConfigMapper configMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateConfig_success() {
|
||||
// 准备参数
|
||||
PointConfigCreateReqVO reqVO = randomPojo(PointConfigCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Integer configId = configService.createConfig(reqVO);
|
||||
// 断言
|
||||
assertNotNull(configId);
|
||||
// 校验记录的属性是否正确
|
||||
PointConfigDO config = configMapper.selectById(configId);
|
||||
assertPojoEquals(reqVO, config);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateConfig_success() {
|
||||
// mock 数据
|
||||
PointConfigDO dbConfig = randomPojo(PointConfigDO.class);
|
||||
configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
PointConfigUpdateReqVO reqVO = randomPojo(PointConfigUpdateReqVO.class, o -> {
|
||||
o.setId(dbConfig.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
configService.updateConfig(reqVO);
|
||||
// 校验是否更新正确
|
||||
PointConfigDO config = configMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, config);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateConfig_notExists() {
|
||||
// 准备参数
|
||||
PointConfigUpdateReqVO reqVO = randomPojo(PointConfigUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> configService.updateConfig(reqVO), CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteConfig_success() {
|
||||
// mock 数据
|
||||
PointConfigDO dbConfig = randomPojo(PointConfigDO.class);
|
||||
configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Integer id = dbConfig.getId();
|
||||
|
||||
// 调用
|
||||
configService.deleteConfig(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(configMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteConfig_notExists() {
|
||||
// 准备参数
|
||||
Integer id = RandomUtils.randomInteger();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> configService.deleteConfig(id), CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetConfigPage() {
|
||||
// mock 数据
|
||||
PointConfigDO dbConfig = randomPojo(PointConfigDO.class, o -> { // 等会查询到
|
||||
o.setTradeDeductEnable(null);
|
||||
});
|
||||
configMapper.insert(dbConfig);
|
||||
// 测试 tradeDeductEnable 不匹配
|
||||
configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setTradeDeductEnable(null)));
|
||||
// 准备参数
|
||||
PointConfigPageReqVO reqVO = new PointConfigPageReqVO();
|
||||
reqVO.setTradeDeductEnable(null);
|
||||
|
||||
// 调用
|
||||
PageResult<PointConfigDO> pageResult = configService.getConfigPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbConfig, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetConfigList() {
|
||||
// mock 数据
|
||||
PointConfigDO dbConfig = randomPojo(PointConfigDO.class, o -> { // 等会查询到
|
||||
o.setTradeDeductEnable(null);
|
||||
});
|
||||
configMapper.insert(dbConfig);
|
||||
// 测试 tradeDeductEnable 不匹配
|
||||
configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setTradeDeductEnable(null)));
|
||||
// 准备参数
|
||||
PointConfigExportReqVO reqVO = new PointConfigExportReqVO();
|
||||
reqVO.setTradeDeductEnable(null);
|
||||
|
||||
// 调用
|
||||
List<PointConfigDO> list = configService.getConfigList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbConfig, list.get(0));
|
||||
}
|
||||
|
||||
}
|
@ -1,183 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.service.pointrecord;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
|
||||
import cn.iocoder.yudao.module.point.dal.mysql.pointrecord.PointRecordMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link PointRecordServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Import(PointRecordServiceImpl.class)
|
||||
public class PointRecordServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private PointRecordServiceImpl recordService;
|
||||
|
||||
@Resource
|
||||
private PointRecordMapper recordMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateRecord_success() {
|
||||
// 准备参数
|
||||
PointRecordCreateReqVO reqVO = randomPojo(PointRecordCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long recordId = recordService.createRecord(reqVO);
|
||||
// 断言
|
||||
assertNotNull(recordId);
|
||||
// 校验记录的属性是否正确
|
||||
PointRecordDO record = recordMapper.selectById(recordId);
|
||||
assertPojoEquals(reqVO, record);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateRecord_success() {
|
||||
// mock 数据
|
||||
PointRecordDO dbRecord = randomPojo(PointRecordDO.class);
|
||||
recordMapper.insert(dbRecord);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
PointRecordUpdateReqVO reqVO = randomPojo(PointRecordUpdateReqVO.class, o -> {
|
||||
o.setId(dbRecord.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
recordService.updateRecord(reqVO);
|
||||
// 校验是否更新正确
|
||||
PointRecordDO record = recordMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, record);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateRecord_notExists() {
|
||||
// 准备参数
|
||||
PointRecordUpdateReqVO reqVO = randomPojo(PointRecordUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> recordService.updateRecord(reqVO), RECORD_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteRecord_success() {
|
||||
// mock 数据
|
||||
PointRecordDO dbRecord = randomPojo(PointRecordDO.class);
|
||||
recordMapper.insert(dbRecord);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbRecord.getId();
|
||||
|
||||
// 调用
|
||||
recordService.deleteRecord(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(recordMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteRecord_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> recordService.deleteRecord(id), RECORD_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetRecordPage() {
|
||||
// mock 数据
|
||||
PointRecordDO dbRecord = randomPojo(PointRecordDO.class, o -> { // 等会查询到
|
||||
o.setBizId(null);
|
||||
o.setBizType(null);
|
||||
o.setType(null);
|
||||
o.setTitle(null);
|
||||
o.setStatus(null);
|
||||
});
|
||||
recordMapper.insert(dbRecord);
|
||||
// 测试 bizId 不匹配
|
||||
recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setBizId(null)));
|
||||
// 测试 bizType 不匹配
|
||||
recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setBizType(null)));
|
||||
// 测试 type 不匹配
|
||||
recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setType(null)));
|
||||
// 测试 title 不匹配
|
||||
recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setTitle(null)));
|
||||
// 测试 status 不匹配
|
||||
recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setStatus(null)));
|
||||
// 准备参数
|
||||
PointRecordPageReqVO reqVO = new PointRecordPageReqVO();
|
||||
reqVO.setBizId(null);
|
||||
reqVO.setBizType(null);
|
||||
reqVO.setType(null);
|
||||
reqVO.setTitle(null);
|
||||
reqVO.setStatus(null);
|
||||
|
||||
// 调用
|
||||
PageResult<PointRecordDO> pageResult = recordService.getRecordPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbRecord, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetRecordList() {
|
||||
// mock 数据
|
||||
PointRecordDO dbRecord = randomPojo(PointRecordDO.class, o -> { // 等会查询到
|
||||
o.setBizId(null);
|
||||
o.setBizType(null);
|
||||
o.setType(null);
|
||||
o.setTitle(null);
|
||||
o.setStatus(null);
|
||||
});
|
||||
recordMapper.insert(dbRecord);
|
||||
// 测试 bizId 不匹配
|
||||
recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setBizId(null)));
|
||||
// 测试 bizType 不匹配
|
||||
recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setBizType(null)));
|
||||
// 测试 type 不匹配
|
||||
recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setType(null)));
|
||||
// 测试 title 不匹配
|
||||
recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setTitle(null)));
|
||||
// 测试 status 不匹配
|
||||
recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setStatus(null)));
|
||||
// 准备参数
|
||||
PointRecordExportReqVO reqVO = new PointRecordExportReqVO();
|
||||
reqVO.setBizId(null);
|
||||
reqVO.setBizType(null);
|
||||
reqVO.setType(null);
|
||||
reqVO.setTitle(null);
|
||||
reqVO.setStatus(null);
|
||||
|
||||
// 调用
|
||||
List<PointRecordDO> list = recordService.getRecordList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbRecord, list.get(0));
|
||||
}
|
||||
|
||||
}
|
@ -1,152 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.service.signinconfig;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
|
||||
import cn.iocoder.yudao.module.point.dal.mysql.signinconfig.SignInConfigMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link SignInConfigServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author QingX
|
||||
*/
|
||||
@Import(SignInConfigServiceImpl.class)
|
||||
public class SignInConfigServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private SignInConfigServiceImpl signInConfigService;
|
||||
|
||||
@Resource
|
||||
private SignInConfigMapper signInConfigMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateSignInConfig_success() {
|
||||
// 准备参数
|
||||
SignInConfigCreateReqVO reqVO = randomPojo(SignInConfigCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Integer signInConfigId = signInConfigService.createSignInConfig(reqVO);
|
||||
// 断言
|
||||
assertNotNull(signInConfigId);
|
||||
// 校验记录的属性是否正确
|
||||
SignInConfigDO signInConfig = signInConfigMapper.selectById(signInConfigId);
|
||||
assertPojoEquals(reqVO, signInConfig);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSignInConfig_success() {
|
||||
// mock 数据
|
||||
SignInConfigDO dbSignInConfig = randomPojo(SignInConfigDO.class);
|
||||
signInConfigMapper.insert(dbSignInConfig);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
SignInConfigUpdateReqVO reqVO = randomPojo(SignInConfigUpdateReqVO.class, o -> {
|
||||
o.setId(dbSignInConfig.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
signInConfigService.updateSignInConfig(reqVO);
|
||||
// 校验是否更新正确
|
||||
SignInConfigDO signInConfig = signInConfigMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, signInConfig);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSignInConfig_notExists() {
|
||||
// 准备参数
|
||||
SignInConfigUpdateReqVO reqVO = randomPojo(SignInConfigUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> signInConfigService.updateSignInConfig(reqVO), SIGN_IN_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteSignInConfig_success() {
|
||||
// mock 数据
|
||||
SignInConfigDO dbSignInConfig = randomPojo(SignInConfigDO.class);
|
||||
signInConfigMapper.insert(dbSignInConfig);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Integer id = dbSignInConfig.getId();
|
||||
|
||||
// 调用
|
||||
signInConfigService.deleteSignInConfig(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(signInConfigMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteSignInConfig_notExists() {
|
||||
// 准备参数
|
||||
Integer id = RandomUtils.randomInteger();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> signInConfigService.deleteSignInConfig(id), SIGN_IN_CONFIG_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetSignInConfigPage() {
|
||||
// mock 数据
|
||||
SignInConfigDO dbSignInConfig = randomPojo(SignInConfigDO.class, o -> { // 等会查询到
|
||||
o.setDay(null);
|
||||
});
|
||||
signInConfigMapper.insert(dbSignInConfig);
|
||||
// 测试 day 不匹配
|
||||
signInConfigMapper.insert(cloneIgnoreId(dbSignInConfig, o -> o.setDay(null)));
|
||||
// 准备参数
|
||||
SignInConfigPageReqVO reqVO = new SignInConfigPageReqVO();
|
||||
reqVO.setDay(null);
|
||||
|
||||
// 调用
|
||||
PageResult<SignInConfigDO> pageResult = signInConfigService.getSignInConfigPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbSignInConfig, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetSignInConfigList() {
|
||||
// mock 数据
|
||||
SignInConfigDO dbSignInConfig = randomPojo(SignInConfigDO.class, o -> { // 等会查询到
|
||||
o.setDay(null);
|
||||
});
|
||||
signInConfigMapper.insert(dbSignInConfig);
|
||||
// 测试 day 不匹配
|
||||
signInConfigMapper.insert(cloneIgnoreId(dbSignInConfig, o -> o.setDay(null)));
|
||||
// 准备参数
|
||||
SignInConfigExportReqVO reqVO = new SignInConfigExportReqVO();
|
||||
reqVO.setDay(null);
|
||||
|
||||
// 调用
|
||||
List<SignInConfigDO> list = signInConfigService.getSignInConfigList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbSignInConfig, list.get(0));
|
||||
}
|
||||
|
||||
}
|
@ -1,167 +0,0 @@
|
||||
package cn.iocoder.yudao.module.point.service.signinrecord;
|
||||
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
|
||||
import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
|
||||
import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
|
||||
import cn.iocoder.yudao.module.point.dal.mysql.signinrecord.SignInRecordMapper;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.hutool.core.util.RandomUtil.*;
|
||||
import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
|
||||
import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
/**
|
||||
* {@link SignInRecordServiceImpl} 的单元测试类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Import(SignInRecordServiceImpl.class)
|
||||
public class SignInRecordServiceImplTest extends BaseDbUnitTest {
|
||||
|
||||
@Resource
|
||||
private SignInRecordServiceImpl signInRecordService;
|
||||
|
||||
@Resource
|
||||
private SignInRecordMapper signInRecordMapper;
|
||||
|
||||
@Test
|
||||
public void testCreateSignInRecord_success() {
|
||||
// 准备参数
|
||||
SignInRecordCreateReqVO reqVO = randomPojo(SignInRecordCreateReqVO.class);
|
||||
|
||||
// 调用
|
||||
Long signInRecordId = signInRecordService.createSignInRecord(reqVO);
|
||||
// 断言
|
||||
assertNotNull(signInRecordId);
|
||||
// 校验记录的属性是否正确
|
||||
SignInRecordDO signInRecord = signInRecordMapper.selectById(signInRecordId);
|
||||
assertPojoEquals(reqVO, signInRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSignInRecord_success() {
|
||||
// mock 数据
|
||||
SignInRecordDO dbSignInRecord = randomPojo(SignInRecordDO.class);
|
||||
signInRecordMapper.insert(dbSignInRecord);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
SignInRecordUpdateReqVO reqVO = randomPojo(SignInRecordUpdateReqVO.class, o -> {
|
||||
o.setId(dbSignInRecord.getId()); // 设置更新的 ID
|
||||
});
|
||||
|
||||
// 调用
|
||||
signInRecordService.updateSignInRecord(reqVO);
|
||||
// 校验是否更新正确
|
||||
SignInRecordDO signInRecord = signInRecordMapper.selectById(reqVO.getId()); // 获取最新的
|
||||
assertPojoEquals(reqVO, signInRecord);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateSignInRecord_notExists() {
|
||||
// 准备参数
|
||||
SignInRecordUpdateReqVO reqVO = randomPojo(SignInRecordUpdateReqVO.class);
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> signInRecordService.updateSignInRecord(reqVO), SIGN_IN_RECORD_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteSignInRecord_success() {
|
||||
// mock 数据
|
||||
SignInRecordDO dbSignInRecord = randomPojo(SignInRecordDO.class);
|
||||
signInRecordMapper.insert(dbSignInRecord);// @Sql: 先插入出一条存在的数据
|
||||
// 准备参数
|
||||
Long id = dbSignInRecord.getId();
|
||||
|
||||
// 调用
|
||||
signInRecordService.deleteSignInRecord(id);
|
||||
// 校验数据不存在了
|
||||
assertNull(signInRecordMapper.selectById(id));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeleteSignInRecord_notExists() {
|
||||
// 准备参数
|
||||
Long id = randomLongId();
|
||||
|
||||
// 调用, 并断言异常
|
||||
assertServiceException(() -> signInRecordService.deleteSignInRecord(id), SIGN_IN_RECORD_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetSignInRecordPage() {
|
||||
// mock 数据
|
||||
SignInRecordDO dbSignInRecord = randomPojo(SignInRecordDO.class, o -> { // 等会查询到
|
||||
o.setUserId(null);
|
||||
o.setDay(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
signInRecordMapper.insert(dbSignInRecord);
|
||||
// 测试 userId 不匹配
|
||||
signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setUserId(null)));
|
||||
// 测试 day 不匹配
|
||||
signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setDay(null)));
|
||||
// 测试 createTime 不匹配
|
||||
signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
SignInRecordPageReqVO reqVO = new SignInRecordPageReqVO();
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setDay(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
PageResult<SignInRecordDO> pageResult = signInRecordService.getSignInRecordPage(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, pageResult.getTotal());
|
||||
assertEquals(1, pageResult.getList().size());
|
||||
assertPojoEquals(dbSignInRecord, pageResult.getList().get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
|
||||
public void testGetSignInRecordList() {
|
||||
// mock 数据
|
||||
SignInRecordDO dbSignInRecord = randomPojo(SignInRecordDO.class, o -> { // 等会查询到
|
||||
o.setUserId(null);
|
||||
o.setDay(null);
|
||||
o.setCreateTime(null);
|
||||
});
|
||||
signInRecordMapper.insert(dbSignInRecord);
|
||||
// 测试 userId 不匹配
|
||||
signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setUserId(null)));
|
||||
// 测试 day 不匹配
|
||||
signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setDay(null)));
|
||||
// 测试 createTime 不匹配
|
||||
signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setCreateTime(null)));
|
||||
// 准备参数
|
||||
SignInRecordExportReqVO reqVO = new SignInRecordExportReqVO();
|
||||
reqVO.setUserId(null);
|
||||
reqVO.setDay(null);
|
||||
reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
|
||||
|
||||
// 调用
|
||||
List<SignInRecordDO> list = signInRecordService.getSignInRecordList(reqVO);
|
||||
// 断言
|
||||
assertEquals(1, list.size());
|
||||
assertPojoEquals(dbSignInRecord, list.get(0));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user