mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-26 01:01:52 +08:00
Merge remote-tracking branch 'yudao/feature/mall_product' into feature/mall_product
# Conflicts: # sql/mysql/optional/mall.sql
This commit is contained in:
commit
d08b9530a2
@ -305,14 +305,147 @@ CREATE TABLE `product_favorite` (
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB COMMENT='喜欢的商品表';
|
||||
) ENGINE=InnoDB COMMENT='商品收藏表';
|
||||
|
||||
-- Table structure for trade_delivery_express_template
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `trade_delivery_express_template`;
|
||||
CREATE TABLE `trade_delivery_express_template` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||
`name` varchar(64) NOT NULL COMMENT '模板名称',
|
||||
`charge_mode` tinyint NOT NULL DEFAULT 1 COMMENT '配送计费方式 1:按件 2:按重量 3:按体积',
|
||||
`sort` int NOT NULL DEFAULT 0 COMMENT '排序',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB COMMENT='快递运费模板';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for trade_delivery_express_template_free
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `trade_delivery_express_template_free`;
|
||||
CREATE TABLE `trade_delivery_express_template_free` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||
`template_id` bigint NOT NULL COMMENT '配送模板编号, 对应delivery_template表id',
|
||||
`area_id` int NOT NULL COMMENT '包邮区域id',
|
||||
`free_price` int NOT NULL COMMENT '包邮金额(单位分) 订单总金额>包邮金额才免运费',
|
||||
`free_count` int NOT NULL DEFAULT 0 COMMENT '包邮件数,订单总件数>包邮件数才免运费',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB COMMENT='快递运费模板包邮配置';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for trade_delivery_express_template_charge
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `trade_delivery_express_template_charge`;
|
||||
CREATE TABLE `trade_delivery_express_template_charge` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||
`template_id` bigint NOT NULL COMMENT '配送模板编号, 对应delivery_template表id',
|
||||
`area_id` int NOT NULL COMMENT '配送区域id 1:适用于全国',
|
||||
`charge_mode` tinyint NOT NULL COMMENT '配送计费方式 1:按件 2:按重量 3:按体积',
|
||||
`start_count` double NOT NULL COMMENT '首件数量(件数,重量,或体积)',
|
||||
`start_price` int NOT NULL COMMENT '起步价(单位分)',
|
||||
`extra_count` double NOT NULL COMMENT '续件数量(件,重量,或体积)',
|
||||
`extra_price` int NOT NULL COMMENT '额外价(单位分)',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB COMMENT='快递运费模板计费配置';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for trade_delivery_pick_up_store
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `trade_delivery_pick_up_store`;
|
||||
CREATE TABLE `trade_delivery_pick_up_store` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||
`name` varchar(64) NOT NULL COMMENT '门店名称',
|
||||
`introduction` varchar(256) COMMENT '门店简介',
|
||||
`phone` varchar(16) NOT NULL COMMENT '门店手机',
|
||||
`area_id` int NOT NULL COMMENT '区域id',
|
||||
`detail_address` varchar(256) NOT NULL COMMENT '门店详细地址',
|
||||
`logo` varchar(256) NOT NULL COMMENT '门店logo',
|
||||
`opening_time` time NOT NULL COMMENT '营业开始时间',
|
||||
`closing_time` time NOT NULL COMMENT '营业结束时间',
|
||||
`latitude` varchar(128) NOT NULL COMMENT '纬度',
|
||||
`longitude` varchar(128) NOT NULL COMMENT '经度',
|
||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '门店状态(0正常 1停用)',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB COMMENT='自提门店';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for trade_delivery_pick_up_store_staff
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `trade_delivery_pick_up_store_staff`;
|
||||
CREATE TABLE `trade_delivery_pick_up_store_staff` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||
store_id bigint NOT NULL COMMENT '自提门店编号',
|
||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0正常 1停用)',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB COMMENT='自提门店店员';
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for trade_delivery_pick_up_store_staff
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `trade_delivery_pick_up_store_staff`;
|
||||
CREATE TABLE `trade_delivery_pick_up_store_staff` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||
`admin_user_id` bigint NOT NULL COMMENT '管理员用户id',
|
||||
store_id bigint NOT NULL COMMENT '自提门店编号',
|
||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0正常 1停用)',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB COMMENT='自提门店店员';
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of product_spu
|
||||
-- Table structure for trade_delivery_express
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
COMMIT;
|
||||
DROP TABLE IF EXISTS `trade_delivery_express`;
|
||||
CREATE TABLE `trade_delivery_express` (
|
||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||
`code` varchar(64) NOT NULL COMMENT '快递公司编号',
|
||||
`name` varchar(64) NOT NULL COMMENT '快递公司名称',
|
||||
`logo` varchar(256) COMMENT '快递公司logo',
|
||||
`sort` int NOT NULL DEFAULT 0 COMMENT '排序',
|
||||
`status` tinyint NOT NULL DEFAULT 0 COMMENT '状态(0正常 1停用)',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB COMMENT='快递公司';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@ -347,6 +480,21 @@ INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2029, 'Banner删除', 'market:banner:delete', 3, 4, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2164, '配送管理', '', 1, 0, 2072, 'delivery', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:18:02', '1', '2023-05-18 09:48:48', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2165, '快递发货', '', 1, 0, 2164, 'express', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:22:06', '1', '2023-05-18 09:22:06', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2166, '门店自提', '', 1, 1, 2164, 'pick-up-store', '', '', '', 0, b'1', b'1', b'1', '1', '2023-05-18 09:23:14', '1', '2023-05-18 09:23:14', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2167, '快递公司', '', 2, 0, 2165, 'express', '', 'mall/trade/delivery/express/index', 'Express', 0, b'1', b'1', b'1', '1', '2023-05-18 09:27:21', '1', '2023-05-18 22:11:14', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2168, '快递公司查询', 'trade:delivery:express:query', 3, 1, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2169, '快递公司创建', 'trade:delivery:express:create', 3, 2, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2170, '快递公司更新', 'trade:delivery:express:update', 3, 3, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2171, '快递公司删除', 'trade:delivery:express:delete', 3, 4, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2172, '快递公司导出', 'trade:delivery:express:export', 3, 5, 2167, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-18 09:37:53', '', '2023-05-18 09:37:53', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2178, '快递运费模板导出', 'trade:delivery:express-template:export', 3, 5, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2177, '快递运费模板删除', 'trade:delivery:express-template:delete', 3, 4, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2176, '快递运费模板更新', 'trade:delivery:express-template:update', 3, 3, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2175, '快递运费模板创建', 'trade:delivery:express-template:create', 3, 2, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2174, '快递运费模板查询', 'trade:delivery:express-template:query', 3, 1, 2173, '', '', '', NULL, 0, b'1', b'1', b'1', '', '2023-05-20 06:49:53', '', '2023-05-20 06:49:53', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_menu`(`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `component_name`, `status`, `visible`, `keep_alive`, `always_show`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2173, '运费模版', 'trade:delivery:express-template:query', 2, 1, 2165, 'express-template', '', 'mall/trade/delivery/expressTemplate/index', 'ExpressTemplate', 0, b'1', b'1', b'1', '1', '2023-05-20 06:48:10', '1', '2023-05-20 06:48:29', b'0');
|
||||
BEGIN;
|
||||
|
||||
BEGIN;
|
||||
@ -360,3 +508,13 @@ INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`,
|
||||
INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '双', 8, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
||||
INSERT INTO `system_dict_data`(`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1, '卷', 9, 'product_unit', 0, '', '', '', 1, NOW(), 1, NOW(), b'0');
|
||||
COMMIT;
|
||||
|
||||
-- ----------------------------
|
||||
-- 数字字典,快递计费方式
|
||||
-- ----------------------------
|
||||
BEGIN;
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_type`(`id`, `name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `deleted_time`) VALUES (169, '快递计费方式', 'trade_delivery_express_charge_mode', 0, '用于商城交易模块配送管理', '1', '2023-05-21 22:45:03', '1', '2023-05-21 22:45:03', b'0', '1970-01-01 00:00:00');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1237, 2, '按体积', '3', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:47:18', '1', '2023-05-21 22:47:18', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1236, 1, '按重量', '2', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:58', '1', '2023-05-21 22:46:58', b'0');
|
||||
INSERT INTO `ruoyi-vue-pro`.`system_dict_data`(`id`, `sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1235, 0, '按件', '1', 'trade_delivery_express_charge_mode', 0, '', '', '', '1', '2023-05-21 22:46:40', '1', '2023-05-21 22:46:40', b'0');
|
||||
COMMIT;
|
@ -33,7 +33,11 @@ public class ServiceErrorCodeRange {
|
||||
// 模块 system 错误码区间 [1-002-000-000 ~ 1-003-000-000)
|
||||
// 模块 report 错误码区间 [1-003-000-000 ~ 1-004-000-000)
|
||||
// 模块 member 错误码区间 [1-004-000-000 ~ 1-005-000-000)
|
||||
// 模块 mp 错误码区间 [1-006-000-000 ~ 1-007-000-000)
|
||||
// 模块 pay 错误码区间 [1-007-000-000 ~ 1-008-000-000)
|
||||
// 模块 product 错误码区间 [1-008-000-000 ~ 1-009-000-000)
|
||||
// 模块 bpm 错误码区间 [1-009-000-000 ~ 1-010-000-000)
|
||||
// 模块 trade 错误码区间 [1-011-000-000 ~ 1-012-000-000)
|
||||
// 模块 promotion 错误码区间 [1-013-000-000 ~ 1-014-000-000)
|
||||
|
||||
}
|
||||
|
@ -3,16 +3,16 @@ package cn.iocoder.yudao.module.bpm.enums;
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* 工作流 错误码枚举类
|
||||
* Bpm 错误码枚举类
|
||||
*
|
||||
* 工作流系统,使用 1-009-000-000 段
|
||||
* bpm 系统,使用 1-009-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 通用流程处理 模块 1-009-000-000 ==========
|
||||
// ========== 通用流程处理 模块 1009000000 ==========
|
||||
ErrorCode HIGHLIGHT_IMG_ERROR = new ErrorCode(1009000002, "获取高亮流程图异常");
|
||||
|
||||
// ========== OA 流程模块 1-009-001-000 ==========
|
||||
// ========== OA 流程模块 1009001000 ==========
|
||||
ErrorCode OA_LEAVE_NOT_EXISTS = new ErrorCode(1009001001, "请假申请不存在");
|
||||
ErrorCode OA_PM_POST_NOT_EXISTS = new ErrorCode(1009001002, "项目经理岗位未设置");
|
||||
ErrorCode OA_DEPART_PM_POST_NOT_EXISTS = new ErrorCode(1009001009, "部门的项目经理不存在");
|
||||
@ -21,7 +21,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode OA_HR_POST_NOT_EXISTS = new ErrorCode(1009001006, "HR岗位未设置");
|
||||
ErrorCode OA_DAY_LEAVE_ERROR = new ErrorCode(1009001007, "请假天数必须>=1");
|
||||
|
||||
// ========== 流程模型 1-009-002-000 ==========
|
||||
// ========== 流程模型 1009002000 ==========
|
||||
ErrorCode MODEL_KEY_EXISTS = new ErrorCode(1009002000, "已经存在流程标识为【{}】的流程");
|
||||
ErrorCode MODEL_NOT_EXISTS = new ErrorCode(1009002001, "流程模型不存在");
|
||||
ErrorCode MODEL_KEY_VALID = new ErrorCode(1009002002, "流程标识格式不正确,需要以字母或下划线开头,后接任意字母、数字、中划线、下划线、句点!");
|
||||
@ -30,34 +30,34 @@ public interface ErrorCodeConstants {
|
||||
"原因:用户任务({})未配置分配规则,请点击【修改流程】按钮进行配置");
|
||||
ErrorCode MODEL_DEPLOY_FAIL_TASK_INFO_EQUALS = new ErrorCode(1009003005, "流程定义部署失败,原因:信息未发生变化");
|
||||
|
||||
// ========== 流程定义 1-009-003-000 ==========
|
||||
// ========== 流程定义 1009003000 ==========
|
||||
ErrorCode PROCESS_DEFINITION_KEY_NOT_MATCH = new ErrorCode(1009003000, "流程定义的标识期望是({}),当前是({}),请修改 BPMN 流程图");
|
||||
ErrorCode PROCESS_DEFINITION_NAME_NOT_MATCH = new ErrorCode(1009003001, "流程定义的名字期望是({}),当前是({}),请修改 BPMN 流程图");
|
||||
ErrorCode PROCESS_DEFINITION_NOT_EXISTS = new ErrorCode(1009003002, "流程定义不存在");
|
||||
ErrorCode PROCESS_DEFINITION_IS_SUSPENDED = new ErrorCode(1009003003, "流程定义处于挂起状态");
|
||||
ErrorCode PROCESS_DEFINITION_BPMN_MODEL_NOT_EXISTS = new ErrorCode(1009003004, "流程定义的模型不存在");
|
||||
|
||||
// ========== 流程实例 1-009-004-000 ==========
|
||||
// ========== 流程实例 1009004000 ==========
|
||||
ErrorCode PROCESS_INSTANCE_NOT_EXISTS = new ErrorCode(1009004000, "流程实例不存在");
|
||||
ErrorCode PROCESS_INSTANCE_CANCEL_FAIL_NOT_EXISTS = new ErrorCode(1009004001, "流程取消失败,流程不处于运行中");
|
||||
ErrorCode PROCESS_INSTANCE_CANCEL_FAIL_NOT_SELF = new ErrorCode(1009004002, "流程取消失败,该流程不是你发起的");
|
||||
|
||||
// ========== 流程任务 1-009-005-000 ==========
|
||||
// ========== 流程任务 1009005000 ==========
|
||||
ErrorCode TASK_COMPLETE_FAIL_NOT_EXISTS = new ErrorCode(1009005000, "审批任务失败,原因:该任务不处于未审批");
|
||||
ErrorCode TASK_COMPLETE_FAIL_ASSIGN_NOT_SELF = new ErrorCode(1009005001, "审批任务失败,原因:该任务的审批人不是你");
|
||||
|
||||
// ========== 流程任务分配规则 1-009-006-000 ==========
|
||||
// ========== 流程任务分配规则 1009006000 ==========
|
||||
ErrorCode TASK_ASSIGN_RULE_EXISTS = new ErrorCode(1009006000, "流程({}) 的任务({}) 已经存在分配规则");
|
||||
ErrorCode TASK_ASSIGN_RULE_NOT_EXISTS = new ErrorCode(1009006001, "流程任务分配规则不存在");
|
||||
ErrorCode TASK_UPDATE_FAIL_NOT_MODEL = new ErrorCode(1009006002, "只有流程模型的任务分配规则,才允许被修改");
|
||||
ErrorCode TASK_CREATE_FAIL_NO_CANDIDATE_USER = new ErrorCode(1009006003, "操作失败,原因:找不到任务的审批人!");
|
||||
ErrorCode TASK_ASSIGN_SCRIPT_NOT_EXISTS = new ErrorCode(1009006004, "操作失败,原因:任务分配脚本({}) 不存在");
|
||||
|
||||
// ========== 动态表单模块 1-009-010-000 ==========
|
||||
// ========== 动态表单模块 1009010000 ==========
|
||||
ErrorCode FORM_NOT_EXISTS = new ErrorCode(1009010000, "动态表单不存在");
|
||||
ErrorCode FORM_FIELD_REPEAT = new ErrorCode(1009010001, "表单项({}) 和 ({}) 使用了相同的字段名({})");
|
||||
|
||||
// ========== 用户组模块 1-009-011-000 ==========
|
||||
// ========== 用户组模块 1009011000 ==========
|
||||
ErrorCode USER_GROUP_NOT_EXISTS = new ErrorCode(1009011000, "用户组不存在");
|
||||
ErrorCode USER_GROUP_IS_DISABLE = new ErrorCode(1009011001, "名字为【{}】的用户组已被禁用");
|
||||
|
||||
|
@ -50,7 +50,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode COMMENT_ADDITIONAL_EXISTS = new ErrorCode(1008007003, "商品追加评价已存在");
|
||||
|
||||
// ========== 商品 收藏 1008008000 ==========
|
||||
ErrorCode COLLECTION_EXISTS = new ErrorCode(1008008000, "该商品已经被收藏");
|
||||
ErrorCode COLLECTION_NOT_EXISTS = new ErrorCode(1008008001, "商品收藏不存在");
|
||||
ErrorCode FAVORITE_EXISTS = new ErrorCode(1008008000, "该商品已经被收藏");
|
||||
ErrorCode FAVORITE_NOT_EXISTS = new ErrorCode(1008008001, "商品收藏不存在");
|
||||
|
||||
}
|
||||
|
@ -1,22 +1,28 @@
|
||||
package cn.iocoder.yudao.module.product.controller.app.favorite;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoritePageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReqVO;
|
||||
import cn.iocoder.yudao.module.product.service.favorite.ProductFavoriteService;
|
||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO;
|
||||
import cn.iocoder.yudao.module.product.convert.favorite.ProductFavoriteConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.favorite.ProductFavoriteDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
||||
import cn.iocoder.yudao.module.product.service.favorite.ProductFavoriteService;
|
||||
import cn.iocoder.yudao.module.product.service.spu.ProductSpuService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.module.product.enums.favorite.ProductFavoriteTypeEnum.COLLECT;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
|
||||
@Tag(name = "用户 APP - 商品收藏")
|
||||
@RestController
|
||||
@ -25,31 +31,48 @@ public class AppFavoriteController {
|
||||
|
||||
@Resource
|
||||
private ProductFavoriteService productFavoriteService;
|
||||
@Resource
|
||||
private ProductSpuService productSpuService;
|
||||
|
||||
// TODO @jason:创建;create
|
||||
@PostMapping(value = "/collect")
|
||||
@PostMapping(value = "/create")
|
||||
@Operation(summary = "商品收藏")
|
||||
public CommonResult<Boolean> collect(@RequestBody @Valid AppFavoriteReqVO reqVO) {
|
||||
Assert.isTrue(Objects.equals(COLLECT.getType(), reqVO.getType()), "参数type 不匹配");
|
||||
return success(productFavoriteService.collect(reqVO));
|
||||
//@PreAuthenticated TODO 暂时注释
|
||||
public CommonResult<Long> createFavorite(@RequestBody @Valid AppFavoriteReqVO reqVO) {
|
||||
return success(productFavoriteService.createFavorite(getLoginUserId(), reqVO));
|
||||
}
|
||||
|
||||
// TODO @jason:创建;delete;使用 @DeleteMapping
|
||||
@PostMapping(value = "/cancelCollect")
|
||||
@Operation(summary = "取消商品收藏(通过商品详情)")
|
||||
public CommonResult<Boolean> cancelCollect(@RequestBody @Valid AppFavoriteReqVO reqVO) {
|
||||
// TODO @jason:是不是不用校验呀?
|
||||
Assert.isTrue(Objects.equals(COLLECT.getType(), reqVO.getType()), "参数type 不匹配");
|
||||
return success(productFavoriteService.cancelCollect(reqVO));
|
||||
@DeleteMapping(value = "/delete")
|
||||
@Operation(summary = "取消商品收藏")
|
||||
public CommonResult<Boolean> deleteFavorite(@RequestBody @Valid AppFavoriteReqVO reqVO) {
|
||||
productFavoriteService.deleteFavorite(getLoginUserId(), reqVO);
|
||||
return success(Boolean.TRUE);
|
||||
}
|
||||
|
||||
// TODO @jason:page;分页
|
||||
@GetMapping(value = "/collectList")
|
||||
@Operation(summary = "商品收藏列表")
|
||||
public CommonResult<PageResult<AppFavoriteRespVO>> pageCollectList(AppFavoritePageReqVO reqVO) {
|
||||
return success(productFavoriteService.pageCollectList(reqVO));
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "分页获取商品收藏列表")
|
||||
public CommonResult<PageResult<AppFavoriteRespVO>> getFavoritePage(AppFavoritePageReqVO reqVO) {
|
||||
PageResult<ProductFavoriteDO> favoritePage = productFavoriteService.getFavoritePage(getLoginUserId(), reqVO);
|
||||
if (CollUtil.isEmpty(favoritePage.getList())) {
|
||||
return success(PageResult.empty());
|
||||
}
|
||||
|
||||
// TODO @json:需要在给一个,用户查询某个商品是否收藏;详情页要用
|
||||
// 得到商品 spu 信息
|
||||
List<ProductFavoriteDO> favorites = favoritePage.getList();
|
||||
List<Long> spuIds = convertList(favorites, ProductFavoriteDO::getSpuId);
|
||||
List<ProductSpuDO> spus = productSpuService.getSpuList(spuIds);
|
||||
|
||||
// 转换 VO 结果
|
||||
PageResult<AppFavoriteRespVO> pageResult = new PageResult<>(favoritePage.getTotal());
|
||||
pageResult.setList(ProductFavoriteConvert.INSTANCE.convertList(favorites, spus));
|
||||
return success(pageResult);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/exits")
|
||||
@Operation(summary = "检查是否收藏过商品")
|
||||
public CommonResult<Boolean> isFavoriteExists(AppFavoriteReqVO reqVO) {
|
||||
ProductFavoriteDO favoriteDO = productFavoriteService.getFavorite(getLoginUserId(), reqVO);
|
||||
return success(Objects.nonNull(favoriteDO));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import javax.validation.constraints.NotNull;
|
||||
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||
|
||||
@Schema(description = "用户 APP - 商品收藏创建 Request VO")
|
||||
@Schema(description = "用户 APP - 商品收藏 Request VO") // 用于收藏、取消收藏、获取收藏
|
||||
@Data
|
||||
public class AppFavoriteReqVO {
|
||||
|
||||
|
@ -2,21 +2,19 @@ package cn.iocoder.yudao.module.product.controller.app.favorite.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
|
||||
|
||||
@Schema(description = "用户APP - 商品收藏 Response VO")
|
||||
@Data
|
||||
public class AppFavoriteRespVO {
|
||||
|
||||
// TODO @jason:required true 哈
|
||||
@Schema(description = "编号", example = "1")
|
||||
@Schema(description = "编号", requiredMode = REQUIRED, example = "1")
|
||||
private Long id;
|
||||
|
||||
// TODO @jason:required true 哈
|
||||
@Schema(description = "商品 SPU 编号", example = "29502")
|
||||
@Schema(description = "商品 SPU 编号", requiredMode = REQUIRED, example = "29502")
|
||||
private Long spuId;
|
||||
|
||||
// TODO @jason:required true 哈
|
||||
@Schema(description = "类型", example = "1")
|
||||
@Schema(description = "类型", requiredMode = REQUIRED, example = "1")
|
||||
private Integer type;
|
||||
|
||||
// ========== 商品相关字段 ==========
|
||||
|
@ -1,14 +1,38 @@
|
||||
package cn.iocoder.yudao.module.product.convert.favorite;
|
||||
|
||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.favorite.ProductFavoriteDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap;
|
||||
|
||||
@Mapper
|
||||
public interface ProductFavoriteConvert {
|
||||
|
||||
ProductFavoriteConvert INSTANCE = Mappers.getMapper(ProductFavoriteConvert.class);
|
||||
|
||||
ProductFavoriteDO convert(Long userId, AppFavoriteReqVO reqVO);
|
||||
|
||||
@Mapping(target = "id", source = "favorite.id")
|
||||
@Mapping(target = "spuName", source = "spu.name")
|
||||
AppFavoriteRespVO convert(ProductSpuDO spu, ProductFavoriteDO favorite);
|
||||
|
||||
default List<AppFavoriteRespVO> convertList(List<ProductFavoriteDO> favorites, List<ProductSpuDO> spus) {
|
||||
List<AppFavoriteRespVO> resultList = new ArrayList<>(favorites.size());
|
||||
Map<Long, ProductSpuDO> spuMap = convertMap(spus, ProductSpuDO::getId);
|
||||
for (ProductFavoriteDO favorite : favorites) {
|
||||
ProductSpuDO spuDO = spuMap.get(favorite.getSpuId());
|
||||
resultList.add(convert(spuDO, favorite));
|
||||
}
|
||||
return resultList;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 配送模板 SPU DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("delivery_template")
|
||||
@KeySequence("delivery_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class DeliveryTemplateDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号,自增
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
}
|
@ -1,14 +1,15 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.favorite;
|
||||
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO;
|
||||
import cn.iocoder.yudao.module.product.enums.favorite.ProductFavoriteTypeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 喜爱商品 DO
|
||||
* 商品收藏 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@ -20,7 +21,7 @@ import lombok.*;
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ProductFavoriteDO extends TenantBaseDO { // TODO @jason:如无必要,使用 BaseDO 哈。例如说 tenant_id 在业务里,是否需要使用到
|
||||
public class ProductFavoriteDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号,主键自增
|
||||
@ -40,7 +41,9 @@ public class ProductFavoriteDO extends TenantBaseDO { // TODO @jason:如无必
|
||||
*/
|
||||
private Long spuId;
|
||||
/**
|
||||
* 类型 1 收藏;2 点赞 // TODO @jason:不要注释 1 收藏 2 点赞;而是注释好,它对应的枚举类
|
||||
* 类型
|
||||
*
|
||||
* 枚举 {@link ProductFavoriteTypeEnum}
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
|
@ -1,10 +1,8 @@
|
||||
package cn.iocoder.yudao.module.product.dal.dataobject.spu;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.delivery.DeliveryTemplateDO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO;
|
||||
import cn.iocoder.yudao.module.product.enums.spu.ProductSpuStatusEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
@ -143,7 +141,7 @@ public class ProductSpuDO extends BaseDO {
|
||||
/**
|
||||
* 物流配置模板编号
|
||||
*
|
||||
* 关联 {@link DeliveryTemplateDO#getId()}
|
||||
* 关联 { TradeDeliveryExpressTemplateDO#getId()}
|
||||
*/
|
||||
private Long deliveryTemplateId;
|
||||
|
||||
|
@ -1,38 +1,28 @@
|
||||
package cn.iocoder.yudao.module.product.dal.mysql.favorite;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.favorite.ProductFavoriteDO;
|
||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface ProductFavoriteMapper extends BaseMapperX<ProductFavoriteDO> {
|
||||
|
||||
default ProductFavoriteDO selectByUserAndSpuAndType(Long userId, Long spuId, Integer type) {
|
||||
Assert.notNull(userId, "the userId argument must not be null");
|
||||
Assert.notNull(spuId, "the spuId argument must not be null");
|
||||
Assert.notNull(type, "the type argument must not be null");
|
||||
return selectOne(new LambdaQueryWrapperX<ProductFavoriteDO>()
|
||||
.eq(ProductFavoriteDO::getUserId, userId)
|
||||
.eq(ProductFavoriteDO::getSpuId, spuId)
|
||||
.eq(ProductFavoriteDO::getType, type));
|
||||
}
|
||||
|
||||
default PageResult<AppFavoriteRespVO> selectPageByUserAndType(Long userId, Integer type, PageParam pageParam){
|
||||
Page<AppFavoriteRespVO> page = MyBatisUtils.buildPage(pageParam);
|
||||
page = selectFavoriteProductList(page, userId, type);
|
||||
return new PageResult<>(page.getRecords(), page.getTotal());
|
||||
default PageResult<ProductFavoriteDO> selectPageByUserAndType(Long userId, Integer type, PageParam pageParam) {
|
||||
return selectPage(pageParam, new LambdaQueryWrapper<ProductFavoriteDO>()
|
||||
.eq(ProductFavoriteDO::getUserId, userId)
|
||||
.eq(ProductFavoriteDO::getType, type)
|
||||
.orderByDesc(ProductFavoriteDO::getId));
|
||||
}
|
||||
|
||||
// TODO @jason:内存中拼接哈。这样好兼容更多的 db 类型;
|
||||
Page<AppFavoriteRespVO> selectFavoriteProductList(Page<AppFavoriteRespVO> page,
|
||||
@Param("userId") Long userId,
|
||||
@Param("type") Integer type);
|
||||
}
|
||||
|
@ -4,31 +4,47 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoritePageReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.favorite.ProductFavoriteDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
/**
|
||||
* 喜爱商品 Service 接口
|
||||
* 商品收藏 Service 接口
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
public interface ProductFavoriteService {
|
||||
|
||||
/**
|
||||
* 商品收藏
|
||||
* @param reqVO 请求vo
|
||||
* 创建商品收藏
|
||||
*
|
||||
* @param userId 用户 id
|
||||
* @param reqVO 请求 vo
|
||||
*/
|
||||
Boolean collect(@Valid AppFavoriteReqVO reqVO);
|
||||
Long createFavorite(Long userId, @Valid AppFavoriteReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 取消商品收藏 (通过商品详情页面)
|
||||
* @param reqVO 请求vo
|
||||
* 取消商品收藏
|
||||
*
|
||||
* @param userId 用户 id
|
||||
* @param reqVO 请求 vo
|
||||
*/
|
||||
Boolean cancelCollect(@Valid AppFavoriteReqVO reqVO);
|
||||
void deleteFavorite(Long userId, @Valid AppFavoriteReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 分页查询用户收藏列表
|
||||
*
|
||||
* @param userId 用户 id
|
||||
* @param reqVO 请求 vo
|
||||
*/
|
||||
PageResult<AppFavoriteRespVO> pageCollectList(@Valid AppFavoritePageReqVO reqVO);
|
||||
PageResult<ProductFavoriteDO> getFavoritePage(Long userId, @Valid AppFavoritePageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 获取收藏过商品
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @param reqVO 请求 vo
|
||||
*/
|
||||
ProductFavoriteDO getFavorite(Long userId, @Valid AppFavoriteReqVO reqVO);
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReq
|
||||
import cn.iocoder.yudao.module.product.convert.favorite.ProductFavoriteConvert;
|
||||
import cn.iocoder.yudao.module.product.dal.dataobject.favorite.ProductFavoriteDO;
|
||||
import cn.iocoder.yudao.module.product.dal.mysql.favorite.ProductFavoriteMapper;
|
||||
import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@ -15,9 +14,8 @@ import javax.validation.Valid;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.COLLECTION_EXISTS;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.COLLECTION_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.FAVORITE_EXISTS;
|
||||
import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.FAVORITE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 商品收藏 Service 实现类
|
||||
@ -29,41 +27,40 @@ import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.COLLECTIO
|
||||
public class ProductFavoriteServiceImpl implements ProductFavoriteService {
|
||||
|
||||
@Resource
|
||||
private ProductFavoriteMapper mapper;
|
||||
private ProductFavoriteMapper productFavoriteMapper;
|
||||
|
||||
@Override
|
||||
public Boolean collect(@Valid AppFavoriteReqVO reqVO) {
|
||||
// TODO @jason:userId 要从 Controller 传递过来,Service 不能有转台
|
||||
Long userId = getLoginUserId();
|
||||
// TODO @jason:代码缩进不对;
|
||||
ProductFavoriteDO favoriteDO = mapper.selectByUserAndSpuAndType(userId, reqVO.getSpuId(), reqVO.getType());
|
||||
if (Objects.nonNull(favoriteDO)) {
|
||||
throw exception(COLLECTION_EXISTS);
|
||||
public Long createFavorite(Long userId, @Valid AppFavoriteReqVO reqVO) {
|
||||
ProductFavoriteDO favorite = productFavoriteMapper.selectByUserAndSpuAndType(
|
||||
userId, reqVO.getSpuId(), reqVO.getType());
|
||||
if (Objects.nonNull(favorite)) {
|
||||
throw exception(FAVORITE_EXISTS);
|
||||
}
|
||||
|
||||
// TODO @jason:插入只有成功,不用判断 1
|
||||
ProductFavoriteDO entity = ProductFavoriteConvert.INSTANCE.convert(userId, reqVO);
|
||||
int count = mapper.insert(entity);
|
||||
return count == 1;
|
||||
productFavoriteMapper.insert(entity);
|
||||
return entity.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean cancelCollect(@Valid AppFavoriteReqVO reqVO) {
|
||||
// TODO @jason:代码缩进不对;
|
||||
Long loginUserId = getLoginUserId();
|
||||
ProductFavoriteDO favoriteDO = mapper.selectByUserAndSpuAndType(loginUserId, reqVO.getSpuId(), reqVO.getType());
|
||||
if (Objects.isNull(favoriteDO)) {
|
||||
throw exception(COLLECTION_NOT_EXISTS);
|
||||
public void deleteFavorite(Long userId, @Valid AppFavoriteReqVO reqVO) {
|
||||
ProductFavoriteDO favorite = productFavoriteMapper.selectByUserAndSpuAndType(
|
||||
userId, reqVO.getSpuId(), reqVO.getType());
|
||||
if (Objects.isNull(favorite)) {
|
||||
throw exception(FAVORITE_NOT_EXISTS);
|
||||
}
|
||||
// TODO @jason:插入只有成功,不用判断 1
|
||||
int count = mapper.deleteById(favoriteDO.getId());
|
||||
return count == 1;
|
||||
|
||||
productFavoriteMapper.deleteById(favorite.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AppFavoriteRespVO> pageCollectList(@Valid AppFavoritePageReqVO reqVO) {
|
||||
Long userId = getLoginUserId();
|
||||
return mapper.selectPageByUserAndType(userId, reqVO.getType(), reqVO);
|
||||
public PageResult<ProductFavoriteDO> getFavoritePage(Long userId, @Valid AppFavoritePageReqVO reqVO) {
|
||||
return productFavoriteMapper.selectPageByUserAndType(userId, reqVO.getType(), reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProductFavoriteDO getFavorite(Long userId, @Valid AppFavoriteReqVO reqVO) {
|
||||
return productFavoriteMapper.selectByUserAndSpuAndType(userId, reqVO.getSpuId(), reqVO.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,8 +2,11 @@ package cn.iocoder.yudao.module.product.service.spu;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.category.vo.ProductCategoryListReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuCreateOrUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.sku.vo.ProductSkuRespVO;
|
||||
import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*;
|
||||
@ -203,8 +206,16 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
||||
|
||||
@Override
|
||||
public PageResult<ProductSpuDO> getSpuPage(AppProductSpuPageReqVO pageReqVO) {
|
||||
//return productSpuMapper.selectPage(pageReqVO); TODO 有差异接口接受参数类型不对
|
||||
return null;
|
||||
// 查找时,如果查找某个分类编号,则包含它的子分类。因为顶级分类不包含商品
|
||||
Set<Long> categoryIds = new HashSet<>();
|
||||
if (pageReqVO.getCategoryId() != null && pageReqVO.getCategoryId() > 0) {
|
||||
categoryIds.add(pageReqVO.getCategoryId());
|
||||
List<ProductCategoryDO> categoryChildren = categoryService.getEnableCategoryList(new ProductCategoryListReqVO()
|
||||
.setParentId(pageReqVO.getCategoryId()).setStatus(CommonStatusEnum.ENABLE.getStatus()));
|
||||
categoryIds.addAll(CollectionUtils.convertList(categoryChildren, ProductCategoryDO::getId));
|
||||
}
|
||||
// 分页查询
|
||||
return productSpuMapper.selectPage(pageReqVO, categoryIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.product.dal.mysql.favorite.ProductFavoriteMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
<select id="selectFavoriteProductList"
|
||||
resultType="cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO">
|
||||
SELECT f.id, f.type, f.spu_id as spuId , p.name as spuName, p.pic_url as picUrl , p.price
|
||||
FROM product_favorite f
|
||||
INNER JOIN product_spu p ON f.spu_id = p.id and f.deleted = 0
|
||||
where f.type = #{type} and f.user_id = #{userId}
|
||||
ORDER BY f.id DESC
|
||||
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -3,58 +3,58 @@ package cn.iocoder.yudao.module.promotion.enums;
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* promotion 错误码枚举类
|
||||
* Promotion 错误码枚举类
|
||||
*
|
||||
* market 系统,使用 1-003-000-000 段
|
||||
* promotion 系统,使用 1-013-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 促销活动相关 1003001000 ============
|
||||
ErrorCode DISCOUNT_ACTIVITY_NOT_EXISTS = new ErrorCode(1003001000, "限时折扣活动不存在");
|
||||
ErrorCode DISCOUNT_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1003006001, "存在商品参加了其它限时折扣活动");
|
||||
ErrorCode DISCOUNT_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1003006002, "限时折扣活动已关闭,不能修改");
|
||||
ErrorCode DISCOUNT_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED = new ErrorCode(1003006003, "限时折扣活动未关闭,不能删除");
|
||||
ErrorCode DISCOUNT_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1003006004, "限时折扣活动已关闭,不能重复关闭");
|
||||
ErrorCode DISCOUNT_ACTIVITY_CLOSE_FAIL_STATUS_END = new ErrorCode(1003006004, "限时折扣活动已结束,不能关闭");
|
||||
// ========== 促销活动相关 1013001000 ============
|
||||
ErrorCode DISCOUNT_ACTIVITY_NOT_EXISTS = new ErrorCode(1013001000, "限时折扣活动不存在");
|
||||
ErrorCode DISCOUNT_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1013001001, "存在商品参加了其它限时折扣活动");
|
||||
ErrorCode DISCOUNT_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1013001002, "限时折扣活动已关闭,不能修改");
|
||||
ErrorCode DISCOUNT_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED = new ErrorCode(1013001003, "限时折扣活动未关闭,不能删除");
|
||||
ErrorCode DISCOUNT_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1013001004, "限时折扣活动已关闭,不能重复关闭");
|
||||
ErrorCode DISCOUNT_ACTIVITY_CLOSE_FAIL_STATUS_END = new ErrorCode(1013001005, "限时折扣活动已结束,不能关闭");
|
||||
|
||||
// ========== Banner 相关 1003002000 ============
|
||||
ErrorCode BANNER_NOT_EXISTS = new ErrorCode(1003002000, "Banner 不存在");
|
||||
// ========== Banner 相关 1013002000 ============
|
||||
ErrorCode BANNER_NOT_EXISTS = new ErrorCode(1013002000, "Banner 不存在");
|
||||
|
||||
// ========== Coupon 相关 1003003000 ============
|
||||
ErrorCode COUPON_NO_MATCH_SPU = new ErrorCode(1003003000, "优惠劵没有可使用的商品!");
|
||||
ErrorCode COUPON_NO_MATCH_MIN_PRICE = new ErrorCode(1003003000, "所结算的商品中未满足使用的金额");
|
||||
// ========== Coupon 相关 1013003000 ============
|
||||
ErrorCode COUPON_NO_MATCH_SPU = new ErrorCode(1013003000, "优惠劵没有可使用的商品!");
|
||||
ErrorCode COUPON_NO_MATCH_MIN_PRICE = new ErrorCode(1013003001, "所结算的商品中未满足使用的金额");
|
||||
|
||||
// ========== 优惠劵模板 1003004000 ==========
|
||||
ErrorCode COUPON_TEMPLATE_NOT_EXISTS = new ErrorCode(1003004000, "优惠劵模板不存在");
|
||||
ErrorCode COUPON_TEMPLATE_TOTAL_COUNT_TOO_SMALL = new ErrorCode(1003004001, "发放数量不能小于已领取数量({})");
|
||||
// ========== 优惠劵模板 1013004000 ==========
|
||||
ErrorCode COUPON_TEMPLATE_NOT_EXISTS = new ErrorCode(1013004000, "优惠劵模板不存在");
|
||||
ErrorCode COUPON_TEMPLATE_TOTAL_COUNT_TOO_SMALL = new ErrorCode(1013004001, "发放数量不能小于已领取数量({})");
|
||||
|
||||
// ========== 优惠劵模板 1003005000 ==========
|
||||
ErrorCode COUPON_NOT_EXISTS = new ErrorCode(1003005000, "优惠券不存在");
|
||||
ErrorCode COUPON_DELETE_FAIL_USED = new ErrorCode(1003005001, "回收优惠劵失败,优惠劵已被使用");
|
||||
ErrorCode COUPON_STATUS_NOT_UNUSED = new ErrorCode(1006003003, "优惠劵不处于待使用状态");
|
||||
ErrorCode COUPON_VALID_TIME_NOT_NOW = new ErrorCode(1006003004, "优惠券不在使用时间范围内");
|
||||
// ========== 优惠劵模板 1013005000 ==========
|
||||
ErrorCode COUPON_NOT_EXISTS = new ErrorCode(1013005000, "优惠券不存在");
|
||||
ErrorCode COUPON_DELETE_FAIL_USED = new ErrorCode(1013005001, "回收优惠劵失败,优惠劵已被使用");
|
||||
ErrorCode COUPON_STATUS_NOT_UNUSED = new ErrorCode(1013005002, "优惠劵不处于待使用状态");
|
||||
ErrorCode COUPON_VALID_TIME_NOT_NOW = new ErrorCode(1013005003, "优惠券不在使用时间范围内");
|
||||
|
||||
// ========== 满减送活动 1003006000 ==========
|
||||
ErrorCode REWARD_ACTIVITY_NOT_EXISTS = new ErrorCode(1003006000, "满减送活动不存在");
|
||||
ErrorCode REWARD_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1003006001, "存在商品参加了其它满减送活动");
|
||||
ErrorCode REWARD_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1003006002, "满减送活动已关闭,不能修改");
|
||||
ErrorCode REWARD_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED = new ErrorCode(1003006003, "满减送活动未关闭,不能删除");
|
||||
ErrorCode REWARD_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1003006004, "满减送活动已关闭,不能重复关闭");
|
||||
ErrorCode REWARD_ACTIVITY_CLOSE_FAIL_STATUS_END = new ErrorCode(1003006004, "满减送活动已结束,不能关闭");
|
||||
// ========== 满减送活动 1013006000 ==========
|
||||
ErrorCode REWARD_ACTIVITY_NOT_EXISTS = new ErrorCode(1013006000, "满减送活动不存在");
|
||||
ErrorCode REWARD_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1013006001, "存在商品参加了其它满减送活动");
|
||||
ErrorCode REWARD_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1013006002, "满减送活动已关闭,不能修改");
|
||||
ErrorCode REWARD_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED = new ErrorCode(1013006003, "满减送活动未关闭,不能删除");
|
||||
ErrorCode REWARD_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1013006004, "满减送活动已关闭,不能重复关闭");
|
||||
ErrorCode REWARD_ACTIVITY_CLOSE_FAIL_STATUS_END = new ErrorCode(1013006005, "满减送活动已结束,不能关闭");
|
||||
|
||||
// ========== Price 相关 1003007000 ============
|
||||
ErrorCode PRICE_CALCULATE_PAY_PRICE_ILLEGAL = new ErrorCode(1003007000, "支付价格计算异常,原因:价格小于等于 0");
|
||||
// ========== Price 相关 1013007000 ============
|
||||
ErrorCode PRICE_CALCULATE_PAY_PRICE_ILLEGAL = new ErrorCode(1013007000, "支付价格计算异常,原因:价格小于等于 0");
|
||||
|
||||
// ========== 秒杀活动 1003008000 ==========
|
||||
ErrorCode SECKILL_ACTIVITY_NOT_EXISTS = new ErrorCode(1003008000, "秒杀活动不存在");
|
||||
ErrorCode SECKILL_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1003008002, "存在商品参加了其它秒杀活动");
|
||||
ErrorCode SECKILL_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1003008003, "秒杀活动已关闭,不能修改");
|
||||
ErrorCode SECKILL_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1003008004, "秒杀活动未关闭或未结束,不能删除");
|
||||
ErrorCode SECKILL_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1003008005, "秒杀活动已关闭,不能重复关闭");
|
||||
ErrorCode SECKILL_ACTIVITY_CLOSE_FAIL_STATUS_END = new ErrorCode(1003008006, "秒杀活动已结束,不能关闭");
|
||||
// ========== 秒杀活动 1013008000 ==========
|
||||
ErrorCode SECKILL_ACTIVITY_NOT_EXISTS = new ErrorCode(1013008000, "秒杀活动不存在");
|
||||
ErrorCode SECKILL_ACTIVITY_SPU_CONFLICTS = new ErrorCode(1013008002, "存在商品参加了其它秒杀活动");
|
||||
ErrorCode SECKILL_ACTIVITY_UPDATE_FAIL_STATUS_CLOSED = new ErrorCode(1013008003, "秒杀活动已关闭,不能修改");
|
||||
ErrorCode SECKILL_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1013008004, "秒杀活动未关闭或未结束,不能删除");
|
||||
ErrorCode SECKILL_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1013008005, "秒杀活动已关闭,不能重复关闭");
|
||||
ErrorCode SECKILL_ACTIVITY_CLOSE_FAIL_STATUS_END = new ErrorCode(1013008006, "秒杀活动已结束,不能关闭");
|
||||
|
||||
// ========== 秒杀时段 1003009000 ==========
|
||||
ErrorCode SECKILL_TIME_NOT_EXISTS = new ErrorCode(1003009000, "秒杀时段不存在");
|
||||
ErrorCode SECKILL_TIME_CONFLICTS = new ErrorCode(1003009001, "秒杀时段冲突");
|
||||
// ========== 秒杀时段 1013009000 ==========
|
||||
ErrorCode SECKILL_TIME_NOT_EXISTS = new ErrorCode(1013009000, "秒杀时段不存在");
|
||||
ErrorCode SECKILL_TIME_CONFLICTS = new ErrorCode(1013009001, "秒杀时段冲突");
|
||||
|
||||
}
|
||||
|
@ -10,11 +10,6 @@ import java.time.LocalTime;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 秒杀时段 Mapper
|
||||
*
|
||||
* @author halfninety
|
||||
*/
|
||||
@Mapper
|
||||
public interface SeckillTimeMapper extends BaseMapperX<SeckillTimeDO> {
|
||||
|
||||
|
@ -3,15 +3,15 @@ package cn.iocoder.yudao.module.trade.enums;
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
|
||||
/**
|
||||
* 交易 错误码枚举类
|
||||
* 交易系统,使用 1-011-000-000 段
|
||||
* Trade 错误码枚举类
|
||||
* trade 系统,使用 1-011-000-000 段
|
||||
*
|
||||
* @author LeeYan9
|
||||
* @since 2022-08-26
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
// ========== Order 模块 1-011-000-000 ==========
|
||||
// ========== Order 模块 1011000000 ==========
|
||||
ErrorCode ORDER_CREATE_SKU_NOT_FOUND = new ErrorCode(1011000001, "商品 SKU 不存在");
|
||||
ErrorCode ORDER_CREATE_SPU_NOT_SALE = new ErrorCode(1011000002, "商品 SPU 不可售卖");
|
||||
ErrorCode ORDER_CREATE_SKU_STOCK_NOT_ENOUGH = new ErrorCode(1011000004, "商品 SKU 库存不足");
|
||||
@ -28,7 +28,7 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode ORDER_DELIVERY_FAIL_STATUS_NOT_UNDELIVERED = new ErrorCode(1011000017, "交易订单发货失败,订单不是【待发货】状态");
|
||||
ErrorCode ORDER_RECEIVE_FAIL_STATUS_NOT_DELIVERED = new ErrorCode(1011000018, "交易订单收货失败,订单不是【待收货】状态");
|
||||
|
||||
// ========== After Sale 模块 1-011-000-000 ==========
|
||||
// ========== After Sale 模块 1011000100 ==========
|
||||
ErrorCode AFTER_SALE_NOT_FOUND = new ErrorCode(1011000100, "售后单不存在");
|
||||
ErrorCode AFTER_SALE_CREATE_FAIL_REFUND_PRICE_ERROR = new ErrorCode(1011000101, "申请退款金额错误");
|
||||
ErrorCode AFTER_SALE_CREATE_FAIL_ORDER_STATUS_CANCELED = new ErrorCode(1011000102, "订单已关闭,无法申请售后");
|
||||
@ -42,7 +42,12 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode AFTER_SALE_REFUND_FAIL_STATUS_NOT_WAIT_REFUND = new ErrorCode(1011000110, "退款失败,售后单状态不是【待退款】");
|
||||
ErrorCode AFTER_SALE_CANCEL_FAIL_STATUS_NOT_APPLY_OR_AGREE = new ErrorCode(1011000111, "取消售后单失败,售后单状态不是【待审核】或【卖家同意】");
|
||||
|
||||
// ========== Cart 模块 1-011-001-000 ==========
|
||||
// ========== Cart 模块 1011002000 ==========
|
||||
ErrorCode CARD_ITEM_NOT_FOUND = new ErrorCode(1011002000, "购物车项不存在");
|
||||
|
||||
// ========== 物流配送模块 1011003000 ==========
|
||||
ErrorCode DELIVERY_EXPRESS_NOT_EXISTS = new ErrorCode(1011003000, "快递公司不存在");
|
||||
ErrorCode EXPRESS_CODE_DUPLICATE = new ErrorCode(1011003001, "已经存在该编码的快递公司");
|
||||
ErrorCode EXPRESS_TEMPLATE_NOT_EXISTS = new ErrorCode(1011003002, "运费模板不存在");
|
||||
ErrorCode EXPRESS_TEMPLATE_NAME_DUPLICATE = new ErrorCode(1011003002, "已经存在该运费模板名");
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.trade.enums.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 快递配送计费方式枚举
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum DeliveryExpressChargeModeEnum implements IntArrayValuable {
|
||||
|
||||
PIECE(1, "按件"),
|
||||
WEIGHT(2,"按重量"),
|
||||
VOLUME(3, "按体积");
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DeliveryExpressChargeModeEnum::getType).toArray();
|
||||
|
||||
/**
|
||||
* 类型
|
||||
*/
|
||||
private final Integer type;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private final String desc;
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package cn.iocoder.yudao.module.product.enums.delivery;
|
||||
package cn.iocoder.yudao.module.trade.enums.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -15,9 +15,8 @@ import java.util.Arrays;
|
||||
@AllArgsConstructor
|
||||
public enum DeliveryTypeEnum implements IntArrayValuable {
|
||||
|
||||
// TODO 芋艿:英文单词,需要再想下;
|
||||
EXPRESS(1, "快递发货"),
|
||||
USER(2, "用户自提"),;
|
||||
PICK_UP(2, "用户自提"),;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(DeliveryTypeEnum::getMode).toArray();
|
||||
|
@ -17,8 +17,8 @@ import java.util.Arrays;
|
||||
public enum TradeOrderItemAfterSaleStatusEnum implements IntArrayValuable {
|
||||
|
||||
NONE(0, "未售后"),
|
||||
APPLY(1, "售后中"),
|
||||
SUCCESS(2, "已退款");
|
||||
APPLY(10, "售后中"),
|
||||
SUCCESS(20, "售后成功");
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderItemAfterSaleStatusEnum::getStatus).toArray();
|
||||
|
||||
@ -31,9 +31,6 @@ public enum TradeOrderItemAfterSaleStatusEnum implements IntArrayValuable {
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
// TODO 芋艿:EXPIRED 已失效不允许申请售后
|
||||
// TODO 芋艿:PART_AFTER_SALE 部分售后
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
|
@ -7,19 +7,19 @@ import lombok.RequiredArgsConstructor;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 交易订单 - 售后状态
|
||||
* 交易订单 - 退款状态
|
||||
*
|
||||
* @author Sin
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum TradeOrderAfterSaleStatusEnum implements IntArrayValuable {
|
||||
public enum TradeOrderRefundStatusEnum implements IntArrayValuable {
|
||||
|
||||
NONE(0, "未退款"),
|
||||
PART(1, "部分退款"),
|
||||
ALL(2, "全部退款");
|
||||
PART(10, "部分退款"),
|
||||
ALL(20, "全部退款");
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderAfterSaleStatusEnum::getStatus).toArray();
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderRefundStatusEnum::getStatus).toArray();
|
||||
|
||||
/**
|
||||
* 状态值
|
@ -23,8 +23,6 @@ public enum TradeOrderStatusEnum implements IntArrayValuable {
|
||||
COMPLETED(30, "已完成"),
|
||||
CANCELED(40, "已取消");
|
||||
|
||||
// TODO 芋艿: TAKE("待核验"):虚拟订单需要核验商品
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderStatusEnum::getStatus).toArray();
|
||||
|
||||
/**
|
||||
|
@ -17,8 +17,11 @@ public enum TradeOrderTypeEnum implements IntArrayValuable {
|
||||
|
||||
NORMAL(0, "普通订单"),
|
||||
SECKILL(1, "秒杀订单"),
|
||||
TEAM(2, "拼团订单"),
|
||||
BARGAIN(3, "砍价订单");
|
||||
// TODO 芋艿:如下三个字段,名字需要改下,等后面表设计完成后。
|
||||
KANJIA(2, "砍价订单"),
|
||||
PINTUAN(3, "拼团订单"),
|
||||
YUSHOU(4, "预售订单"),
|
||||
;
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(TradeOrderTypeEnum::getType).toArray();
|
||||
|
||||
|
@ -0,0 +1,92 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.*;
|
||||
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryExpressConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||
import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - 快递公司")
|
||||
@RestController
|
||||
@RequestMapping("/trade/delivery/express")
|
||||
@Validated
|
||||
public class DeliveryExpressController {
|
||||
|
||||
@Resource
|
||||
private DeliveryExpressService deliveryExpressService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建快递公司")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express:create')")
|
||||
public CommonResult<Long> createDeliveryExpress(@Valid @RequestBody DeliveryExpressCreateReqVO createReqVO) {
|
||||
return success(deliveryExpressService.createDeliveryExpress(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新快递公司")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express:update')")
|
||||
public CommonResult<Boolean> updateDeliveryExpress(@Valid @RequestBody DeliveryExpressUpdateReqVO updateReqVO) {
|
||||
deliveryExpressService.updateDeliveryExpress(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除快递公司")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express:delete')")
|
||||
public CommonResult<Boolean> deleteDeliveryExpress(@RequestParam("id") Long id) {
|
||||
deliveryExpressService.deleteDeliveryExpress(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得快递公司")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express:query')")
|
||||
public CommonResult<DeliveryExpressRespVO> getDeliveryExpress(@RequestParam("id") Long id) {
|
||||
DeliveryExpressDO deliveryExpress = deliveryExpressService.getDeliveryExpress(id);
|
||||
return success(DeliveryExpressConvert.INSTANCE.convert(deliveryExpress));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得快递公司分页")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express:query')")
|
||||
public CommonResult<PageResult<DeliveryExpressRespVO>> getDeliveryExpressPage(@Valid DeliveryExpressPageReqVO pageVO) {
|
||||
PageResult<DeliveryExpressDO> pageResult = deliveryExpressService.getDeliveryExpressPage(pageVO);
|
||||
return success(DeliveryExpressConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出快递公司 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDeliveryExpressExcel(@Valid DeliveryExpressExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<DeliveryExpressDO> list = deliveryExpressService.getDeliveryExpressList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<DeliveryExpressExcelVO> dataList = DeliveryExpressConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "快递公司.xls", "数据", DeliveryExpressExcelVO.class, dataList);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.*;
|
||||
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryExpressTemplateConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateDO;
|
||||
import cn.iocoder.yudao.module.trade.service.delivery.DeliveryExpressTemplateService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 快递运费模板")
|
||||
@RestController
|
||||
@RequestMapping("/trade/delivery/express-template")
|
||||
@Validated
|
||||
public class DeliveryExpressTemplateController {
|
||||
|
||||
@Resource
|
||||
private DeliveryExpressTemplateService deliveryExpressTemplateService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建快递运费模板")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express-template:create')")
|
||||
public CommonResult<Long> createDeliveryExpressTemplate(@Valid @RequestBody DeliveryExpressTemplateCreateReqVO createReqVO) {
|
||||
return success(deliveryExpressTemplateService.createDeliveryExpressTemplate(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新快递运费模板")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express-template:update')")
|
||||
public CommonResult<Boolean> updateDeliveryExpressTemplate(@Valid @RequestBody DeliveryExpressTemplateUpdateReqVO updateReqVO) {
|
||||
deliveryExpressTemplateService.updateDeliveryExpressTemplate(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除快递运费模板")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express-template:delete')")
|
||||
public CommonResult<Boolean> deleteDeliveryExpressTemplate(@RequestParam("id") Long id) {
|
||||
deliveryExpressTemplateService.deleteDeliveryExpressTemplate(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得快递运费模板")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express-template:query')")
|
||||
public CommonResult<DeliveryExpressTemplateRespVO> getDeliveryExpressTemplate(@RequestParam("id") Long id) {
|
||||
return success(deliveryExpressTemplateService.getDeliveryExpressTemplate(id));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得快递运费模板列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express-template:query')")
|
||||
public CommonResult<List<DeliveryExpressTemplateSimpleRespVO>> getDeliveryExpressTemplateList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<DeliveryExpressTemplateDO> list = deliveryExpressTemplateService.getDeliveryExpressTemplateList(ids);
|
||||
return success(DeliveryExpressTemplateConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得快递运费模板分页")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express-template:query')")
|
||||
public CommonResult<PageResult<DeliveryExpressTemplateSimpleRespVO>> getDeliveryExpressTemplatePage(@Valid DeliveryExpressTemplatePageReqVO pageVO) {
|
||||
PageResult<DeliveryExpressTemplateDO> pageResult = deliveryExpressTemplateService.getDeliveryExpressTemplatePage(pageVO);
|
||||
return success(DeliveryExpressTemplateConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出快递运费模板 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('trade:delivery:express-template:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDeliveryExpressTemplateExcel(@Valid DeliveryExpressTemplateExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<DeliveryExpressTemplateDO> list = deliveryExpressTemplateService.getDeliveryExpressTemplateList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<DeliveryExpressTemplateExcelVO> datas = DeliveryExpressTemplateConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "快递运费模板.xls", "数据", DeliveryExpressTemplateExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 快递公司 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class DeliveryExpressBaseVO {
|
||||
|
||||
@Schema(description = "快递公司编号", required = true)
|
||||
@NotNull(message = "快递公司编号不能为空")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "快递公司名称", required = true, example = "李四")
|
||||
@NotNull(message = "快递公司名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "快递公司logo")
|
||||
private String logo;
|
||||
|
||||
@Schema(description = "排序", required = true)
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", required = true, example = "1")
|
||||
@NotNull(message = "状态(0正常 1停用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeliveryExpressCreateReqVO extends DeliveryExpressBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 快递公司 Excel VO
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Data
|
||||
public class DeliveryExpressExcelVO {
|
||||
|
||||
@ExcelProperty("编号")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("快递公司编号")
|
||||
private String code;
|
||||
|
||||
@ExcelProperty("快递公司名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("快递公司logo")
|
||||
private String logo;
|
||||
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@ExcelProperty("状态(0正常 1停用)")
|
||||
private Byte status;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司 Excel 导出 Request VO")
|
||||
@Data
|
||||
public class DeliveryExpressExportReqVO {
|
||||
|
||||
@Schema(description = "快递公司编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "快递公司名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeliveryExpressPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "快递公司编号")
|
||||
private String code;
|
||||
|
||||
@Schema(description = "快递公司名称", example = "李四")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "状态(0正常 1停用)", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeliveryExpressRespVO extends DeliveryExpressBaseVO {
|
||||
|
||||
@Schema(description = "编号", required = true, example = "6592")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 快递运费模板 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class DeliveryExpressTemplateBaseVO {
|
||||
|
||||
@Schema(description = "模板名称", required = true, example = "王五")
|
||||
@NotNull(message = "模板名称不能为空")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "配送计费方式 1:按件 2:按重量 3:按体积", required = true)
|
||||
@NotNull(message = "配送计费方式 1:按件 2:按重量 3:按体积不能为空")
|
||||
private Integer chargeMode;
|
||||
|
||||
@Schema(description = "排序", required = true)
|
||||
@NotNull(message = "排序不能为空")
|
||||
private Integer sort;
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import javax.validation.Valid;
|
||||
|
||||
@Schema(description = "管理后台 - 快递运费模板创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeliveryExpressTemplateCreateReqVO extends DeliveryExpressTemplateBaseVO {
|
||||
|
||||
@Schema(description = "区域运费列表")
|
||||
@Valid
|
||||
private List<ExpressTemplateChargeBaseVO> templateCharge = Collections.emptyList();
|
||||
|
||||
@Schema(description = "包邮区域列表")
|
||||
@Valid
|
||||
private List<ExpressTemplateFreeBaseVO> templateFree = Collections.emptyList();
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* 快递运费模板 Excel VO
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Data
|
||||
public class DeliveryExpressTemplateExcelVO {
|
||||
|
||||
@ExcelProperty("编号,自增")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("模板名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("配送计费方式 1:按件 2:按重量 3:按体积")
|
||||
private Integer chargeMode;
|
||||
|
||||
@ExcelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 快递运费模板 Excel 导出 Request VO,参数和 DeliveryExpressTemplatePageReqVO 是一致的")
|
||||
@Data
|
||||
public class DeliveryExpressTemplateExportReqVO {
|
||||
|
||||
@Schema(description = "模板名称", example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "配送计费方式 1:按件 2:按重量 3:按体积")
|
||||
private Integer chargeMode;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 快递运费模板分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeliveryExpressTemplatePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "模板名称", example = "王五")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "配送计费方式 1:按件 2:按重量 3:按体积")
|
||||
private Integer chargeMode;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
@Schema(description = "管理后台 - 快递运费模板 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeliveryExpressTemplateRespVO extends DeliveryExpressTemplateBaseVO {
|
||||
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "371")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "运费模板运费设置", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<ExpressTemplateChargeBaseVO> templateCharge;
|
||||
|
||||
@Schema(description = "运费模板包邮区域", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private List<ExpressTemplateFreeBaseVO> templateFree;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 快递运费模板 精简 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeliveryExpressTemplateSimpleRespVO extends DeliveryExpressTemplateBaseVO {
|
||||
|
||||
@Schema(description = "编号,自增", required = true, example = "371")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 快递运费模板更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeliveryExpressTemplateUpdateReqVO extends DeliveryExpressTemplateBaseVO {
|
||||
|
||||
@Schema(description = "编号", required = true, example = "371")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "区域运费列表")
|
||||
@Valid
|
||||
private List<ExpressTemplateChargeUpdateVO> templateCharge = Collections.emptyList();
|
||||
|
||||
@Schema(description = "包邮区域列表")
|
||||
@Valid
|
||||
private List<ExpressTemplateFreeUpdateVO> templateFree = Collections.emptyList();
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 快递公司更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DeliveryExpressUpdateReqVO extends DeliveryExpressBaseVO {
|
||||
|
||||
@Schema(description = "编号", required = true, example = "6592")
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 快递运费模板运费设置 Base VO,提供给添加运费模板使用
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Data
|
||||
public class ExpressTemplateChargeBaseVO {
|
||||
|
||||
@Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "区域编号不能为空")
|
||||
private Integer areaId;
|
||||
|
||||
@Schema(description = "首件数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
|
||||
@NotNull(message = "首件数量不能为空")
|
||||
private Double startCount;
|
||||
|
||||
@Schema(description = "起步价", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
|
||||
@NotNull(message = "起步价不能为空")
|
||||
private Integer startPrice;
|
||||
|
||||
@Schema(description = "续件数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
||||
@NotNull(message = "续件数量不能为空")
|
||||
private Double extraCount;
|
||||
|
||||
@Schema(description = "额外价", requiredMode = Schema.RequiredMode.REQUIRED, example = "2000")
|
||||
@NotNull(message = "额外价不能为空")
|
||||
private Integer extraPrice;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
@Data
|
||||
public class ExpressTemplateChargeUpdateVO extends ExpressTemplateChargeBaseVO {
|
||||
|
||||
@Schema(description = "编号", example = "6592")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配送模板编号", example = "1")
|
||||
private Long templateId;
|
||||
|
||||
@Schema(description = "配送计费方式", example = "1")
|
||||
private Integer chargeMode;
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 快递运费模板包邮 Base VO,提供给添加运费模板使用
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Data
|
||||
public class ExpressTemplateFreeBaseVO {
|
||||
|
||||
@Schema(description = "区域编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "区域编号不能为空")
|
||||
private Integer areaId;
|
||||
|
||||
@Schema(description = "包邮金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "5000")
|
||||
@NotNull(message = "包邮金额不能为空")
|
||||
private Integer freePrice;
|
||||
|
||||
@Schema(description = "包邮件数", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
|
||||
@NotNull(message = "包邮件数不能为空")
|
||||
private Integer freeCount;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.admin.delivery.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 快递运费模板包邮 更新 VO
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Data
|
||||
public class ExpressTemplateFreeUpdateVO extends ExpressTemplateFreeBaseVO {
|
||||
|
||||
@Schema(description = "编号", example = "6592")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "配送模板编号", example = "1")
|
||||
private Long templateId;
|
||||
}
|
@ -4,7 +4,6 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 交易订单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
@ -118,9 +117,6 @@ public class TradeOrderBaseVO {
|
||||
@Schema(description = "收件人地区编号", required = true, example = "110000")
|
||||
private Integer receiverAreaId;
|
||||
|
||||
@Schema(description = "收件人邮编", required = true, example = "100000")
|
||||
private Integer receiverPostCode;
|
||||
|
||||
@Schema(description = "收件人详细地址", required = true, example = "中关村大街 1 号")
|
||||
private String receiverDetailAddress;
|
||||
|
||||
|
@ -40,11 +40,8 @@ public class TradeOrderItemBaseVO {
|
||||
|
||||
// ========== 价格 + 支付基本信息 ==========
|
||||
|
||||
@Schema(description = "商品原价(总)", required = true, example = "100")
|
||||
private Integer originalPrice;
|
||||
|
||||
@Schema(description = "商品原价(单)", required = true, example = "100")
|
||||
private Integer originalUnitPrice;
|
||||
private Integer price;
|
||||
|
||||
@Schema(description = "商品优惠(总)", required = true, example = "100")
|
||||
private Integer discountPrice;
|
||||
|
@ -1,8 +1,11 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.app.aftersale;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSaleDeliveryReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.aftersale.vo.AppTradeAfterSalePageItemRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.service.aftersale.TradeAfterSaleService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -12,6 +15,8 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
@ -26,6 +31,51 @@ public class AppTradeAfterSaleController {
|
||||
@Resource
|
||||
private TradeAfterSaleService afterSaleService;
|
||||
|
||||
// TODO 芋艿:待实现
|
||||
@GetMapping(value = "/page")
|
||||
@Operation(summary = "获得售后分页")
|
||||
public CommonResult<PageResult<AppTradeAfterSalePageItemRespVO>> getAfterSalePage() {
|
||||
AppTradeAfterSalePageItemRespVO vo = new AppTradeAfterSalePageItemRespVO();
|
||||
vo.setId(1L);
|
||||
vo.setNo("1146347329394184195");
|
||||
vo.setStatus(61);
|
||||
vo.setWay(10);
|
||||
vo.setType(10);
|
||||
vo.setApplyReason("不想要了");
|
||||
vo.setApplyDescription("这个商品我不喜欢,想退款");
|
||||
vo.setApplyPicUrls(Arrays.asList("pic_url_1", "pic_url_2", "pic_url_3"));
|
||||
|
||||
// 设置订单相关信息
|
||||
vo.setOrderId(2001L);
|
||||
vo.setOrderNo("23456789009876");
|
||||
vo.setOrderItemId(3001L);
|
||||
vo.setSpuId(4001L);
|
||||
vo.setSpuName("商品名");
|
||||
vo.setSkuId(5001L);
|
||||
vo.setProperties(Arrays.asList(
|
||||
new AppProductPropertyValueDetailRespVO().setPropertyId(6001L).setPropertyName("颜色").setValueId(7001L).setValueName("红色"),
|
||||
new AppProductPropertyValueDetailRespVO().setPropertyId(6002L).setPropertyName("尺寸").setValueId(7002L).setValueName("XL")));
|
||||
vo.setPicUrl("https://cdn.pixabay.com/photo/2022/12/06/06/21/lavender-7638368_1280.jpg");
|
||||
vo.setCount(2);
|
||||
|
||||
// 设置审批相关信息
|
||||
vo.setAuditReason("审核通过");
|
||||
|
||||
// 设置退款相关信息
|
||||
vo.setRefundPrice(1000);
|
||||
vo.setRefundTime(LocalDateTime.now());
|
||||
|
||||
// 设置退货相关信息
|
||||
vo.setLogisticsId(7001L);
|
||||
vo.setLogisticsNo("LAGN101010101001");
|
||||
vo.setDeliveryTime(LocalDateTime.now());
|
||||
vo.setReceiveTime(LocalDateTime.now());
|
||||
vo.setReceiveReason("收货正常");
|
||||
|
||||
return success(new PageResult<>(Arrays.asList(vo), 1L));
|
||||
// return success(afterSaleService.getAfterSalePage(getLoginUserId()));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/create")
|
||||
@Operation(summary = "申请售后")
|
||||
public CommonResult<Long> createAfterSale(@RequestBody AppTradeAfterSaleCreateReqVO createReqVO) {
|
||||
|
@ -0,0 +1,103 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.app.aftersale.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "用户 App - 交易售后的分页项 Request VO")
|
||||
@Data
|
||||
public class AppTradeAfterSalePageItemRespVO {
|
||||
|
||||
@Schema(description = "售后编号", required = true, example = "1024")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "售后流水号", required = true, example = "1146347329394184195")
|
||||
private String no;
|
||||
|
||||
@Schema(description = "售后状态", required = true, example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "售后方式", required = true, example = "1")
|
||||
private Integer way;
|
||||
|
||||
@Schema(description = "售后类型", required = true, example = "1")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "申请原因", required = true, example = "1")
|
||||
private String applyReason;
|
||||
|
||||
@Schema(description = "补充描述", required = true, example = "1")
|
||||
private String applyDescription;
|
||||
|
||||
@Schema(description = "补充凭证图片", required = true, example = "1")
|
||||
private List<String> applyPicUrls;
|
||||
|
||||
// ========== 交易订单相关 ==========
|
||||
|
||||
@Schema(description = "交易订单编号", required = true, example = "1")
|
||||
private Long orderId;
|
||||
|
||||
@Schema(description = "交易订单流水号", required = true, example = "1")
|
||||
private String orderNo;
|
||||
|
||||
@Schema(description = "交易订单项编号", required = true, example = "1")
|
||||
private Long orderItemId;
|
||||
|
||||
@Schema(description = "商品 SPU 编号", required = true, example = "1")
|
||||
private Long spuId;
|
||||
|
||||
@Schema(description = "商品 SPU 名称", required = true, example = "1")
|
||||
private String spuName;
|
||||
|
||||
@Schema(description = "商品 SKU 编号", required = true, example = "1")
|
||||
private Long skuId;
|
||||
|
||||
/**
|
||||
* 属性数组
|
||||
*/
|
||||
private List<AppProductPropertyValueDetailRespVO> properties;
|
||||
|
||||
@Schema(description = "商品图片", required = true, example = "https://www.iocoder.cn/01.jpg")
|
||||
private String picUrl;
|
||||
|
||||
@Schema(description = "退货商品数量", required = true, example = "1")
|
||||
private Integer count;
|
||||
|
||||
// ========== 审批相关 ==========
|
||||
|
||||
/**
|
||||
* 审批备注
|
||||
*
|
||||
* 注意,只有审批不通过才会填写
|
||||
*/
|
||||
private String auditReason;
|
||||
|
||||
// ========== 退款相关 ==========
|
||||
|
||||
@Schema(description = "退款金额,单位:分", example = "100")
|
||||
private Integer refundPrice;
|
||||
|
||||
@Schema(description = "退款时间")
|
||||
private LocalDateTime refundTime;
|
||||
|
||||
// ========== 退货相关 ==========
|
||||
|
||||
@Schema(description = "退货物流公司编号", example = "1")
|
||||
private Long logisticsId;
|
||||
|
||||
@Schema(description = "退货物流单号", example = "SF123456789")
|
||||
private String logisticsNo;
|
||||
|
||||
@Schema(description = "退货时间")
|
||||
private LocalDateTime deliveryTime;
|
||||
|
||||
@Schema(description = "收货时间")
|
||||
private LocalDateTime receiveTime;
|
||||
|
||||
@Schema(description = "收货备注")
|
||||
private String receiveReason;
|
||||
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
### /trade-order/confirm-create-order-info 基于商品,确认创建订单
|
||||
GET {{appApi}}/trade/order/get-create-info?items[0].skuId=1&items[0].count=1
|
||||
Authorization: Bearer {{user-access-token}}
|
||||
### /trade-order/settlement 获得订单结算信息
|
||||
GET {{appApi}}/trade/order/settlement?cartIds=1
|
||||
Authorization: Bearer {{appToken}}
|
||||
tenant-id: {{appTenentId}}
|
||||
|
||||
### /trade-order/confirm-create-order-info-from-cart 基于购物车,确认创建订单
|
||||
|
@ -2,15 +2,18 @@ package cn.iocoder.yudao.module.trade.controller.app.order;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils;
|
||||
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
||||
import cn.iocoder.yudao.module.pay.api.notify.dto.PayOrderNotifyReqDTO;
|
||||
import cn.iocoder.yudao.module.product.api.property.ProductPropertyValueApi;
|
||||
import cn.iocoder.yudao.module.product.api.property.dto.ProductPropertyValueDetailRespDTO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.*;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemRespVO;
|
||||
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.framework.order.config.TradeOrderProperties;
|
||||
import cn.iocoder.yudao.module.trade.service.order.TradeOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@ -21,7 +24,11 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.validation.Valid;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
@ -40,12 +47,81 @@ public class AppTradeOrderController {
|
||||
@Resource
|
||||
private ProductPropertyValueApi productPropertyValueApi;
|
||||
|
||||
@GetMapping("/get-create-info")
|
||||
@Operation(summary = "基于商品,确认创建订单")
|
||||
@Resource
|
||||
private TradeOrderProperties tradeOrderProperties;
|
||||
|
||||
@GetMapping("/settlement")
|
||||
@Operation(summary = "获得订单结算信息")
|
||||
@PreAuthenticated
|
||||
public CommonResult<AppTradeOrderGetCreateInfoRespVO> getOrderCreateInfo(AppTradeOrderCreateReqVO createReqVO) {
|
||||
public CommonResult<AppTradeOrderSettlementRespVO> settlementOrder(
|
||||
@Valid AppTradeOrderSettlementReqVO settlementReqVO) {
|
||||
// return success(tradeOrderService.getOrderConfirmCreateInfo(UserSecurityContextHolder.getUserId(), skuId, quantity, couponCardId));
|
||||
return null;
|
||||
AppTradeOrderSettlementRespVO settlement = new AppTradeOrderSettlementRespVO();
|
||||
|
||||
AppTradeOrderSettlementRespVO.Price price = new AppTradeOrderSettlementRespVO.Price();
|
||||
price.setTotalPrice(1000);
|
||||
price.setDeliveryPrice(200);
|
||||
price.setCouponPrice(100);
|
||||
price.setPointPrice(50);
|
||||
price.setPayPrice(950);
|
||||
|
||||
List<AppTradeOrderSettlementRespVO.Item> skus = new ArrayList<>();
|
||||
|
||||
AppTradeOrderSettlementRespVO.Item item1 = new AppTradeOrderSettlementRespVO.Item();
|
||||
item1.setCartId(1L);
|
||||
item1.setSpuId(2048L);
|
||||
item1.setSpuName("Apple iPhone 12");
|
||||
item1.setSkuId(1024);
|
||||
item1.setPrice(500);
|
||||
item1.setPicUrl("https://pro.crmeb.net/uploads/attach/2022/10/12/0c56f9abb80d2775fc1e80dbe4f8826a.jpg");
|
||||
item1.setCount(2);
|
||||
List<AppProductPropertyValueDetailRespVO> properties1 = new ArrayList<>();
|
||||
AppProductPropertyValueDetailRespVO property1 = new AppProductPropertyValueDetailRespVO();
|
||||
property1.setPropertyId(1L);
|
||||
property1.setPropertyName("尺寸");
|
||||
property1.setValueId(2L);
|
||||
property1.setValueName("大");
|
||||
properties1.add(property1);
|
||||
item1.setProperties(properties1);
|
||||
|
||||
AppTradeOrderSettlementRespVO.Item item2 = new AppTradeOrderSettlementRespVO.Item();
|
||||
item2.setCartId(2L);
|
||||
item2.setSpuId(3072L);
|
||||
item2.setSpuName("Samsung Galaxy S21");
|
||||
item2.setSkuId(2048);
|
||||
item2.setPrice(800);
|
||||
item2.setPicUrl("https://pro.crmeb.net/uploads/attach/2022/10/12/0c56f9abb80d2775fc1e80dbe4f8826a.jpg");
|
||||
item2.setCount(1);
|
||||
List<AppProductPropertyValueDetailRespVO> properties2 = new ArrayList<>();
|
||||
AppProductPropertyValueDetailRespVO property2 = new AppProductPropertyValueDetailRespVO();
|
||||
property2.setPropertyId(10L);
|
||||
property2.setPropertyName("颜色");
|
||||
property2.setValueId(20L);
|
||||
property2.setValueName("白色");
|
||||
properties2.add(property2);
|
||||
item2.setProperties(properties2);
|
||||
|
||||
skus.add(item1);
|
||||
skus.add(item2);
|
||||
|
||||
settlement.setItems(skus);
|
||||
settlement.setPrice(price);
|
||||
|
||||
AppTradeOrderSettlementRespVO.Address address = new AppTradeOrderSettlementRespVO.Address();
|
||||
address.setId(1L);
|
||||
address.setName("John");
|
||||
address.setMobile("18888888888");
|
||||
address.setProvinceId(1L);
|
||||
address.setProvinceName("Beijing");
|
||||
address.setCityId(1L);
|
||||
address.setCityName("Beijing");
|
||||
address.setDistrictId(1L);
|
||||
address.setDistrictName("Chaoyang Distripct");
|
||||
address.setDetailAddress("No. 10, Xinzhong Street, Chaoyang District");
|
||||
address.setDefaulted(true);
|
||||
settlement.setAddress(address);
|
||||
|
||||
return success(settlement);
|
||||
}
|
||||
|
||||
@PostMapping("/create")
|
||||
@ -53,12 +129,13 @@ public class AppTradeOrderController {
|
||||
@PreAuthenticated
|
||||
public CommonResult<Long> createOrder(@RequestBody AppTradeOrderCreateReqVO createReqVO,
|
||||
HttpServletRequest servletRequest) {
|
||||
// 获取登录用户、用户 IP 地址
|
||||
Long loginUserId = getLoginUserId();
|
||||
String clientIp = ServletUtils.getClientIP(servletRequest);
|
||||
// 创建交易订单,预支付记录
|
||||
Long orderId = tradeOrderService.createOrder(loginUserId, clientIp, createReqVO);
|
||||
return success(orderId);
|
||||
return success(1L);
|
||||
// // 获取登录用户、用户 IP 地址
|
||||
// Long loginUserId = getLoginUserId();
|
||||
// String clientIp = ServletUtils.getClientIP(servletRequest);
|
||||
// // 创建交易订单,预支付记录
|
||||
// Long orderId = tradeOrderService.createOrder(loginUserId, clientIp, createReqVO);
|
||||
// return success(orderId);
|
||||
}
|
||||
|
||||
@PostMapping("/update-paid")
|
||||
@ -81,11 +158,12 @@ public class AppTradeOrderController {
|
||||
List<ProductPropertyValueDetailRespDTO> propertyValueDetails = productPropertyValueApi
|
||||
.getPropertyValueDetailList(TradeOrderConvert.INSTANCE.convertPropertyValueIds(orderItems));
|
||||
// 最终组合
|
||||
return success(TradeOrderConvert.INSTANCE.convert02(order, orderItems, propertyValueDetails));
|
||||
return success(TradeOrderConvert.INSTANCE.convert02(order, orderItems,
|
||||
propertyValueDetails, tradeOrderProperties));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得订单交易分页")
|
||||
@Operation(summary = "获得交易订单分页")
|
||||
public CommonResult<PageResult<AppTradeOrderPageItemRespVO>> getOrderPage(AppTradeOrderPageReqVO reqVO) {
|
||||
// 查询订单
|
||||
PageResult<TradeOrderDO> pageResult = tradeOrderService.getOrderPage(getLoginUserId(), reqVO);
|
||||
@ -99,4 +177,38 @@ public class AppTradeOrderController {
|
||||
return success(TradeOrderConvert.INSTANCE.convertPage02(pageResult, orderItems, propertyValueDetails));
|
||||
}
|
||||
|
||||
@GetMapping("/get-count")
|
||||
@Operation(summary = "获得交易订单数量")
|
||||
public CommonResult<Map<String, Long>> getOrderCount() {
|
||||
Map<String, Long> orderCount = new HashMap<>();
|
||||
// 全部
|
||||
orderCount.put("allCount", tradeOrderService.getOrderCount(getLoginUserId(), null, null));
|
||||
// 待付款(未支付)
|
||||
orderCount.put("unpaidCount", tradeOrderService.getOrderCount(getLoginUserId(), TradeOrderStatusEnum.UNPAID.getStatus(), null));
|
||||
// 待发货
|
||||
orderCount.put("undeliveredCount", tradeOrderService.getOrderCount(getLoginUserId(), TradeOrderStatusEnum.UNDELIVERED.getStatus(), null));
|
||||
// 待收货
|
||||
orderCount.put("deliveredCount", tradeOrderService.getOrderCount(getLoginUserId(), TradeOrderStatusEnum.DELIVERED.getStatus(), null));
|
||||
// 待评价
|
||||
orderCount.put("uncommentedCount", tradeOrderService.getOrderCount(getLoginUserId(), TradeOrderStatusEnum.COMPLETED.getStatus(), false));
|
||||
return success(orderCount);
|
||||
}
|
||||
|
||||
// ========== 订单项 ==========
|
||||
|
||||
@GetMapping("/item/get")
|
||||
@Operation(summary = "获得交易订单项")
|
||||
@Parameter(name = "id", description = "交易订单项编号")
|
||||
public CommonResult<AppTradeOrderItemRespVO> getOrderItem(@RequestParam("id") Long id) {
|
||||
TradeOrderItemDO item = tradeOrderService.getOrderItem(getLoginUserId(), id);
|
||||
return success(TradeOrderConvert.INSTANCE.convert03(item));
|
||||
}
|
||||
|
||||
// TODO 芋艿:待实现
|
||||
@PostMapping("/item/create-comment")
|
||||
@Operation(summary = "创建交易订单项的评价")
|
||||
public CommonResult<Long> createOrderItemComment() {
|
||||
return success(0L);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -3,8 +3,6 @@ package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
@ -20,33 +18,13 @@ public class AppTradeOrderCreateReqVO {
|
||||
@Schema(description = "优惠劵编号", example = "1024")
|
||||
private Long couponId;
|
||||
|
||||
@Schema(description = "购物车项的编号数组", required = true, example = "true")
|
||||
@NotEmpty(message = "购物车项不能为空")
|
||||
private List<Long> cartIds;
|
||||
|
||||
// ========== 非 AppTradeOrderSettlementReqVO 字段 ==========
|
||||
|
||||
@Schema(description = "备注", example = "这个是我的订单哟")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "是否来自购物车", required = true, example = "true") // true - 来自购物车;false - 立即购买
|
||||
@NotNull(message = "是否来自购物车不能为空")
|
||||
private Boolean fromCart;
|
||||
|
||||
/**
|
||||
* 订单商品项列表
|
||||
*/
|
||||
@NotEmpty(message = "必须选择购买的商品")
|
||||
@Valid
|
||||
private List<Item> items;
|
||||
|
||||
@Schema(description = "订单商品项")
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
@Schema(description = "商品 SKU 编号", required = true, example = "111")
|
||||
@NotNull(message = "商品 SKU 编号不能为空")
|
||||
private Long skuId;
|
||||
|
||||
@Schema(description = "商品 SKU 购买数量", required = true, example = "1024")
|
||||
@NotNull(message = "商品 SKU 购买数量不能为空")
|
||||
@Min(value = 1, message = "商品 SKU 购买数量必须大于 0")
|
||||
private Integer count;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@ -38,14 +38,26 @@ public class AppTradeOrderDetailRespVO {
|
||||
@Schema(description = "订单取消时间")
|
||||
private LocalDateTime cancelTime;
|
||||
|
||||
@Schema(description = "是否评价", required = true, example = "true")
|
||||
private Boolean commentStatus;
|
||||
|
||||
// ========== 价格 + 支付基本信息 ==========
|
||||
|
||||
@Schema(description = "是否已支付", required = true, example = "true")
|
||||
private Boolean payed;
|
||||
|
||||
@Schema(description = "支付订单编号", required = true, example = "1024")
|
||||
private Long payOrderId;
|
||||
|
||||
@Schema(description = "付款时间")
|
||||
private LocalDateTime payTime;
|
||||
|
||||
@Schema(description = "付款超时时间", required = true)
|
||||
private LocalDateTime payExpireTime;
|
||||
|
||||
@Schema(description = "支付渠道", required = true, example = "wx_lite_pay")
|
||||
private String payChannelCode;
|
||||
|
||||
@Schema(description = "商品原价(总)", required = true, example = "1000")
|
||||
private Integer originalPrice;
|
||||
|
||||
@ -66,6 +78,9 @@ public class AppTradeOrderDetailRespVO {
|
||||
|
||||
// ========== 收件 + 物流基本信息 ==========
|
||||
|
||||
@Schema(description = "配送方式", required = true, example = "1")
|
||||
private Integer deliveryType;
|
||||
|
||||
@Schema(description = "发货物流单号", example = "1024")
|
||||
private String logisticsNo;
|
||||
|
||||
@ -87,9 +102,6 @@ public class AppTradeOrderDetailRespVO {
|
||||
@Schema(description = "收件人地区名字", required = true, example = "上海 上海市 普陀区")
|
||||
private String receiverAreaName;
|
||||
|
||||
@Schema(description = "收件人邮编", required = true, example = "100000")
|
||||
private Integer receiverPostCode;
|
||||
|
||||
@Schema(description = "收件人详细地址", required = true, example = "中关村大街 1 号")
|
||||
private String receiverDetailAddress;
|
||||
|
||||
@ -109,41 +121,6 @@ public class AppTradeOrderDetailRespVO {
|
||||
/**
|
||||
* 订单项数组
|
||||
*/
|
||||
private List<Item> items;
|
||||
|
||||
@Schema(description = "用户 App - 交易订单的分页项的订单项目")
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
@Schema(description = "编号", required = true, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商品 SPU 编号", required = true, example = "1")
|
||||
private Long spuId;
|
||||
|
||||
@Schema(description = "商品 SPU 名称", required = true, example = "芋道源码")
|
||||
private String spuName;
|
||||
|
||||
@Schema(description = "商品 SKU 编号", required = true, example = "1")
|
||||
private Long skuId;
|
||||
|
||||
@Schema(description = "商品图片", required = true, example = "https://www.iocoder.cn/1.png")
|
||||
private String picUrl;
|
||||
|
||||
@Schema(description = "购买数量", required = true, example = "1")
|
||||
private Integer count;
|
||||
|
||||
@Schema(description = "商品原价(总)", required = true, example = "100")
|
||||
private Integer originalPrice;
|
||||
|
||||
@Schema(description = "商品原价(单)", required = true, example = "100")
|
||||
private Integer originalUnitPrice;
|
||||
|
||||
/**
|
||||
* 属性数组
|
||||
*/
|
||||
private List<AppProductPropertyValueDetailRespVO> properties;
|
||||
|
||||
}
|
||||
private List<AppTradeOrderItemRespVO> items;
|
||||
|
||||
}
|
||||
|
@ -1,168 +0,0 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "用户 App - 订单获得创建信息 Response VO")
|
||||
@Data
|
||||
public class AppTradeOrderGetCreateInfoRespVO {
|
||||
|
||||
/**
|
||||
* 商品分组数组
|
||||
*/
|
||||
private List<ItemGroup> itemGroups;
|
||||
/**
|
||||
* 费用
|
||||
*/
|
||||
private Fee fee;
|
||||
|
||||
// /**
|
||||
// * 优惠劵列表 TODO 芋艿,后续改改
|
||||
// */
|
||||
// private List<CouponCardAvailableRespDTO> coupons;
|
||||
|
||||
@Schema(description = "商品分组") // 多个商品,参加同一个活动,从而形成分组
|
||||
@Data
|
||||
public static class ItemGroup {
|
||||
|
||||
// /**
|
||||
// * 优惠活动
|
||||
// */
|
||||
// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
|
||||
/**
|
||||
* 商品 SKU 数组
|
||||
*/
|
||||
private List<Sku> items;
|
||||
|
||||
}
|
||||
|
||||
@Schema(description = "商品 SKU")
|
||||
@Data
|
||||
public static class Sku {
|
||||
|
||||
// SKU 自带信息
|
||||
@Schema(description = "SKU 编号", required = true, example = "1024")
|
||||
private Integer id;
|
||||
/**
|
||||
* SPU 信息
|
||||
*/
|
||||
private Spu spu;
|
||||
/**
|
||||
* 图片地址
|
||||
*/
|
||||
private String picURL;
|
||||
// /**
|
||||
// * 属性数组
|
||||
// */
|
||||
// private List<ProductAttrKeyValueRespVO> attrs; // TODO 后面改下
|
||||
/**
|
||||
* 价格,单位:分
|
||||
*/
|
||||
private Integer price;
|
||||
/**
|
||||
* 库存数量
|
||||
*/
|
||||
private Integer stock;
|
||||
|
||||
// 非 SKU 自带信息
|
||||
|
||||
/**
|
||||
* 购买数量
|
||||
*/
|
||||
private Integer buyQuantity;
|
||||
// /**
|
||||
// * 优惠活动
|
||||
// */
|
||||
// private PromotionActivityRespDTO activity; // TODO 芋艿,偷懒
|
||||
/**
|
||||
* 原始单价,单位:分。
|
||||
*/
|
||||
private Integer originPrice;
|
||||
/**
|
||||
* 购买单价,单位:分
|
||||
*/
|
||||
private Integer buyPrice;
|
||||
/**
|
||||
* 最终价格,单位:分。
|
||||
*/
|
||||
private Integer presentPrice;
|
||||
/**
|
||||
* 购买总金额,单位:分
|
||||
*
|
||||
* 用途类似 {@link #presentTotal}
|
||||
*/
|
||||
private Integer buyTotal;
|
||||
/**
|
||||
* 优惠总金额,单位:分。
|
||||
*/
|
||||
private Integer discountTotal;
|
||||
/**
|
||||
* 最终总金额,单位:分。
|
||||
*
|
||||
* 注意,presentPrice * quantity 不一定等于 presentTotal 。
|
||||
* 因为,存在无法整除的情况。
|
||||
* 举个例子,presentPrice = 8.33 ,quantity = 3 的情况,presentTotal 有可能是 24.99 ,也可能是 25 。
|
||||
* 所以,需要存储一个该字段。
|
||||
*/
|
||||
private Integer presentTotal;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class Spu {
|
||||
|
||||
/**
|
||||
* SPU 编号
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
// ========== 基本信息 =========
|
||||
/**
|
||||
* SPU 名字
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 分类编号
|
||||
*/
|
||||
private Integer cid;
|
||||
/**
|
||||
* 商品主图地址
|
||||
*
|
||||
* 数组,以逗号分隔
|
||||
*
|
||||
* 建议尺寸:800*800像素,你可以拖拽图片调整顺序,最多上传15张
|
||||
*/
|
||||
private List<String> picUrls;
|
||||
|
||||
}
|
||||
|
||||
@Schema(description = "费用(合计)")
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public static class Fee {
|
||||
|
||||
@Schema(description = "购买总价", required = true, example = "1024")
|
||||
private Integer buyPrice;
|
||||
/**
|
||||
* 优惠总价
|
||||
*
|
||||
* 注意,满多少元包邮,不算在优惠中。
|
||||
*/
|
||||
private Integer discountTotal;
|
||||
/**
|
||||
* 邮费
|
||||
*/
|
||||
private Integer postageTotal;
|
||||
/**
|
||||
* 最终价格
|
||||
*
|
||||
* 计算公式 = 总价 - 优惠总价 + 邮费
|
||||
*/
|
||||
private Integer presentTotal;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "用户 App - 订单交易的分页项 Response VO")
|
||||
@ -16,50 +17,34 @@ public class AppTradeOrderPageItemRespVO {
|
||||
@Schema(description = "订单流水号", required = true, example = "1146347329394184195")
|
||||
private String no;
|
||||
|
||||
@Schema(description = "订单类型", required = true, example = "0")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "订单状态", required = true, example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "购买的商品数量", required = true, example = "10")
|
||||
private Integer productCount;
|
||||
|
||||
@Schema(description = "是否评价", required = true, example = "true")
|
||||
private Boolean commentStatus;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private Date createTime;
|
||||
|
||||
// ========== 价格 + 支付基本信息 ==========
|
||||
|
||||
@Schema(description = "应付金额,单位:分", required = true, example = "1000")
|
||||
private Integer payPrice;
|
||||
|
||||
// ========== 收件 + 物流基本信息 ==========
|
||||
|
||||
@Schema(description = "配送方式", required = true, example = "1")
|
||||
private Integer deliveryType;
|
||||
|
||||
/**
|
||||
* 订单项数组
|
||||
*/
|
||||
private List<Item> items;
|
||||
|
||||
@Schema(description = "用户 App - 交易订单的明细的订单项目")
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
@Schema(description = "编号", required = true, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商品 SPU 编号", required = true, example = "1")
|
||||
private Long spuId;
|
||||
|
||||
@Schema(description = "商品 SPU 名称", required = true, example = "芋道源码")
|
||||
private String spuName;
|
||||
|
||||
@Schema(description = "商品 SKU 编号", required = true, example = "1")
|
||||
private Long skuId;
|
||||
|
||||
@Schema(description = "商品图片", required = true, example = "https://www.iocoder.cn/1.png")
|
||||
private String picUrl;
|
||||
|
||||
@Schema(description = "购买数量", required = true, example = "1")
|
||||
private Integer count;
|
||||
|
||||
@Schema(description = "商品原价(总)", required = true, example = "100")
|
||||
private Integer originalPrice;
|
||||
|
||||
@Schema(description = "商品原价(单)", required = true, example = "100")
|
||||
private Integer originalUnitPrice;
|
||||
|
||||
/**
|
||||
* 属性数组
|
||||
*/
|
||||
private List<AppProductPropertyValueDetailRespVO> properties;
|
||||
|
||||
}
|
||||
private List<AppTradeOrderItemRespVO> items;
|
||||
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
// TODO 芋艿:字段优化
|
||||
@Schema(description = "交易订单分页 Request VO")
|
||||
@Data
|
||||
public class AppTradeOrderPageReqVO extends PageParam {
|
||||
@ -15,4 +14,7 @@ public class AppTradeOrderPageReqVO extends PageParam {
|
||||
@InEnum(value = TradeOrderStatusEnum.class, message = "订单状态必须是 {value}")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "是否评价", example = "true")
|
||||
private Boolean commentStatus;
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,23 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "用户 App - 交易订单结算 Request VO")
|
||||
@Data
|
||||
public class AppTradeOrderSettlementReqVO {
|
||||
|
||||
@Schema(description = "收件地址编号", example = "1")
|
||||
private Long addressId;
|
||||
|
||||
@Schema(description = "优惠劵编号", example = "1024")
|
||||
private Long couponId;
|
||||
|
||||
@Schema(description = "购物车项的编号数组", required = true, example = "true")
|
||||
@NotEmpty(message = "购物车项不能为空")
|
||||
private List<Long> cartIds;
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.app.order.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "用户 App - 交易订单结算信息 Response VO")
|
||||
@Data
|
||||
public class AppTradeOrderSettlementRespVO {
|
||||
|
||||
@Schema(description = "购物项数组", required = true)
|
||||
private List<Item> items;
|
||||
|
||||
@Schema(description = "费用", required = true)
|
||||
private Price price;
|
||||
|
||||
@Schema(description = "收件地址", required = true)
|
||||
private Address address;
|
||||
|
||||
@Schema(description = "购物项")
|
||||
@Data
|
||||
public static class Item {
|
||||
|
||||
// ========== SPU 信息 ==========
|
||||
|
||||
@Schema(description = "SPU 编号", required = true, example = "2048")
|
||||
private Long spuId;
|
||||
@Schema(description = "SPU 名字", required = true, example = "Apple iPhone 12")
|
||||
private String spuName;
|
||||
|
||||
// ========== SKU 信息 ==========
|
||||
|
||||
@Schema(description = "SKU 编号", required = true, example = "1024")
|
||||
private Integer skuId;
|
||||
@Schema(description = "价格,单位:分", required = true, example = "100")
|
||||
private Integer price;
|
||||
@Schema(description = "图片地址", required = true, example = "https://www.iocoder.cn/1.png")
|
||||
private String picUrl;
|
||||
|
||||
@Schema(description = "属性数组", required = true, example = "100")
|
||||
private List<AppProductPropertyValueDetailRespVO> properties;
|
||||
|
||||
// ========== 购物车信息 ==========
|
||||
|
||||
@Schema(description = "购物车编号", required = true, example = "100")
|
||||
private Long cartId;
|
||||
|
||||
@Schema(description = "购买数量", required = true, example = "1")
|
||||
private Integer count;
|
||||
|
||||
}
|
||||
|
||||
@Schema(description = "费用(合计)")
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class Price {
|
||||
|
||||
@Schema(description = "商品原价(总),单位:分", required = true, example = "500")
|
||||
private Integer totalPrice;
|
||||
|
||||
@Schema(description = "运费金额,单位:分", required = true, example = "50")
|
||||
private Integer deliveryPrice;
|
||||
|
||||
@Schema(description = "优惠劵减免金额,单位:分", required = true, example = "100")
|
||||
private Integer couponPrice;
|
||||
|
||||
@Schema(description = "积分抵扣的金额,单位:分", required = true, example = "50")
|
||||
private Integer pointPrice;
|
||||
|
||||
@Schema(description = "实际支付金额(总),单位:分", required = true, example = "450")
|
||||
private Integer payPrice;
|
||||
|
||||
}
|
||||
|
||||
@Schema(description = "费用(合计)")
|
||||
@Data
|
||||
public static class Address {
|
||||
|
||||
@Schema(description = "编号", required = true, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "收件人名称", required = true, example = "小王")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "手机号", required = true, example = "15601691300")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "省份编号", required = true, example = "1")
|
||||
private Long provinceId;
|
||||
@Schema(description = "省份名字", required = true, example = "北京")
|
||||
private String provinceName;
|
||||
|
||||
@Schema(description = "城市编号", required = true, example = "1")
|
||||
private Long cityId;
|
||||
@Schema(description = "城市名字", required = true, example = "北京")
|
||||
private String cityName;
|
||||
|
||||
@Schema(description = "地区编号", required = true, example = "1")
|
||||
private Long districtId;
|
||||
@Schema(description = "地区名字", required = true, example = "朝阳区")
|
||||
private String districtName;
|
||||
|
||||
@Schema(description = "详细地址", required = true, example = "望京悠乐汇 A 座")
|
||||
private String detailAddress;
|
||||
|
||||
@Schema(description = "是否默认收件地址", required = true, example = "true")
|
||||
private Boolean defaulted;
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.trade.controller.app.order.vo.item;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductPropertyValueDetailRespVO;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Schema(description = "用户 App - 订单交易项 Response VO")
|
||||
@Data
|
||||
public class AppTradeOrderItemRespVO {
|
||||
|
||||
@Schema(description = "编号", required = true, example = "1")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "商品 SPU 编号", required = true, example = "1")
|
||||
private Long spuId;
|
||||
@Schema(description = "商品 SPU 名称", required = true, example = "芋道源码")
|
||||
private String spuName;
|
||||
|
||||
@Schema(description = "商品 SKU 编号", required = true, example = "1")
|
||||
private Long skuId;
|
||||
|
||||
/**
|
||||
* 属性数组
|
||||
*/
|
||||
private List<AppProductPropertyValueDetailRespVO> properties;
|
||||
|
||||
@Schema(description = "商品图片", required = true, example = "https://www.iocoder.cn/1.png")
|
||||
private String picUrl;
|
||||
|
||||
@Schema(description = "购买数量", required = true, example = "1")
|
||||
private Integer count;
|
||||
|
||||
@Schema(description = "是否评价", required = true, example = "true")
|
||||
private Boolean commentStatus;
|
||||
|
||||
// ========== 价格 + 支付基本信息 ==========
|
||||
|
||||
@Schema(description = "商品原价(单)", required = true, example = "100")
|
||||
private Integer price;
|
||||
|
||||
// ========== 营销基本信息 ==========
|
||||
|
||||
// TODO 芋艿:在捉摸一下
|
||||
|
||||
// ========== 售后基本信息 ==========
|
||||
|
||||
@Schema(description = "售后状态", required = true, example = "1")
|
||||
private Integer afterSaleStatus;
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.trade.convert.delivery;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressExcelVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
|
||||
/**
|
||||
* 快递公司 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeliveryExpressConvert {
|
||||
|
||||
DeliveryExpressConvert INSTANCE = Mappers.getMapper(DeliveryExpressConvert.class);
|
||||
|
||||
DeliveryExpressDO convert(DeliveryExpressCreateReqVO bean);
|
||||
|
||||
DeliveryExpressDO convert(DeliveryExpressUpdateReqVO bean);
|
||||
|
||||
DeliveryExpressRespVO convert(DeliveryExpressDO bean);
|
||||
|
||||
List<DeliveryExpressRespVO> convertList(List<DeliveryExpressDO> list);
|
||||
|
||||
PageResult<DeliveryExpressRespVO> convertPage(PageResult<DeliveryExpressDO> page);
|
||||
|
||||
List<DeliveryExpressExcelVO> convertList02(List<DeliveryExpressDO> list);
|
||||
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
package cn.iocoder.yudao.module.trade.convert.delivery;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.*;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateChargeDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateFreeDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
/**
|
||||
* 快递运费模板 Convert
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeliveryExpressTemplateConvert {
|
||||
|
||||
DeliveryExpressTemplateConvert INSTANCE = Mappers.getMapper(DeliveryExpressTemplateConvert.class);
|
||||
|
||||
DeliveryExpressTemplateDO convert(DeliveryExpressTemplateCreateReqVO bean);
|
||||
|
||||
DeliveryExpressTemplateDO convert(DeliveryExpressTemplateUpdateReqVO bean);
|
||||
|
||||
DeliveryExpressTemplateSimpleRespVO convert(DeliveryExpressTemplateDO bean);
|
||||
|
||||
DeliveryExpressTemplateRespVO convert2(DeliveryExpressTemplateDO bean);
|
||||
|
||||
List<DeliveryExpressTemplateSimpleRespVO> convertList(List<DeliveryExpressTemplateDO> list);
|
||||
|
||||
PageResult<DeliveryExpressTemplateSimpleRespVO> convertPage(PageResult<DeliveryExpressTemplateDO> page);
|
||||
|
||||
List<DeliveryExpressTemplateExcelVO> convertList02(List<DeliveryExpressTemplateDO> list);
|
||||
|
||||
DeliveryExpressTemplateChargeDO convertTemplateCharge(Long templateId, Integer chargeMode, ExpressTemplateChargeBaseVO vo);
|
||||
|
||||
DeliveryExpressTemplateChargeDO convertTemplateCharge(ExpressTemplateChargeUpdateVO vo);
|
||||
|
||||
DeliveryExpressTemplateFreeDO convertTemplateFree(Long templateId, ExpressTemplateFreeBaseVO vo);
|
||||
|
||||
DeliveryExpressTemplateFreeDO convertTemplateFree(ExpressTemplateFreeUpdateVO vo);
|
||||
|
||||
List<ExpressTemplateChargeBaseVO> convertTemplateChargeList(List<DeliveryExpressTemplateChargeDO> list);
|
||||
|
||||
List<ExpressTemplateFreeBaseVO> convertTemplateFreeList(List<DeliveryExpressTemplateFreeDO> list);
|
||||
|
||||
default List<DeliveryExpressTemplateChargeDO> convertTemplateChargeList(Long templateId, Integer chargeMode, List<ExpressTemplateChargeBaseVO> list){
|
||||
if(CollUtil.isEmpty(list)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<DeliveryExpressTemplateChargeDO> templateChargeList = new ArrayList<>( list.size() );
|
||||
for (ExpressTemplateChargeBaseVO item : list) {
|
||||
templateChargeList.add(convertTemplateCharge(templateId, chargeMode, item));
|
||||
}
|
||||
return templateChargeList;
|
||||
}
|
||||
|
||||
|
||||
|
||||
default List<DeliveryExpressTemplateFreeDO> convertTemplateFreeList(Long templateId, List<ExpressTemplateFreeBaseVO> list) {
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<DeliveryExpressTemplateFreeDO> templateFreeList = new ArrayList<>(list.size());
|
||||
for (ExpressTemplateFreeBaseVO item : list) {
|
||||
templateFreeList.add(convertTemplateFree(templateId, item));
|
||||
}
|
||||
return templateFreeList;
|
||||
}
|
||||
|
||||
default DeliveryExpressTemplateRespVO convert(DeliveryExpressTemplateDO bean,
|
||||
List<DeliveryExpressTemplateChargeDO> chargeList,
|
||||
List<DeliveryExpressTemplateFreeDO> freeList){
|
||||
DeliveryExpressTemplateRespVO respVO = convert2(bean);
|
||||
respVO.setTemplateCharge(convertTemplateChargeList(chargeList));
|
||||
respVO.setTemplateFree(convertTemplateFreeList(freeList));
|
||||
return respVO;
|
||||
}
|
||||
}
|
@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.trade.controller.app.base.property.AppProductProp
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderDetailRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageItemRespVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.item.AppTradeOrderItemRespVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderItemDO;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum;
|
||||
@ -50,7 +51,6 @@ public interface TradeOrderConvert {
|
||||
@Mapping(source = "address.name", target = "receiverName"),
|
||||
@Mapping(source = "address.mobile", target = "receiverMobile"),
|
||||
@Mapping(source = "address.areaId", target = "receiverAreaId"),
|
||||
@Mapping(source = "address.postCode", target = "receiverPostCode"),
|
||||
@Mapping(source = "address.detailAddress", target = "receiverDetailAddress"),
|
||||
})
|
||||
TradeOrderDO convert(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO,
|
||||
@ -192,7 +192,7 @@ public interface TradeOrderConvert {
|
||||
if (CollUtil.isEmpty(properties)) {
|
||||
continue;
|
||||
}
|
||||
AppTradeOrderPageItemRespVO.Item item = orderVO.getItems().get(i);
|
||||
AppTradeOrderItemRespVO item = orderVO.getItems().get(i);
|
||||
item.setProperties(new ArrayList<>(properties.size()));
|
||||
// 遍历每个 properties,设置到 TradeOrderPageItemRespVO.Item 中
|
||||
properties.forEach(property -> {
|
||||
@ -212,8 +212,9 @@ public interface TradeOrderConvert {
|
||||
AppProductPropertyValueDetailRespVO convert02(ProductPropertyValueDetailRespDTO bean);
|
||||
|
||||
default AppTradeOrderDetailRespVO convert02(TradeOrderDO order, List<TradeOrderItemDO> orderItems,
|
||||
List<ProductPropertyValueDetailRespDTO> propertyValueDetails) {
|
||||
List<ProductPropertyValueDetailRespDTO> propertyValueDetails, TradeOrderProperties tradeOrderProperties) {
|
||||
AppTradeOrderDetailRespVO orderVO = convert3(order, orderItems);
|
||||
orderVO.setPayExpireTime(addTime(tradeOrderProperties.getExpireTime()));
|
||||
// 处理商品属性
|
||||
Map<Long, ProductPropertyValueDetailRespDTO> propertyValueDetailMap = convertMap(propertyValueDetails, ProductPropertyValueDetailRespDTO::getValueId);
|
||||
for (int i = 0; i < orderItems.size(); i++) {
|
||||
@ -221,7 +222,7 @@ public interface TradeOrderConvert {
|
||||
if (CollUtil.isEmpty(properties)) {
|
||||
continue;
|
||||
}
|
||||
AppTradeOrderDetailRespVO.Item item = orderVO.getItems().get(i);
|
||||
AppTradeOrderItemRespVO item = orderVO.getItems().get(i);
|
||||
item.setProperties(new ArrayList<>(properties.size()));
|
||||
// 遍历每个 properties,设置到 TradeOrderPageItemRespVO.Item 中
|
||||
properties.forEach(property -> {
|
||||
@ -238,4 +239,6 @@ public interface TradeOrderConvert {
|
||||
}
|
||||
AppTradeOrderDetailRespVO convert3(TradeOrderDO order, List<TradeOrderItemDO> items);
|
||||
|
||||
AppTradeOrderItemRespVO convert03(TradeOrderItemDO bean);
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.dataobject.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 快递公司 DO
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@TableName(value ="trade_delivery_express")
|
||||
@KeySequence("trade_delivery_express_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
public class DeliveryExpressDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号,自增
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 快递公司 code
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 快递公司名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 快递公司 logo
|
||||
*/
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
// TODO 芋艿:c 和结算相关的字段,后续在看
|
||||
// partnerId 是否需要月结账号
|
||||
// partnerKey 是否需要月结密码
|
||||
// net 是否需要取件网店
|
||||
// account 账号
|
||||
// password 网点名称
|
||||
// isShow 是否显示
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.dataobject.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 快递运费模板计费配置 DO
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@TableName(value ="trade_delivery_express_template_charge")
|
||||
@KeySequence("trade_delivery_express_template_charge_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
public class DeliveryExpressTemplateChargeDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号,自增
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 配送模板编号
|
||||
*
|
||||
* 关联 {@link DeliveryExpressTemplateDO#getId()}
|
||||
*/
|
||||
private Long templateId;
|
||||
|
||||
/**
|
||||
* 配送区域
|
||||
*/
|
||||
private Integer areaId;
|
||||
|
||||
/**
|
||||
* 配送计费方式
|
||||
*
|
||||
* 冗余 {@link DeliveryExpressTemplateDO#getChargeMode()}
|
||||
*/
|
||||
private Integer chargeMode;
|
||||
|
||||
/**
|
||||
* 首件数量(件数,重量,或体积)
|
||||
*/
|
||||
private Double startCount;
|
||||
/**
|
||||
* 起步价,单位:分
|
||||
*/
|
||||
private Integer startPrice;
|
||||
|
||||
/**
|
||||
* 续件数量(件, 重量,或体积)
|
||||
*/
|
||||
private Double extraCount;
|
||||
/**
|
||||
* 额外价,单位:分
|
||||
*/
|
||||
private Integer extraPrice;
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.dataobject.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryExpressChargeModeEnum;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
/**
|
||||
* 快递运费模板 DO
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@TableName("trade_delivery_express_template")
|
||||
@KeySequence("trade_delivery_express_template_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
public class DeliveryExpressTemplateDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号,自增
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 模板名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 配送计费方式
|
||||
*
|
||||
* 枚举 {@link DeliveryExpressChargeModeEnum}
|
||||
*/
|
||||
private Integer chargeMode;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.dataobject.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 快递运费模板包邮配置 DO
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@TableName(value ="trade_delivery_express_template_free")
|
||||
@KeySequence("trade_delivery_express_template_free_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
public class DeliveryExpressTemplateFreeDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 配送模板编号
|
||||
*
|
||||
* 关联 {@link DeliveryExpressTemplateDO#getId()}
|
||||
*/
|
||||
private Long templateId;
|
||||
|
||||
/**
|
||||
* 包邮区域id
|
||||
*/
|
||||
private Integer areaId;
|
||||
|
||||
/**
|
||||
* 包邮金额,单位:分
|
||||
*
|
||||
* 订单总金额 > 包邮金额时,才免运费
|
||||
*/
|
||||
private Integer freePrice;
|
||||
|
||||
/**
|
||||
* 包邮件数
|
||||
*
|
||||
* 订单总件数 > 包邮件数时,才免运费
|
||||
*/
|
||||
private Integer freeCount;
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.dataobject.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalTime;
|
||||
|
||||
/**
|
||||
* 自提门店 DO
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@TableName(value ="trade_delivery_pick_up_store")
|
||||
@KeySequence("trade_delivery_pick_up_store_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
public class DeliveryPickUpStoreDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号,自增
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 门店名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 门店简介
|
||||
*/
|
||||
private String introduction;
|
||||
|
||||
/**
|
||||
* 门店手机
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 区域 id
|
||||
*/
|
||||
private Integer areaId;
|
||||
|
||||
/**
|
||||
* 门店详细地址
|
||||
*/
|
||||
private String detailAddress;
|
||||
|
||||
/**
|
||||
* 门店 logo
|
||||
*/
|
||||
private String logo;
|
||||
|
||||
/**
|
||||
* 营业开始时间
|
||||
*/
|
||||
private LocalTime openingTime;
|
||||
/**
|
||||
* 营业结束时间
|
||||
*/
|
||||
private LocalTime closingTime;
|
||||
|
||||
// TODO @Jason:应该是 double?
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
private String latitude;
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String longitude;
|
||||
|
||||
/**
|
||||
* 门店状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.dataobject.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
// TODO @芋艿:后续再详细 review 一轮
|
||||
// TODO @芋艿:可能改成 DeliveryPickUpStoreUserDO
|
||||
/**
|
||||
* 自提门店店员 DO
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@TableName(value ="trade_delivery_pick_up_store_staff")
|
||||
@KeySequence("trade_delivery_pick_up_store_staff_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
public class DeliveryPickUpStoreStaffDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 编号,自增
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 自提门店编号
|
||||
*
|
||||
* 关联 {@link DeliveryPickUpStoreDO#getId()}
|
||||
*/
|
||||
private Long storeId;
|
||||
|
||||
/**
|
||||
* 管理员用户id
|
||||
*
|
||||
* 关联 {AdminUserDO#getId()}
|
||||
*/
|
||||
private Long adminUserId;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*
|
||||
* 枚举 {@link CommonStatusEnum}
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -3,8 +3,9 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order;
|
||||
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateRespDTO.OrderItem;
|
||||
import cn.iocoder.yudao.module.trade.enums.delivery.DeliveryTypeEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCancelTypeEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderAfterSaleStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderDeliveryStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderTypeEnum;
|
||||
@ -94,6 +95,13 @@ public class TradeOrderDO extends BaseDO {
|
||||
* 商家备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 是否评价
|
||||
*
|
||||
* true - 已评价
|
||||
* false - 未评价
|
||||
*/
|
||||
private Boolean commentStatus;
|
||||
|
||||
// ========== 价格 + 支付基本信息 ==========
|
||||
|
||||
@ -128,16 +136,17 @@ public class TradeOrderDO extends BaseDO {
|
||||
/**
|
||||
* 商品原价(总),单位:分
|
||||
*
|
||||
* 基于 {@link TradeOrderItemDO#getOriginalPrice()} 求和
|
||||
* totalPrice = {@link TradeOrderItemDO#getPrice()} * {@link TradeOrderItemDO#getCount()} 求和
|
||||
*
|
||||
* 对应 taobao 的 trade.total_fee 字段
|
||||
*/
|
||||
private Integer originalPrice;
|
||||
private Integer totalPrice;
|
||||
// TODO 芋艿:是不是要删除这个字段?
|
||||
/**
|
||||
* 订单原价(总),单位:分
|
||||
*
|
||||
* 基于 {@link OrderItem#getPayPrice()} 求和
|
||||
* 和 {@link #originalPrice} 的差异:去除商品级优惠
|
||||
* 1. orderPrice = {@link OrderItem#getPayPrice()} 求和
|
||||
* 2. orderPrice = {@link #totalPrice} - 商品级优惠
|
||||
*/
|
||||
private Integer orderPrice;
|
||||
/**
|
||||
@ -171,6 +180,12 @@ public class TradeOrderDO extends BaseDO {
|
||||
private Integer payPrice;
|
||||
|
||||
// ========== 收件 + 物流基本信息 ==========
|
||||
/**
|
||||
* 配送方式
|
||||
*
|
||||
* 枚举 {@link DeliveryTypeEnum}
|
||||
*/
|
||||
private Integer deliveryType;
|
||||
/**
|
||||
* 配置模板的编号
|
||||
*
|
||||
@ -212,10 +227,6 @@ public class TradeOrderDO extends BaseDO {
|
||||
* 收件人地区编号
|
||||
*/
|
||||
private Integer receiverAreaId;
|
||||
/**
|
||||
* 收件人邮编
|
||||
*/
|
||||
private Integer receiverPostCode;
|
||||
/**
|
||||
* 收件人详细地址
|
||||
*/
|
||||
@ -223,11 +234,11 @@ public class TradeOrderDO extends BaseDO {
|
||||
|
||||
// ========== 售后基本信息 ==========
|
||||
/**
|
||||
* 收货状态
|
||||
* 售后状态
|
||||
*
|
||||
* 枚举 {@link TradeOrderAfterSaleStatusEnum}
|
||||
* 枚举 {@link TradeOrderRefundStatusEnum}
|
||||
*/
|
||||
private Integer afterSaleStatus;
|
||||
private Integer refundStatus;
|
||||
/**
|
||||
* 退款金额,单位:分
|
||||
*
|
||||
|
@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order;
|
||||
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.aftersale.TradeAfterSaleDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.cart.TradeCartDO;
|
||||
import cn.iocoder.yudao.module.trade.enums.order.TradeOrderItemAfterSaleStatusEnum;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
@ -42,6 +43,12 @@ public class TradeOrderItemDO extends BaseDO {
|
||||
* 关联 {@link TradeOrderDO#getId()}
|
||||
*/
|
||||
private Long orderId;
|
||||
/**
|
||||
* 购物车项编号
|
||||
*
|
||||
* 关联 {@link TradeCartDO#getId()}
|
||||
*/
|
||||
private Long cartId;
|
||||
|
||||
// ========== 商品基本信息; 冗余较多字段,减少关联查询 ==========
|
||||
/**
|
||||
@ -77,29 +84,23 @@ public class TradeOrderItemDO extends BaseDO {
|
||||
* 购买数量
|
||||
*/
|
||||
private Integer count;
|
||||
// /**
|
||||
// * 是否评论 TODO
|
||||
// *
|
||||
// * false - 未评论
|
||||
// * true - 已评论
|
||||
// */
|
||||
// private Boolean commented;
|
||||
/**
|
||||
* 是否评价
|
||||
*
|
||||
* true - 已评价
|
||||
* false - 未评价
|
||||
*/
|
||||
private Boolean commentStatus;
|
||||
|
||||
// ========== 价格 + 支付基本信息 ==========
|
||||
|
||||
/**
|
||||
* 商品原价(总),单位:分
|
||||
*
|
||||
* = {@link #originalUnitPrice} * {@link #getCount()}
|
||||
*/
|
||||
private Integer originalPrice;
|
||||
/**
|
||||
* 商品原价(单),单位:分
|
||||
*
|
||||
* 对应 ProductSkuDO 的 price 字段
|
||||
* 对应 taobao 的 order.price 字段
|
||||
*/
|
||||
private Integer originalUnitPrice;
|
||||
private Integer price;
|
||||
/**
|
||||
* 商品优惠(总),单位:分
|
||||
*
|
||||
@ -109,9 +110,9 @@ public class TradeOrderItemDO extends BaseDO {
|
||||
*/
|
||||
private Integer discountPrice;
|
||||
/**
|
||||
* 子订单实付金额,不算主订单分摊金额,单位:分
|
||||
* 子订单实付金额(总),不算主订单分摊金额,单位:分
|
||||
*
|
||||
* = {@link #originalPrice}
|
||||
* = {@link #price} * {@link #count}
|
||||
* - {@link #discountPrice}
|
||||
*
|
||||
* 对应 taobao 的 order.payment 字段
|
||||
|
@ -0,0 +1,43 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.mysql.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressExportReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DeliveryExpressMapper extends BaseMapperX<DeliveryExpressDO> {
|
||||
|
||||
default PageResult<DeliveryExpressDO> selectPage(DeliveryExpressPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DeliveryExpressDO>()
|
||||
.likeIfPresent(DeliveryExpressDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(DeliveryExpressDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DeliveryExpressDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(DeliveryExpressDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByAsc(DeliveryExpressDO::getSort));
|
||||
}
|
||||
|
||||
default List<DeliveryExpressDO> selectList(DeliveryExpressExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<DeliveryExpressDO>()
|
||||
.likeIfPresent(DeliveryExpressDO::getCode, reqVO.getCode())
|
||||
.likeIfPresent(DeliveryExpressDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DeliveryExpressDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(DeliveryExpressDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByAsc(DeliveryExpressDO::getSort));
|
||||
}
|
||||
|
||||
default DeliveryExpressDO selectByCode(String code) {
|
||||
return selectOne(new LambdaQueryWrapper<DeliveryExpressDO>()
|
||||
.eq(DeliveryExpressDO::getCode, code));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.mysql.delivery;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateChargeDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DeliveryExpressTemplateChargeMapper extends BaseMapperX<DeliveryExpressTemplateChargeDO> {
|
||||
|
||||
@Repository
|
||||
class BatchInsertMapper extends ServiceImpl<DeliveryExpressTemplateChargeMapper, DeliveryExpressTemplateChargeDO> {
|
||||
}
|
||||
|
||||
default List<DeliveryExpressTemplateChargeDO> selectListByTemplateId(Long templateId){
|
||||
return selectList(new LambdaQueryWrapper<DeliveryExpressTemplateChargeDO>()
|
||||
.eq(DeliveryExpressTemplateChargeDO::getTemplateId, templateId));
|
||||
}
|
||||
|
||||
default int deleteByTemplateId(Long templateId){
|
||||
return delete(new LambdaQueryWrapper<DeliveryExpressTemplateChargeDO>()
|
||||
.eq(DeliveryExpressTemplateChargeDO::getTemplateId, templateId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.mysql.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateChargeDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateFreeDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DeliveryExpressTemplateFreeMapper extends BaseMapperX<DeliveryExpressTemplateFreeDO> {
|
||||
|
||||
@Repository
|
||||
class BatchInsertMapper extends ServiceImpl<DeliveryExpressTemplateFreeMapper, DeliveryExpressTemplateFreeDO> {
|
||||
}
|
||||
|
||||
default List<DeliveryExpressTemplateFreeDO> selectListByTemplateId(Long templateId) {
|
||||
return selectList(new LambdaQueryWrapper<DeliveryExpressTemplateFreeDO>()
|
||||
.eq(DeliveryExpressTemplateFreeDO::getTemplateId, templateId));
|
||||
}
|
||||
|
||||
default int deleteByTemplateId(Long templateId) {
|
||||
return delete(new LambdaQueryWrapper<DeliveryExpressTemplateFreeDO>()
|
||||
.eq(DeliveryExpressTemplateFreeDO::getTemplateId, templateId));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,40 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.mysql.delivery;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressTemplateExportReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressTemplatePageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateDO;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface DeliveryExpressTemplateMapper extends BaseMapperX<DeliveryExpressTemplateDO> {
|
||||
|
||||
default PageResult<DeliveryExpressTemplateDO> selectPage(DeliveryExpressTemplatePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<DeliveryExpressTemplateDO>()
|
||||
.likeIfPresent(DeliveryExpressTemplateDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DeliveryExpressTemplateDO::getChargeMode, reqVO.getChargeMode())
|
||||
.betweenIfPresent(DeliveryExpressTemplateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByAsc(DeliveryExpressTemplateDO::getSort));
|
||||
}
|
||||
|
||||
default List<DeliveryExpressTemplateDO> selectList(DeliveryExpressTemplateExportReqVO reqVO) {
|
||||
return selectList(new LambdaQueryWrapperX<DeliveryExpressTemplateDO>()
|
||||
.likeIfPresent(DeliveryExpressTemplateDO::getName, reqVO.getName())
|
||||
.eqIfPresent(DeliveryExpressTemplateDO::getChargeMode, reqVO.getChargeMode())
|
||||
.betweenIfPresent(DeliveryExpressTemplateDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByAsc(DeliveryExpressTemplateDO::getSort));
|
||||
}
|
||||
|
||||
default DeliveryExpressTemplateDO selectByName(String name) {
|
||||
return selectOne(new LambdaQueryWrapper<DeliveryExpressTemplateDO>()
|
||||
.eq(DeliveryExpressTemplateDO::getName, name));
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.mysql.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DeliveryPickUpStoreMapper extends BaseMapperX<DeliveryPickUpStoreDO> {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,14 @@
|
||||
package cn.iocoder.yudao.module.trade.dal.mysql.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryPickUpStoreStaffDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface DeliveryPickUpStoreStaffMapper extends BaseMapperX<DeliveryPickUpStoreStaffDO> {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -40,7 +40,14 @@ public interface TradeOrderMapper extends BaseMapperX<TradeOrderDO> {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<TradeOrderDO>()
|
||||
.eq(TradeOrderDO::getUserId, userId)
|
||||
.eqIfPresent(TradeOrderDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(TradeOrderDO::getCommentStatus, reqVO.getCommentStatus())
|
||||
.orderByDesc(TradeOrderDO::getId)); // TODO 芋艿:未来不同的 status,不同的排序
|
||||
}
|
||||
|
||||
default Long selectCountByUserIdAndStatus(Long userId, Integer status, Boolean commentStatus) {
|
||||
return selectCount(new LambdaQueryWrapperX<TradeOrderDO>()
|
||||
.eq(TradeOrderDO::getUserId, userId)
|
||||
.eqIfPresent(TradeOrderDO::getStatus, status)
|
||||
.eqIfPresent(TradeOrderDO::getCommentStatus, commentStatus));
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,74 @@
|
||||
package cn.iocoder.yudao.module.trade.service.delivery;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressExportReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||
|
||||
/**
|
||||
* 快递公司 Service 接口
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
public interface DeliveryExpressService {
|
||||
|
||||
/**
|
||||
* 创建快递公司
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDeliveryExpress(@Valid DeliveryExpressCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新快递公司
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDeliveryExpress(@Valid DeliveryExpressUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除快递公司
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDeliveryExpress(Long id);
|
||||
|
||||
/**
|
||||
* 获得快递公司
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 快递公司
|
||||
*/
|
||||
DeliveryExpressDO getDeliveryExpress(Long id);
|
||||
|
||||
/**
|
||||
* 获得快递公司列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 快递公司列表
|
||||
*/
|
||||
List<DeliveryExpressDO> getDeliveryExpressList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得快递公司分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 快递公司分页
|
||||
*/
|
||||
PageResult<DeliveryExpressDO> getDeliveryExpressPage(DeliveryExpressPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得快递公司列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 快递公司列表
|
||||
*/
|
||||
List<DeliveryExpressDO> getDeliveryExpressList(DeliveryExpressExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package cn.iocoder.yudao.module.trade.service.delivery;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressExportReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.DeliveryExpressUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.convert.delivery.DeliveryExpressConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryExpressMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 快递公司 Service 实现类
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DeliveryExpressServiceImpl implements DeliveryExpressService {
|
||||
|
||||
@Resource
|
||||
private DeliveryExpressMapper deliveryExpressMapper;
|
||||
|
||||
@Override
|
||||
public Long createDeliveryExpress(DeliveryExpressCreateReqVO createReqVO) {
|
||||
//校验编码是否唯一
|
||||
validateExpressCodeUnique(createReqVO.getCode(), null);
|
||||
// 插入
|
||||
DeliveryExpressDO deliveryExpress = DeliveryExpressConvert.INSTANCE.convert(createReqVO);
|
||||
deliveryExpressMapper.insert(deliveryExpress);
|
||||
// 返回
|
||||
return deliveryExpress.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeliveryExpress(DeliveryExpressUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDeliveryExpressExists(updateReqVO.getId());
|
||||
//校验编码是否唯一
|
||||
validateExpressCodeUnique(updateReqVO.getCode(), updateReqVO.getId());
|
||||
// 更新
|
||||
DeliveryExpressDO updateObj = DeliveryExpressConvert.INSTANCE.convert(updateReqVO);
|
||||
deliveryExpressMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeliveryExpress(Long id) {
|
||||
// 校验存在
|
||||
validateDeliveryExpressExists(id);
|
||||
// 删除
|
||||
deliveryExpressMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateExpressCodeUnique(String code, Long id) {
|
||||
DeliveryExpressDO express = deliveryExpressMapper.selectByCode(code);
|
||||
if (express == null) {
|
||||
return;
|
||||
}
|
||||
// 如果 id 为空,说明不用比较是否为相同 id 的快递公司
|
||||
if (id == null) {
|
||||
throw exception(EXPRESS_CODE_DUPLICATE);
|
||||
}
|
||||
if (!express.getId().equals(id)) {
|
||||
throw exception(EXPRESS_CODE_DUPLICATE);
|
||||
}
|
||||
}
|
||||
private void validateDeliveryExpressExists(Long id) {
|
||||
if (deliveryExpressMapper.selectById(id) == null) {
|
||||
throw exception(DELIVERY_EXPRESS_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeliveryExpressDO getDeliveryExpress(Long id) {
|
||||
return deliveryExpressMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeliveryExpressDO> getDeliveryExpressList(Collection<Long> ids) {
|
||||
return deliveryExpressMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DeliveryExpressDO> getDeliveryExpressPage(DeliveryExpressPageReqVO pageReqVO) {
|
||||
return deliveryExpressMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeliveryExpressDO> getDeliveryExpressList(DeliveryExpressExportReqVO exportReqVO) {
|
||||
return deliveryExpressMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.trade.service.delivery;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.*;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateDO;
|
||||
|
||||
/**
|
||||
* 快递运费模板 Service 接口
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
public interface DeliveryExpressTemplateService {
|
||||
|
||||
/**
|
||||
* 创建快递运费模板
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createDeliveryExpressTemplate(@Valid DeliveryExpressTemplateCreateReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新快递运费模板
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateDeliveryExpressTemplate(@Valid DeliveryExpressTemplateUpdateReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除快递运费模板
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteDeliveryExpressTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 获得快递运费模板
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 快递运费模板详情
|
||||
*/
|
||||
DeliveryExpressTemplateRespVO getDeliveryExpressTemplate(Long id);
|
||||
|
||||
/**
|
||||
* 获得快递运费模板列表
|
||||
*
|
||||
* @param ids 编号
|
||||
* @return 快递运费模板列表
|
||||
*/
|
||||
List<DeliveryExpressTemplateDO> getDeliveryExpressTemplateList(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得快递运费模板分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 快递运费模板分页
|
||||
*/
|
||||
PageResult<DeliveryExpressTemplateDO> getDeliveryExpressTemplatePage(DeliveryExpressTemplatePageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 获得快递运费模板列表, 用于 Excel 导出
|
||||
*
|
||||
* @param exportReqVO 查询条件
|
||||
* @return 快递运费模板列表
|
||||
*/
|
||||
List<DeliveryExpressTemplateDO> getDeliveryExpressTemplateList(DeliveryExpressTemplateExportReqVO exportReqVO);
|
||||
|
||||
}
|
@ -0,0 +1,212 @@
|
||||
package cn.iocoder.yudao.module.trade.service.delivery;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.delivery.vo.*;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateChargeDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.delivery.DeliveryExpressTemplateFreeDO;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryExpressTemplateChargeMapper;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryExpressTemplateFreeMapper;
|
||||
import cn.iocoder.yudao.module.trade.dal.mysql.delivery.DeliveryExpressTemplateMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.trade.convert.delivery.DeliveryExpressTemplateConvert.INSTANCE;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 快递运费模板 Service 实现类
|
||||
*
|
||||
* @author jason
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class DeliveryExpressTemplateServiceImpl implements DeliveryExpressTemplateService {
|
||||
|
||||
@Resource
|
||||
private DeliveryExpressTemplateMapper expressTemplateMapper;
|
||||
@Resource
|
||||
private DeliveryExpressTemplateChargeMapper expressTemplateChargeMapper;
|
||||
@Resource
|
||||
private DeliveryExpressTemplateFreeMapper expressTemplateFreeMapper;
|
||||
@Resource
|
||||
private DeliveryExpressTemplateChargeMapper.BatchInsertMapper expressTemplateChargeBatchMapper;
|
||||
@Resource
|
||||
private DeliveryExpressTemplateFreeMapper.BatchInsertMapper expressTemplateFreeBatchMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createDeliveryExpressTemplate(DeliveryExpressTemplateCreateReqVO createReqVO) {
|
||||
//校验模板名是否唯一
|
||||
validateTemplateNameUnique(createReqVO.getName(), null);
|
||||
// 插入
|
||||
DeliveryExpressTemplateDO deliveryExpressTemplate = INSTANCE.convert(createReqVO);
|
||||
expressTemplateMapper.insert(deliveryExpressTemplate);
|
||||
//插入运费模板计费表
|
||||
if(CollUtil.isNotEmpty(createReqVO.getTemplateCharge())) {
|
||||
expressTemplateChargeBatchMapper.saveBatch(
|
||||
INSTANCE.convertTemplateChargeList(deliveryExpressTemplate.getId(), createReqVO.getChargeMode(), createReqVO.getTemplateCharge())
|
||||
);
|
||||
}
|
||||
//插入运费模板包邮表
|
||||
if(CollUtil.isNotEmpty(createReqVO.getTemplateFree())) {
|
||||
expressTemplateFreeBatchMapper.saveBatch(
|
||||
INSTANCE.convertTemplateFreeList(deliveryExpressTemplate.getId(), createReqVO.getTemplateFree())
|
||||
);
|
||||
}
|
||||
return deliveryExpressTemplate.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void updateDeliveryExpressTemplate(DeliveryExpressTemplateUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateDeliveryExpressTemplateExists(updateReqVO.getId());
|
||||
//校验模板名是否唯一
|
||||
validateTemplateNameUnique(updateReqVO.getName(), updateReqVO.getId());
|
||||
|
||||
//更新运费从表
|
||||
updateExpressTemplateCharge(updateReqVO);
|
||||
//更新包邮从表
|
||||
updateExpressTemplateFree(updateReqVO);
|
||||
//更新模板主表
|
||||
DeliveryExpressTemplateDO updateObj = INSTANCE.convert(updateReqVO);
|
||||
expressTemplateMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
private void updateExpressTemplateFree(DeliveryExpressTemplateUpdateReqVO updateReqVO) {
|
||||
List<DeliveryExpressTemplateFreeDO> oldFreeList = expressTemplateFreeMapper.selectListByTemplateId(updateReqVO.getId());
|
||||
List<ExpressTemplateFreeUpdateVO> newFreeList = updateReqVO.getTemplateFree();
|
||||
//新增包邮区域列表
|
||||
List<DeliveryExpressTemplateFreeDO> addFreeList = new ArrayList<>(newFreeList.size());
|
||||
//更新包邮区域列表
|
||||
List<DeliveryExpressTemplateFreeDO> updateFreeList = new ArrayList<>(newFreeList.size());
|
||||
for (ExpressTemplateFreeUpdateVO item : newFreeList) {
|
||||
if (Objects.nonNull(item.getId())) {
|
||||
updateFreeList.add(INSTANCE.convertTemplateFree(item));
|
||||
}else{
|
||||
item.setTemplateId(updateReqVO.getId());
|
||||
addFreeList.add(INSTANCE.convertTemplateFree(item));
|
||||
}
|
||||
}
|
||||
//删除的包邮区域id
|
||||
Set<Long> deleteFreeIds = CollectionUtils.convertSet(oldFreeList, DeliveryExpressTemplateFreeDO::getId);
|
||||
deleteFreeIds.removeAll(CollectionUtils.convertSet(updateFreeList, DeliveryExpressTemplateFreeDO::getId));
|
||||
//新增
|
||||
if (CollUtil.isNotEmpty(addFreeList)) {
|
||||
expressTemplateFreeBatchMapper.saveBatch(addFreeList);
|
||||
}
|
||||
//修改
|
||||
if (CollUtil.isNotEmpty(updateFreeList)) {
|
||||
expressTemplateFreeBatchMapper.saveOrUpdateBatch(updateFreeList);
|
||||
}
|
||||
//删除
|
||||
if (CollUtil.isNotEmpty(deleteFreeIds)) {
|
||||
expressTemplateFreeMapper.deleteBatchIds(deleteFreeIds);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateExpressTemplateCharge(DeliveryExpressTemplateUpdateReqVO updateReqVO) {
|
||||
List<DeliveryExpressTemplateChargeDO> oldChargeList = expressTemplateChargeMapper.selectListByTemplateId(updateReqVO.getId());
|
||||
List<ExpressTemplateChargeUpdateVO> newChargeList = updateReqVO.getTemplateCharge();
|
||||
//新增运费区域列表
|
||||
List<DeliveryExpressTemplateChargeDO> addList = new ArrayList<>(newChargeList.size());
|
||||
//更新运费区域列表
|
||||
List<DeliveryExpressTemplateChargeDO> updateList = new ArrayList<>(newChargeList.size());
|
||||
for (ExpressTemplateChargeUpdateVO item : newChargeList) {
|
||||
if (Objects.nonNull(item.getId())) {
|
||||
//计费模式以主表为准
|
||||
item.setChargeMode(updateReqVO.getChargeMode());
|
||||
updateList.add(INSTANCE.convertTemplateCharge(item));
|
||||
}else{
|
||||
item.setTemplateId(updateReqVO.getId());
|
||||
item.setChargeMode(updateReqVO.getChargeMode());
|
||||
addList.add(INSTANCE.convertTemplateCharge(item));
|
||||
}
|
||||
}
|
||||
//删除的运费区域id
|
||||
Set<Long> deleteChargeIds = CollectionUtils.convertSet(oldChargeList, DeliveryExpressTemplateChargeDO::getId);
|
||||
deleteChargeIds.removeAll(CollectionUtils.convertSet(updateList, DeliveryExpressTemplateChargeDO::getId));
|
||||
//新增
|
||||
if (CollUtil.isNotEmpty(addList)) {
|
||||
expressTemplateChargeBatchMapper.saveBatch(addList);
|
||||
}
|
||||
//修改
|
||||
if (CollUtil.isNotEmpty(updateList)) {
|
||||
expressTemplateChargeBatchMapper.saveOrUpdateBatch(updateList);
|
||||
}
|
||||
//删除
|
||||
if (CollUtil.isNotEmpty(deleteChargeIds)) {
|
||||
expressTemplateChargeMapper.deleteBatchIds(deleteChargeIds);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteDeliveryExpressTemplate(Long id) {
|
||||
// 校验存在
|
||||
validateDeliveryExpressTemplateExists(id);
|
||||
// 删除主表
|
||||
expressTemplateMapper.deleteById(id);
|
||||
// 删除运费从表
|
||||
expressTemplateChargeMapper.deleteByTemplateId(id);
|
||||
// 删除包邮从表
|
||||
expressTemplateFreeMapper.deleteByTemplateId(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验运费模板名是否唯一
|
||||
* @param name 模板名称
|
||||
* @param id 运费模板编号, 可以为null
|
||||
*/
|
||||
private void validateTemplateNameUnique(String name, Long id) {
|
||||
DeliveryExpressTemplateDO template = expressTemplateMapper.selectByName(name);
|
||||
if (template == null) {
|
||||
return;
|
||||
}
|
||||
// 如果 id 为空
|
||||
if (id == null) {
|
||||
throw exception(EXPRESS_TEMPLATE_NAME_DUPLICATE);
|
||||
}
|
||||
if (!template.getId().equals(id)) {
|
||||
throw exception(EXPRESS_TEMPLATE_NAME_DUPLICATE);
|
||||
}
|
||||
}
|
||||
|
||||
private void validateDeliveryExpressTemplateExists(Long id) {
|
||||
if (expressTemplateMapper.selectById(id) == null) {
|
||||
throw exception(EXPRESS_TEMPLATE_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeliveryExpressTemplateRespVO getDeliveryExpressTemplate(Long id) {
|
||||
List<DeliveryExpressTemplateChargeDO> chargeList = expressTemplateChargeMapper.selectListByTemplateId(id);
|
||||
List<DeliveryExpressTemplateFreeDO> freeList = expressTemplateFreeMapper.selectListByTemplateId(id);
|
||||
DeliveryExpressTemplateDO template = expressTemplateMapper.selectById(id);
|
||||
return INSTANCE.convert(template, chargeList,freeList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeliveryExpressTemplateDO> getDeliveryExpressTemplateList(Collection<Long> ids) {
|
||||
return expressTemplateMapper.selectBatchIds(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<DeliveryExpressTemplateDO> getDeliveryExpressTemplatePage(DeliveryExpressTemplatePageReqVO pageReqVO) {
|
||||
return expressTemplateMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeliveryExpressTemplateDO> getDeliveryExpressTemplateList(DeliveryExpressTemplateExportReqVO exportReqVO) {
|
||||
return expressTemplateMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
}
|
@ -91,6 +91,16 @@ public interface TradeOrderService {
|
||||
*/
|
||||
PageResult<TradeOrderDO> getOrderPage(Long userId, AppTradeOrderPageReqVO reqVO);
|
||||
|
||||
/**
|
||||
* 【会员】获得交易订单数量
|
||||
*
|
||||
* @param userId 用户编号
|
||||
* @param status 订单状态。如果为空,则不进行筛选
|
||||
* @param commonStatus 评价状态。如果为空,则不进行筛选
|
||||
* @return 订单数量
|
||||
*/
|
||||
Long getOrderCount(Long userId, Integer status, Boolean commonStatus);
|
||||
|
||||
// =================== Order Item ===================
|
||||
|
||||
/**
|
||||
|
@ -30,7 +30,6 @@ import cn.iocoder.yudao.module.promotion.api.price.dto.PriceCalculateRespDTO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderDeliveryReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.admin.order.vo.TradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderCreateReqVO.Item;
|
||||
import cn.iocoder.yudao.module.trade.controller.app.order.vo.AppTradeOrderPageReqVO;
|
||||
import cn.iocoder.yudao.module.trade.convert.order.TradeOrderConvert;
|
||||
import cn.iocoder.yudao.module.trade.dal.dataobject.order.TradeOrderDO;
|
||||
@ -49,7 +48,8 @@ import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet;
|
||||
import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.getSumValue;
|
||||
import static cn.iocoder.yudao.module.pay.enums.ErrorCodeConstants.PAY_ORDER_NOT_FOUND;
|
||||
import static cn.iocoder.yudao.module.trade.enums.ErrorCodeConstants.*;
|
||||
|
||||
@ -92,7 +92,8 @@ public class TradeOrderServiceImpl implements TradeOrderService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createOrder(Long userId, String userIp, AppTradeOrderCreateReqVO createReqVO) {
|
||||
// 商品 SKU 检查:可售状态、库存
|
||||
List<ProductSkuRespDTO> skus = validateSkuSaleable(createReqVO.getItems());
|
||||
// List<ProductSkuRespDTO> skus = validateSkuSaleable(createReqVO.getItems()); // TODO 芋艿,临时关闭。
|
||||
List<ProductSkuRespDTO> skus = null;
|
||||
// 商品 SPU 检查:可售状态
|
||||
List<ProductSpuRespDTO> spus = validateSpuSaleable(convertSet(skus, ProductSkuRespDTO::getSpuId));
|
||||
// 用户收件地址的校验
|
||||
@ -112,28 +113,28 @@ public class TradeOrderServiceImpl implements TradeOrderService {
|
||||
return tradeOrderDO.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验商品 SKU 是否可出售
|
||||
*
|
||||
* @param items 商品 SKU
|
||||
* @return 商品 SKU 数组
|
||||
*/
|
||||
private List<ProductSkuRespDTO> validateSkuSaleable(List<Item> items) {
|
||||
List<ProductSkuRespDTO> skus = productSkuApi.getSkuList(convertSet(items, Item::getSkuId));
|
||||
// SKU 不存在
|
||||
if (items.size() != skus.size()) {
|
||||
throw exception(ORDER_CREATE_SKU_NOT_FOUND);
|
||||
}
|
||||
// 校验库存不足
|
||||
Map<Long, ProductSkuRespDTO> skuMap = convertMap(skus, ProductSkuRespDTO::getId);
|
||||
items.forEach(item -> {
|
||||
ProductSkuRespDTO sku = skuMap.get(item.getSkuId());
|
||||
if (item.getCount() > sku.getStock()) {
|
||||
throw exception(ErrorCodeConstants.ORDER_CREATE_SKU_STOCK_NOT_ENOUGH);
|
||||
}
|
||||
});
|
||||
return skus;
|
||||
}
|
||||
// /**
|
||||
// * 校验商品 SKU 是否可出售
|
||||
// *
|
||||
// * @param items 商品 SKU
|
||||
// * @return 商品 SKU 数组
|
||||
// */
|
||||
// private List<ProductSkuRespDTO> validateSkuSaleable(List<Item> items) {
|
||||
// List<ProductSkuRespDTO> skus = productSkuApi.getSkuList(convertSet(items, Item::getSkuId));
|
||||
// // SKU 不存在
|
||||
// if (items.size() != skus.size()) {
|
||||
// throw exception(ORDER_CREATE_SKU_NOT_FOUND);
|
||||
// }
|
||||
// // 校验库存不足
|
||||
// Map<Long, ProductSkuRespDTO> skuMap = convertMap(skus, ProductSkuRespDTO::getId);
|
||||
// items.forEach(item -> {
|
||||
// ProductSkuRespDTO sku = skuMap.get(item.getSkuId());
|
||||
// if (item.getCount() > sku.getStock()) {
|
||||
// throw exception(ErrorCodeConstants.ORDER_CREATE_SKU_STOCK_NOT_ENOUGH);
|
||||
// }
|
||||
// });
|
||||
// return skus;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 校验商品 SPU 是否可出售
|
||||
@ -177,12 +178,12 @@ public class TradeOrderServiceImpl implements TradeOrderService {
|
||||
tradeOrderDO.setNo(IdUtil.getSnowflakeNextId() + ""); // TODO @LeeYan9: 思考下, 怎么生成好点哈; 这个是会展示给用户的;
|
||||
tradeOrderDO.setStatus(TradeOrderStatusEnum.UNPAID.getStatus());
|
||||
tradeOrderDO.setType(TradeOrderTypeEnum.NORMAL.getType());
|
||||
tradeOrderDO.setAfterSaleStatus(TradeOrderAfterSaleStatusEnum.NONE.getStatus());
|
||||
tradeOrderDO.setRefundStatus(TradeOrderRefundStatusEnum.NONE.getStatus());
|
||||
tradeOrderDO.setProductCount(getSumValue(order.getItems(), PriceCalculateRespDTO.OrderItem::getCount, Integer::sum));
|
||||
tradeOrderDO.setTerminal(TerminalEnum.H5.getTerminal()); // todo 数据来源?
|
||||
tradeOrderDO.setAdjustPrice(0).setPayed(false); // 支付信息
|
||||
tradeOrderDO.setDeliveryStatus(TradeOrderDeliveryStatusEnum.UNDELIVERED.getStatus()); // 物流信息
|
||||
tradeOrderDO.setAfterSaleStatus(TradeOrderAfterSaleStatusEnum.NONE.getStatus()).setRefundPrice(0); // 退款信息
|
||||
tradeOrderDO.setRefundStatus(TradeOrderRefundStatusEnum.NONE.getStatus()).setRefundPrice(0); // 退款信息
|
||||
tradeOrderMapper.insert(tradeOrderDO);
|
||||
return tradeOrderDO;
|
||||
}
|
||||
@ -450,6 +451,11 @@ public class TradeOrderServiceImpl implements TradeOrderService {
|
||||
return tradeOrderMapper.selectPage(reqVO, userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long getOrderCount(Long userId, Integer status, Boolean commentStatus) {
|
||||
return tradeOrderMapper.selectCountByUserIdAndStatus(userId, status, commentStatus);
|
||||
}
|
||||
|
||||
// =================== Order Item ===================
|
||||
|
||||
@Override
|
||||
@ -485,7 +491,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
|
||||
Integer orderRefundPrice = order.getRefundPrice() + refundPrice;
|
||||
if (isAllOrderItemAfterSaleSuccess(order.getId())) { // 如果都售后成功,则需要取消订单
|
||||
tradeOrderMapper.updateById(new TradeOrderDO().setId(order.getId())
|
||||
.setAfterSaleStatus(TradeOrderAfterSaleStatusEnum.ALL.getStatus()).setRefundPrice(orderRefundPrice)
|
||||
.setRefundStatus(TradeOrderRefundStatusEnum.ALL.getStatus()).setRefundPrice(orderRefundPrice)
|
||||
.setCancelType(TradeOrderCancelTypeEnum.AFTER_SALE_CLOSE.getType()).setCancelTime(LocalDateTime.now()));
|
||||
|
||||
// TODO 芋艿:记录订单日志
|
||||
@ -493,7 +499,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
|
||||
// TODO 芋艿:站内信?
|
||||
} else { // 如果部分售后,则更新退款金额
|
||||
tradeOrderMapper.updateById(new TradeOrderDO().setId(order.getId())
|
||||
.setAfterSaleStatus(TradeOrderAfterSaleStatusEnum.PART.getStatus()).setRefundPrice(orderRefundPrice));
|
||||
.setRefundStatus(TradeOrderRefundStatusEnum.PART.getStatus()).setRefundPrice(orderRefundPrice));
|
||||
}
|
||||
|
||||
// TODO 芋艿:未来如果有分佣,需要更新相关分佣订单为已失效
|
||||
@ -506,6 +512,9 @@ public class TradeOrderServiceImpl implements TradeOrderService {
|
||||
|
||||
@Override
|
||||
public List<TradeOrderItemDO> getOrderItemListByOrderId(Collection<Long> orderIds) {
|
||||
if (CollUtil.isEmpty(orderIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
return tradeOrderItemMapper.selectListByOrderId(orderIds);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.trade.service.order;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
|
||||
import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
|
||||
import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
|
||||
import cn.iocoder.yudao.module.member.api.address.AddressApi;
|
||||
@ -93,10 +92,12 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
||||
// 准备参数
|
||||
Long userId = 100L;
|
||||
String userIp = "127.0.0.1";
|
||||
AppTradeOrderCreateReqVO reqVO = new AppTradeOrderCreateReqVO()
|
||||
.setAddressId(10L).setCouponId(101L).setRemark("我是备注").setFromCart(true)
|
||||
.setItems(Arrays.asList(new AppTradeOrderCreateReqVO.Item().setSkuId(1L).setCount(3),
|
||||
new AppTradeOrderCreateReqVO.Item().setSkuId(2L).setCount(4)));
|
||||
// AppTradeOrderCreateReqVO reqVO = new AppTradeOrderCreateReqVO()
|
||||
// .setAddressId(10L).setCouponId(101L).setRemark("我是备注").setFromCart(true)
|
||||
// .setItems(Arrays.asList(new AppTradeOrderCreateReqVO.Item().setSkuId(1L).setCount(3),
|
||||
// new AppTradeOrderCreateReqVO.Item().setSkuId(2L).setCount(4)));
|
||||
AppTradeOrderCreateReqVO reqVO = null;
|
||||
// TODO 芋艿:重新高下
|
||||
// mock 方法(商品 SKU 检查)
|
||||
ProductSkuRespDTO sku01 = randomPojo(ProductSkuRespDTO.class, o -> o.setId(1L).setSpuId(11L)
|
||||
.setPrice(50).setStock(100)
|
||||
@ -168,7 +169,7 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
||||
assertNull(tradeOrderDO.getRemark());
|
||||
assertFalse(tradeOrderDO.getPayed());
|
||||
assertNull(tradeOrderDO.getPayTime());
|
||||
assertEquals(tradeOrderDO.getOriginalPrice(), 230);
|
||||
assertEquals(tradeOrderDO.getTotalPrice(), 230);
|
||||
assertEquals(tradeOrderDO.getOrderPrice(), 100);
|
||||
assertEquals(tradeOrderDO.getDiscountPrice(), 0);
|
||||
assertEquals(tradeOrderDO.getAdjustPrice(), 0);
|
||||
@ -183,9 +184,8 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
||||
assertEquals(tradeOrderDO.getReceiverName(), "芋艿");
|
||||
assertEquals(tradeOrderDO.getReceiverMobile(), "15601691300");
|
||||
assertEquals(tradeOrderDO.getReceiverAreaId(), 3306);
|
||||
assertEquals(tradeOrderDO.getReceiverPostCode(), 85757);
|
||||
assertEquals(tradeOrderDO.getReceiverDetailAddress(), "土豆村");
|
||||
assertEquals(tradeOrderDO.getAfterSaleStatus(), TradeOrderAfterSaleStatusEnum.NONE.getStatus());
|
||||
assertEquals(tradeOrderDO.getRefundStatus(), TradeOrderRefundStatusEnum.NONE.getStatus());
|
||||
assertEquals(tradeOrderDO.getRefundPrice(), 0);
|
||||
assertEquals(tradeOrderDO.getCouponPrice(), 30);
|
||||
assertEquals(tradeOrderDO.getPointPrice(), 10);
|
||||
@ -204,8 +204,8 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
||||
//assertEquals(tradeOrderItemDO01.getSpuName(), sku01.getSpuName()); TODO 找不到spuName
|
||||
assertEquals(tradeOrderItemDO01.getPicUrl(), sku01.getPicUrl());
|
||||
assertEquals(tradeOrderItemDO01.getCount(), 3);
|
||||
assertEquals(tradeOrderItemDO01.getOriginalPrice(), 150);
|
||||
assertEquals(tradeOrderItemDO01.getOriginalUnitPrice(), 50);
|
||||
// assertEquals(tradeOrderItemDO01.getOriginalPrice(), 150);
|
||||
assertEquals(tradeOrderItemDO01.getPrice(), 50);
|
||||
assertEquals(tradeOrderItemDO01.getDiscountPrice(), 20);
|
||||
assertEquals(tradeOrderItemDO01.getPayPrice(), 130);
|
||||
assertEquals(tradeOrderItemDO01.getOrderPartPrice(), 7);
|
||||
@ -224,8 +224,8 @@ public class TradeOrderServiceTest extends BaseDbUnitTest {
|
||||
//assertEquals(tradeOrderItemDO02.getSpuName(), sku02.getSpuName()); TODO 找不到spuName
|
||||
assertEquals(tradeOrderItemDO02.getPicUrl(), sku02.getPicUrl());
|
||||
assertEquals(tradeOrderItemDO02.getCount(), 4);
|
||||
assertEquals(tradeOrderItemDO02.getOriginalPrice(), 80);
|
||||
assertEquals(tradeOrderItemDO02.getOriginalUnitPrice(), 20);
|
||||
// assertEquals(tradeOrderItemDO02.getOriginalPrice(), 80);
|
||||
assertEquals(tradeOrderItemDO02.getPrice(), 20);
|
||||
assertEquals(tradeOrderItemDO02.getDiscountPrice(), 40);
|
||||
assertEquals(tradeOrderItemDO02.getPayPrice(), 40);
|
||||
assertEquals(tradeOrderItemDO02.getOrderPartPrice(), 15);
|
||||
|
@ -1,10 +1,11 @@
|
||||
package cn.iocoder.yudao.module.member.controller.app.address.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
// TODO 芋艿:example 缺失
|
||||
/**
|
||||
* 用户收件地址 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
@ -24,10 +25,6 @@ public class AppAddressBaseVO {
|
||||
@NotNull(message = "地区编号不能为空")
|
||||
private Long areaId;
|
||||
|
||||
@Schema(description = "邮编", required = true)
|
||||
@NotEmpty(message = "邮编不能为空")
|
||||
private String postCode;
|
||||
|
||||
@Schema(description = "收件详细地址", required = true)
|
||||
@NotNull(message = "收件详细地址不能为空")
|
||||
private String detailAddress;
|
||||
|
@ -40,10 +40,6 @@ public class AddressDO extends BaseDO {
|
||||
* 地区编号
|
||||
*/
|
||||
private Long areaId;
|
||||
/**
|
||||
* 邮编
|
||||
*/
|
||||
private String postCode;
|
||||
/**
|
||||
* 收件详细地址
|
||||
*/
|
||||
|
@ -12,7 +12,7 @@ public interface ErrorCodeConstants {
|
||||
// ========== 公众号账号 1006000000============
|
||||
ErrorCode ACCOUNT_NOT_EXISTS = new ErrorCode(1006000000, "公众号账号不存在");
|
||||
ErrorCode ACCOUNT_GENERATE_QR_CODE_FAIL = new ErrorCode(1006000001, "生成公众号二维码失败,原因:{}");
|
||||
ErrorCode ACCOUNT_CLEAR_QUOTA_FAIL = new ErrorCode(1006000001, "清空公众号的 API 配额失败,原因:{}");
|
||||
ErrorCode ACCOUNT_CLEAR_QUOTA_FAIL = new ErrorCode(1006000002, "清空公众号的 API 配额失败,原因:{}");
|
||||
|
||||
// ========== 公众号统计 1006001000============
|
||||
ErrorCode STATISTICS_GET_USER_SUMMARY_FAIL = new ErrorCode(1006001000, "获取粉丝增减数据失败,原因:{}");
|
||||
@ -23,9 +23,9 @@ public interface ErrorCodeConstants {
|
||||
// ========== 公众号标签 1006002000============
|
||||
ErrorCode TAG_NOT_EXISTS = new ErrorCode(1006002000, "标签不存在");
|
||||
ErrorCode TAG_CREATE_FAIL = new ErrorCode(1006002001, "创建标签失败,原因:{}");
|
||||
ErrorCode TAG_UPDATE_FAIL = new ErrorCode(1006002001, "更新标签失败,原因:{}");
|
||||
ErrorCode TAG_DELETE_FAIL = new ErrorCode(1006002001, "删除标签失败,原因:{}");
|
||||
ErrorCode TAG_GET_FAIL = new ErrorCode(1006002001, "获得标签失败,原因:{}");
|
||||
ErrorCode TAG_UPDATE_FAIL = new ErrorCode(1006002002, "更新标签失败,原因:{}");
|
||||
ErrorCode TAG_DELETE_FAIL = new ErrorCode(1006002003, "删除标签失败,原因:{}");
|
||||
ErrorCode TAG_GET_FAIL = new ErrorCode(1006002004, "获得标签失败,原因:{}");
|
||||
|
||||
// ========== 公众号粉丝 1006003000============
|
||||
ErrorCode USER_NOT_EXISTS = new ErrorCode(1006003000, "粉丝不存在");
|
||||
@ -43,13 +43,13 @@ public interface ErrorCodeConstants {
|
||||
// ========== 公众号发布能力 1006006000============
|
||||
ErrorCode FREE_PUBLISH_LIST_FAIL = new ErrorCode(1006006000, "获得已成功发布列表失败,原因:{}");
|
||||
ErrorCode FREE_PUBLISH_SUBMIT_FAIL = new ErrorCode(1006006001, "提交发布失败,原因:{}");
|
||||
ErrorCode FREE_PUBLISH_DELETE_FAIL = new ErrorCode(1006006001, "删除发布失败,原因:{}");
|
||||
ErrorCode FREE_PUBLISH_DELETE_FAIL = new ErrorCode(1006006002, "删除发布失败,原因:{}");
|
||||
|
||||
// ========== 公众号草稿 1006007000============
|
||||
ErrorCode DRAFT_LIST_FAIL = new ErrorCode(1006007000, "获得草稿列表失败,原因:{}");
|
||||
ErrorCode DRAFT_CREATE_FAIL = new ErrorCode(1006007001, "创建草稿失败,原因:{}");
|
||||
ErrorCode DRAFT_UPDATE_FAIL = new ErrorCode(1006007002, "更新草稿失败,原因:{}");
|
||||
ErrorCode DRAFT_DELETE_FAIL = new ErrorCode(1006007002, "删除草稿失败,原因:{}");
|
||||
ErrorCode DRAFT_DELETE_FAIL = new ErrorCode(1006007003, "删除草稿失败,原因:{}");
|
||||
|
||||
// ========== 公众号菜单 1006008000============
|
||||
ErrorCode MENU_SAVE_FAIL = new ErrorCode(1006008000, "创建菜单失败,原因:{}");
|
||||
|
@ -10,16 +10,12 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
/**
|
||||
* ========== APP 模块 1-007-000-000 ==========
|
||||
*/
|
||||
// ========== APP 模块 1007000000 ==========
|
||||
ErrorCode PAY_APP_NOT_FOUND = new ErrorCode(1007000000, "App 不存在");
|
||||
ErrorCode PAY_APP_IS_DISABLE = new ErrorCode(1007000002, "App 已经被禁用");
|
||||
ErrorCode PAY_APP_EXIST_TRANSACTION_ORDER_CANT_DELETE = new ErrorCode(1007000003, "支付应用存在交易中的订单,无法删除");
|
||||
|
||||
/**
|
||||
* ========== CHANNEL 模块 1-007-001-000 ==========
|
||||
*/
|
||||
// ========== CHANNEL 模块 1007001000 ==========
|
||||
ErrorCode PAY_CHANNEL_NOT_FOUND = new ErrorCode(1007001000, "支付渠道的配置不存在");
|
||||
ErrorCode PAY_CHANNEL_IS_DISABLE = new ErrorCode(1007001001, "支付渠道已经禁用");
|
||||
ErrorCode PAY_CHANNEL_CLIENT_NOT_FOUND = new ErrorCode(1007001002, "支付渠道的客户端不存在");
|
||||
@ -30,44 +26,39 @@ public interface ErrorCodeConstants {
|
||||
ErrorCode CHANNEL_WECHAT_VERSION_3_CERT_KEY_IS_NULL = new ErrorCode(1007001008,"微信渠道v3版本中apiclient_cert.pem不可为空");
|
||||
ErrorCode PAY_CHANNEL_NOTIFY_VERIFY_FAILED = new ErrorCode(1007001009, "渠道通知校验失败");
|
||||
|
||||
// ========== ORDER 模块 1-007-002-000 ==========
|
||||
|
||||
// ========== ORDER 模块 1007002000 ==========
|
||||
ErrorCode PAY_ORDER_NOT_FOUND = new ErrorCode(1007002000, "支付订单不存在");
|
||||
ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1007002001, "支付订单不处于待支付");
|
||||
ErrorCode PAY_ORDER_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007002002, "支付订单不处于已支付");
|
||||
ErrorCode PAY_ORDER_ERROR_USER = new ErrorCode(1007002003, "支付订单用户不正确");
|
||||
|
||||
/**
|
||||
* ========== ORDER 模块(拓展单) 1-007-003-000 ==========
|
||||
*/
|
||||
// ========== ORDER 模块(拓展单) 1007003000 ==========
|
||||
ErrorCode PAY_ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1007003000, "支付交易拓展单不存在");
|
||||
ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING = new ErrorCode(1007003001, "支付交易拓展单不处于待支付");
|
||||
ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_SUCCESS = new ErrorCode(1007003002, "支付订单不处于已支付");
|
||||
|
||||
// ========== 支付模块(退款) 1-007-006-000 ==========
|
||||
// ========== 支付模块(退款) 1007006000 ==========
|
||||
ErrorCode PAY_REFUND_AMOUNT_EXCEED = new ErrorCode(1007006000, "退款金额超过订单可退款金额");
|
||||
ErrorCode PAY_REFUND_ALL_REFUNDED = new ErrorCode(1007006001, "订单已经全额退款");
|
||||
ErrorCode PAY_REFUND_CHN_ORDER_NO_IS_NULL = new ErrorCode(1007006002, "该订单的渠道订单为空");
|
||||
ErrorCode PAY_REFUND_SUCCEED = new ErrorCode(1007006003, "已经退款成功");
|
||||
ErrorCode PAY_REFUND_NOT_FOUND = new ErrorCode(1007006004, "支付退款单不存在");
|
||||
|
||||
/**
|
||||
* ========== 支付商户信息 1-007-004-000 ==========
|
||||
*/
|
||||
// ========== 支付商户信息 1007004000 ==========
|
||||
ErrorCode PAY_MERCHANT_NOT_EXISTS = new ErrorCode(1007004000, "支付商户信息不存在");
|
||||
ErrorCode PAY_MERCHANT_EXIST_APP_CANT_DELETE = new ErrorCode(1007004001, "支付商户存在支付应用,无法删除");
|
||||
|
||||
// ========== 示例订单 1-007-900-000 ==========
|
||||
ErrorCode PAY_DEMO_ORDER_NOT_FOUND = new ErrorCode(100790000, "示例订单不存在");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(100790001, "示例订单更新支付状态失败,订单不是【未支付】状态");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR = new ErrorCode(100790002, "示例订单更新支付状态失败,支付单编号不匹配");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS = new ErrorCode(100790003, "示例订单更新支付状态失败,支付单状态不是【支付成功】状态");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_FAIL_PAY_PRICE_NOT_MATCH = new ErrorCode(100790004, "示例订单更新支付状态失败,支付单金额不匹配");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_NOT_PAID = new ErrorCode(100790005, "发起退款失败,示例订单未支付");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUNDED = new ErrorCode(100790006, "发起退款失败,示例订单已退款");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_NOT_FOUND = new ErrorCode(100790007, "发起退款失败,退款订单不存在");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_NOT_SUCCESS = new ErrorCode(100790008, "发起退款失败,退款订单未退款成功");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(100790008, "发起退款失败,退款单编号不匹配");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(100790004, "发起退款失败,退款单金额不匹配");
|
||||
// ========== 示例订单 1007900000 ==========
|
||||
ErrorCode PAY_DEMO_ORDER_NOT_FOUND = new ErrorCode(1007900000, "示例订单不存在");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(1007900001, "示例订单更新支付状态失败,订单不是【未支付】状态");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR = new ErrorCode(1007900002, "示例订单更新支付状态失败,支付单编号不匹配");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS = new ErrorCode(1007900003, "示例订单更新支付状态失败,支付单状态不是【支付成功】状态");
|
||||
ErrorCode PAY_DEMO_ORDER_UPDATE_PAID_FAIL_PAY_PRICE_NOT_MATCH = new ErrorCode(1007900004, "示例订单更新支付状态失败,支付单金额不匹配");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_NOT_PAID = new ErrorCode(1007900005, "发起退款失败,示例订单未支付");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUNDED = new ErrorCode(1007900006, "发起退款失败,示例订单已退款");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_NOT_FOUND = new ErrorCode(1007900007, "发起退款失败,退款订单不存在");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_NOT_SUCCESS = new ErrorCode(1007900008, "发起退款失败,退款订单未退款成功");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(1007900009, "发起退款失败,退款单编号不匹配");
|
||||
ErrorCode PAY_DEMO_ORDER_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(1007900010, "发起退款失败,退款单金额不匹配");
|
||||
|
||||
}
|
||||
|
@ -55,6 +55,10 @@ public class PayOrderBaseVO {
|
||||
@NotNull(message = "支付金额,单位:分不能为空")
|
||||
private Long amount;
|
||||
|
||||
@Schema(description = "支付金额,单位:分", required = true)
|
||||
@NotNull(message = "支付金额,单位:分不能为空")
|
||||
private Long price;
|
||||
|
||||
@Schema(description = "渠道手续费,单位:百分比")
|
||||
private Double channelFeeRate;
|
||||
|
||||
|
@ -1,19 +1,18 @@
|
||||
package cn.iocoder.yudao.module.pay.controller.app.order;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderRespVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.order.vo.PayOrderSubmitRespVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitReqVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitRespVO;
|
||||
import cn.iocoder.yudao.module.pay.convert.order.PayOrderConvert;
|
||||
import cn.iocoder.yudao.module.pay.service.order.PayOrderService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -28,12 +27,20 @@ import static cn.iocoder.yudao.framework.common.util.servlet.ServletUtils.getCli
|
||||
public class AppPayOrderController {
|
||||
|
||||
@Resource
|
||||
private PayOrderService orderService;
|
||||
private PayOrderService payOrderService;
|
||||
|
||||
// TODO 芋艿:临时 demo,技术打样。
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得支付订单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
public CommonResult<PayOrderRespVO> getOrder(@RequestParam("id") Long id) {
|
||||
return success(PayOrderConvert.INSTANCE.convert(payOrderService.getOrder(id)));
|
||||
}
|
||||
|
||||
@PostMapping("/submit")
|
||||
@Operation(summary = "提交支付订单")
|
||||
public CommonResult<AppPayOrderSubmitRespVO> submitPayOrder(@RequestBody AppPayOrderSubmitReqVO reqVO) {
|
||||
PayOrderSubmitRespVO respVO = orderService.submitPayOrder(reqVO, getClientIP());
|
||||
PayOrderSubmitRespVO respVO = payOrderService.submitPayOrder(reqVO, getClientIP());
|
||||
return success(PayOrderConvert.INSTANCE.convert3(respVO));
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.order.PayOrderUnifiedRespD
|
||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderCreateReqDTO;
|
||||
import cn.iocoder.yudao.module.pay.api.order.dto.PayOrderRespDTO;
|
||||
import cn.iocoder.yudao.module.pay.controller.admin.order.vo.*;
|
||||
import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitReqVO;
|
||||
import cn.iocoder.yudao.module.pay.controller.app.order.vo.AppPayOrderSubmitRespVO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderDO;
|
||||
import cn.iocoder.yudao.module.pay.dal.dataobject.order.PayOrderExtensionDO;
|
||||
@ -28,6 +27,7 @@ public interface PayOrderConvert {
|
||||
|
||||
PayOrderConvert INSTANCE = Mappers.getMapper(PayOrderConvert.class);
|
||||
|
||||
@Mapping(source = "amount", target = "price")
|
||||
PayOrderRespVO convert(PayOrderDO bean);
|
||||
|
||||
PayOrderRespDTO convert2(PayOrderDO order);
|
||||
|
@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
/**
|
||||
* Report 错误码枚举类
|
||||
*
|
||||
* system 系统,使用 1-003-000-000 段
|
||||
* report 系统,使用 1-003-000-000 段
|
||||
*/
|
||||
public interface ErrorCodeConstants {
|
||||
|
||||
|
@ -152,7 +152,7 @@ public interface ErrorCodeConstants {
|
||||
|
||||
// ========== 邮件发送 1002025000 ==========
|
||||
ErrorCode MAIL_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1002025000, "模板参数({})缺失");
|
||||
ErrorCode MAIL_SEND_MAIL_NOT_EXISTS = new ErrorCode(1002025000, "邮箱不存在");
|
||||
ErrorCode MAIL_SEND_MAIL_NOT_EXISTS = new ErrorCode(1002025001, "邮箱不存在");
|
||||
|
||||
// ========== 站内信模版 1002026000 ==========
|
||||
ErrorCode NOTIFY_TEMPLATE_NOT_EXISTS = new ErrorCode(1002026000, "站内信模版不存在");
|
||||
@ -161,6 +161,6 @@ public interface ErrorCodeConstants {
|
||||
// ========== 站内信模版 1002027000 ==========
|
||||
|
||||
// ========== 站内信发送 1002028000 ==========
|
||||
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1002025000, "模板参数({})缺失");
|
||||
ErrorCode NOTIFY_SEND_TEMPLATE_PARAM_MISS = new ErrorCode(1002028000, "模板参数({})缺失");
|
||||
|
||||
}
|
||||
|
@ -6,17 +6,18 @@ import cn.iocoder.yudao.framework.ip.core.Area;
|
||||
import cn.iocoder.yudao.framework.ip.core.utils.AreaUtils;
|
||||
import cn.iocoder.yudao.framework.ip.core.utils.IPUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.ip.vo.AreaNodeRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.ip.vo.LazyAreaNodeRespVO;
|
||||
import cn.iocoder.yudao.module.system.convert.ip.AreaConvert;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@ -34,6 +35,24 @@ public class AreaController {
|
||||
return success(AreaConvert.INSTANCE.convertList(area.getChildren()));
|
||||
}
|
||||
|
||||
@GetMapping("/getChildrenArea")
|
||||
@Operation(summary = "获得地区的下级区域")
|
||||
public CommonResult<List<LazyAreaNodeRespVO>> getChildrenArea(Integer id) {
|
||||
Area area = AreaUtils.getArea(id);
|
||||
Assert.notNull(area, String.format("获取不到 id : %d的区域", id));
|
||||
return success(AreaConvert.INSTANCE.convertList2(area.getChildren()));
|
||||
}
|
||||
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "通过区域ids获得地区列表")
|
||||
public CommonResult<List<LazyAreaNodeRespVO>> list(@RequestBody Set<Integer> areaIds) {
|
||||
List<Area> areaList = new ArrayList<>(areaIds.size());
|
||||
for (Integer areaId : areaIds) {
|
||||
areaList.add(AreaUtils.getArea(areaId));
|
||||
}
|
||||
return success(AreaConvert.INSTANCE.convertList2(areaList));
|
||||
}
|
||||
|
||||
@GetMapping("/get-by-ip")
|
||||
@Operation(summary = "获得 IP 对应的地区名")
|
||||
@Parameter(name = "ip", description = "IP", required = true)
|
||||
|
@ -0,0 +1,21 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.ip.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author jason
|
||||
*/
|
||||
@Schema(description = "管理后台 - 懒加载地区节点 Response VO")
|
||||
@Data
|
||||
public class LazyAreaNodeRespVO {
|
||||
|
||||
@Schema(description = "编号", required = true, example = "110000")
|
||||
private Integer id;
|
||||
|
||||
@Schema(description = "名字", required = true, example = "北京")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "是否叶子节点", required = true, example = "false")
|
||||
private Boolean leaf = Boolean.FALSE;
|
||||
}
|
@ -1,11 +1,17 @@
|
||||
package cn.iocoder.yudao.module.system.convert.ip;
|
||||
|
||||
import cn.iocoder.yudao.framework.ip.core.Area;
|
||||
import cn.iocoder.yudao.framework.ip.core.enums.AreaTypeEnum;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.ip.vo.AreaNodeRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.ip.vo.LazyAreaNodeRespVO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Named;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@Mapper
|
||||
public interface AreaConvert {
|
||||
@ -14,4 +20,12 @@ public interface AreaConvert {
|
||||
|
||||
List<AreaNodeRespVO> convertList(List<Area> list);
|
||||
|
||||
List<LazyAreaNodeRespVO> convertList2(List<Area> list);
|
||||
|
||||
@Mapping(source = "type", target = "leaf")
|
||||
LazyAreaNodeRespVO convert(Area area);
|
||||
|
||||
default Boolean convertAreaType(Integer type){
|
||||
return Objects.equals(AreaTypeEnum.DISTRICT.getType(),type);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user