Compare commits
65 Commits
cde19e180a
...
feature/or
| Author | SHA1 | Date | |
|---|---|---|---|
| 62b78b40be | |||
| 0c051643d5 | |||
| 793a810d65 | |||
| b4f485db09 | |||
| fd5a68c27e | |||
| 6a59e27ebb | |||
| 323cae015f | |||
| 4f9b9c29a3 | |||
|
|
720937581f | ||
|
|
261a8b4797 | ||
| c283800915 | |||
| 483abcfd83 | |||
| 4ebe4f9ac6 | |||
| 90e28f056a | |||
| a5a10898a2 | |||
|
|
00d4e0c3e8 | ||
| 4042fd297d | |||
|
|
0ce1eae772 | ||
|
|
3497962627 | ||
|
|
15e801e426 | ||
|
|
b2e0cca804 | ||
| 22b96b6feb | |||
| fc62fa3167 | |||
| 190e0e1605 | |||
| 3fbb1383fd | |||
| 191eadbf77 | |||
|
|
7fdf546585 | ||
| b6630f3f61 | |||
| f7d4ef8e4c | |||
|
|
ef99dbe035 | ||
| e5f0d57286 | |||
| de062744b4 | |||
| 2943caf779 | |||
| 6ff940777f | |||
| 1cdbf43f29 | |||
| 89c233ca9f | |||
| 5a45668c61 | |||
| 22fc268fcb | |||
| 077fb92772 | |||
| a1c4ae3564 | |||
| 98fc7be679 | |||
| 4ae13cf1e6 | |||
| ab85648edf | |||
| cba541169d | |||
| 53e88feefe | |||
| 562769f9c0 | |||
|
|
73748a6fc0 | ||
| 3f674bd17a | |||
|
|
a6b1cb2ac9 | ||
| 52839e17cc | |||
| 1555739fcd | |||
|
|
ecb8f31850 | ||
|
|
4711bb8cbc | ||
|
|
40f0ecd162 | ||
|
|
27e51b6278 | ||
|
|
eeab4e5ea3 | ||
|
|
a5f992c090 | ||
|
|
a99402c6b0 | ||
| ea780302e3 | |||
|
|
ce643990d8 | ||
|
|
7afa85b941 | ||
|
|
257dc16c94 | ||
|
|
5987f02e4e | ||
|
|
525cf97121 | ||
| 5dc7ab49d5 |
@@ -1,48 +0,0 @@
|
|||||||
---
|
|
||||||
description:
|
|
||||||
globs:
|
|
||||||
alwaysApply: false
|
|
||||||
---
|
|
||||||
---
|
|
||||||
description:
|
|
||||||
globs:
|
|
||||||
alwaysApply: false
|
|
||||||
---
|
|
||||||
|
|
||||||
# Your rule content
|
|
||||||
#角色
|
|
||||||
你是一名精通开发的高级工程师,拥有10年以上的应用开发经验,熟悉*等开发工具和技术栈。
|
|
||||||
你的任务是帮助用户设计和开发易用且易于推护的 *** 应用。始终遵循最佳实践,并坚持干净代码和健壮架构的原则。
|
|
||||||
|
|
||||||
#目标
|
|
||||||
你的目标是以用户容易理解的方式帮助他们完成“应用的设计和开发工作,确保应用功能完善、性能优异、用户体验良好。
|
|
||||||
|
|
||||||
#要求
|
|
||||||
在理解用户需求、设计UI、编写代码、解决问题和项目选代优化时,你应该始终遵循以下原则:
|
|
||||||
|
|
||||||
|
|
||||||
##需求理解
|
|
||||||
-充分理解用户需求,站在用户角度思考,分析需求是否存在缺漏,并与用户讨论完善需求;
|
|
||||||
-选择最简单的解决方案来满足用户需求,避免过度设计。
|
|
||||||
##UI和样式设计
|
|
||||||
-使用现代UI框架进行样式设计(例如***,这里可以根据不同开发项目仔纽展开,比如使用哪些视觉规范或者UI框架,没有的话也可以不用过多展开);
|
|
||||||
-在不同平台上实现一致的设计和响应式模式
|
|
||||||
##代码编写
|
|
||||||
技术选型:根据项目需求选择合适的技术栈(例如***,这里需要仔细展开,比如介招某个技术栈用在什么地方,以及要遵循什么最佳实践)
|
|
||||||
代码结构:强调代码的清晰性、模块化、可维护性,遵循最佳实践(如DRY原则、最小权限原则、响应式设计等)
|
|
||||||
-代码安全性:在编写代码时,始终考虑安全性,避免引入漏洞,确保用户输入的安全处理
|
|
||||||
-性能优化:优化代码的性能,减少资源占用,提升加载速度,确保项目的高效运行
|
|
||||||
-测试与文档:编写单元测试,确保代码的健壮性,并提供清晰的中文注释和文档。方便后续阅读和维护
|
|
||||||
##问题解决
|
|
||||||
-全面阅读相关代码,理解***应用的工作原理
|
|
||||||
-根据用户的反馈分析问题的原因,提出解决问题的思路
|
|
||||||
-确保每次代码变更不会破坏现有功能,且尽可能保持最小的改动
|
|
||||||
##迭代优化
|
|
||||||
与用户保持密切沟通,根据反读调整功能和设计,确保应用符合用户需求
|
|
||||||
在不确定需求时,主动询问用户以澄清需求或技术细节
|
|
||||||
##方法论
|
|
||||||
-系统2思维:以分析严谨的方式解决问题。将需求分解为更小、可管理的部分,并在实施前仔细考虑每一步
|
|
||||||
思维树:评估多种可能的解决方案及其后果。使用结构化的方法探索不同的路径。并选择最优的解决方案
|
|
||||||
-选代改进:在最终确定代码之前,考虑改进、边缘情况和优化。通过潜在增强的迭代,确保最终解决方案是健壮的
|
|
||||||
|
|
||||||
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -31,6 +31,8 @@ target/*
|
|||||||
/.nb-gradle/
|
/.nb-gradle/
|
||||||
/build/
|
/build/
|
||||||
.idea
|
.idea
|
||||||
|
.cursor
|
||||||
|
.lingma
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
**添加规则文件可帮助模型精准理解你的编码偏好,如框架、代码风格等**
|
|
||||||
**规则文件只对当前工程生效,单文件限制10000字符。如果无需将该文件提交到远程 Git 仓库,请将其添加到 .gitignore**
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
16
pom.xml
16
pom.xml
@@ -47,6 +47,22 @@
|
|||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>prod</id>
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<excludes>
|
||||||
|
<exclude>*.yaml</exclude>
|
||||||
|
</excludes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
暂未适配 IBM DB2 数据库,如果你有需要,可以微信联系 wangwenbin-server 一起建设。
|
|
||||||
|
|
||||||
你需要把表结构与数据导入到 DM 数据库,我a来测试与适配代码。
|
|
||||||
113
sql/mysql/ai-manage.sql
Normal file
113
sql/mysql/ai-manage.sql
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
DROP TABLE IF EXISTS `tz_ai_sample`;
|
||||||
|
CREATE TABLE `tz_ai_sample`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`sample_file_id` bigint NOT NULL COMMENT '样本文件id',
|
||||||
|
`sample_name` varchar(64) NULL DEFAULT '' COMMENT '样本名称',
|
||||||
|
`sample_time` varchar(16) NULL DEFAULT '' COMMENT '样本时长',
|
||||||
|
`sample_mine_type` varchar(16) NULL DEFAULT '' COMMENT '样本格式',
|
||||||
|
`sample_size` varchar(16) NULL DEFAULT '' COMMENT '样本大小',
|
||||||
|
`remark` varchar(255) NULL DEFAULT '' COMMENT '样本注释',
|
||||||
|
`creator` varchar(64) NULL DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) 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,
|
||||||
|
INDEX `idx_create_time` (`create_time` ASC) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '样本库';
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_sample_tag_relate`;
|
||||||
|
CREATE TABLE `tz_ai_sample_tag_relate`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`sample_id` bigint NOT NULL COMMENT '样本id',
|
||||||
|
`sample_tag_id` bigint NOT NULL COMMENT '样本标签id',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '样本-标签关联表';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_sample_tag`;
|
||||||
|
CREATE TABLE `tz_ai_sample_tag`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`tag_name` varchar(64) NULL DEFAULT '' COMMENT '标签名称',
|
||||||
|
`creator` varchar(64) NULL DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) 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,
|
||||||
|
INDEX `idx_create_time` (`create_time` ASC) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '样本标签库';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_sample_tag_group`;
|
||||||
|
CREATE TABLE `tz_ai_sample_tag_group`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`group_name` varchar(64) NULL DEFAULT '' COMMENT '分组名称',
|
||||||
|
`creator` varchar(64) NULL DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) 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,
|
||||||
|
INDEX `idx_create_time` (`create_time` ASC) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '样本标签分组库';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_sample_tag_group_relate`;
|
||||||
|
CREATE TABLE `tz_ai_sample_tag_group_relate`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`sample_tag_id` bigint NOT NULL COMMENT '样本标签id',
|
||||||
|
`sample_tag_group_id` bigint NOT NULL COMMENT '样本标签分组id',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT = '样本标签-分组关联表';
|
||||||
|
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_dialog`;
|
||||||
|
CREATE TABLE `tz_ai_dialog`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`title` varchar(128) DEFAULT '' COMMENT '对话标题',
|
||||||
|
`user_id` bigint NOT NULL COMMENT '用户id',
|
||||||
|
`dialog_status` int DEFAULT NULL COMMENT '对话状态(1active, 2archived, 3deleted)',
|
||||||
|
`creator` varchar(64) DEFAULT '' COMMENT '创建者',
|
||||||
|
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||||
|
`updater` varchar(64) 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 ='ai-对话表';
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS `tz_ai_dialog_message`;
|
||||||
|
CREATE TABLE `tz_ai_dialog_message`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
|
||||||
|
`dialog_id` bigint NOT NULL COMMENT '对话id',
|
||||||
|
`content_text` text COMMENT '内容',
|
||||||
|
`content_type` int DEFAULT NULL COMMENT '文本类型(1text,2file)',
|
||||||
|
`message_order` int DEFAULT NULL COMMENT '对话中的顺序',
|
||||||
|
`message_status` int DEFAULT NULL COMMENT '消息状态 1正常 0删除',
|
||||||
|
`pet_id` bigint DEFAULT NULL COMMENT '宠物id',
|
||||||
|
`pet_name` varchar(255) DEFAULT NULL COMMENT '宠物名称',
|
||||||
|
`pet_avatar` varchar(255) DEFAULT NULL COMMENT '宠物头像',
|
||||||
|
`pet_type` varchar(64) DEFAULT NULL COMMENT '宠物类型',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`trans_result` text COMMENT '回答结果',
|
||||||
|
`content_duration` bigint DEFAULT NULL COMMENT '文件时长',
|
||||||
|
`trans_status` int DEFAULT NULL COMMENT '翻译状态(1成功 0失败)',
|
||||||
|
`source_result` text COMMENT '原始结果',
|
||||||
|
`file_name` varchar(255) DEFAULT NULL COMMENT '文件名称',
|
||||||
|
PRIMARY KEY (`id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB COMMENT ='ai-对话消息表';
|
||||||
|
|
||||||
|
|
||||||
338
sql/mysql/order.sql
Normal file
338
sql/mysql/order.sql
Normal file
@@ -0,0 +1,338 @@
|
|||||||
|
-- 基础实体表结构 (BaseDO) 不单独建表,字段会被继承到其他表中
|
||||||
|
CREATE TABLE `tz_trade_order`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '订单编号,主键自增',
|
||||||
|
`order_num` varchar(64) NOT NULL COMMENT '订单流水号',
|
||||||
|
`order_type` tinyint NOT NULL COMMENT '订单类型 (枚举 TradeOrderTypeEnum)',
|
||||||
|
`order_terminal` tinyint NOT NULL COMMENT '订单来源 (枚举 TerminalEnum)',
|
||||||
|
`order_status` tinyint NOT NULL COMMENT '订单状态 (枚举 TradeOrderStatusEnum)',
|
||||||
|
`user_id` bigint NOT NULL COMMENT '用户编号',
|
||||||
|
`user_ip` varchar(64) DEFAULT NULL COMMENT '用户IP',
|
||||||
|
`user_name` varchar(64) DEFAULT NULL COMMENT '用户昵称',
|
||||||
|
`user_mobile` varchar(11) DEFAULT NULL COMMENT '用户手机号',
|
||||||
|
`user_remark` varchar(512) DEFAULT NULL COMMENT '用户备注',
|
||||||
|
`finish_time` datetime DEFAULT NULL COMMENT '订单完成时间',
|
||||||
|
`cancel_time` datetime DEFAULT NULL COMMENT '订单取消时间',
|
||||||
|
`cancel_type` tinyint DEFAULT NULL COMMENT '取消类型 (枚举 TradeOrderCancelTypeEnum)',
|
||||||
|
`cancel_reason` varchar(128) DEFAULT NULL COMMENT '取消原因',
|
||||||
|
`cancel_remark` varchar(255) DEFAULT NULL COMMENT '取消原因备注',
|
||||||
|
`merchant_id` bigint DEFAULT NULL COMMENT '商家编号',
|
||||||
|
`merchant_name` varchar(64) DEFAULT NULL COMMENT '商家名称',
|
||||||
|
`merchant_remark` varchar(512) DEFAULT NULL COMMENT '商家备注',
|
||||||
|
`comment_status` tinyint(1) DEFAULT NULL COMMENT '是否评价 (true-已评价, false-未评价)',
|
||||||
|
`expense_price` int DEFAULT NULL COMMENT '商品成本(单),单位:分',
|
||||||
|
`price` int DEFAULT NULL COMMENT '商品原价(单),单位:分',
|
||||||
|
`discount_price` int DEFAULT NULL COMMENT '优惠金额(总),单位:分',
|
||||||
|
`delivery_price` int DEFAULT NULL COMMENT '运费金额(总),单位:分',
|
||||||
|
`adjust_price` int DEFAULT NULL COMMENT '订单调价(总),单位:分',
|
||||||
|
`pay_price` int DEFAULT NULL COMMENT '应付金额(总),单位:分',
|
||||||
|
`live_price` int DEFAULT NULL COMMENT '实收金额(总),单位:分',
|
||||||
|
`pay_order_id` bigint DEFAULT NULL COMMENT '支付订单编号',
|
||||||
|
`pay_status` tinyint(1) DEFAULT NULL COMMENT '是否已支付 (true-已支付, false-未支付)',
|
||||||
|
`pay_type` tinyint DEFAULT NULL COMMENT '支付方式(PayTypeEnum)',
|
||||||
|
`pay_time` datetime DEFAULT NULL COMMENT '付款时间',
|
||||||
|
`pay_channel_code` tinyint DEFAULT NULL COMMENT '支付渠道(PayTypeEnum)',
|
||||||
|
`delivery_type` tinyint DEFAULT NULL COMMENT '配送方式 (枚举 DeliveryTypeEnum)',
|
||||||
|
`logistics_id` bigint DEFAULT '0' COMMENT '发货物流公司编号',
|
||||||
|
`logistics_no` varchar(64) DEFAULT '' COMMENT '发货物流单号',
|
||||||
|
`delivery_time` datetime DEFAULT NULL COMMENT '发货时间',
|
||||||
|
`receive_time` datetime DEFAULT NULL COMMENT '收货时间',
|
||||||
|
`receiver_name` varchar(64) DEFAULT NULL COMMENT '收件人名称',
|
||||||
|
`receiver_mobile` varchar(20) DEFAULT NULL COMMENT '收件人手机',
|
||||||
|
`receiver_area_id` int DEFAULT NULL COMMENT '收件人地区编号',
|
||||||
|
`receiver_detail_address` varchar(512) DEFAULT NULL COMMENT '收件人详细地址',
|
||||||
|
`pick_up_store_id` bigint DEFAULT NULL COMMENT '自提门店编号',
|
||||||
|
`pick_up_verify_code` varchar(64) DEFAULT NULL COMMENT '自提核销码',
|
||||||
|
`refund_status` tinyint DEFAULT NULL COMMENT '退款状态 (枚举 TradeOrderRefundStatusEnum)',
|
||||||
|
`refund_price` int DEFAULT NULL COMMENT '退款金额,单位:分',
|
||||||
|
`refund_time` datetime DEFAULT NULL COMMENT '退款时间',
|
||||||
|
`after_sale_id` bigint DEFAULT NULL COMMENT '售后单编号',
|
||||||
|
`after_sale_status` tinyint DEFAULT NULL COMMENT '售后状态 (枚举 TradeOrderItemAfterSaleStatusEnum)',
|
||||||
|
`finance_id` bigint DEFAULT NULL COMMENT '财务单编号',
|
||||||
|
`finance_status` tinyint DEFAULT NULL COMMENT '财务状态 (枚举 TradeOrderItemFinanceEnum)',
|
||||||
|
`version` int NOT NULL DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime DEFAULT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) DEFAULT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) DEFAULT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint NOT NULL DEFAULT '1' COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_order_num` (`order_num`),
|
||||||
|
KEY `idx_user_id` (`user_id`),
|
||||||
|
KEY `idx_status` (`order_status`),
|
||||||
|
KEY `idx_pay_status` (`pay_status`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
AUTO_INCREMENT = 2
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_0900_ai_ci COMMENT ='交易订单表';
|
||||||
|
|
||||||
|
|
||||||
|
-- 交易订单项表 (trade_order_item)
|
||||||
|
CREATE TABLE `tz_trade_order_item`
|
||||||
|
(
|
||||||
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
|
`user_id` bigint NOT NULL COMMENT '用户编号',
|
||||||
|
`order_id` bigint NOT NULL COMMENT '订单编号',
|
||||||
|
`cart_id` bigint DEFAULT NULL COMMENT '购物车项编号',
|
||||||
|
`spu_id` bigint NOT NULL COMMENT '商品 SPU 编号',
|
||||||
|
`spu_name` varchar(256) NOT NULL COMMENT '商品 SPU 名称',
|
||||||
|
`spu_type` tinyint(1) NOT NULL COMMENT '商品类型(1商品 2服务)',
|
||||||
|
`sku_id` bigint NOT NULL COMMENT '商品 SKU 编号',
|
||||||
|
`sku_name` varchar(255) NOT NULL COMMENT '商品 SKU 名称',
|
||||||
|
`shop_id` bigint DEFAULT NULL COMMENT '店铺id',
|
||||||
|
`shop_name` varchar(64) DEFAULT NULL COMMENT '店铺名称',
|
||||||
|
`shop_logo` varchar(255) DEFAULT NULL COMMENT '店铺logo',
|
||||||
|
`order_category_name` varchar(64) NOT NULL COMMENT '订单类目名称',
|
||||||
|
`order_category_id` bigint NOT NULL COMMENT '订单类目id',
|
||||||
|
`pic_url` varchar(512) NOT NULL COMMENT '商品图片',
|
||||||
|
`count` int NOT NULL COMMENT '购买数量',
|
||||||
|
`unit` varchar(16) DEFAULT NULL COMMENT '商品单位',
|
||||||
|
`expense_price` int DEFAULT NULL COMMENT '商品成本(单),单位:分',
|
||||||
|
`price` int DEFAULT NULL COMMENT '商品原价(单),单位:分',
|
||||||
|
`discount_price` int DEFAULT NULL COMMENT '优惠金额(总),单位:分',
|
||||||
|
`delivery_price` int DEFAULT NULL COMMENT '运费金额(总),单位:分',
|
||||||
|
`adjust_price` int DEFAULT NULL COMMENT '订单调价(总),单位:分',
|
||||||
|
`pay_price` int DEFAULT NULL COMMENT '应付金额(总),单位:分',
|
||||||
|
`live_price` int DEFAULT NULL COMMENT '实收金额(总),单位:分',
|
||||||
|
`refund_status` tinyint DEFAULT NULL COMMENT '退款状态 (枚举 TradeOrderRefundStatusEnum)',
|
||||||
|
`refund_price` int DEFAULT NULL COMMENT '退款金额,单位:分',
|
||||||
|
`refund_time` datetime DEFAULT NULL COMMENT '退款时间',
|
||||||
|
`sub_type` tinyint(1) DEFAULT '1' COMMENT '预约类型(1预约 2 加急)',
|
||||||
|
`sub_time` datetime DEFAULT NULL COMMENT '预约时间',
|
||||||
|
`serve_address` varchar(255) DEFAULT NULL COMMENT '服务地址',
|
||||||
|
`serve_content` varchar(255) DEFAULT NULL COMMENT '服务内容',
|
||||||
|
`properties` json DEFAULT NULL COMMENT '属性数组',
|
||||||
|
`serve_info` json DEFAULT NULL COMMENT '服务信息',
|
||||||
|
`serve_ext_info` json DEFAULT NULL COMMENT '扩展服务信息,存储额外的服务相关数据',
|
||||||
|
`price_ext_info` json DEFAULT NULL COMMENT '附加费信息',
|
||||||
|
`version` int NOT NULL DEFAULT '0' COMMENT '版本号(乐观锁)',
|
||||||
|
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime DEFAULT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) DEFAULT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) DEFAULT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint NOT NULL DEFAULT '1' COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_order_id` (`order_id`),
|
||||||
|
KEY `idx_sku_id` (`sku_id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
AUTO_INCREMENT = 2
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_0900_ai_ci COMMENT ='交易订单项表';
|
||||||
|
|
||||||
|
|
||||||
|
-- 订单日志表 (trade_order_log)
|
||||||
|
CREATE TABLE `tz_trade_order_log`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
|
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
||||||
|
`user_type` tinyint(4) NOT NULL COMMENT '用户类型 (枚举 UserTypeEnum)',
|
||||||
|
`order_id` bigint(20) NOT NULL COMMENT '订单号',
|
||||||
|
`before_status` int(11) DEFAULT NULL COMMENT '操作前状态',
|
||||||
|
`after_status` int(11) DEFAULT NULL COMMENT '操作后状态',
|
||||||
|
`operate_type` tinyint(4) NOT NULL COMMENT '操作类型 (枚举 TradeOrderOperateTypeEnum)',
|
||||||
|
`content` varchar(1024) NOT NULL COMMENT '订单日志信息',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint NOT NULL DEFAULT '1' COMMENT '租户编号',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_order_id` (`order_id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='订单日志表';
|
||||||
|
|
||||||
|
-- 售后订单表 (tz_trade_after_sale)
|
||||||
|
CREATE TABLE `tz_trade_after_sale`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '售后编号,主键自增',
|
||||||
|
`no` varchar(64) NOT NULL COMMENT '售后单号',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '退款状态 (枚举 AfterSaleStatusEnum)',
|
||||||
|
`way` tinyint(4) NOT NULL COMMENT '售后方式 (枚举 AfterSaleWayEnum)',
|
||||||
|
`type` tinyint(4) NOT NULL COMMENT '售后类型 (枚举 AfterSaleTypeEnum)',
|
||||||
|
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
||||||
|
`apply_reason` varchar(256) NOT NULL COMMENT '申请原因',
|
||||||
|
`apply_description` varchar(512) DEFAULT NULL COMMENT '补充描述',
|
||||||
|
`apply_pic_urls` json DEFAULT NULL COMMENT '补充凭证图片',
|
||||||
|
`order_id` bigint(20) NOT NULL COMMENT '交易订单编号',
|
||||||
|
`order_no` varchar(64) NOT NULL COMMENT '订单流水号',
|
||||||
|
`order_item_id` bigint(20) NOT NULL COMMENT '交易订单项编号',
|
||||||
|
`prod_id` bigint(20) NOT NULL COMMENT '商品 SPU 编号',
|
||||||
|
`prod_name` varchar(256) NOT NULL COMMENT '商品 SPU 名称',
|
||||||
|
`sku_id` bigint(20) NOT NULL COMMENT '商品 SKU 编号',
|
||||||
|
`properties` json DEFAULT NULL COMMENT '属性数组',
|
||||||
|
`pic_url` varchar(512) DEFAULT NULL COMMENT '商品图片',
|
||||||
|
`count` int(11) NOT NULL COMMENT '退货商品数量',
|
||||||
|
`audit_time` datetime DEFAULT NULL COMMENT '审批时间',
|
||||||
|
`audit_user_id` bigint(20) DEFAULT NULL COMMENT '审批人',
|
||||||
|
`audit_reason` varchar(512) DEFAULT NULL COMMENT '审批备注',
|
||||||
|
`refund_price` int(11) NOT NULL COMMENT '退款金额,单位:分',
|
||||||
|
`pay_refund_id` bigint(20) DEFAULT NULL COMMENT '支付退款编号',
|
||||||
|
`refund_time` datetime DEFAULT NULL COMMENT '退款时间',
|
||||||
|
`logistics_id` bigint(20) DEFAULT NULL COMMENT '退货物流公司编号',
|
||||||
|
`logistics_no` varchar(64) DEFAULT NULL COMMENT '退货物流单号',
|
||||||
|
`delivery_time` datetime DEFAULT NULL COMMENT '退货时间',
|
||||||
|
`receive_time` datetime DEFAULT NULL COMMENT '收货时间',
|
||||||
|
`receive_reason` varchar(512) DEFAULT NULL COMMENT '收货备注',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_no` (`no`),
|
||||||
|
KEY `idx_user_id` (`user_id`),
|
||||||
|
KEY `idx_order_id` (`order_id`),
|
||||||
|
KEY `idx_order_item_id` (`order_item_id`),
|
||||||
|
KEY `idx_status` (`status`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='售后订单表';
|
||||||
|
|
||||||
|
-- 交易售后日志表 (tz_trade_after_sale_log)
|
||||||
|
CREATE TABLE `tz_trade_after_sale_log`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
|
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
||||||
|
`user_type` tinyint(4) NOT NULL COMMENT '用户类型 (枚举 UserTypeEnum)',
|
||||||
|
`after_sale_id` bigint(20) NOT NULL COMMENT '售后编号',
|
||||||
|
`before_status` tinyint(4) DEFAULT NULL COMMENT '操作前状态',
|
||||||
|
`after_status` tinyint(4) DEFAULT NULL COMMENT '操作后状态',
|
||||||
|
`operate_type` tinyint(4) NOT NULL COMMENT '操作类型 (枚举 AfterSaleOperateTypeEnum)',
|
||||||
|
`content` varchar(512) NOT NULL COMMENT '操作明细',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_after_sale_id` (`after_sale_id`),
|
||||||
|
KEY `idx_user_id` (`user_id`),
|
||||||
|
KEY `idx_operate_type` (`operate_type`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='交易售后日志表';
|
||||||
|
|
||||||
|
|
||||||
|
-- 快递公司表 (trade_delivery_express)
|
||||||
|
CREATE TABLE `tz_trade_delivery_express`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||||
|
`code` varchar(64) NOT NULL COMMENT '快递公司 code',
|
||||||
|
`name` varchar(128) NOT NULL COMMENT '快递公司名称',
|
||||||
|
`logo` varchar(512) DEFAULT NULL COMMENT '快递公司 logo',
|
||||||
|
`sort` int(11) DEFAULT NULL COMMENT '排序',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '状态 (枚举 CommonStatusEnum)',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_code` (`code`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='快递公司表';
|
||||||
|
|
||||||
|
-- 快递运费模板表 (trade_delivery_express_template)
|
||||||
|
CREATE TABLE `tz_trade_delivery_express_template`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||||
|
`name` varchar(128) NOT NULL COMMENT '模板名称',
|
||||||
|
`charge_mode` tinyint(4) NOT NULL COMMENT '配送计费方式 (枚举 DeliveryExpressChargeModeEnum)',
|
||||||
|
`sort` int(11) DEFAULT NULL COMMENT '排序',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='快递运费模板表';
|
||||||
|
|
||||||
|
-- 快递运费模板计费配置表 (trade_delivery_express_template_charge)
|
||||||
|
CREATE TABLE `tz_trade_delivery_express_template_charge`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||||
|
`template_id` bigint(20) NOT NULL COMMENT '配送模板编号',
|
||||||
|
`area_ids` varchar(512) NOT NULL COMMENT '配送区域编号列表',
|
||||||
|
`charge_mode` tinyint(4) NOT NULL COMMENT '配送计费方式',
|
||||||
|
`start_count` double NOT NULL COMMENT '首件数量(件数,重量,或体积)',
|
||||||
|
`start_price` int(11) NOT NULL COMMENT '起步价,单位:分',
|
||||||
|
`extra_count` double NOT NULL COMMENT '续件数量(件, 重量,或体积)',
|
||||||
|
`extra_price` int(11) NOT NULL COMMENT '额外价,单位:分',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_template_id` (`template_id`),
|
||||||
|
CONSTRAINT `fk_express_template_charge_template_id` FOREIGN KEY (`template_id`) REFERENCES `tz_trade_delivery_express_template` (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='快递运费模板计费配置表';
|
||||||
|
|
||||||
|
-- 快递运费模板包邮配置表 (trade_delivery_express_template_free)
|
||||||
|
CREATE TABLE `tz_trade_delivery_express_template_free`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
|
`template_id` bigint(20) NOT NULL COMMENT '配送模板编号',
|
||||||
|
`area_ids` varchar(512) NOT NULL COMMENT '配送区域编号列表',
|
||||||
|
`free_price` int(11) DEFAULT NULL COMMENT '包邮金额,单位:分',
|
||||||
|
`free_count` int(11) DEFAULT NULL COMMENT '包邮件数',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_template_id` (`template_id`),
|
||||||
|
CONSTRAINT `fk_express_template_free_template_id` FOREIGN KEY (`template_id`) REFERENCES `tz_trade_delivery_express_template` (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='快递运费模板包邮配置表';
|
||||||
|
|
||||||
|
-- 自提门店表 (trade_delivery_pick_up_store)
|
||||||
|
CREATE TABLE `tz_trade_delivery_pick_up_store`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
|
`name` varchar(128) NOT NULL COMMENT '门店名称',
|
||||||
|
`introduction` varchar(512) DEFAULT NULL COMMENT '门店简介',
|
||||||
|
`phone` varchar(20) NOT NULL COMMENT '门店手机',
|
||||||
|
`area_id` int(11) NOT NULL COMMENT '区域编号',
|
||||||
|
`detail_address` varchar(512) NOT NULL COMMENT '门店详细地址',
|
||||||
|
`logo` varchar(512) DEFAULT NULL COMMENT '门店 logo',
|
||||||
|
`opening_time` time NOT NULL COMMENT '营业开始时间',
|
||||||
|
`closing_time` time NOT NULL COMMENT '营业结束时间',
|
||||||
|
`latitude` double DEFAULT NULL COMMENT '纬度',
|
||||||
|
`longitude` double DEFAULT NULL COMMENT '经度',
|
||||||
|
`verify_user_ids` varchar(512) DEFAULT NULL COMMENT '核销员工用户编号数组',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '门店状态 (枚举 CommonStatusEnum)',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_area_id` (`area_id`),
|
||||||
|
KEY `idx_status` (`status`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='自提门店表';
|
||||||
|
|
||||||
|
-- 订单预约时间修改记录表 (tz_trade_sub_log)
|
||||||
|
CREATE TABLE `tz_trade_sub_log`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
|
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
||||||
|
`order_id` bigint(20) NOT NULL COMMENT '订单号',
|
||||||
|
`sub_time` datetime NOT NULL COMMENT '预约时间',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_order_id` (`order_id`),
|
||||||
|
KEY `idx_user_id` (`user_id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='订单预约时间修改记录表';
|
||||||
|
|
||||||
211
sql/mysql/pay.sql
Normal file
211
sql/mysql/pay.sql
Normal file
@@ -0,0 +1,211 @@
|
|||||||
|
-- 支付应用表 (tz_pay_app)
|
||||||
|
CREATE TABLE `tz_pay_app` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '应用编号,数据库自增',
|
||||||
|
`app_key` varchar(64) NOT NULL COMMENT '应用标识',
|
||||||
|
`name` varchar(128) NOT NULL COMMENT '应用名',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '状态 (枚举 CommonStatusEnum)',
|
||||||
|
`remark` varchar(512) DEFAULT NULL COMMENT '备注',
|
||||||
|
`order_notify_url` varchar(512) DEFAULT NULL COMMENT '支付结果的回调地址',
|
||||||
|
`refund_notify_url` varchar(512) DEFAULT NULL COMMENT '退款结果的回调地址',
|
||||||
|
`transfer_notify_url` varchar(512) DEFAULT NULL COMMENT '转账结果的回调地址',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_app_key` (`app_key`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付应用表';
|
||||||
|
|
||||||
|
-- 支付渠道表 (tz_pay_channel)
|
||||||
|
CREATE TABLE `tz_pay_channel` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '渠道编号,数据库自增',
|
||||||
|
`code` varchar(32) NOT NULL COMMENT '渠道编码 (枚举 PayChannelEnum)',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '状态 (枚举 CommonStatusEnum)',
|
||||||
|
`fee_rate` double DEFAULT NULL COMMENT '渠道费率,单位:百分比',
|
||||||
|
`remark` varchar(512) DEFAULT NULL COMMENT '备注',
|
||||||
|
`app_id` bigint(20) NOT NULL COMMENT '应用编号 (关联 tz_pay_app.id)',
|
||||||
|
`config` json DEFAULT NULL COMMENT '支付渠道配置',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_code_app_id` (`code`,`app_id`),
|
||||||
|
KEY `idx_app_id` (`app_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付渠道表';
|
||||||
|
|
||||||
|
-- 支付通知日志表 (tz_pay_notify_log)
|
||||||
|
CREATE TABLE `tz_pay_notify_log` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '日志编号,自增',
|
||||||
|
`task_id` bigint(20) NOT NULL COMMENT '通知任务编号 (关联 tz_pay_notify_task.id)',
|
||||||
|
`notify_times` int(11) NOT NULL COMMENT '第几次被通知',
|
||||||
|
`response` varchar(1024) DEFAULT NULL COMMENT 'HTTP 响应结果',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '支付通知状态 (枚举 PayNotifyStatusEnum)',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_task_id` (`task_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付通知日志表';
|
||||||
|
|
||||||
|
-- 支付通知任务表 (tz_pay_notify_task)
|
||||||
|
CREATE TABLE `tz_pay_notify_task` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号,自增',
|
||||||
|
`app_id` bigint(20) NOT NULL COMMENT '应用编号 (关联 tz_pay_app.id)',
|
||||||
|
`type` tinyint(4) NOT NULL COMMENT '通知类型 (枚举 PayNotifyTypeEnum)',
|
||||||
|
`data_id` bigint(20) NOT NULL COMMENT '数据编号',
|
||||||
|
`merchant_order_id` varchar(64) DEFAULT NULL COMMENT '商户订单编号',
|
||||||
|
`merchant_transfer_id` varchar(64) DEFAULT NULL COMMENT '商户转账单编号',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '通知状态 (枚举 PayNotifyStatusEnum)',
|
||||||
|
`next_notify_time` datetime DEFAULT NULL COMMENT '下一次通知时间',
|
||||||
|
`last_execute_time` datetime DEFAULT NULL COMMENT '最后一次执行时间',
|
||||||
|
`notify_times` int(11) DEFAULT NULL COMMENT '当前通知次数',
|
||||||
|
`max_notify_times` int(11) DEFAULT NULL COMMENT '最大可通知次数',
|
||||||
|
`notify_url` varchar(512) NOT NULL COMMENT '通知地址',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `idx_app_id` (`app_id`),
|
||||||
|
KEY `idx_type_data_id` (`type`,`data_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付通知任务表';
|
||||||
|
|
||||||
|
-- 支付订单表 (tz_pay_order)
|
||||||
|
CREATE TABLE `tz_pay_order` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单编号,数据库自增',
|
||||||
|
`app_id` bigint(20) NOT NULL COMMENT '应用编号 (关联 tz_pay_app.id)',
|
||||||
|
`channel_id` bigint(20) NOT NULL COMMENT '渠道编号 (关联 tz_pay_channel.id)',
|
||||||
|
`channel_code` varchar(32) NOT NULL COMMENT '渠道编码 (枚举 PayChannelEnum)',
|
||||||
|
`merchant_order_id` varchar(64) NOT NULL COMMENT '商户订单编号',
|
||||||
|
`subject` varchar(256) NOT NULL COMMENT '商品标题',
|
||||||
|
`body` varchar(512) DEFAULT NULL COMMENT '商品描述信息',
|
||||||
|
`notify_url` varchar(512) DEFAULT NULL COMMENT '异步通知地址',
|
||||||
|
`price` int(11) NOT NULL COMMENT '支付金额,单位:分',
|
||||||
|
`channel_fee_rate` double DEFAULT NULL COMMENT '渠道手续费,单位:百分比',
|
||||||
|
`channel_fee_price` int(11) DEFAULT NULL COMMENT '渠道手续金额,单位:分',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '支付状态 (枚举 PayOrderStatusEnum)',
|
||||||
|
`user_ip` varchar(32) DEFAULT NULL COMMENT '用户 IP',
|
||||||
|
`expire_time` datetime DEFAULT NULL COMMENT '订单失效时间',
|
||||||
|
`success_time` datetime DEFAULT NULL COMMENT '订单支付成功时间',
|
||||||
|
`extension_id` bigint(20) DEFAULT NULL COMMENT '支付成功的订单拓展单编号 (关联 tz_pay_order_extension.id)',
|
||||||
|
`no` varchar(64) DEFAULT NULL COMMENT '支付成功的外部订单号 (关联 tz_pay_order_extension.no)',
|
||||||
|
`refund_price` int(11) DEFAULT NULL COMMENT '退款总金额,单位:分',
|
||||||
|
`channel_user_id` varchar(128) DEFAULT NULL COMMENT '渠道用户编号',
|
||||||
|
`channel_order_no` varchar(128) DEFAULT NULL COMMENT '渠道订单号',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_merchant_order_id_app_id` (`merchant_order_id`,`app_id`),
|
||||||
|
KEY `idx_app_id` (`app_id`),
|
||||||
|
KEY `idx_channel_id` (`channel_id`),
|
||||||
|
KEY `idx_status` (`status`),
|
||||||
|
KEY `idx_extension_id` (`extension_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付订单表';
|
||||||
|
|
||||||
|
-- 支付订单扩展表 (tz_pay_order_extension)
|
||||||
|
CREATE TABLE `tz_pay_order_extension` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单拓展编号,数据库自增',
|
||||||
|
`no` varchar(64) NOT NULL COMMENT '外部订单号',
|
||||||
|
`order_id` bigint(20) NOT NULL COMMENT '订单号 (关联 tz_pay_order.id)',
|
||||||
|
`channel_id` bigint(20) NOT NULL COMMENT '渠道编号 (关联 tz_pay_channel.id)',
|
||||||
|
`channel_code` varchar(32) NOT NULL COMMENT '渠道编码',
|
||||||
|
`user_ip` varchar(32) DEFAULT NULL COMMENT '用户 IP',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '支付状态 (枚举 PayOrderStatusEnum)',
|
||||||
|
`channel_extras` json DEFAULT NULL COMMENT '支付渠道的额外参数',
|
||||||
|
`channel_error_code` varchar(64) DEFAULT NULL COMMENT '调用渠道的错误码',
|
||||||
|
`channel_error_msg` varchar(512) DEFAULT NULL COMMENT '调用渠道报错时,错误信息',
|
||||||
|
`channel_notify_data` text DEFAULT NULL COMMENT '支付渠道的同步/异步通知的内容',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_no` (`no`),
|
||||||
|
KEY `idx_order_id` (`order_id`),
|
||||||
|
KEY `idx_channel_id` (`channel_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付订单扩展表';
|
||||||
|
|
||||||
|
-- 支付退款单表 (tz_pay_refund)
|
||||||
|
CREATE TABLE `tz_pay_refund` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '退款单编号,数据库自增',
|
||||||
|
`no` varchar(64) NOT NULL COMMENT '外部退款号',
|
||||||
|
`app_id` bigint(20) NOT NULL COMMENT '应用编号 (关联 tz_pay_app.id)',
|
||||||
|
`channel_id` bigint(20) NOT NULL COMMENT '渠道编号 (关联 tz_pay_channel.id)',
|
||||||
|
`channel_code` varchar(32) NOT NULL COMMENT '渠道编码 (枚举 PayChannelEnum)',
|
||||||
|
`order_id` bigint(20) NOT NULL COMMENT '订单编号 (关联 tz_pay_order.id)',
|
||||||
|
`order_no` varchar(64) NOT NULL COMMENT '支付订单编号',
|
||||||
|
`merchant_order_id` varchar(64) NOT NULL COMMENT '商户订单编号',
|
||||||
|
`merchant_refund_id` varchar(64) NOT NULL COMMENT '商户退款订单号',
|
||||||
|
`notify_url` varchar(512) DEFAULT NULL COMMENT '异步通知地址',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '退款状态 (枚举 PayRefundStatusEnum)',
|
||||||
|
`pay_price` int(11) NOT NULL COMMENT '支付金额,单位:分',
|
||||||
|
`refund_price` int(11) NOT NULL COMMENT '退款金额,单位:分',
|
||||||
|
`reason` varchar(512) DEFAULT NULL COMMENT '退款原因',
|
||||||
|
`user_ip` varchar(32) DEFAULT NULL COMMENT '用户 IP',
|
||||||
|
`channel_order_no` varchar(128) DEFAULT NULL COMMENT '渠道订单号',
|
||||||
|
`channel_refund_no` varchar(128) DEFAULT NULL COMMENT '渠道退款单号',
|
||||||
|
`success_time` datetime DEFAULT NULL COMMENT '退款成功时间',
|
||||||
|
`channel_error_code` varchar(64) DEFAULT NULL COMMENT '调用渠道的错误码',
|
||||||
|
`channel_error_msg` varchar(512) DEFAULT NULL COMMENT '调用渠道的错误提示',
|
||||||
|
`channel_notify_data` text DEFAULT NULL COMMENT '支付渠道的同步/异步通知的内容',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_no` (`no`),
|
||||||
|
UNIQUE KEY `uk_merchant_refund_id_app_id` (`merchant_refund_id`,`app_id`),
|
||||||
|
KEY `idx_app_id` (`app_id`),
|
||||||
|
KEY `idx_channel_id` (`channel_id`),
|
||||||
|
KEY `idx_order_id` (`order_id`),
|
||||||
|
KEY `idx_status` (`status`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='支付退款单表';
|
||||||
|
|
||||||
|
-- 转账单表 (tz_pay_transfer)
|
||||||
|
CREATE TABLE `tz_pay_transfer` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
|
`no` varchar(64) NOT NULL COMMENT '转账单号',
|
||||||
|
`app_id` bigint(20) NOT NULL COMMENT '应用编号 (关联 tz_pay_app.id)',
|
||||||
|
`channel_id` bigint(20) NOT NULL COMMENT '转账渠道编号 (关联 tz_pay_channel.id)',
|
||||||
|
`channel_code` varchar(32) NOT NULL COMMENT '转账渠道编码 (枚举 PayChannelEnum)',
|
||||||
|
`merchant_transfer_id` varchar(64) NOT NULL COMMENT '商户转账单编号',
|
||||||
|
`type` tinyint(4) NOT NULL COMMENT '类型 (枚举 PayTransferTypeEnum)',
|
||||||
|
`subject` varchar(256) NOT NULL COMMENT '转账标题',
|
||||||
|
`price` int(11) NOT NULL COMMENT '转账金额,单位:分',
|
||||||
|
`user_name` varchar(64) DEFAULT NULL COMMENT '收款人姓名',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '转账状态 (枚举 PayTransferStatusRespEnum)',
|
||||||
|
`success_time` datetime DEFAULT NULL COMMENT '订单转账成功时间',
|
||||||
|
`alipay_logon_id` varchar(128) DEFAULT NULL COMMENT '支付宝登录号',
|
||||||
|
`openid` varchar(128) DEFAULT NULL COMMENT '微信 openId',
|
||||||
|
`notify_url` varchar(512) DEFAULT NULL COMMENT '异步通知地址',
|
||||||
|
`user_ip` varchar(32) DEFAULT NULL COMMENT '用户 IP',
|
||||||
|
`channel_extras` json DEFAULT NULL COMMENT '渠道的额外参数',
|
||||||
|
`channel_transfer_no` varchar(128) DEFAULT NULL COMMENT '渠道转账单号',
|
||||||
|
`channel_error_code` varchar(64) DEFAULT NULL COMMENT '调用渠道的错误码',
|
||||||
|
`channel_error_msg` varchar(512) DEFAULT NULL COMMENT '调用渠道的错误提示',
|
||||||
|
`channel_notify_data` text DEFAULT NULL COMMENT '渠道的同步/异步通知的内容',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_no` (`no`),
|
||||||
|
UNIQUE KEY `uk_merchant_transfer_id_app_id` (`merchant_transfer_id`,`app_id`),
|
||||||
|
KEY `idx_app_id` (`app_id`),
|
||||||
|
KEY `idx_channel_id` (`channel_id`),
|
||||||
|
KEY `idx_status` (`status`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='转账单表';
|
||||||
90
sql/mysql/user.sql
Normal file
90
sql/mysql/user.sql
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
-- 登录用户表 (tz_login_user) 后续拓展用户信息表
|
||||||
|
CREATE TABLE `tz_user_login`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||||
|
`mobile` varchar(11) NOT NULL COMMENT '手机',
|
||||||
|
`password` varchar(128) NOT NULL COMMENT '加密后的密码',
|
||||||
|
`status` tinyint(4) NOT NULL COMMENT '帐号状态 (枚举 CommonStatusEnum)',
|
||||||
|
`register_ip` varchar(32) DEFAULT NULL COMMENT '注册 IP',
|
||||||
|
`register_terminal` tinyint(4) DEFAULT NULL COMMENT '注册渠道 (枚举 TerminalEnum)',
|
||||||
|
`register_date` datetime DEFAULT NULL COMMENT '注册时间',
|
||||||
|
`login_ip` varchar(32) DEFAULT NULL COMMENT '最后登录IP',
|
||||||
|
`login_date` datetime DEFAULT NULL COMMENT '最后登录时间',
|
||||||
|
`login_terminal` varchar(32) DEFAULT NULL COMMENT '最后登录设备',
|
||||||
|
`nickname` varchar(64) DEFAULT NULL COMMENT '用户昵称',
|
||||||
|
`avatar` varchar(512) DEFAULT NULL COMMENT '用户头像',
|
||||||
|
`remark` varchar(512) DEFAULT NULL COMMENT '用户备注',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `uk_mobile` (`mobile`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='登录用户表';
|
||||||
|
|
||||||
|
-- 会员信息表 (tz_user_member)
|
||||||
|
CREATE TABLE `tz_user_member`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户ID',
|
||||||
|
`name` varchar(64) DEFAULT NULL COMMENT '真实名字',
|
||||||
|
`sex` tinyint DEFAULT NULL COMMENT '性别 (枚举 SexEnum)',
|
||||||
|
`birthday` datetime DEFAULT NULL COMMENT '出生日期',
|
||||||
|
`area_id` int DEFAULT NULL COMMENT '所在地 (关联 Area.id 字段)',
|
||||||
|
`point` int DEFAULT NULL COMMENT '积分',
|
||||||
|
`tag_ids` varchar(512) DEFAULT NULL COMMENT '会员标签列表,以逗号分隔',
|
||||||
|
`level_id` bigint DEFAULT NULL COMMENT '会员级别编号 (关联 MemberLevelDO.id 字段)',
|
||||||
|
`experience` int DEFAULT NULL COMMENT '会员经验',
|
||||||
|
`group_id` bigint DEFAULT NULL COMMENT '用户分组编号 (关联 MemberGroupDO.id 字段)',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='会员信息表';
|
||||||
|
|
||||||
|
-- 会员地址表 (tz_user_member_address)
|
||||||
|
CREATE TABLE `tz_user_member_address`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户编号',
|
||||||
|
`name` varchar(128) DEFAULT NULL COMMENT '收件人名称',
|
||||||
|
`mobile` varchar(11) DEFAULT NULL COMMENT '手机号',
|
||||||
|
`areaId` bigint(20) DEFAULT NULL COMMENT '地区编号',
|
||||||
|
`detailAddress` varchar(255) DEFAULT NULL COMMENT '收件详细地址',
|
||||||
|
`defaultStatus` int DEFAULT NULL COMMENT '是否默认',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='会员地址表';
|
||||||
|
|
||||||
|
-- 会员等级表 (tz_user_member_level)
|
||||||
|
CREATE TABLE `tz_user_member_level`
|
||||||
|
(
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'ID',
|
||||||
|
`level_name` varchar(64) DEFAULT NULL COMMENT '等级名称',
|
||||||
|
`level` int DEFAULT NULL COMMENT '性别 (枚举 SexEnum)',
|
||||||
|
`experience` int DEFAULT NULL COMMENT '会员经验',
|
||||||
|
`discount_percent` int DEFAULT NULL COMMENT '享受折扣',
|
||||||
|
`icon` varchar(128) DEFAULT NULL COMMENT '等级图标',
|
||||||
|
`background_url` varchar(128) DEFAULT NULL COMMENT '等级背景图',
|
||||||
|
`status` int DEFAULT NULL COMMENT '状态',
|
||||||
|
`tenant_id` bigint(20) NOT NULL COMMENT '租户ID',
|
||||||
|
`create_time` datetime NOT NULL COMMENT '创建时间',
|
||||||
|
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
||||||
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE = InnoDB
|
||||||
|
DEFAULT CHARSET = utf8mb4 COMMENT ='会员等级表';
|
||||||
|
|
||||||
8
sql/tools/.gitignore
vendored
8
sql/tools/.gitignore
vendored
@@ -1,8 +0,0 @@
|
|||||||
# 忽略python虚拟环境
|
|
||||||
.env
|
|
||||||
.venv
|
|
||||||
env/
|
|
||||||
venv/
|
|
||||||
ENV/
|
|
||||||
env.bak/
|
|
||||||
venv.bak/
|
|
||||||
@@ -1,130 +0,0 @@
|
|||||||
## 0. 友情提示
|
|
||||||
|
|
||||||
在 `sql/tools` 目录下,我们提供一些数据库相关的工具,包括测试数据库的快速启动、MySQL 转换其它数据库等等。
|
|
||||||
|
|
||||||
注意!所有的操作,必须在 `sql/tools` 目录下执行。
|
|
||||||
|
|
||||||
## 1. 测试数据库的快速启动
|
|
||||||
|
|
||||||
基于 Docker Compose,快速启动 MySQL、Oracle、PostgreSQL、SQL Server 等数据库。
|
|
||||||
|
|
||||||
注意!使用 Docker Compose 启动完测试数据后,因为会自动导入项目的 SQL 脚本,所以可能需要等待 1-2 分钟。
|
|
||||||
|
|
||||||
### 1.1 MySQL
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d mysql
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 1.2 Oracle
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
## x86 版本
|
|
||||||
docker compose up -d oracle
|
|
||||||
|
|
||||||
## MacBook Apple Silicon
|
|
||||||
docker compose up -d oracle_m1
|
|
||||||
```
|
|
||||||
|
|
||||||
> 注意:如果使用 MacBook Apple Silicon 版本,它的 ORACLE_SID 不是 XE,而是 FREE!!!
|
|
||||||
|
|
||||||
### 1.3 PostgreSQL
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d postgres
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.4 SQL Server
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d sqlserver
|
|
||||||
# 注意:启动完 sqlserver 后,需要手动再执行如下命令,因为 SQL Server 不支持初始化脚本
|
|
||||||
docker compose exec sqlserver bash /tmp/create_schema.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.5 DM 达梦
|
|
||||||
|
|
||||||
① 下载达梦 Docker 镜像:<https://eco.dameng.com/download/> 地址,点击“Docker 镜像”选项,进行下载。
|
|
||||||
|
|
||||||
② 加载镜像文件,在镜像 tar 文件所在目录运行:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker load -i dm8_20240715_x86_rh6_rq_single.tar
|
|
||||||
```
|
|
||||||
|
|
||||||
③ 在项目 `sql/tools` 目录下运行:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d dm8
|
|
||||||
# 注意:启动完 dm 后,需要手动再执行如下命令,因为 dm 不支持初始化脚本
|
|
||||||
docker compose exec dm8 bash -c '/opt/dmdbms/bin/disql SYSDBA/SYSDBA001 \`/tmp/schema.sql'
|
|
||||||
exit
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.6 KingbaseES 人大金仓
|
|
||||||
|
|
||||||
① 下载人大金仓 Docker 镜像:
|
|
||||||
|
|
||||||
* [x86_64 版本](https://kingbase.oss-cn-beijing.aliyuncs.com/KESV8R3/V009R001C001B0025-安装包-docker/x86_64/kdb_x86_64_V009R001C001B0025.tar) 【Windows 选择这个】
|
|
||||||
* [aarch64 版本](https://kingbase.oss-cn-beijing.aliyuncs.com/KESV8R3/V009R001C001B0025-安装包-docker/aarch64/kdb_aarch64_V009R001C001B0025.tar) 【MacBook Apple Silicon 选择这个】
|
|
||||||
|
|
||||||
② 加载镜像文件,在镜像 tar 文件所在目录运行:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker load -i kdb_x86_64_V009R001C001B0025.tar
|
|
||||||
```
|
|
||||||
|
|
||||||
③ 在项目 `sql/tools` 目录下运行:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d kingbase
|
|
||||||
# 注意:启动完 kingbase 后,需要手动再执行如下命令
|
|
||||||
docker compose exec kingbase bash -c 'ksql -U $DB_USER -d test -f /tmp/schema.sql'
|
|
||||||
```
|
|
||||||
|
|
||||||
### 1.7 华为 OpenGauss
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose up -d opengauss
|
|
||||||
# 注意:启动完 opengauss 后,需要手动再执行如下命令
|
|
||||||
docker compose exec opengauss bash -c '/usr/local/opengauss/bin/gsql -U $GS_USERNAME -W $GS_PASSWORD -d postgres -f /tmp/schema.sql'
|
|
||||||
```
|
|
||||||
|
|
||||||
## 1.X 容器的销毁重建
|
|
||||||
|
|
||||||
开发测试过程中,有时候需要创建全新干净的数据库。由于测试数据 Docker 容器采用数据卷 Volume 挂载数据库实例的数据目录,因此销毁数据需要停止容器后,删除数据卷,然后再重新创建容器。
|
|
||||||
|
|
||||||
以 postgres 为例,操作如下:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
docker compose down postgres
|
|
||||||
docker volume rm ruoyi-vue-pro_postgres
|
|
||||||
```
|
|
||||||
|
|
||||||
## 2. MySQL 转换其它数据库
|
|
||||||
|
|
||||||
项目提供了 `sql/tools/convertor.py` 脚本,支持将 MySQL 转换为 Oracle、PostgreSQL、SQL Server、达梦、人大金仓、OpenGauss 等数据库的脚本。
|
|
||||||
|
|
||||||
### 2.1 实现原理
|
|
||||||
|
|
||||||
通过读取 MySQL 的 `sql/mysql/ruoyi-vue-pro.sql` 数据库文件,转换成对应的数据库脚本。
|
|
||||||
|
|
||||||
### 2.2 使用方法
|
|
||||||
|
|
||||||
① 安装依赖库 `simple-ddl-parser`
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install simple-ddl-parser
|
|
||||||
# pip3 install simple-ddl-parser
|
|
||||||
```
|
|
||||||
|
|
||||||
② 在 `sql/tools/` 目录下,执行如下命令打印生成 postgres 的脚本内容,其他可选参数有:`oracle`、`sqlserver`、`dm8`、`kingbase`、`opengauss`:
|
|
||||||
|
|
||||||
```Bash
|
|
||||||
python3 convertor.py postgres
|
|
||||||
# python3 convertor.py postgres > tmp.sql
|
|
||||||
```
|
|
||||||
|
|
||||||
程序将 SQL 脚本打印到终端,可以重定向到临时文件 `tmp.sql`。
|
|
||||||
|
|
||||||
确认无误后,可以利用 IDEA 进行格式化。当然,也可以直接导入到数据库中。
|
|
||||||
@@ -1,844 +0,0 @@
|
|||||||
# encoding=utf8
|
|
||||||
"""芋道系统数据库迁移工具
|
|
||||||
|
|
||||||
Author: dhb52 (https://gitee.com/dhb52)
|
|
||||||
|
|
||||||
pip install simple-ddl-parser
|
|
||||||
"""
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import pathlib
|
|
||||||
import re
|
|
||||||
import time
|
|
||||||
from abc import ABC, abstractmethod
|
|
||||||
from typing import Dict, Generator, Optional, Tuple, Union
|
|
||||||
|
|
||||||
from simple_ddl_parser import DDLParser
|
|
||||||
|
|
||||||
PREAMBLE = """/*
|
|
||||||
Yudao Database Transfer Tool
|
|
||||||
|
|
||||||
Source Server Type : MySQL
|
|
||||||
|
|
||||||
Target Server Type : {db_type}
|
|
||||||
|
|
||||||
Date: {date}
|
|
||||||
*/
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def load_and_clean(sql_file: str) -> str:
|
|
||||||
"""加载源 SQL 文件,并清理内容方便下一步 ddl 解析
|
|
||||||
|
|
||||||
Args:
|
|
||||||
sql_file (str): sql文件路径
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 清理后的sql文件内容
|
|
||||||
"""
|
|
||||||
REPLACE_PAIR_LIST = (
|
|
||||||
(" CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ", " "),
|
|
||||||
(" KEY `", " INDEX `"),
|
|
||||||
("UNIQUE INDEX", "UNIQUE KEY"),
|
|
||||||
("b'0'", "'0'"),
|
|
||||||
("b'1'", "'1'"),
|
|
||||||
)
|
|
||||||
|
|
||||||
content = open(sql_file).read()
|
|
||||||
for replace_pair in REPLACE_PAIR_LIST:
|
|
||||||
content = content.replace(*replace_pair)
|
|
||||||
content = re.sub(r"ENGINE.*COMMENT", "COMMENT", content)
|
|
||||||
content = re.sub(r"ENGINE.*;", ";", content)
|
|
||||||
return content
|
|
||||||
|
|
||||||
|
|
||||||
class Convertor(ABC):
|
|
||||||
def __init__(self, src: str, db_type) -> None:
|
|
||||||
self.src = src
|
|
||||||
self.db_type = db_type
|
|
||||||
self.content = load_and_clean(self.src)
|
|
||||||
self.table_script_list = re.findall(r"CREATE TABLE [^;]*;", self.content)
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def translate_type(self, type: str, size: Optional[Union[int, Tuple[int]]]) -> str:
|
|
||||||
"""字段类型转换
|
|
||||||
|
|
||||||
Args:
|
|
||||||
type (str): 字段类型
|
|
||||||
size (Optional[Union[int, Tuple[int]]]): 字段长度描述, 如varchar(255), decimal(10,2)
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 类型定义
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def gen_create(self, table_ddl: Dict) -> str:
|
|
||||||
"""生成 create 脚本
|
|
||||||
|
|
||||||
Args:
|
|
||||||
table_ddl (Dict): 表DDL
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def gen_pk(self, table_name: str) -> str:
|
|
||||||
"""生成主键定义
|
|
||||||
|
|
||||||
Args:
|
|
||||||
table_name (str): 表名
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
"""生成索引定义
|
|
||||||
|
|
||||||
Args:
|
|
||||||
table_ddl (Dict): 表DDL
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
|
||||||
"""生成字段/表注释
|
|
||||||
|
|
||||||
Args:
|
|
||||||
table_sql (str): 原始表SQL
|
|
||||||
table_name (str): 表名
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
@abstractmethod
|
|
||||||
def gen_insert(self, table_name: str) -> str:
|
|
||||||
"""生成 insert 语句块
|
|
||||||
|
|
||||||
Args:
|
|
||||||
table_name (str): 表名
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def gen_dual(self) -> str:
|
|
||||||
"""生成虚拟 dual 表
|
|
||||||
|
|
||||||
Returns:
|
|
||||||
str: 生成脚本, 默认返回空脚本, 表示当前数据库无需手工创建
|
|
||||||
"""
|
|
||||||
return ""
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def inserts(table_name: str, script_content: str) -> Generator:
|
|
||||||
PREFIX = f"INSERT INTO `{table_name}`"
|
|
||||||
|
|
||||||
# 收集 `table_name` 对应的 insert 语句
|
|
||||||
for line in script_content.split("\n"):
|
|
||||||
if line.startswith(PREFIX):
|
|
||||||
head, tail = line.replace(PREFIX, "").split(" VALUES ", maxsplit=1)
|
|
||||||
head = head.strip().replace("`", "").lower()
|
|
||||||
tail = tail.strip().replace(r"\"", '"')
|
|
||||||
# tail = tail.replace("b'0'", "'0'").replace("b'1'", "'1'")
|
|
||||||
yield f"INSERT INTO {table_name.lower()} {head} VALUES {tail}"
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def index(ddl: Dict) -> Generator:
|
|
||||||
"""生成索引定义
|
|
||||||
|
|
||||||
Args:
|
|
||||||
ddl (Dict): 表DDL
|
|
||||||
|
|
||||||
Yields:
|
|
||||||
Generator[str]: create index 语句
|
|
||||||
"""
|
|
||||||
|
|
||||||
def generate_columns(columns):
|
|
||||||
keys = [
|
|
||||||
f"{col['name'].lower()}{' ' + col['order'].lower() if col['order'] != 'ASC' else ''}"
|
|
||||||
for col in columns[0]
|
|
||||||
]
|
|
||||||
return ", ".join(keys)
|
|
||||||
|
|
||||||
for no, index in enumerate(ddl["index"], 1):
|
|
||||||
columns = generate_columns(index["columns"])
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
yield f"CREATE INDEX idx_{table_name}_{no:02d} ON {table_name} ({columns})"
|
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def filed_comments(table_sql: str) -> Generator:
|
|
||||||
for line in table_sql.split("\n"):
|
|
||||||
match = re.match(r"^`([^`]+)`.* COMMENT '([^']+)'", line.strip())
|
|
||||||
if match:
|
|
||||||
field = match.group(1)
|
|
||||||
comment_string = match.group(2).replace("\\n", "\n")
|
|
||||||
yield field, comment_string
|
|
||||||
|
|
||||||
def table_comment(self, table_sql: str) -> str:
|
|
||||||
match = re.search(r"COMMENT \= '([^']+)';", table_sql)
|
|
||||||
return match.group(1) if match else None
|
|
||||||
|
|
||||||
def print(self):
|
|
||||||
"""打印转换后的sql脚本到终端"""
|
|
||||||
print(
|
|
||||||
PREAMBLE.format(
|
|
||||||
db_type=self.db_type,
|
|
||||||
date=time.strftime("%Y-%m-%d %H:%M:%S"),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
dual = self.gen_dual()
|
|
||||||
if dual:
|
|
||||||
print(
|
|
||||||
f"""-- ----------------------------
|
|
||||||
-- Table structure for dual
|
|
||||||
-- ----------------------------
|
|
||||||
{dual}
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
error_scripts = []
|
|
||||||
for table_sql in self.table_script_list:
|
|
||||||
ddl = DDLParser(table_sql.replace("`", "")).run()
|
|
||||||
|
|
||||||
# 如果parse失败, 需要跟进
|
|
||||||
if len(ddl) == 0:
|
|
||||||
error_scripts.append(table_sql)
|
|
||||||
continue
|
|
||||||
|
|
||||||
table_ddl = ddl[0]
|
|
||||||
table_name = table_ddl["table_name"]
|
|
||||||
|
|
||||||
# 忽略 quartz 的内容
|
|
||||||
if table_name.lower().startswith("qrtz"):
|
|
||||||
continue
|
|
||||||
|
|
||||||
# 为每个表生成个5个基本部分
|
|
||||||
create = self.gen_create(table_ddl)
|
|
||||||
pk = self.gen_pk(table_name)
|
|
||||||
index = self.gen_index(table_ddl)
|
|
||||||
comment = self.gen_comment(table_sql, table_name)
|
|
||||||
inserts = self.gen_insert(table_name)
|
|
||||||
|
|
||||||
# 组合当前表的DDL脚本
|
|
||||||
script = f"""{create}
|
|
||||||
|
|
||||||
{pk}
|
|
||||||
|
|
||||||
{index}
|
|
||||||
|
|
||||||
{comment}
|
|
||||||
|
|
||||||
{inserts}
|
|
||||||
"""
|
|
||||||
|
|
||||||
# 清理
|
|
||||||
script = re.sub("\n{3,}", "\n\n", script).strip() + "\n"
|
|
||||||
|
|
||||||
print(script)
|
|
||||||
|
|
||||||
# 将parse失败的脚本打印出来
|
|
||||||
if error_scripts:
|
|
||||||
for script in error_scripts:
|
|
||||||
print(script)
|
|
||||||
|
|
||||||
|
|
||||||
class PostgreSQLConvertor(Convertor):
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src, "PostgreSQL")
|
|
||||||
|
|
||||||
def translate_type(self, type: str, size: Optional[Union[int, Tuple[int]]]):
|
|
||||||
"""类型转换"""
|
|
||||||
|
|
||||||
type = type.lower()
|
|
||||||
|
|
||||||
if type == "varchar":
|
|
||||||
return f"varchar({size})"
|
|
||||||
if type == "int":
|
|
||||||
return "int4"
|
|
||||||
if type == "bigint" or type == "bigint unsigned":
|
|
||||||
return "int8"
|
|
||||||
if type == "datetime":
|
|
||||||
return "timestamp"
|
|
||||||
if type == "bit":
|
|
||||||
return "bool"
|
|
||||||
if type in ("tinyint", "smallint"):
|
|
||||||
return "int2"
|
|
||||||
if type == "text":
|
|
||||||
return "text"
|
|
||||||
if type in ("blob", "mediumblob"):
|
|
||||||
return "bytea"
|
|
||||||
if type == "decimal":
|
|
||||||
return (
|
|
||||||
f"numeric({','.join(str(s) for s in size)})" if len(size) else "numeric"
|
|
||||||
)
|
|
||||||
|
|
||||||
def gen_create(self, ddl: Dict) -> str:
|
|
||||||
"""生成 create"""
|
|
||||||
|
|
||||||
def _generate_column(col):
|
|
||||||
name = col["name"].lower()
|
|
||||||
if name == "deleted":
|
|
||||||
return "deleted int2 NOT NULL DEFAULT 0"
|
|
||||||
|
|
||||||
type = col["type"].lower()
|
|
||||||
full_type = self.translate_type(type, col["size"])
|
|
||||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
|
||||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
|
||||||
return f"{name} {full_type} {nullable} {default}"
|
|
||||||
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
columns = [f"{_generate_column(col).strip()}" for col in ddl["columns"]]
|
|
||||||
filed_def_list = ",\n ".join(columns)
|
|
||||||
script = f"""-- ----------------------------
|
|
||||||
-- Table structure for {table_name}
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS {table_name};
|
|
||||||
CREATE TABLE {table_name} (
|
|
||||||
{filed_def_list}
|
|
||||||
);"""
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
|
||||||
"""生成字段及表的注释"""
|
|
||||||
|
|
||||||
script = ""
|
|
||||||
for field, comment_string in self.filed_comments(table_sql):
|
|
||||||
script += (
|
|
||||||
f"COMMENT ON COLUMN {table_name}.{field} IS '{comment_string}';" + "\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
table_comment = self.table_comment(table_sql)
|
|
||||||
if table_comment:
|
|
||||||
script += f"COMMENT ON TABLE {table_name} IS '{table_comment}';\n"
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_pk(self, table_name) -> str:
|
|
||||||
"""生成主键定义"""
|
|
||||||
return f"ALTER TABLE {table_name} ADD CONSTRAINT pk_{table_name} PRIMARY KEY (id);\n"
|
|
||||||
|
|
||||||
def gen_insert(self, table_name: str) -> str:
|
|
||||||
"""生成 insert 语句,以及根据最后的 insert id+1 生成 Sequence"""
|
|
||||||
|
|
||||||
inserts = list(Convertor.inserts(table_name, self.content))
|
|
||||||
## 生成 insert 脚本
|
|
||||||
script = ""
|
|
||||||
last_id = 0
|
|
||||||
if inserts:
|
|
||||||
inserts_lines = "\n".join(inserts)
|
|
||||||
script += f"""\n\n-- ----------------------------
|
|
||||||
-- Records of {table_name.lower()}
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
BEGIN;
|
|
||||||
{inserts_lines}
|
|
||||||
COMMIT;
|
|
||||||
-- @formatter:on"""
|
|
||||||
match = re.search(r"VALUES \((\d+),", inserts[-1])
|
|
||||||
if match:
|
|
||||||
last_id = int(match.group(1))
|
|
||||||
|
|
||||||
# 生成 Sequence
|
|
||||||
script += (
|
|
||||||
"\n\n"
|
|
||||||
+ f"""DROP SEQUENCE IF EXISTS {table_name}_seq;
|
|
||||||
CREATE SEQUENCE {table_name}_seq
|
|
||||||
START {last_id + 1};"""
|
|
||||||
)
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_dual(self) -> str:
|
|
||||||
return """DROP TABLE IF EXISTS dual;
|
|
||||||
CREATE TABLE dual
|
|
||||||
(
|
|
||||||
id int2
|
|
||||||
);
|
|
||||||
|
|
||||||
COMMENT ON TABLE dual IS '数据库连接的表';
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of dual
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
INSERT INTO dual VALUES (1);
|
|
||||||
-- @formatter:on"""
|
|
||||||
|
|
||||||
|
|
||||||
class OracleConvertor(Convertor):
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src, "Oracle")
|
|
||||||
|
|
||||||
def translate_type(self, type: str, size: Optional[Union[int, Tuple[int]]]):
|
|
||||||
"""类型转换"""
|
|
||||||
type = type.lower()
|
|
||||||
|
|
||||||
if type == "varchar":
|
|
||||||
return f"varchar2({size if size < 4000 else 4000})"
|
|
||||||
if type == "int":
|
|
||||||
return "number"
|
|
||||||
if type == "bigint" or type == "bigint unsigned":
|
|
||||||
return "number"
|
|
||||||
if type == "datetime":
|
|
||||||
return "date"
|
|
||||||
if type == "bit":
|
|
||||||
return "number(1,0)"
|
|
||||||
if type in ("tinyint", "smallint"):
|
|
||||||
return "smallint"
|
|
||||||
if type == "text":
|
|
||||||
return "clob"
|
|
||||||
if type in ("blob", "mediumblob"):
|
|
||||||
return "blob"
|
|
||||||
if type == "decimal":
|
|
||||||
return (
|
|
||||||
f"number({','.join(str(s) for s in size)})" if len(size) else "number"
|
|
||||||
)
|
|
||||||
|
|
||||||
def gen_create(self, ddl) -> str:
|
|
||||||
"""生成 CREATE 语句"""
|
|
||||||
|
|
||||||
def generate_column(col):
|
|
||||||
name = col["name"].lower()
|
|
||||||
if name == "deleted":
|
|
||||||
return "deleted number(1,0) DEFAULT 0 NOT NULL"
|
|
||||||
|
|
||||||
type = col["type"].lower()
|
|
||||||
full_type = self.translate_type(type, col["size"])
|
|
||||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
|
||||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
|
||||||
# Oracle 中 size 不能作为字段名
|
|
||||||
field_name = '"size"' if name == "size" else name
|
|
||||||
# Oracle DEFAULT 定义在 NULLABLE 之前
|
|
||||||
return f"{field_name} {full_type} {default} {nullable}"
|
|
||||||
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
columns = [f"{generate_column(col).strip()}" for col in ddl["columns"]]
|
|
||||||
field_def_list = ",\n ".join(columns)
|
|
||||||
script = f"""-- ----------------------------
|
|
||||||
-- Table structure for {table_name}
|
|
||||||
-- ----------------------------
|
|
||||||
CREATE TABLE {table_name} (
|
|
||||||
{field_def_list}
|
|
||||||
);"""
|
|
||||||
|
|
||||||
# oracle INSERT '' 不能通过 NOT NULL 校验
|
|
||||||
script = script.replace("DEFAULT '' NOT NULL", "DEFAULT '' NULL")
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
|
||||||
script = ""
|
|
||||||
for field, comment_string in self.filed_comments(table_sql):
|
|
||||||
script += (
|
|
||||||
f"COMMENT ON COLUMN {table_name}.{field} IS '{comment_string}';" + "\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
table_comment = self.table_comment(table_sql)
|
|
||||||
if table_comment:
|
|
||||||
script += f"COMMENT ON TABLE {table_name} IS '{table_comment}';\n"
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_pk(self, table_name: str) -> str:
|
|
||||||
"""生成主键定义"""
|
|
||||||
return f"ALTER TABLE {table_name} ADD CONSTRAINT pk_{table_name} PRIMARY KEY (id);\n"
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_insert(self, table_name: str) -> str:
|
|
||||||
"""拷贝 INSERT 语句"""
|
|
||||||
inserts = []
|
|
||||||
for insert_script in Convertor.inserts(table_name, self.content):
|
|
||||||
# 对日期数据添加 TO_DATE 转换
|
|
||||||
insert_script = re.sub(
|
|
||||||
r"('\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}')",
|
|
||||||
r"to_date(\g<1>, 'SYYYY-MM-DD HH24:MI:SS')",
|
|
||||||
insert_script,
|
|
||||||
)
|
|
||||||
inserts.append(insert_script)
|
|
||||||
|
|
||||||
## 生成 insert 脚本
|
|
||||||
script = ""
|
|
||||||
last_id = 0
|
|
||||||
if inserts:
|
|
||||||
inserts_lines = "\n".join(inserts)
|
|
||||||
script += f"""\n\n-- ----------------------------
|
|
||||||
-- Records of {table_name.lower()}
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
{inserts_lines}
|
|
||||||
COMMIT;
|
|
||||||
-- @formatter:on"""
|
|
||||||
match = re.search(r"VALUES \((\d+),", inserts[-1])
|
|
||||||
if match:
|
|
||||||
last_id = int(match.group(1))
|
|
||||||
|
|
||||||
# 生成 Sequence
|
|
||||||
script += f"""
|
|
||||||
|
|
||||||
CREATE SEQUENCE {table_name}_seq
|
|
||||||
START WITH {last_id + 1};"""
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
|
|
||||||
class SQLServerConvertor(Convertor):
|
|
||||||
"""_summary_
|
|
||||||
|
|
||||||
Args:
|
|
||||||
Convertor (_type_): _description_
|
|
||||||
"""
|
|
||||||
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src, "Microsoft SQL Server")
|
|
||||||
|
|
||||||
def translate_type(self, type: str, size: Optional[Union[int, Tuple[int]]]):
|
|
||||||
"""类型转换"""
|
|
||||||
|
|
||||||
type = type.lower()
|
|
||||||
|
|
||||||
if type == "varchar":
|
|
||||||
return f"nvarchar({size if size < 4000 else 4000})"
|
|
||||||
if type == "int":
|
|
||||||
return "int"
|
|
||||||
if type == "bigint" or type == "bigint unsigned":
|
|
||||||
return "bigint"
|
|
||||||
if type == "datetime":
|
|
||||||
return "datetime2"
|
|
||||||
if type == "bit":
|
|
||||||
return "varchar(1)"
|
|
||||||
if type in ("tinyint", "smallint"):
|
|
||||||
return "tinyint"
|
|
||||||
if type == "text":
|
|
||||||
return "nvarchar(max)"
|
|
||||||
if type in ("blob", "mediumblob"):
|
|
||||||
return "varbinary(max)"
|
|
||||||
if type == "decimal":
|
|
||||||
return (
|
|
||||||
f"numeric({','.join(str(s) for s in size)})" if len(size) else "numeric"
|
|
||||||
)
|
|
||||||
|
|
||||||
def gen_create(self, ddl: Dict) -> str:
|
|
||||||
"""生成 create"""
|
|
||||||
|
|
||||||
def _generate_column(col):
|
|
||||||
name = col["name"].lower()
|
|
||||||
if name == "id":
|
|
||||||
return "id bigint NOT NULL PRIMARY KEY IDENTITY"
|
|
||||||
if name == "deleted":
|
|
||||||
return "deleted bit DEFAULT 0 NOT NULL"
|
|
||||||
|
|
||||||
type = col["type"].lower()
|
|
||||||
full_type = self.translate_type(type, col["size"])
|
|
||||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
|
||||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
|
||||||
return f"{name} {full_type} {default} {nullable}"
|
|
||||||
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
columns = [f"{_generate_column(col).strip()}" for col in ddl["columns"]]
|
|
||||||
filed_def_list = ",\n ".join(columns)
|
|
||||||
script = f"""-- ----------------------------
|
|
||||||
-- Table structure for {table_name}
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS {table_name}
|
|
||||||
GO
|
|
||||||
CREATE TABLE {table_name} (
|
|
||||||
{filed_def_list}
|
|
||||||
)
|
|
||||||
GO"""
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
|
||||||
"""生成字段及表的注释"""
|
|
||||||
|
|
||||||
script = ""
|
|
||||||
|
|
||||||
for field, comment_string in self.filed_comments(table_sql):
|
|
||||||
script += f"""EXEC sp_addextendedproperty
|
|
||||||
'MS_Description', N'{comment_string}',
|
|
||||||
'SCHEMA', N'dbo',
|
|
||||||
'TABLE', N'{table_name}',
|
|
||||||
'COLUMN', N'{field}'
|
|
||||||
GO
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
table_comment = self.table_comment(table_sql)
|
|
||||||
if table_comment:
|
|
||||||
script += f"""EXEC sp_addextendedproperty
|
|
||||||
'MS_Description', N'{table_comment}',
|
|
||||||
'SCHEMA', N'dbo',
|
|
||||||
'TABLE', N'{table_name}'
|
|
||||||
GO
|
|
||||||
|
|
||||||
"""
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_pk(self, table_name: str) -> str:
|
|
||||||
"""生成主键定义"""
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
"""生成 index"""
|
|
||||||
return "\n".join(f"{script}\nGO" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_insert(self, table_name: str) -> str:
|
|
||||||
"""生成 insert 语句"""
|
|
||||||
|
|
||||||
# 收集 `table_name` 对应的 insert 语句
|
|
||||||
inserts = []
|
|
||||||
for insert_script in Convertor.inserts(table_name, self.content):
|
|
||||||
# SQLServer: 字符串前加N,hack,是否存在替换字符串内容的风险
|
|
||||||
insert_script = insert_script.replace(", '", ", N'").replace(
|
|
||||||
"VALUES ('", "VALUES (N')"
|
|
||||||
)
|
|
||||||
# 删除 insert 的结尾分号
|
|
||||||
insert_script = re.sub(";$", r"\nGO", insert_script)
|
|
||||||
inserts.append(insert_script)
|
|
||||||
|
|
||||||
## 生成 insert 脚本
|
|
||||||
script = ""
|
|
||||||
if inserts:
|
|
||||||
inserts_lines = "\n".join(inserts)
|
|
||||||
script += f"""\n\n-- ----------------------------
|
|
||||||
-- Records of {table_name.lower()}
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
BEGIN TRANSACTION
|
|
||||||
GO
|
|
||||||
SET IDENTITY_INSERT {table_name.lower()} ON
|
|
||||||
GO
|
|
||||||
{inserts_lines}
|
|
||||||
SET IDENTITY_INSERT {table_name.lower()} OFF
|
|
||||||
GO
|
|
||||||
COMMIT
|
|
||||||
GO
|
|
||||||
-- @formatter:on"""
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_dual(self) -> str:
|
|
||||||
return """DROP TABLE IF EXISTS dual
|
|
||||||
GO
|
|
||||||
CREATE TABLE dual
|
|
||||||
(
|
|
||||||
id int
|
|
||||||
)
|
|
||||||
GO
|
|
||||||
|
|
||||||
EXEC sp_addextendedproperty
|
|
||||||
'MS_Description', N'数据库连接的表',
|
|
||||||
'SCHEMA', N'dbo',
|
|
||||||
'TABLE', N'dual'
|
|
||||||
GO
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of dual
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
INSERT INTO dual VALUES (1)
|
|
||||||
GO
|
|
||||||
-- @formatter:on"""
|
|
||||||
|
|
||||||
|
|
||||||
class DM8Convertor(Convertor):
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src, "DM8")
|
|
||||||
|
|
||||||
def translate_type(self, type: str, size: Optional[Union[int, Tuple[int]]]):
|
|
||||||
"""类型转换"""
|
|
||||||
type = type.lower()
|
|
||||||
|
|
||||||
if type == "varchar":
|
|
||||||
return f"varchar({size})"
|
|
||||||
if type == "int":
|
|
||||||
return "int"
|
|
||||||
if type == "bigint" or type == "bigint unsigned":
|
|
||||||
return "bigint"
|
|
||||||
if type == "datetime":
|
|
||||||
return "datetime"
|
|
||||||
if type == "bit":
|
|
||||||
return "bit"
|
|
||||||
if type in ("tinyint", "smallint"):
|
|
||||||
return "smallint"
|
|
||||||
if type == "text":
|
|
||||||
return "text"
|
|
||||||
if type == "blob":
|
|
||||||
return "blob"
|
|
||||||
if type == "mediumblob":
|
|
||||||
return "varchar(10240)"
|
|
||||||
if type == "decimal":
|
|
||||||
return (
|
|
||||||
f"decimal({','.join(str(s) for s in size)})" if len(size) else "decimal"
|
|
||||||
)
|
|
||||||
|
|
||||||
def gen_create(self, ddl) -> str:
|
|
||||||
"""生成 CREATE 语句"""
|
|
||||||
|
|
||||||
def generate_column(col):
|
|
||||||
name = col["name"].lower()
|
|
||||||
if name == "id":
|
|
||||||
return "id bigint NOT NULL PRIMARY KEY IDENTITY"
|
|
||||||
|
|
||||||
type = col["type"].lower()
|
|
||||||
full_type = self.translate_type(type, col["size"])
|
|
||||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
|
||||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
|
||||||
return f"{name} {full_type} {default} {nullable}"
|
|
||||||
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
columns = [f"{generate_column(col).strip()}" for col in ddl["columns"]]
|
|
||||||
field_def_list = ",\n ".join(columns)
|
|
||||||
script = f"""-- ----------------------------
|
|
||||||
-- Table structure for {table_name}
|
|
||||||
-- ----------------------------
|
|
||||||
CREATE TABLE {table_name} (
|
|
||||||
{field_def_list}
|
|
||||||
);"""
|
|
||||||
|
|
||||||
# oracle INSERT '' 不能通过 NOT NULL 校验
|
|
||||||
script = script.replace("DEFAULT '' NOT NULL", "DEFAULT '' NULL")
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
|
||||||
script = ""
|
|
||||||
for field, comment_string in self.filed_comments(table_sql):
|
|
||||||
script += (
|
|
||||||
f"COMMENT ON COLUMN {table_name}.{field} IS '{comment_string}';" + "\n"
|
|
||||||
)
|
|
||||||
|
|
||||||
table_comment = self.table_comment(table_sql)
|
|
||||||
if table_comment:
|
|
||||||
script += f"COMMENT ON TABLE {table_name} IS '{table_comment}';\n"
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
def gen_pk(self, table_name: str) -> str:
|
|
||||||
"""生成主键定义"""
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def gen_index(self, ddl: Dict) -> str:
|
|
||||||
return "\n".join(f"{script};" for script in self.index(ddl))
|
|
||||||
|
|
||||||
def gen_insert(self, table_name: str) -> str:
|
|
||||||
"""拷贝 INSERT 语句"""
|
|
||||||
inserts = list(Convertor.inserts(table_name, self.content))
|
|
||||||
|
|
||||||
## 生成 insert 脚本
|
|
||||||
script = ""
|
|
||||||
if inserts:
|
|
||||||
inserts_lines = "\n".join(inserts)
|
|
||||||
script += f"""\n\n-- ----------------------------
|
|
||||||
-- Records of {table_name.lower()}
|
|
||||||
-- ----------------------------
|
|
||||||
-- @formatter:off
|
|
||||||
SET IDENTITY_INSERT {table_name.lower()} ON;
|
|
||||||
{inserts_lines}
|
|
||||||
COMMIT;
|
|
||||||
SET IDENTITY_INSERT {table_name.lower()} OFF;
|
|
||||||
-- @formatter:on"""
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
|
|
||||||
class KingbaseConvertor(PostgreSQLConvertor):
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src)
|
|
||||||
self.db_type = "Kingbase"
|
|
||||||
|
|
||||||
def gen_create(self, ddl: Dict) -> str:
|
|
||||||
"""生成 create"""
|
|
||||||
|
|
||||||
def _generate_column(col):
|
|
||||||
name = col["name"].lower()
|
|
||||||
if name == "deleted":
|
|
||||||
return "deleted int2 NOT NULL DEFAULT 0"
|
|
||||||
|
|
||||||
type = col["type"].lower()
|
|
||||||
full_type = self.translate_type(type, col["size"])
|
|
||||||
nullable = "NULL" if col["nullable"] else "NOT NULL"
|
|
||||||
default = f"DEFAULT {col['default']}" if col["default"] is not None else ""
|
|
||||||
return f"{name} {full_type} {nullable} {default}"
|
|
||||||
|
|
||||||
table_name = ddl["table_name"].lower()
|
|
||||||
columns = [f"{_generate_column(col).strip()}" for col in ddl["columns"]]
|
|
||||||
filed_def_list = ",\n ".join(columns)
|
|
||||||
script = f"""-- ----------------------------
|
|
||||||
-- Table structure for {table_name}
|
|
||||||
-- ----------------------------
|
|
||||||
DROP TABLE IF EXISTS {table_name};
|
|
||||||
CREATE TABLE {table_name} (
|
|
||||||
{filed_def_list}
|
|
||||||
);"""
|
|
||||||
|
|
||||||
# Kingbase INSERT '' 不能通过 NOT NULL 校验
|
|
||||||
script = script.replace("NOT NULL DEFAULT ''", "NULL DEFAULT ''")
|
|
||||||
|
|
||||||
return script
|
|
||||||
|
|
||||||
|
|
||||||
class OpengaussConvertor(KingbaseConvertor):
|
|
||||||
def __init__(self, src):
|
|
||||||
super().__init__(src)
|
|
||||||
self.db_type = "OpenGauss"
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
parser = argparse.ArgumentParser(description="芋道系统数据库转换工具")
|
|
||||||
parser.add_argument(
|
|
||||||
"type",
|
|
||||||
type=str,
|
|
||||||
help="目标数据库类型",
|
|
||||||
choices=["postgres", "oracle", "sqlserver", "dm8", "kingbase", "opengauss"],
|
|
||||||
)
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
sql_file = pathlib.Path("../mysql/ruoyi-vue-pro.sql").resolve().as_posix()
|
|
||||||
convertor = None
|
|
||||||
if args.type == "postgres":
|
|
||||||
convertor = PostgreSQLConvertor(sql_file)
|
|
||||||
elif args.type == "oracle":
|
|
||||||
convertor = OracleConvertor(sql_file)
|
|
||||||
elif args.type == "sqlserver":
|
|
||||||
convertor = SQLServerConvertor(sql_file)
|
|
||||||
elif args.type == "dm8":
|
|
||||||
convertor = DM8Convertor(sql_file)
|
|
||||||
elif args.type == "kingbase":
|
|
||||||
convertor = KingbaseConvertor(sql_file)
|
|
||||||
elif args.type == "opengauss":
|
|
||||||
convertor = OpengaussConvertor(sql_file)
|
|
||||||
else:
|
|
||||||
raise NotImplementedError(f"不支持目标数据库类型: {args.type}")
|
|
||||||
|
|
||||||
convertor.print()
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
||||||
@@ -1,134 +0,0 @@
|
|||||||
name: ruoyi-vue-pro
|
|
||||||
|
|
||||||
volumes:
|
|
||||||
mysql: { }
|
|
||||||
postgres: { }
|
|
||||||
sqlserver: { }
|
|
||||||
dm8: { }
|
|
||||||
kingbase: { }
|
|
||||||
opengauss: { }
|
|
||||||
|
|
||||||
services:
|
|
||||||
mysql:
|
|
||||||
image: mysql:8.0.33
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
TZ: Asia/Shanghai
|
|
||||||
MYSQL_ROOT_PASSWORD: 123456
|
|
||||||
MYSQL_DATABASE: ruoyi-vue-pro
|
|
||||||
ports:
|
|
||||||
- "3306:3306"
|
|
||||||
volumes:
|
|
||||||
- mysql:/var/lib/mysql/
|
|
||||||
# 注入初始化脚本
|
|
||||||
- ./mysql/ruoyi-vue-pro.sql:/docker-entrypoint-initdb.d/init.sql:ro
|
|
||||||
command:
|
|
||||||
--default-authentication-plugin=mysql_native_password
|
|
||||||
--character-set-server=utf8mb4
|
|
||||||
--collation-server=utf8mb4_general_ci
|
|
||||||
--explicit_defaults_for_timestamp=true
|
|
||||||
--lower_case_table_names=1
|
|
||||||
|
|
||||||
postgres:
|
|
||||||
image: postgres:14.2
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
POSTGRES_USER: root
|
|
||||||
POSTGRES_PASSWORD: 123456
|
|
||||||
POSTGRES_DB: ruoyi-vue-pro
|
|
||||||
ports:
|
|
||||||
- "5432:5432"
|
|
||||||
volumes:
|
|
||||||
- postgres:/var/lib/postgresql/data
|
|
||||||
# 注入初始化脚本
|
|
||||||
- ../postgresql/quartz.sql:/docker-entrypoint-initdb.d/quartz.sql:ro
|
|
||||||
- ../postgresql/ruoyi-vue-pro.sql:/docker-entrypoint-initdb.d/ruoyi-vue-pro.sql:ro
|
|
||||||
|
|
||||||
oracle:
|
|
||||||
image: gvenzl/oracle-xe:18-slim-faststart
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
## 登录信息 SID: XE user: system password: oracle
|
|
||||||
ORACLE_PASSWORD: oracle
|
|
||||||
ports:
|
|
||||||
- "1521:1521"
|
|
||||||
volumes:
|
|
||||||
- ../oracle/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
|
||||||
# 创建app用户: ROOT/123456@//localhost/XEPDB1
|
|
||||||
- ./oracle/1_create_user.sql:/docker-entrypoint-initdb.d/1_create_user.sql:ro
|
|
||||||
- ./oracle/2_create_schema.sh:/docker-entrypoint-initdb.d/2_create_schema.sh:ro
|
|
||||||
|
|
||||||
oracle_m1:
|
|
||||||
image: einslib/oracle-19c:19.3.0-ee-slim-faststart
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
## 登录信息 SID: FREE user: system password: oracle
|
|
||||||
ORACLE_PASSWORD: oracle
|
|
||||||
ports:
|
|
||||||
- "1521:1521"
|
|
||||||
volumes:
|
|
||||||
- ../oracle/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
|
||||||
# 创建app用户: ROOT/123456@//localhost/XEPDB1
|
|
||||||
- ./oracle/1_create_user.sql:/docker-entrypoint-initdb.d/1_create_user.sql:ro
|
|
||||||
- ./oracle/2_create_schema.sh:/docker-entrypoint-initdb.d/2_create_schema.sh:ro
|
|
||||||
|
|
||||||
sqlserver:
|
|
||||||
image: mcr.microsoft.com/mssql/server:2017-latest
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
TZ: Asia/Shanghai
|
|
||||||
ACCEPT_EULA: "Y"
|
|
||||||
SA_PASSWORD: "Yudao@2024"
|
|
||||||
ports:
|
|
||||||
- "1433:1433"
|
|
||||||
volumes:
|
|
||||||
- sqlserver:/var/opt/mssql
|
|
||||||
- ../sqlserver/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
|
||||||
# docker compose exec sqlserver bash /tmp/create_schema.sh
|
|
||||||
- ./sqlserver/create_schema.sh:/tmp/create_schema.sh:ro
|
|
||||||
|
|
||||||
dm8:
|
|
||||||
# docker load -i dm8_20240715_x86_rh6_rq_single.tar
|
|
||||||
image: dm8_single:dm8_20240715_rev232765_x86_rh6_64
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
PAGE_SIZE: 16
|
|
||||||
LD_LIBRARY_PATH: /opt/dmdbms/bin
|
|
||||||
EXTENT_SIZE: 32
|
|
||||||
BLANK_PAD_MODE: 1
|
|
||||||
LOG_SIZE: 1024
|
|
||||||
UNICODE_FLAG: 1
|
|
||||||
LENGTH_IN_CHAR: 1
|
|
||||||
INSTANCE_NAME: dm8_test
|
|
||||||
ports:
|
|
||||||
- "5236:5236"
|
|
||||||
volumes:
|
|
||||||
- dm8:/opt/dmdbms/data
|
|
||||||
- ../dm/ruoyi-vue-pro-dm8.sql:/tmp/schema.sql:ro
|
|
||||||
|
|
||||||
kingbase:
|
|
||||||
image: kingbase_v009r001c001b0025_single_x86:v1
|
|
||||||
# image: kingbase_v009r001c001b0025_single_arm:v1
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
DB_USER: root
|
|
||||||
DB_PASSWORD: 123456
|
|
||||||
ports:
|
|
||||||
- "54321:54321"
|
|
||||||
volumes:
|
|
||||||
- kingbase:/home/kingbase/userdata
|
|
||||||
- ../kingbase/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
|
||||||
|
|
||||||
opengauss:
|
|
||||||
image: opengauss/opengauss:5.0.0
|
|
||||||
restart: unless-stopped
|
|
||||||
environment:
|
|
||||||
GS_USERNAME: root
|
|
||||||
GS_PASSWORD: Yudao@2024
|
|
||||||
LD_LIBRARY_PATH: /usr/local/opengauss/lib:/usr/lib
|
|
||||||
ports:
|
|
||||||
- "5432:5432"
|
|
||||||
volumes:
|
|
||||||
- opengauss:/var/lib/opengauss
|
|
||||||
- ../opengauss/ruoyi-vue-pro.sql:/tmp/schema.sql:ro
|
|
||||||
# docker compose exec opengauss bash -c '/usr/local/opengauss/bin/gsql -U $GS_USERNAME -W $GS_PASSWORD -d postgres -f /tmp/schema.sql'
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
ALTER SESSION SET CONTAINER=XEPDB1;
|
|
||||||
CREATE USER ROOT IDENTIFIED BY 123456 QUOTA UNLIMITED ON USERS;
|
|
||||||
GRANT CONNECT, RESOURCE TO ROOT;
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
sqlplus -s ROOT/123456@//localhost/XEPDB1 @/tmp/schema.sql
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${SA_PASSWORD} -Q "CREATE DATABASE [ruoyi-vue-pro];
|
|
||||||
GO"
|
|
||||||
/opt/mssql-tools/bin/sqlcmd -S localhost -U sa -P ${SA_PASSWORD} -d 'ruoyi-vue-pro' -i /tmp/schema.sql
|
|
||||||
@@ -34,6 +34,8 @@
|
|||||||
<rocketmq-spring.version>2.3.1</rocketmq-spring.version>
|
<rocketmq-spring.version>2.3.1</rocketmq-spring.version>
|
||||||
<!-- RPC 相关 -->
|
<!-- RPC 相关 -->
|
||||||
<!-- Config 配置中心相关 -->
|
<!-- Config 配置中心相关 -->
|
||||||
|
<springdoc.version>2.7.0</springdoc.version>
|
||||||
|
<knife4j.version>4.6.0</knife4j.version>
|
||||||
<!-- Job 定时任务相关 -->
|
<!-- Job 定时任务相关 -->
|
||||||
<xxl-job.version>2.4.0</xxl-job.version>
|
<xxl-job.version>2.4.0</xxl-job.version>
|
||||||
<!-- 服务保障相关 -->
|
<!-- 服务保障相关 -->
|
||||||
@@ -150,6 +152,62 @@
|
|||||||
<artifactId>tashow-data-permission</artifactId>
|
<artifactId>tashow-data-permission</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-sdk-file</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-trade-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-module-file</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-file-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-module-trade</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-pay-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-sdk-payment</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-user-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-module-pay</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-sdk-payment</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-product-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring 核心 -->
|
<!-- Spring 核心 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -397,6 +455,22 @@
|
|||||||
<version>${spring-boot-admin.version}</version>
|
<version>${spring-boot-admin.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xingfudeshi</groupId> <!-- TODO 芋艿:https://github.com/xiaoymin/knife4j/issues/874 -->
|
||||||
|
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
|
||||||
|
<version>${knife4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springdoc</groupId>
|
||||||
|
<artifactId>springdoc-openapi-starter-webmvc-api</artifactId>
|
||||||
|
<version>${springdoc.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.xiaoymin</groupId> <!-- 接口文档 UI:knife4j【网关专属】 -->
|
||||||
|
<artifactId>knife4j-gateway-spring-boot-starter</artifactId>
|
||||||
|
<version>4.5.0</version> <!-- TODO 芋艿:等 4.5.0 => 4.6.0 -->
|
||||||
|
</dependency>
|
||||||
<!-- Test 测试相关 -->
|
<!-- Test 测试相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.mockito</groupId>
|
<groupId>org.mockito</groupId>
|
||||||
|
|||||||
@@ -14,6 +14,10 @@
|
|||||||
<module>tashow-infra-api</module>
|
<module>tashow-infra-api</module>
|
||||||
<module>tashow-system-api</module>
|
<module>tashow-system-api</module>
|
||||||
<module>tashow-product-api</module>
|
<module>tashow-product-api</module>
|
||||||
|
<module>tashow-trade-api</module>
|
||||||
|
<module>tashow-pay-api</module>
|
||||||
|
<module>tashow-user-api</module>
|
||||||
|
<module>tashow-file-api</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
40
tashow-feign/tashow-file-api/pom.xml
Normal file
40
tashow-feign/tashow-file-api/pom.xml
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-feign</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<artifactId>tashow-file-api</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
infra 模块 API,暴露给其它模块调用
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 参数校验 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RPC 远程调用相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.tashow.cloud.fileapi.api.config;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.fileapi.enums.ApiConstants;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
/** RPC 服务 - 参数配置 */
|
||||||
|
public interface ConfigApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/config";
|
||||||
|
|
||||||
|
/** 根据参数键查询参数值 */
|
||||||
|
@GetMapping(PREFIX + "/get-value-by-key")
|
||||||
|
CommonResult<String> getConfigValueByKey(@RequestParam("key") String key);
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.tashow.cloud.fileapi.api.file;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.fileapi.api.file.dto.FileCreateReqDTO;
|
||||||
|
import com.tashow.cloud.fileapi.enums.ApiConstants;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RPC 服务 - 文件
|
||||||
|
*/
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
public interface FileApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/file";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存文件,并返回文件的访问路径
|
||||||
|
*
|
||||||
|
* @param content 文件内容
|
||||||
|
* @return 文件路径
|
||||||
|
*/
|
||||||
|
default String createFile(byte[] content) {
|
||||||
|
return createFile(null, null, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存文件,并返回文件的访问路径
|
||||||
|
*
|
||||||
|
* @param path 文件路径
|
||||||
|
* @param content 文件内容
|
||||||
|
* @return 文件路径
|
||||||
|
*/
|
||||||
|
default String createFile(String path, byte[] content) {
|
||||||
|
return createFile(null, path, content);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存文件,并返回文件的访问路径
|
||||||
|
*
|
||||||
|
* @param name 原文件名称
|
||||||
|
* @param path 文件路径
|
||||||
|
* @param content 文件内容
|
||||||
|
* @return 文件路径
|
||||||
|
*/
|
||||||
|
default String createFile(
|
||||||
|
@RequestParam("name") String name,
|
||||||
|
@RequestParam("path") String path,
|
||||||
|
@RequestParam("content") byte[] content) {
|
||||||
|
return createFile(new FileCreateReqDTO().setName(name).setPath(path).setContent(content))
|
||||||
|
.getCheckedData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存文件,并返回文件的访问路径
|
||||||
|
*/
|
||||||
|
@PostMapping(PREFIX + "/create")
|
||||||
|
CommonResult<String> createFile(@Valid @RequestBody FileCreateReqDTO createReqDTO);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.tashow.cloud.fileapi.api.file.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/** RPC 服务 - 文件创建 Request DTO */
|
||||||
|
@Data
|
||||||
|
public class FileCreateReqDTO {
|
||||||
|
|
||||||
|
/** 原文件名称 */
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/** 文件路径 */
|
||||||
|
private String path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件内容
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "文件内容不能为空")
|
||||||
|
private byte[] content;
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* infra API 包,定义暴露给其它模块的 API
|
||||||
|
*/
|
||||||
|
package com.tashow.cloud.fileapi.api;
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.tashow.cloud.fileapi.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.enums.RpcConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 相关的枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public class ApiConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务名
|
||||||
|
*
|
||||||
|
* 注意,需要保证和 spring.application.name 保持一致
|
||||||
|
*/
|
||||||
|
public static final String NAME = "file-server";
|
||||||
|
|
||||||
|
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/file";
|
||||||
|
|
||||||
|
public static final String VERSION = "1.0.0";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
package com.tashow.cloud.fileapi.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.exception.ErrorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Infra 错误码枚举类
|
||||||
|
*
|
||||||
|
* infra 系统,使用 1-001-000-000 段
|
||||||
|
*/
|
||||||
|
public interface ErrorCodeConstants {
|
||||||
|
|
||||||
|
// ========== 参数配置 1-001-000-000 ==========
|
||||||
|
ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1_001_000_001, "参数配置不存在");
|
||||||
|
ErrorCode CONFIG_KEY_DUPLICATE = new ErrorCode(1_001_000_002, "参数配置 key 重复");
|
||||||
|
ErrorCode CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE = new ErrorCode(1_001_000_003, "不能删除类型为系统内置的参数配置");
|
||||||
|
ErrorCode CONFIG_GET_VALUE_ERROR_IF_VISIBLE = new ErrorCode(1_001_000_004, "获取参数配置失败,原因:不允许获取不可见配置");
|
||||||
|
|
||||||
|
// ========== 定时任务 1-001-001-000 ==========
|
||||||
|
ErrorCode JOB_NOT_EXISTS = new ErrorCode(1_001_001_000, "定时任务不存在");
|
||||||
|
ErrorCode JOB_HANDLER_EXISTS = new ErrorCode(1_001_001_001, "定时任务的处理器已经存在");
|
||||||
|
ErrorCode JOB_CHANGE_STATUS_INVALID = new ErrorCode(1_001_001_002, "只允许修改为开启或者关闭状态");
|
||||||
|
ErrorCode JOB_CHANGE_STATUS_EQUALS = new ErrorCode(1_001_001_003, "定时任务已经处于该状态,无需修改");
|
||||||
|
ErrorCode JOB_UPDATE_ONLY_NORMAL_STATUS = new ErrorCode(1_001_001_004, "只有开启状态的任务,才可以修改");
|
||||||
|
ErrorCode JOB_CRON_EXPRESSION_VALID = new ErrorCode(1_001_001_005, "CRON 表达式不正确");
|
||||||
|
ErrorCode JOB_HANDLER_BEAN_NOT_EXISTS = new ErrorCode(1_001_001_006, "定时任务的处理器 Bean 不存在,注意 Bean 默认首字母小写");
|
||||||
|
ErrorCode JOB_HANDLER_BEAN_TYPE_ERROR = new ErrorCode(1_001_001_007, "定时任务的处理器 Bean 类型不正确,未实现 JobHandler 接口");
|
||||||
|
|
||||||
|
// ========== API 错误日志 1-001-002-000 ==========
|
||||||
|
ErrorCode API_ERROR_LOG_NOT_FOUND = new ErrorCode(1_001_002_000, "API 错误日志不存在");
|
||||||
|
ErrorCode API_ERROR_LOG_PROCESSED = new ErrorCode(1_001_002_001, "API 错误日志已处理");
|
||||||
|
|
||||||
|
// ========= 文件相关 1-001-003-000 =================
|
||||||
|
ErrorCode FILE_PATH_EXISTS = new ErrorCode(1_001_003_000, "文件路径已存在");
|
||||||
|
ErrorCode FILE_NOT_EXISTS = new ErrorCode(1_001_003_001, "文件不存在");
|
||||||
|
ErrorCode FILE_IS_EMPTY = new ErrorCode(1_001_003_002, "文件为空");
|
||||||
|
|
||||||
|
// ========== 代码生成器 1-001-004-000 ==========
|
||||||
|
ErrorCode CODEGEN_TABLE_EXISTS = new ErrorCode(1_001_004_002, "表定义已经存在");
|
||||||
|
ErrorCode CODEGEN_IMPORT_TABLE_NULL = new ErrorCode(1_001_004_001, "导入的表不存在");
|
||||||
|
ErrorCode CODEGEN_IMPORT_COLUMNS_NULL = new ErrorCode(1_001_004_002, "导入的字段不存在");
|
||||||
|
ErrorCode CODEGEN_TABLE_NOT_EXISTS = new ErrorCode(1_001_004_004, "表定义不存在");
|
||||||
|
ErrorCode CODEGEN_COLUMN_NOT_EXISTS = new ErrorCode(1_001_004_005, "字段义不存在");
|
||||||
|
ErrorCode CODEGEN_SYNC_COLUMNS_NULL = new ErrorCode(1_001_004_006, "同步的字段不存在");
|
||||||
|
ErrorCode CODEGEN_SYNC_NONE_CHANGE = new ErrorCode(1_001_004_007, "同步失败,不存在改变");
|
||||||
|
ErrorCode CODEGEN_TABLE_INFO_TABLE_COMMENT_IS_NULL = new ErrorCode(1_001_004_008, "数据库的表注释未填写");
|
||||||
|
ErrorCode CODEGEN_TABLE_INFO_COLUMN_COMMENT_IS_NULL = new ErrorCode(1_001_004_009, "数据库的表字段({})注释未填写");
|
||||||
|
ErrorCode CODEGEN_MASTER_TABLE_NOT_EXISTS = new ErrorCode(1_001_004_010, "主表(id={})定义不存在,请检查");
|
||||||
|
ErrorCode CODEGEN_SUB_COLUMN_NOT_EXISTS = new ErrorCode(1_001_004_011, "子表的字段(id={})不存在,请检查");
|
||||||
|
ErrorCode CODEGEN_MASTER_GENERATION_FAIL_NO_SUB_TABLE = new ErrorCode(1_001_004_012, "主表生成代码失败,原因:它没有子表");
|
||||||
|
|
||||||
|
// ========== 文件配置 1-001-006-000 ==========
|
||||||
|
ErrorCode FILE_CONFIG_NOT_EXISTS = new ErrorCode(1_001_006_000, "文件配置不存在");
|
||||||
|
ErrorCode FILE_CONFIG_DELETE_FAIL_MASTER = new ErrorCode(1_001_006_001, "该文件配置不允许删除,原因:它是主配置,删除会导致无法上传文件");
|
||||||
|
|
||||||
|
// ========== 数据源配置 1-001-007-000 ==========
|
||||||
|
ErrorCode DATA_SOURCE_CONFIG_NOT_EXISTS = new ErrorCode(1_001_007_000, "数据源配置不存在");
|
||||||
|
ErrorCode DATA_SOURCE_CONFIG_NOT_OK = new ErrorCode(1_001_007_001, "数据源配置不正确,无法进行连接");
|
||||||
|
|
||||||
|
// ========== 学生 1-001-201-000 ==========
|
||||||
|
ErrorCode DEMO01_CONTACT_NOT_EXISTS = new ErrorCode(1_001_201_000, "示例联系人不存在");
|
||||||
|
ErrorCode DEMO02_CATEGORY_NOT_EXISTS = new ErrorCode(1_001_201_001, "示例分类不存在");
|
||||||
|
ErrorCode DEMO02_CATEGORY_EXITS_CHILDREN = new ErrorCode(1_001_201_002, "存在存在子示例分类,无法删除");
|
||||||
|
ErrorCode DEMO02_CATEGORY_PARENT_NOT_EXITS = new ErrorCode(1_001_201_003,"父级示例分类不存在");
|
||||||
|
ErrorCode DEMO02_CATEGORY_PARENT_ERROR = new ErrorCode(1_001_201_004, "不能设置自己为父示例分类");
|
||||||
|
ErrorCode DEMO02_CATEGORY_NAME_DUPLICATE = new ErrorCode(1_001_201_005, "已经存在该名字的示例分类");
|
||||||
|
ErrorCode DEMO02_CATEGORY_PARENT_IS_CHILD = new ErrorCode(1_001_201_006, "不能设置自己的子示例分类为父示例分类");
|
||||||
|
ErrorCode DEMO03_STUDENT_NOT_EXISTS = new ErrorCode(1_001_201_007, "学生不存在");
|
||||||
|
ErrorCode DEMO03_GRADE_NOT_EXISTS = new ErrorCode(1_001_201_008, "学生班级不存在");
|
||||||
|
ErrorCode DEMO03_GRADE_EXISTS = new ErrorCode(1_001_201_009, "学生班级已存在");
|
||||||
|
|
||||||
|
}
|
||||||
@@ -9,8 +9,10 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RPC 服务 - 文件
|
||||||
|
*/
|
||||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
/** RPC 服务 - 文件 */
|
|
||||||
public interface FileApi {
|
public interface FileApi {
|
||||||
|
|
||||||
String PREFIX = ApiConstants.PREFIX + "/file";
|
String PREFIX = ApiConstants.PREFIX + "/file";
|
||||||
@@ -52,7 +54,9 @@ public interface FileApi {
|
|||||||
.getCheckedData();
|
.getCheckedData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存文件,并返回文件的访问路径
|
||||||
|
*/
|
||||||
@PostMapping(PREFIX + "/create")
|
@PostMapping(PREFIX + "/create")
|
||||||
/** 保存文件,并返回文件的访问路径 */
|
|
||||||
CommonResult<String> createFile(@Valid @RequestBody FileCreateReqDTO createReqDTO);
|
CommonResult<String> createFile(@Valid @RequestBody FileCreateReqDTO createReqDTO);
|
||||||
}
|
}
|
||||||
|
|||||||
44
tashow-feign/tashow-pay-api/pom.xml
Normal file
44
tashow-feign/tashow-pay-api/pom.xml
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-feign</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>tashow-pay-api</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
pay 模块 API,暴露给其它模块调用
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 参数校验 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-validation</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RPC 远程调用相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||||
|
<optional>true</optional>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-sdk-payment</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.notify.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付单的通知 Request DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PayOrderNotifyReqDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户订单编号
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "商户订单号不能为空")
|
||||||
|
private String merchantOrderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付订单编号
|
||||||
|
*/
|
||||||
|
@NotNull(message = "支付订单编号不能为空")
|
||||||
|
private Long payOrderId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.notify.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款单的通知 Request DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class PayRefundNotifyReqDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户退款单编号
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "商户退款单编号不能为空")
|
||||||
|
private String merchantOrderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付退款编号
|
||||||
|
*/
|
||||||
|
@NotNull(message = "支付退款编号不能为空")
|
||||||
|
private Long payRefundId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.notify.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账单的通知 Request DTO
|
||||||
|
*
|
||||||
|
* @author jason
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PayTransferNotifyReqDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户转账单号
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "商户转账单号不能为空")
|
||||||
|
private String merchantTransferId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账订单编号
|
||||||
|
*/
|
||||||
|
@NotNull(message = "转账订单编号不能为空")
|
||||||
|
private Long payTransferId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.order;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.payapi.api.order.dto.PayOrderCreateReqDTO;
|
||||||
|
import com.tashow.cloud.payapi.enums.ApiConstants;
|
||||||
|
import com.tashow.cloud.sdk.payment.dto.order.PayOrderRespDTO;
|
||||||
|
import jakarta.annotation.security.PermitAll;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RPC 服务 - 支付单
|
||||||
|
*/
|
||||||
|
@FeignClient(name = ApiConstants.NAME) //
|
||||||
|
public interface PayOrderApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/order";
|
||||||
|
|
||||||
|
/*创建支付单*/
|
||||||
|
@PostMapping(PREFIX + "/create")
|
||||||
|
CommonResult<Long> createOrder(@Valid @RequestBody PayOrderCreateReqDTO reqDTO);
|
||||||
|
|
||||||
|
/*获得支付单*/
|
||||||
|
@GetMapping(PREFIX + "/get")
|
||||||
|
@PermitAll
|
||||||
|
CommonResult<PayOrderRespDTO> getOrder(@RequestParam("id") Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新支付订单价格
|
||||||
|
* @param id 支付单编号
|
||||||
|
* @param payPrice 支付单价格
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PutMapping(PREFIX + "/update-price")
|
||||||
|
CommonResult<Boolean> updatePayOrderPrice(@RequestParam("id") Long id ,//支付单编号
|
||||||
|
@RequestParam("payPrice") Integer payPrice);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.order.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.DecimalMin;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付单创建 Request DTO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PayOrderCreateReqDTO implements Serializable {
|
||||||
|
|
||||||
|
public static final int SUBJECT_MAX_LENGTH = 32;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用标识
|
||||||
|
*/
|
||||||
|
@NotNull(message = "应用标识不能为空")
|
||||||
|
private String appKey;
|
||||||
|
/**
|
||||||
|
* 用户 IP
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "用户 IP 不能为空")
|
||||||
|
private String userIp;
|
||||||
|
|
||||||
|
// ========== 商户相关字段 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户订单编号
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "商户订单编号不能为空")
|
||||||
|
private String merchantOrderId;
|
||||||
|
/**
|
||||||
|
* 商品标题
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "商品标题不能为空")
|
||||||
|
@Length(max = SUBJECT_MAX_LENGTH, message = "商品标题不能超过 32")
|
||||||
|
private String subject;
|
||||||
|
/**
|
||||||
|
* 商品描述
|
||||||
|
*/
|
||||||
|
@Length(max = 128, message = "商品描述信息长度不能超过128")
|
||||||
|
private String body;
|
||||||
|
|
||||||
|
// ========== 订单相关字段 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付金额,单位:分
|
||||||
|
*/
|
||||||
|
@NotNull(message = "支付金额不能为空")
|
||||||
|
@DecimalMin(value = "0", inclusive = false, message = "支付金额必须大于零")
|
||||||
|
private Integer price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付过期时间
|
||||||
|
*/
|
||||||
|
@NotNull(message = "支付过期时间不能为空")
|
||||||
|
private LocalDateTime expireTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.order.dto;
|
||||||
|
|
||||||
|
import com.tashow.cloud.payapi.enums.order.PayOrderStatusEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付单信息 Response DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PayOrderRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单编号,数据库自增
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 渠道编码
|
||||||
|
*
|
||||||
|
* 枚举 PayChannelEnum
|
||||||
|
*/
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
// ========== 商户相关字段 ==========
|
||||||
|
/**
|
||||||
|
* 商户订单编号
|
||||||
|
* 例如说,内部系统 A 的订单号。需要保证每个 PayMerchantDO 唯一
|
||||||
|
*/
|
||||||
|
private String merchantOrderId;
|
||||||
|
|
||||||
|
// ========== 订单相关字段 ==========
|
||||||
|
/**
|
||||||
|
* 支付金额,单位:分
|
||||||
|
*/
|
||||||
|
private Integer price;
|
||||||
|
/**
|
||||||
|
* 支付状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link PayOrderStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
// ========== 渠道相关字段 ==========
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.refund;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.payapi.api.refund.dto.PayRefundCreateReqDTO;
|
||||||
|
import com.tashow.cloud.payapi.api.refund.dto.PayRefundRespDTO;
|
||||||
|
import com.tashow.cloud.payapi.enums.ApiConstants;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RPC 服务 - 退款单
|
||||||
|
*/
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
public interface PayRefundApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/refund";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建退款单
|
||||||
|
* @param reqDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(PREFIX + "/create")
|
||||||
|
CommonResult<Long> createRefund(@Valid @RequestBody PayRefundCreateReqDTO reqDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得退款单
|
||||||
|
* @param id 退款单编号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(PREFIX + "/get")
|
||||||
|
CommonResult<PayRefundRespDTO> getRefund(@RequestParam("id") Long id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.refund.dto;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.hibernate.validator.constraints.Length;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款单创建 Request DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PayRefundCreateReqDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用标识
|
||||||
|
*/
|
||||||
|
@NotNull(message = "应用标识不能为空")
|
||||||
|
private String appKey;
|
||||||
|
/**
|
||||||
|
* 用户 IP
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "用户 IP 不能为空")
|
||||||
|
private String userIp;
|
||||||
|
|
||||||
|
// ========== 商户相关字段 ==========
|
||||||
|
/**
|
||||||
|
* 商户订单编号
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "商户订单编号不能为空")
|
||||||
|
private String merchantOrderId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户退款编号
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "商户退款编号不能为空")
|
||||||
|
private String merchantRefundId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款描述
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "退款描述不能为空")
|
||||||
|
@Length(max = 128, message = "退款描述长度不能超过 128")
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
// ========== 订单相关字段 ==========
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款金额,单位:分
|
||||||
|
*/
|
||||||
|
@NotNull(message = "退款金额不能为空")
|
||||||
|
@Min(value = 1, message = "退款金额必须大于零")
|
||||||
|
private Integer price;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.refund.dto;
|
||||||
|
|
||||||
|
import com.tashow.cloud.payapi.enums.refund.PayRefundStatusEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款单信息 Response DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PayRefundRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 退款单编号
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
// ========== 退款相关字段 ==========
|
||||||
|
/**
|
||||||
|
* 退款状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link PayRefundStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 退款金额,单位:分
|
||||||
|
*/
|
||||||
|
private Integer refundPrice;
|
||||||
|
|
||||||
|
// ========== 商户相关字段 ==========
|
||||||
|
/**
|
||||||
|
* 商户订单编号
|
||||||
|
*/
|
||||||
|
private String merchantOrderId;
|
||||||
|
/**
|
||||||
|
* 退款成功时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime successTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.transfer;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.payapi.api.transfer.dto.PayTransferCreateReqDTO;
|
||||||
|
import com.tashow.cloud.payapi.enums.ApiConstants;
|
||||||
|
import com.tashow.cloud.sdk.payment.dto.transfer.PayTransferRespDTO;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RPC 服务 - 转账单
|
||||||
|
*/
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
public interface PayTransferApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/transfer";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建转账单
|
||||||
|
* @param reqDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(PREFIX + "/create")
|
||||||
|
CommonResult<Long> createTransfer(@Valid @RequestBody PayTransferCreateReqDTO reqDTO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得转账单
|
||||||
|
* @param id 转账单编号
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(PREFIX + "/get")
|
||||||
|
CommonResult<PayTransferRespDTO> getTransfer(@RequestParam("id") Long id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.transfer.dto;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.validation.InEnum;
|
||||||
|
import com.tashow.cloud.sdk.payment.enums.transfer.PayTransferTypeEnum;
|
||||||
|
import jakarta.validation.constraints.Min;
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账单创建 Request DTO
|
||||||
|
*
|
||||||
|
* @author jason
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PayTransferCreateReqDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 应用标识
|
||||||
|
*/
|
||||||
|
@NotNull(message = "应用标识不能为空")
|
||||||
|
private String appKey;
|
||||||
|
|
||||||
|
@NotEmpty(message = "转账渠道不能为空")
|
||||||
|
private String channelCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账渠道的额外参数
|
||||||
|
*/
|
||||||
|
private Map<String, String> channelExtras;
|
||||||
|
|
||||||
|
@NotEmpty(message = "用户 IP 不能为空")
|
||||||
|
private String userIp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
@NotNull(message = "转账类型不能为空")
|
||||||
|
@InEnum(PayTransferTypeEnum.class)
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商户转账单编号
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "商户转账单编号能为空")
|
||||||
|
private String merchantTransferId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账金额,单位:分
|
||||||
|
*/
|
||||||
|
@Min(value = 1, message = "转账金额必须大于零")
|
||||||
|
@NotNull(message = "转账金额不能为空")
|
||||||
|
private Integer price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账标题
|
||||||
|
*/
|
||||||
|
@NotEmpty(message = "转账标题不能为空")
|
||||||
|
private String subject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收款人姓名
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "收款人姓名不能为空", groups = {PayTransferTypeEnum.Alipay.class})
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@NotBlank(message = "支付宝登录号不能为空", groups = {PayTransferTypeEnum.Alipay.class})
|
||||||
|
private String alipayLogonId;
|
||||||
|
|
||||||
|
// ========== 微信转账相关字段 ==========
|
||||||
|
@NotBlank(message = "微信 openId 不能为空", groups = {PayTransferTypeEnum.WxPay.class})
|
||||||
|
private String openid;
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.transfer.dto;
|
||||||
|
|
||||||
|
import com.tashow.cloud.payapi.enums.transfer.PayTransferStatusEnum;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class PayTransferRespDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 编号
|
||||||
|
*/
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账单号
|
||||||
|
*/
|
||||||
|
private String no;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账金额,单位:分
|
||||||
|
*/
|
||||||
|
private Integer price;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账状态
|
||||||
|
*
|
||||||
|
* 枚举 {@link PayTransferStatusEnum}
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.wallet;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.payapi.api.wallet.dto.PayWalletAddBalanceReqDTO;
|
||||||
|
import com.tashow.cloud.payapi.enums.ApiConstants;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* RPC 服务 - 钱包
|
||||||
|
*/
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
public interface PayWalletApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/wallet";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加钱包余额
|
||||||
|
* @param reqDTO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping(PREFIX + "/add-balance")
|
||||||
|
CommonResult<Boolean> addWalletBalance(@Valid @RequestBody PayWalletAddBalanceReqDTO reqDTO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
package com.tashow.cloud.payapi.api.wallet.dto;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.enums.UserTypeEnum;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 钱包余额增加 Request DTO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PayWalletAddBalanceReqDTO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*
|
||||||
|
* 关联 MemberUserDO 的 id 属性,或者 AdminUserDO 的 id 属性
|
||||||
|
*/
|
||||||
|
@NotNull(message = "用户编号不能为空")
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 用户类型
|
||||||
|
*
|
||||||
|
* 关联 {@link UserTypeEnum}
|
||||||
|
*/
|
||||||
|
@NotNull(message = "用户类型不能为空")
|
||||||
|
private Integer userType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联业务分类
|
||||||
|
*/
|
||||||
|
@NotNull(message = "关联业务分类不能为空")
|
||||||
|
private Integer bizType;
|
||||||
|
/**
|
||||||
|
* 关联业务编号
|
||||||
|
*/
|
||||||
|
@NotNull(message = "关联业务编号不能为空")
|
||||||
|
private String bizId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 交易金额,单位分
|
||||||
|
*
|
||||||
|
* 正值表示余额增加,负值表示余额减少
|
||||||
|
*/
|
||||||
|
@NotNull(message = "交易金额不能为空")
|
||||||
|
private Integer price;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.tashow.cloud.payapi.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.enums.RpcConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 相关的枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public class ApiConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务名
|
||||||
|
*
|
||||||
|
* 注意,需要保证和 spring.application.name 保持一致
|
||||||
|
*/
|
||||||
|
public static final String NAME = "pay-server";
|
||||||
|
|
||||||
|
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/pay";
|
||||||
|
|
||||||
|
public static final String VERSION = "1.0.0";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.tashow.cloud.payapi.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pay 字典类型的枚举类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface DictTypeConstants {
|
||||||
|
|
||||||
|
String CHANNEL_CODE = "pay_channel_code"; // 支付渠道编码
|
||||||
|
|
||||||
|
String ORDER_STATUS = "pay_order_status"; // 支付渠道
|
||||||
|
|
||||||
|
String REFUND_STATUS = "pay_order_status"; // 退款状态
|
||||||
|
|
||||||
|
String NOTIFY_STATUS = "pay_notify_status"; // 回调状态
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.tashow.cloud.payapi.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.exception.ErrorCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Pay 错误码 Core 枚举类
|
||||||
|
*
|
||||||
|
* pay 系统,使用 1-007-000-000 段
|
||||||
|
*/
|
||||||
|
public interface ErrorCodeConstants {
|
||||||
|
|
||||||
|
// ========== APP 模块 1-007-000-000 ==========
|
||||||
|
ErrorCode APP_NOT_FOUND = new ErrorCode(1_007_000_000, "App 不存在");
|
||||||
|
ErrorCode APP_IS_DISABLE = new ErrorCode(1_007_000_002, "App 已经被禁用");
|
||||||
|
ErrorCode APP_EXIST_ORDER_CANT_DELETE = new ErrorCode(1_007_000_003, "支付应用存在支付订单,无法删除");
|
||||||
|
ErrorCode APP_EXIST_REFUND_CANT_DELETE = new ErrorCode(1_007_000_004, "支付应用存在退款订单,无法删除");
|
||||||
|
ErrorCode APP_KEY_EXISTS = new ErrorCode(1_007_000_005, "支付应用标识已经存在");
|
||||||
|
|
||||||
|
// ========== CHANNEL 模块 1-007-001-000 ==========
|
||||||
|
ErrorCode CHANNEL_NOT_FOUND = new ErrorCode(1_007_001_000, "支付渠道的配置不存在");
|
||||||
|
ErrorCode CHANNEL_IS_DISABLE = new ErrorCode(1_007_001_001, "支付渠道已经禁用");
|
||||||
|
ErrorCode CHANNEL_EXIST_SAME_CHANNEL_ERROR = new ErrorCode(1_007_001_004, "已存在相同的渠道");
|
||||||
|
|
||||||
|
// ========== ORDER 模块 1-007-002-000 ==========
|
||||||
|
ErrorCode PAY_ORDER_NOT_FOUND = new ErrorCode(1_007_002_000, "支付订单不存在");
|
||||||
|
ErrorCode PAY_ORDER_STATUS_IS_NOT_WAITING = new ErrorCode(1_007_002_001, "支付订单不处于待支付");
|
||||||
|
ErrorCode PAY_ORDER_STATUS_IS_SUCCESS = new ErrorCode(1_007_002_002, "订单已支付,请刷新页面");
|
||||||
|
ErrorCode PAY_ORDER_IS_EXPIRED = new ErrorCode(1_007_002_003, "支付订单已经过期");
|
||||||
|
ErrorCode PAY_ORDER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_007_002_004, "发起支付报错,错误码:{},错误提示:{}");
|
||||||
|
ErrorCode PAY_ORDER_REFUND_FAIL_STATUS_ERROR = new ErrorCode(1_007_002_005, "支付订单退款失败,原因:状态不是已支付或已退款");
|
||||||
|
|
||||||
|
// ========== ORDER 模块(拓展单) 1-007-003-000 ==========
|
||||||
|
ErrorCode PAY_ORDER_EXTENSION_NOT_FOUND = new ErrorCode(1_007_003_000, "支付交易拓展单不存在");
|
||||||
|
ErrorCode PAY_ORDER_EXTENSION_STATUS_IS_NOT_WAITING = new ErrorCode(1_007_003_001, "支付交易拓展单不处于待支付");
|
||||||
|
ErrorCode PAY_ORDER_EXTENSION_IS_PAID = new ErrorCode(1_007_003_002, "订单已支付,请等待支付结果");
|
||||||
|
|
||||||
|
// ========== 支付模块(退款) 1-007-006-000 ==========
|
||||||
|
ErrorCode REFUND_PRICE_EXCEED = new ErrorCode(1_007_006_000, "退款金额超过订单可退款金额");
|
||||||
|
ErrorCode REFUND_HAS_REFUNDING = new ErrorCode(1_007_006_002, "已经有退款在处理中");
|
||||||
|
ErrorCode REFUND_EXISTS = new ErrorCode(1_007_006_003, "已经存在退款单");
|
||||||
|
ErrorCode REFUND_NOT_FOUND = new ErrorCode(1_007_006_004, "支付退款单不存在");
|
||||||
|
ErrorCode REFUND_STATUS_IS_NOT_WAITING = new ErrorCode(1_007_006_005, "支付退款单不处于待退款");
|
||||||
|
|
||||||
|
// ========== 钱包模块 1-007-007-000 ==========
|
||||||
|
ErrorCode WALLET_NOT_FOUND = new ErrorCode(1_007_007_000, "用户钱包不存在");
|
||||||
|
ErrorCode WALLET_BALANCE_NOT_ENOUGH = new ErrorCode(1_007_007_001, "钱包余额不足");
|
||||||
|
ErrorCode WALLET_TRANSACTION_NOT_FOUND = new ErrorCode(1_007_007_002, "未找到对应的钱包交易");
|
||||||
|
ErrorCode WALLET_REFUND_EXIST = new ErrorCode(1_007_007_003, "已经存在钱包退款");
|
||||||
|
ErrorCode WALLET_FREEZE_PRICE_NOT_ENOUGH = new ErrorCode(1_007_007_004, "钱包冻结余额不足");
|
||||||
|
|
||||||
|
// ========== 钱包充值模块 1-007-008-000 ==========
|
||||||
|
ErrorCode WALLET_RECHARGE_NOT_FOUND = new ErrorCode(1_007_008_000, "钱包充值记录不存在");
|
||||||
|
ErrorCode WALLET_RECHARGE_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(1_007_008_001, "钱包充值更新支付状态失败,钱包充值记录不是【未支付】状态");
|
||||||
|
ErrorCode WALLET_RECHARGE_UPDATE_PAID_PAY_ORDER_ID_ERROR = new ErrorCode(1_007_008_002, "钱包充值更新支付状态失败,支付单编号不匹配");
|
||||||
|
ErrorCode WALLET_RECHARGE_UPDATE_PAID_PAY_ORDER_STATUS_NOT_SUCCESS = new ErrorCode(1_007_008_003, "钱包充值更新支付状态失败,支付单状态不是【支付成功】状态");
|
||||||
|
ErrorCode WALLET_RECHARGE_UPDATE_PAID_PAY_PRICE_NOT_MATCH = new ErrorCode(1_007_008_004, "钱包充值更新支付状态失败,支付单金额不匹配");
|
||||||
|
ErrorCode WALLET_RECHARGE_REFUND_FAIL_NOT_PAID = new ErrorCode(1_007_008_005, "钱包发起退款失败,钱包充值订单未支付");
|
||||||
|
ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUNDED = new ErrorCode(1_007_008_006, "钱包发起退款失败,钱包充值订单已退款");
|
||||||
|
ErrorCode WALLET_RECHARGE_REFUND_BALANCE_NOT_ENOUGH = new ErrorCode(1_007_008_007, "钱包发起退款失败,钱包余额不足");
|
||||||
|
ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(1_007_008_008, "钱包退款更新失败,钱包退款单编号不匹配");
|
||||||
|
ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_NOT_FOUND = new ErrorCode(1_007_008_009, "钱包退款更新失败,退款订单不存在");
|
||||||
|
ErrorCode WALLET_RECHARGE_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(1_007_008_010, "钱包退款更新失败,退款单金额不匹配");
|
||||||
|
ErrorCode WALLET_RECHARGE_PACKAGE_NOT_FOUND = new ErrorCode(1_007_008_011, "钱包充值套餐不存在");
|
||||||
|
ErrorCode WALLET_RECHARGE_PACKAGE_IS_DISABLE = new ErrorCode(1_007_008_012, "钱包充值套餐已禁用");
|
||||||
|
ErrorCode WALLET_RECHARGE_PACKAGE_NAME_EXISTS = new ErrorCode(1_007_008_013, "钱包充值套餐名称已存在");
|
||||||
|
|
||||||
|
// ========== 转账模块 1-007-009-000 ==========
|
||||||
|
ErrorCode PAY_TRANSFER_SUBMIT_CHANNEL_ERROR = new ErrorCode(1_007_009_000, "发起转账报错,错误码:{},错误提示:{}");
|
||||||
|
ErrorCode PAY_TRANSFER_NOT_FOUND = new ErrorCode(1_007_009_001, "转账单不存在");
|
||||||
|
ErrorCode PAY_SAME_MERCHANT_TRANSFER_TYPE_NOT_MATCH = new ErrorCode(1_007_009_002, "两次相同转账请求的类型不匹配");
|
||||||
|
ErrorCode PAY_SAME_MERCHANT_TRANSFER_PRICE_NOT_MATCH = new ErrorCode(1_007_009_003, "两次相同转账请求的金额不匹配");
|
||||||
|
ErrorCode PAY_MERCHANT_TRANSFER_EXISTS = new ErrorCode(1_007_009_004, "该笔业务的转账已经发起,请查询转账订单相关状态");
|
||||||
|
ErrorCode PAY_TRANSFER_STATUS_IS_NOT_WAITING = new ErrorCode(1_007_009_005, "转账单不处于待转账");
|
||||||
|
ErrorCode PAY_TRANSFER_STATUS_IS_NOT_PENDING = new ErrorCode(1_007_009_006, "转账单不处于待转账或转账中");
|
||||||
|
|
||||||
|
// ========== 示例订单 1-007-900-000 ==========
|
||||||
|
ErrorCode DEMO_ORDER_NOT_FOUND = new ErrorCode(1_007_900_000, "示例订单不存在");
|
||||||
|
ErrorCode DEMO_ORDER_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(1_007_900_001, "示例订单更新支付状态失败,订单不是【未支付】状态");
|
||||||
|
ErrorCode DEMO_ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR = new ErrorCode(1_007_900_002, "示例订单更新支付状态失败,支付单编号不匹配");
|
||||||
|
ErrorCode DEMO_ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS = new ErrorCode(1_007_900_003, "示例订单更新支付状态失败,支付单状态不是【支付成功】状态");
|
||||||
|
ErrorCode DEMO_ORDER_UPDATE_PAID_FAIL_PAY_PRICE_NOT_MATCH = new ErrorCode(1_007_900_004, "示例订单更新支付状态失败,支付单金额不匹配");
|
||||||
|
ErrorCode DEMO_ORDER_REFUND_FAIL_NOT_PAID = new ErrorCode(1_007_900_005, "发起退款失败,示例订单未支付");
|
||||||
|
ErrorCode DEMO_ORDER_REFUND_FAIL_REFUNDED = new ErrorCode(1_007_900_006, "发起退款失败,示例订单已退款");
|
||||||
|
ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_NOT_FOUND = new ErrorCode(1_007_900_007, "发起退款失败,退款订单不存在");
|
||||||
|
ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_NOT_SUCCESS = new ErrorCode(1_007_900_008, "发起退款失败,退款订单未退款成功");
|
||||||
|
ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_ORDER_ID_ERROR = new ErrorCode(1_007_900_009, "发起退款失败,退款单编号不匹配");
|
||||||
|
ErrorCode DEMO_ORDER_REFUND_FAIL_REFUND_PRICE_NOT_MATCH = new ErrorCode(1_007_900_010, "发起退款失败,退款单金额不匹配");
|
||||||
|
|
||||||
|
// ========== 示例转账订单 1-007-901-001 ==========
|
||||||
|
ErrorCode DEMO_TRANSFER_NOT_FOUND = new ErrorCode(1_007_901_001, "示例转账单不存在");
|
||||||
|
ErrorCode DEMO_TRANSFER_FAIL_TRANSFER_ID_ERROR = new ErrorCode(1_007_901_002, "转账失败,转账单编号不匹配");
|
||||||
|
ErrorCode DEMO_TRANSFER_FAIL_PRICE_NOT_MATCH = new ErrorCode(1_007_901_003, "转账失败,转账单金额不匹配");
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.tashow.cloud.payapi.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通知模板枚举类
|
||||||
|
*
|
||||||
|
* @author HUIHUI
|
||||||
|
*/
|
||||||
|
public interface MessageTemplateConstants {
|
||||||
|
|
||||||
|
// ======================= 小程序订阅消息 =======================
|
||||||
|
|
||||||
|
String WXA_WALLET_RECHARGER_PAID = "充值成功通知";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.tashow.cloud.payapi.enums.notify;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付通知状态枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PayNotifyStatusEnum {
|
||||||
|
|
||||||
|
WAITING(0, "等待通知"),
|
||||||
|
SUCCESS(10, "通知成功"),
|
||||||
|
FAILURE(20, "通知失败"), // 多次尝试,彻底失败
|
||||||
|
REQUEST_SUCCESS(21, "请求成功,但是结果失败"),
|
||||||
|
REQUEST_FAILURE(22, "请求失败"),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private final Integer status;
|
||||||
|
/**
|
||||||
|
* 名字
|
||||||
|
*/
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.tashow.cloud.payapi.enums.notify;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付通知类型
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PayNotifyTypeEnum {
|
||||||
|
|
||||||
|
ORDER(1, "支付单"),
|
||||||
|
REFUND(2, "退款单"),
|
||||||
|
TRANSFER(3, "转账单")
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型
|
||||||
|
*/
|
||||||
|
private final Integer type;
|
||||||
|
/**
|
||||||
|
* 名字
|
||||||
|
*/
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.tashow.cloud.payapi.enums.order;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.core.ArrayValuable;
|
||||||
|
import com.tashow.cloud.common.util.object.ObjectUtils;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 支付订单的状态枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PayOrderStatusEnum implements ArrayValuable<Integer> {
|
||||||
|
|
||||||
|
WAITING(0, "未支付"),
|
||||||
|
SUCCESS(10, "支付成功"),
|
||||||
|
REFUND(20, "已退款"),
|
||||||
|
CLOSED(30, "支付关闭"), // 注意:全部退款后,还是 REFUND 状态
|
||||||
|
;
|
||||||
|
|
||||||
|
private final Integer status;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer[] array() {
|
||||||
|
return new Integer[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否等待支付
|
||||||
|
*
|
||||||
|
* @param status 状态
|
||||||
|
* @return 是否等待支付
|
||||||
|
*/
|
||||||
|
public static boolean isWaiting(Integer status) {
|
||||||
|
return Objects.equals(status, WAITING.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否支付成功
|
||||||
|
*
|
||||||
|
* @param status 状态
|
||||||
|
* @return 是否支付成功
|
||||||
|
*/
|
||||||
|
public static boolean isSuccess(Integer status) {
|
||||||
|
return Objects.equals(status, SUCCESS.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否支付成功或者已退款
|
||||||
|
*
|
||||||
|
* @param status 状态
|
||||||
|
* @return 是否支付成功或者已退款
|
||||||
|
*/
|
||||||
|
public static boolean isSuccessOrRefund(Integer status) {
|
||||||
|
return ObjectUtils.equalsAny(status,
|
||||||
|
SUCCESS.getStatus(), REFUND.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否支付关闭
|
||||||
|
*
|
||||||
|
* @param status 状态
|
||||||
|
* @return 是否支付关闭
|
||||||
|
*/
|
||||||
|
public static boolean isClosed(Integer status) {
|
||||||
|
return Objects.equals(status, CLOSED.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.tashow.cloud.payapi.enums.refund;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渠道的退款状态枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PayRefundStatusEnum {
|
||||||
|
|
||||||
|
WAITING(0, "未退款"),
|
||||||
|
SUCCESS(10, "退款成功"),
|
||||||
|
FAILURE(20, "退款失败");
|
||||||
|
|
||||||
|
private final Integer status;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public static boolean isSuccess(Integer status) {
|
||||||
|
return Objects.equals(status, SUCCESS.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isFailure(Integer status) {
|
||||||
|
return Objects.equals(status, FAILURE.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.tashow.cloud.payapi.enums.transfer;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author jason
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum PayTransferStatusEnum {
|
||||||
|
|
||||||
|
WAITING(0, "等待转账"),
|
||||||
|
/**
|
||||||
|
* TODO 转账到银行卡. 会有T+0 T+1 到账的请情况。 还未实现
|
||||||
|
*/
|
||||||
|
IN_PROGRESS(10, "转账进行中"),
|
||||||
|
|
||||||
|
SUCCESS(20, "转账成功"),
|
||||||
|
/**
|
||||||
|
* 转账关闭 (失败,或者其它情况) // TODO 改成 转账失败状态
|
||||||
|
*/
|
||||||
|
CLOSED(30, "转账关闭");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
private final Integer status;
|
||||||
|
/**
|
||||||
|
* 状态名
|
||||||
|
*/
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public static boolean isSuccess(Integer status) {
|
||||||
|
return Objects.equals(status, SUCCESS.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isClosed(Integer status) {
|
||||||
|
return Objects.equals(status, CLOSED.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isWaiting(Integer status) {
|
||||||
|
return Objects.equals(status, WAITING.getStatus());
|
||||||
|
}
|
||||||
|
public static boolean isInProgress(Integer status) {
|
||||||
|
return Objects.equals(status, IN_PROGRESS.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否处于待转账或者转账中的状态
|
||||||
|
* @param status 状态
|
||||||
|
*/
|
||||||
|
public static boolean isPendingStatus(Integer status) {
|
||||||
|
return Objects.equals(status, WAITING.getStatus()) || Objects.equals(status, IN_PROGRESS.getStatus());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.tashow.cloud.payapi.enums.transfer;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
|
import com.tashow.cloud.common.core.ArrayValuable;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转账类型枚举
|
||||||
|
*
|
||||||
|
* @author jason
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Getter
|
||||||
|
public enum PayTransferTypeEnum implements ArrayValuable<Integer> {
|
||||||
|
|
||||||
|
ALIPAY_BALANCE(1, "支付宝余额"),
|
||||||
|
WX_BALANCE(2, "微信余额"),
|
||||||
|
BANK_CARD(3, "银行卡"),
|
||||||
|
WALLET_BALANCE(4, "钱包余额");
|
||||||
|
|
||||||
|
public interface WxPay {
|
||||||
|
}
|
||||||
|
|
||||||
|
public interface Alipay {
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Integer type;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public static final Integer[] ARRAYS = Arrays.stream(values()).map(PayTransferTypeEnum::getType).toArray(Integer[]::new);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer[] array() {
|
||||||
|
return ARRAYS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PayTransferTypeEnum typeOf(Integer type) {
|
||||||
|
return ArrayUtil.firstMatch(item -> item.getType().equals(type), values());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -29,6 +29,11 @@
|
|||||||
<optional>true</optional>
|
<optional>true</optional>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>jakarta.validation</groupId>
|
||||||
|
<artifactId>jakarta.validation-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- RPC 远程调用相关 -->
|
<!-- RPC 远程调用相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.cloud</groupId>
|
<groupId>org.springframework.cloud</groupId>
|
||||||
@@ -40,6 +45,46 @@
|
|||||||
<artifactId>mybatis</artifactId>
|
<artifactId>mybatis</artifactId>
|
||||||
<version>3.5.13</version> <!-- 推荐使用最新稳定版本 -->
|
<version>3.5.13</version> <!-- 推荐使用最新稳定版本 -->
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- 防止进入swagger页面报类型转换错误,排除3.0.0中的引用,手动增加1.6.2版本 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
<version>1.6.2</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- Swagger Core -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
|
<artifactId>swagger-core</artifactId>
|
||||||
|
<version>2.2.20</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Swagger Models -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger.core.v3</groupId>
|
||||||
|
<artifactId>swagger-models</artifactId>
|
||||||
|
<version>2.2.20</version>
|
||||||
|
</dependency>
|
||||||
|
<!-- EasyExcel 核心库 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba</groupId>
|
||||||
|
<artifactId>easyexcel</artifactId>
|
||||||
|
<version>4.0.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mybatis</groupId>
|
||||||
|
<artifactId>mybatis</artifactId>
|
||||||
|
<version>3.5.9</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-annotation</artifactId>
|
||||||
|
<version>3.5.9</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-data-mybatis</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product;
|
||||||
|
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.CategoryDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.CategoryDto;
|
||||||
|
import com.tashow.cloud.productapi.enums.ApiConstants;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
/** RPC 服务 - 参数配置 */
|
||||||
|
public interface CategoryApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/category";
|
||||||
|
|
||||||
|
/** 根据参数键查询参数值 */
|
||||||
|
@GetMapping(PREFIX + "/categoryList")
|
||||||
|
List<CategoryDO> categoryList(@RequestParam(value = "grade", required = false) Integer grade,
|
||||||
|
@RequestParam(value = "categoryId", required = false) Long categoryId,
|
||||||
|
@RequestParam(value = "categoryName", required = false) String categoryName,
|
||||||
|
@RequestParam(value = "status", required = false) Integer status);
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ProdDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prod.ProdListVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prod.ProdPageReqVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prod.ProdServiceVO;
|
||||||
|
import com.tashow.cloud.productapi.enums.ApiConstants;
|
||||||
|
import jakarta.annotation.security.PermitAll;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
/** RPC 服务 - 参数配置 */
|
||||||
|
public interface ProdApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/prod";
|
||||||
|
/**
|
||||||
|
* 获取商品详情
|
||||||
|
*
|
||||||
|
* @param id 商品id
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/getProdInfo")
|
||||||
|
@PermitAll
|
||||||
|
CommonResult<ProdDO> getProdInfo(@RequestParam(value = "id", required = false) Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取商品服务配置
|
||||||
|
*
|
||||||
|
* @param id 商品id
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
@GetMapping(PREFIX + "/getProdService")
|
||||||
|
ProdServiceVO getProdService(@RequestParam(value = "id", required = false) Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得商品分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 商品分页
|
||||||
|
*/
|
||||||
|
@GetMapping(PREFIX + "/getProdPage")
|
||||||
|
PageResult<ProdListVO> getProdPage(ProdPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 扣减库存
|
||||||
|
* @param skuId 单品ID
|
||||||
|
* @param stocksNum 扣减数量
|
||||||
|
*/
|
||||||
|
@PostMapping(PREFIX + "/reduceStocks")
|
||||||
|
CommonResult<Boolean> reduceStocks(@RequestParam(value = "skuId", required = false)Long skuId
|
||||||
|
,@RequestParam(value = "stocksNum", required = false) Integer stocksNum
|
||||||
|
) ;
|
||||||
|
/**
|
||||||
|
* 增加库存
|
||||||
|
* @param skuId 单品ID
|
||||||
|
* @param stocksNum 增加数量
|
||||||
|
*/
|
||||||
|
@PostMapping(PREFIX + "/increaseStocks")
|
||||||
|
CommonResult<Boolean> increaseStocks(@RequestParam(value = "skuId", required = false)Long skuId
|
||||||
|
,@RequestParam(value = "stocksNum", required = false) Integer stocksNum);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product;
|
||||||
|
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.CategoryDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ShopDetailDO;
|
||||||
|
import com.tashow.cloud.productapi.enums.ApiConstants;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
|
/** RPC 服务 - 参数配置 */
|
||||||
|
public interface ShopDetailApi {
|
||||||
|
|
||||||
|
String PREFIX = ApiConstants.PREFIX + "/shop";
|
||||||
|
|
||||||
|
@GetMapping(PREFIX + "/getShopInfo")
|
||||||
|
ShopDetailDO getShopInfo(@RequestParam(value = "id", required = false) Long id);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品类目 DO
|
* 产品类目 DO
|
||||||
@@ -35,6 +38,12 @@ public class CategoryDO extends BaseDO {
|
|||||||
* 父节点
|
* 父节点
|
||||||
*/
|
*/
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父节名称
|
||||||
|
*/
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 产品类目名称
|
* 产品类目名称
|
||||||
*/
|
*/
|
||||||
@@ -54,11 +63,12 @@ public class CategoryDO extends BaseDO {
|
|||||||
/**
|
/**
|
||||||
* 标签
|
* 标签
|
||||||
*/
|
*/
|
||||||
private String tag;
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> tag;
|
||||||
/**
|
/**
|
||||||
* 排序
|
* 排序
|
||||||
*/
|
*/
|
||||||
private Integer seq;
|
private Integer sort;
|
||||||
/**
|
/**
|
||||||
* 默认是1,表示正常状态,0为下线状态
|
* 默认是1,表示正常状态,0为下线状态
|
||||||
*/
|
*/
|
||||||
@@ -68,4 +78,6 @@ public class CategoryDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Integer grade;
|
private Integer grade;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品类目 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CategoryDto {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类目ID
|
||||||
|
*/
|
||||||
|
private Long categoryId;
|
||||||
|
/**
|
||||||
|
* 店铺ID
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
/**
|
||||||
|
* 父节点
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父节名称
|
||||||
|
*/
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品类目名称
|
||||||
|
*/
|
||||||
|
private String categoryName;
|
||||||
|
/**
|
||||||
|
* 类目图标
|
||||||
|
*/
|
||||||
|
private String icon;
|
||||||
|
/**
|
||||||
|
* 类目的显示图片
|
||||||
|
*/
|
||||||
|
private String pic;
|
||||||
|
/**
|
||||||
|
* 类目描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
/**
|
||||||
|
* 标签
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> tag;
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
/**
|
||||||
|
* 默认是1,表示正常状态,0为下线状态
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 分类层级 1、2、3级
|
||||||
|
*/
|
||||||
|
private Integer grade;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 特殊日期附加费用规则 DO
|
* 特殊日期附加费用规则 DO
|
||||||
@@ -40,14 +43,22 @@ public class ProdAdditionalFeeDatesDO extends BaseDO {
|
|||||||
* 日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'
|
* 日期类型0:'自定义日期范围':1:'指定日期':2:'法定节假日',3:'固定休息日'
|
||||||
*/
|
*/
|
||||||
private Integer dateType;
|
private Integer dateType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自定义日期时间段(JSON格式存储)
|
* 类型:1:特殊日期 2:可预约时段黑名单日期 3:紧急相应服务黑名单日期
|
||||||
*/
|
*/
|
||||||
private String customTimeSlots;
|
private Integer type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 指定日期(JSON格式存储)
|
* 日期
|
||||||
*/
|
*/
|
||||||
private String specificDates;
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> customTimeSlots;
|
||||||
|
/* *//**
|
||||||
|
* 指定日期
|
||||||
|
*//*
|
||||||
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> specificDates;*/
|
||||||
/**
|
/**
|
||||||
* 收费方式0:''固定金额'':1:''基准价上浮
|
* 收费方式0:''固定金额'':1:''基准价上浮
|
||||||
*/
|
*/
|
||||||
@@ -60,5 +71,7 @@ public class ProdAdditionalFeeDatesDO extends BaseDO {
|
|||||||
* 是否启用该规则是否启用该规则0关1开
|
* 是否启用该规则是否启用该规则0关1开
|
||||||
*/
|
*/
|
||||||
private Integer isEnabled;
|
private Integer isEnabled;
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return id == null ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,16 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 特殊时段附加费用规则 DO
|
* 特殊时段附加费用规则 DO
|
||||||
*
|
*
|
||||||
@@ -38,9 +40,10 @@ public class ProdAdditionalFeePeriodsDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String name;
|
private String name;
|
||||||
/**
|
/**
|
||||||
* 特殊时段设置(JSON格式存储)
|
* 特殊时段设置
|
||||||
*/
|
*/
|
||||||
private String specialTimeSlots;
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> specialTimeSlots;
|
||||||
/**
|
/**
|
||||||
* 收费方式0:'固定金额',1:'基准价上浮'
|
* 收费方式0:'固定金额',1:'基准价上浮'
|
||||||
*/
|
*/
|
||||||
@@ -53,5 +56,7 @@ public class ProdAdditionalFeePeriodsDO extends BaseDO {
|
|||||||
* 浮动百分比
|
* 浮动百分比
|
||||||
*/
|
*/
|
||||||
private BigDecimal floatingPercentage;
|
private BigDecimal floatingPercentage;
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return id == null ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,15 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import lombok.*;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import java.util.*;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品 DO
|
* 商品 DO
|
||||||
@@ -110,9 +112,15 @@ public class ProdDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Integer status;
|
private Integer status;
|
||||||
/**
|
/**
|
||||||
* 商品分类
|
* 商品分类id
|
||||||
*/
|
*/
|
||||||
private Long categoryId;
|
private Long categoryId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品分类名称
|
||||||
|
*/
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 销量
|
* 销量
|
||||||
*/
|
*/
|
||||||
@@ -162,4 +170,9 @@ public class ProdDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Integer top;
|
private Integer top;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除时间
|
||||||
|
*/
|
||||||
|
private Date deleteTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品紧急响应服务设置 DO
|
* 商品紧急响应服务设置 DO
|
||||||
@@ -32,24 +35,9 @@ public class ProdEmergencyResponseDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Long prodId;
|
private Long prodId;
|
||||||
/**
|
/**
|
||||||
* 可响应时间段(JSON格式存储)
|
* 可响应时间段
|
||||||
*/
|
*/
|
||||||
private String responseTimeSlots;
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
/**
|
private List<String> responseTimeSlots;
|
||||||
* 黑名自定义日期(JSON格式存储)
|
|
||||||
*/
|
|
||||||
private String blacklistedDates;
|
|
||||||
/**
|
|
||||||
* 黑名单指定日期(JSON格式存储)
|
|
||||||
*/
|
|
||||||
private String blackAppointDates;
|
|
||||||
/**
|
|
||||||
* 法定节假日是否开启0:关闭1开启
|
|
||||||
*/
|
|
||||||
private Integer blackHappy;
|
|
||||||
/**
|
|
||||||
* 固定休息日周末是否开启0关闭1开启
|
|
||||||
*/
|
|
||||||
private Integer blackWeekend;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 紧急响应时间区间设置 DO
|
* 紧急响应时间区间设置 DO
|
||||||
*
|
*
|
||||||
@@ -34,13 +33,18 @@ public class ProdEmergencyResponseIntervalsDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Long configId;
|
private Long configId;
|
||||||
/**
|
/**
|
||||||
* 响应模式名称
|
* 商品ID
|
||||||
*/
|
*/
|
||||||
private String modeName;
|
private Long prodId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 响应模式名称modeName
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
/**
|
/**
|
||||||
* 响应时间(小时)
|
* 响应时间(小时)
|
||||||
*/
|
*/
|
||||||
private Integer responseHours;
|
private BigDecimal responseHours;
|
||||||
/**
|
/**
|
||||||
* 收费模式0:固定收费 1:浮动收费
|
* 收费模式0:固定收费 1:浮动收费
|
||||||
*/
|
*/
|
||||||
@@ -54,4 +58,8 @@ public class ProdEmergencyResponseIntervalsDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
|
|
||||||
|
|
||||||
|
public boolean isEmpty() {
|
||||||
|
return id == null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.*;
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import lombok.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 属性规则 DO
|
* 属性规则 DO
|
||||||
*
|
*
|
||||||
@@ -39,4 +41,9 @@ public class ProdExtendDO {
|
|||||||
*/
|
*/
|
||||||
private Integer isDisable;
|
private Integer isDisable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 体重是否收费0否1是
|
||||||
|
*/
|
||||||
|
private Integer isWeightCharge;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,15 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.ProdPropValueDO;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import java.util.*;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 商品属性 DO
|
* 商品属性 DO
|
||||||
*
|
*
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import java.util.*;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 属性规则 DO
|
* 属性规则 DO
|
||||||
@@ -59,4 +62,8 @@ public class ProdPropValueDO {
|
|||||||
@TableField(exist=false)
|
@TableField(exist=false)
|
||||||
private Integer isExist;
|
private Integer isExist;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除时间
|
||||||
|
*/
|
||||||
|
private Date deleteTime;
|
||||||
}
|
}
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodreservationconfig.TimeBookVO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品预约配置 DO
|
* 商品预约配置 DO
|
||||||
@@ -32,9 +36,10 @@ public class ProdReservationConfigDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Long prodId;
|
private Long prodId;
|
||||||
/**
|
/**
|
||||||
* 预约时段设置(JSON格式存储)
|
* 预约时段设置
|
||||||
*/
|
*/
|
||||||
private String reservationTimeSlots;
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> reservationTimeSlots;
|
||||||
/**
|
/**
|
||||||
* 需提前多少小时预约
|
* 需提前多少小时预约
|
||||||
*/
|
*/
|
||||||
@@ -47,6 +52,12 @@ public class ProdReservationConfigDO extends BaseDO {
|
|||||||
* 是否允许更改预约时间 1可以 0不可以
|
* 是否允许更改预约时间 1可以 0不可以
|
||||||
*/
|
*/
|
||||||
private Integer allowChange;
|
private Integer allowChange;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 时间段
|
||||||
|
*/
|
||||||
|
private Integer timeSlot;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更改预约时间的时间规则(如服务开始前1小时可更改)
|
* 更改预约时间的时间规则(如服务开始前1小时可更改)
|
||||||
*/
|
*/
|
||||||
@@ -56,31 +67,21 @@ public class ProdReservationConfigDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private Integer maxChangeTimes;
|
private Integer maxChangeTimes;
|
||||||
/**
|
/**
|
||||||
* 黑名自定义日期(JSON格式存储)
|
* 预约时间区间设置
|
||||||
*/
|
*/
|
||||||
private String blacklistedDates;
|
@TableField(exist=false)
|
||||||
|
private TimeBookVO timeBook;
|
||||||
|
|
||||||
/**
|
public TimeBookVO getTimeBook() {
|
||||||
* '是否开启黑名单自定义0关1开'
|
if (this.timeBook == null) {
|
||||||
*/
|
this.timeBook = new TimeBookVO();
|
||||||
private Integer isBlacklisted;
|
this.timeBook.setTimeSlot(this.timeSlot);
|
||||||
|
this.timeBook.setReservationTimeSlots(this.reservationTimeSlots);
|
||||||
/**
|
}
|
||||||
* '是否开启黑名单指定日期0关1开'
|
return this.timeBook;
|
||||||
*/
|
}
|
||||||
private Integer isBlackAppoint;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 黑名单指定日期(JSON格式存储)
|
|
||||||
*/
|
|
||||||
private String blackAppointDates;
|
|
||||||
/**
|
|
||||||
* 法定节假日是否开启0:关闭1开启
|
|
||||||
*/
|
|
||||||
private Integer blackHappy;
|
|
||||||
/**
|
|
||||||
* 固定休息日周末是否开启0关闭1开启
|
|
||||||
*/
|
|
||||||
private Integer blackWeekend;
|
|
||||||
|
|
||||||
|
public void setTimeBook(TimeBookVO timeBook) {
|
||||||
|
this.timeBook = timeBook;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
import java.util.*;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 商品与服务区域关联 DO
|
* 商品与服务区域关联 DO
|
||||||
*
|
*
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 服务区域 DO
|
* 服务区域 DO
|
||||||
*
|
*
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 超区规则 DO
|
* 超区规则 DO
|
||||||
*
|
*
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 商品和标签管理 DO
|
* 商品和标签管理 DO
|
||||||
*
|
*
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 体重区间价格 DO
|
* 体重区间价格 DO
|
||||||
*
|
*
|
||||||
@@ -41,7 +41,7 @@ public class ProdWeightRangePricesDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private BigDecimal price;
|
private BigDecimal price;
|
||||||
/**
|
/**
|
||||||
* 是否启用该规则0否1是
|
* 是否收费0否1是
|
||||||
*/
|
*/
|
||||||
private Integer isEnabled;
|
private Integer isEnabled;
|
||||||
|
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 商品接单上限设置 DO
|
* 商品接单上限设置 DO
|
||||||
*
|
*
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 店铺信息 DO
|
* 店铺信息 DO
|
||||||
*
|
*
|
||||||
@@ -1,17 +1,14 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 单品SKU DO
|
* 单品SKU DO
|
||||||
*
|
*
|
||||||
@@ -90,9 +87,21 @@ public class SkuDO extends BaseDO {
|
|||||||
*/
|
*/
|
||||||
private String overview;
|
private String overview;
|
||||||
/**
|
/**
|
||||||
* 库存(-1代表无限库存)
|
* 库存
|
||||||
*/
|
*/
|
||||||
private Integer stocks;
|
private Integer stocks;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 总库存是0 无线库存是1
|
||||||
|
*/
|
||||||
|
private Integer stocksFlg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 锁定库存数
|
||||||
|
*/
|
||||||
|
@TableField(exist=false)
|
||||||
|
private Integer stocksLockNum;
|
||||||
/**
|
/**
|
||||||
* 预警库存
|
* 预警库存
|
||||||
*/
|
*/
|
||||||
@@ -166,5 +175,5 @@ public class SkuDO extends BaseDO {
|
|||||||
/**
|
/**
|
||||||
* 删除时间
|
* 删除时间
|
||||||
*/
|
*/
|
||||||
private LocalDateTime delete_time;
|
private Date deleteTime;
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 服务交付方式 DO
|
* 服务交付方式 DO
|
||||||
*
|
*
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 服务详情 DO
|
* 服务详情 DO
|
||||||
*
|
*
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 服务物料详情 DO
|
* 服务物料详情 DO
|
||||||
*
|
*
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 服务遗体运输 DO
|
* 服务遗体运输 DO
|
||||||
*
|
*
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
package com.tashow.cloud.product.dto;
|
package com.tashow.cloud.productapi.api.product.dto;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
|
import lombok.*;
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
/**
|
/**
|
||||||
* 商品SKU扩展服务表单 DO
|
* 商品SKU扩展服务表单 DO
|
||||||
*
|
*
|
||||||
@@ -1,11 +1,14 @@
|
|||||||
package com.tashow.cloud.product.vo.category;
|
package com.tashow.cloud.productapi.api.product.vo;
|
||||||
|
|
||||||
import lombok.*;
|
|
||||||
import java.util.*;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import com.tashow.cloud.common.pojo.PageParam;
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
@@ -34,10 +37,10 @@ public class CategoryPageReqVO extends PageParam {
|
|||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Schema(description = "标签")
|
@Schema(description = "标签")
|
||||||
private String tag;
|
private List<String> tag;
|
||||||
|
|
||||||
@Schema(description = "排序")
|
@Schema(description = "排序")
|
||||||
private Integer seq;
|
private Integer sort;
|
||||||
|
|
||||||
@Schema(description = "默认是1,表示正常状态,0为下线状态", example = "1")
|
@Schema(description = "默认是1,表示正常状态,0为下线状态", example = "1")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
package com.tashow.cloud.product.vo.category;
|
package com.tashow.cloud.productapi.api.product.vo;
|
||||||
|
|
||||||
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.Data;
|
||||||
import java.util.*;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import com.alibaba.excel.annotation.*;
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 产品类目 Response VO")
|
@Schema(description = "管理后台 - 产品类目 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@@ -42,11 +43,11 @@ public class CategoryRespVO {
|
|||||||
|
|
||||||
@Schema(description = "标签")
|
@Schema(description = "标签")
|
||||||
@ExcelProperty("标签")
|
@ExcelProperty("标签")
|
||||||
private String tag;
|
private List<String> tag;
|
||||||
|
|
||||||
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@ExcelProperty("排序")
|
@ExcelProperty("排序")
|
||||||
private Integer seq;
|
private Integer sort;
|
||||||
|
|
||||||
@Schema(description = "默认是1,表示正常状态,0为下线状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "默认是1,表示正常状态,0为下线状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
@ExcelProperty("默认是1,表示正常状态,0为下线状态")
|
@ExcelProperty("默认是1,表示正常状态,0为下线状态")
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.tashow.cloud.product.vo.category;
|
package com.tashow.cloud.productapi.api.product.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.Data;
|
||||||
import java.util.*;
|
|
||||||
import jakarta.validation.constraints.*;
|
import java.util.List;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - 产品类目新增/修改 Request VO")
|
@Schema(description = "管理后台 - 产品类目新增/修改 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@@ -16,11 +16,16 @@ public class CategorySaveReqVO {
|
|||||||
private Long shopId;
|
private Long shopId;
|
||||||
|
|
||||||
@Schema(description = "父节点", requiredMode = Schema.RequiredMode.REQUIRED, example = "16509")
|
@Schema(description = "父节点", requiredMode = Schema.RequiredMode.REQUIRED, example = "16509")
|
||||||
@NotNull(message = "父节点不能为空")
|
//@NotNull(message = "父节点不能为空")
|
||||||
private Long parentId;
|
private Long parentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 父节名称
|
||||||
|
*/
|
||||||
|
private String parentName;
|
||||||
|
|
||||||
@Schema(description = "产品类目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
@Schema(description = "产品类目名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "王五")
|
||||||
@NotEmpty(message = "产品类目名称不能为空")
|
//@NotEmpty(message = "产品类目名称不能为空")
|
||||||
private String categoryName;
|
private String categoryName;
|
||||||
|
|
||||||
@Schema(description = "类目图标")
|
@Schema(description = "类目图标")
|
||||||
@@ -33,16 +38,16 @@ public class CategorySaveReqVO {
|
|||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@Schema(description = "标签")
|
@Schema(description = "标签")
|
||||||
private String tag;
|
private List<String> tag;
|
||||||
|
|
||||||
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
private Integer seq;
|
private Integer sort;
|
||||||
|
|
||||||
@Schema(description = "默认是1,表示正常状态,0为下线状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
@Schema(description = "默认是1,表示正常状态,0为下线状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
private Integer status;
|
private Integer status;
|
||||||
|
|
||||||
@Schema(description = "分类层级 1级 2级 3级", requiredMode = Schema.RequiredMode.REQUIRED)
|
@Schema(description = "分类层级 1级 2级 3级", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
@NotNull(message = "分类层级不能为空")
|
//@NotNull(message = "分类层级不能为空")
|
||||||
private Integer grade;
|
private Integer grade;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prod;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.tashow.cloud.productapi.api.product.dto.*;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodemergencyresponse.ProdEmergencyInfoVO;
|
||||||
|
import com.tashow.cloud.productapi.api.product.vo.prodserviceareas.ProdServiceAreasInfoVO;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "商品服务配置 VO")
|
||||||
|
@Data
|
||||||
|
public class ProdListVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long prodId;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String prodName;
|
||||||
|
/**
|
||||||
|
* 分类名称
|
||||||
|
*/
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 默认是1,正常状态(出售中), 0:下架(仓库中) 2:待审核
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否置灰0否1是
|
||||||
|
*/
|
||||||
|
private Integer isProhibit;
|
||||||
|
/**
|
||||||
|
* 服务区域地址名称集合
|
||||||
|
*/
|
||||||
|
private List<String> areaNameList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 紧急服务最快响应时间(小时)
|
||||||
|
*/
|
||||||
|
private BigDecimal responseHours;
|
||||||
|
/**
|
||||||
|
* 服务时段
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> reservationTimeSlots;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 还剩多少天
|
||||||
|
*/
|
||||||
|
private Long remainingDays;
|
||||||
|
/**
|
||||||
|
* 图片
|
||||||
|
*/
|
||||||
|
private String pic;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 审核备注
|
||||||
|
*/
|
||||||
|
private String processNotes;
|
||||||
|
/**
|
||||||
|
* 删除时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date deleteTime;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prod;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 商品分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ProdPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "商品名称", example = "赵六")
|
||||||
|
private String prodName;
|
||||||
|
|
||||||
|
@Schema(description = "店铺id", example = "10843")
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
@Schema(description = "默认是1,正常状态(出售中), 0:下架(仓库中) 2:待审核", example = "2")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "商品分类", example = "14895")
|
||||||
|
private Long categoryId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品分类名称
|
||||||
|
*/
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private String[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prod;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
@Schema(description = "商品回收站分页查询")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ProdRecycleBinVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "商品名称", example = "18784")
|
||||||
|
private String prodName;
|
||||||
|
|
||||||
|
@Schema(description = "删除时间")
|
||||||
|
//@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private String[] deleteTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.product.vo.prod;
|
package com.tashow.cloud.productapi.api.product.vo.prod;
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
|
||||||
import com.alibaba.excel.annotation.ExcelProperty;
|
import com.alibaba.excel.annotation.ExcelProperty;
|
||||||
@@ -84,6 +84,11 @@ public class ProdRespVO {
|
|||||||
@ExcelProperty("商品分类")
|
@ExcelProperty("商品分类")
|
||||||
private Long categoryId;
|
private Long categoryId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品分类名称
|
||||||
|
*/
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
@Schema(description = "销量")
|
@Schema(description = "销量")
|
||||||
@ExcelProperty("销量")
|
@ExcelProperty("销量")
|
||||||
private Integer soldNum;
|
private Integer soldNum;
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.tashow.cloud.productapi.api.product.vo.prod;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.tashow.cloud.productapi.general.StringListTypeHandler;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Schema(description = "商品服务配置 VO")
|
||||||
|
@Data
|
||||||
|
public class ProdRestoreListVO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 产品ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long prodId;
|
||||||
|
/**
|
||||||
|
* 商品名称
|
||||||
|
*/
|
||||||
|
private String prodName;
|
||||||
|
/**
|
||||||
|
* 分类名称
|
||||||
|
*/
|
||||||
|
private String categoryName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务区域地址名称集合
|
||||||
|
*/
|
||||||
|
private List<String> areaNameList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 紧急服务最快响应时间(小时)
|
||||||
|
*/
|
||||||
|
private BigDecimal responseHours;
|
||||||
|
/**
|
||||||
|
* 服务时段
|
||||||
|
*/
|
||||||
|
@TableField(typeHandler = StringListTypeHandler.class)
|
||||||
|
private List<String> reservationTimeSlots;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 还剩多少天
|
||||||
|
*/
|
||||||
|
private Long remainingDays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date deleteTime;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user