Merge branch 'feature/mall_product' of https://gitee.com/zhijiantianya/ruoyi-vue-pro

This commit is contained in:
YunaiV 2023-10-22 08:25:27 +08:00
commit d0caa77f80
291 changed files with 6342 additions and 1610 deletions

View File

@ -13,14 +13,14 @@
<!-- Server 主项目 -->
<module>yudao-server</module>
<!-- 各种 module 拓展 -->
<!-- <module>yudao-module-member</module>-->
<module>yudao-module-member</module>
<module>yudao-module-system</module>
<module>yudao-module-infra</module>
<!-- <module>yudao-module-bpm</module>-->
<!-- <module>yudao-module-report</module>-->
<!-- <module>yudao-module-mp</module>-->
<!-- <module>yudao-module-pay</module>-->
<!-- <module>yudao-module-mall</module>-->
<module>yudao-module-pay</module>
<module>yudao-module-mall</module>
<!-- 示例项目 -->
<module>yudao-example</module>
</modules>

2
sql/mysql/mall.sql Normal file
View File

@ -0,0 +1,2 @@
INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name)
VALUES ('核销订单', '', 2, 2, 2166, 'pick-up-order', 'ep:list', 'mall/trade/delivery/pickUpOrder/index', 'PickUpOrder');

View File

