Commit 798e322f08ff28d46cdca8c18fce6229131f1acf

Authored by 芋道源码
Committed by Gitee
2 parents 0d47d6ce 5f64fe05

!506 积分模块

Merge pull request !506 from QingX/feature/mall_product
Showing 67 changed files with 3482 additions and 16 deletions
sql/mysql/menu.sql 0 → 100644
  1 +-- 菜单 SQL
  2 +INSERT INTO system_menu(
  3 + name, permission, type, sort, parent_id,
  4 + path, icon, component, status, component_name
  5 +)
  6 +VALUES (
  7 + '积分设置管理', '', 2, 0, 2162,
  8 + 'config', '', 'point/config/index', 0, 'PointConfig'
  9 +);
  10 +
  11 +-- 按钮父菜单ID
  12 +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
  13 +SELECT @parentId := LAST_INSERT_ID();
  14 +
  15 +-- 按钮 SQL
  16 +INSERT INTO system_menu(
  17 + name, permission, type, sort, parent_id,
  18 + path, icon, component, status
  19 +)
  20 +VALUES (
  21 + '积分设置查询', 'point:config:query', 3, 1, @parentId,
  22 + '', '', '', 0
  23 +);
  24 +INSERT INTO system_menu(
  25 + name, permission, type, sort, parent_id,
  26 + path, icon, component, status
  27 +)
  28 +VALUES (
  29 + '积分设置创建', 'point:config:create', 3, 2, @parentId,
  30 + '', '', '', 0
  31 +);
  32 +INSERT INTO system_menu(
  33 + name, permission, type, sort, parent_id,
  34 + path, icon, component, status
  35 +)
  36 +VALUES (
  37 + '积分设置更新', 'point:config:update', 3, 3, @parentId,
  38 + '', '', '', 0
  39 +);
  40 +INSERT INTO system_menu(
  41 + name, permission, type, sort, parent_id,
  42 + path, icon, component, status
  43 +)
  44 +VALUES (
  45 + '积分设置删除', 'point:config:delete', 3, 4, @parentId,
  46 + '', '', '', 0
  47 +);
  48 +INSERT INTO system_menu(
  49 + name, permission, type, sort, parent_id,
  50 + path, icon, component, status
  51 +)
  52 +VALUES (
  53 + '积分设置导出', 'point:config:export', 3, 5, @parentId,
  54 + '', '', '', 0
  55 +);
  56 +
  57 +
  58 +
  59 +-- 菜单 SQL
  60 +INSERT INTO system_menu(
  61 + name, permission, type, sort, parent_id,
  62 + path, icon, component, status, component_name
  63 +)
  64 +VALUES (
  65 + '积分签到规则管理', '', 2, 0, 2162,
  66 + 'sign-in-config', '', 'point/signInConfig/index', 0, 'SignInConfig'
  67 +);
  68 +
  69 +-- 按钮父菜单ID
  70 +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
  71 +SELECT @parentId := LAST_INSERT_ID();
  72 +
  73 +-- 按钮 SQL
  74 +INSERT INTO system_menu(
  75 + name, permission, type, sort, parent_id,
  76 + path, icon, component, status
  77 +)
  78 +VALUES (
  79 + '积分签到规则查询', 'point:sign-in-config:query', 3, 1, @parentId,
  80 + '', '', '', 0
  81 +);
  82 +INSERT INTO system_menu(
  83 + name, permission, type, sort, parent_id,
  84 + path, icon, component, status
  85 +)
  86 +VALUES (
  87 + '积分签到规则创建', 'point:sign-in-config:create', 3, 2, @parentId,
  88 + '', '', '', 0
  89 +);
  90 +INSERT INTO system_menu(
  91 + name, permission, type, sort, parent_id,
  92 + path, icon, component, status
  93 +)
  94 +VALUES (
  95 + '积分签到规则更新', 'point:sign-in-config:update', 3, 3, @parentId,
  96 + '', '', '', 0
  97 +);
  98 +INSERT INTO system_menu(
  99 + name, permission, type, sort, parent_id,
  100 + path, icon, component, status
  101 +)
  102 +VALUES (
  103 + '积分签到规则删除', 'point:sign-in-config:delete', 3, 4, @parentId,
  104 + '', '', '', 0
  105 +);
  106 +INSERT INTO system_menu(
  107 + name, permission, type, sort, parent_id,
  108 + path, icon, component, status
  109 +)
  110 +VALUES (
  111 + '积分签到规则导出', 'point:sign-in-config:export', 3, 5, @parentId,
  112 + '', '', '', 0
  113 +);
  114 +
  115 +
  116 +-- 菜单 SQL
  117 +INSERT INTO system_menu(
  118 + name, permission, type, sort, parent_id,
  119 + path, icon, component, status, component_name
  120 +)
  121 +VALUES (
  122 + '用户积分记录管理', '', 2, 0, 2162,
  123 + 'record', '', 'point/record/index', 0, 'PointRecord'
  124 +);
  125 +
  126 +-- 按钮父菜单ID
  127 +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
  128 +SELECT @parentId := LAST_INSERT_ID();
  129 +
  130 +-- 按钮 SQL
  131 +INSERT INTO system_menu(
  132 + name, permission, type, sort, parent_id,
  133 + path, icon, component, status
  134 +)
  135 +VALUES (
  136 + '用户积分记录查询', 'point:record:query', 3, 1, @parentId,
  137 + '', '', '', 0
  138 +);
  139 +INSERT INTO system_menu(
  140 + name, permission, type, sort, parent_id,
  141 + path, icon, component, status
  142 +)
  143 +VALUES (
  144 + '用户积分记录创建', 'point:record:create', 3, 2, @parentId,
  145 + '', '', '', 0
  146 +);
  147 +INSERT INTO system_menu(
  148 + name, permission, type, sort, parent_id,
  149 + path, icon, component, status
  150 +)
  151 +VALUES (
  152 + '用户积分记录更新', 'point:record:update', 3, 3, @parentId,
  153 + '', '', '', 0
  154 +);
  155 +INSERT INTO system_menu(
  156 + name, permission, type, sort, parent_id,
  157 + path, icon, component, status
  158 +)
  159 +VALUES (
  160 + '用户积分记录删除', 'point:record:delete', 3, 4, @parentId,
  161 + '', '', '', 0
  162 +);
  163 +INSERT INTO system_menu(
  164 + name, permission, type, sort, parent_id,
  165 + path, icon, component, status
  166 +)
  167 +VALUES (
  168 + '用户积分记录导出', 'point:record:export', 3, 5, @parentId,
  169 + '', '', '', 0
  170 +);
  171 +
  172 +
  173 +
  174 +-- 菜单 SQL
  175 +INSERT INTO system_menu(
  176 + name, permission, type, sort, parent_id,
  177 + path, icon, component, status, component_name
  178 +)
  179 +VALUES (
  180 + '用户签到积分管理', '', 2, 0, 2162,
  181 + 'sign-in-record', '', 'point/signInRecord/index', 0, 'SignInRecord'
  182 +);
  183 +
  184 +-- 按钮父菜单ID
  185 +-- 暂时只支持 MySQL。如果你是 Oracle、PostgreSQL、SQLServer 的话,需要手动修改 @parentId 的部分的代码
  186 +SELECT @parentId := LAST_INSERT_ID();
  187 +
  188 +-- 按钮 SQL
  189 +INSERT INTO system_menu(
  190 + name, permission, type, sort, parent_id,
  191 + path, icon, component, status
  192 +)
  193 +VALUES (
  194 + '用户签到积分查询', 'point:sign-in-record:query', 3, 1, @parentId,
  195 + '', '', '', 0
  196 +);
  197 +INSERT INTO system_menu(
  198 + name, permission, type, sort, parent_id,
  199 + path, icon, component, status
  200 +)
  201 +VALUES (
  202 + '用户签到积分创建', 'point:sign-in-record:create', 3, 2, @parentId,
  203 + '', '', '', 0
  204 +);
  205 +INSERT INTO system_menu(
  206 + name, permission, type, sort, parent_id,
  207 + path, icon, component, status
  208 +)
  209 +VALUES (
  210 + '用户签到积分更新', 'point:sign-in-record:update', 3, 3, @parentId,
  211 + '', '', '', 0
  212 +);
  213 +INSERT INTO system_menu(
  214 + name, permission, type, sort, parent_id,
  215 + path, icon, component, status
  216 +)
  217 +VALUES (
  218 + '用户签到积分删除', 'point:sign-in-record:delete', 3, 4, @parentId,
  219 + '', '', '', 0
  220 +);
  221 +INSERT INTO system_menu(
  222 + name, permission, type, sort, parent_id,
  223 + path, icon, component, status
  224 +)
  225 +VALUES (
  226 + '用户签到积分导出', 'point:sign-in-record:export', 3, 5, @parentId,
  227 + '', '', '', 0
  228 +);
  229 +
  230 +
