初始提交

This commit is contained in:
wzgaoyn 2025-03-18 21:22:38 +08:00
parent aacfffbbc1
commit 536720febf
1813 changed files with 276615 additions and 0 deletions

62
.gitignore vendored Normal file
View File

@ -0,0 +1,62 @@
### gradle ###
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
### STS ###
.settings/
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
bin/
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
*.lock
rebel.xml
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
### maven ###
target/
*.war
*.ear
*.zip
*.tar
*.tar.gz
### logs ####
/logs/
*.log
### temp ignore ###
*.cache
*.diff
*.patch
*.tmp
*.java~
*.properties~
*.xml~
### system ignore ###
.DS_Store
Thumbs.db
Servers
.metadata
upload
gen_code
### node ###
node_modules

19
README.md Normal file
View File

@ -0,0 +1,19 @@
## 协议和授权
`mall4cloud` 并非一个开源软件,作者保留全部的权利。 擅自窃用,即属严重侵权行为,与盗窃无异。产生的一切任何后果责任由侵权者自负。
## 商业使用
本项目并非一个开源项目,**广州市蓝海创新科技有限公司** 拥该项目的100%版权。
商用请联系 **广州市蓝海创新科技有限公司** 获取授权,否则产生的一切任何后果责任由侵权者自负。
## 🚫禁止
将本项目的部分或全部代码和资源进行任何形式的再发行上传GitHub、Gitee等任何公开发行的地方
## 侵权处理
- 支付人民币最低 `100万``侵权数量*商业版售价*10倍` 不等的侵权费用(含我方法律援助费用),本团队已完全委托律师事务所 司法保护
- 个人行为将直接收集材料邮寄贵司侵权律师函,若出现司法诉讼将直接影响当事人征信档案等特此说明

View File

@ -0,0 +1,2 @@
UPDATE sku SET stock_warning = 0 WHERE stock_warning IS NULL;
UPDATE `spu` SET update_time = NOW();

View File