@ -9,7 +9,7 @@ CREATE TABLE `pay_transfer`
`app_id` bigint NOT NULL COMMENT '应用编号',
`merchant_order_id` varchar(64) NOT NULL COMMENT '商户订单编号',
`price` int NOT NULL COMMENT '转账金额单位',
`title` varchar(512) NOT NULL COMMENT '转账标题',
`subject` varchar(512) NOT NULL COMMENT '转账标题',
`payee_info` varchar(512) NOT NULL COMMENT '收款人信息不同类型和渠道不同',
`status` tinyint NOT NULL COMMENT '转账状态',
`success_time` datetime NULL COMMENT '转账成功时间',
@ -76,3 +76,130 @@ CREATE TABLE `pay_demo_transfer` (
ALTER TABLE `pay_channel`
MODIFY COLUMN `config` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '支付渠道配置' AFTER `app_id`;
-- ----------------------------
-- 充值套餐表
-- ----------------------------
DROP TABLE IF EXISTS `pay_wallet_recharge_package`;
CREATE TABLE `pay_wallet_recharge_package`
(
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(64) NOT NULL COMMENT '套餐名',
`pay_price` int NOT NULL COMMENT '支付金额',
`bonus_price` int NOT NULL COMMENT '赠送金额',
`status` tinyint NOT NULL COMMENT '状态',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB COMMENT='充值套餐表';
-- ----------------------------
-- Table structure for pay_wallet_recharge
-- ----------------------------
DROP TABLE IF EXISTS `pay_wallet_recharge`;
CREATE TABLE `pay_wallet_recharge` (
`id` bigint(0) NOT NULL AUTO_INCREMENT COMMENT '编号',
`wallet_id` bigint(0) NOT NULL COMMENT '会员钱包 id',
`total_price` int(0) NOT NULL COMMENT '用户实际到账余额例如充 100 20则该值是 120',
`pay_price` int(0) NOT NULL COMMENT '实际支付金额',
`bonus_price` int(0) NOT NULL COMMENT '钱包赠送金额',
`package_id` bigint(0) DEFAULT NULL COMMENT '充值套餐编号',
`pay_status` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否已支付[0:未支付 1:已经支付过]',
`pay_order_id` bigint(0) DEFAULT NULL COMMENT '支付订单编号',
`pay_channel_code` varchar(16) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '支付成功的支付渠道',
`pay_time` datetime(0) DEFAULT NULL COMMENT '订单支付时间',
`pay_refund_id` bigint(0) DEFAULT NULL COMMENT '支付退款单编号',
`refund_total_price` int(0) NOT NULL DEFAULT 0 COMMENT '退款金额包含赠送金额',
`refund_pay_price` int(0) NOT NULL DEFAULT 0 COMMENT '退款支付金额',
`refund_bonus_price` int(0) NOT NULL DEFAULT 0 COMMENT '退款钱包赠送金额',
`refund_time` datetime(0) DEFAULT NULL COMMENT '退款时间',
`refund_status` int(0) NOT NULL DEFAULT 0 COMMENT '退款状态',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
`create_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
`update_time` datetime(0) NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint(0) NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 9 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员钱包充值' ROW_FORMAT = Dynamic;
-- 钱包充值套餐,钱包余额菜单脚本
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status, component_name
)
VALUES (
'钱包管理', '', 1, 5, 1117,
'wallet', 'ep:caret-right', '', 0, ''
);
SELECT @parentId1 := LAST_INSERT_ID();
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status, component_name
)
VALUES (
'充值套餐', '', 2, 2, @parentId1,
'wallet-recharge-package', 'fa:leaf', 'pay/wallet/rechargePackage/index', 0, 'WalletRechargePackage'
);
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'钱包充值套餐查询', 'pay:wallet-recharge-package:query', 3, 1, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'钱包充值套餐创建', 'pay:wallet-recharge-package:create', 3, 2, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'钱包充值套餐更新', 'pay:wallet-recharge-package:update', 3, 3, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'钱包充值套餐删除', 'pay:wallet-recharge-package:delete', 3, 4, @parentId,
'', '', '', 0
);
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status, component_name
)
VALUES (
'钱包余额', '', 2, 1, @parentId1,
'wallet-balance', 'fa:leaf', 'pay/wallet/balance/index', 0, 'WalletBalance'
);
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
INSERT INTO system_menu(
name, permission, type, sort, parent_id,
path, icon, component, status
)
VALUES (
'钱包余额查询', 'pay:wallet:query', 3, 1, @parentId,
'', '', '', 0
);

View File

@ -11,7 +11,7 @@
Target Server Version : 80034
File Encoding : 65001
Date: 05/10/2023 12:42:16
Date: 18/10/2023 23:33:15
*/
SET NAMES utf8mb4;
@ -384,7 +384,7 @@ CREATE TABLE `infra_api_error_log` (
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1662 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志';
) ENGINE = InnoDB AUTO_INCREMENT = 1739 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统异常日志';
-- ----------------------------
-- Records of infra_api_error_log
@ -422,7 +422,7 @@ CREATE TABLE `infra_codegen_column` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1778 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义';
) ENGINE = InnoDB AUTO_INCREMENT = 1805 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表字段定义';
-- ----------------------------
-- Records of infra_codegen_column
@ -455,7 +455,7 @@ CREATE TABLE `infra_codegen_table` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 135 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义';
) ENGINE = InnoDB AUTO_INCREMENT = 137 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '代码生成表定义';
-- ----------------------------
-- Records of infra_codegen_table
@ -538,7 +538,7 @@ CREATE TABLE `infra_file` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1095 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表';
) ENGINE = InnoDB AUTO_INCREMENT = 1098 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表';
-- ----------------------------
-- Records of infra_file
@ -587,7 +587,7 @@ CREATE TABLE `infra_file_content` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 188 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表';
) ENGINE = InnoDB AUTO_INCREMENT = 191 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '文件表';
-- ----------------------------
-- Records of infra_file_content
@ -709,7 +709,7 @@ CREATE TABLE `member_address` (
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_userId`(`user_id` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址';
) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址';
-- ----------------------------
-- Records of member_address
@ -717,6 +717,33 @@ CREATE TABLE `member_address` (
BEGIN;
INSERT INTO `member_address` (`id`, `user_id`, `name`, `mobile`, `area_id`, `detail_address`, `default_status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 247, 'yunai', '15601691300', 140302, '芋道源码 233 666 ', b'1', '1', '2022-08-01 22:46:35', '247', '2023-06-26 19:47:46', b'0', 1);
INSERT INTO `member_address` (`id`, `user_id`, `name`, `mobile`, `area_id`, `detail_address`, `default_status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (23, 247, '测试', '15601691300', 120103, '13232312', b'0', '247', '2023-06-26 19:47:40', '247', '2023-06-26 19:47:46', b'0', 1);
INSERT INTO `member_address` (`id`, `user_id`, `name`, `mobile`, `area_id`, `detail_address`, `default_status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (24, 248, '芋头', '15601691234', 110101, '灌灌灌灌灌', b'1', '248', '2023-10-06 10:08:24', '248', '2023-10-06 10:08:24', b'0', 1);
COMMIT;
-- ----------------------------
-- Table structure for member_config
-- ----------------------------
DROP TABLE IF EXISTS `member_config`;
CREATE TABLE `member_config` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '自增主键',
`point_trade_deduct_enable` bit(1) NOT NULL COMMENT '是否开启积分抵扣',
`point_trade_deduct_unit_price` int NOT NULL COMMENT '积分抵扣(单位)',
`point_trade_deduct_max_price` int NULL DEFAULT NULL COMMENT '积分抵扣最大值',
`point_trade_give_point` bigint NULL DEFAULT NULL COMMENT '1 元赠送多少分',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员配置表';
-- ----------------------------
-- Records of member_config
-- ----------------------------
BEGIN;
INSERT INTO `member_config` (`id`, `point_trade_deduct_enable`, `point_trade_deduct_unit_price`, `point_trade_deduct_max_price`, `point_trade_give_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (5, b'1', 100, 2, 3, '1', '2023-08-20 09:54:42', '1', '2023-10-01 23:44:01', b'0', 1);
COMMIT;
-- ----------------------------
@ -741,7 +768,7 @@ CREATE TABLE `member_experience_record` (
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_user_id`(`user_id` ASC) USING BTREE COMMENT '会员经验记录-用户编号',
INDEX `idx_user_biz_type`(`user_id` ASC, `biz_type` ASC) USING BTREE COMMENT '会员经验记录-用户业务类型'
) ENGINE = InnoDB AUTO_INCREMENT = 13 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员经验记录';
) ENGINE = InnoDB AUTO_INCREMENT = 41 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员经验记录';
-- ----------------------------
-- Records of member_experience_record
@ -759,6 +786,27 @@ INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (10, 247, '97', 2, '下单奖励', '下单获得 384945 经验', 384945, 5529343, NULL, '2023-10-02 10:21:12', NULL, '2023-10-02 10:21:12', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (11, 247, '11', 3, '退单扣除', '退单获得 -699900 经验', -699900, 4829443, NULL, '2023-10-02 15:19:37', NULL, '2023-10-02 15:19:37', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (12, 247, '98', 2, '下单奖励', '下单获得 384945 经验', 384945, 5214388, NULL, '2023-10-02 15:38:39', NULL, '2023-10-02 15:38:39', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (13, 247, '102', 2, '下单奖励', '下单获得 201 经验', 201, 5214589, NULL, '2023-10-05 23:05:29', NULL, '2023-10-05 23:05:29', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (14, 247, '107', 2, '下单奖励', '下单获得 201 经验', 201, 5214790, NULL, '2023-10-05 23:23:00', NULL, '2023-10-05 23:23:00', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (15, 248, '108', 2, '下单奖励', '下单获得 275 经验', 275, 275, NULL, '2023-10-06 10:13:44', NULL, '2023-10-06 10:13:44', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (16, 248, '118', 2, '下单奖励', '下单获得 203 经验', 203, 478, NULL, '2023-10-07 06:58:52', NULL, '2023-10-07 06:58:52', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (17, 248, '119', 2, '下单奖励', '下单获得 700100 经验', 700100, 700578, NULL, '2023-10-10 23:02:36', NULL, '2023-10-10 23:02:36', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (21, 248, '15', 3, '退单扣除', '退单获得 -700100 经验', -700100, 478, '1', '2023-10-10 23:11:19', '1', '2023-10-10 23:11:19', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (22, 248, '119', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:11:23', '1', '2023-10-10 23:11:23', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (23, 248, '120', 2, '下单奖励', '下单获得 700100 经验', 700100, 700100, NULL, '2023-10-10 23:16:09', NULL, '2023-10-10 23:16:09', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (24, 248, '16', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:20:10', '1', '2023-10-10 23:20:10', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (25, 248, '120', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:20:16', '1', '2023-10-10 23:20:16', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (26, 248, '121', 2, '下单奖励', '下单获得 700100 经验', 700100, 700100, NULL, '2023-10-10 23:23:30', NULL, '2023-10-10 23:23:30', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (27, 248, '17', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:23:50', '1', '2023-10-10 23:23:50', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (28, 248, '121', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:23:55', '1', '2023-10-10 23:23:55', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (29, 248, '122', 2, '下单奖励', '下单获得 700100 经验', 700100, 700100, NULL, '2023-10-10 23:28:07', NULL, '2023-10-10 23:28:07', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (30, 248, '18', 3, '退单扣除', '退单获得 -700100 经验', -700100, 0, '1', '2023-10-10 23:29:55', '1', '2023-10-10 23:29:55', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (31, 248, '123', 2, '下单奖励', '下单获得 300 经验', 300, 300, NULL, '2023-10-10 23:44:45', NULL, '2023-10-10 23:44:45', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (32, 248, '124', 2, '下单奖励', '下单获得 560120 经验', 560120, 560420, NULL, '2023-10-11 07:03:46', NULL, '2023-10-11 07:03:46', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (33, 248, '19', 3, '退单扣除', '退单获得 -300 经验', -300, 560120, '1', '2023-10-11 07:04:28', '1', '2023-10-11 07:04:28', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (34, 248, '125', 11, '下单奖励', '下单获得 700100 经验', 700100, 700100, NULL, '2023-10-11 07:33:29', NULL, '2023-10-11 07:33:29', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (37, 248, '127', 11, '下单奖励', '下单获得 385145 经验', 385145, 385145, NULL, '2023-10-11 07:36:44', NULL, '2023-10-11 07:36:44', b'0', 1);
INSERT INTO `member_experience_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `experience`, `total_experience`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (40, 248, '120', 13, '下单奖励单个取消', '退款订单获得 -385145 经验', -385145, 0, '1', '2023-10-11 07:39:26', '1', '2023-10-11 07:39:26', b'0', 1);
COMMIT;
-- ----------------------------
@ -835,7 +883,7 @@ CREATE TABLE `member_level_record` (
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_user_id`(`user_id` ASC) USING BTREE COMMENT '会员等级记录-用户编号'
) ENGINE = InnoDB AUTO_INCREMENT = 7 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员等级记录';
) ENGINE = InnoDB AUTO_INCREMENT = 20 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '会员等级记录';
-- ----------------------------
-- Records of member_level_record
@ -865,7 +913,7 @@ CREATE TABLE `member_point_record` (
PRIMARY KEY (`id`) USING BTREE,
INDEX `index_userId`(`user_id` ASC) USING BTREE,
INDEX `index_title`(`title` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 32 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户积分记录';
) ENGINE = InnoDB AUTO_INCREMENT = 60 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户积分记录';
-- ----------------------------
-- Records of member_point_record
@ -902,6 +950,27 @@ INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (29, 247, '96', 10, '订单奖励', '下单获得 20997 积分', 20997, 10547883, NULL, '2023-10-02 09:40:20', NULL, '2023-10-02 09:40:20', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (30, 247, '97', 10, '订单奖励', '下单获得 11548 积分', 11548, 10559431, NULL, '2023-10-02 10:21:12', NULL, '2023-10-02 10:21:12', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (31, 247, '98', 10, '订单奖励', '下单获得 11548 积分', 11548, 10570979, NULL, '2023-10-02 15:38:39', NULL, '2023-10-02 15:38:39', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (32, 247, '102', 10, '订单奖励', '下单获得 6 积分', 6, 10570985, NULL, '2023-10-05 23:05:29', NULL, '2023-10-05 23:05:29', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (33, 247, '107', 10, '订单奖励', '下单获得 6 积分', 6, 10570991, NULL, '2023-10-05 23:23:00', NULL, '2023-10-05 23:23:00', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (34, 248, '108', 10, '订单奖励', '下单获得 8 积分', 8, 8, NULL, '2023-10-06 10:13:44', NULL, '2023-10-06 10:13:44', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (35, 248, '118', 10, '订单奖励', '下单获得 6 积分', 6, 14, NULL, '2023-10-07 06:58:51', NULL, '2023-10-07 06:58:51', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (36, 248, '119', 10, '订单奖励', '下单获得 21003 积分', 21003, 21017, NULL, '2023-10-10 23:02:35', NULL, '2023-10-10 23:02:35', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (40, 248, '15', 14, '订单退款', '订单退款扣除赠送的 -21003 积分', -21003, 2080697, '1', '2023-10-10 23:11:19', '1', '2023-10-10 23:11:19', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (41, 248, '119', 11, '订单取消', '订单取消退还 -21003 积分', -21003, 2059694, '1', '2023-10-10 23:11:23', '1', '2023-10-10 23:11:23', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (42, 248, '120', 10, '订单奖励', '下单获得 21003 积分', 21003, 2080697, NULL, '2023-10-10 23:16:09', NULL, '2023-10-10 23:16:09', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (43, 248, '16', 14, '订单退款', '订单退款扣除赠送的 -21003 积分', -21003, 2059694, '1', '2023-10-10 23:20:10', '1', '2023-10-10 23:20:10', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (44, 248, '120', 11, '订单取消', '订单取消退还 -21003 积分', -21003, 2038691, '1', '2023-10-10 23:20:16', '1', '2023-10-10 23:20:16', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (45, 248, '121', 10, '订单奖励', '下单获得 21003 积分', 21003, 2059694, NULL, '2023-10-10 23:23:30', NULL, '2023-10-10 23:23:30', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (46, 248, '17', 14, '订单退款', '订单退款扣除赠送的 -21003 积分', -21003, 2038691, '1', '2023-10-10 23:23:50', '1', '2023-10-10 23:23:50', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (47, 248, '121', 11, '订单取消', '订单取消退还 -21003 积分', -21003, 2017688, '1', '2023-10-10 23:23:55', '1', '2023-10-10 23:23:55', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (48, 248, '122', 10, '订单奖励', '下单获得 21003 积分', 21003, 2038691, NULL, '2023-10-10 23:28:07', NULL, '2023-10-10 23:28:07', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (49, 248, '18', 14, '订单退款', '订单退款扣除赠送的 -21003 积分', -21003, 2017688, '1', '2023-10-10 23:29:55', '1', '2023-10-10 23:29:55', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (50, 248, '123', 10, '订单奖励', '下单获得 9 积分', 9, 2017697, NULL, '2023-10-10 23:44:45', NULL, '2023-10-10 23:44:45', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (51, 248, '124', 10, '订单奖励', '下单获得 16803 积分', 16803, 2034500, NULL, '2023-10-11 07:03:46', NULL, '2023-10-11 07:03:46', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (52, 248, '19', 14, '订单退款', '订单退款扣除赠送的 -9 积分', -9, 2034491, '1', '2023-10-11 07:04:28', '1', '2023-10-11 07:04:28', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (53, 248, '125', 21, '订单积分奖励', '下单获得 21003 积分', 21003, 21003, NULL, '2023-10-11 07:33:29', NULL, '2023-10-11 07:33:29', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (56, 248, '127', 21, '订单积分奖励', '下单获得 11554 积分', 11554, 11554, NULL, '2023-10-11 07:36:44', NULL, '2023-10-11 07:36:44', b'0', 1);
INSERT INTO `member_point_record` (`id`, `user_id`, `biz_id`, `biz_type`, `title`, `description`, `point`, `total_point`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (59, 248, '120', 23, '订单积分奖励单个退款', '订单退款扣除赠送的 -11554 积分', -11554, 0, '1', '2023-10-11 07:39:26', '1', '2023-10-11 07:39:26', b'0', 1);
COMMIT;
-- ----------------------------
@ -1003,6 +1072,7 @@ CREATE TABLE `member_user` (
`password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '密码',
`status` tinyint NOT NULL COMMENT '状态',
`register_ip` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '注册 IP',
`register_terminal` tinyint NULL DEFAULT NULL COMMENT '注册终端',
`login_ip` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '最后登录IP',
`login_date` datetime NULL DEFAULT NULL COMMENT '最后登录时间',
`nickname` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '用户昵称',
@ -1092,7 +1162,7 @@ CREATE TABLE `system_dict_data` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1386 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典数据表';
) ENGINE = InnoDB AUTO_INCREMENT = 1398 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典数据表';
-- ----------------------------
-- Records of system_dict_data
@ -1298,7 +1368,7 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1244, 0, '按件', '1', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:40', '1', '2023-05-21 22:46:40', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1245, 1, '按重量', '2', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:58', '1', '2023-05-21 22:46:58', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1246, 2, '按体积', '3', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:47:18', '1', '2023-05-21 22:47:18', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1335, 11, '订单消费', '11', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:27', '1', '2023-08-20 11:59:47', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1335, 11, '订单积分抵扣', '11', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:27', '1', '2023-10-11 07:41:43', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1336, 1, '签到', '1', 'member_point_biz_type', 0, '', '', '', '1', '2023-06-10 12:15:48', '1', '2023-08-20 11:59:53', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1341, 20, '已退款', '20', 'pay_order_status', 0, 'danger', '', '已退款', '1', '2023-07-19 18:05:37', '1', '2023-07-19 18:05:37', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1342, 21, '请求成功但是结果失败', '21', 'pay_notify_status', 0, 'warning', '', '请求成功但是结果失败', '1', '2023-07-19 18:10:47', '1', '2023-07-19 18:11:38', b'0');
@ -1308,11 +1378,11 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1346, 1, '支付单', '1', 'pay_notify_type', 0, 'primary', '', '支付单', '1', '2023-07-20 12:23:17', '1', '2023-07-20 12:23:17', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1347, 2, '退款单', '2', 'pay_notify_type', 0, 'danger', '', NULL, '1', '2023-07-20 12:23:26', '1', '2023-07-20 12:23:26', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1348, 20, '模拟支付', 'mock', 'pay_channel_code', 0, 'default', '', '模拟支付', '1', '2023-07-29 11:10:51', '1', '2023-07-29 03:14:10', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1349, 12, '订单取消', '12', 'member_point_biz_type', 0, '', '', '', '1', '2023-08-20 12:00:03', '1', '2023-08-20 12:00:03', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1349, 12, '订单积分抵扣整单取消', '12', 'member_point_biz_type', 0, '', '', '', '1', '2023-08-20 12:00:03', '1', '2023-10-11 07:42:01', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1350, 0, '管理员调整', '0', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1351, 1, '邀新奖励', '1', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1352, 2, '下单奖励', '2', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1353, 3, '退单扣除', '3', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1352, 11, '下单奖励', '11', 'member_experience_biz_type', 0, 'success', '', NULL, '', '2023-08-22 12:41:01', '1', '2023-10-11 07:45:09', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1353, 12, '下单奖励整单取消', '12', 'member_experience_biz_type', 0, 'warning', '', NULL, '', '2023-08-22 12:41:01', '1', '2023-10-11 07:45:01', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1354, 4, '签到奖励', '4', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1355, 5, '抽奖奖励', '5', 'member_experience_biz_type', 0, '', '', NULL, '', '2023-08-22 12:41:01', '', '2023-08-22 12:41:01', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1356, 1, '快递发货', '1', 'trade_delivery_type', 0, '', '', '', '1', '2023-08-23 00:04:55', '1', '2023-08-23 00:04:55', b'0');
@ -1348,6 +1418,15 @@ INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `st
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1386, 1, '砍价中', '1', 'promotion_bargain_record_status', 0, 'default', '', '', '1', '2023-10-05 10:41:26', '1', '2023-10-05 10:41:26', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1387, 2, '砍价成功', '2', 'promotion_bargain_record_status', 0, 'success', '', '', '1', '2023-10-05 10:41:39', '1', '2023-10-05 10:41:39', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1388, 3, '砍价失败', '3', 'promotion_bargain_record_status', 0, 'warning', '', '', '1', '2023-10-05 10:41:57', '1', '2023-10-05 10:41:57', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1389, 1, '拼团中', '1', 'promotion_combination_record_status', 0, '', '', '', '1', '2023-10-08 07:24:44', '1', '2023-10-08 07:24:44', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1390, 2, '拼团成功', '2', 'promotion_combination_record_status', 0, 'success', '', '', '1', '2023-10-08 07:24:56', '1', '2023-10-08 07:24:56', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1391, 3, '拼团失败', '3', 'promotion_combination_record_status', 0, 'warning', '', '', '1', '2023-10-08 07:25:11', '1', '2023-10-08 07:25:11', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1392, 2, '管理员修改', '2', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:41:34', '1', '2023-10-11 07:41:34', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1393, 13, '订单积分抵扣单个退款', '13', 'member_point_biz_type', 0, '', '', '', '1', '2023-10-11 07:42:29', '1', '2023-10-11 07:42:29', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1394, 21, '订单积分奖励', '21', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:42:44', '1', '2023-10-11 07:42:44', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1395, 22, '订单积分奖励整单取消', '22', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:42:55', '1', '2023-10-11 07:43:01', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1396, 23, '订单积分奖励单个退款', '23', 'member_point_biz_type', 0, 'default', '', '', '1', '2023-10-11 07:43:16', '1', '2023-10-11 07:43:16', b'0');
INSERT INTO `system_dict_data` (`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1397, 13, '下单奖励单个退款', '13', 'member_experience_biz_type', 0, 'warning', '', '', '1', '2023-10-11 07:45:24', '1', '2023-10-11 07:45:38', b'0');
COMMIT;
-- ----------------------------
@ -1368,7 +1447,7 @@ CREATE TABLE `system_dict_type` (
`deleted_time` datetime NULL DEFAULT NULL COMMENT '删除时间',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `dict_type`(`type` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 183 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典类型表';
) ENGINE = InnoDB AUTO_INCREMENT = 185 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '字典类型表';
-- ----------------------------
-- Records of system_dict_type
@ -1441,6 +1520,7 @@ INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creat
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (181, '佣金提现状态', 'brokerage_withdraw_status', 0, NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0', NULL);
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (182, '佣金提现银行', 'brokerage_bank_name', 0, NULL, '', '2023-09-28 02:46:05', '', '2023-09-28 02:46:05', b'0', NULL);
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (183, '砍价记录的状态', 'promotion_bargain_record_status', 0, '', '1', '2023-10-05 10:41:08', '1', '2023-10-05 10:41:08', b'0', '1970-01-01 00:00:00');
INSERT INTO `system_dict_type` (`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (184, '拼团记录的状态', 'promotion_combination_record_status', 0, '', '1', '2023-10-08 07:24:25', '1', '2023-10-08 07:24:25', b'0', '1970-01-01 00:00:00');
COMMIT;
-- ----------------------------
@ -1489,7 +1569,7 @@ CREATE TABLE `system_login_log` (
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2516 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录';
) ENGINE = InnoDB AUTO_INCREMENT = 2599 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '系统访问记录';
-- ----------------------------
-- Records of system_login_log
@ -1619,7 +1699,7 @@ CREATE TABLE `system_menu` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2366 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表';
) ENGINE = InnoDB AUTO_INCREMENT = 2389 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '菜单权限表';
-- ----------------------------
-- Records of system_menu
@ -1871,7 +1951,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2021, '规格创建', 'product:property:create', 3, 2, 2019, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:30', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, '规格更新', 'product:property:update', 3, 3, 2019, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:33', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, '规格删除', 'product:property:delete', 3, 4, 2019, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-12-12 20:26:37', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 'Banner管理', '', 2, 100, 2030, 'banner', '', 'mall/market/banner/index', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '1', '2023-08-21 10:27:51', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 'Banner管理', '', 2, 100, 2387, 'banner', 'fa:bandcamp', 'mall/market/banner/index', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '1', '2023-10-16 09:41:54', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 'Banner查询', 'market:banner:query', 3, 1, 2025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
@ -2037,7 +2117,7 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2306, '拼团活动创建', 'promotion:combination-activity:create', 3, 2, 2304, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-12 17:54:49', '1', '2023-08-12 17:54:49', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2307, '拼团活动更新', 'promotion:combination-activity:update', 3, 3, 2304, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-12 17:55:04', '1', '2023-08-12 17:55:04', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2308, '拼团活动删除', 'promotion:combination-activity:delete', 3, 4, 2304, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-12 17:55:23', '1', '2023-08-12 17:55:23', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2309, '秒杀活动关闭', 'promotion:combination-activity:close ', 3, 5, 2304, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-12 17:55:37', '1', '2023-08-12 17:55:37', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2309, '拼团活动关闭', 'promotion:combination-activity:close', 3, 5, 2304, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-12 17:55:37', '1', '2023-10-06 10:51:57', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2310, '砍价活动', '', 2, 4, 2030, 'bargain', 'ep:box', '', '', 0, b'1', b'1', b'1', '1', '2023-08-13 00:27:25', '1', '2023-08-13 00:27:25', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2311, '砍价商品', '', 2, 1, 2310, 'activity', 'ep:burger', 'mall/promotion/bargain/activity/index', 'PromotionBargainActivity', 0, b'1', b'1', b'1', '1', '2023-08-13 00:28:49', '1', '2023-10-05 01:16:23', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2312, '砍价活动查询', 'promotion:bargain-activity:query', 3, 1, 2311, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-08-13 00:32:30', '1', '2023-08-13 00:32:30', b'0');
@ -2097,6 +2177,22 @@ INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_i
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2366, '砍价记录', '', 2, 2, 2310, 'record', 'ep:list', 'mall/promotion/bargain/record/index', 'PromotionBargainRecord', 0, b'1', b'1', b'1', '', '2023-10-05 02:49:06', '1', '2023-10-05 10:50:38', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2367, '砍价记录查询', 'promotion:bargain-record:query', 3, 1, 2366, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-05 02:49:06', '', '2023-10-05 02:49:06', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2368, '助力记录查询', 'promotion:bargain-help:query', 3, 2, 2366, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-10-05 12:27:49', '1', '2023-10-05 12:27:49', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2369, '拼团记录', 'promotion:combination-record:query', 2, 2, 2303, 'record', 'ep:avatar', 'mall/promotion/combination/record/index.vue', 'PromotionCombinationRecord', 0, b'1', b'1', b'1', '1', '2023-10-08 07:10:22', '1', '2023-10-08 07:34:11', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2374, '会员统计', '', 2, 2, 2358, 'member', 'ep:avatar', 'statistics/member/index', 'MemberStatistics', 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '1', '2023-10-11 12:50:22', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2375, '会员统计查询', 'statistics:member:query', 3, 1, 2374, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-11 04:39:24', '', '2023-10-11 04:39:24', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2376, '订单核销', 'trade:order:pick-up', 3, 10, 2076, '', '', '', '', 0, b'1', b'1', b'1', '1', '2023-10-14 17:11:58', '1', '2023-10-14 17:11:58', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2377, '文章分类', '', 2, 0, 2387, 'article/category', 'fa:certificate', 'mall/promotion/article/category/index', 'ArticleCategory', 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '1', '2023-10-16 09:38:26', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2378, '分类查询', 'promotion:article-category:query', 3, 1, 2377, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2379, '分类创建', 'promotion:article-category:create', 3, 2, 2377, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2380, '分类更新', 'promotion:article-category:update', 3, 3, 2377, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2381, '分类删除', 'promotion:article-category:delete', 3, 4, 2377, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2382, '文章列表', '', 2, 2, 2387, 'article', 'ep:connection', 'mall/promotion/article/index', 'Article', 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '1', '2023-10-16 09:41:19', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2383, '文章管理查询', 'promotion:article:query', 3, 1, 2382, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2384, '文章管理创建', 'promotion:article:create', 3, 2, 2382, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2385, '文章管理更新', 'promotion:article:update', 3, 3, 2382, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2386, '文章管理删除', 'promotion:article:delete', 3, 4, 2382, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-10-16 01:26:18', '', '2023-10-16 01:26:18', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2387, '内容管理', '', 1, 1, 2030, 'content', 'ep:collection', '', '', 0, b'1', b'1', b'1', '1', '2023-10-16 09:37:31', '1', '2023-10-16 09:37:31', b'0');
INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2388, '商城首页', '', 2, 1, 2362, 'home', 'ep:home-filled', 'mall/home/index', 'MallHome', 0, b'1', b'1', b'1', '', '2023-10-16 12:10:33', '', '2023-10-16 12:10:33', b'0');
COMMIT;
-- ----------------------------
@ -2215,7 +2311,7 @@ CREATE TABLE `system_oauth2_access_token` (
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2880 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌';
) ENGINE = InnoDB AUTO_INCREMENT = 3063 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 访问令牌';
-- ----------------------------
-- Records of system_oauth2_access_token
@ -2337,7 +2433,7 @@ CREATE TABLE `system_oauth2_refresh_token` (
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1014 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌';
) ENGINE = InnoDB AUTO_INCREMENT = 1070 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'OAuth2 刷新令牌';
-- ----------------------------
-- Records of system_oauth2_refresh_token
@ -2377,7 +2473,7 @@ CREATE TABLE `system_operate_log` (
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 8643 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录';
) ENGINE = InnoDB AUTO_INCREMENT = 8738 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '操作日志记录';
-- ----------------------------
-- Records of system_operate_log
@ -3385,7 +3481,7 @@ CREATE TABLE `system_sms_code` (
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_mobile`(`mobile` ASC) USING BTREE COMMENT '手机号'
) ENGINE = InnoDB AUTO_INCREMENT = 515 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码';
) ENGINE = InnoDB AUTO_INCREMENT = 531 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '手机验证码';
-- ----------------------------
-- Records of system_sms_code
@ -3428,7 +3524,7 @@ CREATE TABLE `system_sms_log` (
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 426 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志';
) ENGINE = InnoDB AUTO_INCREMENT = 445 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '短信日志';
-- ----------------------------
-- Records of system_sms_log
@ -3478,6 +3574,33 @@ INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `cont
INSERT INTO `system_sms_template` (`id`, `type`, `status`, `code`, `name`, `content`, `params`, `remark`, `api_template_id`, `channel_id`, `channel_code`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (16, 1, 0, 'user-reset-password', '会员用户 - 重置密码', '您的验证码{code}该验证码 5 分钟内有效请勿泄漏于他人', '[\"code\"]', '', 'null', 4, 'DEBUG_DING_TALK', '1', '2023-08-19 18:58:01', '1', '2023-08-19 11:34:18', b'0');
COMMIT;
-- ----------------------------
-- Table structure for system_social_client
-- ----------------------------
DROP TABLE IF EXISTS `system_social_client`;
CREATE TABLE `system_social_client` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '应用名',
`social_type` tinyint NOT NULL COMMENT '社交平台的类型',
`user_type` tinyint NOT NULL COMMENT '用户类型',
`client_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端编号',
`client_secret` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户端密钥',
`status` tinyint NOT NULL COMMENT '状态',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交客户端表';
-- ----------------------------
-- Records of system_social_client
-- ----------------------------
BEGIN;
COMMIT;
-- ----------------------------
-- Table structure for system_social_user
-- ----------------------------
@ -3500,7 +3623,7 @@ CREATE TABLE `system_social_user` (
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 22 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交用户表';
) ENGINE = InnoDB AUTO_INCREMENT = 25 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交用户表';
-- ----------------------------
-- Records of system_social_user
@ -3525,7 +3648,7 @@ CREATE TABLE `system_social_user_bind` (
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 77 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交绑定表';
) ENGINE = InnoDB AUTO_INCREMENT = 79 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '社交绑定表';
-- ----------------------------
-- Records of system_social_user_bind
@ -3701,7 +3824,7 @@ CREATE TABLE `system_users` (
-- Records of system_users
-- ----------------------------
BEGIN;
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/e1fdd7271685ec143a0900681606406621717a666ad0b2798b096df41422b32f.png', 0, '0:0:0:0:0:0:0:1', '2023-10-05 12:34:11', 'admin', '2021-01-05 17:03:47', NULL, '2023-10-05 12:34:11', b'0', 1);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (1, 'admin', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '芋道源码', '管理员', 103, '[1]', 'aoteman@126.com', '15612345678', 1, 'http://test.yudao.iocoder.cn/e1fdd7271685ec143a0900681606406621717a666ad0b2798b096df41422b32f.png', 0, '0:0:0:0:0:0:0:1', '2023-10-18 22:31:35', 'admin', '2021-01-05 17:03:47', NULL, '2023-10-18 22:31:35', b'0', 1);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (100, 'yudao', '$2a$10$11U48RhyJ5pSBYWSn12AD./ld671.ycSzJHbyrtpeoMeYiw31eo8a', '芋道', '不要吓我', 104, '[1]', 'yudao@iocoder.cn', '15601691300', 1, '', 1, '127.0.0.1', '2022-07-09 23:03:33', '', '2021-01-07 09:07:17', NULL, '2022-07-09 23:03:33', b'0', 1);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (103, 'yuanma', '$2a$10$YMpimV4T6BtDhIaA8jSW.u8UTGBeGhc/qwXP4oxoMr4mOw9.qttt6', '源码', NULL, 106, NULL, 'yuanma@iocoder.cn', '15601701300', 0, '', 0, '127.0.0.1', '2022-07-08 01:26:27', '', '2021-01-13 23:50:35', NULL, '2022-07-08 01:26:27', b'0', 1);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (104, 'test', '$2a$10$GP8zvqHB//TekuzYZSBYAuBQJiNq1.fxQVDYJ.uBCOnWCtDVKE4H6', '测试号', NULL, 107, '[1,2]', '111@qq.com', '15601691200', 1, '', 0, '0:0:0:0:0:0:0:1', '2023-09-24 18:21:19', '', '2021-01-21 02:13:53', NULL, '2023-09-24 18:21:19', b'0', 1);
@ -3709,7 +3832,7 @@ INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`,
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (108, 'admin108', '$2a$10$y6mfvKoNYL1GXWak8nYwVOH.kCWqjactkzdoIDgiKl93WN3Ejg.Lu', '芋艿', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '', NULL, '1', '2022-02-20 23:00:50', '1', '2022-02-27 08:26:53', b'0', 119);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (109, 'admin109', '$2a$10$JAqvH0tEc0I7dfDVBI7zyuB4E3j.uH6daIjV53.vUS6PknFkDJkuK', '芋艿', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '', NULL, '1', '2022-02-20 23:11:50', '1', '2022-02-27 08:26:56', b'0', 120);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (110, 'admin110', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '小王', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '127.0.0.1', '2022-09-25 22:47:33', '1', '2022-02-22 00:56:14', NULL, '2022-09-25 22:47:33', b'0', 121);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (111, 'test', '$2a$10$mExveopHUx9Q4QiLtAzhDeH3n4/QlNLzEsM4AqgxKrU.ciUZDXZCy', '测试用户', NULL, NULL, '[]', '', '', 0, '', 0, '', NULL, '110', '2022-02-23 13:14:33', '110', '2022-02-23 13:14:33', b'0', 121);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (111, 'test', '$2a$10$mRMIYLDtRHlf6.9ipiqH1.Z.bh/R9dO9d5iHiGYPigi6r5KOoR2Wm', '测试用户', NULL, NULL, '[]', '', '', 0, '', 0, '0:0:0:0:0:0:0:1', '2023-10-18 23:31:51', '110', '2022-02-23 13:14:33', NULL, '2023-10-18 23:31:51', b'0', 121);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (112, 'newobject', '$2a$10$3alwklxqfq8/hKoW6oUV0OJp0IdQpBDauLy4633SpUjrRsStl6kMa', '新对象', NULL, 100, '[]', '', '', 1, '', 0, '0:0:0:0:0:0:0:1', '2023-02-10 13:48:13', '1', '2022-02-23 19:08:03', NULL, '2023-02-10 13:48:13', b'0', 1);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (113, 'aoteman', '$2a$10$0acJOIk2D25/oC87nyclE..0lzeu9DtQ/n3geP4fkun/zIVRhHJIO', '芋道', NULL, NULL, NULL, '', '15601691300', 0, '', 0, '127.0.0.1', '2022-03-19 18:38:51', '1', '2022-03-07 21:37:58', NULL, '2022-03-19 18:38:51', b'0', 122);
INSERT INTO `system_users` (`id`, `username`, `password`, `nickname`, `remark`, `dept_id`, `post_ids`, `email`, `mobile`, `sex`, `avatar`, `status`, `login_ip`, `login_date`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `tenant_id`) VALUES (114, 'hrmgr', '$2a$10$TR4eybBioGRhBmDBWkqWLO6NIh3mzYa8KBKDDB5woiGYFVlRAi.fu', 'hr 小姐姐', NULL, NULL, '[3]', '', '', 0, '', 0, '127.0.0.1', '2022-03-19 22:15:43', '1', '2022-03-19 21:50:58', NULL, '2022-03-19 22:15:43', b'0', 1);

View File

@ -1,49 +0,0 @@
-- 交易统计表
CREATE TABLE trade_statistics
(
id bigint AUTO_INCREMENT COMMENT '编号主键自增'
PRIMARY KEY,
time datetime NOT NULL COMMENT '统计日期',
order_create_count int DEFAULT 0 NOT NULL COMMENT '创建订单数',
order_pay_count int DEFAULT 0 NOT NULL COMMENT '支付订单商品数',
order_pay_price int DEFAULT 0 NOT NULL COMMENT '总支付金额单位',
order_wallet_pay_price int DEFAULT 0 NOT NULL COMMENT '总支付金额余额单位',
after_sale_count int DEFAULT 0 NOT NULL COMMENT '退款订单数',
after_sale_refund_price int DEFAULT 0 NOT NULL COMMENT '总退款金额单位',
brokerage_settlement_price int DEFAULT 0 NOT NULL COMMENT '佣金金额已结算单位',
recharge_pay_count int DEFAULT 0 NOT NULL COMMENT '充值订单数',
recharge_pay_price int DEFAULT 0 NOT NULL COMMENT '充值金额单位',
recharge_refund_count int DEFAULT 0 NOT NULL COMMENT '充值退款订单数',
recharge_refund_price int DEFAULT 0 NOT NULL COMMENT '充值退款金额单位',
creator varchar(64) DEFAULT '' NULL COMMENT '创建者',
create_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL COMMENT '创建时间',
updater varchar(64) DEFAULT '' NULL COMMENT '更新者',
update_time datetime DEFAULT CURRENT_TIMESTAMP NOT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
deleted bit DEFAULT b'0' NOT NULL COMMENT '是否删除',
tenant_id bigint DEFAULT 0 NOT NULL COMMENT '租户编号'
)
COMMENT '交易统计表';
CREATE INDEX trade_statistics_time_index
ON trade_statistics (time);
-- 菜单
INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name)
VALUES ('统计管理', '', 1, 4, 0, '/statistics', 'ep:data-line', '', '');
SELECT @parentId := LAST_INSERT_ID();
-- 交易统计
INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name)
VALUES ('交易统计', '', 2, 1, @parentId, 'trade', 'fa-solid:credit-card', 'statistics/trade/index', 'TradeStatistics');
SELECT @parentId := LAST_INSERT_ID();
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('交易统计查询', 'statistics:trade:query', 3, 1, @parentId, '', '', '', 0);
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('交易统计导出', 'statistics:trade:export', 3, 2, @parentId, '', '', '', 0);
-- 会员统计
INSERT INTO system_menu (name, permission, type, sort, parent_id, path, icon, component, component_name)
VALUES ('会员统计', '', 2, 2, @parentId, 'member', 'ep:avatar', 'statistics/member/index', 'MemberStatistics');
SELECT @parentId := LAST_INSERT_ID();
INSERT INTO system_menu(name, permission, type, sort, parent_id, path, icon, component, status)
VALUES ('会员统计查询', 'statistics:member:query', 3, 1, @parentId, '', '', '', 0);

View File

@ -18,8 +18,7 @@ public enum TerminalEnum implements IntArrayValuable {
WECHAT_MINI_PROGRAM(10, "微信小程序"),
WECHAT_WAP(11, "微信公众号"),
H5(20, "H5 网页"),
IOS(31, "苹果 App"),
ANDROID(32, "安卓 App"),
APP(31, "手机 App"),
;
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TerminalEnum::getTerminal).toArray();

View File

@ -27,7 +27,7 @@ public class ServletUtils {
* 返回 JSON 字符串
*
* @param response 响应
* @param object 对象会序列化成 JSON 字符串
* @param object 对象会序列化成 JSON 字符串
*/
@SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE否则会乱码
public static void writeJSON(HttpServletResponse response, Object object) {
@ -40,7 +40,7 @@ public class ServletUtils {
*
* @param response 响应
* @param filename 文件名
* @param content 附件内容
* @param content 附件内容
*/
public static void writeAttachment(HttpServletResponse response, String filename, byte[] content) throws IOException {
// 设置 header contentType
@ -88,6 +88,8 @@ public class ServletUtils {
return ServletUtil.getClientIP(request);
}
// TODO @疯狂terminal 还是从 ServletUtils 里拿更容易全局治理
public static boolean isJsonRequest(ServletRequest request) {
return StrUtil.startWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE);
}
@ -107,4 +109,5 @@ public class ServletUtils {
public static Map<String, String> getParamMap(HttpServletRequest request) {
return ServletUtil.getParamMap(request);
}
}

View File

@ -132,25 +132,31 @@ public class AreaUtils {
return convertList(areas.values(), func, area -> type.getType().equals(area.getType()));
}
// TODO @疯狂注释写下
/**
* 根据区域编号上级区域类型获取上级区域编号
*
* @param id 区域编号
* @param type 区域类型
* @return 上级区域编号
*/
public static Integer getParentIdByType(Integer id, @NonNull AreaTypeEnum type) {
// TODO @疯狂这种不要用 while true因为万一脏数据可能会死循环可以转换成 for (int i = 0; i < Byte.MAX; i++) 一般是优先层级
do {
for (int i = 0; i < Byte.MAX_VALUE; i++) {
Area area = AreaUtils.getArea(id);
if (area == null) {
return null;
}
// 情况一匹配到返回它
if (type.getType().equals(area.getType())) {
return area.getId();
}
// 情况二找到根节点返回空
if (area.getParent() == null || area.getParent().getId() == null) {
return null;
}
// 其它继续向上查找
id = area.getParent().getId();
} while (true);
}
return null;
}
}

View File

@ -51,7 +51,9 @@ public class PayTransferUnifiedReqDTO {
private String title;
/**
* 收款方信息转账类型不同收款方信息不同
* 收款方信息
*
* 转账类型 {@link #type} 不同收款方信息不同
*/
@NotEmpty(message = "收款方信息 不能为空")
private Map<String, String> payeeInfo;

View File

@ -50,8 +50,6 @@ public class PayClientFactoryImpl implements PayClientFactory {
clientClass.put(ALIPAY_APP, AlipayAppPayClient.class);
clientClass.put(ALIPAY_PC, AlipayPcPayClient.class);
clientClass.put(ALIPAY_BAR, AlipayBarPayClient.class);
// 支付包转账客户端
clientClass.put(ALIPAY_TRANSFER, AlipayTransferClient.class);
// Mock 支付客户端
clientClass.put(MOCK, MockPayClient.class);
}

View File

@ -6,24 +6,28 @@ import cn.hutool.core.lang.Assert;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.impl.AbstractPayClient;
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderStatusRespEnum;
import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayConfig;
import com.alipay.api.AlipayResponse;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.domain.AlipayTradeFastpayRefundQueryModel;
import com.alipay.api.domain.AlipayTradeQueryModel;
import com.alipay.api.domain.AlipayTradeRefundModel;
import com.alipay.api.domain.*;
import com.alipay.api.internal.util.AlipaySignature;
import com.alipay.api.request.AlipayFundTransUniTransferRequest;
import com.alipay.api.request.AlipayTradeFastpayRefundQueryRequest;
import com.alipay.api.request.AlipayTradeQueryRequest;
import com.alipay.api.request.AlipayTradeRefundRequest;
import com.alipay.api.response.AlipayFundTransUniTransferResponse;
import com.alipay.api.response.AlipayTradeFastpayRefundQueryResponse;
import com.alipay.api.response.AlipayTradeQueryResponse;
import com.alipay.api.response.AlipayTradeRefundResponse;
@ -39,6 +43,9 @@ import java.util.Objects;
import java.util.function.Supplier;
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMATTER;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_CERTIFICATE;
/**
* 支付宝抽象类实现支付宝统一的接口以及部分实现退款
@ -105,16 +112,20 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPa
// 1.2 构建 AlipayTradeQueryRequest 请求
AlipayTradeQueryRequest request = new AlipayTradeQueryRequest();
request.setBizModel(model);
// 2.1 执行请求
AlipayTradeQueryResponse response = client.execute(request);
AlipayTradeQueryResponse response;
if (Objects.equals(config.getMode(), MODE_CERTIFICATE)) {
// 证书模式
response = client.certificateExecute(request);
} else {
response = client.execute(request);
}
if (!response.isSuccess()) { // 不成功例如说订单不存在
return PayOrderRespDTO.closedOf(response.getSubCode(), response.getSubMsg(),
outTradeNo, response);
}
// 2.2 解析订单的状态
Integer status = parseStatus(response.getTradeStatus());
Assert.notNull(status, (Supplier<Throwable>) () -> {
Assert.notNull(status, () -> {
throw new IllegalArgumentException(StrUtil.format("body({}) 的 trade_status 不正确", response.getBody()));
});
return PayOrderRespDTO.of(status, response.getTradeNo(), response.getBuyerUserId(), LocalDateTimeUtil.of(response.getSendPayDate()),
@ -148,7 +159,12 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPa
request.setBizModel(model);
// 2.1 执行请求
AlipayTradeRefundResponse response = client.execute(request);
AlipayTradeRefundResponse response;
if (Objects.equals(config.getMode(), MODE_CERTIFICATE)) { // 证书模式
response = client.certificateExecute(request);
} else {
response = client.execute(request);
}
if (!response.isSuccess()) {
// 当出现 ACQ.SYSTEM_ERROR, 退款可能成功也可能失败 返回 WAIT 状态. 后续 job 会轮询
if (ObjectUtils.equalsAny(response.getSubCode(), "ACQ.SYSTEM_ERROR", "SYSTEM_ERROR")) {
@ -185,7 +201,12 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPa
request.setBizModel(model);
// 2.1 执行请求
AlipayTradeFastpayRefundQueryResponse response = client.execute(request);
AlipayTradeFastpayRefundQueryResponse response;
if (Objects.equals(config.getMode(), MODE_CERTIFICATE)) { // 证书模式
response = client.certificateExecute(request);
} else {
response = client.execute(request);
}
if (!response.isSuccess()) {
// 明确不存在的情况应该就是失败可进行关闭
if (ObjectUtils.equalsAny(response.getSubCode(), "TRADE_NOT_EXIST", "ACQ.TRADE_NOT_EXIST")) {
@ -202,7 +223,69 @@ public abstract class AbstractAlipayPayClient extends AbstractPayClient<AlipayPa
return PayRefundRespDTO.waitingOf(null, outRefundNo, response);
}
@Override
protected PayTransferRespDTO doUnifiedTransfer(PayTransferUnifiedReqDTO reqDTO) throws AlipayApiException {
// 1.1 校验公钥类型 必须使用公钥证书模式
if (!Objects.equals(config.getMode(), MODE_CERTIFICATE)) {
throw new IllegalStateException("支付宝单笔转账必须使用公钥证书模式");
}
// 1.2 构建 AlipayFundTransUniTransferModel
AlipayFundTransUniTransferModel model = new AlipayFundTransUniTransferModel();
// 通用的参数
model.setTransAmount(formatAmount(reqDTO.getPrice())); // 转账金额
model.setOrderTitle(reqDTO.getTitle()); // 转账业务的标题用于在支付宝用户的账单里显示
model.setOutBizNo(reqDTO.getOutTransferNo());
model.setProductCode("TRANS_ACCOUNT_NO_PWD"); // 销售产品码单笔无密转账固定为 TRANS_ACCOUNT_NO_PWD
model.setBizScene("DIRECT_TRANSFER"); // 业务场景 单笔无密转账固定为 DIRECT_TRANSFER
model.setBusinessParams(JsonUtils.toJsonString(reqDTO.getChannelExtras()));
PayTransferTypeEnum transferType = PayTransferTypeEnum.typeOf(reqDTO.getType());
switch (transferType) {
// TODO @jason是不是不用传递 transferType 参数哈因为应该已经明确是支付宝啦
// @芋艿 是不是还要考虑转账到银行卡所以传 transferType 但是转账到银行卡不知道要如何测试??
case ALIPAY_BALANCE: {
// 个性化的参数
Participant payeeInfo = new Participant();
payeeInfo.setIdentityType("ALIPAY_LOGON_ID");
String logonId = MapUtil.getStr(reqDTO.getPayeeInfo(), "ALIPAY_LOGON_ID");
if (StrUtil.isEmpty(logonId)) {
throw exception0(BAD_REQUEST.getCode(), "支付包登录 ID 不能为空");
}
String accountName = MapUtil.getStr(reqDTO.getPayeeInfo(), "ALIPAY_ACCOUNT_NAME");
if (StrUtil.isEmpty(accountName)) {
throw exception0(BAD_REQUEST.getCode(), "支付包账户名称不能为空");
}
payeeInfo.setIdentity(logonId); // 支付宝登录号
payeeInfo.setName(accountName); // 支付宝账号姓名
model.setPayeeInfo(payeeInfo);
// 1.3 构建 AlipayFundTransUniTransferRequest
AlipayFundTransUniTransferRequest request = new AlipayFundTransUniTransferRequest();
request.setBizModel(model);
// 执行请求
AlipayFundTransUniTransferResponse response = client.certificateExecute(request);
// 处理结果
if (!response.isSuccess()) {
// 当出现 SYSTEM_ERROR, 转账可能成功也可能失败 返回 WAIT 状态. 后续 job 会轮询
if (ObjectUtils.equalsAny(response.getSubCode(), "SYSTEM_ERROR", "ACQ.SYSTEM_ERROR")) {
return PayTransferRespDTO.waitingOf(null, reqDTO.getOutTransferNo(), response);
}
return PayTransferRespDTO.closedOf(response.getSubCode(), response.getSubMsg(),
reqDTO.getOutTransferNo(), response);
}
return PayTransferRespDTO.successOf(response.getOrderId(), parseTime(response.getTransDate()),
response.getOutBizNo(), response);
}
case BANK_CARD: {
Participant payeeInfo = new Participant();
payeeInfo.setIdentityType("BANKCARD_ACCOUNT");
// TODO 待实现
throw new UnsupportedOperationException("待实现");
}
default: {
throw new IllegalStateException("不正确的转账类型: " + transferType);
}
}
}
// ========== 各种工具方法 ==========

View File

@ -2,8 +2,6 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
import com.alipay.api.AlipayApiException;
@ -58,9 +56,4 @@ public class AlipayAppPayClient extends AbstractAlipayPayClient {
return PayOrderRespDTO.waitingOf(displayMode, response.getBody(),
reqDTO.getOutTradeNo(), response);
}
@Override
protected PayTransferRespDTO doUnifiedTransfer(PayTransferUnifiedReqDTO reqDTO) {
throw new UnsupportedOperationException("支付宝【App 支付】不支持转账操作");
}
}

View File

@ -5,8 +5,6 @@ import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
import com.alipay.api.AlipayApiException;
@ -16,9 +14,11 @@ import com.alipay.api.response.AlipayTradePayResponse;
import lombok.extern.slf4j.Slf4j;
import java.time.LocalDateTime;
import java.util.Objects;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
import static cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_CERTIFICATE;
/**
* 支付宝条码支付 PayClient 实现类
@ -61,7 +61,13 @@ public class AlipayBarPayClient extends AbstractAlipayPayClient {
request.setReturnUrl(reqDTO.getReturnUrl());
// 2.1 执行请求
AlipayTradePayResponse response = client.execute(request);
AlipayTradePayResponse response;
if (Objects.equals(config.getMode(), MODE_CERTIFICATE)) {
// 证书模式
response = client.certificateExecute(request);
} else {
response = client.execute(request);
}
// 2.2 处理结果
if (!response.isSuccess()) {
return buildClosedPayOrderRespDTO(reqDTO, response);
@ -76,9 +82,4 @@ public class AlipayBarPayClient extends AbstractAlipayPayClient {
return PayOrderRespDTO.waitingOf(displayMode, "",
reqDTO.getOutTradeNo(), response);
}
@Override
protected PayTransferRespDTO doUnifiedTransfer(PayTransferUnifiedReqDTO reqDTO) {
throw new UnsupportedOperationException("支付宝【条码支付】不支持转账操作");
}
}

View File

@ -4,8 +4,6 @@ import cn.hutool.core.util.ObjectUtil;
import cn.hutool.http.Method;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
import com.alipay.api.AlipayApiException;
@ -68,9 +66,4 @@ public class AlipayPcPayClient extends AbstractAlipayPayClient {
return PayOrderRespDTO.waitingOf(displayMode, response.getBody(),
reqDTO.getOutTradeNo(), response);
}
@Override
protected PayTransferRespDTO doUnifiedTransfer(PayTransferUnifiedReqDTO reqDTO) {
throw new UnsupportedOperationException("支付宝【PC 网站】不支持转账操作");
}
}

View File

@ -2,8 +2,6 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
import com.alipay.api.AlipayApiException;
@ -12,6 +10,10 @@ import com.alipay.api.request.AlipayTradePrecreateRequest;
import com.alipay.api.response.AlipayTradePrecreateResponse;
import lombok.extern.slf4j.Slf4j;
import java.util.Objects;
import static cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_CERTIFICATE;
/**
* 支付宝扫码支付 PayClient 实现类
*
@ -47,7 +49,13 @@ public class AlipayQrPayClient extends AbstractAlipayPayClient {
request.setReturnUrl(reqDTO.getReturnUrl());
// 2.1 执行请求
AlipayTradePrecreateResponse response = client.execute(request);
AlipayTradePrecreateResponse response;
if (Objects.equals(config.getMode(), MODE_CERTIFICATE)) {
// 证书模式
response = client.certificateExecute(request);
} else {
response = client.execute(request);
}
// 2.2 处理结果
if (!response.isSuccess()) {
return buildClosedPayOrderRespDTO(reqDTO, response);
@ -55,9 +63,4 @@ public class AlipayQrPayClient extends AbstractAlipayPayClient {
return PayOrderRespDTO.waitingOf(displayMode, response.getQrCode(),
reqDTO.getOutTradeNo(), response);
}
@Override
protected PayTransferRespDTO doUnifiedTransfer(PayTransferUnifiedReqDTO reqDTO) {
throw new UnsupportedOperationException("支付宝【扫码支付】不支持转账操作");
}
}

View File

@ -1,103 +0,0 @@
package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
import cn.hutool.core.map.MapUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.refund.PayRefundUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum;
import com.alipay.api.AlipayApiException;
import com.alipay.api.domain.AlipayFundTransUniTransferModel;
import com.alipay.api.domain.Participant;
import com.alipay.api.request.AlipayFundTransUniTransferRequest;
import com.alipay.api.response.AlipayFundTransUniTransferResponse;
import lombok.extern.slf4j.Slf4j;
import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.BAD_REQUEST;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
/**
* 支付宝转账的 PayClient 实现类
*
* @author jason
*/
@Slf4j
public class AlipayTransferClient extends AbstractAlipayPayClient {
public AlipayTransferClient(Long channelId, AlipayPayClientConfig config) {
super(channelId, PayChannelEnum.ALIPAY_TRANSFER.getCode(), config);
}
@Override
protected PayOrderRespDTO doUnifiedOrder(PayOrderUnifiedReqDTO reqDTO) {
throw new UnsupportedOperationException("支付宝转账不支持统一下单请求");
}
@Override
protected PayRefundRespDTO doUnifiedRefund(PayRefundUnifiedReqDTO reqDTO) {
throw new UnsupportedOperationException("支付宝转账不支持统一退款请求");
}
@Override
protected PayTransferRespDTO doUnifiedTransfer(PayTransferUnifiedReqDTO reqDTO) throws AlipayApiException {
// 1.1 构建 AlipayFundTransUniTransferModel
AlipayFundTransUniTransferModel model = new AlipayFundTransUniTransferModel();
// 通用的参数
model.setTransAmount(formatAmount(reqDTO.getPrice())); // 转账金额
model.setOrderTitle(reqDTO.getTitle()); // 转账业务的标题用于在支付宝用户的账单里显示
model.setOutBizNo(reqDTO.getOutTransferNo());
model.setProductCode("TRANS_ACCOUNT_NO_PWD"); // 销售产品码单笔无密转账固定为 TRANS_ACCOUNT_NO_PWD
model.setBizScene("DIRECT_TRANSFER"); // 业务场景 单笔无密转账固定为 DIRECT_TRANSFER
model.setBusinessParams(JsonUtils.toJsonString(reqDTO.getChannelExtras()));
PayTransferTypeEnum transferType = PayTransferTypeEnum.ofType(reqDTO.getType());
switch(transferType){
case WX_BALANCE :
case WALLET_BALANCE : {
log.error("[doUnifiedTransfer],支付宝转账不支持的转账类型{}", transferType);
throw new UnsupportedOperationException(String.format("支付宝转账不支持转账类型: %s",transferType.getName()));
}
case ALIPAY_BALANCE : {
// 个性化的参数
Participant payeeInfo = new Participant();
payeeInfo.setIdentityType("ALIPAY_LOGON_ID");
String logonId = MapUtil.getStr(reqDTO.getPayeeInfo(), "ALIPAY_LOGON_ID");
if (StrUtil.isEmpty(logonId)) {
throw exception0(BAD_REQUEST.getCode(), "支付包登录 ID 不能为空");
}
String accountName = MapUtil.getStr(reqDTO.getPayeeInfo(), "ALIPAY_ACCOUNT_NAME");
if (StrUtil.isEmpty(accountName)) {
throw exception0(BAD_REQUEST.getCode(), "支付包账户名称不能为空");
}
payeeInfo.setIdentity(logonId); // 支付宝登录号
payeeInfo.setName(accountName); // 支付宝账号姓名
model.setPayeeInfo(payeeInfo);
// 1.2 构建 AlipayFundTransUniTransferRequest
AlipayFundTransUniTransferRequest request = new AlipayFundTransUniTransferRequest();
request.setBizModel(model);
// 执行请求
AlipayFundTransUniTransferResponse response = client.certificateExecute(request);
// 处理结果
if (!response.isSuccess()) {
// 当出现 SYSTEM_ERROR, 转账可能成功也可能失败 返回 WAIT 状态. 后续 job 会轮询
if (ObjectUtils.equalsAny(response.getSubCode(), "SYSTEM_ERROR", "ACQ.SYSTEM_ERROR")) {
return PayTransferRespDTO.waitingOf(null, reqDTO.getOutTransferNo(), response);
}
return PayTransferRespDTO.closedOf(response.getSubCode(), response.getSubMsg(),
reqDTO.getOutTransferNo(), response);
}
return PayTransferRespDTO.successOf(response.getOrderId(), parseTime(response.getTransDate()),
response.getOutBizNo(), response);
}
case BANK_CARD : {
Participant payeeInfo = new Participant();
payeeInfo.setIdentityType("BANKCARD_ACCOUNT");
throw new UnsupportedOperationException("待实现");
}
default: {
throw new IllegalStateException("不正确的转账类型: " + transferType);
}
}
}
}

View File

@ -3,8 +3,6 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.alipay;
import cn.hutool.http.Method;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferRespDTO;
import cn.iocoder.yudao.framework.pay.core.client.dto.transfer.PayTransferUnifiedReqDTO;
import cn.iocoder.yudao.framework.pay.core.enums.channel.PayChannelEnum;
import cn.iocoder.yudao.framework.pay.core.enums.order.PayOrderDisplayModeEnum;
import com.alipay.api.AlipayApiException;
@ -57,9 +55,4 @@ public class AlipayWapPayClient extends AbstractAlipayPayClient {
return PayOrderRespDTO.waitingOf(displayMode, response.getBody(),
reqDTO.getOutTradeNo(), response);
}
@Override
public PayTransferRespDTO doUnifiedTransfer(PayTransferUnifiedReqDTO reqDTO) {
throw new UnsupportedOperationException("支付宝【Wap 网站】不支持转账操作");
}
}

View File

@ -70,4 +70,5 @@ public class MockPayClient extends AbstractPayClient<NonePayClientConfig> {
protected PayTransferRespDTO doUnifiedTransfer(PayTransferUnifiedReqDTO reqDTO) {
throw new UnsupportedOperationException("待实现");
}
}

View File

@ -28,8 +28,6 @@ public enum PayChannelEnum {
ALIPAY_APP("alipay_app", "支付宝App 支付", AlipayPayClientConfig.class),
ALIPAY_QR("alipay_qr", "支付宝扫码支付", AlipayPayClientConfig.class),
ALIPAY_BAR("alipay_bar", "支付宝条码支付", AlipayPayClientConfig.class),
ALIPAY_TRANSFER("alipay_transfer", "支付宝转账", AlipayPayClientConfig.class),
MOCK("mock", "模拟支付", NonePayClientConfig.class),
WALLET("wallet", "钱包支付", NonePayClientConfig.class);

View File

@ -18,10 +18,10 @@ public enum PayTransferStatusRespEnum {
/**
* TODO 转账到银行卡. 会有T+0 T+1 到账的请情况 还未实现
* TODO @jason可以看看其它开源项目针对这个场景处理策略是怎么样的例如说每天主动轮询这个状态的单子
*/
IN_PROGRESS(10, "转账进行中"),
SUCCESS(20, "转账成功"),
/**
* 转账关闭 (失败或者其它情况)

View File

@ -15,6 +15,7 @@ import java.util.Arrays;
@AllArgsConstructor
@Getter
public enum PayTransferTypeEnum implements IntArrayValuable {
ALIPAY_BALANCE(1, "支付宝余额"),
WX_BALANCE(2, "微信余额"),
BANK_CARD(3, "银行卡"),
@ -33,7 +34,8 @@ public enum PayTransferTypeEnum implements IntArrayValuable {
return ARRAYS;
}
public static PayTransferTypeEnum ofType(Integer type) {
public static PayTransferTypeEnum typeOf(Integer type) {
return ArrayUtil.firstMatch(item -> item.getType().equals(type), values());
}
}

View File

@ -0,0 +1,313 @@
package cn.iocoder.yudao.framework.mybatis.core.query;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils;
import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
import com.github.yulichang.toolkit.MPJWrappers;
import com.github.yulichang.wrapper.MPJLambdaWrapper;
import org.springframework.util.StringUtils;
import java.util.Collection;
import java.util.function.Consumer;
/**
* 拓展 MyBatis Plus Join QueryWrapper 主要增加如下功能
* <p>
* 1. 拼接条件的方法增加 xxxIfPresent 方法用于判断值不存在的时候不要拼接到条件中
*
* @param <T> 数据类型
*/
public class MPJLambdaWrapperX<T> extends MPJLambdaWrapper<T> {
public MPJLambdaWrapperX<T> likeIfPresent(SFunction<T, ?> column, String val) {
MPJWrappers.lambdaJoin().like(column, val);
if (StringUtils.hasText(val)) {
return (MPJLambdaWrapperX<T>) super.like(column, val);
}
return this;
}
public MPJLambdaWrapperX<T> inIfPresent(SFunction<T, ?> column, Collection<?> values) {
if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) {
return (MPJLambdaWrapperX<T>) super.in(column, values);
}
return this;
}
public MPJLambdaWrapperX<T> inIfPresent(SFunction<T, ?> column, Object... values) {
if (ObjectUtil.isAllNotEmpty(values) && !ArrayUtil.isEmpty(values)) {
return (MPJLambdaWrapperX<T>) super.in(column, values);
}
return this;
}
public MPJLambdaWrapperX<T> eqIfPresent(SFunction<T, ?> column, Object val) {
if (ObjectUtil.isNotEmpty(val)) {
return (MPJLambdaWrapperX<T>) super.eq(column, val);
}
return this;
}
public MPJLambdaWrapperX<T> neIfPresent(SFunction<T, ?> column, Object val) {
if (ObjectUtil.isNotEmpty(val)) {
return (MPJLambdaWrapperX<T>) super.ne(column, val);
}
return this;
}
public MPJLambdaWrapperX<T> gtIfPresent(SFunction<T, ?> column, Object val) {
if (val != null) {
return (MPJLambdaWrapperX<T>) super.gt(column, val);
}
return this;
}
public MPJLambdaWrapperX<T> geIfPresent(SFunction<T, ?> column, Object val) {
if (val != null) {
return (MPJLambdaWrapperX<T>) super.ge(column, val);
}
return this;
}
public MPJLambdaWrapperX<T> ltIfPresent(SFunction<T, ?> column, Object val) {
if (val != null) {
return (MPJLambdaWrapperX<T>) super.lt(column, val);
}
return this;
}
public MPJLambdaWrapperX<T> leIfPresent(SFunction<T, ?> column, Object val) {
if (val != null) {
return (MPJLambdaWrapperX<T>) super.le(column, val);
}
return this;
}
public MPJLambdaWrapperX<T> betweenIfPresent(SFunction<T, ?> column, Object val1, Object val2) {
if (val1 != null && val2 != null) {
return (MPJLambdaWrapperX<T>) super.between(column, val1, val2);
}
if (val1 != null) {
return (MPJLambdaWrapperX<T>) ge(column, val1);
}
if (val2 != null) {
return (MPJLambdaWrapperX<T>) le(column, val2);
}
return this;
}
public MPJLambdaWrapperX<T> betweenIfPresent(SFunction<T, ?> column, Object[] values) {
Object val1 = ArrayUtils.get(values, 0);
Object val2 = ArrayUtils.get(values, 1);
return betweenIfPresent(column, val1, val2);
}
// ========== 重写父类方法方便链式调用 ==========
@Override
public <X> MPJLambdaWrapperX<T> eq(boolean condition, SFunction<X, ?> column, Object val) {
super.eq(condition, column, val);
return this;
}
@Override
public <X> MPJLambdaWrapperX<T> eq(SFunction<X, ?> column, Object val) {
super.eq(column, val);
return this;
}
@Override
public <X> MPJLambdaWrapperX<T> orderByDesc(SFunction<X, ?> column) {
//noinspection unchecked
super.orderByDesc(true, column);
return this;
}
@Override
public MPJLambdaWrapperX<T> last(String lastSql) {
super.last(lastSql);
return this;
}
@Override
public <X> MPJLambdaWrapperX<T> in(SFunction<X, ?> column, Collection<?> coll) {
super.in(column, coll);
return this;
}
@Override
public MPJLambdaWrapperX<T> selectAll(Class<?> clazz) {
super.selectAll(clazz);
return this;
}
@Override
public MPJLambdaWrapperX<T> selectAll(Class<?> clazz, String prefix) {
super.selectAll(clazz, prefix);
return this;
}
@Override
public <S> MPJLambdaWrapperX<T> selectAs(SFunction<S, ?> column, String alias) {
super.selectAs(column, alias);
return this;
}
@Override
public <E> MPJLambdaWrapperX<T> selectAs(String column, SFunction<E, ?> alias) {
super.selectAs(column, alias);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectAs(SFunction<S, ?> column, SFunction<X, ?> alias) {
super.selectAs(column, alias);
return this;
}
@Override
public <E, X> MPJLambdaWrapperX<T> selectAs(String index, SFunction<E, ?> column, SFunction<X, ?> alias) {
super.selectAs(index, column, alias);
return this;
}
@Override
public <E> MPJLambdaWrapperX<T> selectAsClass(Class<E> source, Class<?> tag) {
super.selectAsClass(source, tag);
return this;
}
@Override
public <E, F> MPJLambdaWrapperX<T> selectSub(Class<E> clazz, Consumer<MPJLambdaWrapper<E>> consumer, SFunction<F, ?> alias) {
super.selectSub(clazz, consumer, alias);
return this;
}
@Override
public <E, F> MPJLambdaWrapperX<T> selectSub(Class<E> clazz, String st, Consumer<MPJLambdaWrapper<E>> consumer, SFunction<F, ?> alias) {
super.selectSub(clazz, st, consumer, alias);
return this;
}
@Override
public <S> MPJLambdaWrapperX<T> selectCount(SFunction<S, ?> column) {
super.selectCount(column);
return this;
}
@Override
public MPJLambdaWrapperX<T> selectCount(Object column, String alias) {
super.selectCount(column, alias);
return this;
}
@Override
public <X> MPJLambdaWrapperX<T> selectCount(Object column, SFunction<X, ?> alias) {
super.selectCount(column, alias);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectCount(SFunction<S, ?> column, String alias) {
super.selectCount(column, alias);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectCount(SFunction<S, ?> column, SFunction<X, ?> alias) {
super.selectCount(column, alias);
return this;
}
@Override
public <S> MPJLambdaWrapperX<T> selectSum(SFunction<S, ?> column) {
super.selectSum(column);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectSum(SFunction<S, ?> column, String alias) {
super.selectSum(column, alias);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectSum(SFunction<S, ?> column, SFunction<X, ?> alias) {
super.selectSum(column, alias);
return this;
}
@Override
public <S> MPJLambdaWrapperX<T> selectMax(SFunction<S, ?> column) {
super.selectMax(column);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectMax(SFunction<S, ?> column, String alias) {
super.selectMax(column, alias);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectMax(SFunction<S, ?> column, SFunction<X, ?> alias) {
super.selectMax(column, alias);
return this;
}
@Override
public <S> MPJLambdaWrapperX<T> selectMin(SFunction<S, ?> column) {
super.selectMin(column);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectMin(SFunction<S, ?> column, String alias) {
super.selectMin(column, alias);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectMin(SFunction<S, ?> column, SFunction<X, ?> alias) {
super.selectMin(column, alias);
return this;
}
@Override
public <S> MPJLambdaWrapperX<T> selectAvg(SFunction<S, ?> column) {
super.selectAvg(column);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectAvg(SFunction<S, ?> column, String alias) {
super.selectAvg(column, alias);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectAvg(SFunction<S, ?> column, SFunction<X, ?> alias) {
super.selectAvg(column, alias);
return this;
}
@Override
public <S> MPJLambdaWrapperX<T> selectLen(SFunction<S, ?> column) {
super.selectLen(column);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectLen(SFunction<S, ?> column, String alias) {
super.selectLen(column, alias);
return this;
}
@Override
public <S, X> MPJLambdaWrapperX<T> selectLen(SFunction<S, ?> column, SFunction<X, ?> alias) {
super.selectLen(column, alias);
return this;
}
}

View File

@ -34,8 +34,9 @@ public interface ErrorCodeConstants {
// ========== 商品 SPU 1-008-005-000 ==========
ErrorCode SPU_NOT_EXISTS = new ErrorCode(1_008_005_000, "商品 SPU 不存在");
ErrorCode SPU_SAVE_FAIL_CATEGORY_LEVEL_ERROR = new ErrorCode(1_008_005_001, "商品分类不正确,原因:必须使用第二级的商品分类及以下");
ErrorCode SPU_NOT_ENABLE = new ErrorCode(1_008_005_002, "商品 SPU【{}】不处于上架状态");
ErrorCode SPU_NOT_RECYCLE = new ErrorCode(1_008_005_003, "商品 SPU 不处于回收站状态");
ErrorCode SPU_SAVE_FAIL_COUPON_TEMPLATE_NOT_EXISTS = new ErrorCode(1_008_005_002, "商品 SPU 保存失败,原因:优惠卷不存在");
ErrorCode SPU_NOT_ENABLE = new ErrorCode(1_008_005_003, "商品 SPU【{}】不处于上架状态");
ErrorCode SPU_NOT_RECYCLE = new ErrorCode(1_008_005_004, "商品 SPU 不处于回收站状态");
// ========== 商品 SKU 1-008-006-000 ==========
ErrorCode SKU_NOT_EXISTS = new ErrorCode(1_008_006_000, "商品 SKU 不存在");

View File

@ -28,6 +28,11 @@
<artifactId>yudao-module-member-api</artifactId>
<version>${revision}</version>
</dependency>
<dependency>
<groupId>cn.iocoder.boot</groupId>
<artifactId>yudao-module-promotion-api</artifactId>
<version>${revision}</version>
</dependency>
<!-- 业务组件 -->
<dependency>

View File

@ -8,8 +8,11 @@ import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*;
import cn.iocoder.yudao.module.product.convert.spu.ProductSpuConvert;
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
import cn.iocoder.yudao.module.promotion.api.coupon.CouponTemplateApi;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponTemplateRespDTO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
@ -22,6 +25,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
@ -41,6 +45,9 @@ public class ProductSpuController {
@Resource
private ProductSkuService productSkuService;
@Resource
private CouponTemplateApi couponTemplateApi;
@PostMapping("/create")
@Operation(summary = "创建商品 SPU")
@PreAuthorize("@ss.hasPermission('product:spu:create')")
@ -85,14 +92,20 @@ public class ProductSpuController {
}
// 查询商品 SKU
List<ProductSkuDO> skus = productSkuService.getSkuListBySpuId(spu.getId());
return success(ProductSpuConvert.INSTANCE.convertForSpuDetailRespVO(spu, skus));
// 查询优惠卷
// TODO @puhui999优惠劵的信息要不交给前端读取主要是为了避免商品依赖 promotion 模块哈
List<CouponTemplateRespDTO> couponTemplateList = couponTemplateApi.getCouponTemplateListByIds(
spu.getGiveCouponTemplateIds());
return success(ProductSpuConvert.INSTANCE.convertForSpuDetailRespVO(spu, skus, couponTemplateList));
}
@GetMapping("/get-simple-list")
@GetMapping("/list-all-simple")
@Operation(summary = "获得商品 SPU 精简列表")
@PreAuthorize("@ss.hasPermission('product:spu:query')")
public CommonResult<List<ProductSpuSimpleRespVO>> getSpuSimpleList() {
List<ProductSpuDO> list = productSpuService.getSpuList();
List<ProductSpuDO> list = productSpuService.getSpuListByStatus(ProductSpuStatusEnum.ENABLE.getStatus());
// 降序排序后返回给前端
list.sort(Comparator.comparing(ProductSpuDO::getSort).reversed());
return success(ProductSpuConvert.INSTANCE.convertList02(list));
}

View File

@ -96,19 +96,31 @@ public class ProductSpuBaseVO {
@NotNull(message = "商品赠送积分不能为空")
private Integer giveIntegral;
@Schema(description = "赠送的优惠劵编号的数组", example = "[1, 10]") // TODO 这块前端还未实现
private List<Long> giveCouponTemplateIds;
@Schema(description = "赠送的优惠劵数组包含优惠券编号和名称")
private List<GiveCouponTemplate> giveCouponTemplates;
@Schema(description = "分销类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
@NotNull(message = "商品分销类型不能为空")
private Boolean subCommissionType;
@Schema(description = "活动展示顺序", example = "[1, 3, 2, 4, 5]") // TODO 这块前端还未实现
@Schema(description = "活动展示顺序", example = "[1, 3, 2, 4, 5]")
private List<Integer> activityOrders;
// ========== 统计相关字段 =========
@Schema(description = "虚拟销量", example = "芋道")
@Schema(description = "虚拟销量", example = "66")
private Integer virtualSalesCount;
@Schema(description = "管理后台 - 商品 SPU 赠送的优惠卷")
@Data
public static class GiveCouponTemplate {
@Schema(description = "模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
private Long id;
@Schema(description = "优惠劵名", requiredMode = Schema.RequiredMode.REQUIRED, example = "春节送送送")
private String name;
}
}

View File

@ -12,6 +12,7 @@ import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert;
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
import cn.iocoder.yudao.module.product.enums.DictTypeConstants;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponTemplateRespDTO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Named;
@ -100,10 +101,14 @@ public interface ProductSpuConvert {
List<AppProductSpuDetailRespVO.Sku> convertListForGetSpuDetail(List<ProductSkuDO> skus);
default ProductSpuDetailRespVO convertForSpuDetailRespVO(ProductSpuDO spu, List<ProductSkuDO> skus) {
ProductSpuDetailRespVO detailRespVO = convert03(spu);
detailRespVO.setSkus(ProductSkuConvert.INSTANCE.convertList(skus));
return detailRespVO;
List<ProductSpuDetailRespVO.GiveCouponTemplate> convertList04(List<CouponTemplateRespDTO> couponTemplateList);
default ProductSpuDetailRespVO convertForSpuDetailRespVO(ProductSpuDO spu, List<ProductSkuDO> skus,
List<CouponTemplateRespDTO> couponTemplateList) {
ProductSpuDetailRespVO respVO = convert03(spu);
respVO.setSkus(ProductSkuConvert.INSTANCE.convertList(skus));
respVO.setGiveCouponTemplates(convertList04(couponTemplateList));
return respVO;
}
default List<ProductSpuDetailRespVO> convertForSpuDetailRespListVO(List<ProductSpuDO> spus, List<ProductSkuDO> skus) {

View File

@ -194,7 +194,7 @@ public class ProductSpuDO extends BaseDO {
* 对应 PromotionTypeEnum 枚举
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private List<Integer> activityOrders;
private List<Integer> activityOrders; // TODO @芋艿 活动顺序字段长度需要增加
// ========== 统计相关字段 =========

View File

@ -68,11 +68,12 @@ public interface ProductSpuService {
}
/**
* 获得所有商品 SPU 列表
* 获得指定状态的商品 SPU 列表
*
* @param status 状态
* @return 商品 SPU 列表
*/
List<ProductSpuDO> getSpuList();
List<ProductSpuDO> getSpuListByStatus(Integer status);
/**
* 获得所有商品 SPU 列表
@ -146,4 +147,5 @@ public interface ProductSpuService {
* @return 商品 SPU 列表
*/
List<ProductSpuDO> validateSpuList(Collection<Long> ids);
}

View File

@ -16,8 +16,10 @@ import cn.iocoder.yudao.module.product.dal.mysql.spu.ProductSpuMapper;
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
import cn.iocoder.yudao.module.product.service.brand.ProductBrandService;
import cn.iocoder.yudao.module.product.service.category.ProductCategoryService;
import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService;
import cn.iocoder.yudao.module.product.service.sku.ProductSkuService;
import cn.iocoder.yudao.module.promotion.api.coupon.CouponTemplateApi;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponTemplateRespDTO;
import cn.iocoder.yudao.module.promotion.enums.common.PromotionTypeEnum;
import com.google.common.collect.Maps;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -26,10 +28,10 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getMinValue;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getSumValue;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
import static cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO.CATEGORY_LEVEL;
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.*;
@ -52,9 +54,10 @@ public class ProductSpuServiceImpl implements ProductSpuService {
private ProductBrandService brandService;
@Resource
private ProductCategoryService categoryService;
@Resource
@Lazy // 循环依赖避免报错
private ProductPropertyValueService productPropertyValueService;
@Lazy
private CouponTemplateApi couponTemplateApi;
@Override
@Transactional(rollbackFor = Exception.class)
@ -62,6 +65,9 @@ public class ProductSpuServiceImpl implements ProductSpuService {
// 校验分类品牌
validateCategory(createReqVO.getCategoryId());
brandService.validateProductBrand(createReqVO.getBrandId());
// 校验优惠券
Set<Long> giveCouponTemplateIds = convertSet(createReqVO.getGiveCouponTemplates(), ProductSpuCreateReqVO.GiveCouponTemplate::getId);
validateCouponTemplate(giveCouponTemplateIds);
// 校验 SKU
List<ProductSkuCreateOrUpdateReqVO> skuSaveReqList = createReqVO.getSkus();
productSkuService.validateSkuList(skuSaveReqList, createReqVO.getSpecType());
@ -69,6 +75,8 @@ public class ProductSpuServiceImpl implements ProductSpuService {
ProductSpuDO spu = ProductSpuConvert.INSTANCE.convert(createReqVO);
// 初始化 SPU SKU 相关属性
initSpuFromSkus(spu, skuSaveReqList);
// 设置优惠券
spu.setGiveCouponTemplateIds(CollUtil.newArrayList(giveCouponTemplateIds));
// 插入 SPU
productSpuMapper.insert(spu);
// 插入 SKU
@ -85,6 +93,9 @@ public class ProductSpuServiceImpl implements ProductSpuService {
// 校验分类品牌
validateCategory(updateReqVO.getCategoryId());
brandService.validateProductBrand(updateReqVO.getBrandId());
// 校验优惠券
Set<Long> giveCouponTemplateIds = convertSet(updateReqVO.getGiveCouponTemplates(), ProductSpuUpdateReqVO.GiveCouponTemplate::getId);
validateCouponTemplate(giveCouponTemplateIds);
// 校验SKU
List<ProductSkuCreateOrUpdateReqVO> skuSaveReqList = updateReqVO.getSkus();
productSkuService.validateSkuList(skuSaveReqList, updateReqVO.getSpecType());
@ -92,6 +103,8 @@ public class ProductSpuServiceImpl implements ProductSpuService {
// 更新 SPU
ProductSpuDO updateObj = ProductSpuConvert.INSTANCE.convert(updateReqVO);
initSpuFromSkus(updateObj, skuSaveReqList);
// 设置优惠券
updateObj.setGiveCouponTemplateIds(CollUtil.newArrayList(giveCouponTemplateIds));
productSpuMapper.updateById(updateObj);
// 批量更新 SKU
productSkuService.updateSkuList(updateObj.getId(), updateReqVO.getSkus());
@ -125,6 +138,10 @@ public class ProductSpuServiceImpl implements ProductSpuService {
// 默认商品浏览量
spu.setBrowseCount(0);
}
// 如果活动顺序为空则默认初始化
if (CollUtil.isEmpty(spu.getActivityOrders())) {
spu.setActivityOrders(Arrays.stream(PromotionTypeEnum.ARRAYS).boxed().collect(Collectors.toList()));
}
}
/**
@ -140,6 +157,13 @@ public class ProductSpuServiceImpl implements ProductSpuService {
}
}
private void validateCouponTemplate(Collection<Long> ids) {
List<CouponTemplateRespDTO> couponTemplateList = couponTemplateApi.getCouponTemplateListByIds(ids);
if (couponTemplateList.size() != ids.size()) {
throw exception(SPU_SAVE_FAIL_COUPON_TEMPLATE_NOT_EXISTS);
}
}
@Override
public List<ProductSpuDO> validateSpuList(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) {
@ -196,8 +220,8 @@ public class ProductSpuServiceImpl implements ProductSpuService {
}
@Override
public List<ProductSpuDO> getSpuList() {
return productSpuMapper.selectList();
public List<ProductSpuDO> getSpuListByStatus(Integer status) {
return productSpuMapper.selectList(ProductSpuDO::getStatus, status);
}
@Override

View File

@ -1,7 +1,7 @@
package cn.iocoder.yudao.module.promotion.api.combination;
import cn.iocoder.yudao.framework.common.core.KeyValue;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateRespDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO;
import javax.validation.Valid;
@ -28,9 +28,9 @@ public interface CombinationRecordApi {
* 创建开团记录
*
* @param reqDTO 请求 DTO
* @return key 开团记录编号value 团长编号
* @return 拼团信息
*/
KeyValue<Long, Long> createCombinationRecord(@Valid CombinationRecordCreateReqDTO reqDTO);
CombinationRecordCreateRespDTO createCombinationRecord(@Valid CombinationRecordCreateReqDTO reqDTO);
/**
* 查询拼团记录是否成功

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.promotion.api.combination.dto;
import lombok.Data;
/**
* 拼团记录的创建 Response DTO
*
* @author HUIHUI
*/
@Data
public class CombinationRecordCreateRespDTO {
/**
* 拼团活动编号
*
* 关联 CombinationActivityDO id 字段
*/
private Long combinationActivityId;
/**
* 拼团团长编号
*
* 关联 CombinationRecordDO headId 字段
*/
private Long combinationHeadId;
/**
* 拼团记录编号
*
* 关联 CombinationRecordDO id 字段
*/
private Long combinationRecordId;
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.promotion.api.coupon;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponTemplateRespDTO;
import java.util.Collection;
import java.util.List;
/**
* 优惠劵模版 API 接口
*
* @author HUIHUI
*/
public interface CouponTemplateApi {
/**
* 获得优惠券模版的精简信息列表
*
* @param ids 优惠券模版编号
* @return 优惠券模版的精简信息列表
*/
List<CouponTemplateRespDTO> getCouponTemplateListByIds(Collection<Long> ids);
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.promotion.api.coupon.dto;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import lombok.Data;
/**
* 优惠券模版 Response DTO
*
* @author HUIHUI
*/
@Data
public class CouponTemplateRespDTO {
/**
* 模板编号自增唯一
*/
private Long id;
/**
* 优惠劵名
*/
private String name;
/**
* 状态
*
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
}

View File

@ -0,0 +1,10 @@
package cn.iocoder.yudao.module.promotion.enums;
/**
* promotion 字典类型的枚举类
*
* @author HUIHUI
*/
public class DictTypeConstants {
}

View File

@ -15,7 +15,6 @@ public interface ErrorCodeConstants {
ErrorCode DISCOUNT_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_001_002, "限时折扣活动已关闭,不能修改");
ErrorCode DISCOUNT_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED = new ErrorCode(1_013_001_003, "限时折扣活动未关闭,不能删除");
ErrorCode DISCOUNT_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1_013_001_004, "限时折扣活动已关闭,不能重复关闭");
ErrorCode DISCOUNT_ACTIVITY_CLOSE_FAIL_STATUS_END = new ErrorCode(1_013_001_005, "限时折扣活动已结束,不能关闭");
// ========== Banner 相关 1-013-002-000 ============
ErrorCode BANNER_NOT_EXISTS = new ErrorCode(1_013_002_000, "Banner 不存在");
@ -110,4 +109,11 @@ public interface ErrorCodeConstants {
ErrorCode BARGAIN_HELP_CREATE_FAIL_CONFLICT = new ErrorCode(1_013_014_003, "助力失败,请重试");
ErrorCode BARGAIN_HELP_CREATE_FAIL_HELP_EXISTS = new ErrorCode(1_013_014_004, "助力失败,您已经助力过了");
// ========== 文章分类 1-013-015-000 ==========
ErrorCode ARTICLE_CATEGORY_NOT_EXISTS = new ErrorCode(1_013_015_000, "文章分类不存在");
ErrorCode ARTICLE_CATEGORY_DELETE_FAIL_HAVE_ARTICLES = new ErrorCode(1_013_015_001, "文章分类删除失败,存在关联文章");
// ========== 文章管理 1-013-016-000 ==========
ErrorCode ARTICLE_NOT_EXISTS = new ErrorCode(1_013_016_000, "文章不存在");
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.promotion.enums.banner;
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
/**
* Banner Position 枚举
*
* @author HUIHUI
*/
@AllArgsConstructor
@Getter
public enum BannerPositionEnum implements IntArrayValuable {
HOME_POSITION(1, "首页"),
SECKILL_POSITION(2, "秒杀活动页"),
COMBINATION_POSITION(3, "砍价活动页"),
DISCOUNT_POSITION(4, "限时折扣页"),
REWARD_POSITION(5, "满减送页");
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(BannerPositionEnum::getPosition).toArray();
/**
*
*/
private final Integer position;
/**
* 名字
*/
private final String name;
@Override
public int[] array() {
return ARRAYS;
}
}

View File

@ -1,8 +1,9 @@
package cn.iocoder.yudao.module.promotion.api.combination;
import cn.iocoder.yudao.framework.common.core.KeyValue;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateRespDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO;
import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO;
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
import cn.iocoder.yudao.module.promotion.service.combination.CombinationRecordService;
@ -29,10 +30,9 @@ public class CombinationRecordApiImpl implements CombinationRecordApi {
recordService.validateCombinationRecord(userId, activityId, headId, skuId, count);
}
// TODO @puhui999搞个创建的 RespDTO
@Override
public KeyValue<Long, Long> createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) {
return recordService.createCombinationRecord(reqDTO);
public CombinationRecordCreateRespDTO createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) {
return CombinationActivityConvert.INSTANCE.convert4(recordService.createCombinationRecord(reqDTO));
}
@Override

View File

@ -0,0 +1,33 @@
package cn.iocoder.yudao.module.promotion.api.coupon;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponTemplateRespDTO;
import cn.iocoder.yudao.module.promotion.convert.coupon.CouponTemplateConvert;
import cn.iocoder.yudao.module.promotion.service.coupon.CouponTemplateService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* 优惠劵模版 API 接口实现类
*
* @author HUIHUI
*/
@Service
public class CouponTemplateApiImpl implements CouponTemplateApi {
@Resource
private CouponTemplateService couponTemplateService;
@Override
public List<CouponTemplateRespDTO> getCouponTemplateListByIds(Collection<Long> ids) {
if (CollUtil.isEmpty(ids)) { // 防御一下
return Collections.emptyList();
}
return CouponTemplateConvert.INSTANCE.convertList(couponTemplateService.getCouponTemplateListByIds(ids));
}
}

View File

@ -0,0 +1,84 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.*;
import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO;
import cn.iocoder.yudao.module.promotion.service.article.ArticleCategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.Comparator;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 文章分类")
@RestController
@RequestMapping("/promotion/article-category")
@Validated
public class ArticleCategoryController {
@Resource
private ArticleCategoryService articleCategoryService;
@PostMapping("/create")
@Operation(summary = "创建文章分类")
@PreAuthorize("@ss.hasPermission('promotion:article-category:create')")
public CommonResult<Long> createArticleCategory(@Valid @RequestBody ArticleCategoryCreateReqVO createReqVO) {
return success(articleCategoryService.createArticleCategory(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新文章分类")
@PreAuthorize("@ss.hasPermission('promotion:article-category:update')")
public CommonResult<Boolean> updateArticleCategory(@Valid @RequestBody ArticleCategoryUpdateReqVO updateReqVO) {
articleCategoryService.updateArticleCategory(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除文章分类")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('promotion:article-category:delete')")
public CommonResult<Boolean> deleteArticleCategory(@RequestParam("id") Long id) {
articleCategoryService.deleteArticleCategory(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得文章分类")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('promotion:article-category:query')")
public CommonResult<ArticleCategoryRespVO> getArticleCategory(@RequestParam("id") Long id) {
ArticleCategoryDO category = articleCategoryService.getArticleCategory(id);
return success(ArticleCategoryConvert.INSTANCE.convert(category));
}
@GetMapping("/list-all-simple")
@Operation(summary = "获取文章分类精简信息列表", description = "只包含被开启的文章分类,主要用于前端的下拉选项")
public CommonResult<List<ArticleCategorySimpleRespVO>> getSimpleDeptList() {
// 获得分类列表只要开启状态的
List<ArticleCategoryDO> list = articleCategoryService.getArticleCategoryListByStatus(CommonStatusEnum.ENABLE.getStatus());
// 降序排序后返回给前端
list.sort(Comparator.comparing(ArticleCategoryDO::getSort).reversed());
return success(ArticleCategoryConvert.INSTANCE.convertList03(list));
}
@GetMapping("/page")
@Operation(summary = "获得文章分类分页")
@PreAuthorize("@ss.hasPermission('promotion:article-category:query')")
public CommonResult<PageResult<ArticleCategoryRespVO>> getArticleCategoryPage(@Valid ArticleCategoryPageReqVO pageVO) {
PageResult<ArticleCategoryDO> pageResult = articleCategoryService.getArticleCategoryPage(pageVO);
return success(ArticleCategoryConvert.INSTANCE.convertPage(pageResult));
}
}

View File

@ -0,0 +1,74 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleRespVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO;
import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
import cn.iocoder.yudao.module.promotion.service.article.ArticleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "管理后台 - 文章管理")
@RestController
@RequestMapping("/promotion/article")
@Validated
public class ArticleController {
@Resource
private ArticleService articleService;
@PostMapping("/create")
@Operation(summary = "创建文章管理")
@PreAuthorize("@ss.hasPermission('promotion:article:create')")
public CommonResult<Long> createArticle(@Valid @RequestBody ArticleCreateReqVO createReqVO) {
return success(articleService.createArticle(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新文章管理")
@PreAuthorize("@ss.hasPermission('promotion:article:update')")
public CommonResult<Boolean> updateArticle(@Valid @RequestBody ArticleUpdateReqVO updateReqVO) {
articleService.updateArticle(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除文章管理")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('promotion:article:delete')")
public CommonResult<Boolean> deleteArticle(@RequestParam("id") Long id) {
articleService.deleteArticle(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得文章管理")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('promotion:article:query')")
public CommonResult<ArticleRespVO> getArticle(@RequestParam("id") Long id) {
ArticleDO article = articleService.getArticle(id);
return success(ArticleConvert.INSTANCE.convert(article));
}
@GetMapping("/page")
@Operation(summary = "获得文章管理分页")
@PreAuthorize("@ss.hasPermission('promotion:article:query')")
public CommonResult<PageResult<ArticleRespVO>> getArticlePage(@Valid ArticlePageReqVO pageVO) {
PageResult<ArticleDO> pageResult = articleService.getArticlePage(pageVO);
return success(ArticleConvert.INSTANCE.convertPage(pageResult));
}
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 文章管理 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class ArticleBaseVO {
@Schema(description = "文章分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "15458")
@NotNull(message = "文章分类编号不能为空")
private Long categoryId;
@Schema(description = "关联商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "22378")
@NotNull(message = "关联商品不能为空")
private Long spuId;
@Schema(description = "文章标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "这是一个标题")
@NotNull(message = "文章标题不能为空")
private String title;
@Schema(description = "文章作者", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
private String author;
@Schema(description = "文章封面图片地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
@NotNull(message = "文章封面图片地址不能为空")
private String picUrl;
@Schema(description = "文章简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "这是一个简介")
private String introduction;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "排序不能为空")
private Integer sort;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "状态不能为空")
private Integer status;
@Schema(description = "是否热门(小程序)", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
@NotNull(message = "是否热门(小程序)不能为空")
private Boolean recommendHot;
@Schema(description = "是否轮播图(小程序)", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
@NotNull(message = "是否轮播图(小程序)不能为空")
private Boolean recommendBanner;
@Schema(description = "文章内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "这是文章内容")
@NotNull(message = "文章内容不能为空")
private String content;
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 文章管理创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ArticleCreateReqVO extends ArticleBaseVO {
}

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 文章管理分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ArticlePageReqVO extends PageParam {
@Schema(description = "文章分类编号", example = "15458")
private Long categoryId;
@Schema(description = "关联商品编号", example = "22378")
private Long spuId;
@Schema(description = "文章标题")
private String title;
@Schema(description = "文章作者")
private String author;
@Schema(description = "状态", example = "2")
private Integer status;
@Schema(description = "是否热门(小程序)")
private Boolean recommendHot;
@Schema(description = "是否轮播图(小程序)")
private Boolean recommendBanner;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 文章管理 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ArticleRespVO extends ArticleBaseVO {
@Schema(description = "文章编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8606")
private Long id;
@Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "99999")
private Integer browseCount;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 文章管理更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ArticleUpdateReqVO extends ArticleBaseVO {
@Schema(description = "文章编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "8606")
@NotNull(message = "文章编号不能为空")
private Long id;
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
/**
* 文章分类 Base VO提供给添加修改详细的子 VO 使用
* 如果子 VO 存在差异的字段请不要添加到这里影响 Swagger 文档生成
*/
@Data
public class ArticleCategoryBaseVO {
@Schema(description = "文章分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "秒杀")
@NotNull(message = "文章分类名称不能为空")
private String name;
@Schema(description = "图标地址", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn")
private String picUrl;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "状态不能为空")
private Integer status;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "排序不能为空")
private Integer sort;
}

View File

@ -0,0 +1,14 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Schema(description = "管理后台 - 文章分类创建 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ArticleCategoryCreateReqVO extends ArticleCategoryBaseVO {
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 文章分类分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ArticleCategoryPageReqVO extends PageParam {
@Schema(description = "文章分类名称", example = "秒杀")
private String name;
@Schema(description = "状态", example = "1")
private Integer status;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import java.time.LocalDateTime;
@Schema(description = "管理后台 - 文章分类 Response VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ArticleCategoryRespVO extends ArticleCategoryBaseVO {
@Schema(description = "文章分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19490")
private Long id;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Schema(description = "管理后台 - 文章分类精简信息 Response VO")
@Data
public class ArticleCategorySimpleRespVO {
@Schema(description = "文章分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19490")
private Long id;
@Schema(description = "文章分类名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "秒杀")
private String name;
}

View File

@ -0,0 +1,20 @@
package cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@Schema(description = "管理后台 - 文章分类更新 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ArticleCategoryUpdateReqVO extends ArticleCategoryBaseVO {
@Schema(description = "文章分类编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "19490")
@NotNull(message = "文章分类编号不能为空")
private Long id;
}

View File

@ -27,6 +27,10 @@ public class BannerBaseVO {
@NotNull(message = "图片地址不能为空")
private String picUrl;
@Schema(description = "position", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "position 不能为空")
private Integer position;
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "排序不能为空")
private Integer sort;

View File

@ -13,19 +13,16 @@ import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* @author xia
*/
@Schema(description = "管理后台 - Banner 分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class BannerPageReqVO extends PageParam {
// TODO @puhui999example
@Schema(description = "标题")
private String title;
@Schema(description = "状态")
@InEnum(CommonStatusEnum.class)
private Integer status;

View File

@ -3,11 +3,11 @@ package cn.iocoder.yudao.module.promotion.controller.admin.combination;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordPageItemRespVO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPage2VO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordSummaryVO;
import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO;
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
import cn.iocoder.yudao.module.promotion.service.combination.CombinationActivityService;
@ -40,29 +40,17 @@ public class CombinationRecordController {
@Lazy
private CombinationRecordService combinationRecordService;
// TODO @puhui999getBargainRecordPage getBargainRecordPage 是不是可以合并然后 CombinationRecordReqPageVO 加一个 headId
// 然后如果 headId 非空并且第一页单独多查询一条 head 放到第 0 个位置相当于说第一页特殊一点
@GetMapping("/page")
@Operation(summary = "获得拼团记录分页")
@PreAuthorize("@ss.hasPermission('promotion:combination-record:query')")
public CommonResult<PageResult<CombinationRecordPageItemRespVO>> getBargainRecordPage(@Valid CombinationRecordReqPageVO pageVO) {
PageResult<CombinationRecordDO> recordPage = combinationRecordService.getCombinationRecordPage(pageVO);
// 拼接数据
List<CombinationActivityDO> activities = combinationActivityService.getCombinationActivityListByIds(
convertSet(recordPage.getList(), CombinationRecordDO::getActivityId));
// TODO @puhui999商品没读取
return success(CombinationActivityConvert.INSTANCE.convert(recordPage, activities));
}
@GetMapping("/page-by-headId")
@Operation(summary = "获得拼团记录分页")
@PreAuthorize("@ss.hasPermission('promotion:combination-record:query')")
public CommonResult<PageResult<CombinationRecordPageItemRespVO>> getBargainRecordPage(@Valid CombinationRecordReqPage2VO pageVO) {
// 包含团长和团员的分页记录
PageResult<CombinationRecordDO> recordPage = combinationRecordService.getCombinationRecordPage2(pageVO);
List<CombinationActivityDO> activities = combinationActivityService.getCombinationActivityListByIds(
List<CombinationProductDO> products = combinationActivityService.getCombinationProductListByActivityIds(
convertSet(recordPage.getList(), CombinationRecordDO::getActivityId));
return success(CombinationActivityConvert.INSTANCE.convert(recordPage, activities));
return success(CombinationActivityConvert.INSTANCE.convert(recordPage, activities, products));
}
@GetMapping("/get-summary")
@ -70,7 +58,7 @@ public class CombinationRecordController {
@PreAuthorize("@ss.hasPermission('promotion:combination-record:query')")
public CommonResult<CombinationRecordSummaryVO> getCombinationRecordSummary() {
CombinationRecordSummaryVO summaryVO = new CombinationRecordSummaryVO();
summaryVO.setUserCount(combinationRecordService.getCombinationRecordCount(null, null, null)); // 获取拼团用户参与数量
summaryVO.setUserCount(combinationRecordService.getCombinationUserCount()); // 获取拼团用户参与数量
summaryVO.setSuccessCount(combinationRecordService.getCombinationRecordCount( // 获取成团记录
CombinationRecordStatusEnum.SUCCESS.getStatus(), null, CombinationRecordDO.HEAD_ID_GROUP));
summaryVO.setVirtualGroupCount(combinationRecordService.getCombinationRecordCount(// 获取虚拟成团记录

View File

@ -23,6 +23,9 @@ public class CombinationRecordReqPageVO extends PageParam {
@InEnum(BargainRecordStatusEnum.class)
private Integer status;
@Schema(description = "团长编号", example = "1024")
private Long headId;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;

View File

@ -1,7 +1,10 @@
package cn.iocoder.yudao.module.promotion.controller.admin.discount;
import cn.hutool.core.collection.CollUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi;
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
import cn.iocoder.yudao.module.promotion.controller.admin.discount.vo.*;
import cn.iocoder.yudao.module.promotion.convert.discount.DiscountActivityConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountActivityDO;
@ -19,6 +22,7 @@ import javax.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
@Tag(name = "管理后台 - 限时折扣活动")
@RestController
@ -29,6 +33,9 @@ public class DiscountActivityController {
@Resource
private DiscountActivityService discountActivityService;
@Resource
private ProductSpuApi productSpuApi;
@PostMapping("/create")
@Operation(summary = "创建限时折扣活动")
@PreAuthorize("@ss.hasPermission('promotion:discount-activity:create')")
@ -49,7 +56,7 @@ public class DiscountActivityController {
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('promotion:discount-activity:close')")
public CommonResult<Boolean> closeRewardActivity(@RequestParam("id") Long id) {
discountActivityService.closeRewardActivity(id);
discountActivityService.closeDiscountActivity(id);
return success(true);
}
@ -81,7 +88,18 @@ public class DiscountActivityController {
@PreAuthorize("@ss.hasPermission('promotion:discount-activity:query')")
public CommonResult<PageResult<DiscountActivityRespVO>> getDiscountActivityPage(@Valid DiscountActivityPageReqVO pageVO) {
PageResult<DiscountActivityDO> pageResult = discountActivityService.getDiscountActivityPage(pageVO);
return success(DiscountActivityConvert.INSTANCE.convertPage(pageResult));
if (CollUtil.isEmpty(pageResult.getList())) { // TODO @zhangshuai方法里的空行目的是让代码分块可以更清晰所以上面这个空格可以不要而下面判断之后的空格其实加下比较好类似的还有 spuList以及后面的 convert
return success(PageResult.empty(pageResult.getTotal()));
}
// 拼接数据
List<DiscountProductDO> products = discountActivityService.getDiscountProductsByActivityId(
convertSet(pageResult.getList(), DiscountActivityDO::getId));
List<ProductSpuRespDTO> spuList = productSpuApi.getSpuList(
convertSet(products, DiscountProductDO::getSpuId));
return success(DiscountActivityConvert.INSTANCE.convertPage(pageResult, products, spuList));
}
}

View File

@ -7,6 +7,7 @@ import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "管理后台 - 限时折扣活动 Response VO")
@Data
@ -24,4 +25,25 @@ public class DiscountActivityRespVO extends DiscountActivityBaseVO {
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;
@Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") // TODO @zhangshuai属性和属性之间最多空一行噢
private Long spuId;
@Schema(description = "限时折扣商品", requiredMode = Schema.RequiredMode.REQUIRED)
private List<DiscountActivityBaseVO.Product> products;
// ========== 商品字段 ==========
// TODO @zhangshuai一个优惠活动会关联多个商品所以它不用返回 spuName
// TODO 最终界面展示字段就编号活动名称参与商品数活动状态开始时间结束时间操作
@Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, // SPU name 读取
example = "618大促")
private String spuName;
@Schema(description = "商品主图", requiredMode = Schema.RequiredMode.REQUIRED, // SPU picUrl 读取
example = "https://www.iocoder.cn/xx.png")
private String picUrl;
@Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, // SPU marketPrice 读取
example = "50")
private Integer marketPrice;
}

View File

@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.*;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -45,7 +46,7 @@ public class AppActivityController {
@Parameter(name = "spuId", description = "商品编号", required = true)
public CommonResult<List<AppActivityRespVO>> getActivityListBySpuId(@RequestParam("spuId") Long spuId) {
// 每种活动只返回一个
return success(getAppActivityRespVOList(Collections.singletonList(spuId)));
return success(getAppActivityList(Collections.singletonList(spuId)));
}
@GetMapping("/list-by-spu-ids")
@ -56,17 +57,19 @@ public class AppActivityController {
return success(MapUtil.empty());
}
// 每种活动只返回一个key SPU 编号
return success(convertMultiMap(getAppActivityRespVOList(spuIds), AppActivityRespVO::getSpuId));
return success(convertMultiMap(getAppActivityList(spuIds), AppActivityRespVO::getSpuId));
}
private List<AppActivityRespVO> getAppActivityRespVOList(Collection<Long> spuIds) {
private List<AppActivityRespVO> getAppActivityList(Collection<Long> spuIds) {
if (CollUtil.isEmpty(spuIds)) {
return new ArrayList<>();
}
LocalDateTime now = LocalDateTime.now();
List<AppActivityRespVO> activityList = new ArrayList<>();
// 拼团活动
List<CombinationActivityDO> combinationActivities = combinationActivityService.getCombinationActivityBySpuIdsAndStatus(
spuIds, CommonStatusEnum.ENABLE.getStatus());
// 1. 拼团活动 - 获取开启的且开始的且没有结束的活动
List<CombinationActivityDO> combinationActivities = combinationActivityService.getCombinationActivityBySpuIdsAndStatusAndDateTimeLt(
spuIds, CommonStatusEnum.ENABLE.getStatus(), now);
if (CollUtil.isNotEmpty(combinationActivities)) {
combinationActivities.forEach(item -> {
activityList.add(new AppActivityRespVO().setId(item.getId())
@ -74,9 +77,10 @@ public class AppActivityController {
.setSpuId(item.getSpuId()).setStartTime(item.getStartTime()).setEndTime(item.getEndTime()));
});
}
// 秒杀活动
List<SeckillActivityDO> seckillActivities = seckillActivityService.getSeckillActivityBySpuIdsAndStatus(
spuIds, CommonStatusEnum.ENABLE.getStatus());
// 2. 秒杀活动 - 获取开启的且开始的且没有结束的活动
List<SeckillActivityDO> seckillActivities = seckillActivityService.getSeckillActivityBySpuIdsAndStatusAndDateTimeLt(
spuIds, CommonStatusEnum.ENABLE.getStatus(), now);
if (CollUtil.isNotEmpty(seckillActivities)) {
seckillActivities.forEach(item -> {
activityList.add(new AppActivityRespVO().setId(item.getId())
@ -84,9 +88,10 @@ public class AppActivityController {
.setSpuId(item.getSpuId()).setStartTime(item.getStartTime()).setEndTime(item.getEndTime()));
});
}
// 砍价活动
List<BargainActivityDO> bargainActivities = bargainActivityService.getBargainActivityBySpuIdsAndStatus(
spuIds, CommonStatusEnum.ENABLE.getStatus());
// 3. 砍价活动 - 获取开启的且开始的且没有结束的活动
List<BargainActivityDO> bargainActivities = bargainActivityService.getBargainActivityBySpuIdsAndStatusAndDateTimeLt(
spuIds, CommonStatusEnum.ENABLE.getStatus(), now);
if (CollUtil.isNotEmpty(bargainActivities)) {
bargainActivities.forEach(item -> {
activityList.add(new AppActivityRespVO().setId(item.getId())

View File

@ -1,16 +1,20 @@
package cn.iocoder.yudao.module.promotion.controller.app.article;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.category.AppArticleCategoryRespVO;
import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO;
import cn.iocoder.yudao.module.promotion.service.article.ArticleCategoryService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import javax.annotation.Resource;
import java.util.Comparator;
import java.util.List;
import java.util.Random;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -20,20 +24,16 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
public class AppArticleCategoryController {
@Resource
private ArticleCategoryService articleCategoryService;
@RequestMapping("/list")
@Operation(summary = "获得文章分类列表")
// TODO @芋艿swagger 注解
public CommonResult<List<AppArticleCategoryRespVO>> getArticleCategoryList() {
List<AppArticleCategoryRespVO> appArticleRespVOList = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < 10; i++) {
AppArticleCategoryRespVO appArticleRespVO = new AppArticleCategoryRespVO();
appArticleRespVO.setId((long) (i + 1));
appArticleRespVO.setName("分类 - " + i);
appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png");
appArticleRespVOList.add(appArticleRespVO);
}
return success(appArticleRespVOList);
List<ArticleCategoryDO> categoryList = articleCategoryService.getArticleCategoryListByStatus(
CommonStatusEnum.ENABLE.getStatus());
categoryList.sort(Comparator.comparing(ArticleCategoryDO::getSort)); // sort 降序排列
return success(ArticleCategoryConvert.INSTANCE.convertList04(categoryList));
}
}

View File

@ -4,16 +4,20 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO;
import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert;
import cn.iocoder.yudao.module.promotion.service.article.ArticleService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.ArrayList;
import javax.annotation.Resource;
import java.util.List;
import java.util.Random;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@ -23,68 +27,41 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
public class AppArticleController {
@Resource
private ArticleService articleService;
@RequestMapping("/list")
// TODO @芋艿swagger 注解
public CommonResult<List<AppArticleRespVO>> getArticleList(@RequestParam(value = "recommendHot", required = false) Boolean recommendHot,
@RequestParam(value = "recommendBanner", required = false) Boolean recommendBanner) {
List<AppArticleRespVO> appArticleRespVOList = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < 10; i++) {
AppArticleRespVO appArticleRespVO = new AppArticleRespVO();
appArticleRespVO.setId((long) (i + 1));
appArticleRespVO.setTitle("芋道源码 - " + i + "模块");
appArticleRespVO.setAuthor("芋道源码");
appArticleRespVO.setCategoryId((long) random.nextInt(10000));
appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png");
appArticleRespVO.setIntroduction("我是简介");
appArticleRespVO.setDescription("我是详细");
appArticleRespVO.setCreateTime(LocalDateTime.now());
appArticleRespVO.setBrowseCount(random.nextInt(10000));
appArticleRespVO.setSpuId((long) random.nextInt(10000));
appArticleRespVOList.add(appArticleRespVO);
}
return success(appArticleRespVOList);
@Operation(summary = "获得文章详情列表")
@Parameters({
@Parameter(name = "recommendHot", description = "是否热门", example = "false"), // 场景一查看指定的文章
@Parameter(name = "recommendBanner", description = "是否轮播图", example = "false") // 场景二查看指定的文章
})
public CommonResult<List<AppArticleRespVO>> getArticleList(
@RequestParam(value = "recommendHot", required = false) Boolean recommendHot,
@RequestParam(value = "recommendBanner", required = false) Boolean recommendBanner) {
return success(ArticleConvert.INSTANCE.convertList03(
articleService.getArticleCategoryListByRecommend(recommendHot, recommendBanner)));
}
@RequestMapping("/page")
// TODO @芋艿swagger 注解
@Operation(summary = "获得文章详情分页")
public CommonResult<PageResult<AppArticleRespVO>> getArticlePage(AppArticlePageReqVO pageReqVO) {
List<AppArticleRespVO> appArticleRespVOList = new ArrayList<>();
Random random = new Random();
for (int i = 0; i < 10; i++) {
AppArticleRespVO appArticleRespVO = new AppArticleRespVO();
appArticleRespVO.setId((long) (i + 1));
appArticleRespVO.setTitle("芋道源码 - " + i + "模块");
appArticleRespVO.setAuthor("芋道源码");
appArticleRespVO.setCategoryId((long) random.nextInt(10000));
appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (i + 1) + ".png");
appArticleRespVO.setIntroduction("我是简介");
appArticleRespVO.setDescription("我是详细");
appArticleRespVO.setCreateTime(LocalDateTime.now());
appArticleRespVO.setBrowseCount(random.nextInt(10000));
appArticleRespVO.setSpuId((long) random.nextInt(10000));
appArticleRespVOList.add(appArticleRespVO);
}
return success(new PageResult<>(appArticleRespVOList, 10L));
return success(ArticleConvert.INSTANCE.convertPage02(articleService.getArticlePage(pageReqVO)));
}
@RequestMapping("/get")
// TODO @芋艿swagger 注解
@Operation(summary = "获得文章详情")
@Parameter(name = "id", description = "文章编号", example = "1024")
public CommonResult<AppArticleRespVO> getArticlePage(@RequestParam("id") Long id) {
Random random = new Random();
AppArticleRespVO appArticleRespVO = new AppArticleRespVO();
appArticleRespVO.setId((long) (1));
appArticleRespVO.setTitle("芋道源码 - " + 0 + "模块");
appArticleRespVO.setAuthor("芋道源码");
appArticleRespVO.setCategoryId((long) random.nextInt(10000));
appArticleRespVO.setPicUrl("https://www.iocoder.cn/" + (0 + 1) + ".png");
appArticleRespVO.setIntroduction("我是简介");
appArticleRespVO.setDescription("我是详细");
appArticleRespVO.setCreateTime(LocalDateTime.now());
appArticleRespVO.setBrowseCount(random.nextInt(10000));
appArticleRespVO.setSpuId((long) random.nextInt(10000));
appArticleRespVO.setSpuId(633L);
return success(appArticleRespVO);
return success(ArticleConvert.INSTANCE.convert01(articleService.getArticle(id)));
}
@PutMapping("/add-browse-count")
@Operation(summary = "增加文章浏览量")
@Parameter(name = "id", description = "文章编号", example = "1024")
public CommonResult<Boolean> addBrowseCount(@RequestParam("id") Long id) {
articleService.addArticleBrowseCount(id);
return success(true);
}
}

View File

@ -39,11 +39,4 @@ public class AppArticleRespVO {
@Schema(description = "关联的商品 SPU 编号", example = "1024")
private Long spuId;
// TODO 芋艿下面 2 个字段后端要存储前端不用返回
// @Schema(description = "是否热卖推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
// private Boolean recommendHot;
//
// @Schema(description = "是否 Banner 推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
// private Boolean recommendBanner;
}

View File

@ -16,11 +16,4 @@ public class AppArticleCategoryRespVO {
@Schema(description = "分类图标", requiredMode = Schema.RequiredMode.REQUIRED, example = "https://www.iocoder.cn/1.png")
private String picUrl;
// TODO 芋艿下面 2 个字段后端要存储前端不用返回
// @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
// private Integer status;
//
// @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
// private Integer sort;
}

View File

@ -2,18 +2,23 @@ package cn.iocoder.yudao.module.promotion.controller.app.banner;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.controller.app.banner.vo.AppBannerRespVO;
import cn.iocoder.yudao.module.promotion.convert.banner.BannerConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.banner.BannerDO;
import cn.iocoder.yudao.module.promotion.service.banner.BannerService;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import javax.annotation.Resource;
import java.time.Duration;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.common.util.cache.CacheUtils.buildAsyncReloadingCache;
@RestController
@RequestMapping("/promotion/banner")
@ -21,22 +26,41 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
public class AppBannerController {
// TODO @puhui999这个目前不缓存也没问题因为首页没用到
/**
* {@link AppBannerRespVO} 缓存通过它异步刷新 {@link #getBannerList0(Integer)} 所要的首页数据
*/
private final LoadingCache<Integer, List<AppBannerRespVO>> bannerListCache = buildAsyncReloadingCache(Duration.ofSeconds(10L),
new CacheLoader<Integer, List<AppBannerRespVO>>() {
@Override
public List<AppBannerRespVO> load(Integer position) {
return getBannerList0(position);
}
});
@Resource
private BannerService bannerService;
@GetMapping("/list")
@Operation(summary = "获得 banner 列表")
// todo @芋艿swagger 注解待补全
// TODO @芋艿可以增加缓存提升性能
// TODO @芋艿position = 1 首页position = 10 拼团活动页
@Parameter(name = "position", description = "Banner position", example = "1")
public CommonResult<List<AppBannerRespVO>> getBannerList(@RequestParam("position") Integer position) {
List<AppBannerRespVO> bannerList = new ArrayList<>();
AppBannerRespVO banner1 = new AppBannerRespVO();
banner1.setUrl("https://www.example.com/link1");
banner1.setPicUrl("https://api.java.crmeb.net/crmebimage/public/content/2022/08/04/0f78716213f64bfa83f191d51a832cbf73f6axavoy.jpg");
bannerList.add(banner1);
AppBannerRespVO banner2 = new AppBannerRespVO();
banner2.setUrl("https://www.example.com/link2");
banner2.setPicUrl("https://api.java.crmeb.net/crmebimage/public/content/2023/01/11/be09e755268b43ee90b0db3a3e1b7132r7a6t2wvsm.jpg");
bannerList.add(banner2);
return success(bannerList);
return success(bannerListCache.getUnchecked(position));
}
private List<AppBannerRespVO> getBannerList0(Integer position) {
List<BannerDO> bannerList = bannerService.getBannerListByPosition(position);
return BannerConvert.INSTANCE.convertList01(bannerList);
}
@PutMapping("/add-browse-count")
@Operation(summary = "增加 Banner 点击量")
@Parameter(name = "id", description = "Banner 编号", example = "1024")
public CommonResult<Boolean> addBrowseCount(@RequestParam("id") Long id) {
bannerService.addBannerBrowseCount(id);
return success(true);
}
}

View File

@ -9,6 +9,13 @@ import javax.validation.constraints.NotNull;
@Data
public class AppBannerRespVO {
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED)
private Long id;
@Schema(description = "标题", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "标题不能为空")
private String title;
@Schema(description = "跳转链接", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "跳转链接不能为空")
private String url;

View File

@ -47,13 +47,13 @@ public class AppCombinationRecordController {
public CommonResult<AppCombinationRecordSummaryRespVO> getCombinationRecordSummary() {
AppCombinationRecordSummaryRespVO summary = new AppCombinationRecordSummaryRespVO();
// 1. 获得拼团参与用户数量
Long count = combinationRecordService.getCombinationRecordCount(null, null, null);
if (count == 0) {
Long userCount = combinationRecordService.getCombinationUserCount();
if (userCount == 0) {
summary.setAvatars(Collections.emptyList());
summary.setUserCount(count);
summary.setUserCount(userCount);
return success(summary);
}
summary.setUserCount(count);
summary.setUserCount(userCount);
// 2. 获得拼团记录头像
List<CombinationRecordDO> records = combinationRecordService.getLatestCombinationRecordList(

View File

@ -0,0 +1,36 @@
package cn.iocoder.yudao.module.promotion.convert.article;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.*;
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.category.AppArticleCategoryRespVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 文章分类 Convert
*
* @author HUIHUI
*/
@Mapper
public interface ArticleCategoryConvert {
ArticleCategoryConvert INSTANCE = Mappers.getMapper(ArticleCategoryConvert.class);
ArticleCategoryDO convert(ArticleCategoryCreateReqVO bean);
ArticleCategoryDO convert(ArticleCategoryUpdateReqVO bean);
ArticleCategoryRespVO convert(ArticleCategoryDO bean);
List<ArticleCategoryRespVO> convertList(List<ArticleCategoryDO> list);
PageResult<ArticleCategoryRespVO> convertPage(PageResult<ArticleCategoryDO> page);
List<ArticleCategorySimpleRespVO> convertList03(List<ArticleCategoryDO> list);
List<AppArticleCategoryRespVO> convertList04(List<ArticleCategoryDO> categoryList);
}

View File

@ -0,0 +1,40 @@
package cn.iocoder.yudao.module.promotion.convert.article;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleRespVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticleRespVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
/**
* 文章管理 Convert
*
* @author HUIHUI
*/
@Mapper
public interface ArticleConvert {
ArticleConvert INSTANCE = Mappers.getMapper(ArticleConvert.class);
ArticleDO convert(ArticleCreateReqVO bean);
ArticleDO convert(ArticleUpdateReqVO bean);
ArticleRespVO convert(ArticleDO bean);
List<ArticleRespVO> convertList(List<ArticleDO> list);
PageResult<ArticleRespVO> convertPage(PageResult<ArticleDO> page);
AppArticleRespVO convert01(ArticleDO article);
PageResult<AppArticleRespVO> convertPage02(PageResult<ArticleDO> articlePage);
List<AppArticleRespVO> convertList03(List<ArticleDO> articleCategoryListByRecommendHotAndRecommendBanner);
}

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerRespVO;
import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerUpdateReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.banner.vo.AppBannerRespVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.banner.BannerDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
@ -25,4 +26,6 @@ public interface BannerConvert {
BannerDO convert(BannerUpdateReqVO updateReqVO);
List<AppBannerRespVO> convertList01(List<BannerDO> bannerList);
}

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO;
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateRespDTO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageItemRespVO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityRespVO;
@ -109,6 +110,11 @@ public interface CombinationActivityConvert {
CombinationRecordDO convert(CombinationRecordCreateReqDTO reqDTO);
default CombinationRecordCreateRespDTO convert4(CombinationRecordDO combinationRecord) {
return new CombinationRecordCreateRespDTO().setCombinationActivityId(combinationRecord.getActivityId())
.setCombinationRecordId(combinationRecord.getId()).setCombinationHeadId(combinationRecord.getHeadId());
}
default CombinationRecordDO convert(CombinationRecordCreateReqDTO reqDTO,
CombinationActivityDO activity, MemberUserRespDTO user,
ProductSpuRespDTO spu, ProductSkuRespDTO sku) {
@ -172,19 +178,20 @@ public interface CombinationActivityConvert {
PageResult<CombinationRecordPageItemRespVO> convert(PageResult<CombinationRecordDO> result);
default PageResult<CombinationRecordPageItemRespVO> convert(PageResult<CombinationRecordDO> recordPage, List<CombinationActivityDO> activities) {
default PageResult<CombinationRecordPageItemRespVO> convert(PageResult<CombinationRecordDO> recordPage, List<CombinationActivityDO> activities, List<CombinationProductDO> products) {
PageResult<CombinationRecordPageItemRespVO> result = convert(recordPage);
// 拼接关联属性
Map<Long, CombinationActivityDO> activityMap = convertMap(activities, CombinationActivityDO::getId);
Map<Long, List<CombinationProductDO>> productsMap = convertMultiMap(products, CombinationProductDO::getActivityId);
result.setList(CollectionUtils.convertList(result.getList(), item -> {
findAndThen(activityMap, item.getActivityId(), activity -> {
item.setActivity(convert(activity));
item.setActivity(convert(activity).setProducts(convertList2(productsMap.get(item.getActivityId()))));
});
return item;
}));
return result;
}
default AppCombinationRecordDetailRespVO convert(Long userId, CombinationRecordDO headRecord, List<CombinationRecordDO> memberRecords) {
AppCombinationRecordDetailRespVO respVO = new AppCombinationRecordDetailRespVO()
.setHeadRecord(convert(headRecord)).setMemberRecords(convertList3(memberRecords));
@ -200,32 +207,23 @@ public interface CombinationActivityConvert {
/**
* 转换生成虚拟成团虚拟记录
*
* @param virtualGroupHeadRecords 虚拟成团团长记录列表
* @param headRecord 虚拟成团团长记录
* @return 虚拟记录列表
*/
default List<CombinationRecordDO> convertVirtualGroupList(List<CombinationRecordDO> virtualGroupHeadRecords) {
List<CombinationRecordDO> createRecords = new ArrayList<>();
virtualGroupHeadRecords.forEach(headRecord -> {
// 计算需要创建的虚拟成团记录数量
int count = headRecord.getUserSize() - headRecord.getUserCount();
for (int i = 0; i < count; i++) {
// 基础信息和团长保持一致
CombinationRecordDO newRecord = new CombinationRecordDO().setActivityId(headRecord.getActivityId())
.setCombinationPrice(headRecord.getCombinationPrice()).setSpuId(headRecord.getSpuId()).setSpuName(headRecord.getSpuName())
.setPicUrl(headRecord.getPicUrl()).setSkuId(headRecord.getSkuId()).setHeadId(headRecord.getId())
.setStatus(headRecord.getStatus()) // 状态保持和创建时一致创建完成后会接着处理
.setVirtualGroup(headRecord.getVirtualGroup()).setExpireTime(headRecord.getExpireTime())
.setStartTime(headRecord.getStartTime()).setUserSize(headRecord.getUserSize()).setUserCount(headRecord.getUserCount());
// 虚拟信息
newRecord.setCount(0);
newRecord.setUserId(0L);
newRecord.setNickname("");
newRecord.setAvatar("");
newRecord.setOrderId(0L);
createRecords.add(newRecord);
}
});
default List<CombinationRecordDO> convertVirtualRecordList(CombinationRecordDO headRecord) {
int count = headRecord.getUserSize() - headRecord.getUserCount();
List<CombinationRecordDO> createRecords = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
// 基础信息和团长保持一致
CombinationRecordDO newRecord = convert5(headRecord);
// 虚拟信息
newRecord.setCount(0) // 会单独更新下在后续的 Service 逻辑里
.setUserId(0L).setNickname("").setAvatar("").setOrderId(0L);
createRecords.add(newRecord);
}
return createRecords;
}
@Mapping(target = "id", ignore = true)
CombinationRecordDO convert5(CombinationRecordDO headRecord);
}

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.promotion.convert.coupon;
import cn.hutool.core.map.MapUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponTemplateRespDTO;
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplatePageReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplateRespVO;
@ -58,4 +59,6 @@ public interface CouponTemplateConvert {
}
}
List<CouponTemplateRespDTO> convertList(List<CouponTemplateDO> list);
}

View File

@ -2,6 +2,9 @@ package cn.iocoder.yudao.module.promotion.convert.discount;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.common.util.collection.MapUtils;
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
import cn.iocoder.yudao.module.promotion.api.discount.dto.DiscountProductRespDTO;
import cn.iocoder.yudao.module.promotion.controller.admin.discount.vo.*;
import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountActivityDO;
@ -11,6 +14,7 @@ import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import java.util.List;
import java.util.Map;
/**
* 限时折扣活动 Convert
@ -29,14 +33,57 @@ public interface DiscountActivityConvert {
DiscountActivityRespVO convert(DiscountActivityDO bean);
List<DiscountActivityRespVO> convertList(List<DiscountActivityDO> list);
List<DiscountActivityBaseVO.Product> convertList2(List<DiscountProductDO> list);
List<DiscountProductRespDTO> convertList02(List<DiscountProductDO> list);
PageResult<DiscountActivityRespVO> convertPage(PageResult<DiscountActivityDO> page);
default PageResult<DiscountActivityRespVO> convertPage(PageResult<DiscountActivityDO> page,
List<DiscountProductDO> discountProductDOList,
List<ProductSpuRespDTO> spuList) {
PageResult<DiscountActivityRespVO> pageResult = convertPage(page);
// 拼接商品 TODO @zhangshuai类似空行的问题也可以看看
Map<Long, DiscountProductDO> discountActivityMap = CollectionUtils.convertMap(discountProductDOList, DiscountProductDO::getActivityId);
Map<Long, ProductSpuRespDTO> spuMap = CollectionUtils.convertMap(spuList, ProductSpuRespDTO::getId);
pageResult.getList().forEach(item -> {
item.setProducts(convertList2(discountProductDOList));
item.setSpuId(discountActivityMap.get(item.getId())==null?null: discountActivityMap.get(item.getId()).getSpuId());
if (item.getSpuId() != null) {
MapUtils.findAndThen(spuMap, item.getSpuId(),
spu -> item.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()));
}
});
return pageResult;
}
DiscountProductDO convert(DiscountActivityBaseVO.Product bean);
DiscountActivityDetailRespVO convert(DiscountActivityDO activity, List<DiscountProductDO> products);
default DiscountActivityDetailRespVO convert(DiscountActivityDO activity, List<DiscountProductDO> products){
if ( activity == null && products == null ) {
return null;
}
DiscountActivityDetailRespVO discountActivityDetailRespVO = new DiscountActivityDetailRespVO();
if ( activity != null ) {
discountActivityDetailRespVO.setName( activity.getName() );
discountActivityDetailRespVO.setStartTime( activity.getStartTime() );
discountActivityDetailRespVO.setEndTime( activity.getEndTime() );
discountActivityDetailRespVO.setRemark( activity.getRemark() );
discountActivityDetailRespVO.setId( activity.getId() );
discountActivityDetailRespVO.setStatus( activity.getStatus() );
discountActivityDetailRespVO.setCreateTime( activity.getCreateTime() );
}
if (!products.isEmpty()) {
discountActivityDetailRespVO.setSpuId(products.get(0).getSpuId());
}
discountActivityDetailRespVO.setProducts( convertList2( products ) );
return discountActivityDetailRespVO;
}
// =========== 比较是否相等 ==========
/**

View File

@ -0,0 +1,49 @@
package cn.iocoder.yudao.module.promotion.dal.dataobject.article;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 文章分类 DO
*
* @author HUIHUI
*/
@TableName("promotion_article_category")
@KeySequence("promotion_article_category_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ArticleCategoryDO extends BaseDO {
/**
* 文章分类编号
*/
@TableId
private Long id;
/**
* 文章分类名称
*/
private String name;
/**
* 图标地址
*/
private String picUrl;
/**
* 状态
*
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
/**
* 排序
*/
private Integer sort;
}

View File

@ -0,0 +1,81 @@
package cn.iocoder.yudao.module.promotion.dal.dataobject.article;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
/**
* 文章管理 DO
*
* @author HUIHUI
*/
@TableName("promotion_article")
@KeySequence("promotion_article_seq") // 用于 OraclePostgreSQLKingbaseDB2H2 数据库的主键自增如果是 MySQL 等数据库可不写
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class ArticleDO extends BaseDO {
/**
* 文章管理编号
*/
@TableId
private Long id;
/**
* 分类编号 ArticleCategoryDO#id
*/
private Long categoryId;
/**
* 关联商品编号 ProductSpuDO#id
*/
private Long spuId;
/**
* 文章标题
*/
private String title;
/**
* 文章作者
*/
private String author;
/**
* 文章封面图片地址
*/
private String picUrl;
/**
* 文章简介
*/
private String introduction;
/**
* 浏览次数
*/
private Integer browseCount;
/**
* 排序
*/
private Integer sort;
/**
* 状态
*
* 枚举 {@link CommonStatusEnum}
*/
private Integer status;
/**
* 是否热门(小程序)
*/
private Boolean recommendHot;
/**
* 是否轮播图(小程序)
*/
private Boolean recommendBanner;
/**
* 文章内容
*/
private String content;
}

View File

@ -1,9 +1,12 @@
package cn.iocoder.yudao.module.promotion.dal.dataobject.banner;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.promotion.enums.banner.BannerPositionEnum;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
// TODO @puhui999表名改成 promotion_banner然后有序加下另外sql 给我下哈还有那个 position 字典嘿嘿
/**
* banner DO
*
@ -40,14 +43,23 @@ public class BannerDO extends BaseDO {
private Integer sort;
/**
* 状态 {@link cn.iocoder.yudao.framework.common.enums.CommonStatusEnum}
* 状态 {@link CommonStatusEnum}
*/
private Integer status;
/**
* 定位 {@link BannerPositionEnum}
*/
private Integer position;
/**
* 备注
*/
private String memo;
// TODO 芋艿 点击次数&& 其他数据相关
/**
* 点击次数
*/
private Integer browseCount;
}

View File

@ -33,7 +33,6 @@ public class DiscountActivityDO extends BaseDO {
* 活动标题
*/
private String name;
// TODO 芋艿状态调整只有开启和关闭
/**
* 状态
*

View File

@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.time.LocalDateTime;
/**
* 限时折扣商品 DO
*
@ -25,7 +27,6 @@ public class DiscountProductDO extends BaseDO {
@TableId
private Long id;
// TODO 芋艿 activity 所有的字段冗余过来
/**
* 限时折扣活动的编号
*
@ -65,4 +66,23 @@ public class DiscountProductDO extends BaseDO {
*/
private Integer discountPrice;
/**
* 活动状态
*
* 关联 {@link DiscountActivityDO#getStatus()}
*/
private Integer activityStatus;
/**
* 活动开始时间点
*
* 冗余 {@link DiscountActivityDO#getStartTime()}
*/
private LocalDateTime activityStartTime;
/**
* 活动结束时间点
*
* 冗余 {@link DiscountActivityDO#getEndTime()}
*/
private LocalDateTime activityEndTime;
}

View File

@ -38,7 +38,6 @@ public class RewardActivityDO extends BaseDO {
* 活动标题
*/
private String name;
// TODO @芋艿改成开启禁用两种状态
/**
* 状态
*

View File

@ -0,0 +1,32 @@
package cn.iocoder.yudao.module.promotion.dal.mysql.article;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 文章分类 Mapper
*
* @author HUIHUI
*/
@Mapper
public interface ArticleCategoryMapper extends BaseMapperX<ArticleCategoryDO> {
default PageResult<ArticleCategoryDO> selectPage(ArticleCategoryPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ArticleCategoryDO>()
.likeIfPresent(ArticleCategoryDO::getName, reqVO.getName())
.eqIfPresent(ArticleCategoryDO::getStatus, reqVO.getStatus())
.betweenIfPresent(ArticleCategoryDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ArticleCategoryDO::getSort));
}
default List<ArticleCategoryDO> selectListByStatus(Integer status) {
return selectList(ArticleCategoryDO::getStatus, status);
}
}

View File

@ -0,0 +1,52 @@
package cn.iocoder.yudao.module.promotion.dal.mysql.article;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 文章管理 Mapper
*
* @author HUIHUI
*/
@Mapper
public interface ArticleMapper extends BaseMapperX<ArticleDO> {
default PageResult<ArticleDO> selectPage(ArticlePageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<ArticleDO>()
.eqIfPresent(ArticleDO::getCategoryId, reqVO.getCategoryId())
.eqIfPresent(ArticleDO::getTitle, reqVO.getTitle())
.eqIfPresent(ArticleDO::getAuthor, reqVO.getAuthor())
.eqIfPresent(ArticleDO::getStatus, reqVO.getStatus())
.eqIfPresent(ArticleDO::getSpuId, reqVO.getSpuId())
.eqIfPresent(ArticleDO::getRecommendHot, reqVO.getRecommendHot())
.eqIfPresent(ArticleDO::getRecommendBanner, reqVO.getRecommendBanner())
.betweenIfPresent(ArticleDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(ArticleDO::getId));
}
default List<ArticleDO> selectList(Boolean recommendHot, Boolean recommendBanner) {
return selectList(new LambdaQueryWrapperX<ArticleDO>()
.eqIfPresent(ArticleDO::getRecommendHot, recommendHot)
.eqIfPresent(ArticleDO::getRecommendBanner, recommendBanner));
}
default PageResult<ArticleDO> selectPage(AppArticlePageReqVO pageReqVO) {
return selectPage(pageReqVO, new LambdaQueryWrapperX<ArticleDO>()
.eqIfPresent(ArticleDO::getCategoryId, pageReqVO.getCategoryId()));
}
default void updateBrowseCount(Long id) {
update(null, new LambdaUpdateWrapper<ArticleDO>()
.eq(ArticleDO::getId, id)
.setSql("browse_count = browse_count + 1"));
}
}

View File

@ -5,8 +5,11 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.banner.vo.BannerPageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.banner.BannerDO;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* Banner Mapper
*
@ -23,4 +26,14 @@ public interface BannerMapper extends BaseMapperX<BannerDO> {
.orderByDesc(BannerDO::getSort));
}
default void updateBrowseCount(Long id) {
update(null, new LambdaUpdateWrapper<BannerDO>()
.eq(BannerDO::getId, id)
.setSql("browse_count = browse_count + 1"));
}
default List<BannerDO> selectBannerListByPosition(Integer position) {
return selectList(new LambdaQueryWrapperX<BannerDO>().eq(BannerDO::getPosition, position));
}
}

View File

@ -86,7 +86,6 @@ public interface BargainActivityMapper extends BaseMapperX<BargainActivityDO> {
.last("LIMIT " + count));
}
// TODO @puhui999是不是返回 BargainActivityDO 更干净哈
/**
* 查询出指定 spuId spu 参加的活动最接近现在的一条记录多个的话一个 spuId 对应一个最近的活动编号
*
@ -102,9 +101,19 @@ public interface BargainActivityMapper extends BaseMapperX<BargainActivityDO> {
.groupBy("spu_id"));
}
default List<BargainActivityDO> selectListByIds(Collection<Long> ids) {
/**
* 获取指定活动编号的活动列表且
* 开始时间和结束时间小于给定时间 dateTime 的活动列表
*
* @param ids 活动编号
* @param dateTime 指定日期
* @return 活动列表
*/
default List<BargainActivityDO> selectListByIdsAndDateTimeLt(Collection<Long> ids, LocalDateTime dateTime) {
return selectList(new LambdaQueryWrapperX<BargainActivityDO>()
.in(BargainActivityDO::getId, ids)
.lt(BargainActivityDO::getStartTime, dateTime)
.gt(BargainActivityDO::getEndTime, dateTime)// 开始时间 < 指定时间 < 结束时间也就是说获取指定时间段的活动
.orderByDesc(BargainActivityDO::getCreateTime));
}

View File

@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -58,9 +59,19 @@ public interface CombinationActivityMapper extends BaseMapperX<CombinationActivi
.groupBy("spu_id"));
}
default List<CombinationActivityDO> selectListByIds(Collection<Long> ids) {
/**
* 获取指定活动编号的活动列表且
* 开始时间和结束时间小于给定时间 dateTime 的活动列表
*
* @param ids 活动编号
* @param dateTime 指定日期
* @return 活动列表
*/
default List<CombinationActivityDO> selectListByIdsAndDateTimeLt(Collection<Long> ids, LocalDateTime dateTime) {
return selectList(new LambdaQueryWrapperX<CombinationActivityDO>()
.in(CombinationActivityDO::getId, ids)
.lt(CombinationActivityDO::getStartTime, dateTime)
.gt(CombinationActivityDO::getEndTime, dateTime)// 开始时间 < 指定时间 < 结束时间也就是说获取指定时间段的活动
.orderByDesc(CombinationActivityDO::getCreateTime));
}

View File

@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPage2VO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@ -97,21 +96,19 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO
}
default PageResult<CombinationRecordDO> selectPage(CombinationRecordReqPageVO pageVO) {
return selectPage(pageVO, new LambdaQueryWrapperX<CombinationRecordDO>()
LambdaQueryWrapperX<CombinationRecordDO> queryWrapper = new LambdaQueryWrapperX<CombinationRecordDO>()
.eqIfPresent(CombinationRecordDO::getStatus, pageVO.getStatus())
.betweenIfPresent(CombinationRecordDO::getCreateTime, pageVO.getCreateTime()));
}
default PageResult<CombinationRecordDO> selectPage(CombinationRecordReqPage2VO pageVO) {
return selectPage(pageVO, new LambdaQueryWrapperX<CombinationRecordDO>()
.eq(CombinationRecordDO::getId, pageVO.getHeadId())
.or()
.eq(CombinationRecordDO::getHeadId, pageVO.getHeadId()));
.betweenIfPresent(CombinationRecordDO::getCreateTime, pageVO.getCreateTime());
// 如果 headId 非空说明查询指定团的团长 + 团员的拼团记录
if (pageVO.getHeadId() != null) {
queryWrapper.eq(CombinationRecordDO::getId, pageVO.getHeadId()) // 团长
.or().eq(CombinationRecordDO::getHeadId, pageVO.getHeadId()); // 团员
}
return selectPage(pageVO, queryWrapper);
}
/**
* 查询指定条件的记录数
* 如果参数都为 null 时则查询用户拼团记录DISTINCT 去重也就是说查询会员表中的用户有多少人参与过拼团活动每个人只统计一次
*
* @param status 状态可为 null
* @param virtualGroup 是否虚拟成团可为 null
@ -119,13 +116,20 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO
* @return 记录数
*/
default Long selectCountByHeadAndStatusAndVirtualGroup(Integer status, Boolean virtualGroup, Long headId) {
return selectCount(new LambdaQueryWrapperX<CombinationRecordDO>()
.eqIfPresent(CombinationRecordDO::getStatus, status)
.eqIfPresent(CombinationRecordDO::getVirtualGroup, virtualGroup)
.eqIfPresent(CombinationRecordDO::getHeadId, headId));
}
/**
* 查询用户拼团记录DISTINCT 去重也就是说查询会员表中的用户有多少人参与过拼团活动每个人只统计一次
*
* @return 参加过拼团的用户数
*/
default Long selectUserCount() {
return selectCount(new QueryWrapper<CombinationRecordDO>()
// TODO @puhui999这种偏逻辑性的不要给 mapper 可以考虑拆成 2 mapper上层也是 2 service
.select(status == null && virtualGroup == null && headId == null, "DISTINCT (user_id)")
.eq(status != null, "status", status)
.eq(virtualGroup != null, "virtual_group", virtualGroup)
.eq(headId != null, "head_id", headId)
.groupBy("user_id"));
.select("DISTINCT (user_id)"));
}
default List<CombinationRecordDO> selectListByHeadIdAndStatusAndExpireTimeLt(Long headId, Integer status, LocalDateTime dateTime) {
@ -135,8 +139,8 @@ public interface CombinationRecordMapper extends BaseMapperX<CombinationRecordDO
.lt(CombinationRecordDO::getExpireTime, dateTime));
}
default List<CombinationRecordDO> selectListByHeadIds(Collection<Long> headIds) {
return selectList(new LambdaQueryWrapperX<CombinationRecordDO>().in(CombinationRecordDO::getHeadId, headIds));
default List<CombinationRecordDO> selectListByHeadId(Long headId) {
return selectList(CombinationRecordDO::getHeadId, headId);
}
}

View File

@ -8,10 +8,11 @@ import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.template.CouponTemplatePageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.function.Consumer;
@ -39,7 +40,11 @@ public interface CouponTemplateMapper extends BaseMapperX<CouponTemplateDO> {
.orderByDesc(CouponTemplateDO::getId));
}
void updateTakeCount(@Param("id") Long id, @Param("incrCount") Integer incrCount);
default void updateTakeCount(Long id, Integer incrCount) {
update(null, new LambdaUpdateWrapper<CouponTemplateDO>()
.eq(CouponTemplateDO::getId, id)
.setSql("take_count = take_count + " + incrCount));
}
default List<CouponTemplateDO> selectListByTakeType(Integer takeType) {
return selectList(CouponTemplateDO::getTakeType, takeType);
@ -70,4 +75,8 @@ public interface CouponTemplateMapper extends BaseMapperX<CouponTemplateDO> {
return canTakeConsumer;
}
default List<CouponTemplateDO> selectListByIds(Collection<Long> ids) {
return selectList(new LambdaQueryWrapperX<CouponTemplateDO>().in(CouponTemplateDO::getId, ids));
}
}

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.promotion.dal.mysql.discount;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.promotion.dal.dataobject.discount.DiscountProductDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
@ -23,4 +24,10 @@ public interface DiscountProductMapper extends BaseMapperX<DiscountProductDO> {
return selectList(DiscountProductDO::getActivityId, activityId);
}
default List<DiscountProductDO> selectListByActivityId(Collection<Long> activityIds) {
return selectList(DiscountProductDO::getActivityId, activityIds);
}
// TODO @zhangshuai逻辑里尽量避免写 join 语句哈你可以看看这个查询有什么办法优化目前的一个思路是分 2 次查询性能也是 ok
List<DiscountProductDO> getMatchDiscountProductList(@Param("skuIds") Collection<Long> skuIds);
}

View File

@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -90,9 +91,19 @@ public interface SeckillActivityMapper extends BaseMapperX<SeckillActivityDO> {
.groupBy("spu_id"));
}
default List<SeckillActivityDO> selectListByIds(Collection<Long> ids) {
/**
* 获取指定活动编号的活动列表且
* 开始时间和结束时间小于给定时间 dateTime 的活动列表
*
* @param ids 活动编号
* @param dateTime 指定日期
* @return 活动列表
*/
default List<SeckillActivityDO> selectListByIdsAndDateTimeLt(Collection<Long> ids, LocalDateTime dateTime) {
return selectList(new LambdaQueryWrapperX<SeckillActivityDO>()
.in(SeckillActivityDO::getId, ids)
.lt(SeckillActivityDO::getStartTime, dateTime)
.gt(SeckillActivityDO::getEndTime, dateTime)// 开始时间 < 指定时间 < 结束时间也就是说获取指定时间段的活动
.orderByDesc(SeckillActivityDO::getCreateTime));
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.module.promotion.service.article;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO;
import javax.validation.Valid;
import java.util.List;
/**
* 文章分类 Service 接口
*
* @author HUIHUI
*/
public interface ArticleCategoryService {
/**
* 创建文章分类
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createArticleCategory(@Valid ArticleCategoryCreateReqVO createReqVO);
/**
* 更新文章分类
*
* @param updateReqVO 更新信息
*/
void updateArticleCategory(@Valid ArticleCategoryUpdateReqVO updateReqVO);
/**
* 删除文章分类
*
* @param id 编号
*/
void deleteArticleCategory(Long id);
/**
* 获得文章分类
*
* @param id 编号
* @return 文章分类
*/
ArticleCategoryDO getArticleCategory(Long id);
/**
* 获得文章分类分页
*
* @param pageReqVO 分页查询
* @return 文章分类分页
*/
PageResult<ArticleCategoryDO> getArticleCategoryPage(ArticleCategoryPageReqVO pageReqVO);
/**
* 获得指定状态的文章分类列表
*
* @param status 状态
* @return 文章分类列表
*/
List<ArticleCategoryDO> getArticleCategoryListByStatus(Integer status);
}

View File

@ -0,0 +1,90 @@
package cn.iocoder.yudao.module.promotion.service.article;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryPageReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.category.ArticleCategoryUpdateReqVO;
import cn.iocoder.yudao.module.promotion.convert.article.ArticleCategoryConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO;
import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleCategoryMapper;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_DELETE_FAIL_HAVE_ARTICLES;
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_NOT_EXISTS;
/**
* 文章分类 Service 实现类
*
* @author HUIHUI
*/
@Service
@Validated
public class ArticleCategoryServiceImpl implements ArticleCategoryService {
@Resource
private ArticleCategoryMapper articleCategoryMapper;
@Resource
@Lazy // 延迟加载解决循环依赖问题
private ArticleService articleService;
@Override
public Long createArticleCategory(ArticleCategoryCreateReqVO createReqVO) {
// 插入
ArticleCategoryDO category = ArticleCategoryConvert.INSTANCE.convert(createReqVO);
articleCategoryMapper.insert(category);
// 返回
return category.getId();
}
@Override
public void updateArticleCategory(ArticleCategoryUpdateReqVO updateReqVO) {
// 校验存在
validateArticleCategoryExists(updateReqVO.getId());
// 更新
ArticleCategoryDO updateObj = ArticleCategoryConvert.INSTANCE.convert(updateReqVO);
articleCategoryMapper.updateById(updateObj);
}
@Override
public void deleteArticleCategory(Long id) {
// 校验存在
validateArticleCategoryExists(id);
// 校验是不是存在关联文章
Long count = articleService.getArticleCountByCategoryId(id);
if (count > 0) {
throw exception(ARTICLE_CATEGORY_DELETE_FAIL_HAVE_ARTICLES);
}
// 删除
articleCategoryMapper.deleteById(id);
}
private void validateArticleCategoryExists(Long id) {
if (articleCategoryMapper.selectById(id) == null) {
throw exception(ARTICLE_CATEGORY_NOT_EXISTS);
}
}
@Override
public ArticleCategoryDO getArticleCategory(Long id) {
return articleCategoryMapper.selectById(id);
}
@Override
public PageResult<ArticleCategoryDO> getArticleCategoryPage(ArticleCategoryPageReqVO pageReqVO) {
return articleCategoryMapper.selectPage(pageReqVO);
}
@Override
public List<ArticleCategoryDO> getArticleCategoryListByStatus(Integer status) {
return articleCategoryMapper.selectListByStatus(status);
}
}

View File

@ -0,0 +1,98 @@
package cn.iocoder.yudao.module.promotion.service.article;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
import javax.validation.Valid;
import java.util.List;
/**
* 文章详情 Service 接口
*
* @author HUIHUI
*/
public interface ArticleService {
/**
* 创建文章详情
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createArticle(@Valid ArticleCreateReqVO createReqVO);
/**
* 更新文章详情
*
* @param updateReqVO 更新信息
*/
void updateArticle(@Valid ArticleUpdateReqVO updateReqVO);
/**
* 删除文章详情
*
* @param id 编号
*/
void deleteArticle(Long id);
/**
* 获得文章详情
*
* @param id 编号
* @return 文章详情
*/
ArticleDO getArticle(Long id);
/**
* 获得文章详情分页
*
* @param pageReqVO 分页查询
* @return 文章详情分页
*/
PageResult<ArticleDO> getArticlePage(ArticlePageReqVO pageReqVO);
/**
* 获得文章详情列表
*
* @param recommendHot 是否热门
* @param recommendBanner 是否轮播图
* @return 文章详情列表
*/
List<ArticleDO> getArticleCategoryListByRecommend(Boolean recommendHot, Boolean recommendBanner);
/**
* 获得文章详情分页
*
* @param pageReqVO 分页查询
* @return 文章详情分页
*/
PageResult<ArticleDO> getArticlePage(AppArticlePageReqVO pageReqVO);
/**
* 获得指定分类的文章列表
*
* @param categoryId 文章分类编号
* @return 文章列表
*/
List<ArticleDO> getArticleByCategoryId(Long categoryId);
/**
* 获得指定分类的文章数量
*
* @param categoryId 文章分类编号
* @return 文章数量
*/
Long getArticleCountByCategoryId(Long categoryId);
/**
* 增加文章浏览量
*
* @param id 文章编号
*/
void addArticleBrowseCount(Long id);
}

View File

@ -0,0 +1,121 @@
package cn.iocoder.yudao.module.promotion.service.article;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticlePageReqVO;
import cn.iocoder.yudao.module.promotion.controller.admin.article.vo.article.ArticleUpdateReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.article.vo.article.AppArticlePageReqVO;
import cn.iocoder.yudao.module.promotion.convert.article.ArticleConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleCategoryDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.article.ArticleDO;
import cn.iocoder.yudao.module.promotion.dal.mysql.article.ArticleMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_CATEGORY_NOT_EXISTS;
import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.ARTICLE_NOT_EXISTS;
/**
* 文章管理 Service 实现类
*
* @author HUIHUI
*/
@Service
@Validated
public class ArticleServiceImpl implements ArticleService {
@Resource
private ArticleMapper articleMapper;
@Resource
private ArticleCategoryService articleCategoryService;
@Override
public Long createArticle(ArticleCreateReqVO createReqVO) {
// 校验分类存在
validateArticleCategoryExists(createReqVO.getCategoryId());
// 插入
ArticleDO article = ArticleConvert.INSTANCE.convert(createReqVO);
article.setBrowseCount(0); // 初始浏览量
articleMapper.insert(article);
// 返回
return article.getId();
}
@Override
public void updateArticle(ArticleUpdateReqVO updateReqVO) {
// 校验存在
validateArticleExists(updateReqVO.getId());
// 校验分类存在
validateArticleCategoryExists(updateReqVO.getCategoryId());
// 更新
ArticleDO updateObj = ArticleConvert.INSTANCE.convert(updateReqVO);
articleMapper.updateById(updateObj);
}
@Override
public void deleteArticle(Long id) {
// 校验存在
validateArticleExists(id);
// 删除
articleMapper.deleteById(id);
}
private void validateArticleExists(Long id) {
if (articleMapper.selectById(id) == null) {
throw exception(ARTICLE_NOT_EXISTS);
}
}
private void validateArticleCategoryExists(Long categoryId) {
ArticleCategoryDO articleCategory = articleCategoryService.getArticleCategory(categoryId);
if (articleCategory == null) {
throw exception(ARTICLE_CATEGORY_NOT_EXISTS);
}
}
@Override
public ArticleDO getArticle(Long id) {
return articleMapper.selectById(id);
}
@Override
public PageResult<ArticleDO> getArticlePage(ArticlePageReqVO pageReqVO) {
return articleMapper.selectPage(pageReqVO);
}
@Override
public List<ArticleDO> getArticleCategoryListByRecommend(Boolean recommendHot, Boolean recommendBanner) {
return articleMapper.selectList(recommendHot, recommendBanner);
}
@Override
public PageResult<ArticleDO> getArticlePage(AppArticlePageReqVO pageReqVO) {
return articleMapper.selectPage(pageReqVO);
}
@Override
public List<ArticleDO> getArticleByCategoryId(Long categoryId) {
return articleMapper.selectList(ArticleDO::getCategoryId, categoryId);
}
@Override
public Long getArticleCountByCategoryId(Long categoryId) {
return articleMapper.selectCount(ArticleDO::getCategoryId, categoryId);
}
@Override
public void addArticleBrowseCount(Long id) {
// 校验文章是否存在
validateArticleExists(id);
// 增加浏览次数
articleMapper.updateBrowseCount(id);
}
}

View File

@ -46,12 +46,6 @@ public interface BannerService {
*/
BannerDO getBanner(Long id);
/**
* 获得所有 Banner列表
* @return Banner列表
*/
List<BannerDO> getBannerList();
/**
* 获得 Banner 分页
*
@ -60,4 +54,19 @@ public interface BannerService {
*/
PageResult<BannerDO> getBannerPage(BannerPageReqVO pageReqVO);
/**
* 增加 Banner 点击量
*
* @param id Banner编号
*/
void addBannerBrowseCount(Long id);
/**
* 获得 Banner 列表
*
* @param position 定位
* @return Banner 列表
*/
List<BannerDO> getBannerListByPosition(Integer position);
}

View File

@ -65,14 +65,22 @@ public class BannerServiceImpl implements BannerService {
return bannerMapper.selectById(id);
}
@Override
public List<BannerDO> getBannerList() {
return bannerMapper.selectList();
}
@Override
public PageResult<BannerDO> getBannerPage(BannerPageReqVO pageReqVO) {
return bannerMapper.selectPage(pageReqVO);
}
@Override
public void addBannerBrowseCount(Long id) {
// 校验 Banner 是否存在
validateBannerExists(id);
// 增加点击次数
bannerMapper.updateBrowseCount(id);
}
@Override
public List<BannerDO> getBannerListByPosition(Integer position) {
return bannerMapper.selectBannerListByPosition(position);
}
}

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity.Ba
import cn.iocoder.yudao.module.promotion.dal.dataobject.bargain.BargainActivityDO;
import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;
import java.util.Set;
@ -102,10 +103,11 @@ public interface BargainActivityService {
/**
* 获取指定 spu 编号最近参加的活动每个 spuId 只返回一条记录
*
* @param spuIds spu 编号
* @param status 状态
* @param spuIds spu 编号
* @param status 状态
* @param dateTime 日期时间
* @return 砍价活动列表
*/
List<BargainActivityDO> getBargainActivityBySpuIdsAndStatus(Collection<Long> spuIds, Integer status);
List<BargainActivityDO> getBargainActivityBySpuIdsAndStatusAndDateTimeLt(Collection<Long> spuIds, Integer status, LocalDateTime dateTime);
}

View File

@ -182,15 +182,15 @@ public class BargainActivityServiceImpl implements BargainActivityService {
}
@Override
public List<BargainActivityDO> getBargainActivityBySpuIdsAndStatus(Collection<Long> spuIds, Integer status) {
public List<BargainActivityDO> getBargainActivityBySpuIdsAndStatusAndDateTimeLt(Collection<Long> spuIds, Integer status, LocalDateTime dateTime) {
// 1. 查询出指定 spuId spu 参加的活动最接近现在的一条记录多个的话一个 spuId 对应一个最近的活动编号
// TODO @puhui999我想了下这种是不是只展示当前正在进行中的已经结束或者未开始的可能没啥意义
List<Map<String, Object>> spuIdAndActivityIdMaps = bargainActivityMapper.selectSpuIdAndActivityIdMapsBySpuIdsAndStatus(spuIds, status);
if (CollUtil.isEmpty(spuIdAndActivityIdMaps)) {
return Collections.emptyList();
}
// 2. 查询活动详情
return bargainActivityMapper.selectListByIds(convertSet(spuIdAndActivityIdMaps, map -> MapUtil.getLong(map, "activityId")));
return bargainActivityMapper.selectListByIdsAndDateTimeLt(
convertSet(spuIdAndActivityIdMaps, map -> MapUtil.getLong(map, "activityId")), dateTime);
}
}

View File

@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationA
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO;
import javax.validation.Valid;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@ -35,6 +36,8 @@ public interface CombinationActivityService {
*/
void updateCombinationActivity(@Valid CombinationActivityUpdateReqVO updateReqVO);
// TODO @puhui999这里少了一个关闭活动的接口因为关闭的活动才可以删除
/**
* 删除拼团活动
*
@ -120,10 +123,11 @@ public interface CombinationActivityService {
/**
* 获取指定 spu 编号最近参加的活动每个 spuId 只返回一条记录
*
* @param spuIds spu 编号
* @param status 状态
* @param spuIds spu 编号
* @param status 状态
* @param dateTime 日期时间
* @return 拼团活动列表
*/
List<CombinationActivityDO> getCombinationActivityBySpuIdsAndStatus(Collection<Long> spuIds, Integer status);
List<CombinationActivityDO> getCombinationActivityBySpuIdsAndStatusAndDateTimeLt(Collection<Long> spuIds, Integer status, LocalDateTime dateTime);
}

View File

@ -25,6 +25,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@ -228,14 +229,15 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic
}
@Override
public List<CombinationActivityDO> getCombinationActivityBySpuIdsAndStatus(Collection<Long> spuIds, Integer status) {
public List<CombinationActivityDO> getCombinationActivityBySpuIdsAndStatusAndDateTimeLt(Collection<Long> spuIds, Integer status, LocalDateTime dateTime) {
// 1.查询出指定 spuId spu 参加的活动最接近现在的一条记录多个的话一个 spuId 对应一个最近的活动编号
List<Map<String, Object>> spuIdAndActivityIdMaps = combinationActivityMapper.selectSpuIdAndActivityIdMapsBySpuIdsAndStatus(spuIds, status);
if (CollUtil.isEmpty(spuIdAndActivityIdMaps)) {
return Collections.emptyList();
}
// 2.查询活动详情
return combinationActivityMapper.selectListByIds(convertSet(spuIdAndActivityIdMaps, map -> MapUtil.getLong(map, "activityId")));
return combinationActivityMapper.selectListByIdsAndDateTimeLt(
convertSet(spuIdAndActivityIdMaps, map -> MapUtil.getLong(map, "activityId")), dateTime);
}
}

View File

@ -4,7 +4,6 @@ import cn.iocoder.yudao.framework.common.core.KeyValue;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPage2VO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO;
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO;
@ -50,9 +49,9 @@ public interface CombinationRecordService {
* 创建拼团记录
*
* @param reqDTO 创建信息
* @return key 开团记录编号 value 团长编号
* @return 团信息
*/
KeyValue<Long, Long> createCombinationRecord(CombinationRecordCreateReqDTO reqDTO);
CombinationRecordDO createCombinationRecord(CombinationRecordCreateReqDTO reqDTO);
/**
* 获得拼团记录
@ -94,7 +93,14 @@ public interface CombinationRecordService {
* @param headId 团长编号允许空目的 headId 设置为 {@link CombinationRecordDO#HEAD_ID_GROUP} 可以设置
* @return 记录数
*/
Long getCombinationRecordCount(@Nullable Integer status, @Nullable Boolean virtualGroup, @Nullable Long headId);
Long getCombinationRecordCount(@Nullable Integer status, @Nullable Boolean virtualGroup, Long headId);
/**
* 查询用户拼团记录DISTINCT 去重也就是说查询会员表中的用户有多少人参与过拼团活动每个人只统计一次
*
* @return 参加过拼团的用户数
*/
Long getCombinationUserCount();
/**
* 获取最近的 count 条拼团记录
@ -138,14 +144,6 @@ public interface CombinationRecordService {
*/
PageResult<CombinationRecordDO> getCombinationRecordPage(CombinationRecordReqPageVO pageVO);
/**
* 获取拼团记录分页数据通过团长查询
*
* @param pageVO 分页请求
* @return 拼团记录分页数据包括团长的
*/
PageResult<CombinationRecordDO> getCombinationRecordPage2(CombinationRecordReqPage2VO pageVO);
/**
* 拼团活动获得拼团记录数量 Map
*

View File

@ -6,6 +6,7 @@ import cn.hutool.extra.spring.SpringUtil;
import cn.iocoder.yudao.framework.common.core.KeyValue;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi;
@ -14,7 +15,6 @@ import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi;
import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationRecordCreateReqDTO;
import cn.iocoder.yudao.module.promotion.api.combination.dto.CombinationValidateJoinRespDTO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPage2VO;
import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.recrod.CombinationRecordReqPageVO;
import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert;
import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO;
@ -23,7 +23,7 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationR
import cn.iocoder.yudao.module.promotion.dal.mysql.combination.CombinationRecordMapper;
import cn.iocoder.yudao.module.promotion.enums.combination.CombinationRecordStatusEnum;
import cn.iocoder.yudao.module.trade.api.order.TradeOrderApi;
import org.springframework.scheduling.annotation.Async;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
@ -47,6 +47,7 @@ import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.*;
* @author HUIHUI
*/
@Service
@Slf4j
@Validated
public class CombinationRecordServiceImpl implements CombinationRecordService {
@ -72,9 +73,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
CombinationRecordDO record = validateCombinationRecord(userId, orderId);
// 更新状态
// TODO @puhui999不要整个更新new 一个出来why例如说两个线程都去更新这样存在相互覆盖的问题
record.setStatus(status);
combinationRecordMapper.updateById(record);
combinationRecordMapper.updateById(new CombinationRecordDO().setId(record.getId()).setStatus(status));
}
private CombinationRecordDO validateCombinationRecord(Long userId, Long orderId) {
@ -164,7 +163,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
@Override
@Transactional(rollbackFor = Exception.class)
public KeyValue<Long, Long> createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) {
public CombinationRecordDO createCombinationRecord(CombinationRecordCreateReqDTO reqDTO) {
// 1. 校验拼团活动
KeyValue<CombinationActivityDO, CombinationProductDO> keyValue = validateCombinationRecord(reqDTO.getUserId(),
reqDTO.getActivityId(), reqDTO.getHeadId(), reqDTO.getSkuId(), reqDTO.getCount());
@ -191,7 +190,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
if (ObjUtil.notEqual(CombinationRecordDO.HEAD_ID_GROUP, record.getHeadId())) {
updateCombinationRecordWhenCreate(reqDTO.getHeadId(), keyValue.getKey());
}
return new KeyValue<>(record.getId(), record.getHeadId());
return record;
}
/**
@ -249,6 +248,11 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
return combinationRecordMapper.selectCountByHeadAndStatusAndVirtualGroup(status, virtualGroup, headId);
}
@Override
public Long getCombinationUserCount() {
return combinationRecordMapper.selectUserCount();
}
@Override
public List<CombinationRecordDO> getLatestCombinationRecordList(int count) {
return combinationRecordMapper.selectLatestList(count);
@ -275,11 +279,6 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
return combinationRecordMapper.selectPage(pageVO);
}
@Override
public PageResult<CombinationRecordDO> getCombinationRecordPage2(CombinationRecordReqPage2VO pageVO) {
return combinationRecordMapper.selectPage(pageVO);
}
@Override
public Map<Long, Integer> getCombinationRecordCountMapByActivity(Collection<Long> activityIds,
@Nullable Integer status, @Nullable Long headId) {
@ -343,8 +342,7 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
@Override
public KeyValue<Integer, Integer> expireCombinationRecord() {
// TODO @puhui999数字一般是 1. 2. 这种格式哈
// 1获取所有正在进行中的过期的父拼团
// 1. 获取所有正在进行中的过期的父拼团
List<CombinationRecordDO> headExpireRecords = combinationRecordMapper.selectListByHeadIdAndStatusAndExpireTimeLt(
CombinationRecordDO.HEAD_ID_GROUP, CombinationRecordStatusEnum.IN_PROGRESS.getStatus(), LocalDateTime.now());
if (CollUtil.isEmpty(headExpireRecords)) {
@ -352,91 +350,84 @@ public class CombinationRecordServiceImpl implements CombinationRecordService {
}
// 2. 获取拼团活动
// TODO @puhui999在自己模块里变量可以简略点例如说 activityList
List<CombinationActivityDO> combinationActivities = combinationActivityService.getCombinationActivityListByIds(
List<CombinationActivityDO> activities = combinationActivityService.getCombinationActivityListByIds(
convertSet(headExpireRecords, CombinationRecordDO::getActivityId));
Map<Long, CombinationActivityDO> activityMap = convertMap(combinationActivities, CombinationActivityDO::getId);
Map<Long, CombinationActivityDO> activityMap = convertMap(activities, CombinationActivityDO::getId);
// TODO @puhui999job 一般不建议异步跑因为可能下次跑结果上次还没跑完
// TODO 这里我们可以每个 record 处理下然后按照是否需要虚拟拼团各搞一个方法逻辑 + 事务这样保证 job 里面尽量不要大事务而是 n 个独立小事务的处理
// 3. 校验是否虚拟成团
List<CombinationRecordDO> virtualGroupHeadRecords = new ArrayList<>(); // 虚拟成团
for (Iterator<CombinationRecordDO> iterator = headExpireRecords.iterator(); iterator.hasNext(); ) {
CombinationRecordDO record = iterator.next();
// 3.1 不匹配则直接跳过
CombinationActivityDO activity = activityMap.get(record.getActivityId());
if (activity == null || !activity.getVirtualGroup()) { // 取不到活动的或者不是虚拟拼团的
continue;
// 3. 逐个处理拼团过期 or 虚拟成团
KeyValue<Integer, Integer> keyValue = new KeyValue<>(0, 0); // 统计过期拼团和虚拟成团
for (CombinationRecordDO record : headExpireRecords) {
try {
CombinationActivityDO activity = activityMap.get(record.getActivityId());
if (activity == null || !activity.getVirtualGroup()) { // 取不到活动的或者不是虚拟拼团的
// 3.1. 处理过期的拼团
getSelf().handleExpireRecord(record);
keyValue.setKey(keyValue.getKey() + 1);
} else {
// 3.2. 处理虚拟成团
getSelf().handleVirtualGroupRecord(record);
keyValue.setValue(keyValue.getValue() + 1);
}
} catch (Exception ignored) { // 处理异常继续循环
log.error("[expireCombinationRecord][record({}) 处理异常请进行处理record 数据是:{}]",
record.getId(), JsonUtils.toJsonString(record));
}
// 3.2 匹配则移除添加到虚拟成团中并结束寻找
virtualGroupHeadRecords.add(record);
iterator.remove();
break;
}
// 4.处理过期的拼团
getSelf().handleExpireRecord(headExpireRecords);
// 5.虚拟成团
getSelf().handleVirtualGroupRecord(virtualGroupHeadRecords);
return new KeyValue<>(headExpireRecords.size(), virtualGroupHeadRecords.size());
return keyValue;
}
@Async
protected void handleExpireRecord(List<CombinationRecordDO> headExpireRecords) {
if (CollUtil.isEmpty(headExpireRecords)) {
return;
}
// 1.更新拼团记录
List<CombinationRecordDO> headsAndRecords = updateBatchCombinationRecords(headExpireRecords,
/**
* 处理过期拼团
*
* @param headRecord 过期拼团团长记录
*/
@Transactional(rollbackFor = Exception.class)
public void handleExpireRecord(CombinationRecordDO headRecord) {
// 1. 更新拼团记录
List<CombinationRecordDO> headAndRecords = updateBatchCombinationRecords(headRecord,
CombinationRecordStatusEnum.FAILED);
if (headsAndRecords == null) {
return;
}
// 2.订单取消 TODO 以现在的取消回滚逻辑好像只能循环了
headsAndRecords.forEach(item -> {
tradeOrderApi.cancelPaidOrder(item.getUserId(), item.getOrderId());
});
// 2. 订单取消
headAndRecords.forEach(item -> tradeOrderApi.cancelPaidOrder(item.getUserId(), item.getOrderId()));
}
@Async
protected void handleVirtualGroupRecord(List<CombinationRecordDO> virtualGroupHeadRecords) {
if (CollUtil.isEmpty(virtualGroupHeadRecords)) {
return;
}
/**
* 处理虚拟拼团
*
* @param headRecord 虚拟成团团长记录
*/
@Transactional(rollbackFor = Exception.class)
public void handleVirtualGroupRecord(CombinationRecordDO headRecord) {
// 1. 团员补齐
combinationRecordMapper.insertBatch(CombinationActivityConvert.INSTANCE.convertVirtualGroupList(virtualGroupHeadRecords));
combinationRecordMapper.insertBatch(CombinationActivityConvert.INSTANCE.convertVirtualRecordList(headRecord));
// 2. 更新拼团记录
updateBatchCombinationRecords(virtualGroupHeadRecords, CombinationRecordStatusEnum.SUCCESS);
updateBatchCombinationRecords(headRecord, CombinationRecordStatusEnum.SUCCESS);
}
private List<CombinationRecordDO> updateBatchCombinationRecords(List<CombinationRecordDO> headRecords, CombinationRecordStatusEnum status) {
// 1. 查询团成员
List<CombinationRecordDO> records = combinationRecordMapper.selectListByHeadIds(
convertSet(headRecords, CombinationRecordDO::getId));
if (CollUtil.isEmpty(records)) {
return null;
}
Map<Long, List<CombinationRecordDO>> recordsMap = convertMultiMap(records, CombinationRecordDO::getHeadId);
headRecords.forEach(item -> {
recordsMap.get(item.getId()).add(item); // 把团长加进团里
});
// 2.批量更新拼团记录 status 失败/成团时间
List<CombinationRecordDO> headsAndRecords = mergeValuesFromMap(recordsMap);
List<CombinationRecordDO> updateRecords = new ArrayList<>(headsAndRecords.size());
/**
* 更新拼团记录
*
* @param headRecord 团长记录
* @param status 状态-拼团失败 FAILED 成功 SUCCESS
* @return 整团记录包含团长和团成员
*/
private List<CombinationRecordDO> updateBatchCombinationRecords(CombinationRecordDO headRecord, CombinationRecordStatusEnum status) {
// 1. 查询团成员包含团长
List<CombinationRecordDO> records = combinationRecordMapper.selectListByHeadId(headRecord.getId());
records.add(headRecord);// 把团长加进去
// 2. 批量更新拼团记录 status endTime
List<CombinationRecordDO> updateRecords = new ArrayList<>(records.size());
LocalDateTime now = LocalDateTime.now();
headsAndRecords.forEach(item -> {
CombinationRecordDO record = new CombinationRecordDO().setId(item.getId())
records.forEach(item -> {
CombinationRecordDO updateRecord = new CombinationRecordDO().setId(item.getId())
.setStatus(status.getStatus()).setEndTime(now);
if (CombinationRecordStatusEnum.isSuccess(status.getStatus())) { // 虚拟成团完事更改状态成功后还需要把参与人数修改为成团需要人数
record.setUserCount(record.getUserSize());
updateRecord.setUserCount(updateRecord.getUserSize());
}
updateRecords.add(record);
updateRecords.add(updateRecord);
});
combinationRecordMapper.updateBatch(updateRecords);
return headsAndRecords;
return records;
}
/**

View File

@ -8,6 +8,7 @@ import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponTemplateDO;
import cn.iocoder.yudao.module.promotion.enums.coupon.CouponTakeTypeEnum;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
@ -91,4 +92,12 @@ public interface CouponTemplateService {
List<CouponTemplateDO> getCouponTemplateList(List<Integer> canTakeTypes, Integer productScope,
Long productScopeValue, Integer count);
/**
* 获得优惠券模版列表
*
* @param ids 优惠券模版编号
* @return 优惠券模版列表
*/
List<CouponTemplateDO> getCouponTemplateListByIds(Collection<Long> ids);
}

Some files were not shown because too many files have changed in this diff Show More