Compare commits
18 Commits
3497962627
...
feature/or
| Author | SHA1 | Date | |
|---|---|---|---|
| 62b78b40be | |||
| 0c051643d5 | |||
| 793a810d65 | |||
| b4f485db09 | |||
| fd5a68c27e | |||
| 6a59e27ebb | |||
| 323cae015f | |||
| 4f9b9c29a3 | |||
|
|
720937581f | ||
|
|
261a8b4797 | ||
| c283800915 | |||
| 483abcfd83 | |||
| 4ebe4f9ac6 | |||
| 90e28f056a | |||
| a5a10898a2 | |||
|
|
00d4e0c3e8 | ||
| 4042fd297d | |||
|
|
0ce1eae772 |
@@ -1,51 +0,0 @@
|
|||||||
-- 会员用户表 (tz_member_user)
|
|
||||||
CREATE TABLE `tz_member_user` (
|
|
||||||
`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)',
|
|
||||||
`login_ip` varchar(32) DEFAULT NULL COMMENT '最后登录IP',
|
|
||||||
`login_date` datetime DEFAULT NULL COMMENT '最后登录时间',
|
|
||||||
`nickname` varchar(64) DEFAULT NULL COMMENT '用户昵称',
|
|
||||||
`avatar` varchar(512) DEFAULT NULL COMMENT '用户头像',
|
|
||||||
`name` varchar(64) DEFAULT NULL COMMENT '真实名字',
|
|
||||||
`sex` tinyint(4) DEFAULT NULL COMMENT '性别 (枚举 SexEnum)',
|
|
||||||
`birthday` datetime DEFAULT NULL COMMENT '出生日期',
|
|
||||||
`area_id` int(11) DEFAULT NULL COMMENT '所在地 (关联 Area.id 字段)',
|
|
||||||
`mark` varchar(512) DEFAULT NULL COMMENT '用户备注',
|
|
||||||
`point` int(11) DEFAULT NULL COMMENT '积分',
|
|
||||||
`tag_ids` varchar(512) DEFAULT NULL COMMENT '会员标签列表,以逗号分隔',
|
|
||||||
`level_id` bigint(20) DEFAULT NULL COMMENT '会员级别编号 (关联 MemberLevelDO.id 字段)',
|
|
||||||
`experience` int(11) DEFAULT NULL COMMENT '会员经验',
|
|
||||||
`group_id` bigint(20) 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`),
|
|
||||||
UNIQUE KEY `uk_mobile` (`mobile`),
|
|
||||||
KEY `idx_level_id` (`level_id`),
|
|
||||||
KEY `idx_group_id` (`group_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员用户表';
|
|
||||||
|
|
||||||
-- 用户收件地址表 (tz_member_address)
|
|
||||||
CREATE TABLE `tz_member_address` (
|
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
|
||||||
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
|
||||||
`name` varchar(64) NOT NULL COMMENT '收件人名称',
|
|
||||||
`mobile` varchar(11) NOT NULL COMMENT '手机号',
|
|
||||||
`area_id` bigint(20) NOT NULL COMMENT '地区编号',
|
|
||||||
`detail_address` varchar(512) NOT NULL COMMENT '收件详细地址',
|
|
||||||
`default_status` tinyint(1) DEFAULT NULL COMMENT '是否默认 (true - 默认收件地址)',
|
|
||||||
`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_user_id` (`user_id`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户收件地址表';
|
|
||||||
@@ -3,8 +3,6 @@ CREATE TABLE `tz_trade_order`
|
|||||||
(
|
(
|
||||||
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '订单编号,主键自增',
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '订单编号,主键自增',
|
||||||
`order_num` varchar(64) NOT NULL COMMENT '订单流水号',
|
`order_num` varchar(64) NOT NULL COMMENT '订单流水号',
|
||||||
`order_category_id` bigint NOT NULL COMMENT '订单类目id',
|
|
||||||
`order_category_name` varchar(64) NOT NULL COMMENT '订单类目名称',
|
|
||||||
`order_type` tinyint NOT NULL COMMENT '订单类型 (枚举 TradeOrderTypeEnum)',
|
`order_type` tinyint NOT NULL COMMENT '订单类型 (枚举 TradeOrderTypeEnum)',
|
||||||
`order_terminal` tinyint NOT NULL COMMENT '订单来源 (枚举 TerminalEnum)',
|
`order_terminal` tinyint NOT NULL COMMENT '订单来源 (枚举 TerminalEnum)',
|
||||||
`order_status` tinyint NOT NULL COMMENT '订单状态 (枚举 TradeOrderStatusEnum)',
|
`order_status` tinyint NOT NULL COMMENT '订单状态 (枚举 TradeOrderStatusEnum)',
|
||||||
@@ -17,19 +15,18 @@ CREATE TABLE `tz_trade_order`
|
|||||||
`cancel_time` datetime DEFAULT NULL COMMENT '订单取消时间',
|
`cancel_time` datetime DEFAULT NULL COMMENT '订单取消时间',
|
||||||
`cancel_type` tinyint DEFAULT NULL COMMENT '取消类型 (枚举 TradeOrderCancelTypeEnum)',
|
`cancel_type` tinyint DEFAULT NULL COMMENT '取消类型 (枚举 TradeOrderCancelTypeEnum)',
|
||||||
`cancel_reason` varchar(128) DEFAULT NULL COMMENT '取消原因',
|
`cancel_reason` varchar(128) DEFAULT NULL COMMENT '取消原因',
|
||||||
|
`cancel_remark` varchar(255) DEFAULT NULL COMMENT '取消原因备注',
|
||||||
`merchant_id` bigint DEFAULT NULL COMMENT '商家编号',
|
`merchant_id` bigint DEFAULT NULL COMMENT '商家编号',
|
||||||
`merchant_name` varchar(64) DEFAULT NULL COMMENT '商家名称',
|
`merchant_name` varchar(64) DEFAULT NULL COMMENT '商家名称',
|
||||||
`merchant_remark` varchar(512) DEFAULT NULL COMMENT '商家备注',
|
`merchant_remark` varchar(512) DEFAULT NULL COMMENT '商家备注',
|
||||||
`comment_status` tinyint(1) DEFAULT NULL COMMENT '是否评价 (true-已评价, false-未评价)',
|
`comment_status` tinyint(1) DEFAULT NULL COMMENT '是否评价 (true-已评价, false-未评价)',
|
||||||
`sub_type` tinyint(1) NOT NULL DEFAULT 1 COMMENT '预约类型(1预约 2 加急)',
|
`expense_price` int DEFAULT NULL COMMENT '商品成本(单),单位:分',
|
||||||
`sub_time` datetime NOT NULL COMMENT '预约时间',
|
`price` int DEFAULT NULL COMMENT '商品原价(单),单位:分',
|
||||||
`expense_price` int(11) DEFAULT NULL COMMENT '商品成本(单),单位:分',
|
`discount_price` int DEFAULT NULL COMMENT '优惠金额(总),单位:分',
|
||||||
`price` int(11) DEFAULT NULL COMMENT '商品原价(单),单位:分',
|
`delivery_price` int DEFAULT NULL COMMENT '运费金额(总),单位:分',
|
||||||
`discount_price` int(11) DEFAULT NULL COMMENT '优惠金额(总),单位:分',
|
`adjust_price` int DEFAULT NULL COMMENT '订单调价(总),单位:分',
|
||||||
`delivery_price` int(11) DEFAULT NULL COMMENT '运费金额(总),单位:分',
|
`pay_price` int DEFAULT NULL COMMENT '应付金额(总),单位:分',
|
||||||
`adjust_price` int(11) DEFAULT NULL COMMENT '订单调价(总),单位:分',
|
`live_price` int DEFAULT NULL COMMENT '实收金额(总),单位:分',
|
||||||
`pay_price` int(11) DEFAULT NULL COMMENT '应付金额(总),单位:分',
|
|
||||||
`live_price` int(11) DEFAULT NULL COMMENT '实收金额(总),单位:分',
|
|
||||||
`pay_order_id` bigint DEFAULT NULL COMMENT '支付订单编号',
|
`pay_order_id` bigint DEFAULT NULL COMMENT '支付订单编号',
|
||||||
`pay_status` tinyint(1) DEFAULT NULL COMMENT '是否已支付 (true-已支付, false-未支付)',
|
`pay_status` tinyint(1) DEFAULT NULL COMMENT '是否已支付 (true-已支付, false-未支付)',
|
||||||
`pay_type` tinyint DEFAULT NULL COMMENT '支付方式(PayTypeEnum)',
|
`pay_type` tinyint DEFAULT NULL COMMENT '支付方式(PayTypeEnum)',
|
||||||
@@ -59,6 +56,7 @@ CREATE TABLE `tz_trade_order`
|
|||||||
`creator` varchar(64) DEFAULT NULL COMMENT '创建者',
|
`creator` varchar(64) DEFAULT NULL COMMENT '创建者',
|
||||||
`updater` varchar(64) DEFAULT NULL COMMENT '更新者',
|
`updater` varchar(64) DEFAULT NULL COMMENT '更新者',
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
|
`deleted` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint NOT NULL DEFAULT '1' COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
UNIQUE KEY `uk_order_num` (`order_num`),
|
UNIQUE KEY `uk_order_num` (`order_num`),
|
||||||
KEY `idx_user_id` (`user_id`),
|
KEY `idx_user_id` (`user_id`),
|
||||||
@@ -73,43 +71,56 @@ CREATE TABLE `tz_trade_order`
|
|||||||
-- 交易订单项表 (trade_order_item)
|
-- 交易订单项表 (trade_order_item)
|
||||||
CREATE TABLE `tz_trade_order_item`
|
CREATE TABLE `tz_trade_order_item`
|
||||||
(
|
(
|
||||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||||
`user_id` bigint(20) NOT NULL COMMENT '用户编号',
|
`user_id` bigint NOT NULL COMMENT '用户编号',
|
||||||
`order_id` bigint(20) NOT NULL COMMENT '订单编号',
|
`order_id` bigint NOT NULL COMMENT '订单编号',
|
||||||
`cart_id` bigint(20) DEFAULT NULL COMMENT '购物车项编号',
|
`cart_id` bigint DEFAULT NULL COMMENT '购物车项编号',
|
||||||
`spu_id` bigint(20) NOT NULL COMMENT '商品 SPU 编号',
|
`spu_id` bigint NOT NULL COMMENT '商品 SPU 编号',
|
||||||
`spu_name` varchar(256) NOT NULL COMMENT '商品 SPU 名称',
|
`spu_name` varchar(256) NOT NULL COMMENT '商品 SPU 名称',
|
||||||
`spu_type` tinyint(1) NOT NULL COMMENT '商品类型(1商品 2服务)',
|
`spu_type` tinyint(1) NOT NULL COMMENT '商品类型(1商品 2服务)',
|
||||||
`sku_id` bigint(20) NOT NULL COMMENT '商品 SKU 编号',
|
`sku_id` bigint NOT NULL COMMENT '商品 SKU 编号',
|
||||||
`sku_name` bigint(20) NOT NULL COMMENT '商品 SKU 名称',
|
`sku_name` varchar(255) NOT NULL COMMENT '商品 SKU 名称',
|
||||||
`pic_url` varchar(512) NOT NULL COMMENT '商品图片',
|
`shop_id` bigint DEFAULT NULL COMMENT '店铺id',
|
||||||
`count` int(11) NOT NULL COMMENT '购买数量',
|
`shop_name` varchar(64) DEFAULT NULL COMMENT '店铺名称',
|
||||||
`unit` varchar(16) NOT NULL COMMENT '商品单位',
|
`shop_logo` varchar(255) DEFAULT NULL COMMENT '店铺logo',
|
||||||
`expense_price` int(11) NOT NULL COMMENT '商品成本(单),单位:分',
|
`order_category_name` varchar(64) NOT NULL COMMENT '订单类目名称',
|
||||||
`price` int(11) NOT NULL COMMENT '商品原价(单),单位:分',
|
`order_category_id` bigint NOT NULL COMMENT '订单类目id',
|
||||||
`discount_price` int(11) NOT NULL COMMENT '优惠金额(总),单位:分',
|
`pic_url` varchar(512) NOT NULL COMMENT '商品图片',
|
||||||
`delivery_price` int(11) NOT NULL COMMENT '运费金额(总),单位:分',
|
`count` int NOT NULL COMMENT '购买数量',
|
||||||
`adjust_price` int(11) NOT NULL COMMENT '订单调价(总),单位:分',
|
`unit` varchar(16) DEFAULT NULL COMMENT '商品单位',
|
||||||
`pay_price` int(11) NOT NULL COMMENT '应付金额(总),单位:分',
|
`expense_price` int DEFAULT NULL COMMENT '商品成本(单),单位:分',
|
||||||
`live_price` int(11) NOT NULL COMMENT '实收金额(总),单位:分',
|
`price` int DEFAULT NULL COMMENT '商品原价(单),单位:分',
|
||||||
|
`discount_price` int DEFAULT NULL COMMENT '优惠金额(总),单位:分',
|
||||||
`serve_address` datetime NOT NULL COMMENT '服务地址',
|
`delivery_price` int DEFAULT NULL COMMENT '运费金额(总),单位:分',
|
||||||
`properties` json DEFAULT NULL COMMENT '属性数组',
|
`adjust_price` int DEFAULT NULL COMMENT '订单调价(总),单位:分',
|
||||||
`serve_info` json DEFAULT NULL COMMENT '服务信息',
|
`pay_price` int DEFAULT NULL COMMENT '应付金额(总),单位:分',
|
||||||
`serve_ext_info` json DEFAULT NULL COMMENT '扩展服务信息,存储额外的服务相关数据',
|
`live_price` int DEFAULT NULL COMMENT '实收金额(总),单位:分',
|
||||||
`price_ext_info` json DEFAULT NULL COMMENT '附加费信息',
|
`refund_status` tinyint DEFAULT NULL COMMENT '退款状态 (枚举 TradeOrderRefundStatusEnum)',
|
||||||
`version` int(11) DEFAULT '0' COMMENT '版本号(乐观锁)',
|
`refund_price` int DEFAULT NULL COMMENT '退款金额,单位:分',
|
||||||
`create_time` datetime NOT NULL COMMENT '创建时间',
|
`refund_time` datetime DEFAULT NULL COMMENT '退款时间',
|
||||||
`update_time` datetime NOT NULL COMMENT '最后更新时间',
|
`sub_type` tinyint(1) DEFAULT '1' COMMENT '预约类型(1预约 2 加急)',
|
||||||
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
`sub_time` datetime DEFAULT NULL COMMENT '预约时间',
|
||||||
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
`serve_address` varchar(255) DEFAULT NULL COMMENT '服务地址',
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT 0 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`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `idx_order_id` (`order_id`),
|
KEY `idx_order_id` (`order_id`),
|
||||||
KEY `idx_sku_id` (`sku_id`),
|
KEY `idx_sku_id` (`sku_id`),
|
||||||
KEY `idx_user_id` (`user_id`)
|
KEY `idx_user_id` (`user_id`)
|
||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
DEFAULT CHARSET = utf8mb4 COMMENT ='交易订单项表';
|
AUTO_INCREMENT = 2
|
||||||
|
DEFAULT CHARSET = utf8mb4
|
||||||
|
COLLATE = utf8mb4_0900_ai_ci COMMENT ='交易订单项表';
|
||||||
|
|
||||||
|
|
||||||
-- 订单日志表 (trade_order_log)
|
-- 订单日志表 (trade_order_log)
|
||||||
@@ -128,6 +139,7 @@ CREATE TABLE `tz_trade_order_log`
|
|||||||
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
`creator` varchar(64) NOT NULL COMMENT '创建者',
|
||||||
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
`updater` varchar(64) NOT NULL COMMENT '更新者',
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
|
||||||
|
`tenant_id` bigint NOT NULL DEFAULT '1' COMMENT '租户编号',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `idx_order_id` (`order_id`),
|
KEY `idx_order_id` (`order_id`),
|
||||||
KEY `idx_user_id` (`user_id`)
|
KEY `idx_user_id` (`user_id`)
|
||||||
@@ -307,4 +319,20 @@ CREATE TABLE `tz_trade_delivery_pick_up_store`
|
|||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
DEFAULT CHARSET = utf8mb4 COMMENT ='自提门店表';
|
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 ='订单预约时间修改记录表';
|
||||||
|
|
||||||
|
|||||||
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 ='会员等级表';
|
||||||
|
|
||||||
@@ -163,6 +163,16 @@
|
|||||||
<artifactId>tashow-trade-api</artifactId>
|
<artifactId>tashow-trade-api</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</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>
|
<dependency>
|
||||||
<groupId>com.tashow.cloud</groupId>
|
<groupId>com.tashow.cloud</groupId>
|
||||||
<artifactId>tashow-module-trade</artifactId>
|
<artifactId>tashow-module-trade</artifactId>
|
||||||
@@ -180,7 +190,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tashow.cloud</groupId>
|
<groupId>com.tashow.cloud</groupId>
|
||||||
<artifactId>tashow-member-api</artifactId>
|
<artifactId>tashow-user-api</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -193,6 +203,11 @@
|
|||||||
<artifactId>tashow-sdk-payment</artifactId>
|
<artifactId>tashow-sdk-payment</artifactId>
|
||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-product-api</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring 核心 -->
|
<!-- Spring 核心 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -16,7 +16,8 @@
|
|||||||
<module>tashow-product-api</module>
|
<module>tashow-product-api</module>
|
||||||
<module>tashow-trade-api</module>
|
<module>tashow-trade-api</module>
|
||||||
<module>tashow-pay-api</module>
|
<module>tashow-pay-api</module>
|
||||||
<module>tashow-member-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;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.memberapi.enums;
|
package com.tashow.cloud.fileapi.enums;
|
||||||
|
|
||||||
|
|
||||||
import com.tashow.cloud.common.enums.RpcConstants;
|
import com.tashow.cloud.common.enums.RpcConstants;
|
||||||
@@ -15,9 +15,9 @@ public class ApiConstants {
|
|||||||
*
|
*
|
||||||
* 注意,需要保证和 spring.application.name 保持一致
|
* 注意,需要保证和 spring.application.name 保持一致
|
||||||
*/
|
*/
|
||||||
public static final String NAME = "member-server";
|
public static final String NAME = "file-server";
|
||||||
|
|
||||||
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/member";
|
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/file";
|
||||||
|
|
||||||
public static final String VERSION = "1.0.0";
|
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, "学生班级已存在");
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
/**
|
|
||||||
* 消息队列的消息
|
|
||||||
*/
|
|
||||||
package com.tashow.cloud.memberapi.message;
|
|
||||||
@@ -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);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -32,4 +32,10 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode SKU_SERVICES_FORM_NOT_EXISTS = new ErrorCode(10021, "商品SKU扩展服务表单不存在");
|
ErrorCode SKU_SERVICES_FORM_NOT_EXISTS = new ErrorCode(10021, "商品SKU扩展服务表单不存在");
|
||||||
ErrorCode SKU_SERVICE_TRANSPORT_NOT_EXISTS = new ErrorCode(10022, "服务遗体运输不存在");
|
ErrorCode SKU_SERVICE_TRANSPORT_NOT_EXISTS = new ErrorCode(10022, "服务遗体运输不存在");
|
||||||
ErrorCode SKU_SERVICE_DETAILS_NOT_EXISTS = new ErrorCode(10023, "服务详情不存在");
|
ErrorCode SKU_SERVICE_DETAILS_NOT_EXISTS = new ErrorCode(10023, "服务详情不存在");
|
||||||
|
|
||||||
|
ErrorCode SKU_DOES_NOT_EXIST = new ErrorCode(10030, "商品不存在");
|
||||||
|
ErrorCode SKU_DELETE = new ErrorCode(10030, "商品已删除");
|
||||||
|
ErrorCode SKU_DISABLE = new ErrorCode(10031, "商品已禁用");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public class TradeOrderRespDTO {
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
//订单流水号
|
//订单流水号
|
||||||
private String no;
|
private String orderNum;
|
||||||
|
|
||||||
//订单类型
|
//订单类型
|
||||||
private Integer type; // 参见 TradeOrderTypeEnum 枚举
|
private Integer type; // 参见 TradeOrderTypeEnum 枚举
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public interface ErrorCodeConstants {
|
|||||||
ErrorCode ORDER_ITEM_NOT_FOUND = new ErrorCode(1_011_000_010, "交易订单项不存在");
|
ErrorCode ORDER_ITEM_NOT_FOUND = new ErrorCode(1_011_000_010, "交易订单项不存在");
|
||||||
ErrorCode ORDER_NOT_FOUND = new ErrorCode(1_011_000_011, "交易订单不存在");
|
ErrorCode ORDER_NOT_FOUND = new ErrorCode(1_011_000_011, "交易订单不存在");
|
||||||
ErrorCode ORDER_ITEM_UPDATE_AFTER_SALE_STATUS_FAIL = new ErrorCode(1_011_000_012, "交易订单项更新售后状态失败,请重试");
|
ErrorCode ORDER_ITEM_UPDATE_AFTER_SALE_STATUS_FAIL = new ErrorCode(1_011_000_012, "交易订单项更新售后状态失败,请重试");
|
||||||
|
ErrorCode ORDER_UPDATE_UNWAITACCEPT_FAIL = new ErrorCode(1_011_000_012, "交易订单更新状态失败,当前订单不处于待验收状态");
|
||||||
ErrorCode ORDER_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(1_011_000_013, "交易订单更新支付状态失败,订单不是【未支付】状态");
|
ErrorCode ORDER_UPDATE_PAID_STATUS_NOT_UNPAID = new ErrorCode(1_011_000_013, "交易订单更新支付状态失败,订单不是【未支付】状态");
|
||||||
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR = new ErrorCode(1_011_000_014, "交易订单更新支付状态失败,支付单编号不匹配");
|
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_ORDER_ID_ERROR = new ErrorCode(1_011_000_014, "交易订单更新支付状态失败,支付单编号不匹配");
|
||||||
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS = new ErrorCode(1_011_000_015, "交易订单更新支付状态失败,支付单状态不是【支付成功】状态");
|
ErrorCode ORDER_UPDATE_PAID_FAIL_PAY_ORDER_STATUS_NOT_SUCCESS = new ErrorCode(1_011_000_015, "交易订单更新支付状态失败,支付单状态不是【支付成功】状态");
|
||||||
|
|||||||
@@ -20,40 +20,15 @@ import static cn.hutool.core.util.ArrayUtil.firstMatch;
|
|||||||
@Getter
|
@Getter
|
||||||
public enum AfterSaleStatusEnum implements ArrayValuable<Integer> {
|
public enum AfterSaleStatusEnum implements ArrayValuable<Integer> {
|
||||||
|
|
||||||
/**
|
APPLY(10,"等待审核", ""), // 有赞的状态提示:退款申请待商家处理
|
||||||
* 【申请售后】
|
SELLER_AGREE(20, "审核通过", ""), // 有赞的状态提示:请退货并填写物流信息
|
||||||
*/
|
BUYER_DELIVERY(30,"已完成", ""), // 有赞的状态提示:退货退款申请待商家处理
|
||||||
APPLY(10,"申请中", "会员申请退款"), // 有赞的状态提示:退款申请待商家处理
|
WAIT_REFUND(40, "已取消", ""), // 有赞的状态提示:无(有赞无该状态)
|
||||||
/**
|
COMPLETE(50, "已拒绝", ""), // 有赞的状态提示:退款成功
|
||||||
* 卖家通过售后;【商品待退货】
|
|
||||||
*/
|
|
||||||
SELLER_AGREE(20, "卖家通过", "商家同意退款"), // 有赞的状态提示:请退货并填写物流信息
|
|
||||||
/**
|
|
||||||
* 买家已退货,等待卖家收货;【商家待收货】
|
|
||||||
*/
|
|
||||||
BUYER_DELIVERY(30,"待卖家收货", "会员填写退货物流信息"), // 有赞的状态提示:退货退款申请待商家处理
|
|
||||||
/**
|
|
||||||
* 卖家已收货,等待平台退款;等待退款【等待退款】
|
|
||||||
*/
|
|
||||||
WAIT_REFUND(40, "等待平台退款", "商家收货"), // 有赞的状态提示:无(有赞无该状态)
|
|
||||||
/**
|
|
||||||
* 完成退款【退款成功】
|
|
||||||
*/
|
|
||||||
COMPLETE(50, "完成", "商家确认退款"), // 有赞的状态提示:退款成功
|
|
||||||
/**
|
|
||||||
* 【买家取消】
|
|
||||||
*/
|
|
||||||
BUYER_CANCEL(61, "买家取消售后", "会员取消退款"), // 有赞的状态提示:退款关闭
|
|
||||||
/**
|
|
||||||
* 卖家拒绝售后;商家拒绝【商家拒绝】
|
|
||||||
*/
|
|
||||||
SELLER_DISAGREE(62,"卖家拒绝", "商家拒绝退款"), // 有赞的状态提示:商家不同意退款申请
|
|
||||||
/**
|
|
||||||
* 卖家拒绝收货,终止售后;【商家拒收货】
|
|
||||||
*/
|
|
||||||
SELLER_REFUSE(63,"卖家拒绝收货", "商家拒绝收货"), // 有赞的状态提示:商家拒绝收货,不同意退款
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
public static final Integer[] ARRAYS = Arrays.stream(values()).map(AfterSaleStatusEnum::getStatus).toArray(Integer[]::new);
|
public static final Integer[] ARRAYS = Arrays.stream(values()).map(AfterSaleStatusEnum::getStatus).toArray(Integer[]::new);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ public enum TradeOrderOperateTypeEnum {
|
|||||||
SYSTEM_COMMENT(34, "到期未评价,系统自动评价"),
|
SYSTEM_COMMENT(34, "到期未评价,系统自动评价"),
|
||||||
MEMBER_CANCEL(40, "取消订单"),
|
MEMBER_CANCEL(40, "取消订单"),
|
||||||
SYSTEM_CANCEL(41, "到期未支付,系统自动取消订单"),
|
SYSTEM_CANCEL(41, "到期未支付,系统自动取消订单"),
|
||||||
|
ADMIN_CANCEL(42, "管理员取消订单"),
|
||||||
// 42 预留:管理员取消订单
|
// 42 预留:管理员取消订单
|
||||||
ADMIN_CANCEL_AFTER_SALE(43, "订单全部售后,管理员自动取消订单"),
|
ADMIN_CANCEL_AFTER_SALE(43, "订单全部售后,管理员自动取消订单"),
|
||||||
MEMBER_DELETE(49, "删除订单"),
|
MEMBER_DELETE(49, "删除订单"),
|
||||||
|
|||||||
@@ -55,6 +55,15 @@ public enum TradeOrderStatusEnum implements ArrayValuable<Integer> {
|
|||||||
public static boolean isUnpaid(Integer status) {
|
public static boolean isUnpaid(Integer status) {
|
||||||
return ObjectUtil.equal(WAITPAID.getStatus(), status);
|
return ObjectUtil.equal(WAITPAID.getStatus(), status);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 判断指定状态,是否正处于【待验收】状态
|
||||||
|
*
|
||||||
|
* @param status 指定状态
|
||||||
|
* @return 是否
|
||||||
|
*/
|
||||||
|
public static boolean isWaitAccept(Integer status) {
|
||||||
|
return ObjectUtil.equal(WAITACCEPT.getStatus(), status);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断指定状态,是否正处于【待发货】状态
|
* 判断指定状态,是否正处于【待发货】状态
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<version>${revision}</version>
|
<version>${revision}</version>
|
||||||
</parent>
|
</parent>
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>tashow-member-api</artifactId>
|
<artifactId>tashow-user-api</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>${project.artifactId}</name>
|
<name>${project.artifactId}</name>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.tashow.cloud.memberapi.api.address;
|
package com.tashow.cloud.userapi.api.address;
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.CommonResult;
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
import com.tashow.cloud.memberapi.api.address.dto.MemberAddressRespDTO;
|
import com.tashow.cloud.userapi.api.address.dto.MemberAddressRespDTO;
|
||||||
import com.tashow.cloud.memberapi.enums.ApiConstants;
|
import com.tashow.cloud.userapi.enums.ApiConstants;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.memberapi.api.address.dto;
|
package com.tashow.cloud.userapi.api.address.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
/**
|
/**
|
||||||
* member API 包,定义暴露给其它模块的 API
|
* member API 包,定义暴露给其它模块的 API
|
||||||
*/
|
*/
|
||||||
package com.tashow.cloud.memberapi.api;
|
package com.tashow.cloud.userapi.api;
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.tashow.cloud.memberapi.api.user;
|
package com.tashow.cloud.userapi.api.user;
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.CommonResult;
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
import com.tashow.cloud.memberapi.api.user.dto.MemberUserRespDTO;
|
import com.tashow.cloud.userapi.api.user.dto.UserMemberRespDTO;
|
||||||
import com.tashow.cloud.memberapi.enums.ApiConstants;
|
import com.tashow.cloud.userapi.enums.ApiConstants;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
@@ -17,9 +17,9 @@ import static com.tashow.cloud.common.util.collection.CollectionUtils.convertMap
|
|||||||
* RPC 服务 - 会员用户
|
* RPC 服务 - 会员用户
|
||||||
*/
|
*/
|
||||||
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
@FeignClient(name = ApiConstants.NAME) // TODO 芋艿:fallbackFactory =
|
||||||
public interface MemberUserApi {
|
public interface UserMemberApi {
|
||||||
|
|
||||||
String PREFIX = ApiConstants.PREFIX + "/user";
|
String PREFIX = ApiConstants.PREFIX + "/member";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,9 +28,9 @@ public interface MemberUserApi {
|
|||||||
* @param ids 用户编号的数组
|
* @param ids 用户编号的数组
|
||||||
* @return 会员用户 Map
|
* @return 会员用户 Map
|
||||||
*/
|
*/
|
||||||
default Map<Long, MemberUserRespDTO> getUserMap(Collection<Long> ids) {
|
default Map<Long, UserMemberRespDTO> getUserMap(Collection<Long> ids) {
|
||||||
List<MemberUserRespDTO> list = getUserList(ids).getCheckedData();
|
List<UserMemberRespDTO> list = getUserList(ids).getCheckedData();
|
||||||
return convertMap(list, MemberUserRespDTO::getId);
|
return convertMap(list, UserMemberRespDTO::getId);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +39,7 @@ public interface MemberUserApi {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(PREFIX + "/get")
|
@GetMapping(PREFIX + "/get")
|
||||||
CommonResult<MemberUserRespDTO> getUser(@RequestParam("id") Long id);
|
CommonResult<UserMemberRespDTO> getUser(@RequestParam("id") Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获得会员用户信息们
|
* 获得会员用户信息们
|
||||||
@@ -47,7 +47,7 @@ public interface MemberUserApi {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(PREFIX + "/list")
|
@GetMapping(PREFIX + "/list")
|
||||||
CommonResult<List<MemberUserRespDTO>> getUserList(@RequestParam("ids") Collection<Long> ids);
|
CommonResult<List<UserMemberRespDTO>> getUserList(@RequestParam("ids") Collection<Long> ids);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基于用户昵称,模糊匹配用户列表
|
* 基于用户昵称,模糊匹配用户列表
|
||||||
@@ -55,7 +55,7 @@ public interface MemberUserApi {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(PREFIX + "/list-by-nickname")
|
@GetMapping(PREFIX + "/list-by-nickname")
|
||||||
CommonResult<List<MemberUserRespDTO>> getUserListByNickname(@RequestParam("nickname") String nickname);
|
CommonResult<List<UserMemberRespDTO>> getUserListByNickname(@RequestParam("nickname") String nickname);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基于手机号,精准匹配用户
|
* 基于手机号,精准匹配用户
|
||||||
@@ -63,7 +63,7 @@ public interface MemberUserApi {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping(PREFIX + "/get-by-mobile")
|
@GetMapping(PREFIX + "/get-by-mobile")
|
||||||
CommonResult<MemberUserRespDTO> getUserByMobile(@RequestParam("mobile") String mobile);
|
CommonResult<UserMemberRespDTO> getUserByMobile(@RequestParam("mobile") String mobile);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验用户是否存在
|
* 校验用户是否存在
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.memberapi.api.user.dto;
|
package com.tashow.cloud.userapi.api.user.dto;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -8,13 +8,15 @@ import java.time.LocalDateTime;
|
|||||||
* RPC 服务 - 用户信息 Response DTO
|
* RPC 服务 - 用户信息 Response DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class MemberUserRespDTO {
|
public class UserMemberRespDTO {
|
||||||
|
|
||||||
//用户编号
|
//用户编号
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
//昵称
|
//昵称
|
||||||
private String nickname;
|
private String nickname;
|
||||||
|
//姓名
|
||||||
|
private String name;
|
||||||
|
|
||||||
//帐号状态
|
//帐号状态
|
||||||
private Integer status; // 参见 CommonStatusEnum 枚举
|
private Integer status; // 参见 CommonStatusEnum 枚举
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.tashow.cloud.userapi.enums;
|
||||||
|
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.enums.RpcConstants;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* API 相关的枚举
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public class ApiConstants {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务名
|
||||||
|
*
|
||||||
|
* 注意,需要保证和 spring.application.name 保持一致
|
||||||
|
*/
|
||||||
|
public static final String NAME = "user-server";
|
||||||
|
|
||||||
|
public static final String PREFIX = RpcConstants.RPC_API_PREFIX + "/user";
|
||||||
|
|
||||||
|
public static final String VERSION = "1.0.0";
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.memberapi.enums;
|
package com.tashow.cloud.userapi.enums;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Member 字典类型的枚举类
|
* Member 字典类型的枚举类
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.memberapi.enums;
|
package com.tashow.cloud.userapi.enums;
|
||||||
|
|
||||||
|
|
||||||
import com.tashow.cloud.common.exception.ErrorCode;
|
import com.tashow.cloud.common.exception.ErrorCode;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.memberapi.enums;
|
package com.tashow.cloud.userapi.enums;
|
||||||
|
|
||||||
import cn.hutool.core.util.EnumUtil;
|
import cn.hutool.core.util.EnumUtil;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.memberapi.enums.point;
|
package com.tashow.cloud.userapi.enums.point;
|
||||||
|
|
||||||
import cn.hutool.core.util.EnumUtil;
|
import cn.hutool.core.util.EnumUtil;
|
||||||
import com.tashow.cloud.common.core.ArrayValuable;
|
import com.tashow.cloud.common.core.ArrayValuable;
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
/**
|
||||||
|
* 消息队列的消息
|
||||||
|
*/
|
||||||
|
package com.tashow.cloud.userapi.message;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.memberapi.message.user;
|
package com.tashow.cloud.userapi.message.user;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -126,6 +126,10 @@
|
|||||||
<artifactId>commons-lang3</artifactId>
|
<artifactId>commons-lang3</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.tika</groupId>
|
||||||
|
<artifactId>tika-core</artifactId> <!-- 文件客户端:文件类型的识别 -->
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.tashow.cloud.common.enums;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 文档地址
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Getter
|
|
||||||
@AllArgsConstructor
|
|
||||||
public enum DocumentEnum {
|
|
||||||
|
|
||||||
REDIS_INSTALL("https://gitee.com/zhijiantianya/ruoyi-vue-pro/issues/I4VCSJ", "Redis 安装文档"),
|
|
||||||
TENANT("https://doc.iocoder.cn", "SaaS 多租户文档");
|
|
||||||
|
|
||||||
private final String url;
|
|
||||||
private final String memo;
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -177,6 +177,15 @@ public class LocalDateTimeUtils {
|
|||||||
public static Long between(LocalDateTime dateTime) {
|
public static Long between(LocalDateTime dateTime) {
|
||||||
return LocalDateTimeUtil.between(dateTime, LocalDateTime.now(), ChronoUnit.DAYS);
|
return LocalDateTimeUtil.between(dateTime, LocalDateTime.now(), ChronoUnit.DAYS);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 获取指定日期到现在过了几天,如果指定日期在当前日期之后,获取结果为负
|
||||||
|
*
|
||||||
|
* @param dateTime 日期
|
||||||
|
* @return 相差天数
|
||||||
|
*/
|
||||||
|
public static Long betweenWithNow(LocalDateTime dateTime) {
|
||||||
|
return LocalDateTimeUtil.between(dateTime, LocalDateTime.now(), ChronoUnit.SECONDS);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取今天的开始时间
|
* 获取今天的开始时间
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.infra.framework.file.core.utils;
|
package com.tashow.cloud.common.util.io;
|
||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@@ -64,7 +64,7 @@ public class FileTypeUtils {
|
|||||||
String contentType = getMineType(content, filename);
|
String contentType = getMineType(content, filename);
|
||||||
response.setContentType(contentType);
|
response.setContentType(contentType);
|
||||||
// 针对 video 的特殊处理,解决视频地址在移动端播放的兼容性问题
|
// 针对 video 的特殊处理,解决视频地址在移动端播放的兼容性问题
|
||||||
if (StrUtil.containsIgnoreCase(contentType, "video")) {
|
if (StrUtil.containsIgnoreCase(contentType, "video")||StrUtil.containsIgnoreCase(contentType, "audio")) {
|
||||||
response.setHeader("Content-Length", String.valueOf(content.length - 1));
|
response.setHeader("Content-Length", String.valueOf(content.length - 1));
|
||||||
response.setHeader("Content-Range", String.valueOf(content.length - 1));
|
response.setHeader("Content-Range", String.valueOf(content.length - 1));
|
||||||
response.setHeader("Accept-Ranges", "bytes");
|
response.setHeader("Accept-Ranges", "bytes");
|
||||||
@@ -72,5 +72,4 @@ public class FileTypeUtils {
|
|||||||
// 输出附件
|
// 输出附件
|
||||||
IoUtil.write(response.getOutputStream(), false, content);
|
IoUtil.write(response.getOutputStream(), false, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018-2999 广州市蓝海创新科技有限公司 All rights reserved.
|
||||||
|
*
|
||||||
|
* https://www.mall4j.com/
|
||||||
|
*
|
||||||
|
* 未经允许,不可做商业用途!
|
||||||
|
*
|
||||||
|
* 版权所有,侵权必究!
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.tashow.cloud.common.util.json.databind;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.fasterxml.jackson.core.JsonGenerator;
|
||||||
|
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||||
|
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件序列化
|
||||||
|
*/
|
||||||
|
public class FileJsonSerializer extends JsonSerializer<String> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException {
|
||||||
|
if (StrUtil.isBlank(value)) {
|
||||||
|
gen.writeString(StrUtil.EMPTY);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
String[] imgs = value.split(StrUtil.COMMA);
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String resourceUrl = "";
|
||||||
|
String rule="^((http[s]{0,1})://)";
|
||||||
|
Pattern pattern= Pattern.compile(rule);
|
||||||
|
// if (Objects.equals(imgUploadUtil.getUploadType(), 2)) {
|
||||||
|
// resourceUrl = qiniu.getResourcesUrl();
|
||||||
|
// } else if (Objects.equals(imgUploadUtil.getUploadType(), 1)) {
|
||||||
|
// resourceUrl = imgUploadUtil.getResourceUrl();
|
||||||
|
// }
|
||||||
|
for (String img : imgs) {
|
||||||
|
Matcher matcher = pattern.matcher(img);
|
||||||
|
//若图片以http或https开头,直接返回
|
||||||
|
if (matcher.find()){
|
||||||
|
sb.append(img).append(StrUtil.COMMA);
|
||||||
|
}else {
|
||||||
|
sb.append(resourceUrl).append(img).append(StrUtil.COMMA);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.deleteCharAt(sb.length()-1);
|
||||||
|
gen.writeString(sb.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -29,7 +29,7 @@ import java.util.List;
|
|||||||
* 1. {@link BaseMapper} 为 MyBatis Plus 的基础接口,提供基础的 CRUD 能力
|
* 1. {@link BaseMapper} 为 MyBatis Plus 的基础接口,提供基础的 CRUD 能力
|
||||||
* 2. {@link MPJBaseMapper} 为 MyBatis Plus Join 的基础接口,提供连表 Join 能力
|
* 2. {@link MPJBaseMapper} 为 MyBatis Plus Join 的基础接口,提供连表 Join 能力
|
||||||
*/
|
*/
|
||||||
public interface BaseMapperX<T> extends MPJBaseMapper<T> {
|
public interface BaseMapperX<T> extends MPJBaseMapper<T>,BaseMapper<T> {
|
||||||
|
|
||||||
default PageResult<T> selectPage(SortablePageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) {
|
default PageResult<T> selectPage(SortablePageParam pageParam, @Param("ew") Wrapper<T> queryWrapper) {
|
||||||
return selectPage(pageParam, pageParam.getSortingFields(), queryWrapper);
|
return selectPage(pageParam, pageParam.getSortingFields(), queryWrapper);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class EnvEnvironmentPostProcessor implements EnvironmentPostProcessor {
|
|||||||
environment.getSystemProperties().put(hostNameKey, EnvUtils.getHostName());
|
environment.getSystemProperties().put(hostNameKey, EnvUtils.getHostName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1.1 如果没有 yudao.env.tag 配置项,则不进行配置项的修改
|
// 1.1 如果没有 tashow.env.tag 配置项,则不进行配置项的修改
|
||||||
String tag = EnvUtils.getTag(environment);
|
String tag = EnvUtils.getTag(environment);
|
||||||
if (StrUtil.isEmpty(tag)) {
|
if (StrUtil.isEmpty(tag)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import jakarta.validation.constraints.NotNull;
|
|||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@ConfigurationProperties(prefix = "yudao.security")
|
@ConfigurationProperties(prefix = "tashow.security")
|
||||||
@Validated
|
@Validated
|
||||||
@Data
|
@Data
|
||||||
public class SecurityProperties {
|
public class SecurityProperties {
|
||||||
|
|||||||
@@ -136,9 +136,12 @@ public class WebSecurityConfigurerAdapter {
|
|||||||
.requestMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
|
.requestMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll()
|
||||||
.requestMatchers(HttpMethod.HEAD, permitAllUrls.get(HttpMethod.HEAD).toArray(new String[0])).permitAll()
|
.requestMatchers(HttpMethod.HEAD, permitAllUrls.get(HttpMethod.HEAD).toArray(new String[0])).permitAll()
|
||||||
.requestMatchers(HttpMethod.PATCH, permitAllUrls.get(HttpMethod.PATCH).toArray(new String[0])).permitAll()
|
.requestMatchers(HttpMethod.PATCH, permitAllUrls.get(HttpMethod.PATCH).toArray(new String[0])).permitAll()
|
||||||
// 1.3 基于 yudao.security.permit-all-urls 无需认证
|
// 1.3 基于 tashow.security.permit-all-urls 无需认证
|
||||||
.requestMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
|
.requestMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll()
|
||||||
|
|
||||||
)
|
)
|
||||||
|
//app-api 不在security控制权限
|
||||||
|
.authorizeHttpRequests(c->c.requestMatchers(webProperties.getAppApi().getPrefix()+"/**").permitAll())
|
||||||
// ②:每个项目的自定义规则
|
// ②:每个项目的自定义规则
|
||||||
.authorizeHttpRequests(c -> authorizeRequestsCustomizers.forEach(customizer -> customizer.customize(c)))
|
.authorizeHttpRequests(c -> authorizeRequestsCustomizers.forEach(customizer -> customizer.customize(c)))
|
||||||
// ③:兜底规则,必须认证
|
// ③:兜底规则,必须认证
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import com.tashow.cloud.redis.config.TashowCacheProperties;
|
|||||||
import com.tashow.cloud.systemapi.api.tenant.TenantApi;
|
import com.tashow.cloud.systemapi.api.tenant.TenantApi;
|
||||||
import com.tashow.cloud.tenant.core.aop.TenantIgnoreAspect;
|
import com.tashow.cloud.tenant.core.aop.TenantIgnoreAspect;
|
||||||
import com.tashow.cloud.tenant.core.db.TenantDatabaseInterceptor;
|
import com.tashow.cloud.tenant.core.db.TenantDatabaseInterceptor;
|
||||||
import com.tashow.cloud.tenant.core.job.TenantJobAspect;
|
|
||||||
import com.tashow.cloud.tenant.core.mq.rabbitmq.TenantRabbitMQInitializer;
|
import com.tashow.cloud.tenant.core.mq.rabbitmq.TenantRabbitMQInitializer;
|
||||||
import com.tashow.cloud.tenant.core.redis.TenantRedisCacheManager;
|
import com.tashow.cloud.tenant.core.redis.TenantRedisCacheManager;
|
||||||
import com.tashow.cloud.tenant.core.security.TenantSecurityWebFilter;
|
import com.tashow.cloud.tenant.core.security.TenantSecurityWebFilter;
|
||||||
@@ -86,14 +85,6 @@ public class TenantAutoConfiguration {
|
|||||||
return registrationBean;
|
return registrationBean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ========== Job ==========
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnClass(name = "com.xxl.job.core.handler.annotation.XxlJob")
|
|
||||||
public TenantJobAspect tenantJobAspect(TenantFrameworkService tenantFrameworkService) {
|
|
||||||
return new TenantJobAspect(tenantFrameworkService);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConditionalOnClass(name = "org.springframework.amqp.rabbit.core.RabbitTemplate")
|
@ConditionalOnClass(name = "org.springframework.amqp.rabbit.core.RabbitTemplate")
|
||||||
|
|||||||
@@ -2,14 +2,13 @@ package com.tashow.cloud.tenant.config;
|
|||||||
|
|
||||||
import com.tashow.cloud.systemapi.api.tenant.TenantApi;
|
import com.tashow.cloud.systemapi.api.tenant.TenantApi;
|
||||||
import com.tashow.cloud.tenant.core.rpc.TenantRequestInterceptor;
|
import com.tashow.cloud.tenant.core.rpc.TenantRequestInterceptor;
|
||||||
import com.tashow.cloud.tenant.core.rpc.TenantRequestInterceptor;
|
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@ConditionalOnProperty(prefix = "tashow.tenant", value = "enable", matchIfMissing = true) // 允许使用 yudao.tenant.enable=false 禁用多租户
|
@ConditionalOnProperty(prefix = "tashow.tenant", value = "enable", matchIfMissing = true)
|
||||||
@EnableFeignClients(clients = TenantApi.class) // 主要是引入相关的 API 服务
|
@EnableFeignClients(clients = TenantApi.class) // 主要是引入相关的 API 服务
|
||||||
public class TenantRpcAutoConfiguration {
|
public class TenantRpcAutoConfiguration {
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.tashow.cloud.tenant.core.context;
|
package com.tashow.cloud.tenant.core.context;
|
||||||
|
|
||||||
import com.alibaba.ttl.TransmittableThreadLocal;
|
import com.alibaba.ttl.TransmittableThreadLocal;
|
||||||
import com.tashow.cloud.common.enums.DocumentEnum;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多租户上下文 Holder
|
* 多租户上下文 Holder
|
||||||
@@ -37,8 +36,7 @@ public class TenantContextHolder {
|
|||||||
public static Long getRequiredTenantId() {
|
public static Long getRequiredTenantId() {
|
||||||
Long tenantId = getTenantId();
|
Long tenantId = getTenantId();
|
||||||
if (tenantId == null) {
|
if (tenantId == null) {
|
||||||
throw new NullPointerException("TenantContextHolder 不存在租户编号!可参考文档:"
|
throw new NullPointerException("TenantContextHolder 不存在租户编号!");
|
||||||
+ DocumentEnum.TENANT.getUrl());
|
|
||||||
}
|
}
|
||||||
return tenantId;
|
return tenantId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +0,0 @@
|
|||||||
package com.tashow.cloud.tenant.core.job;
|
|
||||||
|
|
||||||
import java.lang.annotation.ElementType;
|
|
||||||
import java.lang.annotation.Retention;
|
|
||||||
import java.lang.annotation.RetentionPolicy;
|
|
||||||
import java.lang.annotation.Target;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 多租户 Job 注解
|
|
||||||
*/
|
|
||||||
@Target({ElementType.METHOD})
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
public @interface TenantJob {
|
|
||||||
}
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
package com.tashow.cloud.tenant.core.job;
|
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
|
||||||
import cn.hutool.core.exceptions.ExceptionUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.tashow.cloud.common.util.json.JsonUtils;
|
|
||||||
import com.tashow.cloud.tenant.core.service.TenantFrameworkService;
|
|
||||||
import com.tashow.cloud.tenant.core.util.TenantUtils;
|
|
||||||
import com.xxl.job.core.context.XxlJobContext;
|
|
||||||
import com.xxl.job.core.context.XxlJobHelper;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang3.exception.ExceptionUtils;
|
|
||||||
import org.aspectj.lang.ProceedingJoinPoint;
|
|
||||||
import org.aspectj.lang.annotation.Around;
|
|
||||||
import org.aspectj.lang.annotation.Aspect;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 多租户 JobHandler AOP
|
|
||||||
* 任务执行时,会按照租户逐个执行 Job 的逻辑
|
|
||||||
*
|
|
||||||
* 注意,需要保证 JobHandler 的幂等性。因为 Job 因为某个租户执行失败重试时,之前执行成功的租户也会再次执行。
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
@Aspect
|
|
||||||
@RequiredArgsConstructor
|
|
||||||
@Slf4j
|
|
||||||
public class TenantJobAspect {
|
|
||||||
|
|
||||||
private final TenantFrameworkService tenantFrameworkService;
|
|
||||||
|
|
||||||
@Around("@annotation(tenantJob)")
|
|
||||||
public void around(ProceedingJoinPoint joinPoint, TenantJob tenantJob) {
|
|
||||||
// 获得租户列表
|
|
||||||
List<Long> tenantIds = tenantFrameworkService.getTenantIds();
|
|
||||||
if (CollUtil.isEmpty(tenantIds)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 逐个租户,执行 Job
|
|
||||||
Map<Long, String> results = new ConcurrentHashMap<>();
|
|
||||||
AtomicBoolean success = new AtomicBoolean(true); // 标记,是否存在失败的情况
|
|
||||||
XxlJobContext xxlJobContext = XxlJobContext.getXxlJobContext(); // XXL-Job 上下文
|
|
||||||
tenantIds.parallelStream().forEach(tenantId -> {
|
|
||||||
// TODO 芋艿:先通过 parallel 实现并行;1)多个租户,是一条执行日志;2)异常的情况
|
|
||||||
TenantUtils.execute(tenantId, () -> {
|
|
||||||
try {
|
|
||||||
XxlJobContext.setXxlJobContext(xxlJobContext);
|
|
||||||
// 执行 Job
|
|
||||||
Object result = joinPoint.proceed();
|
|
||||||
results.put(tenantId, StrUtil.toStringOrEmpty(result));
|
|
||||||
} catch (Throwable e) {
|
|
||||||
results.put(tenantId, ExceptionUtil.getRootCauseMessage(e));
|
|
||||||
success.set(false);
|
|
||||||
// 打印异常
|
|
||||||
XxlJobHelper.log(StrUtil.format("[多租户({}) 执行任务({}),发生异常:{}]",
|
|
||||||
tenantId, joinPoint.getSignature(), ExceptionUtils.getStackTrace(e)));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
// 记录执行结果
|
|
||||||
if (success.get()) {
|
|
||||||
XxlJobHelper.handleSuccess(JsonUtils.toJsonString(results));
|
|
||||||
} else {
|
|
||||||
XxlJobHelper.handleFail(JsonUtils.toJsonString(results));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -3,7 +3,6 @@ package com.tashow.cloud.web.web.config;
|
|||||||
import com.tashow.cloud.common.enums.WebFilterOrderEnum;
|
import com.tashow.cloud.common.enums.WebFilterOrderEnum;
|
||||||
import com.tashow.cloud.infraapi.api.logger.ApiErrorLogApi;
|
import com.tashow.cloud.infraapi.api.logger.ApiErrorLogApi;
|
||||||
import com.tashow.cloud.web.web.core.filter.CacheRequestBodyFilter;
|
import com.tashow.cloud.web.web.core.filter.CacheRequestBodyFilter;
|
||||||
import com.tashow.cloud.web.web.core.filter.DemoFilter;
|
|
||||||
import com.tashow.cloud.web.web.core.handler.GlobalExceptionHandler;
|
import com.tashow.cloud.web.web.core.handler.GlobalExceptionHandler;
|
||||||
import com.tashow.cloud.web.web.core.handler.GlobalResponseBodyHandler;
|
import com.tashow.cloud.web.web.core.handler.GlobalResponseBodyHandler;
|
||||||
import com.tashow.cloud.web.web.core.util.WebFrameworkUtils;
|
import com.tashow.cloud.web.web.core.util.WebFrameworkUtils;
|
||||||
@@ -12,7 +11,6 @@ import jakarta.servlet.Filter;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
||||||
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
import org.springframework.boot.autoconfigure.web.client.RestTemplateAutoConfiguration;
|
||||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||||
import org.springframework.boot.web.client.RestTemplateBuilder;
|
import org.springframework.boot.web.client.RestTemplateBuilder;
|
||||||
@@ -53,8 +51,10 @@ public class WebAutoConfiguration implements WebMvcConfigurer {
|
|||||||
*/
|
*/
|
||||||
private void configurePathMatch(PathMatchConfigurer configurer, WebProperties.Api api) {
|
private void configurePathMatch(PathMatchConfigurer configurer, WebProperties.Api api) {
|
||||||
AntPathMatcher antPathMatcher = new AntPathMatcher(".");
|
AntPathMatcher antPathMatcher = new AntPathMatcher(".");
|
||||||
configurer.addPathPrefix(api.getPrefix(), clazz -> clazz.isAnnotationPresent(RestController.class)
|
configurer.addPathPrefix(api.getPrefix(),
|
||||||
&& antPathMatcher.match(api.getController(), clazz.getPackage().getName())); // 仅仅匹配 controller 包
|
clazz -> clazz.isAnnotationPresent(RestController.class)
|
||||||
|
&& antPathMatcher.match(api.getController(), clazz.getPackage().getName())
|
||||||
|
); // 仅仅匹配 controller 包
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@@ -102,15 +102,6 @@ public class WebAutoConfiguration implements WebMvcConfigurer {
|
|||||||
return createFilterBean(new CacheRequestBodyFilter(), WebFilterOrderEnum.REQUEST_BODY_CACHE_FILTER);
|
return createFilterBean(new CacheRequestBodyFilter(), WebFilterOrderEnum.REQUEST_BODY_CACHE_FILTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建 DemoFilter Bean,演示模式
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
@ConditionalOnProperty(value = "yudao.demo", havingValue = "true")
|
|
||||||
public FilterRegistrationBean<DemoFilter> demoFilter() {
|
|
||||||
return createFilterBean(new DemoFilter(), WebFilterOrderEnum.DEMO_FILTER);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T extends Filter> FilterRegistrationBean<T> createFilterBean(T filter, Integer order) {
|
public static <T extends Filter> FilterRegistrationBean<T> createFilterBean(T filter, Integer order) {
|
||||||
FilterRegistrationBean<T> bean = new FilterRegistrationBean<>(filter);
|
FilterRegistrationBean<T> bean = new FilterRegistrationBean<>(filter);
|
||||||
bean.setOrder(order);
|
bean.setOrder(order);
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package com.tashow.cloud.web.web.core.filter;
|
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.tashow.cloud.common.pojo.CommonResult;
|
|
||||||
import com.tashow.cloud.common.util.servlet.ServletUtils;
|
|
||||||
import com.tashow.cloud.web.web.core.util.WebFrameworkUtils;
|
|
||||||
import jakarta.servlet.FilterChain;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
|
||||||
import org.springframework.web.filter.OncePerRequestFilter;
|
|
||||||
|
|
||||||
import static com.tashow.cloud.common.exception.enums.GlobalErrorCodeConstants.DEMO_DENY;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 演示 Filter,禁止用户发起写操作,避免影响测试数据
|
|
||||||
*
|
|
||||||
* @author 芋道源码
|
|
||||||
*/
|
|
||||||
public class DemoFilter extends OncePerRequestFilter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected boolean shouldNotFilter(HttpServletRequest request) {
|
|
||||||
String method = request.getMethod();
|
|
||||||
return !StrUtil.equalsAnyIgnoreCase(method, "POST", "PUT", "DELETE") // 写操作时,不进行过滤率
|
|
||||||
|| WebFrameworkUtils.getLoginUserId(request) == null; // 非登录用户时,不进行过滤
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain) {
|
|
||||||
// 直接返回 DEMO_DENY 的结果。即,请求不继续
|
|
||||||
ServletUtils.writeJSON(response, CommonResult.error(DEMO_DENY));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -22,8 +22,8 @@ import static com.tashow.cloud.web.web.config.WebAutoConfiguration.createFilterB
|
|||||||
|
|
||||||
@AutoConfiguration
|
@AutoConfiguration
|
||||||
@EnableConfigurationProperties(XssProperties.class)
|
@EnableConfigurationProperties(XssProperties.class)
|
||||||
@ConditionalOnProperty(prefix = "yudao.xss", name = "enable", havingValue = "true", matchIfMissing = true) // 设置为 false 时,禁用
|
@ConditionalOnProperty(prefix = "tashow.xss", name = "enable", havingValue = "true", matchIfMissing = true) // 设置为 false 时,禁用
|
||||||
public class YudaoXssAutoConfiguration implements WebMvcConfigurer {
|
public class TashowXssAutoConfiguration implements WebMvcConfigurer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Xss 清理者
|
* Xss 清理者
|
||||||
@@ -12,7 +12,7 @@ import java.util.List;
|
|||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@ConfigurationProperties(prefix = "yudao.xss")
|
@ConfigurationProperties(prefix = "tashow.xss")
|
||||||
@Validated
|
@Validated
|
||||||
@Data
|
@Data
|
||||||
public class XssProperties {
|
public class XssProperties {
|
||||||
|
|||||||
@@ -18,7 +18,8 @@
|
|||||||
<module>tashow-module-ai</module>
|
<module>tashow-module-ai</module>
|
||||||
<module>tashow-module-pay</module>
|
<module>tashow-module-pay</module>
|
||||||
<module>tashow-module-trade</module>
|
<module>tashow-module-trade</module>
|
||||||
<module>tashow-module-member</module>
|
<module>tashow-module-user</module>
|
||||||
|
<module>tashow-module-file</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -6,8 +6,9 @@ import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateReqVo;
|
|||||||
import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateRespVo;
|
import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateRespVo;
|
||||||
import com.tashow.cloud.ai.service.dialog.AiDialogService;
|
import com.tashow.cloud.ai.service.dialog.AiDialogService;
|
||||||
import com.tashow.cloud.common.pojo.CommonResult;
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.annotation.security.PermitAll;
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -15,8 +16,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,8 +27,6 @@ import static com.tashow.cloud.common.pojo.CommonResult.success;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
public class DialogController {
|
public class DialogController {
|
||||||
|
|
||||||
List<String> message = List.of("渴了", "饿了", "想睡觉", "想出去玩", "想溜达", "情绪低落", "很开心", "很伤心", "想哭");
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private AiDialogService aiDialogService;
|
private AiDialogService aiDialogService;
|
||||||
|
|
||||||
@@ -38,11 +35,10 @@ public class DialogController {
|
|||||||
* 获取对话消息列表
|
* 获取对话消息列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getDialog")
|
@GetMapping("/getDialog")
|
||||||
@PermitAll
|
public CommonResult<DialogResp> msList(@Valid PageParam pageParam) {
|
||||||
public CommonResult<DialogResp> msList() {
|
|
||||||
//获取当前登录用户
|
//获取当前登录用户
|
||||||
Long userId = 1L;
|
Long userId = 1L;
|
||||||
return success(aiDialogService.getDialog(userId));
|
return success(aiDialogService.getDialog(userId,pageParam));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -50,7 +46,6 @@ public class DialogController {
|
|||||||
* 翻译
|
* 翻译
|
||||||
*/
|
*/
|
||||||
@PostMapping("/translate")
|
@PostMapping("/translate")
|
||||||
@PermitAll
|
|
||||||
public CommonResult<TranslateRespVo> translate(@Validated TranslateReqVo fileReqVo) {
|
public CommonResult<TranslateRespVo> translate(@Validated TranslateReqVo fileReqVo) {
|
||||||
return success(aiDialogService.translate(fileReqVo));
|
return success(aiDialogService.translate(fileReqVo));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
package com.tashow.cloud.ai.controller.app.dialog.vo;
|
package com.tashow.cloud.ai.controller.app.dialog.vo;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.tashow.cloud.common.util.json.databind.StringLocalDateTimeSerializer;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ai-对话消息 DO
|
* ai-对话消息 DO
|
||||||
*
|
*
|
||||||
@@ -71,7 +69,13 @@ public class AiDialogMessageRespVo {
|
|||||||
/**
|
/**
|
||||||
* 创建时间
|
* 创建时间
|
||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
//发送时间
|
||||||
|
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
private Integer emotion;
|
||||||
|
private String terminal;
|
||||||
|
private String fileType;
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,9 @@
|
|||||||
package com.tashow.cloud.ai.controller.app.dialog.vo;
|
package com.tashow.cloud.ai.controller.app.dialog.vo;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
@Schema(description = "api - 对话 Response VO")
|
@Schema(description = "api - 对话 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@@ -17,5 +16,5 @@ public class DialogResp {
|
|||||||
@Schema(description = "对话状态")
|
@Schema(description = "对话状态")
|
||||||
private String dialogStatus;
|
private String dialogStatus;
|
||||||
@Schema(description = "对话消息内容")
|
@Schema(description = "对话消息内容")
|
||||||
private List<AiDialogMessageRespVo> messages;
|
private PageResult<AiDialogMessageRespVo> messages;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,11 +14,13 @@ public class TranslateReqVo {
|
|||||||
//消息id
|
//消息id
|
||||||
private Long msgId;
|
private Long msgId;
|
||||||
|
|
||||||
|
private String terminal;
|
||||||
|
|
||||||
/** 文件附件 */
|
/** 文件附件 */
|
||||||
private MultipartFile file;
|
private MultipartFile file;
|
||||||
|
|
||||||
//文件时长
|
//文件时长
|
||||||
private String contentDuration;
|
private Long contentDuration;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ public class TranslateRespVo {
|
|||||||
private String transResult;
|
private String transResult;
|
||||||
//文件时长
|
//文件时长
|
||||||
private Long contentDuration;
|
private Long contentDuration;
|
||||||
|
private String terminal;
|
||||||
//发送时间
|
//发送时间
|
||||||
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
@JsonSerialize(using = StringLocalDateTimeSerializer.class)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|||||||
@@ -97,4 +97,7 @@ public class AiDialogMessageDO {
|
|||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
private Integer emotion;
|
||||||
|
private String terminal;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.tashow.cloud.ai.dal.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum EmotionEnums {
|
||||||
|
|
||||||
|
XF(1,"兴奋/玩耍","兴奋"),
|
||||||
|
PJ(2,"平静/放松","平静"),
|
||||||
|
je(3,"乞求/饥饿/口渴","饥饿"),
|
||||||
|
yk(4,"愉快/满足","愉快"),
|
||||||
|
tt(5,"疼痛/沮丧","疼痛"),
|
||||||
|
kj(6,"恐惧/不安","恐惧"),
|
||||||
|
hq(7,"问候/好奇","好奇"),
|
||||||
|
ng(8,"难过/焦虑","难过"),
|
||||||
|
fn(9,"愤怒/警告","愤怒"),
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
private Integer code;
|
||||||
|
private String name;
|
||||||
|
private String aiName;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -37,7 +37,7 @@ public interface AiSampleMapper extends BaseMapperX<AiSampleDO> {
|
|||||||
" AND t.sample_name LIKE CONCAT('%',#{pageReqVO.sampleName},'%')" +
|
" AND t.sample_name LIKE CONCAT('%',#{pageReqVO.sampleName},'%')" +
|
||||||
" </if>" +
|
" </if>" +
|
||||||
"</where>" +
|
"</where>" +
|
||||||
"ORDER BY t.id DESC" +
|
"GROUP BY t.id ORDER BY t.id DESC" +
|
||||||
"</script>")
|
"</script>")
|
||||||
IPage<AiSampleDO> getAiSamplePage(Page<AiSampleDO> objectPage, AiSamplePageReqVO pageReqVO);
|
IPage<AiSampleDO> getAiSamplePage(Page<AiSampleDO> objectPage, AiSamplePageReqVO pageReqVO);
|
||||||
}
|
}
|
||||||
@@ -32,8 +32,6 @@ public class SecurityConfiguration {
|
|||||||
.requestMatchers(adminSeverContextPath + "/**").permitAll();
|
.requestMatchers(adminSeverContextPath + "/**").permitAll();
|
||||||
// 文件读取
|
// 文件读取
|
||||||
registry.requestMatchers(buildAdminApi("/infra/file/*/get/**")).permitAll();
|
registry.requestMatchers(buildAdminApi("/infra/file/*/get/**")).permitAll();
|
||||||
|
|
||||||
// TODO 芋艿:这个每个项目都需要重复配置,得捉摸有没通用的方案
|
|
||||||
// RPC 服务的安全配置
|
// RPC 服务的安全配置
|
||||||
registry.requestMatchers(ApiConstants.PREFIX + "/**").permitAll();
|
registry.requestMatchers(ApiConstants.PREFIX + "/**").permitAll();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.tashow.cloud.ai.controller.app.dialog.vo.DialogResp;
|
|||||||
import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateReqVo;
|
import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateReqVo;
|
||||||
import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateRespVo;
|
import com.tashow.cloud.ai.controller.app.dialog.vo.TranslateRespVo;
|
||||||
import com.tashow.cloud.ai.dal.dataobject.dialog.AiDialogDO;
|
import com.tashow.cloud.ai.dal.dataobject.dialog.AiDialogDO;
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ai-对话 Service 接口
|
* ai-对话 Service 接口
|
||||||
@@ -14,7 +15,7 @@ import com.tashow.cloud.ai.dal.dataobject.dialog.AiDialogDO;
|
|||||||
public interface AiDialogService extends IService<AiDialogDO> {
|
public interface AiDialogService extends IService<AiDialogDO> {
|
||||||
|
|
||||||
|
|
||||||
DialogResp getDialog(Long userId);
|
DialogResp getDialog(Long userId, PageParam pageParam);
|
||||||
|
|
||||||
TranslateRespVo translate(TranslateReqVo fileReqVo);
|
TranslateRespVo translate(TranslateReqVo fileReqVo);
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.tashow.cloud.ai.service.dialog;
|
package com.tashow.cloud.ai.service.dialog;
|
||||||
|
|
||||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
@@ -16,6 +17,8 @@ import com.tashow.cloud.ai.dal.dataobject.dialog.AiDialogDO;
|
|||||||
import com.tashow.cloud.ai.dal.dataobject.dialog.AiDialogMessageDO;
|
import com.tashow.cloud.ai.dal.dataobject.dialog.AiDialogMessageDO;
|
||||||
import com.tashow.cloud.ai.dal.mysql.dialog.AiDialogMapper;
|
import com.tashow.cloud.ai.dal.mysql.dialog.AiDialogMapper;
|
||||||
import com.tashow.cloud.ai.dal.mysql.dialog.AiDialogMessageMapper;
|
import com.tashow.cloud.ai.dal.mysql.dialog.AiDialogMessageMapper;
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
import com.tashow.cloud.common.util.object.BeanUtils;
|
import com.tashow.cloud.common.util.object.BeanUtils;
|
||||||
import com.tashow.cloud.infraapi.api.file.FileApi;
|
import com.tashow.cloud.infraapi.api.file.FileApi;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -28,9 +31,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|||||||
|
|
||||||
import javax.sound.sampled.AudioInputStream;
|
import javax.sound.sampled.AudioInputStream;
|
||||||
import javax.sound.sampled.AudioSystem;
|
import javax.sound.sampled.AudioSystem;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -55,10 +55,55 @@ public class AiDialogServiceImpl extends ServiceImpl<AiDialogMapper, AiDialogDO>
|
|||||||
@Resource
|
@Resource
|
||||||
private FileApi fileApi;
|
private FileApi fileApi;
|
||||||
|
|
||||||
|
private List<String> failedStr =List.of(
|
||||||
|
"刚刚的音符太独特了,我没听清呢~可以再对我说一次吗?",
|
||||||
|
"哇,这是哪来的小可爱?声音太有魅力了,让我一时走了神。请靠近一点,慢慢再说一遍好?",
|
||||||
|
"背景音有点热闹,我有点分心啦~能在一个更安静的地方,让我专心听听TA的声音吗",
|
||||||
|
"报告主人!声波受到不明干扰(可能是零食袋的声音?),翻译任务失败,请求二次输入!",
|
||||||
|
"我的‘物种雷达’刚才打了个盹儿~快让我再听一次这美妙的声音!",
|
||||||
|
"这声音太迷人了,让我CPU过载了!请简化一下环境音,我们再来一次?"
|
||||||
|
);
|
||||||
|
|
||||||
|
private Map<String,List<String>> failedMap =new HashMap<>(){{
|
||||||
|
put("cat",List.of(
|
||||||
|
"听得出是猫猫在说话,但TA似乎在表达一种很深邃的情绪..也许是个小秘密呢?",
|
||||||
|
"喵星人的这段‘加密通话’等级太高了!翻译官正在努力学习中...你能通过TA的尾巴和眼神猜猜看吗?",
|
||||||
|
"警报!警报!接收到喵星最高机密指令,我的权限不足,无法破译!建议提供小鱼干以获取更多线索"
|
||||||
|
));
|
||||||
|
put("dog",List.of(
|
||||||
|
"听得出是狗狗在说话,但TA似乎在表达一种很深邃的情绪...也许是个小秘密呢?",
|
||||||
|
"汪语十级考试失败!这句大概是“今天的我比昨天更爱你了'之类的复杂情感吧",
|
||||||
|
"汪星人的这段‘加密通话’等级太高了!翻译官正在努力学习中..你能通过TA的尾巴和眼神猜猜看吗?"
|
||||||
|
));
|
||||||
|
put("common",List.of(
|
||||||
|
"TA刚才可能用了某种古老的咒语,或者...只是在打一个很有思想的哈欠?",
|
||||||
|
"这句‘话’的哲学深度超出了我的理解范围,TA可能是一位诗人~"
|
||||||
|
));
|
||||||
|
}};
|
||||||
|
|
||||||
|
private Map<String,List<String>> successMap =new HashMap<>(){{
|
||||||
|
put("舒服",List.of(
|
||||||
|
"TA 现在全身心都放松下来啦,正被满满的安全感包围着呢~ ",
|
||||||
|
"听这均匀的呼吸,TA 的心正像云朵一样软绵绵、轻飘飘的哦。",
|
||||||
|
"这是幸福的声音!此刻的TA,觉得自己是全世界最被爱的小宝贝",
|
||||||
|
"环境很安心~主人很贴心~TA 正在小声说:好舒服呀~…"
|
||||||
|
));
|
||||||
|
put("等待喂食",List.of(
|
||||||
|
"小肚肚发出‘咕咕’警报啦!美食雷达正在全面启动,搜寻好吃的!",
|
||||||
|
"来自TA的紧急通讯:‘报告!能量储备严重不足,请求立刻补充!",
|
||||||
|
"你听到了吗?那是小饭碗在思念食物的声音!TA的眼神正在发出渴望的光波~",
|
||||||
|
"“开饭铃”已经摇响!再不开饭,小委屈就要溢出来啦!"
|
||||||
|
));
|
||||||
|
put("生气",List.of(
|
||||||
|
"TA 现在有点小紧张哦,周围可能有让TA不安的东西,快给TA一点安慰吧",
|
||||||
|
"检测到‘心跳加速’模式!TA需要一点空间和一个温柔的声音来平静下来",
|
||||||
|
"TA 现在有点小紧张哦,周围可能有让TA不安的东西,快给TA一点安慰吧"
|
||||||
|
));
|
||||||
|
}};
|
||||||
|
|
||||||
private Map<String, String> petAvatars = new HashMap<>() {{
|
private Map<String, String> petAvatars = new HashMap<>() {{
|
||||||
put("cat", "https://petshy.tashowz.com/admin-api/infra/file/29/get/89f4982de19aadae3248ffde37132857df255b3276de484fdf12e603e5e29a7e.png");
|
put("cat", "https://petshy.tashowz.com/admin-api/infra/file/29/get/默认的猫.png");
|
||||||
put("dog", "https://petshy.tashowz.com/admin-api/infra/file/29/get/175ba9f58dc812786bfe0598ca9c4a7f422fe138c1889e08d8228aebc953c1b3.png");
|
put("dog", "https://petshy.tashowz.com/admin-api/infra/file/29/get/默认的狗.png");
|
||||||
}};
|
}};
|
||||||
|
|
||||||
private Map<String, String> petName = new HashMap<>() {{
|
private Map<String, String> petName = new HashMap<>() {{
|
||||||
@@ -68,7 +113,7 @@ public class AiDialogServiceImpl extends ServiceImpl<AiDialogMapper, AiDialogDO>
|
|||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DialogResp getDialog(Long userId) {
|
public DialogResp getDialog(Long userId, PageParam pageParam) {
|
||||||
AiDialogDO aiDialogDO = this.getOne(new LambdaQueryWrapper<AiDialogDO>().eq(AiDialogDO::getUserId, userId));
|
AiDialogDO aiDialogDO = this.getOne(new LambdaQueryWrapper<AiDialogDO>().eq(AiDialogDO::getUserId, userId));
|
||||||
if (aiDialogDO == null) {
|
if (aiDialogDO == null) {
|
||||||
aiDialogDO = new AiDialogDO();
|
aiDialogDO = new AiDialogDO();
|
||||||
@@ -77,7 +122,12 @@ public class AiDialogServiceImpl extends ServiceImpl<AiDialogMapper, AiDialogDO>
|
|||||||
aiDialogDO.setUserId(userId);
|
aiDialogDO.setUserId(userId);
|
||||||
this.save(aiDialogDO);
|
this.save(aiDialogDO);
|
||||||
}
|
}
|
||||||
List<AiDialogMessageDO> messageDOS = aiDialogMessageMapper.selectList(new LambdaQueryWrapper<AiDialogMessageDO>().eq(AiDialogMessageDO::getDialogId, aiDialogDO.getId()));
|
|
||||||
|
PageResult<AiDialogMessageDO> messageDOS = aiDialogMessageMapper.selectPage(pageParam,
|
||||||
|
new LambdaQueryWrapper<AiDialogMessageDO>().eq(AiDialogMessageDO::getDialogId, aiDialogDO.getId())
|
||||||
|
.orderByAsc(AiDialogMessageDO::getCreateTime)
|
||||||
|
);
|
||||||
|
|
||||||
DialogResp resp = new DialogResp();
|
DialogResp resp = new DialogResp();
|
||||||
resp.setDialogId(aiDialogDO.getId());
|
resp.setDialogId(aiDialogDO.getId());
|
||||||
resp.setTitle(aiDialogDO.getTitle());
|
resp.setTitle(aiDialogDO.getTitle());
|
||||||
@@ -89,43 +139,23 @@ public class AiDialogServiceImpl extends ServiceImpl<AiDialogMapper, AiDialogDO>
|
|||||||
@Override
|
@Override
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
public TranslateRespVo translate(TranslateReqVo fileReqVo) {
|
public TranslateRespVo translate(TranslateReqVo fileReqVo) {
|
||||||
AiDialogMessageDO messageDO = aiDialogMessageMapper.selectById(fileReqVo.getMsgId());
|
AiDialogMessageDO messageDO = new AiDialogMessageDO();
|
||||||
if (messageDO == null) {
|
String fileName = fileReqVo.getFile().getOriginalFilename();
|
||||||
messageDO = new AiDialogMessageDO();
|
|
||||||
}
|
|
||||||
String fileName = StrUtil.isBlank(messageDO.getFileName()) ? fileReqVo.getFile().getOriginalFilename() : messageDO.getFileName();
|
|
||||||
//上传文件获取文件地址
|
//上传文件获取文件地址
|
||||||
String fileUrl = StrUtil.isBlank(messageDO.getContentText()) ? fileServer + fileApi.createFile(fileName, "", fileReqVo.getFile().getBytes()) : messageDO.getContentText();
|
String fileUrl = fileServer + fileApi.createFile(fileName, "", fileReqVo.getFile().getBytes());
|
||||||
//翻译结果
|
//翻译结果
|
||||||
translate(messageDO, fileUrl, fileName);
|
translate(messageDO, fileUrl, fileName);
|
||||||
|
|
||||||
//创建消息 持久化消息
|
//创建消息
|
||||||
if (messageDO.getId() == null) {
|
messageDO.setFileName(fileName);
|
||||||
messageDO.setFileName(fileName);
|
messageDO.setFileType(fileReqVo.getFile().getContentType());
|
||||||
messageDO.setFileType(fileReqVo.getFile().getContentType());
|
messageDO.setDialogId(fileReqVo.getDialogId());
|
||||||
messageDO.setDialogId(fileReqVo.getDialogId());
|
//前端无法转换时 后端进行转
|
||||||
//前端无法转换时 后端进行转
|
messageDO.setContentDuration(fileReqVo.getContentDuration());
|
||||||
messageDO.setContentDuration(
|
messageDO.setContentText(fileUrl);
|
||||||
StrUtil.isBlank(fileReqVo.getContentDuration()) || "Infinity".equals(fileReqVo.getContentDuration())
|
messageDO.setContentType(2);
|
||||||
? 0 : Long.parseLong(fileReqVo.getContentDuration())
|
messageDO.setCreateTime(LocalDateTimeUtil.now());
|
||||||
);
|
return BeanUtils.toBean(messageDO, TranslateRespVo.class);
|
||||||
|
|
||||||
messageDO.setContentText(fileUrl);
|
|
||||||
messageDO.setContentType(2);
|
|
||||||
|
|
||||||
//获取当前最后的排序
|
|
||||||
AiDialogMessageDO aiDialogMessageDO = aiDialogMessageMapper.selectOne(new LambdaQueryWrapper<AiDialogMessageDO>()
|
|
||||||
.eq(AiDialogMessageDO::getDialogId, fileReqVo.getDialogId())
|
|
||||||
.orderByDesc(AiDialogMessageDO::getMessageOrder)
|
|
||||||
.last("limit 1")
|
|
||||||
);
|
|
||||||
messageDO.setMessageOrder(aiDialogMessageDO == null ? 1 : aiDialogMessageDO.getMessageOrder() + 1);
|
|
||||||
messageDO.setCreateTime(LocalDateTimeUtil.now());
|
|
||||||
}
|
|
||||||
int i = messageDO.getId() == null ? aiDialogMessageMapper.insert(messageDO) : aiDialogMessageMapper.updateById(messageDO);
|
|
||||||
TranslateRespVo bean = BeanUtils.toBean(messageDO, TranslateRespVo.class);
|
|
||||||
bean.setId(messageDO.getId());
|
|
||||||
return bean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@@ -148,51 +178,54 @@ public class AiDialogServiceImpl extends ServiceImpl<AiDialogMapper, AiDialogDO>
|
|||||||
//数据解析
|
//数据解析
|
||||||
JSONObject translateResult = JSON.parseObject(result);
|
JSONObject translateResult = JSON.parseObject(result);
|
||||||
|
|
||||||
|
//翻译失败
|
||||||
if (translateResult.isEmpty()
|
if (translateResult.isEmpty()
|
||||||
|| !translateResult.containsKey("intent_result")
|
|| !translateResult.containsKey("intent_result")
|
||||||
|| !translateResult.getBoolean("is_species_sound")
|
|| !translateResult.getBoolean("is_species_sound")
|
||||||
|| translateResult.getInteger("confidence") < 0.7
|
|| translateResult.getDouble("confidence") < 0.7
|
||||||
) {
|
) {
|
||||||
messageDO.setTransStatus(0);
|
messageDO.setTransStatus(0);
|
||||||
messageDO.setTransResult("");
|
messageDO.setTransResult(failedStr.get(RandomUtil.randomInt(failedStr.size())));
|
||||||
return messageDO;
|
return messageDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
//标签 如 cat dog
|
//标签 如 cat dog
|
||||||
String speciesLabels = translateResult.getString("species_labels");
|
String speciesLabels = translateResult.getString("species_labels");
|
||||||
//解析翻译结果
|
//解析翻译结果
|
||||||
JSONObject probabilities = translateResult.getJSONObject("intent_result")
|
JSONObject intentResult = translateResult.getJSONObject("intent_result");
|
||||||
.getJSONObject("probabilities");
|
|
||||||
|
|
||||||
String resultKey = probabilities.entrySet().stream()
|
|
||||||
.filter(entry -> entry.getValue() instanceof Number && ((Number) entry.getValue()).doubleValue() > 0.7)
|
|
||||||
.max(Comparator.comparingDouble(entry -> ((Number) entry.getValue()).doubleValue()))
|
|
||||||
.map(Map.Entry::getKey)
|
|
||||||
.orElse(null);
|
|
||||||
|
|
||||||
//返回结果
|
|
||||||
if (StrUtil.isBlank(resultKey)) {
|
|
||||||
messageDO.setTransStatus(0);
|
|
||||||
messageDO.setTransResult("");
|
|
||||||
return messageDO;
|
|
||||||
}
|
|
||||||
|
|
||||||
//宠物档案 todo
|
//宠物档案 todo
|
||||||
messageDO.setPetId(1l);
|
messageDO.setPetId(1l);
|
||||||
messageDO.setPetName(petName.get(speciesLabels));
|
messageDO.setPetName(petName.get(speciesLabels));
|
||||||
https:
|
|
||||||
//qcloud.dpfile.com/pc/qw4HqeQN5Af9tLaw0mx8pXQhxKUCvwHbCXmSRI-nKiW1NpX6wMdvSN80YpcTbMKw.jpg
|
|
||||||
messageDO.setPetAvatar(petAvatars.get(speciesLabels));
|
messageDO.setPetAvatar(petAvatars.get(speciesLabels));
|
||||||
messageDO.setPetType(speciesLabels);
|
messageDO.setPetType(speciesLabels);
|
||||||
|
//识别物种,无法翻译音频
|
||||||
|
if (intentResult.getDouble("confidence")<0.7){
|
||||||
|
messageDO.setTransStatus(0);
|
||||||
|
List<String> petFailResult = failedMap.get(speciesLabels);
|
||||||
|
if (petFailResult == null) {
|
||||||
|
petFailResult = failedMap.get("common");
|
||||||
|
}
|
||||||
|
messageDO.setTransResult(petFailResult.get(RandomUtil.randomInt(petFailResult.size())));
|
||||||
|
return messageDO;
|
||||||
|
}
|
||||||
|
//都识别成功后 也有不同的翻译结果
|
||||||
|
JSONObject probabilities = intentResult.getJSONObject("probabilities");
|
||||||
|
String resultKey = probabilities.entrySet().stream()
|
||||||
|
.max(Comparator.comparingDouble(entry -> ((Number) entry.getValue()).doubleValue()))
|
||||||
|
.map(Map.Entry::getKey)
|
||||||
|
.orElse(null);
|
||||||
|
//根据key解析结果
|
||||||
|
String emo = StrUtil.isBlank(resultKey) ? "" : resultKey.split(cn.hutool.core.util.StrUtil.UNDERLINE)[1];
|
||||||
|
List<String> emoList = successMap.get(emo);
|
||||||
messageDO.setTransStatus(1);
|
messageDO.setTransStatus(1);
|
||||||
messageDO.setTransResult(StrUtil.isBlank(resultKey) ? "" : resultKey.split(StrUtil.UNDERLINE)[1]);
|
messageDO.setTransResult(emoList.get(RandomUtil.randomInt(emoList.size())));
|
||||||
|
|
||||||
return messageDO;
|
return messageDO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
InputStream inputStream = getInputStreamFromUrl("https://petshy.tashowz.com/admin-api/infra/file/29/get/857def513547ec33a105f71108c8ece329cb64dacc3a4779c94b0fcc3398cc32.webm");
|
|
||||||
AudioInputStream audioStream = AudioSystem.getAudioInputStream(inputStream);
|
|
||||||
System.out.println((long) (audioStream.getFrameLength() / audioStream.getFormat().getFrameRate()));
|
|
||||||
// byte[] bytes = HttpUtil.downloadBytes("http://192.168.1.231:48080/admin-api/infra/file/29/get/c7351abf780f18600c104ec5662d843783ed8c309c01fb427046565217f51102.wav");
|
// byte[] bytes = HttpUtil.downloadBytes("http://192.168.1.231:48080/admin-api/infra/file/29/get/c7351abf780f18600c104ec5662d843783ed8c309c01fb427046565217f51102.wav");
|
||||||
//
|
//
|
||||||
//// File file = new File("http://192.168.1.231:48080/admin-api/infra/file/29/get/c7351abf780f18600c104ec5662d843783ed8c309c01fb427046565217f51102.wav");
|
//// File file = new File("http://192.168.1.231:48080/admin-api/infra/file/29/get/c7351abf780f18600c104ec5662d843783ed8c309c01fb427046565217f51102.wav");
|
||||||
@@ -202,19 +235,4 @@ public class AiDialogServiceImpl extends ServiceImpl<AiDialogMapper, AiDialogDO>
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static InputStream getInputStreamFromUrl(String urlString) throws Exception {
|
|
||||||
URL url = new URL(urlString);
|
|
||||||
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
|
|
||||||
connection.setRequestMethod("GET"); // 可以是GET, POST等
|
|
||||||
connection.setConnectTimeout(5000); // 设置连接超时时间
|
|
||||||
connection.setReadTimeout(5000); // 设置读取超时时间
|
|
||||||
int responseCode = connection.getResponseCode(); // 获取响应码
|
|
||||||
if (responseCode == HttpURLConnection.HTTP_OK) { // 状态码200表示成功
|
|
||||||
return connection.getInputStream();
|
|
||||||
} else {
|
|
||||||
// 处理错误情况,例如抛出异常或返回null等
|
|
||||||
throw new RuntimeException("Failed : HTTP error code : " + responseCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
102
tashow-module/tashow-module-file/pom.xml
Normal file
102
tashow-module/tashow-module-file/pom.xml
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<?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-module</artifactId>
|
||||||
|
<version>${revision}</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>tashow-module-file</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>${project.artifactId}</name>
|
||||||
|
<description>
|
||||||
|
文件 模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Spring Cloud 基础 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-framework-env</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-framework-monitor</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-framework-security</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- DB 相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-data-mybatis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-data-redis</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-file-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- RPC 远程调用相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.tashow.cloud</groupId>
|
||||||
|
<artifactId>tashow-framework-rpc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Registry 注册中心相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Config 配置中心相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.alibaba.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 三方云服务相关 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-net</groupId>
|
||||||
|
<artifactId>commons-net</artifactId> <!-- 文件客户端:解决 ftp 连接 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.jcraft</groupId>
|
||||||
|
<artifactId>jsch</artifactId> <!-- 文件客户端:解决 sftp 连接 -->
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.amazonaws</groupId>
|
||||||
|
<artifactId>aws-java-sdk-s3</artifactId><!-- 文件客户端:解决阿里云、腾讯云、minio 等 S3 连接 -->
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<!-- 设置构建的 jar 包名 -->
|
||||||
|
<finalName>${project.artifactId}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<!-- 打包 -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<version>${spring.boot.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>repackage</goal> <!-- 将引入的 jar 打入其中 -->
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.member;
|
package com.tashow.cloud.file;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
@@ -7,10 +7,10 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
* 项目的启动类
|
* 项目的启动类
|
||||||
*/
|
*/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class MemberServerApplication {
|
public class FileServerApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(MemberServerApplication.class, args);
|
SpringApplication.run(FileServerApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.tashow.cloud.infra.api.config;
|
package com.tashow.cloud.file.api.config;
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.CommonResult;
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
import com.tashow.cloud.infra.service.config.ConfigService;
|
import com.tashow.cloud.file.dal.dataobject.config.ConfigDO;
|
||||||
import com.tashow.cloud.infraapi.api.config.ConfigApi;
|
import com.tashow.cloud.file.service.config.ConfigService;
|
||||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
import com.tashow.cloud.fileapi.api.config.ConfigApi;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
@@ -1,14 +1,13 @@
|
|||||||
package com.tashow.cloud.infra.api.file;
|
package com.tashow.cloud.file.api.file;
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.CommonResult;
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
import com.tashow.cloud.infra.service.file.FileService;
|
import com.tashow.cloud.file.service.file.FileService;
|
||||||
import com.tashow.cloud.infraapi.api.file.FileApi;
|
import com.tashow.cloud.fileapi.api.file.FileApi;
|
||||||
import com.tashow.cloud.infraapi.api.file.dto.FileCreateReqDTO;
|
import com.tashow.cloud.fileapi.api.file.dto.FileCreateReqDTO;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
|
|
||||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package com.tashow.cloud.user.api;
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package com.tashow.cloud.file.controller.admin.config;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import com.tashow.cloud.file.controller.admin.config.vo.ConfigPageReqVO;
|
||||||
|
import com.tashow.cloud.file.controller.admin.config.vo.ConfigRespVO;
|
||||||
|
import com.tashow.cloud.file.controller.admin.config.vo.ConfigSaveReqVO;
|
||||||
|
import com.tashow.cloud.file.convert.config.ConfigConvert;
|
||||||
|
import com.tashow.cloud.file.dal.dataobject.config.ConfigDO;
|
||||||
|
import com.tashow.cloud.file.service.config.ConfigService;
|
||||||
|
import com.tashow.cloud.fileapi.enums.ErrorCodeConstants;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.validation.Valid;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理后台 - 参数配置
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/file/config")
|
||||||
|
@Validated
|
||||||
|
public class ConfigController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ConfigService configService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建参数配置
|
||||||
|
* @param createReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/create")
|
||||||
|
public CommonResult<Long> createConfig(@Valid @RequestBody ConfigSaveReqVO createReqVO) {
|
||||||
|
return success(configService.createConfig(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改参数配置
|
||||||
|
* @param updateReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PutMapping("/update")
|
||||||
|
public CommonResult<Boolean> updateConfig(@Valid @RequestBody ConfigSaveReqVO updateReqVO) {
|
||||||
|
configService.updateConfig(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除参数配置
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
public CommonResult<Boolean> deleteConfig(@RequestParam("id") Long id) {
|
||||||
|
configService.deleteConfig(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得参数配置
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/get")
|
||||||
|
public CommonResult<ConfigRespVO> getConfig(@RequestParam("id") Long id) {
|
||||||
|
return success(ConfigConvert.INSTANCE.convert(configService.getConfig(id)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据参数键名查询参数值
|
||||||
|
* @param key
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping(value = "/get-value-by-key")
|
||||||
|
public CommonResult<String> getConfigKey(@RequestParam("key") String key) {
|
||||||
|
ConfigDO config = configService.getConfigByKey(key);
|
||||||
|
if (config == null) {
|
||||||
|
return success(null);
|
||||||
|
}
|
||||||
|
if (!config.getVisible()) {
|
||||||
|
throw exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_VISIBLE);
|
||||||
|
}
|
||||||
|
return success(config.getValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取参数配置分页
|
||||||
|
* @param pageReqVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/page")
|
||||||
|
public CommonResult<PageResult<ConfigRespVO>> getConfigPage(@Valid ConfigPageReqVO pageReqVO) {
|
||||||
|
PageResult<ConfigDO> page = configService.getConfigPage(pageReqVO);
|
||||||
|
return success(ConfigConvert.INSTANCE.convertPage(page));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.tashow.cloud.file.controller.admin.config.vo;
|
||||||
|
|
||||||
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理后台 - 参数配置分页 Request VO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ConfigPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
// 数据源名称,模糊匹配
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
//参数键名,模糊匹配
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
//参数类型,参见 SysConfigTypeEnum 枚举
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
//创建时间
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package com.tashow.cloud.file.controller.admin.config.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理后台 - 参数配置信息 Response VO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ConfigRespVO {
|
||||||
|
|
||||||
|
//参数配置序号
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
//参数分类
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
//参数名称
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
//参数键名
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
//参数键值
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
//参数类型,参见 SysConfigTypeEnum 枚举
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
//是否可见
|
||||||
|
private Boolean visible;
|
||||||
|
|
||||||
|
//备注
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
//创建时间
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.tashow.cloud.file.controller.admin.config.vo;
|
||||||
|
|
||||||
|
import jakarta.validation.constraints.NotBlank;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理后台 - 参数配置创建/修改 Request VO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class ConfigSaveReqVO {
|
||||||
|
|
||||||
|
//参数配置序号
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
//参数分组
|
||||||
|
@NotEmpty(message = "参数分组不能为空")
|
||||||
|
@Size(max = 50, message = "参数名称不能超过 50 个字符")
|
||||||
|
private String category;
|
||||||
|
|
||||||
|
//参数名称
|
||||||
|
@NotBlank(message = "参数名称不能为空")
|
||||||
|
@Size(max = 100, message = "参数名称不能超过 100 个字符")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
//参数键名
|
||||||
|
@NotBlank(message = "参数键名长度不能为空")
|
||||||
|
@Size(max = 100, message = "参数键名长度不能超过 100 个字符")
|
||||||
|
private String key;
|
||||||
|
|
||||||
|
//参数键值
|
||||||
|
@NotBlank(message = "参数键值不能为空")
|
||||||
|
@Size(max = 500, message = "参数键值长度不能超过 500 个字符")
|
||||||
|
private String value;
|
||||||
|
|
||||||
|
//是否可见
|
||||||
|
@NotNull(message = "是否可见不能为空")
|
||||||
|
private Boolean visible;
|
||||||
|
|
||||||
|
//备注
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,24 +1,23 @@
|
|||||||
package com.tashow.cloud.infra.controller.admin.file;
|
package com.tashow.cloud.file.controller.admin.file;
|
||||||
|
|
||||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.CommonResult;
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
import com.tashow.cloud.common.pojo.PageResult;
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
import com.tashow.cloud.common.util.object.BeanUtils;
|
import com.tashow.cloud.common.util.object.BeanUtils;
|
||||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
|
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigPageReqVO;
|
||||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigRespVO;
|
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigRespVO;
|
||||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
||||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
import com.tashow.cloud.file.dal.dataobject.file.FileConfigDO;
|
||||||
import com.tashow.cloud.infra.service.file.FileConfigService;
|
import com.tashow.cloud.file.service.file.FileConfigService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
/** 管理后台 - 文件配置 */
|
/** 管理后台 - 文件配置 */
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/infra/file-config")
|
@RequestMapping("/file/file-config")
|
||||||
@Validated
|
@Validated
|
||||||
public class FileConfigController {
|
public class FileConfigController {
|
||||||
|
|
||||||
@@ -26,14 +25,12 @@ public class FileConfigController {
|
|||||||
|
|
||||||
/** 创建文件配置 */
|
/** 创建文件配置 */
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:file-config:create')")
|
|
||||||
public CommonResult<Long> createFileConfig(@Valid @RequestBody FileConfigSaveReqVO createReqVO) {
|
public CommonResult<Long> createFileConfig(@Valid @RequestBody FileConfigSaveReqVO createReqVO) {
|
||||||
return success(fileConfigService.createFileConfig(createReqVO));
|
return success(fileConfigService.createFileConfig(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 更新文件配置 */
|
/** 更新文件配置 */
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:file-config:update')")
|
|
||||||
public CommonResult<Boolean> updateFileConfig(
|
public CommonResult<Boolean> updateFileConfig(
|
||||||
@Valid @RequestBody FileConfigSaveReqVO updateReqVO) {
|
@Valid @RequestBody FileConfigSaveReqVO updateReqVO) {
|
||||||
fileConfigService.updateFileConfig(updateReqVO);
|
fileConfigService.updateFileConfig(updateReqVO);
|
||||||
@@ -42,7 +39,6 @@ public class FileConfigController {
|
|||||||
|
|
||||||
/** 更新文件配置为 Master */
|
/** 更新文件配置为 Master */
|
||||||
@PutMapping("/update-master")
|
@PutMapping("/update-master")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:file-config:update')")
|
|
||||||
public CommonResult<Boolean> updateFileConfigMaster(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> updateFileConfigMaster(@RequestParam("id") Long id) {
|
||||||
fileConfigService.updateFileConfigMaster(id);
|
fileConfigService.updateFileConfigMaster(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -50,7 +46,6 @@ public class FileConfigController {
|
|||||||
|
|
||||||
/** 删除文件配置 */
|
/** 删除文件配置 */
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:file-config:delete')")
|
|
||||||
public CommonResult<Boolean> deleteFileConfig(@RequestParam("id") Long id) {
|
public CommonResult<Boolean> deleteFileConfig(@RequestParam("id") Long id) {
|
||||||
fileConfigService.deleteFileConfig(id);
|
fileConfigService.deleteFileConfig(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -58,7 +53,6 @@ public class FileConfigController {
|
|||||||
|
|
||||||
/** 获得文件配置 */
|
/** 获得文件配置 */
|
||||||
@GetMapping("/get")
|
@GetMapping("/get")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:file-config:query')")
|
|
||||||
public CommonResult<FileConfigRespVO> getFileConfig(@RequestParam("id") Long id) {
|
public CommonResult<FileConfigRespVO> getFileConfig(@RequestParam("id") Long id) {
|
||||||
FileConfigDO config = fileConfigService.getFileConfig(id);
|
FileConfigDO config = fileConfigService.getFileConfig(id);
|
||||||
return success(BeanUtils.toBean(config, FileConfigRespVO.class));
|
return success(BeanUtils.toBean(config, FileConfigRespVO.class));
|
||||||
@@ -66,7 +60,6 @@ public class FileConfigController {
|
|||||||
|
|
||||||
/** 获得文件配置分页 */
|
/** 获得文件配置分页 */
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:file-config:query')")
|
|
||||||
public CommonResult<PageResult<FileConfigRespVO>> getFileConfigPage(
|
public CommonResult<PageResult<FileConfigRespVO>> getFileConfigPage(
|
||||||
@Valid FileConfigPageReqVO pageVO) {
|
@Valid FileConfigPageReqVO pageVO) {
|
||||||
PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(pageVO);
|
PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(pageVO);
|
||||||
@@ -75,7 +68,6 @@ public class FileConfigController {
|
|||||||
|
|
||||||
/** 测试文件配置是否正确 */
|
/** 测试文件配置是否正确 */
|
||||||
@GetMapping("/test")
|
@GetMapping("/test")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:file-config:query')")
|
|
||||||
public CommonResult<String> testFileConfig(@RequestParam("id") Long id) throws Exception {
|
public CommonResult<String> testFileConfig(@RequestParam("id") Long id) throws Exception {
|
||||||
String url = fileConfigService.testFileConfig(id);
|
String url = fileConfigService.testFileConfig(id);
|
||||||
return success(url);
|
return success(url);
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.infra.controller.admin.file;
|
package com.tashow.cloud.file.controller.admin.file;
|
||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@@ -6,27 +6,25 @@ import cn.hutool.core.util.URLUtil;
|
|||||||
import com.tashow.cloud.common.pojo.CommonResult;
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
import com.tashow.cloud.common.pojo.PageResult;
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
import com.tashow.cloud.common.util.object.BeanUtils;
|
import com.tashow.cloud.common.util.object.BeanUtils;
|
||||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.*;
|
import com.tashow.cloud.file.controller.admin.file.vo.file.*;
|
||||||
import com.tashow.cloud.infra.dal.dataobject.file.FileDO;
|
import com.tashow.cloud.file.dal.dataobject.file.FileDO;
|
||||||
import com.tashow.cloud.infra.service.file.FileService;
|
import com.tashow.cloud.file.service.file.FileService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.annotation.security.PermitAll;
|
|
||||||
import jakarta.servlet.http.HttpServletRequest;
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.servlet.http.HttpServletResponse;
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||||
import static com.tashow.cloud.infra.framework.file.core.utils.FileTypeUtils.writeAttachment;
|
import static com.tashow.cloud.file.framework.file.core.utils.FileTypeUtils.writeAttachment;
|
||||||
|
|
||||||
/** 管理后台 - 文件存储 */
|
/** 管理后台 - 文件存储 */
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/infra/file")
|
@RequestMapping("/file")
|
||||||
@Validated
|
@Validated
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class FileController {
|
public class FileController {
|
||||||
@@ -58,7 +56,6 @@ public class FileController {
|
|||||||
|
|
||||||
/** 删除文件 */
|
/** 删除文件 */
|
||||||
@DeleteMapping("/delete")
|
@DeleteMapping("/delete")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:file:delete')")
|
|
||||||
public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) throws Exception {
|
public CommonResult<Boolean> deleteFile(@RequestParam("id") Long id) throws Exception {
|
||||||
fileService.deleteFile(id);
|
fileService.deleteFile(id);
|
||||||
return success(true);
|
return success(true);
|
||||||
@@ -66,7 +63,6 @@ public class FileController {
|
|||||||
|
|
||||||
/** 下载文件 */
|
/** 下载文件 */
|
||||||
@GetMapping("/{configId}/get/**")
|
@GetMapping("/{configId}/get/**")
|
||||||
@PermitAll
|
|
||||||
public void getFileContent(
|
public void getFileContent(
|
||||||
HttpServletRequest request,
|
HttpServletRequest request,
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
@@ -87,13 +83,11 @@ public class FileController {
|
|||||||
response.setStatus(HttpStatus.NOT_FOUND.value());
|
response.setStatus(HttpStatus.NOT_FOUND.value());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
response.setContentLength(content.length);
|
|
||||||
writeAttachment(response, path, content);
|
writeAttachment(response, path, content);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 获得文件分页 */
|
/** 获得文件分页 */
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@PreAuthorize("@ss.hasPermission('infra:file:query')")
|
|
||||||
public CommonResult<PageResult<FileRespVO>> getFilePage(@Valid FilePageReqVO pageVO) {
|
public CommonResult<PageResult<FileRespVO>> getFilePage(@Valid FilePageReqVO pageVO) {
|
||||||
PageResult<FileDO> pageResult = fileService.getFilePage(pageVO);
|
PageResult<FileDO> pageResult = fileService.getFilePage(pageVO);
|
||||||
return success(BeanUtils.toBean(pageResult, FileRespVO.class));
|
return success(BeanUtils.toBean(pageResult, FileRespVO.class));
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
package com.tashow.cloud.infra.controller.admin.file.vo.config;
|
package com.tashow.cloud.file.controller.admin.file.vo.config;
|
||||||
|
|
||||||
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.PageParam;
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
/** 管理后台 - 文件配置分页 Request VO */
|
/** 管理后台 - 文件配置分页 Request VO */
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.tashow.cloud.infra.controller.admin.file.vo.config;
|
package com.tashow.cloud.file.controller.admin.file.vo.config;
|
||||||
|
|
||||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/** 管理后台 - 文件配置 Response VO */
|
/** 管理后台 - 文件配置 Response VO */
|
||||||
@Data
|
@Data
|
||||||
public class FileConfigRespVO {
|
public class FileConfigRespVO {
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
package com.tashow.cloud.infra.controller.admin.file.vo.config;
|
package com.tashow.cloud.file.controller.admin.file.vo.config;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import java.util.Map;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/** 管理后台 - 文件配置创建/修改 Request VO */
|
/** 管理后台 - 文件配置创建/修改 Request VO */
|
||||||
@Data
|
@Data
|
||||||
public class FileConfigSaveReqVO {
|
public class FileConfigSaveReqVO {
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.infra.controller.admin.file.vo.file;
|
package com.tashow.cloud.file.controller.admin.file.vo.file;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,14 +1,15 @@
|
|||||||
package com.tashow.cloud.infra.controller.admin.file.vo.file;
|
package com.tashow.cloud.file.controller.admin.file.vo.file;
|
||||||
|
|
||||||
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.PageParam;
|
import com.tashow.cloud.common.pojo.PageParam;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
/** 管理后台 - 文件分页 Request VO */
|
/** 管理后台 - 文件分页 Request VO */
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.infra.controller.admin.file.vo.file;
|
package com.tashow.cloud.file.controller.admin.file.vo.file;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
package com.tashow.cloud.infra.controller.admin.file.vo.file;
|
package com.tashow.cloud.file.controller.admin.file.vo.file;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/** 管理后台 - 文件 Response VO,不返回 content 字段,太大 */
|
/** 管理后台 - 文件 Response VO,不返回 content 字段,太大 */
|
||||||
@Data
|
@Data
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.infra.controller.admin.file.vo.file;
|
package com.tashow.cloud.file.controller.admin.file.vo.file;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package com.tashow.cloud.user.controller.admin;
|
||||||
@@ -1,24 +1,23 @@
|
|||||||
package com.tashow.cloud.infra.controller.app.file;
|
package com.tashow.cloud.file.controller.app.file;
|
||||||
|
|
||||||
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
|
||||||
|
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
import com.tashow.cloud.common.pojo.CommonResult;
|
import com.tashow.cloud.common.pojo.CommonResult;
|
||||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FileCreateReqVO;
|
import com.tashow.cloud.file.controller.admin.file.vo.file.FileCreateReqVO;
|
||||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
import com.tashow.cloud.file.controller.admin.file.vo.file.FilePresignedUrlRespVO;
|
||||||
import com.tashow.cloud.infra.controller.app.file.vo.AppFileUploadReqVO;
|
import com.tashow.cloud.file.controller.app.file.vo.AppFileUploadReqVO;
|
||||||
import com.tashow.cloud.infra.service.file.FileService;
|
import com.tashow.cloud.file.service.file.FileService;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import jakarta.annotation.security.PermitAll;
|
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import static com.tashow.cloud.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
/** 用户 App - 文件存储 */
|
/** 用户 App - 文件存储 */
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/infra/file")
|
@RequestMapping("/file")
|
||||||
@Validated
|
@Validated
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AppFileController {
|
public class AppFileController {
|
||||||
@@ -27,7 +26,6 @@ public class AppFileController {
|
|||||||
|
|
||||||
/** 上传文件 */
|
/** 上传文件 */
|
||||||
@PostMapping("/upload")
|
@PostMapping("/upload")
|
||||||
@PermitAll
|
|
||||||
public CommonResult<String> uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception {
|
public CommonResult<String> uploadFile(AppFileUploadReqVO uploadReqVO) throws Exception {
|
||||||
MultipartFile file = uploadReqVO.getFile();
|
MultipartFile file = uploadReqVO.getFile();
|
||||||
String path = uploadReqVO.getPath();
|
String path = uploadReqVO.getPath();
|
||||||
@@ -38,7 +36,6 @@ public class AppFileController {
|
|||||||
|
|
||||||
/** 获取文件预签名地址", description = "模式二:前端上传文件:用于前端直接上传七牛、阿里云 OSS 等文件存储器 */
|
/** 获取文件预签名地址", description = "模式二:前端上传文件:用于前端直接上传七牛、阿里云 OSS 等文件存储器 */
|
||||||
@GetMapping("/presigned-url")
|
@GetMapping("/presigned-url")
|
||||||
@PermitAll
|
|
||||||
public CommonResult<FilePresignedUrlRespVO> getFilePresignedUrl(@RequestParam("path") String path)
|
public CommonResult<FilePresignedUrlRespVO> getFilePresignedUrl(@RequestParam("path") String path)
|
||||||
throws Exception {
|
throws Exception {
|
||||||
return success(fileService.getFilePresignedUrl(path));
|
return success(fileService.getFilePresignedUrl(path));
|
||||||
@@ -46,7 +43,6 @@ public class AppFileController {
|
|||||||
|
|
||||||
/** 创建文件", description = "模式二:前端上传文件:配合 presigned-url 接口,记录上传了上传的文件 */
|
/** 创建文件", description = "模式二:前端上传文件:配合 presigned-url 接口,记录上传了上传的文件 */
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@PermitAll
|
|
||||||
public CommonResult<Long> createFile(@Valid @RequestBody FileCreateReqVO createReqVO) {
|
public CommonResult<Long> createFile(@Valid @RequestBody FileCreateReqVO createReqVO) {
|
||||||
return success(fileService.createFile(createReqVO));
|
return success(fileService.createFile(createReqVO));
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.tashow.cloud.infra.controller.app.file.vo;
|
package com.tashow.cloud.file.controller.app.file.vo;
|
||||||
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package com.tashow.cloud.file.controller.app;
|
||||||
@@ -3,4 +3,4 @@
|
|||||||
* 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目
|
* 1. admin 包:提供给管理后台 yudao-ui-admin 前端项目
|
||||||
* 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
|
* 2. app 包:提供给用户 APP yudao-ui-app 前端项目,它的 Controller 和 VO 都要添加 App 前缀,用于和管理后台进行区分
|
||||||
*/
|
*/
|
||||||
package com.tashow.cloud.member.controller;
|
package com.tashow.cloud.user.controller;
|
||||||
@@ -1,9 +1,9 @@
|
|||||||
package com.tashow.cloud.infra.convert.config;
|
package com.tashow.cloud.file.convert.config;
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.PageResult;
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigRespVO;
|
import com.tashow.cloud.file.controller.admin.config.vo.ConfigRespVO;
|
||||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigSaveReqVO;
|
import com.tashow.cloud.file.controller.admin.config.vo.ConfigSaveReqVO;
|
||||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
import com.tashow.cloud.file.dal.dataobject.config.ConfigDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.tashow.cloud.infra.convert.file;
|
package com.tashow.cloud.file.convert.file;
|
||||||
|
|
||||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigSaveReqVO;
|
||||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
import com.tashow.cloud.file.dal.dataobject.file.FileConfigDO;
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
import org.mapstruct.Mapping;
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.factory.Mappers;
|
import org.mapstruct.factory.Mappers;
|
||||||
@@ -3,4 +3,4 @@
|
|||||||
*
|
*
|
||||||
* 目前使用 MapStruct 框架
|
* 目前使用 MapStruct 框架
|
||||||
*/
|
*/
|
||||||
package com.tashow.cloud.member.convert;
|
package com.tashow.cloud.user.convert;
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.tashow.cloud.infra.dal.dataobject.config;
|
package com.tashow.cloud.file.dal.dataobject.config;
|
||||||
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
|
||||||
import com.tashow.cloud.infra.enums.config.ConfigTypeEnum;
|
|
||||||
import com.tashow.cloud.infra.enums.config.ConfigTypeEnum;
|
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
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 com.tashow.cloud.infra.enums.config.ConfigTypeEnum;
|
import com.tashow.cloud.file.enums.config.ConfigTypeEnum;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
@@ -1,20 +1,19 @@
|
|||||||
package com.tashow.cloud.infra.dal.dataobject.file;
|
package com.tashow.cloud.file.dal.dataobject.file;
|
||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.tashow.cloud.common.util.json.JsonUtils;
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
|
||||||
import com.tashow.cloud.infra.framework.file.core.client.FileClientConfig;
|
|
||||||
import com.tashow.cloud.infra.framework.file.core.client.db.DBFileClientConfig;
|
|
||||||
import com.tashow.cloud.infra.framework.file.core.client.ftp.FtpFileClientConfig;
|
|
||||||
import com.tashow.cloud.infra.framework.file.core.client.local.LocalFileClientConfig;
|
|
||||||
import com.tashow.cloud.infra.framework.file.core.client.s3.S3FileClientConfig;
|
|
||||||
import com.tashow.cloud.infra.framework.file.core.client.sftp.SftpFileClientConfig;
|
|
||||||
import com.tashow.cloud.infra.framework.file.core.enums.FileStorageEnum;
|
|
||||||
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.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
|
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.tashow.cloud.common.util.json.JsonUtils;
|
||||||
|
import com.tashow.cloud.file.framework.file.core.client.FileClientConfig;
|
||||||
|
import com.tashow.cloud.file.framework.file.core.client.ftp.FtpFileClientConfig;
|
||||||
|
import com.tashow.cloud.file.framework.file.core.client.local.LocalFileClientConfig;
|
||||||
|
import com.tashow.cloud.file.framework.file.core.client.s3.S3FileClientConfig;
|
||||||
|
import com.tashow.cloud.file.framework.file.core.client.sftp.SftpFileClientConfig;
|
||||||
|
import com.tashow.cloud.file.framework.file.core.enums.FileStorageEnum;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
@@ -86,8 +85,6 @@ public class FileConfigDO extends BaseDO {
|
|||||||
String className = JsonUtils.parseObject(json, "@class", String.class);
|
String className = JsonUtils.parseObject(json, "@class", String.class);
|
||||||
className = StrUtil.subAfter(className, ".", true);
|
className = StrUtil.subAfter(className, ".", true);
|
||||||
switch (className) {
|
switch (className) {
|
||||||
case "DBFileClientConfig":
|
|
||||||
return JsonUtils.parseObject2(json, DBFileClientConfig.class);
|
|
||||||
case "FtpFileClientConfig":
|
case "FtpFileClientConfig":
|
||||||
return JsonUtils.parseObject2(json, FtpFileClientConfig.class);
|
return JsonUtils.parseObject2(json, FtpFileClientConfig.class);
|
||||||
case "LocalFileClientConfig":
|
case "LocalFileClientConfig":
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.tashow.cloud.infra.dal.dataobject.file;
|
package com.tashow.cloud.file.dal.dataobject.file;
|
||||||
|
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.tashow.cloud.mybatis.mybatis.core.dataobject.BaseDO;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package com.tashow.cloud.user.dal.dataobject;
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.tashow.cloud.infra.dal.mysql.config;
|
package com.tashow.cloud.file.dal.mysql.config;
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.PageResult;
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import com.tashow.cloud.file.controller.admin.config.vo.ConfigPageReqVO;
|
||||||
|
import com.tashow.cloud.file.dal.dataobject.config.ConfigDO;
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
|
||||||
import com.tashow.cloud.infra.controller.admin.config.vo.ConfigPageReqVO;
|
|
||||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
|
||||||
import com.tashow.cloud.infra.dal.dataobject.config.ConfigDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.tashow.cloud.infra.dal.mysql.file;
|
package com.tashow.cloud.file.dal.mysql.file;
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.PageResult;
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import com.tashow.cloud.file.controller.admin.file.vo.config.FileConfigPageReqVO;
|
||||||
|
import com.tashow.cloud.file.dal.dataobject.file.FileConfigDO;
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
|
||||||
import com.tashow.cloud.infra.controller.admin.file.vo.config.FileConfigPageReqVO;
|
|
||||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
|
||||||
import com.tashow.cloud.infra.dal.dataobject.file.FileConfigDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.tashow.cloud.infra.dal.mysql.file;
|
package com.tashow.cloud.file.dal.mysql.file;
|
||||||
|
|
||||||
import com.tashow.cloud.common.pojo.PageResult;
|
import com.tashow.cloud.common.pojo.PageResult;
|
||||||
|
import com.tashow.cloud.file.controller.admin.file.vo.file.FilePageReqVO;
|
||||||
|
import com.tashow.cloud.file.dal.dataobject.file.FileDO;
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
|
||||||
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import com.tashow.cloud.infra.dal.dataobject.file.FileDO;
|
|
||||||
import com.tashow.cloud.infra.controller.admin.file.vo.file.FilePageReqVO;
|
|
||||||
import com.tashow.cloud.infra.dal.dataobject.file.FileDO;
|
|
||||||
import com.tashow.cloud.infra.dal.dataobject.file.FileDO;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
package com.tashow.cloud.user.dal.mysql;
|
||||||
@@ -6,4 +6,4 @@
|
|||||||
*
|
*
|
||||||
* 其中,MySQL 的表以 member_ 作为前缀
|
* 其中,MySQL 的表以 member_ 作为前缀
|
||||||
*/
|
*/
|
||||||
package com.tashow.cloud.member.dal;
|
package com.tashow.cloud.user.dal;
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user