@ -0,0 +1,157 @@
# 退款单新增商家备注字段
USE mall4cloud_order_0;
DELIMITER //
DROP PROCEDURE IF EXISTS updateRefundColumn //
CREATE PROCEDURE updateRefundColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 32 DO
SET @add_column = CONCAT( 'ALTER TABLE order_refund_', i, " ADD COLUMN `shop_seller_msg` varchar(300) NULL COMMENT '商家备注(移交供应商处理时保存)' AFTER `seller_msg`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateRefundColumn() //
DROP PROCEDURE updateRefundColumn //
DELIMITER;
USE mall4cloud_order_1;
DELIMITER //
DROP PROCEDURE IF EXISTS updateRefundColumn //
CREATE PROCEDURE updateRefundColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 32 DO
SET @add_column = CONCAT( 'ALTER TABLE order_refund_', i, " ADD COLUMN `shop_seller_msg` varchar(300) NULL COMMENT '商家备注(移交供应商处理时保存)' AFTER `seller_msg`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateRefundColumn() //
DROP PROCEDURE updateRefundColumn //
DELIMITER;
USE mall4cloud_order_2;
DELIMITER //
DROP PROCEDURE IF EXISTS updateRefundColumn //
CREATE PROCEDURE updateRefundColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 32 DO
SET @add_column = CONCAT( 'ALTER TABLE order_refund_', i, " ADD COLUMN `shop_seller_msg` varchar(300) NULL COMMENT '商家备注(移交供应商处理时保存)' AFTER `seller_msg`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateRefundColumn() //
DROP PROCEDURE updateRefundColumn //
DELIMITER;
USE mall4cloud_order_3;
DELIMITER //
DROP PROCEDURE IF EXISTS updateRefundColumn //
CREATE PROCEDURE updateRefundColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 32 DO
SET @add_column = CONCAT( 'ALTER TABLE order_refund_', i, " ADD COLUMN `shop_seller_msg` varchar(300) NULL COMMENT '商家备注(移交供应商处理时保存)' AFTER `seller_msg`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateRefundColumn() //
DROP PROCEDURE updateRefundColumn //
DELIMITER;
USE mall4cloud_order_4;
DELIMITER //
DROP PROCEDURE IF EXISTS updateRefundColumn //
CREATE PROCEDURE updateRefundColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 32 DO
SET @add_column = CONCAT( 'ALTER TABLE order_refund_', i, " ADD COLUMN `shop_seller_msg` varchar(300) NULL COMMENT '商家备注(移交供应商处理时保存)' AFTER `seller_msg`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateRefundColumn() //
DROP PROCEDURE updateRefundColumn //
DELIMITER;
USE mall4cloud_order_5;
DELIMITER //
DROP PROCEDURE IF EXISTS updateRefundColumn //
CREATE PROCEDURE updateRefundColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 32 DO
SET @add_column = CONCAT( 'ALTER TABLE order_refund_', i, " ADD COLUMN `shop_seller_msg` varchar(300) NULL COMMENT '商家备注(移交供应商处理时保存)' AFTER `seller_msg`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateRefundColumn() //
DROP PROCEDURE updateRefundColumn //
DELIMITER;
USE mall4cloud_order_6;
DELIMITER //
DROP PROCEDURE IF EXISTS updateRefundColumn //
CREATE PROCEDURE updateRefundColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 32 DO
SET @add_column = CONCAT( 'ALTER TABLE order_refund_', i, " ADD COLUMN `shop_seller_msg` varchar(300) NULL COMMENT '商家备注(移交供应商处理时保存)' AFTER `seller_msg`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateRefundColumn() //
DROP PROCEDURE updateRefundColumn //
DELIMITER;
USE mall4cloud_order_7;
DELIMITER //
DROP PROCEDURE IF EXISTS updateRefundColumn //
CREATE PROCEDURE updateRefundColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 32 DO
SET @add_column = CONCAT( 'ALTER TABLE order_refund_', i, " ADD COLUMN `shop_seller_msg` varchar(300) NULL COMMENT '商家备注(移交供应商处理时保存)' AFTER `seller_msg`" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updateRefundColumn() //
DROP PROCEDURE updateRefundColumn //
DELIMITER;
# 添加小程序发货定时任务
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-15 13:53:42', '2023-09-15 13:53:42', 'admin', '',
'CRON', '0 0/1 * * * ?', 'DO_NOTHING', 'FIRST', 'wxAppShipment', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '',
'GLUE代码初始化', '2023-09-15 13:53:42', '', 0, 0, 0);

View File

@ -0,0 +1,13 @@
USE `mall4cloud_nacos`;
UPDATE config_info
SET content= REPLACE(content,
'parameters:\n namespace: ${spring.cloud.nacos.discovery.namespace}\n',
'parameters:\n namespace: ${spring.cloud.nacos.discovery.namespace}-dubbo\n')
WHERE data_id = 'application.yml';
USE `mall4cloud_nacos`;
UPDATE config_info
SET content= REPLACE(content,
'provider-namespace: ${spring.cloud.nacos.discovery.namespace}\n',
'provider-namespace: ${spring.cloud.nacos.discovery.namespace}-dubbo\n')
WHERE data_id = 'application.yml';

View File

@ -0,0 +1,21 @@
USE `mall4cloud_leaf`;
INSERT INTO leaf_alloc ( biz_tag, max_id, step, update_time, description, random_step )
VALUE ( 'mall4cloud-order-virtual-info-log', 1, 1000, NOW(), 'mall4cloud虚拟订单核销记录', 10 );
USE `mall4cloud_product`;
# 商品添加固定运费字段
ALTER TABLE `spu`
ADD COLUMN `delivery_amount` bigint(0) NULL COMMENT '运费固定金额' AFTER `delivery_template_id`;
# 电子面单菜单修改
# 发货管理菜单改名电子面单,平台端位置移至会员菜单,供应商/商家端位置移至订单菜单
update menu set name = '电子面单' ,title = '电子面单',parent_id = 147
where name = '发货管理' and biz_type = 1;
update menu set name = '电子面单' ,title = '电子面单',parent_id = 632
where name = '发货管理' and biz_type = 2;
update menu set name = '电子面单' ,title = '电子面单',parent_id = 448
where name = '发货管理' and biz_type = 3;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,22 @@
USE `mall4cloud_admin`;
# 新增文件上传配置,需要在后台重新配置文件上传
INSERT INTO `sys_config`(`param_key`, `param_value`, `remark`)
VALUES
('UPLOAD_FILE_CONFIG', '{\"storageType\":\"1\", \"endPoint\":\"\", \"accessKey\":\"\", \"secretKey\":\"\", \"bucketName\":\"\"}', '文件上传配置');
USE `mall4cloud_auth`;
# 移除首页接口菜单资源授权,执行完sql需要手动移除redis缓存 查找key 'permission:uri_permissions:'
DELETE FROM menu_permission WHERE uri IN (
'/p/order_statistics/list_shop_ranking_by_refund_count',
'/p/order_statistics/list_shop_ranking_by_pay_actual',
'/p/order_statistics/list_spu_ranking_by_order_count',
'/p/order_statistics/get_order_info_by_day_count',
'/p/order_statistics/get_detail_by_hour');
# 删除旧的微信小程序发货配置
USE `mall4cloud_admin`;
DELETE FROM sys_config where param_key = 'WECHAT_SHIPPING_CONFIG';
# 将发货配置添加到微信小程序参数配置里面
UPDATE sys_config set param_value =
REPLACE(param_value,'}',',\"wechatShippingAudit\":false}') where param_key = 'MA_CONFIG';

View File

@ -0,0 +1,197 @@
# 看注释!!!!!!
# 将redis中优惠券缓存(mall4cloud_coupon目录下的缓存)删除后执行下列操作
# 将nacos中mall4cloud-marketing.yml的配置清空然后重新配置数据库连接参数注意检查连接配置重新发布保存
# spring:
# datasource:
# url: jdbc:mysql://${MYSQL_HOST:192.168.193.128}:${MYSQL_PORT:3306}/${MYSQL_DATABASE:mall4cloud_marketing}?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}
# data:
# mongodb:
# host: 192.168.193.128
# port: 27017
# database: mall4cloud
# username: mall4cloud
# password: mall4cloud
# authentication-database: mall4cloud
# redis:
# multi:
# enable: true
# password: hn02le.34lkdLKD
# database: 0
# redisAddrs:
# - 192.168.193.128:6379
# initCouponUserToMongodb,这个定时任务只对2023-12-04更新前将coupon_user存入mysql之后将数据搬迁到mongodb
# 该定时任务正常执行*成功*一次后(数据已经完全搬迁到mongodb)就可以置为停止或删除
# 随后可以将mysql中的coupon_user删除
# 并且可以将CouponUserMapper以及相关定时任务initCouponUserToMongodb代码从代码中删去
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 (5, '初始化原有领券数据库记录至mongodb', '2023-11-27 10:07:30', '2023-11-27 10:07:30', 'admin', '', 'CRON',
'0 0 0 1 1 ? *', 'DO_NOTHING', 'FIRST', 'initCouponUserToMongodb', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN',
'', 'GLUE代码初始化', '2023-11-06 10:07:30', '', 0, 0, 0),
(5, '解锁优惠券', '2023-11-27 10:07:30', '2023-11-27 10:07:30', 'admin', '', 'CRON',
'0 5 0 * * ?', 'DO_NOTHING', 'FIRST', 'unLockCouponStock', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN',
'', 'GLUE代码初始化', '2023-11-06 10:07:30', '', 0, 0, 0);
# 将原本的优惠券库存落库定时任务删除
delete from `xxl_job_info` where `executor_handler` = 'hotCouponStockPlacement';
# 添加领券id这里max_id调高是防止与之前的id重复可以参考现有最高的coupon_user_id来限定该值
USE `mall4cloud_marketing`;
insert into `leaf_alloc`(`biz_tag`,`max_id`,`step`,`description`) values
('mall4cloud-coupon-user',1000000,1000,'领券记录id');
# 订单支付记录添加字段
USE mall4cloud_payment_0;
DELIMITER //
DROP PROCEDURE IF EXISTS updatePayInfoColumn //
CREATE PROCEDURE updatePayInfoColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `biz_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '第三方系统userid'" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updatePayInfoColumn() //
DROP PROCEDURE updatePayInfoColumn //
DELIMITER;
USE mall4cloud_payment_1;
DELIMITER //
DROP PROCEDURE IF EXISTS updatePayInfoColumn //
CREATE PROCEDURE updatePayInfoColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `biz_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '第三方系统userid'" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updatePayInfoColumn() //
DROP PROCEDURE updatePayInfoColumn //
DELIMITER;
USE mall4cloud_payment_2;
DELIMITER //
DROP PROCEDURE IF EXISTS updatePayInfoColumn //
CREATE PROCEDURE updatePayInfoColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `biz_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '第三方系统userid'" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updatePayInfoColumn() //
DROP PROCEDURE updatePayInfoColumn //
DELIMITER;
USE mall4cloud_payment_3;
DELIMITER //
DROP PROCEDURE IF EXISTS updatePayInfoColumn //
CREATE PROCEDURE updatePayInfoColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `biz_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '第三方系统userid'" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updatePayInfoColumn() //
DROP PROCEDURE updatePayInfoColumn //
DELIMITER;
USE mall4cloud_payment_4;
DELIMITER //
DROP PROCEDURE IF EXISTS updatePayInfoColumn //
CREATE PROCEDURE updatePayInfoColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `biz_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '第三方系统userid'" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updatePayInfoColumn() //
DROP PROCEDURE updatePayInfoColumn //
DELIMITER;
USE mall4cloud_payment_5;
DELIMITER //
DROP PROCEDURE IF EXISTS updatePayInfoColumn //
CREATE PROCEDURE updatePayInfoColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `biz_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '第三方系统userid'" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updatePayInfoColumn() //
DROP PROCEDURE updatePayInfoColumn //
DELIMITER;
USE mall4cloud_payment_6;
DELIMITER //
DROP PROCEDURE IF EXISTS updatePayInfoColumn //
CREATE PROCEDURE updatePayInfoColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `biz_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '第三方系统userid'" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updatePayInfoColumn() //
DROP PROCEDURE updatePayInfoColumn //
DELIMITER;
USE mall4cloud_payment_7;
DELIMITER //
DROP PROCEDURE IF EXISTS updatePayInfoColumn //
CREATE PROCEDURE updatePayInfoColumn()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @add_column = CONCAT( 'ALTER TABLE pay_info_', i, " ADD COLUMN `biz_user_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '第三方系统userid'" );
PREPARE add_column FROM @add_column;
EXECUTE add_column;
SET i = i + 1;
END WHILE;
END //
CALL updatePayInfoColumn() //
DROP PROCEDURE updatePayInfoColumn //
DELIMITER;

View File

@ -0,0 +1,49 @@
# 看注释!!!!!!
# 方案一. 在nacos中application.yml添加的dubbo配置建议此操作
# dubbo:
# provider:
# filter: -exception
# 方案二. 执行以下sql然后重新保存nacos中application.yml
use mall4cloud_nacos;
update config_info set content = REPLACE(content, 'provider:\n token: true\n', 'provider:\n token: true\n filter: -exception\n') where data_id = 'application.yml';
# 满减满折菜单名称更新为限时折扣
USE mall4cloud_auth;
UPDATE menu SET name = '限时折扣' , title = '限时折扣' WHERE menu_id = 154;
UPDATE menu SET name = '限时折扣' , title = '限时折扣' WHERE menu_id = 177;
UPDATE menu SET title = '查看限时折扣' WHERE menu_id = 270;
UPDATE menu SET title = '限时折扣编辑' WHERE menu_id = 268;
# 修改平台菜单
USE `mall4cloud_auth`;
# 删除原来的 轮播图 和 分组管理 菜单
delete from `menu` where menu_id in (257, 264, 265);
# 添加到新的默认组件菜单中
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 (676, '2023-12-15 10:32:06', '2023-12-15 10:32:14', 526, 2, NULL, '/platform-default', 'default', NULL, NULL, 0,
'默认组件', '默认组件', '', NULL, NULL, NULL, NULL, 2),
(677, '2023-12-15 10:32:39', '2023-12-15 10:39:49', 676, 2, NULL, 'index-img', 'platform/default/index-img',
NULL, NULL, 0, '轮播图', '轮播图', 'el-icon-picture-outline', NULL, NULL, NULL, NULL, 1),
(678, '2023-12-15 10:32:37', '2023-12-15 10:39:53', 676, 2, NULL, 'spu-tag', 'platform/default/spu-tag', NULL,
NULL, 0, '分组管理', '分组管理', '', NULL, NULL, NULL, NULL, 2),
(679, '2023-12-15 10:32:26', '2023-12-15 11:19:43', 676, 2, NULL, 'tag-prod', 'platform/default/tag-prod', NULL,
NULL, 1, '添加分组商品', '添加分组商品', '', NULL, NULL, NULL, NULL, 0);
# 修改菜单名称
UPDATE `menu`
SET
`title` = '积分规格'
WHERE
`title` = '规格管理'
AND biz_type = 2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,393 @@
# 添加mongodb的索引
# 注意这部分为mongodn的sql
db.coupon_user.ensureIndex({"userId": 1}, {"name": "user_idx"});
db.coupon_user.ensureIndex({"couponId": 1}, {"name": "coupon_idx"});
db.coupon_user.ensureIndex({"shopId": 1}, {"name": "shop_idx"});
db.group_order.ensureIndex({"userId": 1}, {"name": "user_idx"});
db.group_order.ensureIndex({"shopId": 1}, {"name": "shop_idx"});
db.group_order.ensureIndex({"groupActivityId": 1}, {"name": "group_activity_idx"});
db.group_team.ensureIndex({"shopId": 1}, {"name": "shop_idx"});
db.group_team.ensureIndex({"shareUserId": 1}, {"name": "share_user_idx"});
db.group_team.ensureIndex({"groupSpuId": 1}, {"name": "group_spu_idx"});
db.group_team.ensureIndex({"groupActivityId": 1}, {"name": "group_activity_idx"});
db.order.ensureIndex({"userId": 1}, {"name": "user_idx"});
db.order.ensureIndex({"shopId": 1}, {"name": "shop_idx"});
db.order.ensureIndex({"supplierId": 1}, {"name": "supplier_idx"});
db.order.ensureIndex({"stationId": 1}, {"name": "station_idx"});
db.order_refund.ensureIndex({"orderId": 1}, {"name": "order_idx"});
db.order_refund.ensureIndex({"payId": 1}, {"name": "pay_idx"});
db.order_refund.ensureIndex({"userId": 1}, {"name": "user_idx"});
db.order_refund.ensureIndex({"shopId": 1}, {"name": "shop_idx"});
db.order_refund.ensureIndex({"supplierId": 1}, {"name": "supplier_idx"});
db.order_virtual_info_log.ensureIndex({"orderId": 1}, {"name": "order_idx"});
db.order_virtual_info_log.ensureIndex({"shopId": 1}, {"name": "shop_idx"});
db.order_virtual_info_log.ensureIndex({"stationId": 1}, {"name": "station_idx"});
db.purchase_order.ensureIndex({"orderId": 1}, {"name": "order_idx"});
db.purchase_order.ensureIndex({"supplierId": 1}, {"name": "supplier_idx"});
db.stock_bill_log.ensureIndex({"sourceOrderNo": 1}, {"name": "source_order_no_idx"});
db.stock_bill_log.ensureIndex({"shopId": 1}, {"name": "shop_idx"});
db.stock_bill_log.ensureIndex({"stockBillNo": 1, "type": 1}, {"name": "id_order_no"});
db.supplier_wallet_log.ensureIndex({"supplierId": 1, "reason": 1}, {"name": "supplierId_reason_idx"});
db.supplier_wallet_log.ensureIndex({"orderId": 1}, {"name": "order_idx"});
db.flow_regional.ensureIndex({"dateType": 1, "provinceId": 1}, {"name": "data_type_province_idx"});
db.flow_spu.ensureIndex({"dateType": 1, "shopId": 1}, {"name": "data_type_shop_idx"});
db.flow_spu_user.ensureIndex({"spuId": 1, "userId": 1}, {"name": "spu_user_idx"});
db.flow_system.ensureIndex({"dateType": 1, "systemType": 1}, {"name": "date_type_system_type_idx"});
db.flow_system.ensureIndex({"spuId": 1, "userId": 1}, {"name": "spu_user_idx"});
db.flow_system_user.ensureIndex({"userId": 1}, {"name": "user_idx"});
db.flow_system_user.ensureIndex({"dateType": 1, "systemType": 1}, {"name": "date_type_system_type_idx"});
db.flow_user.ensureIndex({"dateType": 1, "type": 1}, {"name": "date_type_type_idx"});
db.flow_user_footprint.ensureIndex({"dateType": 1}, {"name": "date_type_idx"});
db.flow_user_operation.ensureIndex({"userId": 1}, {"name": "user_idx"});
db.flow_user_retain.ensureIndex({"retainType": 1}, {"name": "retain_type_idx"});
# 更改nacos的application.yml配置
# 原配置
# dubbo:
# application:
# name: ${spring.cloud.nacos.discovery.namespace}-${spring.application.name}-dubbo-server
# 更改为:
# dubbo:
# application:
# name: ${spring.cloud.nacos.discovery.namespace}-${spring.application.name}-dubbo-server
# serialize-check-status: WARN
# 1 修改canal配置
# 修改canal/example/instance.properties文件在参数"canal.instance.filter.regex"中补充上"mall4cloud_order_[0-9]+.allot_order_[0-9]+:*",然后重启
USE `mall4cloud_product`;
# 商品组合商品相关字段
ALTER TABLE `spu`
MODIFY `spu_mold` tinyint NOT NULL COMMENT '商品类别 0.实物商品 1.虚拟商品 2.组合商品',
ADD COLUMN `is_all_entity` INT DEFAULT NULL COMMENT '是否为全部实物商品的组合商品 1.是 0.否';
ALTER TABLE spu DROP COLUMN is_compose;
CREATE TABLE `sku_combo` (
`sku_id` bigint NOT NULL COMMENT '规格id',
`combo_sku_id` bigint NOT NULL COMMENT '组合的skuid',
`combo_spu_id` bigint NOT NULL COMMENT '组合的spuid',
`combo_count` int NOT NULL COMMENT '组合数量',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',
PRIMARY KEY (`sku_id`,`combo_sku_id`),
KEY `idx_spu_id` (`combo_spu_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci COMMENT='规格组合商品管理表';
# 实物盘点字段补充
ALTER TABLE `take_stock`
ADD COLUMN `warehouse_id` bigint(0) NULL COMMENT '仓库id' AFTER `maker_mobile`,
ADD COLUMN `stock_point_type` tinyint(0) NULL COMMENT '库存点类型(1:仓库, 2:门店)' AFTER `warehouse_id`;
# 出入库原因添加系统类型字段
ALTER TABLE `stock_change_reason`
ADD COLUMN `sys_type` tinyint(0) NULL COMMENT '系统类型';
# 添加库存管理表
CREATE TABLE `stock_point_sku` (
`stock_point_sku_id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '库存商品关联skuid',
`stock_point_id` bigint NOT NULL COMMENT '库存点id',
`stock_point_type` tinyint NOT NULL COMMENT '库存点类型 1仓库 2门店',
`spu_id` bigint DEFAULT NULL COMMENT 'spuId',
`sku_id` bigint DEFAULT NULL COMMENT 'skuid',
`supplier_sku_id` bigint DEFAULT NULL COMMENT '当商品为代销商品时供应商商品skuid',
`status` tinyint DEFAULT '0' COMMENT '状态 1:enable, 0:disable, -1:deleted',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`type` tinyint DEFAULT '1' COMMENT '仓库类型0默认仓库1区域仓库',
`stock_mode` tinyint DEFAULT NULL COMMENT '库存模式 1共享总部库存 2独立销售库存',
PRIMARY KEY (`stock_point_sku_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
# 新增仓库表
CREATE TABLE `warehouse` (
`warehouse_id` bigint NOT 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 '更新时间',
`shop_id` bigint DEFAULT NULL COMMENT '店铺id',
`warehouse_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '仓库名称',
`type` tinyint DEFAULT NULL COMMENT '仓库类型0默认仓库1区域仓库',
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '仓库地址',
`manage` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '管理人',
`phone` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '管理电话',
`sys_type` tinyint DEFAULT NULL COMMENT '系统类型',
`province_id` bigint DEFAULT NULL COMMENT '省ID',
`province` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '',
`city_id` bigint DEFAULT NULL COMMENT '城市ID',
`city` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '城市',
`area_id` bigint DEFAULT NULL COMMENT '区ID',
`area` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '',
PRIMARY KEY (`warehouse_id`),
KEY `shop_id` (`shop_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
INSERT INTO `warehouse` (`warehouse_id`,`shop_id`, `warehouse_name`, `type`, `address`, `manage`, `phone`, `sys_type`, `province_id`, `province`, `city_id`, `city`, `area_id`, `area`)
VALUES
(300000000000000,0,'默认仓库',0,NULL,NULL,NULL,2,NULL,NULL,NULL,NULL,NULL,NULL);
CREATE TABLE `warehouse_area` (
`warehouse_area_id` bigint NOT NULL AUTO_INCREMENT,
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '建立时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`warehouse_id` bigint DEFAULT NULL COMMENT '仓库id',
`area_id` bigint DEFAULT NULL COMMENT '城市id',
PRIMARY KEY (`warehouse_area_id`) USING BTREE,
KEY `idx_warehouse_id` (`warehouse_id`) USING BTREE,
KEY `idx_city_id` (`area_id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='仓库项和供货城市关联信息';
INSERT INTO `leaf_alloc`(`biz_tag`, `max_id`, `step`, `update_time`, `description`) VALUES
('mall4cloud-stock-point', 1000, 1000, '2023-12-15 17:28:15', '库存点id');
# 给旧门店数据创建一个门店仓库
INSERT INTO `mall4cloud_product`.`warehouse` ( `warehouse_id`, `shop_id`, `sys_type`, `type`, `warehouse_name`, `phone`, `province_id`, `province`, `city_id`, `city`, `area_id`, `area`, `address` ) (
SELECT
station_id warehouse_id,
station_id shop_id,
'4' sys_type,
'1' type,
station_name warehouse_name,
mobile phone,
province_id,
province,
city_id,
city,
area_id,
area,
addr address
FROM
`mall4cloud_order`.`station`);
USE mall4cloud_order;
INSERT INTO `leaf_alloc`(`biz_tag`, `max_id`, `step`, `update_time`, `description`) VALUES
('mall4cloud-stock-point', 1000, 1000, '2023-12-15 17:28:15', '库存点id');
# 所有门店添加库存模式,并统一为共享总部库存
ALTER TABLE `station`
ADD COLUMN `stock_mode` tinyint DEFAULT NULL COMMENT '库存模式 1共享总部库存 2独立销售库存';
update station set stock_mode = 1;
# 删除店铺相关字段,修改店铺地址到同城配送
ALTER TABLE `same_city`
ADD COLUMN `province_id` bigint(0) NULL DEFAULT NULL COMMENT '省ID' AFTER `lat`,
ADD COLUMN `province` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '' AFTER `province_id`,
ADD COLUMN `city_id` bigint(0) NULL DEFAULT NULL COMMENT '城市ID' AFTER `province`,
ADD COLUMN `city` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '城市' AFTER `city_id`,
ADD COLUMN `area_id` bigint(0) NULL DEFAULT NULL COMMENT '区ID' AFTER `city`,
ADD COLUMN `area` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '' AFTER `area_id`,
ADD COLUMN `detail_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '详细地址' AFTER `area`,
ADD COLUMN `shop_lng` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '店铺所在经度' AFTER `detail_address`,
ADD COLUMN `shop_lat` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '店铺所在维度' AFTER `shop_lng`;
UPDATE `mall4cloud_order`.`same_city` sc
INNER JOIN ( SELECT shop_lng, shop_lat, province_id, province, city_id, city, area_id, area, detail_address, shop_id FROM `mall4cloud_admin`.`shop_detail` ) AS sd ON sc.shop_id = sd.shop_id
SET sc.shop_lng = sd.shop_lng,
sc.shop_lat = sd.shop_lat,
sc.province_id = sd.province_id,
sc.province = sd.province,
sc.city_id = sd.city_id,
sc.city = sd.city,
sc.area_id = sd.area_id,
sc.area = sd.area,
sc.detail_address = sd.detail_address;
# 新增组合商品订单相关字段,此处为了方便查看不重复写代码了,实际需要更改mall4cloud_order_0-7的8个库的分库分表!!!!!
USE mall4cloud_order_0;
DELIMITER //
DROP PROCEDURE IF EXISTS updateOrderInfo //
CREATE PROCEDURE updateOrderInfo()
BEGIN
DECLARE i INT;
SET i = 0;
WHILE i < 64 DO
SET @update_order_item = CONCAT("ALTER TABLE order_item_", i,"
ADD COLUMN `write_off_num` INT DEFAULT NULL COMMENT '核销次数 -1.多次核销 0.无需核销 1.单次核销' AFTER `supplier_pic`,
ADD COLUMN `write_off_multiple_count` INT DEFAULT NULL COMMENT '核销次数 -1.无限次' AFTER `write_off_num`,
ADD COLUMN `write_off_start` DATETIME DEFAULT NULL COMMENT '核销开始时间' AFTER `write_off_multiple_count`,
ADD COLUMN `write_off_end` DATETIME DEFAULT NULL COMMENT '核销结束时间' AFTER `write_off_start`;
");
PREPARE update_order_item FROM @update_order_item;
EXECUTE update_order_item;
SET @update_order = CONCAT( "ALTER TABLE order_", i,"
ADD COLUMN main_order_id BIGINT NOT NULL DEFAULT '0' COMMENT '主单号,在组合/套餐商品拆单时会存在' AFTER `write_off_count`;
");
PREPARE update_order FROM @update_order;
EXECUTE update_order;
SET @update_order_virtual_lang = CONCAT( "ALTER TABLE order_virtual_info_", i,"
ADD COLUMN `order_item_id` bigint NOT NULL DEFAULT '0' COMMENT '订单项id' AFTER `order_id`;
");
PREPARE update_order_virtual_lang FROM @update_order_virtual_lang;
EXECUTE update_order_virtual_lang;
SET @add_order_item = CONCAT( "ALTER TABLE order_item_", i, " ADD COLUMN `stock_point_id` bigint DEFAULT NULL COMMENT '库存点id';" );
PREPARE add_allot_order_item FROM @add_order_item;
EXECUTE add_allot_order_item;
SET @add_allot_order = CONCAT( "CREATE TABLE IF NOT EXISTS `allot_order_", i, "` (
`allot_order_id` bigint(0) NOT NULL COMMENT '调拨订单id',
`out_warehouse_id` bigint(0) NULL DEFAULT NULL COMMENT '调出点仓库id',
`out_stock_point_type` int(0) NULL DEFAULT NULL COMMENT '调出点库存点类型(1:仓库, 2:门店)',
`in_warehouse_id` bigint(0) NULL DEFAULT NULL COMMENT '调入点仓库id',
`in_stock_point_type` int(0) NULL DEFAULT NULL COMMENT '调入点库存点类型(1:仓库, 2:门店)',
`dvy_company_id` bigint(0) NULL DEFAULT NULL COMMENT '物流公司id',
`dvy_type` int(0) NULL DEFAULT NULL COMMENT '物流方式(1:快递, 2:无需快递)',
`dvy_order_number` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '物流单号',
`status` int(0) NULL DEFAULT NULL COMMENT '状态(0:作废, 1:待入库, 2:部分入库, 3:已完成)',
`total_allot_count` int(0) NULL DEFAULT NULL COMMENT '总调拨数量',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注',
`shop_id` bigint(0) NULL COMMENT '店铺id',
`sys_type` int(1) NULL COMMENT '系统类型',
`create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`allot_order_id`) USING BTREE
); " );
PREPARE add_allot_order FROM @add_allot_order;
EXECUTE add_allot_order;
SET @add_allot_order_item = CONCAT( "CREATE TABLE `allot_order_item_", i, "` (
`allot_order_item_id` bigint NOT NULL COMMENT '调拨订单商品id',
`allot_order_id` bigint NULL COMMENT '调拨订单id',
`spu_id` bigint NULL COMMENT '商品spuId',
`sku_id` bigint NULL COMMENT '商品skuId',
`allot_count` int(255) NULL COMMENT '调拨数量',
`allot_in_count` int(255) NULL COMMENT '调拨入库数量',
`create_time` datetime NULL COMMENT '创建时间',
`update_time` datetime NULL COMMENT '创建时间',
PRIMARY KEY (`allot_order_item_id`)
);" );
PREPARE add_allot_order_item FROM @add_allot_order_item;
EXECUTE add_allot_order_item;
SET i = i + 1;
END WHILE;
END //
CALL updateOrderInfo() //
DROP PROCEDURE updateOrderInfo //
DELIMITER ;
# 添加仓库菜单
USE `mall4cloud_auth`;
UPDATE `menu` SET `parent_id` = 424, `biz_type` = 1, `permission` = NULL, `path` = '/manage', `component` = 'inventory', `redirect` = NULL, `always_show` = NULL, `hidden` = 0, `name` = '库存管理', `title` = '库存管理', `icon` = '', `seq` = 1 WHERE `menu_id` = 426;
UPDATE `menu` SET `parent_id` = 424, `biz_type` = 1, `permission` = NULL, `path` = '/stock', `component` = 'stock', `redirect` = NULL, `always_show` = NULL, `hidden` = 0, `name` = '库存盘点', `title` = '库存盘点', `icon` = '', `seq` = 4 WHERE `menu_id` = 575;
UPDATE `menu` SET `parent_id` = 424, `biz_type` = 1, `permission` = NULL, `path` = '/rec-send-manage', `component` = 'inventory', `redirect` = NULL, `always_show` = NULL, `hidden` = 0, `name` = '出入库管理', `title` = '出入库管理', `icon` = '', `seq` = 3 WHERE `menu_id` = 432;
UPDATE `menu` SET `parent_id` = 424, `biz_type` = 1, `permission` = NULL, `path` = '/purchase-manage', `component` = 'inventory', `redirect` = NULL, `always_show` = NULL, `hidden` = 0, `name` = '采购管理', `title` = '采购管理', `icon` = '', `seq` = 2 WHERE `menu_id` = 429;
UPDATE `menu` SET `parent_id` = 0, `biz_type` = 3, `permission` = NULL, `path` = '/order', `component` = 'Layout', `redirect` = NULL, `always_show` = NULL, `hidden` = 0, `name` = 'order', `title` = '订单', `icon` = 'order', `seq` = 3 WHERE `menu_id` = 448;
UPDATE `menu` SET `parent_id` = 680, `biz_type` = 1, `permission` = NULL, `path` = 'station', `component` = 'order/delivery-manage/station', `redirect` = NULL, `always_show` = NULL, `hidden` = 0, `name` = '门店管理', `title` = '门店管理', `icon` = '', `seq` = 1 WHERE `menu_id` = 599;
# 680是仓库门店的菜单id如果有改动需要自行根据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
(680, '2023-11-16 13:46:14', '2023-11-28 14:33:09', 424, 1, NULL, '/stock/warehouse-store', 'inventory', NULL, NULL, 0, '仓库门店', '仓库门店', '', NULL, NULL, NULL, NULL, 0),
(681, '2023-11-16 13:47:53', '2023-11-28 14:33:43', 680, 1, NULL, 'warehouse-manage', 'stock/warehouse-store/warehouse-manage/index', NULL, NULL, 0, '仓库管理', '仓库管理', '', NULL, NULL, NULL, NULL, 0),
(682, '2023-11-20 11:54:19', '2023-11-20 11:54:40', 0, 3, NULL, '/stock', 'Layout', NULL, NULL, 0, '库存', '库存', '', NULL, NULL, NULL, NULL, 2),
(683, '2023-11-20 11:56:35', '2023-11-20 11:56:59', 682, 3, NULL, '/stock/warehouse', '-', NULL, NULL, 0, '仓库管理', '仓库管理', '', NULL, NULL, NULL, NULL, 0),
(684, '2023-11-20 11:58:11', '2023-11-20 13:33:26', 683, 3, NULL, 'warehouse/warehouse-manage', 'stock/warehouse/warehouse-manage', NULL, NULL, 0, '仓库管理', '仓库管理', '', NULL, NULL, NULL, NULL, 0),
(685, '2023-11-23 10:06:44', '2023-11-23 10:07:23', 682, 3, NULL, '/rec-send-manage', 'inventory', NULL, NULL, 0, '出入库管理', '出入库管理', '', NULL, NULL, NULL, NULL, 1),
(686, '2023-11-23 10:08:05', '2023-11-23 10:08:33', 685, 3, NULL, 'stock-send-add-or-update', 'stock/rec-send-manage/out-stock/add-or-update', NULL, NULL, 1, '新建出库明细', '新建出库明细', '', NULL, NULL, NULL, NULL, 0),
(687, '2023-11-23 10:09:15', '2023-11-23 10:09:15', 685, 3, NULL, 'receive-list', 'stock/rec-send-manage/in-stock', NULL, NULL, 0, '入库明细', '入库明细', '', NULL, NULL, NULL, NULL, 1),
(688, '2023-11-23 10:10:03', '2023-11-23 10:10:21', 685, 3, NULL, 'receive-detail', 'stock/rec-send-manage/in-stock/components/in-detail', NULL, NULL, 1, '入库明细详情', '入库明细详情', '', NULL, NULL, NULL, NULL, 0),
(689, '2023-11-23 10:10:56', '2023-11-27 16:52:00', 685, 3, NULL, 'stock-receive-add-or-update', 'stock/rec-send-manage/in-stock/add-or-update', NULL, NULL, 1, '新建入库明细', '新建入库明细', '', NULL, NULL, NULL, NULL, 0),
(690, '2023-11-23 10:11:30', '2023-11-23 10:11:30', 685, 3, NULL, 'customize-reason', 'stock/rec-send-manage/reason', NULL, NULL, 0, '出入库原因', '出入库原因', '', NULL, NULL, NULL, NULL, 2),
(691, '2023-11-23 10:12:02', '2023-11-23 10:12:02', 685, 3, NULL, 'send-list', 'stock/rec-send-manage/out-stock', NULL, NULL, 0, '出库明细', '出库明细', '', NULL, NULL, NULL, NULL, 3),
(692, '2023-11-23 10:13:12', '2023-11-23 10:53:23', 685, 3, NULL, 'send-detail', 'stock/rec-send-manage/out-stock/components/out-detail', NULL, NULL, 1, '出库明细详情', '出库明细详情', '', NULL, NULL, NULL, NULL, 3),
(694, '2023-11-28 14:26:29', '2023-12-14 09:18:33', 680, 1, NULL, 'transfer-order', 'stock/warehouse-store/transfer-order/index', NULL, NULL, 0, '调拨订单', '调拨订单', '', NULL, NULL, NULL, NULL, 2),
(695, '2023-11-28 14:29:21', '2023-11-28 14:32:35', 680, 1, NULL, 'transfer-order-create', 'stock/warehouse-store/transfer-order-create/index', NULL, NULL, 1, '新建调拨订单', '新建调拨订单', '', NULL, NULL, NULL, NULL, 2),
(696, '2023-12-04 16:39:48', '2023-12-04 16:50:11', 683, 3, NULL, 'transfer-order', 'stock/warehouse/transfer-order/index', NULL, NULL, 0, '调拨订单', '调拨订单', '', NULL, NULL, NULL, NULL, 1),
(697, '2023-12-04 16:46:12', '2023-12-04 16:50:39', 683, 3, NULL, 'transfer-order-create', 'stock/warehouse/transfer-order-create/index', NULL, NULL, 1, '新建调拨订单', '新建调拨订单', '', NULL, NULL, NULL, NULL, 0);
USE `mall4cloud_seckill`;
ALTER TABLE `seckill`
ADD COLUMN `replenish` int DEFAULT NULL COMMENT '补充库存 0不补充 1补充';
CREATE TABLE `seckill_stock_point_sku` (
`seckill_stock_point_sku_id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '库存商品关联skuid',
`stock_point_id` bigint NOT NULL COMMENT '库存点id',
`stock_point_type` tinyint NOT NULL COMMENT '库存点类型 1仓库 2门店',
`sku_id` bigint DEFAULT NULL COMMENT 'sku_id',
`seckill_sku_id` bigint DEFAULT NULL COMMENT '秒杀活动skuid',
`status` tinyint DEFAULT '0' COMMENT '状态 1:enable, 0:disable, -1:deleted',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`type` tinyint DEFAULT NULL COMMENT '仓库类型0默认仓库1区域仓库',
`seckill_origin_stocks` int DEFAULT NULL COMMENT '秒杀库存点原始库存',
PRIMARY KEY (`seckill_stock_point_sku_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
USE `mall4cloud_admin`;
ALTER TABLE `shop_detail`
DROP COLUMN `email`,
DROP COLUMN `detail_address`,
DROP COLUMN `shop_lng`,
DROP COLUMN `shop_lat`,
DROP COLUMN `province_id`,
DROP COLUMN `province`,
DROP COLUMN `city_id`,
DROP COLUMN `city`,
DROP COLUMN `area_id`,
DROP COLUMN `area`;
ALTER TABLE `supplier_detail`
DROP COLUMN `email`,
DROP COLUMN `detail_address`,
DROP COLUMN `province_id`,
DROP COLUMN `province`,
DROP COLUMN `city_id`,
DROP COLUMN `city`,
DROP COLUMN `area_id`,
DROP COLUMN `area`;
# 将原sku库存初始化为区域库存
USE mall4cloud_job;
# 执行sql后到xxl-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
(4,'初始化秒杀区域库存','2023-07-10 09:51:23','2023-07-10 09:52:03','admin','','CRON','0 * * * * ?','DO_NOTHING','FIRST','initPointSeckillStock','','SERIAL_EXECUTION','0','0','BEAN','','GLUE代码初始化','2023-07-10 09:51:23','','0','0','0'),
(11,'初始化区域库存','2023-07-10 09:51:23','2023-07-10 09:52:03','admin','','CRON','0 * * * * ?','DO_NOTHING','FIRST','intiPointStock','','SERIAL_EXECUTION','0','0','BEAN','','GLUE代码初始化','2023-07-10 09:51:23','','0','0','0');

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

199
db/stock-vue3更新.sql Normal file
View File

@ -0,0 +1,199 @@
# 本次更新修改了很多东西
# 1. 更新到springboot3,spring cloud 2022, 使用jdk17。vue从vue2更新到vue3。
# 2. 将数据分析的数据全部存入到mongodb而不是mysql
#
# 3. 使用dubbo代替openfeign
# 3.1 在nacos中的 application.yml的移除所有关于openfeign的配置
# 3.2 在nacos中的 application.yml的增加关于dubbo的配置dubbo因为要本地调试所以在开发环境可以加多个dubbo本地的负载均衡配置dubbo.consumer.loadbalance=dev
# dubbo:
# application:
# name: ${spring.cloud.nacos.discovery.namespace}-${spring.application.name}-dubbo-server
# register-mode: instance
# service-discovery:
# migration: FORCE_APPLICATION
# protocol:
# name: dubbo
# serialization: fastjson2
# provider:
# token: true
# registry:
# # 配置dubbo的注册中心为nacos
# address: nacos://${spring.cloud.nacos.discovery.server-addr}
# # group: ${spring.cloud.nacos.discovery.namespace}-dubbo
# username: ${spring.cloud.nacos.discovery.username}
# password: ${spring.cloud.nacos.discovery.password}
# timeout: 50000
# parameters:
# namespace: ${spring.cloud.nacos.discovery.namespace}
# consumer:
# check: false
# timeout: 50000
# #指定服务提供者的namespace
# provider-namespace: ${spring.cloud.nacos.discovery.namespace}
#
# 4. 删除所有数据库关于库存的记录统一存在redis增加一台redis机器专门用来存商品库存的。一定要有个额外的redis不然清理缓存之后库存数据再也找不回来了。
# 4.1 在nacos的mall4cloud-seckill.yml 加入如下配置可以为秒杀增加多台redis
# redis:
# multi:
# enable: true
# password: hn02le.34lkdLKD
# database: 0
# redisAddrs:
# - 192.168.193.128:31377
# 4.2 在nacos的mall4cloud-product.yml 加入如下配置 只能增加一台用于aof的redis
# redis:
# aof:
# enable: true
# password: hn02le.34lkdLKD
# database: 0
# redisAddr: 192.168.193.128:31377
#
# 在服务器增加一台redis-aof的机器并且配置aof的配置详细见一键安装的部署文档docker-compose
#
# 5. 移除@ParameterObject 的注解需要在nacos中的 application.yml的增加关于springdoc的配置。
# springdoc:
# # 默认是false需要设置为true
# default-flat-param-object: true
#
# 6. 支付证书从路径的形式改成读取证书内容的形式
# 6.1.平台端 -> 系统 -> 系统设置 -> 支付配置 -> (微信配置 or 支付宝配置)
# 6.2.将支付宝支付 or 微信v3支付的对应证书的路径修改为对应证书的内容鼠标右键 -> 打开方式 -> 记事本打开 -> 将内容复制并填写进对应的输入框)
#
# 7. rocketmq使用rocketmq5.0 在阿里云服务器购买rocketmq5价格巨量降低
#
#
#
# 8.修改knife4j版本到4.3.0移除nacos当中gateway.yml 的openapi配置
# - id: openapi
# uri: lb://mall4cloud-gateway
# predicates:
# - Path=/v3/api-docs/**
# filters:
# - RewritePath=/v3/api-docs/(?<path>.*), /$\{path}/v3/api-docs
# - AddBasePath
# 增加knife4j配置
# knife4j:
# gateway:
# enabled: true
# strategy: discover
# discover:
# version: openapi3
# enabled: true
# 增加application.yml的springdoc配置
#springdoc:
# api-docs:
# path: /v3/api-docs/default
# 9.数据分析的数据放入mongodb。在mall4cloud-flow.yml加入以下配置
# data:
# mongodb:
# host: 192.168.193.128
# port: 27017
# database: mall4cloud
# username: mall4cloud
# password: mall4cloud
# authentication-database: mall4cloud
# 10. 直播使用阿里云直播。未开通小程序直播插件可以在app和h5进行直播。开通小程序直播插件后可以在app、h5以及小程序进行直播。
USE mall4cloud_product;
ALTER TABLE `sku` ADD COLUMN `stock_warning_status` tinyint NOT NULL DEFAULT '0' COMMENT '库存预警状态 0:库存充足 1:库存预警';
ALTER TABLE `sku` MODIFY `stock_warning` BIGINT DEFAULT NULL COMMENT '设置库存预警的数量';
USE mall4cloud_nacos;
UPDATE config_info
set content = '# 数据源\nspring:\n profiles:\n active: dev\n #避免nacos取网卡出错\n cloud:\n inetutils:\n preferred-networks: 10.1.\n datasource:\n driver-class-name: com.mysql.cj.jdbc.Driver\n type: com.zaxxer.hikari.HikariDataSource\n hikari:\n minimum-idle: 0\n maximum-pool-size: 20\n idle-timeout: 25000\n auto-commit: true\n connection-test-query: SELECT 1\n data:\n redis:\n host: 192.168.193.128\n password: hn02le.34lkdLKD\n jackson:\n date-format: yyyy-MM-dd HH:mm:ss\n time-zone: GMT+8\n\nspringdoc:\n # 默认是false需要设置为true\n default-flat-param-object: true\n \n#mybatis的相关配置\nmybatis:\n #mapper配置文件\n mapper-locations: classpath:mapper/*Mapper.xml\n type-aliases-package: com.moyuer.cloud.**.model\n #开启驼峰命名\n configuration:\n map-underscore-to-camel-case: true\n\nseata:\n config:\n type: nacos\n nacos:\n namespace: 05b1150e-9306-474c-90e1-ed4852c21475\n dataId: \"seataServer.properties\"\n server-addr: ${spring.cloud.nacos.discovery.server-addr}\n password: ${spring.cloud.nacos.discovery.password}\n username: ${spring.cloud.nacos.discovery.username}\n registry:\n type: nacos\n nacos:\n server-addr: ${spring.cloud.nacos.discovery.server-addr}\n password: ${spring.cloud.nacos.discovery.password}\n username: ${spring.cloud.nacos.discovery.username}\n namespace: ${seata.config.nacos.namespace}\n\nlogging:\n level:\n root: info\n com:\n mall4j:\n cloud: debug\n\n# 分页合理化当查询到页码大于最后一页的时候返回最后一页的数据防止vue在最后一页删除时数据不对的问题\npagehelper:\n reasonable: true\n\nbiz:\n oss:\n # 文件上传类型 0.阿里云 1.minio\n type: 1\n # 资源url图片域名(阿里云的resources-url是带有bucket的那个url)\n # resources-url: http://mall4cloud.oss-cn-shenzhen.aliyuncs.com\n # endpoint: https://oss-cn-shenzhen.aliyuncs.com\n # bucket: mall4cloud\n # access-key-id: key\n # access-key-secret: secret\n # resources-url是带有bucket的\n resources-url: http://192.168.193.128:9000/mall4cloud\n endpoint: http://192.168.193.128:9000\n bucket: mall4cloud\n access-key-id: admin\n access-key-secret: admin123456\n\n\ndubbo:\n application:\n name: ${spring.cloud.nacos.discovery.namespace}-${spring.application.name}-dubbo-server\n register-mode: instance\n service-discovery:\n migration: FORCE_APPLICATION\n protocol:\n name: dubbo\n serialization: fastjson2\n registry:\n # 配置dubbo的注册中心为nacos\n address: nacos://${spring.cloud.nacos.discovery.server-addr}\n username: ${spring.cloud.nacos.discovery.username}\n password: ${spring.cloud.nacos.discovery.password}\n consumer:\n check: false\n loadbalance: dev\n\nmall4cloud:\n job:\n accessToken: default_token\n logPath: /data/applogs/xxl-job/jobhandler\n admin:\n addresses: http://192.168.193.128:8080/xxl-job-admin\n expose:\n permission: true\n\nrocketmq:\n name-server: 192.168.193.128:9876\n\nsa-token:\n # token名称 (同时也是cookie名称)\n token-name: authorization\n # 是否允许同一账号并发登录 (为true时允许一起登录, 为false时新登录挤掉旧登录)\n is-concurrent: true\n # 在多人登录同一账号时是否共用一个token(不共用,避免登出时导致其他用户也登出)\n is-share: false\n # token风格(默认可取值uuid、simple-uuid、random-32、random-64、random-128、tik)\n token-style: uuid\n # 是否输出操作日志\n is-log: false'
where data_id = "application.yml";
UPDATE config_info
set content = PERLACE(content, 'elastic:\n # elastic的地址\n address:', 'spring:\n elasticsearch:\n uris:')
where data_id = "mall4cloud-search.yml";
USE mall4cloud_leaf;
insert into `leaf_alloc` (`biz_tag`, `max_id`, `step`, `update_time`, `description`, `random_step`) values
('mall4cloud-flow-user-id','1','100','2023-08-01 10:01:43','mall4cloud-flow的用户操作编号','10');
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-16 09:56:14','2023-08-16 09:56:20','admin','','CRON','0/5 * * * * ?','DO_NOTHING','FIRST','handleSkuStockChange','','DISCARD_LATER','0','0','BEAN','','GLUE代码初始化','2023-08-16 09:56:14','',1,1692234575000,1692234580000),
(11,'初始化库存','2023-07-10 09:51:23','2023-07-10 09:52:03','admin','','CRON','0 * * * * ?','DO_NOTHING','FIRST','intiStock','','SERIAL_EXECUTION','0','0','BEAN','','GLUE代码初始化','2023-07-10 09:51:23','','0','0','0');
# 如需配置阿里直播需要看下mall4cloud-doc这个项目下的 基本开发文档-阿里视频直播配置文档,参照文档进行配置
# 清除微信直播的定时任务
DELETE
FROM xxl_job_info
WHERE executor_handler IN
('synchronousWxLiveProds', 'offShelfLiveProds', 'synchronousWxLiveRoom', 'synchronousWxLiveUsers');
# 新增阿里直播定时任务
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 (5, '定时改变直播间状态', '2023-07-21 17:08:16', '2023-07-24 10:24:59', 'admin', '', 'CRON', '0 0/30 * * * ? ',
'DO_NOTHING', 'FIRST', 'changeLiveRoomStatus', '', 'SERIAL_EXECUTION', 0, 0, 'BEAN', '', 'GLUE代码初始化',
'2023-07-21 17:08:16', '', 1, 0, 0);
USE mall4cloud_marketing;
# 清除没有用的直播相关表格
DROP TABLE IF EXISTS `live_user`;
DROP TABLE IF EXISTS `live_log`;
DROP TABLE IF EXISTS `live_prod_log`;
DROP TABLE IF EXISTS `live_prod_store`;
DROP TABLE IF EXISTS `live_room_back`;
# 更改直播间和直播商品表,请注意,当前直播间信息将会全部删除!
DROP TABLE IF EXISTS `live_room`;
CREATE TABLE `live_room`
(
`room_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '直播间信息',
`shop_id` BIGINT DEFAULT NULL COMMENT '店铺id',
`name` VARCHAR(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '直播间名称',
`user_id` BIGINT DEFAULT NULL COMMENT '主播用户id',
`live_status` TINYINT NOT NULL COMMENT '直播间状态 0.未开始 1.直播中 2.已结束 3.暂停中 -1.违规下架',
`cover_img` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '直播背景图',
`share_img` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '主播分享图',
`feeds_img` VARCHAR(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '直播封面图',
`room_top` TINYINT DEFAULT '0' COMMENT '是否置顶 1.是 0.不是',
`start_time` DATETIME DEFAULT NULL COMMENT '直播开始时间',
`end_time` DATETIME DEFAULT NULL COMMENT '直播结束时间',
`create_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`remark` VARCHAR(500) COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '下线备注',
PRIMARY KEY (`room_id`)
) ENGINE = INNODB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='直播间';
DROP TABLE IF EXISTS `live_room_prod`;
CREATE TABLE `live_room_prod`
(
`room_prod_id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '直播间商品信息',
`spu_id` BIGINT NOT NULL COMMENT '商品id',
`room_id` BIGINT NOT NULL COMMENT '房间id',
`explain_status` TINYINT DEFAULT '0' COMMENT '讲解状态 0未讲解 1讲解中',
PRIMARY KEY (`room_prod_id`)
) ENGINE = INNODB
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT ='直播商品';
USE mall4cloud_admin;
# 添加阿里直播配置
INSERT INTO `sys_config` (`param_key`, `param_value`, `remark`)
VALUES ('ALI_LIVE_CONFIG',
'{\"pushDomain\":\"\",\"pullDomain\":\"\",\"appName\":\"\",\"pushAuthKey\":\"\",\"pullAuthKey\":\"\",\"isHttps\":\"\"}',
'直播配置');

View File

@ -0,0 +1,40 @@
# 增加订单退款相关平台介入字段
```
PUT order-refund/_mapping/_doc?include_type_name=true
{
"properties": {
"shopImgUrls": {
"type": "keyword",
"index": false,
"doc_values": false
},
"applyInterventionImgUrls": {
"type": "keyword",
"index": false,
"doc_values": false
},
"platformInterventionStatus": {
"type": "integer"
},
"applyInterventionReason": {
"type": "text"
},
"interventionRefundType": {
"type": "integer"
},
"afterInterventionRefundAmount": {
"type": "long"
},
"platformMessage": {
"type": "text"
},
"applyInterventionTime": {
"type": "date"
},
"interventionFinishTime": {
"type": "date"
}
}
}
```

View File

@ -0,0 +1,15 @@
# 增加订单退款相关平台介入字段
```
PUT product/_mapping/_doc?include_type_name=true
{
"properties": {
"spuNameLikeZh" : {
"type" : "wildcard"
},
"spuNameLikeEn" : {
"type" : "wildcard"
}
}
}
```

482
pom.xml Normal file
View File

@ -0,0 +1,482 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub</artifactId>
<version>0.0.1</version>
<modules>
<module>tmerclub-gateway</module>
<module>tmerclub-auth</module>
<module>tmerclub-common</module>
<module>tmerclub-api</module>
<module>tmerclub-admin</module>
<module>tmerclub-biz</module>
<module>tmerclub-product</module>
<module>tmerclub-search</module>
<module>tmerclub-user</module>
<module>tmerclub-order</module>
<module>tmerclub-marketing</module>
<module>tmerclub-payment</module>
<module>tmerclub-group</module>
<module>tmerclub-seckill</module>
<module>tmerclub-flow</module>
<module>tmerclub-im</module>
<!-- <module>system-test</module>-->
</modules>
<packaging>pom</packaging>
<properties>
<project.encoding>UTF-8</project.encoding>
<maven-compiler-plugin.version>3.12.0</maven-compiler-plugin.version>
<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
<java.version>17</java.version>
<!-- 核心依赖 -->
<spring-boot.version>3.1.7</spring-boot.version>
<spring-cloud.version>2022.0.4</spring-cloud.version>
<spring-cloud-alibaba.version>2022.0.0.0</spring-cloud-alibaba.version>
<dubbo.version>3.2.10</dubbo.version>
<!--分离出这两个东西,是为了能够在 spring cloud alibaba不更新的时候及时更新-->
<seata.version>2.0.0</seata.version>
<nacos.version>2.2.4</nacos.version>
<xxl-job.version>2.4.0</xxl-job.version>
<!-- 次要依赖 -->
<hutool.version>5.8.24</hutool.version>
<mybatis-spring-boot-starter.version>3.0.3</mybatis-spring-boot-starter.version>
<pagehelper-spring-boot-starter.version>2.1.0</pagehelper-spring-boot-starter.version>
<captcha.version>1.3.0</captcha.version>
<knife4j.version>4.3.0</knife4j.version>
<elasticsearch.version>7.17.5</elasticsearch.version>
<redisson-version>3.25.2</redisson-version>
<rocketmq-springboot.version>2.2.3</rocketmq-springboot.version>
<easyexcel.version>3.3.3</easyexcel.version>
<poi.version>5.2.3</poi.version>
<guava.version>33.0.0-jre</guava.version>
<weixin.version>4.6.0</weixin.version>
<aliyun-core.version>4.6.4</aliyun-core.version>
<alipay.version>4.38.183.ALL</alipay.version>
<alilive.version>3.9.43</alilive.version>
<fastjson.version>1.2.83</fastjson.version>
<fastjson2.version>2.0.44</fastjson2.version>
<ip2region.version>2.7.0</ip2region.version>
<transmittable-thread-local.version>2.14.3</transmittable-thread-local.version>
<log4j.version>2.20.0</log4j.version>
<satoken.version>1.37.0</satoken.version>
<protobuf.version>3.23.4</protobuf.version>
<springdoc.version>2.2.0</springdoc.version>
<springdoc-webflux.version>2.0.4</springdoc-webflux.version>
<logging-tracer.version>3.0.6</logging-tracer.version>
<aws-s3.version>2.21.5</aws-s3.version>
</properties>
<dependencyManagement>
<dependencies>
<!-- 核心依赖 -->
<!--spring boot-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!--spring cloud-->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<!--spring cloud alibaba-->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-bom</artifactId>
<version>${dubbo.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.nacos</groupId>
<artifactId>nacos-client</artifactId>
<version>${nacos.version}</version>
</dependency>
<dependency>
<groupId>io.seata</groupId>
<artifactId>seata-spring-boot-starter</artifactId>
<version>${seata.version}</version>
<exclusions>
<exclusion>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
<version>${xxl-job.version}</version>
</dependency>
<!-- 次要依赖 -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-miniapp</artifactId>
<version>${weixin.version}</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-mp</artifactId>
<version>${weixin.version}</version>
</dependency>
<dependency>
<groupId>com.github.binarywang</groupId>
<artifactId>weixin-java-pay</artifactId>
<version>${weixin.version}</version>
<exclusions>
<exclusion>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
<version>${aliyun-core.version}</version>
</dependency>
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId>
<version>${alipay.version}</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-live</artifactId>
<version>${alilive.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba.fastjson2</groupId>
<artifactId>fastjson2</artifactId>
<version>${fastjson2.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-crypto</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-extra</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>${mybatis-spring-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>${pagehelper-spring-boot-starter.version}</version>
</dependency>
<dependency>
<groupId>com.anji-plus</groupId>
<artifactId>captcha</artifactId>
<version>${captcha.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
<exclusions>
<exclusion>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-gateway-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
<exclusions>
<exclusion>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-high-level-client</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch</groupId>
<artifactId>elasticsearch</artifactId>
<version>${elasticsearch.version}</version>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson-spring-boot-starter</artifactId>
<version>${redisson-version}</version>
</dependency>
<dependency>
<groupId>org.elasticsearch.client</groupId>
<artifactId>elasticsearch-rest-client</artifactId>
<version>${elasticsearch.version}</version>
<exclusions>
<exclusion>
<artifactId>commons-logging</artifactId>
<groupId>commons-logging</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.rocketmq</groupId>
<artifactId>rocketmq-spring-boot-starter</artifactId>
<version>${rocketmq-springboot.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easyexcel.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>transmittable-thread-local</artifactId>
<version>${transmittable-thread-local.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-mongodb</artifactId>
<version>${spring-boot.version}</version>
</dependency>
<dependency>
<groupId>org.lionsoul</groupId>
<artifactId>ip2region</artifactId>
<version>${ip2region.version}</version>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot3-starter</artifactId>
<version>${satoken.version}</version>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-redis-fastjson2</artifactId>
<version>${satoken.version}</version>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-dubbo3</artifactId>
<version>${satoken.version}</version>
</dependency>
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>${protobuf.version}</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc.version}</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-common</artifactId>
<version>${springdoc.version}</version>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webflux-ui</artifactId>
<version>${springdoc-webflux.version}</version>
</dependency>
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>s3</artifactId>
<version>${aws-s3.version}</version>
</dependency>
<dependency>
<groupId>com.lzhpo</groupId>
<artifactId>logging-tracer-dubbo-adapter</artifactId>
<version>${logging-tracer.version}</version>
<exclusions>
<exclusion>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclusion>
<exclusion>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<pluginRepositories>
<pluginRepository>
<id>aliyun-plugin</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<repositories>
<!--阿里云代理-->
<repository>
<id>aliyun</id>
<name>aliyun</name>
<url>https://maven.aliyun.com/nexus/content/groups/public</url>
</repository>
</repositories>
<build>
<finalName>${project.name}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<configuration>
<layers>
<enabled>true</enabled>
</layers>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.encoding}</encoding>
<skip>true</skip>
<parameters>true</parameters>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${maven-resources-plugin.version}</version>
<configuration>
<encoding>${project.encoding}</encoding>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>xdb</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
</project>

98
system-test/pom.xml Normal file
View File

@ -0,0 +1,98 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud</artifactId>
<version>0.0.1</version>
</parent>
<artifactId>system-test</artifactId>
<description>mall4cloud test服务 用于做系统测试的模块</description>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud-user</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud-search</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud-marketing</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud-admin</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud-biz</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud-order</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud-product</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.5</version>
</dependency>
<!-- 添加reportNG依赖 -->
<dependency>
<groupId>org.uncommons</groupId>
<artifactId>reportng</artifactId>
<version>1.1.2</version>
<scope>test</scope>
<!-- 排除testNG依赖 -->
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud-group</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud-payment</artifactId>
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>mall4cloud-seckill</artifactId>
<version>0.0.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,51 @@
package com.tmerclub.cloud.systemtest.api.amount;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.common.order.vo.UserAddrVO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import com.tmerclub.cloud.user.dto.UserAddrDTO;
import java.util.List;
/**
* @author lanhai
*/
public class AddrApi {
public static void addAddr(UserAddrDTO userAddrDTO){
String url = Constant.API_URL + "/mall4cloud_user/user_addr";
HttpUtil.post(url, userAddrDTO, UrlEnum.API);
}
public static List<UserAddrVO> dvyList(){
String url = Constant.API_URL + "/mall4cloud_user/user_addr/list";
List list = HttpUtil.get(url, List.class, UrlEnum.API);
return JSON.parseArray(JSON.toJSONString(list), UserAddrVO.class);
}
// public static UserAddrVO addrInfo(Long addrId) {
// String url = Constant.API_URL + "/mall4cloud_user/user_addr?addrId=" + addrId;
// return HttpUtil.get(url, UserAddrVO.class, UrlEnum.API);
// }
public static void updateAddr(UserAddrDTO userAddrDTO){
String url = Constant.API_URL + "/mall4cloud_user/user_addr";
HttpUtil.put(url, userAddrDTO, UrlEnum.API);
}
// public static void deleteDvy(Long addrId){
// String url = Constant.API_URL +"/p/address/deleteAddr/{addrId}";
// HttpUtil.delete(url);
// }
//
// public static List<RefundAddr> refundAddrList(){
// String url = Constant.SHOP_URL + "/shop/refundAddr/list";
// List list = HttpUtil.get(url, List.class);
// return JSON.parseArray(JSON.toJSONString(list), RefundAddr.class);
// }
//
// public static void addRefundAddr(RefundAddr refundAddr){
// String url = Constant.SHOP_URL + "/shop/refundAddr";
// HttpUtil.post(url,refundAddr);
// }
}

View File

@ -0,0 +1,58 @@
//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.model.Giveaway;
//import com.yami.shop.common.util.Json;
//import com.yami.shop.systemtest.constants.Constant;
//import com.yami.shop.systemtest.util.HttpUtil;
//
//import java.util.List;
//
///**
// * @author lpj
// */
//public class GiveawayApi {
//
// /**
// * 分页获取赠品信息
// */
// public static List<Giveaway> getGiveawayPage() {
// String url = Constant.SHOP_URL + "/shop/giveaway/page";
// return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, Page.class)), Page.class).getRecords()), Giveaway.class);
// }
//
// /**
// * 通过id查询赠品
// */
// public static Giveaway getGiveawayInfo(Long giveawayId) {
// String url = Constant.SHOP_URL + "/shop/giveaway/info/" + giveawayId;
// return HttpUtil.get(url, Giveaway.class);
// }
//
// /**
// * 新增赠品
// */
// public static void addGiveaway(Giveaway giveaway) {
// String url = Constant.SHOP_URL + "/shop/giveaway";
// HttpUtil.post(url, giveaway);
// }
//
// /**
// * 修改赠品
// */
// public static void updateGiveaway(Giveaway giveaway) {
// String url = Constant.SHOP_URL + "/shop/giveaway";
// HttpUtil.put(url, giveaway);
// }
//
//
// /**
// * 修改赠品活动状态失效/删除赠品活动
// */
// public static void updateGiveawayStatus(Integer status, Long giveawayId) {
// String url = Constant.SHOP_URL + "/shop/giveaway/changeStatus?status=" + status + "&giveawayId=" + giveawayId;
// HttpUtil.put(url);
// }
//
//}

View File

@ -0,0 +1,46 @@
package com.tmerclub.cloud.systemtest.api.amount;
import com.tmerclub.cloud.payment.dto.PayInfoDTO;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.data.order.PayParamData;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import java.util.List;
/**
* @author Tu
*/
public class PayApi {
public static Long pay(PayInfoDTO payParam){
String uri = Constant.API_URL+"/mall4cloud_payment/pay/order";
Long payId = HttpUtil.post(uri,payParam, UrlEnum.API,Long.class);
return payId;
}
public static void balancePay(Long payId){
String uri = Constant.API_URL+"/mall4cloud_user/user_balance/balance_pay";
HttpUtil.post(uri,payId, UrlEnum.API);
}
public static void orderPay(Long orderNum){
balancePay(pay(PayParamData.getPayParamData(orderNum)));
}
public static void orderPay(List<Long> orderNums) {
balancePay(pay(PayParamData.getPayParamData(orderNums)));
}
public static Long payBalance(PayInfoDTO payParam){
String uri = Constant.API_URL+"/mall4cloud_payment/pay/pay_balance";
Long payId = HttpUtil.post(uri,payParam, UrlEnum.API,Long.class);
return payId;
}
public static void orderPayBalance(Long orderNum){
balancePay(payBalance(PayParamData.getPayParamData(orderNum)));
}
}

View File

@ -0,0 +1,118 @@
package com.tmerclub.cloud.systemtest.api.amount;
import com.tmerclub.cloud.api.platform.dto.OfflineHandleEventDTO;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.tmerclub.cloud.common.product.dto.SpuDTO;
import com.tmerclub.cloud.common.product.vo.SpuVO;
import com.tmerclub.cloud.common.product.vo.app.SpuAppVO;
import com.tmerclub.cloud.product.dto.SpuPageSearchDTO;
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 ProductApi {
public static Long createProduct(SpuDTO spuDTO, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu";
if(isMainShop) {
return HttpUtil.post(url, spuDTO, UrlEnum.SHOP,Long.class);
} else {
return HttpUtil.post(url, spuDTO, UrlEnum.SHOP_OTHER,Long.class);
}
}
public static SpuVO info(Long spuId, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu?spuId=" + spuId;
if(isMainShop) {
return HttpUtil.get(url, SpuVO.class, UrlEnum.SHOP);
} else {
return HttpUtil.get(url, SpuVO.class, UrlEnum.SHOP_OTHER);
}
}
public static void delete(Long spuId, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu?spuId=" + spuId;
if(isMainShop) {
HttpUtil.delete(url,UrlEnum.SHOP);
} else {
HttpUtil.delete(url,UrlEnum.SHOP_OTHER);
}
}
/**
*获取商品详情
*/
public static SpuAppVO getProductInfo(Long spuId){
String url = Constant.API_URL + "/mall4cloud_product/ma/spu/prod_info?spuId="+spuId+"&userId=&addrId=";
return HttpUtil.get(url, SpuAppVO.class,UrlEnum.API);
}
public static List<Long> addSupplierProduct(List<Long> supplierSpuId, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu/importSupplierSpu";
if(isMainShop) {
return HttpUtil.post(url, supplierSpuId, UrlEnum.SHOP,List.class);
} else {
return HttpUtil.post(url, supplierSpuId, UrlEnum.SHOP_OTHER,List.class);
}
}
public static void onlineProduct(SpuPageSearchDTO spuDTO, Boolean isMainShop){
String url = Constant.API_URL + "/mall4cloud_product/mp/spu/prod_status";
if(isMainShop) {
HttpUtil.put(url, spuDTO, UrlEnum.SHOP);
} else {
HttpUtil.put(url, spuDTO, UrlEnum.SHOP_OTHER);
}
}
/**
* 修改商品信息
*/
public static void update(SpuDTO spuDTO, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu";
if(isMainShop) {
HttpUtil.put(url, spuDTO, UrlEnum.SHOP);
} else {
HttpUtil.put(url, spuDTO, UrlEnum.SHOP_OTHER);
}
}
/**
* 商品列表修改商品信息
*/
public static void updateProductData(SpuDTO spuDTO) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu/update_spu_data";
HttpUtil.put(url, spuDTO, UrlEnum.SHOP);
}
/**
* 修改商品状态-上架 1 下架 0
*/
public static void changeProductStatus(SpuPageSearchDTO spuPageSearchDTO){
String url = Constant.API_URL + "/mall4cloud_product/mp/spu/prod_status";
HttpUtil.put(url,spuPageSearchDTO,UrlEnum.SHOP);
}
/**
* 商家获取最新下架信息
*/
public static OfflineHandleEventVO shopGetOfflineHandleEvent(Long productId) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu/get_offline_handle_event/" + productId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.SHOP);
}
/**
* 商家申请上架提交审核
*/
public static void apply(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu/audit_apply";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.SHOP);
}
}

View File

@ -0,0 +1,22 @@
//package com.tmerclub.cloud.systemtest.api.login;
//
//import com.alibaba.fastjson2.JSON;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.yami.shop.bean.param.UserManagerReqParam;
//import com.yami.shop.common.util.Json;
//import com.yami.shop.systemtest.constants.Constant;
//import com.yami.shop.systemtest.util.HttpUtil;
//
//import java.util.List;
//
///**
// * @author Tu
// */
//public class MemberShipApi {
// public static List<UserManagerReqParam> lishUser(){
// String url = Constant.PLATFORM_URL+"admin/user/userPage";
// return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, Page.class)), Page.class).getRecords()), UserManagerReqParam.class);
// }
//
//
//}

View File

@ -0,0 +1,18 @@
//package com.tmerclub.cloud.systemtest.api.login;
//
//import com.yami.shop.bean.app.param.SendSmsParam;
//import com.yami.shop.common.response.ServerResponseEntity;
//import com.yami.shop.systemtest.constants.Constant;
//import com.yami.shop.systemtest.util.HttpUtil;
//
///**
// * @author Tu
// */
//public class UserLoginApi {
// public static ServerResponseEntity register(SendSmsParam sendSmsParam){
// String url = Constant.API_URL+"/user/sendRegisterSms";
// ServerResponseEntity serverResponseEntity = HttpUtil.puts(url, sendSmsParam);
// return serverResponseEntity;
// }
//
//}

View File

@ -0,0 +1,58 @@
package com.tmerclub.cloud.systemtest.api.marketing;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.combo.vo.ComboVO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.product.dto.ComboDTO;
import com.tmerclub.cloud.common.util.Json;
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 ComboApi {
/**
* 获取套餐列表
*/
public static List<ComboVO> getComboPage() {
String url = Constant.API_URL + "/mall4cloud_marketing/m/combo/page?pageNum=1&pageSize=10&name=&status=&mainSpuName=&matchSpuName";
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP)), PageVO.class).getList()), ComboVO.class);
}
/**
* 新增套餐
*/
public static void save(ComboDTO comboDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/m/combo";
HttpUtil.post(url, comboDTO, UrlEnum.SHOP);
}
/**
* 获取套餐详情
*/
public static ComboVO getComboInfo(Long comboId) {
String url = Constant.API_URL + "/mall4cloud_marketing/m/combo?comboId=" + comboId;
return HttpUtil.get(url, ComboVO.class, UrlEnum.SHOP);
}
/**
* 修改套餐
*/
public static void update(ComboDTO comboDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/m/combo";
HttpUtil.put(url, comboDTO, UrlEnum.SHOP);
}
/**
* 修改商品状态
* @param comboDTO status 0-失效 -1-删除
*/
public static void updateComboStatus(ComboDTO comboDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/m/combo/updateComboStatus";
HttpUtil.put(url, comboDTO, UrlEnum.SHOP);
}
}

View File

@ -0,0 +1,113 @@
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.discount.dto.DiscountDTO;
import com.tmerclub.cloud.discount.vo.DiscountVO;
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 DiscountApi {
/**
* 商家获取满减列表
*/
public static List<DiscountVO> getDiscountPage(Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/discount/page?pageSize=10&pageNum=1&name=";
if(isMainShop) {
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP)), PageVO.class).getList()), DiscountVO.class);
} else {
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP_OTHER)), PageVO.class).getList()), DiscountVO.class);
}
}
/**
* 新增满减
*/
public static void save(DiscountDTO discountDTO, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/discount";
if(isMainShop) {
HttpUtil.post(url, discountDTO, UrlEnum.SHOP);
} else {
HttpUtil.post(url, discountDTO, UrlEnum.SHOP_OTHER);
}
}
/**
* 通过id获取满减
*/
public static DiscountVO getDiscountInfo(Long discountId) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/discount/info/" + discountId;
return HttpUtil.get(url, DiscountVO.class, UrlEnum.SHOP);
}
/**
* 修改满减
*/
public static void update(DiscountDTO discountDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/discount";
HttpUtil.put(url, discountDTO, UrlEnum.SHOP);
}
/**
* 删除满减
*/
public static void delete(Long discountId, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/discount/" + discountId;
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/mp/discount/offline";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
/**
* 商家获取最新下架信息
*/
public static OfflineHandleEventVO shopGetOfflineHandleEvent(Long discountId) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/discount/get_offline_handle_event/" + discountId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.SHOP);
}
/**
* 商家申请上架提交审核
*/
public static void applyDiscount(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/discount/audit_apply";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.SHOP);
}
/**
* 平台获取最新下架信息
*/
public static OfflineHandleEventVO platformGetOfflineHandleEvent(Long discountId) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/discount/get_offline_handle_event/" + discountId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.PLATFORM);
}
/**
* 平台审核平台活动
*/
public static void auditDiscount(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_marketing/mp/discount/audit";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
}

View File

@ -0,0 +1,57 @@
package com.tmerclub.cloud.systemtest.api.marketing;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.product.vo.GiveawayVO;
import com.tmerclub.cloud.common.util.Json;
import com.tmerclub.cloud.product.dto.GiveawayDTO;
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 GiveawayApi {
/**
* 获取赠品活动列表
*/
public static List<GiveawayVO> getGiveawayPage() {
String url = Constant.API_URL + "/mall4cloud_product/m/giveaway/page?pageNum=1&pageSize=10&name=&spuName=&status=&giveawaySpuName=";
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP)), PageVO.class).getList()), GiveawayVO.class);
}
/**
* 新增赠品活动
*/
public static void save(GiveawayDTO giveawayDTO) {
String url = Constant.API_URL + "/mall4cloud_product/m/giveaway";
HttpUtil.post(url, giveawayDTO, UrlEnum.SHOP);
}
/**
* 根据id获取赠品活动信息
*/
public static GiveawayVO getGiveawayInfo(Long giveawayId) {
String url = Constant.API_URL + "/mall4cloud_product/m/giveaway?giveawayId=" + giveawayId;
return HttpUtil.get(url, GiveawayVO.class, UrlEnum.SHOP);
}
/**
* 修改赠品活动
*/
public static void update(GiveawayDTO giveawayDTO) {
String url = Constant.API_URL + "/mall4cloud_product/m/giveaway";
HttpUtil.put(url, giveawayDTO, UrlEnum.SHOP);
}
/**
* 修改赠品状态
*/
public static void updateGiveawayStatus(Integer status, Long giveawayId) {
String url = Constant.API_URL + "/mall4cloud_product/m/giveaway/changeStatus?status=" + status + "&giveawayId=" + giveawayId;
HttpUtil.put(url, UrlEnum.SHOP);
}
}

View File

@ -0,0 +1,171 @@
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.moyuer.cloud.group.dto.GroupActivityDTO;
import com.moyuer.cloud.group.dto.GroupOrderDTO;
import com.moyuer.cloud.group.dto.SubmitGroupOrderDTO;
import com.moyuer.cloud.group.vo.GroupActivityVO;
import com.moyuer.cloud.group.vo.app.AppGroupActivityVO;
import com.moyuer.cloud.group.vo.app.AppGroupTeamVO;
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 GroupApi {
/**
* 新增拼团活动
*/
public static void save(GroupActivityDTO groupActivityDTO) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity";
HttpUtil.post(url, groupActivityDTO, UrlEnum.SHOP );
}
/**
* 商家获取拼团活动列表
*/
public static List<GroupActivityVO> getGroupActivityPage() {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity/page?pageSize=10&pageNum=1&activityName=&spuName=&status=";
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP)), PageVO.class).getList()), GroupActivityVO.class);
}
/**
*通过id获取拼团活动
*/
public static GroupActivityVO getGroupActivity(Long groupActivityId) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity?groupActivityId=" + groupActivityId;
return HttpUtil.get(url, GroupActivityVO.class, UrlEnum.SHOP);
}
/**
* 修改拼团活动
*/
public static void updateGroupActivity(GroupActivityDTO groupActivityDTO) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity";
HttpUtil.put(url, groupActivityDTO, UrlEnum.SHOP);
}
/**
* 启用拼团活动
*/
public static void activeGroupActivity(GroupActivityDTO groupActivityDTO) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity/active";
HttpUtil.put(url, groupActivityDTO, UrlEnum.SHOP);
}
/**
* 失效拼团活动
*/
public static void invalidActivity(GroupActivityDTO groupActivityDTO) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity/invalid";
HttpUtil.put(url, groupActivityDTO, UrlEnum.SHOP);
}
/**
* 删除拼团活动
*/
public static void deleteGroupActivity(Long groupActivityId) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity?groupActivityId=" + groupActivityId;
HttpUtil.delete(url, UrlEnum.SHOP);
}
/**
* 平台违规下架平台活动
*/
public static void offline(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity/offline";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
/**
* 商家获取最新下架信息
*/
public static OfflineHandleEventVO shopGetOfflineHandleEvent(Long groupActivityId) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity/get_offline_handle_event/" + groupActivityId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.SHOP);
}
/**
* 商家申请上架提交审核
*/
public static void applyGroupActivity(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity/audit_apply";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.SHOP);
}
/**
* 平台获取最新下架信息
*/
public static OfflineHandleEventVO platformGetOfflineHandleEvent(Long groupActivityId) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity/get_offline_handle_event/" + groupActivityId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.PLATFORM);
}
/**
* 平台审核平台活动
*/
public static void auditGroupActivity(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_group/mp/group_activity/audit";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.PLATFORM);
}
/**
* 用户获取团购商品信息
*/
public static AppGroupActivityVO getGroupActivityInfo(Long productId) {
String url = Constant.API_URL + "/mall4cloud_group/ua/group_activity/info?spuId=" + productId;
return HttpUtil.get(url, AppGroupActivityVO.class, UrlEnum.API);
}
/**
* 用户开团
*/
public static void openGroup(GroupOrderDTO groupOrderDTO) {
String url = Constant.API_URL + "/mall4cloud_group/group_order/confirm";
HttpUtil.post(url, groupOrderDTO, UrlEnum.API);
}
/**
* 开团用户提交拼团订单
*/
public static List<Long> submitGroupOrder(SubmitGroupOrderDTO submitGroupOrderDTO) {
String url = Constant.API_URL + "/mall4cloud_group/group_order/submit";
return HttpUtil.post(url, submitGroupOrderDTO, UrlEnum.API, List.class);
}
/**
* 用户获取可参团列表
*/
public static List<AppGroupTeamVO> getJoinGroupList(Long groupActivityId) {
String url = Constant.API_URL + "/mall4cloud_group/ua/group_activity/join_group_list?groupActivityId=" + groupActivityId;
return HttpUtil.get(url, List.class, UrlEnum.API_OTHER);
}
/**
* 用户立即参团
*/
public static void joinGroup(GroupOrderDTO groupOrderDTO) {
String url = Constant.API_URL + "/mall4cloud_group/group_order/confirm";
HttpUtil.post(url, groupOrderDTO, UrlEnum.API_OTHER);
}
/**
* 参团用户提交拼团订单
*/
public static List<Long> submitJoinGroupOrder(SubmitGroupOrderDTO submitGroupOrderDTO) {
String url = Constant.API_URL + "/mall4cloud_group/group_order/submit";
return HttpUtil.post(url, submitGroupOrderDTO, UrlEnum.API_OTHER, List.class);
}
}

View File

@ -0,0 +1,100 @@
//package com.tmerclub.cloud.systemtest.api.marketing;
//
//import com.alibaba.fastjson2.JSON;
//import com.tmerclub.cloud.common.database.vo.PageVO;
//import com.tmerclub.cloud.common.util.Json;
//import com.tmerclub.cloud.live.dto.LiveProdStoreDTO;
//import com.tmerclub.cloud.live.model.LiveProdStore;
//import com.tmerclub.cloud.live.model.LiveRoom;
//import com.tmerclub.cloud.live.model.LiveUser;
//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 LiveApi {
// /**
// * 商家获取直播商品列表
// */
// public static List<LiveProdStore> getLiveProdStorePage() {
// String url = Constant.API_URL + "/mall4cloud_marketing/m/live_prod_store/page?pageNum=1&pageSize=10&name=";
// return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP)), PageVO.class).getList()), LiveProdStore.class);
// }
//
// /**
// * 新增直播商品
// */
// public static void saveLiveProdStore(LiveProdStoreDTO liveProdStoreDTO) {
// String url = Constant.API_URL + "/mall4cloud_marketing/m/live_prod_store";
// HttpUtil.post(url, liveProdStoreDTO, UrlEnum.SHOP);
// }
//
// /**
// * 获取直播商品信息
// */
// public static LiveProdStore getLiveProdStore(Long liveProdStoreId) {
// String url = Constant.API_URL + "/mall4cloud_marketing/m/live_prod_store/info/" + liveProdStoreId;
// return HttpUtil.get(url, LiveProdStore.class, UrlEnum.SHOP);
// }
//
// /**
// * 修改直播商品
// */
// public static void updateLiveProdStore(LiveProdStoreDTO liveProdStoreDTO) {
// String url = Constant.API_URL + "/mall4cloud_marketing/m/live_prod_store";
// HttpUtil.put(url, liveProdStoreDTO, UrlEnum.SHOP);
// }
//
// /**
// * 提交审核
// */
// public static void submitVerify(LiveProdStore liveProdStore) {
// String url = Constant.API_URL + "/mall4cloud_marketing/m/live_prod_store/submitVerify";
// HttpUtil.put(url, liveProdStore, UrlEnum.SHOP);
// }
//
// /**
// * 删除直播商品
// */
// public static void deleteLiveProdStore(Long liveProdStoreId) {
// String url = Constant.API_URL + "/mall4cloud_marketing/m/live_prod_store/" + liveProdStoreId;
// HttpUtil.delete(url, UrlEnum.SHOP);
// }
//
// /**
// * 商家获取直播间列表
// */
// public static List<LiveRoom> getLiveRoomPage() {
// String url = Constant.API_URL + "/mall4cloud_marketing/m/live_room/page?pageNum=1&pageSize=10&name=&anchorName=&liveStatus=&roomTop=";
// return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP)), PageVO.class).getList()), LiveRoom.class);
// }
//
// /**
// * 新增直播间
// */
// public static void saveLiveRoom(LiveRoom liveRoom) {
// String url = Constant.API_URL + "/mall4cloud_marketing/m/live_room";
// HttpUtil.post(url, liveRoom, UrlEnum.SHOP);
// }
//
// /**
// * 删除直播间
// */
// public static void deleteLiveRoom(Long liveRoomId) {
// String url = Constant.API_URL + "/mall4cloud_marketing/m/live_room?id=" + liveRoomId;
// HttpUtil.delete(url, UrlEnum.SHOP);
// }
//
// /**
// * 获取直播成员
// */
// public static List<LiveUser> getLiveUserPage() {
// String url = Constant.API_URL + "/mall4cloud_marketing/p/live_user/page?pageNum=1&pageSize=10&nickName=&anchorWechat=&roles=";
// return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.PLATFORM)), PageVO.class).getList()), LiveUser.class);
// }
//
//}

View File

@ -0,0 +1,71 @@
package com.tmerclub.cloud.systemtest.api.order;
import com.tmerclub.cloud.common.order.dto.OrderDTO;
import com.tmerclub.cloud.common.order.dto.SubmitOrderDTO;
import com.tmerclub.cloud.common.order.vo.OrderSelfStationVO;
import com.tmerclub.cloud.common.order.vo.ShopCartOrderMergerVO;
import com.tmerclub.cloud.order.dto.OrderStationDTO;
import com.tmerclub.cloud.order.vo.OrderShopVO;
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 MyOrderApi {
public static ShopCartOrderMergerVO confirm(OrderDTO orderParam){
String url = Constant.API_URL+"/mall4cloud_order/order/confirm";
return HttpUtil.post(url, orderParam, UrlEnum.API, ShopCartOrderMergerVO.class);
}
public static void confirmScoreOrder(OrderDTO orderParam){
String url = Constant.API_URL+"/mall4cloud_order/score_order/confirm";
HttpUtil.post(url, orderParam, UrlEnum.API);
}
public static List<Long> submit(SubmitOrderDTO submitOrderDTO){
String url = Constant.API_URL+"/mall4cloud_order/order/submit";
return HttpUtil.post(url, submitOrderDTO,UrlEnum.API, List.class);
}
public static void cancel(Long orderNumber){
String url = Constant.API_URL+"/mall4cloud_order/my_order/cancel/"+orderNumber;
HttpUtil.put(url,UrlEnum.API);
}
public static void receipt(Long orderNumber){
String url = Constant.API_URL + "/mall4cloud_order/my_order/receipt/"+orderNumber;
HttpUtil.put(url,UrlEnum.API);
}
public static OrderShopVO orderDetail(Long orderNumber){
String url = Constant.API_URL + "/mall4cloud_order/my_order/order_detail?orderId="+orderNumber;
return HttpUtil.get(url,OrderShopVO.class,UrlEnum.API);
}
public static void delete(Long orderNumber){
String url = Constant.API_URL + "/mall4cloud_order/my_order/"+orderNumber;
HttpUtil.delete(url,UrlEnum.API);
}
/**
* 自提订单门店详情
*/
public static OrderSelfStationVO stationOrderDetail(Long orderId) {
String url = Constant.API_URL + "/mall4cloud_order/my_station_order/station_detail?orderId=" + orderId + "&lat=22.943953938872706&lng=113.39070900424778";
return HttpUtil.get(url, OrderSelfStationVO.class, UrlEnum.API);
}
/**
* 用户扫商家码核销订单
*/
public static void orderStationByOrderId(OrderStationDTO orderStationDTO) {
String url = Constant.API_URL + "/mall4cloud_order/my_station_order/order_station_by_order_id";
HttpUtil.put(url, orderStationDTO, UrlEnum.API);
}
}

View File

@ -0,0 +1,97 @@
package com.tmerclub.cloud.systemtest.api.order;
import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderDTO;
import com.tmerclub.cloud.api.delivery.vo.DeliveryOrderFeignVO;
import com.tmerclub.cloud.common.order.dto.OrderSelfStationDTO;
import com.tmerclub.cloud.common.order.dto.OrderVirtualInfoDTO;
import com.tmerclub.cloud.common.order.vo.OrderAddrVO;
import com.tmerclub.cloud.common.order.vo.OrderSelfStationVO;
import com.tmerclub.cloud.common.order.vo.OrderVO;
import com.tmerclub.cloud.order.dto.OrderAddrDTO;
import com.tmerclub.cloud.order.dto.multishop.OrderAdminDTO;
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 OrderApi {
public static OrderVO getOrderItemAndAddress(Long orderNumber){
String url = Constant.API_URL+"/mall4cloud_order/mp/order/order_item_and_address/"+orderNumber;
return HttpUtil.get(url, OrderVO.class,UrlEnum.SHOP);
}
public static void delivery(DeliveryOrderDTO deliveryOrderParam){
String url = Constant.API_URL + "/mall4cloud_order/mp/order/delivery";
HttpUtil.post(url,deliveryOrderParam,UrlEnum.SHOP);
}
public static OrderVO infoOrder(Long orderNumber){
String url = Constant.API_URL + "/mall4cloud_order/mp/order/order_info/"+orderNumber;
return HttpUtil.get(url, OrderVO.class,UrlEnum.SHOP);
}
public static void changeOrderAmount(OrderAdminDTO orderAdminDTO){
String url = Constant.API_URL + "/mall4cloud_order/mp/order/change_amount";
HttpUtil.put(url, orderAdminDTO, UrlEnum.SHOP);
}
public static OrderAddrVO infoOrderAddr(Long orderNumber){
String url = Constant.API_URL + "/mall4cloud_order/mp/order/order_addr/"+orderNumber;
return HttpUtil.get(url,OrderAddrVO.class,UrlEnum.SHOP);
}
public static void changeOrderAddrCheck(Long orderNumber){
String url = Constant.API_URL + "/mall4cloud_order/mp/order/get_change_amount?orderId="+orderNumber+"&areaId=130203";
HttpUtil.get(url,UrlEnum.SHOP);
}
public static void changeOrderAddr(OrderAddrDTO orderAddrDTO){
String url = Constant.API_URL + "/mall4cloud_order/mp/order/change_user_addr";
HttpUtil.put(url,orderAddrDTO,UrlEnum.SHOP);
}
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.SHOP);
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.SHOP);
}
/**
* 自提订单商家端提货
*/
public static void changeStatusAndOrderStation(OrderSelfStationDTO orderSelfStationDTO){
String url = Constant.API_URL + "/mall4cloud_order/m/order_self_station/change_status_and_order_station";
HttpUtil.put(url, orderSelfStationDTO, UrlEnum.SHOP);
}
/**
* 订单自提信息详情
*/
public static OrderSelfStationVO getOrderItemAndStationInfo(Long orderId) {
String url = Constant.API_URL + "/mall4cloud_order/m/order_self_station/get_order_item_and_station_info?orderId=" + orderId;
return HttpUtil.get(url, OrderSelfStationVO.class, UrlEnum.SHOP);
}
/**
* 根据订单ID和核销码核销虚拟订单
*/
public static void orderWriteOffByOrderId(OrderVirtualInfoDTO orderVirtualInfoDTO) {
String url = Constant.API_URL + "/mall4cloud_order/m/order_virtual_info/order_write_off_by_order_id";
HttpUtil.put(url, orderVirtualInfoDTO, UrlEnum.SHOP);
}
/**
* 根据订单ID采购订单
* */
public static void sourcingOrder(OrderAdminDTO orderDTO) {
String url = Constant.API_URL + "/mall4cloud_order/mp/order/sourcing_order";
HttpUtil.put(url, orderDTO, UrlEnum.SHOP);
}
}

View File

@ -0,0 +1,40 @@
package com.tmerclub.cloud.systemtest.api.order;
import com.tmerclub.cloud.order.dto.app.OrderRefundDTO;
import com.tmerclub.cloud.order.dto.app.OrderRefundDeliveryDTO;
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 OrderRefundApi {
/**
* 申请退款
*/
public static Long apply(OrderRefundDTO orderRefundParam){
String url = Constant.API_URL+"/mall4cloud_order/order_refund/apply";
return HttpUtil.post(url,orderRefundParam, UrlEnum.API, Long.class);
}
/**
* 用户提交退款订单物流填写信息
*/
public static void submitExpress(OrderRefundDeliveryDTO orderRefundExpressParam){
String url = Constant.API_URL+"/mall4cloud_order/order_refund/submit_express";
HttpUtil.post(url,orderRefundExpressParam,UrlEnum.API);
}
// public static ApiOrderRefundDto infoUserByRefundSn(String refundSn){
// String url = Constant.API_URL+"/p/orderRefund/info?refundSn="+refundSn;
// return HttpUtil.get(url,ApiOrderRefundDto.class);
// }
//
// public static void cancel(String refundSn){
// String url = Constant.API_URL+"/p/orderRefund/cancel";
// HttpUtil.put(url,refundSn);
// }
}

View File

@ -0,0 +1,22 @@
//package com.tmerclub.cloud.systemtest.api.order;
//
//
//import com.alibaba.fastjson2.JSON;
//import com.yami.shop.bean.model.ShopWalletLog;
//import com.yami.shop.systemtest.constants.Constant;
//import com.yami.shop.systemtest.util.HttpUtil;
//
//import java.util.List;
//
///**
// * @author Tu
// */
//public class SettlementApi {
// public static List<ShopWalletLog> infoSettlement(String orderNumber, String refundSn){
// String url = Constant.SHOP_URL+"/shop/shopWalletLog/page?ioType=&amountType=&orderNumber="+orderNumber+
// "&refundSn="+refundSn+"&reason=&startTime=&endTime=&current=1&size=10";
// // 返回集合用JSON.parseArray(HttpUtil.gets(url), ShopWalletLog.class);
// // 返回单个用 JSON.parseObject(HttpUtil.gets(url), ShopWalletLog.class);
// return JSON.parseArray(HttpUtil.gets(url), ShopWalletLog.class);
// }
//}

View File

@ -0,0 +1,17 @@
package com.tmerclub.cloud.systemtest.api.order;
import com.tmerclub.cloud.product.dto.shopcart.ChangeShopCartItemDTO;
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 ShopCartApi {
public static void addItem(ChangeShopCartItemDTO param) {
String url = Constant.API_URL+"/mall4cloud_product/shop_cart/change_item";
HttpUtil.post(url,param,UrlEnum.API);
}
}

View File

@ -0,0 +1,55 @@
package com.tmerclub.cloud.systemtest.api.order;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.delivery.vo.StationVO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.order.dto.OrderVirtualInfoDTO;
import com.tmerclub.cloud.common.order.vo.OrderVO;
import com.tmerclub.cloud.common.util.Json;
import com.moyuer.cloud.delivery.vo.StationDetailVO;
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 StationApi {
public static List<StationDetailVO> getStationList(Long shopId){
String url = Constant.API_URL+"/mall4cloud_order/station/user_station?pageNum=1&pageSize=7&lat=22.943953938872706&lng=113.39070900424778&stationName=&shopId="+shopId;
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.API)), PageVO.class).getList()), StationDetailVO.class);
}
/**
* 获取门店首页数据
*/
public static StationVO getStationIndexInfo() {
String url = Constant.API_URL + "/mall4cloud_order/station/get_station_index_info";
return HttpUtil.get(url, StationVO.class, UrlEnum.STATION);
}
/**
* 在门店端查询订单信息
* */
public static OrderVO getStationOrderByCode(String code){
String url = Constant.API_URL+"/mall4cloud_order/station/get_station_order_by_code?code="+code;
return HttpUtil.get(url,OrderVO.class, UrlEnum.STATION);
}
/**
* 在门店端核销自提订单
* */
public static void orderStationById(String orderIds) {
String url = Constant.API_URL + "/mall4cloud_order/station/order_station_by_order_id";
HttpUtil.put(url, orderIds, UrlEnum.STATION);
}
/**
* 在门店端核销虚拟商品订单
* */
public static void orderWriteOffByOrderNumber(OrderVirtualInfoDTO orderVirtualInfoDTO){
String url = Constant.API_URL + "/mall4cloud_order/station/order_write_off_by_order_id";
HttpUtil.put(url, orderVirtualInfoDTO, UrlEnum.STATION);
}
}

View File

@ -0,0 +1,25 @@
package com.tmerclub.cloud.systemtest.api.platform;
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 lpj
*/
public class PlatformTransportApi {
public static void platformAddTransport(TransportDTO transportDTO){
String url = Constant.API_URL + "/mall4cloud_order/mp/transport";
HttpUtil.post(url,transportDTO, UrlEnum.PLATFORM);
}
public static List<TransportVO> platformInfoTransport(){
String url = Constant.API_URL + "/mall4cloud_order/mp/transport/page?pageSize=10&pageNum=1&transName=";
return JSON.parseArray(HttpUtil.gets(url,UrlEnum.PLATFORM), TransportVO.class);
}
}

View File

@ -0,0 +1,41 @@
package com.tmerclub.cloud.systemtest.api.platform;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.util.Json;
import com.tmerclub.cloud.multishop.mongo.MongoShopWalletLogBO;
import com.tmerclub.cloud.order.vo.OrderDetailVO;
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 PlatformWalletApi {
/**
* 根据订单号查询结算记录
*/
public static List<MongoShopWalletLogBO> getMongoShopWalletLogBO(Long orderId) {
String url = Constant.API_URL + "/mall4cloud_admin/mp/shop_wallet/page?platformIoType=&amountType=&orderId=" + orderId + "&refundId=&reason=&pageNum=1&pageSize=10";
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.PLATFORM)), PageVO.class).getList()), MongoShopWalletLogBO.class);
}
/**
* 根据订单号查询结算明细
*/
public static OrderDetailVO getOrderDetailVO(Long orderId) {
String url = Constant.API_URL + "/mall4cloud_order/mp/order_item/get_order_detail?orderId=" + orderId + "&refundId";
return HttpUtil.get(url, OrderDetailVO.class, UrlEnum.PLATFORM);
}
/**
* 根据订单号与退款单号查询结算明细
*/
public static OrderDetailVO getOrderDetailVO(Long orderId, Long refundId) {
String url = Constant.API_URL + "/mall4cloud_order/mp/order_item/get_order_detail?orderId=" + orderId + "&refundId=" + refundId;
return HttpUtil.get(url, OrderDetailVO.class, UrlEnum.PLATFORM);
}
}

View File

@ -0,0 +1,36 @@
package com.tmerclub.cloud.systemtest.api.platform;
import com.tmerclub.cloud.common.product.dto.SpuDTO;
import com.tmerclub.cloud.common.product.vo.app.SpuAppVO;
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 ScoreProductApi {
/**
* 发布积分商品
*/
public static Long createScoreProduct(SpuDTO spuDTO) {
String url = Constant.API_URL + "/mall4cloud_product/p/spu/score_save";
return HttpUtil.post(url, spuDTO, UrlEnum.PLATFORM,Long.class);
}
/**
* 删除积分商品
*/
public static void deleteScoreProduct(Long spuId) {
String url = Constant.API_URL + "/mall4cloud_product/mp/spu?spuId=" + spuId;
HttpUtil.delete(url,UrlEnum.PLATFORM);
}
/**
* 获取积分商品详情
*/
public static SpuAppVO getScoreProductInfo(Long spuId, Long userId){
String url = Constant.API_URL + "/mall4cloud_product/ma/spu/score_prod_info?spuId="+spuId+"&&userId="+userId;
return HttpUtil.get(url, SpuAppVO.class,UrlEnum.API);
}
}

View File

@ -0,0 +1,28 @@
package com.tmerclub.cloud.systemtest.api.platform;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import com.tmerclub.cloud.user.dto.UserLevelDTO;
import com.tmerclub.cloud.user.vo.UserLevelVO;
/**
* @author lpj
*/
public class UserLevelApi {
/**
* 获取用户等级信息
*/
public static UserLevelVO info(Long userLevelId) {
String url = Constant.API_URL + "/mall4cloud_user/p/user_level?userLevelId=" + userLevelId;
return HttpUtil.get(url, UserLevelVO.class, UrlEnum.PLATFORM);
}
/**
* 更新用户等级
*/
public static void update(UserLevelDTO userLevelDTO) {
String url = Constant.API_URL + "/mall4cloud_user/p/user_level";
HttpUtil.put(url, userLevelDTO, UrlEnum.PLATFORM);
}
}

View File

@ -0,0 +1,27 @@
package com.tmerclub.cloud.systemtest.api.platform;
import com.moyuer.cloud.systemtest.constants.Constant;
import com.moyuer.cloud.systemtest.util.HttpUtil;
import com.moyuer.cloud.systemtest.util.UrlEnum;
import com.tmerclub.cloud.user.dto.UserRightsDTO;
/**
* @author lpj
*/
public class UserRightsApi {
/**
* 新增用户权益
*/
public static Long save(UserRightsDTO userRightsDTO) {
String url = Constant.API_URL + "/mall4cloud_user/p/user_rights";
return HttpUtil.post(url, userRightsDTO, UrlEnum.PLATFORM, Long.class);
}
/**
* 删除用户权益
*/
public static void delete(Long rightsId) {
String url = Constant.API_URL + "/mall4cloud_user/p/user_rights?rightsId=" + rightsId;
HttpUtil.delete(url, UrlEnum.PLATFORM);
}
}

View File

@ -0,0 +1,22 @@
package com.tmerclub.cloud.systemtest.api.store;
import com.tmerclub.cloud.api.delivery.vo.SameCityVO;
import com.moyuer.cloud.delivery.dto.SameCityDTO;
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 SameCityApi {
public static SameCityVO getSameCityInfo() {
String url = Constant.API_URL + "/mall4cloud_order/m/same_city/get_same_city_info";
return HttpUtil.get(url, SameCityVO.class, UrlEnum.SHOP);
}
public static void saveSameCity(SameCityDTO sameCityDTO) {
String url = Constant.API_URL + "/mall4cloud_order/m/same_city";
HttpUtil.post(url, sameCityDTO, UrlEnum.SHOP);
}
}

View File

@ -0,0 +1,19 @@
//package com.tmerclub.cloud.systemtest.api.store;
//
//
//import com.yami.shop.bean.app.dto.NoticeDto;
//import com.yami.shop.systemtest.util.HttpUtil;
//
///**
// * 商家公告管理
// * @author Zuo
// */
//
//public class ShopNoticeApi {
//
// public static void save(String url, NoticeDto noticeDto){
// HttpUtil.post(url,noticeDto);
// }
//
//}
//

View File

@ -0,0 +1,53 @@
package com.tmerclub.cloud.systemtest.api.store;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.util.Json;
import com.tmerclub.cloud.multishop.mongo.MongoShopWalletLogBO;
import com.tmerclub.cloud.order.vo.OrderDetailVO;
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 ShopWalletApi {
/**
* 根据订单号查询结算记录
*/
public static List<MongoShopWalletLogBO> getMongoShopWalletLogBO(Long orderId, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_admin/mp/shop_wallet/page?shopIoType=&amountType=&orderId=" + orderId + "&refundId=&reason=&pageNum=1&pageSize=10";
if(isMainShop) {
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP)), PageVO.class).getList()), MongoShopWalletLogBO.class);
} else {
return JSON.parseArray(JSON.toJSONString(Json.parseObject(JSON.toJSONString(HttpUtil.get(url, PageVO.class, UrlEnum.SHOP_OTHER)), PageVO.class).getList()), MongoShopWalletLogBO.class);
}
}
/**
* 根据订单号查询结算明细
*/
public static OrderDetailVO getOrderDetailVO(Long orderId, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_order/mp/order_item/get_order_detail?orderId=" + orderId + "&refundId";
if(isMainShop) {
return HttpUtil.get(url, OrderDetailVO.class, UrlEnum.SHOP);
} else {
return HttpUtil.get(url, OrderDetailVO.class, UrlEnum.SHOP_OTHER);
}
}
/**
* 根据订单号与退款单号查询结算明细
*/
public static OrderDetailVO getOrderDetailVO(Long orderId, Long refundId, Boolean isMainShop) {
String url = Constant.API_URL + "/mall4cloud_order/mp/order_item/get_order_detail?orderId=" + orderId + "&refundId=" + refundId;
if(isMainShop) {
return HttpUtil.get(url, OrderDetailVO.class, UrlEnum.SHOP);
} else {
return HttpUtil.get(url, OrderDetailVO.class, UrlEnum.SHOP_OTHER);
}
}
}

View File

@ -0,0 +1,35 @@
package com.tmerclub.cloud.systemtest.api.supplier;
import com.tmerclub.cloud.api.delivery.dto.DeliveryOrderDTO;
import com.tmerclub.cloud.common.order.vo.OrderVO;
import com.tmerclub.cloud.order.dto.OrderAddrDTO;
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 SupplierOrderApi {
public static void updateOrderDelivery(OrderAddrDTO orderAddrDTO){
String url = Constant.API_URL + "/mall4cloud_order/s/order/change_user_addr";
HttpUtil.put(url,orderAddrDTO, UrlEnum.SUPPLIER);
}
public static OrderVO info(Long orderNumber){
String url = Constant.API_URL + "/mall4cloud_order/s/order/order_info/"+orderNumber;
return HttpUtil.get(url,OrderVO.class, UrlEnum.SUPPLIER);
}
public static void delivery(DeliveryOrderDTO deliveryOrderParam){
String url = Constant.API_URL + "/mall4cloud_order/s/order/delivery";
HttpUtil.post(url,deliveryOrderParam,UrlEnum.SUPPLIER);
}
public static void updateOrderDelivery(List<DeliveryOrderDTO> list){
String url = Constant.API_URL + "/mall4cloud_order/mp/order_delivery/update";
HttpUtil.put(url,list,UrlEnum.SUPPLIER);
}
}

View File

@ -0,0 +1,89 @@
package com.tmerclub.cloud.systemtest.api.supplier;
import com.tmerclub.cloud.api.platform.dto.OfflineHandleEventDTO;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.tmerclub.cloud.common.product.dto.SpuDTO;
import com.tmerclub.cloud.common.product.vo.SpuVO;
import com.tmerclub.cloud.product.dto.SpuPageSearchDTO;
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 SupplierProductApi {
public static Long createProduct(SpuDTO spuDTO, Boolean isMainSupplier) {
String url = Constant.API_URL + "/mall4cloud_product/s/spu";
if(isMainSupplier) {
return HttpUtil.post(url, spuDTO, UrlEnum.SUPPLIER,Long.class);
} else {
return HttpUtil.post(url, spuDTO, UrlEnum.SUPPLIER_OTHER,Long.class);
}
}
public static void delete(Long spuId, Boolean isMainSupplier) {
String url = Constant.API_URL + "/mall4cloud_product/s/spu/batch?spuIds=" + spuId;
if(isMainSupplier) {
HttpUtil.delete(url,UrlEnum.SUPPLIER);
} else {
HttpUtil.delete(url,UrlEnum.SUPPLIER_OTHER);
}
}
/**
* 获取商品详情
*/
public static SpuVO info(Long spuId, Boolean isMainSupplier) {
String url = Constant.API_URL + "/mall4cloud_product/s/spu?spuId=" + spuId;
if(isMainSupplier) {
return HttpUtil.get(url, SpuVO.class, UrlEnum.SUPPLIER);
} else {
return HttpUtil.get(url, SpuVO.class, UrlEnum.SUPPLIER_OTHER);
}
}
/**
* 修改商品信息
*/
public static void update(SpuDTO spuDTO, Boolean isMainSupplier) {
String url = Constant.API_URL + "/mall4cloud_product/s/spu";
if(isMainSupplier) {
HttpUtil.put(url, spuDTO, UrlEnum.SUPPLIER);
} else {
HttpUtil.put(url, spuDTO, UrlEnum.SUPPLIER_OTHER);
}
}
/**
* 商品列表修改商品信息
*/
public static void updateProductData(SpuDTO spuDTO) {
String url = Constant.API_URL + "/mall4cloud_product/s/spu/update_spu_data";
HttpUtil.put(url, spuDTO, UrlEnum.SUPPLIER);
}
/**
* 修改商品状态-上架 1 下架 0
*/
public static void changeProductStatus(SpuPageSearchDTO spuPageSearchDTO){
String url = Constant.API_URL + "/mall4cloud_product/s/spu/prod_status";
HttpUtil.put(url,spuPageSearchDTO,UrlEnum.SUPPLIER);
}
/**
* 商家获取最新下架信息
*/
public static OfflineHandleEventVO getOfflineHandleEvent(Long productId) {
String url = Constant.API_URL + "/mall4cloud_product/s/spu/get_offline_handle_event/" + productId;
return HttpUtil.get(url, OfflineHandleEventVO.class, UrlEnum.SUPPLIER);
}
/**
* 商家申请上架提交审核
*/
public static void apply(OfflineHandleEventDTO offlineHandleEventDTO) {
String url = Constant.API_URL + "/mall4cloud_product/s/spu/audit_apply";
HttpUtil.post(url, offlineHandleEventDTO, UrlEnum.SUPPLIER);
}
}

View File

@ -0,0 +1,30 @@
package com.tmerclub.cloud.systemtest.data.amount;
import com.tmerclub.cloud.api.platform.dto.OfflineHandleEventDTO;
/**
* @author lpj
*/
public class OfflineHandleEventDtoData {
/**
* 违规下架数据
* @param eventId 事件id
* @param handleId 违规下架的活动id
* @param offlineReason 违规下线原因
* @param reapplyReason 申请上架原因
* @param refuseReason 拒绝原因
* @param status 状态
*/
public static OfflineHandleEventDTO getOfflineHandleEventDTO(Long eventId, Long handleId, String offlineReason, String reapplyReason, String refuseReason, Integer status) {
OfflineHandleEventDTO offlineHandleEventDTO = new OfflineHandleEventDTO();
offlineHandleEventDTO.setEventId(eventId);
offlineHandleEventDTO.setHandleId(handleId);
offlineHandleEventDTO.setOfflineReason(offlineReason);
offlineHandleEventDTO.setReapplyReason(reapplyReason);
offlineHandleEventDTO.setRefuseReason(refuseReason);
offlineHandleEventDTO.setStatus(status);
return offlineHandleEventDTO;
}
}

View File

@ -0,0 +1,118 @@
package com.tmerclub.cloud.systemtest.data.amount;
import cn.hutool.core.date.DateUtil;
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.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
/**
* @author lpj
*/
public class PreSaleSpuData {
public static SpuDTO getDepositPreSaleSpu(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(8800L);
spuDTO.setPriceFee(priceFee);
spuDTO.setHasSkuImg(0);
spuDTO.setSkuList(getSkuList(priceFee));
spuDTO.setSupplierSpuType(0);
spuDTO.setPreSaleType(1);
spuDTO.setDepositType(1);
spuDTO.setDepositValue(BigDecimal.valueOf(8));
spuDTO.setDepositExpansionValue(BigDecimal.valueOf(18));
spuDTO.setDepositStartTime(DateUtil.parse("2023-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
spuDTO.setDepositEndTime(DateUtil.parse("2026-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
spuDTO.setBalanceStartTime(DateUtil.parse("2023-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
spuDTO.setBalanceEndTime(DateUtil.parse("2026-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
spuDTO.setPreSaleDeliveryType(-1);
spuDTO.setPreSaleDeliveryTime(DateUtil.parse("2026-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
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.setSpuOrigin(0);
return spuDTO;
}
public static SpuDTO getFullPreSaleSpu(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(8800L);
spuDTO.setPriceFee(priceFee);
spuDTO.setHasSkuImg(0);
spuDTO.setSkuList(getSkuList(priceFee));
spuDTO.setSupplierSpuType(0);
spuDTO.setPreSaleType(0);
spuDTO.setPreSaleDeliveryType(2);
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.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(8800L);
skuDTO.setStock(100);
skuDTO.setStatus(1);
skuDTO.setWeight(0.0);
skuDTO.setVolume(0.0);
skuList.add(skuDTO);
return skuList;
}
}

View File

@ -0,0 +1,69 @@
package com.tmerclub.cloud.systemtest.data.marketing;
import cn.hutool.core.date.DateUtil;
import com.tmerclub.cloud.coupon.dto.CouponDTO;
import com.tmerclub.cloud.coupon.vo.CouponVO;
import org.springframework.beans.BeanUtils;
import java.util.List;
/**
* @author lpj
*/
public class CouponData {
/**
* 优惠券数据
* @param putonStatus 状态
* @param getWay 领取方式
* @param couponType 优惠券类型
* @param cashCondition 使用条件
* @param reduceAmount 减免金额
* @param couponDiscount 减免折扣
* @param validTimeType 生效类型
* @param limitNum 每人限领
* @param stocks 库存
* @param suitableProdType 适用商品
* @param spuIds 适用商品id
*/
public static CouponDTO getCouponDTO(Integer putonStatus, Integer getWay, Integer couponType, Long cashCondition, Long reduceAmount, Double couponDiscount,
Integer validTimeType, Integer limitNum, Integer stocks, Integer suitableProdType, List<Long> spuIds) {
CouponDTO couponDTO = new CouponDTO();
couponDTO.setCouponId(0L);
couponDTO.setCouponName("测试自动化优惠券");
couponDTO.setSubTitle(null);
couponDTO.setPutonStatus(putonStatus);
couponDTO.setLaunchTime(null);
couponDTO.setGetWay(getWay);
couponDTO.setCouponType(couponType);
couponDTO.setCashCondition(cashCondition);
couponDTO.setReduceAmount(reduceAmount);
couponDTO.setCouponDiscount(couponDiscount);
couponDTO.setValidTimeType(validTimeType);
couponDTO.setAfterReceiveDays(0);
couponDTO.setValidDays(1);
couponDTO.setStartTime(DateUtil.parse("2023-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
couponDTO.setEndTime(DateUtil.parse("2026-1-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
couponDTO.setLimitNum(limitNum);
couponDTO.setStocks(stocks);
couponDTO.setSuitableProdType(suitableProdType);
couponDTO.setSpuIds(spuIds);
couponDTO.setShopId(null);
couponDTO.setTotalStock(1);
couponDTO.setVersion(null);
couponDTO.setStatus(1);
return couponDTO;
}
/**
* 修改优惠券数据
*/
public static CouponDTO getUpdateCouponDTO(CouponVO couponVO) {
CouponDTO couponDTO = new CouponDTO();
BeanUtils.copyProperties(couponVO, couponDTO);
//修改为投放状态
couponDTO.setPutonStatus(4);
return couponDTO;
}
}

View File

@ -0,0 +1,79 @@
//package com.tmerclub.cloud.systemtest.data.marketing;
//
//import cn.hutool.core.date.DateUtil;
//import com.tmerclub.cloud.live.dto.LiveProdStoreDTO;
//import com.tmerclub.cloud.live.model.LiveProdStore;
//import com.tmerclub.cloud.live.model.LiveRoom;
//import com.moyuer.cloud.systemtest.api.marketing.LiveApi;
//import org.springframework.beans.BeanUtils;
//
///**
// * @author lpj
// */
//public class LiveData {
// /**
// * 直播商品数据
// */
// public static LiveProdStoreDTO getLiveProdStoreDTO(Long prodId, Integer priceType, Double price, Double price2, Integer prodType) {
// LiveProdStoreDTO liveProdStoreDTO = new LiveProdStoreDTO();
// liveProdStoreDTO.setCoverPic("/2023/07/05/e405632be59343a1bb8fa4fff5cf9b16");
// liveProdStoreDTO.setLiveProdStoreId(0L);
// liveProdStoreDTO.setName("直播商品");
// liveProdStoreDTO.setPrice(price);
// liveProdStoreDTO.setPrice2(price2);
// liveProdStoreDTO.setPriceType(priceType);
// liveProdStoreDTO.setProdId(prodId);
// liveProdStoreDTO.setProdType(prodType);
// liveProdStoreDTO.setUrl("pages/detail/detail?spuId=" + prodId);
//
// return liveProdStoreDTO;
// }
//
// /**
// * 修改为价格区间的直播商品更新数据
// */
// public static LiveProdStoreDTO getUpdateLiveProdStoreDTO(LiveProdStore liveProdStore) {
// LiveProdStoreDTO liveProdStoreDTO = new LiveProdStoreDTO();
// BeanUtils.copyProperties(liveProdStore, liveProdStoreDTO);
// liveProdStoreDTO.setPriceType(2);
// liveProdStoreDTO.setPrice2(188.0);
//
// return liveProdStoreDTO;
// }
//
// /**
// * 直播间数据
// */
// public static LiveRoom getLiveRoom() {
// LiveRoom liveRoom = new LiveRoom();
// liveRoom.setAnchorName("直播昵称");
// liveRoom.setAnchorWechat(LiveApi.getLiveUserPage().get(0).getAnchorWechat());
// liveRoom.setApplyTime(null);
// liveRoom.setCoverImg("/2023/07/05/e405632be59343a1bb8fa4fff5cf9b16");
// //每3个月需要修改一次时间
// liveRoom.setStartTime(DateUtil.parse("2023-10-1 00:00:00","yyyy-MM-dd HH:mm:ss"));
// liveRoom.setEndTime(DateUtil.parse("2023-10-2 00:00:00","yyyy-MM-dd HH:mm:ss"));
// liveRoom.setFeedsImg("/2023/07/05/e405632be59343a1bb8fa4fff5cf9b16");
// liveRoom.setId(0L);
// liveRoom.setIsFeedsPublic(1);
// liveRoom.setLiveStatus(null);
// liveRoom.setName("直播间");
// liveRoom.setRoomId(null);
// liveRoom.setRoomTools("{\"closeLike\":0,\"closeGoods\":0,\"closeComment\":0,\"closeReplay\":0,\"closeShare\":1,\"closeKf\":1}");
//
// LiveRoom.RoomToolsVO roomToolsVO = new LiveRoom.RoomToolsVO();
// roomToolsVO.setCloseComment(0);
// roomToolsVO.setCloseGoods(0);
// roomToolsVO.setCloseKf(1);
// roomToolsVO.setCloseLike(0);
// roomToolsVO.setCloseReplay(0);
// roomToolsVO.setCloseShare(1);
// liveRoom.setRoomToolsVo(roomToolsVO);
//
// liveRoom.setScreenType(0);
// liveRoom.setShareImg("/2023/07/05/e405632be59343a1bb8fa4fff5cf9b16");
// liveRoom.setType(0);
//
// return liveRoom;
// }
//}

View File

@ -0,0 +1,56 @@
package com.tmerclub.cloud.systemtest.data.marketing;
import cn.hutool.core.bean.BeanUtil;
import com.tmerclub.cloud.common.product.vo.SkuVO;
import com.tmerclub.cloud.seckill.dto.SeckillCategoryDTO;
import com.tmerclub.cloud.seckill.dto.SeckillDTO;
import com.tmerclub.cloud.seckill.dto.SeckillSkuDTO;
import com.moyuer.cloud.systemtest.api.marketing.SeckillApi;
import com.moyuer.cloud.systemtest.api.store.SkuApi;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author lpj
*/
public class SeckillData {
/**
* 秒杀分类数据
*/
public static SeckillCategoryDTO getSeckillCategoryDTO() {
SeckillCategoryDTO seckillCategoryDTO = new SeckillCategoryDTO();
seckillCategoryDTO.setCategoryId(null);
seckillCategoryDTO.setName("测试秒杀分类" + new Date());
return seckillCategoryDTO;
}
/**
* 秒杀活动数据
*/
public static SeckillDTO getSeckillDTO(Long productId, Long seckillCategoryId, Long startTimestamps) {
SeckillDTO seckillDTO = new SeckillDTO();
seckillDTO.setCategoryId(seckillCategoryId);
seckillDTO.setEndTime(null);
seckillDTO.setMaxNum(10);
seckillDTO.setMaxCancelTime(2);
seckillDTO.setSeckillId(0L);
seckillDTO.setSeckillName("测试秒杀活动");
seckillDTO.setSeckillTag(null);
seckillDTO.setSelectedLot(SeckillApi.getSeckillList().get(1).getSelectedLot());
seckillDTO.setSpuId(productId);
seckillDTO.setStartTime(null);
seckillDTO.setStartTimestamps(startTimestamps);
List<SkuVO> skuList = SkuApi.getAllSkuList(productId);
List<SeckillSkuDTO> skuDtos = skuList.stream().map(i -> BeanUtil.copyProperties(i, SeckillSkuDTO.class)).collect(Collectors.toList());
skuDtos.forEach(i->i.setSeckillPrice(6600L));
skuDtos.forEach(i->i.setSeckillStocks(100));
seckillDTO.setSeckillSkuList(skuDtos);
return seckillDTO;
}
}

View File

@ -0,0 +1,45 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.common.order.vo.OrderVO;
import com.tmerclub.cloud.order.dto.multishop.OrderAdminDTO;
import com.tmerclub.cloud.order.dto.multishop.OrderItemDTO;
import com.moyuer.cloud.systemtest.api.order.OrderApi;
import java.util.List;
/**
* @author Tu
*/
public class OrderAdminDtoData {
public static OrderAdminDTO getOrderAdminDto(Long orderNum, Long changeAmount, Long freightAmount){
OrderAdminDTO orderAdminDTO = new OrderAdminDTO();
orderAdminDTO.setOrderId(orderNum);
orderAdminDTO.setOrderAddrDTO(OrderAddrDtoData.getOrderAddrDTO(orderNum));
OrderVO orderVO = OrderApi.infoOrder(orderNum);
orderAdminDTO.setShopId(orderVO.getShopId());
orderAdminDTO.setFreightAmount(orderVO.getFreightAmount());
List<OrderItemDTO> orderItemDTOList = JSON.parseArray(JSON.toJSONString(orderVO.getOrderItems()), OrderItemDTO.class);
orderItemDTOList.get(0).setChangeAmount(changeAmount);
orderAdminDTO.setFreightAmount(freightAmount);
orderAdminDTO.setOrderItems(orderItemDTOList);
return orderAdminDTO;
}
public static OrderAdminDTO getOrderAdminDto(Long orderNum){
OrderVO orderVO = OrderApi.infoOrder(orderNum);
OrderAdminDTO orderAdminDTO = getOrderAdminDto(orderNum,5100L,orderVO.getFreightAmount());
return orderAdminDTO;
}
/**
* 采购订单
* */
public static OrderAdminDTO getSourcingOrderAdminDto(Long orderNum){
OrderAdminDTO orderAdminDTO = new OrderAdminDTO();
orderAdminDTO.setOrderId(orderNum);
return orderAdminDTO;
}
}

View File

@ -0,0 +1,174 @@
package com.tmerclub.cloud.systemtest.data.order;
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.amount.AddrApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.data.amount.UserAddrDtoData;
import java.util.ArrayList;
import java.util.List;
/**
* @author Tu
*/
public class OrderDtoData {
public static OrderDTO getOrderDtoData(Long spuId) {
OrderDTO orderDTO = new OrderDTO();
Long areaId = 440103L;
Long shopId = ProductApi.getProductInfo(spuId).getShopId();
if (AddrApi.dvyList().isEmpty()) {
AddrApi.addAddr(UserAddrDtoData.getUserAddrDTO());
} else if (!AddrApi.dvyList().get(0).getAreaId().equals(areaId)) {
AddrApi.updateAddr(UserAddrDtoData.getUpdataUserAddrDTO());
}
orderDTO.setAddrId(0L);
orderDTO.setCouponIds(new ArrayList<>());
DvyTypeDTO dvyTypeDTO = new DvyTypeDTO();
dvyTypeDTO.setDvyType(1);
dvyTypeDTO.setShopId(shopId);
ArrayList<DvyTypeDTO> dvyTypeDTOList = new ArrayList<>();
dvyTypeDTOList.add(dvyTypeDTO);
orderDTO.setIsScorePay(0);
orderDTO.setUserChangeCoupon(0);
orderDTO.setUserUseScore(0L);
orderDTO.setDvyTypes(dvyTypeDTOList);
return orderDTO;
}
/**
* 多店铺商品确认订单数据
*/
public static OrderDTO getOrderDtoData(List<Long> shopIds) {
OrderDTO orderDTO = new OrderDTO();
Long areaId = 440103L;
if (AddrApi.dvyList().isEmpty()) {
AddrApi.addAddr(UserAddrDtoData.getUserAddrDTO());
} else if (!AddrApi.dvyList().get(0).getAreaId().equals(areaId)) {
AddrApi.updateAddr(UserAddrDtoData.getUpdataUserAddrDTO());
}
orderDTO.setAddrId(0L);
orderDTO.setCouponIds(new ArrayList<>());
ArrayList<DvyTypeDTO> dvyTypeDTOList = new ArrayList<>();
for (Long shopId : shopIds) {
DvyTypeDTO dvyTypeDTO = new DvyTypeDTO();
dvyTypeDTO.setDvyType(1);
dvyTypeDTO.setShopId(shopId);
dvyTypeDTOList.add(dvyTypeDTO);
}
orderDTO.setIsScorePay(0);
orderDTO.setUserChangeCoupon(0);
orderDTO.setUserUseScore(0L);
orderDTO.setDvyTypes(dvyTypeDTOList);
return orderDTO;
}
/**
*立即购买快递配送
*/
public static OrderDTO getOrderDtoData(Long spuId, Integer count) {
OrderDTO orderDTO = new OrderDTO();
SpuAppVO product = ProductApi.getProductInfo(spuId);
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(0);
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;
}
/**
* 立即购买自提
*/
public static OrderDTO getPickUpOrderDtoData(Long spuId, Integer count) {
OrderDTO orderDTO = new OrderDTO();
SpuAppVO product = ProductApi.getProductInfo(spuId);
if (AddrApi.dvyList().isEmpty()) {
AddrApi.addAddr(UserAddrDtoData.getUserAddrDTO());
}
orderDTO.setAddrId(AddrApi.dvyList().get(0).getAddrId());
orderDTO.setCouponIds(new ArrayList<>());
DvyTypeDTO dvyTypeDTO = new DvyTypeDTO();
dvyTypeDTO.setDvyType(2);
dvyTypeDTO.setShopId(product.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.setCount(count);
shopCartItemDTO.setDistributionUserId(0L);
shopCartItemDTO.setShopId(product.getShopId());
shopCartItemDTO.setSkuId(product.getSkus().get(0).getSkuId());
shopCartItemDTO.setSpuId(spuId);
orderDTO.setShopCartItem(shopCartItemDTO);
return orderDTO;
}
/**
* 立即购买同城
*/
public static OrderDTO getSameCityOrderDtoData(Long spuId, Integer count) {
OrderDTO orderDTO = new OrderDTO();
SpuAppVO product = ProductApi.getProductInfo(spuId);
if (AddrApi.dvyList().isEmpty()) {
AddrApi.addAddr(UserAddrDtoData.getUserAddrDTO());
}
AddrApi.updateAddr(UserAddrDtoData.getUpdateUserAddrDTO(AddrApi.dvyList().get(0).getAddrId()));
orderDTO.setAddrId(AddrApi.dvyList().get(0).getAddrId());
orderDTO.setCouponIds(new ArrayList<>());
DvyTypeDTO dvyTypeDTO = new DvyTypeDTO();
dvyTypeDTO.setDvyType(4);
dvyTypeDTO.setShopId(product.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.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,21 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.order.dto.app.OrderRefundDeliveryDTO;
/**
* @author Tu
*/
public class OrderRefundDeliveryDtoData {
public static OrderRefundDeliveryDTO getOrderRefundDeliveryDTO(Long refundId){
OrderRefundDeliveryDTO orderRefundDeliveryDTO = new OrderRefundDeliveryDTO();
orderRefundDeliveryDTO.setRefundId(refundId);
orderRefundDeliveryDTO.setDeliveryCompanyId(60L);
orderRefundDeliveryDTO.setDeliveryName("申通快递");
orderRefundDeliveryDTO.setDeliveryNo("123123123123");
orderRefundDeliveryDTO.setImgs("");
orderRefundDeliveryDTO.setMobile("13333333333");
orderRefundDeliveryDTO.setSenderRemarks("自动化测试");
return orderRefundDeliveryDTO;
}
}

View File

@ -0,0 +1,15 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.common.order.dto.OrderSelfStationDTO;
/**
* @author lpj
*/
public class OrderSelfStationDtoData {
public static OrderSelfStationDTO getOrderSelfStationDTO(Long orderId, Long stationId) {
OrderSelfStationDTO orderSelfStationDTO = new OrderSelfStationDTO();
orderSelfStationDTO.setOrderId(orderId);
orderSelfStationDTO.setStationId(stationId);
return orderSelfStationDTO;
}
}

View File

@ -0,0 +1,76 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.order.dto.multishop.OrderRefundDTO;
import com.moyuer.cloud.systemtest.api.store.ShopRefundAddrApi;
import com.moyuer.cloud.systemtest.data.store.ShopRefundAddrDtoData;
/**
* @author Tu
*/
public class ShopOrderRefundDtoData {
/**
* 拒绝退款
* **/
public static OrderRefundDTO getRufuseOrderRefundDTO(Long refundId){
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setRefundId(refundId);
orderRefundDTO.setRefundSts(3);
orderRefundDTO.setRejectMessage("自动化测试拒绝退款");
orderRefundDTO.setSupplierHandleStatus(-1);
return orderRefundDTO;
}
/**
* 退货退款第一次同意
* **/
public static OrderRefundDTO getReceiveRefundDTO(Long refundId){
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setRefundId(refundId);
orderRefundDTO.setRefundSts(2);
orderRefundDTO.setSupplierHandleStatus(-1);
if (ShopRefundAddrApi.listShopRefundAddr().isEmpty()){
orderRefundDTO.setShopRefundAddrId(ShopRefundAddrApi.addShopRefundAddr(ShopRefundAddrDtoData.getShopRefundAddrDTO()));
}else {
orderRefundDTO.setShopRefundAddrId(ShopRefundAddrApi.listShopRefundAddr().get(0).getShopRefundAddrId());
}
return orderRefundDTO;
}
/**
* 退货申请用户已发货拒绝退款
* **/
public static OrderRefundDTO getRefuseDeliveryRefundDTO(Long refundId){
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setIsReceived(true);
orderRefundDTO.setRefundId(refundId);
orderRefundDTO.setRefundSts(3);
orderRefundDTO.setRejectMessage("自动化测试拒绝退款");
orderRefundDTO.setSupplierHandleStatus(-1);
return orderRefundDTO;
}
/**
* 同意退货退款第二步
* */
public static OrderRefundDTO getReceiveDeliveryRefundDTO(Long refundId){
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setShopRefundAddrId(ShopRefundAddrApi.listShopRefundAddr().get(0).getShopRefundAddrId());
orderRefundDTO.setRefundId(refundId);
orderRefundDTO.setRefundSts(2);
orderRefundDTO.setRejectMessage("自动化测试同意退货退款");
orderRefundDTO.setSupplierHandleStatus(-1);
orderRefundDTO.setIsReceived(true);
return orderRefundDTO;
}
public static OrderRefundDTO getSupplierRefundDTO(Long refundId){
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setRefundId(refundId);
orderRefundDTO.setRefundSts(4);
orderRefundDTO.setRejectMessage("转移供应商处理");
orderRefundDTO.setSupplierHandleStatus(0);
orderRefundDTO.setIsReceived(false);
return orderRefundDTO;
}
}

View File

@ -0,0 +1,20 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.product.dto.SpuCommDTO;
/**
* @author Tu
*/
public class SpuCommDtoData {
public static SpuCommDTO getSpuCommDtoData(Long orderItemId) {
SpuCommDTO spuCommDTO = new SpuCommDTO();
spuCommDTO.setContent("自动化评价");
spuCommDTO.setEvaluate(0);
spuCommDTO.setIsAnonymous(1);
spuCommDTO.setOrderItemId(orderItemId);
spuCommDTO.setScore(5);
spuCommDTO.setPics("");
return spuCommDTO;
}
}

View File

@ -0,0 +1,85 @@
package com.tmerclub.cloud.systemtest.data.order;
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 com.moyuer.cloud.systemtest.api.amount.AddrApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.order.ShopStationApi;
import com.moyuer.cloud.systemtest.api.order.StationApi;
import com.moyuer.cloud.systemtest.data.store.ShopStationDtoData;
import java.util.ArrayList;
import java.util.List;
/**
* @author Tu
*/
public class SubmitOrderDtoData {
public static SubmitOrderDTO getSubmitOrderDtoData(Long productId) {
SubmitOrderDTO submitOrderDTO = new SubmitOrderDTO();
OrderShopDTO orderShopParam = new OrderShopDTO();
Long shopId = ProductApi.getProductInfo(productId).getShopId();
orderShopParam.setShopId(shopId);
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;
}
/**
* 多店铺订单提交订单
*/
public static SubmitOrderDTO getSubmitOrderDtoData(List<Long> shopIds) {
SubmitOrderDTO submitOrderDTO = new SubmitOrderDTO();
ArrayList<OrderShopDTO> orderShopDTOList = new ArrayList<>();
for(Long shopId : shopIds) {
OrderShopDTO orderShopParam = new OrderShopDTO();
orderShopParam.setShopId(shopId);
orderShopParam.setRemarks("");
orderShopDTOList.add(orderShopParam);
}
submitOrderDTO.setOrderInvoiceList(null);
submitOrderDTO.setOrderSelfStationDto(new OrderSelfStationDTO());
submitOrderDTO.setVirtualRemarkList(new ArrayList<>());
submitOrderDTO.setOrderShopParam(orderShopDTOList);
return submitOrderDTO;
}
/**
* 提交自提订单
*/
public static SubmitOrderDTO getPickUpSubmitOrderDtoData(Long productId) {
SubmitOrderDTO submitOrderDTO = new SubmitOrderDTO();
OrderShopDTO orderShopParam = new OrderShopDTO();
Long shopId = ProductApi.getProductInfo(productId).getShopId();
orderShopParam.setShopId(shopId);
orderShopParam.setRemarks("");
ArrayList<OrderShopDTO> orderShopDTOList = new ArrayList<>();
orderShopDTOList.add(orderShopParam);
submitOrderDTO.setOrderShopParam(orderShopDTOList);
submitOrderDTO.setOrderInvoiceList(null);
submitOrderDTO.setVirtualRemarkList(new ArrayList<>());
OrderSelfStationDTO orderSelfStationDTO = new OrderSelfStationDTO();
if (StationApi.getStationList(shopId).isEmpty()) {
ShopStationApi.addStation(ShopStationDtoData.getStationDTO());
}
orderSelfStationDTO.setStationId(StationApi.getStationList(shopId).get(0).getStationId());
orderSelfStationDTO.setStationUserName(AddrApi.dvyList().get(0).getConsignee());
orderSelfStationDTO.setStationUserMobile(AddrApi.dvyList().get(0).getMobile());
submitOrderDTO.setOrderSelfStationDto(orderSelfStationDTO);
return submitOrderDTO;
}
}

View File

@ -0,0 +1,133 @@
package com.tmerclub.cloud.systemtest.data.order;
import com.tmerclub.cloud.multishop.mongo.MongoShopWalletLogBO;
import com.tmerclub.cloud.order.vo.OrderDetailVO;
import com.tmerclub.cloud.order.vo.OrderItemDetailVO;
import org.testng.Assert;
/**
* @author lpj
*/
public class WalletAssert {
/**
* 商家店铺结算记录验证
* @param mongoShopWalletLogBO 店铺结算记录
* @param amountType 金额类型 0 待结算金额 1 店铺余额 2 冻结金额
* @param shopIoType 收支类型 0 支出 1 收入
* @param shopChangeAmount 改变金额
* @param userAmount 操作金额
* @param platformAmount 平台优惠金额
* @param shopReduceAmount 商家优惠金额
* @param distributionAmount 分销占用金额
* @param shopPlatformCommission 平台佣金
* @param reason 资金变化原因 0 用户支付 1 订单结算 2 用户申请退款成功 4 提现申请 5 提现申请被拒绝 6 提现申请通过 9 扣除订单分销金额
* 11 充值成功 12 扣除订单采购金额 13 商家自行处理采购价差 14 超时未支付尾款
*/
public static void shopWalletLogAssert(MongoShopWalletLogBO mongoShopWalletLogBO, Integer amountType, Integer shopIoType, Long shopChangeAmount, Long userAmount,
Long platformAmount, Long shopReduceAmount, Long distributionAmount, Long shopPlatformCommission, Integer reason) {
//金额类型
Assert.assertEquals(mongoShopWalletLogBO.getAmountType(), amountType);
//收支类型
Assert.assertEquals(mongoShopWalletLogBO.getShopIoType(), shopIoType);
//改变金额
Assert.assertEquals(mongoShopWalletLogBO.getShopChangeAmount(), shopChangeAmount);
//操作金额
Assert.assertEquals(mongoShopWalletLogBO.getUserAmount(), userAmount);
//平台优惠金额
Assert.assertEquals(mongoShopWalletLogBO.getPlatformAmount(), platformAmount);
//商家优惠金额
Assert.assertEquals(mongoShopWalletLogBO.getShopReduceAmount(), shopReduceAmount);
//分销占用金额
Assert.assertEquals(mongoShopWalletLogBO.getDistributionAmount(), distributionAmount);
//平台佣金
Assert.assertEquals(mongoShopWalletLogBO.getShopPlatformCommission(), shopPlatformCommission);
//资金变化原因
Assert.assertEquals(mongoShopWalletLogBO.getReason(), reason);
}
/**
* 商家结算明细数据验证
* @param orderItemDetailVO 店铺结算单条数据
* @param spuTotalAmount 商品总金额
* @param actualTotal 用户支付金额
* @param itemPurchaseAmount 供货价
* @param multiShopReduce 商家优惠金额
* @param platformShareReduce 平台优惠金额
* @param distributionAmount 分销金额
* @param useScore 使用积分
* @param rate 平台分账
* @param platformCommission 平台佣金
* @param scoreAmount 积分抵扣金额
* @param memberAmount 会员折扣金额
* @param platformCouponAmount 平台优惠券优惠金额
* @param shopCouponAmount 店铺优惠券优惠金额
* @param discountAmount 满减优惠金额
* @param seckillAmount 秒杀优惠金额
* @param groupAmount 拼团优惠金额
* @param shopChangeFreeAmount 商家改价金额
* @param refundAmount 退款金额
* @param count 商品数量
* @param refundCount 退款数量
*/
public static void shopOrderDetailAssert(OrderItemDetailVO orderItemDetailVO, Long spuTotalAmount, Long actualTotal, Long itemPurchaseAmount, Long multiShopReduce,
Long platformShareReduce, Long distributionAmount, Long useScore, Double rate, Long platformCommission, Long scoreAmount,
Long memberAmount, Long platformCouponAmount, Long shopCouponAmount, Long discountAmount, Long seckillAmount,
Long groupAmount, Long shopChangeFreeAmount, Long refundAmount, Integer count, Integer refundCount) {
//商品总金额
Assert.assertEquals(orderItemDetailVO.getSpuTotalAmount(), spuTotalAmount);
//用户支付金额
Assert.assertEquals(orderItemDetailVO.getActualTotal(), actualTotal);
//供货价
Assert.assertEquals(orderItemDetailVO.getItemPurchaseAmount(), itemPurchaseAmount);
//商家优惠金额
Assert.assertEquals(orderItemDetailVO.getMultishopReduce(), multiShopReduce);
//平台优惠金额
Assert.assertEquals(orderItemDetailVO.getPlatformShareReduce(), platformShareReduce);
//分销金额
Assert.assertEquals(orderItemDetailVO.getDistributionAmount(), distributionAmount);
//使用积分
Assert.assertEquals(orderItemDetailVO.getUseScore(), useScore);
//平台分账
Assert.assertEquals(orderItemDetailVO.getRate(), rate);
//平台佣金
Assert.assertEquals(orderItemDetailVO.getPlatformCommission(), platformCommission);
//积分抵扣金额
Assert.assertEquals(orderItemDetailVO.getScoreAmount(), scoreAmount);
//会员折扣金额
Assert.assertEquals(orderItemDetailVO.getMemberAmount(), memberAmount);
//平台优惠券优惠金额
Assert.assertEquals(orderItemDetailVO.getPlatformCouponAmount(), platformCouponAmount);
//店铺优惠券优惠金额
Assert.assertEquals(orderItemDetailVO.getShopCouponAmount(), shopCouponAmount);
//满减优惠金额
Assert.assertEquals(orderItemDetailVO.getDiscountAmount(),discountAmount);
//秒杀优惠金额
Assert.assertEquals(orderItemDetailVO.getSeckillAmount(), seckillAmount);
//拼团优惠金额
Assert.assertEquals(orderItemDetailVO.getGroupAmount(), groupAmount);
//商家改价金额
Assert.assertEquals(orderItemDetailVO.getShopChangeFreeAmount(), shopChangeFreeAmount);
//退款金额
Assert.assertEquals(orderItemDetailVO.getRefundAmount(), refundAmount);
//商品数量
Assert.assertEquals(orderItemDetailVO.getCount(), count);
//退款数量
Assert.assertEquals(orderItemDetailVO.getRefundCount(), refundCount);
}
/**
* 商家订单运费验证
* @param orderDetailVO 订单结算明细
* @param freightAmount 订单运费
* @param freeFreightAmount 商家减免运费
* @param platformFreeFreightAmount 平台减免运费
*/
public static void shopOrderFreightAssert(OrderDetailVO orderDetailVO, Long freightAmount, Long freeFreightAmount, Long platformFreeFreightAmount) {
//订单运费
Assert.assertEquals(orderDetailVO.getFreightAmount(), freightAmount);
//商家减免运费
Assert.assertEquals(orderDetailVO.getFreeFreightAmount(), freeFreightAmount);
//平台减免运费
Assert.assertEquals(orderDetailVO.getPlatformFreeFreightAmount(), platformFreeFreightAmount);
}
}

View File

@ -0,0 +1,63 @@
package com.tmerclub.cloud.systemtest.data.platform;
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.platform.ScoreOrderApi;
import java.util.ArrayList;
import java.util.List;
/**
* @author lpj
*/
public class DeliveryScoreOrderDtoData {
/**
* 积分订单快递发货数据
*/
public static DeliveryOrderDTO getDeliveryScoreOrderDtoData(Long orderNum) {
DeliveryOrderDTO deliveryOrderDTO = new DeliveryOrderDTO();
deliveryOrderDTO.setOrderId(orderNum);
deliveryOrderDTO.setOrderAddrId(orderNum);
deliveryOrderDTO.setDeliveryCompanyId(16L);
deliveryOrderDTO.setDeliveryNo("123456789");
deliveryOrderDTO.setDeliveryType(1);
OrderItemVO orderItem = ScoreOrderApi.getScoreOrderItemAndAddress(orderNum).getOrderItems().get(0);
OrderVO address = ScoreOrderApi.getScoreOrderItemAndAddress(orderNum);
List<DeliveryOrderItemDTO> deliveryOrderItemDTOList = new ArrayList<>();
DeliveryOrderItemDTO deliveryOrderItemDTO = new DeliveryOrderItemDTO();
deliveryOrderDTO.setDeliveryOrderId(orderItem.getOrderItemId());
deliveryOrderItemDTO.setOrderItemId(orderItem.getOrderItemId());
deliveryOrderItemDTO.setChangeNum(1);
deliveryOrderItemDTOList.add(deliveryOrderItemDTO);
deliveryOrderDTO.setSelectOrderItems(deliveryOrderItemDTOList);
deliveryOrderDTO.setOrderAddrId(address.getOrderAddrId());
return deliveryOrderDTO;
}
/**
* 积分订单无需快递发货数据
*/
public static DeliveryOrderDTO getNoDeliveryScoreOrderDtoData(Long orderNum) {
DeliveryOrderDTO deliveryOrderDTO = new DeliveryOrderDTO();
deliveryOrderDTO.setOrderId(orderNum);
deliveryOrderDTO.setOrderAddrId(orderNum);
deliveryOrderDTO.setDeliveryType(3);
List<DeliveryOrderItemDTO> deliveryOrderItemDTOList = new ArrayList<>();
DeliveryOrderItemDTO deliveryOrderItemDTO = new DeliveryOrderItemDTO();
OrderItemVO orderItem = ScoreOrderApi.getScoreOrderItemAndAddress(orderNum).getOrderItems().get(0);
OrderVO address = ScoreOrderApi.getScoreOrderItemAndAddress(orderNum);
deliveryOrderDTO.setDeliveryOrderId(orderItem.getOrderItemId());
deliveryOrderItemDTO.setOrderItemId(orderItem.getOrderItemId());
deliveryOrderItemDTO.setChangeNum(1);
deliveryOrderItemDTOList.add(deliveryOrderItemDTO);
deliveryOrderDTO.setSelectOrderItems(deliveryOrderItemDTOList);
deliveryOrderDTO.setOrderAddrId(address.getOrderAddrId());
return deliveryOrderDTO;
}
}

View File

@ -0,0 +1,31 @@
package com.tmerclub.cloud.systemtest.data.platform;
import cn.hutool.core.bean.BeanUtil;
import com.moyuer.cloud.systemtest.api.platform.UserLevelApi;
import com.tmerclub.cloud.user.dto.UserLevelDTO;
import com.tmerclub.cloud.user.dto.UserLevelTermDTO;
import com.tmerclub.cloud.user.vo.UserLevelTermVO;
import com.tmerclub.cloud.user.vo.UserLevelVO;
import org.springframework.beans.BeanUtils;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author lpj
*/
public class UserLevelDtoData {
public static UserLevelDTO getUserLevelDTO(Long userLevelId, List<Long> userRightsIds) {
UserLevelVO userLevelVO = UserLevelApi.info(userLevelId);
UserLevelDTO userLevelDTO = new UserLevelDTO();
BeanUtils.copyProperties(userLevelVO, userLevelDTO);
List<UserLevelTermVO> userLevelTerms = userLevelVO.getUserLevelTerms();
List<UserLevelTermDTO> userLevelTermDTOList = userLevelTerms.stream().map(i -> BeanUtil.copyProperties(i, UserLevelTermDTO.class)).collect(Collectors.toList());
userLevelDTO.setUserLevelTerms(userLevelTermDTOList);
userLevelDTO.setUserRightsIds(userRightsIds);
return userLevelDTO;
}
}

View File

@ -0,0 +1,54 @@
package com.tmerclub.cloud.systemtest.data.platform;
import com.tmerclub.cloud.user.dto.UserRightsDTO;
import java.util.ArrayList;
/**
* @author lpj
*/
public class UserRightsDtoData {
/**
* 平台打8折
*/
public static UserRightsDTO getDiscounttUserRightsDTO(Integer discount) {
UserRightsDTO userRightsDTO = new UserRightsDTO();
userRightsDTO.setCouponIds(new ArrayList<>());
userRightsDTO.setDescription("自动化打8折");
userRightsDTO.setDetails("<p>自动化打8折</p>");
userRightsDTO.setDiscount(discount);
userRightsDTO.setDiscountRange(0);
userRightsDTO.setFreeFeeType(2);
userRightsDTO.setIcon("/test.png");
userRightsDTO.setPresScore(0L);
userRightsDTO.setRateScore(0);
userRightsDTO.setRightsId(null);
userRightsDTO.setRightsName("自动化打8折");
userRightsDTO.setRightsType(4);
userRightsDTO.setSeq(1);
return userRightsDTO;
}
/**
* 平台包邮
*/
public static UserRightsDTO getFreeFeeUserRightsDTO() {
UserRightsDTO userRightsDTO = new UserRightsDTO();
userRightsDTO.setCouponIds(new ArrayList<>());
userRightsDTO.setDescription("平台包邮");
userRightsDTO.setDetails("<p>平台包邮</p>");
userRightsDTO.setDiscount(null);
userRightsDTO.setDiscountRange(0);
userRightsDTO.setFreeFeeType(1);
userRightsDTO.setIcon("/test.png");
userRightsDTO.setPresScore(0L);
userRightsDTO.setRateScore(0);
userRightsDTO.setRightsId(null);
userRightsDTO.setRightsName("平台包邮");
userRightsDTO.setRightsType(5);
userRightsDTO.setSeq(1);
return userRightsDTO;
}
}

View File

@ -0,0 +1,58 @@
package com.tmerclub.cloud.systemtest.data.store;
import com.tmerclub.cloud.common.bean.BmapPoint;
import com.moyuer.cloud.delivery.dto.SameCityDTO;
import com.moyuer.cloud.systemtest.api.store.SameCityApi;
import java.util.ArrayList;
import java.util.List;
/**
* @author lpj
*/
public class SameCityDtoData {
public static SameCityDTO getSameCityDTO() {
SameCityDTO sameCityDTO = new SameCityDTO();
sameCityDTO.setChargeType(1);
sameCityDTO.setDefaultDistance(0.0);
sameCityDTO.setDeliveryFee(100L);
sameCityDTO.setFreeWeight(1.0);
sameCityDTO.setLat(22.943853);
sameCityDTO.setLng(113.390465);
sameCityDTO.setOverDistance(0.0);
sameCityDTO.setOverDistanceFee(0L);
sameCityDTO.setOverWeight(1.0);
sameCityDTO.setOverWeightFee(100L);
sameCityDTO.setPositionInfo(null);
sameCityDTO.setSamecityId(SameCityApi.getSameCityInfo().getSamecityId());
sameCityDTO.setShopId(SameCityApi.getSameCityInfo().getShopId());
sameCityDTO.setStartFee(1L);
sameCityDTO.setStatus(1);
List<BmapPoint> polygonPath = new ArrayList<>();
BmapPoint upperLeft = new BmapPoint();
upperLeft.setLat(22.760551);
upperLeft.setLng(113.199306);
polygonPath.add(upperLeft);
BmapPoint upperRight = new BmapPoint();
upperRight.setLat(22.755218);
upperRight.setLng(113.541955);
polygonPath.add(upperRight);
BmapPoint lowerLeft = new BmapPoint();
lowerLeft.setLat(23.096059);
lowerLeft.setLng(113.573001);
polygonPath.add(lowerLeft);
BmapPoint lowerRight = new BmapPoint();
lowerRight.setLat(23.06095);
lowerRight.setLng(113.161361);
polygonPath.add(lowerRight);
sameCityDTO.setPolygonPath(polygonPath);
sameCityDTO.setPositionInfo("[{\"lat\":0.068656,\"lng\":44.169773},{\"lat\":40.685259,\"lng\":147.930527},{\"lat\":54.342124,\"lng\":166.916358},{\"lat\":53.909883,\"lng\":82.436151}]");
return sameCityDTO;
}
}

View File

@ -0,0 +1,28 @@
package com.tmerclub.cloud.systemtest.data.store;
import com.moyuer.cloud.delivery.dto.StationDTO;
/**
* @author lpj
*/
public class ShopStationDtoData {
public static StationDTO getStationDTO() {
StationDTO stationDTO = new StationDTO();
stationDTO.setAddr("清河东路319号");
stationDTO.setArea("番禺区");
stationDTO.setAreaId(440113L);
stationDTO.setCity("广州市");
stationDTO.setCityId(4401L);
stationDTO.setLat(22.93772);
stationDTO.setLng(113.39424);
stationDTO.setMobile("18888888888");
stationDTO.setProvince("广东省");
stationDTO.setProvinceId(44L);
stationDTO.setStationId(0L);
stationDTO.setStationName("自动化测试门店");
stationDTO.setStatus(1);
stationDTO.setTimeInfo("{\"shopTime\":[1580515200000,1580558400000]}");
return stationDTO;
}
}

View File

@ -0,0 +1,19 @@
package com.tmerclub.cloud.systemtest.data.store;
import com.tmerclub.cloud.product.dto.SpuPageSearchDTO;
import java.util.List;
/**
* @author lpj
*/
public class SpuPageSearchDtoData {
public static SpuPageSearchDTO getSpuPageSearchDTO(Long productId, List<Long> productIds, Integer status) {
SpuPageSearchDTO spuPageSearchDTO = new SpuPageSearchDTO();
spuPageSearchDTO.setSpuId(productId);
spuPageSearchDTO.setSpuIds(productIds);
spuPageSearchDTO.setStatus(status);
return spuPageSearchDTO;
}
}

View File

@ -0,0 +1,57 @@
package com.tmerclub.cloud.systemtest.data.supplier;
import com.tmerclub.cloud.order.dto.multishop.OrderRefundDTO;
import com.moyuer.cloud.systemtest.api.store.ShopRefundAddrApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierRefundAddrApi;
/**
* @author Tu
*/
public class SupplierOrderRefundDtoData {
public static OrderRefundDTO getRufuseOrderRefundDTO(Long refundId){
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setRefundId(refundId);
orderRefundDTO.setRefundSts(3);
orderRefundDTO.setRejectMessage("自动化测试拒绝退款");
orderRefundDTO.setSupplierHandleStatus(2);
return orderRefundDTO;
}
/**
* 接受退货退款申请
* */
public static OrderRefundDTO getSupplierReceiveRefundDTO(Long refundId){
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setRefundId(refundId);
orderRefundDTO.setRefundSts(2);
orderRefundDTO.setSupplierHandleStatus(1);
if (SupplierRefundAddrApi.listSupplierRefundAddr().isEmpty()){
orderRefundDTO.setShopRefundAddrId(SupplierRefundAddrApi.addSupplierRefundAddr(SupplierRefundAddrDtoData.getSupplierRefundAddrDTO()));
}else {
orderRefundDTO.setShopRefundAddrId(SupplierRefundAddrApi.listSupplierRefundAddr().get(0).getSupplierRefundAddrId());
}
return orderRefundDTO;
}
public static OrderRefundDTO getRefuseDeliveryRefundDTO(Long refundId){
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setIsReceived(true);
orderRefundDTO.setRefundId(refundId);
orderRefundDTO.setRefundSts(3);
orderRefundDTO.setRejectMessage("自动化测试拒绝退货退款");
orderRefundDTO.setSupplierHandleStatus(2);
return orderRefundDTO;
}
public static OrderRefundDTO getReceiveDeliveryRefundDTO(Long refundId){
OrderRefundDTO orderRefundDTO = new OrderRefundDTO();
orderRefundDTO.setShopRefundAddrId(ShopRefundAddrApi.listShopRefundAddr().get(0).getShopRefundAddrId());
orderRefundDTO.setRefundId(refundId);
orderRefundDTO.setRefundSts(2);
orderRefundDTO.setRejectMessage("自动化测试同意退货退款");
orderRefundDTO.setSupplierHandleStatus(1);
orderRefundDTO.setIsReceived(true);
return orderRefundDTO;
}
}

View File

@ -0,0 +1,122 @@
package com.tmerclub.cloud.systemtest.data.supplier;
import com.alibaba.fastjson2.JSON;
import com.tmerclub.cloud.api.product.dto.CategoryShopDTO;
import com.tmerclub.cloud.common.product.dto.SkuDTO;
import com.tmerclub.cloud.common.product.dto.SpuDTO;
import com.tmerclub.cloud.common.product.vo.SpuVO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.product.dto.SpuPageSearchDTO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.store.ShopSubstituteSalesApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierProductApi;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.platform.CategoryDtoData;
import com.moyuer.cloud.systemtest.data.store.ShopSubstituteSalesDtoData;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* @author Tu
*/
public class SupplierProductData {
private static final Integer SUPPLIER_DELIVERY = 1;
private static final Integer SHOP_DELIVERY = 2;
/**
* 供应商发布商品
* @param supplyPrice 供货价
* @param deliverTemplateId 运费模板id
* @param isMainSupplier 是否是主供应商supplier_token
*/
public static Long getSupplierProductId(Long supplyPrice, Long deliverTemplateId, Boolean isMainSupplier) {
List<CategoryAppVO> supplierCategoryList = CategoryApi.listSupplierCategory(isMainSupplier);
if (supplierCategoryList.size() == 0) {
CategoryApi.addSupplierCategory(getCategoryShopDtoList(CategoryApi.listSupplierApplyCategory(isMainSupplier).get(0).getCategoryId()), isMainSupplier);
}
Long categoryId = CategoryApi.listSupplierCategory(isMainSupplier).get(0).getCategoryId();
double deductionRateTemp = 1.99;
if (CategoryApi.getCategoryInfo(categoryId).getDeductionRate() != deductionRateTemp) {
CategoryApi.update(CategoryDtoData.getCategoryDTO(categoryId));
}
return SupplierProductApi.createProduct(SpuData.getSupplierSpu(categoryId, deliverTemplateId, supplyPrice), isMainSupplier);
}
/**
* 商家代销供应商商品
* @param supplierProductId 供应商商品id
* @param priceFee 销售价
* @param supplierDeliveryType 发货方式 1 供应商发货 2 商家发货
* @param deliverTemplateId 商家发货时运费模板id
* @param isMainSupplier 是否是主供应商的商品supplier_token
* @param isMainShop 是否是主商家 :shop_token
*/
public static Long getProductId(Long supplierProductId, Long priceFee, Integer supplierDeliveryType, Long deliverTemplateId, Boolean isMainSupplier, Boolean isMainShop) {
//修改代销设置为手动设置直接转为待采购订单
ShopSubstituteSalesApi.updateShopSubstituteSales(ShopSubstituteSalesDtoData.getShopSubstituteSalesDTO(1, 0, null, 0), true);
//如果商家端没有签约即将发布商品的分类则签约
Long categoryId = SupplierProductApi.info(supplierProductId, isMainSupplier).getCategoryId();
List<CategoryAppVO> categoryAppVOList = CategoryApi.listSigningCategory(isMainShop);
List<Long> collect = categoryAppVOList.stream().map(CategoryAppVO::getCategoryId).toList();
if(!collect.contains(categoryId)) {
CategoryApi.addSigningCategory(getCategoryShopDtoList(categoryId), isMainShop);
}
Object obj = ProductApi.addSupplierProduct(Collections.singletonList(supplierProductId), isMainShop).get(0);
Long productId;
if (obj instanceof Integer) {
Integer ob = (Integer) obj;
productId = ob.longValue();
} else {
productId = (Long) obj;
}
SpuVO spuVO = ProductApi.info(productId, isMainShop);
SpuDTO spuDTO = JSON.parseObject(JSON.toJSONString(spuVO), SpuDTO.class);
List<SkuDTO> skuDTOList = JSON.parseArray(JSON.toJSONString(spuVO.getSkus()), SkuDTO.class);
if (supplierDeliveryType.equals(SUPPLIER_DELIVERY) && ShopSubstituteSalesApi.getShopSubstituteSales().getSalesType().equals(0)) {
spuDTO.setSkuList(skuDTOList);
}
if (supplierDeliveryType.equals(SUPPLIER_DELIVERY) && ShopSubstituteSalesApi.getShopSubstituteSales().getSalesType().equals(1)) {
skuDTOList.forEach(i->i.setPriceFee(priceFee));
spuDTO.setSkuList(skuDTOList);
}
if (supplierDeliveryType.equals(SHOP_DELIVERY)) {
skuDTOList.forEach(i->i.setPriceFee(priceFee));
skuDTOList.forEach(i->i.setStock(100));
skuDTOList.forEach(i->i.setChangeStock(100));
spuDTO.setSkuList(skuDTOList);
}
spuDTO.setSkuList(skuDTOList);
Long shopCategoryId = CategoryApi.listShopCategory(isMainShop).get(1).getCategoryId();
spuDTO.setShopCategoryId(shopCategoryId);
spuDTO.setPriceFee(priceFee);
spuDTO.setSupplierDeliveryType(supplierDeliveryType);
if (supplierDeliveryType.equals(SHOP_DELIVERY)) {
spuDTO.setDeliveryTemplateId(deliverTemplateId);
}
ProductApi.update(spuDTO, isMainShop);
ProductApi.onlineProduct(getSpuPageSearchDTO(productId), isMainShop);
return productId;
}
public static List<CategoryShopDTO> getCategoryShopDtoList(Long categoryId) {
List<CategoryShopDTO> categoryShopDTOList= new ArrayList<>();
CategoryShopDTO categoryShopDTO = new CategoryShopDTO();
categoryShopDTO.setCategoryId(categoryId);
categoryShopDTO.setQualifications(null);
categoryShopDTOList.add(categoryShopDTO);
return categoryShopDTOList;
}
public static SpuPageSearchDTO getSpuPageSearchDTO(Long productId) {
SpuPageSearchDTO spuPageSearchDTO = new SpuPageSearchDTO();
// spuPageSearchDTO.setIsCommission(1);
spuPageSearchDTO.setSpuId(productId);
spuPageSearchDTO.setStatus(1);
return spuPageSearchDTO;
}
}

View File

@ -0,0 +1,24 @@
package com.tmerclub.cloud.systemtest.data.supplier;
import com.tmerclub.cloud.supplier.dto.SupplierRefundAddrDTO;
/**
* @author Tu
*/
public class SupplierRefundAddrDtoData {
public static SupplierRefundAddrDTO getSupplierRefundAddrDTO(){
SupplierRefundAddrDTO supplierRefundAddrDTO = new SupplierRefundAddrDTO();
supplierRefundAddrDTO.setAddr("自动化测试地址");
supplierRefundAddrDTO.setArea("天河区");
supplierRefundAddrDTO.setCity("广州市");
supplierRefundAddrDTO.setCityId(4401L);
supplierRefundAddrDTO.setIsDefault(0);
supplierRefundAddrDTO.setMobile("12345678901");
supplierRefundAddrDTO.setAreaId(440106L);
supplierRefundAddrDTO.setProvince("广东省");
supplierRefundAddrDTO.setProvinceId(44L);
supplierRefundAddrDTO.setConsignee("自动化测试收货人");
supplierRefundAddrDTO.setSupplierRefundAddrId(0L);
return supplierRefundAddrDTO;
}
}

View File

@ -0,0 +1,199 @@
package com.tmerclub.cloud.systemtest.test.amount;
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.MyOrderApi;
import com.moyuer.cloud.systemtest.api.order.ShopCartApi;
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.OrderDtoData;
import com.moyuer.cloud.systemtest.data.order.ShopCartData;
import com.moyuer.cloud.systemtest.data.order.SubmitOrderDtoData;
import com.moyuer.cloud.systemtest.data.platform.CategoryDtoData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import org.testng.Assert;
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 FreightTest {
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 sameProductsFreightWithCount() {
//运费模板-首件2运费10续件1运费5
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 2D, 1000L, 1D, 500L, 0, null, null, null), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
sameProductFreight(transportId);
}
@Test(description = "按件计算运费,购买多件不同商品,运费是否正确")
public void differentProductsFreightWithCount() {
//运费模板-首件2运费10续件1运费5
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 2D, 1000L, 1D, 500L, 0, null, null, null), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
differentProducts(transportId);
}
@Test(description = "按重量计算运费,购买多件相同商品,运费是否正确")
public void sameProductsFreightWithWeight() {
//运费模板-首千克2运费10续件1运费5
TransportApi.addTransport(DeliveryData.getTransportDTO(1, 2D, 1000L, 1D, 500L, 0, null, null, null), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
sameProductFreight(transportId);
}
@Test(description = "按重量计算运费,购买多件不同商品,运费是否正确")
public void differentProductsFreightWithWeight() {
//运费模板-首千克2运费10续件1运费5
TransportApi.addTransport(DeliveryData.getTransportDTO(1, 2D, 1000L, 1D, 500L, 0, null, null, null), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
differentProducts(transportId);
}
@Test(description = "按体积计算运费,购买多件相同商品,运费是否正确")
public void sameProductsFreightWithVolume() {
//运费模板-首立方2运费10续件1运费5
TransportApi.addTransport(DeliveryData.getTransportDTO(2, 2D, 1000L, 1D, 500L, 0, null, null, null), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
sameProductFreight(transportId);
}
@Test(description = "按体积计算运费,购买多件不同商品,运费是否正确")
public void differentProductsFreightWithVolume() {
//运费模板-首立方2运费10续件1运费5
TransportApi.addTransport(DeliveryData.getTransportDTO(2, 2D, 1000L, 1D, 500L, 0, null, null, null), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
differentProducts(transportId);
}
@Test(description = "同一运费模板,不同商品,运费是否正确")
public void differentProductsWithSameTransport() {
List<Long> categoryIds = getCategoryId(true);
//运费模板-首件2运费10续件1运费5
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 2D, 1000L, 1D, 500L, 0, null, null, null), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
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, 10000L), true);
//第一笔订单购买2件不同的商品
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productIdB, true);
ProductApi.delete(productIdA, true);
TransportApi.deleteTransport(transportId, true);
//验证订单运费是否正确
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 1000);
}
@Test(description = "多商品多运费模板,运费是否正确")
public void differentProductsWithDifferentTransport() throws InterruptedException {
List<Long> categoryIds = getCategoryId(true);
//运费模板-首件2运费10续件1运费5
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 2D, 1000L, 1D, 500L, 0, null, null, null), true);
Long transportIdA = TransportApi.infoTransport(true).get(0).getTransportId();
Long productIdA = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportIdA, 10000L), true);
//运费模板2-首件2运费10续件1运费5
TimeUnit.SECONDS.sleep(2L);
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 2D, 1000L, 1D, 500L, 0, null, null, null), true);
Long transportIdB = TransportApi.infoTransport(true).get(0).getTransportId();
Long productIdB = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportIdB, 10000L), true);
//第一笔订单购买2件不同的商品
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productIdB, true);
TransportApi.deleteTransport(transportIdB, true);
ProductApi.delete(productIdA, true);
TransportApi.deleteTransport(transportIdA, true);
//验证订单运费是否正确
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 2000);
}
private static void sameProductFreight(Long transportId) {
List<Long> categoryIds = getCategoryId(true);
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 10000L), true);
//第一笔订单购买1件商品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNumFirst = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumFirst);
//第二笔订单购买2件商品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 2));
Long orderNumSec = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumSec);
//第三笔订单购买3件商品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 3));
Long orderNumThird = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNumThird);
ProductApi.delete(productId, true);
TransportApi.deleteTransport(transportId, true);
//第一笔订单运费验证
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, true).getFreightAmount(), 1000);
//第二笔订单运费验证
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, true).getFreightAmount(), 1000);
//第三笔订单运费验证
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumThird, true).getFreightAmount(), 1500);
}
private static void differentProducts(Long transportId) {
List<Long> categoryIds = getCategoryId(true);
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, 10000L), true);
Long productIdC = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 10000L), true);
//第一笔订单购买2件不同的商品
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
Long orderNumFirst = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNumFirst);
//第一笔订单购买3件不同的商品
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdC));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
Long orderNumSec = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNumSec);
ProductApi.delete(productIdC, true);
ProductApi.delete(productIdB, true);
ProductApi.delete(productIdA, true);
TransportApi.deleteTransport(transportId, true);
//第一笔订单运费验证
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumFirst, true).getFreightAmount(), 1000);
//第二笔订单运费验证
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumSec, true).getFreightAmount(), 1500);
}
}

View File

@ -0,0 +1,89 @@
package com.tmerclub.cloud.systemtest.test.amount;
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.login.UserApi;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
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.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.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.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @author lpj
*/
public class MemberAmountTest {
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 memberAmountTest() {
List<Long> categoryIds = getCategoryId(true);
Long transportId = DeliveryData.getFreeFeeDelivery(true);
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 7337L), true);
//新增打8折权益
Long discountUserRightsId = UserRightsApi.save(UserRightsDtoData.getDiscounttUserRightsDTO(70));
//用户会员等级添加包邮和打8折权益
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Collections.singletonList(discountUserRightsId)));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
UserRightsApi.delete(discountUserRightsId);
ProductApi.delete(productId, true);
//验证数据
WalletAssert.shopWalletLogAssert(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).get(0), 0, 1, 7191L, 5136L, 2201L, 0L, 0L, 146L, 0);
OrderDetailVO orderDetailVO = ShopWalletApi.getOrderDetailVO(orderNum, true);
WalletAssert.shopOrderDetailAssert(orderDetailVO.getOrderItemDetailList().get(0), 7337L, 5136L, 0L, 0L, 2201L, 0L, 0L, 1.99, 146L,
0L, 2201L, 0L, 0L, 0L, null, null, 0L, null, 1, null);
}
@Test(description = "商品金额为小数额,会员折扣优惠金额数据是否正确")
public void minPriceMemberAmountTest() {
List<Long> categoryIds = getCategoryId(true);
Long transportId = DeliveryData.getFreeFeeDelivery(true);
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 1L), true);
//新增打8折权益
Long discountUserRightsId = UserRightsApi.save(UserRightsDtoData.getDiscounttUserRightsDTO(10));
//用户会员等级添加包邮和打8折权益
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Collections.singletonList(discountUserRightsId)));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
UserRightsApi.delete(discountUserRightsId);
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);
}
}

View File

@ -0,0 +1,97 @@
package com.tmerclub.cloud.systemtest.test.marketing;
import com.tmerclub.cloud.combo.vo.ComboVO;
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.marketing.ComboApi;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
import com.moyuer.cloud.systemtest.api.order.OrderApi;
import com.moyuer.cloud.systemtest.api.store.ShopWalletApi;
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.ComboData;
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.List;
import java.util.concurrent.TimeUnit;
/**
* @author lpj
*/
public class ComboTest {
@DataProvider(name = "productProvider")
private Object[][] productProvider() {
List<CategoryAppVO> categoryAppVOList = CategoryApi.listShopCategory(true);
Long shopCategoryId = categoryAppVOList.get(categoryAppVOList.size() - 1).getCategoryId();
Long categoryId = CategoryApi.listSigningCategory(true).get(0).getCategoryId();
Long mainProductId = ProductApi.createProduct(SpuData.getRealSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
Long realProductId = ProductApi.createProduct(SpuData.getRealSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
Long virtualProductId = ProductApi.createProduct(SpuData.getUnRealSpu(categoryId,shopCategoryId,8800L, 1), true);
Long fullPreSaleProductId = ProductApi.createProduct(PreSaleSpuData.getFullPreSaleSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
Long supplierProductId = SupplierProductData.getSupplierProductId(6600L, DeliveryData.getSupplierFreeFeeDelivery(true), true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8800L, 1, null, true, true);
return new Object[][]{{mainProductId, Arrays.asList(realProductId, virtualProductId, fullPreSaleProductId, productId), supplierProductId}};
}
@Test(description = "套餐基本流程", dataProvider = "productProvider")
public void comboFlow(Long mainProductId, List<Long> matchingProductIds, Long supplierProductId) throws InterruptedException {
//新增套餐
ComboApi.save(ComboData.getComboDTO(mainProductId, matchingProductIds));
//获取套餐id
Long comboId = ComboApi.getComboPage().get(0).getComboId();
//购买套餐
MyOrderApi.confirm(ComboData.getComboOrderDTO(comboId, 2));
//提交订单获取订单id
TimeUnit.SECONDS.sleep(2L);
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(mainProductId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//获取套餐信息
ComboVO comboVO = ComboApi.getComboInfo(comboId);
//修改套餐信息去掉搭配商品
ComboApi.update(ComboData.getUpdateComboDTO(comboVO));
//失效套餐
ComboApi.updateComboStatus(ComboData.getUpdateStatusData(comboId, 0));
//删除套餐
ComboApi.updateComboStatus(ComboData.getUpdateStatusData(comboId, -1));
//删除商品
ProductApi.delete(mainProductId, true);
for (Long matchingProductId : matchingProductIds) {
ProductApi.delete(matchingProductId, true);
}
SupplierProductApi.delete(supplierProductId, true);
//对订单进行退款并验证数据是否正确
for (Long orderNumber : orderNumberList) {
if (OrderApi.infoOrder(orderNumber).getSupplierDeliveryType().equals(1)){
Long refundId = OrderRefund.supplierOrderRefund(orderNumber);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(1L);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumber, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumber, refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 26400);
}else if (MyOrderApi.orderDetail(orderNumber).getOrderMold().equals(0)) {
Long refundId = OrderRefund.realOrderRefund(orderNumber);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(1L);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumber, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumber, refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 26400);
} else {
Long refundId = OrderRefund.virtualOrderRefund(orderNumber);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(1L);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumber, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumber, refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 26400);
}
}
}
}

View File

@ -0,0 +1,493 @@
package com.tmerclub.cloud.systemtest.test.marketing;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
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.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.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.CouponData;
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.Collections;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @author lpj
*/
public class CouponTest {
@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 shopCouponFlow(Long productId) throws InterruptedException {
//新建代金券
List<Long> productIds = Collections.singletonList(productId);
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 1, productIds));
//获取优惠券id
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);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
TimeUnit.SECONDS.sleep(1L);
//用户删除领取的优惠券
CouponApi.deleteUserCoupon(CouponApi.getUserCouponPage().get(0).getCouponUserId());
//平台违规下架活动
CouponApi.offline(OfflineHandleEventDtoData.getOfflineHandleEventDTO(null, couponId, "违规下架原因", null, null, null));
//申请上架审核失败
//商家根据活动id获取下架信息
OfflineHandleEventVO offlineHandleEventVO = CouponApi.shopGetOfflineHandleEvent(couponId);
//商家申请上架
CouponApi.apply(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = CouponApi.platformGetOfflineHandleEvent(couponId);
//平台审核失败
CouponApi.audit(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, "审核失败原因", 4));
//申请上架审核成功
//商家根据活动id获取下架信息
offlineHandleEventVO = CouponApi.shopGetOfflineHandleEvent(couponId);
//商家申请上架
CouponApi.apply(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = CouponApi.platformGetOfflineHandleEvent(couponId);
//平台审核成功
CouponApi.audit(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, null, 3));
//根据优惠券id获取优惠券信息
CouponVO couponVO = CouponApi.getShopCouponInfo(couponId);
//修改优惠券为暂不投放
CouponApi.updateShopCoupon(CouponData.getUpdateCouponDTO(couponVO));
//删除店铺代金券
CouponApi.deleteShopCoupon(couponId);
//新建商家发放折扣券-全部商品适用
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 1, 2, 1000L, null, 8.33, 1, 10, 100, 0, null));
//获取优惠券id
couponId = CouponApi.getShopCouponPage().get(0).getCouponId();
//删除店铺折扣券
CouponApi.deleteShopCoupon(couponId);
//删除商品
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).getShopCouponAmount(), 300);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 8500);
}
@Test(description = "虚拟商品参与店铺优惠券完整流程", dataProvider = "virtualProduct")
public void shopCouponFlowWithVirtualProduct(Long productId) throws InterruptedException {
//新建代金券
List<Long> productIds = Collections.singletonList(productId);
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 1, productIds));
//获取优惠券id
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);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = OrderRefund.virtualOrderRefund(orderNumberList.get(0));
TimeUnit.SECONDS.sleep(1L);
//用户删除领取的优惠券
CouponApi.deleteUserCoupon(CouponApi.getUserCouponPage().get(0).getCouponUserId());
//根据优惠券id获取优惠券信息
CouponVO couponVO = CouponApi.getShopCouponInfo(couponId);
//修改优惠券为暂不投放
CouponApi.updateShopCoupon(CouponData.getUpdateCouponDTO(couponVO));
//删除店铺代金券
CouponApi.deleteShopCoupon(couponId);
//删除商品
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).getShopCouponAmount(), 300);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 8500);
}
@Test(description = "全款预售商品参与店铺优惠券完整流程", dataProvider = "fullPreSaleProduct")
public void shopCouponFlowWithFullPreSaleProduct(Long productId) throws InterruptedException {
//新建代金券
List<Long> productIds = Collections.singletonList(productId);
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 1, productIds));
//获取优惠券id
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);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
TimeUnit.SECONDS.sleep(1L);
//用户删除领取的优惠券
CouponApi.deleteUserCoupon(CouponApi.getUserCouponPage().get(0).getCouponUserId());
//根据优惠券id获取优惠券信息
CouponVO couponVO = CouponApi.getShopCouponInfo(couponId);
//修改优惠券为暂不投放
CouponApi.updateShopCoupon(CouponData.getUpdateCouponDTO(couponVO));
//删除店铺代金券
CouponApi.deleteShopCoupon(couponId);
//删除商品
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).getShopCouponAmount(), 300);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 8500);
}
@Test(description = "定金预售商品参与店铺优惠券完整流程", dataProvider = "depositPreSaleProduct")
public void shopCouponFlowWithDepositPreSaleProduct(Long productId) throws InterruptedException {
//新建代金券
List<Long> productIds = Collections.singletonList(productId);
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 1, productIds));
//获取优惠券id
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);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付定金
PayApi.orderPay(orderNumberList);
//根据订单id支付尾款
TimeUnit.SECONDS.sleep(2L);
PayApi.orderPayBalance(orderNumberList.get(0));
//对订单进行退款
TimeUnit.SECONDS.sleep(2L);
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
TimeUnit.SECONDS.sleep(1L);
//用户删除领取的优惠券
CouponApi.deleteUserCoupon(CouponApi.getUserCouponPage().get(0).getCouponUserId());
//根据优惠券id获取优惠券信息
CouponVO couponVO = CouponApi.getShopCouponInfo(couponId);
//修改优惠券为暂不投放
CouponApi.updateShopCoupon(CouponData.getUpdateCouponDTO(couponVO));
//删除店铺代金券
CouponApi.deleteShopCoupon(couponId);
//删除商品
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).getShopCouponAmount(), 300);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 7500);
}
@Test(description = "供应商发货的供应商商品参与店铺优惠券完整流程", dataProvider = "supplierProduct")
public void shopCouponFlowWithSupplierProduct(Long productId, Long supplierProductId) throws InterruptedException {
//新建代金券
List<Long> productIds = Collections.singletonList(productId);
CouponApi.saveShopCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 1, productIds));
//获取优惠券id
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);
//用户提交订单
TimeUnit.SECONDS.sleep(2L);
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
TimeUnit.SECONDS.sleep(2L);
Long refundId = OrderRefund.supplierOrderRefund(orderNumberList.get(0));
TimeUnit.SECONDS.sleep(1L);
//用户删除领取的优惠券
CouponApi.deleteUserCoupon(CouponApi.getUserCouponPage().get(0).getCouponUserId());
//根据优惠券id获取优惠券信息
CouponVO couponVO = CouponApi.getShopCouponInfo(couponId);
//修改优惠券为暂不投放
CouponApi.updateShopCoupon(CouponData.getUpdateCouponDTO(couponVO));
//删除店铺代金券
CouponApi.deleteShopCoupon(couponId);
//删除商品
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).getShopCouponAmount(), 300);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 8500);
}
/**
* 平台优惠券基本流程
*/
@Test(description = "平台优惠券基本流程", dataProvider = "realProduct")
public void platformCouponFlow(Long productId) throws InterruptedException {
List<Long> productIds = Collections.singletonList(productId);
//新建平台代金券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 0, productIds));
//获取优惠券id
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);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
//根据优惠券id获取优惠券信息
CouponVO couponVO = CouponApi.getPlatformCouponInfo(couponId);
//修改优惠券为暂不投放
CouponApi.updatePlatformCoupon(CouponData.getUpdateCouponDTO(couponVO));
//删除平台代金券券
CouponApi.deletePlatformCoupon(couponId);
//新建平台发放的折扣券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 1, 2, 1000L, null, 8.33, 1, 10, 100, 0, null));
//获取优惠券id
couponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//删除平台折扣券
CouponApi.deletePlatformCoupon(couponId);
//删除商品
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).getPlatformCouponAmount(), 300);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 8500);
}
@Test(description = "虚拟商品参与平台优惠券", dataProvider = "virtualProduct")
public void platformCouponFlowWithVirtualProduct(Long productId) throws InterruptedException {
List<Long> productIds = Collections.singletonList(productId);
//新建平台代金券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 0, productIds));
//获取优惠券id
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);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = OrderRefund.virtualOrderRefund(orderNumberList.get(0));
//根据优惠券id获取优惠券信息
CouponVO couponVO = CouponApi.getPlatformCouponInfo(couponId);
//修改优惠券为暂不投放
CouponApi.updatePlatformCoupon(CouponData.getUpdateCouponDTO(couponVO));
//删除平台代金券券
CouponApi.deletePlatformCoupon(couponId);
//新建平台发放的折扣券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 1, 2, 1000L, null, 8.33, 1, 10, 100, 0, null));
//获取优惠券id
couponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//删除平台折扣券
CouponApi.deletePlatformCoupon(couponId);
//删除商品
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).getPlatformCouponAmount(), 300);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 8500);
}
@Test(description = "全款预售商品参与平台优惠券", dataProvider = "fullPreSaleProduct")
public void platformCouponFlowWithFullPreSaleProduct(Long productId) throws InterruptedException {
List<Long> productIds = Collections.singletonList(productId);
//新建平台代金券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 0, productIds));
//获取优惠券id
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);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
//根据优惠券id获取优惠券信息
CouponVO couponVO = CouponApi.getPlatformCouponInfo(couponId);
//修改优惠券为暂不投放
CouponApi.updatePlatformCoupon(CouponData.getUpdateCouponDTO(couponVO));
//删除平台代金券券
CouponApi.deletePlatformCoupon(couponId);
//新建平台发放的折扣券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 1, 2, 1000L, null, 8.33, 1, 10, 100, 0, null));
//获取优惠券id
couponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//删除平台折扣券
CouponApi.deletePlatformCoupon(couponId);
//删除商品
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).getPlatformCouponAmount(), 300);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 8500);
}
@Test(description = "定金预售商品参与平台优惠券", dataProvider = "depositPreSaleProduct")
public void platformCouponFlowDepositPreSaleProductProduct(Long productId) throws InterruptedException {
List<Long> productIds = Collections.singletonList(productId);
//新建平台代金券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 0, productIds));
//获取优惠券id
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);
//用户提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
TimeUnit.SECONDS.sleep(2L);
//根据订单id支付订单尾款
PayApi.orderPayBalance(orderNumberList.get(0));
//对订单进行退款
TimeUnit.SECONDS.sleep(2L);
Long refundId = OrderRefund.realOrderRefund(orderNumberList.get(0));
//根据优惠券id获取优惠券信息
CouponVO couponVO = CouponApi.getPlatformCouponInfo(couponId);
//修改优惠券为暂不投放
CouponApi.updatePlatformCoupon(CouponData.getUpdateCouponDTO(couponVO));
//删除平台代金券券
CouponApi.deletePlatformCoupon(couponId);
//新建平台发放的折扣券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 1, 2, 1000L, null, 8.33, 1, 10, 100, 0, null));
//获取优惠券id
couponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//删除平台折扣券
CouponApi.deletePlatformCoupon(couponId);
//删除商品
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).getPlatformCouponAmount(), 300);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 7500);
}
@Test(description = "供应商发货的供应商商品参与平台优惠券", dataProvider = "supplierProduct")
public void platformCouponFlowWithSupplierProduct(Long productId, Long supplierProductId) throws InterruptedException {
List<Long> productIds = Collections.singletonList(productId);
//新建平台代金券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 0, 1, 1000L, 300L, null, 2, 10, 100, 0, productIds));
//获取优惠券id
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);
//用户提交订单
TimeUnit.SECONDS.sleep(2L);
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = OrderRefund.supplierOrderRefund(orderNumberList.get(0));
//根据优惠券id获取优惠券信息
CouponVO couponVO = CouponApi.getPlatformCouponInfo(couponId);
//修改优惠券为暂不投放
CouponApi.updatePlatformCoupon(CouponData.getUpdateCouponDTO(couponVO));
//删除平台代金券券
CouponApi.deletePlatformCoupon(couponId);
//新建平台发放的折扣券
CouponApi.savePlatformCoupon(CouponData.getCouponDTO(1, 1, 2, 1000L, null, 8.33, 1, 10, 100, 0, null));
//获取优惠券id
couponId = CouponApi.getPlatformCouponPage().get(0).getCouponId();
//删除平台折扣券
CouponApi.deletePlatformCoupon(couponId);
//删除商品
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).getPlatformCouponAmount(), 300);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 8500);
}
}

View File

@ -0,0 +1,137 @@
package com.tmerclub.cloud.systemtest.test.marketing;
import com.tmerclub.cloud.api.distribution.vo.DistributionSpuVO;
import com.tmerclub.cloud.api.platform.vo.OfflineHandleEventVO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.marketing.DistributionProdApi;
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.DistributionProdData;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import com.moyuer.cloud.systemtest.data.supplier.SupplierProductData;
import org.springframework.beans.BeanUtils;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.List;
import java.util.concurrent.TimeUnit;
/**
* @author lpj
*/
public class DistributionProdTest {
@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 realDistributionProdFlow(Long productId) throws InterruptedException {
distributionProdFlow(productId);
}
@Test(description = "虚拟分销商品基本流程", dataProvider = "virtualProduct")
public void virtualDistributionProdFlow(Long productId) throws InterruptedException {
distributionProdFlow(productId);
}
@Test(description = "全款预售分销商品基本流程", dataProvider = "fullPreSaleProduct")
public void fullPreSaleDistributionProdFlow(Long productId) throws InterruptedException {
distributionProdFlow(productId);
}
@Test(description = "定金预售分销商品基本流程", dataProvider = "depositPreSaleProduct")
public void depositPreSaleDistributionProdFlow(Long productId) throws InterruptedException {
distributionProdFlow(productId);
}
@Test(description = "供应商发货的供应商分销商品基本流程", dataProvider = "supplierProduct")
public void supplierDistributionProdFlow(Long productId, Long supplierProductId) throws InterruptedException {
distributionProdFlow(productId);
SupplierProductApi.delete(supplierProductId, true);
}
/**
* 分销商品基本流程
*/
private void distributionProdFlow(Long productId) throws InterruptedException {
//新增分销商品
DistributionProdApi.save(DistributionProdData.getDistributionSpuDTO(productId, 0, 2000L, 0, 1000L, 1), true);
//等待保存
TimeUnit.SECONDS.sleep(2L);
//获取分销商品id
Long distributionProdId = DistributionProdApi.getDistributionProdPage(true).get(0).getDistributionInfo().getDistributionSpuId();
//获取分销商品详情
DistributionSpuVO distributionProdVO = new DistributionSpuVO();
BeanUtils.copyProperties(DistributionProdApi.getDistributionProdPage(true).get(0).getDistributionInfo(), distributionProdVO);
distributionProdVO.setSpuId(productId);
//修改分销商品
DistributionProdApi.update(DistributionProdData.getUpdateDistributionSpuDTO(distributionProdVO));
//平台违规下架活动
DistributionProdApi.offline(OfflineHandleEventDtoData.getOfflineHandleEventDTO(null, distributionProdId, "违规下架原因", null, null, null));
//申请上架审核失败
//商家根据活动id获取下架信息
OfflineHandleEventVO offlineHandleEventVO = DistributionProdApi.shopGetOfflineHandleEvent(distributionProdId);
//商家申请上架
DistributionProdApi.apply(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = DistributionProdApi.platformGetOfflineHandleEvent(distributionProdId);
//平台审核失败
DistributionProdApi.audit(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, "审核失败原因", 4));
//申请上架审核成功
//商家根据活动id获取下架信息
offlineHandleEventVO = DistributionProdApi.shopGetOfflineHandleEvent(distributionProdId);
//商家申请上架
DistributionProdApi.apply(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = DistributionProdApi.platformGetOfflineHandleEvent(distributionProdId);
//平台审核成功
DistributionProdApi.audit(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, null, 3));
//删除分销商品
DistributionProdApi.delete(distributionProdId, true);
//删除商品
ProductApi.delete(productId, true);
}
}

View File

@ -0,0 +1,213 @@
package com.tmerclub.cloud.systemtest.test.marketing;
import com.tmerclub.cloud.common.product.vo.GiveawayVO;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.order.vo.OrderItemDetailVO;
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.GiveawayApi;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
import com.moyuer.cloud.systemtest.api.order.OrderApi;
import com.moyuer.cloud.systemtest.api.order.OrderRefundApi;
import com.moyuer.cloud.systemtest.api.order.ShopOrderRefundApi;
import com.moyuer.cloud.systemtest.api.store.ShopWalletApi;
import com.moyuer.cloud.systemtest.data.amount.PreSaleSpuData;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.marketing.GiveawayData;
import com.moyuer.cloud.systemtest.data.order.*;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
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;
/**
* @author lpj
*/
public class GiveawayTest {
@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 mainProductId = ProductApi.createProduct(SpuData.getRealSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
Long matchingProductId = ProductApi.createProduct(SpuData.getRealSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
return new Object[][]{{mainProductId, Collections.singletonList(matchingProductId)}};
}
@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 mainProductId = ProductApi.createProduct(PreSaleSpuData.getFullPreSaleSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
Long matchingProductId = ProductApi.createProduct(SpuData.getRealSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
return new Object[][]{{mainProductId, Collections.singletonList(matchingProductId)}};
}
@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 mainProductId = ProductApi.createProduct(PreSaleSpuData.getDepositPreSaleSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
Long matchingProductId = ProductApi.createProduct(SpuData.getRealSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(true),8800L), true);
return new Object[][]{{mainProductId, Collections.singletonList(matchingProductId)}};
}
@Test(description = "实物商品作为主商品的赠品活动基本流程", dataProvider = "realProduct")
public void giveawayFlowWithRealProduct(Long mainProductId, List<Long> matchingProductIds) throws InterruptedException {
//新增赠品活动
GiveawayApi.save(GiveawayData.getGiveawayDTO(mainProductId, matchingProductIds));
//获取赠品活动id
Long giveawayId = GiveawayApi.getGiveawayPage().get(0).getGiveawayId();
//获取赠品活动信息
GiveawayVO giveawayVO = GiveawayApi.getGiveawayInfo(giveawayId);
//修改赠品活动信息
GiveawayApi.update(GiveawayData.getUpdateGiveawayDTO(giveawayVO));
//购买五件主商品赠送赠品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(mainProductId, 5));
//提交订单获取订单id
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(mainProductId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = realOrderRefund(orderNumberList.get(0));
//失效赠品活动
GiveawayApi.updateGiveawayStatus(0, giveawayId);
//删除赠品活动
GiveawayApi.updateGiveawayStatus(-1, giveawayId);
//删除商品
ProductApi.delete(mainProductId, true);
for (Long matchingProductId : matchingProductIds) {
ProductApi.delete(matchingProductId, true);
}
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 3);
for (OrderItemDetailVO orderItemDetailVO : ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList()) {
if (orderItemDetailVO.getCount().equals(5)) {
Assert.assertEquals(orderItemDetailVO.getActualTotal(), 44000);
Assert.assertEquals(orderItemDetailVO.getRefundAmount(), 42900);
}
}
}
@Test(description = "全款预售商品作为主商品的赠品活动基本流程", dataProvider = "fullPreSaleProduct")
public void giveawayFlowWithFullPreSaleProduct(Long mainProductId, List<Long> matchingProductIds) throws InterruptedException {
//新增赠品活动
GiveawayApi.save(GiveawayData.getGiveawayDTO(mainProductId, matchingProductIds));
//获取赠品活动id
Long giveawayId = GiveawayApi.getGiveawayPage().get(0).getGiveawayId();
//获取赠品活动信息
GiveawayVO giveawayVO = GiveawayApi.getGiveawayInfo(giveawayId);
//修改赠品活动信息
GiveawayApi.update(GiveawayData.getUpdateGiveawayDTO(giveawayVO));
//购买五件主商品赠送赠品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(mainProductId, 5));
//提交订单获取订单id
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(mainProductId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//对订单进行退款
Long refundId = realOrderRefund(orderNumberList.get(0));
//失效赠品活动
GiveawayApi.updateGiveawayStatus(0, giveawayId);
//删除赠品活动
GiveawayApi.updateGiveawayStatus(-1, giveawayId);
//删除商品
ProductApi.delete(mainProductId, true);
for (Long matchingProductId : matchingProductIds) {
ProductApi.delete(matchingProductId, true);
}
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 3);
for (OrderItemDetailVO orderItemDetailVO : ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList()) {
if (orderItemDetailVO.getCount().equals(5)) {
Assert.assertEquals(orderItemDetailVO.getActualTotal(), 44000);
Assert.assertEquals(orderItemDetailVO.getRefundAmount(), 42900);
}
}
}
@Test(description = "定金预售商品作为主商品的赠品活动基本流程", dataProvider = "depositPreSaleProduct")
public void giveawayFlowWithDepositProduct(Long mainProductId, List<Long> matchingProductIds) throws InterruptedException {
//新增赠品活动
GiveawayApi.save(GiveawayData.getGiveawayDTO(mainProductId, matchingProductIds));
//获取赠品活动id
Long giveawayId = GiveawayApi.getGiveawayPage().get(0).getGiveawayId();
//获取赠品活动信息
GiveawayVO giveawayVO = GiveawayApi.getGiveawayInfo(giveawayId);
//修改赠品活动信息
GiveawayApi.update(GiveawayData.getUpdateGiveawayDTO(giveawayVO));
//购买五件主商品赠送赠品
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(mainProductId, 5));
//提交订单获取订单id
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(mainProductId));
//根据订单id支付订单
PayApi.orderPay(orderNumberList);
//根据订单id支付尾款
TimeUnit.SECONDS.sleep(1L);
PayApi.orderPayBalance(orderNumberList.get(0));
//对订单进行退款
Long refundId = realOrderRefund(orderNumberList.get(0));
//失效赠品活动
GiveawayApi.updateGiveawayStatus(0, giveawayId);
//删除赠品活动
GiveawayApi.updateGiveawayStatus(-1, giveawayId);
//删除商品
ProductApi.delete(mainProductId, true);
for (Long matchingProductId : matchingProductIds) {
ProductApi.delete(matchingProductId, true);
}
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberList.get(0), true).size(), 3);
for (OrderItemDetailVO orderItemDetailVO : ShopWalletApi.getOrderDetailVO(orderNumberList.get(0), refundId, true).getOrderItemDetailList()) {
if (orderItemDetailVO.getCount().equals(5)) {
Assert.assertEquals(orderItemDetailVO.getActualTotal(), 39000);
Assert.assertEquals(orderItemDetailVO.getRefundAmount(), 37900);
}
}
}
private static Long realOrderRefund(Long orderNum) throws InterruptedException {
//申请第一次退款部分退款 等待保存
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.getOrderRefundDtoRemoveGiveaway(orderNum));
ShopOrderRefundApi.infoByRefundSn(refundIdFirth);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundIdFirth));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundIdFirth));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdFirth));
return refundIdFirth;
}
}

View File

@ -0,0 +1,293 @@
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.common.product.vo.app.SpuAppVO;
import com.moyuer.cloud.group.dto.GroupActivityDTO;
import com.moyuer.cloud.group.vo.GroupActivityVO;
import com.moyuer.cloud.group.vo.app.AppGroupTeamVO;
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.GroupApi;
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.GroupData;
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.List;
import java.util.concurrent.TimeUnit;
/**
* @author lpj
*/
public class GroupTest {
@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 groupFlowWithRealProduct(Long productId) throws InterruptedException {
//新建拼团活动
GroupApi.save(GroupData.getGroupActivityDTO(productId));
//获取拼团活动id
Long groupActivityId = GroupApi.getGroupActivityPage().get(0).getGroupActivityId();
//根据id获取拼团活动信息
GroupActivityVO groupActivityVO = GroupApi.getGroupActivity(groupActivityId);
//修改信息后更新拼团活动
GroupApi.updateGroupActivity(GroupData.getUpdateGroupActivityDTO(groupActivityVO));
//平台违规下架活动
GroupApi.offline(OfflineHandleEventDtoData.getOfflineHandleEventDTO(null, groupActivityId, "违规下架原因", null, null, null));
//申请上架审核失败
//商家根据活动id获取下架信息
OfflineHandleEventVO offlineHandleEventVO = GroupApi.shopGetOfflineHandleEvent(groupActivityId);
//商家申请上架
GroupApi.applyGroupActivity(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = GroupApi.platformGetOfflineHandleEvent(groupActivityId);
//平台审核失败
GroupApi.auditGroupActivity(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, "审核失败原因", 4));
//申请上架审核成功
//商家根据活动id获取下架信息
offlineHandleEventVO = GroupApi.shopGetOfflineHandleEvent(groupActivityId);
//商家申请上架
GroupApi.applyGroupActivity(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = GroupApi.platformGetOfflineHandleEvent(groupActivityId);
//平台审核成功
GroupApi.auditGroupActivity(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, null, 3));
//商家启用活动
GroupActivityDTO groupActivityDTO = new GroupActivityDTO();
groupActivityDTO.setGroupActivityId(groupActivityId);
GroupApi.activeGroupActivity(groupActivityDTO);
//获取商品详情
SpuAppVO productInfo = ProductApi.getProductInfo(productId);
//获取店铺id
Long shopId = productInfo.getShopId();
//用户A开团
GroupApi.openGroup(GroupData.getGroupOrderDTO(productId, 1));
//用户A提交订单获取订单id
List<Long> orderNumberListA = GroupApi.submitGroupOrder(GroupData.getSubmitGroupOrderDTO(0L, shopId));
//根据订单id支付订单
PayApi.orderPay(orderNumberListA);
//等待保存
TimeUnit.SECONDS.sleep(2L);
//获取可参团列表
List<AppGroupTeamVO> joinGroupList = JSON.parseArray(GroupApi.getJoinGroupList(groupActivityId).toString(), AppGroupTeamVO.class);
//获取团队id
Long groupTeamId = joinGroupList.get(0).getGroupTeamId();
//用户B参团
GroupApi.joinGroup(GroupData.getGroupOrderDTO(productId, 1));
//用户A提交订单获取订单id
List<Long> orderNumberListB = GroupApi.submitJoinGroupOrder(GroupData.getSubmitGroupOrderDTO(groupTeamId, shopId));
//根据订单id支付订单
PayApi.orderPay(orderNumberListB);
//用户A对订单进行退款
TimeUnit.SECONDS.sleep(2L);
Long refundId = OrderRefund.realOrderRefund(orderNumberListA.get(0));
//商家失效活动
GroupApi.invalidActivity(groupActivityDTO);
//删除拼团活动
GroupApi.deleteGroupActivity(groupActivityId);
//删除商品
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberListA.get(0), true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberListA.get(0), true).getOrderItemDetailList().get(0).getGroupAmount(), 2200);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberListA.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 6600);
}
@Test(description = "虚拟商品拼团活动基本流程", dataProvider = "virtualProduct")
public void groupFlowWithVirtualProduct(Long productId) throws InterruptedException {
//新建拼团活动
GroupApi.save(GroupData.getGroupActivityDTO(productId));
//获取拼团活动id
Long groupActivityId = GroupApi.getGroupActivityPage().get(0).getGroupActivityId();
//根据id获取拼团活动信息
GroupActivityVO groupActivityVO = GroupApi.getGroupActivity(groupActivityId);
//修改信息后更新拼团活动
GroupApi.updateGroupActivity(GroupData.getUpdateGroupActivityDTO(groupActivityVO));
//商家启用活动
GroupActivityDTO groupActivityDTO = new GroupActivityDTO();
groupActivityDTO.setGroupActivityId(groupActivityId);
GroupApi.activeGroupActivity(groupActivityDTO);
//获取商品详情
SpuAppVO productInfo = ProductApi.getProductInfo(productId);
//获取店铺id
Long shopId = productInfo.getShopId();
//用户A开团
GroupApi.openGroup(GroupData.getGroupOrderDTO(productId, 1));
//用户A提交订单获取订单id
List<Long> orderNumberListA = GroupApi.submitGroupOrder(GroupData.getSubmitGroupOrderDTO(0L, shopId));
//根据订单id支付订单
PayApi.orderPay(orderNumberListA);
//等待保存
TimeUnit.SECONDS.sleep(2L);
//获取可参团列表
List<AppGroupTeamVO> joinGroupList = JSON.parseArray(GroupApi.getJoinGroupList(groupActivityId).toString(), AppGroupTeamVO.class);
//获取团队id
Long groupTeamId = joinGroupList.get(0).getGroupTeamId();
//用户B参团
GroupApi.joinGroup(GroupData.getGroupOrderDTO(productId, 1));
//用户A提交订单获取订单id
List<Long> orderNumberListB = GroupApi.submitJoinGroupOrder(GroupData.getSubmitGroupOrderDTO(groupTeamId, shopId));
//根据订单id支付订单
PayApi.orderPay(orderNumberListB);
//用户A对订单进行退款
TimeUnit.SECONDS.sleep(2L);
Long refundId = OrderRefund.virtualOrderRefund(orderNumberListA.get(0));
//商家失效活动
GroupApi.invalidActivity(groupActivityDTO);
//删除拼团活动
GroupApi.deleteGroupActivity(groupActivityId);
//删除商品
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberListA.get(0), true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberListA.get(0), true).getOrderItemDetailList().get(0).getGroupAmount(), 2200);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberListA.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 6600);
}
@Test(description = "全款预售商品拼团活动基本流程", dataProvider = "fullPreSaleProduct")
public void groupFlowWithFullPreSaleProduct(Long productId) throws InterruptedException {
//新建拼团活动
GroupApi.save(GroupData.getGroupActivityDTO(productId));
//获取拼团活动id
Long groupActivityId = GroupApi.getGroupActivityPage().get(0).getGroupActivityId();
//根据id获取拼团活动信息
GroupActivityVO groupActivityVO = GroupApi.getGroupActivity(groupActivityId);
//修改信息后更新拼团活动
GroupApi.updateGroupActivity(GroupData.getUpdateGroupActivityDTO(groupActivityVO));
//商家启用活动
GroupActivityDTO groupActivityDTO = new GroupActivityDTO();
groupActivityDTO.setGroupActivityId(groupActivityId);
GroupApi.activeGroupActivity(groupActivityDTO);
//获取商品详情
SpuAppVO productInfo = ProductApi.getProductInfo(productId);
//获取店铺id
Long shopId = productInfo.getShopId();
//用户A开团
GroupApi.openGroup(GroupData.getGroupOrderDTO(productId, 1));
//用户A提交订单获取订单id
List<Long> orderNumberListA = GroupApi.submitGroupOrder(GroupData.getSubmitGroupOrderDTO(0L, shopId));
//根据订单id支付订单
PayApi.orderPay(orderNumberListA);
//等待保存
TimeUnit.SECONDS.sleep(2L);
//获取可参团列表
List<AppGroupTeamVO> joinGroupList = JSON.parseArray(GroupApi.getJoinGroupList(groupActivityId).toString(), AppGroupTeamVO.class);
//获取团队id
Long groupTeamId = joinGroupList.get(0).getGroupTeamId();
//用户B参团
GroupApi.joinGroup(GroupData.getGroupOrderDTO(productId, 1));
//用户A提交订单获取订单id
List<Long> orderNumberListB = GroupApi.submitJoinGroupOrder(GroupData.getSubmitGroupOrderDTO(groupTeamId, shopId));
//根据订单id支付订单
PayApi.orderPay(orderNumberListB);
//用户A对订单进行退款
TimeUnit.SECONDS.sleep(2L);
Long refundId = OrderRefund.virtualOrderRefund(orderNumberListA.get(0));
//商家失效活动
GroupApi.invalidActivity(groupActivityDTO);
//删除拼团活动
GroupApi.deleteGroupActivity(groupActivityId);
//删除商品
ProductApi.delete(productId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberListA.get(0), true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberListA.get(0), true).getOrderItemDetailList().get(0).getGroupAmount(), 2200);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberListA.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 6600);
}
@Test(description = "供应商发货的供应商商品拼团活动基本流程", dataProvider = "supplierProduct")
public void groupFlowWithSupplierProduct(Long productId, Long supplierProductId) throws InterruptedException {
//新建拼团活动
GroupApi.save(GroupData.getGroupActivityDTO(productId));
//获取拼团活动id
Long groupActivityId = GroupApi.getGroupActivityPage().get(0).getGroupActivityId();
//根据id获取拼团活动信息
GroupActivityVO groupActivityVO = GroupApi.getGroupActivity(groupActivityId);
//修改信息后更新拼团活动
GroupApi.updateGroupActivity(GroupData.getUpdateGroupActivityDTO(groupActivityVO));
//商家启用活动
GroupActivityDTO groupActivityDTO = new GroupActivityDTO();
groupActivityDTO.setGroupActivityId(groupActivityId);
GroupApi.activeGroupActivity(groupActivityDTO);
//获取商品详情
SpuAppVO productInfo = ProductApi.getProductInfo(productId);
//获取店铺id
Long shopId = productInfo.getShopId();
//用户A开团
GroupApi.openGroup(GroupData.getGroupOrderDTO(productId, 1));
//用户A提交订单获取订单id
TimeUnit.SECONDS.sleep(2L);
List<Long> orderNumberListA = GroupApi.submitGroupOrder(GroupData.getSubmitGroupOrderDTO(0L, shopId));
//根据订单id支付订单
PayApi.orderPay(orderNumberListA);
//等待保存
TimeUnit.SECONDS.sleep(2L);
//获取可参团列表
List<AppGroupTeamVO> joinGroupList = JSON.parseArray(GroupApi.getJoinGroupList(groupActivityId).toString(), AppGroupTeamVO.class);
//获取团队id
Long groupTeamId = joinGroupList.get(0).getGroupTeamId();
//用户B参团
GroupApi.joinGroup(GroupData.getGroupOrderDTO(productId, 1));
//用户A提交订单获取订单id
List<Long> orderNumberListB = GroupApi.submitJoinGroupOrder(GroupData.getSubmitGroupOrderDTO(groupTeamId, shopId));
//根据订单id支付订单
PayApi.orderPay(orderNumberListB);
//用户A对订单进行退款
TimeUnit.SECONDS.sleep(2L);
Long refundId = OrderRefund.supplierOrderRefund(orderNumberListA.get(0));
//商家失效活动
GroupApi.invalidActivity(groupActivityDTO);
//删除拼团活动
GroupApi.deleteGroupActivity(groupActivityId);
//删除商品
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
//验证运行后数据是否正确
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNumberListA.get(0), true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberListA.get(0), true).getOrderItemDetailList().get(0).getSupplyPriceFee(), 6600);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberListA.get(0), true).getOrderItemDetailList().get(0).getGroupAmount(), 2200);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNumberListA.get(0), refundId, true).getOrderItemDetailList().get(0).getRefundAmount(), 6600);
}
}

View File

@ -0,0 +1,56 @@
//package com.tmerclub.cloud.systemtest.test.marketing;
//
//import com.tmerclub.cloud.live.model.LiveProdStore;
//import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
//import com.moyuer.cloud.systemtest.api.amount.ProductApi;
//import com.moyuer.cloud.systemtest.api.marketing.LiveApi;
//import com.moyuer.cloud.systemtest.data.amount.SpuData;
//import com.moyuer.cloud.systemtest.data.marketing.LiveData;
//import com.moyuer.cloud.systemtest.data.store.DeliveryData;
//import org.testng.annotations.Test;
//
///**
// * @author lpj
// */
//public class LiveTest {
// /**
// * 直播商品基本流程
// */
// @Test(description = "直播商品基本流程")
// public void liveProdStoreFlow() {
// //新建实物商品作为直播商品
// Long shopCategoryId = CategoryApi.listShopCategory().get(CategoryApi.listShopCategory().size()-1).getCategoryId();
// Long categoryId = CategoryApi.listSigningCategory().get(0).getCategoryId();
// Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryId,shopCategoryId, DeliveryData.getFreeFeeDelivery(),8800L));
//
// //新增直播商品
// LiveApi.saveLiveProdStore(LiveData.getLiveProdStoreDTO(productId, 1, 88.0, 0.0, 0));
// //获取直播商品id
// Long liveProdStoreId = LiveApi.getLiveProdStorePage().get(0).getLiveProdStoreId();
// //获取直播商品信息
// LiveProdStore liveProdStore = LiveApi.getLiveProdStore(liveProdStoreId);
// //修改直播商品的价格类型为价格区间
// LiveApi.updateLiveProdStore(LiveData.getUpdateLiveProdStoreDTO(liveProdStore));
//
// //提交审核
// LiveApi.submitVerify(liveProdStore);
//
// //删除直播商品
// LiveApi.deleteLiveProdStore(liveProdStoreId);
// //删除商品
// ProductApi.delete(productId);
// }
//
// /**
// * 直播间基本流程
// */
// @Test(description = "直播间基本流程")
// public void liveRoomFlow() {
// //新增直播间
// LiveApi.saveLiveRoom(LiveData.getLiveRoom());
// //获取直播间id
// Long liveRoomId = LiveApi.getLiveRoomPage().get(0).getId();
// //删除直播间
// LiveApi.deleteLiveRoom(liveRoomId);
// }
//}

View File

@ -0,0 +1,72 @@
package com.tmerclub.cloud.systemtest.test.marketing;
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 com.moyuer.cloud.systemtest.api.order.OrderRefundApi;
import com.moyuer.cloud.systemtest.api.order.ShopOrderRefundApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierOrderApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierRefundApi;
import com.moyuer.cloud.systemtest.data.order.DeliveryOrderDtoData;
import com.moyuer.cloud.systemtest.data.order.OrderRefundDeliveryDtoData;
import com.moyuer.cloud.systemtest.data.order.OrderRefundDtoData;
import com.moyuer.cloud.systemtest.data.order.ShopOrderRefundDtoData;
import com.moyuer.cloud.systemtest.data.supplier.SupplierOrderRefundDtoData;
import java.util.concurrent.TimeUnit;
/**
* @author lpj
*/
public class OrderRefund {
/**
* 商家发货的实物订单退款
*/
public static Long realOrderRefund(Long orderNum) throws InterruptedException {
//发货
OrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNum));
//确认收货后对订单进行整单退货退款且同意
MyOrderApi.receipt(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderRefundDTO orderRefundDTO = OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum);
orderRefundDTO.setRefundAmount((long) Arith.sub(MyOrderApi.orderDetail(orderNum).getCanRefundAmount(), MyOrderApi.orderDetail(orderNum).getTransfee()));
Long refundId= OrderRefundApi.apply(orderRefundDTO);
ShopOrderRefundApi.infoByRefundSn(refundId);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundId));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundId));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
return refundId;
}
/**
* 虚拟订单退款
*/
public static Long virtualOrderRefund(Long orderNum) throws InterruptedException {
//部分退款同意退款
TimeUnit.SECONDS.sleep(2L);
Long refundId= OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundId);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
return refundId;
}
/**
* 供应商订单退款
*/
public static Long supplierOrderRefund(Long orderNum) throws InterruptedException {
//供应商发货
SupplierOrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNum));
//确认收货后对订单进行整单退货退款且同意
MyOrderApi.receipt(orderNum);
TimeUnit.SECONDS.sleep(2L);
Long refundId= OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum));
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getSupplierRefundDTO(refundId));
SupplierRefundApi.processRefundOrder(SupplierOrderRefundDtoData.getSupplierReceiveRefundDTO(refundId));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundId));
SupplierRefundApi.returnMoneyRefundOrder(SupplierOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
return refundId;
}
}

View File

@ -0,0 +1,882 @@
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.order.dto.OrderDTO;
import com.tmerclub.cloud.common.order.vo.OrderAddrVO;
import com.tmerclub.cloud.order.dto.OrderAddrDTO;
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.TransportApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierOrderApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierProductApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierRefundApi;
import com.moyuer.cloud.systemtest.data.order.*;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import com.moyuer.cloud.systemtest.data.supplier.SupplierOrderRefundDtoData;
import com.moyuer.cloud.systemtest.data.supplier.SupplierProductData;
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 Tu
*/
public class SupplierOrderTest {
@Test(description = "JK_20,取消删除订单流程",dataProvider = "freeProductId")
public void cancelOrderTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
TimeUnit.SECONDS.sleep(2L);
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
MyOrderApi.cancel(orderNum);
deleteProduct(productId,supplierProductId,transportId);
MyOrderApi.delete(orderNum);
}
@Test(description = "JK_21,商家修改订单金额,供应商修改用户收货信息和修改物流信息完成流程",dataProvider = "freeProductId")
public void changeAmountOrderTest(Long productId,Long supplierProductId,Long transportId)throws InterruptedException{
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
TimeUnit.SECONDS.sleep(2L);
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNum));
PayApi.orderPay(orderNum);
OrderAddrVO orderAddrVO = SupplierOrderApi.info(orderNum).getOrderAddr();
orderAddrVO.setAddr("供应商修改收货地址");
OrderAddrDTO orderAddrDTO = JSON.parseObject(JSON.toJSONString(orderAddrVO), OrderAddrDTO.class);
orderAddrDTO.setOrderId(orderNum);
SupplierOrderApi.updateOrderDelivery(orderAddrDTO);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
List<DeliveryOrderFeignVO> delivery = OrderApi.infoOrderDelivery(orderNum);
List<DeliveryOrderDTO> deliveryOrderDTOList = JSON.parseArray(JSON.toJSONString(delivery), DeliveryOrderDTO.class);
deliveryOrderDTOList.forEach(s -> s.setDeliveryNo("xgh123123123123"));
SupplierOrderApi.updateOrderDelivery(deliveryOrderDTOList);
deleteProduct(productId,supplierProductId,transportId);
MyOrderApi.receipt(orderNum);
}
@Test(description = "JK_22,无需快递发货订单完整流程",dataProvider = "freeTransportOrderNum")
public void noDeliveryOrderTest(Long orderNum,Long productId,Long supplierProductId,Long transportId)throws InterruptedException{
SupplierOrderApi.delivery(DeliveryOrderDtoData.getNoDeliveryOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNum);
deleteProduct(productId,supplierProductId,transportId);
CommentApi.addComment(SpuCommDtoData.getSpuCommDtoData(OrderApi.getOrderItemAndAddress(orderNum).getOrderItems().get(0).getOrderItemId()));
}
@Test(description = "JK_23,多次退款失败,退货成功订单",dataProvider = "freeTransportOrderNum")
public void multiRefundOrderTest(Long orderNum,Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
TimeUnit.SECONDS.sleep(2L);
//第一次 整单退款商家直接拒绝
refuseRefund(orderNum,false,1L,0L);
//第二次 部分退款供应商拒绝后发货
refuseRefund(orderNum,true,2L,0L);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
//第三次 部分退款仅退款商家直接拒绝
refuseRefund(orderNum,true,1L,0L);
//第四次 整单退款仅退款供应商拒绝
refuseRefund(orderNum,false,2L,0L);
TimeUnit.SECONDS.sleep(2L);
//第五次 部分退款 退货退货退款商家自行处理同意退款后用户发货拒绝退款
shopRefundDeliveryRefuse(orderNum,true,2L,0L);
TimeUnit.SECONDS.sleep(2L);
//第六次 整单退款 退货退款转移供应商同意退款后用户发货拒绝退款,用户确认收货
supplierRefundDeliveryRefuse(orderNum,false,2L,0L);
MyOrderApi.receipt(orderNum);
//第七次 整单退款 仅退款商家直接拒绝
refuseRefund(orderNum,false,1L,0L);
//第八次 部分退款仅退款供应商拒绝
refuseRefund(orderNum,true,2L,0L);
//第九次 整单退款 退货退款商家自行处理同意退款后用户发货拒绝退款
shopRefundDeliveryRefuse(orderNum,true,1L,0L);
//第十次 部分退款 退货退款转移供应商退货退款成功
receiveDeliveryRefund(orderNum,true,2L,0L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_24,未发货订单申请退款成功-商家自行处理",dataProvider = "productId")
public void unDeliveryShopReceiveRefundOrderTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst,false,1L,0L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec,true,1L,0L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_25,未发货订单申请退款成功-移交供应商处理",dataProvider = "productId")
public void unDeliverySupplierReceiveRefundOrderTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst,false,2L,0L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec,true,2L,0L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_26,已发货订单申请仅退款成功-商家自行处理",dataProvider = "productId")
public void deliveredShopReceiveRefundOrderTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst,false,1L,0L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec,true,1L,0L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_27,已发货订单申请仅退款成功-移交供应商处理",dataProvider = "productId")
public void deliveredSupplierReceiveRefundOrderTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst,false,2L,0L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec,true,2L,0L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_28,已发货订单申请退货退款成功-商家自行处理",dataProvider = "productId")
public void deliveredShopReceiveRefundDeliveryTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumFirst,false,1L,0L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumSec,true,1L,0L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_29,已发货订单申请退货退款成功-移交供应商处理",dataProvider = "productId")
public void deliveredSupplierReceiveRefundDeliveryTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumFirst,false,2L,0L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumSec,true,2L,0L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_30,已完成订单申请仅退款成功-商家自行处理",dataProvider = "productId")
public void receivedShopReceiveRefundTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst,false,1L,0L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
MyOrderApi.receipt(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec,true,1L,0L);
TimeUnit.SECONDS.sleep(2L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_31,已完成订单申请仅退款成功-移交供应商处理",dataProvider = "productId")
public void receivedSupplierReceiveRefundTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst,false,2L,0L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec,true,2L,0L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_32,已完成订单申请退货退款成功-商家自行处理",dataProvider = "productId")
public void receivedShopReceiveRefundDeliveryTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumFirst));
MyOrderApi.receipt(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumFirst,false,1L,0L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
MyOrderApi.receipt(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumSec,true,1L,0L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_33,已完成订单申请退货退款成功-移交供应商处理",dataProvider = "productId")
public void receivedSupplierReceiveRefundDeliveryTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumFirst,false,2L,0L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
MyOrderApi.receipt(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumSec,true,2L,0L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_34,未发货有运费订单部分金额退款-商家自行处理",dataProvider = "productId")
public void unDeliverySupplierDeliveryTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst,true,1L,2077L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec,true,1L,293L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_35,未发货有运费订单部分金额退款-转移供应商处理",dataProvider = "productId")
public void unDeliverySupplierReceiveTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst,true,2L,2077L);
//第二笔订单部分退款
Long orderNumSec = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec,true,2L,293L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_36,已完成有运费订单部分金额仅退款-商家自行处理",dataProvider = "productId")
public void completedShopReceiveTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
Long orderNum = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNum);
receiveRefund(orderNum,true,1L,1099L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_37,已完成有运费订单部分金额仅退款-商家自行处理",dataProvider = "productId")
public void completedSupplierReceiveTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
Long orderNum = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNum);
receiveRefund(orderNum,true,2L,1099L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_38,已完成有运费订单部分金额退货退款-商家自行处理",dataProvider = "productId")
public void completedRefundDeliveryShopReceiveTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
Long orderNum = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNum);
receiveRefund(orderNum,true,1L,1099L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_39,已完成有运费订单部分金额退货退款-商家自行处理",dataProvider = "productId")
public void completedRefundDeliverySupplierReceiveTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
Long orderNum = payOrder(productId);
TimeUnit.SECONDS.sleep(2L);
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNum);
receiveRefund(orderNum,true,2L,1099L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "JK_40,待采购订单采购完整流程",dataProvider = "productId")
public void unBuySupplierTest(Long productId,Long supplierProductId,Long transportId) throws InterruptedException {
Long orderNum = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNum,877L,800L));
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
OrderApi.sourcingOrder(OrderAdminDtoData.getSourcingOrderAdminDto(orderNum));
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNum));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNum);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "采购订单退款成功完整流程", dataProvider = "productId")
public void unBuySupplierRefundTest(Long productId, Long supplierProductId, Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumFirst,888L,800L));
PayApi.orderPay(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst, false, 1L, null);
//第二笔订单部分退款-修改退款金额为5.33
Long orderNumSec = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumSec,888L,800L));
PayApi.orderPay(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec, true, 1L, 533L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "采购订单退款成功-商家自行处理完整流程", dataProvider = "productId")
public void buySupplierRefundShopReceiveTest(Long productId, Long supplierProductId, Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumFirst,888L,800L));
PayApi.orderPay(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
OrderApi.sourcingOrder(OrderAdminDtoData.getSourcingOrderAdminDto(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst, false, 1L, null);
//第二笔订单部分退款-修改退款金额为5.33
Long orderNumSec = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumSec,888L,800L));
PayApi.orderPay(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
OrderApi.sourcingOrder(OrderAdminDtoData.getSourcingOrderAdminDto(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec, true, 1L, 533L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "采购订单退款成功-移交供应商处理完整流程", dataProvider = "productId")
public void buySupplierRefundSupplierReceiveTest(Long productId, Long supplierProductId, Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumFirst,888L,800L));
PayApi.orderPay(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
OrderApi.sourcingOrder(OrderAdminDtoData.getSourcingOrderAdminDto(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumFirst, false, 2L, null);
//第二笔订单部分退款-修改退款金额为5.33
Long orderNumSec = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumSec,888L,800L));
PayApi.orderPay(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
OrderApi.sourcingOrder(OrderAdminDtoData.getSourcingOrderAdminDto(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
receiveRefund(orderNumSec, true, 2L, 533L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "已完成采购订单退货退款成功-商家自行处理完整流程", dataProvider = "productId")
public void completeBuySupplierRefundShopReceiveTest(Long productId, Long supplierProductId, Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumFirst,888L,800L));
PayApi.orderPay(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
OrderApi.sourcingOrder(OrderAdminDtoData.getSourcingOrderAdminDto(orderNumFirst));
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumFirst, false, 1L, null);
//第二笔订单部分退款-修改退款金额为5.33
Long orderNumSec = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumSec,888L,800L));
PayApi.orderPay(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
OrderApi.sourcingOrder(OrderAdminDtoData.getSourcingOrderAdminDto(orderNumSec));
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumSec, true, 1L, 533L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "已完成采购订单退货退款成功-移交供应商处理完整流程", dataProvider = "productId")
public void completeBuySupplierRefundSupplierReceiveTest(Long productId, Long supplierProductId, Long transportId) throws InterruptedException {
//第一笔订单整单退款
Long orderNumFirst = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumFirst,888L,800L));
PayApi.orderPay(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
OrderApi.sourcingOrder(OrderAdminDtoData.getSourcingOrderAdminDto(orderNumFirst));
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumFirst));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNumFirst);
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumFirst, false, 2L, null);
//第二笔订单部分退款-修改退款金额为5.33
Long orderNumSec = getOrderNum(productId);
OrderApi.changeOrderAmount(OrderAdminDtoData.getOrderAdminDto(orderNumSec,888L,800L));
PayApi.orderPay(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
OrderApi.sourcingOrder(OrderAdminDtoData.getSourcingOrderAdminDto(orderNumSec));
SupplierOrderApi.delivery(DeliveryOrderDtoData.getDeliveryOrderDtoData(orderNumSec));
TimeUnit.SECONDS.sleep(2L);
MyOrderApi.receipt(orderNumSec);
TimeUnit.SECONDS.sleep(2L);
receiveDeliveryRefund(orderNumSec, true, 2L, 533L);
deleteProduct(productId,supplierProductId,transportId);
}
@Test(description = "商家代销供应商多商品订单完整流程")
public void differentSupplerProductOrderTest() throws InterruptedException {
Long supplierProductIdA = SupplierProductData.getSupplierProductId(6600L, DeliveryData.getSupplierFreeFeeDelivery(true), true);
Long supplierProductIdB = SupplierProductData.getSupplierProductId(6600L, DeliveryData.getSupplierFreeFeeDelivery(true), true);
Long productIdA = SupplierProductData.getProductId(supplierProductIdA, 8800L, 1, null, true, true);
Long productIdB = SupplierProductData.getProductId(supplierProductIdB, 8800L, 1, null, true, true);
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
TimeUnit.SECONDS.sleep(2L);
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productIdB, true);
SupplierProductApi.delete(supplierProductIdB, true);
ProductApi.delete(productIdA, true);
SupplierProductApi.delete(supplierProductIdA, true);
}
@Test(description = "商家发货的供应商商品订单退款完整流程")
public void shopDeliverySupplierProductOrderTest() throws InterruptedException {
Long supplierProductId = SupplierProductData.getSupplierProductId(6600L, DeliveryData.getSupplierFreeFeeDelivery(true), true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8800L, 2, DeliveryData.getFreeFeeDelivery(true), true, true);
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
TimeUnit.SECONDS.sleep(2L);
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);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "多商家代销同一供应商商品订单完整流程")
public void multipleShopSameSupplerProductOrderTest() {
Long transportId = DeliveryData.getSupplierFreeFeeDelivery(true);
Long supplierProductId = SupplierProductData.getSupplierProductId(6600L, transportId, true);
//A店铺代销商品A
Long productIdA = SupplierProductData.getProductId(supplierProductId, 8800L, 1, null, true, true);
//B店铺代销商品B
Long productIdB = SupplierProductData.getProductId(supplierProductId, 8800L, 1, null, true, false);
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB, 1));
//确认订单数据
Long shopIdA = ProductApi.getProductInfo(productIdA).getShopId();
Long shopIdB = ProductApi.getProductInfo(productIdB).getShopId();
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(Arrays.asList(shopIdA, shopIdB));
//确认订单
MyOrderApi.confirm(orderDTO);
//提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(Arrays.asList(shopIdA, shopIdB)));
//支付订单
PayApi.orderPay(orderNumberList);
ProductApi.delete(productIdB, false);
ProductApi.delete(productIdA, true);
SupplierProductApi.delete(supplierProductId, true);
}
@Test(description = "商家代销多供应商商品订单完整流程")
public void sameShopMultipleSupplerProductOrderTest() throws InterruptedException {
Long transportId = DeliveryData.getSupplierFreeFeeDelivery(true);
//A供应商发布供应商商品A
Long supplierProductIdA = SupplierProductData.getSupplierProductId(6600L, transportId, true);
//B供应商发布供应商商品B
Long supplierProductIdB = SupplierProductData.getSupplierProductId(6600L, transportId, false);
//A店铺代销商品A
Long productIdA = SupplierProductData.getProductId(supplierProductIdA, 8800L, 1, null, true, true);
//A店铺代销商品B
Long productIdB = SupplierProductData.getProductId(supplierProductIdB, 8800L, 1, null, false, true);
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB, 1));
//确认订单数据
Long shopId = ProductApi.getProductInfo(productIdA).getShopId();
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(Collections.singletonList(shopId));
//确认订单
MyOrderApi.confirm(orderDTO);
//提交订单
TimeUnit.SECONDS.sleep(2L);
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(Collections.singletonList(shopId)));
//支付订单
PayApi.orderPay(orderNumberList);
ProductApi.delete(productIdB, true);
ProductApi.delete(productIdA, true);
SupplierProductApi.delete(supplierProductIdB, false);
SupplierProductApi.delete(supplierProductIdA, true);
}
@Test(description = "多商家代销多供应商商品订单完整流程")
public void multipleShopMultipleSupplerProductOrderTest() throws InterruptedException {
//A供应商包邮运费模板
Long feeTransportIdA = DeliveryData.getSupplierFreeFeeDelivery(true);
//A供应商运费模板8元/
TransportApi.addSupplierTransport(DeliveryData.getTransportDTO(0, 1D, 800L, 1D, 800L, 0, null, null, null), true);
Long transportIdA = TransportApi.supplierTransportPage(true).get(0).getTransportId();
//A供应商发布包邮商品A1
Long supplierProductIdA1 = SupplierProductData.getSupplierProductId(6600L, feeTransportIdA, true);
//A供应商发货有运费商品A2
Long supplierProductIdA2 = SupplierProductData.getSupplierProductId(6600L, transportIdA, true);
//B供应商包邮运费模板
Long feeTransportIdB = DeliveryData.getSupplierFreeFeeDelivery(false);
//A供应商运费模板8元/
TransportApi.addSupplierTransport(DeliveryData.getTransportDTO(0, 1D, 800L, 1D, 800L, 0, null, null, null), false);
Long transportIdB = TransportApi.supplierTransportPage(false).get(0).getTransportId();
//A供应商发布包邮商品A1
Long supplierProductIdB1 = SupplierProductData.getSupplierProductId(6600L, feeTransportIdB, false);
//A供应商发货有运费商品A2
Long supplierProductIdB2 = SupplierProductData.getSupplierProductId(6600L, transportIdB, false);
//A店铺代销商品A1
Long productIdA1 = SupplierProductData.getProductId(supplierProductIdA1, 8800L, 1, null, true, true);
//A店铺代销商品A2
Long productIdA2 = SupplierProductData.getProductId(supplierProductIdA2, 8800L, 1, null, true, true);
//A店铺代销商品B1
Long productIdA3 = SupplierProductData.getProductId(supplierProductIdB1, 8800L, 1, null, false, true);
//A店铺代销商品B2
Long productIdA4 = SupplierProductData.getProductId(supplierProductIdB2, 8800L, 1, null, false, true);
//B店铺代销商品A1
Long productIdB1 = SupplierProductData.getProductId(supplierProductIdA1, 8800L, 1, null, true, false);
//B店铺代销商品A2
Long productIdB2 = SupplierProductData.getProductId(supplierProductIdA2, 8800L, 1, null, true, false);
//B店铺代销商品B1
Long productIdB3 = SupplierProductData.getProductId(supplierProductIdB1, 8800L, 1, null, false, false);
//B店铺代销商品B2
Long productIdB4 = SupplierProductData.getProductId(supplierProductIdB2, 8800L, 1, null, false, false);
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA1, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA2, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA3, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA4, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB1, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB2, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB3, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB4, 1));
//确认订单数据
Long shopIdA = ProductApi.getProductInfo(productIdA1).getShopId();
Long shopIdB = ProductApi.getProductInfo(productIdB1).getShopId();
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(Arrays.asList(shopIdA, shopIdB));
//确认订单
MyOrderApi.confirm(orderDTO);
//提交订单
TimeUnit.SECONDS.sleep(2L);
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(Arrays.asList(shopIdA, shopIdB)));
//支付订单
PayApi.orderPay(orderNumberList);
ProductApi.delete(productIdB4, false);
ProductApi.delete(productIdB3, false);
ProductApi.delete(productIdB2, false);
ProductApi.delete(productIdB1, false);
SupplierProductApi.delete(supplierProductIdB2, false);
SupplierProductApi.delete(supplierProductIdB1, false);
TransportApi.deleteSupplierTransport(transportIdB, false);
ProductApi.delete(productIdA4, true);
ProductApi.delete(productIdA3, true);
ProductApi.delete(productIdA2, true);
ProductApi.delete(productIdA1, true);
SupplierProductApi.delete(supplierProductIdA2, true);
SupplierProductApi.delete(supplierProductIdA1, true);
TransportApi.deleteSupplierTransport(transportIdA, true);
}
@DataProvider(name = "freeTransportOrderNum")
private Object[][] freeTransportOrderNum() throws InterruptedException {
Long transportId = DeliveryData.getSupplierFreeFeeDelivery(true);
Long supplierProductId = SupplierProductData.getSupplierProductId(1099L, transportId, true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8888L, 1, null, true, true);
Long orderNum = payOrder(productId);
return new Object[][]{{orderNum,productId,supplierProductId,transportId}};
}
@DataProvider(name = "orderNum")
private Object[][] orderNum() throws InterruptedException {
TransportApi.addSupplierTransport(DeliveryData.getTransportDTO(), true);
Long transportId = TransportApi.supplierTransportPage(true).get(0).getTransportId();
Long supplierProductId = SupplierProductData.getSupplierProductId(1099L, transportId, true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8888L, 1, null, true, true);
Long orderNum = payOrder(productId);
return new Object[][]{{orderNum,productId,supplierProductId,transportId}};
}
@DataProvider(name = "freeProductId")
private Object[][] freeProductId(){
Long transportId = DeliveryData.getSupplierFreeFeeDelivery(true);
Long supplierProductId = SupplierProductData.getSupplierProductId(1099L, transportId, true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8888L, 1, null, true, true);
return new Object[][]{{productId,supplierProductId,transportId}};
}
@DataProvider(name = "productId")
private Object[][] productId(){
TransportApi.addSupplierTransport(DeliveryData.getTransportDTO(), true);
Long transportId = TransportApi.supplierTransportPage(true).get(0).getTransportId();
Long supplierProductId = SupplierProductData.getSupplierProductId(1099L, transportId, true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8888L, 1, null, true, true);
return new Object[][]{{productId,supplierProductId,transportId}};
}
private Long getOrderNum(Long productId) throws InterruptedException {
ShopCartApi.addItem(ShopCartData.getShopCartItem(productId));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId));
TimeUnit.SECONDS.sleep(2L);
return MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
}
private Long payOrder(Long productId) throws InterruptedException {
Long orderNum = getOrderNum(productId);
PayApi.orderPay(orderNum);
TimeUnit.SECONDS.sleep(2L);
return orderNum;
}
private void deleteProduct(Long productId,Long supplierProductId,Long transportId) {
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
if (TransportApi.info(transportId, true).getIsFreeFee().equals(0)) {
TransportApi.deleteSupplierTransport(transportId, true);
}
}
/**
* type==true时部分退款,否则为整单退款
* role==1时为商家否者为供应商
* 仅退款申请
* */
private void refuseRefund(Long orderNum,Boolean type,Long role,Long refundAmount) {
Long refundId;
if (type){
refundId = OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,refundAmount));
} else {
refundId = OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDTO(orderNum));
}
ShopOrderRefundApi.infoByRefundSn(refundId);
if(role == 1){
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundId));
}else {
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getSupplierRefundDTO(refundId));
SupplierRefundApi.processRefundOrder(SupplierOrderRefundDtoData.getRufuseOrderRefundDTO(refundId));
}
}
/**
* type==true时部分退款,否则为整单退款
* role==1时为商家否者为供应商
* 仅退款申请
* */
private void receiveRefund(Long orderNum,Boolean type,Long role,Long refundAmount) {
Long refundId;
if (type){
refundId = OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDTO(orderNum,refundAmount));
} else {
refundId = OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDTO(orderNum));
}
ShopOrderRefundApi.infoByRefundSn(refundId);
if(role == 1){
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveRefundDTO(refundId));
}else {
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getSupplierRefundDTO(refundId));
SupplierRefundApi.processRefundOrder(SupplierOrderRefundDtoData.getSupplierReceiveRefundDTO(refundId));
}
}
/**
* type==true时部分退款,否则为整单退款
* 商家自行处理退货退款申请
* */
private void shopRefundDeliveryRefuse(Long orderNum,Boolean type,Long step,Long refundAmount) {
Long refundId;
if (type){
refundId = OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDeliveryDTO(orderNum,refundAmount));
} else {refundId = OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum));
}
ShopOrderRefundApi.infoByRefundSn(refundId);
if (step == 1){
//商家在第一步拒绝退货退款申请
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getRufuseOrderRefundDTO(refundId));
}else {
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundId));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getRefuseDeliveryRefundDTO(refundId));
}
}
/**
* type==true时部分退款,否则为整单退款
* step==1时在申请退货退款的第一步拒绝退款 否则在申请退货退款的第二步拒绝退款
* 供应商 在第二步拒绝退货退款申请
* */
private void supplierRefundDeliveryRefuse(Long orderNum,Boolean type,Long step,Long refundAmount) {
Long refundId;
if (type){
refundId = OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDeliveryDTO(orderNum,refundAmount));
} else {refundId = OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum));
}
ShopOrderRefundApi.infoByRefundSn(refundId);
if (step == 1){
//供应商在第一步拒绝退货退款申请
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getSupplierRefundDTO(refundId));
SupplierRefundApi.processRefundOrder(SupplierOrderRefundDtoData.getRufuseOrderRefundDTO(refundId));
}else {
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getSupplierRefundDTO(refundId));
SupplierRefundApi.processRefundOrder(SupplierOrderRefundDtoData.getSupplierReceiveRefundDTO(refundId));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundId));
SupplierRefundApi.returnMoneyRefundOrder(SupplierOrderRefundDtoData.getRefuseDeliveryRefundDTO(refundId));
}}
/**
* 同意退货退款
* type==true时部分退款,否则为整单退款
* role=1商家同意否则供应商同意
* */
private void receiveDeliveryRefund(Long orderNum,Boolean type,Long role,Long refundAmount){
Long refundId;
if (type){
refundId = OrderRefundApi.apply(OrderRefundDtoData.getOrderRefundDeliveryDTO(orderNum,refundAmount));
} else {refundId = OrderRefundApi.apply(OrderRefundDtoData.getAllOrderRefundDeliveryDTO(orderNum));
}
ShopOrderRefundApi.infoByRefundSn(refundId);
if (role == 1){
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundId));
ShopOrderRefundApi.returnMoney(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
}else {
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getSupplierRefundDTO(refundId));
SupplierRefundApi.processRefundOrder(SupplierOrderRefundDtoData.getSupplierReceiveRefundDTO(refundId));
OrderRefundApi.submitExpress(OrderRefundDeliveryDtoData.getOrderRefundDeliveryDTO(refundId));
SupplierRefundApi.returnMoneyRefundOrder(SupplierOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundId));
}
}
}

View File

@ -0,0 +1,277 @@
package com.tmerclub.cloud.systemtest.test.order;
import com.tmerclub.cloud.common.order.dto.OrderDTO;
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.login.UserApi;
import com.moyuer.cloud.systemtest.api.order.MyOrderApi;
import com.moyuer.cloud.systemtest.api.order.ShopCartApi;
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.data.amount.SpuData;
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.platform.CategoryDtoData;
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.Assert;
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 TransFeeFreesOrderTest {
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 fullAmountFreeFreight() {
List<Long> categoryIds = getCategoryId(true);
//运费模板-8元/满100元包邮
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 1D, 800L, 1D, 800L, 1, 1, null, 10000L), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 10000L), true);
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productId, true);
TransportApi.deleteTransport(transportId, true);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 0);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreeFreightAmount(), 800);
}
@Test(description = "运费模板满件包邮订单,运费是否正确")
public void fullPriceFreeFreight() {
List<Long> categoryIds = getCategoryId(true);
//运费模板-8元/满1件包邮
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 1D, 800L, 1D, 800L,1, 0, 1D, null), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 10000L), true);
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productId, true);
TransportApi.deleteTransport(transportId, true);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 0);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreeFreightAmount(), 800);
}
@Test(description = "运费模板满件和满金额包邮订单,运费是否正确")
public void fullPriceAndAmountFreeFreight() {
List<Long> categoryIds = getCategoryId(true);
//运费模板-8元/满1件和满100元时包邮
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 1D, 800L, 1D, 800L,1, 2, 1D, 10000L), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 10000L), true);
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productId, true);
TransportApi.deleteTransport(transportId, true);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 0);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreeFreightAmount(), 800);
}
@Test(description = "平台会员权益-全平台包邮与运费模板满条件包邮订单,运费是否正确")
public void fullConditionFreeFreightAndFreeFeeUserRight() {
List<Long> categoryIds = getCategoryId(true);
//用户会员等级添加包邮权益
Long freeFeeUserRightsId = UserRightsApi.save(UserRightsDtoData.getFreeFeeUserRightsDTO());
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Collections.singletonList(freeFeeUserRightsId)));
//运费模板-8元/满1件和满100元时包邮
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 1D, 800L, 1D, 800L,1, 2, 1D, 10000L), true);
Long transportId = TransportApi.infoTransport(true).get(0).getTransportId();
Long productId = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportId, 10000L), true);
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productId, true);
TransportApi.deleteTransport(transportId, true);
UserRightsApi.delete(freeFeeUserRightsId);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 0);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreeFreightAmount(), 800);
}
@Test(description = "运费模板满条件包邮商品与运费模板不包邮商品的订单,运费是否正确")
public void fullConditionFreeFreightAndNotFreeFreight() throws InterruptedException {
List<Long> categoryIds = getCategoryId(true);
//运费模板-运费8元/满1件包邮
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 1D, 800L, 1D, 800L,1, 0, 1D, null), true);
Long transportIdA = TransportApi.infoTransport(true).get(0).getTransportId();
Long productIdA = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportIdA, 10000L), true);
//运费模板-运费8元/
TimeUnit.SECONDS.sleep(2L);
TransportApi.addTransport(DeliveryData.getTransportDTO(), true);
Long transportIdB = TransportApi.infoTransport(true).get(0).getTransportId();
Long productIdB = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportIdB, 10000L), true);
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productIdB, true);
TransportApi.deleteTransport(transportIdB, true);
ProductApi.delete(productIdA, true);
TransportApi.deleteTransport(transportIdA, true);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreeFreightAmount(), 800);
}
@Test(description = "使用同一运费模板的不同商品满足包邮条件,运费是否正确")
public void differentProductFullConditionFreeFreight() {
List<Long> categoryIds = getCategoryId(true);
//运费模板运费8元/满2件包邮
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 1D, 800L, 1D, 800L,1, 0, 1D, null), true);
Long transportIdA = TransportApi.infoTransport(true).get(0).getTransportId();
//商品A
Long productIdA = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportIdA, 10000L), true);
//商品B
Long productIdB = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportIdA, 10000L), true);
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productIdB, true);
ProductApi.delete(productIdA, true);
TransportApi.deleteTransport(transportIdA, true);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 0);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreeFreightAmount(), 1600);
}
@Test(description = "平台会员权益-全平台包邮、运费模板满条件包邮商品与运费模板不包邮商品的订单,运费是否正确")
public void fullConditionFreeFreightAndNotFreeFreightAndFreeFeeUserRight() throws InterruptedException {
List<Long> categoryIds = getCategoryId(true);
//用户会员等级添加包邮权益
Long freeFeeUserRightsId = UserRightsApi.save(UserRightsDtoData.getFreeFeeUserRightsDTO());
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Collections.singletonList(freeFeeUserRightsId)));
//运费模板-运费8元/满1件包邮
TransportApi.addTransport(DeliveryData.getTransportDTO(0, 1D, 800L, 1D, 800L,1, 0, 1D, null), true);
Long transportIdA = TransportApi.infoTransport(true).get(0).getTransportId();
Long productIdA = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportIdA, 10000L), true);
//运费模板-运费8元/
TimeUnit.SECONDS.sleep(2L);
TransportApi.addTransport(DeliveryData.getTransportDTO(), true);
Long transportIdB = TransportApi.infoTransport(true).get(0).getTransportId();
Long productIdB = ProductApi.createProduct(SpuData.getRealSpu(categoryIds.get(0), categoryIds.get(1), transportIdB, 10000L), true);
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB));
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productIdA));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productIdA)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productIdB, true);
TransportApi.deleteTransport(transportIdB, true);
ProductApi.delete(productIdA, true);
TransportApi.deleteTransport(transportIdA, true);
UserRightsApi.delete(freeFeeUserRightsId);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreeFreightAmount(), 800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getPlatformFreeFreightAmount(), 800);
}
@Test(description = "平台会员包邮订单,运费是否正确")
public void freeFeeUserRight() {
List<Long> categoryIds = getCategoryId(true);
//用户会员等级添加包邮权益
Long freeFeeUserRightsId = UserRightsApi.save(UserRightsDtoData.getFreeFeeUserRightsDTO());
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Collections.singletonList(freeFeeUserRightsId)));
//运费模板-8元/
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, 10000L), true);
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 1));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
ProductApi.delete(productId, true);
TransportApi.deleteTransport(transportId, true);
UserRightsApi.delete(freeFeeUserRightsId);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getPlatformFreeFreightAmount(), 800);
}
@Test(description = "多商家商品订单平台会员包邮,运费是否正确")
public static void multipleShopProductWithFreeFeeUserRight() {
//用户会员等级添加包邮权益
Long freeFeeUserRightsId = UserRightsApi.save(UserRightsDtoData.getFreeFeeUserRightsDTO());
UserLevelApi.update(UserLevelDtoData.getUserLevelDTO(UserApi.getUserInfo().getUserLevelId(), Collections.singletonList(freeFeeUserRightsId)));
//A店铺运费模板-8元/
TransportApi.addTransport(DeliveryData.getTransportDTO(), true);
Long transportIdA = TransportApi.infoTransport(true).get(0).getTransportId();
List<Long> categoryIdsA = getCategoryId(true);
Long productIdA = ProductApi.createProduct(SpuData.getRealSpu(categoryIdsA.get(0), categoryIdsA.get(1), transportIdA, 10000L), true);
//B店铺运费模板-8元/
TransportApi.addTransport(DeliveryData.getTransportDTO(), false);
Long transportIdB = TransportApi.infoTransport(false).get(0).getTransportId();
List<Long> categoryIdsB = getCategoryId(false);
Long productIdB = ProductApi.createProduct(SpuData.getRealSpu(categoryIdsB.get(0), categoryIdsB.get(1), transportIdB, 10000L), false);
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdA, 1));
ShopCartApi.addItem(ShopCartData.getShopCartItem(productIdB, 1));
//确认订单数据
Long shopIdA = ProductApi.getProductInfo(productIdA).getShopId();
Long shopIdB = ProductApi.getProductInfo(productIdB).getShopId();
OrderDTO orderDTO = OrderDtoData.getOrderDtoData(Arrays.asList(shopIdA, shopIdB));
//确认订单
MyOrderApi.confirm(orderDTO);
//提交订单
List<Long> orderNumberList = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(Arrays.asList(shopIdA, shopIdB)));
//支付订单
PayApi.orderPay(orderNumberList);
ProductApi.delete(productIdB, false);
TransportApi.deleteTransport(transportIdB, false);
ProductApi.delete(productIdA, true);
TransportApi.deleteTransport(transportIdA, true);
UserRightsApi.delete(freeFeeUserRightsId);
for(Long orderNum : orderNumberList) {
if (MyOrderApi.orderDetail(orderNum).getShopId().equals(shopIdA)) {
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getPlatformFreeFreightAmount(), 800);
}
if (MyOrderApi.orderDetail(orderNum).getShopId().equals(shopIdB)) {
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getFreightAmount(), 800);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getPlatformFreeFreightAmount(), 800);
}
}
}
}

View File

@ -0,0 +1,338 @@
package com.tmerclub.cloud.systemtest.test.order;
import com.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.tmerclub.cloud.order.dto.OrderStationDTO;
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.order.*;
import com.moyuer.cloud.systemtest.api.store.ShopWalletApi;
import com.moyuer.cloud.systemtest.data.amount.SpuData;
import com.moyuer.cloud.systemtest.data.order.*;
import com.moyuer.cloud.systemtest.data.platform.CategoryDtoData;
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 lpj
*/
public class VirtualOrderTest {
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 = "noWriteNumVirtualProduct")
public Object[][] noWriteNumVirtualProduct(){
List<Long> categoryIds = getCategoryId();
Long productId = ProductApi.createProduct(SpuData.getUnRealSpu(categoryIds.get(0), categoryIds.get(1), 100L, 0), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "singleWriteNumVirtualProduct")
public Object[][] singleWriteNumVirtualProduct(){
List<Long> categoryIds = getCategoryId();
Long productId = ProductApi.createProduct(SpuData.getUnRealSpu(categoryIds.get(0), categoryIds.get(1), 100L, 1), true);
return new Object[][]{{productId}};
}
@DataProvider(name = "tripleWriteNumVirtualProduct")
public Object[][] tripleWriteNumVirtualProduct(){
List<Long> categoryIds = getCategoryId();
Long productId = ProductApi.createProduct(SpuData.getUnRealSpu(categoryIds.get(0), categoryIds.get(1), 100L, -1), true);
return new Object[][]{{productId}};
}
@Test(description = "JK_43,虚拟订单取消删除", dataProvider = "noWriteNumVirtualProduct")
public void noWriteNumVirtualProductTestCase(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_44,无需核销虚拟订单完整流程", dataProvider = "noWriteNumVirtualProduct")
public void noWriteNumVirtualOrderTestCase(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(1L);
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(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
@Test(description = "JK_45虚拟商品订单单次核销订单完整流程" ,dataProvider = "singleWriteNumVirtualProduct")
public void singleWriteNumVirtualProductTestCase(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(1L);
String writeOffCode = MyOrderApi.orderDetail(orderNum).getVirtualInfoList().get(0).getWriteOffCode();
StationApi.orderWriteOffByOrderNumber(OrderVirtualInfoDtoData.getOrderVirtualInfoDTO(orderNum, writeOffCode));
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(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
@Test(description = "JK_46三次核销虚拟订单完整流程" ,dataProvider = "tripleWriteNumVirtualProduct")
public void tripleWriteNumVirtualTestCase(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(1L);
String writeOffCode = MyOrderApi.orderDetail(orderNum).getVirtualInfoList().get(0).getWriteOffCode();
for (int i=0; i<MyOrderApi.orderDetail(orderNum).getWriteOffMultipleCount(); i++){
StationApi.orderWriteOffByOrderNumber(OrderVirtualInfoDtoData.getOrderVirtualInfoDTO(orderNum, writeOffCode));
}
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(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
@Test(description = "JK_47,无需核销虚拟订单退款完整流程", dataProvider = "noWriteNumVirtualProduct")
public void noWriteNumVirtualOrderRefundTestCase(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.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 2);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundIdSec, true).getOrderItemDetailList().get(0).getRefundAmount(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
@Test(description = "JK_48,虚拟商品订单,单次核销订单退款完整流程", dataProvider = "singleWriteNumVirtualProduct")
public void singleWriteNumVirtualOrderRefundTestCase(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.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 2);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundIdSec, true).getOrderItemDetailList().get(0).getRefundAmount(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
@Test(description = "JK_49,虚拟商品订单,三次核销订单退款完整流程", dataProvider = "tripleWriteNumVirtualProduct")
public void tripleWriteNumVirtualOrderRefundTestCase(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.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 2);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundIdSec, true).getOrderItemDetailList().get(0).getRefundAmount(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
@Test(description = "JK_49,虚拟商品订单,三次核销订单,核销一次后退款完整流程", dataProvider = "tripleWriteNumVirtualProduct")
public void tripleWriteNumVirtualOrderWriteOffOnceRefundTestCase(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(1L);
String writeOffCode = MyOrderApi.orderDetail(orderNum).getVirtualInfoList().get(0).getWriteOffCode();
StationApi.orderWriteOffByOrderNumber(OrderVirtualInfoDtoData.getOrderVirtualInfoDTO(orderNum, writeOffCode));
//申请第一次退款部分退款拒绝退款
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.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 2);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 2);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundIdSec, true).getOrderItemDetailList().get(0).getRefundAmount(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
@Test(description = "51,虚拟商品订单,两件三次核销订单,核销其中一个后退款完整流程", dataProvider = "tripleWriteNumVirtualProduct")
public void tripleWriteNumVirtualOrderWriteOffTwiceRefundTestCase(Long productId) throws InterruptedException {
MyOrderApi.confirm(OrderDtoData.getOrderDtoData(productId, 2));
Long orderNum = MyOrderApi.submit(SubmitOrderDtoData.getSubmitOrderDtoData(productId)).get(0);
PayApi.orderPay(orderNum);
//可核销三次的虚拟订单核销其中一个核销码
TimeUnit.SECONDS.sleep(1L);
String writeOffCode = MyOrderApi.orderDetail(orderNum).getVirtualInfoList().get(0).getWriteOffCode();
for (int i=0; i<MyOrderApi.orderDetail(orderNum).getWriteOffMultipleCount(); i++) {
StationApi.orderWriteOffByOrderNumber(OrderVirtualInfoDtoData.getOrderVirtualInfoDTO(orderNum, writeOffCode));
}
//申请第一次退款部分退款拒绝退款
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.getOrderRefundDTO(orderNum,0L));
ShopOrderRefundApi.infoByRefundSn(refundIdSec);
ShopOrderRefundApi.processRefundOrder(ShopOrderRefundDtoData.getReceiveDeliveryRefundDTO(refundIdSec));
ProductApi.delete(productId, true);
//验证运行后数据是否正确
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ShopOrderRefundApi.getEsOrderRefundVO(orderNum).size(), 2);
Assert.assertEquals(ShopWalletApi.getMongoShopWalletLogBO(orderNum, true).size(), 3);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundIdSec, true).getOrderItemDetailList().get(0).getActualTotal(), 200);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, refundIdSec, true).getOrderItemDetailList().get(0).getRefundAmount(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 4);
}
@Test(description = "JK_52,商家端核销虚拟订单", dataProvider = "singleWriteNumVirtualProduct")
public static void writeOffVirtualOrder(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(1L);
OrderApi.orderWriteOffByOrderId(OrderVirtualInfoDtoData.getOrderVirtualInfoDTO(orderNum, null));
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(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
@Test(description = "JK_53,商家端通过核销码核销虚拟订单", dataProvider = "singleWriteNumVirtualProduct")
public static void writeOffVirtualOrderByWriteOffCode(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(1L);
String writeOffCode = MyOrderApi.orderDetail(orderNum).getVirtualInfoList().get(0).getWriteOffCode();
OrderApi.orderWriteOffByOrderId(OrderVirtualInfoDtoData.getOrderVirtualInfoDTO(orderNum, writeOffCode));
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(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
@Test(description = "JK_54,门店扫核销码核销虚拟订单", dataProvider = "singleWriteNumVirtualProduct")
public static void writeOffVirtualOrderByWriteOffQrCode(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(1L);
StationApi.orderWriteOffByOrderNumber(OrderVirtualInfoDtoData.getOrderVirtualInfoDTO(orderNum, null));
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(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
@Test(description = "JK_55,用户扫门店商家码销虚拟订单", dataProvider = "singleWriteNumVirtualProduct")
public static void writeOffVirtualOrderByStationCode(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(1L);
OrderStationDTO orderStationDTO = new OrderStationDTO();
orderStationDTO.setOrderIds(Collections.singletonList(orderNum));
orderStationDTO.setStationId(StationApi.getStationIndexInfo().getStationId());
orderStationDTO.setUserId(UserApi.getUserInfo().getUserId());
MyOrderApi.orderStationByOrderId(orderStationDTO);
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(), 100);
Assert.assertEquals(ShopWalletApi.getOrderDetailVO(orderNum, true).getOrderItemDetailList().get(0).getPlatformCommission(), 2);
}
}

View File

@ -0,0 +1,89 @@
package com.tmerclub.cloud.systemtest.test.store;
import cn.hutool.core.bean.BeanUtil;
import com.tmerclub.cloud.common.product.dto.SkuDTO;
import com.tmerclub.cloud.common.product.dto.SpuDTO;
import com.tmerclub.cloud.common.product.vo.SkuVO;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.store.ShopSubstituteSalesApi;
import com.moyuer.cloud.systemtest.api.supplier.SupplierProductApi;
import com.moyuer.cloud.systemtest.data.store.DeliveryData;
import com.moyuer.cloud.systemtest.data.store.ShopSubstituteSalesDtoData;
import com.moyuer.cloud.systemtest.data.supplier.SupplierProductData;
import org.testng.Assert;
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 ConsignmentManagementTest {
@Test(description = "代销设置基本流程")
public void consignmentManagementFlow() throws InterruptedException {
//发布商品和导入商品
Long supplierProductId = SupplierProductData.getSupplierProductId(1000L, DeliveryData.getSupplierFreeFeeDelivery(true), true);
Long productId = SupplierProductData.getProductId(supplierProductId, 8800L, 1, null, true, true);
//商家设置代销设置为按比例加价10%
ShopSubstituteSalesApi.updateShopSubstituteSales(ShopSubstituteSalesDtoData.getShopSubstituteSalesDTO(0, 0, 1000L, 0), true);
//根据商品ID获取商品销售价判断销售价是否为11
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getSkus().get(0).getPriceFee(), 1100);
//商家修改代销设置为按比例加价为11%
ShopSubstituteSalesApi.updateShopSubstituteSales(ShopSubstituteSalesDtoData.getShopSubstituteSalesDTO(0, 0, 1100L, 0), true);
//根据商品ID获取商品销售价判断销售价是否为11.1
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getSkus().get(0).getPriceFee(), 1110);
//商家修改代销设置为按固定数值加价0
ShopSubstituteSalesApi.updateShopSubstituteSales(ShopSubstituteSalesDtoData.getShopSubstituteSalesDTO(0, 1, 0L, 0), true);
//根据商品ID获取商品销售价判断销售价是否为10
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getSkus().get(0).getPriceFee(), 1000);
//商家修改代销设置为按固定数值加价10
ShopSubstituteSalesApi.updateShopSubstituteSales(ShopSubstituteSalesDtoData.getShopSubstituteSalesDTO(0, 1, 1000L, 0), true);
//根据商品ID获取商品销售价判断销售价是否为20
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getSkus().get(0).getPriceFee(), 2000);
//商家修改代销设置为手动设价
ShopSubstituteSalesApi.updateShopSubstituteSales(ShopSubstituteSalesDtoData.getShopSubstituteSalesDTO(1, 0, null, 0), true);
//根据商品ID获取商品销售价判断销售价是否为20
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getSkus().get(0).getPriceFee(), 2000);
//商家根据商品ID删除商品
ProductApi.delete(productId, true);
//商家根据供应商商品ID导入商品获取商品ID
Object obj = ProductApi.addSupplierProduct(Collections.singletonList(supplierProductId), true).get(0);
if (obj instanceof Integer) {
Integer ob = (Integer) obj;
productId = ob.longValue();
} else {
productId = (Long) obj;
}
//根据商品ID获取商品销售价判断销售价是否为10
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getSkus().get(0).getPriceFee(), 1000);
//商家修改代销设置为按比例加价100%
ShopSubstituteSalesApi.updateShopSubstituteSales(ShopSubstituteSalesDtoData.getShopSubstituteSalesDTO(0, 0, 10000L, 0), true);
//根据商品ID获取商品销售价判断销售价是否为20
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getSkus().get(0).getPriceFee(), 2000);
//供应商根据供应商商品ID修改供货价为20
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);
//根据商品ID获取商品销售价判断销售价是否为40
TimeUnit.SECONDS.sleep(2L);
Assert.assertEquals(ProductApi.info(productId, true).getSkus().get(0).getPriceFee(), 4000);
//删除商品
ProductApi.delete(productId, true);
SupplierProductApi.delete(supplierProductId, true);
}
}

View File

@ -0,0 +1,157 @@
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.tmerclub.cloud.common.product.vo.app.CategoryAppVO;
import com.moyuer.cloud.systemtest.api.amount.CategoryApi;
import com.moyuer.cloud.systemtest.api.amount.ProductApi;
import com.moyuer.cloud.systemtest.api.platform.PlatformProductApi;
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;
import java.util.stream.Stream;
/**
* @author lpj
*/
public class ProductTest {
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();
return Stream.of(categoryId, shopCategoryId).collect(Collectors.toList());
}
@DataProvider(name = "realProduct")
private Object[][] realProduct() {
Long transportId = DeliveryData.getFreeFeeDelivery(true);
Long productId = ProductApi.createProduct(SpuData.getRealSpu(getCategoryId().get(0), getCategoryId().get(1), transportId, 1000L), true);
return new Object[][]{{productId}};
}
@Test(description = "商品管理基本流程", dataProvider = "realProduct")
public void productFlow(Long productId) throws InterruptedException {
//下架
ProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(productId, null, 0));
//上架
ProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(productId, null, 1));
//批量下架
ProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(null, Collections.singletonList(productId), 0));
//批量上架
ProductApi.changeProductStatus(SpuPageSearchDtoData.getSpuPageSearchDTO(null, Collections.singletonList(productId), 1));
//平台置顶商品
PlatformProductApi.toTop(productId);
//平台取消置顶商品
PlatformProductApi.toTop(productId);
//平台违规下架商品
OfflineHandleEventDTO offlineHandleEventDTO = OfflineHandleEventDtoData.getOfflineHandleEventDTO(null, productId, "违规下架原因", null, null, null);
offlineHandleEventDTO.setHandleIds(Collections.singletonList(productId));
PlatformProductApi.offline(offlineHandleEventDTO);
//申请上架审核失败
//商家根据活动id获取下架信息
OfflineHandleEventVO offlineHandleEventVO = ProductApi.shopGetOfflineHandleEvent(productId);
//商家申请上架
ProductApi.apply(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = PlatformProductApi.platformGetOfflineHandleEvent(productId);
//平台审核失败
TimeUnit.SECONDS.sleep(2L);
PlatformProductApi.audit(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, "审核失败原因", 4));
//申请上架审核成功
//商家根据活动id获取下架信息
offlineHandleEventVO = ProductApi.shopGetOfflineHandleEvent(productId);
//商家申请上架
ProductApi.apply(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, "申请上架原因", null, null));
//平台根据活动id获取下架信息
offlineHandleEventVO = PlatformProductApi.platformGetOfflineHandleEvent(productId);
//平台审核成功
TimeUnit.SECONDS.sleep(2L);
PlatformProductApi.audit(OfflineHandleEventDtoData.getOfflineHandleEventDTO(offlineHandleEventVO.getEventId(), offlineHandleEventVO.getHandleId(), null, null, null, 3));
//平台删除商品
PlatformProductApi.platformDeleteProduct(productId);
}
@Test(description = "修改商品信息", dataProvider = "realProduct")
public void updateProduct(Long productId) {
SpuVO spuVO = ProductApi.info(productId, 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 = ProductApi.info(productId, 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);
ProductApi.update(spuDTO, true);
ProductApi.delete(productId, true);
}
@Test(description = "商品列表修改商品名称", dataProvider = "realProduct")
public void updateProductName(Long productId) {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setSpuId(productId);
List<SpuLangVO> spuLangVOList = ProductApi.info(productId, 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);
ProductApi.updateProductData(spuDTO);
ProductApi.delete(productId, true);
}
@Test(description = "商品列表修改商品价格", dataProvider = "realProduct")
public void updateProductPrice(Long productId) {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setSpuId(productId);
List<SkuVO> skuVOList = ProductApi.info(productId, 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);
ProductApi.updateProductData(spuDTO);
ProductApi.delete(productId, true);
}
@Test(description = "商品列表修改商品库存", dataProvider = "realProduct")
public void updateProductStock(Long productId) {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setSpuId(productId);
List<SkuVO> skuVOList = ProductApi.info(productId, 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);
ProductApi.updateProductData(spuDTO);
ProductApi.delete(productId, true);
}
@Test(description = "商品列表修改商品序号", dataProvider = "realProduct")
public void updateProductSeq(Long productId) {
SpuDTO spuDTO = new SpuDTO();
spuDTO.setSpuId(productId);
spuDTO.setSeq(1);
ProductApi.updateProductData(spuDTO);
ProductApi.delete(productId, true);
}
}

View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="MarketingTest Suite">
<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,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="ProductTest 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>
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>
</suite>

View File

@ -0,0 +1,47 @@
<?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.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"/>
<include name="unDeliverySupplierDeliveryTest"/>
<include name="unDeliverySupplierReceiveTest"/>
<include name="completedShopReceiveTest"/>
<include name="completedSupplierReceiveTest"/>
<include name="completedRefundDeliveryShopReceiveTest"/>
<include name="completedRefundDeliverySupplierReceiveTest"/>
<include name="unBuySupplierTest"/>
<include name="unBuySupplierRefundTest"/>
<include name="buySupplierRefundShopReceiveTest"/>
<include name="buySupplierRefundSupplierReceiveTest"/>
<include name="completeBuySupplierRefundShopReceiveTest"/>
<include name="completeBuySupplierRefundSupplierReceiveTest"/>
<include name="differentSupplerProductOrderTest"/>
<include name=""/>
</methods>
</class>
</classes>
</test>
<listeners>
<listener class-name="org.uncommons.reportng.HTMLReporter"/>
<listener class-name="org.uncommons.reportng.JUnitXMLReporter"/>
</listeners>
</suite>

13
tmerclub-admin/Dockerfile Normal file
View File

@ -0,0 +1,13 @@
FROM openjdk:17.0.2 as builder
WORKDIR application
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract
FROM openjdk:17.0.2
WORKDIR application
COPY --from=builder application/dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/application/ ./
ENTRYPOINT ["java", "-Xms512m", "-Xmx512m", "org.springframework.boot.loader.JarLauncher"]

101
tmerclub-admin/pom.xml Normal file
View File

@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>tmerclub</artifactId>
<groupId>com.moyuer.cloud</groupId>
<version>0.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>tmerclub-admin</artifactId>
<description>tmerclub 管理端</description>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-common-database</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-common-security</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-common-leaf</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-api-product</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-api-search</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-api-order</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-api-admin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-api-user</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-common-rocketmq</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-api-biz</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-common-mongodb</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-api-seckill</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.xuxueli</groupId>
<artifactId>xxl-job-core</artifactId>
</dependency>
<dependency>
<groupId>com.moyuer.cloud</groupId>
<artifactId>tmerclub-common-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>aliyun-java-sdk-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,74 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.config;
import com.tmerclub.cloud.common.rocketmq.config.RocketMqAdapter;
import com.tmerclub.cloud.common.rocketmq.config.RocketMqConstant;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
/**
* @author FrozenWatermelon
* @date 2021/3/30
*/
@RefreshScope
@Configuration
public class RocketMqConfig {
@Autowired
private RocketMqAdapter rocketMqAdapter;
@Lazy
@Bean(destroyMethod = "destroy")
public RocketMQTemplate shopWalletNotifyServiceTemplate() {
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.SHOP_WALLET_NOTIFY_SERVICE_TOPIC);
}
@Lazy
@Bean(destroyMethod = "destroy")
public RocketMQTemplate refundShopNotifyServiceTemplate() {
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.REFUND_SHOP_NOTIFY_SERVICE_TOPIC);
}
@Lazy
@Bean(destroyMethod = "destroy")
public RocketMQTemplate refundSuccessNotifySupplierTemplate() {
return rocketMqAdapter.getTemplateByTopicName(RocketMqConstant.ORDER_REFUND_SUCCESS_SETTLEMENT_SUPPLIER_TOPIC);
}
@Lazy
@Bean(destroyMethod = "destroy")
public RocketMQTemplate addShopWalletLogTemplate() {
return rocketMqAdapter.getTransactionTemplateByTopicName(RocketMqConstant.ADD_SHOP_WALLET_LOG_TOPIC);
}
@Lazy
@Bean(destroyMethod = "destroy")
public RocketMQTemplate updateShopRechargeSuccessTemplate() {
return rocketMqAdapter.getTransactionTemplateByTopicName(RocketMqConstant.UPDATE_SHOP_RECHARGE_SUCCESS_TOPIC);
}
@Lazy
@Bean(destroyMethod = "destroy")
public RocketMQTemplate addSupplierWalletLogTemplate() {
return rocketMqAdapter.getTransactionTemplateByTopicName(RocketMqConstant.ADD_SUPPLIER_WALLET_LOG_TOPIC);
}
@Lazy
@Bean(destroyMethod = "destroy")
public RocketMQTemplate openAllinPayRocketMQTemplate() {
return rocketMqAdapter.getTransactionTemplateByTopicName(RocketMqConstant.OPEN_ALLINPAY_TOPIC);
}
}

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 HomeStatus {
/**
* 是主页
*/
YES(1),
/**
* 不是主页
*/
NO(0);
private final Integer num;
public Integer value() {
return num;
}
HomeStatus(Integer num) {
this.num = num;
}
public static HomeStatus instance(Integer value) {
HomeStatus[] enums = values();
for (HomeStatus statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum;
}
}
return null;
}
}

View File

@ -0,0 +1,47 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.constant;
/**
* 热搜状态
*
* @author YXF
*/
public enum HotSearchType {
/**
* 商品热搜
*/
PROD(1),
/**
* 店铺热搜
*/
SHOP(2);
private final Integer num;
public Integer value() {
return num;
}
HotSearchType(Integer num) {
this.num = num;
}
public static HotSearchType instance(Integer value) {
HotSearchType[] enums = values();
for (HotSearchType 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/6/16 9:14
*/
public enum IsDefault {
/**
* 是默认
*/
YES(1),
/**
* 不是默认
*/
NO(0);
private final Integer num;
public Integer value() {
return num;
}
IsDefault(Integer num) {
this.num = num;
}
public static IsDefault instance(Integer value) {
IsDefault[] enums = values();
for (IsDefault statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum;
}
}
return null;
}
}

View File

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

View File

@ -0,0 +1,64 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.constant;
/**
* 收支类型 0支出 1收入
*
* @Author lth
* @Date 2021/6/10 14:12
*/
public enum ShopWalletIoType {
/**
* 0.支出
*/
EXPENDITURE(0, "支出"),
/**
* 1. 收入
*/
INCOME(1, "收入"),
;
private final Integer num;
private final String str;
public Integer value() {
return num;
}
public String str() {
return str;
}
ShopWalletIoType(Integer num, String str) {
this.num = num;
this.str = str;
}
public static ShopWalletIoType instance(Integer value) {
ShopWalletIoType[] enums = values();
for (ShopWalletIoType typeEnum : enums) {
if (typeEnum.value().equals(value)) {
return typeEnum;
}
}
return null;
}
public static String getIoName(Integer value) {
ShopWalletIoType[] enums = values();
for (ShopWalletIoType statusEnum : enums) {
if (statusEnum.value().equals(value)) {
return statusEnum.str;
}
}
return null;
}
}

View File

@ -0,0 +1,107 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import com.tmerclub.cloud.api.product.feign.SpuFeignClient;
import com.tmerclub.cloud.common.constant.StatusEnum;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.product.vo.SpuVO;
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.IndexImgDTO;
import com.tmerclub.cloud.multishop.model.IndexImg;
import com.tmerclub.cloud.multishop.service.IndexImgService;
import com.tmerclub.cloud.multishop.vo.IndexImgVO;
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 YXF
* @date 2020-11-24 16:38:32
*/
@RestController("adminIndexImgController")
@RequestMapping("/mp/index_img")
@Tag(name = "admin-轮播图")
public class IndexImgController {
@Autowired
private IndexImgService indexImgService;
@DubboReference
private SpuFeignClient spuFeignClient;
@GetMapping("/page")
@Operation(summary = "获取轮播图列表", description = "分页获取轮播图列表")
public ServerResponseEntity<PageVO<IndexImgVO>> page(@Valid PageDTO pageDTO, IndexImgDTO indexImgDTO) {
indexImgDTO.setShopId(AuthUserContext.get().getTenantId());
PageVO<IndexImgVO> indexImgPage = indexImgService.page(pageDTO, indexImgDTO);
return ServerResponseEntity.success(indexImgPage);
}
@GetMapping
@Operation(summary = "获取轮播图", description = "根据imgId获取轮播图")
public ServerResponseEntity<IndexImgVO> getByImgId(@RequestParam Long imgId) {
IndexImgVO indexImg = indexImgService.getByImgId(imgId);
if (Objects.nonNull(indexImg.getSpuId())) {
// 已被删除的商品不显示
ServerResponseEntity<SpuVO> spuResponse = spuFeignClient.getById(indexImg.getSpuId());
SpuVO spuVO;
if (spuResponse.isSuccess()
&& (spuVO = spuResponse.getData()) != null
&& spuVO.getStatus() != -1) {
indexImg.setSpu(spuVO);
} else {
indexImg.setSpuId(null);
}
}
return ServerResponseEntity.success(indexImg);
}
@PostMapping
@Operation(summary = "保存轮播图", description = "保存轮播图")
public ServerResponseEntity<Void> save(@Valid @RequestBody IndexImgDTO indexImgDTO) {
IndexImg indexImg = BeanUtil.map(indexImgDTO, IndexImg.class);
indexImg.setImgId(null);
indexImg.setShopId(AuthUserContext.get().getTenantId());
if (Objects.isNull(indexImgDTO.getStatus())) {
indexImg.setStatus(StatusEnum.ENABLE.value());
} else {
indexImg.setStatus(indexImgDTO.getStatus());
}
indexImgService.save(indexImg);
return ServerResponseEntity.success();
}
@PutMapping
@Operation(summary = "更新轮播图", description = "更新轮播图")
public ServerResponseEntity<Void> update(@Valid @RequestBody IndexImgDTO indexImgDTO) {
IndexImg indexImg = BeanUtil.map(indexImgDTO, IndexImg.class);
indexImg.setShopId(AuthUserContext.get().getTenantId());
indexImgService.update(indexImg);
return ServerResponseEntity.success();
}
@DeleteMapping
@Operation(summary = "删除轮播图", description = "根据轮播图id删除轮播图")
public ServerResponseEntity<Void> delete(@RequestParam Long imgId) {
Integer imgType = indexImgService.getByImgId(imgId).getImgType();
indexImgService.deleteById(imgId, AuthUserContext.get().getTenantId(), imgType);
return ServerResponseEntity.success();
}
}

View File

@ -0,0 +1,144 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import com.tmerclub.cloud.api.auth.constant.SysTypeEnum;
import com.tmerclub.cloud.common.constant.Constant;
import com.tmerclub.cloud.common.constant.StatusEnum;
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.NoticeType;
import com.tmerclub.cloud.multishop.dto.NoticeDTO;
import com.tmerclub.cloud.multishop.model.Notice;
import com.tmerclub.cloud.multishop.service.NoticeService;
import com.tmerclub.cloud.multishop.vo.NoticeVO;
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.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 公告
* @author YXF
* @date 2020-11-25 17:57:56
*/
@RestController("adminNoticeController")
@RequestMapping("/mp/notice")
@Tag(name = "admin-公告")
public class NoticeController {
@Autowired
private NoticeService noticeService;
@GetMapping("/page")
@Operation(summary = "获取公告列表", description = "分页获取公告列表")
public ServerResponseEntity<PageVO<NoticeVO>> page(@Valid PageDTO pageDTO, NoticeDTO noticeDTO) {
noticeDTO.setShopId(AuthUserContext.get().getTenantId());
noticeDTO.setAccountId(AuthUserContext.get().getTenantId());
PageVO<NoticeVO> noticePage = noticeService.page(pageDTO, noticeDTO);
return ServerResponseEntity.success(noticePage);
}
@GetMapping("/p/pagePlatformNotice")
@Operation(summary = "获取平台公告分页列表(商家端或供应商端)", description = "获取平台公告分页列表(商家端或供应商端)")
public ServerResponseEntity<PageVO<NoticeVO>> pagePlatformNotice(@Valid PageDTO pageDTO, NoticeDTO noticeDTO) {
Integer sysType = AuthUserContext.get().getSysType();
noticeDTO.setShopId(Constant.PLATFORM_SHOP_ID);
noticeDTO.setType(Objects.equals(sysType, SysTypeEnum.MULTISHOP.value()) ? NoticeType.TO_MULTISHOP.value() : NoticeType.TO_SUPPLIER.value());
noticeDTO.setAccountId(AuthUserContext.get().getTenantId());
noticeDTO.setSendTime(new Date());
noticeDTO.setStatus(StatusEnum.ENABLE.value());
PageVO<NoticeVO> notices = noticeService.pagePlatformNotice(pageDTO, noticeDTO);
return ServerResponseEntity.success(notices);
}
@GetMapping
@Operation(summary = "获取公告", description = "根据id获取公告")
public ServerResponseEntity<NoticeVO> getById(@RequestParam Long id) {
return ServerResponseEntity.success(noticeService.getById(id));
}
@PostMapping
@Operation(summary = "保存公告", description = "保存公告")
public ServerResponseEntity<Void> save(@Valid @RequestBody NoticeDTO noticeDTO) {
Notice notice = BeanUtil.map(noticeDTO, Notice.class);
Long shopId = AuthUserContext.get().getTenantId();
//商家端创建公告
if (!Objects.equals(shopId, Constant.PLATFORM_SHOP_ID)) {
notice.setTypes(NoticeType.TO_USER.value().toString());
notice.setImmediatelySend(1);
}
notice.setShopId(shopId);
noticeService.save(notice);
noticeService.removeCacheByShopIdAndType(shopId, NoticeType.TO_USER.value());
removeCache(notice.getTypes(), shopId);
return ServerResponseEntity.success();
}
@PutMapping
@Operation(summary = "更新公告", description = "更新公告")
public ServerResponseEntity<Void> update(@Valid @RequestBody NoticeDTO noticeDTO) {
Notice notice = BeanUtil.map(noticeDTO, Notice.class);
Long shopId = AuthUserContext.get().getTenantId();
NoticeVO dbNotice = noticeService.getById(notice.getId());
if (!Objects.equals(dbNotice.getShopId(), AuthUserContext.get().getTenantId())) {
throw new LuckException(ResponseEnum.UNAUTHORIZED);
}
boolean isPublish = Objects.equals(dbNotice.getStatus(), StatusEnum.DISABLE.value()) && Objects.equals(notice.getStatus(), StatusEnum.ENABLE.value());
if (isPublish) {
notice.setPublishTime(new Date());
} else {
notice.setPublishTime(null);
}
noticeService.update(notice);
removeCache(notice.getTypes(), shopId);
return ServerResponseEntity.success();
}
@DeleteMapping
@Operation(summary = "删除公告", description = "根据公告id删除公告")
@Parameter(name = "id", description = "公告id", required = true)
public ServerResponseEntity<Void> delete(@RequestParam("id") Long id) {
NoticeVO dbNotice = noticeService.getById(id);
Long shopId = AuthUserContext.get().getTenantId();
if (Objects.isNull(dbNotice)) {
return ServerResponseEntity.success();
} else if (!Objects.equals(dbNotice.getShopId(), shopId)) {
throw new LuckException(ResponseEnum.UNAUTHORIZED);
}
noticeService.deleteById(id);
removeCache(dbNotice.getTypes(), shopId);
return ServerResponseEntity.success();
}
private void removeCache(String dbNotice, Long shopId) {
List<Integer> typeList = Arrays.stream(dbNotice.split(",")).map(s -> Integer.parseInt(s.trim())).collect(Collectors.toList());
for (Integer type : typeList) {
noticeService.removeCacheByShopIdAndType(shopId, type);
}
}
}

View File

@ -0,0 +1,117 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import com.tmerclub.cloud.api.multishop.vo.ShopDetailVO;
import com.tmerclub.cloud.api.payment.feign.AllinpayFeignClient;
import com.tmerclub.cloud.common.constant.AllinpayConstant;
import com.tmerclub.cloud.common.constant.IdCardCollectProcessStatus;
import com.tmerclub.cloud.common.exception.LuckException;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.util.BeanUtil;
import com.tmerclub.cloud.multishop.constant.AuditStatus;
import com.tmerclub.cloud.multishop.dto.ShopCompanyDTO;
import com.tmerclub.cloud.multishop.model.ShopCompany;
import com.tmerclub.cloud.multishop.service.ShopAllinpayService;
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 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
* @Date 2021/8/14 16:53
*/
@RestController("adminShopCompanyController")
@RequestMapping("/mp/shop_company")
@Tag(name = "admin-商家工商信息")
public class ShopCompanyController {
@Autowired
private ShopCompanyService shopCompanyService;
@DubboReference
private AllinpayFeignClient allinpayFeignClient;
@Autowired
private ShopAllinpayService shopAllinpayService;
@Autowired
private ShopDetailService shopDetailService;
@GetMapping("/check_credit_code")
@Operation(summary = "检查统一信用码是否已存在", description = "检查统一信用码是否已存在")
public ServerResponseEntity<Boolean> checkCreditCode(@RequestParam("creditCode") String creditCode, @RequestParam("shopId") Long shopId) {
Boolean res = shopCompanyService.checkCreditCode(creditCode, shopId);
return ServerResponseEntity.success(res);
}
@PutMapping("/update_id_card_status")
@Operation(summary = "更新影印件状态", description = "通联独有")
public ServerResponseEntity<Integer> updateIdCardStatus(@RequestParam("shopId") Long shopId) {
if (!shopAllinpayService.getIsAllinpay()) {
return ServerResponseEntity.success();
}
if (Objects.isNull(shopId)) {
throw new LuckException("店铺id不能为空");
}
ShopCompanyVO shopCompanyVO = shopCompanyService.getShopCompanyByShopIdAndStatus(shopId, AuditStatus.WAITAUDIT.value());
if (Objects.isNull(shopCompanyVO)) {
shopCompanyVO = shopCompanyService.getShopCompanyByShopIdAndStatus(shopId, AuditStatus.SUCCESSAUDIT.value());
}
ShopDetailVO shopDetailVO = shopDetailService.getByShopId(shopId);
if (Objects.equals(shopDetailVO.getIdCardCollectProcessStatus(), IdCardCollectProcessStatus.ALL.value())) {
// 更新下更新时间
shopCompanyService.updateById(BeanUtil.map(shopCompanyVO, ShopCompany.class));
// 已经审核通过不用更新
return ServerResponseEntity.success(shopDetailVO.getIdCardCollectProcessStatus());
}
// 可能回调有问题导致这里没刷新所以多给一个接口
ServerResponseEntity<Integer> idCardStatus = allinpayFeignClient.getIdCardStatus(AllinpayConstant.SHOP + shopId);
if (!idCardStatus.isSuccess()) {
throw new LuckException(idCardStatus.getMsg());
}
if (Objects.equals(shopDetailVO.getIdCardCollectProcessStatus(), idCardStatus.getData())) {
// 更新下更新时间
shopCompanyService.updateById(BeanUtil.map(shopCompanyVO, ShopCompany.class));
// 状态一致不用更新
return ServerResponseEntity.success(idCardStatus.getData());
}
shopDetailService.updateAllinpayIdCardStatus(AllinpayConstant.SHOP + shopId, idCardStatus.getData());
shopDetailService.removeCacheByShopId(shopId);
return ServerResponseEntity.success(idCardStatus.getData());
}
@PutMapping("/upload_id_card")
@Operation(summary = "重新上传影印件", description = "通联独有")
public ServerResponseEntity<String> uploadIdCard(@RequestBody ShopCompanyDTO shopCompanyDTO) {
if (!shopAllinpayService.getIsAllinpay()) {
return ServerResponseEntity.success("非通联环境");
}
Long shopId = shopCompanyDTO.getShopId();
if (Objects.isNull(shopId)) {
throw new LuckException("店铺id不能为空");
}
ShopDetailVO shopDetailVO = shopDetailService.getByShopId(shopId);
ServerResponseEntity<Integer> idCardStatus = allinpayFeignClient.getIdCardStatus(AllinpayConstant.SHOP + shopId);
if (!idCardStatus.isSuccess()) {
throw new LuckException(idCardStatus.getMsg());
}
String result = shopCompanyService.uploadIdCard(shopCompanyDTO, shopDetailVO, idCardStatus.getData());
shopDetailService.removeCacheByShopId(shopId);
if (!Objects.equals(result, AllinpayConstant.ALLINPAY_AUDIT_SUCCESS) || Objects.equals(result, AllinpayConstant.ID_CARD_UPDATE_SUCCESS)) {
return ServerResponseEntity.showFailMsg(result);
}
return ServerResponseEntity.success(result);
}
}

View File

@ -0,0 +1,41 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.multishop.service.ShopDetailService;
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;
/**
* @Author lth
* @Date 2021/8/14 16:45
*/
@RestController("adminShopDetailController")
@RequestMapping("/mp/shop_detail")
@Tag(name = "admin-店铺信息")
public class ShopDetailController {
@Autowired
private ShopDetailService shopDetailService;
@GetMapping("/check_shop_name")
@Operation(summary = "检查店铺名称是否已存在", description = "检查店铺名称是否已存在")
public ServerResponseEntity<Boolean> checkShopName(@RequestParam("shopName") String shopName) {
Boolean res = shopDetailService.checkShopName(shopName);
return ServerResponseEntity.success(res);
}
}

View File

@ -0,0 +1,109 @@
/*
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
*
* https://www.mall4j.com/
*
* 未经允许不可做商业用途
*
* 版权所有侵权必究
*/
package com.tmerclub.cloud.multishop.controller.admin;
import com.tmerclub.cloud.api.auth.constant.SysTypeEnum;
import com.tmerclub.cloud.api.multishop.vo.ShopDetailVO;
import com.tmerclub.cloud.api.platform.constant.OfflineHandleEventStatus;
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.StatusEnum;
import com.tmerclub.cloud.common.exception.LuckException;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.multishop.service.ShopDetailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
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 YXF
* @date 2021-01-15 17:46:26
*/
@RestController("shopOfflineHandleEventController")
@RequestMapping("/mp/shop_offline_handle_event")
@Tag(name = "admin-下线处理事件")
public class ShopOfflineHandleEventController {
@DubboReference
private OfflineHandleEventFeignClient offlineHandleEventFeignClient;
@Autowired
private ShopDetailService shopDetailService;
@PostMapping("/offline")
@Operation(summary = "下线店铺", description = "下线店铺")
public ServerResponseEntity<Void> offline(@RequestBody OfflineHandleEventDTO offlineHandleEventDto) {
ShopDetailVO shopDetail = shopDetailService.getByShopId(offlineHandleEventDto.getHandleId());
if (shopDetail == null) {
throw new LuckException("该店铺不存在或者已删除");
}
// 添加下线处理记录
offlineHandleEventDto.setHandleType(OfflineHandleEventType.PROD.getValue());
offlineHandleEventDto.setHandleId(shopDetail.getShopId());
offlineHandleEventDto.setSysType(SysTypeEnum.MULTISHOP.value());
offlineHandleEventFeignClient.save(offlineHandleEventDto);
// 更新店铺状态为下线
shopDetailService.changeSpuStatus(shopDetail.getShopId(), StatusEnum.OFFLINE.value());
// 移除缓存
shopDetailService.removeCacheByShopId(shopDetail.getShopId());
return ServerResponseEntity.success();
}
@GetMapping("/get_offline_handle_event_by_prodId/{prodId}")
@Operation(summary = "获取最新下线店铺的事件", description = "通过prodId获取最新下线店铺的事件")
public ServerResponseEntity<OfflineHandleEventVO> getOfflineHandleEventByProdId(@PathVariable Long prodId) {
ServerResponseEntity<OfflineHandleEventVO> offlineHandleEventResponse =
offlineHandleEventFeignClient.getProcessingEventByHandleTypeAndHandleId(OfflineHandleEventType.SHOP.getValue(), prodId, null);
return ServerResponseEntity.success(offlineHandleEventResponse.getData());
}
@PostMapping("/shop_audit")
@Operation(summary = "审核店铺", description = "审核店铺")
public ServerResponseEntity<Void> prodAudit(@RequestBody OfflineHandleEventDTO offlineHandleEventDto) {
offlineHandleEventFeignClient.auditOfflineEvent(offlineHandleEventDto);
Long shopId = offlineHandleEventDto.getHandleId();
// 审核通过,更新店铺为营业状态
if (Objects.equals(offlineHandleEventDto.getStatus(), OfflineHandleEventStatus.AGREE_BY_PLATFORM.getValue())) {
shopDetailService.changeSpuStatus(shopId, StatusEnum.ENABLE.value());
} else if (Objects.equals(offlineHandleEventDto.getStatus(), OfflineHandleEventStatus.DISAGREE_BY_PLATFORM.getValue())) {
shopDetailService.changeSpuStatus(shopId, StatusEnum.OFFLINE.value());
}
// 移除缓存
shopDetailService.removeCacheByShopId(shopId);
return ServerResponseEntity.success();
}
@PostMapping("/audit_apply")
@Operation(summary = "违规店铺提交审核", description = "违规店铺提交审核")
public ServerResponseEntity<Void> auditApply(@RequestBody OfflineHandleEventDTO offlineHandleEventDto) {
Long shopId = offlineHandleEventDto.getHandleId();
ShopDetailVO shopDetailVO = shopDetailService.getByShopId(offlineHandleEventDto.getHandleId());
if (shopDetailVO == null) {
// 店铺信息不存在
throw new LuckException("店铺信息不存在");
}
offlineHandleEventFeignClient.updateToApply(offlineHandleEventDto);
// 更新店铺为待审核状态
shopDetailService.changeSpuStatus(shopId, StatusEnum.WAIT_AUDIT.value());
return ServerResponseEntity.success();
}
}

View File

@ -0,0 +1,121 @@
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.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.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.util.Objects;
/**
* @author 菠萝凤梨
*/
@RestController("adminShopRenovationUpDelController")
@RequestMapping("/mp/shop_renovation")
@Tag(name = "店铺页面-修改、删除、设为主页")
public class ShopRenovationUpDelController {
@Autowired
private ShopRenovationService shopRenovationService;
@Value("${mall4cloud.expose.operation.auth:}")
private Boolean permission;
@PutMapping("/update_pc")
@Operation(summary = "更新店铺pc端装修信息", description = "更新店铺装修信息")
public ServerResponseEntity<Void> update(@Valid @RequestBody ShopRenovationDTO shopRenovationDTO) {
shopRenovationDTO.setRenovationType(RenovationType.PC.value());
updateShopRenovation(shopRenovationDTO);
return ServerResponseEntity.success();
}
@PutMapping("/update_h5")
@Operation(summary = "更新店铺移动端装修信息", description = "更新店铺装修信息")
public ServerResponseEntity<Void> updateH5(@Valid @RequestBody ShopRenovationDTO shopRenovationDTO) {
shopRenovationDTO.setRenovationType(RenovationType.H5.value());
updateShopRenovation(shopRenovationDTO);
return ServerResponseEntity.success();
}
@DeleteMapping("/delete_pc")
@Operation(summary = "删除pc店铺装修信息", description = "根据店铺装修信息id删除店铺pc装修信息")
public ServerResponseEntity<Void> delete(@RequestParam Long renovationId) {
deleteRenovation(renovationId);
return ServerResponseEntity.success();
}
@DeleteMapping("/delete_h5")
@Operation(summary = "删除h5店铺装修信息", description = "根据店铺装修信息id删除店铺h5装修信息")
public ServerResponseEntity<Void> deleteH5(@RequestParam Long renovationId) {
deleteRenovation(renovationId);
return ServerResponseEntity.success();
}
@PutMapping("/update_home_status_pc")
@Operation(summary = "PC端修改主页标识", description = "PC端修改主页标识")
public ServerResponseEntity<Void> updateHomeStatus(@RequestParam Long renovationId) {
updateShopRenovationStatus(renovationId);
return ServerResponseEntity.success();
}
@PutMapping("/update_h5_home_status")
@Operation(summary = "移动端修改主页标识", description = "移动端修改主页标识")
public ServerResponseEntity<Void> updateH5HomeStatus(@RequestParam Long renovationId) {
updateShopRenovationStatus(renovationId);
return ServerResponseEntity.success();
}
private void updateShopRenovationStatus(Long renovationId) {
if (BooleanUtil.isFalse(permission)) {
throw new LuckException("抱歉,当前无操作权限");
}
ShopRenovation shopRenovation = shopRenovationService.getByRenovationId(renovationId);
if (!Objects.equals(shopRenovation.getShopId(), AuthUserContext.get().getTenantId())) {
throw new LuckException(ResponseEnum.UNAUTHORIZED);
}
shopRenovationService.updateToHomePage(shopRenovation);
shopRenovationService.removeCache(shopRenovation.getShopId(), shopRenovation.getRenovationType(), shopRenovation.getRenovationId());
}
private void updateShopRenovation(ShopRenovationDTO shopRenovationDTO) {
if (BooleanUtil.isFalse(permission)) {
throw new LuckException("抱歉,当前无操作权限");
}
ShopRenovation shopRenovation = BeanUtil.map(shopRenovationDTO, ShopRenovation.class);
ShopRenovation shopRenovationDb = shopRenovationService.getByRenovationId(shopRenovation.getRenovationId());
if (Objects.isNull(shopRenovationDb)) {
throw new LuckException("该装修不存在,请刷新页面重试");
}
if (!Objects.equals(shopRenovationDb.getShopId(), AuthUserContext.get().getTenantId())) {
throw new LuckException(ResponseEnum.UNAUTHORIZED);
}
shopRenovationService.update(shopRenovation);
shopRenovationService.removeCache(shopRenovationDb.getShopId(), shopRenovationDTO.getRenovationType(), shopRenovationDb.getRenovationId());
}
private void deleteRenovation(Long renovationId) {
if (BooleanUtil.isFalse(permission)) {
throw new LuckException("抱歉,当前无操作权限");
}
ShopRenovation shopRenovation = shopRenovationService.getByRenovationId(renovationId);
if (!Objects.equals(shopRenovation.getShopId(), AuthUserContext.get().getTenantId())) {
throw new LuckException(ResponseEnum.UNAUTHORIZED);
}
shopRenovationService.deleteById(renovationId, shopRenovation.getRenovationType(), shopRenovation.getShopId());
shopRenovationService.removeCache(shopRenovation.getShopId(), shopRenovation.getRenovationType(), shopRenovation.getRenovationId());
}
}

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