... ...
sql/mysql/point.sql 0 → 100644
  1 +/*
  2 + Navicat Premium Data Transfer
  3 +
  4 + Source Server : docer-master-root(3308)
  5 + Source Server Type : MySQL
  6 + Source Server Version : 80030
  7 + Source Host : 10.211.55.5:3308
  8 + Source Schema : mall
  9 +
  10 + Target Server Type : MySQL
  11 + Target Server Version : 80030
  12 + File Encoding : 65001
  13 +
  14 + Date: 10/06/2023 20:13:57
  15 +*/
  16 +
  17 +SET NAMES utf8mb4;
  18 +SET FOREIGN_KEY_CHECKS = 0;
  19 +
  20 +-- ----------------------------
  21 +-- Table structure for member_point_config
  22 +-- ----------------------------
  23 +DROP TABLE IF EXISTS `member_point_config`;
  24 +CREATE TABLE `member_point_config` (
  25 + `id` int NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  26 + `trade_deduct_enable` int DEFAULT NULL COMMENT '1 开启积分抵扣\n0 关闭积分抵扣',
  27 + `trade_deduct_unit_price` decimal(10,2) DEFAULT NULL COMMENT '积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元)',
  28 + `trade_deduct_max_price` bigint DEFAULT NULL COMMENT '积分抵扣最大值',
  29 + `trade_give_point` bigint DEFAULT NULL COMMENT '1元赠送多少分',
  30 + `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  31 + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '变更时间',
  32 + `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户id',
  33 + `deleted` int DEFAULT '0' COMMENT '是否被删除 0 未删除 1已删除',
  34 + `creator` varchar(255) DEFAULT NULL COMMENT '创建人',
  35 + `updater` varchar(255) DEFAULT NULL COMMENT '更新人',
  36 + PRIMARY KEY (`id`)
  37 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='积分设置';
  38 +
  39 +-- ----------------------------
  40 +-- Records of member_point_config
  41 +-- ----------------------------
  42 +BEGIN;
  43 +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');
  44 +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');
  45 +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');
  46 +COMMIT;
  47 +
  48 +-- ----------------------------
  49 +-- Table structure for member_point_record
  50 +-- ----------------------------
  51 +DROP TABLE IF EXISTS `member_point_record`;
  52 +CREATE TABLE `member_point_record` (
  53 + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键',
  54 + `biz_id` varchar(255) DEFAULT NULL COMMENT '业务编码',
  55 + `biz_type` varchar(255) DEFAULT NULL COMMENT '业务类型',
  56 + `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '1增加 0扣减',
  57 + `title` varchar(255) DEFAULT NULL COMMENT '积分标题',
  58 + `description` varchar(5000) DEFAULT NULL COMMENT '积分描述',
  59 + `point` int DEFAULT NULL COMMENT '积分',
  60 + `total_point` int NOT NULL COMMENT '变动后的积分',
  61 + `status` int DEFAULT NULL COMMENT '状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款)\n',
  62 + `user_id` int DEFAULT NULL COMMENT '用户id',
  63 + `freezing_time` datetime DEFAULT NULL COMMENT '冻结时间',
  64 + `thawing_time` datetime DEFAULT NULL COMMENT '解冻时间',
  65 + `create_time` datetime DEFAULT NULL COMMENT '发生时间',
  66 + `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户',
  67 + `deleted` int DEFAULT '0' COMMENT '是否删除',
  68 + `creator` varchar(255) DEFAULT NULL COMMENT '创建用户',
  69 + `updater` varchar(255) DEFAULT NULL COMMENT '更新用户',
  70 + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
  71 + PRIMARY KEY (`id`),
  72 + KEY `index_userId` (`user_id`),
  73 + KEY `index_title` (`title`) USING BTREE
  74 +) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户积分记录';
  75 +
  76 +-- ----------------------------
  77 +-- Records of member_point_record
  78 +-- ----------------------------
  79 +BEGIN;
  80 +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');
  81 +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');
  82 +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');
  83 +COMMIT;
  84 +
  85 +-- ----------------------------
  86 +-- Table structure for member_sign_in_config
  87 +-- ----------------------------
  88 +DROP TABLE IF EXISTS `member_sign_in_config`;
  89 +CREATE TABLE `member_sign_in_config` (
  90 + `id` int NOT NULL AUTO_INCREMENT COMMENT '规则自增主键',
  91 + `day` int DEFAULT NULL COMMENT '签到第x天',
  92 + `point` int DEFAULT NULL COMMENT '签到天数对应分数',
  93 + `create_time` datetime DEFAULT NULL COMMENT '创建时间',
  94 + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '变更时间',
  95 + `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户id',
  96 + `deleted` int DEFAULT '0' COMMENT '是否删除',
  97 + `creator` varchar(255) DEFAULT NULL COMMENT '创建人',
  98 + `updater` varchar(255) DEFAULT NULL COMMENT '变更人',
  99 + PRIMARY KEY (`id`)
  100 +) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='积分签到规则';
  101 +
  102 +-- ----------------------------
  103 +-- Records of member_sign_in_config
  104 +-- ----------------------------
  105 +BEGIN;
  106 +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');
  107 +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');
  108 +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');
  109 +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');
  110 +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');
  111 +COMMIT;
  112 +
  113 +-- ----------------------------
  114 +-- Table structure for member_sign_in_record
  115 +-- ----------------------------
  116 +DROP TABLE IF EXISTS `member_sign_in_record`;
  117 +CREATE TABLE `member_sign_in_record` (
  118 + `id` bigint NOT NULL AUTO_INCREMENT COMMENT '签到自增id',
  119 + `user_id` int DEFAULT NULL COMMENT '签到用户',
  120 + `day` int DEFAULT NULL COMMENT '第几天签到',
  121 + `point` int DEFAULT NULL COMMENT '签到的分数',
  122 + `create_time` datetime DEFAULT NULL COMMENT '签到时间',
  123 + `update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '变更时间',
  124 + `tenant_id` varchar(255) DEFAULT NULL COMMENT '租户id',
  125 + `deleted` int DEFAULT '0' COMMENT '是否删除',
  126 + `creator` varchar(255) DEFAULT NULL COMMENT '创建人',
  127 + `updater` varchar(255) DEFAULT NULL COMMENT '更新人',
  128 + PRIMARY KEY (`id`)
  129 +) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='用户签到积分';
  130 +
  131 +-- ----------------------------
  132 +-- Records of member_sign_in_record
  133 +-- ----------------------------
  134 +BEGIN;
  135 +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');
  136 +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');
  137 +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');
  138 +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');
  139 +COMMIT;
  140 +
  141 +SET FOREIGN_KEY_CHECKS = 1;
  142 +
  143 +
  144 +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');
  145 +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');
  146 +
  147 +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');
  148 +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');
  149 +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');
  150 +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');
  151 +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');
  152 +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');
... ...
yudao-module-point/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <modelVersion>4.0.0</modelVersion>
  6 + <parent>
  7 + <groupId>cn.iocoder.boot</groupId>
  8 + <artifactId>yudao</artifactId>
  9 + <version>${revision}</version>
  10 + </parent>
  11 +
  12 + <artifactId>yudao-module-point</artifactId>
  13 + <packaging>pom</packaging>
  14 + <modules>
  15 + <module>yudao-module-point-api</module>
  16 + </modules>
  17 +
  18 +
  19 +</project>
0 20 \ No newline at end of file
... ...
yudao-module-point/yudao-module-point-api/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <modelVersion>4.0.0</modelVersion>
  6 + <parent>
  7 + <groupId>cn.iocoder.boot</groupId>
  8 + <artifactId>yudao-module-point</artifactId>
  9 + <version>${revision}</version>
  10 + </parent>
  11 +
  12 + <artifactId>yudao-module-point-api</artifactId>
  13 + <packaging>jar</packaging>
  14 +
  15 + <dependencies>
  16 + <dependency>
  17 + <groupId>cn.iocoder.boot</groupId>
  18 + <artifactId>yudao-common</artifactId>
  19 + </dependency>
  20 +
  21 + <!-- 参数校验 -->
  22 + <dependency>
  23 + <groupId>org.springframework.boot</groupId>
  24 + <artifactId>spring-boot-starter-validation</artifactId>
  25 + <optional>true</optional>
  26 + </dependency>
  27 + </dependencies>
  28 +</project>
0 29 \ No newline at end of file
... ...
yudao-module-point/yudao-module-point-api/src/main/java/cn/iocoder/yudao/module/point/enums/ErrorCodeConstants.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.enums;
  2 +
  3 +
  4 +import cn.iocoder.yudao.framework.common.exception.ErrorCode;
  5 +
  6 +/**
  7 + * Pay 错误码 Core 枚举类
  8 + *
  9 + * pay 系统,使用 1-007-000-000 段
  10 + */
  11 +public interface ErrorCodeConstants {
  12 +
  13 + ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(499, "积分设置不存在");
  14 +
  15 + ErrorCode CONFIG_EXISTS = new ErrorCode(499, "积分设置已存在,只允配置一条记录");
  16 +
  17 +
  18 + ErrorCode SIGN_IN_CONFIG_NOT_EXISTS = new ErrorCode(499, "签到天数规则不存在");
  19 + ErrorCode SIGN_IN_CONFIG_EXISTS = new ErrorCode(499, "签到天数规则已存在");
  20 +
  21 + ErrorCode RECORD_NOT_EXISTS = new ErrorCode( 499, "用户积分记录不存在");
  22 +
  23 + ErrorCode SIGN_IN_RECORD_NOT_EXISTS = new ErrorCode(499, "用户签到积分不存在");
  24 +
  25 +
  26 +
  27 +}
... ...
yudao-module-point/yudao-module-point-biz/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <modelVersion>4.0.0</modelVersion>
  6 + <parent>
  7 + <groupId>cn.iocoder.boot</groupId>
  8 + <artifactId>yudao-module-point</artifactId>
  9 + <version>${revision}</version>
  10 + </parent>
  11 +
  12 + <artifactId>yudao-module-point-biz</artifactId>
  13 + <packaging>jar</packaging>
  14 +
  15 + <dependencies>
  16 + <dependency>
  17 + <groupId>cn.iocoder.boot</groupId>
  18 + <artifactId>yudao-module-point-api</artifactId>
  19 + <version>${revision}</version>
  20 + </dependency>
  21 +
  22 + <!-- 业务组件 -->
  23 + <dependency>
  24 + <groupId>cn.iocoder.boot</groupId>
  25 + <artifactId>yudao-spring-boot-starter-biz-operatelog</artifactId>
  26 + </dependency>
  27 +
  28 + <!-- Web 相关 -->
  29 + <dependency>
  30 + <groupId>cn.iocoder.boot</groupId>
  31 + <artifactId>yudao-spring-boot-starter-web</artifactId>
  32 + </dependency>
  33 +
  34 + <dependency>
  35 + <groupId>cn.iocoder.boot</groupId>
  36 + <artifactId>yudao-spring-boot-starter-security</artifactId>
  37 + </dependency>
  38 +
  39 + <!-- DB 相关 -->
  40 + <dependency>
  41 + <groupId>cn.iocoder.boot</groupId>
  42 + <artifactId>yudao-spring-boot-starter-mybatis</artifactId>
  43 + </dependency>
  44 +
  45 + <!-- Test 测试相关 -->
  46 + <dependency>
  47 + <groupId>cn.iocoder.boot</groupId>
  48 + <artifactId>yudao-spring-boot-starter-test</artifactId>
  49 + </dependency>
  50 +
  51 + <!-- 工具类相关 -->
  52 + <dependency>
  53 + <groupId>cn.iocoder.boot</groupId>
  54 + <artifactId>yudao-spring-boot-starter-excel</artifactId>
  55 + </dependency>
  56 + </dependencies>
  57 +</project>
0 58 \ No newline at end of file
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/PointConfigController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointconfig;
  2 +
  3 +import org.springframework.web.bind.annotation.*;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import io.swagger.v3.oas.annotations.tags.Tag;
  8 +import io.swagger.v3.oas.annotations.Parameter;
  9 +import io.swagger.v3.oas.annotations.Operation;
  10 +
  11 +import javax.validation.constraints.*;
  12 +import javax.validation.*;
  13 +import javax.servlet.http.*;
  14 +import java.util.*;
  15 +import java.io.IOException;
  16 +
  17 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  18 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  19 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  20 +
  21 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  22 +
  23 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  24 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
  25 +
  26 +import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*;
  27 +import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO;
  28 +import cn.iocoder.yudao.module.point.convert.pointconfig.PointConfigConvert;
  29 +import cn.iocoder.yudao.module.point.service.pointconfig.PointConfigService;
  30 +
  31 +@Tag(name = "管理后台 - 积分设置")
  32 +@RestController
  33 +@RequestMapping("/point/config")
  34 +@Validated
  35 +public class PointConfigController {
  36 +
  37 + @Resource
  38 + private PointConfigService configService;
  39 +
  40 + @PostMapping("/create")
  41 + @Operation(summary = "创建积分设置")
  42 + @PreAuthorize("@ss.hasPermission('point:config:create')")
  43 + public CommonResult<Integer> createConfig(@Valid @RequestBody PointConfigCreateReqVO createReqVO) {
  44 + return success(configService.createConfig(createReqVO));
  45 + }
  46 +
  47 + @PutMapping("/update")
  48 + @Operation(summary = "更新积分设置")
  49 + @PreAuthorize("@ss.hasPermission('point:config:update')")
  50 + public CommonResult<Boolean> updateConfig(@Valid @RequestBody PointConfigUpdateReqVO updateReqVO) {
  51 + configService.updateConfig(updateReqVO);
  52 + return success(true);
  53 + }
  54 +
  55 + @DeleteMapping("/delete")
  56 + @Operation(summary = "删除积分设置")
  57 + @Parameter(name = "id", description = "编号", required = true)
  58 + @PreAuthorize("@ss.hasPermission('point:config:delete')")
  59 + public CommonResult<Boolean> deleteConfig(@RequestParam("id") Integer id) {
  60 + configService.deleteConfig(id);
  61 + return success(true);
  62 + }
  63 +
  64 + @GetMapping("/get")
  65 + @Operation(summary = "获得积分设置")
  66 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  67 + @PreAuthorize("@ss.hasPermission('point:config:query')")
  68 + public CommonResult<PointConfigRespVO> getConfig(@RequestParam("id") Integer id) {
  69 + PointConfigDO config = configService.getConfig(id);
  70 + return success(PointConfigConvert.INSTANCE.convert(config));
  71 + }
  72 +
  73 + @GetMapping("/list")
  74 + @Operation(summary = "获得积分设置列表")
  75 + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
  76 + @PreAuthorize("@ss.hasPermission('point:config:query')")
  77 + public CommonResult<List<PointConfigRespVO>> getConfigList(@RequestParam("ids") Collection<Integer> ids) {
  78 + List<PointConfigDO> list = configService.getConfigList(ids);
  79 + return success(PointConfigConvert.INSTANCE.convertList(list));
  80 + }
  81 +
  82 + @GetMapping("/page")
  83 + @Operation(summary = "获得积分设置分页")
  84 + @PreAuthorize("@ss.hasPermission('point:config:query')")
  85 + public CommonResult<PageResult<PointConfigRespVO>> getConfigPage(@Valid PointConfigPageReqVO pageVO) {
  86 + PageResult<PointConfigDO> pageResult = configService.getConfigPage(pageVO);
  87 + return success(PointConfigConvert.INSTANCE.convertPage(pageResult));
  88 + }
  89 +
  90 + @GetMapping("/export-excel")
  91 + @Operation(summary = "导出积分设置 Excel")
  92 + @PreAuthorize("@ss.hasPermission('point:config:export')")
  93 + @OperateLog(type = EXPORT)
  94 + public void exportConfigExcel(@Valid PointConfigExportReqVO exportReqVO,
  95 + HttpServletResponse response) throws IOException {
  96 + List<PointConfigDO> list = configService.getConfigList(exportReqVO);
  97 + // 导出 Excel
  98 + List<PointConfigExcelVO> datas = PointConfigConvert.INSTANCE.convertList02(list);
  99 + ExcelUtils.write(response, "积分设置.xls", "数据", PointConfigExcelVO.class, datas);
  100 + }
  101 +
  102 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigBaseVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.math.BigDecimal;
  7 +import java.time.LocalDateTime;
  8 +import java.time.LocalDateTime;
  9 +import javax.validation.constraints.*;
  10 +
  11 +/**
  12 + * 积分设置 Base VO,提供给添加、修改、详细的子 VO 使用
  13 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  14 + */
  15 +@Data
  16 +public class PointConfigBaseVO {
  17 +
  18 + @Schema(description = "1 开启积分抵扣 0 关闭积分抵扣", example = "1")
  19 + private Integer tradeDeductEnable;
  20 +
  21 + @Schema(description = "积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元)", example = "13506")
  22 + private BigDecimal tradeDeductUnitPrice;
  23 +
  24 + @Schema(description = "积分抵扣最大值", example = "32428")
  25 + private Long tradeDeductMaxPrice;
  26 +
  27 + @Schema(description = "1元赠送多少分")
  28 + private Long tradeGivePoint;
  29 +
  30 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@Schema(description = "管理后台 - 积分设置创建 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class PointConfigCreateReqVO extends PointConfigBaseVO {
  13 +
  14 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExcelVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.math.BigDecimal;
  7 +import java.time.LocalDateTime;
  8 +import java.time.LocalDateTime;
  9 +
  10 +import com.alibaba.excel.annotation.ExcelProperty;
  11 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  12 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  13 +
  14 +
  15 +/**
  16 + * 积分设置 Excel VO
  17 + *
  18 + * @author QingX
  19 + */
  20 +@Data
  21 +public class PointConfigExcelVO {
  22 +
  23 + @ExcelProperty("自增主键")
  24 + private Integer id;
  25 +
  26 + @ExcelProperty(value = "1 开启积分抵扣 0 关闭积分抵扣", converter = DictConvert.class)
  27 + @DictFormat("infra_boolean_string") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
  28 + private Integer tradeDeductEnable;
  29 +
  30 + @ExcelProperty("积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元)")
  31 + private BigDecimal tradeDeductUnitPrice;
  32 +
  33 + @ExcelProperty("积分抵扣最大值")
  34 + private Long tradeDeductMaxPrice;
  35 +
  36 + @ExcelProperty("1元赠送多少分")
  37 + private Long tradeGivePoint;
  38 +
  39 + @ExcelProperty("创建时间")
  40 + private LocalDateTime createTime;
  41 +
  42 + @ExcelProperty("变更时间")
  43 + private LocalDateTime updateTime;
  44 +
  45 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigExportReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +
  8 +@Schema(description = "管理后台 - 积分设置 Excel 导出 Request VO,参数和 PointConfigPageReqVO 是一致的")
  9 +@Data
  10 +public class PointConfigExportReqVO {
  11 +
  12 + @Schema(description = "1 开启积分抵扣 0 关闭积分抵扣", example = "1")
  13 + private Integer tradeDeductEnable;
  14 +
  15 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +
  8 +@Schema(description = "管理后台 - 积分设置分页 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class PointConfigPageReqVO extends PageParam {
  13 +
  14 + @Schema(description = "1 开启积分抵扣 0 关闭积分抵扣", example = "1")
  15 + private Integer tradeDeductEnable;
  16 +
  17 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.time.LocalDateTime;
  6 +
  7 +@Schema(description = "管理后台 - 积分设置 Response VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class PointConfigRespVO extends PointConfigBaseVO {
  12 +
  13 + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20937")
  14 + private Integer id;
  15 +
  16 + @Schema(description = "创建时间")
  17 + private LocalDateTime createTime;
  18 +
  19 + @Schema(description = "变更时间")
  20 + private LocalDateTime updateTime;
  21 +
  22 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointconfig/vo/PointConfigUpdateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@Schema(description = "管理后台 - 积分设置更新 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class PointConfigUpdateReqVO extends PointConfigBaseVO {
  13 +
  14 + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20937")
  15 + @NotNull(message = "自增主键不能为空")
  16 + private Integer id;
  17 +
  18 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/PointRecordController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointrecord;
  2 +
  3 +import org.springframework.web.bind.annotation.*;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import io.swagger.v3.oas.annotations.tags.Tag;
  8 +import io.swagger.v3.oas.annotations.Parameter;
  9 +import io.swagger.v3.oas.annotations.Operation;
  10 +
  11 +import javax.validation.constraints.*;
  12 +import javax.validation.*;
  13 +import javax.servlet.http.*;
  14 +import java.util.*;
  15 +import java.io.IOException;
  16 +
  17 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  18 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  19 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  20 +
  21 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  22 +
  23 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  24 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
  25 +
  26 +import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
  27 +import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
  28 +import cn.iocoder.yudao.module.point.convert.pointrecord.PointRecordConvert;
  29 +import cn.iocoder.yudao.module.point.service.pointrecord.PointRecordService;
  30 +
  31 +@Tag(name = "管理后台 - 用户积分记录")
  32 +@RestController
  33 +@RequestMapping("/point/record")
  34 +@Validated
  35 +public class PointRecordController {
  36 +
  37 + @Resource
  38 + private PointRecordService recordService;
  39 +
  40 + @PostMapping("/create")
  41 + @Operation(summary = "创建用户积分记录")
  42 + @PreAuthorize("@ss.hasPermission('point:record:create')")
  43 + public CommonResult<Long> createRecord(@Valid @RequestBody PointRecordCreateReqVO createReqVO) {
  44 + return success(recordService.createRecord(createReqVO));
  45 + }
  46 +
  47 + @PutMapping("/update")
  48 + @Operation(summary = "更新用户积分记录")
  49 + @PreAuthorize("@ss.hasPermission('point:record:update')")
  50 + public CommonResult<Boolean> updateRecord(@Valid @RequestBody PointRecordUpdateReqVO updateReqVO) {
  51 + recordService.updateRecord(updateReqVO);
  52 + return success(true);
  53 + }
  54 +
  55 + @DeleteMapping("/delete")
  56 + @Operation(summary = "删除用户积分记录")
  57 + @Parameter(name = "id", description = "编号", required = true)
  58 + @PreAuthorize("@ss.hasPermission('point:record:delete')")
  59 + public CommonResult<Boolean> deleteRecord(@RequestParam("id") Long id) {
  60 + recordService.deleteRecord(id);
  61 + return success(true);
  62 + }
  63 +
  64 + @GetMapping("/get")
  65 + @Operation(summary = "获得用户积分记录")
  66 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  67 + @PreAuthorize("@ss.hasPermission('point:record:query')")
  68 + public CommonResult<PointRecordRespVO> getRecord(@RequestParam("id") Long id) {
  69 + PointRecordDO record = recordService.getRecord(id);
  70 + return success(PointRecordConvert.INSTANCE.convert(record));
  71 + }
  72 +
  73 + @GetMapping("/list")
  74 + @Operation(summary = "获得用户积分记录列表")
  75 + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
  76 + @PreAuthorize("@ss.hasPermission('point:record:query')")
  77 + public CommonResult<List<PointRecordRespVO>> getRecordList(@RequestParam("ids") Collection<Long> ids) {
  78 + List<PointRecordDO> list = recordService.getRecordList(ids);
  79 + return success(PointRecordConvert.INSTANCE.convertList(list));
  80 + }
  81 +
  82 + @GetMapping("/page")
  83 + @Operation(summary = "获得用户积分记录分页")
  84 + @PreAuthorize("@ss.hasPermission('point:record:query')")
  85 + public CommonResult<PageResult<PointRecordRespVO>> getRecordPage(@Valid PointRecordPageReqVO pageVO) {
  86 + PageResult<PointRecordDO> pageResult = recordService.getRecordPage(pageVO);
  87 + return success(PointRecordConvert.INSTANCE.convertPage(pageResult));
  88 + }
  89 +
  90 + @GetMapping("/export-excel")
  91 + @Operation(summary = "导出用户积分记录 Excel")
  92 + @PreAuthorize("@ss.hasPermission('point:record:export')")
  93 + @OperateLog(type = EXPORT)
  94 + public void exportRecordExcel(@Valid PointRecordExportReqVO exportReqVO,
  95 + HttpServletResponse response) throws IOException {
  96 + List<PointRecordDO> list = recordService.getRecordList(exportReqVO);
  97 + // 导出 Excel
  98 + List<PointRecordExcelVO> datas = PointRecordConvert.INSTANCE.convertList02(list);
  99 + ExcelUtils.write(response, "用户积分记录.xls", "数据", PointRecordExcelVO.class, datas);
  100 + }
  101 +
  102 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordBaseVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.time.LocalDateTime;
  7 +import java.time.LocalDateTime;
  8 +import java.time.LocalDateTime;
  9 +import java.time.LocalDateTime;
  10 +import javax.validation.constraints.*;
  11 +import org.springframework.format.annotation.DateTimeFormat;
  12 +
  13 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  14 +
  15 +/**
  16 + * 用户积分记录 Base VO,提供给添加、修改、详细的子 VO 使用
  17 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  18 + */
  19 +@Data
  20 +public class PointRecordBaseVO {
  21 +
  22 + @Schema(description = "业务编码", example = "22706")
  23 + @NotNull(message = "业务编码不能为空")
  24 + private String bizId;
  25 +
  26 + @Schema(description = "业务类型", example = "1")
  27 + @NotNull(message = "业务类型不能为空")
  28 + private String bizType;
  29 +
  30 + @Schema(description = "1增加 0扣减", example = "1")
  31 + @NotNull(message = "操作类型不能为空")
  32 + private String type;
  33 +
  34 + @Schema(description = "积分标题")
  35 + @NotNull(message = "积分标题不能为空")
  36 + private String title;
  37 +
  38 + @Schema(description = "积分描述", example = "你猜")
  39 + private String description;
  40 +
  41 + @Schema(description = "积分")
  42 + @NotNull(message = "操作积分不能为空")
  43 + private Integer point;
  44 +
  45 + @Schema(description = "变动后的积分", requiredMode = Schema.RequiredMode.REQUIRED)
  46 +// @NotNull(message = "变动后的积分不能为空")
  47 + private Integer totalPoint;
  48 +
  49 + @Schema(description = "状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款) ", example = "1")
  50 + @NotNull(message = "积分状态不能为空")
  51 + private Integer status;
  52 +
  53 + @Schema(description = "用户id", example = "31169")
  54 + @NotNull(message = "用户ID不能为空")
  55 + private Integer userId;
  56 +
  57 + @Schema(description = "冻结时间")
  58 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  59 + @NotNull(message = "冻结时间不能为空")
  60 + private LocalDateTime freezingTime;
  61 +
  62 + @Schema(description = "解冻时间")
  63 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  64 + @NotNull(message = "解冻时间不能为空")
  65 + private LocalDateTime thawingTime;
  66 +
  67 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@Schema(description = "管理后台 - 用户积分记录创建 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class PointRecordCreateReqVO extends PointRecordBaseVO {
  13 +
  14 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordExcelVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.time.LocalDateTime;
  7 +import java.time.LocalDateTime;
  8 +import java.time.LocalDateTime;
  9 +import java.time.LocalDateTime;
  10 +
  11 +import com.alibaba.excel.annotation.ExcelProperty;
  12 +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
  13 +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
  14 +
  15 +
  16 +/**
  17 + * 用户积分记录 Excel VO
  18 + *
  19 + * @author QingX
  20 + */
  21 +@Data
  22 +public class PointRecordExcelVO {
  23 +
  24 + @ExcelProperty("自增主键")
  25 + private Long id;
  26 +
  27 + @ExcelProperty("业务编码")
  28 + private String bizId;
  29 +
  30 + @ExcelProperty(value = "业务类型", converter = DictConvert.class)
  31 + @DictFormat("biz_type") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
  32 + private String bizType;
  33 +
  34 + @ExcelProperty("1增加 0扣减")
  35 + private String type;
  36 +
  37 + @ExcelProperty("积分标题")
  38 + private String title;
  39 +
  40 + @ExcelProperty("积分描述")
  41 + private String description;
  42 +
  43 + @ExcelProperty("积分")
  44 + private Integer point;
  45 +
  46 + @ExcelProperty("变动后的积分")
  47 + private Integer totalPoint;
  48 +
  49 + @ExcelProperty(value = "状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款) ", converter = DictConvert.class)
  50 + @DictFormat("point_status") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中
  51 + private Integer status;
  52 +
  53 + @ExcelProperty("用户id")
  54 + private Integer userId;
  55 +
  56 + @ExcelProperty("冻结时间")
  57 + private LocalDateTime freezingTime;
  58 +
  59 + @ExcelProperty("解冻时间")
  60 + private LocalDateTime thawingTime;
  61 +
  62 + @ExcelProperty("发生时间")
  63 + private LocalDateTime createTime;
  64 +
  65 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordExportReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +
  8 +@Schema(description = "管理后台 - 用户积分记录 Excel 导出 Request VO,参数和 PointRecordPageReqVO 是一致的")
  9 +@Data
  10 +public class PointRecordExportReqVO {
  11 +
  12 + @Schema(description = "业务编码", example = "22706")
  13 + private String bizId;
  14 +
  15 + @Schema(description = "业务类型", example = "1")
  16 + private String bizType;
  17 +
  18 + @Schema(description = "1增加 0扣减", example = "1")
  19 + private String type;
  20 +
  21 + @Schema(description = "积分标题")
  22 + private String title;
  23 +
  24 + @Schema(description = "状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款) ", example = "1")
  25 + private Integer status;
  26 +
  27 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +
  8 +@Schema(description = "管理后台 - 用户积分记录分页 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class PointRecordPageReqVO extends PageParam {
  13 +
  14 + @Schema(description = "业务编码", example = "22706")
  15 + private String bizId;
  16 +
  17 + @Schema(description = "业务类型", example = "1")
  18 + private String bizType;
  19 +
  20 + @Schema(description = "1增加 0扣减", example = "1")
  21 + private String type;
  22 +
  23 + @Schema(description = "积分标题")
  24 + private String title;
  25 +
  26 + @Schema(description = "状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款) ", example = "1")
  27 + private Integer status;
  28 +
  29 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.time.LocalDateTime;
  6 +
  7 +@Schema(description = "管理后台 - 用户积分记录 Response VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class PointRecordRespVO extends PointRecordBaseVO {
  12 +
  13 + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31457")
  14 + private Long id;
  15 +
  16 + @Schema(description = "发生时间")
  17 + private LocalDateTime createTime;
  18 +
  19 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/pointrecord/vo/PointRecordUpdateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@Schema(description = "管理后台 - 用户积分记录更新 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class PointRecordUpdateReqVO extends PointRecordBaseVO {
  13 +
  14 + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31457")
  15 + @NotNull(message = "自增主键不能为空")
  16 + private Long id;
  17 +
  18 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/SignInConfigController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinconfig;
  2 +
  3 +import org.springframework.web.bind.annotation.*;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import io.swagger.v3.oas.annotations.tags.Tag;
  8 +import io.swagger.v3.oas.annotations.Parameter;
  9 +import io.swagger.v3.oas.annotations.Operation;
  10 +
  11 +import javax.validation.constraints.*;
  12 +import javax.validation.*;
  13 +import javax.servlet.http.*;
  14 +import java.util.*;
  15 +import java.io.IOException;
  16 +
  17 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  18 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  19 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  20 +
  21 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  22 +
  23 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  24 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
  25 +
  26 +import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
  27 +import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
  28 +import cn.iocoder.yudao.module.point.convert.signinconfig.SignInConfigConvert;
  29 +import cn.iocoder.yudao.module.point.service.signinconfig.SignInConfigService;
  30 +
  31 +@Tag(name = "管理后台 - 积分签到规则")
  32 +@RestController
  33 +@RequestMapping("/point/sign-in-config")
  34 +@Validated
  35 +public class SignInConfigController {
  36 +
  37 + @Resource
  38 + private SignInConfigService signInConfigService;
  39 +
  40 + @PostMapping("/create")
  41 + @Operation(summary = "创建积分签到规则")
  42 + @PreAuthorize("@ss.hasPermission('point:sign-in-config:create')")
  43 + public CommonResult<Integer> createSignInConfig(@Valid @RequestBody SignInConfigCreateReqVO createReqVO) {
  44 + return success(signInConfigService.createSignInConfig(createReqVO));
  45 + }
  46 +
  47 + @PutMapping("/update")
  48 + @Operation(summary = "更新积分签到规则")
  49 + @PreAuthorize("@ss.hasPermission('point:sign-in-config:update')")
  50 + public CommonResult<Boolean> updateSignInConfig(@Valid @RequestBody SignInConfigUpdateReqVO updateReqVO) {
  51 + signInConfigService.updateSignInConfig(updateReqVO);
  52 + return success(true);
  53 + }
  54 +
  55 + @DeleteMapping("/delete")
  56 + @Operation(summary = "删除积分签到规则")
  57 + @Parameter(name = "id", description = "编号", required = true)
  58 + @PreAuthorize("@ss.hasPermission('point:sign-in-config:delete')")
  59 + public CommonResult<Boolean> deleteSignInConfig(@RequestParam("id") Integer id) {
  60 + signInConfigService.deleteSignInConfig(id);
  61 + return success(true);
  62 + }
  63 +
  64 + @GetMapping("/get")
  65 + @Operation(summary = "获得积分签到规则")
  66 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  67 + @PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
  68 + public CommonResult<SignInConfigRespVO> getSignInConfig(@RequestParam("id") Integer id) {
  69 + SignInConfigDO signInConfig = signInConfigService.getSignInConfig(id);
  70 + return success(SignInConfigConvert.INSTANCE.convert(signInConfig));
  71 + }
  72 +
  73 + @GetMapping("/list")
  74 + @Operation(summary = "获得积分签到规则列表")
  75 + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
  76 + @PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
  77 + public CommonResult<List<SignInConfigRespVO>> getSignInConfigList(@RequestParam("ids") Collection<Integer> ids) {
  78 + List<SignInConfigDO> list = signInConfigService.getSignInConfigList(ids);
  79 + return success(SignInConfigConvert.INSTANCE.convertList(list));
  80 + }
  81 +
  82 + @GetMapping("/page")
  83 + @Operation(summary = "获得积分签到规则分页")
  84 + @PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
  85 + public CommonResult<PageResult<SignInConfigRespVO>> getSignInConfigPage(@Valid SignInConfigPageReqVO pageVO) {
  86 + PageResult<SignInConfigDO> pageResult = signInConfigService.getSignInConfigPage(pageVO);
  87 + return success(SignInConfigConvert.INSTANCE.convertPage(pageResult));
  88 + }
  89 +
  90 + @GetMapping("/export-excel")
  91 + @Operation(summary = "导出积分签到规则 Excel")
  92 + @PreAuthorize("@ss.hasPermission('point:sign-in-config:export')")
  93 + @OperateLog(type = EXPORT)
  94 + public void exportSignInConfigExcel(@Valid SignInConfigExportReqVO exportReqVO,
  95 + HttpServletResponse response) throws IOException {
  96 + List<SignInConfigDO> list = signInConfigService.getSignInConfigList(exportReqVO);
  97 + // 导出 Excel
  98 + List<SignInConfigExcelVO> datas = SignInConfigConvert.INSTANCE.convertList02(list);
  99 + ExcelUtils.write(response, "积分签到规则.xls", "数据", SignInConfigExcelVO.class, datas);
  100 + }
  101 +
  102 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigBaseVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.time.LocalDateTime;
  7 +import java.time.LocalDateTime;
  8 +import javax.validation.constraints.*;
  9 +
  10 +/**
  11 + * 积分签到规则 Base VO,提供给添加、修改、详细的子 VO 使用
  12 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  13 + */
  14 +@Data
  15 +public class SignInConfigBaseVO {
  16 +
  17 + @Schema(description = "签到第x天", example = "7")
  18 + private Integer day;
  19 +
  20 + @Schema(description = "签到天数对应分数", example = "10")
  21 + private Integer point;
  22 +
  23 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@Schema(description = "管理后台 - 积分签到规则创建 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class SignInConfigCreateReqVO extends SignInConfigBaseVO {
  13 +
  14 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigExcelVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.time.LocalDateTime;
  7 +import java.time.LocalDateTime;
  8 +
  9 +import com.alibaba.excel.annotation.ExcelProperty;
  10 +
  11 +/**
  12 + * 积分签到规则 Excel VO
  13 + *
  14 + * @author QingX
  15 + */
  16 +@Data
  17 +public class SignInConfigExcelVO {
  18 +
  19 + @ExcelProperty("签到第x天")
  20 + private Integer day;
  21 +
  22 + @ExcelProperty("签到天数对应分数")
  23 + private Integer point;
  24 +
  25 + @ExcelProperty("创建时间")
  26 + private LocalDateTime createTime;
  27 +
  28 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigExportReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +
  8 +@Schema(description = "管理后台 - 积分签到规则 Excel 导出 Request VO,参数和 SignInConfigPageReqVO 是一致的")
  9 +@Data
  10 +public class SignInConfigExportReqVO {
  11 +
  12 + @Schema(description = "签到第x天", example = "7")
  13 + private Integer day;
  14 +
  15 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +
  8 +@Schema(description = "管理后台 - 积分签到规则分页 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class SignInConfigPageReqVO extends PageParam {
  13 +
  14 + @Schema(description = "签到第x天", example = "7")
  15 + private Integer day;
  16 +
  17 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.time.LocalDateTime;
  6 +
  7 +@Schema(description = "管理后台 - 积分签到规则 Response VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class SignInConfigRespVO extends SignInConfigBaseVO {
  12 +
  13 + @Schema(description = "自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20937")
  14 + private Integer id;
  15 +
  16 + @Schema(description = "创建时间")
  17 + private LocalDateTime createTime;
  18 +
  19 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinconfig/vo/SignInConfigUpdateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@Schema(description = "管理后台 - 积分签到规则更新 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class SignInConfigUpdateReqVO extends SignInConfigBaseVO {
  13 +
  14 + @Schema(description = "规则自增主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "13653")
  15 + @NotNull(message = "规则自增主键不能为空")
  16 + private Integer id;
  17 +
  18 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/SignInRecordController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinrecord;
  2 +
  3 +import org.springframework.web.bind.annotation.*;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +import org.springframework.security.access.prepost.PreAuthorize;
  7 +import io.swagger.v3.oas.annotations.tags.Tag;
  8 +import io.swagger.v3.oas.annotations.Parameter;
  9 +import io.swagger.v3.oas.annotations.Operation;
  10 +
  11 +import javax.validation.constraints.*;
  12 +import javax.validation.*;
  13 +import javax.servlet.http.*;
  14 +import java.util.*;
  15 +import java.io.IOException;
  16 +
  17 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  18 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  19 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  20 +
  21 +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
  22 +
  23 +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
  24 +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
  25 +
  26 +import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
  27 +import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
  28 +import cn.iocoder.yudao.module.point.convert.signinrecord.SignInRecordConvert;
  29 +import cn.iocoder.yudao.module.point.service.signinrecord.SignInRecordService;
  30 +
  31 +@Tag(name = "管理后台 - 用户签到积分")
  32 +@RestController
  33 +@RequestMapping("/point/sign-in-record")
  34 +@Validated
  35 +public class SignInRecordController {
  36 +
  37 + @Resource
  38 + private SignInRecordService signInRecordService;
  39 +
  40 + @PostMapping("/create")
  41 + @Operation(summary = "创建用户签到积分")
  42 + @PreAuthorize("@ss.hasPermission('point:sign-in-record:create')")
  43 + public CommonResult<Long> createSignInRecord(@Valid @RequestBody SignInRecordCreateReqVO createReqVO) {
  44 + return success(signInRecordService.createSignInRecord(createReqVO));
  45 + }
  46 +
  47 + @PutMapping("/update")
  48 + @Operation(summary = "更新用户签到积分")
  49 + @PreAuthorize("@ss.hasPermission('point:sign-in-record:update')")
  50 + public CommonResult<Boolean> updateSignInRecord(@Valid @RequestBody SignInRecordUpdateReqVO updateReqVO) {
  51 + signInRecordService.updateSignInRecord(updateReqVO);
  52 + return success(true);
  53 + }
  54 +
  55 + @DeleteMapping("/delete")
  56 + @Operation(summary = "删除用户签到积分")
  57 + @Parameter(name = "id", description = "编号", required = true)
  58 + @PreAuthorize("@ss.hasPermission('point:sign-in-record:delete')")
  59 + public CommonResult<Boolean> deleteSignInRecord(@RequestParam("id") Long id) {
  60 + signInRecordService.deleteSignInRecord(id);
  61 + return success(true);
  62 + }
  63 +
  64 + @GetMapping("/get")
  65 + @Operation(summary = "获得用户签到积分")
  66 + @Parameter(name = "id", description = "编号", required = true, example = "1024")
  67 + @PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
  68 + public CommonResult<SignInRecordRespVO> getSignInRecord(@RequestParam("id") Long id) {
  69 + SignInRecordDO signInRecord = signInRecordService.getSignInRecord(id);
  70 + return success(SignInRecordConvert.INSTANCE.convert(signInRecord));
  71 + }
  72 +
  73 + @GetMapping("/list")
  74 + @Operation(summary = "获得用户签到积分列表")
  75 + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
  76 + @PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
  77 + public CommonResult<List<SignInRecordRespVO>> getSignInRecordList(@RequestParam("ids") Collection<Long> ids) {
  78 + List<SignInRecordDO> list = signInRecordService.getSignInRecordList(ids);
  79 + return success(SignInRecordConvert.INSTANCE.convertList(list));
  80 + }
  81 +
  82 + @GetMapping("/page")
  83 + @Operation(summary = "获得用户签到积分分页")
  84 + @PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
  85 + public CommonResult<PageResult<SignInRecordRespVO>> getSignInRecordPage(@Valid SignInRecordPageReqVO pageVO) {
  86 + PageResult<SignInRecordDO> pageResult = signInRecordService.getSignInRecordPage(pageVO);
  87 + return success(SignInRecordConvert.INSTANCE.convertPage(pageResult));
  88 + }
  89 +
  90 + @GetMapping("/export-excel")
  91 + @Operation(summary = "导出用户签到积分 Excel")
  92 + @PreAuthorize("@ss.hasPermission('point:sign-in-record:export')")
  93 + @OperateLog(type = EXPORT)
  94 + public void exportSignInRecordExcel(@Valid SignInRecordExportReqVO exportReqVO,
  95 + HttpServletResponse response) throws IOException {
  96 + List<SignInRecordDO> list = signInRecordService.getSignInRecordList(exportReqVO);
  97 + // 导出 Excel
  98 + List<SignInRecordExcelVO> datas = SignInRecordConvert.INSTANCE.convertList02(list);
  99 + ExcelUtils.write(response, "用户签到积分.xls", "数据", SignInRecordExcelVO.class, datas);
  100 + }
  101 +
  102 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordBaseVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.time.LocalDateTime;
  7 +import java.time.LocalDateTime;
  8 +import javax.validation.constraints.*;
  9 +
  10 +/**
  11 + * 用户签到积分 Base VO,提供给添加、修改、详细的子 VO 使用
  12 + * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
  13 + */
  14 +@Data
  15 +public class SignInRecordBaseVO {
  16 +
  17 + @Schema(description = "签到用户", example = "6507")
  18 + private Integer userId;
  19 +
  20 + @Schema(description = "第几天签到")
  21 + private Integer day;
  22 +
  23 + @Schema(description = "签到的分数")
  24 + private Integer point;
  25 +
  26 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordCreateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@Schema(description = "管理后台 - 用户签到积分创建 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class SignInRecordCreateReqVO extends SignInRecordBaseVO {
  13 +
  14 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordExcelVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import java.time.LocalDateTime;
  7 +import java.time.LocalDateTime;
  8 +
  9 +import com.alibaba.excel.annotation.ExcelProperty;
  10 +
  11 +/**
  12 + * 用户签到积分 Excel VO
  13 + *
  14 + * @author 芋道源码
  15 + */
  16 +@Data
  17 +public class SignInRecordExcelVO {
  18 +
  19 + @ExcelProperty("签到自增id")
  20 + private Long id;
  21 +
  22 + @ExcelProperty("签到用户")
  23 + private Integer userId;
  24 +
  25 + @ExcelProperty("第几天签到")
  26 + private Integer day;
  27 +
  28 + @ExcelProperty("签到的分数")
  29 + private Integer point;
  30 +
  31 + @ExcelProperty("签到时间")
  32 + private LocalDateTime createTime;
  33 +
  34 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordExportReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +import java.time.LocalDateTime;
  8 +import org.springframework.format.annotation.DateTimeFormat;
  9 +
  10 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  11 +
  12 +@Schema(description = "管理后台 - 用户签到积分 Excel 导出 Request VO,参数和 SignInRecordPageReqVO 是一致的")
  13 +@Data
  14 +public class SignInRecordExportReqVO {
  15 +
  16 + @Schema(description = "签到用户", example = "6507")
  17 + private Integer userId;
  18 +
  19 + @Schema(description = "第几天签到")
  20 + private Integer day;
  21 +
  22 + @Schema(description = "签到时间")
  23 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  24 + private LocalDateTime[] createTime;
  25 +
  26 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordPageReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import io.swagger.v3.oas.annotations.media.Schema;
  6 +import cn.iocoder.yudao.framework.common.pojo.PageParam;
  7 +import org.springframework.format.annotation.DateTimeFormat;
  8 +import java.time.LocalDateTime;
  9 +
  10 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
  11 +
  12 +@Schema(description = "管理后台 - 用户签到积分分页 Request VO")
  13 +@Data
  14 +@EqualsAndHashCode(callSuper = true)
  15 +@ToString(callSuper = true)
  16 +public class SignInRecordPageReqVO extends PageParam {
  17 +
  18 + @Schema(description = "签到用户", example = "6507")
  19 + private Integer userId;
  20 +
  21 + @Schema(description = "第几天签到")
  22 + private Integer day;
  23 +
  24 + @Schema(description = "签到时间")
  25 + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
  26 + private LocalDateTime[] createTime;
  27 +
  28 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.time.LocalDateTime;
  6 +
  7 +@Schema(description = "管理后台 - 用户签到积分 Response VO")
  8 +@Data
  9 +@EqualsAndHashCode(callSuper = true)
  10 +@ToString(callSuper = true)
  11 +public class SignInRecordRespVO extends SignInRecordBaseVO {
  12 +
  13 + @Schema(description = "签到自增id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11903")
  14 + private Long id;
  15 +
  16 + @Schema(description = "签到时间")
  17 + private LocalDateTime createTime;
  18 +
  19 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/controller/admin/signinrecord/vo/SignInRecordUpdateReqVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.*;
  5 +import java.util.*;
  6 +import javax.validation.constraints.*;
  7 +
  8 +@Schema(description = "管理后台 - 用户签到积分更新 Request VO")
  9 +@Data
  10 +@EqualsAndHashCode(callSuper = true)
  11 +@ToString(callSuper = true)
  12 +public class SignInRecordUpdateReqVO extends SignInRecordBaseVO {
  13 +
  14 + @Schema(description = "签到自增id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11903")
  15 + @NotNull(message = "签到自增id不能为空")
  16 + private Long id;
  17 +
  18 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/pointconfig/PointConfigConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.convert.pointconfig;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +
  7 +import org.mapstruct.Mapper;
  8 +import org.mapstruct.factory.Mappers;
  9 +import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*;
  10 +import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO;
  11 +
  12 +/**
  13 + * 积分设置 Convert
  14 + *
  15 + * @author QingX
  16 + */
  17 +@Mapper
  18 +public interface PointConfigConvert {
  19 +
  20 + PointConfigConvert INSTANCE = Mappers.getMapper(PointConfigConvert.class);
  21 +
  22 + PointConfigDO convert(PointConfigCreateReqVO bean);
  23 +
  24 + PointConfigDO convert(PointConfigUpdateReqVO bean);
  25 +
  26 + PointConfigRespVO convert(PointConfigDO bean);
  27 +
  28 + List<PointConfigRespVO> convertList(List<PointConfigDO> list);
  29 +
  30 + PageResult<PointConfigRespVO> convertPage(PageResult<PointConfigDO> page);
  31 +
  32 + List<PointConfigExcelVO> convertList02(List<PointConfigDO> list);
  33 +
  34 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/pointrecord/PointRecordConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.convert.pointrecord;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +
  7 +import org.mapstruct.Mapper;
  8 +import org.mapstruct.factory.Mappers;
  9 +import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
  10 +import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
  11 +
  12 +/**
  13 + * 用户积分记录 Convert
  14 + *
  15 + * @author QingX
  16 + */
  17 +@Mapper
  18 +public interface PointRecordConvert {
  19 +
  20 + PointRecordConvert INSTANCE = Mappers.getMapper(PointRecordConvert.class);
  21 +
  22 + PointRecordDO convert(PointRecordCreateReqVO bean);
  23 +
  24 + PointRecordDO convert(PointRecordUpdateReqVO bean);
  25 +
  26 + PointRecordRespVO convert(PointRecordDO bean);
  27 +
  28 + List<PointRecordRespVO> convertList(List<PointRecordDO> list);
  29 +
  30 + PageResult<PointRecordRespVO> convertPage(PageResult<PointRecordDO> page);
  31 +
  32 + List<PointRecordExcelVO> convertList02(List<PointRecordDO> list);
  33 +
  34 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/signinconfig/SignInConfigConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.convert.signinconfig;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +
  7 +import org.mapstruct.Mapper;
  8 +import org.mapstruct.factory.Mappers;
  9 +import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
  10 +import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
  11 +
  12 +/**
  13 + * 积分签到规则 Convert
  14 + *
  15 + * @author QingX
  16 + */
  17 +@Mapper
  18 +public interface SignInConfigConvert {
  19 +
  20 + SignInConfigConvert INSTANCE = Mappers.getMapper(SignInConfigConvert.class);
  21 +
  22 + SignInConfigDO convert(SignInConfigCreateReqVO bean);
  23 +
  24 + SignInConfigDO convert(SignInConfigUpdateReqVO bean);
  25 +
  26 + SignInConfigRespVO convert(SignInConfigDO bean);
  27 +
  28 + List<SignInConfigRespVO> convertList(List<SignInConfigDO> list);
  29 +
  30 + PageResult<SignInConfigRespVO> convertPage(PageResult<SignInConfigDO> page);
  31 +
  32 + List<SignInConfigExcelVO> convertList02(List<SignInConfigDO> list);
  33 +
  34 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/convert/signinrecord/SignInRecordConvert.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.convert.signinrecord;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +
  7 +import org.mapstruct.Mapper;
  8 +import org.mapstruct.factory.Mappers;
  9 +import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
  10 +import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
  11 +
  12 +/**
  13 + * 用户签到积分 Convert
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@Mapper
  18 +public interface SignInRecordConvert {
  19 +
  20 + SignInRecordConvert INSTANCE = Mappers.getMapper(SignInRecordConvert.class);
  21 +
  22 + SignInRecordDO convert(SignInRecordCreateReqVO bean);
  23 +
  24 + SignInRecordDO convert(SignInRecordUpdateReqVO bean);
  25 +
  26 + SignInRecordRespVO convert(SignInRecordDO bean);
  27 +
  28 + List<SignInRecordRespVO> convertList(List<SignInRecordDO> list);
  29 +
  30 + PageResult<SignInRecordRespVO> convertPage(PageResult<SignInRecordDO> page);
  31 +
  32 + List<SignInRecordExcelVO> convertList02(List<SignInRecordDO> list);
  33 +
  34 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/pointconfig/PointConfigDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.dal.dataobject.pointconfig;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.math.BigDecimal;
  6 +import java.time.LocalDateTime;
  7 +import java.time.LocalDateTime;
  8 +import com.baomidou.mybatisplus.annotation.*;
  9 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  10 +
  11 +/**
  12 + * 积分设置 DO
  13 + *
  14 + * @author QingX
  15 + */
  16 +@TableName("member_point_config")
  17 +@KeySequence("member_point_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  18 +@Data
  19 +@EqualsAndHashCode(callSuper = true)
  20 +@ToString(callSuper = true)
  21 +@Builder
  22 +@NoArgsConstructor
  23 +@AllArgsConstructor
  24 +public class PointConfigDO extends BaseDO {
  25 +
  26 + /**
  27 + * 自增主键
  28 + */
  29 + @TableId
  30 + private Integer id;
  31 + /**
  32 + * 1 开启积分抵扣
  33 +0 关闭积分抵扣
  34 + *
  35 + * 枚举 {@link TODO infra_boolean_string 对应的类}
  36 + */
  37 + private Integer tradeDeductEnable;
  38 + /**
  39 + * 积分抵扣,抵扣最低为分 以0.01表示 1积分抵扣0.01元(单位:元)
  40 + */
  41 + private BigDecimal tradeDeductUnitPrice;
  42 + /**
  43 + * 积分抵扣最大值
  44 + */
  45 + private Long tradeDeductMaxPrice;
  46 + /**
  47 + * 1元赠送多少分
  48 + */
  49 + private Long tradeGivePoint;
  50 +
  51 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/pointrecord/PointRecordDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.dal.dataobject.pointrecord;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.time.LocalDateTime;
  6 +import java.time.LocalDateTime;
  7 +import java.time.LocalDateTime;
  8 +import java.time.LocalDateTime;
  9 +import com.baomidou.mybatisplus.annotation.*;
  10 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  11 +
  12 +/**
  13 + * 用户积分记录 DO
  14 + *
  15 + * @author QingX
  16 + */
  17 +@TableName("member_point_record")
  18 +@KeySequence("member_point_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  19 +@Data
  20 +@EqualsAndHashCode(callSuper = true)
  21 +@ToString(callSuper = true)
  22 +@Builder
  23 +@NoArgsConstructor
  24 +@AllArgsConstructor
  25 +public class PointRecordDO extends BaseDO {
  26 +
  27 + /**
  28 + * 自增主键
  29 + */
  30 + @TableId
  31 + private Long id;
  32 + /**
  33 + * 业务编码
  34 + */
  35 + private String bizId;
  36 + /**
  37 + * 业务类型
  38 + *
  39 + * 枚举 {@link TODO biz_type 对应的类}
  40 + */
  41 + private String bizType;
  42 + /**
  43 + * 1增加 0扣减
  44 + */
  45 + private String type;
  46 + /**
  47 + * 积分标题
  48 + */
  49 + private String title;
  50 + /**
  51 + * 积分描述
  52 + */
  53 + private String description;
  54 + /**
  55 + * 积分
  56 + */
  57 + private Integer point;
  58 + /**
  59 + * 变动后的积分
  60 + */
  61 + private Integer totalPoint;
  62 + /**
  63 + * 状态:1-订单创建,2-冻结期,3-完成,4-失效(订单退款)
  64 +
  65 + *
  66 + * 枚举 {@link TODO point_status 对应的类}
  67 + */
  68 + private Integer status;
  69 + /**
  70 + * 用户id
  71 + */
  72 + private Integer userId;
  73 + /**
  74 + * 冻结时间
  75 + */
  76 + private LocalDateTime freezingTime;
  77 + /**
  78 + * 解冻时间
  79 + */
  80 + private LocalDateTime thawingTime;
  81 +
  82 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/signinconfig/SignInConfigDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.dal.dataobject.signinconfig;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.time.LocalDateTime;
  6 +import java.time.LocalDateTime;
  7 +import com.baomidou.mybatisplus.annotation.*;
  8 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  9 +
  10 +/**
  11 + * 积分签到规则 DO
  12 + *
  13 + * @author QingX
  14 + */
  15 +@TableName("member_sign_in_config")
  16 +@KeySequence("member_sign_in_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  17 +@Data
  18 +@EqualsAndHashCode(callSuper = true)
  19 +@ToString(callSuper = true)
  20 +@Builder
  21 +@NoArgsConstructor
  22 +@AllArgsConstructor
  23 +public class SignInConfigDO extends BaseDO {
  24 +
  25 + /**
  26 + * 规则自增主键
  27 + */
  28 + @TableId
  29 + private Integer id;
  30 + /**
  31 + * 签到第x天
  32 + */
  33 + private Integer day;
  34 + /**
  35 + * 签到天数对应分数
  36 + */
  37 + private Integer point;
  38 +
  39 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/dataobject/signinrecord/SignInRecordDO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.dal.dataobject.signinrecord;
  2 +
  3 +import lombok.*;
  4 +import java.util.*;
  5 +import java.time.LocalDateTime;
  6 +import java.time.LocalDateTime;
  7 +import com.baomidou.mybatisplus.annotation.*;
  8 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  9 +
  10 +/**
  11 + * 用户签到积分 DO
  12 + *
  13 + * @author 芋道源码
  14 + */
  15 +@TableName("member_sign_in_record")
  16 +@KeySequence("member_sign_in_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
  17 +@Data
  18 +@EqualsAndHashCode(callSuper = true)
  19 +@ToString(callSuper = true)
  20 +@Builder
  21 +@NoArgsConstructor
  22 +@AllArgsConstructor
  23 +public class SignInRecordDO extends BaseDO {
  24 +
  25 + /**
  26 + * 签到自增id
  27 + */
  28 + @TableId
  29 + private Long id;
  30 + /**
  31 + * 签到用户
  32 + */
  33 + private Integer userId;
  34 + /**
  35 + * 第几天签到
  36 + */
  37 + private Integer day;
  38 + /**
  39 + * 签到的分数
  40 + */
  41 + private Integer point;
  42 +
  43 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/pointconfig/PointConfigMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.dal.mysql.pointconfig;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  8 +import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO;
  9 +import org.apache.ibatis.annotations.Mapper;
  10 +import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*;
  11 +
  12 +/**
  13 + * 积分设置 Mapper
  14 + *
  15 + * @author QingX
  16 + */
  17 +@Mapper
  18 +public interface PointConfigMapper extends BaseMapperX<PointConfigDO> {
  19 +
  20 + default PageResult<PointConfigDO> selectPage(PointConfigPageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<PointConfigDO>()
  22 + .eqIfPresent(PointConfigDO::getTradeDeductEnable, reqVO.getTradeDeductEnable())
  23 + .orderByDesc(PointConfigDO::getId));
  24 + }
  25 +
  26 + default List<PointConfigDO> selectList(PointConfigExportReqVO reqVO) {
  27 + return selectList(new LambdaQueryWrapperX<PointConfigDO>()
  28 + .eqIfPresent(PointConfigDO::getTradeDeductEnable, reqVO.getTradeDeductEnable())
  29 + .orderByDesc(PointConfigDO::getId));
  30 + }
  31 +
  32 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/pointrecord/PointRecordMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.dal.mysql.pointrecord;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  8 +import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
  9 +import org.apache.ibatis.annotations.Mapper;
  10 +import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
  11 +
  12 +/**
  13 + * 用户积分记录 Mapper
  14 + *
  15 + * @author QingX
  16 + */
  17 +@Mapper
  18 +public interface PointRecordMapper extends BaseMapperX<PointRecordDO> {
  19 +
  20 + default PageResult<PointRecordDO> selectPage(PointRecordPageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<PointRecordDO>()
  22 + .eqIfPresent(PointRecordDO::getBizId, reqVO.getBizId())
  23 + .eqIfPresent(PointRecordDO::getBizType, reqVO.getBizType())
  24 + .eqIfPresent(PointRecordDO::getType, reqVO.getType())
  25 + .eqIfPresent(PointRecordDO::getTitle, reqVO.getTitle())
  26 + .eqIfPresent(PointRecordDO::getStatus, reqVO.getStatus())
  27 + .orderByDesc(PointRecordDO::getId));
  28 + }
  29 +
  30 + default List<PointRecordDO> selectList(PointRecordExportReqVO reqVO) {
  31 + return selectList(new LambdaQueryWrapperX<PointRecordDO>()
  32 + .eqIfPresent(PointRecordDO::getBizId, reqVO.getBizId())
  33 + .eqIfPresent(PointRecordDO::getBizType, reqVO.getBizType())
  34 + .eqIfPresent(PointRecordDO::getType, reqVO.getType())
  35 + .eqIfPresent(PointRecordDO::getTitle, reqVO.getTitle())
  36 + .eqIfPresent(PointRecordDO::getStatus, reqVO.getStatus())
  37 + .orderByDesc(PointRecordDO::getId));
  38 + }
  39 +
  40 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/signinconfig/SignInConfigMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.dal.mysql.signinconfig;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  8 +import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX;
  9 +import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
  10 +import org.apache.ibatis.annotations.Mapper;
  11 +import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
  12 +
  13 +/**
  14 + * 积分签到规则 Mapper
  15 + *
  16 + * @author QingX
  17 + */
  18 +@Mapper
  19 +public interface SignInConfigMapper extends BaseMapperX<SignInConfigDO> {
  20 +
  21 + default PageResult<SignInConfigDO> selectPage(SignInConfigPageReqVO reqVO) {
  22 + return selectPage(reqVO, new LambdaQueryWrapperX<SignInConfigDO>()
  23 + .eqIfPresent(SignInConfigDO::getDay, reqVO.getDay())
  24 + .orderByAsc(SignInConfigDO::getDay));
  25 + }
  26 +
  27 + default List<SignInConfigDO> selectList(SignInConfigExportReqVO reqVO) {
  28 + return selectList(new LambdaQueryWrapperX<SignInConfigDO>()
  29 + .eqIfPresent(SignInConfigDO::getDay, reqVO.getDay())
  30 + .orderByDesc(SignInConfigDO::getId));
  31 + }
  32 +
  33 + //
  34 + default long selectSameDayNotSelf(SignInConfigUpdateReqVO reqVO){
  35 + return selectCount(new LambdaQueryWrapperX <SignInConfigDO>()
  36 + .ne(SignInConfigDO::getId, reqVO.getId())
  37 + .eq(SignInConfigDO::getDay,reqVO.getDay())
  38 + );
  39 + }
  40 +
  41 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/dal/mysql/signinrecord/SignInRecordMapper.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.dal.mysql.signinrecord;
  2 +
  3 +import java.util.*;
  4 +
  5 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  6 +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
  7 +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
  8 +import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
  9 +import org.apache.ibatis.annotations.Mapper;
  10 +import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
  11 +
  12 +/**
  13 + * 用户签到积分 Mapper
  14 + *
  15 + * @author 芋道源码
  16 + */
  17 +@Mapper
  18 +public interface SignInRecordMapper extends BaseMapperX<SignInRecordDO> {
  19 +
  20 + default PageResult<SignInRecordDO> selectPage(SignInRecordPageReqVO reqVO) {
  21 + return selectPage(reqVO, new LambdaQueryWrapperX<SignInRecordDO>()
  22 + .eqIfPresent(SignInRecordDO::getUserId, reqVO.getUserId())
  23 + .eqIfPresent(SignInRecordDO::getDay, reqVO.getDay())
  24 + .betweenIfPresent(SignInRecordDO::getCreateTime, reqVO.getCreateTime())
  25 + .orderByDesc(SignInRecordDO::getId));
  26 + }
  27 +
  28 + default List<SignInRecordDO> selectList(SignInRecordExportReqVO reqVO) {
  29 + return selectList(new LambdaQueryWrapperX<SignInRecordDO>()
  30 + .eqIfPresent(SignInRecordDO::getUserId, reqVO.getUserId())
  31 + .eqIfPresent(SignInRecordDO::getDay, reqVO.getDay())
  32 + .betweenIfPresent(SignInRecordDO::getCreateTime, reqVO.getCreateTime())
  33 + .orderByDesc(SignInRecordDO::getId));
  34 + }
  35 +
  36 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.pointconfig;
  2 +
  3 +import java.util.*;
  4 +import javax.validation.*;
  5 +import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*;
  6 +import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO;
  7 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  8 +
  9 +/**
  10 + * 积分设置 Service 接口
  11 + *
  12 + * @author QingX
  13 + */
  14 +public interface PointConfigService {
  15 +
  16 + /**
  17 + * 创建积分设置
  18 + *
  19 + * @param createReqVO 创建信息
  20 + * @return 编号
  21 + */
  22 + Integer createConfig(@Valid PointConfigCreateReqVO createReqVO);
  23 +
  24 + /**
  25 + * 更新积分设置
  26 + *
  27 + * @param updateReqVO 更新信息
  28 + */
  29 + void updateConfig(@Valid PointConfigUpdateReqVO updateReqVO);
  30 +
  31 + /**
  32 + * 删除积分设置
  33 + *
  34 + * @param id 编号
  35 + */
  36 + void deleteConfig(Integer id);
  37 +
  38 + /**
  39 + * 获得积分设置
  40 + *
  41 + * @param id 编号
  42 + * @return 积分设置
  43 + */
  44 + PointConfigDO getConfig(Integer id);
  45 +
  46 + /**
  47 + * 获得积分设置列表
  48 + *
  49 + * @param ids 编号
  50 + * @return 积分设置列表
  51 + */
  52 + List<PointConfigDO> getConfigList(Collection<Integer> ids);
  53 +
  54 + /**
  55 + * 获得积分设置分页
  56 + *
  57 + * @param pageReqVO 分页查询
  58 + * @return 积分设置分页
  59 + */
  60 + PageResult<PointConfigDO> getConfigPage(PointConfigPageReqVO pageReqVO);
  61 +
  62 + /**
  63 + * 获得积分设置列表, 用于 Excel 导出
  64 + *
  65 + * @param exportReqVO 查询条件
  66 + * @return 积分设置列表
  67 + */
  68 + List<PointConfigDO> getConfigList(PointConfigExportReqVO exportReqVO);
  69 +
  70 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.pointconfig;
  2 +
  3 +import org.springframework.beans.factory.annotation.Autowired;
  4 +import org.springframework.stereotype.Service;
  5 +import javax.annotation.Resource;
  6 +import org.springframework.validation.annotation.Validated;
  7 +
  8 +import java.util.*;
  9 +import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*;
  10 +import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO;
  11 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  12 +
  13 +import cn.iocoder.yudao.module.point.convert.pointconfig.PointConfigConvert;
  14 +import cn.iocoder.yudao.module.point.dal.mysql.pointconfig.PointConfigMapper;
  15 +
  16 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  17 +import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
  18 +
  19 +/**
  20 + * 积分设置 Service 实现类
  21 + *
  22 + * @author QingX
  23 + */
  24 +@Service
  25 +@Validated
  26 +public class PointConfigServiceImpl implements PointConfigService {
  27 +
  28 + @Autowired
  29 + private PointConfigMapper configMapper;
  30 +
  31 + @Override
  32 + public Integer createConfig(PointConfigCreateReqVO createReqVO) {
  33 + // 插入
  34 + PointConfigDO config = PointConfigConvert.INSTANCE.convert(createReqVO);
  35 + //每个租户只允许存在一条记录
  36 + validateConfigExistsOne();
  37 +
  38 + configMapper.insert(config);
  39 + // 返回
  40 + return config.getId();
  41 + }
  42 +
  43 + @Override
  44 + public void updateConfig(PointConfigUpdateReqVO updateReqVO) {
  45 + // 校验存在
  46 + validateConfigExists(updateReqVO.getId());
  47 + // 更新
  48 + PointConfigDO updateObj = PointConfigConvert.INSTANCE.convert(updateReqVO);
  49 + configMapper.updateById(updateObj);
  50 + }
  51 +
  52 + @Override
  53 + public void deleteConfig(Integer id) {
  54 + // 校验存在
  55 + validateConfigExists(id);
  56 + // 删除
  57 + configMapper.deleteById(id);
  58 + }
  59 +
  60 + private void validateConfigExists(Integer id) {
  61 + if (configMapper.selectById(id) == null) {
  62 + throw exception(CONFIG_NOT_EXISTS);
  63 + }
  64 + }
  65 +
  66 + private void validateConfigExistsOne() {
  67 + if (configMapper.selectCount() > 0) {
  68 + throw exception(CONFIG_EXISTS);
  69 + }
  70 + }
  71 +
  72 + @Override
  73 + public PointConfigDO getConfig(Integer id) {
  74 + return configMapper.selectById(id);
  75 + }
  76 +
  77 + @Override
  78 + public List<PointConfigDO> getConfigList(Collection<Integer> ids) {
  79 + return configMapper.selectBatchIds(ids);
  80 + }
  81 +
  82 + @Override
  83 + public PageResult<PointConfigDO> getConfigPage(PointConfigPageReqVO pageReqVO) {
  84 + return configMapper.selectPage(pageReqVO);
  85 + }
  86 +
  87 + @Override
  88 + public List<PointConfigDO> getConfigList(PointConfigExportReqVO exportReqVO) {
  89 + return configMapper.selectList(exportReqVO);
  90 + }
  91 +
  92 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.pointrecord;
  2 +
  3 +import java.util.*;
  4 +import javax.validation.*;
  5 +import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
  6 +import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
  7 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  8 +
  9 +/**
  10 + * 用户积分记录 Service 接口
  11 + *
  12 + * @author QingX
  13 + */
  14 +public interface PointRecordService {
  15 +
  16 + /**
  17 + * 创建用户积分记录
  18 + *
  19 + * @param createReqVO 创建信息
  20 + * @return 编号
  21 + */
  22 + Long createRecord(@Valid PointRecordCreateReqVO createReqVO);
  23 +
  24 + /**
  25 + * 更新用户积分记录
  26 + *
  27 + * @param updateReqVO 更新信息
  28 + */
  29 + void updateRecord(@Valid PointRecordUpdateReqVO updateReqVO);
  30 +
  31 + /**
  32 + * 删除用户积分记录
  33 + *
  34 + * @param id 编号
  35 + */
  36 + void deleteRecord(Long id);
  37 +
  38 + /**
  39 + * 获得用户积分记录
  40 + *
  41 + * @param id 编号
  42 + * @return 用户积分记录
  43 + */
  44 + PointRecordDO getRecord(Long id);
  45 +
  46 + /**
  47 + * 获得用户积分记录列表
  48 + *
  49 + * @param ids 编号
  50 + * @return 用户积分记录列表
  51 + */
  52 + List<PointRecordDO> getRecordList(Collection<Long> ids);
  53 +
  54 + /**
  55 + * 获得用户积分记录分页
  56 + *
  57 + * @param pageReqVO 分页查询
  58 + * @return 用户积分记录分页
  59 + */
  60 + PageResult<PointRecordDO> getRecordPage(PointRecordPageReqVO pageReqVO);
  61 +
  62 + /**
  63 + * 获得用户积分记录列表, 用于 Excel 导出
  64 + *
  65 + * @param exportReqVO 查询条件
  66 + * @return 用户积分记录列表
  67 + */
  68 + List<PointRecordDO> getRecordList(PointRecordExportReqVO exportReqVO);
  69 +
  70 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.pointrecord;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +
  7 +import java.util.*;
  8 +import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
  9 +import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
  10 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  11 +
  12 +import cn.iocoder.yudao.module.point.convert.pointrecord.PointRecordConvert;
  13 +import cn.iocoder.yudao.module.point.dal.mysql.pointrecord.PointRecordMapper;
  14 +
  15 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  16 +import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
  17 +
  18 +/**
  19 + * 用户积分记录 Service 实现类
  20 + *
  21 + * @author QingX
  22 + */
  23 +@Service
  24 +@Validated
  25 +public class PointRecordServiceImpl implements PointRecordService {
  26 +
  27 + @Resource
  28 + private PointRecordMapper recordMapper;
  29 +
  30 + @Override
  31 + public Long createRecord(PointRecordCreateReqVO createReqVO) {
  32 + // 插入
  33 + PointRecordDO record = PointRecordConvert.INSTANCE.convert(createReqVO);
  34 + recordMapper.insert(record);
  35 + // 返回
  36 + return record.getId();
  37 + }
  38 +
  39 + @Override
  40 + public void updateRecord(PointRecordUpdateReqVO updateReqVO) {
  41 + // 校验存在
  42 + validateRecordExists(updateReqVO.getId());
  43 + // 更新
  44 + PointRecordDO updateObj = PointRecordConvert.INSTANCE.convert(updateReqVO);
  45 + recordMapper.updateById(updateObj);
  46 + }
  47 +
  48 + @Override
  49 + public void deleteRecord(Long id) {
  50 + // 校验存在
  51 + validateRecordExists(id);
  52 + // 删除
  53 + recordMapper.deleteById(id);
  54 + }
  55 +
  56 + private void validateRecordExists(Long id) {
  57 + if (recordMapper.selectById(id) == null) {
  58 + throw exception(RECORD_NOT_EXISTS);
  59 + }
  60 + }
  61 +
  62 + @Override
  63 + public PointRecordDO getRecord(Long id) {
  64 + return recordMapper.selectById(id);
  65 + }
  66 +
  67 + @Override
  68 + public List<PointRecordDO> getRecordList(Collection<Long> ids) {
  69 + return recordMapper.selectBatchIds(ids);
  70 + }
  71 +
  72 + @Override
  73 + public PageResult<PointRecordDO> getRecordPage(PointRecordPageReqVO pageReqVO) {
  74 + return recordMapper.selectPage(pageReqVO);
  75 + }
  76 +
  77 + @Override
  78 + public List<PointRecordDO> getRecordList(PointRecordExportReqVO exportReqVO) {
  79 + return recordMapper.selectList(exportReqVO);
  80 + }
  81 +
  82 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.signinconfig;
  2 +
  3 +import java.util.*;
  4 +import javax.validation.*;
  5 +import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
  6 +import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
  7 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  8 +
  9 +/**
  10 + * 积分签到规则 Service 接口
  11 + *
  12 + * @author QingX
  13 + */
  14 +public interface SignInConfigService {
  15 +
  16 + /**
  17 + * 创建积分签到规则
  18 + *
  19 + * @param createReqVO 创建信息
  20 + * @return 编号
  21 + */
  22 + Integer createSignInConfig(@Valid SignInConfigCreateReqVO createReqVO);
  23 +
  24 + /**
  25 + * 更新积分签到规则
  26 + *
  27 + * @param updateReqVO 更新信息
  28 + */
  29 + void updateSignInConfig(@Valid SignInConfigUpdateReqVO updateReqVO);
  30 +
  31 + /**
  32 + * 删除积分签到规则
  33 + *
  34 + * @param id 编号
  35 + */
  36 + void deleteSignInConfig(Integer id);
  37 +
  38 + /**
  39 + * 获得积分签到规则
  40 + *
  41 + * @param id 编号
  42 + * @return 积分签到规则
  43 + */
  44 + SignInConfigDO getSignInConfig(Integer id);
  45 +
  46 + /**
  47 + * 获得积分签到规则列表
  48 + *
  49 + * @param ids 编号
  50 + * @return 积分签到规则列表
  51 + */
  52 + List<SignInConfigDO> getSignInConfigList(Collection<Integer> ids);
  53 +
  54 + /**
  55 + * 获得积分签到规则分页
  56 + *
  57 + * @param pageReqVO 分页查询
  58 + * @return 积分签到规则分页
  59 + */
  60 + PageResult<SignInConfigDO> getSignInConfigPage(SignInConfigPageReqVO pageReqVO);
  61 +
  62 + /**
  63 + * 获得积分签到规则列表, 用于 Excel 导出
  64 + *
  65 + * @param exportReqVO 查询条件
  66 + * @return 积分签到规则列表
  67 + */
  68 + List<SignInConfigDO> getSignInConfigList(SignInConfigExportReqVO exportReqVO);
  69 +
  70 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.signinconfig;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +
  7 +import java.util.*;
  8 +import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
  9 +import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
  10 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  11 +
  12 +import cn.iocoder.yudao.module.point.convert.signinconfig.SignInConfigConvert;
  13 +import cn.iocoder.yudao.module.point.dal.mysql.signinconfig.SignInConfigMapper;
  14 +
  15 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  16 +import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
  17 +
  18 +/**
  19 + * 积分签到规则 Service 实现类
  20 + *
  21 + * @author QingX
  22 + */
  23 +@Service
  24 +@Validated
  25 +public class SignInConfigServiceImpl implements SignInConfigService {
  26 +
  27 + @Resource
  28 + private SignInConfigMapper signInConfigMapper;
  29 +
  30 + @Override
  31 + public Integer createSignInConfig(SignInConfigCreateReqVO createReqVO) {
  32 + // 插入
  33 + SignInConfigDO signInConfig = SignInConfigConvert.INSTANCE.convert(createReqVO);
  34 + //判断是否重复插入签到天数
  35 + validateSignInConfigExistsDay(signInConfig.getDay());
  36 + signInConfigMapper.insert(signInConfig);
  37 + // 返回
  38 + return signInConfig.getId();
  39 + }
  40 +
  41 + @Override
  42 + public void updateSignInConfig(SignInConfigUpdateReqVO updateReqVO) {
  43 + // 校验存在
  44 + validateSignInConfigExists(updateReqVO.getId());
  45 + //判断是否重复插入签到天数
  46 + validateSignInConfigSameDayNotSelf(updateReqVO);
  47 + // 判断更新的
  48 + SignInConfigDO updateObj = SignInConfigConvert.INSTANCE.convert(updateReqVO);
  49 +
  50 +
  51 + signInConfigMapper.updateById(updateObj);
  52 + }
  53 +
  54 + @Override
  55 + public void deleteSignInConfig(Integer id) {
  56 + // 校验存在
  57 + validateSignInConfigExists(id);
  58 + // 删除
  59 + signInConfigMapper.deleteById(id);
  60 + }
  61 +
  62 + private void validateSignInConfigExists(Integer id) {
  63 + if (signInConfigMapper.selectById(id) == null) {
  64 + throw exception(SIGN_IN_CONFIG_NOT_EXISTS);
  65 + }
  66 + }
  67 + //根据签到天数判断是否存在一个相同的天数
  68 + private void validateSignInConfigExistsDay(Integer day) {
  69 + if (signInConfigMapper.selectCount(SignInConfigDO::getDay,day)>0) {
  70 + throw exception(SIGN_IN_CONFIG_EXISTS);
  71 + }
  72 + }
  73 +
  74 + //更新天数时判断是否有重复的天数,需要去除自己
  75 + private void validateSignInConfigSameDayNotSelf(SignInConfigUpdateReqVO reqVO) {
  76 + if (signInConfigMapper.selectSameDayNotSelf(reqVO)>0) {
  77 + throw exception(SIGN_IN_CONFIG_EXISTS);
  78 + }
  79 + }
  80 +
  81 +
  82 + @Override
  83 + public SignInConfigDO getSignInConfig(Integer id) {
  84 + return signInConfigMapper.selectById(id);
  85 + }
  86 +
  87 + @Override
  88 + public List<SignInConfigDO> getSignInConfigList(Collection<Integer> ids) {
  89 + return signInConfigMapper.selectBatchIds(ids);
  90 + }
  91 +
  92 + @Override
  93 + public PageResult<SignInConfigDO> getSignInConfigPage(SignInConfigPageReqVO pageReqVO) {
  94 + return signInConfigMapper.selectPage(pageReqVO);
  95 + }
  96 +
  97 + @Override
  98 + public List<SignInConfigDO> getSignInConfigList(SignInConfigExportReqVO exportReqVO) {
  99 + return signInConfigMapper.selectList(exportReqVO);
  100 + }
  101 +
  102 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordService.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.signinrecord;
  2 +
  3 +import java.util.*;
  4 +import javax.validation.*;
  5 +import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
  6 +import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
  7 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  8 +
  9 +/**
  10 + * 用户签到积分 Service 接口
  11 + *
  12 + * @author 芋道源码
  13 + */
  14 +public interface SignInRecordService {
  15 +
  16 + /**
  17 + * 创建用户签到积分
  18 + *
  19 + * @param createReqVO 创建信息
  20 + * @return 编号
  21 + */
  22 + Long createSignInRecord(@Valid SignInRecordCreateReqVO createReqVO);
  23 +
  24 + /**
  25 + * 更新用户签到积分
  26 + *
  27 + * @param updateReqVO 更新信息
  28 + */
  29 + void updateSignInRecord(@Valid SignInRecordUpdateReqVO updateReqVO);
  30 +
  31 + /**
  32 + * 删除用户签到积分
  33 + *
  34 + * @param id 编号
  35 + */
  36 + void deleteSignInRecord(Long id);
  37 +
  38 + /**
  39 + * 获得用户签到积分
  40 + *
  41 + * @param id 编号
  42 + * @return 用户签到积分
  43 + */
  44 + SignInRecordDO getSignInRecord(Long id);
  45 +
  46 + /**
  47 + * 获得用户签到积分列表
  48 + *
  49 + * @param ids 编号
  50 + * @return 用户签到积分列表
  51 + */
  52 + List<SignInRecordDO> getSignInRecordList(Collection<Long> ids);
  53 +
  54 + /**
  55 + * 获得用户签到积分分页
  56 + *
  57 + * @param pageReqVO 分页查询
  58 + * @return 用户签到积分分页
  59 + */
  60 + PageResult<SignInRecordDO> getSignInRecordPage(SignInRecordPageReqVO pageReqVO);
  61 +
  62 + /**
  63 + * 获得用户签到积分列表, 用于 Excel 导出
  64 + *
  65 + * @param exportReqVO 查询条件
  66 + * @return 用户签到积分列表
  67 + */
  68 + List<SignInRecordDO> getSignInRecordList(SignInRecordExportReqVO exportReqVO);
  69 +
  70 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordServiceImpl.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.signinrecord;
  2 +
  3 +import org.springframework.stereotype.Service;
  4 +import javax.annotation.Resource;
  5 +import org.springframework.validation.annotation.Validated;
  6 +
  7 +import java.util.*;
  8 +import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
  9 +import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
  10 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  11 +
  12 +import cn.iocoder.yudao.module.point.convert.signinrecord.SignInRecordConvert;
  13 +import cn.iocoder.yudao.module.point.dal.mysql.signinrecord.SignInRecordMapper;
  14 +
  15 +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
  16 +import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
  17 +
  18 +/**
  19 + * 用户签到积分 Service 实现类
  20 + *
  21 + * @author 芋道源码
  22 + */
  23 +@Service
  24 +@Validated
  25 +public class SignInRecordServiceImpl implements SignInRecordService {
  26 +
  27 + @Resource
  28 + private SignInRecordMapper signInRecordMapper;
  29 +
  30 + @Override
  31 + public Long createSignInRecord(SignInRecordCreateReqVO createReqVO) {
  32 + // 插入
  33 + SignInRecordDO signInRecord = SignInRecordConvert.INSTANCE.convert(createReqVO);
  34 + signInRecordMapper.insert(signInRecord);
  35 + // 返回
  36 + return signInRecord.getId();
  37 + }
  38 +
  39 + @Override
  40 + public void updateSignInRecord(SignInRecordUpdateReqVO updateReqVO) {
  41 + // 校验存在
  42 + validateSignInRecordExists(updateReqVO.getId());
  43 + // 更新
  44 + SignInRecordDO updateObj = SignInRecordConvert.INSTANCE.convert(updateReqVO);
  45 + signInRecordMapper.updateById(updateObj);
  46 + }
  47 +
  48 + @Override
  49 + public void deleteSignInRecord(Long id) {
  50 + // 校验存在
  51 + validateSignInRecordExists(id);
  52 + // 删除
  53 + signInRecordMapper.deleteById(id);
  54 + }
  55 +
  56 + private void validateSignInRecordExists(Long id) {
  57 + if (signInRecordMapper.selectById(id) == null) {
  58 + throw exception(SIGN_IN_RECORD_NOT_EXISTS);
  59 + }
  60 + }
  61 +
  62 + @Override
  63 + public SignInRecordDO getSignInRecord(Long id) {
  64 + return signInRecordMapper.selectById(id);
  65 + }
  66 +
  67 + @Override
  68 + public List<SignInRecordDO> getSignInRecordList(Collection<Long> ids) {
  69 + return signInRecordMapper.selectBatchIds(ids);
  70 + }
  71 +
  72 + @Override
  73 + public PageResult<SignInRecordDO> getSignInRecordPage(SignInRecordPageReqVO pageReqVO) {
  74 + return signInRecordMapper.selectPage(pageReqVO);
  75 + }
  76 +
  77 + @Override
  78 + public List<SignInRecordDO> getSignInRecordList(SignInRecordExportReqVO exportReqVO) {
  79 + return signInRecordMapper.selectList(exportReqVO);
  80 + }
  81 +
  82 +}
... ...
yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointconfig/PointConfigMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="cn.iocoder.yudao.module.point.dal.mysql.pointconfig.PointConfigMapper">
  4 +
  5 + <!--
  6 + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  7 + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  8 + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  9 + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  10 + -->
  11 +
  12 +</mapper>
... ...
yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/pointrecord/PointRecordMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="cn.iocoder.yudao.module.point.dal.mysql.pointrecord.PointRecordMapper">
  4 +
  5 + <!--
  6 + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  7 + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  8 + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  9 + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  10 + -->
  11 +
  12 +</mapper>
... ...
yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinconfig/SignInConfigMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="cn.iocoder.yudao.module.point.dal.mysql.signinconfig.SignInConfigMapper">
  4 +
  5 + <!--
  6 + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  7 + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  8 + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  9 + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  10 + -->
  11 +
  12 +</mapper>
... ...
yudao-module-point/yudao-module-point-biz/src/main/resources/mapper/signinrecord/SignInRecordMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3 +<mapper namespace="cn.iocoder.yudao.module.point.dal.mysql.signinrecord.SignInRecordMapper">
  4 +
  5 + <!--
  6 + 一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
  7 + 无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
  8 + 代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
  9 + 文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
  10 + -->
  11 +
  12 +</mapper>
... ...
yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/pointconfig/PointConfigServiceImplTest.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.pointconfig;
  2 +
  3 +import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
  4 +import org.junit.jupiter.api.Disabled;
  5 +import org.junit.jupiter.api.Test;
  6 +import org.springframework.boot.test.mock.mockito.MockBean;
  7 +
  8 +import javax.annotation.Resource;
  9 +
  10 +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
  11 +
  12 +import cn.iocoder.yudao.module.point.controller.admin.pointconfig.vo.*;
  13 +import cn.iocoder.yudao.module.point.dal.dataobject.pointconfig.PointConfigDO;
  14 +import cn.iocoder.yudao.module.point.dal.mysql.pointconfig.PointConfigMapper;
  15 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  16 +
  17 +import javax.annotation.Resource;
  18 +import org.springframework.context.annotation.Import;
  19 +import java.util.*;
  20 +import java.time.LocalDateTime;
  21 +
  22 +import static cn.hutool.core.util.RandomUtil.*;
  23 +import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
  24 +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
  25 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
  26 +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
  27 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
  28 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
  29 +import static org.junit.jupiter.api.Assertions.*;
  30 +import static org.mockito.Mockito.*;
  31 +
  32 +/**
  33 + * {@link PointConfigServiceImpl} 的单元测试类
  34 + *
  35 + * @author QingX
  36 + */
  37 +@Import(PointConfigServiceImpl.class)
  38 +public class PointConfigServiceImplTest extends BaseDbUnitTest {
  39 +
  40 + @Resource
  41 + private PointConfigServiceImpl configService;
  42 +
  43 + @Resource
  44 + private PointConfigMapper configMapper;
  45 +
  46 + @Test
  47 + public void testCreateConfig_success() {
  48 + // 准备参数
  49 + PointConfigCreateReqVO reqVO = randomPojo(PointConfigCreateReqVO.class);
  50 +
  51 + // 调用
  52 + Integer configId = configService.createConfig(reqVO);
  53 + // 断言
  54 + assertNotNull(configId);
  55 + // 校验记录的属性是否正确
  56 + PointConfigDO config = configMapper.selectById(configId);
  57 + assertPojoEquals(reqVO, config);
  58 + }
  59 +
  60 + @Test
  61 + public void testUpdateConfig_success() {
  62 + // mock 数据
  63 + PointConfigDO dbConfig = randomPojo(PointConfigDO.class);
  64 + configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据
  65 + // 准备参数
  66 + PointConfigUpdateReqVO reqVO = randomPojo(PointConfigUpdateReqVO.class, o -> {
  67 + o.setId(dbConfig.getId()); // 设置更新的 ID
  68 + });
  69 +
  70 + // 调用
  71 + configService.updateConfig(reqVO);
  72 + // 校验是否更新正确
  73 + PointConfigDO config = configMapper.selectById(reqVO.getId()); // 获取最新的
  74 + assertPojoEquals(reqVO, config);
  75 + }
  76 +
  77 + @Test
  78 + public void testUpdateConfig_notExists() {
  79 + // 准备参数
  80 + PointConfigUpdateReqVO reqVO = randomPojo(PointConfigUpdateReqVO.class);
  81 +
  82 + // 调用, 并断言异常
  83 + assertServiceException(() -> configService.updateConfig(reqVO), CONFIG_NOT_EXISTS);
  84 + }
  85 +
  86 + @Test
  87 + public void testDeleteConfig_success() {
  88 + // mock 数据
  89 + PointConfigDO dbConfig = randomPojo(PointConfigDO.class);
  90 + configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据
  91 + // 准备参数
  92 + Integer id = dbConfig.getId();
  93 +
  94 + // 调用
  95 + configService.deleteConfig(id);
  96 + // 校验数据不存在了
  97 + assertNull(configMapper.selectById(id));
  98 + }
  99 +
  100 + @Test
  101 + public void testDeleteConfig_notExists() {
  102 + // 准备参数
  103 + Integer id = RandomUtils.randomInteger();
  104 +
  105 + // 调用, 并断言异常
  106 + assertServiceException(() -> configService.deleteConfig(id), CONFIG_NOT_EXISTS);
  107 + }
  108 +
  109 + @Test
  110 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  111 + public void testGetConfigPage() {
  112 + // mock 数据
  113 + PointConfigDO dbConfig = randomPojo(PointConfigDO.class, o -> { // 等会查询到
  114 + o.setTradeDeductEnable(null);
  115 + });
  116 + configMapper.insert(dbConfig);
  117 + // 测试 tradeDeductEnable 不匹配
  118 + configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setTradeDeductEnable(null)));
  119 + // 准备参数
  120 + PointConfigPageReqVO reqVO = new PointConfigPageReqVO();
  121 + reqVO.setTradeDeductEnable(null);
  122 +
  123 + // 调用
  124 + PageResult<PointConfigDO> pageResult = configService.getConfigPage(reqVO);
  125 + // 断言
  126 + assertEquals(1, pageResult.getTotal());
  127 + assertEquals(1, pageResult.getList().size());
  128 + assertPojoEquals(dbConfig, pageResult.getList().get(0));
  129 + }
  130 +
  131 + @Test
  132 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  133 + public void testGetConfigList() {
  134 + // mock 数据
  135 + PointConfigDO dbConfig = randomPojo(PointConfigDO.class, o -> { // 等会查询到
  136 + o.setTradeDeductEnable(null);
  137 + });
  138 + configMapper.insert(dbConfig);
  139 + // 测试 tradeDeductEnable 不匹配
  140 + configMapper.insert(cloneIgnoreId(dbConfig, o -> o.setTradeDeductEnable(null)));
  141 + // 准备参数
  142 + PointConfigExportReqVO reqVO = new PointConfigExportReqVO();
  143 + reqVO.setTradeDeductEnable(null);
  144 +
  145 + // 调用
  146 + List<PointConfigDO> list = configService.getConfigList(reqVO);
  147 + // 断言
  148 + assertEquals(1, list.size());
  149 + assertPojoEquals(dbConfig, list.get(0));
  150 + }
  151 +
  152 +}
... ...
yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/pointrecord/PointRecordServiceImplTest.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.pointrecord;
  2 +
  3 +import org.junit.jupiter.api.Disabled;
  4 +import org.junit.jupiter.api.Test;
  5 +import org.springframework.boot.test.mock.mockito.MockBean;
  6 +
  7 +import javax.annotation.Resource;
  8 +
  9 +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
  10 +
  11 +import cn.iocoder.yudao.module.point.controller.admin.pointrecord.vo.*;
  12 +import cn.iocoder.yudao.module.point.dal.dataobject.pointrecord.PointRecordDO;
  13 +import cn.iocoder.yudao.module.point.dal.mysql.pointrecord.PointRecordMapper;
  14 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  15 +
  16 +import javax.annotation.Resource;
  17 +import org.springframework.context.annotation.Import;
  18 +import java.util.*;
  19 +import java.time.LocalDateTime;
  20 +
  21 +import static cn.hutool.core.util.RandomUtil.*;
  22 +import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
  23 +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
  24 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
  25 +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
  26 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
  27 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
  28 +import static org.junit.jupiter.api.Assertions.*;
  29 +import static org.mockito.Mockito.*;
  30 +
  31 +/**
  32 + * {@link PointRecordServiceImpl} 的单元测试类
  33 + *
  34 + * @author QingX
  35 + */
  36 +@Import(PointRecordServiceImpl.class)
  37 +public class PointRecordServiceImplTest extends BaseDbUnitTest {
  38 +
  39 + @Resource
  40 + private PointRecordServiceImpl recordService;
  41 +
  42 + @Resource
  43 + private PointRecordMapper recordMapper;
  44 +
  45 + @Test
  46 + public void testCreateRecord_success() {
  47 + // 准备参数
  48 + PointRecordCreateReqVO reqVO = randomPojo(PointRecordCreateReqVO.class);
  49 +
  50 + // 调用
  51 + Long recordId = recordService.createRecord(reqVO);
  52 + // 断言
  53 + assertNotNull(recordId);
  54 + // 校验记录的属性是否正确
  55 + PointRecordDO record = recordMapper.selectById(recordId);
  56 + assertPojoEquals(reqVO, record);
  57 + }
  58 +
  59 + @Test
  60 + public void testUpdateRecord_success() {
  61 + // mock 数据
  62 + PointRecordDO dbRecord = randomPojo(PointRecordDO.class);
  63 + recordMapper.insert(dbRecord);// @Sql: 先插入出一条存在的数据
  64 + // 准备参数
  65 + PointRecordUpdateReqVO reqVO = randomPojo(PointRecordUpdateReqVO.class, o -> {
  66 + o.setId(dbRecord.getId()); // 设置更新的 ID
  67 + });
  68 +
  69 + // 调用
  70 + recordService.updateRecord(reqVO);
  71 + // 校验是否更新正确
  72 + PointRecordDO record = recordMapper.selectById(reqVO.getId()); // 获取最新的
  73 + assertPojoEquals(reqVO, record);
  74 + }
  75 +
  76 + @Test
  77 + public void testUpdateRecord_notExists() {
  78 + // 准备参数
  79 + PointRecordUpdateReqVO reqVO = randomPojo(PointRecordUpdateReqVO.class);
  80 +
  81 + // 调用, 并断言异常
  82 + assertServiceException(() -> recordService.updateRecord(reqVO), RECORD_NOT_EXISTS);
  83 + }
  84 +
  85 + @Test
  86 + public void testDeleteRecord_success() {
  87 + // mock 数据
  88 + PointRecordDO dbRecord = randomPojo(PointRecordDO.class);
  89 + recordMapper.insert(dbRecord);// @Sql: 先插入出一条存在的数据
  90 + // 准备参数
  91 + Long id = dbRecord.getId();
  92 +
  93 + // 调用
  94 + recordService.deleteRecord(id);
  95 + // 校验数据不存在了
  96 + assertNull(recordMapper.selectById(id));
  97 + }
  98 +
  99 + @Test
  100 + public void testDeleteRecord_notExists() {
  101 + // 准备参数
  102 + Long id = randomLongId();
  103 +
  104 + // 调用, 并断言异常
  105 + assertServiceException(() -> recordService.deleteRecord(id), RECORD_NOT_EXISTS);
  106 + }
  107 +
  108 + @Test
  109 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  110 + public void testGetRecordPage() {
  111 + // mock 数据
  112 + PointRecordDO dbRecord = randomPojo(PointRecordDO.class, o -> { // 等会查询到
  113 + o.setBizId(null);
  114 + o.setBizType(null);
  115 + o.setType(null);
  116 + o.setTitle(null);
  117 + o.setStatus(null);
  118 + });
  119 + recordMapper.insert(dbRecord);
  120 + // 测试 bizId 不匹配
  121 + recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setBizId(null)));
  122 + // 测试 bizType 不匹配
  123 + recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setBizType(null)));
  124 + // 测试 type 不匹配
  125 + recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setType(null)));
  126 + // 测试 title 不匹配
  127 + recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setTitle(null)));
  128 + // 测试 status 不匹配
  129 + recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setStatus(null)));
  130 + // 准备参数
  131 + PointRecordPageReqVO reqVO = new PointRecordPageReqVO();
  132 + reqVO.setBizId(null);
  133 + reqVO.setBizType(null);
  134 + reqVO.setType(null);
  135 + reqVO.setTitle(null);
  136 + reqVO.setStatus(null);
  137 +
  138 + // 调用
  139 + PageResult<PointRecordDO> pageResult = recordService.getRecordPage(reqVO);
  140 + // 断言
  141 + assertEquals(1, pageResult.getTotal());
  142 + assertEquals(1, pageResult.getList().size());
  143 + assertPojoEquals(dbRecord, pageResult.getList().get(0));
  144 + }
  145 +
  146 + @Test
  147 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  148 + public void testGetRecordList() {
  149 + // mock 数据
  150 + PointRecordDO dbRecord = randomPojo(PointRecordDO.class, o -> { // 等会查询到
  151 + o.setBizId(null);
  152 + o.setBizType(null);
  153 + o.setType(null);
  154 + o.setTitle(null);
  155 + o.setStatus(null);
  156 + });
  157 + recordMapper.insert(dbRecord);
  158 + // 测试 bizId 不匹配
  159 + recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setBizId(null)));
  160 + // 测试 bizType 不匹配
  161 + recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setBizType(null)));
  162 + // 测试 type 不匹配
  163 + recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setType(null)));
  164 + // 测试 title 不匹配
  165 + recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setTitle(null)));
  166 + // 测试 status 不匹配
  167 + recordMapper.insert(cloneIgnoreId(dbRecord, o -> o.setStatus(null)));
  168 + // 准备参数
  169 + PointRecordExportReqVO reqVO = new PointRecordExportReqVO();
  170 + reqVO.setBizId(null);
  171 + reqVO.setBizType(null);
  172 + reqVO.setType(null);
  173 + reqVO.setTitle(null);
  174 + reqVO.setStatus(null);
  175 +
  176 + // 调用
  177 + List<PointRecordDO> list = recordService.getRecordList(reqVO);
  178 + // 断言
  179 + assertEquals(1, list.size());
  180 + assertPojoEquals(dbRecord, list.get(0));
  181 + }
  182 +
  183 +}
... ...
yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/signinconfig/SignInConfigServiceImplTest.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.signinconfig;
  2 +
  3 +import cn.iocoder.yudao.framework.test.core.util.RandomUtils;
  4 +import org.junit.jupiter.api.Disabled;
  5 +import org.junit.jupiter.api.Test;
  6 +import org.springframework.boot.test.mock.mockito.MockBean;
  7 +
  8 +import javax.annotation.Resource;
  9 +
  10 +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
  11 +
  12 +import cn.iocoder.yudao.module.point.controller.admin.signinconfig.vo.*;
  13 +import cn.iocoder.yudao.module.point.dal.dataobject.signinconfig.SignInConfigDO;
  14 +import cn.iocoder.yudao.module.point.dal.mysql.signinconfig.SignInConfigMapper;
  15 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  16 +
  17 +import javax.annotation.Resource;
  18 +import org.springframework.context.annotation.Import;
  19 +import java.util.*;
  20 +import java.time.LocalDateTime;
  21 +
  22 +import static cn.hutool.core.util.RandomUtil.*;
  23 +import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
  24 +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
  25 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
  26 +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
  27 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
  28 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
  29 +import static org.junit.jupiter.api.Assertions.*;
  30 +import static org.mockito.Mockito.*;
  31 +
  32 +/**
  33 + * {@link SignInConfigServiceImpl} 的单元测试类
  34 + *
  35 + * @author QingX
  36 + */
  37 +@Import(SignInConfigServiceImpl.class)
  38 +public class SignInConfigServiceImplTest extends BaseDbUnitTest {
  39 +
  40 + @Resource
  41 + private SignInConfigServiceImpl signInConfigService;
  42 +
  43 + @Resource
  44 + private SignInConfigMapper signInConfigMapper;
  45 +
  46 + @Test
  47 + public void testCreateSignInConfig_success() {
  48 + // 准备参数
  49 + SignInConfigCreateReqVO reqVO = randomPojo(SignInConfigCreateReqVO.class);
  50 +
  51 + // 调用
  52 + Integer signInConfigId = signInConfigService.createSignInConfig(reqVO);
  53 + // 断言
  54 + assertNotNull(signInConfigId);
  55 + // 校验记录的属性是否正确
  56 + SignInConfigDO signInConfig = signInConfigMapper.selectById(signInConfigId);
  57 + assertPojoEquals(reqVO, signInConfig);
  58 + }
  59 +
  60 + @Test
  61 + public void testUpdateSignInConfig_success() {
  62 + // mock 数据
  63 + SignInConfigDO dbSignInConfig = randomPojo(SignInConfigDO.class);
  64 + signInConfigMapper.insert(dbSignInConfig);// @Sql: 先插入出一条存在的数据
  65 + // 准备参数
  66 + SignInConfigUpdateReqVO reqVO = randomPojo(SignInConfigUpdateReqVO.class, o -> {
  67 + o.setId(dbSignInConfig.getId()); // 设置更新的 ID
  68 + });
  69 +
  70 + // 调用
  71 + signInConfigService.updateSignInConfig(reqVO);
  72 + // 校验是否更新正确
  73 + SignInConfigDO signInConfig = signInConfigMapper.selectById(reqVO.getId()); // 获取最新的
  74 + assertPojoEquals(reqVO, signInConfig);
  75 + }
  76 +
  77 + @Test
  78 + public void testUpdateSignInConfig_notExists() {
  79 + // 准备参数
  80 + SignInConfigUpdateReqVO reqVO = randomPojo(SignInConfigUpdateReqVO.class);
  81 +
  82 + // 调用, 并断言异常
  83 + assertServiceException(() -> signInConfigService.updateSignInConfig(reqVO), SIGN_IN_CONFIG_NOT_EXISTS);
  84 + }
  85 +
  86 + @Test
  87 + public void testDeleteSignInConfig_success() {
  88 + // mock 数据
  89 + SignInConfigDO dbSignInConfig = randomPojo(SignInConfigDO.class);
  90 + signInConfigMapper.insert(dbSignInConfig);// @Sql: 先插入出一条存在的数据
  91 + // 准备参数
  92 + Integer id = dbSignInConfig.getId();
  93 +
  94 + // 调用
  95 + signInConfigService.deleteSignInConfig(id);
  96 + // 校验数据不存在了
  97 + assertNull(signInConfigMapper.selectById(id));
  98 + }
  99 +
  100 + @Test
  101 + public void testDeleteSignInConfig_notExists() {
  102 + // 准备参数
  103 + Integer id = RandomUtils.randomInteger();
  104 +
  105 + // 调用, 并断言异常
  106 + assertServiceException(() -> signInConfigService.deleteSignInConfig(id), SIGN_IN_CONFIG_NOT_EXISTS);
  107 + }
  108 +
  109 + @Test
  110 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  111 + public void testGetSignInConfigPage() {
  112 + // mock 数据
  113 + SignInConfigDO dbSignInConfig = randomPojo(SignInConfigDO.class, o -> { // 等会查询到
  114 + o.setDay(null);
  115 + });
  116 + signInConfigMapper.insert(dbSignInConfig);
  117 + // 测试 day 不匹配
  118 + signInConfigMapper.insert(cloneIgnoreId(dbSignInConfig, o -> o.setDay(null)));
  119 + // 准备参数
  120 + SignInConfigPageReqVO reqVO = new SignInConfigPageReqVO();
  121 + reqVO.setDay(null);
  122 +
  123 + // 调用
  124 + PageResult<SignInConfigDO> pageResult = signInConfigService.getSignInConfigPage(reqVO);
  125 + // 断言
  126 + assertEquals(1, pageResult.getTotal());
  127 + assertEquals(1, pageResult.getList().size());
  128 + assertPojoEquals(dbSignInConfig, pageResult.getList().get(0));
  129 + }
  130 +
  131 + @Test
  132 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  133 + public void testGetSignInConfigList() {
  134 + // mock 数据
  135 + SignInConfigDO dbSignInConfig = randomPojo(SignInConfigDO.class, o -> { // 等会查询到
  136 + o.setDay(null);
  137 + });
  138 + signInConfigMapper.insert(dbSignInConfig);
  139 + // 测试 day 不匹配
  140 + signInConfigMapper.insert(cloneIgnoreId(dbSignInConfig, o -> o.setDay(null)));
  141 + // 准备参数
  142 + SignInConfigExportReqVO reqVO = new SignInConfigExportReqVO();
  143 + reqVO.setDay(null);
  144 +
  145 + // 调用
  146 + List<SignInConfigDO> list = signInConfigService.getSignInConfigList(reqVO);
  147 + // 断言
  148 + assertEquals(1, list.size());
  149 + assertPojoEquals(dbSignInConfig, list.get(0));
  150 + }
  151 +
  152 +}
... ...
yudao-module-point/yudao-module-point-biz/src/test/java/cn/iocoder/yudao/module/point/service/signinrecord/SignInRecordServiceImplTest.java 0 → 100644
  1 +package cn.iocoder.yudao.module.point.service.signinrecord;
  2 +
  3 +import org.junit.jupiter.api.Disabled;
  4 +import org.junit.jupiter.api.Test;
  5 +import org.springframework.boot.test.mock.mockito.MockBean;
  6 +
  7 +import javax.annotation.Resource;
  8 +
  9 +import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
  10 +
  11 +import cn.iocoder.yudao.module.point.controller.admin.signinrecord.vo.*;
  12 +import cn.iocoder.yudao.module.point.dal.dataobject.signinrecord.SignInRecordDO;
  13 +import cn.iocoder.yudao.module.point.dal.mysql.signinrecord.SignInRecordMapper;
  14 +import cn.iocoder.yudao.framework.common.pojo.PageResult;
  15 +
  16 +import javax.annotation.Resource;
  17 +import org.springframework.context.annotation.Import;
  18 +import java.util.*;
  19 +import java.time.LocalDateTime;
  20 +
  21 +import static cn.hutool.core.util.RandomUtil.*;
  22 +import static cn.iocoder.yudao.module.point.enums.ErrorCodeConstants.*;
  23 +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.*;
  24 +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*;
  25 +import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.*;
  26 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.*;
  27 +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
  28 +import static org.junit.jupiter.api.Assertions.*;
  29 +import static org.mockito.Mockito.*;
  30 +
  31 +/**
  32 + * {@link SignInRecordServiceImpl} 的单元测试类
  33 + *
  34 + * @author 芋道源码
  35 + */
  36 +@Import(SignInRecordServiceImpl.class)
  37 +public class SignInRecordServiceImplTest extends BaseDbUnitTest {
  38 +
  39 + @Resource
  40 + private SignInRecordServiceImpl signInRecordService;
  41 +
  42 + @Resource
  43 + private SignInRecordMapper signInRecordMapper;
  44 +
  45 + @Test
  46 + public void testCreateSignInRecord_success() {
  47 + // 准备参数
  48 + SignInRecordCreateReqVO reqVO = randomPojo(SignInRecordCreateReqVO.class);
  49 +
  50 + // 调用
  51 + Long signInRecordId = signInRecordService.createSignInRecord(reqVO);
  52 + // 断言
  53 + assertNotNull(signInRecordId);
  54 + // 校验记录的属性是否正确
  55 + SignInRecordDO signInRecord = signInRecordMapper.selectById(signInRecordId);
  56 + assertPojoEquals(reqVO, signInRecord);
  57 + }
  58 +
  59 + @Test
  60 + public void testUpdateSignInRecord_success() {
  61 + // mock 数据
  62 + SignInRecordDO dbSignInRecord = randomPojo(SignInRecordDO.class);
  63 + signInRecordMapper.insert(dbSignInRecord);// @Sql: 先插入出一条存在的数据
  64 + // 准备参数
  65 + SignInRecordUpdateReqVO reqVO = randomPojo(SignInRecordUpdateReqVO.class, o -> {
  66 + o.setId(dbSignInRecord.getId()); // 设置更新的 ID
  67 + });
  68 +
  69 + // 调用
  70 + signInRecordService.updateSignInRecord(reqVO);
  71 + // 校验是否更新正确
  72 + SignInRecordDO signInRecord = signInRecordMapper.selectById(reqVO.getId()); // 获取最新的
  73 + assertPojoEquals(reqVO, signInRecord);
  74 + }
  75 +
  76 + @Test
  77 + public void testUpdateSignInRecord_notExists() {
  78 + // 准备参数
  79 + SignInRecordUpdateReqVO reqVO = randomPojo(SignInRecordUpdateReqVO.class);
  80 +
  81 + // 调用, 并断言异常
  82 + assertServiceException(() -> signInRecordService.updateSignInRecord(reqVO), SIGN_IN_RECORD_NOT_EXISTS);
  83 + }
  84 +
  85 + @Test
  86 + public void testDeleteSignInRecord_success() {
  87 + // mock 数据
  88 + SignInRecordDO dbSignInRecord = randomPojo(SignInRecordDO.class);
  89 + signInRecordMapper.insert(dbSignInRecord);// @Sql: 先插入出一条存在的数据
  90 + // 准备参数
  91 + Long id = dbSignInRecord.getId();
  92 +
  93 + // 调用
  94 + signInRecordService.deleteSignInRecord(id);
  95 + // 校验数据不存在了
  96 + assertNull(signInRecordMapper.selectById(id));
  97 + }
  98 +
  99 + @Test
  100 + public void testDeleteSignInRecord_notExists() {
  101 + // 准备参数
  102 + Long id = randomLongId();
  103 +
  104 + // 调用, 并断言异常
  105 + assertServiceException(() -> signInRecordService.deleteSignInRecord(id), SIGN_IN_RECORD_NOT_EXISTS);
  106 + }
  107 +
  108 + @Test
  109 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  110 + public void testGetSignInRecordPage() {
  111 + // mock 数据
  112 + SignInRecordDO dbSignInRecord = randomPojo(SignInRecordDO.class, o -> { // 等会查询到
  113 + o.setUserId(null);
  114 + o.setDay(null);
  115 + o.setCreateTime(null);
  116 + });
  117 + signInRecordMapper.insert(dbSignInRecord);
  118 + // 测试 userId 不匹配
  119 + signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setUserId(null)));
  120 + // 测试 day 不匹配
  121 + signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setDay(null)));
  122 + // 测试 createTime 不匹配
  123 + signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setCreateTime(null)));
  124 + // 准备参数
  125 + SignInRecordPageReqVO reqVO = new SignInRecordPageReqVO();
  126 + reqVO.setUserId(null);
  127 + reqVO.setDay(null);
  128 + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
  129 +
  130 + // 调用
  131 + PageResult<SignInRecordDO> pageResult = signInRecordService.getSignInRecordPage(reqVO);
  132 + // 断言
  133 + assertEquals(1, pageResult.getTotal());
  134 + assertEquals(1, pageResult.getList().size());
  135 + assertPojoEquals(dbSignInRecord, pageResult.getList().get(0));
  136 + }
  137 +
  138 + @Test
  139 + @Disabled // TODO 请修改 null 为需要的值,然后删除 @Disabled 注解
  140 + public void testGetSignInRecordList() {
  141 + // mock 数据
  142 + SignInRecordDO dbSignInRecord = randomPojo(SignInRecordDO.class, o -> { // 等会查询到
  143 + o.setUserId(null);
  144 + o.setDay(null);
  145 + o.setCreateTime(null);
  146 + });
  147 + signInRecordMapper.insert(dbSignInRecord);
  148 + // 测试 userId 不匹配
  149 + signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setUserId(null)));
  150 + // 测试 day 不匹配
  151 + signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setDay(null)));
  152 + // 测试 createTime 不匹配
  153 + signInRecordMapper.insert(cloneIgnoreId(dbSignInRecord, o -> o.setCreateTime(null)));
  154 + // 准备参数
  155 + SignInRecordExportReqVO reqVO = new SignInRecordExportReqVO();
  156 + reqVO.setUserId(null);
  157 + reqVO.setDay(null);
  158 + reqVO.setCreateTime(buildBetweenTime(2023, 2, 1, 2023, 2, 28));
  159 +
  160 + // 调用
  161 + List<SignInRecordDO> list = signInRecordService.getSignInRecordList(reqVO);
  162 + // 断言
  163 + assertEquals(1, list.size());
  164 + assertPojoEquals(dbSignInRecord, list.get(0));
  165 + }
  166 +
  167 +}
... ...
yudao-server/pom.xml
... ... @@ -54,11 +54,11 @@
54 54 <!-- <version>${revision}</version>-->
55 55 <!-- </dependency>-->
56 56 <!-- 支付服务 -->
57   - <dependency>
58   - <groupId>cn.iocoder.boot</groupId>
59   - <artifactId>yudao-module-pay-biz</artifactId>
60   - <version>${revision}</version>
61   - </dependency>
  57 +<!-- <dependency>-->
  58 +<!-- <groupId>cn.iocoder.boot</groupId>-->
  59 +<!-- <artifactId>yudao-module-pay-biz</artifactId>-->
  60 +<!-- <version>${revision}</version>-->
  61 +<!-- </dependency>-->
62 62  
63 63 <!-- 微信公众号模块。默认注释,保证编译速度 -->
64 64 <!-- <dependency>-->
... ... @@ -68,19 +68,25 @@
68 68 <!-- </dependency>-->
69 69  
70 70 <!-- 商城相关模块。默认注释,保证编译速度 -->
  71 +<!-- <dependency>-->
  72 +<!-- <groupId>cn.iocoder.boot</groupId>-->
  73 +<!-- <artifactId>yudao-module-promotion-biz</artifactId>-->
  74 +<!-- <version>${revision}</version>-->
  75 +<!-- </dependency>-->
  76 +<!-- <dependency>-->
  77 +<!-- <groupId>cn.iocoder.boot</groupId>-->
  78 +<!-- <artifactId>yudao-module-product-biz</artifactId>-->
  79 +<!-- <version>${revision}</version>-->
  80 +<!-- </dependency>-->
  81 +<!-- <dependency>-->
  82 +<!-- <groupId>cn.iocoder.boot</groupId>-->
  83 +<!-- <artifactId>yudao-module-trade-biz</artifactId>-->
  84 +<!-- <version>${revision}</version>-->
  85 +<!-- </dependency>-->
  86 +
71 87 <dependency>
72 88 <groupId>cn.iocoder.boot</groupId>
73   - <artifactId>yudao-module-promotion-biz</artifactId>
74   - <version>${revision}</version>
75   - </dependency>
76   - <dependency>
77   - <groupId>cn.iocoder.boot</groupId>
78   - <artifactId>yudao-module-product-biz</artifactId>
79   - <version>${revision}</version>
80   - </dependency>
81   - <dependency>
82   - <groupId>cn.iocoder.boot</groupId>
83   - <artifactId>yudao-module-trade-biz</artifactId>
  89 + <artifactId>yudao-module-point-biz</artifactId>
84 90 <version>${revision}</version>
85 91 </dependency>
86 92  
... ...