diff --git a/sql/mysql/optional/member_point.sql b/sql/mysql/optional/member_point.sql new file mode 100644 index 000000000..08702cb8a --- /dev/null +++ b/sql/mysql/optional/member_point.sql @@ -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; diff --git a/sql/mysql/point.sql b/sql/mysql/point.sql deleted file mode 100644 index dfa625940..000000000 --- a/sql/mysql/point.sql +++ /dev/null @@ -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'); diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java index 1e77db1c8..8a4cd7f63 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java @@ -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, "用户签到积分不存在"); + } diff --git a/yudao-module-member/yudao-module-member-biz/pom.xml b/yudao-module-member/yudao-module-member-biz/pom.xml index 839ac3a88..7b50822d0 100644 --- a/yudao-module-member/yudao-module-member-biz/pom.xml +++ b/yudao-module-member/yudao-module-member-biz/pom.xml @@ -84,6 +84,11 @@ + + cn.iocoder.boot + yudao-spring-boot-starter-excel + + diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointConfigController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointConfigController.java index f0e6d0ee2..3cebd62c9 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointConfigController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointConfigController.java @@ -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 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 getConfig() { MemberPointConfigDO config = memberPointConfigService.getConfig(); return success(MemberPointConfigConvert.INSTANCE.convert(config)); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointRecordController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointRecordController.java new file mode 100644 index 000000000..70c7b9f09 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/MemberPointRecordController.java @@ -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 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 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> getRecordList(@RequestParam("ids") Collection ids) { + List list = recordService.getRecordList(ids); + return success(MemberPointRecordConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得用户积分记录分页") + @PreAuthorize("@ss.hasPermission('point:record:query')") + public CommonResult> getRecordPage(@Valid MemberPointRecordPageReqVO pageVO) { + PageResult 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 list = recordService.getRecordList(exportReqVO); + // 导出 Excel + List datas = MemberPointRecordConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "用户积分记录.xls", "数据", MemberPointRecordExcelVO.class, datas); + } + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java index 46ad58321..4d7de8d42 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/config/MemberPointConfigBaseVO.java @@ -12,6 +12,8 @@ import java.math.BigDecimal; @Data public class MemberPointConfigBaseVO { + private Long id; + @Schema(description = "积分抵扣开关", required = true, example = "true") private Boolean tradeDeductEnable; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordBaseVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordBaseVO.java similarity index 90% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordBaseVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordBaseVO.java index 0337aac8e..9d0c2604a 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordBaseVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordBaseVO.java @@ -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 = "业务编码不能为空") diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordCreateReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordCreateReqVO.java similarity index 53% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordCreateReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordCreateReqVO.java index 7062109d2..d0214c2cc 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordCreateReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordCreateReqVO.java @@ -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 { } diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordExcelVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordExcelVO.java similarity index 84% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordExcelVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordExcelVO.java index 3db1573fc..e093c58fa 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordExcelVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordExcelVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordExportReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordExportReqVO.java similarity index 78% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordExportReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordExportReqVO.java index d57ade55a..0858bbd4f 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordExportReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordExportReqVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java similarity index 83% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordPageReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java index b4570c618..7275314cd 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordPageReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordPageReqVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java similarity index 76% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordRespVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java index d40dee6ee..d48cf6de8 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordRespVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordRespVO.java @@ -1,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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordUpdateReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordUpdateReqVO.java similarity index 73% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordUpdateReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordUpdateReqVO.java index d053e0a0e..6da3e7688 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordUpdateReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/MemberPointRecordUpdateReqVO.java @@ -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 = "自增主键不能为空") diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/package-info.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/package-info.java deleted file mode 100644 index 284e2178b..000000000 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/point/vo/recrod/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/SignInConfigController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInConfigController.java similarity index 55% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/SignInConfigController.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInConfigController.java index 2ca25dd5a..39c885bc6 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/SignInConfigController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInConfigController.java @@ -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 createSignInConfig(@Valid @RequestBody SignInConfigCreateReqVO createReqVO) { - return success(signInConfigService.createSignInConfig(createReqVO)); + public CommonResult createSignInConfig(@Valid @RequestBody MemberSignInConfigCreateReqVO createReqVO) { + return success(memberSignInConfigService.createSignInConfig(createReqVO)); } @PutMapping("/update") @Operation(summary = "更新积分签到规则") @PreAuthorize("@ss.hasPermission('point:sign-in-config:update')") - public CommonResult updateSignInConfig(@Valid @RequestBody SignInConfigUpdateReqVO updateReqVO) { - signInConfigService.updateSignInConfig(updateReqVO); + public CommonResult 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 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 getSignInConfig(@RequestParam("id") Integer id) { - SignInConfigDO signInConfig = signInConfigService.getSignInConfig(id); - return success(SignInConfigConvert.INSTANCE.convert(signInConfig)); + public CommonResult 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> getSignInConfigList(@RequestParam("ids") Collection ids) { - List list = signInConfigService.getSignInConfigList(ids); - return success(SignInConfigConvert.INSTANCE.convertList(list)); + public CommonResult> getSignInConfigList(@RequestParam("ids") Collection ids) { + List list = memberSignInConfigService.getSignInConfigList(ids); + return success(MemberSignInConfigConvert.INSTANCE.convertList(list)); } @GetMapping("/page") @Operation(summary = "获得积分签到规则分页") @PreAuthorize("@ss.hasPermission('point:sign-in-config:query')") - public CommonResult> getSignInConfigPage(@Valid SignInConfigPageReqVO pageVO) { - PageResult pageResult = signInConfigService.getSignInConfigPage(pageVO); - return success(SignInConfigConvert.INSTANCE.convertPage(pageResult)); + public CommonResult> getSignInConfigPage(@Valid MemberSignInConfigPageReqVO pageVO) { + PageResult 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 list = signInConfigService.getSignInConfigList(exportReqVO); + List list = memberSignInConfigService.getSignInConfigList(exportReqVO); // 导出 Excel - List datas = SignInConfigConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "积分签到规则.xls", "数据", SignInConfigExcelVO.class, datas); + List datas = MemberSignInConfigConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "积分签到规则.xls", "数据", MemberSignInConfigExcelVO.class, datas); } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInRecordController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInRecordController.java new file mode 100644 index 000000000..fcb9f71e7 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/MemberSignInRecordController.java @@ -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 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 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> getSignInRecordList(@RequestParam("ids") Collection ids) { + List list = memberSignInRecordService.getSignInRecordList(ids); + return success(MemberSignInRecordConvert.INSTANCE.convertList(list)); + } + + @GetMapping("/page") + @Operation(summary = "获得用户签到积分分页") + @PreAuthorize("@ss.hasPermission('point:sign-in-record:query')") + public CommonResult> getSignInRecordPage(@Valid MemberSignInRecordPageReqVO pageVO) { + PageResult 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 list = memberSignInRecordService.getSignInRecordList(exportReqVO); + // 导出 Excel + List datas = MemberSignInRecordConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "用户签到积分.xls", "数据", MemberSignInRecordExcelVO.class, datas); + } + +} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigBaseVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigBaseVO.java similarity index 66% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigBaseVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigBaseVO.java index 4c2160dde..5410ccde7 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigBaseVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigBaseVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigCreateReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigCreateReqVO.java similarity index 52% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigCreateReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigCreateReqVO.java index 39098c192..34e921377 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigCreateReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigCreateReqVO.java @@ -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 { } diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigExcelVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigExcelVO.java similarity index 64% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigExcelVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigExcelVO.java index 8d066f2ae..c50c7a291 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigExcelVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigExcelVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigExportReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigExportReqVO.java similarity index 60% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigExportReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigExportReqVO.java index 473fe1153..f714786f6 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigExportReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigExportReqVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigPageReqVO.java similarity index 71% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigPageReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigPageReqVO.java index 892d1f2e8..7ffd3827a 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigPageReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigPageReqVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigRespVO.java similarity index 76% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigRespVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigRespVO.java index a78816c3f..a5bfcfa18 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigRespVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigRespVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigUpdateReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigUpdateReqVO.java similarity index 74% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigUpdateReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigUpdateReqVO.java index cf6c788e1..74361d5a9 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigUpdateReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInConfigUpdateReqVO.java @@ -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 = "规则自增主键不能为空") diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordBaseVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordBaseVO.java similarity index 66% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordBaseVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordBaseVO.java index 9cefa4a18..f593d0d35 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordBaseVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordBaseVO.java @@ -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; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordCreateReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordCreateReqVO.java new file mode 100644 index 000000000..f56e240a4 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordCreateReqVO.java @@ -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 { + +} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordExcelVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordExcelVO.java similarity index 68% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordExcelVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordExcelVO.java index de9ebf605..9deec36e1 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordExcelVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordExcelVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordExportReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordExportReqVO.java similarity index 77% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordExportReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordExportReqVO.java index 673042306..df919be76 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordExportReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordExportReqVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordPageReqVO.java similarity index 79% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordPageReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordPageReqVO.java index 49218aafa..d3808a831 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordPageReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordPageReqVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordRespVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordRespVO.java similarity index 66% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordRespVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordRespVO.java index d4180d1b1..a5b784412 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordRespVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordRespVO.java @@ -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; diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordUpdateReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordUpdateReqVO.java similarity index 59% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordUpdateReqVO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordUpdateReqVO.java index 81392d088..7fce60861 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordUpdateReqVO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/admin/signin/vo/MemberSignInRecordUpdateReqVO.java @@ -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不能为空") diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java index cf49d2951..d1cdd1d49 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointConfigConvert.java @@ -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); + + } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java new file mode 100644 index 000000000..8d94843cd --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java @@ -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 convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/signin/MemberSignInConfigConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/signin/MemberSignInConfigConvert.java new file mode 100644 index 000000000..1068e089e --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/signin/MemberSignInConfigConvert.java @@ -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 convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/signin/MemberSignInRecordConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/signin/MemberSignInRecordConvert.java new file mode 100644 index 000000000..bc8d1ca62 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/signin/MemberSignInRecordConvert.java @@ -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 convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/pointrecord/PointRecordDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java similarity index 84% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/pointrecord/PointRecordDO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java index 74197e70d..59b55d314 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/pointrecord/PointRecordDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/point/MemberPointRecordDO.java @@ -1,13 +1,12 @@ -package cn.iocoder.yudao.module.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 { /** * 自增主键 diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/signinconfig/SignInConfigDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInConfigDO.java similarity index 71% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/signinconfig/SignInConfigDO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInConfigDO.java index 9eb07c929..1c7bcd853 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/signinconfig/SignInConfigDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInConfigDO.java @@ -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 { /** * 规则自增主键 diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/signinrecord/SignInRecordDO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInRecordDO.java similarity index 72% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/signinrecord/SignInRecordDO.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInRecordDO.java index d75a852d3..8cf89cc43 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/signinrecord/SignInRecordDO.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/dataobject/signin/MemberSignInRecordDO.java @@ -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 diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java new file mode 100644 index 000000000..67cca615e --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java @@ -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 { + + default PageResult selectPage(MemberPointRecordPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .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 selectList(MemberPointRecordExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .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)); + } + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInConfigMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInConfigMapper.java new file mode 100644 index 000000000..5b6a9a7cc --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInConfigMapper.java @@ -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 { + + default PageResult selectPage(MemberSignInConfigPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(MemberSignInConfigDO::getDay, reqVO.getDay()) + .orderByAsc(MemberSignInConfigDO::getDay)); + } + + default List selectList(MemberSignInConfigExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(MemberSignInConfigDO::getDay, reqVO.getDay()) + .orderByDesc(MemberSignInConfigDO::getId)); + } + + // + default long selectSameDayNotSelf(MemberSignInConfigUpdateReqVO reqVO){ + return selectCount(new LambdaQueryWrapperX () + .ne(MemberSignInConfigDO::getId, reqVO.getId()) + .eq(MemberSignInConfigDO::getDay,reqVO.getDay()) + ); + } + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInRecordMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInRecordMapper.java new file mode 100644 index 000000000..e7d45569e --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/signin/MemberSignInRecordMapper.java @@ -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 { + + default PageResult selectPage(MemberSignInRecordPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .eqIfPresent(MemberSignInRecordDO::getUserId, reqVO.getUserId()) + .eqIfPresent(MemberSignInRecordDO::getDay, reqVO.getDay()) + .betweenIfPresent(MemberSignInRecordDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(MemberSignInRecordDO::getId)); + } + + default List selectList(MemberSignInRecordExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .eqIfPresent(MemberSignInRecordDO::getUserId, reqVO.getUserId()) + .eqIfPresent(MemberSignInRecordDO::getDay, reqVO.getDay()) + .betweenIfPresent(MemberSignInRecordDO::getCreateTime, reqVO.getCreateTime()) + .orderByDesc(MemberSignInRecordDO::getId)); + } + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java index 181537d55..103dc20b9 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointConfigServiceImpl.java @@ -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 list = pointConfigMapper.selectList(); + return list == null ? null : list.get(0); } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java new file mode 100644 index 000000000..1191ef86b --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java @@ -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 getRecordList(Collection ids); + + /** + * 获得用户积分记录分页 + * + * @param pageReqVO 分页查询 + * @return 用户积分记录分页 + */ + PageResult getRecordPage(MemberPointRecordPageReqVO pageReqVO); + + /** + * 获得用户积分记录列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 用户积分记录列表 + */ + List getRecordList(MemberPointRecordExportReqVO exportReqVO); + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java new file mode 100644 index 000000000..4199d2997 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java @@ -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 getRecordList(Collection ids) { + return recordMapper.selectBatchIds(ids); + } + + @Override + public PageResult getRecordPage(MemberPointRecordPageReqVO pageReqVO) { + return recordMapper.selectPage(pageReqVO); + } + + @Override + public List getRecordList(MemberPointRecordExportReqVO exportReqVO) { + return recordMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigService.java similarity index 50% rename from yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigService.java rename to yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigService.java index 486f08f49..28b993632 100644 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigService.java @@ -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 getSignInConfigList(Collection ids); + List getSignInConfigList(Collection ids); /** * 获得积分签到规则分页 @@ -57,7 +61,7 @@ public interface SignInConfigService { * @param pageReqVO 分页查询 * @return 积分签到规则分页 */ - PageResult getSignInConfigPage(SignInConfigPageReqVO pageReqVO); + PageResult getSignInConfigPage(MemberSignInConfigPageReqVO pageReqVO); /** * 获得积分签到规则列表, 用于 Excel 导出 @@ -65,6 +69,6 @@ public interface SignInConfigService { * @param exportReqVO 查询条件 * @return 积分签到规则列表 */ - List getSignInConfigList(SignInConfigExportReqVO exportReqVO); + List getSignInConfigList(MemberSignInConfigExportReqVO exportReqVO); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigServiceImpl.java new file mode 100644 index 000000000..8fdf8a54f --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInConfigServiceImpl.java @@ -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 getSignInConfigList(Collection ids) { + return memberSignInConfigMapper.selectBatchIds(ids); + } + + @Override + public PageResult getSignInConfigPage(MemberSignInConfigPageReqVO pageReqVO) { + return memberSignInConfigMapper.selectPage(pageReqVO); + } + + @Override + public List getSignInConfigList(MemberSignInConfigExportReqVO exportReqVO) { + return memberSignInConfigMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordService.java new file mode 100644 index 000000000..b5bda4720 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordService.java @@ -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 getSignInRecordList(Collection ids); + + /** + * 获得用户签到积分分页 + * + * @param pageReqVO 分页查询 + * @return 用户签到积分分页 + */ + PageResult getSignInRecordPage(MemberSignInRecordPageReqVO pageReqVO); + + /** + * 获得用户签到积分列表, 用于 Excel 导出 + * + * @param exportReqVO 查询条件 + * @return 用户签到积分列表 + */ + List getSignInRecordList(MemberSignInRecordExportReqVO exportReqVO); + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordServiceImpl.java new file mode 100644 index 000000000..3476dfa57 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/signin/MemberSignInRecordServiceImpl.java @@ -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 getSignInRecordList(Collection ids) { + return memberSignInRecordMapper.selectBatchIds(ids); + } + + @Override + public PageResult getSignInRecordPage(MemberSignInRecordPageReqVO pageReqVO) { + return memberSignInRecordMapper.selectPage(pageReqVO); + } + + @Override + public List getSignInRecordList(MemberSignInRecordExportReqVO exportReqVO) { + return memberSignInRecordMapper.selectList(exportReqVO); + } + +} diff --git a/yudao-module-point/pom.xml b/yudao-module-point/pom.xml deleted file mode 100644 index f0361dd60..000000000 --- a/yudao-module-point/pom.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - 4.0.0 - - cn.iocoder.boot - yudao - ${revision} - - - yudao-module-point - pom - - yudao-module-point-api - - - - \ No newline at end of file diff --git a/yudao-module-point/yudao-module-point-api/pom.xml b/yudao-module-point/yudao-module-point-api/pom.xml deleted file mode 100644 index 83898557f..000000000 --- a/yudao-module-point/yudao-module-point-api/pom.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - 4.0.0 - - cn.iocoder.boot - yudao-module-point - ${revision} - - - yudao-module-point-api - jar - - - - cn.iocoder.boot - yudao-common - - - - - org.springframework.boot - spring-boot-starter-validation - true - - - \ No newline at end of file diff --git a/yudao-module-point/yudao-module-point-api/src/main/java/cn/iocoder/yudao/module/point/enums/ErrorCodeConstants.java b/yudao-module-point/yudao-module-point-api/src/main/java/cn/iocoder/yudao/module/point/enums/ErrorCodeConstants.java deleted file mode 100644 index 8d4daf0fc..000000000 --- a/yudao-module-point/yudao-module-point-api/src/main/java/cn/iocoder/yudao/module/point/enums/ErrorCodeConstants.java +++ /dev/null @@ -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, "用户签到积分不存在"); - - - -} diff --git a/yudao-module-point/yudao-module-point-biz/pom.xml b/yudao-module-point/yudao-module-point-biz/pom.xml deleted file mode 100644 index fc4561441..000000000 --- a/yudao-module-point/yudao-module-point-biz/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - 4.0.0 - - cn.iocoder.boot - yudao-module-point - ${revision} - - - yudao-module-point-biz - jar - - - - cn.iocoder.boot - yudao-module-point-api - ${revision} - - - - - cn.iocoder.boot - yudao-spring-boot-starter-biz-operatelog - - - - - cn.iocoder.boot - yudao-spring-boot-starter-web - - - - cn.iocoder.boot - yudao-spring-boot-starter-security - - - - - cn.iocoder.boot - yudao-spring-boot-starter-mybatis - - - - - cn.iocoder.boot - yudao-spring-boot-starter-test - - - - - cn.iocoder.boot - yudao-spring-boot-starter-excel - - - \ No newline at end of file diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/PointRecordController.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/PointRecordController.java deleted file mode 100644 index 14c115a35..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/PointRecordController.java +++ /dev/null @@ -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 createRecord(@Valid @RequestBody PointRecordCreateReqVO createReqVO) { - return success(recordService.createRecord(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新用户积分记录") - @PreAuthorize("@ss.hasPermission('point:record:update')") - public CommonResult 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 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 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> getRecordList(@RequestParam("ids") Collection ids) { - List list = recordService.getRecordList(ids); - return success(PointRecordConvert.INSTANCE.convertList(list)); - } - - @GetMapping("/page") - @Operation(summary = "获得用户积分记录分页") - @PreAuthorize("@ss.hasPermission('point:record:query')") - public CommonResult> getRecordPage(@Valid PointRecordPageReqVO pageVO) { - PageResult 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 list = recordService.getRecordList(exportReqVO); - // 导出 Excel - List datas = PointRecordConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "用户积分记录.xls", "数据", PointRecordExcelVO.class, datas); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/SignInRecordController.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/SignInRecordController.java deleted file mode 100644 index a2a639c5d..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/SignInRecordController.java +++ /dev/null @@ -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 createSignInRecord(@Valid @RequestBody SignInRecordCreateReqVO createReqVO) { - return success(signInRecordService.createSignInRecord(createReqVO)); - } - - @PutMapping("/update") - @Operation(summary = "更新用户签到积分") - @PreAuthorize("@ss.hasPermission('point:sign-in-record:update')") - public CommonResult 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 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 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> getSignInRecordList(@RequestParam("ids") Collection ids) { - List list = signInRecordService.getSignInRecordList(ids); - return success(SignInRecordConvert.INSTANCE.convertList(list)); - } - - @GetMapping("/page") - @Operation(summary = "获得用户签到积分分页") - @PreAuthorize("@ss.hasPermission('point:sign-in-record:query')") - public CommonResult> getSignInRecordPage(@Valid SignInRecordPageReqVO pageVO) { - PageResult 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 list = signInRecordService.getSignInRecordList(exportReqVO); - // 导出 Excel - List datas = SignInRecordConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "用户签到积分.xls", "数据", SignInRecordExcelVO.class, datas); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordCreateReqVO.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordCreateReqVO.java deleted file mode 100644 index 9635b3076..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordCreateReqVO.java +++ /dev/null @@ -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 { - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/pointrecord/PointRecordConvert.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/pointrecord/PointRecordConvert.java deleted file mode 100644 index 556c154f8..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/pointrecord/PointRecordConvert.java +++ /dev/null @@ -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 convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/signinconfig/SignInConfigConvert.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/signinconfig/SignInConfigConvert.java deleted file mode 100644 index a602fd399..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/signinconfig/SignInConfigConvert.java +++ /dev/null @@ -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 convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/signinrecord/SignInRecordConvert.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/signinrecord/SignInRecordConvert.java deleted file mode 100644 index 6c3b434cb..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/signinrecord/SignInRecordConvert.java +++ /dev/null @@ -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 convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/pointrecord/PointRecordMapper.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/pointrecord/PointRecordMapper.java deleted file mode 100644 index 005056a30..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/pointrecord/PointRecordMapper.java +++ /dev/null @@ -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 { - - default PageResult selectPage(PointRecordPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .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 selectList(PointRecordExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .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)); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/signinconfig/SignInConfigMapper.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/signinconfig/SignInConfigMapper.java deleted file mode 100644 index 6188d3fef..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/signinconfig/SignInConfigMapper.java +++ /dev/null @@ -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 { - - default PageResult selectPage(SignInConfigPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(SignInConfigDO::getDay, reqVO.getDay()) - .orderByAsc(SignInConfigDO::getDay)); - } - - default List selectList(SignInConfigExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .eqIfPresent(SignInConfigDO::getDay, reqVO.getDay()) - .orderByDesc(SignInConfigDO::getId)); - } - - // - default long selectSameDayNotSelf(SignInConfigUpdateReqVO reqVO){ - return selectCount(new LambdaQueryWrapperX () - .ne(SignInConfigDO::getId, reqVO.getId()) - .eq(SignInConfigDO::getDay,reqVO.getDay()) - ); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/signinrecord/SignInRecordMapper.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/signinrecord/SignInRecordMapper.java deleted file mode 100644 index 9d0c1c6eb..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/signinrecord/SignInRecordMapper.java +++ /dev/null @@ -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 { - - default PageResult selectPage(SignInRecordPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .eqIfPresent(SignInRecordDO::getUserId, reqVO.getUserId()) - .eqIfPresent(SignInRecordDO::getDay, reqVO.getDay()) - .betweenIfPresent(SignInRecordDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(SignInRecordDO::getId)); - } - - default List selectList(SignInRecordExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .eqIfPresent(SignInRecordDO::getUserId, reqVO.getUserId()) - .eqIfPresent(SignInRecordDO::getDay, reqVO.getDay()) - .betweenIfPresent(SignInRecordDO::getCreateTime, reqVO.getCreateTime()) - .orderByDesc(SignInRecordDO::getId)); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordService.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordService.java deleted file mode 100644 index 99833ff8d..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordService.java +++ /dev/null @@ -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 getRecordList(Collection ids); - - /** - * 获得用户积分记录分页 - * - * @param pageReqVO 分页查询 - * @return 用户积分记录分页 - */ - PageResult getRecordPage(PointRecordPageReqVO pageReqVO); - - /** - * 获得用户积分记录列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 用户积分记录列表 - */ - List getRecordList(PointRecordExportReqVO exportReqVO); - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordServiceImpl.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordServiceImpl.java deleted file mode 100644 index a2c0d1ab9..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordServiceImpl.java +++ /dev/null @@ -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 getRecordList(Collection ids) { - return recordMapper.selectBatchIds(ids); - } - - @Override - public PageResult getRecordPage(PointRecordPageReqVO pageReqVO) { - return recordMapper.selectPage(pageReqVO); - } - - @Override - public List getRecordList(PointRecordExportReqVO exportReqVO) { - return recordMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigServiceImpl.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigServiceImpl.java deleted file mode 100644 index ac4947ddc..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigServiceImpl.java +++ /dev/null @@ -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 getSignInConfigList(Collection ids) { - return signInConfigMapper.selectBatchIds(ids); - } - - @Override - public PageResult getSignInConfigPage(SignInConfigPageReqVO pageReqVO) { - return signInConfigMapper.selectPage(pageReqVO); - } - - @Override - public List getSignInConfigList(SignInConfigExportReqVO exportReqVO) { - return signInConfigMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordService.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordService.java deleted file mode 100644 index 8910eec7f..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordService.java +++ /dev/null @@ -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 getSignInRecordList(Collection ids); - - /** - * 获得用户签到积分分页 - * - * @param pageReqVO 分页查询 - * @return 用户签到积分分页 - */ - PageResult getSignInRecordPage(SignInRecordPageReqVO pageReqVO); - - /** - * 获得用户签到积分列表, 用于 Excel 导出 - * - * @param exportReqVO 查询条件 - * @return 用户签到积分列表 - */ - List getSignInRecordList(SignInRecordExportReqVO exportReqVO); - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordServiceImpl.java b/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordServiceImpl.java deleted file mode 100644 index 00ff4967e..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordServiceImpl.java +++ /dev/null @@ -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 getSignInRecordList(Collection ids) { - return signInRecordMapper.selectBatchIds(ids); - } - - @Override - public PageResult getSignInRecordPage(SignInRecordPageReqVO pageReqVO) { - return signInRecordMapper.selectPage(pageReqVO); - } - - @Override - public List getSignInRecordList(SignInRecordExportReqVO exportReqVO) { - return signInRecordMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigServiceImplTest.java b/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigServiceImplTest.java deleted file mode 100644 index d012d03fe..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigServiceImplTest.java +++ /dev/null @@ -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 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 list = configService.getConfigList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbConfig, list.get(0)); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordServiceImplTest.java b/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordServiceImplTest.java deleted file mode 100644 index 32a7740f0..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordServiceImplTest.java +++ /dev/null @@ -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 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 list = recordService.getRecordList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbRecord, list.get(0)); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigServiceImplTest.java b/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigServiceImplTest.java deleted file mode 100644 index e0bd5a2b2..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigServiceImplTest.java +++ /dev/null @@ -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 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 list = signInConfigService.getSignInConfigList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbSignInConfig, list.get(0)); - } - -} diff --git a/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordServiceImplTest.java b/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordServiceImplTest.java deleted file mode 100644 index 267bfcd40..000000000 --- a/yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordServiceImplTest.java +++ /dev/null @@ -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 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 list = signInRecordService.getSignInRecordList(reqVO); - // 断言 - assertEquals(1, list.size()); - assertPojoEquals(dbSignInRecord, list.get(0)); - } - -}