出事提交

This commit is contained in:
wzgaoyn 2025-03-18 17:23:25 +08:00
commit aacfffbbc1
1927 changed files with 252066 additions and 0 deletions

3
db/2023-08-23.sql Normal file
View File

@ -0,0 +1,3 @@
USE mall4cloud_job;
insert into `xxl_job_info` (`job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`, `trigger_status`, `trigger_last_time`, `trigger_next_time`)
values(11,'解锁sku库存','2023-08-18 14:30:19','2023-08-23 11:03:25','admin','','CRON','0 5 0 * * ?','DO_NOTHING','FIRST','unLockOrderSkuStock','','SERIAL_EXECUTION','0','0','BEAN','','GLUE代码初始化','2023-08-18 14:30:19','','1','0','1692806700000');

View File

@ -0,0 +1,96 @@
#电子面单新建表
USE `mall4cloud_order`;
/*Table structure for table `outlet_config` */
DROP TABLE IF EXISTS `outlet_config`;
CREATE TABLE `outlet_config` (
`outlet_config_id` bigint NOT NULL AUTO_INCREMENT COMMENT '网点配置id',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`shop_id` bigint DEFAULT NULL COMMENT '店铺id',
`supplier_id` bigint DEFAULT NULL COMMENT '供应商id',
`delivery_company_type` tinyint NOT NULL COMMENT '快递公司类型',
`shop_addr_id` bigint DEFAULT NULL COMMENT '发货地址id',
`shipper` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '发货人',
`mobile` varchar(20) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '发货人电话',
`partner_id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电子面单客户账户或月结账号',
`partner_key` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '电子面单密码',
`net` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '收件网点名称',
`paper_size` tinyint DEFAULT '1' COMMENT '纸张规格 1.一联面单 2.二联面单',
`is_default` tinyint NOT NULL DEFAULT '0' COMMENT '是否默认 0否1是',
PRIMARY KEY (`outlet_config_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='网点配置';
/*Table structure for table `printer` */
DROP TABLE IF EXISTS `printer`;
CREATE TABLE `printer` (
`printer_id` bigint NOT NULL AUTO_INCREMENT COMMENT '打印机id',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`shop_id` bigint DEFAULT NULL COMMENT '店铺id',
`supplier_id` bigint DEFAULT NULL COMMENT '供应商id',
`printer_name` varchar(50) COLLATE utf8mb4_general_ci NOT NULL COMMENT '打印机名称',
`siid` varchar(50) COLLATE utf8mb4_general_ci NOT NULL COMMENT '设备码',
`printer_remark` varchar(50) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '打印机备注',
`is_default` tinyint DEFAULT '0' COMMENT '是否默认 0否1是',
PRIMARY KEY (`printer_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='打印机';
USE mall4cloud_admin;
# 快递100增加secret, isPrint, printReqUrl配置
UPDATE sys_config SET param_value = REPLACE(param_value,'","key":','","secret":"","isPrint":false,"mock":false,"printReqUrl":"https://api.kuaidi100.com/label/order","key":')
WHERE param_key = 'QUICK100_CONFIG';
USE mall4cloud_auth;
-- 菜单SQL
# 371为商家端系统菜单id
insert into `menu`(`menu_id`,`create_time`,`update_time`,`parent_id`,`biz_type`,`permission`,`path`,`component`,`redirect`,`always_show`,`hidden`,`name`,`title`,`icon`,`no_cache`,`breadcrumb`,`affix`,`active_menu`,`seq`) values
(647,'2023-08-28 14:36:57','2023-08-28 14:36:57',371,1,NULL,'/system/delivery-manager','system/delivery-manager',NULL,NULL,0,'发货管理','发货管理','',NULL,NULL,NULL,NULL,4),
(648,'2023-08-28 14:37:51','2023-08-28 14:37:51',647,1,NULL,'outlet-config/index','system/delivery-manager/outlet-config/index',NULL,NULL,0,'网点管理','网点管理','',NULL,NULL,NULL,NULL,0),
(649,'2023-08-28 14:38:33','2023-08-28 14:38:33',647,1,NULL,'printer/index','system/delivery-manager/printer/index',NULL,NULL,0,'硬件设备','硬件设备','',NULL,NULL,NULL,NULL,1),
(650,'2023-08-29 15:28:06','2023-08-29 15:28:06',255,2,NULL,'addr','platform/addr',NULL,NULL,0,'发货地址','发货地址','',NULL,NULL,NULL,NULL,7),
(651,'2023-08-29 15:29:38','2023-08-29 15:29:38',166,2,NULL,'/system/delivery-manager','system/delivery-manager',NULL,NULL,0,'发货管理','发货管理','',NULL,NULL,NULL,NULL,4),
(652,'2023-08-29 15:30:10','2023-08-29 16:14:37',651,2,NULL,'outlet-config/index','system/delivery-manager/outlet-config/index',NULL,NULL,0,'网点管理','网点管理','',NULL,NULL,NULL,NULL,0),
(653,'2023-08-29 15:31:35','2023-08-29 16:16:32',651,2,NULL,'printer/index','system/delivery-manager/printer/index',NULL,NULL,0,'硬件设备','硬件设备','',NULL,NULL,NULL,NULL,1),
(654,'2023-08-29 15:33:24','2023-08-29 15:33:24',461,3,NULL,'/setting/delivery-manager','setting/delivery-manager',NULL,NULL,0,'发货管理','发货管理','',NULL,NULL,NULL,NULL,4),
(655,'2023-08-29 15:34:04','2023-08-30 17:22:24',654,3,NULL,'outlet-config/index','setting/delivery-manager/outlet-config/index',NULL,NULL,0,'网点管理','网点管理','',NULL,NULL,NULL,NULL,0),
(656,'2023-08-29 15:34:35','2023-08-30 17:22:09',654,3,NULL,'printer/index','setting/delivery-manager/printer/index',NULL,NULL,0,'硬件设备','硬件设备','',NULL,NULL,NULL,NULL,1);
update `menu` set `name` = '商家地址库', `title` = '商家地址库' where `component` = 'shop/refund-addr';
insert into `menu_permission` (`menu_permission_id`, `create_time`, `update_time`, `menu_id`, `biz_type`, `permission`, `name`, `uri`, `method`) values
(635,'2023-08-29 15:59:11','2023-08-29 15:59:11',648,1,'shop:outletConfig:save','新增','/mp/outlet_config',2),
(636,'2023-08-29 15:59:36','2023-08-29 15:59:36',648,1,'shop:outletConfig:update','编辑','/mp/outlet_config',3),
(637,'2023-08-29 15:59:53','2023-08-29 15:59:53',648,1,'shop:outletConfig:delete','删除','/mp/outlet_config',4),
(638,'2023-08-29 16:00:30','2023-08-29 16:00:30',648,1,'shop:outletConfig:paperSize','纸张规格','/mp/outlet_config',3),
(639,'2023-08-29 16:01:09','2023-08-29 16:01:09',648,1,'shop:outletConfig:setDefault','设为默认','/mp/outlet_config/set_default',3),
(640,'2023-08-29 16:01:38','2023-08-29 16:01:38',649,1,'shop:printer:save','新增','/mp/printer',2),
(641,'2023-08-29 16:01:57','2023-08-29 16:01:57',649,1,'shop:printer:update','编辑','/mp/printer',3),
(642,'2023-08-29 16:02:10','2023-08-29 16:02:10',649,1,'shop:printer:delete','删除','/mp/printer',4),
(643,'2023-08-29 16:02:39','2023-08-29 16:02:39',649,1,'shop:printer:setDefault','设为默认','/mp/printer/set_default',3),
(653,'2023-08-29 15:59:11','2023-08-29 16:06:24',652,2,'platform:outletConfig:save','新增','/mp/outlet_config',2),
(654,'2023-08-29 15:59:36','2023-08-29 16:06:26',652,2,'platform:outletConfig:update','编辑','/mp/outlet_config',3),
(655,'2023-08-29 15:59:53','2023-08-29 16:06:28',652,2,'platform:outletConfig:delete','删除','/mp/outlet_config',4),
(656,'2023-08-29 16:00:30','2023-08-29 16:06:31',652,2,'platform:outletConfig:paperSize','纸张规格','/mp/outlet_config',3),
(657,'2023-08-29 16:01:09','2023-08-29 16:06:34',652,2,'platform:outletConfig:setDefault','设为默认','/mp/outlet_config/set_default',3),
(658,'2023-08-29 16:01:38','2023-08-29 16:06:37',653,2,'platform:printer:save','新增','/mp/printer',2),
(659,'2023-08-29 16:01:57','2023-08-29 16:06:38',653,2,'platform:printer:update','编辑','/mp/printer',3),
(660,'2023-08-29 16:02:10','2023-08-29 16:06:41',653,2,'platform:printer:delete','删除','/mp/printer',4),
(661,'2023-08-29 16:02:39','2023-08-29 16:06:43',653,2,'platform:printer:setDefault','设为默认','/mp/printer/set_default',3),
(662,'2023-08-29 15:59:11','2023-08-29 16:06:50',655,3,'supplier:outletConfig:save','新增','/s/outlet_config',2),
(663,'2023-08-29 15:59:36','2023-08-29 16:06:51',655,3,'supplier:outletConfig:update','编辑','/s/outlet_config',3),
(664,'2023-08-29 15:59:53','2023-08-29 16:06:53',655,3,'supplier:outletConfig:delete','删除','/s/outlet_config',4),
(665,'2023-08-29 16:00:30','2023-08-29 16:06:55',655,3,'supplier:outletConfig:paperSize','纸张规格','/s/outlet_config',3),
(666,'2023-08-29 16:01:09','2023-08-29 16:06:57',655,3,'supplier:outletConfig:setDefault','设为默认','/s/outlet_config/set_default',3),
(667,'2023-08-29 16:01:38','2023-08-29 16:06:59',656,3,'supplier:printer:save','新增','/s/printer',2),
(668,'2023-08-29 16:01:57','2023-08-29 16:07:01',656,3,'supplier:printer:update','编辑','/s/printer',3),
(669,'2023-08-29 16:02:10','2023-08-29 16:07:02',656,3,'supplier:printer:delete','删除','/s/printer',4),
(670,'2023-08-29 16:02:39','2023-08-29 16:07:03',656,3,'supplier:printer:setDefault','设为默认','/s/printer/set_default',3),
(671,'2022-08-05 11:35:13','2022-08-05 11:35:13',650,2,'platform:shopAddr:delete','删除','/mp/shop_refund_addr',4),
(672,'2022-08-05 11:35:46','2022-08-05 11:35:46',650,2,'platform:shopAddr:update','编辑','/mp/shop_refund_addr',3),
(673,'2022-08-05 11:36:28','2022-08-05 11:36:28',650,2,'platform:shopAddr:save','新建','/mp/shop_refund_addr',2);

View File

@ -0,0 +1,5 @@
# 其中372是店铺订单管理,475是供应商订单管理,170是平台订单管理
insert into `menu`(`menu_id`,`create_time`,`update_time`,`parent_id`,`biz_type`,`permission`,`path`,`component`,`redirect`,`always_show`,`hidden`,`name`,`title`,`icon`,`no_cache`,`breadcrumb`,`affix`,`active_menu`,`seq`) values
(662,'2023-08-31 17:36:13','2023-08-31 17:36:13','372','1',NULL,'refund-order-info','order/order-manage/refund-order-info',NULL,NULL,'1','refund-info','退款详情','',NULL,NULL,NULL,NULL,'5'),
(661,'2023-08-31 17:22:42','2023-08-31 17:23:56','475','3',NULL,'refund-order-info','order/order-manage/refund-order-info',NULL,NULL,'1','refund-info','退款详情','',NULL,NULL,NULL,NULL,'5'),
(660,'2023-08-31 13:33:30','2023-08-31 13:33:30','170','2',NULL,'refund-order-info','order/refund-order-info',NULL,NULL,'1','order-refund-info','退款详情','',NULL,NULL,NULL,NULL,'0');

View File

@ -0,0 +1,256 @@
USE mall4cloud_job;
INSERT INTO `xxl_job_info`(`job_group`,`job_desc`,`add_time`,`update_time`,`author`,`alarm_email`,`schedule_type`,`schedule_conf`,`misfire_strategy`,`executor_route_strategy`,`executor_handler`,`executor_param`,`executor_block_strategy`,`executor_timeout`,`executor_fail_retry_count`,`glue_type`,`glue_source`,`glue_remark`,`glue_updatetime`,`child_jobid`,`trigger_status`,`trigger_last_time`,`trigger_next_time`) VALUES
(2,'发放退款','2023-09-07 09:16:24','2023-09-07 11:35:33','admin','','CRON','0 0/1 * * * ?','DO_NOTHING','FIRST','refundRequest','','SERIAL_EXECUTION',0,0,'BEAN','','GLUE代码初始化','2023-09-07 09:16:24','',1,1694068500000,1694068560000),
(2,'支付宝退款订单查单','2023-09-07 09:16:50','2023-09-07 11:15:16','admin','','CRON','0 0/1 * * * ?','DO_NOTHING','FIRST','updateAliPayRefundStatus','','SERIAL_EXECUTION',0,0,'BEAN','','GLUE代码初始化','2023-09-07 09:16:50','',1,1694068500000,1694068560000);
# 订单支付记录添加支付的系统类型字段
USE mall4cloud_payment_0;
DELIMITER //
DROP PROCEDURE
IF
EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
DECLARE
i INT;
SET i = 0;
WHILE
i < 64 DO
SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc 2:h5 3:小程序 4:安卓 5:ios'
" );
PREPARE set_pay_info_id
FROM
@set_pay_info_id;
EXECUTE set_pay_info_id;
SET i = i + 1;
END WHILE;
END // CALL createTable ()//
DELIMITER;
USE mall4cloud_payment_1;
DELIMITER //
DROP PROCEDURE
IF
EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
DECLARE
i INT;
SET i = 0;
WHILE
i < 64 DO
SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc 2:h5 3:小程序 4:安卓 5:ios'
" );
PREPARE set_pay_info_id
FROM
@set_pay_info_id;
EXECUTE set_pay_info_id;
SET i = i + 1;
END WHILE;
END // CALL createTable ()//
DELIMITER;
USE mall4cloud_payment_2;
DELIMITER //
DROP PROCEDURE
IF
EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
DECLARE
i INT;
SET i = 0;
WHILE
i < 64 DO
SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc 2:h5 3:小程序 4:安卓 5:ios'
" );
PREPARE set_pay_info_id
FROM
@set_pay_info_id;
EXECUTE set_pay_info_id;
SET i = i + 1;
END WHILE;
END // CALL createTable ()//
DELIMITER;
USE mall4cloud_payment_3;
DELIMITER //
DROP PROCEDURE
IF
EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
DECLARE
i INT;
SET i = 0;
WHILE
i < 64 DO
SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc 2:h5 3:小程序 4:安卓 5:ios'
" );
PREPARE set_pay_info_id
FROM
@set_pay_info_id;
EXECUTE set_pay_info_id;
SET i = i + 1;
END WHILE;
END // CALL createTable ()//
DELIMITER;
USE mall4cloud_payment_4;
DELIMITER //
DROP PROCEDURE
IF
EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
DECLARE
i INT;
SET i = 0;
WHILE
i < 64 DO
SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc 2:h5 3:小程序 4:安卓 5:ios'
" );
PREPARE set_pay_info_id
FROM
@set_pay_info_id;
EXECUTE set_pay_info_id;
SET i = i + 1;
END WHILE;
END // CALL createTable ()//
DELIMITER;
USE mall4cloud_payment_5;
DELIMITER //
DROP PROCEDURE
IF
EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
DECLARE
i INT;
SET i = 0;
WHILE
i < 64 DO
SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc 2:h5 3:小程序 4:安卓 5:ios'
" );
PREPARE set_pay_info_id
FROM
@set_pay_info_id;
EXECUTE set_pay_info_id;
SET i = i + 1;
END WHILE;
END // CALL createTable ()//
DELIMITER;
USE mall4cloud_payment_6;
DELIMITER //
DROP PROCEDURE
IF
EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
DECLARE
i INT;
SET i = 0;
WHILE
i < 64 DO
SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc 2:h5 3:小程序 4:安卓 5:ios'
" );
PREPARE set_pay_info_id
FROM
@set_pay_info_id;
EXECUTE set_pay_info_id;
SET i = i + 1;
END WHILE;
END // CALL createTable ()//
DELIMITER;
USE mall4cloud_payment_7;
DELIMITER //
DROP PROCEDURE
IF
EXISTS createTable // CREATE PROCEDURE createTable () BEGIN
DECLARE
i INT;
SET i = 0;
WHILE
i < 64 DO
SET @set_pay_info_id = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `system_model` tinyint DEFAULT NULL COMMENT '支付的系统类型 1:pc 2:h5 3:小程序 4:安卓 5:ios'
" );
PREPARE set_pay_info_id
FROM
@set_pay_info_id;
EXECUTE set_pay_info_id;
SET i = i + 1;
END WHILE;
END // CALL createTable ()//
DELIMITER;
# 添加微信发货配置
USE mall4cloud_admin;
INSERT INTO `sys_config`(`create_time`, `update_time`, `param_key`, `param_value`, `remark`) VALUES ('2023-01-31 09:16:47', '2023-09-08 15:51:23', 'WECHAT_SHIPPING_CONFIG', '{\"wechatShippingAudit\":false}', '微信发货配置');
USE `mall4cloud_leaf`;
INSERT INTO leaf_alloc ( biz_tag, max_id, step, update_time, description, random_step )
VALUE ( 'mall4cloud-purchase-amount-log', 1, 1000, NOW(), '采购金额日志id', 10 );
# 采购金额日志菜单补充
USE `mall4cloud_auth`;
# menu_id=322, 464分别为商家和供应的'店铺结算'
DELETE FROM `menu` WHERE `menu_id` IN (322, 464);
INSERT INTO `menu`(`menu_id`, `create_time`, `update_time`, `parent_id`, `biz_type`, `permission`, `path`, `component`, `redirect`, `always_show`, `hidden`, `name`, `title`, `icon`, `no_cache`, `breadcrumb`, `affix`, `active_menu`, `seq`)
VALUES
(663, '2023-08-31 16:36:36', '2023-09-01 15:30:48', 0, 1, NULL, '/finance', 'Layout', NULL, NULL, 0, '财务', '财务', 'financial', NULL, NULL, NULL, NULL, 10),
(664, '2023-08-31 16:37:06', '2023-09-01 15:29:32', 663, 1, NULL, 'finance-purchase-settlement', 'finance/purchase-settlement', NULL, NULL, 0, '采购结算', '采购结算', '', NULL, NULL, NULL, NULL, 1),
(665, '2023-09-01 14:42:53', '2023-09-01 14:42:53', 663, 1, NULL, 'wallet-log', 'shop/wallet-log', NULL, NULL, 0, '财务结算', '财务结算', '', NULL, NULL, NULL, NULL, 0),
(666, '2023-09-01 13:50:25', '2023-09-01 15:31:06', 0, 3, NULL, '/finance', 'Layout', NULL, NULL, 0, '财务', '财务', 'financial', NULL, NULL, NULL, NULL, 4),
(667, '2023-09-01 13:52:09', '2023-09-01 15:29:15', 666, 3, NULL, 'supplier-walletLog', 'shop/wallet-log', NULL, NULL, 0, 'shop-walletLog', '财务结算', '', NULL, NULL, NULL, NULL, 0),
(668, '2023-09-01 13:53:38', '2023-09-01 13:53:38', 666, 3, NULL, 'finance-purchase-settlement', 'finance/purchase-settlement', NULL, NULL, 0, '采购结算', '采购结算', '', NULL, NULL, NULL, NULL, 1);

View File

@ -0,0 +1,36 @@
USE mall4cloud_admin;
ALTER TABLE shop_wallet DROP COLUMN zone_num;
ALTER TABLE supplier_wallet DROP COLUMN zone_num;
# 把钱包分片的内容整合到总钱包中
UPDATE shop_wallet sw
JOIN (SELECT SUM(unsettled_amount) AS unsettled_amount, SUM(settled_amount) AS settled_amount,
SUM(total_settled_amount) AS total_settled_amount,shop_id, pay_sys_type
FROM shop_wallet_zone
GROUP BY shop_id) zone ON zone.shop_id = sw.`shop_id` AND zone.pay_sys_type = sw.`pay_sys_type`
SET sw.unsettled_amount = zone.unsettled_amount + sw.`unsettled_amount`,
sw.`settled_amount` = zone.settled_amount + sw.`settled_amount`,
sw.`total_settled_amount` = zone.total_settled_amount + sw.`total_settled_amount`;
UPDATE supplier_wallet sw
JOIN (SELECT SUM(unsettled_amount) AS unsettled_amount, SUM(settled_amount) AS settled_amount,
SUM(total_settled_amount) AS total_settled_amount,supplier_id, pay_sys_type
FROM supplier_wallet_zone
GROUP BY supplier_id) zone ON zone.supplier_id = sw.`supplier_id` AND zone.pay_sys_type = sw.`pay_sys_type`
SET sw.unsettled_amount = zone.unsettled_amount + sw.`unsettled_amount`,
sw.`settled_amount` = zone.settled_amount + sw.`settled_amount`,
sw.`total_settled_amount` = zone.total_settled_amount + sw.`total_settled_amount`;
DROP TABLE IF EXISTS `shop_wallet_zone`;
DROP TABLE IF EXISTS `supplier_wallet_zone`;
DROP TABLE IF EXISTS `supplier_wallet_log`;
USE mall4cloud_job;
DELETE FROM xxl_job_info
WHERE executor_handler IN ('zoneShopWalletToTenIfNecessary', 'zoneSupplierWalletToTenIfNecessary');
# 变更商家端公告位置
USE mall4cloud_auth;
# menu_id = 253, 375都是'公告'
DELETE FROM `menu` WHERE `menu_id` IN (253, 375);
# parent_id = 145 为'店铺管理'
INSERT INTO `menu`(`menu_id`,`create_time`, `update_time`, `parent_id`, `biz_type`, `permission`, `path`, `component`, `redirect`, `always_show`, `hidden`, `name`, `title`, `icon`, `no_cache`, `breadcrumb`, `affix`, `active_menu`, `seq`)
VALUES
(669, NOW(), NOW(), 145, 1, NULL, 'notice', 'shop/notice', NULL, NULL, 0, '店铺公告', '店铺公告', '', NULL, NULL, NULL, NULL, 1);

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,149 @@
USE mall4cloud_auth;
# 修改平台发货地址菜单 651为发货管理菜单
update menu set parent_id = 651, component = 'system/delivery-manager/addr/index', seq = 2 where menu_id = 650 and name = '发货地址';
# 订单发票新增供应商id字段
USE mall4cloud_order_0;
DELIMITER //
DROP PROCEDURE IF EXISTS updateInvoiceColumn //
CREATE PROCEDURE updateInvoiceColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE order_invoice_', i, " ADD COLUMN `supplier_id` bigint(0) NULL COMMENT '供应商id' AFTER `shop_id`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateInvoiceColumn() //
DROP PROCEDURE updateInvoiceColumn //
DELIMITER;
USE mall4cloud_order_1;
DELIMITER //
DROP PROCEDURE IF EXISTS updateInvoiceColumn //
CREATE PROCEDURE updateInvoiceColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE order_invoice_', i, " ADD COLUMN `supplier_id` bigint(0) NULL COMMENT '供应商id' AFTER `shop_id`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateInvoiceColumn() //
DROP PROCEDURE updateInvoiceColumn //
DELIMITER;
USE mall4cloud_order_2;
DELIMITER //
DROP PROCEDURE IF EXISTS updateInvoiceColumn //
CREATE PROCEDURE updateInvoiceColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE order_invoice_', i, " ADD COLUMN `supplier_id` bigint(0) NULL COMMENT '供应商id' AFTER `shop_id`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateInvoiceColumn() //
DROP PROCEDURE updateInvoiceColumn //
DELIMITER;
USE mall4cloud_order_3;
DELIMITER //
DROP PROCEDURE IF EXISTS updateInvoiceColumn //
CREATE PROCEDURE updateInvoiceColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE order_invoice_', i, " ADD COLUMN `supplier_id` bigint(0) NULL COMMENT '供应商id' AFTER `shop_id`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateInvoiceColumn() //
DROP PROCEDURE updateInvoiceColumn //
DELIMITER;
USE mall4cloud_order_4;
DELIMITER //
DROP PROCEDURE IF EXISTS updateInvoiceColumn //
CREATE PROCEDURE updateInvoiceColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE order_invoice_', i, " ADD COLUMN `supplier_id` bigint(0) NULL COMMENT '供应商id' AFTER `shop_id`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateInvoiceColumn() //
DROP PROCEDURE updateInvoiceColumn //
DELIMITER;
USE mall4cloud_order_5;
DELIMITER //
DROP PROCEDURE IF EXISTS updateInvoiceColumn //
CREATE PROCEDURE updateInvoiceColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE order_invoice_', i, " ADD COLUMN `supplier_id` bigint(0) NULL COMMENT '供应商id' AFTER `shop_id`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateInvoiceColumn() //
DROP PROCEDURE updateInvoiceColumn //
DELIMITER;
USE mall4cloud_order_6;
DELIMITER //
DROP PROCEDURE IF EXISTS updateInvoiceColumn //
CREATE PROCEDURE updateInvoiceColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE order_invoice_', i, " ADD COLUMN `supplier_id` bigint(0) NULL COMMENT '供应商id' AFTER `shop_id`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateInvoiceColumn() //
DROP PROCEDURE updateInvoiceColumn //
DELIMITER;
USE mall4cloud_order_7;
DELIMITER //
DROP PROCEDURE IF EXISTS updateInvoiceColumn //
CREATE PROCEDURE updateInvoiceColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE order_invoice_', i, " ADD COLUMN `supplier_id` bigint(0) NULL COMMENT '供应商id' AFTER `shop_id`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateInvoiceColumn() //
DROP PROCEDURE updateInvoiceColumn //
DELIMITER;

View File

@ -0,0 +1,109 @@
# 看注释!!!!!!!!
# 1.执行 2023-11-13 整合leaf模块.sql 新增的分布式id数据要导入
# 2.给用户服务添加mongodb连接
# 积分、余额的数据放入mongodb。在mall4cloud-user.yml加入以下配置连接数据注意检查更换
# data:
# mongodb:
# host: 192.168.193.128
# port: 27017
# database: mall4cloud
# username: mall4cloud
# password: mall4cloud
# authentication-database: mall4cloud
# 3.给支付模块增加一个数据库配置
# 在mall4cloud-payment.yml替换以下配置
# 将:
#
# datasource:
# names: ds,ds0,ds1,ds2,ds3,ds4,ds5,ds6,ds7
#
# 替换成:
# datasource:
# names: ds,ds0,ds1,ds2,ds3,ds4,ds5,ds6,ds7
# ds:
# type: com.zaxxer.hikari.HikariDataSource
# driver-class-name: com.mysql.cj.jdbc.Driver
# jdbc-url: jdbc:mysql://${MYSQL_HOST:192.168.193.128}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:mall4cloud_payment}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true&useAffectedRows=true
# username: ${MYSQL_USERNAME:root}
# password: ${MYSQL_PASSWORD:hn02le.34lkdLKD}
# minimum-idle: 0
# maximum-pool-size: 20
# idle-timeout: 25000
# auto-commit: true
# connection-test-query: SELECT 1
#
# 将:
# sharding:
#
# 替换成:
# sharding:
# default-data-source-name: ds
#
#
# 或者执行以下两条sql后重启nacos二选一
use mall4cloud_nacos;
update config_info set content = REPLACE(content, 'names: ds0,ds1,ds2,ds3,ds4,ds5,ds6,ds7\n', 'names: ds,ds0,ds1,ds2,ds3,ds4,ds5,ds6,ds7\n ds:\n type: com.zaxxer.hikari.HikariDataSource\n driver-class-name: com.mysql.cj.jdbc.Driver\n jdbc-url: jdbc:mysql://${MYSQL_HOST:192.168.193.128}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:mall4cloud_payment}?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true&useAffectedRows=true\n username: ${MYSQL_USERNAME:root}\n password: ${MYSQL_PASSWORD:hn02le.34lkdLKD}\n minimum-idle: 0\n maximum-pool-size: 20\n idle-timeout: 25000\n auto-commit: true\n connection-test-query: SELECT 1\n') where data_id = 'mall4cloud-payment.yml';
update config_info set content = REPLACE(content, 'sharding:\n', 'sharding:\n default-data-source-name: ds\n') where data_id = 'mall4cloud-payment.yml';
# 4.search模块增加一个mongodb配置
# 在mall4cloud-search.yml替换以下配置
# 将:
#
# spring:
#
# 替换成:
# spring:
# data:
# mongodb:
# host: 192.168.193.128
# port: 27017
# database: mall4cloud
# username: mall4cloud
# password: 'mall4cloud'
# authentication-database: mall4cloud
#
# 或者执行以下两条sql后重启nacos二选一
use mall4cloud_nacos;
update config_info set content = REPLACE(content, 'spring:\n', 'spring:\n data:\n mongodb:\n host: 192.168.193.128\n port: 27017\n database: mall4cloud\n username: mall4cloud\n password: mall4cloud\n authentication-database: mall4cloud\n') where data_id = 'mall4cloud-search.yml';
# 5.initScoreAndBalanceLogToMongodb这个定时任务只对2023-11-13更新前将积分日志(user_score_log)和余额日志(user_balance_log)存入mysql之后将数据搬迁到mongodb
# 需要重启用户服务,使该定时任务正常执行*成功*一次后(数据已经完全搬迁到mongodb)就可以置为停止或删除随后可以将mysql中user_score_log和user_balance_log删除
# 并且可以将UserScoreLogMapper、UserBalanceLogMapper以及相关定时任务代码从代码中删去
USE `mall4cloud_job`;
insert into `xxl_job_info`(`job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`,
`schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`,
`executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`,
`glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`,
`trigger_status`, `trigger_last_time`, `trigger_next_time`)
values (12, '初始化原有数据库记录至mongodb', '2023-11-02 10:07:30', '2023-11-02 10:07:30', 'admin', '', 'CRON',
'0 0 0 1 1 ? *', 'DO_NOTHING', 'FIRST', 'initScoreAndBalanceLogToMongodb', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN',
'', 'GLUE代码初始化', '2023-11-02 10:07:30', '', 0, 0, 0);
# 6.优化通联会员注册
USE `mall4cloud_user`;
ALTER TABLE `user_extension`
ADD COLUMN `allinpay_create` tinyint(1) DEFAULT 0 COMMENT '是否创建通联会员(0:否1:是)' AFTER `allinpay_actual_balance`;
USE mall4cloud_job;
INSERT INTO `xxl_job`.`xxl_job_info`(`job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`, `trigger_status`, `trigger_last_time`, `trigger_next_time`)
VALUES
(12, '用户创建通联会员', '2023-11-10 14:30:03', '2023-11-10 14:51:03', 'admin', '', 'CRON', '0 0/10 * * * ? *', 'DO_NOTHING', 'FIRST', 'createAllinpayMember', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化', '2023-11-10 14:30:03', '', 1, 0, 1699599600000);
# 7. 上面步骤执行完毕后,重启所有服务
# 8. 重启服务后,导入初始化的定时任务并执行
# 只需要执行一次就可以删除掉,不要重复执行
USE `mall4cloud_job`;
insert into `xxl_job_info` (`id`, `job_group`, `job_desc`, `add_time`, `update_time`, `author`, `alarm_email`, `schedule_type`, `schedule_conf`, `misfire_strategy`, `executor_route_strategy`, `executor_handler`, `executor_param`, `executor_block_strategy`, `executor_timeout`, `executor_fail_retry_count`, `glue_type`, `glue_source`, `glue_remark`, `glue_updatetime`, `child_jobid`, `trigger_status`, `trigger_last_time`, `trigger_next_time`) values
('612','11','初始化库存','2023-07-10 09:51:23','2023-11-10 16:38:00','admin','','CRON','0 0 0 1 10 ?','DO_NOTHING','FIRST','intiStock','','SERIAL_EXECUTION','0','0','BEAN','','GLUE代码初始化','2023-07-10 09:51:23','','0','0','0');

View File

@ -0,0 +1,37 @@
USE mall4cloud_user;
DROP TABLE IF EXISTS `cost_per_popup`;
CREATE TABLE `cost_per_popup` (
`popup_id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '弹窗广告id',
`shop_id` bigint NOT NULL COMMENT '店铺id',
`popup_name` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '弹窗名称',
`status` tinyint NOT NULL COMMENT '状态 1.未开始 2.投放中 3.已结束',
`page_type` tinyint NOT NULL COMMENT '触发页面类型 1.平台首页 2.会员中心 3.支付成功 4.店铺首页 5.商品详情',
`popup_pic` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '弹窗图片',
`jump_url` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '跳转页面',
`user_type` tinyint NOT NULL DEFAULT '0' COMMENT '推送用户类型 0.所有用户 1.免费会员 2.付费会员 3.店铺客户',
`start_time` datetime NOT NULL COMMENT '推送开始时间',
`end_time` datetime NOT NULL COMMENT '推送结束时间',
`push_frequency` tinyint NOT NULL DEFAULT '0' COMMENT '推送频次 0.永久一次 1.每次进入 2.自定义频次',
`day_frequency` tinyint DEFAULT NULL COMMENT '按x天推送',
`week_frequency` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '按周推送 eg. 1,2',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`popup_id`),
KEY `shop_id` (`popup_id`,`shop_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='弹窗广告';
DROP TABLE IF EXISTS `popup_relate`;
CREATE TABLE `popup_relate` (
`relate_id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '关联id',
`popup_id` bigint NOT NULL COMMENT '弹窗广告id',
`spu_id` bigint DEFAULT NULL COMMENT '商品id',
`user_level_id` bigint DEFAULT NULL COMMENT '会员等级id',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
PRIMARY KEY (`relate_id`),
KEY `popup_id` (`popup_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='弹窗广告关联';

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,6 @@
# 增加分布式id的wordId
# 如果测试环境、开发环境、生产环境用的都是同一套支付系统,那么会面临一个问题:
# 测试环境中的支付单号1会与生产环境中的支付单号1重复。所以需要在不同的环境增加一个需要比如加多个序号测试环境的1会变成11开发环境的1会变成21
# 需要在`mall4cloud-leaf.yml` 修改这个配置请配置10-99。请手动在不同的环境加上不同的id
application:
workerId: 10

View File

@ -0,0 +1,12 @@
# 增加订单用户地址字段
```
PUT order/_mapping/_doc?include_type_name=true
{
"properties": {
"receivingAddr": {
"type": "text"
}
}
}
```

View File

@ -0,0 +1,135 @@
# 新增订单组合商品字段
```
PUT order/_mapping/_doc?include_type_name=true
{
"properties": {
"mainOrderId": {
"type": "long"
},
"orderItems": {
"type": "nested",
"properties": {
"writeOffNum": {
"type": "integer"
},
"spuMold": {
"type": "integer"
},
"writeOffMultipleCount": {
"type": "integer"
},
"writeOffStart": {
"type": "date"
},
"writeOffEnd": {
"type": "date"
}
}
}
}
}
```
# 新增调拨订单ES数据
PUT allot-order
```json
{
"mappings": {
"properties": {
"allotOrderId": {
"type": "long"
},
"outWarehouseId": {
"type": "long"
},
"outStockPointType": {
"type": "integer"
},
"inWarehouseId": {
"type": "long"
},
"inStockPointType": {
"type": "integer"
},
"dvyCompanyId": {
"type": "long"
},
"dvyType": {
"type": "integer"
},
"dvyOrderNumber": {
"type": "keyword",
"index": false,
"doc_values": false
},
"status": {
"type": "integer"
},
"totalAllotCount": {
"type": "integer"
},
"remark": {
"type": "keyword",
"index": false,
"doc_values": false
},
"shopId": {
"type": "long"
},
"sysType": {
"type": "integer"
},
"createTime": {
"type": "date"
},
"updateTime": {
"type": "date"
},
"allotOrderItems": {
"type": "nested",
"properties": {
"allotOrderItemId": {
"type": "long"
},
"spuId": {
"type": "long"
},
"skuId": {
"type": "long"
},
"allotCount": {
"type": "integer"
},
"allotInCount": {
"type": "integer"
}
}
}
}
}
}
```
# 新增商品配送方式字段
PUT product/_mapping/_doc?include_type_name=true
```json
{
"properties": {
"deliveryMode": {
"type": "nested",
"properties": {
"hasUserPickUp": {
"type": "boolean"
},
"hasShopDelivery": {
"type": "boolean"
},
"hasCityDelivery": {
"type": "boolean"
}
}
}
}
}
```

View File

@ -0,0 +1,126 @@
package com.tmerclub.cloud.systemtest.api.amount;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.product.dto.CategoryShopDTO;
import com.tmerclub.cloud.common.product.vo.CategoryVO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.product.dto.CategoryDTO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author Tu
* 分类数据
*
*/
public class CategoryApi {
/**
* 获取店铺签约的可用分类列表(发布商品时使用
*/
public static List<CategoryAppVO> listShopCategory(Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_product/mp/category/enable_categories";
if(isMainShop) {
return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url, List.class,UrlEnum.SHOP)), CategoryAppVO.class);
} else {
return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url, List.class,UrlEnum.SHOP_OTHER)), CategoryAppVO.class);
}
}
public static List<CategoryAppVO> listSigningCategory(Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_product/m/apply_shop/category/list_signing_category?status=1";
if(isMainShop) {
return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url, List.class,UrlEnum.SHOP)), CategoryAppVO.class);
} else {
return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url, List.class,UrlEnum.SHOP_OTHER)), CategoryAppVO.class);
}
}
/**
* 新增平台分类
*/
public static Long save(CategoryDTO categoryDTO) {
String url = Constant.API_URL + "/mall4cloud_product/mp/category";
return HttpUtil.post(url, categoryDTO, UrlEnum.PLATFORM, Long.class);
}
/**
* 根据分类id查找分类信息
*/
public static CategoryVO getCategoryInfo(Long categoryId){
String url = Constant.API_URL + "/mall4cloud_product/mp/category?categoryId=" + categoryId;
return HttpUtil.get(url, CategoryVO.class, UrlEnum.PLATFORM);
}
/**
* 修改分类信息
*/
public static void update(CategoryDTO categoryDTO){
String url = Constant.API_URL + "/mall4cloud_product/mp/category";
HttpUtil.put(url, categoryDTO, UrlEnum.PLATFORM);
}
/**
* 删除平台分类
*/
public static void delete(Long categoryId) {
String url = Constant.API_URL + "/mall4cloud_product/mp/category?categoryId=" + categoryId;
HttpUtil.delete(url, UrlEnum.PLATFORM);
}
/**
* 店铺增加签约分类
*/
public static void addSigningCategory(List<CategoryShopDTO> categoryShopDTOList, Boolean isMainShop){
String url = Constant.API_URL + "/mall4cloud_product/m/apply_shop/category/add_signing_category";
if(isMainShop) {
HttpUtil.post(url, categoryShopDTOList,UrlEnum.SHOP);
} else {
HttpUtil.post(url, categoryShopDTOList,UrlEnum.SHOP_OTHER);
}
}
/**
* 查询供应商签约类目发布商品时使用
* */
public static List<CategoryAppVO> listSupplierCategory(Boolean isMainSupplier) {
String url = Constant.API_URL + "/mall4cloud_product/s/apply_supplier/category/list_signing_category";
if(isMainSupplier) {
return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url, List.class,UrlEnum.SUPPLIER)), CategoryAppVO.class);
} else {
return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url, List.class,UrlEnum.SUPPLIER_OTHER)), CategoryAppVO.class);
}
}
/**
* 供应商 增加签约分类
*/
public static void addSupplierCategory(List<CategoryShopDTO> categoryShopDTOList, Boolean isMainSupplier){
String url = Constant.API_URL + "/mall4cloud_product/s/apply_supplier/category/add_signing_category";
if(isMainSupplier) {
HttpUtil.post(url, categoryShopDTOList,UrlEnum.SUPPLIER);
} else {
HttpUtil.post(url, categoryShopDTOList,UrlEnum.SUPPLIER_OTHER);
}
}
/**
* 查询供应商可签约类目需要签约类目查询平台类目时使用
* */
public static List<CategoryVO> listSupplierApplyCategory(Boolean isMainSupplier) {
String url = Constant.API_URL + "/mall4cloud_product/s/apply_supplier/category/list_apply_signing_category";
if(isMainSupplier) {
return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url, List.class,UrlEnum.SUPPLIER)), CategoryVO.class);
} else {
return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url, List.class,UrlEnum.SUPPLIER_OTHER)), CategoryVO.class);
}
}
}

View File

@ -0,0 +1,155 @@
//package com.tmerclub.cloud.systemtest.api.amount;
//
//import cn.hutool.http.HttpRequest;
//import cn.hutool.http.HttpResponse;
//import com.alibaba.fastjson2.JSON;
//import com.alibaba.fastjson2.JSONObject;
//import com.yami.shop.bean.app.dto.CouponDto;
//import com.yami.shop.bean.model.OfflineHandleEvent;
//import com.yami.shop.bean.param.OfflineHandleEventAuditParam;
//import com.yami.shop.common.util.Json;
//import com.yami.shop.coupon.common.model.Coupon;
//import com.yami.shop.coupon.common.model.CouponUser;
//import com.yami.shop.systemtest.constants.Constant;
//import com.yami.shop.systemtest.util.CheckUtil;
//import com.yami.shop.systemtest.util.HttpUtil;
//
//import java.util.List;
//
///**
// * @author lh
// */
//public class CouponApi {
//
// public static Long save(Coupon coupon){
// String url = Constant.SHOP_URL+"/admin/coupon";
// return HttpUtil.post(url,coupon,Long.class,true);
// }
//
// public static Long platformSave(Coupon coupon){
// String url = Constant.PLATFORM_URL+"/platform/coupon";
// return HttpUtil.post(url,coupon,Long.class,true);
// }
//
// public static String receive(Long couponId){
// String url = Constant.API_URL+"/p/myCoupon/receive";
// HttpRequest post = HttpRequest.post(url);
// post.header("authorization", Constant.API_TOKEN);
// post.header("content-type","application/json; charset=UTF-8");
// HttpResponse response = post.body(Json.toJsonString(couponId)).execute();
// return CheckUtil.checkAndGetObject(response,String.class);
// }
//
//
// public static List<CouponDto> list(){
// String url = Constant.API_URL+"/p/myCoupon/listCouponIds";
// List list = HttpUtil.get(url, List.class);
// return JSON.parseArray(JSONObject.toJSONString(list), CouponDto.class);
// }
//
// /**
// * 用户删除优惠券
// */
// public static void userDelete(Long couponId) {
// String url = Constant.API_URL + "/p/myCoupon/delCoupon/" + couponId;
// HttpUtil.delete(url);
// }
//
// public static Coupon getCouponById(Long couponId){
// String url = Constant.SHOP_URL+"/admin/coupon/info/"+couponId;
// return HttpUtil.get(url,Coupon.class);
// }
//
// /**
// * 修改优惠券
// */
// public static void update(Coupon coupon) {
// String url = Constant.SHOP_URL + "/admin/coupon";
// HttpUtil.put(url, coupon);
// }
//
// /**
// * 店铺删除优惠券
// */
// public static void delete(Long couponId) {
// String url = Constant.SHOP_URL + "/admin/coupon";
// HttpUtil.delete(url, couponId);
// }
//
// /**
// * 平台违规下架优惠券
// */
// public static void offline(OfflineHandleEvent offlineHandleEvent) {
// String url = Constant.PLATFORM_URL + "/platform/coupon/offline";
// HttpUtil.post(url, offlineHandleEvent);
// }
//
// /**
// * 商家根据优惠券ID获取下架信息
// */
// public static OfflineHandleEvent getOfflineHandleEvent(Long couponId) {
// String url = Constant.SHOP_URL + "/admin/coupon/getOfflineHandleEventByCouponId/" + couponId;
// return HttpUtil.get(url, OfflineHandleEvent.class);
// }
//
// /**
// * 商家根据下架信息申请上架
// */
// public static void applyOnline(OfflineHandleEventAuditParam offlineHandleEventAuditParam) {
// String url = Constant.SHOP_URL + "/admin/coupon/auditApply";
// HttpUtil.post(url, offlineHandleEventAuditParam);
// }
//
// /**
// * 平台根据优惠券ID获取下架信息
// */
// public static OfflineHandleEvent getOfflineHandleEventByPlatform(Long couponId) {
// String url = Constant.PLATFORM_URL + "/platform/coupon/getOfflineHandleEventByCouponId/" + couponId;
// return HttpUtil.get(url, OfflineHandleEvent.class);
// }
//
// /**
// * 平台根据下架信息审核
// */
// public static void audit(OfflineHandleEventAuditParam offlineHandleEventAuditParam) {
// String url = Constant.PLATFORM_URL + "/platform/coupon/auditCoupon";
// HttpUtil.post(url, offlineHandleEventAuditParam);
// }
//
// /**
// * 根据用户id获取优惠券信息
// * @param userId
// * @return
// */
// public static List<CouponUser> getCouponUserByUserId(String userId){
// String url = Constant.SHOP_URL+"/admin/couponUser/info/"+userId;
// Object result = HttpUtil.get(url, Object.class);
// List<CouponUser> couponUsers = JSON.parseArray(result.toString(), CouponUser.class);
// return couponUsers;
// }
//
// /**
// * 根据优惠券ID获取平台优惠券信息
// */
// public static Coupon getPlatformCouponById(Long couponId) {
// String url = Constant.PLATFORM_URL + "/platform/coupon/info/" + couponId;
// return HttpUtil.get(url, Coupon.class);
// }
//
// /**
// * 修改平台优惠券
// */
// public static void updatePlatformCoupon(Coupon coupon) {
// String url = Constant.PLATFORM_URL + "/platform/coupon";
// HttpUtil.put(url, coupon);
// }
//
// /**
// * 删除平台优惠券
// */
// public static void deletePlatformCoupon(Long couponId) {
// String url = Constant.PLATFORM_URL + "/platform/coupon";
// HttpUtil.delete(url, couponId);
// }
//
//}

View File

@ -0,0 +1,32 @@
//package com.tmerclub.cloud.systemtest.api.amount;
//
//import com.yami.shop.bean.model.Order;
//import com.yami.shop.delivery.common.param.DeliveryOrderItemParam;
//import com.yami.shop.systemtest.constants.Constant;
//import com.yami.shop.systemtest.util.HttpUtil;
//
///**
// * @author lanhai
// */
//public class DeliverApi {
// /**
// * 发货
// *
// */
// public static void orderItemsDelivery(DeliveryOrderItemParam deliveryOrderItemParam){
// String uri = Constant.SHOP_URL+"/order/delivery/orderItemsDelivery";
// HttpUtil.put(uri,deliveryOrderItemParam);
// }
//
// /**
// * 根据订单号获取未发货
// * @param orderNumber
// * @return
// */
// public static Order getOrderItemUnDelivery(String orderNumber){
// String uri = Constant.SHOP_URL+"/order/delivery/getOrderItemUnDelivery/"+orderNumber;
// return HttpUtil.get(uri, Order.class);
// }
//
//
//}

View File

@ -0,0 +1,130 @@
//package com.tmerclub.cloud.systemtest.api.amount;
//
//import com.alibaba.fastjson2.JSON;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yami.shop.bean.app.dto.OrderNumbersDto;
//import com.yami.shop.bean.app.param.SubmitSeckillOrderParam;
//import com.yami.shop.bean.model.OfflineHandleEvent;
//import com.yami.shop.bean.param.OfflineHandleEventAuditParam;
//import com.yami.shop.common.util.Json;
//import com.yami.shop.seckill.api.param.SeckillOrderParam;
//import com.yami.shop.seckill.common.model.Seckill;
//import com.yami.shop.seckill.multishop.param.SeckillParam;
//import com.yami.shop.systemtest.constants.Constant;
//import com.yami.shop.systemtest.util.HttpUtil;
//
//import java.util.List;
//
///**
// * @author lanhai
// */
//public class SeckillApi {
// /**
// * 新建秒杀活动
// * @param seckillParam
// */
// public static void createSeckill(SeckillParam seckillParam){
// String url = Constant.SHOP_URL+"/seckill/seckill";
// HttpUtil.post(url,seckillParam);
// }
//
// /**
// * 获取秒杀活动列表
// */
// public static List<Seckill> listSeckill() {
// String url = Constant.SHOP_URL + "/seckill/seckill/page";
// return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, Page.class)), Page.class).getRecords()), Seckill.class);
// }
//
// /**
// * 平台违规下架秒杀活动
// */
// public static void offine(OfflineHandleEvent offlineHandleEvent) {
// String url = Constant.PLATFORM_URL + "/platform/seckill/offline";
// HttpUtil.post(url, offlineHandleEvent);
// }
//
// /**
// * 商家根据活动ID获取下架信息
// */
// public static OfflineHandleEvent getOfflineHandleEvent(Long seckillId) {
// String url = Constant.SHOP_URL + "/seckill/seckill/getOfflineHandleEventBySeckillId/" + seckillId;
// return HttpUtil.get(url, OfflineHandleEvent.class);
// }
//
// /**
// * 商家根据活动下架信息申请上架
// */
// public static void applyOnline(OfflineHandleEventAuditParam offlineHandleEventAuditParam) {
// String url = Constant.SHOP_URL + "/seckill/seckill/auditApply";
// HttpUtil.post(url, offlineHandleEventAuditParam);
// }
//
// /**
// * 平台根据活动ID获取下架信息
// */
// public static OfflineHandleEvent getOfflineHandleEventBySeckillId(Long seckillId) {
// String url = Constant.PLATFORM_URL + "/platform/seckill/getOfflineHandleEventBySeckillId/" + seckillId;
// return HttpUtil.get(url, OfflineHandleEvent.class);
// }
//
// /**
// * 平台根据活动下架信息审核
// */
// public static void audit(OfflineHandleEventAuditParam offlineHandleEventAuditParam) {
// String url = Constant.PLATFORM_URL + "/platform/seckill/auditSeckill";
// HttpUtil.post(url, offlineHandleEventAuditParam);
// }
//
//
// /**
// * 店铺关闭秒杀活动
// */
// public static void closeSeckill(Long seckillId) {
// String url = Constant.SHOP_URL + "/seckill/seckill/invalid/" + seckillId;
// HttpUtil.put(url, seckillId);
// }
//
// /**
// * 店铺删除秒杀活动
// * @param seckillId
// */
// public static void shopDeleteSeckill(Long seckillId){
// String url = Constant.SHOP_URL+"/seckill/seckill/"+seckillId;
// HttpUtil.delete(url);
// }
//
// /**
// * 平台删除秒杀活动
// * @param seckllId
// */
// public static void deleteSeckill(Long seckllId){
// String url = Constant.PLATFORM_URL+"/seckill/seckill/"+seckllId;
// HttpUtil.delete(url);
// }
//
//
// /**
// * 用户根据商品ID获取秒杀订单路径
// */
// public static String getSeckillPath(Long productId) {
// String url = Constant.API_URL + "/p/seckill/orderPath?prodId=" + productId;
// return HttpUtil.get(url, String.class);
// }
//
// /**
// * 用户根据商品ID购买秒杀商品
// */
// public static void buySeckill(SeckillOrderParam seckillOrderParam, String path) {
// String url = Constant.API_URL + "/p/seckill/" + path + "/confirm";
// HttpUtil.post(url, seckillOrderParam);
// }
//
// /**
// * 提交秒杀订单
// */
// public static OrderNumbersDto submitSeckillOrder(String path, SubmitSeckillOrderParam submitSeckillOrderParam) {
// String url = Constant.API_URL + "/p/seckill/" + path + "/submit";
// return HttpUtil.post(url, submitSeckillOrderParam, OrderNumbersDto.class);
// }
//}

View File

@ -0,0 +1,16 @@
//package com.tmerclub.cloud.systemtest.api.login;
//
//import com.yami.shop.security.common.dto.AuthenticationDTO;
//import com.yami.shop.security.common.vo.TokenInfoVO;
//import com.yami.shop.systemtest.constants.Constant;
//import com.yami.shop.systemtest.util.HttpUtil;
//
///**
// * @author lanhai
// */
//public class LoginApi {
// public static TokenInfoVO login(AuthenticationDTO authenticationDTO){
// String url = Constant.API_URL + "/login";
// return HttpUtil.post(url,authenticationDTO, TokenInfoVO.class,true);
// }
//}

View File

@ -0,0 +1,19 @@
package com.tmerclub.cloud.systemtest.api.login;
import com.tmerclub.cloud.api.user.vo.UserApiVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
/**
* @author lpj
*/
public class UserApi {
/**
* 获取用户信息
*/
public static UserApiVO getUserInfo() {
String url = Constant.API_URL + "/mall4cloud_user/user/ma/user_detail_info";
return HttpUtil.get(url, UserApiVO.class, UrlEnum.API);
}
}

View File

@ -0,0 +1,164 @@
package com.tmerclub.cloud.systemtest.api.marketing;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.platform.dto.OfflineHandleEventDTO;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.util.Json;
import com.tmerclub.cloud.coupon.dto.CouponDTO;
import com.tmerclub.cloud.coupon.vo.CouponAppVO;
import com.tmerclub.cloud.coupon.vo.CouponVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author lpj
*/
public class CouponApi {
/**
* 商家获取优惠券列表
*/
public static List<CouponVO> getShopCouponPage() {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon/page?pageSize=10&pageNum=1&couponName=&couponType=&getWay=";
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP)), PageVO.class).getList()), CouponVO.class);
}
/**
* 商家新建店铺优惠券
*/
public static void saveShopCoupon(CouponDTO couponDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon";
HttpUtil.post(url, couponDTO, UrlEnum.SHOP);
}
/**
* 商家获取优惠券信息
*/
public static CouponVO getShopCouponInfo(Long couponId) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon?couponId=" + couponId;
return HttpUtil.get(url, CouponVO.class, UrlEnum.SHOP);
}
/**
* 商家修改优惠券信息
*/
public static void updateShopCoupon(CouponDTO couponDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon";
HttpUtil.put(url, couponDTO, UrlEnum.SHOP);
}
/**
* 商家删除优惠券
*/
public static void deleteShopCoupon(Long couponId) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon?couponId=" + couponId;
HttpUtil.delete(url, UrlEnum.SHOP);
}
/**
* 平台违规下架活动
*/
public static void offline(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon/offline";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
/**
* 商家获取最新下架信息
*/
public static OfflineHandleEventVO shopGetOfflineHandleEvent(Long couponId) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon/get_offline_handle_event/" + couponId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.SHOP);
}
/**
* 商家申请上架提交审核
*/
public static void apply(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon/audit_apply";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.SHOP);
}
/**
* 平台获取最新下架信息
*/
public static OfflineHandleEventVO platformGetOfflineHandleEvent(Long couponId) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon/get_offline_handle_event/" + couponId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.PLATFORM);
}
/**
* 平台审核平台活动
*/
public static void audit(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon/audit";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
/**
* 平台获取平台优惠券列表
*/
public static List<CouponVO> getPlatformCouponPage() {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon/page?pageSize=10&pageNum=1&couponName=&couponType=&getWay=";
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.PLATFORM)), PageVO.class).getList()), CouponVO.class);
}
/**
* 平台新建平台优惠券
*/
public static void savePlatformCoupon(CouponDTO couponDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon";
HttpUtil.post(url, couponDTO, UrlEnum.PLATFORM);
}
/**
* 平台获取平台优惠券信息
*/
public static CouponVO getPlatformCouponInfo(Long couponId) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon?couponId=" + couponId;
return HttpUtil.get(url, CouponVO.class, UrlEnum.PLATFORM);
}
/**
* 平台修改平台优惠券信息
*/
public static void updatePlatformCoupon(CouponDTO couponDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon";
HttpUtil.put(url, couponDTO, UrlEnum.PLATFORM);
}
/**
* 平台删除平台优惠券
*/
public static void deletePlatformCoupon(Long couponId) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/coupon?couponId=" + couponId;
HttpUtil.delete(url, UrlEnum.PLATFORM);
}
/**
* 用户领取优惠券
*/
public static void receive(Long couponId) {
String url = Constant.API_URL + "/mall4cloud_marketing/my_coupon/receive";
HttpUtil.post(url, couponId, UrlEnum.API);
}
/**
* 用户获取优惠券列表
*/
public static List<CouponAppVO> getUserCouponPage() {
String url = Constant.API_URL + "/mall4cloud_marketing/my_coupon/get_page?pageSize=10&pageNum=1&status=1&type=0";
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.API)), PageVO.class).getList()), CouponAppVO.class);
}
/**
* 用户删除优惠券
*/
public static void deleteUserCoupon(Long couponUserId) {
String url = Constant.API_URL + "/mall4cloud_marketing/my_coupon/delete_coupon/" + couponUserId;
HttpUtil.delete(url, UrlEnum.API);
}
}

View File

@ -0,0 +1,103 @@
package com.tmerclub.cloud.systemtest.api.marketing;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.platform.dto.OfflineHandleEventDTO;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.tmerclub.cloud.api.vo.EsPageVO;
import com.tmerclub.cloud.common.product.vo.search.SpuAdminVO;
import com.tmerclub.cloud.common.util.Json;
import com.tmerclub.cloud.distribution.dto.DistributionSpuDTO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author lpj
*/
public class DistributionProdApi {
/**
* 获取分销商品列表
*/
public static List<SpuAdminVO> getDistributionProdPage(Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_search/mp/search/page_distribution_spu?pageSize=10&pageNum=1&distributionSpu=true&spuName=&distributionState=";
if(isMainShop) {
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, EsPageVO.class, UrlEnum.SHOP)), EsPageVO.class).getList()), SpuAdminVO.class);
} else {
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, EsPageVO.class, UrlEnum.SHOP_OTHER)), EsPageVO.class).getList()), SpuAdminVO.class);
}
}
/**
* 新增分销商品
*/
public static void save(DistributionSpuDTO distributionSpuDTO, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_marketing/m/distribution_spu";
if(isMainShop) {
HttpUtil.post(url, distributionSpuDTO, UrlEnum.SHOP);
} else {
HttpUtil.post(url, distributionSpuDTO, UrlEnum.SHOP_OTHER);
}
}
/**
* 修改分销商品
*/
public static void update(DistributionSpuDTO distributionSpuDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/m/distribution_spu";
HttpUtil.put(url, distributionSpuDTO, UrlEnum.SHOP);
}
/**
* 删除分销商品
*/
public static void delete(Long distributionSpuId, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_marketing/m/distribution_spu?distributionSpuId=" + distributionSpuId;
if(isMainShop) {
HttpUtil.delete(url, UrlEnum.SHOP);
} else {
HttpUtil.delete(url, UrlEnum.SHOP_OTHER);
}
}
/**
* 平台违规下架活动
*/
public static void offline(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/p/distribution_spu/offline";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
/**
* 商家获取最新下架信息
*/
public static OfflineHandleEventVO shopGetOfflineHandleEvent(Long distributionSpuId) {
String url = Constant.API_URL + "/mall4cloud_marketing/m/distribution_spu/get_offline_handle_event?distributionSpuId=" + distributionSpuId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.SHOP);
}
/**
* 商家申请上架提交审核
*/
public static void apply(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/m/distribution_spu/audit_apply";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.SHOP);
}
/**
* 平台获取最新下架信息
*/
public static OfflineHandleEventVO platformGetOfflineHandleEvent(Long distributionSpuId) {
String url = Constant.API_URL + "/mall4cloud_marketing/p/distribution_spu/get_offline_handle_event?distributionSpuId=" + distributionSpuId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.PLATFORM);
}
/**
* 平台审核平台活动
*/
public static void audit(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/p/distribution_spu/audit";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
}

View File

@ -0,0 +1,118 @@
package com.tmerclub.cloud.systemtest.api.marketing;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.platform.dto.OfflineHandleEventDTO;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.util.Json;
import com.tmerclub.cloud.seckill.dto.SeckillCategoryDTO;
import com.tmerclub.cloud.seckill.dto.SeckillDTO;
import com.tmerclub.cloud.seckill.model.SeckillCategory;
import com.tmerclub.cloud.seckill.vo.SeckillAdminVO;
import com.tmerclub.cloud.seckill.vo.SeckillSpuVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author lpj
*/
public class SeckillApi {
/**
* 平台新建秒杀分类
*/
public static void saveSeckillCategory(SeckillCategoryDTO seckillCategoryDTO) {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill_category";
HttpUtil.post(url, seckillCategoryDTO, UrlEnum.PLATFORM);
}
/**
* 获取秒杀分类列表
*/
public static List<SeckillCategory> getSeckillCategoryList() {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill_category/list";
return HttpUtil.get(url, List.class, UrlEnum.PLATFORM);
}
/**
* 删除秒杀分类
*/
public static void deleteSeckillCategory(Long categoryId) {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill_category?categoryId=" + categoryId;
HttpUtil.delete(url, UrlEnum.PLATFORM);
}
/**
* 获取可参加的秒杀列表
*/
public static List<SeckillAdminVO> getSeckillList() {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill/list_seckill?pageSize=10&pageNum=1&name=&type=0";
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP)), PageVO.class).getList()), SeckillAdminVO.class);
}
/**
* 新增秒杀活动
*/
public static void saveSeckill(SeckillDTO seckillDTO) {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill";
HttpUtil.post(url, seckillDTO, UrlEnum.SHOP);
}
/**
* 根据时间获取秒杀活动列表
*/
public static List<SeckillSpuVO> getSeckillSpuList(Long startTimestamps) {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill/list_seckill_spu_by_time?pageSize=10&pageNum=1&name=&startTimestamp=" + startTimestamps;
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP)), PageVO.class).getList()), SeckillSpuVO.class);
}
/**
* 失效秒杀活动
*/
public static void invalidSeckill(Long seckillId) {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill/invalid/" + seckillId;
HttpUtil.put(url, UrlEnum.SHOP);
}
/**
* 平台违规下架活动
*/
public static void offline(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill/offline";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
/**
* 商家获取最新下架信息
*/
public static OfflineHandleEventVO shopGetOfflineHandleEvent(Long seckillId) {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill/get_offline_handle_event/" + seckillId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.SHOP);
}
/**
* 商家申请上架提交审核
*/
public static void apply(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill/audit_apply";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.SHOP);
}
/**
* 平台获取最新下架信息
*/
public static OfflineHandleEventVO platformGetOfflineHandleEvent(Long seckillId) {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill/get_offline_handle_event/" + seckillId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.PLATFORM);
}
/**
* 平台审核活动
*/
public static void audit(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_seckill/mp/seckill/audit";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
}

View File

@ -0,0 +1,16 @@
package com.tmerclub.cloud.systemtest.api.order;
import com.tmerclub.cloud.product.dto.SpuCommDTO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
/**
* @author Tu
*/
public class CommentApi {
public static void addComment(SpuCommDTO spuCommDto) {
String url = Constant.API_URL+"/mall4cloud_product/spu_comm/comment";
HttpUtil.post(url,spuCommDto,UrlEnum.API);
}
}

View File

@ -0,0 +1,52 @@
package com.tmerclub.cloud.systemtest.api.order;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.vo.EsPageVO;
import com.tmerclub.cloud.common.order.vo.EsOrderRefundVO;
import com.tmerclub.cloud.common.util.Json;
import com.tmerclub.cloud.order.dto.multishop.OrderRefundDTO;
import com.tmerclub.cloud.order.vo.OrderRefundVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author Tu
*/
public class ShopOrderRefundApi {
/**
* 商家查询退款详情
*/
public static OrderRefundVO infoByRefundSn(Long refundId) {
String url = Constant.API_URL+"/mall4cloud_order/m/order_refund/info/"+refundId;
return HttpUtil.get(url,OrderRefundVO.class, UrlEnum.SHOP);
}
/**
* 商家处理退款订单
*/
public static void processRefundOrder(OrderRefundDTO orderRefundParam){
String url = Constant.API_URL+"/mall4cloud_order/m/order_refund/return_and_refund_audit";
HttpUtil.put(url,orderRefundParam,UrlEnum.SHOP);
}
/**
* 商家处理退货退款订单
*/
public static void returnMoney(OrderRefundDTO orderRefundParam){
String url = Constant.API_URL+"/mall4cloud_order/m/order_refund/return_money";
HttpUtil.put(url, orderRefundParam, UrlEnum.SHOP);
}
/**
* 根据订单号查询退款记录
*/
public static List<EsOrderRefundVO> getEsOrderRefundVO(Long orderId) {
String url = Constant.API_URL + "/mall4cloud_search/mp/search/order_refund/page?pageSize=10&pageNum=1&orderId=" + orderId + "&returnMoneySts=&refundId=&orderType=&applyType=&refundType=&beginTime=&endTime=";
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, EsPageVO.class, UrlEnum.SHOP)), EsPageVO.class).getList()), EsOrderRefundVO.class);
}
}

View File

@ -0,0 +1,16 @@
package com.tmerclub.cloud.systemtest.api.order;
import com.moyuer.cloud.delivery.dto.StationDTO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
/**
* @author Tu
*/
public class ShopStationApi {
public static void addStation(StationDTO stationDTO){
String url = Constant.API_URL+"/mall4cloud_order/m/station";
HttpUtil.post(url,stationDTO, UrlEnum.SHOP);
}
}

View File

@ -0,0 +1,52 @@
package com.tmerclub.cloud.systemtest.api.platform;
import com.tmerclub.cloud.api.platform.dto.OfflineHandleEventDTO;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
/**
* @author lpj
*/
public class PlatformProductApi {
/**
* 平台违规下架商品
*/
public static void offline(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu/batch_offline";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
/**
* 平台获取最新下架信息
*/
public static OfflineHandleEventVO platformGetOfflineHandleEvent(Long productId) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu/get_offline_handle_event/" + productId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.PLATFORM);
}
/**
* 平台审核平台活动
*/
public static void audit(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu/audit";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
/**
* 平台置顶商品
*/
public static void toTop(Long productId) {
String url = Constant.API_URL + "/mall4cloud_product/p/spu/to_top?spuId=" + productId;
HttpUtil.put(url, UrlEnum.PLATFORM);
}
/**
* 平台删除商品
*/
public static void platformDeleteProduct(Long productId) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu?spuId=" + productId;
HttpUtil.delete(url, UrlEnum.PLATFORM);
}
}

View File

@ -0,0 +1,28 @@
package com.tmerclub.cloud.systemtest.api.platform;
import com.tmerclub.cloud.platform.dto.ScoreConfigDTO;
import com.tmerclub.cloud.platform.vo.ScoreConfigVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
/**
* @author lpj
*/
public class ScoreConfigApi {
/**
* 获取积分配置详情
*/
public static ScoreConfigVO info() {
String url = Constant.API_URL + "/mall4cloud_admin/p/score_config/info/SCORE_CONFIG";
return HttpUtil.get(url, ScoreConfigVO.class, UrlEnum.PLATFORM);
}
/**
* 更新积分配置
*/
public static void update(ScoreConfigDTO scoreConfigDTO) {
String url = Constant.API_URL + "/mall4cloud_admin/p/score_config";
HttpUtil.post(url, scoreConfigDTO, UrlEnum.PLATFORM);
}
}

View File

@ -0,0 +1,36 @@
package com.tmerclub.cloud.systemtest.api.platform;
import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderDTO;
import com.tmerclub.cloud.api.delivery.vo.DeliveryOrderFeignVO;
import com.tmerclub.cloud.common.order.vo.OrderVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author lpj
*/
public class ScoreOrderApi {
public static OrderVO getScoreOrderItemAndAddress(Long orderNumber){
String url = Constant.API_URL+"/mall4cloud_order/mp/order/order_item_and_address/"+orderNumber;
return HttpUtil.get(url, OrderVO.class, UrlEnum.PLATFORM);
}
public static void scoreOrderDelivery(DeliveryOrderDTO deliveryOrderParam){
String url = Constant.API_URL + "/mall4cloud_order/mp/order/delivery";
HttpUtil.post(url,deliveryOrderParam,UrlEnum.PLATFORM);
}
public static List<DeliveryOrderFeignVO> infoOrderDelivery(Long orderNumber){
String url = Constant.API_URL+"/mall4cloud_order/mp/order_delivery/info?orderId="+orderNumber;
List<DeliveryOrderFeignVO> deliveryOrderFeignVos = HttpUtil.get(url, List.class,UrlEnum.PLATFORM);
return deliveryOrderFeignVos;
}
public static void updateOrderDelivery(List<DeliveryOrderDTO> list){
String url = Constant.API_URL + "/mall4cloud_order/mp/order_delivery/update";
HttpUtil.put(url,list,UrlEnum.PLATFORM);
}
}

View File

@ -0,0 +1,12 @@
package com.tmerclub.cloud.systemtest.api.store;
/**
* @author lanhai
*/
public class ShopApi {
// public static ShopDetail info(Boolean useMainShop){
// String url = Constant.SHOP_URL + "/shop/shopDetail/info";
// return HttpUtil.get(url, ShopDetail.class, useMainShop);
// }
}

View File

@ -0,0 +1,25 @@
package com.tmerclub.cloud.systemtest.api.store;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.multishop.vo.ShopRefundAddrVO;
import com.tmerclub.cloud.multishop.dto.ShopRefundAddrDTO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author Tu
*/
public class ShopRefundAddrApi {
public static Long addShopRefundAddr(ShopRefundAddrDTO shopRefundAddrDTO){
String url = Constant.API_URL +"/mall4cloud_admin/mp/shop_refund_addr";
return JSON.parseArray(JSON.toJSONString(HttpUtil.post(url,shopRefundAddrDTO, UrlEnum.SHOP,Long.class)),Long.class).get(0);
}
public static List<ShopRefundAddrVO> listShopRefundAddr(){
String url = Constant.API_URL +"/mall4cloud_admin/mp/shop_refund_addr/list";
return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url,List.class, UrlEnum.SHOP)),ShopRefundAddrVO.class);
}
}

View File

@ -0,0 +1,32 @@
package com.tmerclub.cloud.systemtest.api.store;
import com.tmerclub.cloud.common.vo.ShopSubstituteSalesVO;
import com.tmerclub.cloud.multishop.dto.ShopSubstituteSalesDTO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
/**
* @author lpj
*/
public class ShopSubstituteSalesApi {
/**
* 获取代销设置详情
*/
public static ShopSubstituteSalesVO getShopSubstituteSales() {
String url = Constant.API_URL + "/mall4cloud_admin/m/shop_substitute_sales";
return HttpUtil.get(url, ShopSubstituteSalesVO.class, UrlEnum.SHOP);
}
/**
* 修改代销设置
*/
public static void updateShopSubstituteSales(ShopSubstituteSalesDTO shopSubstituteSalesDTO, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_admin/m/shop_substitute_sales";
if(isMainShop) {
HttpUtil.put(url, shopSubstituteSalesDTO, UrlEnum.SHOP);
} else {
HttpUtil.put(url, shopSubstituteSalesDTO, UrlEnum.SHOP_OTHER);
}
}
}

View File

@ -0,0 +1,22 @@
package com.tmerclub.cloud.systemtest.api.store;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.common.product.vo.SkuVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author Tu
*/
public class SkuApi {
public static List<SkuVO> getAllSkuList(Long prodId){
String url = Constant.API_URL + "/mall4cloud_product/m/sku/get_all_skuList?prodId="+prodId;
List list = HttpUtil.get(url, List.class, UrlEnum.SHOP);
List<SkuVO> skuList = JSON.parseArray(JSON.toJSONString(list), SkuVO.class);
return skuList;
}
}

View File

@ -0,0 +1,106 @@
package com.tmerclub.cloud.systemtest.api.store;
import com.alibaba.fastjson2.JSON;
import com.moyuer.cloud.delivery.dto.TransportDTO;
import com.moyuer.cloud.delivery.vo.TransportVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author Tu
*/
public class TransportApi {
public static void addTransport(TransportDTO transportDTO, Boolean isMainShop){
String url = Constant.API_URL + "/mall4cloud_order/mp/transport";
if(isMainShop) {
HttpUtil.post(url, transportDTO, UrlEnum.SHOP);
} else {
HttpUtil.post(url, transportDTO, UrlEnum.SHOP_OTHER);
}
}
public static List<TransportVO> infoTransport(Boolean isMainShop){
String url = Constant.API_URL + "/mall4cloud_order/mp/transport/page?pageSize=50&pageNum=1&transName=";
if(isMainShop) {
return JSON.parseArray(HttpUtil.gets(url, UrlEnum.SHOP), TransportVO.class);
} else {
return JSON.parseArray(HttpUtil.gets(url, UrlEnum.SHOP_OTHER), TransportVO.class);
}
}
public static TransportVO info(Long transportId, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_order/mp/transport?transportId=" + transportId;
if(isMainShop) {
return HttpUtil.get(url, TransportVO.class, UrlEnum.SHOP);
} else {
return HttpUtil.get(url, TransportVO.class, UrlEnum.SHOP_OTHER);
}
}
public static void update(TransportDTO transportDTO, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_order/mp/transport";
if(isMainShop) {
HttpUtil.put(url, transportDTO, UrlEnum.SHOP);
} else {
HttpUtil.put(url, transportDTO, UrlEnum.SHOP_OTHER);
}
}
public static void deleteTransport(Long transportId, Boolean isMainShop){
String url = Constant.API_URL + "/mall4cloud_order/mp/transport?transportIds="+transportId;
if(isMainShop) {
HttpUtil.delete(url,UrlEnum.SHOP);
} else {
HttpUtil.delete(url,UrlEnum.SHOP_OTHER);
}
}
public static List<TransportVO> supplierTransportPage(Boolean isMainSupplier){
String url = Constant.API_URL + "/mall4cloud_order/mp/transport/page?pageSize=50&pageNum=1&transName=";
if(isMainSupplier) {
return JSON.parseArray(HttpUtil.gets(url,UrlEnum.SUPPLIER), TransportVO.class);
} else {
return JSON.parseArray(HttpUtil.gets(url,UrlEnum.SUPPLIER_OTHER), TransportVO.class);
}
}
public static void addSupplierTransport(TransportDTO transportDTO, Boolean isMainSupplier){
String url = Constant.API_URL + "/mall4cloud_order/mp/transport";
if(isMainSupplier) {
HttpUtil.post(url,transportDTO, UrlEnum.SUPPLIER);
} else {
HttpUtil.post(url,transportDTO, UrlEnum.SUPPLIER_OTHER);
}
}
public static TransportVO infoSupplierTransport(Long transportId, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_order/mp/transport?transportId=" + transportId;
if(isMainShop) {
return HttpUtil.get(url, TransportVO.class, UrlEnum.SHOP);
} else {
return HttpUtil.get(url, TransportVO.class, UrlEnum.SHOP_OTHER);
}
}
public static void updateSupplierTransport(TransportDTO transportDTO, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_order/mp/transport";
if(isMainShop) {
HttpUtil.put(url, transportDTO, UrlEnum.SHOP);
} else {
HttpUtil.put(url, transportDTO, UrlEnum.SHOP_OTHER);
}
}
public static void deleteSupplierTransport(Long transportId, Boolean isMainSupplier){
String url = Constant.API_URL + "/mall4cloud_order/mp/transport?transportIds="+transportId;
if(isMainSupplier) {
HttpUtil.delete(url,UrlEnum.SUPPLIER);
} else {
HttpUtil.delete(url,UrlEnum.SUPPLIER_OTHER);
}
}
}

View File

@ -0,0 +1,25 @@
package com.tmerclub.cloud.systemtest.api.supplier;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.supplier.vo.SupplierApiRefundAddrVO;
import com.tmerclub.cloud.supplier.dto.SupplierRefundAddrDTO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author Tu
*/
public class SupplierRefundAddrApi {
public static Long addSupplierRefundAddr(SupplierRefundAddrDTO supplierRefundAddrDTO){
String url = Constant.API_URL +"/mall4cloud_admin/mp/supplier_refund_addr";
return JSON.parseArray(JSON.toJSONString(HttpUtil.post(url,supplierRefundAddrDTO, UrlEnum.SUPPLIER,Long.class)),Long.class).get(0);
}
public static List<SupplierApiRefundAddrVO> listSupplierRefundAddr(){
String url = Constant.API_URL +"/mall4cloud_admin/mp/supplier_refund_addr/list";
return JSON.parseArray(JSON.toJSONString(HttpUtil.get(url,List.class, UrlEnum.SUPPLIER)),SupplierApiRefundAddrVO.class);
}
}

View File

@ -0,0 +1,24 @@
package com.tmerclub.cloud.systemtest.api.supplier;
import com.tmerclub.cloud.order.dto.multishop.OrderRefundDTO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
/**
* @author Tu
*/
public class SupplierRefundApi {
public static void processRefundOrder(OrderRefundDTO orderRefundParam){
String url = Constant.API_URL+"/mall4cloud_order/s/order_refund/return_and_refund_audit";
HttpUtil.put(url,orderRefundParam, UrlEnum.SUPPLIER);
}
/**
* 拒绝退货退款
* */
public static void returnMoneyRefundOrder(OrderRefundDTO orderRefundParam){
String url = Constant.API_URL+"/mall4cloud_order/s/order_refund/return_money";
HttpUtil.put(url,orderRefundParam, UrlEnum.SUPPLIER);
}
}

View File

@ -0,0 +1,22 @@
package com.tmerclub.cloud.systemtest.constants;
/**
* @author Tu
*/
public class Constant {
public static final String API_URL = "https://192.0.0.27:8080";
public static final String PLATFORM_TOKEN = "b5ed912d-fdc9-4527-bea0-99946e2095cc";
public static final String SUPPLIER_TOKEN = "54134940-57b6-4068-a180-5a27d23a4adf";
public static final String OTHER_SUPPLIER_TOKEN = "e6a331c0-75b6-42af-813c-fdfca9605efd";
public static final String SHOP_TOKEN = "4ff287e9-cc42-4313-a50e-3136e6f12c84";
public static final String OTHER_SHOP_TOKEN = "5f975b86-c89a-4dba-8425-0e5ddf3479a4";
public static String API_TOKEN = "42567b93-292e-40a0-b0a3-ac143e354889";
public static String OTHER_API_TOKEN = "8d8479b1-7db6-4b14-99d7-7bd04e151eab";
public static String STATION_TOKEN = "d831dfda-201d-4210-afb1-6c16038f8428";
}

View File

@ -0,0 +1,145 @@
package com.tmerclub.cloud.systemtest.data.amount;
import com.tmerclub.cloud.common.order.bo.DeliveryModeBO;
import com.tmerclub.cloud.common.product.dto.SkuDTO;
import com.tmerclub.cloud.common.product.dto.SpuDTO;
import com.tmerclub.cloud.common.product.dto.SpuLangDTO;
import com.tmerclub.cloud.common.util.Json;
import java.util.ArrayList;
import java.util.List;
/**
* @author Tu
*/
public class SpuData {
public static SpuDTO getRealSpu(Long categoryId,Long shopCategoryId,Long deliveryTemplateId,Long priceFee){
SpuDTO spuDTO = new SpuDTO();
spuDTO.setCategoryId(categoryId);
spuDTO.setShopCategoryId(shopCategoryId);
spuDTO.setName("接口自动化实物商品");
spuDTO.setSellingPoint("商品卖点");
spuDTO.setDetail("测试商品详情");
spuDTO.setDeliveryTemplateId(deliveryTemplateId);
spuDTO.setMainImgUrl("/test.png");
spuDTO.setImgUrls("/test.png");
spuDTO.setMarketPriceFee(88L);
spuDTO.setPriceFee(priceFee);
spuDTO.setHasSkuImg(0);
spuDTO.setSkuList(getSkuList(priceFee));
spuDTO.setSupplierSpuType(0);
List<SpuLangDTO> spuLangDTOList = new ArrayList<>();
SpuLangDTO spuLangDTO = new SpuLangDTO();
spuLangDTO.setLang(1);
spuLangDTO.setSpuName("接口自动化实物商品");
spuLangDTOList.add(spuLangDTO);
spuDTO.setSpuLangList(spuLangDTOList);
spuDTO.setTotalStock(100);
DeliveryModeBO deliveryModeBO = new DeliveryModeBO();
deliveryModeBO.setHasShopDelivery(true);
deliveryModeBO.setHasUserPickUp(true);
deliveryModeBO.setHasCityDelivery(true);
spuDTO.setDeliveryMode(Json.toJsonString(deliveryModeBO));
spuDTO.setSpuMold(0);
spuDTO.setPreSaleType(-1);
spuDTO.setSpuOrigin(0);
return spuDTO;
}
public static SpuDTO getUnRealSpu(Long categoryId,Long shopCategoryId,Long priceFee,Integer writeOffNum){
SpuDTO spuDTO = new SpuDTO();
spuDTO.setCategoryId(categoryId);
spuDTO.setShopCategoryId(shopCategoryId);
spuDTO.setName("接口自动化虚拟商品");
spuDTO.setSellingPoint("虚拟商品卖点");
spuDTO.setDetail("虚拟测试商品详情");
spuDTO.setMainImgUrl("/test.png");
spuDTO.setImgUrls("/test.png");
spuDTO.setMarketPriceFee(88L);
spuDTO.setPriceFee(priceFee);
spuDTO.setHasSkuImg(0);
spuDTO.setSkuList(getSkuList(priceFee));
spuDTO.setSpuMold(1);
spuDTO.setIsRefund(1);
spuDTO.setPreSaleType(-1);
spuDTO.setSpuOrigin(0);
List<SpuLangDTO> spuLangDTOList = new ArrayList<>();
SpuLangDTO spuLangDTO = new SpuLangDTO();
spuLangDTO.setLang(1);
spuLangDTO.setSpuName("接口自动化虚拟商品");
spuLangDTOList.add(spuLangDTO);
spuDTO.setSpuLangList(spuLangDTOList);
spuDTO.setSkuList(getSkuList(priceFee));
spuDTO.setTotalStock(100);
DeliveryModeBO deliveryModeBO = new DeliveryModeBO();
deliveryModeBO.setHasShopDelivery(false);
deliveryModeBO.setHasUserPickUp(false);
deliveryModeBO.setHasCityDelivery(false);
spuDTO.setDeliveryMode(Json.toJsonString(deliveryModeBO));
spuDTO.setDeliveryTemplateId(null);
spuDTO.setWriteOffNum(writeOffNum);
int writeOffMultipleCount = 3;
if(writeOffNum == -1){spuDTO.setWriteOffMultipleCount(writeOffMultipleCount);}
if(writeOffNum != 0){spuDTO.setWriteOffTime(-1);}
return spuDTO;
}
public static SpuDTO getSupplierSpu(Long categoryId,Long deliveryTemplateId,Long priceFee){
SpuDTO spuDTO = new SpuDTO();
spuDTO.setCategoryId(categoryId);
spuDTO.setName("供应商商品-接口自动化");
spuDTO.setSellingPoint("商品卖点");
spuDTO.setDetail("测试商品详情-供应商");
spuDTO.setDeliveryTemplateId(deliveryTemplateId);
spuDTO.setMainImgUrl("/test.png");
spuDTO.setImgUrls("/test.png");
spuDTO.setMarketPriceFee(88L);
spuDTO.setPriceFee(priceFee);
spuDTO.setHasSkuImg(0);
spuDTO.setSkuList(getSkuList(priceFee));
spuDTO.setSupplierSpuType(0);
List<SpuLangDTO> spuLangDTOList = new ArrayList<>();
SpuLangDTO spuLangDTO = new SpuLangDTO();
spuLangDTO.setLang(1);
spuLangDTO.setSpuName("供应商商品-接口自动化");
spuLangDTOList.add(spuLangDTO);
spuDTO.setSpuLangList(spuLangDTOList);
spuDTO.setTotalStock(100);
DeliveryModeBO deliveryModeBO = new DeliveryModeBO();
deliveryModeBO.setHasShopDelivery(true);
deliveryModeBO.setHasUserPickUp(true);
deliveryModeBO.setHasCityDelivery(true);
spuDTO.setDeliveryMode(Json.toJsonString(deliveryModeBO));
spuDTO.setSpuMold(0);
spuDTO.setPreSaleType(-1);
spuDTO.setSpuOrigin(0);
return spuDTO;
}
public static List<SkuDTO> getSkuList(Long priceFee){
List<SkuDTO> skuList = new ArrayList<>();
SkuDTO skuDTO = new SkuDTO();
skuDTO.setChangeStock(100);
skuDTO.setPriceFee(priceFee);
skuDTO.setMarketPriceFee(88L);
skuDTO.setStock(100);
skuDTO.setStatus(1);
skuDTO.setWeight(1.0);
skuDTO.setVolume(1.0);
skuList.add(skuDTO);
return skuList;
}
}

View File

@ -0,0 +1,64 @@
package com.tmerclub.cloud.systemtest.data.amount;
import com.moyuer.cloud.systemtest.api.amount.AddrApi;
import com.tmerclub.cloud.user.dto.UserAddrDTO;
/**
* @author lpj
*/
public class UserAddrDtoData {
public static UserAddrDTO getUserAddrDTO() {
UserAddrDTO userAddrDTO = new UserAddrDTO();
userAddrDTO.setAddr("清河东路319号");
userAddrDTO.setAddrId(0L);
userAddrDTO.setArea("荔湾区");
userAddrDTO.setAreaId(440103L);
userAddrDTO.setCity("广州市");
userAddrDTO.setCityId(4401L);
userAddrDTO.setConsignee("用户");
userAddrDTO.setIsDefault(1);
userAddrDTO.setLat(22.93772);
userAddrDTO.setLng(113.39424);
userAddrDTO.setMobile("19800000001");
userAddrDTO.setProvince("广东省");
userAddrDTO.setProvinceId(44L);
return userAddrDTO;
}
public static UserAddrDTO getUpdateUserAddrDTO(Long addrId) {
UserAddrDTO userAddrDTO = new UserAddrDTO();
userAddrDTO.setAddr("清河东路319号");
userAddrDTO.setAddrId(addrId);
userAddrDTO.setArea("荔湾区");
userAddrDTO.setAreaId(440103L);
userAddrDTO.setCity("广州市");
userAddrDTO.setCityId(4401L);
userAddrDTO.setConsignee("用户");
userAddrDTO.setIsDefault(1);
userAddrDTO.setLat(22.93772);
userAddrDTO.setLng(113.39424);
userAddrDTO.setMobile("19800000001");
userAddrDTO.setProvince("广东省");
userAddrDTO.setProvinceId(44L);
return userAddrDTO;
}
public static UserAddrDTO getUpdataUserAddrDTO() {
UserAddrDTO userAddrDTO = new UserAddrDTO();
userAddrDTO.setAddr("修改后的地址");
userAddrDTO.setAddrId(AddrApi.dvyList().get(0).getAddrId());
userAddrDTO.setArea("荔湾区");
userAddrDTO.setAreaId(440103L);
userAddrDTO.setIsDefault(1);
userAddrDTO.setLat(22.93772);
userAddrDTO.setLng(113.39424);
userAddrDTO.setMobile("19800000001");
userAddrDTO.setProvince("广东省");
userAddrDTO.setCity("广州市");
userAddrDTO.setCityId(4401L);
userAddrDTO.setConsignee("用户");
userAddrDTO.setProvinceId(44L);
return userAddrDTO;
}
}

View File

@ -0,0 +1,156 @@
package com.tmerclub.cloud.systemtest.data.marketing;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.tmerclub.cloud.combo.vo.ComboVO;
import com.tmerclub.cloud.common.order.dto.DvyTypeDTO;
import com.tmerclub.cloud.common.order.dto.OrderDTO;
import com.tmerclub.cloud.common.order.dto.ShopCartItemDTO;
import com.tmerclub.cloud.common.product.dto.CartComboMatchSpuDTO;
import com.tmerclub.cloud.common.product.dto.ComboDTO;
import com.tmerclub.cloud.common.product.vo.ComboSpuSkuVO;
import com.tmerclub.cloud.common.product.vo.ComboSpuVO;
import com.tmerclub.cloud.common.product.vo.SkuVO;
import com.tmerclub.cloud.common.product.vo.SpuVO;
import com.tmerclub.cloud.common.util.Arith;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.marketing.ComboApi;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author lpj
*/
public class ComboData {
/**
* 新增套餐数据
*/
public static ComboDTO getComboDTO(Long mainSpuId, List<Long> matchingSpuIds) {
ComboDTO comboDTO = new ComboDTO();
comboDTO.setName("测试套餐");
comboDTO.setStartTime(DateUtil.parse("2023-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
comboDTO.setEndTime(DateUtil.parse("2026-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
comboDTO.setMainSpu(getComboMainSpu(mainSpuId));
comboDTO.setMatchingSpus(getMatchingComboSpu(matchingSpuIds));
return comboDTO;
}
private static ComboSpuVO getComboMainSpu(Long mainSpuId) {
ComboSpuVO mainSpu = new ComboSpuVO();
SpuVO spu = ProductApi.info(mainSpuId, true);
mainSpu.setSpuId(spu.getSpuId());
mainSpu.setComboPrice(6600L);
mainSpu.setSpuName(spu.getName());
mainSpu.setSpuStatus(spu.getStatus());
mainSpu.setLeastNum(2);
mainSpu.setPic("/test.png");
mainSpu.setRequired(0);
List<SkuVO> skuList = spu.getSkus();
List<ComboSpuSkuVO> comboSpuSkuVOList = skuList.stream().map(i -> BeanUtil.copyProperties(i, ComboSpuSkuVO.class)).collect(Collectors.toList());
comboSpuSkuVOList.forEach(i->i.setMatchingPrice(6600L));
mainSpu.setSkuList(comboSpuSkuVOList);
return mainSpu;
}
private static List<ComboSpuVO> getMatchingComboSpu(List<Long> matchingSpuIds) {
List<ComboSpuVO> matchingSpus = new ArrayList<>();
for (Long matchingSpuId : matchingSpuIds) {
ComboSpuVO matchingSpu = new ComboSpuVO();
SpuVO spu = ProductApi.info(matchingSpuId, true);
matchingSpu.setSpuId(spu.getSpuId());
matchingSpu.setComboPrice(6600L);
matchingSpu.setSpuName(spu.getName());
matchingSpu.setSpuStatus(spu.getStatus());
matchingSpu.setLeastNum(2);
matchingSpu.setPic("/test.png");
matchingSpu.setRequired(0);
List<SkuVO> skuList = spu.getSkus();
List<ComboSpuSkuVO> comboSpuSkuVOList = skuList.stream().map(i -> BeanUtil.copyProperties(i, ComboSpuSkuVO.class)).collect(Collectors.toList());
comboSpuSkuVOList.forEach(i->i.setMatchingPrice(6600L));
matchingSpu.setSkuList(comboSpuSkuVOList);
matchingSpus.add(matchingSpu);
}
return matchingSpus;
}
/**
* 修改套餐状态数据
*/
public static ComboDTO getUpdateStatusData(Long comboId, Integer status) {
ComboDTO comboDTO = new ComboDTO();
comboDTO.setComboId(comboId);
comboDTO.setStatus(status);
return comboDTO;
}
/**
* 修改套餐数据
*/
public static ComboDTO getUpdateComboDTO(ComboVO comboVO) {
ComboDTO comboDTO = new ComboDTO();
BeanUtils.copyProperties(comboVO, comboDTO);
ComboSpuVO mainSpu = new ComboSpuVO();
BeanUtils.copyProperties(comboVO.getMainSpu(), mainSpu);
List<ComboSpuSkuVO> comboSpuSkuVOList = comboVO.getMainSpu().getSkuList().stream().map(i -> BeanUtil.copyProperties(i, ComboSpuSkuVO.class)).collect(Collectors.toList());
mainSpu.setSkuList(comboSpuSkuVOList);
comboDTO.setMainSpu(mainSpu);
comboDTO.setMatchingSpus(new ArrayList<>());
return comboDTO;
}
/**
* 套餐下单数据
*/
public static OrderDTO getComboOrderDTO(Long comboId,Integer comboCount) {
OrderDTO orderDTO = new OrderDTO();
ComboVO combo = ComboApi.getComboInfo(comboId);
orderDTO.setAddrId(0L);
orderDTO.setCouponIds(new ArrayList<>());
DvyTypeDTO dvyTypeDTO = new DvyTypeDTO();
dvyTypeDTO.setDvyType(1);
dvyTypeDTO.setShopId(combo.getShopId());
ArrayList<DvyTypeDTO> dvyTypeDTOList = new ArrayList<>();
dvyTypeDTOList.add(dvyTypeDTO);
orderDTO.setDvyTypes(dvyTypeDTOList);
orderDTO.setIsScorePay(0);
orderDTO.setUserChangeCoupon(0);
orderDTO.setUserUseScore(0L);
ShopCartItemDTO shopCartItemDTO = new ShopCartItemDTO();
shopCartItemDTO.setComboId(comboId);
shopCartItemDTO.setComboMainLeastNum(combo.getMainSpu().getLeastNum());
shopCartItemDTO.setComboCount(comboCount);
shopCartItemDTO.setCount(comboCount);
shopCartItemDTO.setShopId(combo.getShopId());
shopCartItemDTO.setSkuId(combo.getMainSpu().getSkuList().get(0).getSkuId());
shopCartItemDTO.setSpuId(combo.getMainSpuId());
List<CartComboMatchSpuDTO> cartComboMatchSpuDTOList = new ArrayList<>();
for (com.tmerclub.cloud.combo.vo.ComboSpuVO comboSpuVO: combo.getMatchingSpus()) {
CartComboMatchSpuDTO cartComboMatchSpuDTO = new CartComboMatchSpuDTO();
cartComboMatchSpuDTO.setCount((int) Arith.mul(comboSpuVO.getLeastNum(), comboCount));
cartComboMatchSpuDTO.setSkuId(comboSpuVO.getSkuList().get(0).getSkuId());
cartComboMatchSpuDTO.setSpuId(comboSpuVO.getSpuId());
cartComboMatchSpuDTOList.add(cartComboMatchSpuDTO);
}
shopCartItemDTO.setCartComboMatchSpuDTOS(cartComboMatchSpuDTOList);
orderDTO.setShopCartItem(shopCartItemDTO);
return orderDTO;
}
}

View File

@ -0,0 +1,66 @@
package com.tmerclub.cloud.systemtest.data.marketing;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.tmerclub.cloud.discount.dto.DiscountDTO;
import com.tmerclub.cloud.discount.dto.DiscountItemDTO;
import com.tmerclub.cloud.discount.vo.DiscountItemVO;
import com.tmerclub.cloud.discount.vo.DiscountVO;
import org.springframework.beans.BeanUtils;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author lpj
*/
public class DiscountData {
/**
* 满减数据
*/
public static DiscountDTO getDiscount(Integer discountRule, Integer discountType, List<DiscountItemDTO> discountItemDTOList, Long maxReduceAmount, Integer suitableSpuType, List<Long> spuIds, Integer status) {
DiscountDTO discountDTO = new DiscountDTO();
discountDTO.setDiscountId(0L);
discountDTO.setDiscountName("测试满减活动");
discountDTO.setDiscountRule(discountRule);
discountDTO.setDiscountType(discountType);
discountDTO.setStartTime(DateUtil.parse("2023-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
discountDTO.setEndTime(DateUtil.parse("2026-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
discountDTO.setDiscountItemList(discountItemDTOList);
discountDTO.setMaxReduceAmount(maxReduceAmount);
discountDTO.setMobilePic("test.png");
discountDTO.setPcBackgroundPic("test.png");
discountDTO.setPcPic("test.png");
discountDTO.setShopId(null);
discountDTO.setSuitableSpuType(suitableSpuType);
discountDTO.setSpuIds(spuIds);
discountDTO.setStatus(status);
return discountDTO;
}
/**
* 满减层级数据
*/
public static DiscountItemDTO getDiscountItemDTO(Long needAmount, Long discount) {
DiscountItemDTO discountItemDTO = new DiscountItemDTO();
discountItemDTO.setNeedAmount(needAmount);
discountItemDTO.setDiscount(discount);
return discountItemDTO;
}
/**
* 修改后的满减数据
*/
public static DiscountDTO getUpdateDiscountDTO(DiscountVO discountVO) {
DiscountDTO discountDTO = new DiscountDTO();
BeanUtils.copyProperties(discountVO, discountDTO);
List<DiscountItemVO> discountItemVOList = discountVO.getDiscountItemList();
List<DiscountItemDTO> discountItemDTOList = discountItemVOList.stream().map(i -> BeanUtil.copyProperties(i, DiscountItemDTO.class)).collect(Collectors.toList());
discountDTO.setDiscountItemList(discountItemDTOList);
discountDTO.setDiscountName("修改后的满减活动");
return discountDTO;
}
}

View File

@ -0,0 +1,37 @@
package com.tmerclub.cloud.systemtest.data.marketing;
import com.tmerclub.cloud.api.distribution.vo.DistributionSpuVO;
import com.tmerclub.cloud.distribution.dto.DistributionSpuDTO;
import org.springframework.beans.BeanUtils;
/**
* @author lpj
*/
public class DistributionProdData {
/**
* 新增分销商品数据
*/
public static DistributionSpuDTO getDistributionSpuDTO(Long productId, Integer awardMode, Long awardNumbers, Integer parentAwardSet, Long parentAwardNumbers, Integer state) {
DistributionSpuDTO distributionSpuDTO = new DistributionSpuDTO();
distributionSpuDTO.setDistributionSpuId(0L);
distributionSpuDTO.setSpuId(productId);
distributionSpuDTO.setAwardMode(awardMode);
distributionSpuDTO.setAwardNumbers(awardNumbers);
distributionSpuDTO.setParentAwardSet(parentAwardSet);
distributionSpuDTO.setParentAwardNumbers(parentAwardNumbers);
distributionSpuDTO.setState(state);
return distributionSpuDTO;
}
/**
* 修改分销商品数据
*/
public static DistributionSpuDTO getUpdateDistributionSpuDTO(DistributionSpuVO distributionSpuVO) {
DistributionSpuDTO distributionSpuDTO = new DistributionSpuDTO();
BeanUtils.copyProperties(distributionSpuVO, distributionSpuDTO);
//切换为按固定数值奖励
distributionSpuDTO.setAwardMode(1);
return distributionSpuDTO;
}
}

View File

@ -0,0 +1,68 @@
package com.tmerclub.cloud.systemtest.data.marketing;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.tmerclub.cloud.common.product.vo.GiveawayVO;
import com.tmerclub.cloud.common.product.vo.SpuVO;
import com.tmerclub.cloud.product.dto.GiveawayDTO;
import com.tmerclub.cloud.product.dto.GiveawaySpuDTO;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author lpj
*/
public class GiveawayData {
/**
* 新增赠品数据
*/
public static GiveawayDTO getGiveawayDTO(Long mainProductId, List<Long> matchingProductIds) {
GiveawayDTO giveawayDTO = new GiveawayDTO();
giveawayDTO.setName("测试赠品活动");
giveawayDTO.setStartTime(DateUtil.parse("2023-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
giveawayDTO.setEndTime(DateUtil.parse("2026-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
giveawayDTO.setStatus(1);
giveawayDTO.setSpuId(mainProductId);
giveawayDTO.setBuyNum(3);
giveawayDTO.setGiveawaySpuDTOs(getGiveawaySpuDTO(matchingProductIds));
return giveawayDTO;
}
private static List<GiveawaySpuDTO> getGiveawaySpuDTO(List<Long> matchingProductIds) {
List<GiveawaySpuDTO> giveawaySpuDTOList = new ArrayList<>();
for (Long matchingProductId : matchingProductIds) {
GiveawaySpuDTO giveawaySpuDTO = new GiveawaySpuDTO();
SpuVO spu = ProductApi.info(matchingProductId, true);
giveawaySpuDTO.setSpuId(spu.getSpuId());
giveawaySpuDTO.setSpuName(spu.getName());
giveawaySpuDTO.setRefundPrice(1100L);
giveawaySpuDTO.setGiveawayNum(1);
for (int i=0; i<spu.getSkus().size(); i++) {
giveawaySpuDTO.setSkuId(spu.getSkus().get(i).getSkuId());
giveawaySpuDTO.setSkuName(spu.getSkus().get(i).getSkuName());
giveawaySpuDTOList.add(giveawaySpuDTO);
}
}
return giveawaySpuDTOList;
}
/**
* 修改赠品活动数据修改购买数量条件为5
*/
public static GiveawayDTO getUpdateGiveawayDTO(GiveawayVO giveawayVO) {
GiveawayDTO giveawayDTO = new GiveawayDTO();
BeanUtils.copyProperties(giveawayVO, giveawayDTO);
giveawayDTO.setBuyNum(5);
List<GiveawaySpuDTO> giveawaySpuDTOList = giveawayVO.getGiveawaySpus().stream().map(i -> BeanUtil.copyProperties(i, GiveawaySpuDTO.class)).collect(Collectors.toList());
giveawayDTO.setGiveawaySpuDTOs(giveawaySpuDTOList);
return giveawayDTO;
}
}

View File

@ -0,0 +1,127 @@
package com.tmerclub.cloud.systemtest.data.marketing;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.tmerclub.cloud.common.order.dto.DvyTypeDTO;
import com.tmerclub.cloud.common.order.dto.OrderSelfStationDTO;
import com.tmerclub.cloud.common.order.dto.OrderShopDTO;
import com.tmerclub.cloud.common.order.dto.ShopCartItemDTO;
import com.tmerclub.cloud.common.product.vo.SkuVO;
import com.moyuer.cloud.group.dto.GroupActivityDTO;
import com.moyuer.cloud.group.dto.GroupOrderDTO;
import com.moyuer.cloud.group.dto.GroupSkuDTO;
import com.moyuer.cloud.group.dto.SubmitGroupOrderDTO;
import com.moyuer.cloud.group.vo.GroupActivityVO;
import com.moyuer.cloud.group.vo.GroupSkuVO;
import com.moyuer.cloud.group.vo.app.AppGroupActivityVO;
import com.moyuer.cloud.systemtest.api.marketing.GroupApi;
import com.moyuer.cloud.systemtest.api.store.SkuApi;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author lpj
*/
public class GroupData {
/**
* 拼团活动数据
* @param prodId 商品id
*/
public static GroupActivityDTO getGroupActivityDTO(Long prodId){
GroupActivityDTO groupActivityDTO = new GroupActivityDTO();
groupActivityDTO.setActivityName("测试拼团活动");
groupActivityDTO.setGroupActivityId(0L);
groupActivityDTO.setStartTime(DateUtil.parse("2023-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
groupActivityDTO.setEndTime(DateUtil.parse("2026-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
groupActivityDTO.setHasRobot(1);
groupActivityDTO.setGroupNumber(2);
groupActivityDTO.setHasMaxNum(0);
groupActivityDTO.setHasGroupTip(1);
groupActivityDTO.setIsPreheat(0);
groupActivityDTO.setMaxNum(null);
groupActivityDTO.setShopId(null);
groupActivityDTO.setStatus(null);
groupActivityDTO.setSpuId(prodId);
List<SkuVO> skuList = SkuApi.getAllSkuList(prodId);
List<GroupSkuDTO> skuDtos = skuList.stream().map(i -> BeanUtil.copyProperties(i, GroupSkuDTO.class)).collect(Collectors.toList());
skuDtos.forEach(i->i.setActPrice(6600L));
groupActivityDTO.setGroupSkuList(skuDtos);
return groupActivityDTO;
}
/**
* 修改拼团活动信息
*/
public static GroupActivityDTO getUpdateGroupActivityDTO(GroupActivityVO groupActivityVO) {
GroupActivityDTO groupActivityDTO = new GroupActivityDTO();
BeanUtils.copyProperties(groupActivityVO, groupActivityDTO);
List<GroupSkuVO> groupSkuVOList = groupActivityVO.getGroupSkuList();
List<GroupSkuDTO> skuDtos = groupSkuVOList.stream().map(i -> BeanUtil.copyProperties(i, GroupSkuDTO.class)).collect(Collectors.toList());
groupActivityDTO.setGroupSkuList(skuDtos);
groupActivityDTO.setActivityName("修改后的拼团活动名称");
return groupActivityDTO;
}
/**
* 团购商品确认订单数据
*/
public static GroupOrderDTO getGroupOrderDTO(Long productId, Integer count) {
GroupOrderDTO groupOrderDTO = new GroupOrderDTO();
AppGroupActivityVO appGroupActivityVO = GroupApi.getGroupActivityInfo(productId);
Long shopId = appGroupActivityVO.getShopId();
groupOrderDTO.setAddrId(0L);
groupOrderDTO.setCouponIds(new ArrayList<>());
List<DvyTypeDTO> dvyTypeDTOList = new ArrayList<>();
DvyTypeDTO dvyTypeDTO = new DvyTypeDTO();
dvyTypeDTO.setDvyType(1);
dvyTypeDTO.setShopId(shopId);
dvyTypeDTOList.add(dvyTypeDTO);
groupOrderDTO.setDvyTypes(dvyTypeDTOList);
groupOrderDTO.setGroupSkuId(appGroupActivityVO.getGroupSkuList().get(0).getGroupSkuId());
groupOrderDTO.setIsScorePay(0);
ShopCartItemDTO shopCartItemDTO = new ShopCartItemDTO();
shopCartItemDTO.setCount(count);
shopCartItemDTO.setDistributionUserId(0L);
shopCartItemDTO.setShopId(shopId);
shopCartItemDTO.setSkuId(appGroupActivityVO.getGroupSkuList().get(0).getSkuId());
shopCartItemDTO.setSpuId(appGroupActivityVO.getSpuId());
groupOrderDTO.setShopCartItem(shopCartItemDTO);
groupOrderDTO.setUserChangeCoupon(0);
groupOrderDTO.setUserUseScore(0L);
return groupOrderDTO;
}
/**
* 团购订单提交订单数据
*/
public static SubmitGroupOrderDTO getSubmitGroupOrderDTO(Long groupTeamId, Long shopId) {
SubmitGroupOrderDTO submitGroupOrderDTO = new SubmitGroupOrderDTO();
submitGroupOrderDTO.setGroupTeamId(groupTeamId);
submitGroupOrderDTO.setOrderInvoiceList(null);
submitGroupOrderDTO.setOrderSelfStationDto(new OrderSelfStationDTO());
List<OrderShopDTO> orderShopDTOList = new ArrayList<>();
OrderShopDTO orderShopDTO = new OrderShopDTO();
orderShopDTO.setShopId(shopId);
orderShopDTO.setRemarks(null);
orderShopDTOList.add(orderShopDTO);
submitGroupOrderDTO.setOrderShopParam(orderShopDTOList);
submitGroupOrderDTO.setVirtualRemarkList(new ArrayList<>());
return submitGroupOrderDTO;
}
}

View File

@ -0,0 +1,75 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderDTO;
import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderItemDTO;
import com.tmerclub.cloud.common.order.vo.OrderItemVO;
import com.tmerclub.cloud.common.order.vo.OrderVO;
import com.moyuer.cloud.systemtest.api.order.OrderApi;
import java.util.ArrayList;
import java.util.List;
/**
* @author Tu
*/
public class DeliveryOrderDtoData {
public static DeliveryOrderDTO getDeliveryOrderDtoData(Long orderNum) {
DeliveryOrderDTO deliveryOrderDTO = new DeliveryOrderDTO();
OrderVO orderVO = OrderApi.getOrderItemAndAddress(orderNum);
deliveryOrderDTO.setOrderId(orderVO.getOrderId());
deliveryOrderDTO.setOrderAddrId(orderVO.getOrderAddrId());
deliveryOrderDTO.setDeliveryType(1);
deliveryOrderDTO.setDeliveryCompanyId(33L);
deliveryOrderDTO.setDeliveryNo("123456789");
List<DeliveryOrderItemDTO> deliveryOrderItemDTOList = new ArrayList<>();
for (OrderItemVO orderItem : orderVO.getOrderItems()) {
DeliveryOrderItemDTO deliveryOrderItemDTO = new DeliveryOrderItemDTO();
deliveryOrderItemDTO.setDeliveryOrderId(orderNum);
deliveryOrderItemDTO.setOrderItemId(orderItem.getOrderItemId());
deliveryOrderItemDTO.setChangeNum(orderItem.getChangeNum());
deliveryOrderItemDTOList.add(deliveryOrderItemDTO);
}
deliveryOrderDTO.setSelectOrderItems(deliveryOrderItemDTOList);
return deliveryOrderDTO;
}
public static DeliveryOrderDTO getNoDeliveryOrderDtoData(Long orderNum) {
DeliveryOrderDTO deliveryOrderDTO = new DeliveryOrderDTO();
OrderVO orderVO = OrderApi.getOrderItemAndAddress(orderNum);
deliveryOrderDTO.setOrderId(orderVO.getOrderId());
deliveryOrderDTO.setOrderAddrId(orderVO.getOrderAddrId());
deliveryOrderDTO.setDeliveryType(3);
List<DeliveryOrderItemDTO> deliveryOrderItemDTOList = new ArrayList<>();
for (int i=0; i<orderVO.getOrderItems().size(); i++){
DeliveryOrderItemDTO deliveryOrderItemDTO = new DeliveryOrderItemDTO();
OrderItemVO orderItem = orderVO.getOrderItems().get(i);
deliveryOrderItemDTO.setDeliveryOrderId(orderNum);
deliveryOrderItemDTO.setOrderItemId(orderItem.getOrderItemId());
deliveryOrderItemDTO.setChangeNum(orderItem.getChangeNum());
deliveryOrderItemDTOList.add(deliveryOrderItemDTO);
}
deliveryOrderDTO.setSelectOrderItems(deliveryOrderItemDTOList);
return deliveryOrderDTO;
}
public static DeliveryOrderDTO getSameCityDeliveryOrderDtoData(Long orderNum) {
DeliveryOrderDTO deliveryOrderDTO = new DeliveryOrderDTO();
OrderVO orderVO = OrderApi.getOrderItemAndAddress(orderNum);
deliveryOrderDTO.setOrderId(orderVO.getOrderId());
deliveryOrderDTO.setOrderAddrId(orderVO.getOrderAddrId());
deliveryOrderDTO.setDeliveryType(4);
List<DeliveryOrderItemDTO> deliveryOrderItemDTOList = new ArrayList<>();
for (int i=0; i<orderVO.getOrderItems().size(); i++){
DeliveryOrderItemDTO deliveryOrderItemDTO = new DeliveryOrderItemDTO();
OrderItemVO orderItem = orderVO.getOrderItems().get(i);
deliveryOrderItemDTO.setDeliveryOrderId(orderNum);
deliveryOrderItemDTO.setOrderItemId(orderItem.getOrderItemId());
deliveryOrderItemDTO.setChangeNum(orderItem.getChangeNum());
deliveryOrderItemDTOList.add(deliveryOrderItemDTO);
}
deliveryOrderDTO.setSelectOrderItems(deliveryOrderItemDTOList);
return deliveryOrderDTO;
}
}

View File

@ -0,0 +1,53 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.common.order.vo.OrderAddrVO;
import com.tmerclub.cloud.common.order.vo.OrderVO;
import com.tmerclub.cloud.order.dto.OrderAddrDTO;
import com.moyuer.cloud.systemtest.api.order.OrderApi;
/**
* @author Tu
*/
public class OrderAddrDtoData {
public static OrderAddrDTO getChangeOrderAddrDTO(Long orderNum){
OrderAddrDTO orderAddrDTO = new OrderAddrDTO();
OrderVO orderVO = OrderApi.infoOrder(orderNum);
OrderAddrVO orderAddrVO = orderVO.getOrderAddr();
orderAddrDTO.setOrderId(orderNum);
orderAddrDTO.setUserId(orderVO.getUserId());
orderAddrDTO.setOrderAddrId(orderVO.getOrderAddrId());
orderAddrDTO.setProvinceId(orderAddrVO.getProvinceId());
orderAddrDTO.setProvince(orderAddrVO.getProvince());
orderAddrDTO.setCityId(orderAddrVO.getCityId());
orderAddrDTO.setConsignee("修改后的收货人信息");
orderAddrDTO.setCity(orderAddrVO.getCity());
orderAddrDTO.setAreaId(orderAddrVO.getAreaId());
orderAddrDTO.setArea(orderAddrVO.getArea());
orderAddrDTO.setAddr("自动化修改地址信息");
orderAddrDTO.setMobile(orderAddrVO.getMobile());
return orderAddrDTO;
}
public static OrderAddrDTO getOrderAddrDTO(Long orderNum){
OrderVO orderVO = OrderApi.infoOrder(orderNum);
OrderAddrVO orderAddrVO = orderVO.getOrderAddr();
OrderAddrDTO orderAddrDTO = new OrderAddrDTO();
orderAddrDTO.setOrderAddrId(orderVO.getOrderAddrId());
orderAddrDTO.setOrderId(orderNum);
orderAddrDTO.setUserId(orderVO.getUserId());
orderAddrDTO.setConsignee(orderAddrVO.getConsignee());
orderAddrDTO.setProvinceId(orderAddrVO.getProvinceId());
orderAddrDTO.setProvince(orderAddrVO.getProvince());
orderAddrDTO.setCityId(orderAddrVO.getCityId());
orderAddrDTO.setCity(orderAddrVO.getCity());
orderAddrDTO.setAreaId(orderAddrVO.getAreaId());
orderAddrDTO.setArea(orderAddrVO.getArea());
orderAddrDTO.setAddr(orderAddrVO.getAddr());
orderAddrDTO.setMobile(orderAddrVO.getMobile());
return orderAddrDTO;
}
}

View File

@ -0,0 +1,175 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.common.order.vo.OrderItemVO;
import com.tmerclub.cloud.common.order.vo.OrderVirtualInfoVO;
import com.tmerclub.cloud.common.util.Arith;
import com.tmerclub.cloud.order.dto.app.OrderRefundDTO;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
import com.moyuer.cloud.systemtest.api.order.OrderApi;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author Tu
*/
public class OrderRefundDtoData {
public static OrderRefundDTO getOrderRefundDTO(Long orderNum,Long refundAmount) {
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setOrderId(orderNum);
orderRefundDTO.setOrderItemId(MyOrderApi.orderDetail(orderNum).getOrderItems().get(0).getOrderItemId());
orderRefundDTO.setApplyType(1);
orderRefundDTO.setRefundType(2);
orderRefundDTO.setBuyerDesc("部分退款自动化执行");
orderRefundDTO.setBuyerReason(0);
orderRefundDTO.setBuyerMobile("12345678910");
orderRefundDTO.setImgUrls("");
orderRefundDTO.setReceived(0);
if(refundAmount == 0 ){
orderRefundDTO.setRefundAmount(MyOrderApi.orderDetail(orderNum).getOrderItems().get(0).getActualTotal());
}else {
orderRefundDTO.setRefundAmount(refundAmount);
}
orderRefundDTO.setRefundCount(0);
//如果有赠品添加赠品id列表
if (!Objects.isNull(MyOrderApi.orderDetail(orderNum).getOrderItems().get(0).getGiveawayList())) {
List<Long> giveawayItemIds = new ArrayList<>();
for (OrderItemVO orderItemVO : MyOrderApi.orderDetail(orderNum).getOrderItems().get(0).getGiveawayList()) {
giveawayItemIds.add(orderItemVO.getOrderItemId());
}
orderRefundDTO.setGiveawayItemIds(giveawayItemIds);
}
//需核销的虚拟订单设置可退款数量和退款金额
if (MyOrderApi.orderDetail(orderNum).getOrderMold().equals(1) && !MyOrderApi.orderDetail(orderNum).getWriteOffNum().equals(0)) {
Integer count = 0;
for (OrderVirtualInfoVO orderVirtualInfoVO : MyOrderApi.orderDetail(orderNum).getVirtualInfoList()) {
if (orderVirtualInfoVO.getIsWriteOff().equals(0)) {
count++;
}
}
orderRefundDTO.setRefundCount(count);
orderRefundDTO.setRefundAmount(getVirtualOrderRefundAmount(orderNum, count));
}
return orderRefundDTO;
}
public static OrderRefundDTO getAllOrderRefundDTO(Long orderNum) {//
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setOrderId(orderNum);
orderRefundDTO.setOrderItemId(0L);
orderRefundDTO.setApplyType(1);
orderRefundDTO.setRefundType(1);
orderRefundDTO.setBuyerReason(0);
orderRefundDTO.setBuyerDesc("整单仅退款自动化执行");
orderRefundDTO.setBuyerMobile("12345678910");
orderRefundDTO.setImgUrls("");
orderRefundDTO.setReceived(0);
orderRefundDTO.setRefundAmount(getRefundAmount(orderNum));
orderRefundDTO.setRefundCount(0);
return orderRefundDTO;
}
public static OrderRefundDTO getAllOrderRefundDeliveryDTO(Long orderNum) {
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setOrderId(orderNum);
orderRefundDTO.setOrderItemId(0L);
orderRefundDTO.setApplyType(2);
orderRefundDTO.setRefundType(1);
orderRefundDTO.setBuyerReason(0);
orderRefundDTO.setBuyerDesc("整单退货退款自动化执行");
orderRefundDTO.setBuyerMobile("12345678910");
orderRefundDTO.setImgUrls("");
orderRefundDTO.setReceived(1);
orderRefundDTO.setRefundAmount(getRefundAmount(orderNum));
orderRefundDTO.setRefundCount(0);
return orderRefundDTO;
}
public static Long getRefundAmount(Long orderNum) {
Long refundAmount;
Integer status = 2;
if(MyOrderApi.orderDetail(orderNum).getStatus().equals(status)){
refundAmount = MyOrderApi.orderDetail(orderNum).getCanRefundAmount();
}else {
refundAmount = MyOrderApi.orderDetail(orderNum).getCanRefundAmount() - MyOrderApi.orderDetail(orderNum).getTransfee();
}
return refundAmount;
}
/**
* 部分退款-移除赠品退货退款
*/
public static OrderRefundDTO getOrderRefundDtoRemoveGiveaway(Long orderNum) {
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setOrderId(orderNum);
orderRefundDTO.setOrderItemId(MyOrderApi.orderDetail(orderNum).getOrderItems().get(0).getOrderItemId());
orderRefundDTO.setApplyType(2);
orderRefundDTO.setRefundType(2);
orderRefundDTO.setBuyerDesc("部分退款移除赠品自动化执行");
orderRefundDTO.setBuyerReason(0);
orderRefundDTO.setBuyerMobile("12345678910");
orderRefundDTO.setImgUrls("");
orderRefundDTO.setReceived(0);
orderRefundDTO.setRefundAmount((long) Arith.sub(MyOrderApi.orderDetail(orderNum).getOrderItems().get(0).getActualTotal(), MyOrderApi.orderDetail(orderNum).getOrderItems().get(0).getGiveawayList().get(0).getGiveawayAmount()));
orderRefundDTO.setRefundCount(0);
orderRefundDTO.setGiveawayItemIds(new ArrayList<>());
return orderRefundDTO;
}
public static OrderRefundDTO getOrderRefundDeliveryDTO(Long orderNum,Long refundAmount) {
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setOrderId(orderNum);
orderRefundDTO.setOrderItemId(MyOrderApi.orderDetail(orderNum).getOrderItems().get(0).getOrderItemId());
orderRefundDTO.setApplyType(2);
orderRefundDTO.setRefundType(2);
orderRefundDTO.setBuyerReason(0);
orderRefundDTO.setBuyerDesc("部分退货退款自动化执行");
orderRefundDTO.setBuyerMobile("12345678910");
orderRefundDTO.setImgUrls("");
orderRefundDTO.setReceived(1);
if (refundAmount == 0){
orderRefundDTO.setRefundAmount(getRefundAmount(orderNum));
}else {
orderRefundDTO.setRefundAmount(refundAmount);
}
orderRefundDTO.setRefundCount(1);
return orderRefundDTO;
}
private static Long getVirtualOrderRefundAmount(Long orderNum, Integer count) {
Integer prodNum = MyOrderApi.orderDetail(orderNum).getTotalNum();
Long actualTotal = MyOrderApi.orderDetail(orderNum).getOrderItems().get(0).getActualTotal();
return (long) Arith.mul(Arith.div(count, prodNum), actualTotal);
}
public static OrderRefundDTO getOrderRefundApartAmountDTO(Long orderNum,Long refundAmount) {
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setOrderId(orderNum);
orderRefundDTO.setOrderItemId(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId());
orderRefundDTO.setApplyType(1);
orderRefundDTO.setRefundType(2);
orderRefundDTO.setBuyerDesc("部分退款自动化执行");
orderRefundDTO.setBuyerReason(0);
orderRefundDTO.setBuyerMobile("12345678910");
orderRefundDTO.setImgUrls("");
orderRefundDTO.setReceived(0);
orderRefundDTO.setRefundAmount(refundAmount);
orderRefundDTO.setRefundCount(0);
return orderRefundDTO;
}
public static OrderRefundDTO getRefundDeliveryApartAmountDTO(Long orderNum,Long refundAmount) {
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setOrderId(orderNum);
orderRefundDTO.setOrderItemId(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId());
orderRefundDTO.setApplyType(2);
orderRefundDTO.setRefundType(2);
orderRefundDTO.setBuyerDesc("退货退款退部分金额");
orderRefundDTO.setBuyerReason(0);
orderRefundDTO.setBuyerMobile("12345678910");
orderRefundDTO.setImgUrls("");
orderRefundDTO.setReceived(1);
orderRefundDTO.setRefundAmount(refundAmount);
orderRefundDTO.setRefundCount(1);
return orderRefundDTO;
}
}

View File

@ -0,0 +1,18 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.common.order.dto.OrderVirtualInfoDTO;
/**
* @author lpj
*/
public class OrderVirtualInfoDtoData {
/**
* 门店核销虚拟订单数据
*/
public static OrderVirtualInfoDTO getOrderVirtualInfoDTO(Long orderId, String writeOffCode) {
OrderVirtualInfoDTO orderVirtualInfoDTO = new OrderVirtualInfoDTO();
orderVirtualInfoDTO.setOrderId(orderId);
orderVirtualInfoDTO.setWriteOffCode(writeOffCode);
return orderVirtualInfoDTO;
}
}

View File

@ -0,0 +1,32 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.payment.dto.PayInfoDTO;
import java.util.ArrayList;
import java.util.List;
/**
* @author Tu
*/
public class PayParamData {
public static PayInfoDTO getPayParamData(Long orderId){
PayInfoDTO payInfoDTO = new PayInfoDTO();
ArrayList<Long> orderIds = new ArrayList<>();
orderIds.add(orderId);
payInfoDTO.setOrderIds(orderIds);
payInfoDTO.setPayType(9);
payInfoDTO.setReturnUrl("https://h5.mall4j.com/cloud-test/package-user/pages/order/order?orderStatus=0");
return payInfoDTO;
}
/**
* 需拆分订单的订单支付
*/
public static PayInfoDTO getPayParamData(List<Long> orderIds) {
PayInfoDTO payInfoDTO = new PayInfoDTO();
payInfoDTO.setOrderIds(orderIds);
payInfoDTO.setPayType(9);
return payInfoDTO;
}
}

View File

@ -0,0 +1,25 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.product.dto.shopcart.ChangeShopCartItemDTO;
import com.moyuer.cloud.systemtest.api.store.SkuApi;
/**
* @author Tu
*/
public class ShopCartData {
public static ChangeShopCartItemDTO getShopCartItem(Long spuId) {
ChangeShopCartItemDTO changeShopCartItemDTO = new ChangeShopCartItemDTO();
changeShopCartItemDTO.setCount(1);
changeShopCartItemDTO.setSkuId(SkuApi.getAllSkuList(spuId).get(0).getSkuId());
changeShopCartItemDTO.setSpuId(spuId);
return changeShopCartItemDTO;
}
public static ChangeShopCartItemDTO getShopCartItem(Long spuId, Integer count) {
ChangeShopCartItemDTO changeShopCartItemDTO = new ChangeShopCartItemDTO();
changeShopCartItemDTO.setCount(count);
changeShopCartItemDTO.setSkuId(SkuApi.getAllSkuList(spuId).get(0).getSkuId());
changeShopCartItemDTO.setSpuId(spuId);
return changeShopCartItemDTO;
}
}

View File

@ -0,0 +1,86 @@
package com.tmerclub.cloud.systemtest.data.platform;
import cn.hutool.core.bean.BeanUtil;
import com.tmerclub.cloud.api.product.dto.CategoryShopDTO;
import com.tmerclub.cloud.common.product.vo.CategoryLangVO;
import com.tmerclub.cloud.common.product.vo.CategoryVO;
import com.tmerclub.cloud.product.dto.CategoryDTO;
import com.tmerclub.cloud.product.dto.CategoryLangDTO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import org.springframework.beans.BeanUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author lpj
*/
public class CategoryDtoData {
/**
* 平台分类新增数据
* @param level 等级
* @param parentId 上级分类id
* @param deductionRate 平台扣率
*/
public static CategoryDTO getCategoryDTO(Integer level, Long parentId, Double deductionRate) {
CategoryDTO categoryDTO = new CategoryDTO();
categoryDTO.setCategoryId(0L);
String name = "自动化测试分类" + System.currentTimeMillis();
categoryDTO.setName(name);
categoryDTO.setImgUrl("/test.png");
categoryDTO.setLevel(level);
categoryDTO.setParentId(parentId);
categoryDTO.setDeductionRate(deductionRate);
categoryDTO.setCategoryLangList(getCategoryLangDTOList(name));
categoryDTO.setStatus(1);
categoryDTO.setSeq(1);
return categoryDTO;
}
/**
* 修改平台分类数据
*/
public static CategoryDTO getCategoryDTO(Long categoryId) {
CategoryVO categoryVO = CategoryApi.getCategoryInfo(categoryId);
CategoryDTO categoryDTO = new CategoryDTO();
BeanUtils.copyProperties(categoryVO, categoryDTO);
List<CategoryLangVO> categoryLangVOList = categoryVO.getCategoryLangList();
List<CategoryLangDTO> categoryLangDTOList = categoryLangVOList.stream().map(i -> BeanUtil.copyProperties(i, CategoryLangDTO.class)).collect(Collectors.toList());
categoryDTO.setCategoryLangList(categoryLangDTOList);
categoryDTO.setDeductionRate(1.99);
return categoryDTO;
}
/**
* 店铺签约分类列表
*/
public static List<CategoryShopDTO> getCategoryShopDtoList(List<Long> categoryIds) {
List<CategoryShopDTO> categoryShopDTOList= new ArrayList<>();
for(Long categoryId : categoryIds) {
CategoryShopDTO categoryShopDTO = new CategoryShopDTO();
categoryShopDTO.setCategoryId(categoryId);
categoryShopDTO.setQualifications(null);
categoryShopDTOList.add(categoryShopDTO);
}
return categoryShopDTOList;
}
private static List<CategoryLangDTO> getCategoryLangDTOList(String name) {
List<CategoryLangDTO> categoryLangDTOList = new ArrayList<>();
CategoryLangDTO categoryLangDtoA = new CategoryLangDTO();
categoryLangDtoA.setLang(1);
categoryLangDtoA.setName(name);
categoryLangDTOList.add(categoryLangDtoA);
CategoryLangDTO categoryLangDtoB = new CategoryLangDTO();
categoryLangDtoB.setLang(2);
categoryLangDtoB.setName(null);
categoryLangDTOList.add(categoryLangDtoB);
return categoryLangDTOList;
}
}

View File

@ -0,0 +1,62 @@
package com.tmerclub.cloud.systemtest.data.platform;
import com.moyuer.cloud.delivery.dto.AreaDTO;
import com.moyuer.cloud.delivery.dto.TransfeeDTO;
import com.moyuer.cloud.delivery.dto.TransportDTO;
import com.moyuer.cloud.delivery.vo.TransportVO;
import com.moyuer.cloud.systemtest.api.platform.PlatformTransportApi;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author lpj
*/
public class PlatformDeliveryData {
/**
* 平台端获取包邮模板ID
*/
public static Long getPlatformFreeFeeDelivery() {
List<TransportVO> transportVOList = PlatformTransportApi.platformInfoTransport();
long count = transportVOList.stream().filter(t -> Objects.equals(t.getIsFreeFee(), 1)).count();
if (count == 0 ||transportVOList.size() == 0) {
PlatformTransportApi.platformAddTransport(getFreeTransportDTO());
return PlatformTransportApi.platformInfoTransport().get(0).getTransportId();
}
for (TransportVO transportVO : transportVOList) {
if (transportVO.getIsFreeFee() == 1) {
return transportVO.getTransportId();
}
}
return null;
}
/**
*新增包邮模板
* */
public static TransportDTO getFreeTransportDTO() {
TransportDTO transportDTO = new TransportDTO();
transportDTO.setTransName("包邮模板");
transportDTO.setChargeType(0);
transportDTO.setIsFreeFee(1);
transportDTO.setHasFreeCondition(0);
TransfeeDTO transfeeDTO = new TransfeeDTO();
transfeeDTO.setFirstFee(0L);
transfeeDTO.setFirstPiece(1D);
transfeeDTO.setContinuousFee(0L);
transfeeDTO.setContinuousPiece(1D);
ArrayList<AreaDTO> cityList = new ArrayList<>();
AreaDTO areaDTO = new AreaDTO();
cityList.add(areaDTO);
transfeeDTO.setCityList(cityList);
List<TransfeeDTO> transfeeDTOList = new ArrayList<>();
transfeeDTOList.add(transfeeDTO);
transportDTO.setTransFees(transfeeDTOList);
return transportDTO;
}
}

View File

@ -0,0 +1,28 @@
package com.tmerclub.cloud.systemtest.data.platform;
import com.tmerclub.cloud.platform.dto.ScoreConfigDTO;
import com.tmerclub.cloud.platform.vo.ScoreConfigVO;
import com.moyuer.cloud.systemtest.api.platform.ScoreConfigApi;
import org.springframework.beans.BeanUtils;
import java.util.List;
/**
* @author lpj
*/
public class ScoreConfigDtoData {
public static ScoreConfigDTO getScoreConfigDTO(Long shoppingUseScoreRatio, Double userRatioLimit) {
ScoreConfigVO scoreConfigVO = ScoreConfigApi.info();
ScoreConfigDTO scoreConfigDTO = new ScoreConfigDTO();
BeanUtils.copyProperties(scoreConfigVO, scoreConfigDTO);
List<Integer> signInScore = scoreConfigVO.getSignInScore();
scoreConfigDTO.setSignInScore(signInScore);
scoreConfigDTO.setShoppingUseScoreRatio(shoppingUseScoreRatio);
scoreConfigDTO.setUseRatioLimit(userRatioLimit);
scoreConfigDTO.setShoppingScoreSwitch(true);
return scoreConfigDTO;
}
}

View File

@ -0,0 +1,48 @@
package com.tmerclub.cloud.systemtest.data.platform;
import com.tmerclub.cloud.common.order.dto.DvyTypeDTO;
import com.tmerclub.cloud.common.order.dto.OrderDTO;
import com.tmerclub.cloud.common.order.dto.ShopCartItemDTO;
import com.tmerclub.cloud.common.product.vo.app.SpuAppVO;
import com.moyuer.cloud.systemtest.api.login.UserApi;
import com.moyuer.cloud.systemtest.api.platform.ScoreProductApi;
import java.util.ArrayList;
/**
* @author lpj
*/
public class ScoreOrderDtoData {
/**
* 立即购买积分商品
*/
public static OrderDTO getScoreOrderDtoData(Long spuId, Integer count) {
OrderDTO orderDTO = new OrderDTO();
Long userId = UserApi.getUserInfo().getUserId();
SpuAppVO product = ScoreProductApi.getScoreProductInfo(spuId, userId);
orderDTO.setAddrId(0L);
orderDTO.setCouponIds(new ArrayList<>());
DvyTypeDTO dvyTypeDTO = new DvyTypeDTO();
dvyTypeDTO.setDvyType(1);
dvyTypeDTO.setShopId(product.getShopId());
ArrayList<DvyTypeDTO> dvyTypeDTOList = new ArrayList<>();
dvyTypeDTOList.add(dvyTypeDTO);
orderDTO.setDvyTypes(dvyTypeDTOList);
orderDTO.setIsScorePay(1);
orderDTO.setUserChangeCoupon(0);
orderDTO.setUserUseScore(0L);
ShopCartItemDTO shopCartItemDTO = new ShopCartItemDTO();
shopCartItemDTO.setCount(count);
shopCartItemDTO.setDistributionUserId(0L);
shopCartItemDTO.setShopId(product.getShopId());
shopCartItemDTO.setSkuId(product.getSkus().get(0).getSkuId());
shopCartItemDTO.setSpuId(spuId);
orderDTO.setShopCartItem(shopCartItemDTO);
return orderDTO;
}
}

View File

@ -0,0 +1,66 @@
package com.tmerclub.cloud.systemtest.data.platform;
import com.tmerclub.cloud.common.order.bo.DeliveryModeBO;
import com.tmerclub.cloud.common.product.dto.SkuDTO;
import com.tmerclub.cloud.common.product.dto.SpuDTO;
import com.tmerclub.cloud.common.product.dto.SpuLangDTO;
import com.tmerclub.cloud.common.util.Json;
import java.util.ArrayList;
import java.util.List;
/**
* @author lpj
*/
public class ScoreSpuData {
public static SpuDTO getScoreSpu(Long deliveryTemplateId, Long priceFee, Long scorePriceFee) {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setName("接口自动化积分商品");
spuDTO.setSellingPoint("商品卖点");
spuDTO.setDetail("测试商品详情");
spuDTO.setDeliveryTemplateId(deliveryTemplateId);
spuDTO.setMainImgUrl("/test.png");
spuDTO.setImgUrls("/test.png");
spuDTO.setMarketPriceFee(88L);
spuDTO.setPriceFee(priceFee);
spuDTO.setScoreFee(scorePriceFee);
spuDTO.setHasSkuImg(0);
spuDTO.setSkuList(getSkuList(priceFee, scorePriceFee));
spuDTO.setSupplierSpuType(0);
List<SpuLangDTO> spuLangDTOList = new ArrayList<>();
SpuLangDTO spuLangDTO = new SpuLangDTO();
spuLangDTO.setLang(1);
spuLangDTO.setSpuName("接口自动化积分商品");
spuLangDTOList.add(spuLangDTO);
spuDTO.setSpuLangList(spuLangDTOList);
spuDTO.setTotalStock(100);
DeliveryModeBO deliveryModeBO = new DeliveryModeBO();
deliveryModeBO.setHasShopDelivery(true);
deliveryModeBO.setHasUserPickUp(true);
deliveryModeBO.setHasCityDelivery(false);
spuDTO.setDeliveryMode(Json.toJsonString(deliveryModeBO));
spuDTO.setSpuMold(0);
spuDTO.setPreSaleType(-1);
spuDTO.setSpuOrigin(0);
return spuDTO;
}
public static List<SkuDTO> getSkuList(Long priceFee, Long scorePriceFee){
List<SkuDTO> skuList = new ArrayList<>();
SkuDTO skuDTO = new SkuDTO();
skuDTO.setChangeStock(100);
skuDTO.setPriceFee(priceFee);
skuDTO.setScoreFee(scorePriceFee);
skuDTO.setMarketPriceFee(88L);
skuDTO.setStock(100);
skuDTO.setStatus(1);
skuList.add(skuDTO);
return skuList;
}
}

View File

@ -0,0 +1,28 @@
package com.tmerclub.cloud.systemtest.data.platform;
import com.tmerclub.cloud.common.order.dto.OrderSelfStationDTO;
import com.tmerclub.cloud.common.order.dto.OrderShopDTO;
import com.tmerclub.cloud.common.order.dto.SubmitOrderDTO;
import java.util.ArrayList;
/**
* @author lpj
*/
public class SubmitScoreOrderDtoData {
public static SubmitOrderDTO getSubmitScoreOrderDtoData() {
SubmitOrderDTO submitOrderDTO = new SubmitOrderDTO();
OrderShopDTO orderShopParam = new OrderShopDTO();
orderShopParam.setShopId(0L);
orderShopParam.setRemarks("");
ArrayList<OrderShopDTO> orderShopDTOList = new ArrayList<>();
orderShopDTOList.add(orderShopParam);
submitOrderDTO.setOrderInvoiceList(null);
submitOrderDTO.setOrderSelfStationDto(new OrderSelfStationDTO());
submitOrderDTO.setVirtualRemarkList(new ArrayList<>());
submitOrderDTO.setOrderShopParam(orderShopDTOList);
return submitOrderDTO;
}
}

View File

@ -0,0 +1,162 @@
package com.tmerclub.cloud.systemtest.data.store;
import com.moyuer.cloud.delivery.dto.AreaDTO;
import com.moyuer.cloud.delivery.dto.TransfeeDTO;
import com.moyuer.cloud.delivery.dto.TransfeeFreeDTO;
import com.moyuer.cloud.delivery.dto.TransportDTO;
import com.moyuer.cloud.delivery.vo.TransportVO;
import com.moyuer.cloud.systemtest.api.store.TransportApi;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* @author Tu
*/
public class DeliveryData {
/**
* 获取包邮模板ID
* @param isMainShop true 使用shop_token
*/
public static Long getFreeFeeDelivery(Boolean isMainShop) {
List<TransportVO> transportVOList = TransportApi.infoTransport(isMainShop);
long count = transportVOList.stream().filter(t -> Objects.equals(t.getIsFreeFee(), 1)).count();
if (count == 0 ||transportVOList.size() == 0) {
TransportApi.addTransport(DeliveryData.getFreeTransportDTO(), isMainShop);
return TransportApi.infoTransport(isMainShop).get(0).getTransportId();
}
for (TransportVO transportVO : transportVOList) {
if (transportVO.getIsFreeFee() == 1) {
return transportVO.getTransportId();
}
}
return null;
}
/**
* 供应商包邮ID
* @param isMainSupplier true 使用supplier_token
*/
public static Long getSupplierFreeFeeDelivery(Boolean isMainSupplier) {
List<TransportVO> transportVOList = TransportApi.supplierTransportPage(isMainSupplier);
long count = transportVOList.stream().filter(t -> Objects.equals(t.getIsFreeFee(), 1)).count();
if (count == 0 ||transportVOList.size() == 0) {
TransportApi.addSupplierTransport(DeliveryData.getFreeTransportDTO(), isMainSupplier);
return TransportApi.supplierTransportPage(isMainSupplier).get(0).getTransportId();
}
for (TransportVO transportVO : transportVOList) {
if (transportVO.getIsFreeFee() == 1) {
return transportVO.getTransportId();
}
}
return null;
}
/**
*新增包邮模板
* */
public static TransportDTO getFreeTransportDTO() {
TransportDTO transportDTO = new TransportDTO();
transportDTO.setTransName("包邮模板");
transportDTO.setChargeType(0);
transportDTO.setIsFreeFee(1);
transportDTO.setHasFreeCondition(0);
TransfeeDTO transfeeDTO = new TransfeeDTO();
transfeeDTO.setFirstFee(0L);
transfeeDTO.setFirstPiece(1D);
transfeeDTO.setContinuousFee(0L);
transfeeDTO.setContinuousPiece(1D);
ArrayList<AreaDTO> cityList = new ArrayList<>();
AreaDTO areaDTO = new AreaDTO();
cityList.add(areaDTO);
transfeeDTO.setCityList(cityList);
List<TransfeeDTO> transfeeDTOList = new ArrayList<>();
transfeeDTOList.add(transfeeDTO);
transportDTO.setTransFees(transfeeDTOList);
return transportDTO;
}
/**
* 广东可送运费8
* */
public static TransportDTO getTransportDTO() {
TransportDTO transportDTO = new TransportDTO();
transportDTO.setTransName("广东可配送-自动化添加" + System.currentTimeMillis());
transportDTO.setChargeType(0);
transportDTO.setIsFreeFee(0);
transportDTO.setHasFreeCondition(0);
TransfeeDTO transfeeDTO = new TransfeeDTO();
transfeeDTO.setFirstFee(800L);
transfeeDTO.setFirstPiece(1D);
transfeeDTO.setContinuousFee(800L);
transfeeDTO.setContinuousPiece(1D);
List<AreaDTO> cityList = new ArrayList<>();
AreaDTO areaDTO = new AreaDTO();
areaDTO.setAreaName("荔湾区");
areaDTO.setAreaId(440103L);
areaDTO.setParentId(4401L);
areaDTO.setLevel(3);
cityList.add(areaDTO);
transfeeDTO.setCityList(cityList);
List<TransfeeDTO> transfeeDTOList = new ArrayList<>();
transfeeDTOList.add(transfeeDTO);
transportDTO.setTransFees(transfeeDTOList);
return transportDTO;
}
/**
* 满条件包邮
* @param chargeType 收费方式 件数 0 重量 1 体积 2
* @param freeType 包邮条件 件数/重量/体积 0 金额 1 件数/重量/体积+金额2
* @param price 满件数/重量/体积的条件
* @param amount 满金额的条件
*/
public static TransportDTO getTransportDTO(Integer chargeType, Double firstPiece, Long firstFee, Double continuousPiece, Long continuousFee, Integer hasFreeCondition, Integer freeType, Double price, Long amount) {
TransportDTO transportDTO = new TransportDTO();
transportDTO.setTransName("可送荔湾-自动化-满条件包邮" + System.currentTimeMillis());
transportDTO.setChargeType(chargeType);
transportDTO.setIsFreeFee(0);
transportDTO.setHasFreeCondition(hasFreeCondition);
TransfeeDTO transfeeDTO = new TransfeeDTO();
transfeeDTO.setFirstFee(firstFee);
transfeeDTO.setFirstPiece(firstPiece);
transfeeDTO.setContinuousFee(continuousFee);
transfeeDTO.setContinuousPiece(continuousPiece);
List<AreaDTO> cityList = new ArrayList<>();
AreaDTO areaDTO = new AreaDTO();
areaDTO.setAreaName("荔湾区");
areaDTO.setAreaId(440103L);
areaDTO.setParentId(4401L);
areaDTO.setLevel(3);
cityList.add(areaDTO);
transfeeDTO.setCityList(cityList);
List<TransfeeDTO> transfeeDTOList = new ArrayList<>();
transfeeDTOList.add(transfeeDTO);
transportDTO.setTransFees(transfeeDTOList);
List<TransfeeFreeDTO> transfeeFreeDtoList = new ArrayList<>();
TransfeeFreeDTO transfeeFreeDto = new TransfeeFreeDTO();
transfeeFreeDto.setFreeType(freeType);
transfeeFreeDto.setPiece(price);
transfeeFreeDto.setAmount(amount);
transfeeFreeDto.setFreeCityList(cityList);
transfeeFreeDtoList.add(transfeeFreeDto);
transportDTO.setTransFeeFrees(transfeeFreeDtoList);
return transportDTO;
}
}

View File

@ -0,0 +1,24 @@
package com.tmerclub.cloud.systemtest.data.store;
import com.tmerclub.cloud.multishop.dto.ShopRefundAddrDTO;
/**
* @author Tu
*/
public class ShopRefundAddrDtoData {
public static ShopRefundAddrDTO getShopRefundAddrDTO(){
ShopRefundAddrDTO shopRefundAddrDTO = new ShopRefundAddrDTO();
shopRefundAddrDTO.setAddr("自动化测试地址");
shopRefundAddrDTO.setArea("荔湾区");
shopRefundAddrDTO.setCity("广州市");
shopRefundAddrDTO.setIsDefault(0);
shopRefundAddrDTO.setMobile("12345678901");
shopRefundAddrDTO.setAreaId(440103L);
shopRefundAddrDTO.setProvince("广东省");
shopRefundAddrDTO.setProvinceId(44L);
shopRefundAddrDTO.setConsignee("自动化测试收货人");
shopRefundAddrDTO.setShopRefundAddrId(0L);
return shopRefundAddrDTO;
}
}

View File

@ -0,0 +1,27 @@
package com.tmerclub.cloud.systemtest.data.store;
import com.tmerclub.cloud.multishop.dto.ShopSubstituteSalesDTO;
import com.moyuer.cloud.systemtest.api.store.ShopSubstituteSalesApi;
/**
* @author lpj
*/
public class ShopSubstituteSalesDtoData {
/**
* 代销设置数据
* @param salesType 设置价格方式 0 智能设价 1 手动设价
* @param salesPriceType 加价类型 0 按比例 1 固定金额
* @param salesPrice 代销价格
* @param orderShape 待采购方式 0 直接转为待采购 1 自动采购
*/
public static ShopSubstituteSalesDTO getShopSubstituteSalesDTO(Integer salesType, Integer salesPriceType, Long salesPrice, Integer orderShape) {
ShopSubstituteSalesDTO shopSubstituteSalesDTO = new ShopSubstituteSalesDTO();
shopSubstituteSalesDTO.setSalesType(salesType);
shopSubstituteSalesDTO.setSalesPriceType(salesPriceType);
shopSubstituteSalesDTO.setSalesPrice(salesPrice);
shopSubstituteSalesDTO.setOrderShape(orderShape);
shopSubstituteSalesDTO.setShopId(ShopSubstituteSalesApi.getShopSubstituteSales().getShopId());
shopSubstituteSalesDTO.setShopSubstituteSalesId(ShopSubstituteSalesApi.getShopSubstituteSales().getShopSubstituteSalesId());
return shopSubstituteSalesDTO;
}
}

View File

@ -0,0 +1,196 @@
package com.tmerclub.cloud.systemtest.test.amount;
import com.tmerclub.cloud.common.order.dto.OrderDTO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.order.vo.OrderDetailVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.PayApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.marketing.CouponApi;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
import com.moyuer.cloud.systemtest.api.order.ShopCartApi;
import com.moyuer.cloud.systemtest.api.store.ShopWalletApi;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.marketing.CouponData;
import com.moyuer.cloud.systemtest.data.order.OrderDtoData;
import com.moyuer.cloud.systemtest.data.order.ShopCartData;
import com.moyuer.cloud.systemtest.data.order.SubmitOrderDtoData;
import com.moyuer.cloud.systemtest.data.order.WalletAssert;
import com.moyuer.cloud.systemtest.data.platform.CategoryDtoData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author lpj
*/
public class CouponAmountTest {
private static List<Long> getCategoryId(Boolean isMainShop) {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(isMainShop);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
CategoryApi.update(CategoryDtoData.getCategoryDTO(categoryId));
return Stream.of(categoryId, shopCategoryId).collect(Collectors.toList());
}
@Test(description = "商品金额为小数额,使用店铺优惠券优惠金额计算是否正确")
public void minPriceShopCouponAmountTest() {
Long transportId = DeliveryData.getFreeFeeDelivery(true);
List<Long> categoryIds = getCategoryId(true);
//新建店铺折扣券-满0.01打5折
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 1L), true);
List<Long> productIds = Collections.singletonList(productId);
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 2, 1L, null, 5.0, 2, 10, 100, 1, productIds));
Long couponId = CouponApi.getShopCouponPage().get(0).getCouponId();
//用户领取优惠券
CouponApi.receive(couponId);
//用户使用优惠券购买商品
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(productId, 1);
orderDTO.setCouponIds(Collections.singletonList(CouponApi.getUserCouponPage().get(0).getCouponUserId()));
MyOrderApi.confirm(orderDTO);
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
CouponApi.deleteShopCoupon(couponId);
ProductApi.delete(productId, true);
//验证数据
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).get(0), 0, 1, 1L, 1L, 0L, 0L, 0L, 0L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(0), 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1.99, 0L,
0L, 0L, 0L, 0L, 0L, null, null, 0L, null, 1, null);
}
@Test(description = "商品金额为小数额,使用平台优惠券优惠金额计算是否正确")
public void minPricePlatformCouponAmountTest() {
Long transportId = DeliveryData.getFreeFeeDelivery(true);
List<Long> categoryIds = getCategoryId(true);
//新建店铺折扣券-满0.01打5折
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 1L), true);
List<Long> productIds = Collections.singletonList(productId);
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 2, 1L, null, 5.0, 2, 10, 100, 1, productIds));
Long couponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//用户领取优惠券
CouponApi.receive(couponId);
//用户使用优惠券购买商品
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(productId, 1);
orderDTO.setCouponIds(Collections.singletonList(CouponApi.getUserCouponPage().get(0).getCouponUserId()));
MyOrderApi.confirm(orderDTO);
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
CouponApi.deletePlatformCoupon(couponId);
ProductApi.delete(productId, true);
//验证数据
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).get(0), 0, 1, 1L, 1L, 0L, 0L, 0L, 0L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(0), 1L, 1L, 0L, 0L, 0L, 0L, 0L, 1.99, 0L,
0L, 0L, 0L, 0L, 0L, null, null, 0L, null, 1, null);
}
@Test(description = "多个商品,其中一个商品不参与店铺优惠券,使用店铺优惠券金额计算是否正确")
public void differentProductShopCouponAmountTest() {
Long transportId = DeliveryData.getFreeFeeDelivery(true);
List<Long> categoryIds = getCategoryId(true);
//新建店铺代金券-满20减5
Long productIdA = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 2000L), true);
Long productIdB = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 1700L), true);
Long productIdC = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 300L), true);
List<Long> productIds = Arrays.asList(productIdB, productIdC);
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 1, 2000L, 500L, null, 2, 10, 100, 1, productIds));
Long couponId = CouponApi.getShopCouponPage().get(0).getCouponId();
//用户领取优惠券
CouponApi.receive(couponId);
//用户使用优惠券购买商品
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdC, 1));
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(productIdA);
orderDTO.setCouponIds(Collections.singletonList(CouponApi.getUserCouponPage().get(0).getCouponUserId()));
MyOrderApi.confirm(orderDTO);
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
CouponApi.deleteShopCoupon(couponId);
ProductApi.delete(productIdC, true);
ProductApi.delete(productIdB, true);
ProductApi.delete(productIdA, true);
//验证数据
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).get(0), 0, 1, 3431L, 3500L, 0L, 500L, 0L, 69L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
for (int i=0; i<orderDetailVO.getOrderItemDetailList().size(); i++) {
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(2000L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 2000L, 2000L, 0L, 0L, 0L, 0L, 0L, 1.99, 40L,
0L, 0L, 0L, 0L, 0L, null, null, 0L, null, 1, null);
}
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(1700L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 1700L, 1275L, 0L, 425L, 0L, 0L, 0L, 1.99, 25L,
0L, 0L, 0L, 425L, 0L, null, null, 0L, null, 1, null);
}
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(300L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 300L, 225L, 0L, 75L, 0L, 0L, 0L, 1.99, 4L,
0L, 0L, 0L, 75L, 0L, null, null, 0L, null, 1, null);
}
}
}
@Test(description = "多个商品,其中一个商品不参与平台优惠券,使用平台优惠券金额计算是否正确")
public void differentProductPlatformCouponAmountTest() {
Long transportId = DeliveryData.getFreeFeeDelivery(true);
List<Long> categoryIds = getCategoryId(true);
//新建店铺代金券-满20减5
Long productIdA = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 2000L), true);
Long productIdB = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 1700L), true);
Long productIdC = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 300L), true);
List<Long> productIds = Arrays.asList(productIdB, productIdC);
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 2000L, 500L, null, 2, 10, 100, 1, productIds));
Long couponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//用户领取优惠券
CouponApi.receive(couponId);
//用户使用优惠券购买商品
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdC, 1));
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(productIdA);
orderDTO.setCouponIds(Collections.singletonList(CouponApi.getUserCouponPage().get(0).getCouponUserId()));
MyOrderApi.confirm(orderDTO);
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
CouponApi.deletePlatformCoupon(couponId);
ProductApi.delete(productIdC, true);
ProductApi.delete(productIdB, true);
ProductApi.delete(productIdA, true);
//验证数据
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).get(0), 0, 1, 3920L, 3500L, 500L, 0L, 0L, 80L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
for (int i=0; i<orderDetailVO.getOrderItemDetailList().size(); i++) {
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(2000L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 2000L, 2000L, 0L, 0L, 0L, 0L, 0L, 1.99, 40L,
0L, 0L, 0L, 0L, 0L, null, null, 0L, null, 1, null);
}
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(1700L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 1700L, 1275L, 0L, 0L, 425L, 0L, 0L, 1.99, 34L,
0L, 0L, 425L, 0L, 0L, null, null, 0L, null, 1, null);
}
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(300L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 300L, 225L, 0L, 0L, 75L, 0L, 0L, 1.99, 6L,
0L, 0L, 75L, 0L, 0L, null, null, 0L, null, 1, null);
}
}
}
}

View File

@ -0,0 +1,190 @@
package com.tmerclub.cloud.systemtest.test.amount;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.discount.dto.DiscountItemDTO;
import com.tmerclub.cloud.order.vo.OrderDetailVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.PayApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.marketing.DiscountApi;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
import com.moyuer.cloud.systemtest.api.order.ShopCartApi;
import com.moyuer.cloud.systemtest.api.store.ShopWalletApi;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.marketing.DiscountData;
import com.moyuer.cloud.systemtest.data.order.OrderDtoData;
import com.moyuer.cloud.systemtest.data.order.ShopCartData;
import com.moyuer.cloud.systemtest.data.order.SubmitOrderDtoData;
import com.moyuer.cloud.systemtest.data.order.WalletAssert;
import com.moyuer.cloud.systemtest.data.platform.CategoryDtoData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author lpj
*/
public class DiscountAmountTest {
private static List<Long> getCategoryId(Boolean isMainShop) {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(isMainShop);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(isMainShop).get(0).getCategoryId();
CategoryApi.update(CategoryDtoData.getCategoryDTO(categoryId));
return Stream.of(categoryId, shopCategoryId).collect(Collectors.toList());
}
@Test(description = "使用多个活动下单各个活动优惠金额是否正确")
public void differentDiscountAmountTest() {
Long transportId = DeliveryData.getFreeFeeDelivery(true);
List<Long> categoryIds = getCategoryId(true);
//新建满减活动A-满20减8
Long productIdA = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 7310L), true);
List<DiscountItemDTO> discountItemDtoListA = List.of(DiscountData.getDiscountItemDTO(2000L, 800L));
List<Long> productIdsA = Collections.singletonList(productIdA);
DiscountApi.save(DiscountData.getDiscount(0, 0, discountItemDtoListA, 800L, 1, productIdsA, 1), true);
Long discountIdA = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//新建满减活动B-满1件打3.9折
Long productIdB = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 633L), true);
List<DiscountItemDTO> discountItemDtoListB = List.of(DiscountData.getDiscountItemDTO(100L, 390L));
List<Long> productIdsB = Collections.singletonList(productIdB);
DiscountApi.save(DiscountData.getDiscount(3, 0, discountItemDtoListB, 50000L, 1, productIdsB, 1), true);
Long discountIdB = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//新建满减活动A-满2件打3折
Long productIdC = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 270L), true);
List<DiscountItemDTO> discountItemDtoListC = List.of(DiscountData.getDiscountItemDTO(200L, 300L));
List<Long> productIdsC = Collections.singletonList(productIdC);
DiscountApi.save(DiscountData.getDiscount(3, 0, discountItemDtoListC, 50000L, 1, productIdsC, 1), true);
Long discountIdC = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//新建满减活动A-满1件打3折上限20
Long productIdD = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 7347L), true);
List<DiscountItemDTO> discountItemDtoListD = List.of(DiscountData.getDiscountItemDTO(100L, 300L));
List<Long> productIdsD = Collections.singletonList(productIdD);
DiscountApi.save(DiscountData.getDiscount(3, 0, discountItemDtoListD, 2000L, 1, productIdsD, 1), true);
Long discountIdD = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdC, 3));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdD, 1));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
DiscountApi.delete(discountIdD, true);
DiscountApi.delete(discountIdC, true);
DiscountApi.delete(discountIdB, true);
DiscountApi.delete(discountIdA, true);
ProductApi.delete(productIdD, true);
ProductApi.delete(productIdC, true);
ProductApi.delete(productIdB, true);
ProductApi.delete(productIdA, true);
//验证数据
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).get(0), 0, 1, 12101L, 12347L, 0L, 3753L, 0L, 246L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
for (int i=0; i<orderDetailVO.getOrderItemDetailList().size(); i++) {
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(7347L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 7347L, 5347L, 0L, 2000L, 0L, 0L, 0L, 1.99, 106L,
0L, 0L, 0L, 0L, 2000L, null, null, 0L, null, 1, null);
}
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(7310L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 7310L, 6510L, 0L, 800L, 0L, 0L, 0L, 1.99, 130L,
0L, 0L, 0L, 0L, 800L, null, null, 0L, null, 1, null);
}
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(810L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 810L, 243L, 0L, 567L, 0L, 0L, 0L, 1.99, 5L,
0L, 0L, 0L, 0L, 567L, null, null, 0L, null, 3, null);
}
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(633L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 633L, 247L, 0L, 386L, 0L, 0L, 0L, 1.99, 5L,
0L, 0L, 0L, 0L, 386L, null, null, 0L, null, 1, null);
}
}
}
@Test(description = "优惠上限为*优惠金额数据是否正确")
public void discountMaxReduceAmountTest() {
Long transportId = DeliveryData.getFreeFeeDelivery(true);
List<Long> categoryIds = getCategoryId(true);
//新建满减活动A-每满10减1
Long productIdA = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 7000L), true);
List<DiscountItemDTO> discountItemDtoListA = List.of(DiscountData.getDiscountItemDTO(1000L, 100L));
List<Long> productIdsA = Collections.singletonList(productIdA);
DiscountApi.save(DiscountData.getDiscount(0, 1, discountItemDtoListA, 500L, 1, productIdsA, 1), true);
Long discountIdA = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//新建满减活动B-满1件打7折
Long productIdB = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 7000L), true);
List<DiscountItemDTO> discountItemDtoListB = List.of(DiscountData.getDiscountItemDTO(100L, 700L));
List<Long> productIdsB = Collections.singletonList(productIdB);
DiscountApi.save(DiscountData.getDiscount(3, 0, discountItemDtoListB, 500L, 1, productIdsB, 1), true);
Long discountIdB = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB, 1));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
DiscountApi.delete(discountIdB, true);
DiscountApi.delete(discountIdA, true);
ProductApi.delete(productIdB, true);
ProductApi.delete(productIdA, true);
//验证数据
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).get(0), 0, 1, 12742L, 13000L, 0L, 1000L, 0L, 258L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(0), 7000L, 6500L, 0L, 500L, 0L, 0L, 0L, 1.99, 129L,
0L, 0L, 0L, 0L, 500L, null, null, 0L, null, 1, null);
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(1), 7000L, 6500L, 0L, 500L, 0L, 0L, 0L, 1.99, 129L,
0L, 0L, 0L, 0L, 500L, null, null, 0L, null, 1, null);
}
@Test(description = "满足满多层级减折活动,优惠金额是否正确")
public void discountItemsAmountTest() {
Long transportId = DeliveryData.getFreeFeeDelivery(true);
List<Long> categoryIds = getCategoryId(true);
//新建满减活动B-满1件打7折满2件打3.7折
Long productIdA = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 10000L), true);
Long productIdB = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 7347L), true);
List<DiscountItemDTO> discountItemDtoList = List.of(DiscountData.getDiscountItemDTO(100L, 700L), DiscountData.getDiscountItemDTO(200L, 370L));
List<Long> productIds = Arrays.asList(productIdA, productIdB);
DiscountApi.save(DiscountData.getDiscount(3, 0, discountItemDtoList, 50000L, 1, productIds, 1), true);
Long discountId = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB, 2));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
DiscountApi.delete(discountId, true);
ProductApi.delete(productIdB, true);
ProductApi.delete(productIdA, true);
//验证数据
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).get(0), 0, 1, 8955L, 9137L, 0L, 15557L, 0L, 182L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
for (int i=0; i<orderDetailVO.getOrderItemDetailList().size(); i++) {
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(10000L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 10000L, 3700L, 0L, 6300L, 0L, 0L, 0L, 1.99, 74L,
0L, 0L, 0L, 0L, 6300L, null, null, 0L, null, 1, null);
}
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(14694L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 14694L, 5437L, 0L, 9257L, 0L, 0L, 0L, 1.99, 108L,
0L, 0L, 0L, 0L, 9257L, null, null, 0L, null, 2, null);
}
}
}
}

View File

@ -0,0 +1,499 @@
package com.tmerclub.cloud.systemtest.test.amount;
import com.tmerclub.cloud.common.order.dto.OrderDTO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.discount.dto.DiscountItemDTO;
import com.tmerclub.cloud.multishop.mongo.MongoShopWalletLogBO;
import com.tmerclub.cloud.order.vo.OrderDetailVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.PayApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.login.UserApi;
import com.moyuer.cloud.systemtest.api.marketing.CouponApi;
import com.moyuer.cloud.systemtest.api.marketing.DiscountApi;
import com.moyuer.cloud.systemtest.api.marketing.DistributionProdApi;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
import com.moyuer.cloud.systemtest.api.order.ShopCartApi;
import com.moyuer.cloud.systemtest.api.platform.ScoreConfigApi;
import com.moyuer.cloud.systemtest.api.platform.UserLevelApi;
import com.moyuer.cloud.systemtest.api.platform.UserRightsApi;
import com.moyuer.cloud.systemtest.api.store.ShopWalletApi;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.marketing.CouponData;
import com.moyuer.cloud.systemtest.data.marketing.DiscountData;
import com.moyuer.cloud.systemtest.data.marketing.DistributionProdData;
import com.moyuer.cloud.systemtest.data.order.OrderDtoData;
import com.moyuer.cloud.systemtest.data.order.ShopCartData;
import com.moyuer.cloud.systemtest.data.order.SubmitOrderDtoData;
import com.moyuer.cloud.systemtest.data.order.WalletAssert;
import com.moyuer.cloud.systemtest.data.platform.CategoryDtoData;
import com.moyuer.cloud.systemtest.data.platform.ScoreConfigDtoData;
import com.moyuer.cloud.systemtest.data.platform.UserLevelDtoData;
import com.moyuer.cloud.systemtest.data.platform.UserRightsDtoData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author lpj
*/
public class MultipleDiscountsAmountTest {
private static List<Long> getCategoryIdA() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
CategoryApi.update(CategoryDtoData.getCategoryDTO(categoryId));
return Stream.of(categoryId, shopCategoryId).collect(Collectors.toList());
}
private static List<Long> getCategoryIdB() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(false);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(false).get(0).getCategoryId();
CategoryApi.update(CategoryDtoData.getCategoryDTO(categoryId));
return Stream.of(categoryId, shopCategoryId).collect(Collectors.toList());
}
@Test(description = "单店铺下使用多种优惠,优惠金额、付款金额是否正确")
public void sameShopMultipleDiscountsAmountTest() {
Long transportId = DeliveryData.getFreeFeeDelivery(true);
List<Long> categoryIdsA = getCategoryIdA();
Long categoryIdA = categoryIdsA.get(0);
Long shopCategoryIdA = categoryIdsA.get(1);
Long productIdA1 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdA, transportId, 6912L), true);
Long productIdA2 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdA, transportId, 7222L), true);
Long productIdA3 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdA, transportId, 3070L), true);
Long productIdA4 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdA, transportId, 2000L), true);
//商品a1, a4参与满减活动A-每满7减5.33
List<DiscountItemDTO> discountItemDtoListA = List.of(DiscountData.getDiscountItemDTO(700L, 533L));
List<Long> discountProductIdsA = Arrays.asList(productIdA1, productIdA4);
DiscountApi.save(DiscountData.getDiscount(0, 1, discountItemDtoListA, 50000L, 1, discountProductIdsA, 1), true);
Long discountIdA = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//商品a2, a3参与满减活动B-满2件打8.5折满3件打7.7折
List<DiscountItemDTO> discountItemDtoListB = List.of(DiscountData.getDiscountItemDTO(200L, 850L), DiscountData.getDiscountItemDTO(300L, 770L));
List<Long> discountProductIdsB = Arrays.asList(productIdA2, productIdA3);
DiscountApi.save(DiscountData.getDiscount(3, 0, discountItemDtoListB, 50000L, 1, discountProductIdsB, 1), true);
Long discountIdB = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//商品a1, a2, a4参与店铺优惠券满50打3.7折
List<Long> shopCouponProductIds = Arrays.asList(productIdA1, productIdA2, productIdA4);
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 2, 5000L, null, 3.7, 2, 10, 100, 1, shopCouponProductIds));
Long shopCouponId = CouponApi.getShopCouponPage().get(0).getCouponId();
CouponApi.receive(shopCouponId);
//商品a1, a2参与平台优惠券满7.2减5.02
List<Long> platformCouponProductIds = Arrays.asList(productIdA1, productIdA2, productIdA4);
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 720L, 502L, null, 2, 10, 100, 1, platformCouponProductIds));
Long platformCouponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
CouponApi.receive(platformCouponId);
//修改积分配置每15积分抵扣一元最大使用积分比例33.7%
ScoreConfigApi.update(ScoreConfigDtoData.getScoreConfigDTO(15L ,33.7));
//将商品加入购物车
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA1, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA2, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA3, 3));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA4, 1));
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(productIdA1);
//使用优惠券
orderDTO.setCouponIds(Arrays.asList(CouponApi.getUserCouponPage().get(0).getCouponUserId(), CouponApi.getUserCouponPage().get(1).getCouponUserId()));
//使用最大可使用积分
orderDTO.setIsScorePay(1);
orderDTO.setUserUseScore(MyOrderApi.confirm(orderDTO).getMaxUsableScore());
//确认订单
MyOrderApi.confirm(orderDTO);
//提交订单
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA1)).get(0);
//支付订单
PayApi.orderPay(orderNum);
CouponApi.deletePlatformCoupon(platformCouponId);
CouponApi.deleteShopCoupon(shopCouponId);
DiscountApi.delete(discountIdB, true);
DiscountApi.delete(discountIdA, true);
ProductApi.delete(productIdA4, true);
ProductApi.delete(productIdA3, true);
ProductApi.delete(productIdA2, true);
ProductApi.delete(productIdA1, true);
//验证数据
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).get(0), 0, 1, 9880L, 6351L, 3729L, 15264L, 0L, 200L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
for (int i=0; i<orderDetailVO.getOrderItemDetailList().size(); i++) {
//商品a1结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(6912L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 6912L, 401L, 0L, 6190L, 321L, 0L, 30L, 1.99, 14L,
200L, 0L, 121L, 1229L, 4961L, null, null, 0L, null, 1, null);
}
//商品a2结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(7222L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 7222L, 1133L, 0L, 5164L, 925L, 0L, 87L, 1.99, 41L,
580L, 0L, 345L, 3503L, 1661L, null, null, 0L, null, 1, null);
}
//商品a3结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(9210L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 9210L, 4702L, 0L, 2120L, 2388L, 0L, 358L, 1.99, 141L,
2387L, 0L, 1L, 2L, 2118L, null, null, 0L, null, 3, null);
}
//商品a4结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(2000L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 2000L, 115L, 0L, 1790L, 95L, 0L, 9L, 1.99, 4L,
60L, 0L, 35L, 355L, 1435L, null, null, 0L, null, 1, null);
}
}
}
@Test(description = "多店铺下使用多种优惠,优惠金额、付款金额是否正确")
public void differentShopMultipleDiscountsAmountTest() {
//A店铺商品a1, a2, a3, a4
Long transportIdA = DeliveryData.getFreeFeeDelivery(true);
List<Long> categoryIdsA = getCategoryIdA();
Long categoryIdA = categoryIdsA.get(0);
Long shopCategoryIdA = categoryIdsA.get(1);
Long productIdA1 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdA, transportIdA, 6912L), true);
Long productIdA2 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdA, transportIdA, 7222L), true);
Long productIdA3 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdA, transportIdA, 3070L), true);
Long productIdA4 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdA, transportIdA, 2000L), true);
//商品a1, a4参与满减活动A-每满7减5.33
List<DiscountItemDTO> discountItemDtoListA = List.of(DiscountData.getDiscountItemDTO(700L, 533L));
List<Long> discountProductIdsA = Arrays.asList(productIdA1, productIdA4);
DiscountApi.save(DiscountData.getDiscount(0, 1, discountItemDtoListA, 50000L, 1, discountProductIdsA, 1), true);
Long discountIdA = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//商品a2, a3参与满减活动B-满2件打8.5折满3件打7.7折
List<DiscountItemDTO> discountItemDtoListB = List.of(DiscountData.getDiscountItemDTO(200L, 850L), DiscountData.getDiscountItemDTO(300L, 770L));
List<Long> discountProductIdsB = Arrays.asList(productIdA2, productIdA3);
DiscountApi.save(DiscountData.getDiscount(3, 0, discountItemDtoListB, 50000L, 1, discountProductIdsB, 1), true);
Long discountIdB = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//商品a1, a2, a4参与店铺优惠券满50打3.7折
List<Long> shopCouponProductIds = Arrays.asList(productIdA1, productIdA2, productIdA4);
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 2, 5000L, null, 3.7, 2, 10, 100, 1, shopCouponProductIds));
Long shopCouponId = CouponApi.getShopCouponPage().get(0).getCouponId();
CouponApi.receive(shopCouponId);
//B店铺商品b1, b2, b3
Long transportIdB = DeliveryData.getFreeFeeDelivery(false);
List<Long> categoryIdsB = getCategoryIdB();
Long categoryIdB = categoryIdsB.get(0);
Long shopCategoryIdB = categoryIdsB.get(1);
Long productIdB1 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdB, shopCategoryIdB, transportIdB, 16912L), false);
Long productIdB2 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdB, shopCategoryIdB, transportIdB, 7222L), false);
Long productIdB3 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdB, shopCategoryIdB, transportIdB, 3070L), false);
//商品a2, a3参与满减活动B-满1件打8.5折满2件打7.5折
List<DiscountItemDTO> discountItemDtoListC = List.of(DiscountData.getDiscountItemDTO(100L, 850L), DiscountData.getDiscountItemDTO(200L, 750L));
List<Long> discountProductIdsC = Arrays.asList(productIdB1, productIdB3);
DiscountApi.save(DiscountData.getDiscount(3, 0, discountItemDtoListC, 50000L, 1, discountProductIdsC, 1), false);
Long discountIdC = DiscountApi.getDiscountPage(false).get(0).getDiscountId();
//商品a1, a2, b3参与平台优惠券满50减7.2
List<Long> platformCouponProductIds = Arrays.asList(productIdA1, productIdA2, productIdB3);
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 5000L, 720L, null, 2, 10, 100, 1, platformCouponProductIds));
Long platformCouponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
CouponApi.receive(platformCouponId);
//修改积分配置每15积分抵扣一元最大使用积分比例30.7%
ScoreConfigApi.update(ScoreConfigDtoData.getScoreConfigDTO(15L ,30.7));
//新增打9.1折权益
Long discountUserRightsId = UserRightsApi.save(UserRightsDtoData.getDiscounttUserRightsDTO(91));
//用户会员等级添加打9.1折权益
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Collections.singletonList(discountUserRightsId)));
//将商品加入购物车
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA1, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA2, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA3, 3));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA4, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB1, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB2, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB3, 1));
//确认订单数据
Long shopIdA = ProductApi.getProductInfo(productIdA1).getShopId();
Long shopIdB = ProductApi.getProductInfo(productIdB1).getShopId();
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(Arrays.asList(shopIdA, shopIdB));
//使用优惠券
orderDTO.setCouponIds(Arrays.asList(CouponApi.getUserCouponPage().get(0).getCouponUserId(), CouponApi.getUserCouponPage().get(1).getCouponUserId()));
//使用最大可使用积分
orderDTO.setIsScorePay(1);
orderDTO.setUserUseScore(MyOrderApi.confirm(orderDTO).getMaxUsableScore());
//确认订单
MyOrderApi.confirm(orderDTO);
//提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA1));
//支付订单
PayApi.orderPay(orderNumberList);
UserRightsApi.delete(discountUserRightsId);
CouponApi.deletePlatformCoupon(platformCouponId);
CouponApi.deleteShopCoupon(shopCouponId);
DiscountApi.delete(discountIdC, false);
DiscountApi.delete(discountIdB, true);
DiscountApi.delete(discountIdA, true);
ProductApi.delete(productIdB3, false);
ProductApi.delete(productIdB2, false);
ProductApi.delete(productIdB1, false);
ProductApi.delete(productIdA4, true);
ProductApi.delete(productIdA3, true);
ProductApi.delete(productIdA2, true);
ProductApi.delete(productIdA1, true);
//验证数据
for(Long orderNum : orderNumberList) {
if(MyOrderApi.orderDetail(orderNum).getShopId().equals(shopIdA)) {
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).get(0), 0, 1, 9880L, 6109L, 3971L, 15264L, 0L, 200L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
for (int i=0; i<orderDetailVO.getOrderItemDetailList().size(); i++) {
//商品a1结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(6912L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 6912L, 391L, 0L, 6190L, 331L, 0L, 26L, 1.99, 14L,
173L, 56L, 102L, 1229L, 4961L, null, null, 0L, null, 1, null);
}
//商品a2结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(7222L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 7222L, 1115L, 0L, 5164L, 943L, 0L, 74L, 1.99, 41L,
493L, 159L, 291L, 3503L, 1661L, null, null, 0L, null, 1, null);
}
//商品a3结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(9210L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 9210L, 4472L, 0L, 2120L, 2618L, 0L, 297L, 1.99, 141L,
1980L, 638L, 0L, 2L, 2118L, null, null, 0L, null, 3, null);
}
//商品a4结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(2000L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 2000L, 131L, 0L, 1790L, 79L, 0L, 9L, 1.99, 4L,
60L, 19L, 0L, 355L, 1435L, null, null, 0L, null, 1, null);
}
}
}
if(MyOrderApi.orderDetail(orderNum).getShopId().equals(shopIdB)) {
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, false).get(0), 0, 1, 21766L, 13811L, 8397L, 4996L, 0L, 442L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, false);
for (int i = 0; i < orderDetailVO.getOrderItemDetailList().size(); i++) {
//商品b1结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(16912L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 16912L, 8014L, 0L, 4228L, 4670L, 0L, 529L, 1.99, 252L,
3528L, 1141L, 1L, 0L, 4228L, null, null, 0L, null, 1, null);
}
//商品b2结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(7222L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 7222L, 4552L, 0L, 0L, 2670L, 0L, 303L, 1.99, 144L,
2020L, 650L, 0L, 0L, 0L, null, null, 0L, null, 1, null);
}
//商品b3结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(3070L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 3070L, 1245L, 0L, 768L, 1057L, 0L, 83L, 1.99, 46L,
553L, 178L, 326L, 0L, 768L, null, null, 0L, null, 1, null);
}
}
}
}
}
@Test(description = "结算明细使用各种优惠,金额明细是否正确")
public void shopWalletDetail() throws InterruptedException {
//分类A9.1%分类B0.1%分类C0%
Long categoryIdFirst = CategoryApi.save(CategoryDtoData.getCategoryDTO(0, 0L, 0.0));
Long categoryIdSec = CategoryApi.save(CategoryDtoData.getCategoryDTO(1, categoryIdFirst, 0.0));
Long categoryIdA = CategoryApi.save(CategoryDtoData.getCategoryDTO(2, categoryIdSec, 9.1));
Long categoryIdB = CategoryApi.save(CategoryDtoData.getCategoryDTO(2, categoryIdSec, 0.1));
Long categoryIdC = CategoryApi.save(CategoryDtoData.getCategoryDTO(2, categoryIdSec, 0.0));
//A店铺签约分类ABC
CategoryApi.addSigningCategory(CategoryDtoData.getCategoryShopDtoList(Arrays.asList(categoryIdA, categoryIdB, categoryIdC)), true);
//A店铺获取店铺分类idA
List<CategoryAppVO> categoryAppVoListA = CategoryApi.listShopCategory(true);
Long shopCategoryIdA = categoryAppVoListA.get(categoryAppVoListA.size() - 1).getCategoryId();
//A店铺商品a1, a2, a3, a4
Long transportIdA = DeliveryData.getFreeFeeDelivery(true);
Long productIdA1 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdA, transportIdA, 6912L), true);
Long productIdA2 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdA, transportIdA, 7222L), true);
Long productIdA3 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdC, shopCategoryIdA, transportIdA, 3070L), true);
Long productIdA4 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdC, shopCategoryIdA, transportIdA, 2000L), true);
//商品a1, a4参与满减活动A-每满7减5.33
List<DiscountItemDTO> discountItemDtoListA = List.of(DiscountData.getDiscountItemDTO(700L, 533L));
List<Long> discountProductIdsA = Arrays.asList(productIdA1, productIdA4);
DiscountApi.save(DiscountData.getDiscount(0, 1, discountItemDtoListA, 50000L, 1, discountProductIdsA, 1), true);
Long discountIdA = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//商品a2, a3参与满减活动B-满2件打8.5折满3件打7.7折
List<DiscountItemDTO> discountItemDtoListB = List.of(DiscountData.getDiscountItemDTO(200L, 850L), DiscountData.getDiscountItemDTO(300L, 770L));
List<Long> discountProductIdsB = Arrays.asList(productIdA2, productIdA3);
DiscountApi.save(DiscountData.getDiscount(3, 0, discountItemDtoListB, 50000L, 1, discountProductIdsB, 1), true);
Long discountIdB = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//商品a1, a2, a4参与店铺优惠券满50打3.7折
List<Long> shopCouponProductIds = Arrays.asList(productIdA1, productIdA2, productIdA4);
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 2, 5000L, null, 3.7, 2, 10, 100, 1, shopCouponProductIds));
Long shopCouponId = CouponApi.getShopCouponPage().get(0).getCouponId();
CouponApi.receive(shopCouponId);
//商品a1为分销商品直推奖励1%间推奖励为1.21%
DistributionProdApi.save(DistributionProdData.getDistributionSpuDTO(productIdA1, 0, 100L, 1, 121L, 1), true);
//等待保存
TimeUnit.SECONDS.sleep(2L);
//获取分销商品id
Long distributionProdIdA1 = DistributionProdApi.getDistributionProdPage(true).get(0).getDistributionInfo().getDistributionSpuId();
//B店铺签约分类ABC
CategoryApi.addSigningCategory(CategoryDtoData.getCategoryShopDtoList(Arrays.asList(categoryIdA, categoryIdB, categoryIdC)), false);
//B店铺获取店铺分类IdB
List<CategoryAppVO> categoryAppVoListB = CategoryApi.listShopCategory(false);
Long shopCategoryIdB = categoryAppVoListB.get(categoryAppVoListB.size() - 1).getCategoryId();
//B店铺商品b1, b2, b3
Long transportIdB = DeliveryData.getFreeFeeDelivery(false);
Long productIdB1 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdB, shopCategoryIdB, transportIdB, 16912L), false);
Long productIdB2 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdA, shopCategoryIdB, transportIdB, 7222L), false);
Long productIdB3 = ProductApi.createProduct(SpuData.getRealSpu(categoryIdC, shopCategoryIdB, transportIdB, 3070L), false);
//商品a2, a3参与满减活动B-满1件打8.5折满2件打7.5折
List<DiscountItemDTO> discountItemDtoListC = List.of(DiscountData.getDiscountItemDTO(100L, 850L), DiscountData.getDiscountItemDTO(200L, 750L));
List<Long> discountProductIdsC = Arrays.asList(productIdB1, productIdB3);
DiscountApi.save(DiscountData.getDiscount(3, 0, discountItemDtoListC, 50000L, 1, discountProductIdsC, 1), false);
Long discountIdC = DiscountApi.getDiscountPage(false).get(0).getDiscountId();
//商品b1为分销商品直推奖励2间推奖励为2.1
DistributionProdApi.save(DistributionProdData.getDistributionSpuDTO(productIdB1, 1, 200L, 1, 210L, 1), false);
//等待保存
TimeUnit.SECONDS.sleep(2L);
//获取分销商品id
Long distributionProdIdB1 = DistributionProdApi.getDistributionProdPage(false).get(0).getDistributionInfo().getDistributionSpuId();
//商品a1, a2, b3参与平台优惠券满50减7.2
List<Long> platformCouponProductIds = Arrays.asList(productIdA1, productIdA2, productIdB3);
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 5000L, 720L, null, 2, 10, 100, 1, platformCouponProductIds));
Long platformCouponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
CouponApi.receive(platformCouponId);
//修改积分配置每15积分抵扣一元最大使用积分比例30.7%
ScoreConfigApi.update(ScoreConfigDtoData.getScoreConfigDTO(15L ,30.7));
//新增打9.1折权益
Long discountUserRightsId = UserRightsApi.save(UserRightsDtoData.getDiscounttUserRightsDTO(91));
//用户会员等级添加打9.1折权益
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Collections.singletonList(discountUserRightsId)));
//将商品加入购物车
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA1, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA2, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA3, 3));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA4, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB1, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB2, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB3, 1));
//确认订单数据
Long shopIdA = ProductApi.getProductInfo(productIdA1).getShopId();
Long shopIdB = ProductApi.getProductInfo(productIdB1).getShopId();
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(Arrays.asList(shopIdA, shopIdB));
//使用优惠券
orderDTO.setCouponIds(Arrays.asList(CouponApi.getUserCouponPage().get(0).getCouponUserId(), CouponApi.getUserCouponPage().get(1).getCouponUserId()));
//使用积分700
orderDTO.setIsScorePay(1);
orderDTO.setUserUseScore(700L);
//确认订单
MyOrderApi.confirm(orderDTO);
//提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(Arrays.asList(shopIdA, shopIdB)));
//支付订单
PayApi.orderPay(orderNumberList);
DistributionProdApi.delete(distributionProdIdB1, false);
DistributionProdApi.delete(distributionProdIdA1, true);
UserRightsApi.delete(discountUserRightsId);
CouponApi.deletePlatformCoupon(platformCouponId);
CouponApi.deleteShopCoupon(shopCouponId);
DiscountApi.delete(discountIdC, false);
DiscountApi.delete(discountIdB, true);
DiscountApi.delete(discountIdA, true);
ProductApi.delete(productIdB3, false);
ProductApi.delete(productIdB2, false);
ProductApi.delete(productIdB1, false);
ProductApi.delete(productIdA4, true);
ProductApi.delete(productIdA3, true);
ProductApi.delete(productIdA2, true);
ProductApi.delete(productIdA1, true);
CategoryApi.delete(categoryIdC);
CategoryApi.delete(categoryIdB);
CategoryApi.delete(categoryIdA);
CategoryApi.delete(categoryIdSec);
CategoryApi.delete(categoryIdFirst);
//验证数据
for(Long orderNum : orderNumberList) {
if(MyOrderApi.orderDetail(orderNum).getShopId().equals(shopIdA)) {
List<MongoShopWalletLogBO> mongoShopWalletLogBOList = ShopWalletApi.getMongoShopWalletLogBO(orderNum, true);
for(MongoShopWalletLogBO mongoShopWalletLogBO : mongoShopWalletLogBOList) {
if(mongoShopWalletLogBO.getReason().equals(0)) {
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBO, 0, 1, 9827L, 7382L, 2698L, 15264L, 9L, 253L, 0);
}
}
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
for (int i=0; i<orderDetailVO.getOrderItemDetailList().size(); i++) {
//商品a1结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(6912L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 6912L, 471L, 0L, 6190L, 251L, 9L, 14L, 9.1, 66L,
93L, 56L, 102L, 1229L, 4961L, null, null, 0L, null, 1, null);
}
//商品a2结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(7222L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 7222L, 1348L, 0L, 5164L, 710L, 0L, 39L, 9.1, 187L,
260L, 159L, 291L, 3503L, 1661L, null, null, 0L, null, 1, null);
}
//商品a3结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(9210L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 9210L, 5405L, 0L, 2120L, 1685L, 0L, 157L, 0.0, 0L,
1047L, 638L, 0L, 2L, 2118L, null, null, 0L, null, 3, null);
}
//商品a4结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(2000L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 2000L, 158L, 0L, 1790L, 52L, 0L, 5L, 0.0, 0L,
33L, 19L, 0L, 355L, 1435L, null, null, 0L, null, 1, null);
}
}
}
if(MyOrderApi.orderDetail(orderNum).getShopId().equals(shopIdB)) {
List<MongoShopWalletLogBO> mongoShopWalletLogBOList = ShopWalletApi.getMongoShopWalletLogBO(orderNum, false);
for(MongoShopWalletLogBO mongoShopWalletLogBO : mongoShopWalletLogBOList) {
if(mongoShopWalletLogBO.getReason().equals(0)) {
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBO, 0, 1, 21538L, 16678L, 5530L, 4996L, 410L, 670L, 0);
}
}
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, false);
for (int i = 0; i < orderDetailVO.getOrderItemDetailList().size(); i++) {
//商品b1结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(16912L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 16912L, 9668L, 0L, 4228L, 3016L, 410L, 281L, 0.1, 13L,
1874L, 1141L, 1L, 0L, 4228L, null, null, 0L, null, 1, null);
}
//商品b2结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(7222L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 7222L, 5505L, 0L, 0L, 1717L, 0L, 160L, 9.1, 657L,
1067L, 650L, 0L, 0L, 0L, null, null, 0L, null, 1, null);
}
//商品b3结算明细验证
if (orderDetailVO.getOrderItemDetailList().get(i).getSpuTotalAmount().equals(3070L)) {
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(i), 3070L, 1505L, 0L, 768L, 797L, 0L, 44L, 0.0, 0L,
293L, 178L, 326L, 0L, 768L, null, null, 0L, null, 1, null);
}
}
}
}
}
}

View File

@ -0,0 +1,449 @@
package com.tmerclub.cloud.systemtest.test.marketing;
import com.tmerclub.cloud.common.order.dto.OrderDTO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.coupon.vo.CouponVO;
import com.tmerclub.cloud.discount.dto.DiscountItemDTO;
import com.tmerclub.cloud.order.vo.OrderDetailVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.PayApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.login.UserApi;
import com.moyuer.cloud.systemtest.api.marketing.CouponApi;
import com.moyuer.cloud.systemtest.api.marketing.DiscountApi;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
import com.moyuer.cloud.systemtest.api.order.OrderApi;
import com.moyuer.cloud.systemtest.api.platform.ScoreConfigApi;
import com.moyuer.cloud.systemtest.api.platform.UserLevelApi;
import com.moyuer.cloud.systemtest.api.platform.UserRightsApi;
import com.moyuer.cloud.systemtest.api.store.ShopWalletApi;
import com.moyuer.cloud.systemtest.api.store.TransportApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierProductApi;
import com.moyuer.cloud.systemtest.data.amount.PreSaleSpuData;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.marketing.CouponData;
import com.moyuer.cloud.systemtest.data.marketing.DiscountData;
import com.moyuer.cloud.systemtest.data.order.OrderAdminDtoData;
import com.moyuer.cloud.systemtest.data.order.OrderDtoData;
import com.moyuer.cloud.systemtest.data.order.SubmitOrderDtoData;
import com.moyuer.cloud.systemtest.data.order.WalletAssert;
import com.moyuer.cloud.systemtest.data.platform.CategoryDtoData;
import com.moyuer.cloud.systemtest.data.platform.ScoreConfigDtoData;
import com.moyuer.cloud.systemtest.data.platform.UserLevelDtoData;
import com.moyuer.cloud.systemtest.data.platform.UserRightsDtoData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import com.moyuer.cloud.systemtest.data.supplier.SupplierProductData;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author lpj
*/
public class DiscountAmountTest {
private List<Long> getCategoryId() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
CategoryApi.update(CategoryDtoData.getCategoryDTO(categoryId));
return Stream.of(categoryId, shopCategoryId).collect(Collectors.toList());
}
/**
* 广州荔湾区可配送8元运费商品
* */
@DataProvider(name = "realProductDelivery")
private Object[][] realProductDeliveryNoFree() {
TransportApi.addTransport(DeliveryData.getTransportDTO(), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
Long productId = ProductApi.createProduct(SpuData.getRealSpu(getCategoryId().get(0), getCategoryId().get(1), transportId, 18800L), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "virtualProduct")
private Object[][] virtualProduct() {
Long shopCategoryId = CategoryApi.listShopCategory(true).get(CategoryApi.listShopCategory(true).size()-1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
Long productId = ProductApi.createProduct(SpuData.getUnRealSpu(categoryId, shopCategoryId, 18800L, 1), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "depositPreSaleProduct")
private Object[][] depositPreSaleProduct() {
TransportApi.addTransport(DeliveryData.getTransportDTO(), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
Long productId = ProductApi.createProduct(PreSaleSpuData.getDepositPreSaleSpu(getCategoryId().get(0), getCategoryId().get(1), transportId, 18800L), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "supplierProduct")
private Object[][] supplierProduct() {
Long supplierProductId = SupplierProductData.getSupplierProductId(6600L, DeliveryData.getSupplierFreeFeeDelivery(true), true);
Long productId = SupplierProductData.getProductId(supplierProductId, 18800L, 1, null, true, true);
return new Object[][]{{productId, supplierProductId}};
}
@Test(description = "多优惠金额叠加实物订单", dataProvider = "realProductDelivery")
public void discountAmountTestWithRealProduct(Long productId) throws InterruptedException {
//新建满减活动
List<DiscountItemDTO> discountItemDTOList = Arrays.asList(DiscountData.getDiscountItemDTO(10000L,1000L), DiscountData.getDiscountItemDTO(10100L, 5000L));
List<Long> productIds = Collections.singletonList(productId);
DiscountApi.save(DiscountData.getDiscount(0, 0, discountItemDTOList, 50000L, 1, productIds, 1), true);
//获取满减活动id
Long discountId = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//新建店铺代金券
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 1, productIds));
//获取店铺优惠券id
Long shopCouponId = CouponApi.getShopCouponPage().get(0).getCouponId();
//用户领取店铺优惠券
CouponApi.receive(shopCouponId);
//新建平台代金券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 0, productIds));
//获取优惠券id
Long platformCouponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//用户领取优惠券
CouponApi.receive(platformCouponId);
//新增打8折权益
Long discountUserRightsId = UserRightsApi.save(UserRightsDtoData.getDiscounttUserRightsDTO(80));
//新增包邮权益
Long freeFeeUserRightsId = UserRightsApi.save(UserRightsDtoData.getFreeFeeUserRightsDTO());
//用户会员等级添加包邮和打8折权益
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Arrays.asList(discountUserRightsId, freeFeeUserRightsId)));
//修改积分配置每15积分抵扣一元最大使用积分比例100%
ScoreConfigApi.update(ScoreConfigDtoData.getScoreConfigDTO(15L, 100D));
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(productId, 1);
//用户使用优惠券
orderDTO.setCouponIds(Arrays.asList(CouponApi.getUserCouponPage().get(0).getCouponUserId(), CouponApi.getUserCouponPage().get(1).getCouponUserId()));
//使用150积分
orderDTO.setIsScorePay(1);
orderDTO.setUserUseScore(150L);
//确认订单
MyOrderApi.confirm(orderDTO);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//商家修改订单金额为50元
TimeUnit.SECONDS.sleep(2L);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumberList.get(0), 5000L, 0L));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
TimeUnit.SECONDS.sleep(2L);
//对订单进行退款
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
TimeUnit.SECONDS.sleep(2L);
//删除会员权益
UserRightsApi.delete(discountUserRightsId);
UserRightsApi.delete(freeFeeUserRightsId);
//用户删除领取的店铺优惠券
CouponApi.deleteUserCoupon(CouponApi.getUserCouponPage().get(0).getCouponUserId());
//根据平台优惠券id获取优惠券信息
CouponVO platformCouponVO = CouponApi.getPlatformCouponInfo(platformCouponId);
//修改平台优惠券为暂不投放
CouponApi.updatePlatformCoupon(CouponData.getUpdateCouponDTO(platformCouponVO));
//删除平台代金券券
CouponApi.deletePlatformCoupon(platformCouponId);
//根据店铺优惠券id获取店铺优惠券信息
CouponVO shopCouponVO = CouponApi.getShopCouponInfo(shopCouponId);
//修改店铺优惠券为暂不投放
CouponApi.updateShopCoupon(CouponData.getUpdateCouponDTO(shopCouponVO));
//删除店铺代金券
CouponApi.deleteShopCoupon(shopCouponId);
//商家删除满减
DiscountApi.delete(discountId, true);
//删除商品
ProductApi.delete(productId, true);
//删除运费模板
TransportApi.deleteTransport(TransportApi.infoTransport(true).get(0).getTransportId(), true);
//运行后验证数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 3);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true);
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(0), 18800L, 5000L, 0L, 10816L, 2984L, 0L, 150L, 1.99, 159L,
1000L, 2640L, 300L, 300L, 5000L, null, null, -4560L, 5000L, 1, 1);
WalletAssert.shopOrderFreightAssert(orderDetailVO, 800L, 0L, 800L);
}
@Test(description = "多优惠金额叠加虚拟订单", dataProvider = "virtualProduct")
public void discountAmountTestWithVirtualProduct(Long productId) throws InterruptedException {
//新建满减活动
List<DiscountItemDTO> discountItemDTOList = Arrays.asList(DiscountData.getDiscountItemDTO(10000L,1000L), DiscountData.getDiscountItemDTO(10100L, 5000L));
List<Long> productIds = Collections.singletonList(productId);
DiscountApi.save(DiscountData.getDiscount(0, 0, discountItemDTOList, 50000L, 1, productIds, 1), true);
//获取满减活动id
Long discountId = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//新建店铺代金券
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 1, productIds));
//获取店铺优惠券id
Long shopCouponId = CouponApi.getShopCouponPage().get(0).getCouponId();
//用户领取店铺优惠券
CouponApi.receive(shopCouponId);
//新建平台代金券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 0, productIds));
//获取优惠券id
Long platformCouponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//用户领取优惠券
CouponApi.receive(platformCouponId);
//新增打8折权益
Long discountUserRightsId = UserRightsApi.save(UserRightsDtoData.getDiscounttUserRightsDTO(80));
//新增包邮权益
Long freeFeeUserRightsId = UserRightsApi.save(UserRightsDtoData.getFreeFeeUserRightsDTO());
//用户会员等级添加包邮和打8折权益
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Arrays.asList(discountUserRightsId, freeFeeUserRightsId)));
//修改积分配置每15积分抵扣一元最大使用积分比例100%
ScoreConfigApi.update(ScoreConfigDtoData.getScoreConfigDTO(15L, 100D));
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(productId, 1);
//用户使用优惠券
orderDTO.setCouponIds(Arrays.asList(CouponApi.getUserCouponPage().get(0).getCouponUserId(), CouponApi.getUserCouponPage().get(1).getCouponUserId()));
//使用150积分
orderDTO.setIsScorePay(1);
orderDTO.setUserUseScore(150L);
//确认订单
MyOrderApi.confirm(orderDTO);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//商家修改订单金额为50元
TimeUnit.SECONDS.sleep(2L);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumberList.get(0), 5000L, 0L));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
TimeUnit.SECONDS.sleep(2L);
//对订单进行退款
Long refundId = OrderRefund.virtualOrderRefund(orderNumberList.get(0));
TimeUnit.SECONDS.sleep(2L);
//删除会员权益
UserRightsApi.delete(discountUserRightsId);
UserRightsApi.delete(freeFeeUserRightsId);
//用户删除领取的店铺优惠券
CouponApi.deleteUserCoupon(CouponApi.getUserCouponPage().get(0).getCouponUserId());
//根据平台优惠券id获取优惠券信息
CouponVO platformCouponVO = CouponApi.getPlatformCouponInfo(platformCouponId);
//修改平台优惠券为暂不投放
CouponApi.updatePlatformCoupon(CouponData.getUpdateCouponDTO(platformCouponVO));
//删除平台代金券券
CouponApi.deletePlatformCoupon(platformCouponId);
//根据店铺优惠券id获取店铺优惠券信息
CouponVO shopCouponVO = CouponApi.getShopCouponInfo(shopCouponId);
//修改店铺优惠券为暂不投放
CouponApi.updateShopCoupon(CouponData.getUpdateCouponDTO(shopCouponVO));
//删除店铺代金券
CouponApi.deleteShopCoupon(shopCouponId);
//商家删除满减
DiscountApi.delete(discountId, true);
//删除商品
ProductApi.delete(productId, true);
//运行后验证数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 2);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true);
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(0), 18800L, 5000L, 0L, 10816L, 2984L, 0L, 150L, 1.99, 159L,
1000L, 2640L, 300L, 300L, 5000L, null, null, -4560L, 5000L, 1, 1);
WalletAssert.shopOrderFreightAssert(orderDetailVO, 0L, 0L, 0L);
}
@Test(description = "多优惠金额叠加预售订单", dataProvider = "depositPreSaleProduct")
public void discountAmountTestWithDepositPreSaleProduct(Long productId) throws InterruptedException {
//新建满减活动
List<DiscountItemDTO> discountItemDTOList = Arrays.asList(DiscountData.getDiscountItemDTO(10000L,1000L), DiscountData.getDiscountItemDTO(10100L, 5000L));
List<Long> productIds = Collections.singletonList(productId);
DiscountApi.save(DiscountData.getDiscount(0, 0, discountItemDTOList, 50000L, 1, productIds, 1), true);
//获取满减活动id
Long discountId = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//新建店铺代金券
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 1, productIds));
//获取店铺优惠券id
Long shopCouponId = CouponApi.getShopCouponPage().get(0).getCouponId();
//用户领取店铺优惠券
CouponApi.receive(shopCouponId);
//新建平台代金券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 0, productIds));
//获取优惠券id
Long platformCouponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//用户领取优惠券
CouponApi.receive(platformCouponId);
//新增打8折权益
Long discountUserRightsId = UserRightsApi.save(UserRightsDtoData.getDiscounttUserRightsDTO(80));
//新增包邮权益
Long freeFeeUserRightsId = UserRightsApi.save(UserRightsDtoData.getFreeFeeUserRightsDTO());
//用户会员等级添加包邮和打8折权益
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Arrays.asList(discountUserRightsId, freeFeeUserRightsId)));
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(productId, 1);
//用户使用优惠券
orderDTO.setCouponIds(Arrays.asList(CouponApi.getUserCouponPage().get(0).getCouponUserId(), CouponApi.getUserCouponPage().get(1).getCouponUserId()));
//确认订单
MyOrderApi.confirm(orderDTO);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//商家修改订单金额为50元
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumberList.get(0), 5000L, 0L));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
TimeUnit.SECONDS.sleep(2L);
PayApi.orderPayBalance(orderNumberList.get(0));
//对订单进行退款
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
TimeUnit.SECONDS.sleep(2L);
//删除会员权益
UserRightsApi.delete(discountUserRightsId);
UserRightsApi.delete(freeFeeUserRightsId);
//用户删除领取的店铺优惠券
CouponApi.deleteUserCoupon(CouponApi.getUserCouponPage().get(0).getCouponUserId());
//根据平台优惠券id获取优惠券信息
CouponVO platformCouponVO = CouponApi.getPlatformCouponInfo(platformCouponId);
//修改平台优惠券为暂不投放
CouponApi.updatePlatformCoupon(CouponData.getUpdateCouponDTO(platformCouponVO));
//删除平台代金券券
CouponApi.deletePlatformCoupon(platformCouponId);
//根据店铺优惠券id获取店铺优惠券信息
CouponVO shopCouponVO = CouponApi.getShopCouponInfo(shopCouponId);
//修改店铺优惠券为暂不投放
CouponApi.updateShopCoupon(CouponData.getUpdateCouponDTO(shopCouponVO));
//删除店铺代金券
CouponApi.deleteShopCoupon(shopCouponId);
//商家删除满减
DiscountApi.delete(discountId, true);
//删除商品
ProductApi.delete(productId, true);
//删除运费模板
TransportApi.deleteTransport(TransportApi.infoTransport(true).get(0).getTransportId(), true);
//运行后验证数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 3);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true);
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(0), 18800L, 5800L, 0L, 12802L, 198L, 0L, 0L, 1.99, 119L,
0L, 0L, 300L, 300L, 5000L, null, null, -6400L, 5800L, 1, 1);
WalletAssert.shopOrderFreightAssert(orderDetailVO, 800L, 0L, 800L);
}
@Test(description = "多优惠金额叠加供应商订单", dataProvider = "supplierProduct")
public void discountAmountTestWithSupplierProduct(Long productId, Long supplierProductId) throws InterruptedException {
//新建满减活动
List<DiscountItemDTO> discountItemDTOList = Arrays.asList(DiscountData.getDiscountItemDTO(10000L,1000L), DiscountData.getDiscountItemDTO(10100L, 5000L));
List<Long> productIds = Collections.singletonList(productId);
DiscountApi.save(DiscountData.getDiscount(0, 0, discountItemDTOList, 50000L, 1, productIds, 1), true);
//获取满减活动id
Long discountId = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//新建店铺代金券
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 1, productIds));
//获取店铺优惠券id
Long shopCouponId = CouponApi.getShopCouponPage().get(0).getCouponId();
//用户领取店铺优惠券
CouponApi.receive(shopCouponId);
//新建平台代金券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 0, productIds));
//获取优惠券id
Long platformCouponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//用户领取优惠券
CouponApi.receive(platformCouponId);
//新增打8折权益
Long discountUserRightsId = UserRightsApi.save(UserRightsDtoData.getDiscounttUserRightsDTO(80));
//新增包邮权益
Long freeFeeUserRightsId = UserRightsApi.save(UserRightsDtoData.getFreeFeeUserRightsDTO());
//用户会员等级添加包邮和打8折权益
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Arrays.asList(discountUserRightsId, freeFeeUserRightsId)));
//修改积分配置每15积分抵扣一元最大使用积分比例100%
ScoreConfigApi.update(ScoreConfigDtoData.getScoreConfigDTO(15L ,100D));
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(productId, 1);
//用户使用优惠券
orderDTO.setCouponIds(Arrays.asList(CouponApi.getUserCouponPage().get(0).getCouponUserId(), CouponApi.getUserCouponPage().get(1).getCouponUserId()));
//使用150积分
orderDTO.setIsScorePay(1);
orderDTO.setUserUseScore(150L);
//确认订单
MyOrderApi.confirm(orderDTO);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//商家修改订单金额为50元
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumberList.get(0), 5000L, 0L));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
TimeUnit.SECONDS.sleep(2L);
//对订单进行退款
Long refundId = OrderRefund.supplierOrderRefund(orderNumberList.get(0));
TimeUnit.SECONDS.sleep(2L);
//删除会员权益
UserRightsApi.delete(discountUserRightsId);
UserRightsApi.delete(freeFeeUserRightsId);
//用户删除领取的店铺优惠券
CouponApi.deleteUserCoupon(CouponApi.getUserCouponPage().get(0).getCouponUserId());
//根据平台优惠券id获取优惠券信息
CouponVO platformCouponVO = CouponApi.getPlatformCouponInfo(platformCouponId);
//修改平台优惠券为暂不投放
CouponApi.updatePlatformCoupon(CouponData.getUpdateCouponDTO(platformCouponVO));
//删除平台代金券券
CouponApi.deletePlatformCoupon(platformCouponId);
//根据店铺优惠券id获取店铺优惠券信息
CouponVO shopCouponVO = CouponApi.getShopCouponInfo(shopCouponId);
//修改店铺优惠券为暂不投放
CouponApi.updateShopCoupon(CouponData.getUpdateCouponDTO(shopCouponVO));
//删除店铺代金券
CouponApi.deleteShopCoupon(shopCouponId);
//商家删除满减
DiscountApi.delete(discountId, true);
//删除商品
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
//运行后验证数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 2);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true);
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(0), 18800L, 5000L, 6600L, 10816L, 2984L, 0L, 150L, 1.99, 28L,
1000L, 2640L, 300L, 300L, 5000L, null, null, -4560L, 5000L, 1, 1);
}
}

View File

@ -0,0 +1,253 @@
package com.tmerclub.cloud.systemtest.test.marketing;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.discount.dto.DiscountItemDTO;
import com.tmerclub.cloud.discount.vo.DiscountVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.PayApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.marketing.DiscountApi;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
import com.moyuer.cloud.systemtest.api.store.ShopWalletApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierProductApi;
import com.moyuer.cloud.systemtest.data.amount.OfflineHandleEventDtoData;
import com.moyuer.cloud.systemtest.data.amount.PreSaleSpuData;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.marketing.DiscountData;
import com.moyuer.cloud.systemtest.data.order.OrderDtoData;
import com.moyuer.cloud.systemtest.data.order.SubmitOrderDtoData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import com.moyuer.cloud.systemtest.data.supplier.SupplierProductData;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @author lpj
*/
public class DiscountTest {
@DataProvider(name = "realProduct")
private Object[][] realProduct() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "virtualProduct")
private Object[][] virtualProduct() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
Long productId = ProductApi.createProduct(SpuData.getUnRealSpu(categoryId, shopCategoryId, 8800L, 1), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "fullPreSaleProduct")
private Object[][] fullPreSaleProduct() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
Long productId = ProductApi.createProduct(PreSaleSpuData.getFullPreSaleSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "depositPreSaleProduct")
private Object[][] depositPreSaleProduct() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
Long productId = ProductApi.createProduct(PreSaleSpuData.getDepositPreSaleSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "supplierProduct")
private Object[][] supplierProduct() {
Long supplierProductId = SupplierProductData.getSupplierProductId(6600L, DeliveryData.getSupplierFreeFeeDelivery(true), true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8800L, 1, null, true, true);
return new Object[][]{{productId, supplierProductId}};
}
@Test(description = "满减基本流程", dataProvider = "realProduct")
public void discountFlow(Long productId) throws InterruptedException {
//新建满减活动
List<DiscountItemDTO> discountItemDTOList = Arrays.asList(DiscountData.getDiscountItemDTO(10000L,1000L), DiscountData.getDiscountItemDTO(10100L, 5000L));
List<Long> productIds = Collections.singletonList(productId);
DiscountApi.save(DiscountData.getDiscount(0, 0, discountItemDTOList, 50000L, 1, productIds, 1), true);
//获取满减活动id
Long discountId = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//根据id获取满减活动信息
DiscountVO discountVO = DiscountApi.getDiscountInfo(discountId);
//修改信息后更新满减活动
DiscountApi.update(DiscountData.getUpdateDiscountDTO(discountVO));
//用户购买商品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 2));
//提交订单获取订单id
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
TimeUnit.SECONDS.sleep(2L);
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
//平台违规下架活动
DiscountApi.offline(OfflineHandleEventDtoData.getOfflineHandleEventDTO(null, discountId, "违规下架原因", null, null, null));
//申请上架审核失败
//商家根据活动id获取下架信息
OfflineHandleEventVO offlineHandleEventVO = DiscountApi.shopGetOfflineHandleEvent(discountId);
//商家申请上架
DiscountApi.applyDiscount(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = DiscountApi.platformGetOfflineHandleEvent(discountId);
//平台审核失败
DiscountApi.auditDiscount(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, "审核失败原因", 4));
//申请上架审核成功
//商家根据活动id获取下架信息
offlineHandleEventVO = DiscountApi.shopGetOfflineHandleEvent(discountId);
//商家申请上架
DiscountApi.applyDiscount(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = DiscountApi.platformGetOfflineHandleEvent(discountId);
//平台审核成功
DiscountApi.auditDiscount(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, null, 3));
//商家删除满减
DiscountApi.delete(discountId, true);
//删除商品
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), true).getOrderItemDetailList().get(0).getDiscountAmount(), 5000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 12600);
}
@Test(description = "虚拟商品参与满减基本流程", dataProvider = "virtualProduct")
public void discountFlowWithVirtualProduct(Long productId) throws InterruptedException {
//新建满减活动
List<DiscountItemDTO> discountItemDTOList = Arrays.asList(DiscountData.getDiscountItemDTO(10000L,1000L), DiscountData.getDiscountItemDTO(10100L, 5000L));
List<Long> productIds = Collections.singletonList(productId);
DiscountApi.save(DiscountData.getDiscount(0, 0, discountItemDTOList, 50000L, 1, productIds, 1), true);
//获取满减活动id
Long discountId = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//根据id获取满减活动信息
DiscountVO discountVO = DiscountApi.getDiscountInfo(discountId);
//修改信息后更新满减活动
DiscountApi.update(DiscountData.getUpdateDiscountDTO(discountVO));
//用户购买商品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 2));
//提交订单获取订单id
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = OrderRefund.virtualOrderRefund(orderNumberList.get(0));
//商家删除满减
DiscountApi.delete(discountId, true);
//删除商品
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), true).getOrderItemDetailList().get(0).getDiscountAmount(), 5000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 12600);
}
@Test(description = "全款预售商品参与满减基本流程", dataProvider = "fullPreSaleProduct")
public void discountFlowWithFullPreSaleProduct(Long productId) throws InterruptedException {
//新建满减活动
List<DiscountItemDTO> discountItemDTOList = Arrays.asList(DiscountData.getDiscountItemDTO(10000L,1000L), DiscountData.getDiscountItemDTO(10100L, 5000L));
List<Long> productIds = Collections.singletonList(productId);
DiscountApi.save(DiscountData.getDiscount(0, 0, discountItemDTOList, 50000L, 1, productIds, 1), true);
//获取满减活动id
Long discountId = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//根据id获取满减活动信息
DiscountVO discountVO = DiscountApi.getDiscountInfo(discountId);
//修改信息后更新满减活动
DiscountApi.update(DiscountData.getUpdateDiscountDTO(discountVO));
//用户购买商品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 2));
//提交订单获取订单id
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
//商家删除满减
DiscountApi.delete(discountId, true);
//删除商品
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), true).getOrderItemDetailList().get(0).getDiscountAmount(), 5000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 12600);
}
@Test(description = "定金预售商品参与满减基本流程", dataProvider = "depositPreSaleProduct")
public void discountFlowWithDepositPreSaleProduct(Long productId) throws InterruptedException {
//新建满减活动
List<DiscountItemDTO> discountItemDTOList = Arrays.asList(DiscountData.getDiscountItemDTO(10000L,1000L), DiscountData.getDiscountItemDTO(10100L, 5000L));
List<Long> productIds = Collections.singletonList(productId);
DiscountApi.save(DiscountData.getDiscount(0, 0, discountItemDTOList, 50000L, 1, productIds, 1), true);
//获取满减活动id
Long discountId = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//根据id获取满减活动信息
DiscountVO discountVO = DiscountApi.getDiscountInfo(discountId);
//修改信息后更新满减活动
DiscountApi.update(DiscountData.getUpdateDiscountDTO(discountVO));
//用户购买商品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 2));
//提交订单获取订单id
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//根据订单id支付尾款
TimeUnit.SECONDS.sleep(2L);
PayApi.orderPayBalance(orderNumberList.get(0));
//对订单进行退款
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
//商家删除满减
DiscountApi.delete(discountId, true);
//删除商品
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), true).getOrderItemDetailList().get(0).getDiscountAmount(), 5000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 10600);
}
@Test(description = "供应商发货的供应商商品参与满减基本流程", dataProvider = "supplierProduct")
public void discountFlowWithSupplierProduct(Long productId, Long supplierProductId) throws InterruptedException {
//新建满减活动
List<DiscountItemDTO> discountItemDTOList = Arrays.asList(DiscountData.getDiscountItemDTO(10000L,1000L), DiscountData.getDiscountItemDTO(10100L, 4000L));
List<Long> productIds = Collections.singletonList(productId);
DiscountApi.save(DiscountData.getDiscount(0, 0, discountItemDTOList, 50000L, 1, productIds, 1), true);
//获取满减活动id
Long discountId = DiscountApi.getDiscountPage(true).get(0).getDiscountId();
//根据id获取满减活动信息
DiscountVO discountVO = DiscountApi.getDiscountInfo(discountId);
//修改信息后更新满减活动
DiscountApi.update(DiscountData.getUpdateDiscountDTO(discountVO));
//用户购买商品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 2));
//提交订单获取订单id
TimeUnit.SECONDS.sleep(2L);
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = OrderRefund.supplierOrderRefund(orderNumberList.get(0));
//商家删除满减
DiscountApi.delete(discountId, true);
//删除商品
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), true).getOrderItemDetailList().get(0).getDiscountAmount(), 4000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 13600);
}
}

View File

@ -0,0 +1,169 @@
package com.tmerclub.cloud.systemtest.test.marketing;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.seckill.model.SeckillCategory;
import com.tmerclub.cloud.seckill.vo.SeckillSpuVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.marketing.SeckillApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierProductApi;
import com.moyuer.cloud.systemtest.data.amount.OfflineHandleEventDtoData;
import com.moyuer.cloud.systemtest.data.amount.PreSaleSpuData;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.marketing.SeckillData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import com.moyuer.cloud.systemtest.data.supplier.SupplierProductData;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.List;
/**
* @author lpj
*/
public class SeckillTest {
@DataProvider(name = "realProduct")
private Object[][] realProduct() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "virtualProduct")
private Object[][] virtualProduct() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
Long productId = ProductApi.createProduct(SpuData.getUnRealSpu(categoryId, shopCategoryId, 8800L, 1), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "fullPreSaleProduct")
private Object[][] fullPreSaleProduct() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
Long productId = ProductApi.createProduct(PreSaleSpuData.getFullPreSaleSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "supplierProduct")
private Object[][] supplierProduct() {
Long supplierProductId = SupplierProductData.getSupplierProductId(6600L, DeliveryData.getSupplierFreeFeeDelivery(true), true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8800L, 1, null, true, true);
return new Object[][]{{productId, supplierProductId}};
}
@Test(description = "实物秒杀活动基本流程", dataProvider = "realProduct")
public void secKillFlowWithRealProduct(Long productId) {
//新增秒杀分类
SeckillApi.saveSeckillCategory(SeckillData.getSeckillCategoryDTO());
//获取秒杀分类id
List<SeckillCategory> seckillCategoryList = JSON.parseArray(SeckillApi.getSeckillCategoryList().toString(), SeckillCategory.class);
Long seckillCategoryId = seckillCategoryList.get(seckillCategoryList.size()-1).getCategoryId();
//参与秒杀的时间戳
Long startTimestamps = SeckillApi.getSeckillList().get(1).getStartTime().getTime();
//新建秒杀活动
SeckillApi.saveSeckill(SeckillData.getSeckillDTO(productId,seckillCategoryId, startTimestamps));
//获取秒杀活动id
List<SeckillSpuVO> seckillSpuVOList = SeckillApi.getSeckillSpuList(startTimestamps);
Long seckillId = seckillSpuVOList.get(seckillSpuVOList.size()-1).getSeckillId();
//平台违规下架活动
SeckillApi.offline(OfflineHandleEventDtoData.getOfflineHandleEventDTO(null, seckillId, "违规下架原因", null, null, null));
//申请上架审核失败
//商家根据活动id获取下架信息
OfflineHandleEventVO offlineHandleEventVO = SeckillApi.shopGetOfflineHandleEvent(seckillId);
//商家申请上架
SeckillApi.apply(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = SeckillApi.platformGetOfflineHandleEvent(seckillId);
//平台审核失败
SeckillApi.audit(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, "审核失败原因", 4));
//申请上架审核成功
//商家根据活动id获取下架信息
offlineHandleEventVO = SeckillApi.shopGetOfflineHandleEvent(seckillId);
//商家申请上架
SeckillApi.apply(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = SeckillApi.platformGetOfflineHandleEvent(seckillId);
//平台审核成功
SeckillApi.audit(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, null, 3));
//失效秒杀活动
SeckillApi.invalidSeckill(seckillId);
//删除商品
ProductApi.delete(productId, true);
//删除秒杀分类
SeckillApi.deleteSeckillCategory(seckillCategoryId);
}
@Test(description = "虚拟秒杀活动基本流程", dataProvider = "virtualProduct")
public void secKillFlowWithVirtualProduct(Long productId) {
//新增秒杀分类
SeckillApi.saveSeckillCategory(SeckillData.getSeckillCategoryDTO());
//获取秒杀分类id
List<SeckillCategory> seckillCategoryList = JSON.parseArray(SeckillApi.getSeckillCategoryList().toString(), SeckillCategory.class);
Long seckillCategoryId = seckillCategoryList.get(seckillCategoryList.size()-1).getCategoryId();
//参与秒杀的时间戳
Long startTimestamps = SeckillApi.getSeckillList().get(1).getStartTime().getTime();
//新建秒杀活动
SeckillApi.saveSeckill(SeckillData.getSeckillDTO(productId,seckillCategoryId, startTimestamps));
//获取秒杀活动id
List<SeckillSpuVO> seckillSpuVOList = SeckillApi.getSeckillSpuList(startTimestamps);
Long seckillId = seckillSpuVOList.get(seckillSpuVOList.size()-1).getSeckillId();
//失效秒杀活动
SeckillApi.invalidSeckill(seckillId);
//删除商品
ProductApi.delete(productId, true);
//删除秒杀分类
SeckillApi.deleteSeckillCategory(seckillCategoryId);
}
@Test(description = "全款预售秒杀活动基本流程", dataProvider = "fullPreSaleProduct")
public void secKillFlowWithFullPreSaleProduct(Long productId) {
//新增秒杀分类
SeckillApi.saveSeckillCategory(SeckillData.getSeckillCategoryDTO());
//获取秒杀分类id
List<SeckillCategory> seckillCategoryList = JSON.parseArray(SeckillApi.getSeckillCategoryList().toString(), SeckillCategory.class);
Long seckillCategoryId = seckillCategoryList.get(seckillCategoryList.size()-1).getCategoryId();
//参与秒杀的时间戳
Long startTimestamps = SeckillApi.getSeckillList().get(1).getStartTime().getTime();
//新建秒杀活动
SeckillApi.saveSeckill(SeckillData.getSeckillDTO(productId,seckillCategoryId, startTimestamps));
//获取秒杀活动id
List<SeckillSpuVO> seckillSpuVOList = SeckillApi.getSeckillSpuList(startTimestamps);
Long seckillId = seckillSpuVOList.get(seckillSpuVOList.size()-1).getSeckillId();
//失效秒杀活动
SeckillApi.invalidSeckill(seckillId);
//删除商品
ProductApi.delete(productId, true);
//删除秒杀分类
SeckillApi.deleteSeckillCategory(seckillCategoryId);
}
@Test(description = "供应商发货的供应商商品秒杀活动基本流程", dataProvider = "supplierProduct")
private void secKillFlowWithSupplierProduct(Long productId, Long supplierProductId) {
//新增秒杀分类
SeckillApi.saveSeckillCategory(SeckillData.getSeckillCategoryDTO());
//获取秒杀分类id
List<SeckillCategory> seckillCategoryList = JSON.parseArray(SeckillApi.getSeckillCategoryList().toString(), SeckillCategory.class);
Long seckillCategoryId = seckillCategoryList.get(seckillCategoryList.size()-1).getCategoryId();
//参与秒杀的时间戳
Long startTimestamps = SeckillApi.getSeckillList().get(1).getStartTime().getTime();
//新建秒杀活动
SeckillApi.saveSeckill(SeckillData.getSeckillDTO(productId,seckillCategoryId, startTimestamps));
//获取秒杀活动id
List<SeckillSpuVO> seckillSpuVOList = SeckillApi.getSeckillSpuList(startTimestamps);
Long seckillId = seckillSpuVOList.get(seckillSpuVOList.size()-1).getSeckillId();
//失效秒杀活动
SeckillApi.invalidSeckill(seckillId);
//删除商品
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
//删除秒杀分类
SeckillApi.deleteSeckillCategory(seckillCategoryId);
}
}

View File

@ -0,0 +1,653 @@
package com.tmerclub.cloud.systemtest.test.order;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderDTO;
import com.tmerclub.cloud.api.delivery.vo.DeliveryOrderFeignVO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.multishop.mongo.MongoShopWalletLogBO;
import com.tmerclub.cloud.order.dto.OrderStationDTO;
import com.tmerclub.cloud.order.vo.OrderDetailVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.PayApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.order.*;
import com.moyuer.cloud.systemtest.api.store.SameCityApi;
import com.moyuer.cloud.systemtest.api.store.ShopWalletApi;
import com.moyuer.cloud.systemtest.api.store.TransportApi;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.order.*;
import com.moyuer.cloud.systemtest.data.platform.CategoryDtoData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import com.moyuer.cloud.systemtest.data.store.SameCityDtoData;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author Tu
*/
public class OrderTest {
private List<Long> getCategoryId() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
CategoryApi.update(CategoryDtoData.getCategoryDTO(categoryId));
return Stream.of(categoryId, shopCategoryId).collect(Collectors.toList());
}
/**
* 无运费商品
* */
@DataProvider(name = "realProductDeliveryFree")
private Object[][] realProductDeliveryFree() {
List<Long> categoryIds = getCategoryId();
Long transportId = DeliveryData.getFreeFeeDelivery(true);
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 1000L), true);
return new Object[][]{{productId}};
}
/**
* 广东可配送8元运费商品
* */
@DataProvider(name = "realProductDelivery")
private Object[][] realProductDeliveryNoFree() {
List<Long> categoryIds = getCategoryId();
TransportApi.addTransport(DeliveryData.getTransportDTO(), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 8800L), true);
return new Object[][]{{productId}};
}
@Test(description = "JK_01,实物商品订单取消删除", dataProvider = "realProductDeliveryFree")
public void realOrderCancel(Long productId) {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
MyOrderApi.cancel(orderNum);
ProductApi.delete(productId, true);
MyOrderApi.delete(orderNum);
}
@Test(description = "JK_02,实物商品订单发货完整流程", dataProvider = "realProductDeliveryFree")
public void realProductDeliveryOrderTestCase(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
List<MongoShopWalletLogBO> mongoShopWalletLogBOList = ShopWalletApi.getMongoShopWalletLogBO(orderNum, true);
Assert.assertEquals(mongoShopWalletLogBOList.size(), 1);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOList.get(0), 0, 1, 980L, 1000L, 0L, 0L, 0L, 20L, 0);
}
@Test(description = "JK_03,修改订单金额、用户收货信息和物流信息完整流程", dataProvider = "realProductDeliveryFree")
public void orderChangeAmountDeliveryTestCase(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
OrderApi.infoOrder(orderNum);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNum));
OrderApi.infoOrderAddr(orderNum);
OrderApi.changeOrderAddrCheck(orderNum);
OrderApi.changeOrderAddr(OrderAddrDtoData.getChangeOrderAddrDTO(orderNum));
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
List<DeliveryOrderFeignVO> delivery = OrderApi.infoOrderDelivery(orderNum);
List<DeliveryOrderDTO> deliveryOrderDtos = JSON.parseArray(JSON.toJSONString(delivery), DeliveryOrderDTO.class);
deliveryOrderDtos.forEach(s -> s.setDeliveryNo("xgh123123123123"));
OrderApi.updateOrderDelivery(deliveryOrderDtos);
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
List<MongoShopWalletLogBO> mongoShopWalletLogBOList = ShopWalletApi.getMongoShopWalletLogBO(orderNum, true);
Assert.assertEquals(mongoShopWalletLogBOList.size(), 1);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOList.get(0), 0, 1, 4999L, 5100L, 0L, 0L, 0L, 101L, 0);
}
@Test(description = "JK_04,无需快递发货订单完整流程", dataProvider = "realProductDeliveryFree")
public void noDeliveryOrderTestCase(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNum));
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
List<MongoShopWalletLogBO> mongoShopWalletLogBOList = ShopWalletApi.getMongoShopWalletLogBO(orderNum, true);
Assert.assertEquals(mongoShopWalletLogBOList.size(), 1);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOList.get(0), 0, 1, 980L, 1000L, 0L, 0L, 0L, 20L, 0);
}
@Test(description = "JK_05,多次退款失败,退货成功订单", dataProvider = "realProductDeliveryFree")
public void multiRefundOrderTestCase(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
//申请第一次退款部分退款 等待保存
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirst= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirst);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdFirst));
//申请第二次退款整单退款
TimeUnit.SECONDS.sleep(2L);
Long refundIdSec= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDTO(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdSec));
//发货后对订单进行部分退款仅退款 & 整单退货退款先同意退款申请发货后拒绝退款
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
Long refundIdTir= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdTir);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdTir));
TimeUnit.SECONDS.sleep(2L);
Long refundIdFourth= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundIdFourth);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundIdFourth));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdFourth));
TimeUnit.SECONDS.sleep(1L);
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getRefuseDeliveryRefundDTO(refundIdFourth));
//确认收货后对订单进行部分退款仅退款 & 整单退货退款且同意
MyOrderApi.receipt(orderNum);
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirth= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirth);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdFirth));
TimeUnit.SECONDS.sleep(2L);
Long refundIdSixth= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundIdSixth);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundIdSixth));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdSixth));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSixth));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 6);
List<MongoShopWalletLogBO> mongoShopWalletLogBOList = ShopWalletApi.getMongoShopWalletLogBO(orderNum, true);
Assert.assertEquals(mongoShopWalletLogBOList.size(), 2);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOList.get(0), 0, 0, 980L, 1000L, 0L, 0L, 0L, 20L, 2);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOList.get(1), 0, 1, 980L, 1000L, 0L, 0L, 0L, 20L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, refundIdSixth, true);
// WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(0), 100);
}
@Test(description = "JK_06,未发货订单申请退款成功", dataProvider = "realProductDeliveryFree")
public void unDeliveryRefundTest(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
//部分退款成功
Long orderNumFirst = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirst = OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNumFirst,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirst);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdFirst));
//整单退款成功
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNumSec = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
Long refundIdSec = OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDTO(orderNumSec));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
ProductApi.delete(productId, true);
//第一个下单验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNumFirst).size(), 1);
List<MongoShopWalletLogBO> mongoShopWalletLogBOListFirst = ShopWalletApi.getMongoShopWalletLogBO(orderNumFirst, true);
Assert.assertEquals(mongoShopWalletLogBOListFirst.size(), 2);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOListFirst.get(0), 0, 0, 980L, 1000L, 0L, 0L, 0L, 20L, 2);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOListFirst.get(1), 0, 1, 980L, 1000L, 0L, 0L, 0L, 20L, 0);
OrderDetailVO orderDetailVOFirst = ShopWalletApi.getOrderDetailVO(orderNumFirst, refundIdFirst, true);
// WalletAssert.shopOrderDetailAssert(orderDetailVOFirst, 1000L, 1, 0L, 0L, 0L);
//第二个下单验证运行后数据是否正确
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNumSec).size(), 1);
List<MongoShopWalletLogBO> mongoShopWalletLogBOListSec = ShopWalletApi.getMongoShopWalletLogBO(orderNumSec, true);
Assert.assertEquals(mongoShopWalletLogBOListSec.size(), 2);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOListSec.get(0), 0, 0, 980L, 1000L, 0L, 0L, 0L, 20L, 2);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOListSec.get(1), 0, 1, 980L, 1000L, 0L, 0L, 0L, 20L, 0);
OrderDetailVO orderDetailVOSec = ShopWalletApi.getOrderDetailVO(orderNumSec, refundIdSec, true);
// WalletAssert.shopOrderDetailAssert(orderDetailVOSec, 1000L, 1, 0L, 0L, 0L);
}
@Test(description = "JK_07,已发货订单申请仅退款成功", dataProvider = "realProductDeliveryFree")
public void deliveryRefundTest(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
//部分退款成功
Long orderNumFirst = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirst= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNumFirst,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirst);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdFirst));
//整单退款成功
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNumSec = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
Long refundIdSec= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDTO(orderNumSec));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
ProductApi.delete(productId, true);
//第一个下单验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNumFirst).size(), 1);
List<MongoShopWalletLogBO> mongoShopWalletLogBOListFirst = ShopWalletApi.getMongoShopWalletLogBO(orderNumFirst, true);
Assert.assertEquals(mongoShopWalletLogBOListFirst.size(), 2);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOListFirst.get(0), 0, 0, 980L, 1000L, 0L, 0L, 0L, 20L, 2);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOListFirst.get(1), 0, 1, 980L, 1000L, 0L, 0L, 0L, 20L, 0);
OrderDetailVO orderDetailVOFirst = ShopWalletApi.getOrderDetailVO(orderNumFirst, refundIdFirst, true);
// WalletAssert.shopOrderDetailAssert(orderDetailVOFirst, 1000L, 1, 0L, 0L, 0L);
//第二个下单验证运行后数据是否正确
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNumSec).size(), 1);
List<MongoShopWalletLogBO> mongoShopWalletLogBOListSec = ShopWalletApi.getMongoShopWalletLogBO(orderNumSec, true);
Assert.assertEquals(mongoShopWalletLogBOListSec.size(), 2);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOListSec.get(0), 0, 0, 980L, 1000L, 0L, 0L, 0L, 20L, 2);
WalletAssert.shopWalletLogAssert(mongoShopWalletLogBOListSec.get(1), 0, 1, 980L, 1000L, 0L, 0L, 0L, 20L, 0);
OrderDetailVO orderDetailVOSec = ShopWalletApi.getOrderDetailVO(orderNumSec, refundIdSec, true);
// WalletAssert.shopOrderDetailAssert(orderDetailVOSec, 1000L, 1, 0L, 0L, 0L);
}
@Test(description = "JK_08,已收货订单申请仅退款成功", dataProvider = "realProductDeliveryFree")
public void receiveRefundTest(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
//部分退款成功
Long orderNumFirst = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNumFirst));
MyOrderApi.receipt(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirst= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNumFirst,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirst);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdFirst));
//整单退款成功
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNumSec = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
MyOrderApi.receipt(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
Long refundIdSec= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDTO(orderNumSec));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
ProductApi.delete(productId, true);
//第一个下单验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNumFirst).size(), 1);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumFirst, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, refundIdFirst, true).getOrderItemDetailList().get(0).getRefundAmount(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
//第二个下单验证运行后数据是否正确
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNumSec).size(), 1);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumSec, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, refundIdSec, true).getOrderItemDetailList().get(0).getRefundAmount(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
}
@Test(description = "JK_09,已发货订单申请退货退款成功", dataProvider = "realProductDeliveryFree")
public void unReceiveRefundDeLiveryTest(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
//部分退货退款成功
Long orderNumFirst = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumFirst);
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirst= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDeliveryDTO(orderNumFirst,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirst);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdFirst));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdFirst));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdFirst));
//整单退货退款成功
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNumSec = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumSec);
OrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
Long refundIdSec= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNumSec));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdSec));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
ProductApi.delete(productId, true);
//第一个下单验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNumFirst).size(), 1);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumFirst, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, refundIdFirst, true).getOrderItemDetailList().get(0).getRefundAmount(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
//第二个下单验证运行后数据是否正确
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNumSec).size(), 1);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumSec, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, refundIdSec, true).getOrderItemDetailList().get(0).getRefundAmount(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
}
@Test(description = "JK_10,已收货订单申请退货退款成功", dataProvider = "realProductDeliveryFree")
public void receivedRefundDeLiveryTest(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
//部分退货退款成功
Long orderNumFirst = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNumFirst));
MyOrderApi.receipt(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirst= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDeliveryDTO(orderNumFirst,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirst);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdFirst));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdFirst));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdFirst));
//整单退货退款成功
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNumSec = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumSec);
OrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
MyOrderApi.receipt(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
Long refundIdSec= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNumSec));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdSec));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
ProductApi.delete(productId, true);
//第一个下单验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNumFirst).size(), 1);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumFirst, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, refundIdFirst, true).getOrderItemDetailList().get(0).getRefundAmount(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
//第二个下单验证运行后数据是否正确
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNumSec).size(), 1);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumSec, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, refundIdSec, true).getOrderItemDetailList().get(0).getRefundAmount(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
}
@Test(description = "JK_11,已完成有运费订单部分金额仅退款", dataProvider = "realProductDelivery")
public void receivedRefundTest(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
//部分退款仅退部分金额
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNum));
MyOrderApi.receipt(orderNum);
TimeUnit.SECONDS.sleep(2L);
Long refundId= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundApartAmountDTO(orderNum,1099L));
ShopOrderRefundApi.infoByRefundSn(refundId);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
ProductApi.delete(productId, true);
TransportApi.deleteTransport(TransportApi.infoTransport(true).get(0).getTransportId(), true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 1);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 3);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 8800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 1099);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundId, true).getFreightAmount(), 800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 175);
}
@Test(description = "JK_12,已完成有运费订单部分金额退货退款", dataProvider = "realProductDelivery")
public void receivedRefundDeliveryTest(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
//部分退货退款仅退部分金额
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNum));
MyOrderApi.receipt(orderNum);
TimeUnit.SECONDS.sleep(2L);
Long refundId= OrderRefundApi.apply(OrderRefundDtoData.getRefundDeliveryApartAmountDTO(orderNum,1099L));
ShopOrderRefundApi.infoByRefundSn(refundId);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundId));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
ProductApi.delete(productId, true);
TransportApi.deleteTransport(TransportApi.infoTransport(true).get(0).getTransportId(), true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 1);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 3);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 8800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 1099);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundId, true).getFreightAmount(), 800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 175);
}
@Test(description = "JK_13,未发货有运费订单部分退款", dataProvider = "realProductDelivery")
public void unDeliveryRefundTransFeeTest(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
//部分退款仅退部分金额
TimeUnit.SECONDS.sleep(2L);
Long refundId= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundApartAmountDTO(orderNum,1099L));
ShopOrderRefundApi.infoByRefundSn(refundId);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
ProductApi.delete(productId, true);
TransportApi.deleteTransport(TransportApi.infoTransport(true).get(0).getTransportId(), true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 1);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 3);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 8800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 1899);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundId, true).getFreightAmount(), 800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 175);
}
@Test(description = "JK_14,未发货有运费订单整单退款", dataProvider = "realProductDelivery")
public void unDeliveryRefundAllTransFeeTest(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
Long refundId= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDTO(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundId);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundId));
ProductApi.delete(productId, true);
TransportApi.deleteTransport(TransportApi.infoTransport(true).get(0).getTransportId(), true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 1);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 8800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 8800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundId, true).getFreightAmount(), 800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 175);
}
@Test(description = "JK_15, 自提订单通过自提码后台提货", dataProvider = "realProductDeliveryFree")
public static void pickUpAdminProductOrderByStationCode(Long productId)throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getPickUpOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getPickUpSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
Assert.assertEquals(OrderApi.getOrderItemAndStationInfo(orderNum).getStationCode(), MyOrderApi.stationOrderDetail(orderNum).getStationCode());
OrderApi.changeStatusAndOrderStation(OrderSelfStationDtoData.getOrderSelfStationDTO(orderNum, MyOrderApi.stationOrderDetail(orderNum).getStationId()));
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
TimeUnit.SECONDS.sleep(2L);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 1);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
}
@Test(description = "JK_16, 自提订单无需自提码后台提货", dataProvider = "realProductDeliveryFree")
public static void pickUpAdminProductOrder(Long productId) {
MyOrderApi.confirm(OrderDtoData.getPickUpOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getPickUpSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
OrderApi.changeStatusAndOrderStation(OrderSelfStationDtoData.getOrderSelfStationDTO(orderNum, MyOrderApi.stationOrderDetail(orderNum).getStationId()));
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 1);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
}
@Test(description = "JK_17, 门店提货自提订单", dataProvider = "realProductDeliveryFree")
public static void stationPickUpAdminProductOrder(Long productId) throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getPickUpOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getPickUpSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
StationApi.getStationOrderByCode(MyOrderApi.stationOrderDetail(orderNum).getStationCode());
StationApi.orderStationById(orderNum.toString());
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 1);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
}
@Test(description = "JK_18, 用户扫商家码核销订单", dataProvider = "realProductDeliveryFree")
public static void userPickUpAdminProductOrder(Long productId) throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getPickUpOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getPickUpSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderStationDTO orderStationDTO = new OrderStationDTO();
orderStationDTO.setOrderIds(Collections.singletonList(orderNum));
orderStationDTO.setStationId(MyOrderApi.stationOrderDetail(orderNum).getStationId());
MyOrderApi.orderStationByOrderId(orderStationDTO);
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 1);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
}
@Test(description = "JK_19, 同城配送订单流程", dataProvider = "realProductDeliveryFree")
public static void sameCityOrder(Long productId) throws InterruptedException {
SameCityApi.saveSameCity(SameCityDtoData.getSameCityDTO());
MyOrderApi.confirm(OrderDtoData.getSameCityOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getSameCityDeliveryOrderDtoData(orderNum));
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 1);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 1000);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 20);
}
}

View File

@ -0,0 +1,304 @@
package com.tmerclub.cloud.systemtest.test.order;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderDTO;
import com.tmerclub.cloud.api.delivery.vo.DeliveryOrderFeignVO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.PayApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.order.*;
import com.moyuer.cloud.systemtest.api.store.SameCityApi;
import com.moyuer.cloud.systemtest.api.store.ShopWalletApi;
import com.moyuer.cloud.systemtest.data.amount.PreSaleSpuData;
import com.moyuer.cloud.systemtest.data.order.*;
import com.moyuer.cloud.systemtest.data.platform.CategoryDtoData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import com.moyuer.cloud.systemtest.data.store.SameCityDtoData;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author lpj
*/
public class PreSaleOrderTest {
private List<Long> getCategoryId() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
CategoryApi.update(CategoryDtoData.getCategoryDTO(categoryId));
return Stream.of(categoryId, shopCategoryId).collect(Collectors.toList());
}
@DataProvider(name = "depositPreSaleProduct")
private Object[][] depositPreSaleProduct() {
List<Long> categoryIds = getCategoryId();
Long transportId = DeliveryData.getFreeFeeDelivery(true);
Long productId = ProductApi.createProduct(PreSaleSpuData.getDepositPreSaleSpu(categoryIds.get(0), categoryIds.get(1), transportId, 8800L), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "fullPreSaleProduct")
private Object[][] fullPreSaleProduct() {
List<Long> categoryIds = getCategoryId();
Long transportId = DeliveryData.getFreeFeeDelivery(true);
Long productId = ProductApi.createProduct(PreSaleSpuData.getFullPreSaleSpu(categoryIds.get(0), categoryIds.get(1), transportId, 8800L), true);
return new Object[][]{{productId}};
}
@Test(description = "JK_59,定金预售订单取消删除", dataProvider = "depositPreSaleProduct")
public void preSaleOrderCancel(Long productId) {
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
MyOrderApi.cancel(orderNum);
ProductApi.delete(productId, true);
MyOrderApi.delete(orderNum);
}
@Test(description = "JK_60,定金预售订单发货完整流程", dataProvider = "depositPreSaleProduct")
public void depositPreSaleOrderDeliveryTestCase(Long productId) throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
PayApi.orderPayBalance(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 1);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 7800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 155);
}
@Test(description = "JK_61,修改定金预售订单金额、用户收货信息和物流信息完整流程", dataProvider = "depositPreSaleProduct")
public void depositPreSaleOrderChangeAmountDeliveryTestCase(Long productId) throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
OrderApi.infoOrder(orderNum);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNum, 50L, 0L));
OrderApi.infoOrderAddr(orderNum);
OrderApi.changeOrderAddrCheck(orderNum);
OrderApi.changeOrderAddr(OrderAddrDtoData.getChangeOrderAddrDTO(orderNum));
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
PayApi.orderPayBalance(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
List<DeliveryOrderFeignVO> delivery = OrderApi.infoOrderDelivery(orderNum);
List<DeliveryOrderDTO> deliveryOrderDtos = JSON.parseArray(JSON.toJSONString(delivery), DeliveryOrderDTO.class);
deliveryOrderDtos.forEach(s -> s.setDeliveryNo("xgh123123123123"));
OrderApi.updateOrderDelivery(deliveryOrderDtos);
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 1);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 850);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 17);
}
@Test(description = "JK_62,无需快递发货定金预售订单完整流程", dataProvider = "depositPreSaleProduct")
public void noDeliveryDepositPreSaleOrderTestCase(Long productId) throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
PayApi.orderPayBalance(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNum));
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 1);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 7800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 155);
}
@Test(description = "JK_63,未发货退货成功定金预售订单", dataProvider = "depositPreSaleProduct")
public void refundDepositPreSaleOrderTestCase(Long productId) throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
PayApi.orderPayBalance(orderNum);
//申请第一次退款部分退款 等待保存
TimeUnit.SECONDS.sleep(2L);
Long refundId = OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundId);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundId));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 7800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 7800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 155);
}
@Test(description = "JK_64,多次退款失败,退货成功定金预售订单", dataProvider = "depositPreSaleProduct")
public void multiRefundDepositPreSaleOrderTestCase(Long productId) throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
PayApi.orderPayBalance(orderNum);
//申请第一次退款部分退款 等待保存
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirst= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirst);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdFirst));
//申请第二次退款整单退款
TimeUnit.SECONDS.sleep(2L);
Long refundIdSec= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDTO(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdSec));
//发货后对订单进行部分退款仅退款 & 整单退货退款先同意退款申请发货后拒绝退款
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
Long refundIdTir= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdTir);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdTir));
TimeUnit.SECONDS.sleep(2L);
Long refundIdFourth= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundIdFourth);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundIdFourth));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdFourth));
TimeUnit.SECONDS.sleep(1L);
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getRefuseDeliveryRefundDTO(refundIdFourth));
//确认收货后对订单进行部分退款仅退款 & 整单退货退款且同意
MyOrderApi.receipt(orderNum);
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirth= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirth);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdFirth));
TimeUnit.SECONDS.sleep(2L);
Long refundIdSixth= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundIdSixth);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundIdSixth));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdSixth));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSixth));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 6);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 7800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundIdSixth, true).getOrderItemDetailList().get(0).getRefundAmount(), 7800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 155);
}
@Test(description = "JK_65, 门店提货自提定金预售订单", dataProvider = "depositPreSaleProduct")
public static void stationPickUpAdminDepositPreSaleOrder(Long productId) throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getPickUpOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getPickUpSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
PayApi.orderPayBalance(orderNum);
TimeUnit.SECONDS.sleep(2L);
StationApi.getStationOrderByCode(MyOrderApi.stationOrderDetail(orderNum).getStationCode());
StationApi.orderStationById(orderNum.toString());
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 1);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 7800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 155);
}
@Test(description = "JK_66, 同城配送定金预售订单流程", dataProvider = "depositPreSaleProduct")
public static void sameCityDepositPreSaleOrder(Long productId) throws InterruptedException {
SameCityApi.saveSameCity(SameCityDtoData.getSameCityDTO());
MyOrderApi.confirm(OrderDtoData.getSameCityOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
PayApi.orderPayBalance(orderNum);
OrderApi.delivery(DeliveryOrderDtoData.getSameCityDeliveryOrderDtoData(orderNum));
MyOrderApi.receipt(orderNum);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 1);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 7800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 155);
}
@Test(description = "JK_67,多次退款失败,退货成功全款预售订单", dataProvider = "fullPreSaleProduct")
public void multiRefundFullPreSaleOrderTestCase(Long productId) throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
//申请第一次退款部分退款 等待保存
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirst= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirst);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdFirst));
//申请第二次退款整单退款
TimeUnit.SECONDS.sleep(2L);
Long refundIdSec= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDTO(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdSec));
//发货后对订单进行部分退款仅退款 & 整单退货退款先同意退款申请发货后拒绝退款
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
Long refundIdTir= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdTir);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdTir));
TimeUnit.SECONDS.sleep(2L);
Long refundIdFourth= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundIdFourth);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundIdFourth));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdFourth));
TimeUnit.SECONDS.sleep(1L);
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getRefuseDeliveryRefundDTO(refundIdFourth));
//确认收货后对订单进行部分退款仅退款 & 整单退货退款且同意
MyOrderApi.receipt(orderNum);
TimeUnit.SECONDS.sleep(2L);
Long refundIdFirth= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdFirth);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundIdFirth));
TimeUnit.SECONDS.sleep(2L);
Long refundIdSixth= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundIdSixth);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundIdSixth));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdSixth));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSixth));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 6);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getActualTotal(), 8800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundIdSixth, true).getOrderItemDetailList().get(0).getRefundAmount(), 8800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 175);
}
}

View File

@ -0,0 +1,67 @@
package com.tmerclub.cloud.systemtest.test.order;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderDTO;
import com.tmerclub.cloud.api.delivery.vo.DeliveryOrderFeignVO;
import com.moyuer.cloud.systemtest.api.amount.PayApi;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
import com.moyuer.cloud.systemtest.api.platform.ScoreOrderApi;
import com.moyuer.cloud.systemtest.api.platform.ScoreProductApi;
import com.moyuer.cloud.systemtest.data.platform.*;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @author lpj
*/
public class ScoreOrderTest {
@DataProvider(name = "scoreProductDeliveryFree")
private Object[][] scoreProductDeliveryFree() {
Long transportId = PlatformDeliveryData.getPlatformFreeFeeDelivery();
Long productId = ScoreProductApi.createScoreProduct(ScoreSpuData.getScoreSpu(transportId, 100L, 100L));
return new Object[][]{{productId}};
}
@Test(description = "JK_52,积分商品订单取消删除", dataProvider = "scoreProductDeliveryFree")
public void scoreOrderCancel(Long productId) {
MyOrderApi.confirmScoreOrder(ScoreOrderDtoData.getScoreOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitScoreOrderDtoData.getSubmitScoreOrderDtoData()).get(0);
MyOrderApi.cancel(orderNum);
ScoreProductApi.deleteScoreProduct(productId);
MyOrderApi.delete(orderNum);
}
@Test(description = "JK_53,积分商品订单发货完整流程", dataProvider = "scoreProductDeliveryFree")
public void scoreOrderDeliveryOrderTestCase(Long productId) throws InterruptedException {
MyOrderApi.confirmScoreOrder(ScoreOrderDtoData.getScoreOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitScoreOrderDtoData.getSubmitScoreOrderDtoData()).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
ScoreOrderApi.scoreOrderDelivery(DeliveryScoreOrderDtoData.getDeliveryScoreOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
List<DeliveryOrderFeignVO> delivery = ScoreOrderApi.infoOrderDelivery(orderNum);
List<DeliveryOrderDTO> deliveryOrderDtos = JSON.parseArray(JSON.toJSONString(delivery), DeliveryOrderDTO.class);
deliveryOrderDtos.forEach(s -> s.setDeliveryNo("xgh123123123123"));
ScoreOrderApi.updateOrderDelivery(deliveryOrderDtos);
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNum);
ScoreProductApi.deleteScoreProduct(productId);
}
@Test(description = "JK_54,积分商品无需快递发货完成流程", dataProvider = "scoreProductDeliveryFree")
public void scoreOrderNoDeliveryOrderTestCase(Long productId) throws InterruptedException {
MyOrderApi.confirmScoreOrder(ScoreOrderDtoData.getScoreOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitScoreOrderDtoData.getSubmitScoreOrderDtoData()).get(0);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
ScoreOrderApi.scoreOrderDelivery(DeliveryScoreOrderDtoData.getNoDeliveryScoreOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNum);
ScoreProductApi.deleteScoreProduct(productId);
}
}

View File

@ -0,0 +1,341 @@
package com.tmerclub.cloud.systemtest.test.store;
import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.common.product.dto.*;
import com.tmerclub.cloud.common.product.vo.SkuVO;
import com.tmerclub.cloud.common.product.vo.SpuLangVO;
import com.tmerclub.cloud.common.product.vo.SpuVO;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierProductApi;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import com.moyuer.cloud.systemtest.data.store.SpuPageSearchDtoData;
import com.moyuer.cloud.systemtest.data.supplier.SupplierProductData;
import org.springframework.beans.BeanUtils;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @author lpj
*/
public class SupplierChangeSpuTest {
@DataProvider(name = "supplierDeliveryProduct")
private Object[][] supplierDeliveryProduct() {
Long supplierProductId = SupplierProductData.getSupplierProductId(6600L, DeliveryData.getSupplierFreeFeeDelivery(true), true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8800L, 1, null, true, true);
return new Object[][]{{productId, supplierProductId}};
}
@DataProvider(name = "shopDeliveryProduct")
private Object[][] shopDeliveryProduct() {
Long supplierProductId = SupplierProductData.getSupplierProductId(6600L, DeliveryData.getSupplierFreeFeeDelivery(true), true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8800L, 2, DeliveryData.getFreeFeeDelivery(true), true, true);
return new Object[][]{{productId, supplierProductId}};
}
@Test(description = "供应商删除商品,供应商发货的代销商品状态是否正确", dataProvider = "supplierDeliveryProduct")
public void supplierDeleteSupplierDeliveryProduct(Long productId, Long supplierProductId) {
SupplierProductApi.delete(supplierProductId, true);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 0);
ProductApi.delete(productId, true);
}
@Test(description = "供应商删除商品,商家发货的代销商品状态是否正确", dataProvider = "shopDeliveryProduct")
public void supplierDeleteShopDeliveryProduct(Long productId, Long supplierProductId) {
SupplierProductApi.delete(supplierProductId, true);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 1);
ProductApi.delete(productId, true);
}
@Test(description = "供应商修改供货价,供应商发货的代销商品状态是否正确", dataProvider = "supplierDeliveryProduct")
public void supplierChangeSupplierDeliveryProductPrice(Long productId, Long supplierProductId) throws InterruptedException {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setSpuId(supplierProductId);
List<SkuVO> skuVOList = SupplierProductApi.info(supplierProductId, true).getSkus();
List<SkuDTO> skuDTOList = skuVOList.stream().map(i -> BeanUtil.copyProperties(i, SkuDTO.class)).collect(Collectors.toList());
skuDTOList.forEach(i->i.setPriceFee(2000L));
spuDTO.setSkuList(skuDTOList);
SupplierProductApi.updateProductData(spuDTO);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 0);
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "供应商修改供货价,商家发货的代销商品状态是否正确", dataProvider = "shopDeliveryProduct")
public void supplierChangeShopDeliveryProductPrice(Long productId, Long supplierProductId) throws InterruptedException {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setSpuId(supplierProductId);
List<SkuVO> skuVOList = SupplierProductApi.info(supplierProductId, true).getSkus();
List<SkuDTO> skuDTOList = skuVOList.stream().map(i -> BeanUtil.copyProperties(i, SkuDTO.class)).collect(Collectors.toList());
skuDTOList.forEach(i->i.setPriceFee(2000L));
spuDTO.setSkuList(skuDTOList);
SupplierProductApi.updateProductData(spuDTO);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 1);
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "供应商修改重量,供应商发货的代销商品状态是否正确", dataProvider = "supplierDeliveryProduct")
public void supplierChangeSupplierDeliveryProductWeight(Long productId, Long supplierProductId) throws InterruptedException {
SpuVO spuVO = SupplierProductApi.info(supplierProductId, true);
SpuDTO spuDTO = new SpuDTO();
BeanUtils.copyProperties(spuVO, spuDTO);
List<SkuVO> skuVOList = spuVO.getSkus();
List<SkuDTO> skuDTOList = skuVOList.stream().map(i -> BeanUtil.copyProperties(i, SkuDTO.class)).collect(Collectors.toList());
spuDTO.setSkuList(skuDTOList);
skuDTOList.forEach(i->i.setWeight(1.1));
List<SpuLangVO> spuLangVOList = SupplierProductApi.info(supplierProductId, true).getSpuLangList();
List<SpuLangDTO> spuLangDTOList = spuLangVOList.stream().map(i -> BeanUtil.copyProperties(i, SpuLangDTO.class)).collect(Collectors.toList());
spuDTO.setSpuLangList(spuLangDTOList);
SupplierProductApi.update(spuDTO, true);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 1);
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "供应商修改重量,商家发货的代销商品状态是否正确", dataProvider = "shopDeliveryProduct")
public void supplierChangeShopDeliveryProductWeight(Long productId, Long supplierProductId) throws InterruptedException {
SpuVO spuVO = SupplierProductApi.info(supplierProductId, true);
SpuDTO spuDTO = new SpuDTO();
BeanUtils.copyProperties(spuVO, spuDTO);
List<SkuVO> skuVOList = spuVO.getSkus();
List<SkuDTO> skuDTOList = skuVOList.stream().map(i -> BeanUtil.copyProperties(i, SkuDTO.class)).collect(Collectors.toList());
spuDTO.setSkuList(skuDTOList);
skuDTOList.forEach(i->i.setWeight(1.1));
List<SpuLangVO> spuLangVOList = SupplierProductApi.info(supplierProductId, true).getSpuLangList();
List<SpuLangDTO> spuLangDTOList = spuLangVOList.stream().map(i -> BeanUtil.copyProperties(i, SpuLangDTO.class)).collect(Collectors.toList());
spuDTO.setSpuLangList(spuLangDTOList);
SupplierProductApi.update(spuDTO, true);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 0);
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "供应商修改体积,供应商发货的代销商品状态是否正确", dataProvider = "supplierDeliveryProduct")
public void supplierChangeSupplierDeliveryProductVolume(Long productId, Long supplierProductId) throws InterruptedException {
SpuVO spuVO = SupplierProductApi.info(supplierProductId, true);
SpuDTO spuDTO = new SpuDTO();
BeanUtils.copyProperties(spuVO, spuDTO);
List<SkuVO> skuVOList = spuVO.getSkus();
List<SkuDTO> skuDTOList = skuVOList.stream().map(i -> BeanUtil.copyProperties(i, SkuDTO.class)).collect(Collectors.toList());
spuDTO.setSkuList(skuDTOList);
skuDTOList.forEach(i->i.setVolume(1.1));
List<SpuLangVO> spuLangVOList = SupplierProductApi.info(supplierProductId, true).getSpuLangList();
List<SpuLangDTO> spuLangDTOList = spuLangVOList.stream().map(i -> BeanUtil.copyProperties(i, SpuLangDTO.class)).collect(Collectors.toList());
spuDTO.setSpuLangList(spuLangDTOList);
SupplierProductApi.update(spuDTO, true);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 1);
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "供应商修改体积,商家发货的代销商品状态是否正确", dataProvider = "shopDeliveryProduct")
public void supplierChangeShopDeliveryProductVolume(Long productId, Long supplierProductId) throws InterruptedException {
SpuVO spuVO = SupplierProductApi.info(supplierProductId, true);
SpuDTO spuDTO = new SpuDTO();
BeanUtils.copyProperties(spuVO, spuDTO);
List<SkuVO> skuVOList = spuVO.getSkus();
List<SkuDTO> skuDTOList = skuVOList.stream().map(i -> BeanUtil.copyProperties(i, SkuDTO.class)).collect(Collectors.toList());
spuDTO.setSkuList(skuDTOList);
skuDTOList.forEach(i->i.setVolume(1.1));
List<SpuLangVO> spuLangVOList = SupplierProductApi.info(supplierProductId, true).getSpuLangList();
List<SpuLangDTO> spuLangDTOList = spuLangVOList.stream().map(i -> BeanUtil.copyProperties(i, SpuLangDTO.class)).collect(Collectors.toList());
spuDTO.setSpuLangList(spuLangDTOList);
SupplierProductApi.update(spuDTO, true);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 0);
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "供应商修改sku信息供应商发货的代销商品状态是否正确", dataProvider = "supplierDeliveryProduct")
public void supplierChangeSupplierDeliveryProductSku(Long productId, Long supplierProductId) throws InterruptedException {
//供应商增加sku供应商发货的代销商品状态是否正确
SpuVO spuVO = SupplierProductApi.info(supplierProductId, true);
SpuDTO spuDTO = new SpuDTO();
BeanUtils.copyProperties(spuVO, spuDTO);
spuDTO.setSkuList(getSkuList(6600L));
List<SpuLangVO> spuLangVOList = SupplierProductApi.info(supplierProductId, true).getSpuLangList();
List<SpuLangDTO> spuLangDTOList = spuLangVOList.stream().map(i -> BeanUtil.copyProperties(i, SpuLangDTO.class)).collect(Collectors.toList());
spuDTO.setSpuLangList(spuLangDTOList);
SupplierProductApi.update(spuDTO, true);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 0);
//供应商禁用sku供应商发货的代销商品状态是否正确
updateProduct(productId);
ProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(productId, null, 1));
disableSku(supplierProductId);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 1);
//供应商启用sku供应商发货的代销商品状态是否正确
updateProduct(productId);
ProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(productId, null, 1));
enableSku(supplierProductId);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 1);
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "供应商修改sku信息商家发货的代销商品状态是否正确", dataProvider = "shopDeliveryProduct")
public void supplierChangeShopDeliveryProductSku(Long productId, Long supplierProductId) throws InterruptedException {
//供应商增加sku商家发货的代销商品状态是否正确
SpuVO spuVO = SupplierProductApi.info(supplierProductId, true);
SpuDTO spuDTO = new SpuDTO();
BeanUtils.copyProperties(spuVO, spuDTO);
spuDTO.setSkuList(getSkuList(6600L));
List<SpuLangVO> spuLangVOList = SupplierProductApi.info(supplierProductId, true).getSpuLangList();
List<SpuLangDTO> spuLangDTOList = spuLangVOList.stream().map(i -> BeanUtil.copyProperties(i, SpuLangDTO.class)).collect(Collectors.toList());
spuDTO.setSpuLangList(spuLangDTOList);
SupplierProductApi.update(spuDTO, true);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 0);
//供应商禁用sku商家发货的代销商品状态是否正确
updateProduct(productId);
ProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(productId, null, 1));
disableSku(supplierProductId);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 1);
//供应商启用sku商家发货的代销商品状态是否正确
updateProduct(productId);
ProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(productId, null, 1));
enableSku(supplierProductId);
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getStatus(), 1);
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
}
/**
* 商家更新代销商品
*/
public static void updateProduct(Long productId) {
SpuVO spuVO = ProductApi.info(productId, true);
SpuDTO spuDTO = JSON.parseObject(JSON.toJSONString(spuVO), SpuDTO.class);
List<SkuDTO> skuDTOList = JSON.parseArray(JSON.toJSONString(spuVO.getSkus()), SkuDTO.class);
spuDTO.setSkuList(skuDTOList);
ProductApi.update(spuDTO, true);
}
/**
* 供应商禁用sku
*/
public static void disableSku(Long supplierProductId) {
SpuVO spuVO = SupplierProductApi.info(supplierProductId, true);
SpuDTO spuDTO = JSON.parseObject(JSON.toJSONString(spuVO), SpuDTO.class);
List<SkuDTO> skuDTOList = JSON.parseArray(JSON.toJSONString(spuVO.getSkus()), SkuDTO.class);
skuDTOList.get(0).setStatus(0);
spuDTO.setSkuList(skuDTOList);
SupplierProductApi.update(spuDTO, true);
}
/**
* 供应商启用sku
*/
public static void enableSku(Long supplierProductId) {
SpuVO spuVO = SupplierProductApi.info(supplierProductId, true);
SpuDTO spuDTO = JSON.parseObject(JSON.toJSONString(spuVO), SpuDTO.class);
List<SkuDTO> skuDTOList = JSON.parseArray(JSON.toJSONString(spuVO.getSkus()), SkuDTO.class);
skuDTOList.get(0).setStatus(1);
spuDTO.setSkuList(skuDTOList);
SupplierProductApi.update(spuDTO, true);
}
public static List<SkuDTO> getSkuList(Long priceFee){
List<SkuDTO> skuList = new ArrayList<>();
SkuDTO skuDtoA = new SkuDTO();
skuDtoA.setChangeStock(100);
skuDtoA.setPriceFee(priceFee);
skuDtoA.setMarketPriceFee(88L);
skuDtoA.setStock(100);
skuDtoA.setStatus(1);
skuDtoA.setWeight(0.0);
skuDtoA.setVolume(0.0);
List<SkuLangDTO> skuLangDtoListA = new ArrayList<>();
SkuLangDTO skuLangDtoA = new SkuLangDTO();
skuLangDtoA.setAttrs("test");
skuLangDtoA.setLang(1);
skuLangDtoA.setSkuName("test1");
skuLangDtoListA.add(skuLangDtoA);
SkuLangDTO skuLangDtoB = new SkuLangDTO();
skuLangDtoB.setAttrs("test");
skuLangDtoB.setLang(2);
skuLangDtoB.setSkuName("test1");
skuLangDtoListA.add(skuLangDtoB);
skuDtoA.setSkuLangList(skuLangDtoListA);
List<SpuSkuAttrValueDTO> spuSkuAttrValueDtoListA = new ArrayList<>();
SpuSkuAttrValueDTO spuSkuAttrValueDtoA = new SpuSkuAttrValueDTO();
spuSkuAttrValueDtoA.setAttrName("test");
spuSkuAttrValueDtoA.setAttrValueName("test1");
spuSkuAttrValueDtoListA.add(spuSkuAttrValueDtoA);
skuDtoA.setSpuSkuAttrValues(spuSkuAttrValueDtoListA);
skuList.add(skuDtoA);
SkuDTO skuDtoB = new SkuDTO();
skuDtoB.setChangeStock(100);
skuDtoB.setPriceFee(priceFee);
skuDtoB.setMarketPriceFee(88L);
skuDtoB.setStock(100);
skuDtoB.setStatus(1);
skuDtoB.setWeight(0.0);
skuDtoB.setVolume(0.0);
List<SkuLangDTO> skuLangDtoListB = new ArrayList<>();
SkuLangDTO skuLangDtoC = new SkuLangDTO();
skuLangDtoC.setAttrs("test");
skuLangDtoC.setLang(1);
skuLangDtoC.setSkuName("test2");
skuLangDtoListB.add(skuLangDtoC);
SkuLangDTO skuLangDtoD = new SkuLangDTO();
skuLangDtoD.setAttrs("test");
skuLangDtoD.setLang(2);
skuLangDtoD.setSkuName("test2");
skuLangDtoListB.add(skuLangDtoD);
skuDtoB.setSkuLangList(skuLangDtoListB);
List<SpuSkuAttrValueDTO> spuSkuAttrValueDtoListB = new ArrayList<>();
SpuSkuAttrValueDTO spuSkuAttrValueDtoB = new SpuSkuAttrValueDTO();
spuSkuAttrValueDtoB.setAttrName("test");
spuSkuAttrValueDtoB.setAttrValueName("test2");
spuSkuAttrValueDtoListB.add(spuSkuAttrValueDtoB);
skuDtoB.setSpuSkuAttrValues(spuSkuAttrValueDtoListB);
skuList.add(skuDtoB);
return skuList;
}
}

View File

@ -0,0 +1,149 @@
package com.tmerclub.cloud.systemtest.test.store;
import cn.hutool.core.bean.BeanUtil;
import com.tmerclub.cloud.api.platform.dto.OfflineHandleEventDTO;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.tmerclub.cloud.common.product.dto.SkuDTO;
import com.tmerclub.cloud.common.product.dto.SpuDTO;
import com.tmerclub.cloud.common.product.dto.SpuLangDTO;
import com.tmerclub.cloud.common.product.vo.SkuVO;
import com.tmerclub.cloud.common.product.vo.SpuLangVO;
import com.tmerclub.cloud.common.product.vo.SpuVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.platform.PlatformProductApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierProductApi;
import com.moyuer.cloud.systemtest.data.amount.OfflineHandleEventDtoData;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import com.moyuer.cloud.systemtest.data.store.SpuPageSearchDtoData;
import org.springframework.beans.BeanUtils;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
/**
* @author lpj
*/
public class SupplierProductTest {
@DataProvider(name = "supplierProduct")
private Object[][] supplierProduct() {
Long transportId = DeliveryData.getSupplierFreeFeeDelivery(true);
Long categoryId = CategoryApi.listSupplierCategory(true).get(0).getCategoryId();
Long supplierProductId = SupplierProductApi.createProduct(SpuData.getSupplierSpu(categoryId, transportId, 8800L), true);
return new Object[][]{{supplierProductId}};
}
@Test(description = "商品管理基本流程", dataProvider = "supplierProduct")
public void productFlow(Long supplierProductId) throws InterruptedException {
//下架
SupplierProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(supplierProductId, null, 0));
//上架
SupplierProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(supplierProductId, null, 1));
//批量下架
SupplierProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(null, Collections.singletonList(supplierProductId), 0));
//批量上架
SupplierProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(null, Collections.singletonList(supplierProductId), 1));
//平台置顶商品
PlatformProductApi.toTop(supplierProductId);
//平台取消置顶商品
PlatformProductApi.toTop(supplierProductId);
//平台违规下架商品
OfflineHandleEventDTO offlineHandleEventDTO = OfflineHandleEventDtoData.getOfflineHandleEventDTO(null, supplierProductId, "违规下架原因", null, null, null);
offlineHandleEventDTO.setHandleIds(Collections.singletonList(supplierProductId));
PlatformProductApi.offline(offlineHandleEventDTO);
//申请上架审核失败
//商家根据活动id获取下架信息
OfflineHandleEventVO offlineHandleEventVO = SupplierProductApi.getOfflineHandleEvent(supplierProductId);
//商家申请上架
SupplierProductApi.apply(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = PlatformProductApi.platformGetOfflineHandleEvent(supplierProductId);
//平台审核失败
TimeUnit.SECONDS.sleep(2L);
PlatformProductApi.audit(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, "审核失败原因", 4));
//申请上架审核成功
//商家根据活动id获取下架信息
offlineHandleEventVO = SupplierProductApi.getOfflineHandleEvent(supplierProductId);
//商家申请上架
SupplierProductApi.apply(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = PlatformProductApi.platformGetOfflineHandleEvent(supplierProductId);
//平台审核成功
TimeUnit.SECONDS.sleep(2L);
PlatformProductApi.audit(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, null, 3));
//平台删除商品
PlatformProductApi.platformDeleteProduct(supplierProductId);
}
@Test(description = "修改商品信息", dataProvider = "supplierProduct")
public void updateProduct(Long supplierProductId) {
SpuVO spuVO = SupplierProductApi.info(supplierProductId, true);
SpuDTO spuDTO = new SpuDTO();
BeanUtils.copyProperties(spuVO, spuDTO);
List<SkuVO> skuVOList = spuVO.getSkus();
List<SkuDTO> skuDTOList = skuVOList.stream().map(i -> BeanUtil.copyProperties(i, SkuDTO.class)).collect(Collectors.toList());
spuDTO.setSkuList(skuDTOList);
List<SpuLangVO> spuLangVOList = SupplierProductApi.info(supplierProductId, true).getSpuLangList();
List<SpuLangDTO> spuLangDTOList = spuLangVOList.stream().map(i -> BeanUtil.copyProperties(i, SpuLangDTO.class)).collect(Collectors.toList());
spuLangDTOList.forEach(i->i.setSpuName("修改后的商品名称"));
spuDTO.setSpuLangList(spuLangDTOList);
SupplierProductApi.update(spuDTO, true);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "商品列表修改商品名称", dataProvider = "supplierProduct")
public void updateProductName(Long supplierProductId) {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setSpuId(supplierProductId);
List<SpuLangVO> spuLangVOList = SupplierProductApi.info(supplierProductId, true).getSpuLangList();
List<SpuLangDTO> spuLangDTOList = spuLangVOList.stream().map(i -> BeanUtil.copyProperties(i, SpuLangDTO.class)).collect(Collectors.toList());
spuLangDTOList.forEach(i->i.setSpuName("修改后的商品名称"));
spuDTO.setSpuLangList(spuLangDTOList);
SupplierProductApi.updateProductData(spuDTO);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "商品列表修改商品价格", dataProvider = "supplierProduct")
public void updateProductPrice(Long supplierProductId) {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setSpuId(supplierProductId);
List<SkuVO> skuVOList = SupplierProductApi.info(supplierProductId, true).getSkus();
List<SkuDTO> skuDTOList = skuVOList.stream().map(i -> BeanUtil.copyProperties(i, SkuDTO.class)).collect(Collectors.toList());
skuDTOList.forEach(i->i.setPriceFee(2000L));
spuDTO.setSkuList(skuDTOList);
SupplierProductApi.updateProductData(spuDTO);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "商品列表修改商品库存", dataProvider = "supplierProduct")
public void updateProductStock(Long supplierProductId) {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setSpuId(supplierProductId);
List<SkuVO> skuVOList = SupplierProductApi.info(supplierProductId, true).getSkus();
List<SkuDTO> skuDTOList = skuVOList.stream().map(i -> BeanUtil.copyProperties(i, SkuDTO.class)).collect(Collectors.toList());
skuDTOList.forEach(i->i.setChangeStock(1));
spuDTO.setSkuList(skuDTOList);
SupplierProductApi.updateProductData(spuDTO);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "商品列表修改商品序号", dataProvider = "supplierProduct")
public void updateProductSeq(Long supplierProductId) {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setSpuId(supplierProductId);
spuDTO.setSeq(1);
SupplierProductApi.updateProductData(spuDTO);
SupplierProductApi.delete(supplierProductId, true);
}
}

View File

@ -0,0 +1,65 @@
package com.tmerclub.cloud.systemtest.util;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.util.Json;
import java.util.List;
/**
* @author lanhai
*/
public class CheckUtil {
public static void check(HttpResponse response) {
String body = getBody(response);
ServerResponseEntity serverResponseEntity = Json.parseObject(body, ServerResponseEntity.class);
if (!serverResponseEntity.isSuccess()) {
throw new RuntimeException(serverResponseEntity.getMsg());
}
}
public static <T> T checkAndGetObject(HttpResponse response, Class<T> clazz) {
String body = getBody(response);
TypeReference<ServerResponseEntity<T>> typeReference = new TypeReference<ServerResponseEntity<T>>(clazz) {};
ServerResponseEntity<T> serverResponseEntity = JSON.parseObject(body, typeReference);
if (!serverResponseEntity.isSuccess()) {
throw new RuntimeException(serverResponseEntity.getMsg());
}
return serverResponseEntity.getData();
}
public static <T> List<T> checkAndGetArray(HttpResponse response, Class<T[]> clazz) {
String body = getBody(response);
ServerResponseEntity<T> serverResponseEntity = Json.parseObject(body, ServerResponseEntity.class);
if (!serverResponseEntity.isSuccess()) {
throw new RuntimeException(serverResponseEntity.getMsg());
}
return Json.parseArray(Json.toJsonString(serverResponseEntity.getData()), clazz);
}
public static <T> String checkAndGetObjects(HttpResponse response) {
String body = getBody(response);
JSONObject jsonObject = JSON.parseObject(body);
JSONObject data = JSON.parseObject(jsonObject.get("data").toString());
if(data.containsKey("records")){
return data.get("records").toString();
}else {
return data.get("list").toString();
}
}
private static String getBody(HttpResponse response){
if (!response.isOk()) {
throw new RuntimeException("请求异常");
}
System.out.println(response.body());
return response.body();
}
}

View File

@ -0,0 +1,147 @@
package com.tmerclub.cloud.systemtest.util;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.TypeReference;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.util.Json;
import java.util.List;
import java.util.Objects;
/**
* @author lanhai
*/
public class HttpUtil {
public static void get(String url, UrlEnum urlEnum) {
HttpResponse response = doGet(url, urlEnum);
CheckUtil.check(response);
}
public static <T> T get(String url, Class<T> clazz, UrlEnum urlEnum) {
HttpResponse response = doGet(url, urlEnum);
return CheckUtil.checkAndGetObject(response,clazz);
}
public static <T> String gets(String url, UrlEnum urlEnum) {
HttpResponse response = doGet(url, urlEnum);
return CheckUtil.checkAndGetObjects(response);
}
public static void post(String url, Object obj, UrlEnum urlEnum) {
HttpResponse response = doPost(url, obj, urlEnum);
CheckUtil.check(response);
}
public static <T> T post(String url, Object obj, UrlEnum urlEnum ,Class<T> clazz) {
HttpResponse response = doPost(url, obj, urlEnum);
return CheckUtil.checkAndGetObject(response,clazz);
}
public static void put(String url, Object obj, UrlEnum urlEnum) {
HttpResponse response = doPut(url, obj, urlEnum);
CheckUtil.check(response);
}
public static void put(String url, UrlEnum urlEnum) {
HttpResponse response = doPut(url,null, urlEnum);
CheckUtil.check(response);
}
public static <T> ServerResponseEntity<T> puts(String url, Object obj, UrlEnum urlEnum) {
HttpResponse response = doPut(url, obj, urlEnum);
String body = response.body();
TypeReference<ServerResponseEntity<T>> typeReference = new TypeReference<ServerResponseEntity<T>>(ServerResponseEntity.class) {};
ServerResponseEntity<T> serverResponseEntity = JSON.parseObject(body, typeReference);
return serverResponseEntity;
}
public static <T> List<T> putResultArray(String url, Object obj, Class<T[]> clazz, UrlEnum urlEnum) {
HttpResponse response = doPut(url, obj, urlEnum);
return CheckUtil.checkAndGetArray(response,clazz);
}
public static void delete(String url, UrlEnum urlEnum) {
HttpResponse response = doDelete(url, urlEnum);
CheckUtil.check(response);
}
public static void delete(String url, Object obj, UrlEnum urlEnum) {
HttpResponse response = doDelete(url, obj, urlEnum);
CheckUtil.check(response);
}
public static <T> T delete(String url, Class<T> clazz, UrlEnum urlEnum) {
HttpResponse response = doDelete(url, urlEnum);
return CheckUtil.checkAndGetObject(response,clazz);
}
public static <T> List<T> deleteResultArray(String url, Class<T[]> clazz, UrlEnum urlEnum) {
HttpResponse response = doDelete(url, urlEnum);
return CheckUtil.checkAndGetArray(response,clazz);
}
private static HttpResponse doGet(String url, UrlEnum urlEnum) {
HttpRequest postRequest = HttpRequest.get(url);
setHeader(postRequest, urlEnum);
return postRequest.execute();
}
private static HttpResponse doPost(String url, Object obj, UrlEnum urlEnum) {
HttpRequest postRequest = HttpRequest.post(url);
setHeader(postRequest, urlEnum);
// 如果是String类型直接发送 通过json转换成String发送会多出双引号
if (obj instanceof String) {
return postRequest.body(obj.toString()).execute();
}
return postRequest
.body(JSON.toJSONString(obj))
.execute();
}
/**
* 需要权限校验的put请求
* @param url
* @param obj
* @param urlEnum com.yami.shop.systemtest.util.UrlEnum
* @return
*/
private static HttpResponse doPut(String url, Object obj, UrlEnum urlEnum) {
HttpRequest postRequest = HttpRequest.put(url);
setHeader(postRequest, urlEnum);
// 如果是String类型直接发送 通过json转换成String发送会多出双引号
if (obj instanceof String) {
return postRequest.body(obj.toString()).execute();
}
return postRequest
.body(JSON.toJSONString(obj))
.execute();
}
private static HttpResponse doDelete(String url, UrlEnum urlEnum) {
HttpRequest postRequest = HttpRequest.delete(url);
setHeader(postRequest, urlEnum);
return postRequest.execute();
}
private static HttpResponse doDelete(String url, Object obj, UrlEnum urlEnum) {
HttpRequest postRequest = HttpRequest.delete(url);
setHeader(postRequest, urlEnum);
return postRequest
.body(Json.toJsonString(obj))
.contentType("application/json")
.execute();
}
private static void setHeader(HttpRequest httpRequest, UrlEnum urlEnum) {
httpRequest.header("content-type", "application/json");
httpRequest.header("Accept", "*/*");
// 自定义token
if (Objects.nonNull(urlEnum)) {
httpRequest.header("authorization", urlEnum.token());
}
}
}

View File

@ -0,0 +1,73 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.systemtest.util;
import com.moyuer.cloud.systemtest.constants.Constant;
/**
* url枚举
* @author yxf
*/
public enum UrlEnum {
/**
* 用户端
*/
API(1, Constant.API_TOKEN),
API_OTHER(2, Constant.OTHER_API_TOKEN),
/**
* 门店端
*/
STATION(3, Constant.STATION_TOKEN),
/**
* 商家端
*/
SHOP(4, Constant.SHOP_TOKEN),
SHOP_OTHER(5, Constant.OTHER_SHOP_TOKEN),
/**
* 平台端
*/
PLATFORM(6, Constant.PLATFORM_TOKEN),
/**
* 供应商
* */
SUPPLIER(7, Constant.SUPPLIER_TOKEN),
SUPPLIER_OTHER(8, Constant.OTHER_SUPPLIER_TOKEN)
;
private final Integer value;
private final String token;
public Integer value() {
return value;
}
public String token() {
return token;
}
UrlEnum(Integer value, String token) {
this.value = value;
this.token = token;
}
public static UrlEnum instance(Integer value) {
UrlEnum[] enums = values();
for (UrlEnum statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum;
}
}
return null;
}
}

View File

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="OrderTest Suite">
<test name="OrderTest">
<classes>
<class name="com.moyuer.cloud.systemtest.test.order.OrderTest">
<methods>
<include name="realOrderCancel"/>
<include name="realProductDeliveryOrderTestCase"/>
<include name="orderChangeAmountDeliveryTestCase"/>
<include name="noDeliveryOrderTestCase"/>
<include name="multiRefundOrderTestCase"/>
<include name="unDeliveryRefundTest"/>
<include name="deliveryRefundTest"/>
<include name="receiveRefundTest"/>
<include name="unReceiveRefundDeLiveryTest"/>
<include name="receivedRefundDeLiveryTest"/>
<include name="receivedRefundTest"/>
<include name="receivedRefundDeliveryTest"/>
<include name="unDeliveryRefundTransFeeTest"/>
<include name="unDeliveryRefundAllTransFeeTest"/>
<include name="pickUpAdminProductOrderByStationCode"/>
<include name="pickUpAdminProductOrder"/>
<include name="stationPickUpAdminProductOrder"/>
<include name="userPickUpAdminProductOrder"/>
<include name="sameCityOrder"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.order.PreSaleOrderTest">
<methods>
<include name="preSaleOrderCancel"/>
<include name="depositPreSaleOrderDeliveryTestCase"/>
<include name="depositPreSaleOrderChangeAmountDeliveryTestCase"/>
<include name="noDeliveryDepositPreSaleOrderTestCase"/>
<include name="refundDepositPreSaleOrderTestCase"/>
<include name="multiRefundDepositPreSaleOrderTestCase"/>
<include name="stationPickUpAdminDepositPreSaleOrder"/>
<include name="sameCityDepositPreSaleOrder"/>
<include name="multiRefundFullPreSaleOrderTestCase"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.order.ScoreOrderTest">
<methods>
<include name="scoreOrderCancel"/>
<include name="scoreOrderDeliveryOrderTestCase"/>
<include name="scoreOrderNoDeliveryOrderTestCase"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.order.TransFeeFreesOrderTest">
<methods>
<include name="fullAmountFreeFreight"/>
<include name="fullPriceFreeFreight"/>
<include name="fullPriceAndAmountFreeFreight"/>
<include name="fullConditionFreeFreightAndFreeFeeUserRight"/>
<include name="fullConditionFreeFreightAndNotFreeFreight"/>
<include name="differentProductFullConditionFreeFreight"/>
<include name="fullConditionFreeFreightAndNotFreeFreightAndFreeFeeUserRight"/>
<include name="freeFeeUserRight"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.order.VirtualOrderTest">
<methods>
<include name="noWriteNumVirtualProductTestCase"/>
<include name="noWriteNumVirtualOrderTestCase"/>
<include name="singleWriteNumVirtualProductTestCase"/>
<include name="tripleWriteNumVirtualTestCase"/>
<include name="noWriteNumVirtualOrderRefundTestCase"/>
<include name="singleWriteNumVirtualOrderRefundTestCase"/>
<include name="tripleWriteNumVirtualOrderRefundTestCase"/>
<include name="tripleWriteNumVirtualOrderWriteOffOnceRefundTestCase"/>
<include name="tripleWriteNumVirtualOrderWriteOffTwiceRefundTestCase"/>
<include name="writeOffVirtualOrder"/>
<include name="writeOffVirtualOrderByWriteOffCode"/>
<include name="writeOffVirtualOrderByWriteOffQRCode"/>
<include name="writeOffVirtualOrderByStationCode"/>
</methods>
</class>
</classes>
</test>
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>
</suite>

View File

@ -0,0 +1,207 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="SmokeTesting Suite">
<test name="ProductTest">
<classes>
<class name="com.moyuer.cloud.systemtest.test.store.ProductTest">
<methods>
<include name="productFlow"/>
<include name="updateProduct"/>
<include name="updateProductName"/>
<include name="updateProductPrice"/>
<include name="updateProductStock"/>
<include name="updateProductSeq"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.store.SupplierProductTest">
<methods>
<include name="productFlow"/>
<include name="updateProduct"/>
<include name="updateProductName"/>
<include name="updateProductPrice"/>
<include name="updateProductStock"/>
<include name="updateProductSeq"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.store.ConsignmentManagementTest">
<methods>
<include name="consignmentManagementFlow"/>
</methods>
</class>
</classes>
</test>
<test name="OrderTest">
<classes>
<class name="com.moyuer.cloud.systemtest.test.order.OrderTest">
<methods>
<include name="realOrderCancel"/>
<include name="realProductDeliveryOrderTestCase"/>
<include name="orderChangeAmountDeliveryTestCase"/>
<include name="noDeliveryOrderTestCase"/>
<include name="multiRefundOrderTestCase"/>
<include name="unDeliveryRefundTest"/>
<include name="deliveryRefundTest"/>
<include name="receiveRefundTest"/>
<include name="unReceiveRefundDeLiveryTest"/>
<include name="receivedRefundDeLiveryTest"/>
<include name="receivedRefundTest"/>
<include name="receivedRefundDeliveryTest"/>
<include name="unDeliveryRefundTransFeeTest"/>
<include name="unDeliveryRefundAllTransFeeTest"/>
<include name="pickUpAdminProductOrderByStationCode"/>
<include name="pickUpAdminProductOrder"/>
<include name="stationPickUpAdminProductOrder"/>
<include name="userPickUpAdminProductOrder"/>
<include name="sameCityOrder"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.order.PreSaleOrderTest">
<methods>
<include name="preSaleOrderCancel"/>
<include name="depositPreSaleOrderDeliveryTestCase"/>
<include name="depositPreSaleOrderChangeAmountDeliveryTestCase"/>
<include name="noDeliveryDepositPreSaleOrderTestCase"/>
<include name="refundDepositPreSaleOrderTestCase"/>
<include name="multiRefundDepositPreSaleOrderTestCase"/>
<include name="stationPickUpAdminDepositPreSaleOrder"/>
<include name="sameCityDepositPreSaleOrder"/>
<include name="multiRefundFullPreSaleOrderTestCase"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.order.ScoreOrderTest">
<methods>
<include name="scoreOrderCancel"/>
<include name="scoreOrderDeliveryOrderTestCase"/>
<include name="scoreOrderNoDeliveryOrderTestCase"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.order.SupplierOrderTest">
<methods>
<include name="cancelOrderTest"/>
<include name="changeAmountOrderTest"/>
<include name="noDeliveryOrderTest"/>
<include name="multiRefundOrderTest"/>
<include name="unDeliveryShopReceiveRefundOrderTest"/>
<include name="unDeliverySupplierReceiveRefundOrderTest"/>
<include name="deliveredShopReceiveRefundOrderTest"/>
<include name="deliveredSupplierReceiveRefundOrderTest"/>
<include name="deliveredShopReceiveRefundDeliveryTest"/>
<include name="deliveredSupplierReceiveRefundDeliveryTest"/>
<include name="receivedShopReceiveRefundTest"/>
<include name="receivedSupplierReceiveRefundTest"/>
<include name="receivedShopReceiveRefundDeliveryTest"/>
<include name="receivedSupplierReceiveRefundDeliveryTest"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.order.TransFeeFreesOrderTest">
<methods>
<include name="fullAmountFreeFreight"/>
<include name="fullPriceFreeFreight"/>
<include name="fullPriceAndAmountFreeFreight"/>
<include name="fullConditionFreeFreightAndFreeFeeUserRight"/>
<include name="fullConditionFreeFreightAndNotFreeFreight"/>
<include name="differentProductFullConditionFreeFreight"/>
<include name="fullConditionFreeFreightAndNotFreeFreightAndFreeFeeUserRight"/>
<include name="freeFeeUserRight"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.order.VirtualOrderTest">
<methods>
<include name="noWriteNumVirtualProductTestCase"/>
<include name="noWriteNumVirtualOrderTestCase"/>
<include name="singleWriteNumVirtualProductTestCase"/>
<include name="tripleWriteNumVirtualTestCase"/>
<include name="noWriteNumVirtualOrderRefundTestCase"/>
<include name="singleWriteNumVirtualOrderRefundTestCase"/>
<include name="tripleWriteNumVirtualOrderRefundTestCase"/>
<include name="tripleWriteNumVirtualOrderWriteOffOnceRefundTestCase"/>
<include name="tripleWriteNumVirtualOrderWriteOffTwiceRefundTestCase"/>
<include name="writeOffVirtualOrder"/>
<include name="writeOffVirtualOrderByWriteOffCode"/>
<include name="writeOffVirtualOrderByWriteOffQRCode"/>
<include name="writeOffVirtualOrderByStationCode"/>
</methods>
</class>
</classes>
</test>
<test name="MarketingTest">
<classes>
<class name="com.moyuer.cloud.systemtest.test.marketing.ComboTest">
<methods>
<include name="comboFlow"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.marketing.CouponTest">
<methods>
<include name="shopCouponFlow"/>
<include name="shopCouponFlowWithVirtualProduct"/>
<include name="shopCouponFlowWithFullPreSaleProduct"/>
<include name="shopCouponFlowWithDepositPreSaleProduct"/>
<include name="shopCouponFlowWithSupplierProduct"/>
<include name="platformCouponFlow"/>
<include name="platformCouponFlowWithVirtualProduct"/>
<include name="platformCouponFlowWithFullPreSaleProduct"/>
<include name="platformCouponFlowDepositPreSaleProductProduct"/>
<include name="platformCouponFlowWithSupplierProduct"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.marketing.DiscountAmountTest">
<methods>
<include name="discountAmountTestWithRealProduct"/>
<include name="discountAmountTestWithVirtualProduct"/>
<include name="discountAmountTestWithDepositPreSaleProduct"/>
<include name="discountAmountTestWithSupplierProduct"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.marketing.DiscountTest">
<methods>
<include name="discountFlow"/>
<include name="discountFlowWithVirtualProduct"/>
<include name="discountFlowWithFullPreSaleProduct"/>
<include name="discountFlowWithDepositPreSaleProduct"/>
<include name="discountFlowWithSupplierProduct"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.marketing.DistributionProdTest">
<methods>
<include name="distributionProdFlow"/>
<include name="virtualDistributionProdFlow"/>
<include name="fullPreSaleDistributionProdFlow"/>
<include name="depositPreSaleDistributionProdFlow"/>
<include name="supplierDistributionProdFlow"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.marketing.GiveawayTest">
<methods>
<include name="giveawayFlowWithRealProduct"/>
<include name="giveawayFlowWithFullPreSaleProduct"/>
<include name="giveawayFlowWithDepositProduct"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.marketing.GroupTest">
<methods>
<include name="groupFlowWithRealProduct"/>
<include name="groupFlowWithVirtualProduct"/>
<include name="groupFlowWithFullPreSaleProduct"/>
<include name="groupFlowWithSupplierProduct"/>
</methods>
</class>
<class name="com.moyuer.cloud.systemtest.test.marketing.SeckillTest">
<methods>
<include name="secKillFlowWithRealProduct"/>
<include name="secKillFlowWithVirtualProduct"/>
<include name="secKillFlowWithFullPreSaleProduct"/>
<include name="secKillFlowWithSupplierProduct"/>
</methods>
</class>
</classes>
</test>
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>
</suite>

View File

@ -0,0 +1,29 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud;
import org.apache.dubbo.config.spring.context.annotation.EnableDubbo;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.UserDetailsServiceAutoConfiguration;
/**
* @author lhd
* @date 2020/12/22
*/
@SpringBootApplication(scanBasePackages = "com.moyuer.cloud", exclude = UserDetailsServiceAutoConfiguration.class)
@EnableDubbo(scanBasePackages = "com.moyuer.cloud.**.feign")
public class AdminApplication {
public static void main(String[] args) {
SpringApplication.run(AdminApplication.class, args);
}
}

View File

@ -0,0 +1,67 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.config;
import com.tmerclub.cloud.common.constant.Constant;
import com.xxl.job.core.executor.impl.XxlJobSpringExecutor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.commons.util.InetUtils;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* xxl-job config
*
* @author FrozenWatermelon
* @date 2021/1/18
*/
@Configuration
public class XxlJobConfig {
private static final Logger logger = LoggerFactory.getLogger(XxlJobConfig.class);
@Value("${mall4cloud.job.admin.addresses}")
private String adminAddresses;
@Value("${mall4cloud.job.accessToken}")
private String accessToken;
@Value("${mall4cloud.job.logPath}")
private String logPath;
@Value("${spring.application.name}")
private String appname;
@Value("${server.port}")
private int port;
@Autowired
private InetUtils inetUtils;
@Bean
public XxlJobSpringExecutor xxlJobExecutor() {
logger.info(">>>>>>>>>>> xxl-job config init.");
XxlJobSpringExecutor xxlJobSpringExecutor = new XxlJobSpringExecutor();
xxlJobSpringExecutor.setAdminAddresses(adminAddresses);
xxlJobSpringExecutor.setAppname(appname + Constant.DASHED_ENV);
// 针对多网卡容器内部署等情况可借助 "spring-cloud-commons" 提供的 "InetUtils" 组件灵活定制注册IP
xxlJobSpringExecutor.setIp(inetUtils.findFirstNonLoopbackAddress().getHostAddress());
xxlJobSpringExecutor.setPort(port + 1000);
xxlJobSpringExecutor.setAccessToken(accessToken);
xxlJobSpringExecutor.setLogPath(logPath);
xxlJobSpringExecutor.setLogRetentionDays(3);
return xxlJobSpringExecutor;
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.constant;
import com.tmerclub.cloud.common.leaf.constant.GlobalDistributedIdKey;
/**
* 分布式id key
*
* @author FrozenWatermelon
* @date 2021/4/9
*/
public interface DistributedIdKey {
/**
* 平台用户id
*/
String MALL4CLOUD_PLATFORM_USER = "mall4cloud-platform-user";
/**
* 商家用户id
*/
String MALL4CLOUD_MULTISHOP_USER = "mall4cloud-multishop-user";
/**
* 供应商用户id
*/
String MALL4CLOUD_SUPPLIER_USER = "mall4cloud-supplier-user";
/**
* 钱包日志id
*/
String MALL4CLOUD_SHOP_WALLET_LOG = GlobalDistributedIdKey.MALL4CLOUD_SHOP_WALLET_LOG.value();
/**
* 系统权限
*/
String MALL4CLOUD_AUTHORIZATION = "mall4cloud-authorization";
/**
* 采购金额日志
*/
String PURCHASE_AMOUNT_LOG = "mall4cloud-purchase-amount-log";
}

View File

@ -0,0 +1,57 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.constant;
/**
* 审核状态
*
* @author YXF
*/
public enum AuditStatus {
/**
* 未审核
*/
WAITAUDIT(0),
/**
* 已通过
*/
SUCCESSAUDIT(1),
/**
* 未通过
*/
FAILAUDIT(-1),
/**
* 平台下线
*/
OFFLINE(2);
private final Integer num;
public Integer value() {
return num;
}
AuditStatus(Integer num) {
this.num = num;
}
public static AuditStatus instance(Integer value) {
AuditStatus[] enums = values();
for (AuditStatus statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum;
}
}
return null;
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.constant;
/**
* @Author lth
* @Date 2021/5/20 20:34
*/
public enum IsPreferred {
/**
* 是优选好店
*/
YES(1),
/**
* 不是优选好店
*/
NO(0);
private final Integer num;
public Integer value() {
return num;
}
IsPreferred(Integer num) {
this.num = num;
}
public static IsPreferred instance(Integer value) {
IsPreferred[] enums = values();
for (IsPreferred statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum;
}
}
return null;
}
}

View File

@ -0,0 +1,61 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.constant;
/**
* 店铺钱包金额类型
* 金额类型 0 未结算金额 1可提现金额 2冻结金额
*
* @author FrozenWatermelon
*/
public enum NoticeType {
/**
* 平台公告
*/
TO_MULTISHOP(1, "商家端展示"),
/**
* 商城公告
*/
TO_USER(2, "用户端展示"),
/**
* 在供应商端展示
*/
TO_SUPPLIER(3, "供应商端展示");
private final Integer num;
private final String shopWalletAmountType;
public Integer value() {
return num;
}
public String getShopWalletAmountType() {
return shopWalletAmountType;
}
NoticeType(Integer num, String shopWalletAmountType) {
this.num = num;
this.shopWalletAmountType = shopWalletAmountType;
}
public static NoticeType instance(Integer value) {
NoticeType[] enums = values();
for (NoticeType statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum;
}
}
return null;
}
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.constant;
/**
* 装修页面类型
* @author lhd
*/
public enum RenovationType {
/**
* pc端
*/
PC(1),
/**
* 移动端
*/
H5(2),
;
private final Integer num;
public Integer value() {
return num;
}
RenovationType(Integer num) {
this.num = num;
}
public static RenovationType instance(Integer value) {
RenovationType[] enums = values();
for (RenovationType statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum;
}
}
return null;
}
}

View File

@ -0,0 +1,126 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.constant;
/**
* 店铺钱包金额发生改变的原因
* 0用户支付 1用户确认收货 2 用户退款申请 3 拒绝用户退款申请 4 提现申请 5 提现申请被拒绝
*
* @author FrozenWatermelon
*/
public enum ShopWalletChangeReason {
/**
* 用户支付
*/
PAY(0, "用户支付"),
/**
* 订单结算
*/
SETTLED(1, "订单结算"),
/**
* 用户退款申请成功
*/
ORDER_REFUND(2, "用户退款申请成功"),
/**
* 提现申请
*/
APPLY_CASH(4, "提现申请"),
/**
* 提现申请被拒绝
*/
REFUSE_CASH(5, "提现申请被拒绝"),
/**
* 通过提现申请
*/
PASS_CASH(6, "提现申请通过"),
/**
* 系统发放成功
*/
SUCCESS_CASH(7, "系统发放成功"),
/**
* 提现发放失败
*/
FAIL_CASH(8, "系统发放失败"),
/**
* 系统扣除订单中需要颁发给用户的分销金额
*/
DISTRIBUTION_AMOUNT(9, "扣除订单分销金额"),
/**
* 余额充值订单
*/
APPLY_RECHARGE(10, "提交充值订单"),
/**
* 余额充值成功
*/
SUCCESS_RECHARGE(11, "充值成功"),
/**
* 订单采购价差
*/
PURCHASE_SPREAD_AMOUNT(12, "扣除订单采购价差"),
/**
* 商家自行处理采购价差退款采购价差
*/
REFUND_SPREAD_AMOUNT(13, "商家自行处理采购价差"),
/**
* 预售失败结算超时未支付尾款
*/
PRE_SALE_FAIL(14, "预售失败结算(超时未支付尾款)");
private final Integer num;
private final String shopWalletChangeReason;
public Integer value() {
return num;
}
public String getShopWalletChangeReason() {
return shopWalletChangeReason;
}
ShopWalletChangeReason(Integer num, String shopWalletChangeReason) {
this.num = num;
this.shopWalletChangeReason = shopWalletChangeReason;
}
public static ShopWalletChangeReason instance(Integer value) {
ShopWalletChangeReason[] enums = values();
for (ShopWalletChangeReason statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum;
}
}
return null;
}
public static String getReason(Integer value) {
ShopWalletChangeReason[] enums = values();
for (ShopWalletChangeReason statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum.shopWalletChangeReason;
}
}
return null;
}
}

View File

@ -0,0 +1,63 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.constant;
/**
* 商家提现申请信息状态
*
* @author lth
*/
public enum ShopWithdrawCashStatus {
/**
* 未通过
*/
FAILAUDIT(-1),
/**
* 未审核
*/
WAITAUDIT(0),
/**
* 已通过
*/
SUCCESSAUDIT(1),
/**
* 发放成功
*/
SUCCESS(2),
/**
* 发放失败
*/
FAIL(3);
private final Integer num;
public Integer value() {
return num;
}
ShopWithdrawCashStatus(Integer num) {
this.num = num;
}
public static ShopWithdrawCashStatus instance(Integer value) {
ShopWithdrawCashStatus[] enums = values();
for (ShopWithdrawCashStatus statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum;
}
}
return null;
}
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.constant;
/**
* 装修模板类型
* @author lhd
*/
public enum TemplateType {
/**
* pc端
*/
PC(1),
/**
* 移动端
*/
H5(2),
;
private final Integer num;
public Integer value() {
return num;
}
TemplateType(Integer num) {
this.num = num;
}
public static TemplateType instance(Integer value) {
TemplateType[] enums = values();
for (TemplateType statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum;
}
}
return null;
}
}

View File

@ -0,0 +1,37 @@
package com.tmerclub.cloud.multishop.constant;
/**
* @author lanhai
*/
public enum WithdrawCashType {
/**
*
*/
WEEKEND(1, "每周"),
/**
*
*/
MONTH(2, "每月"),
/**
*
*/
YEAR(3, "每年");
private final Integer value;
private final String date;
public Integer value() {
return value;
}
public String date() {
return date;
}
WithdrawCashType(Integer value, String date) {
this.value = value;
this.date = date;
}
}

View File

@ -0,0 +1,55 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.StrUtil;
import com.tmerclub.cloud.common.constant.Constant;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.multishop.service.CompanyAuditingService;
import com.tmerclub.cloud.multishop.vo.ShopCompanyAuditingVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.Objects;
/**
* @author chiley
* @date 2022/9/13 14:06
*/
@RestController("adminCompanyAuditingController")
@RequestMapping("/mp/shop_company_auditing")
@Tag(name = "admin-工商信息审核情况")
public class CompanyAuditingController {
@Autowired
private CompanyAuditingService companyAuditingService;
@GetMapping("/auditInfo")
@Operation(summary = "查看申请审核情况", description = "查看申请审核情况")
public ServerResponseEntity<ShopCompanyAuditingVO> auditInfo(@RequestParam(value = "shopId", required = false) Long shopId) {
Long tenantId = AuthUserContext.get().getTenantId();
if (!Objects.equals(tenantId, Constant.PLATFORM_SHOP_ID)) {
shopId = tenantId;
}
ShopCompanyAuditingVO auditInfo = companyAuditingService.getAuditInfo(shopId);
if (Objects.nonNull(auditInfo) && Objects.nonNull(auditInfo.getShopCompanyVO()) && StrUtil.isNotBlank(auditInfo.getShopCompanyVO().getLegalPhone())) {
auditInfo.getShopCompanyVO().setLegalPhone(PhoneUtil.hideBetween(auditInfo.getShopCompanyVO().getLegalPhone()).toString());
}
return ServerResponseEntity.success(auditInfo);
}
}

View File

@ -0,0 +1,115 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.exception.LuckException;
import com.tmerclub.cloud.common.response.ResponseEnum;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.common.util.BeanUtil;
import com.tmerclub.cloud.multishop.constant.HotSearchType;
import com.tmerclub.cloud.multishop.dto.HotSearchDTO;
import com.tmerclub.cloud.multishop.model.HotSearch;
import com.tmerclub.cloud.multishop.service.HotSearchService;
import com.tmerclub.cloud.multishop.vo.HotSearchVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* 热搜
*
* @author YXF
* @date 2021-01-27 09:10:00
*/
@RestController("adminHotSearchController")
@RequestMapping("/mp/hot_search")
@Tag(name = "admin-热搜")
public class HotSearchController {
private static final Logger log = LoggerFactory.getLogger(HotSearchController.class);
@Autowired
private HotSearchService hotSearchService;
@GetMapping("/page")
@Operation(summary = "分页获取热搜列表", description = "分页获取热搜列表")
public ServerResponseEntity<PageVO<HotSearchVO>> page(@Valid PageDTO pageDTO, HotSearchDTO hotSearchDTO) {
hotSearchDTO.setShopId(AuthUserContext.get().getTenantId());
PageVO<HotSearchVO> hotSearchPage = hotSearchService.page(pageDTO, hotSearchDTO);
return ServerResponseEntity.success(hotSearchPage);
}
@GetMapping
@Operation(summary = "获取热搜", description = "根据hotSearchId获取热搜")
public ServerResponseEntity<HotSearchVO> getByHotSearchId(@RequestParam Long hotSearchId) {
return ServerResponseEntity.success(hotSearchService.getByHotSearchId(hotSearchId));
}
@PostMapping
@Operation(summary = "保存热搜", description = "保存热搜")
public ServerResponseEntity<Void> save(@Valid @RequestBody HotSearchDTO hotSearchDTO) {
HotSearch hotSearch = BeanUtil.map(hotSearchDTO, HotSearch.class);
hotSearch.setShopId(AuthUserContext.get().getTenantId());
if (Objects.isNull(hotSearch.getType())) {
hotSearch.setType(HotSearchType.PROD.value());
}
// 热搜标题不能重复
if (hotSearchService.checkExist(hotSearch.getShopId(), hotSearch.getTitle(), hotSearch.getType())) {
log.error("热搜标题不能重复");
throw new LuckException("热搜标题不能重复");
}
hotSearchService.save(hotSearch);
hotSearchService.removeHotSearchListCache(hotSearch.getShopId(), hotSearch.getType());
return ServerResponseEntity.success();
}
@PutMapping
@Operation(summary = "更新热搜", description = "更新热搜")
public ServerResponseEntity<Void> update(@Valid @RequestBody HotSearchDTO hotSearchDTO) {
HotSearch hotSearch = BeanUtil.map(hotSearchDTO, HotSearch.class);
HotSearchVO dbHotSearch = hotSearchService.getByHotSearchId(hotSearchDTO.getHotSearchId());
if (Objects.isNull(dbHotSearch)) {
throw new LuckException(ResponseEnum.DATA_ERROR);
}
hotSearch.setShopId(AuthUserContext.get().getTenantId());
if (!Objects.equals(dbHotSearch.getShopId(), hotSearch.getShopId())) {
throw new LuckException(ResponseEnum.UNAUTHORIZED);
}
hotSearchService.update(hotSearch);
hotSearchService.removeHotSearchListCache(hotSearch.getShopId(), dbHotSearch.getType());
return ServerResponseEntity.success();
}
@DeleteMapping
@Operation(summary = "删除热搜", description = "根据热搜id删除热搜")
public ServerResponseEntity<Void> delete(@RequestParam Long hotSearchId) {
HotSearchVO dbHotSearch = hotSearchService.getByHotSearchId(hotSearchId);
if (Objects.isNull(dbHotSearch)) {
throw new LuckException(ResponseEnum.DATA_ERROR);
}
if (!Objects.equals(dbHotSearch.getShopId(), AuthUserContext.get().getTenantId())) {
throw new LuckException(ResponseEnum.UNAUTHORIZED);
}
Long shopId = AuthUserContext.get().getTenantId();
hotSearchService.deleteById(hotSearchId, shopId);
hotSearchService.removeHotSearchListCache(shopId, dbHotSearch.getType());
return ServerResponseEntity.success();
}
}

View File

@ -0,0 +1,49 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.multishop.mongo.MongoShopWalletLogBO;
import com.tmerclub.cloud.multishop.service.ShopWalletLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 商家提现申请信息
*
* @Author chiley
* @Date 2022/6/30 17:23
*/
@RestController("adminShopRechargeController")
@RequestMapping("/mp/shop_recharge")
@Tag(name = "admin-商家充值记录信息")
public class ShopRechargeController {
@Autowired
private ShopWalletLogService shopWalletLogService;
@GetMapping("/page")
@Operation(summary = "分页获取商家充值记录信息", description = "分页获取商家充值记录信息")
public ServerResponseEntity<PageVO<MongoShopWalletLogBO>> page(PageDTO pageDTO) {
Long shopId = AuthUserContext.get().getTenantId();
PageVO<MongoShopWalletLogBO> pageVO = shopWalletLogService.getRechargePageByShopId(pageDTO, shopId);
return ServerResponseEntity.success(pageVO);
}
}

View File

@ -0,0 +1,106 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.StrUtil;
import com.tmerclub.cloud.api.multishop.vo.ShopRefundAddrVO;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.common.util.BeanUtil;
import com.tmerclub.cloud.multishop.dto.ShopRefundAddrDTO;
import com.tmerclub.cloud.multishop.model.ShopRefundAddr;
import com.tmerclub.cloud.multishop.service.ShopRefundAddrService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 退货地址
*
* @author YXF
* @date 2021-01-27 09:10:00
*/
@RestController("adminShopRefundAddrController")
@RequestMapping("/mp/shop_refund_addr")
@Tag(name = "admin-退货地址")
public class ShopRefundAddrController {
@Autowired
private ShopRefundAddrService shopRefundAddrService;
@GetMapping("/page")
@Operation(summary = "分页获取退货地址列表", description = "分页获取退货地址列表")
public ServerResponseEntity<PageVO<ShopRefundAddrVO>> page(@Valid PageDTO pageDTO, ShopRefundAddrDTO shopRefundAddrDTO) {
shopRefundAddrDTO.setShopId(AuthUserContext.get().getTenantId());
PageVO<ShopRefundAddrVO> refundAddrPage = shopRefundAddrService.page(pageDTO, shopRefundAddrDTO);
for (ShopRefundAddrVO shopRefundAddrVO : refundAddrPage.getList()) {
if (StrUtil.isNotBlank(shopRefundAddrVO.getMobile())) {
shopRefundAddrVO.setMobile(PhoneUtil.hideBetween(shopRefundAddrVO.getMobile()).toString());
}
}
return ServerResponseEntity.success(refundAddrPage);
}
@GetMapping
@Operation(summary = "获取退货地址", description = "根据shopRefundAddrId获取退货地址")
public ServerResponseEntity<ShopRefundAddrVO> getByShopRefundAddrId(@RequestParam Long shopRefundAddrId) {
Long shopId = AuthUserContext.get().getTenantId();
ShopRefundAddrVO byShopRefund = shopRefundAddrService.getByShopRefundAddrId(shopRefundAddrId, shopId);
if (StrUtil.isNotBlank(byShopRefund.getMobile())) {
byShopRefund.setMobile(PhoneUtil.hideBetween(byShopRefund.getMobile()).toString());
}
return ServerResponseEntity.success(byShopRefund);
}
@PostMapping
@Operation(summary = "保存退货地址", description = "保存退货地址")
public ServerResponseEntity<Long> save(@Valid @RequestBody ShopRefundAddrDTO shopRefundAddrDTO) {
ShopRefundAddr shopRefundAddr = BeanUtil.map(shopRefundAddrDTO, ShopRefundAddr.class);
Long shopId = AuthUserContext.get().getTenantId();
shopRefundAddr.setShopId(shopId);
shopRefundAddrService.save(shopRefundAddr);
shopRefundAddrService.removeCacheByShopId(shopId);
return ServerResponseEntity.success(shopRefundAddr.getShopRefundAddrId());
}
@PutMapping
@Operation(summary = "更新退货地址", description = "更新退货地址")
public ServerResponseEntity<Void> update(@Valid @RequestBody ShopRefundAddrDTO shopRefundAddrDTO) {
ShopRefundAddr shopRefundAddr = BeanUtil.map(shopRefundAddrDTO, ShopRefundAddr.class);
Long shopId = AuthUserContext.get().getTenantId();
shopRefundAddr.setShopId(AuthUserContext.get().getTenantId());
shopRefundAddrService.update(shopRefundAddr);
shopRefundAddrService.removeCacheByShopId(shopId);
return ServerResponseEntity.success();
}
@DeleteMapping
@Operation(summary = "删除退货地址", description = "根据退货地址id删除退货地址")
public ServerResponseEntity<Void> delete(@RequestParam Long shopRefundAddrId) {
Long shopId = AuthUserContext.get().getTenantId();
shopRefundAddrService.deleteById(shopRefundAddrId, shopId);
shopRefundAddrService.removeCacheByShopId(shopId);
return ServerResponseEntity.success();
}
@GetMapping("/list")
@Operation(summary = "获取退货地址列表", description = "获取退货地址列表")
public ServerResponseEntity<List<ShopRefundAddrVO>> list() {
return ServerResponseEntity.success(shopRefundAddrService.listByShopId(AuthUserContext.get().getTenantId()));
}
}

View File

@ -0,0 +1,100 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ResponseEnum;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.common.util.BeanUtil;
import com.tmerclub.cloud.multishop.constant.RenovationType;
import com.tmerclub.cloud.multishop.dto.ShopRenovationDTO;
import com.tmerclub.cloud.multishop.model.ShopRenovation;
import com.tmerclub.cloud.multishop.service.ShopRenovationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* 店铺装修信息
* @author Orange
*/
@RestController("adminShopRenovationController")
@RequestMapping("/mp/shop_renovation")
@Tag(name = "店铺装修信息")
public class ShopRenovationController {
@Autowired
private ShopRenovationService shopRenovationService;
@GetMapping("/page")
@Operation(summary = "根据类型分页获取店铺装修信息列表", description = "分页获取店铺装修信息列表")
public ServerResponseEntity<PageVO<ShopRenovation>> page(@Valid PageDTO pageDTO, ShopRenovationDTO shopRenovation) {
shopRenovation.setShopId(AuthUserContext.get().getTenantId());
PageVO<ShopRenovation> shopRenovationPage = shopRenovationService.page(pageDTO, BeanUtil.map(shopRenovation, ShopRenovation.class));
return ServerResponseEntity.success(shopRenovationPage);
}
@GetMapping("/page_h5")
@Operation(summary = "根据类型分页获取店铺装修信息列表", description = "分页获取店铺装修信息列表")
public ServerResponseEntity<PageVO<ShopRenovation>> pageH5(@Valid PageDTO pageDTO, ShopRenovationDTO shopRenovation) {
shopRenovation.setShopId(AuthUserContext.get().getTenantId());
PageVO<ShopRenovation> shopRenovationPage = shopRenovationService.page(pageDTO, BeanUtil.map(shopRenovation, ShopRenovation.class));
return ServerResponseEntity.success(shopRenovationPage);
}
@GetMapping
@Operation(summary = "获取店铺装修信息", description = "根据renovationId获取店铺装修信息")
public ServerResponseEntity<ShopRenovation> getByRenovationId(@RequestParam Long renovationId) {
ShopRenovation shopRenovation = shopRenovationService.getByRenovationId(renovationId);
if (!Objects.equals(shopRenovation.getShopId(), AuthUserContext.get().getTenantId())) {
return ServerResponseEntity.fail(ResponseEnum.UNAUTHORIZED);
}
return ServerResponseEntity.success(shopRenovation);
}
@GetMapping("/get_h5")
@Operation(summary = "获取店铺装修信息", description = "根据renovationId获取店铺装修信息")
public ServerResponseEntity<ShopRenovation> getH5ByRenovationId(@RequestParam Long renovationId) {
ShopRenovation shopRenovation = shopRenovationService.getByRenovationId(renovationId);
if (!Objects.equals(shopRenovation.getShopId(), AuthUserContext.get().getTenantId())) {
return ServerResponseEntity.fail(ResponseEnum.UNAUTHORIZED);
}
return ServerResponseEntity.success(shopRenovation);
}
@PostMapping("/save_pc")
@Operation(summary = "保存店铺pc端装修信息", description = "保存店铺装修信息")
public ServerResponseEntity<Long> save(@Valid @RequestBody ShopRenovationDTO shopRenovationDTO) {
ShopRenovation shopRenovation = BeanUtil.map(shopRenovationDTO, ShopRenovation.class);
shopRenovation.setShopId(AuthUserContext.get().getTenantId());
shopRenovation.setRenovationId(null);
shopRenovation.setRenovationType(RenovationType.PC.value());
shopRenovationService.save(shopRenovation);
return ServerResponseEntity.success(shopRenovation.getRenovationId());
}
@PostMapping("/save_h5")
@Operation(summary = "保存店铺移动端装修信息", description = "保存店铺装修信息")
public ServerResponseEntity<Long> saveH5(@Valid @RequestBody ShopRenovationDTO shopRenovationDTO) {
ShopRenovation shopRenovation = BeanUtil.map(shopRenovationDTO, ShopRenovation.class);
shopRenovation.setShopId(AuthUserContext.get().getTenantId());
shopRenovation.setRenovationId(null);
shopRenovation.setRenovationType(RenovationType.H5.value());
shopRenovationService.save(shopRenovation);
return ServerResponseEntity.success(shopRenovation.getRenovationId());
}
}

View File

@ -0,0 +1,100 @@
package com.tmerclub.cloud.multishop.controller.admin;
import cn.hutool.core.util.BooleanUtil;
import com.tmerclub.cloud.common.exception.LuckException;
import com.tmerclub.cloud.common.response.ResponseEnum;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.common.util.BeanUtil;
import com.tmerclub.cloud.multishop.dto.ShopTemplateDTO;
import com.tmerclub.cloud.multishop.model.ShopTemplate;
import com.tmerclub.cloud.multishop.service.ShopTemplateService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* @author 菠萝凤梨
*/
@RestController("adminShopTemplateUpDelController")
@RequestMapping("/mp/shop_template")
@Tag(name = "店铺装修模板-修改、删除、设为主页")
public class ShopTemplateUpDelController {
@Autowired
private ShopTemplateService shopTemplateService;
@Value("${mall4cloud.expose.operation.auth:}")
private Boolean permission;
@PutMapping("/update_pc")
@Operation(summary = "更新商品PC装修模板表", description = "更新商品PC装修模板表")
public ServerResponseEntity<Void> update(@Valid @RequestBody ShopTemplateDTO shopTemplateDTO) {
if (BooleanUtil.isFalse(permission)) {
throw new LuckException("没有权限进行操作");
}
updateTemplate(shopTemplateDTO);
return ServerResponseEntity.success();
}
@PutMapping("/update_h5")
@Operation(summary = "更新商品H5装修模板表", description = "更新商品H5装修模板表")
public ServerResponseEntity<Void> updateH5(@Valid @RequestBody ShopTemplateDTO shopTemplateDTO) {
if (BooleanUtil.isFalse(permission)) {
throw new LuckException("没有权限进行操作");
}
updateTemplate(shopTemplateDTO);
return ServerResponseEntity.success();
}
@DeleteMapping("delete_pc")
@Operation(summary = "删除商品PC装修模板表", description = "根据商品装修模板表id删除商品PC装修模板表")
public ServerResponseEntity<Void> delete(@RequestParam Long templateId) {
if (BooleanUtil.isFalse(permission)) {
throw new LuckException("没有权限进行操作");
}
deleteTemplate(templateId);
return ServerResponseEntity.success();
}
@DeleteMapping("delete_h5")
@Operation(summary = "删除商品H5装修模板表", description = "根据商品装修模板表id删除商品H5装修模板表")
public ServerResponseEntity<Void> deleteH5(@RequestParam Long templateId) {
if (BooleanUtil.isFalse(permission)) {
throw new LuckException("没有权限进行操作");
}
deleteTemplate(templateId);
return ServerResponseEntity.success();
}
private void deleteTemplate(Long templateId) {
ShopTemplate shopTemplateDb = shopTemplateService.getByTemplateId(templateId);
if (Objects.isNull(shopTemplateDb)) {
throw new LuckException("模板不存在,请刷新页面重试");
}
if (!Objects.equals(shopTemplateDb.getShopId(), AuthUserContext.get().getTenantId())) {
throw new LuckException(ResponseEnum.UNAUTHORIZED);
}
shopTemplateService.deleteById(templateId);
shopTemplateService.removeCache(templateId);
}
private void updateTemplate(ShopTemplateDTO shopTemplateDTO) {
ShopTemplate shopTemplate = BeanUtil.map(shopTemplateDTO, ShopTemplate.class);
ShopTemplate shopTemplateDb = shopTemplateService.getByTemplateId(shopTemplate.getTemplateId());
if (Objects.isNull(shopTemplateDb)) {
throw new LuckException("模板不存在,请刷新页面重试");
}
if (!Objects.equals(shopTemplateDb.getShopId(), AuthUserContext.get().getTenantId())) {
throw new LuckException(ResponseEnum.UNAUTHORIZED);
}
shopTemplateService.update(shopTemplate);
shopTemplateService.removeCache(shopTemplate.getTemplateId());
}
}

View File

@ -0,0 +1,101 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import com.tmerclub.cloud.common.constant.Constant;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.common.util.ExcelUtil;
import com.tmerclub.cloud.multishop.dto.ShopWalletLogSearchDTO;
import com.tmerclub.cloud.multishop.mongo.MongoShopWalletLogBO;
import com.tmerclub.cloud.multishop.service.ShopWalletLogService;
import com.tmerclub.cloud.multishop.service.ShopWalletService;
import com.tmerclub.cloud.multishop.vo.ShopWalletLogExcelVO;
import com.tmerclub.cloud.multishop.vo.ShopWalletVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Objects;
/**
* 店铺钱包日志
* @author Pineapple
* @date 2021/6/8 19:46
*/
@RestController("adminShopWalletController")
@RequestMapping("/mp/shop_wallet")
@Tag(name = "admin-店铺钱包")
public class ShopWalletController {
@Autowired
private ShopWalletLogService shopWalletLogService;
@Autowired
private ShopWalletService shopWalletService;
@GetMapping("/page")
@Operation(summary = "分页查询钱包记录信息", description = "分页查询")
public ServerResponseEntity<PageVO<MongoShopWalletLogBO>> getShopWalletLogPage(PageDTO pageDTO, ShopWalletLogSearchDTO shopWalletLogSearchDTO) {
Long shopId = AuthUserContext.get().getTenantId();
if (!Objects.equals(shopId, Constant.PLATFORM_SHOP_ID)) {
shopWalletLogSearchDTO.setShopId(shopId);
}
PageVO<MongoShopWalletLogBO> page = shopWalletLogService.pageByParam(pageDTO, shopWalletLogSearchDTO);
return ServerResponseEntity.success(page);
}
@GetMapping("/get_all_shop_wallet")
@Operation(summary = "查看所有店铺钱包总信息")
public ServerResponseEntity<ShopWalletVO> getAllShopWalletVoByShopId(ShopWalletLogSearchDTO shopWalletLogSearchDTO) {
ShopWalletVO shopWallet = shopWalletService.getAllShop(shopWalletLogSearchDTO);
return ServerResponseEntity.success(shopWallet);
}
@GetMapping("/page_shop_wallet_by_time")
@Operation(summary = "分页查看店铺钱包总信息")
public ServerResponseEntity<PageVO<ShopWalletVO>> pageShopWalletByTime(PageDTO pageDTO, ShopWalletLogSearchDTO shopWalletLogSearchDTO) {
PageVO<ShopWalletVO> pageShopWalletByTime = shopWalletService.pageShopWalletByTime(pageDTO, shopWalletLogSearchDTO);
return ServerResponseEntity.success(pageShopWalletByTime);
}
@GetMapping("/page_all_shop")
@Operation(summary = "查看所有店铺的日志")
public ServerResponseEntity<PageVO<MongoShopWalletLogBO>> getAllShopWalletLogPage(PageDTO pageDTO, ShopWalletLogSearchDTO shopWalletLogSearchDTO) {
PageVO<MongoShopWalletLogBO> page = shopWalletLogService.pageAllShop(pageDTO, shopWalletLogSearchDTO);
return ServerResponseEntity.success(page);
}
@GetMapping("/get_shop_wallet_log_form")
@Operation(summary = "导出店铺结算报表", description = "导出店铺结算报表")
public ServerResponseEntity<Void> getShopWalletLogForm(HttpServletResponse response, ShopWalletLogSearchDTO shopWalletLogSearchDTO) {
List<ShopWalletLogExcelVO> list = shopWalletLogService.listShopWalletLogExcel(shopWalletLogSearchDTO);
ExcelUtil.soleExcel(response, list, ShopWalletLogExcelVO.EXCEL_NAME, ShopWalletLogExcelVO.MERGE_ROW_INDEX, ShopWalletLogExcelVO.MERGE_COLUMN_INDEX, ShopWalletLogExcelVO.class);
return ServerResponseEntity.success();
}
@GetMapping("/get_shop_wallet")
@Operation(summary = "查看店铺钱包信息", description = "根据店铺id查看店铺钱包信息")
public ServerResponseEntity<ShopWalletVO> getShopWalletVoByShopId() {
Long shopId = AuthUserContext.get().getTenantId();
if (Objects.equals(shopId, Constant.PLATFORM_SHOP_ID)) {
return ServerResponseEntity.success(shopWalletLogService.getPlatformWallet());
}
ShopWalletVO shopWallet = shopWalletService.getByShopId(shopId);
return ServerResponseEntity.success(shopWallet);
}
}

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.app;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.multishop.service.HotSearchService;
import com.tmerclub.cloud.multishop.vo.HotSearchVO;
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.beans.factory.annotation.Autowired;
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 java.util.List;
/**
* 热搜
*
* @author YXF
* @date 2021-01-27 09:10:00
*/
@RestController("appHotSearchController")
@RequestMapping("/ua/app/hot_search")
@Tag(name = "app-热搜")
public class HotSearchController {
@Autowired
private HotSearchService hotSearchService;
@GetMapping("/list")
@Operation(summary = "获取热搜列表", description = "获取热搜列表")
@Parameters({
@Parameter(name = "shopId", description = "店铺id"),
@Parameter(name = "type", description = "1:商品热搜 2:店铺热搜")
})
public ServerResponseEntity<List<HotSearchVO>> listByShopId(@RequestParam("shopId") Long shopId, @RequestParam("type") Integer type) {
List<HotSearchVO> hotSearches = hotSearchService.listByShopId(shopId, type);
return ServerResponseEntity.success(hotSearches);
}
}

View File

@ -0,0 +1,91 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.app;
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
import com.tmerclub.cloud.api.auth.bo.UidInfoBO;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.multishop.service.ShopCollectionService;
import com.tmerclub.cloud.multishop.vo.ShopCollectionVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 用户店铺收藏记录
*
* @author lhd
* @date 2021-02-23 14:41:42
*/
@RestController("appUserCollectionShopController")
@RequestMapping("/user_collection_shop")
@Tag(name = "app-用户店铺收藏记录")
public class ShopCollectionController {
@Autowired
private ShopCollectionService shopCollectionService;
@GetMapping("/page")
@Operation(summary = "分页返回收藏数据", description = "根据用户id获取")
public ServerResponseEntity<PageVO<ShopCollectionVO>> getUserCollectionDtoPageByUserId(@Valid PageDTO pageDTO, String shopName) {
Long userId = AuthUserContext.get().getUserId();
PageVO<ShopCollectionVO> shopCollectionPage = shopCollectionService.getUserCollectionShopPageByUserIdAndShopName(pageDTO, userId, shopName);
return ServerResponseEntity.success(shopCollectionPage);
}
@GetMapping("/ma/is_collection")
@Operation(summary = "根据店铺id获取该店铺是否在收藏夹中", description = "传入收藏店铺id")
public ServerResponseEntity<Boolean> isCollection(Long shopId) {
UidInfoBO uidInfoBO = AuthUserContext.get();
// 没有登陆就返回false (未收藏店铺)
if (uidInfoBO == null) {
return ServerResponseEntity.success(Boolean.FALSE);
}
return ServerResponseEntity.success(shopCollectionService.countByShopIdAndUserId(shopId, uidInfoBO.getUserId()) > 0);
}
@PostMapping("/add_or_cancel")
@Operation(summary = "添加/取消收藏", description = "传入收藏店铺id,如果店铺未收藏则收藏店铺,已收藏则取消收藏")
@Parameter(name = "shopId", description = "店铺id", required = true)
public ServerResponseEntity<Boolean> addOrCancel(@RequestBody Long shopId) {
Long userId = AuthUserContext.get().getUserId();
Boolean isAdd = shopCollectionService.addOrCancel(shopId, userId);
return ServerResponseEntity.success(isAdd);
}
@PostMapping("/batch_cancel")
@Operation(summary = "批量取消收藏", description = "传入收藏店铺id")
@Parameter(name = "shopIds", description = "店铺Id", required = true)
public ServerResponseEntity<Boolean> batchCancel(@RequestBody List<Long> shopIds) {
Long userId = AuthUserContext.get().getUserId();
if (CollectionUtils.isEmpty(shopIds)) {
return ServerResponseEntity.success(false);
}
return ServerResponseEntity.success(shopCollectionService.batchCancel(shopIds, userId));
}
/**
* 查询用户收藏店铺数量
*/
@GetMapping("count")
@Operation(summary = "查询用户收藏店铺数量", description = "查询用户收藏店铺数量")
public int findUserCollectionCount() {
Long userId = AuthUserContext.get().getUserId();
return shopCollectionService.countByShopIdAndUserId(null, userId);
}
}

View File

@ -0,0 +1,100 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.app;
import com.tmerclub.cloud.api.auth.constant.SysTypeEnum;
import com.tmerclub.cloud.api.multishop.vo.ShopDetailVO;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.multishop.constant.RenovationType;
import com.tmerclub.cloud.multishop.dto.ShopDetailDTO;
import com.tmerclub.cloud.multishop.dto.ShopSearchDTO;
import com.tmerclub.cloud.multishop.model.ShopRenovation;
import com.tmerclub.cloud.multishop.service.ShopDetailService;
import com.tmerclub.cloud.multishop.service.ShopRenovationService;
import com.tmerclub.cloud.multishop.vo.ShopDetailAppVO;
import com.tmerclub.cloud.multishop.vo.ShopHeadInfoVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Objects;
/**
* 店铺详情
*
* @author FrozenWatermelon
* @date 2020-12-05 15:50:25
*/
@RestController("appShopDetailController")
@RequestMapping("/ua/shop_detail")
@Tag(name = "app-店铺详情")
public class ShopDetailController {
@Autowired
private ShopDetailService shopDetailService;
@Autowired
private ShopRenovationService shopRenovationService;
@GetMapping("/page")
@Operation(summary = "搜索店铺列表")
public ServerResponseEntity<PageVO<ShopDetailAppVO>> page(@Valid PageDTO pageDTO, ShopDetailDTO shopDetailDTO) {
return ServerResponseEntity.success(shopDetailService.shopSearchPage(pageDTO, shopDetailDTO));
}
@GetMapping("/head_info")
@Operation(summary = "店铺头部信息", description = "获取的店铺头部信息")
public ServerResponseEntity<ShopHeadInfoVO> getShopHeadInfo(Long shopId) {
ShopHeadInfoVO shopHeadInfoDto = new ShopHeadInfoVO();
ShopDetailVO shopDetail = shopDetailService.getShoExtensionsByShopId(shopId);
if (Objects.isNull(shopDetail)) {
return ServerResponseEntity.showFailMsg("店铺不存在!");
}
shopHeadInfoDto.setShopStatus(shopDetail.getShopStatus());
shopHeadInfoDto.setContractStartTime(shopDetail.getContractStartTime());
shopHeadInfoDto.setContractEndTime(shopDetail.getContractEndTime());
if (!Objects.equals(shopDetail.getShopStatus(), 1)) {
return ServerResponseEntity.success(shopHeadInfoDto);
}
ShopRenovation shopHomeRenovation = shopRenovationService.getShopHomeRenovation(shopId, RenovationType.H5.value());
shopHeadInfoDto.setRenovationId(Objects.nonNull(shopHomeRenovation) ? shopHomeRenovation.getRenovationId() : null);
shopHeadInfoDto.setShopId(shopId);
shopHeadInfoDto.setType(shopDetail.getType());
shopHeadInfoDto.setIntro(shopDetail.getIntro());
shopHeadInfoDto.setShopLogo(shopDetail.getShopLogo());
shopHeadInfoDto.setShopName(shopDetail.getShopName());
shopHeadInfoDto.setIsPreferred(shopDetail.getIsPreferred());
shopHeadInfoDto.setCollectionNum(shopDetail.getCollectionNum());
shopHeadInfoDto.setPcBackgroundPic(shopDetail.getPcBackgroundPic());
shopHeadInfoDto.setMobileBackgroundPic(shopDetail.getMobileBackgroundPic());
return ServerResponseEntity.success(shopHeadInfoDto);
}
@GetMapping("/search_shops")
@Operation(summary = "app搜索店铺", description = "根据店铺名称搜索店铺")
public ServerResponseEntity<PageVO<ShopHeadInfoVO>> searchShops(PageDTO pageDTO, ShopSearchDTO shopSearchDTO) {
PageVO<ShopHeadInfoVO> shopPage = shopDetailService.renovationShopPage(pageDTO, shopSearchDTO, SysTypeEnum.ORDINARY.value());
return ServerResponseEntity.success(shopPage);
}
@GetMapping("/list_renovation_shop")
@Operation(summary = "获取装修店铺列表信息", description = "获取装修店铺列表信息")
public ServerResponseEntity<List<ShopHeadInfoVO>> listRenovationShop(ShopSearchDTO shopSearchDTO) {
List<ShopHeadInfoVO> shopList = shopDetailService.listRenovationShop(shopSearchDTO);
return ServerResponseEntity.success(shopList);
}
}

View File

@ -0,0 +1,78 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.app;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.multishop.model.ShopRenovation;
import com.tmerclub.cloud.multishop.service.ShopRenovationService;
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.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
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 java.util.Objects;
/**
* 店铺装修信息
* @author Orange
* @date 2022-08-12 11:27:18
*/
@RestController("appShopRenovationController")
@RequestMapping("/ua/shop_renovation")
@Tag(name = "app-店铺装修信息")
public class ShopRenovationController {
private static final Logger logger = LoggerFactory.getLogger(ShopRenovationController.class);
@Autowired
private ShopRenovationService shopRenovationService;
@GetMapping("/get_home_page")
@Operation(summary = "获取店铺主页装修信息", description = "根据店铺id装修类型获取店铺装修信息")
@Parameters({
@Parameter(name = "shopId", description = "店铺id", required = true),
@Parameter(name = "renovationType", description = "装修类型 1.pc 2.移动端", required = true)
})
public ServerResponseEntity<ShopRenovation> getHomePage(@RequestParam("shopId") Long shopId,
@RequestParam("renovationType") Integer renovationType) {
ShopRenovation shopHomeRenovation = shopRenovationService.getShopHomeRenovation(shopId, renovationType);
return ServerResponseEntity.success(shopHomeRenovation);
}
@GetMapping("/get_home")
@Operation(summary = "获取店铺主页装修信息(内容为空)", description = "根据店铺id装修类型获取店铺装修信息(内容为空)")
@Parameters({
@Parameter(name = "shopId", description = "店铺id", required = true),
@Parameter(name = "renovationType", description = "装修类型 1.pc 2.移动端", required = true)
})
public ServerResponseEntity<ShopRenovation> getHome(@RequestParam("shopId") Long shopId,
@RequestParam("renovationType") Integer renovationType) {
ShopRenovation shopHomeRenovation = shopRenovationService.getShopHomeRenovation(shopId, renovationType);
if (Objects.nonNull(shopHomeRenovation)) {
logger.info("判断店铺装修信息是否为空,不为空则设置内容为空");
shopHomeRenovation.setContent(null);
}
return ServerResponseEntity.success(shopHomeRenovation);
}
@GetMapping("/get_renovation_by_id")
@Operation(summary = "根据装修id获取店铺装修信息", description = "根据装修id获取店铺装修信息")
@Parameter(name = "renovationId", description = "装修id", required = true)
public ServerResponseEntity<ShopRenovation> getRenovationById(@RequestParam("renovationId") Long renovationId) {
ShopRenovation shopRenovation = shopRenovationService.getByRenovationId(renovationId);
return ServerResponseEntity.success(shopRenovation);
}
}

View File

@ -0,0 +1,65 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.multishop;
import com.tmerclub.cloud.common.exception.LuckException;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.multishop.constant.AuditStatus;
import com.tmerclub.cloud.multishop.dto.ShopCompanyDTO;
import com.tmerclub.cloud.multishop.service.CompanyAuditingService;
import com.tmerclub.cloud.multishop.service.ShopDetailService;
import com.tmerclub.cloud.multishop.vo.ShopCompanyAuditingVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* @author chiley
* @date 2022/9/13 14:06
*/
@RestController("multishopCompanyAuditingController")
@RequestMapping("/m/shop_company_auditing")
@Tag(name = "multishop-店铺变更工商信息")
public class CompanyAuditingController {
@Autowired
private CompanyAuditingService companyAuditingService;
@Autowired
private ShopDetailService shopDetailService;
@PostMapping("/apply_change_company_info")
@Operation(summary = "申请变更工商信息", description = "申请变更工商信息")
public ServerResponseEntity<Void> applyChangeCompanyInfo(@RequestBody @Valid ShopCompanyDTO shopCompanyDTO) {
Long shopId = AuthUserContext.get().getTenantId();
// 校验是否已经存在申请中记录
ShopCompanyAuditingVO shopCompanyAuditingVO = companyAuditingService.getLatestAuditingByShopId(shopId);
if (Objects.nonNull(shopCompanyAuditingVO) && Objects.equals(shopCompanyAuditingVO.getStatus(), AuditStatus.WAITAUDIT.value())) {
throw new LuckException("不能同时提交多次签约申请,请耐心等候平台审核,或者把上次提交申请撤销后重新申请");
}
shopCompanyDTO.setShopId(shopId);
companyAuditingService.applyChangeCompanyInfo(shopCompanyDTO);
shopDetailService.removeCacheByShopId(shopId);
return ServerResponseEntity.success();
}
@PutMapping("/revoke")
@Operation(summary = "撤销申请", description = "撤销申请")
public ServerResponseEntity<Void> revoke() {
Long shopId = AuthUserContext.get().getTenantId();
companyAuditingService.revoke(shopId);
return ServerResponseEntity.success();
}
}

View File

@ -0,0 +1,165 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.multishop;
import com.tmerclub.cloud.api.multishop.vo.ShopBankCardVO;
import com.tmerclub.cloud.api.multishop.vo.ShopDetailVO;
import com.tmerclub.cloud.common.constant.CompanyInfoProcessStatus;
import com.tmerclub.cloud.common.exception.LuckException;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.multishop.constant.AuditStatus;
import com.tmerclub.cloud.multishop.dto.AllinpayShopBankCardDTO;
import com.tmerclub.cloud.multishop.dto.ShopBankCardDTO;
import com.tmerclub.cloud.multishop.service.ShopAllinpayService;
import com.tmerclub.cloud.multishop.service.ShopBankCardService;
import com.tmerclub.cloud.multishop.service.ShopCompanyService;
import com.tmerclub.cloud.multishop.service.ShopDetailService;
import com.tmerclub.cloud.multishop.vo.ShopCompanyVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Objects;
/**
* @author lth
*/
@RestController("multishopShopBankCardController")
@RequestMapping("/m/apply_shop/shop_bank_card")
@Tag(name = "multishop-店铺银行卡信息")
public class ShopBankCardController {
private final Logger LOGGER = LoggerFactory.getLogger(ShopBankCardController.class);
@Autowired
private ShopBankCardService shopBankCardService;
@Autowired
private ShopCompanyService shopCompanyService;
@Autowired
private ShopAllinpayService shopAllinpayService;
@Autowired
private ShopDetailService shopDetailService;
@PostMapping("/save_and_apply_shop")
@Operation(summary = "批量保存店铺银行卡信息并提交店铺审核信息", description = "批量保存店铺银行卡信息并提交店铺审核信息")
public ServerResponseEntity<Void> saveAndApplyShop(@Valid @RequestBody List<ShopBankCardDTO> shopBankCardDTOList) {
Long shopId = AuthUserContext.get().getTenantId();
if (shopAllinpayService.getIsAllinpay()) {
LOGGER.info("通联支付--批量保存店铺银行卡信息并提交店铺审核信息");
throw new LuckException("开店所需要提交的信息有所变更,请重新填写");
}
shopBankCardService.insertBatchAndSubmitApply(shopBankCardDTOList, shopId);
return ServerResponseEntity.success();
}
@PostMapping("/allinpay_save_and_apply_shop")
@Operation(summary = "通联支付--批量保存店铺银行卡信息并提交店铺审核信息", description = "批量保存店铺银行卡信息并提交店铺审核信息")
public ServerResponseEntity<Void> allinpaySaveAndApplyShop(@Valid @RequestBody AllinpayShopBankCardDTO allinpayShopBankCardDTO) {
Long shopId = AuthUserContext.get().getTenantId();
// 查找工商信息
ShopCompanyVO shopCompany = shopCompanyService.getShopCompanyByShopIdAndStatus(shopId, AuditStatus.WAITAUDIT.value());
if (Objects.isNull(shopCompany)) {
LOGGER.info("店铺工商信息为空,请刷新页面重新填写");
throw new LuckException("店铺工商信息为空,请刷新页面重新填写");
}
checkAllinpay(shopCompany);
ShopDetailVO shopDetailVO = shopDetailService.getByShopId(shopId);
if (Objects.equals(shopDetailVO.getCompanyInfoProcessStatus(), CompanyInfoProcessStatus.SUCCESS.value())) {
// 已经审核成功就不必要多次设置企业信息了
throw new LuckException("店铺已经审核通过");
}
shopBankCardService.insertAndSetCompanyInfo(allinpayShopBankCardDTO, shopId, shopCompany);
shopDetailService.removeCacheByShopId(shopId);
return ServerResponseEntity.success();
}
private void checkAllinpay(ShopCompanyVO shopCompany) {
boolean needInfo = Objects.isNull(shopCompany.getLegalIds()) || Objects.isNull(shopCompany.getLegalPhone());
if (shopAllinpayService.getIsAllinpay() && needInfo) {
throw new LuckException("工商信息需要提交的内容有所变更,请重新填写");
}
}
@GetMapping
@Operation(summary = "根据银行卡id获取银行卡信息", description = "根据银行卡id获取银行卡信息")
public ServerResponseEntity<ShopBankCardVO> getById(@RequestParam("shopBankCardId") Long shopBankCardId) {
Long shopId = AuthUserContext.get().getTenantId();
ShopBankCardVO shopBankCardVO = shopBankCardService.getByShopBankCardIdAndShopId(shopBankCardId, shopId);
return ServerResponseEntity.success(shopBankCardVO);
}
@GetMapping("/list_by_shopId")
@Operation(summary = "获取店铺下的银行卡列表", description = "获取店铺下的银行卡列表")
public ServerResponseEntity<List<ShopBankCardVO>> listByShopId() {
Long shopId = AuthUserContext.get().getTenantId();
List<ShopBankCardVO> shopBankCardVOList = shopBankCardService.listByShopId(shopId);
return ServerResponseEntity.success(shopBankCardVOList);
}
@PostMapping
@Operation(summary = "添加单个银行卡信息", description = "添加单个银行卡信息")
public ServerResponseEntity<Void> insert(@RequestBody @Valid ShopBankCardDTO shopBankCardDTO) {
if (shopAllinpayService.getIsAllinpay()) {
throw new LuckException("当前不支持该接口添加银行卡");
}
Long shopId = AuthUserContext.get().getTenantId();
shopBankCardService.insertByShopId(shopBankCardDTO, shopId);
return ServerResponseEntity.success();
}
@DeleteMapping
@Operation(summary = "根据银行卡id删除银行卡信息", description = "根据银行卡id删除银行卡信息")
public ServerResponseEntity<Void> deleteById(@RequestParam("shopBankCardId") Long shopBankCardId) {
if (shopAllinpayService.getIsAllinpay()) {
throw new LuckException("当前不支持该接口删除银行卡");
}
shopBankCardService.deleteByShopBankCardId(shopBankCardId, AuthUserContext.get().getTenantId());
return ServerResponseEntity.success();
}
@PutMapping
@Operation(summary = "更新银行卡信息", description = "更新银行卡信息")
public ServerResponseEntity<Void> update(@RequestBody @Valid ShopBankCardDTO shopBankCardDTO) {
if (shopAllinpayService.getIsAllinpay()) {
throw new LuckException("当前不支持该接口更新银行卡");
}
shopBankCardService.updateByShopId(shopBankCardDTO, AuthUserContext.get().getTenantId());
return ServerResponseEntity.success();
}
@PutMapping("/set_primary")
@Operation(summary = "设置为主账号", description = "设置为主账号")
public ServerResponseEntity<Void> setPrimary(@RequestParam("shopBankCardId") Long shopBankCardId) {
shopBankCardService.setPrimaryByShopId(shopBankCardId, AuthUserContext.get().getTenantId());
return ServerResponseEntity.success();
}
@PutMapping("/set_not_primary")
@Operation(summary = "取消主账号", description = "取消主账号")
public ServerResponseEntity<Void> setNotPrimary(@RequestParam("shopBankCardId") Long shopBankCardId) {
shopBankCardService.setNotPrimaryByShopId(shopBankCardId, AuthUserContext.get().getTenantId());
return ServerResponseEntity.success();
}
@PostMapping("/refresh")
@Operation(summary = "刷新银行卡列表", description = "通联独有,防止有银行卡没有同步到数据库")
public ServerResponseEntity<Void> refresh() {
Long shopId = AuthUserContext.get().getTenantId();
shopBankCardService.refresh(shopId);
return ServerResponseEntity.success();
}
}

View File

@ -0,0 +1,166 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.multishop;
import cn.hutool.core.util.PhoneUtil;
import cn.hutool.core.util.StrUtil;
import com.tmerclub.cloud.api.multishop.constant.ShopStatus;
import com.tmerclub.cloud.api.multishop.vo.ShopDetailVO;
import com.tmerclub.cloud.api.platform.constant.OfflineHandleEventType;
import com.tmerclub.cloud.api.platform.dto.OfflineHandleEventDTO;
import com.tmerclub.cloud.api.platform.feign.OfflineHandleEventFeignClient;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.tmerclub.cloud.common.constant.Constant;
import com.tmerclub.cloud.common.exception.LuckException;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.multishop.dto.ShopDetailDTO;
import com.tmerclub.cloud.multishop.service.ShopAllinpayService;
import com.tmerclub.cloud.multishop.service.ShopDetailService;
import com.tmerclub.cloud.multishop.vo.ShopStatusInfoVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* @author lth
*/
@RestController("multishopShopDetailController")
@RequestMapping("/m/apply_shop/shop_detail")
@Tag(name = "multishop-店铺信息")
public class ShopDetailController {
@Autowired
private ShopDetailService shopDetailService;
@DubboReference
private OfflineHandleEventFeignClient offlineHandleEventFeignClient;
@Autowired
private ShopAllinpayService shopAllinpayService;
@PostMapping
@Operation(summary = "创建店铺", description = "创建店铺")
public ServerResponseEntity<Void> createShop(@RequestBody @Valid ShopDetailDTO shopDetailDTO) {
if (!Objects.equals(AuthUserContext.get().getTenantId(), Constant.DEFAULT_SHOP_ID)) {
throw new LuckException("店铺已存在,不能重复创建");
}
this.dealWithUpdateOrCreateInfo(shopDetailDTO);
shopDetailService.createShop(shopDetailDTO);
return ServerResponseEntity.success();
}
@PutMapping
@Operation(summary = "更新店铺基本信息", description = "更新店铺基本信息")
public ServerResponseEntity<Void> update(@RequestBody @Valid ShopDetailDTO shopDetailDTO) {
Long shopId = AuthUserContext.get().getTenantId();
if (Objects.equals(shopId, Constant.DEFAULT_SHOP_ID)) {
throw new LuckException("店铺不存在,无法更新");
}
shopDetailDTO.setShopId(shopId);
this.dealWithUpdateOrCreateInfo(shopDetailDTO);
shopDetailService.update(shopDetailDTO);
return ServerResponseEntity.success();
}
@PostMapping("/storage")
@Operation(summary = "存储店铺基本信息", description = "存储店铺基本信息,不存在则新增,已存在则更新")
public ServerResponseEntity<Void> storage(@RequestBody @Valid ShopDetailDTO shopDetailDTO) {
Long shopId = AuthUserContext.get().getTenantId();
this.dealWithUpdateOrCreateInfo(shopDetailDTO);
if (Objects.equals(shopId, Constant.DEFAULT_SHOP_ID)) {
// 店铺不存在新增
shopDetailService.createShop(shopDetailDTO);
} else {
// 店铺已存在更新
shopDetailDTO.setShopId(shopId);
shopDetailService.update(shopDetailDTO);
}
return ServerResponseEntity.success();
}
@GetMapping
@Operation(summary = "获取店铺基本信息", description = "获取店铺基本信息")
public ServerResponseEntity<ShopDetailVO> get() {
Long shopId = AuthUserContext.get().getTenantId();
if (Objects.equals(shopId, Constant.DEFAULT_SHOP_ID)) {
// 店铺未创建
return ServerResponseEntity.success(null);
}
ShopDetailVO shopDetailVO = shopDetailService.getByShopId(shopId);
if (Objects.nonNull(shopDetailVO) && StrUtil.isNotBlank(shopDetailVO.getContactPhone())) {
shopDetailVO.setContactPhone(PhoneUtil.hideBetween(shopDetailVO.getContactPhone()).toString());
}
return ServerResponseEntity.success(shopDetailVO);
}
@GetMapping("/get_status_info")
@Operation(summary = "获取店铺状态信息", description = "获取店铺状态信息")
public ServerResponseEntity<ShopStatusInfoVO> getShopStatusInfo() {
Long shopId = AuthUserContext.get().getTenantId();
ShopDetailVO shopDetailVO = shopDetailService.getByShopId(shopId);
if (Objects.isNull(shopDetailVO)) {
throw new LuckException("店铺不存在");
}
ShopStatusInfoVO shopStatusInfoVO = new ShopStatusInfoVO();
shopStatusInfoVO.setShopStatus(shopDetailVO.getShopStatus());
shopStatusInfoVO.setContractStartTime(shopDetailVO.getContractStartTime());
shopStatusInfoVO.setContractEndTime(shopDetailVO.getContractEndTime());
if (Objects.equals(shopDetailVO.getShopStatus(), ShopStatus.OFFLINE.value())) {
ServerResponseEntity<OfflineHandleEventVO> offlineHandleEventRes = offlineHandleEventFeignClient.getProcessingEventByHandleTypeAndHandleId(OfflineHandleEventType.SHOP.getValue(), shopId, null);
if (!offlineHandleEventRes.isSuccess()) {
throw new LuckException(offlineHandleEventRes.getMsg());
}
OfflineHandleEventVO offlineHandleEventVO = offlineHandleEventRes.getData();
if (Objects.nonNull(offlineHandleEventVO)) {
shopStatusInfoVO.setOfflineReason(offlineHandleEventVO.getOfflineReason());
shopStatusInfoVO.setOfflineStatus(offlineHandleEventVO.getStatus());
} else if (shopAllinpayService.getIsAllinpay()) {
shopStatusInfoVO.setOfflineReason("平台开启通联支付,请重新提交工商信息与财务信息");
}
}
return ServerResponseEntity.success(shopStatusInfoVO);
}
@PostMapping("/create_allinpay_member")
@Operation(summary = "给还没有创建通联账户的商家创建一个", description = "给还没有创建通联账户的商家创建一个")
public ServerResponseEntity<Void> createAllinpayMemberByShopId() {
shopDetailService.createAllinpayMemberByShopId(AuthUserContext.get().getTenantId());
shopDetailService.removeCacheByShopId(AuthUserContext.get().getTenantId());
return ServerResponseEntity.success();
}
@PostMapping("/audit_apply")
@Operation(summary = "店铺重新申请上线", description = "店铺重新申请上线")
public ServerResponseEntity<Void> auditApply(@RequestBody OfflineHandleEventDTO offlineHandleEventDTO) {
Long shopId = AuthUserContext.get().getTenantId();
offlineHandleEventDTO.setHandleId(shopId);
shopDetailService.auditApply(offlineHandleEventDTO);
return ServerResponseEntity.success();
}
/**
* 处理店铺信息这些信息商家无法直接修改
* @param shopDetailDTO
*/
private void dealWithUpdateOrCreateInfo(ShopDetailDTO shopDetailDTO) {
if (Objects.isNull(shopDetailDTO)) {
return;
}
shopDetailDTO.setContractEndTime(null);
shopDetailDTO.setContractStartTime(null);
shopDetailDTO.setShopStatus(null);
shopDetailDTO.setType(null);
}
}

View File

@ -0,0 +1,144 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.multishop;
import com.tmerclub.cloud.api.multishop.vo.ShopDetailVO;
import com.tmerclub.cloud.api.payment.constant.PaySysType;
import com.tmerclub.cloud.common.constant.Constant;
import com.tmerclub.cloud.common.exception.LuckException;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.multishop.constant.ShopWalletAmountType;
import com.tmerclub.cloud.multishop.constant.ShopWalletChangeReason;
import com.tmerclub.cloud.multishop.constant.ShopWalletIoType;
import com.tmerclub.cloud.multishop.dto.AllinpayRechargeDTO;
import com.tmerclub.cloud.multishop.dto.ShopRechargeInfoDTO;
import com.tmerclub.cloud.multishop.mongo.MongoShopWalletLogBO;
import com.tmerclub.cloud.multishop.service.*;
import com.tmerclub.cloud.multishop.vo.ShopRechargeVO;
import com.tmerclub.cloud.multishop.vo.ShopWalletVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Date;
import java.util.Objects;
/**
* 商家店铺余额充值
* @author chiley
*/
@RestController("multishopRechargeController")
@RequestMapping("/m/shop_recharge")
@Tag(name = "multishop-商家余额充值")
public class ShopRechargeController {
@Autowired
private ShopWalletLogService shopWalletLogService;
@Autowired
private ShopWalletService shopWalletService;
@Autowired
private ShopAllinpayService shopAllinpayService;
@Autowired
private ShopDetailService shopDetailService;
@Autowired
private ShopRechargeService shopRechargeService;
@PostMapping("/recharge")
@Operation(summary = "充值订单", description = "生成余额充值订单,保存充值记录")
public ServerResponseEntity<Long> save(@Valid @RequestBody ShopRechargeInfoDTO shopRechargeInfoDTO) {
if (shopAllinpayService.getIsAllinpay()) {
throw new LuckException("通联充值暂不支持该接口");
}
Long shopId = AuthUserContext.get().getTenantId();
Long amount = checkAndGetAmount(shopRechargeInfoDTO, shopId);
MongoShopWalletLogBO shopWalletLog = new MongoShopWalletLogBO();
shopWalletLog.setShopId(shopId);
shopWalletLog.setShopChangeAmount(amount);
shopWalletLog.setUserAmount(amount);
shopWalletLog.setShopIoType(ShopWalletIoType.INCOME.value());
shopWalletLog.setReason(ShopWalletChangeReason.APPLY_RECHARGE.value());
shopWalletLog.setAmountType(ShopWalletAmountType.SETTLED_AMOUNT.value());
shopWalletLog.setCreateTime(new Date());
shopWalletLog.setPaySysType(PaySysType.DEFAULT.value());
shopWalletLogService.saveMongo(shopWalletLog);
return ServerResponseEntity.success(shopWalletLog.getWalletLogId());
}
/**
* @param shopRechargeInfoDTO
* @return
*/
@PostMapping("/allinpay_recharge")
@Operation(summary = "通联充值订单", description = "生成余额充值订单,保存充值记录--通联独有")
public ServerResponseEntity<ShopRechargeVO> allinpayRecharge(@Valid @RequestBody ShopRechargeInfoDTO shopRechargeInfoDTO) {
if (!shopAllinpayService.getIsAllinpay()) {
throw new LuckException("通联支付未开启");
}
Long shopId = AuthUserContext.get().getTenantId();
ShopDetailVO shopDetailVO = shopDetailService.getByShopId(shopId);
if (Objects.equals(shopDetailVO.getIsBindPhone(), 0)) {
throw new LuckException("店铺还未绑定手机号码,无法进行充值");
}
Long amount = checkAndGetAmount(shopRechargeInfoDTO, shopId);
MongoShopWalletLogBO shopWalletLog = new MongoShopWalletLogBO();
shopWalletLog.setShopId(shopId);
shopWalletLog.setUserAmount(amount);
shopWalletLog.setShopChangeAmount(amount);
shopWalletLog.setShopIoType(ShopWalletIoType.INCOME.value());
shopWalletLog.setReason(ShopWalletChangeReason.APPLY_RECHARGE.value());
shopWalletLog.setAmountType(ShopWalletAmountType.SETTLED_AMOUNT.value());
shopWalletLog.setCreateTime(new Date());
// 补充支付类型默认支付/通联支付
shopWalletLog.setPaySysType(PaySysType.ALLINPAY.value());
ShopRechargeVO shopRecharge = shopRechargeService.shopRecharge(shopWalletLog, shopRechargeInfoDTO.getReturnUrl());
return ServerResponseEntity.success(shopRecharge);
}
private Long checkAndGetAmount(ShopRechargeInfoDTO shopRechargeInfoDTO, Long shopId) {
Long amount = shopRechargeInfoDTO.getRechargeAmount().longValue();
if (amount < 1) {
throw new LuckException("充值金额有误");
}
ShopWalletVO shopWallet = shopWalletService.getByShopId(shopId);
long userBalance = shopWallet.getSettledAmount() + amount;
if (userBalance > Constant.MAX_USER_BALANCE) {
throw new LuckException("此次充值会导致余额超出最大限制,故无法进行此操作,请减少充值金额后重试");
}
return amount;
}
@Operation(summary = "充值确认支付--暂不调用,采用微信正扫不需要该接口", description = "通联独有")
@PostMapping("/confirm_recharge_pay")
public ServerResponseEntity<Void> confirmRechargePay(@RequestBody AllinpayRechargeDTO rechargeDTO) {
if (Objects.isNull(rechargeDTO.getBizOrderNo()) || Objects.isNull(rechargeDTO.getVerificationCode())) {
throw new LuckException("短信验证码和订单号不能为空");
}
shopRechargeService.confirmRechargePay(rechargeDTO, AuthUserContext.get().getTenantId());
return ServerResponseEntity.success();
}
@Operation(summary = "重新发送充值支付验证码--暂不调用,采用微信正扫不需要该接口", description = "通联独有")
@PostMapping("/resend_pay_sms")
public ServerResponseEntity<Void> resendPaySms(@RequestBody AllinpayRechargeDTO rechargeDTO) {
if (Objects.isNull(rechargeDTO.getBizOrderNo())) {
throw new LuckException("充值订单号不能为空");
}
shopRechargeService.resendPaySms(rechargeDTO.getBizOrderNo(), AuthUserContext.get().getTenantId());
return ServerResponseEntity.success();
}
}

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