diff --git a/README.md b/README.md index 3d81776410c5a4933c2dff3566c1e58dfbd04569..e6c47b0b61e15a44f201dd173d978c7ca9e98a92 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ -# Bootx-Platform (v1.2.1) +# Bootx-Platform (v1.2.2)

star - Build Status + Build Status Build Status - Downloads + Downloads

@@ -15,29 +15,35 @@ 基于Spring Boot框架打造,针对单体式应用进行专门设计,提供整套服务模块,努力为打造全方位企业级开发解决方案, 致力将开源版打造成超越商业版后台管理框架的项目。 -- Spring Cloud版本使用Spring Cloud Alibaba技术栈 +- 单体版本使用Spring Boot相关技术栈 +- 分布式版本使用Spring Cloud Alibaba技术栈 - vue2使用 [ANTD PRO VUE](https://pro.antdv.com/) 作为脚手架 - vue3使用 [Vben-Admin](https://vvbin.cn/doc-next/) 作为脚手架 -- 移动端使用 [Taro](https://taro.jd.com/) vue3+TS为技术栈。 +- 可视化大屏使用 [Go-VIew](https://gitee.com/dromara/go-view) 作为基础框架 +- 移动端使用 [Taro](https://taro.jd.com/)、[NutUI](https://nutui.jd.com/) vue3+TS为技术栈。 ## 🍒文档 -- 系统演示地址:[管理平台(vue2)](http://web.platform.bootx.cn/)、[管理平台(vue3)](http://v3.platform.bootx.cn/) -- 前端项目地址:[前端项目(vue2)](https://gitee.com/bootx/bootx-platform-ui)、[前端项目(vue3)](https://gitee.com/bootx/bootx-platform-vue3) +- 系统演示地址:[管理平台(vue2)](http://web.platform.bootx.cn/)、[管理平台(vue3)](http://v3.platform.bootx.cn/)、[可视化大屏](http://visualization.platform.bootx.cn/) +- 前端项目地址:[前端项目(vue2)](https://gitee.com/bootx/bootx-platform-ui)、[前端项目(vue3)](https://gitee.com/bootx/bootx-platform-vue3)、[可视化大屏](https://gitee.com/bootx/bootx-platform-visualization) - 移动端项目地址:[移动端项目(taro+vue3+ts)](https://gitee.com/xucun/bootx-platform-mobile) - 日志收集:[ELK](http://elk.dev.bootx.cn:5601/app/discove)、[PlumeLog](http://platform.dev.bootx.cn:8080/plumelog/#/) - 项目文档:[项目文档(GITEE)](https://bootx.gitee.io/)、[项目文档(备用)](https://doc.bootx.cn/) - 更新日志:[更新日志](./_doc/ChangeLog.md) ## 🛠️功能亮点 + +低代码可视化平台,基于`GoView`开发,可以通过托拉拽来生成常用的大屏,可以用上快速开打各种数据看板的场景。 +![](https://oscimg.oschina.net/oscnet/up-43cd6c0ac952c938863db303d0c2e644827.png) + +集成最新版本的Flowable 6.7.2 工作流,并基于Bpmn.js定制流程设计器,相较于自带modeler更贴近业务和易用,通过关联动态表单可通过托拉拽实现业务审批流的业务 +![](https://oscimg.oschina.net/oscnet/up-22b8de0f4951ee6165e2ae604ad77b0af44.png) + 支持支付宝、微信、聚合支付、现金支付、储值卡支付、钱包,对各种支付方式抽象成策略类,通过模板模式进行串通,方便扩展新的支付方式或业务 结算台演示地址:[http://web.platform.bootx.cn/cashier](http://web.platform.bootx.cn/cashier) ![](https://oscimg.oschina.net/oscnet/up-9f0044b76071d5a7f598ceab591c5fedb02.png) -集成最新版本的Flowable 6.7.2 工作流,并基于Bpmn.js定制流程设计器,相较于自带modeler更贴近业务和易用,通过关联动态表单可通过托拉拽实现业务审批流的业务 -![](https://oscimg.oschina.net/oscnet/up-22b8de0f4951ee6165e2ae604ad77b0af44.png) - ## 🍎特色功能 - 支持单通道支付、聚合支付、组合支付、部分和全部退款等支付功能 - 支持支付宝、微信、云闪付、现金、钱包、储值卡等多种支付方式 @@ -52,39 +58,32 @@ - 支持站内信、微信、钉钉、企业微信、微信公众号的消息推送 - 支持微信自定义菜单、素材、消息模板等资源的管理 - 集成Flowable+Bpmn.js工作流全家桶,方便OA相关功能的开发 +- 基于GoView打造低代码可视化大屏平台,快速生成各种数据展板和大屏 ## 🚅 路线图 -- 工作流功能完善 - - [x] 更灵活的节点用户配置,可配置发起人、指定用户、指定角色等,关联消息通知 - - [x] 会签处理、串签处理、或签处理、驳回处理、任意节点退回、会签比例通过处理 -- Vue3版本前端 - - [x] 登录模块移植 - - [x] 基础功能移植已完成 - - [x] 组件移植和Mixin转换为Hooks、 - - [x] 支付功能移植基本完成 - - [ ] 工作流功能移植除流程设计器外已完成 -- Spring Cloud版本 - - [ ] 代码组织结构调整 - - [x] 网关定制开发 - - [ ] 功能模块移植 +- 功能 + - [x] 基于`GoView`的低代码可视化大屏平台 (90%) + - [ ] Vue3工作流功能移植除流程设计器 + - [ ] 短信通知 ## 🥂 Quick Start -- 下载项目并切换到master分支,或者下载发行版后导入IDEA中,下载对应的Maven依赖 -- 配置好各种必要的数据库中间件地址(见下方中间表),直接启动项目。注:不需要导入Sql脚本到数据库中,默认启用`flyway`会自动对数据库进行初始化 -- 如果使用`_config/sql`导入到数据库中的方式,则需要在项目启动前将`spring.flyway.enabled`设为`false`后启动项目,推荐使用`flyway`对数据库进行数据管理 -- 后端启动启动成功,开始启动前端 -- 安装依赖 `yarn install`,node版本需要12以上,推荐使用16 -- 启动前端 `yarn serve`,进行访问 +[后端](https://bootx.gitee.io/doc/overview/config/项目启动.html#后端启动) + +Vue2前端: [Vue2前端启动流程](https://bootx.gitee.io/doc/overview/config/%E9%A1%B9%E7%9B%AE%E5%90%AF%E5%8A%A8.html#环境准备) + +Vue3后端: [Vue3前端启动流程](https://bootx.gitee.io/doc/overview/config/%E9%A1%B9%E7%9B%AE%E5%90%AF%E5%8A%A8.html#环境准备-1) + +可视化大屏: [可视化大屏启动流程](http://) **中间件配置** -| 组件 | 是否必须配置 | 备注 | -| -------- | ------------ |---------------------------------------------| -| MySQL | 是 | 不设置无法启动 | -| Redis | 是 | 不设置启动后无法正常使用 | -| RabbitMQ | 否 | 支付消息通知在使用 | -| MongoDB | 否 | 默认审计日志和文件管理使用持久化方式为Mono,可在配置文件中配置切换成其他持久化方式 | -| plumelog | 是 | 默认项目自带lite版plumelog,不需要额外配置中间件,直接就可以使用 | +| 组件 | 是否必须配置 | 备注 | +|----------|--------|---------------------------------------------| +| MySQL | 是 | 不设置无法启动 | +| Redis | 是 | 不设置启动后无法正常使用 | +| RabbitMQ | 否 | 支付消息通知在使用 | +| MongoDB | 否 | 默认审计日志和文件管理使用持久化方式为Mono,可在配置文件中配置切换成其他持久化方式 | +| plumelog | 是 | 默认项目自带lite版plumelog,不需要额外配置中间件,直接就可以使用 | ## 🥞项目整体结构 ```lua @@ -125,17 +124,13 @@ bootx-platform ├── common-websocket -- websocket封装 ├── common-xxl-job -- XXL-JOB定时任务 ├── bootx-demo -- demo示例模块 - ├── bootx-modules -- 业务系统(停用) - ├── eshop -- 网上商城(停用) ├── bootx-services -- 业务服务模块 ├── service-baseapi -- 基础api功能服务 - ├── service-goods -- 商品中心服务(停用) ├── service-iam -- 身份识别与访问管理 ├── service-notice -- 消息通知服务 ├── service-office -- 办公服务 - ├── service-order -- 订单服务(停用) + ├── service-visualization 可视化大屏管理 ├── service-payment -- 支付服务 - ├── service-sales -- 销售中心(停用) ├── bootx-start -- 启动模块 ``` ## 🍇模块结构说明 @@ -159,7 +154,7 @@ service-iam **core核心包业务代码分包** ```lua -├───code +├───core ├── business -- 业务模块 ├── convert -- 实体类转换 ├── dao -- 持久化类 diff --git a/_config/sql/1.2.2/1.2.1_up_1.2.2.sql b/_config/sql/1.2.2/1.2.1_up_1.2.2.sql new file mode 100644 index 0000000000000000000000000000000000000000..a264264f5bffa5ee62dd915c11eca1a4508fd6cd --- /dev/null +++ b/_config/sql/1.2.2/1.2.1_up_1.2.2.sql @@ -0,0 +1,106 @@ +SET FOREIGN_KEY_CHECKS=0; + +CREATE TABLE `report_project_info` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目名称', + `state` int(11) NULL DEFAULT NULL COMMENT '发布状态', + `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '报表内容', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建者ID', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修者ID', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '乐观锁', + `deleted` bit(1) NOT NULL COMMENT '删除标志', + `index_image` bigint(20) NULL DEFAULT NULL COMMENT '预览图片id', + `edit` bit(1) NULL DEFAULT NULL COMMENT '是否在编辑中', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义大屏信息' ROW_FORMAT = Dynamic; + +CREATE TABLE `report_project_info_publish` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '报表内容', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建者ID', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修者ID', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '乐观锁', + `deleted` bit(1) NOT NULL COMMENT '删除标志', + PRIMARY KEY (`id`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义大屏发布信息' ROW_FORMAT = Dynamic; + +DROP TABLE `goods_brand`; + +DROP TABLE `goods_category`; + +DROP TABLE `goods_category_brand`; + +DROP TABLE `goods_category_parameter`; + +DROP TABLE `goods_category_parameter_group`; + +DROP TABLE `goods_category_specification`; + +DROP TABLE `goods_goods`; + +DROP TABLE `goods_goods_packing`; + +DROP TABLE `goods_goods_sku`; + +DROP TABLE `goods_goods_sku_attr`; + +DROP TABLE `goods_goods_sku_packing`; + +DROP TABLE `goods_specification`; + +DROP TABLE `order_order`; + +DROP TABLE `order_order_billing`; + +DROP TABLE `order_order_detail`; + +DROP TABLE `order_order_item_billing`; + +DROP TABLE `order_order_strategy_mapping`; + +DROP TABLE `sales_activity`; + +DROP TABLE `sales_check_rule`; + +DROP TABLE `sales_coupon`; + +DROP TABLE `sales_coupon_template`; + +DROP TABLE `sales_match_rule`; + +DROP TABLE `sales_strategy`; + +DROP TABLE `sales_strategy_check_rule`; + +DROP TABLE `sales_strategy_config`; + +DROP TABLE `sales_strategy_config_value`; + +DROP TABLE `sales_strategy_register`; + +SET FOREIGN_KEY_CHECKS = 0; + +INSERT INTO `iam_client`(`id`, `code`, `name`, `system`, `enable`, `login_type_ids`, `description`, `creator`, `create_time`, `last_modifier`, `last_modified_time`, `version`, `deleted`) VALUES (1626840094767714304, 'GoView', '可视化平台', b'0', b'1', '1430430071299207168', '', 1414143554414059520, '2023-02-18 15:04:38', 1414143554414059520, '2023-02-18 15:04:38', 0, 0); + +INSERT INTO `iam_login_type`(`id`, `code`, `name`, `type`, `system`, `timeout`, `captcha`, `pwd_err_num`, `enable`, `description`, `creator`, `create_time`, `last_modifier`, `last_modified_time`, `version`, `deleted`) VALUES (1626845524617203712, 'passwordGoView', '可视化平台登录', 'password', b'0', 3600, b'0', -1, b'1', '', 1414143554414059520, '2023-02-18 15:26:13', 1414143554414059520, '2023-02-18 15:26:13', 0, 0); + +UPDATE `iam_login_type` SET `code` = 'password', `name` = '账号密码登陆', `type` = 'password', `system` = b'1', `timeout` = 3600, `captcha` = b'0', `pwd_err_num` = -1, `enable` = b'1', `description` = NULL, `creator` = 1399985191002447872, `create_time` = '2021-08-25 15:21:20', `last_modifier` = 1399985191002447872, `last_modified_time` = '2022-11-03 22:24:53', `version` = 20, `deleted` = 0 WHERE `id` = 1430430071299207168; + +INSERT INTO `iam_perm_menu`(`id`, `client_code`, `parent_id`, `title`, `name`, `perm_code`, `effect`, `icon`, `hidden`, `hide_children_in_menu`, `component`, `component_name`, `path`, `redirect`, `sort_no`, `menu_type`, `leaf`, `keep_alive`, `target_outside`, `hidden_header_content`, `admin`, `remark`, `creator`, `create_time`, `last_modifier`, `last_modified_time`, `version`, `deleted`) VALUES (1631946120891707392, 'admin', 1552207982510706688, '可视化大屏', 'ProjectInfoList', NULL, b'0', '', b'0', b'0', 'develop/report/ProjectInfoList', NULL, '/develop/report', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2023-03-04 17:14:10', 1399985191002447872, '2023-03-04 17:14:10', 0, 0); + +INSERT INTO `iam_perm_menu`(`id`, `client_code`, `parent_id`, `title`, `name`, `perm_code`, `effect`, `icon`, `hidden`, `hide_children_in_menu`, `component`, `component_name`, `path`, `redirect`, `sort_no`, `menu_type`, `leaf`, `keep_alive`, `target_outside`, `hidden_header_content`, `admin`, `remark`, `creator`, `create_time`, `last_modifier`, `last_modified_time`, `version`, `deleted`) VALUES (1629039360928075776, 'adminv3', 1582276341792985088, '可视化大屏', 'ProjectInfoList', NULL, b'0', '', b'0', b'0', '/modules/develop/report/ProjectInfoList', NULL, '/develop/report', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-02-24 16:43:44', 1414143554414059520, '2023-02-24 16:44:17', 1, 0); + +UPDATE `iam_perm_menu` SET `client_code` = 'adminv3', `parent_id` = 1599378992811429888, `title` = '邮件通知', `name` = 'EmailSenderDemo', `perm_code` = NULL, `effect` = b'0', `icon` = '', `hidden` = b'0', `hide_children_in_menu` = b'0', `component` = '/modules/demo/notice/email/EmailSenderDemo.vue', `component_name` = NULL, `path` = '/demo/notice/email', `redirect` = '', `sort_no` = 0, `menu_type` = 1, `leaf` = NULL, `keep_alive` = b'1', `target_outside` = b'0', `hidden_header_content` = b'0', `admin` = b'0', `remark` = NULL, `creator` = 1414143554414059520, `create_time` = '2023-02-08 22:20:04', `last_modifier` = 1414143554414059520, `last_modified_time` = '2023-02-20 10:38:55', `version` = 1, `deleted` = 0 WHERE `id` = 1623325795944439808; + +UPDATE `iam_user_info` SET `name` = '小小明', `username` = 'xxm', `password` = 'f52020dca765fd3943ed40a615dc2c5c', `phone` = '133****3333', `email` = 'x******@outlook.com', `client_ids` = '1430430071299207168,1430430071299207169,1626840094767714304,1580487061605175296', `avatar` = NULL, `source` = NULL, `admin` = b'1', `register_time` = '2021-06-02 15:04:12', `status` = 1, `creator` = 1, `create_time` = '2021-06-02 15:04:15', `last_modifier` = 1414143554414059520, `last_modified_time` = '2023-02-18 15:08:42', `version` = 55, `deleted` = 0 WHERE `id` = 1399985191002447872; + +UPDATE `iam_user_info` SET `name` = '小小明1995', `username` = 'xxm1995', `password` = 'f52020dca765fd3943ed40a615dc2c5c', `phone` = '130****0000', `email` = 'x******@foxmail.com', `client_ids` = '1430430071299207168,1580487061605175296,1430430071299207169,1626840094767714304', `avatar` = NULL, `source` = NULL, `admin` = b'1', `register_time` = '2021-07-11 16:44:31', `status` = 1, `creator` = 1, `create_time` = '2021-07-11 16:44:32', `last_modifier` = 1414143554414059520, `last_modified_time` = '2023-02-18 15:08:48', `version` = 9, `deleted` = 0 WHERE `id` = 1414143554414059520; + +SET FOREIGN_KEY_CHECKS = 1; + +SET FOREIGN_KEY_CHECKS=1; diff --git a/_config/sql/bootx-platform.sql b/_config/sql/bootx-platform.sql index e66a1ad8c0ceffa6aeb83fc16c1a06b5bf1950b8..3ba3dba131aa3140f0c4e081fc3c30ea305bc101 100644 --- a/_config/sql/bootx-platform.sql +++ b/_config/sql/bootx-platform.sql @@ -9,7 +9,7 @@ Target Server Version : 50735 File Encoding : 65001 - Date: 12/02/2023 15:11:59 + Date: 03/03/2023 16:59:26 */ SET NAMES utf8mb4; @@ -4034,316 +4034,6 @@ INSERT INTO `demo_super_query` VALUES (1496372489909899264, '张飞', 54, b'0', INSERT INTO `demo_super_query` VALUES (1496372766427779072, '梁冀', 38, b'1', '1958-02-08', '08:30:00', '2022-02-23 14:34:03', '1', '', 1399985191002447872, '2022-02-23 14:34:03', 1399985191002447872, '2022-02-23 14:34:03', 0, 0); INSERT INTO `demo_super_query` VALUES (1496373512871284736, '刘备', 108, b'0', '1993-11-12', '09:30:10', '2022-02-23 14:37:01', '2', '刘羽禅的粑粑', 1399985191002447872, '2022-02-23 14:37:01', 1399985191002447872, '2022-02-23 14:37:01', 0, 0); --- ---------------------------- --- Table structure for goods_brand --- ---------------------------- -DROP TABLE IF EXISTS `goods_brand`; -CREATE TABLE `goods_brand` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌名称', - `logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌图标', - `enable` bit(1) NULL DEFAULT NULL COMMENT '是否启用', - `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '品牌' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_brand --- ---------------------------- -INSERT INTO `goods_brand` VALUES (1524046765181800448, '鸭鸭', '', NULL, '', 1399985191002447872, '2022-05-10 23:20:39', 1399985191002447872, '2022-05-10 23:20:39', 0, 0); -INSERT INTO `goods_brand` VALUES (1525092807788691456, '微信', '', b'1', '', 1399985191002447872, '2022-05-13 20:37:15', 1399985191002447872, '2022-05-13 20:37:15', 0, 0); -INSERT INTO `goods_brand` VALUES (1525092835118776320, '舜泰', '', b'1', '', 1399985191002447872, '2022-05-13 20:37:21', 1399985191002447872, '2022-05-13 20:37:21', 0, 0); -INSERT INTO `goods_brand` VALUES (1525092854139944960, '绿城', '', b'1', '', 1399985191002447872, '2022-05-13 20:37:26', 1399985191002447872, '2022-05-13 20:37:26', 0, 0); - --- ---------------------------- --- Table structure for goods_category --- ---------------------------- -DROP TABLE IF EXISTS `goods_category`; -CREATE TABLE `goods_category` ( - `id` bigint(20) NOT NULL, - `pid` bigint(20) NULL DEFAULT NULL COMMENT '上级类目id', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类目名称', - `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标/图片地址', - `enable` bit(1) NOT NULL COMMENT '是否启用', - `sort_no` double(8, 2) NULL DEFAULT NULL COMMENT '排序', - `level` int(5) NULL DEFAULT NULL COMMENT '层级', - `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_category --- ---------------------------- - --- ---------------------------- --- Table structure for goods_category_brand --- ---------------------------- -DROP TABLE IF EXISTS `goods_category_brand`; -CREATE TABLE `goods_category_brand` ( - `id` bigint(20) NOT NULL, - `category_id` bigint(20) NOT NULL COMMENT '分类id', - `brand_id` bigint(20) NOT NULL COMMENT '品牌id', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目品牌关联' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_category_brand --- ---------------------------- - --- ---------------------------- --- Table structure for goods_category_parameter --- ---------------------------- -DROP TABLE IF EXISTS `goods_category_parameter`; -CREATE TABLE `goods_category_parameter` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '品牌名称', - `type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类型', - `options` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '选择值(列表)', - `required` bit(1) NULL DEFAULT NULL COMMENT '是否必填', - `sort_no` double(8, 2) NULL DEFAULT NULL COMMENT '排序', - `group_id` bigint(20) NULL DEFAULT NULL COMMENT '参数组id', - `category_id` bigint(20) NULL DEFAULT NULL COMMENT '类目id', - `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目参数' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_category_parameter --- ---------------------------- - --- ---------------------------- --- Table structure for goods_category_parameter_group --- ---------------------------- -DROP TABLE IF EXISTS `goods_category_parameter_group`; -CREATE TABLE `goods_category_parameter_group` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', - `sort_no` double(8, 2) NULL DEFAULT NULL COMMENT '排序', - `category_id` bigint(20) NULL DEFAULT NULL COMMENT '类目id', - `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目参数组' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_category_parameter_group --- ---------------------------- - --- ---------------------------- --- Table structure for goods_category_specification --- ---------------------------- -DROP TABLE IF EXISTS `goods_category_specification`; -CREATE TABLE `goods_category_specification` ( - `id` bigint(20) NOT NULL, - `category_id` bigint(20) NOT NULL COMMENT '分类id', - `specification_id` bigint(20) NOT NULL COMMENT '规格id', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目规格关联' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_category_specification --- ---------------------------- -INSERT INTO `goods_category_specification` VALUES (1525131071690076160, 1523994966466924544, 1524258633343254528); -INSERT INTO `goods_category_specification` VALUES (1525131071694270464, 1523994966466924544, 1524360756764590080); - --- ---------------------------- --- Table structure for goods_goods --- ---------------------------- -DROP TABLE IF EXISTS `goods_goods`; -CREATE TABLE `goods_goods` ( - `id` bigint(20) NOT NULL, - `cid` bigint(20) NULL DEFAULT NULL COMMENT '类目id', - `cname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类目名称', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编码', - `packing` bit(1) NOT NULL COMMENT '是否是打包品', - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `addition` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数', - `state` int(11) NOT NULL COMMENT '状态', - `banner_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `display_price` decimal(19, 2) NULL DEFAULT NULL, - `goods_type` int(11) NULL DEFAULT NULL, - `main_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `sale_off_time` datetime(6) NULL DEFAULT NULL, - `sale_on_time` datetime(6) NULL DEFAULT NULL, - `sale_state` int(11) NULL DEFAULT NULL, - `shop_id` bigint(20) NULL DEFAULT NULL, - `attr_def_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `attr_value_displays` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `attr_values` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `display_lower_price` decimal(19, 2) NULL DEFAULT NULL, - `display_upper_price` decimal(19, 2) NULL DEFAULT NULL, - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - `out_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品spu' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_goods --- ---------------------------- - --- ---------------------------- --- Table structure for goods_goods_packing --- ---------------------------- -DROP TABLE IF EXISTS `goods_goods_packing`; -CREATE TABLE `goods_goods_packing` ( - `id` bigint(20) NOT NULL, - `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '打包品', - `packed_goods_id` bigint(20) NULL DEFAULT NULL COMMENT '被打包品', - `create_time` datetime(6) NULL DEFAULT NULL, - `creator` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品打包关系' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_goods_packing --- ---------------------------- - --- ---------------------------- --- Table structure for goods_goods_sku --- ---------------------------- -DROP TABLE IF EXISTS `goods_goods_sku`; -CREATE TABLE `goods_goods_sku` ( - `id` bigint(20) NOT NULL, - `cid` bigint(20) NULL DEFAULT NULL COMMENT '所属类目id', - `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '所属商品 id', - `shop_id` bigint(20) NULL DEFAULT NULL COMMENT '所属商户', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '外部编码', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'SKU 名称', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `packing` bit(1) NOT NULL COMMENT '是否打包品', - `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加信息', - `business_id` bigint(20) NULL DEFAULT NULL COMMENT '业务id', - `attr_def_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '生成此商品 SKU 的属性定义的 id 拼接串', - `attr_values` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性值id拼接串', - `attr_value_displays` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '示值拼接串', - `is_unlimited` bit(1) NOT NULL COMMENT '是否无限库存', - `capacity` int(11) NOT NULL COMMENT '初始库存', - `locked` int(11) NOT NULL COMMENT '预占库存', - `sold` int(11) NOT NULL COMMENT '已用库存', - `available` int(11) NOT NULL COMMENT '可用库存', - `sale_state` int(11) NULL DEFAULT NULL COMMENT '销售状态', - `sale_off_time` datetime(6) NULL DEFAULT NULL COMMENT '上架时间', - `sale_on_time` datetime(6) NULL DEFAULT NULL COMMENT '下架时间', - `price` decimal(19, 2) NULL DEFAULT NULL COMMENT '价格', - `state` int(11) NOT NULL COMMENT '状态', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NULL DEFAULT NULL, - `out_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品sku' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_goods_sku --- ---------------------------- - --- ---------------------------- --- Table structure for goods_goods_sku_attr --- ---------------------------- -DROP TABLE IF EXISTS `goods_goods_sku_attr`; -CREATE TABLE `goods_goods_sku_attr` ( - `id` bigint(20) NOT NULL, - `cid` bigint(20) NULL DEFAULT NULL COMMENT '类目 id', - `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '商品 id', - `sku_id` bigint(20) NULL DEFAULT NULL COMMENT 'SKU id', - `attr_def_id` bigint(20) NULL DEFAULT NULL COMMENT '属性定义 id', - `attr_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性值', - `attr_value_display` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '显示值', - `tid` bigint(20) NOT NULL, - `attr_values_display` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `attr_value_displays` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sku属性' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_goods_sku_attr --- ---------------------------- - --- ---------------------------- --- Table structure for goods_goods_sku_packing --- ---------------------------- -DROP TABLE IF EXISTS `goods_goods_sku_packing`; -CREATE TABLE `goods_goods_sku_packing` ( - `id` bigint(20) NOT NULL, - `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '打包品', - `packed_goods_id` bigint(20) NULL DEFAULT NULL COMMENT '被打包品', - `goods_sku_id` bigint(20) NULL DEFAULT NULL COMMENT '打包SKU', - `packed_sku_id` bigint(20) NULL DEFAULT NULL COMMENT '被打包SKU', - `create_time` datetime(6) NULL DEFAULT NULL, - `creator` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sku打包关系' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_goods_sku_packing --- ---------------------------- - --- ---------------------------- --- Table structure for goods_specification --- ---------------------------- -DROP TABLE IF EXISTS `goods_specification`; -CREATE TABLE `goods_specification` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格名称', - `type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型', - `options` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格列表值', - `state` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态', - `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '规格' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_specification --- ---------------------------- - -- ---------------------------- -- Table structure for iam_client -- ---------------------------- @@ -4371,6 +4061,7 @@ CREATE TABLE `iam_client` ( INSERT INTO `iam_client` VALUES (1430430071299207168, 'admin', 'pc管理端', b'1', b'1', '1430430071299207168,1435138582839009280,1430478946919653376,1542091599907115008,1542804450312122368,1543126042909016064', 'pc浏览器', 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-07-02 14:55:11', 4, 0); INSERT INTO `iam_client` VALUES (1430430071299207169, 'h5', 'h5端', b'1', b'1', '1430430071299207168,1435138582839009280', '手机wap', 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-06-29 18:31:45', 1, 0); INSERT INTO `iam_client` VALUES (1580487061605175296, 'adminv3', 'pc管理端(vue3版)', b'0', b'1', '1430430071299207168,1430478946919653376,1435138582839009280,1542091599907115008,1542804450312122368,1543126042909016064', 'vue3版本', 1399985191002447872, '2022-10-13 17:14:14', 1399985191002447872, '2022-10-13 17:14:25', 1, 0); +INSERT INTO `iam_client` VALUES (1626840094767714304, 'GoView', '可视化平台', b'0', b'1', '1430430071299207168', '', 1414143554414059520, '2023-02-18 15:04:38', 1414143554414059520, '2023-02-18 15:04:38', 0, 0); -- ---------------------------- -- Table structure for iam_data_scope @@ -4509,12 +4200,13 @@ CREATE TABLE `iam_login_type` ( -- ---------------------------- -- Records of iam_login_type -- ---------------------------- -INSERT INTO `iam_login_type` VALUES (1430430071299207168, 'password', '账号密码登陆', 'password', b'1', 3600, b'1', -1, b'1', NULL, 1399985191002447872, '2021-08-25 15:21:20', 1414143554414059520, '2022-11-02 21:32:48', 19, 0); +INSERT INTO `iam_login_type` VALUES (1430430071299207168, 'password', '账号密码登陆', 'password', b'1', 3600, b'0', -1, b'1', NULL, 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-11-03 22:24:53', 20, 0); INSERT INTO `iam_login_type` VALUES (1430478946919653376, 'miniApp', '微信小程序', 'openId', b'0', 99999, b'0', 0, b'1', NULL, 1399985191002447872, '2021-08-25 18:35:33', 1399985191002447872, '2022-07-16 12:32:26', 3, 0); INSERT INTO `iam_login_type` VALUES (1435138582839009280, 'phone', '手机短信登录', 'openId', b'0', 3600, b'0', 0, b'1', NULL, 1399985191002447872, '2021-09-07 15:11:16', 1399985191002447872, '2022-07-16 12:32:19', 5, 0); INSERT INTO `iam_login_type` VALUES (1542091599907115008, 'dingTalk', '钉钉', 'openId', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-06-29 18:24:23', 1399985191002447872, '2022-07-02 14:55:01', 5, 0); INSERT INTO `iam_login_type` VALUES (1542804450312122368, 'weCom', '企业微信', 'openId', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-07-01 17:37:00', 1399985191002447872, '2022-07-01 17:37:00', 0, 0); INSERT INTO `iam_login_type` VALUES (1543126042909016064, 'weChat', '微信登录', 'openId', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-07-02 14:54:53', 0, '2022-10-12 22:15:05', 2, 0); +INSERT INTO `iam_login_type` VALUES (1626845524617203712, 'passwordGoView', '可视化平台登录', 'password', b'0', 3600, b'0', -1, b'1', '', 1414143554414059520, '2023-02-18 15:26:13', 1414143554414059520, '2023-02-18 15:26:13', 0, 0); -- ---------------------------- -- Table structure for iam_perm_menu @@ -4749,8 +4441,10 @@ INSERT INTO `iam_perm_menu` VALUES (1617847653746315264, 'adminv3', 159710279937 INSERT INTO `iam_perm_menu` VALUES (1617847747375763456, 'adminv3', 1597102799370317824, '数据脱敏', 'DataSensitiveDemoList', NULL, b'0', '', b'0', b'0', '/modules/demo/data/sensitive/DataSensitiveDemoList.vue', NULL, '/demo/data/sensitive', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-01-24 19:32:16', 1414143554414059520, '2023-01-24 20:06:58', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1621150743447965696, 'admin', 1495968302034210816, '省市区联动', 'ChinaRegionDemo', NULL, b'0', '', b'0', b'0', 'demo/chinaregion/ChinaRegionDemo', NULL, '/demo/chinaregion', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2023-02-02 22:17:11', 1399985191002447872, '2023-02-08 09:43:39', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1623156857846034432, 'adminv3', 1582276516905177088, '省市区联动', 'ChinaRegionDemo', NULL, b'0', '', b'0', b'0', '/modules/demo/chinaregion/ChinaRegionDemo', NULL, '/demo/chinaregion', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-02-08 11:08:46', 1414143554414059520, '2023-02-08 11:08:46', 0, 0); -INSERT INTO `iam_perm_menu` VALUES (1623325795944439808, 'adminv3', 1599378992811429888, '邮件通知', '', NULL, b'0', '', b'0', b'0', '', NULL, '/demo/notice', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-02-08 22:20:04', 1414143554414059520, '2023-02-08 22:20:04', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1623325795944439808, 'adminv3', 1599378992811429888, '邮件通知', 'EmailSenderDemo', NULL, b'0', '', b'0', b'0', '/modules/demo/notice/email/EmailSenderDemo.vue', NULL, '/demo/notice/email', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-02-08 22:20:04', 1414143554414059520, '2023-02-20 10:38:55', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1623494586215579648, 'admin', 1552207982510706688, '行政区划', 'ChinaRegion', NULL, b'0', '', b'1', b'0', 'develop/region/ChinaRegionList', NULL, '/develop/region', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2023-02-09 09:30:47', 1399985191002447872, '2023-02-09 17:50:05', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1629039360928075776, 'adminv3', 1582276341792985088, '可视化大屏', 'ProjectInfoList', NULL, b'0', '', b'0', b'0', '/modules/develop/report/ProjectInfoList', NULL, '/develop/report', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-02-24 16:43:44', 1414143554414059520, '2023-02-24 16:44:17', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1631946120891707392, 'admin', 1552207982510706688, '可视化大屏', 'ProjectInfoList', NULL, b'0', '', b'0', b'0', 'develop/report/ProjectInfoList', NULL, '/develop/report', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2023-03-04 17:14:10', 1399985191002447872, '2023-03-04 17:14:10', 0, 0); -- ---------------------------- -- Table structure for iam_perm_path @@ -4940,8 +4634,8 @@ CREATE TABLE `iam_user_info` ( -- ---------------------------- -- Records of iam_user_info -- ---------------------------- -INSERT INTO `iam_user_info` VALUES (1399985191002447872, '小小明', 'xxm', 'f52020dca765fd3943ed40a615dc2c5c', '13333333333', 'xxm1995@outlook.com', '1430430071299207168,1430430071299207169', NULL, NULL, b'1', '2021-06-02 15:04:12', 1, 1, '2021-06-02 15:04:15', 1399985191002447872, '2022-06-27 23:09:31', 50, 0); -INSERT INTO `iam_user_info` VALUES (1414143554414059520, '小小明1995', 'xxm1995', 'f52020dca765fd3943ed40a615dc2c5c', '13000000000', 'xxm1995@foxmail.com', NULL, NULL, NULL, b'1', '2021-07-11 16:44:31', 1, 1, '2021-07-11 16:44:32', 1414143554414059520, '2022-10-31 13:30:07', 5, 0); +INSERT INTO `iam_user_info` VALUES (1399985191002447872, '小小明', 'xxm', 'f52020dca765fd3943ed40a615dc2c5c', '133****3333', 'x******@outlook.com', '1430430071299207168,1430430071299207169,1626840094767714304,1580487061605175296', NULL, NULL, b'1', '2021-06-02 15:04:12', 1, 1, '2021-06-02 15:04:15', 1414143554414059520, '2023-02-18 15:08:42', 55, 0); +INSERT INTO `iam_user_info` VALUES (1414143554414059520, '小小明1995', 'xxm1995', 'f52020dca765fd3943ed40a615dc2c5c', '130****0000', 'x******@foxmail.com', '1430430071299207168,1580487061605175296,1430430071299207169,1626840094767714304', NULL, NULL, b'1', '2021-07-11 16:44:31', 1, 1, '2021-07-11 16:44:32', 1414143554414059520, '2023-02-18 15:08:48', 9, 0); INSERT INTO `iam_user_info` VALUES (1435894470432456704, '管理员', 'admin', 'f52020dca765fd3943ed40a615dc2c5c', '13000001111', 'admin@qq.com', '1430430071299207168', '', NULL, b'0', '2021-09-09 17:14:52', 1, 1399985191002447872, '2021-09-09 17:14:54', 1399985191002447872, '2022-09-16 16:41:51', 7, 0); INSERT INTO `iam_user_info` VALUES (1435967884114194432, '测试', 'test', 'f52020dca765fd3943ed40a615dc2c5c', '13311111111', 'test@qq.com', '1430430071299207168', '', NULL, b'0', '2021-09-09 22:06:37', 1, 1414143554414059520, '2021-09-09 22:06:37', 1399985191002447872, '2022-05-31 15:59:37', 9, 0); INSERT INTO `iam_user_info` VALUES (1477990832987361280, '测试用户001', 'test001', 'f52020dca765fd3943ed40a615dc2c5c', '', '', '1430430071299207168', '', NULL, b'0', '2022-01-03 21:10:49', 1, 1399985191002447872, '2022-01-03 21:10:49', 1399985191002447872, '2022-06-05 20:26:26', 1, 0); @@ -5196,166 +4890,6 @@ CREATE TABLE `notice_wechat_config` ( -- ---------------------------- INSERT INTO `notice_wechat_config` VALUES (181361815405135421, 0, 'test01', 'test01', 'ww9d6247559117d202', '8n6A3SzN-DJNkw8wyCcJnr8-SOjFFWSOlBqZN8vypKM', 1, 1415, '2018-11-20 11:07:07', 1415, '2018-11-20 11:07:07', 0, 0); --- ---------------------------- --- Table structure for order_order --- ---------------------------- -DROP TABLE IF EXISTS `order_order`; -CREATE TABLE `order_order` ( - `id` bigint(20) NOT NULL, - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编码', - `contact_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人', - `contact_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号', - `contact_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系邮箱', - `channel_id` bigint(20) NULL DEFAULT NULL COMMENT '渠道', - `pay_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', - `user_id` bigint(20) NULL DEFAULT NULL COMMENT '购买用户id', - `status` int(11) NOT NULL COMMENT '状态', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `type` int(11) NULL DEFAULT NULL COMMENT '类型', - `total_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '总金额', - `pay_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '实付金额', - `coupon_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所用优惠券ids', - `address_info` json NULL COMMENT '地址参数', - `invoice_info` json NULL COMMENT '发票参数', - `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数', - `device_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备id', - `source` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源', - `business_id` bigint(20) NULL DEFAULT NULL COMMENT '业务id', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of order_order --- ---------------------------- - --- ---------------------------- --- Table structure for order_order_billing --- ---------------------------- -DROP TABLE IF EXISTS `order_order_billing`; -CREATE TABLE `order_order_billing` ( - `id` bigint(20) NOT NULL, - `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', - `channel_id` bigint(20) NULL DEFAULT NULL COMMENT '渠道id', - `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', - `pay_type` int(11) NOT NULL COMMENT '交易目的', - `transaction_purpose` int(11) NOT NULL COMMENT '交易类型', - `transaction_type` int(11) NOT NULL COMMENT '支付类型', - `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '金额', - `count` int(11) NULL DEFAULT NULL COMMENT '交易数量', - `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务id', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单账单' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of order_order_billing --- ---------------------------- - --- ---------------------------- --- Table structure for order_order_detail --- ---------------------------- -DROP TABLE IF EXISTS `order_order_detail`; -CREATE TABLE `order_order_detail` ( - `id` bigint(20) NOT NULL, - `active_id` bigint(20) NULL DEFAULT NULL COMMENT '活动id', - `shop_id` bigint(20) NULL DEFAULT NULL COMMENT '店铺id', - `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', - `category_id` bigint(20) NULL DEFAULT NULL COMMENT '类目id', - `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '商品id', - `sku_id` bigint(20) NULL DEFAULT NULL COMMENT '库存id', - `goods_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名称', - `goods_price` decimal(19, 2) NULL DEFAULT NULL COMMENT '商品价格', - `num` int(11) NOT NULL COMMENT '数量', - `total_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '总价', - `pay_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '支付价', - `state` int(11) NULL DEFAULT NULL COMMENT '状态', - `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单明细' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of order_order_detail --- ---------------------------- - --- ---------------------------- --- Table structure for order_order_item_billing --- ---------------------------- -DROP TABLE IF EXISTS `order_order_item_billing`; -CREATE TABLE `order_order_item_billing` ( - `id` bigint(20) NOT NULL, - `order_billing_id` bigint(20) NULL DEFAULT NULL COMMENT '账单id', - `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', - `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', - `order_item_id` bigint(20) NULL DEFAULT NULL COMMENT '订单项id', - `sku_id` bigint(20) NULL DEFAULT NULL COMMENT '订单项目skuId', - `transaction_purpose` int(11) NOT NULL COMMENT '交易目的', - `transaction_type` int(11) NOT NULL COMMENT '交易类型(名目)', - `pay_type` int(11) NOT NULL COMMENT '支付类型', - `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '支付金额', - `count` int(11) NULL DEFAULT NULL COMMENT '使用数量', - `bookkeeping_time` bigint(20) NULL DEFAULT NULL COMMENT '入账时间', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NOT NULL, - `business_type` int(11) NULL DEFAULT NULL, - `source_item_billing_id` bigint(20) NULL DEFAULT NULL, - `source_order_item_id` bigint(20) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单明细账单' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of order_order_item_billing --- ---------------------------- - --- ---------------------------- --- Table structure for order_order_strategy_mapping --- ---------------------------- -DROP TABLE IF EXISTS `order_order_strategy_mapping`; -CREATE TABLE `order_order_strategy_mapping` ( - `id` bigint(20) NOT NULL, - `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', - `order_detail_id` bigint(20) NULL DEFAULT NULL COMMENT '明细id', - `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略ID', - `strategy_type` int(11) NULL DEFAULT NULL COMMENT '策略类型(普通/优惠券ID)', - `strategy_register_id` bigint(20) NULL DEFAULT NULL COMMENT '策略注册ID', - `price_change` decimal(19, 2) NULL DEFAULT NULL COMMENT '价格变动', - `desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注信息', - `coupon_id` bigint(20) NULL DEFAULT NULL, - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单策略映射' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of order_order_strategy_mapping --- ---------------------------- - -- ---------------------------- -- Table structure for pay_ali_payment -- ---------------------------- @@ -6034,276 +5568,48 @@ CREATE TABLE `qrtz_triggers` ( INSERT INTO `qrtz_triggers` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', '1546857070483939328', 'DEFAULT', NULL, 1663741925000, 1663741920000, 5, 'ACQUIRED', 'CRON', 1657634445000, 0, NULL, 0, ''); -- ---------------------------- --- Table structure for sales_activity --- ---------------------------- -DROP TABLE IF EXISTS `sales_activity`; -CREATE TABLE `sales_activity` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'name', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `strategy_id` bigint(255) NULL DEFAULT NULL COMMENT '策略id', - `strategy_register_id` bigint(20) NOT NULL COMMENT '策略注册id', - `activity_mutual` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动互斥', - `start_time` datetime(6) NOT NULL COMMENT '有效开始时间', - `end_time` datetime(6) NOT NULL COMMENT '有效结束时间', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠活动' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_activity --- ---------------------------- -INSERT INTO `sales_activity` VALUES (1394892920481533952, '100-16', '100-16活动策略2', NULL, 1394892919403597824, '', '2021-05-18 17:43:59.000000', '2021-07-01 17:44:02.000000', 1, '2021-05-19 13:49:22.757000', 1, '2021-05-19 13:49:22.757000', 0, b'0'); -INSERT INTO `sales_activity` VALUES (1394918400265965568, '100-5', '100-5活动策略3', NULL, 1394918398827319296, '', '2021-05-18 17:43:59.000000', '2021-07-01 17:44:02.000000', 1, '2021-05-19 15:30:37.611000', 1, '2021-05-19 15:30:37.611000', 0, b'0'); -INSERT INTO `sales_activity` VALUES (1395308738893729792, '50-20', '50-20活动策略3', 1382517531398524928, 1395308573587820544, '', '2021-05-18 17:43:59.000000', '2021-07-01 17:44:02.000000', 1, '2021-05-20 17:21:41.592000', 1, '2021-05-20 17:21:41.592000', 0, b'0'); - --- ---------------------------- --- Table structure for sales_check_rule --- ---------------------------- -DROP TABLE IF EXISTS `sales_check_rule`; -CREATE TABLE `sales_check_rule` ( - `id` bigint(20) NOT NULL, - `strategy_register_id` bigint(20) NOT NULL COMMENT '关联策略注册id', - `register_type` int(6) NOT NULL COMMENT '策略类型 策略/优惠券', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则名称', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则code', - `rule_type` int(11) NOT NULL COMMENT '规则类型', - `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '对应策略id', - `addition` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '附加对象 json', - `priority` int(11) NULL DEFAULT NULL COMMENT '优先级', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '检查规则' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_check_rule +-- Table structure for report_project_info -- ---------------------------- - --- ---------------------------- --- Table structure for sales_coupon --- ---------------------------- -DROP TABLE IF EXISTS `sales_coupon`; -CREATE TABLE `sales_coupon` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `template_id` bigint(20) NULL DEFAULT NULL COMMENT '模板id', - `strategy_register_id` bigint(20) NULL DEFAULT NULL COMMENT '策略注册id', - `start_time` datetime(6) NULL DEFAULT NULL COMMENT '有效开始时间', - `end_time` datetime(6) NULL DEFAULT NULL COMMENT '有效结束时间', - `status` int(6) NOT NULL COMMENT '状态', - `obtain_time` datetime(6) NULL DEFAULT NULL COMMENT '领取时间', - `used_time` datetime(6) NULL DEFAULT NULL COMMENT '使用时间', - `order_id` bigint(20) NULL DEFAULT NULL COMMENT '所用订单Id', - `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', - `creator` bigint(20) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠券' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_coupon --- ---------------------------- - --- ---------------------------- --- Table structure for sales_coupon_template --- ---------------------------- -DROP TABLE IF EXISTS `sales_coupon_template`; -CREATE TABLE `sales_coupon_template` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', - `strategy_register_id` bigint(20) NOT NULL COMMENT '策略注册id', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `num` int(11) NOT NULL COMMENT '数量', - `channel_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道', - `activity_mutual` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动互斥', - `coupon_mutual` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '优惠券互斥', - `effective_type` int(8) NOT NULL COMMENT '有效类型', - `time_type` int(8) NULL DEFAULT NULL COMMENT '时间类型', - `effective_time` bigint(20) NULL DEFAULT NULL COMMENT '有效时间', - `start_time` datetime(6) NULL DEFAULT NULL COMMENT '开始时间', - `end_time` datetime(6) NULL DEFAULT NULL COMMENT '结束时间', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠券模板' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_coupon_template --- ---------------------------- -INSERT INTO `sales_coupon_template` VALUES (1395284918623424512, '100-33', 1395284918430486528, '100-33优惠券', 999, NULL, '', '', 0, 1, NULL, NULL, NULL, 1, '2021-05-20 15:47:02.397000', 1, '2021-05-20 15:58:10.795000', 1, b'0'); -INSERT INTO `sales_coupon_template` VALUES (1395320423364841472, '100-33', 1395320422941216768, '100-33优惠券', 988, NULL, '', '', 0, 1, NULL, NULL, NULL, 1, '2021-05-20 18:08:07.387000', 1, '2021-05-20 18:28:33.743000', 12, b'0'); - --- ---------------------------- --- Table structure for sales_match_rule --- ---------------------------- -DROP TABLE IF EXISTS `sales_match_rule`; -CREATE TABLE `sales_match_rule` ( - `id` bigint(20) NOT NULL, - `strategy_register_id` bigint(20) NOT NULL COMMENT '关联策略注册id', - `register_type` int(6) NOT NULL COMMENT '策略类型 策略/优惠券', - `feature_type` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '特征类型(sku/spu/shop)', - `feature_point` varchar(55) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '特征点', - `match_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '匹配类型', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '匹配检查' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_match_rule --- ---------------------------- - --- ---------------------------- --- Table structure for sales_strategy --- ---------------------------- -DROP TABLE IF EXISTS `sales_strategy`; -CREATE TABLE `sales_strategy` ( - `id` bigint(20) NOT NULL, - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '唯一编码', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `engine_type` int(1) NOT NULL COMMENT '引擎类型, java/js/groovy', - `target_type` int(11) NOT NULL COMMENT '目标类型', - `rule_script` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '规则脚本', - `show` int(1) NULL DEFAULT NULL COMMENT '是否展示 0不展示,1展示(default)', - `state` int(1) NOT NULL COMMENT '0 可用 1 不可用', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_strategy --- ---------------------------- -INSERT INTO `sales_strategy` VALUES (1382516141636866048, 'instantReduction', '立减策略', '立减指定的金额', 1, 1, NULL, 1, 1, 1, '2021-04-15 10:08:28.720000', 1, '2021-04-15 10:08:28.720000', 0, b'0', 10011); -INSERT INTO `sales_strategy` VALUES (1382517531398524928, 'fullReduction', '满减策略', '满减策略', 1, 1, NULL, 1, 1, 1, '2021-04-15 10:14:00.075000', 1, '2021-04-15 10:14:00.075000', 0, b'0', 10011); -INSERT INTO `sales_strategy` VALUES (1394909889247203328, 'channelCheck', '渠道检查', '渠道检查', 1, 2, NULL, 1, 1, 1, '2021-05-19 14:56:48.426000', 1, '2021-05-19 14:56:48.426000', 0, b'0', 10011); -INSERT INTO `sales_strategy` VALUES (1395320340615417856, 'obtainMultiple', '多张领取检查', '多张领取检查', 1, 3, '', NULL, 1, 1, '2021-05-20 18:07:47.642000', 1, '2021-05-20 18:07:47.642000', 0, b'0', 10011); - --- ---------------------------- --- Table structure for sales_strategy_check_rule --- ---------------------------- -DROP TABLE IF EXISTS `sales_strategy_check_rule`; -CREATE TABLE `sales_strategy_check_rule` ( - `id` bigint(20) NOT NULL, - `register_id` bigint(20) NULL DEFAULT NULL COMMENT '模板id', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则名称', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则code', - `type` int(11) NOT NULL COMMENT '类型', - `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数 json', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略规则检查' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_strategy_check_rule --- ---------------------------- - --- ---------------------------- --- Table structure for sales_strategy_config --- ---------------------------- -DROP TABLE IF EXISTS `sales_strategy_config`; -CREATE TABLE `sales_strategy_config` ( - `id` bigint(20) NOT NULL, - `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略id', - `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数类型', - `key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '方法参数名', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数名称', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略参数定义' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_strategy_config --- ---------------------------- -INSERT INTO `sales_strategy_config` VALUES (1382517531788595199, 1382516141636866048, 'BigDecimal', 'amount', '立减金额', '立减金额', 1, '2021-04-15 10:08:28.873000', 1, '2021-04-15 10:08:28.873000', 0, b'0'); -INSERT INTO `sales_strategy_config` VALUES (1382517531788595200, 1382517531398524928, 'BigDecimal', 'satisfy', '满多少', '配置满多少的字段', 1, '2021-04-15 10:14:00.169000', 1, '2021-04-15 10:14:00.169000', 0, b'0'); -INSERT INTO `sales_strategy_config` VALUES (1382517531788595201, 1382517531398524928, 'BigDecimal', 'minus', '减多少', '配置减多少的字段', 1, '2021-04-15 10:14:00.169000', 1, '2021-04-15 10:14:00.169000', 0, b'0'); - --- ---------------------------- --- Table structure for sales_strategy_config_value --- ---------------------------- -DROP TABLE IF EXISTS `sales_strategy_config_value`; -CREATE TABLE `sales_strategy_config_value` ( - `id` bigint(20) NOT NULL, - `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略id', - `strategy_register_id` bigint(20) NULL DEFAULT NULL COMMENT '策略注册id', - `strategy_config_id` bigint(20) NULL DEFAULT NULL COMMENT '策略定义id', - `key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '策略参数key', - `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数值', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, +DROP TABLE IF EXISTS `report_project_info`; +CREATE TABLE `report_project_info` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目名称', + `state` int(11) NULL DEFAULT NULL COMMENT '发布状态', + `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '报表内容', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建者ID', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修者ID', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '乐观锁', + `deleted` bit(1) NOT NULL COMMENT '删除标志', + `index_image` bigint(20) NULL DEFAULT NULL COMMENT '预览图片id', + `edit` bit(1) NULL DEFAULT NULL COMMENT '是否在编辑中', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略配置参数' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义大屏信息' ROW_FORMAT = DYNAMIC; -- ---------------------------- --- Records of sales_strategy_config_value +-- Records of report_project_info -- ---------------------------- -- ---------------------------- --- Table structure for sales_strategy_register +-- Table structure for report_project_info_publish -- ---------------------------- -DROP TABLE IF EXISTS `sales_strategy_register`; -CREATE TABLE `sales_strategy_register` ( - `id` bigint(20) NOT NULL, - `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略id', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '策略注册名称', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `strategy_type` int(11) NULL DEFAULT NULL COMMENT '策略类型(1活动/2优惠券)', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, +DROP TABLE IF EXISTS `report_project_info_publish`; +CREATE TABLE `report_project_info_publish` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '报表内容', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建者ID', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修者ID', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '乐观锁', + `deleted` bit(1) NOT NULL COMMENT '删除标志', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略注册' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义大屏发布信息' ROW_FORMAT = DYNAMIC; -- ---------------------------- --- Records of sales_strategy_register +-- Records of report_project_info_publish -- ---------------------------- -- ---------------------------- diff --git a/_doc/ChangeLog.md b/_doc/ChangeLog.md index 61a633076bd61ec0da0a8e9fe796aae5d36cdc1b..ba22d0791ef938634c65c1e31e63711d3a401075 100644 --- a/_doc/ChangeLog.md +++ b/_doc/ChangeLog.md @@ -1,4 +1,24 @@ # CHANGELOG +## [v1.2.2] 一号线-创新谷 +**项目主要更新** +- 增加Minio文件上传方式 +- 集成GoVIew可视化大屏功能 + +**可视化大屏** +- 登录接口对接 +- 编辑保存对接 +- 列表接口对接 +- 复制功能 +- 修改基础信息功能 + +**Vue3更新** +- 新增邮件发送演示 +- 新增数据版本信息展示 + +**Vue2更新** +- 新增数据版本信息展示 + + ## [v1.2.1] 一号线-创新谷 **项目主要更新** - 数据字段翻译功能支持字典翻译 diff --git a/_doc/Task.md b/_doc/Task.md new file mode 100644 index 0000000000000000000000000000000000000000..71bb1fac8dc9b652a9c65869d72feeb3277df937 --- /dev/null +++ b/_doc/Task.md @@ -0,0 +1 @@ +[ ] diff --git a/_license/go-view/LICENSE2 b/_license/go-view/LICENSE2 new file mode 100644 index 0000000000000000000000000000000000000000..6f55195df70a015a9ca72ed2c0631315025810ff --- /dev/null +++ b/_license/go-view/LICENSE2 @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2021 奔跑的面条 + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/bootx-common-core/pom.xml b/bootx-common-core/pom.xml index 7557d16b1b722506ff23dd9757427520601edd9d..7371a94f899cf46ca461bdbe24c51556fc7582d2 100644 --- a/bootx-common-core/pom.xml +++ b/bootx-common-core/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/Translate.java b/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/Translate.java index ea6b356cb37dc0813717fd75fe0fc1c98db21415..eebb68323b30d159f1b8bc2d7cec89c685c6718e 100644 --- a/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/Translate.java +++ b/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/Translate.java @@ -14,7 +14,6 @@ import java.lang.annotation.Target; @Retention(RetentionPolicy.RUNTIME) public @interface Translate { - /** * 翻译类型 */ diff --git a/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/TranslationResult.java b/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/TranslationResult.java index ba7a3030dde5f89355fd00704c0ecdc560035113..4c971712a4d6e558876fa75b36402766570c63b4 100644 --- a/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/TranslationResult.java +++ b/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/TranslationResult.java @@ -35,7 +35,7 @@ public @interface TranslationResult { */ MAP, /** - * 不对目标对象的类型进行修改, 只对字典值进行翻译, 但遇到注解标注的字段出现字典项code与name类型不一致, 会抛出异常 + * 不对目标对象的类型进行修改, 只对字典值进行翻译, 但遇到注解标注的字段出现字典项code与name类型不一致, 会进行忽略 */ OBJECT } diff --git a/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/actable/Unique.java b/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/actable/Unique.java index 105e91aa254780a66d40a683081fe48a7eecba73..c632a52b38a6706bc4fe4cdf172e7ac3dc94fe40 100644 --- a/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/actable/Unique.java +++ b/bootx-common-core/src/main/java/cn/bootx/common/core/annotation/actable/Unique.java @@ -15,7 +15,7 @@ public @interface Unique { /** * 唯一约束的名字,不设置默认为{actable_uni_当前标记字段名@Column的name}

- * 如果设置了名字例如union_name,系统会默认在名字前加actable_uni_前缀,也就是actable_uni_union_name + * 如果设置了名字例如union_name,系统会默认在名字前加auni_前缀,也就是uni_union_name */ String value() default ""; diff --git a/bootx-common-core/src/main/java/cn/bootx/common/core/rest/param/PageParam.java b/bootx-common-core/src/main/java/cn/bootx/common/core/rest/param/PageParam.java index 83090164dcf37df2a4e1fd927fd227275d9e59f6..f62a451fc8d269f72bdd0562b135d1f8bbd372e4 100644 --- a/bootx-common-core/src/main/java/cn/bootx/common/core/rest/param/PageParam.java +++ b/bootx-common-core/src/main/java/cn/bootx/common/core/rest/param/PageParam.java @@ -2,7 +2,9 @@ package cn.bootx.common.core.rest.param; import cn.hutool.core.util.PageUtil; import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.NoArgsConstructor; import lombok.Setter; import java.io.Serializable; @@ -13,6 +15,8 @@ import java.io.Serializable; @Getter @Setter @Schema(title = "分页查询参数") +@NoArgsConstructor +@AllArgsConstructor public class PageParam implements Serializable { private static final long serialVersionUID = 7489222986629492487L; diff --git a/bootx-common-starters/common-starter-audit-log/pom.xml b/bootx-common-starters/common-starter-audit-log/pom.xml index 181afaec2ecc6668c3401d5c5231790030e9acea..4ffe400f87bbe6733bb872984c3012fdcf8d3f85 100644 --- a/bootx-common-starters/common-starter-audit-log/pom.xml +++ b/bootx-common-starters/common-starter-audit-log/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/core/db/dao/DataVersionLogDbManager.java b/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/core/db/dao/DataVersionLogDbManager.java index 77416daffd4f2353772f0186b7930f0d72e8ad92..e505c4c01b3799c5cbdd90a83923bf059c443620 100644 --- a/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/core/db/dao/DataVersionLogDbManager.java +++ b/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/core/db/dao/DataVersionLogDbManager.java @@ -43,7 +43,9 @@ public class DataVersionLogDbManager extends BaseManager page(PageParam pageParam, DataVersionLogParam param) { - DataVersionLogMongo dataVersionLogMongo = new DataVersionLogMongo().setDataId(param.getDataId()) + DataVersionLogMongo dataVersionLogMongo = new DataVersionLogMongo() + .setDataId(param.getDataId()) + .setVersion(param.getVersion()) + .setTableName(param.getTableName()) .setDataName(param.getDataName()); // 查询条件 ExampleMatcher matching = ExampleMatcher.matching() diff --git a/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/handler/DataVersionRecordHandler.java b/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/handler/DataVersionRecordHandler.java index 59cc2e6e38c85d49802f330afcc2a6faba9e263b..3588158423876d5321c64d572cb188e48dc1db8f 100644 --- a/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/handler/DataVersionRecordHandler.java +++ b/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/handler/DataVersionRecordHandler.java @@ -42,15 +42,15 @@ public class DataVersionRecordHandler extends DataChangeRecorderInnerInterceptor Map updateRecord = new HashMap<>(); // 遍历原始数据的所有字段 for (DataColumnChangeResult originalColumn : originalColumns) { - System.out.println(originalColumn.getColumnName()+":"+originalColumn.getOriginalValue()); dataRecord.put(originalColumn.getColumnName(),originalColumn.getOriginalValue()); } // 用新数据进行替换 List updatedColumns = Optional.ofNullable(changedRecord.getUpdatedColumns()) .orElse(new ArrayList<>(0)); for (DataColumnChangeResult updatedColumn : updatedColumns) { + // 更新记录列表记录变更前的数据 + updateRecord.put(updatedColumn.getColumnName(),dataRecord.get(updatedColumn.getColumnName())); dataRecord.put(updatedColumn.getColumnName(),updatedColumn.getUpdateValue()); - updateRecord.put(updatedColumn.getColumnName(),updatedColumn.getUpdateValue()); } Object pkColumnVal = changedRecord.getPkColumnVal(); // insert手动获取下主键值 diff --git a/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/param/DataVersionLogParam.java b/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/param/DataVersionLogParam.java index 16788e061b4b6f09ed0165b88567b1ac71731184..7af330cb01fcc17b18626fb2916ebc838729bec5 100644 --- a/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/param/DataVersionLogParam.java +++ b/bootx-common-starters/common-starter-audit-log/src/main/java/cn/bootx/starter/audit/log/param/DataVersionLogParam.java @@ -27,4 +27,7 @@ public class DataVersionLogParam { @Schema(description = "本次变动的数据内容") private Object changeContent; + + @Schema(description = "版本") + private Integer version; } diff --git a/bootx-common-starters/common-starter-auth/pom.xml b/bootx-common-starters/common-starter-auth/pom.xml index f6f801dbe1c060246ca579bcac55279a97f8155f..3695d04e2ab277002902a60fd92a7b8ea2275f62 100644 --- a/bootx-common-starters/common-starter-auth/pom.xml +++ b/bootx-common-starters/common-starter-auth/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-common-starters - 1.2.1 + 1.2.2 4.0.0 common-starter-auth diff --git a/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/authentication/AbstractAuthentication.java b/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/authentication/AbstractAuthentication.java index e8d13766dd2c4637be38e31903131652321068ff..bac16b7e6edcaef2fd9d69392bcb2524deb4dcf6 100644 --- a/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/authentication/AbstractAuthentication.java +++ b/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/authentication/AbstractAuthentication.java @@ -23,7 +23,7 @@ public interface AbstractAuthentication { String getLoginType(); /** - * openId类型是否匹配 + * 登录类型是否匹配 */ default boolean adaptation(String loginType){ return Objects.equals(getLoginType(),loginType); diff --git a/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/code/AuthLoginTypeCode.java b/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/code/AuthLoginTypeCode.java index b0c5793125170cff1694facaa81d0f9058534534..6183002608439c94b0eedfab41885f5df05ab7a2 100644 --- a/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/code/AuthLoginTypeCode.java +++ b/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/code/AuthLoginTypeCode.java @@ -1,9 +1,9 @@ package cn.bootx.starter.auth.code; -/** +/** * 认证录方式 -* @author xxm -* @date 2021/8/2 +* @author xxm +* @date 2021/8/2 */ public interface AuthLoginTypeCode { @@ -19,9 +19,13 @@ public interface AuthLoginTypeCode { int SUCCESS = 2000; - /** 账号密码登录 */ + /* 登录方式 */ + /** 账号密码登录(普通) */ String PASSWORD = "password"; + /** 账号密码登录(GoView) */ + String PASSWORD_GO_VIEW = "passwordGoView"; + /** 手机号登录 */ String PHONE = "phone"; @@ -39,6 +43,9 @@ public interface AuthLoginTypeCode { /** 码云 */ String GITEE = "gitee"; + /** 飞书 */ + String FEISHU = "feishu"; + /** 钉钉登录 */ String DING_TALK = "dingTalk"; diff --git a/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/endpoint/TokenService.java b/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/endpoint/TokenService.java index bf5264ca05468419abe11d5673caf82cc6919ba2..b26eef91f666dad61c62c888c3c96b76b5ed76a1 100644 --- a/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/endpoint/TokenService.java +++ b/bootx-common-starters/common-starter-auth/src/main/java/cn/bootx/starter/auth/endpoint/TokenService.java @@ -140,12 +140,12 @@ public class TokenService { * 认证 */ private @NotNull AuthInfoResult authentication(LoginAuthContext context){ - String clientCode = context.getAuthLoginType().getCode(); + String loginType = context.getAuthLoginType().getCode(); return abstractAuthentications.stream() - .filter(o->o.adaptation(clientCode)) + .filter(o->o.adaptation(loginType)) .findFirst() .map(o->o.authentication(context)) - .orElseThrow(() -> new LoginFailureException("未找到对应的终端认证器")); + .orElseThrow(() -> new LoginFailureException("未找到对应的登录认证器")); } /** diff --git a/bootx-common-starters/common-starter-code-gen/pom.xml b/bootx-common-starters/common-starter-code-gen/pom.xml index 78ec0b36e75952911b635542e5cd4cbbd432ca68..384673250da32874d82e4a83d6fe49fa21e0f0e2 100644 --- a/bootx-common-starters/common-starter-code-gen/pom.xml +++ b/bootx-common-starters/common-starter-code-gen/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-common-starters - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-common-starters/common-starter-code-gen/src/main/resources/codegen/template/vue2/list.vue.vm b/bootx-common-starters/common-starter-code-gen/src/main/resources/codegen/template/vue2/list.vue.vm index 370da787747106a449d8606bf3c8d79ebe119587..5039c8623df888fdb14e2a3ea7a3ae1635ba255c 100644 --- a/bootx-common-starters/common-starter-code-gen/src/main/resources/codegen/template/vue2/list.vue.vm +++ b/bootx-common-starters/common-starter-code-gen/src/main/resources/codegen/template/vue2/list.vue.vm @@ -21,12 +21,12 @@ :loading="loading" :data="tableData" > - + #foreach ($column in $columns) - + #end - - + + - + bootx-common-starters cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-common-starters/common-starter-dingtalk/pom.xml b/bootx-common-starters/common-starter-dingtalk/pom.xml index f2f269682d001672092205e8fd95ad04f89ce68e..292e91aadeca0ca80c1607fb5756e72102b47d47 100644 --- a/bootx-common-starters/common-starter-dingtalk/pom.xml +++ b/bootx-common-starters/common-starter-dingtalk/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-common-starters/common-starter-file/pom.xml b/bootx-common-starters/common-starter-file/pom.xml index 1fe768efe3046ed18dc6f02f49523e1bc027b5b9..ed491ac049f09116e63addf96049087f337f8e3d 100644 --- a/bootx-common-starters/common-starter-file/pom.xml +++ b/bootx-common-starters/common-starter-file/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 @@ -30,5 +30,11 @@ common-mybatis-plus true + + + io.minio + minio + ${minio.version} + diff --git a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/configuration/FileUploadProperties.java b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/configuration/FileUploadProperties.java index eb2c33b9d680d0d86fb652f75923e8c5a7648c9c..d37dff3814194790d8a147a7f6080d7d5bc44e56 100644 --- a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/configuration/FileUploadProperties.java +++ b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/configuration/FileUploadProperties.java @@ -31,6 +31,9 @@ public class FileUploadProperties { /** mongo存储配置 */ private Mongo mongo = new Mongo(); + /** minio存储配置 */ + private Minio minio = new Minio(); + /** * 本地存储 */ @@ -50,4 +53,22 @@ public class FileUploadProperties { /** 存储桶 */ private String bucket = "fs"; } + + /** + * Minio存储配置 + */ + @Getter + @Setter + public static class Minio{ + /** 端点地址 */ + private String endpoint; + /** 区域 */ + private String region; + /** 访问 key */ + private String accessKey; + /** 访问 Secret */ + private String accessSecret; + /** 存储桶 需要至少三位 */ + private String bucket = "bootx"; + } } diff --git a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/UploadService.java b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/UploadService.java index 832a2c9d6ecd5239017d6b22b02a4e8946827e84..19e68f0bd8ca53142f75ee0c7cea468d30f2bf60 100644 --- a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/UploadService.java +++ b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/UploadService.java @@ -31,4 +31,9 @@ public interface UploadService { * 下载文件 */ InputStream download(UpdateFileInfo updateFileInfo); + + /** + * 删除文件 + */ + void delete(UpdateFileInfo updateFileInfo ); } diff --git a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/LocalUploadService.java b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/LocalUploadService.java index 44e6979a9282f94ad4394445162d2990738b72dd..53c4a53485f998f8b35d1037e7f936c142bdc1db 100644 --- a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/LocalUploadService.java +++ b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/LocalUploadService.java @@ -25,10 +25,10 @@ import java.io.InputStream; import java.nio.file.Files; import java.util.Optional; -/** +/** * 上传文件本地存储 -* @author xxm -* @date 2022/1/12 +* @author xxm +* @date 2022/1/12 */ @Slf4j @Service @@ -89,4 +89,13 @@ public class LocalUploadService implements UploadService { } return Files.newInputStream(file.toPath()); } + + /** + * 删除文件 + */ + @Override + public void delete(UpdateFileInfo updateFileInfo) { + String storePath = fileUploadProperties.getLocal().getLocalPath() + updateFileInfo.getFilePath(); + FileUtil.del(storePath); + } } diff --git a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MinioUploadService.java b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MinioUploadService.java index c386d354c546273488ee06f1adb4b6816869110d..59aa06ba790f3c782772f4c3dfc681f2a94754dd 100644 --- a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MinioUploadService.java +++ b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MinioUploadService.java @@ -1,16 +1,128 @@ package cn.bootx.starter.file.service.impl; +import cn.bootx.starter.file.code.FileUploadTypeEnum; +import cn.bootx.starter.file.configuration.FileUploadProperties; +import cn.bootx.starter.file.entity.UpdateFileInfo; +import cn.bootx.starter.file.entity.UploadFileContext; +import cn.bootx.starter.file.service.UploadService; +import cn.hutool.core.io.IoUtil; +import io.minio.*; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; +import org.springframework.http.HttpHeaders; import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; -/** -* minio方式存储文件 -* @author xxm -* @date 2022/1/12 -*/ +import javax.servlet.ServletOutputStream; +import javax.servlet.http.HttpServletResponse; +import java.io.InputStream; +import java.util.Objects; + +/** + * minio方式存储文件 + * @author xxm + * @date 2022/1/12 + */ @Slf4j @Service @RequiredArgsConstructor -public class MinioUploadService { +public class MinioUploadService implements UploadService { + private final FileUploadProperties fileUploadProperties; + private MinioClient client; + + /** + * 判断启用 + */ + @Override + public boolean enable(FileUploadTypeEnum type) { + boolean b = type == FileUploadTypeEnum.MINIO; + if (b){ + this.doInit(); + } + return b; + } + + /** + * 上传文件 + */ + @SneakyThrows + @Override + public UpdateFileInfo upload(MultipartFile file, UploadFileContext context) { + FileUploadProperties.Minio minio = fileUploadProperties.getMinio(); + PutObjectArgs putObjectArgs = PutObjectArgs.builder() + .bucket(minio.getBucket()) // bucket 必须传递 + .contentType(file.getContentType()) + .object(context.getFileId()+"."+context.getFileSuffix()) + .stream(file.getInputStream(), file.getSize(), -1) // 文件内容 + .build(); + // 执行上传 + client.putObject(putObjectArgs); + return new UpdateFileInfo() + .setExternalStorageId(putObjectArgs.object()) + .setFileSize(file.getSize()); + } + + /** + * 预览文件 + */ + @SneakyThrows + @Override + public void preview(UpdateFileInfo updateFileInfo, HttpServletResponse response) { + FileUploadProperties.Minio minio = fileUploadProperties.getMinio(); + String storageId = updateFileInfo.getExternalStorageId(); + GetObjectResponse inputStream = client.getObject(GetObjectArgs.builder() + .bucket(minio.getBucket()) + .object(storageId) + .build()); + //获取响应输出流 + ServletOutputStream os = response.getOutputStream(); + IoUtil.copy(inputStream, os); + response.addHeader(HttpHeaders.CONTENT_DISPOSITION, updateFileInfo.getFileType()); + IoUtil.close(inputStream); + IoUtil.close(os); + } + + /** + * 下载文件 + */ + @SneakyThrows + @Override + public InputStream download(UpdateFileInfo updateFileInfo) { + FileUploadProperties.Minio minio = fileUploadProperties.getMinio(); + String storageId = updateFileInfo.getExternalStorageId(); + return client.getObject(GetObjectArgs.builder() + .bucket(minio.getBucket()) // bucket 必须传递 + .object(storageId) // 相对路径作为 key + .build()); + } + + /** + * 删除文件 + */ + @SneakyThrows + @Override + public void delete(UpdateFileInfo updateFileInfo) { + FileUploadProperties.Minio minio = fileUploadProperties.getMinio(); + client.removeObject(RemoveObjectArgs.builder() + .bucket(minio.getBucket()) // bucket 必须传递 + .object(updateFileInfo.getExternalStorageId()) // 相对路径作为 key + .build()); + } + + /** + * 初始化 + */ + protected void doInit() { + if (Objects.nonNull(client)){ + return; + } + FileUploadProperties.Minio minio = fileUploadProperties.getMinio(); + // 初始化客户端 + client = MinioClient.builder() + .endpoint(minio.getEndpoint()) // Endpoint URL + .region(minio.getRegion()) // Region + .credentials(minio.getAccessKey(), minio.getAccessSecret()) // 认证密钥 + .build(); + } } diff --git a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MongoUploadService.java b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MongoUploadService.java index 965056e421d27d8ab4d30edb808ad158086d5b10..6715456cfb3783c40f6fc7f1018bb53a4e50ed32 100644 --- a/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MongoUploadService.java +++ b/bootx-common-starters/common-starter-file/src/main/java/cn/bootx/starter/file/service/impl/MongoUploadService.java @@ -82,4 +82,14 @@ public class MongoUploadService implements UploadService { GridFsResource resource = gridFsTemplate.getResource(gridFSFile); return resource.getInputStream(); } + + /** + * 删除文件 + */ + @Override + public void delete(UpdateFileInfo updateFileInfo) { + Criteria criteria = Criteria.where("_id").is(new ObjectId(updateFileInfo.getExternalStorageId())); + Query query = new Query(criteria); + gridFsTemplate.delete(query); + } } diff --git a/bootx-common-starters/common-starter-flowable/pom.xml b/bootx-common-starters/common-starter-flowable/pom.xml index 560d313c73d131be965ce71f52a7bfc65896727c..333084d45e6f9c3e60269507d7360c17648ddedb 100644 --- a/bootx-common-starters/common-starter-flowable/pom.xml +++ b/bootx-common-starters/common-starter-flowable/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-common-starters/common-starter-monitor/pom.xml b/bootx-common-starters/common-starter-monitor/pom.xml index 24be62b330e247ff4fb8a8f876168b180205348e..6738e0bedbf0a33dd2003d800fff669ba32b1d95 100644 --- a/bootx-common-starters/common-starter-monitor/pom.xml +++ b/bootx-common-starters/common-starter-monitor/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 jar diff --git a/bootx-common-starters/common-starter-quartz/pom.xml b/bootx-common-starters/common-starter-quartz/pom.xml index f040915364fb4a02259162f9ce19ad461453f2dc..9485f1d175bd49de6e3f20054fbdbd1da7edac9a 100644 --- a/bootx-common-starters/common-starter-quartz/pom.xml +++ b/bootx-common-starters/common-starter-quartz/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-common-starters - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-common-starters/common-starter-wechat/pom.xml b/bootx-common-starters/common-starter-wechat/pom.xml index e480c8819ea51dd0ceb5dd53630d4ccf3a845bac..dd9bdab6eff546925110bb1e3c24da9f1d24896c 100644 --- a/bootx-common-starters/common-starter-wechat/pom.xml +++ b/bootx-common-starters/common-starter-wechat/pom.xml @@ -5,7 +5,7 @@ bootx-common-starters cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-common-starters/common-starter-wecom/pom.xml b/bootx-common-starters/common-starter-wecom/pom.xml index 0020579d3b7869f8cb5c6f664b88e710a766b971..e07e5def01047b8ddbddbc468e2c32f3192b9393 100644 --- a/bootx-common-starters/common-starter-wecom/pom.xml +++ b/bootx-common-starters/common-starter-wecom/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-common-starters - 1.2.1 + 1.2.2 4.0.0 jar diff --git a/bootx-common-starters/pom.xml b/bootx-common-starters/pom.xml index 263a44cb38c6c1699078a276cf1c0eb4edf28718..8bcfb857a18d16c32ed3b541ec17ee3fb603bace 100644 --- a/bootx-common-starters/pom.xml +++ b/bootx-common-starters/pom.xml @@ -5,7 +5,7 @@ bootx-platform cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-actable/pom.xml b/bootx-commons/common-actable/pom.xml index 90146acfe8b05ae30563b524cb959ee6d07c3ce4..47d3cf2738d70ddf93606dc6db644c76db89d39b 100644 --- a/bootx-commons/common-actable/pom.xml +++ b/bootx-commons/common-actable/pom.xml @@ -6,7 +6,7 @@ cn.bootx.platform bootx-commons - 1.2.1 + 1.2.2 common-actable diff --git a/bootx-commons/common-cache/pom.xml b/bootx-commons/common-cache/pom.xml index 1ea1b9575d8c4f7bb699c6cbe08a8809b567219f..47864b3d32b9e4e5c70e7924f42890c16acb0491 100644 --- a/bootx-commons/common-cache/pom.xml +++ b/bootx-commons/common-cache/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-data-translate/pom.xml b/bootx-commons/common-data-translate/pom.xml index 9db25112cbd9dd985bb2cba89c119be1d8ff9141..08ce3b2041ab1bbc05f35fe70b3ccf2edb9cb2ee 100644 --- a/bootx-commons/common-data-translate/pom.xml +++ b/bootx-commons/common-data-translate/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-exception-handler/pom.xml b/bootx-commons/common-exception-handler/pom.xml index b8289d65b8e7f8ce9eb130c749e6a5d40dc36727..4921b27beae8e1563682b20cc5f00dfa1649570a 100644 --- a/bootx-commons/common-exception-handler/pom.xml +++ b/bootx-commons/common-exception-handler/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 common-exception-handler diff --git a/bootx-commons/common-header-holder/pom.xml b/bootx-commons/common-header-holder/pom.xml index e52e731b7bc6976124162b5d4c48e2013530b5f2..596e1f231c1f7201fe474545b0eea87ec3bf52f7 100644 --- a/bootx-commons/common-header-holder/pom.xml +++ b/bootx-commons/common-header-holder/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-idempotency/pom.xml b/bootx-commons/common-idempotency/pom.xml index 299b8ced86724d5a7f605b0c49327701acba55a7..2bd3af37a1f45ee9278f638adfc865172c7536ed 100644 --- a/bootx-commons/common-idempotency/pom.xml +++ b/bootx-commons/common-idempotency/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-jackson/pom.xml b/bootx-commons/common-jackson/pom.xml index 700ff61c1e92b6083cd17c0d419c0193e7244a50..620fa92cec889155a48ec6b9194e6b561f94c922 100644 --- a/bootx-commons/common-jackson/pom.xml +++ b/bootx-commons/common-jackson/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-lock/pom.xml b/bootx-commons/common-lock/pom.xml index 84e6cdbb3b37c0445b67b43fa13ed0baf4884aea..5f0f53f541167a36ff05c2b66ff5b55a50c89088 100644 --- a/bootx-commons/common-lock/pom.xml +++ b/bootx-commons/common-lock/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-log/pom.xml b/bootx-commons/common-log/pom.xml index 475b7e66c560bd2cb7ff0cb693fef78718b9b5e7..8d583d90e5adb98502f10a3455891cd469bd5ce3 100644 --- a/bootx-commons/common-log/pom.xml +++ b/bootx-commons/common-log/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-mongo/pom.xml b/bootx-commons/common-mongo/pom.xml index 3d7a6a491b265a19aeb22e2ca54c06b43e94aca4..85ed2ba60de8377c24941cd1cf1daeb022beda64 100644 --- a/bootx-commons/common-mongo/pom.xml +++ b/bootx-commons/common-mongo/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-commons - 1.2.1 + 1.2.2 4.0.0 common-mongo diff --git a/bootx-commons/common-mqtt/pom.xml b/bootx-commons/common-mqtt/pom.xml index 32d203eafe07ce620d5015878c28084acba596b6..17f7b2c401c18f957ac8f674e7214dfc88a62bb8 100644 --- a/bootx-commons/common-mqtt/pom.xml +++ b/bootx-commons/common-mqtt/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-mybatis-plus/pom.xml b/bootx-commons/common-mybatis-plus/pom.xml index 37c8deeb43aa1017072b4be0a3b26f253ac1f261..6d5bbce304e843e7ae50233e481a1d97732673a0 100644 --- a/bootx-commons/common-mybatis-plus/pom.xml +++ b/bootx-commons/common-mybatis-plus/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/base/MpCreateEntity.java b/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/base/MpCreateEntity.java index e78d899e1b41a293ca7f89665eebe6a3a8da5b84..523943711892e5bead7ab1b6373cf0574e4959c1 100644 --- a/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/base/MpCreateEntity.java +++ b/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/base/MpCreateEntity.java @@ -20,7 +20,7 @@ import java.time.LocalDateTime; public abstract class MpCreateEntity extends MpIdEntity{ /** 创建者ID */ - @Column(comment = "创建者ID",order = Integer.MAX_VALUE-600) + @Column(comment = "创建者ID",length = 20,order = Integer.MAX_VALUE-600) @TableField(fill = FieldFill.INSERT) private Long creator; diff --git a/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/base/MpDelEntity.java b/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/base/MpDelEntity.java index 08f4c256ed27bc5e3f5d55169f22d214bfd6f4e0..7f7935c076961f89f539b40d835855e228229f07 100644 --- a/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/base/MpDelEntity.java +++ b/bootx-commons/common-mybatis-plus/src/main/java/cn/bootx/common/mybatisplus/base/MpDelEntity.java @@ -21,7 +21,7 @@ import java.time.LocalDateTime; public abstract class MpDelEntity extends MpCreateEntity{ /** 最后修者ID */ - @Column(comment = "最后修者ID",order = Integer.MAX_VALUE-400) + @Column(comment = "最后修者ID",length = 20,order = Integer.MAX_VALUE-400) @TableField(fill = FieldFill.INSERT_UPDATE) private Long lastModifier; diff --git a/bootx-commons/common-rabbitmq/pom.xml b/bootx-commons/common-rabbitmq/pom.xml index b4cf8618a4e02debcf24ce344c2eb373ef3873be..83e007a735e3af692a2c31ca925ea111b9d330c6 100644 --- a/bootx-commons/common-rabbitmq/pom.xml +++ b/bootx-commons/common-rabbitmq/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-redis-client/pom.xml b/bootx-commons/common-redis-client/pom.xml index 5301b329ead67f54bbd81fbc9429e8a83dbe2722..26aea755800d59ced98b248add84e2e8f31ee7e1 100644 --- a/bootx-commons/common-redis-client/pom.xml +++ b/bootx-commons/common-redis-client/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-sequence/pom.xml b/bootx-commons/common-sequence/pom.xml index ed5e4dad3f9a7a304ec0d240f0e48dde2ef70ef7..14f9fbe41fb2be21128cb6edcfaceeb833e3d67f 100644 --- a/bootx-commons/common-sequence/pom.xml +++ b/bootx-commons/common-sequence/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-spring/pom.xml b/bootx-commons/common-spring/pom.xml index 2eca10bac5b3f33b72414d11d38ce8871bc29992..3675aaf3f063541efc3a0e5054fdc86f9c138a23 100644 --- a/bootx-commons/common-spring/pom.xml +++ b/bootx-commons/common-spring/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-super-query/pom.xml b/bootx-commons/common-super-query/pom.xml index 539858101d999cea1865dba70e05e618f464063e..6457f0e94301a47ed6a61800785ee7da986bc4e8 100644 --- a/bootx-commons/common-super-query/pom.xml +++ b/bootx-commons/common-super-query/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-swagger/pom.xml b/bootx-commons/common-swagger/pom.xml index ea7de927760fc0485365befde24a353daaa89e72..7785e8fc40eb5292f265e25fd41160db9614c0f8 100644 --- a/bootx-commons/common-swagger/pom.xml +++ b/bootx-commons/common-swagger/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-websocket/pom.xml b/bootx-commons/common-websocket/pom.xml index 6a55f377817d76b14c8a23216b9328e2336ec806..9b3dce07c7675f1b5e84894c712195ef2fbd1199 100644 --- a/bootx-commons/common-websocket/pom.xml +++ b/bootx-commons/common-websocket/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/common-xxl-job/pom.xml b/bootx-commons/common-xxl-job/pom.xml index 3cea1d3bf453f1666ab3e5c2cb5423249901ed4d..705c240b6daf09fba4c65f8c12347cf632cf83ec 100644 --- a/bootx-commons/common-xxl-job/pom.xml +++ b/bootx-commons/common-xxl-job/pom.xml @@ -5,7 +5,7 @@ bootx-commons cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-commons/pom.xml b/bootx-commons/pom.xml index 28d82d9f48d78880b773b6d6e7ef7047b7f440fc..f2819f552dbe0d6ccd4da3a50fb88c8289728b4a 100644 --- a/bootx-commons/pom.xml +++ b/bootx-commons/pom.xml @@ -7,7 +7,7 @@ cn.bootx.platform bootx-platform - 1.2.1 + 1.2.2 bootx-commons diff --git a/bootx-demo/pom.xml b/bootx-demo/pom.xml index c745e0b4715d3e144fe0f48516ee79c02cee8b36..73cfa2559f101b5bcb16f71d4b31eea05af08642 100644 --- a/bootx-demo/pom.xml +++ b/bootx-demo/pom.xml @@ -5,7 +5,7 @@ bootx-platform cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 @@ -37,6 +37,11 @@ service-office ${bootx-platform.version} + + cn.bootx.platform + service-visualization + ${bootx-platform.version} + cn.bootx.platform common-starter-file diff --git a/bootx-modules/module-eshop/pom.xml b/bootx-modules/module-eshop/pom.xml deleted file mode 100644 index 4ce0005a709c464af30288a621a18e0136bc7c30..0000000000000000000000000000000000000000 --- a/bootx-modules/module-eshop/pom.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - bootx-modules - cn.bootx.platform - 1.2.1 - - 4.0.0 - - module-eshop - jar - 网上商城 - - - - cn.bootx.platform - service-iam - ${bootx-platform.version} - - - - cn.bootx.platform - service-payment - ${bootx-platform.version} - - - cn.bootx.platform - service-goods - ${bootx-platform.version} - - - cn.bootx.platform - service-sales - ${bootx-platform.version} - - - cn.bootx.platform - service-order - ${bootx-platform.version} - - - - diff --git a/bootx-modules/module-eshop/src/main/resources/META-INF/spring.factories b/bootx-modules/module-eshop/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 8ca5a5a0cbdbb25cf91d95ba93fc36078a7c3854..0000000000000000000000000000000000000000 --- a/bootx-modules/module-eshop/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -## 配置自动化配置 -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - cn.bootx.models.eshop.EshopApplication diff --git a/bootx-modules/module-eshop/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/bootx-modules/module-eshop/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index fd445ebb2cca8d683cc778d86e1dd47ff64f1367..0000000000000000000000000000000000000000 --- a/bootx-modules/module-eshop/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -cn.bootx.starter.wecom.WeComAutoConfiguration \ No newline at end of file diff --git a/bootx-modules/pom.xml b/bootx-modules/pom.xml deleted file mode 100644 index 2574434a894d784f4fa2f2209c7aac8dbacd33ec..0000000000000000000000000000000000000000 --- a/bootx-modules/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - bootx-platform - cn.bootx.platform - 1.2.1 - - 4.0.0 - - bootx-modules - pom - 解决方案实现 - - - - - - - cn.bootx.platform - service-baseapi - ${bootx-platform.version} - - - - diff --git a/bootx-services/pom.xml b/bootx-services/pom.xml index e48ba4d0d5a153720cbcd1003a4c78f583b2c4e1..df39b8a790406e5ac269c0976487e07e09a0bc20 100644 --- a/bootx-services/pom.xml +++ b/bootx-services/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-platform - 1.2.1 + 1.2.2 4.0.0 @@ -20,9 +20,7 @@ service-payment service-notice service-office - - - + service-visualization diff --git a/bootx-services/service-baseapi/pom.xml b/bootx-services/service-baseapi/pom.xml index 0cbb9c9253cef1dd706d4748fe491dfecb36ef5f..ea8e1a08ea576c50818f808ced0ae703855b347f 100644 --- a/bootx-services/service-baseapi/pom.xml +++ b/bootx-services/service-baseapi/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-services - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-services/service-goods/README.md b/bootx-services/service-goods/README.md deleted file mode 100644 index 0388b7f5c91c73adef1bce79e6162329cef96f42..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# 商品中心 - -## 介绍 - -## 能力 - -## 核心概念 - -## 使用 \ No newline at end of file diff --git a/bootx-services/service-goods/pom.xml b/bootx-services/service-goods/pom.xml deleted file mode 100644 index a2f19a4fbf29c08d92bee4662f1b9e72ada6f357..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - bootx-services - cn.bootx.platform - 1.2.1 - - 4.0.0 - - service-goods - - - - - com.mysql - mysql-connector-j - runtime - - - - cn.bootx.platform - common-starter-quartz - - - diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/GoodsApplication.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/GoodsApplication.java deleted file mode 100644 index 6834bf10d9bca3df09ba63cc38cf8d1bdd98c0ae..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/GoodsApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bootx.goods; - -import org.apache.ibatis.annotations.Mapper; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.ComponentScan; - -/** -* 商品中心 -* @author xxm -* @date 2021/7/27 -*/ -@ComponentScan -@MapperScan(annotationClass = Mapper.class) -public class GoodsApplication { -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/code/CategoryCode.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/code/CategoryCode.java deleted file mode 100644 index f85bbb5b44c74d51a5650fa0b340c0a555f31799..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/code/CategoryCode.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.bootx.goods.code; - -/** -* 类目相关常量 -* @author xxm -* @date 2022/5/9 -*/ -public interface CategoryCode { - - /** 根类目 id */ - long ID_ROOT = 0L; - - // 类目层级 - /** 一级类目 */ - int LEVEL_TOP = 1; - /** 中间类目 */ - int LEVEL_MIDDLE = 2; - /** 子孙类目 */ - int LEVEL_CHILD = 3; - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/code/GoodsCode.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/code/GoodsCode.java deleted file mode 100644 index 60b1fbcca5b5407fa45aa9d83e63743fd1cd7b1a..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/code/GoodsCode.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.bootx.goods.code; - -/** -* 商品中心常量 -* @author xxm -* @date 2021/3/21 -*/ -public interface GoodsCode { - - /** - * 项目名称 - */ - String APPLICATION_NAME = "service-goods-center"; - /** - * 默认的不受限库存数 - */ - int CAPACITY_UNLIMITED = 99999999; - - /** - * 库存操作 token 过期时间,30分钟 - */ - long INVENTORY_TOKEN_EXPIRED_TIME = 30 * 60 * 1000L; -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/code/GoodsErrorCode.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/code/GoodsErrorCode.java deleted file mode 100644 index 61c630984f0a25296253dbc4c02a6a66f89b4a8c..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/code/GoodsErrorCode.java +++ /dev/null @@ -1,75 +0,0 @@ -package cn.bootx.goods.code; - -/** -* 错误码定义类 -* @author xxm -* @date 2020/11/20 -*/ -public interface GoodsErrorCode { - - - /** 类目已存在 */ - int CATEGORY_ALREADY_EXISTED = 22010; - /** 类目属性定义已存在 */ - int CATEGORY_ATTR_DEF_ALREADY_EXISTED = 22011; - /** 类目不存在 */ - int CATEGORY_NOT_EXISTED = 22012; - /** 类目属性是系统自定义商品公用属性 */ - int CATEGORY_DEF_NOT_ALLOWED = 22014; - /** 类目名称支持字母数组和下划线 */ - int CATEGORY_LEF_NAME = 22015; - /** 类目属性名称支持字母数组和下划线 */ - int CATEGORY_DEF_NAME = 22016; - /** 类目属性数据库字段同步失败 */ - int CATEGORY_DEF_DDL = 22017; - - /** 商品已存在 */ - int GOODS_ALREADY_EXISTED = 22020; - /** SKU不存在 */ - int GOODS_NOT_EXISTED = 22021; - /** 必填字段丢失 */ - int REQUIRED_FIELD_MISS = 22025; - - - /** SKU不存在 */ - int GOODS_SKU_NOT_EXISTED = 22021; - /** 商品SKU已停售 */ - int GOODS_SKU_ALREADY_OFF = 22022; - /** 商品SKU尚未开售 */ - int GOODS_SKU_NOT_ON = 22023; - - /** 库存不足 */ - int INVENTORY_INSUFFICIENT = 22030; - /** 预占的库存不足 */ - int INVENTORY_LOCK_INSUFFICIENT = 22031; - /** 未找到对应的库存 */ - int INVENTORY_NOT_FOUND = 22032; - /** 更新 sku 时状态错误 */ - int GOODS_SKU_UPDATE_STATE = 22033; - /** 更新 sku 时价格错误 */ - int GOODS_SKU_UPDATE_PRICE = 22034; - /** 更新 sku 库存信息错误 */ - int GOODS_SKU_UPDATE_STOCK = 22035; - - /** 更新 sku 库存信息错误 */ - int GOODS_SKU_TIME_FORMAT_ERROR = 22036; - - /** 推送 更新 sku时,延迟设置异常 */ - int GOODS_SKU_DELAY_STRATEGY_EXCEPTION = 22037; - - /** 根据sku价格类型创建表失败 */ - int GOODS_SKU_PRICE_TYPE_DEF_DDL = 22038; - /** 名称支持字母数字和下划线 */ - int GOODS_SKU_PRICE_TYPE_LEF_NAME = 22039; - /** sku价格类型已存在 */ - int GOODS_SKU_PRICE_TYPE_ALREADY_EXISTED = 22040; - - /** 名称只支持字母数字和下划线 */ - int COMMON_INVALID_NAME = 22060; - /** name已存在 */ - int COMMON_NAME_ALREADY_EXISTED = 22061; - /** 价格类型数据不存在 */ - int COMMON_DATA_NOT_EXIST = 22062; - /** 库存 token 已过期 */ - int TOKEN_OUT_OF_DADE = 22063; -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/BrandController.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/BrandController.java deleted file mode 100644 index 088fe9eeef7de6aec1db81073ee6bbab79ee28cd..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/BrandController.java +++ /dev/null @@ -1,66 +0,0 @@ - -package cn.bootx.goods.controller; - -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.goods.core.category.service.BrandService; -import cn.bootx.goods.dto.category.BrandDto; -import cn.bootx.goods.param.category.BrandParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 品牌 - * @author xxm - * @date 2022-05-09 - */ -@Tag(name ="品牌") -@RestController -@RequestMapping("/brand") -@RequiredArgsConstructor -public class BrandController { - private final BrandService brandService; - - @Operation( summary = "添加") - @PostMapping(value = "/add") - public ResResult add(@RequestBody BrandParam param){ - return Res.ok(brandService.add(param)); - } - - @Operation( summary = "修改") - @PostMapping(value = "/update") - public ResResult update(@RequestBody BrandParam param){ - return Res.ok(brandService.update(param)); - } - - @Operation( summary = "删除") - @DeleteMapping(value = "/delete") - public ResResult delete(Long id){ - brandService.delete(id); - return Res.ok(); - } - - @Operation( summary = "通过ID查询") - @GetMapping(value = "/findById") - public ResResult findById(Long id){ - return Res.ok(brandService.findById(id)); - } - - @Operation( summary = "查询所有") - @GetMapping(value = "/findAll") - public ResResult> findAll(){ - return Res.ok(brandService.findAll()); - } - - @Operation( summary = "分页查询") - @GetMapping(value = "/page") - public ResResult> page(PageParam pageParam, BrandParam brandParam){ - return Res.ok(brandService.page(pageParam,brandParam)); - } -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/CategoryController.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/CategoryController.java deleted file mode 100644 index ddf687babbba914935b192f209a9e40a31d96397..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/CategoryController.java +++ /dev/null @@ -1,110 +0,0 @@ -package cn.bootx.goods.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.common.core.util.ValidationUtil; -import cn.bootx.goods.core.category.service.CategoryService; -import cn.bootx.goods.dto.category.CategoryDto; -import cn.bootx.goods.dto.category.CategoryTreeNode; -import cn.bootx.goods.param.category.CategoryBrandParam; -import cn.bootx.goods.param.category.CategoryParam; -import cn.bootx.goods.param.category.CategorySpecParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * @author xxm - * @date 2020/11/19 - */ -@Tag(name ="类目管理") -@RestController -@RequestMapping("/category") -@AllArgsConstructor -public class CategoryController { - private final CategoryService categoryService; - - @Operation(summary = "增加新类目") - @PostMapping("/add") - public ResResult add(@RequestBody CategoryParam categoryParam) { - ValidationUtil.validateParam(categoryParam); - categoryService.add(categoryParam); - return Res.ok(); - } - - @Operation(summary = "更新类目") - @PostMapping("/update") - public ResResult update(@RequestBody CategoryDto categoryDto){ - return Res.ok(categoryService.update(categoryDto)); - } - - @Operation( summary = "获取所有类目") - @GetMapping("/findAll") - public ResResult> findAll() { - return Res.ok(categoryService.findAll()); - } - - @Operation(summary = "判断类目是否已经存在") - @GetMapping("/existsByName") - public ResResult existsByName(String name){ - return Res.ok(categoryService.existsByName(name)); - } - - @Operation(summary = "判断类目是否已经存在(不包含自身)") - @GetMapping("/existsByNameNotId") - public ResResult existsByName(String name,Long id){ - return Res.ok(categoryService.existsByName(name,id)); - } - - @Operation( summary = "获取类目树") - @GetMapping("/findTree") - public ResResult> findTree() { - return Res.ok(categoryService.findTree()); - } - - @Operation( summary = "通过 id 获取指定类目") - @GetMapping("/findById") - public ResResult findById(@Parameter(description = "类目 id", required = true) - @RequestParam(value = "id") Long id) { - return Res.ok(categoryService.findById(id)); - } - - @Operation( summary = "通过 id 删除类目") - @DeleteMapping("/delete") - public ResResult delete(Long id) { - categoryService.delete(id); - return Res.ok(); - } - - @Operation(summary = "根据类目id查询关联的绑定品牌id集合") - @GetMapping("/findBindBrandIds") - public ResResult> findBindBrandIds(Long categoryId){ - return Res.ok(categoryService.findBindBrandIds(categoryId)); - } - - @Operation(summary = "绑定品牌") - @PostMapping("/bindBrand") - public ResResult bindBrand(@RequestBody CategoryBrandParam param){ - ValidationUtil.validateParam(param); - categoryService.bindBrand(param); - return Res.ok(); - } - - @Operation(summary = "根据类目id查询关联的绑定规格id集合") - @GetMapping("/findBindSpecIds") - public ResResult> findBindSpecIds(Long categoryId){ - return Res.ok(categoryService.findBindSpecIds(categoryId)); - } - - @Operation(summary = "绑定规格") - @PostMapping("/bindSpec") - public ResResult bindSpec(@RequestBody CategorySpecParam param){ - ValidationUtil.validateParam(param); - categoryService.bindSpec(param); - return Res.ok(); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/CategoryParameterController.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/CategoryParameterController.java deleted file mode 100644 index 1d99d4e9034a76fc51ed537e881ff77ef8aced94..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/CategoryParameterController.java +++ /dev/null @@ -1,83 +0,0 @@ -package cn.bootx.goods.controller; - -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.core.util.ValidationUtil; -import cn.bootx.common.core.validation.ValidationGroup; -import cn.bootx.goods.core.category.service.CategoryParameterService; -import cn.bootx.goods.dto.category.CategoryParameterDto; -import cn.bootx.goods.param.category.CategoryParameterParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 类目参数 - * @author xxm - * @date 2022-05-09 - */ -@Tag(name ="类目参数") -@RestController -@RequestMapping("/categoryParameter") -@RequiredArgsConstructor -public class CategoryParameterController { - private final CategoryParameterService categoryParameterService; - - @Operation( summary = "添加") - @PostMapping(value = "/add") - public ResResult add(@RequestBody CategoryParameterParam param){ - ValidationUtil.validateParam(param, ValidationGroup.add.class); - return Res.ok(categoryParameterService.add(param)); - } - - @Operation( summary = "修改") - @PostMapping(value = "/update") - public ResResult update(@RequestBody CategoryParameterParam param){ - ValidationUtil.validateParam(param,ValidationGroup.edit.class); - return Res.ok(categoryParameterService.update(param)); - } - - @Operation( summary = "删除") - @DeleteMapping(value = "/delete") - public ResResult delete(Long id){ - categoryParameterService.delete(id); - return Res.ok(); - } - - @Operation( summary = "通过ID查询") - @GetMapping(value = "/findById") - public ResResult findById(Long id){ - return Res.ok(categoryParameterService.findById(id)); - } - - @Operation( summary = "查询所有") - @GetMapping(value = "/findAll") - public ResResult> findAll(){ - return Res.ok(categoryParameterService.findAll()); - } - - @Operation( summary = "分页查询(限定类目和分组id)") - @GetMapping(value = "/page") - public ResResult> page(PageParam pageParam, CategoryParameterParam categoryParameterParam){ - ValidationUtil.validateParam(categoryParameterParam,ValidationGroup.query.class); - return Res.ok(categoryParameterService.page(pageParam,categoryParameterParam)); - } - - @Operation(summary = "判断类目参数是否已经存在") - @GetMapping("/existsByName") - public ResResult existsByName(String name,Long groupId){ - return Res.ok(categoryParameterService.existsByName(name,groupId)); - } - - @Operation(summary = "判断类目参数是否已经存在(不包含自身)") - @GetMapping("/existsByNameNotId") - public ResResult existsByName(String name,Long groupId,Long id){ - return Res.ok(categoryParameterService.existsByName(name,groupId,id)); - } - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/CategoryParameterGroupController.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/CategoryParameterGroupController.java deleted file mode 100644 index c81f9f737e9ae97d71dc636db4fc38ee3cb3d269..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/CategoryParameterGroupController.java +++ /dev/null @@ -1,78 +0,0 @@ -package cn.bootx.goods.controller; - -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.goods.core.category.service.CategoryParameterGroupService; -import cn.bootx.goods.dto.category.CategoryParameterGroupDto; -import cn.bootx.goods.param.category.CategoryParameterGroupParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 类目参数组 - * @author xxm - * @date 2022-05-09 - */ -@Tag(name ="类目参数组") -@RestController -@RequestMapping("/categoryParameterGroup") -@RequiredArgsConstructor -public class CategoryParameterGroupController { - private final CategoryParameterGroupService categoryParameterGroupService; - - @Operation( summary = "添加") - @PostMapping(value = "/add") - public ResResult add(@RequestBody CategoryParameterGroupParam param){ - return Res.ok(categoryParameterGroupService.add(param)); - } - - @Operation( summary = "修改") - @PostMapping(value = "/update") - public ResResult update(@RequestBody CategoryParameterGroupParam param){ - return Res.ok(categoryParameterGroupService.update(param)); - } - - @Operation( summary = "删除") - @DeleteMapping(value = "/delete") - public ResResult delete(Long id){ - categoryParameterGroupService.delete(id); - return Res.ok(); - } - - @Operation( summary = "通过ID查询") - @GetMapping(value = "/findById") - public ResResult findById(Long id){ - return Res.ok(categoryParameterGroupService.findById(id)); - } - - @Operation( summary = "查询所有") - @GetMapping(value = "/findAll") - public ResResult> findAll(){ - return Res.ok(categoryParameterGroupService.findAll()); - } - - @Operation( summary = "分页查询") - @GetMapping(value = "/page") - public ResResult> page(PageParam pageParam, CategoryParameterGroupParam categoryParameterGroupParam){ - return Res.ok(categoryParameterGroupService.page(pageParam,categoryParameterGroupParam)); - } - - @Operation(summary = "判断类目参数组是否已经存在") - @GetMapping("/existsByName") - public ResResult existsByName(String name,Long categoryId){ - return Res.ok(categoryParameterGroupService.existsByName(name,categoryId)); - } - - @Operation(summary = "判断类目参数组是否已经存在(不包含自身)") - @GetMapping("/existsByNameNotId") - public ResResult existsByName(String name,Long categoryId,Long id){ - return Res.ok(categoryParameterGroupService.existsByName(name,categoryId,id)); - } - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/GoodsController.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/GoodsController.java deleted file mode 100644 index f6f6eee3f4f2552f69435e2b036ef382b8ef563f..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/GoodsController.java +++ /dev/null @@ -1,60 +0,0 @@ -package cn.bootx.goods.controller; - -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.goods.core.goods.service.GoodsService; -import cn.bootx.goods.dto.goods.GoodsDto; -import cn.bootx.goods.param.goods.GoodsParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -@Tag(name ="商品管理") -@RestController -@RequestMapping("/goods") -@AllArgsConstructor -public class GoodsController{ - private final GoodsService goodsService; - - @Operation(summary = "添加商品") - @PostMapping("/add") - public ResResult add(@RequestBody GoodsParam param){ - goodsService.add(param); - return Res.ok(); - } - - @Operation(summary = "查询全部") - @GetMapping("/findAll") - public ResResult> findAll(){ - return Res.ok(goodsService.findAll()); - } - - @Operation(summary = "分页") - @GetMapping("/page") - public ResResult> page(PageParam param, GoodsParam query){ - return Res.ok(goodsService.page(param,query)); - } - - @Operation(summary = "查询包含sku的详情") - @GetMapping("/getDetails") - public ResResult getDetails(Long id){ - return Res.ok(goodsService.getDetails(id)); - } - - @Operation(summary = "查询包含商品信息") - @GetMapping("/findById") - public ResResult findById(Long id){ - return Res.ok(goodsService.findById(id)); - } - - @Operation(summary = "按类目查询") - @GetMapping("/findByCategory") - public ResResult> findByCategory(Long cid){ - return Res.ok(goodsService.findByCategory(cid)); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/GoodsSkuController.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/GoodsSkuController.java deleted file mode 100644 index fd77fb2db95bee28a0b402d5bcbaef603837e4a0..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/GoodsSkuController.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.bootx.goods.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.goods.core.sku.service.GoodsSkuService; -import cn.bootx.goods.dto.sku.GoodsSkuDto; -import cn.bootx.goods.param.sku.SkuParam; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** -* @author xxm -* @date 2020/11/21 -*/ -@Tag(name ="sku操作") -@RestController -@RequestMapping("/sku") -@AllArgsConstructor -public class GoodsSkuController { - private final GoodsSkuService goodsSkuService; - - @Operation(summary = "添加商品sku") - @PostMapping("/add") - public ResResult add(@RequestBody SkuParam skuParam){ - return Res.ok(goodsSkuService.add(skuParam)); - } - - @Operation(summary = "获取sku") - @GetMapping("/get") - public ResResult getById(Long id){ - return Res.ok(goodsSkuService.getById(id)); - } - - @Operation(summary = "获取sku集合") - @GetMapping("/findBySkuIds") - public ResResult> findBySkuIds(@RequestParam List skuIds){ - return Res.ok(goodsSkuService.findBySkuIds(skuIds)); - } - - @Operation(summary = "根据goodsId查询") - @GetMapping("/findByGoodsId") - public ResResult> findByGoodsId(Long goodsId){ - return Res.ok(goodsSkuService.findByGoodsId(goodsId)); - } - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/InventoryController.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/InventoryController.java deleted file mode 100644 index 5dd6cea3b8fa6b7cca0ff1bdd4fb3c46a56c1832..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/InventoryController.java +++ /dev/null @@ -1,89 +0,0 @@ -package cn.bootx.goods.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.goods.core.inventory.service.InventoryService; -import cn.bootx.goods.core.inventory.service.OperateInventoryService; -import cn.bootx.goods.dto.inventory.LockInventoryDto; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** -* @author xxm -* @date 2020/11/23 -*/ -@Tag(name ="库存操作") -@RestController -@RequestMapping("/inventory") -@AllArgsConstructor -public class InventoryController { - private final InventoryService inventoryService; - private final OperateInventoryService operateInventoryService; - - @Operation(summary = "获取指定 SKU 的可用库存") - @GetMapping("/getAvailable") - public ResResult getAvailable(Long skuId){ - return Res.ok(inventoryService.getAvailable(skuId)); - } - - @Operation(summary = "锁定库存") - @PostMapping("/lockInventory") - public ResResult lockInventory(Long skuId, int count){ - return Res.ok(operateInventoryService.lockInventory(skuId,count)); - } - - @Operation(summary = "释放预占的SKU库存,需使用token") - @PostMapping("/unlockInventory") - public ResResult unlockInventory(Long skuId, int count, String token){ - operateInventoryService.unlockInventory(skuId,count,token); - return Res.ok(); - } - - @Operation(summary = "解锁没有令牌的库存") - @PostMapping("/unlockInventoryWithoutToken") - public ResResult unlockInventoryWithoutToken(Long skuId, int count){ - operateInventoryService.unlockInventoryWithoutToken(skuId,count); - return Res.ok(); - } - - @Operation(summary = "扣减指定 SKU 的预占库存,增加对应售出") - @PostMapping("/reduceInventory") - public ResResult reduceInventory(Long skuId, int count, String token){ - operateInventoryService.reduceInventory(skuId,count,token); - return Res.ok(); - } - - @Operation(summary = "增补指定 SKU 的可售库存, 扣减对应售出") - @PostMapping("/increaseInventory") - public ResResult increaseInventory(Long skuId, int count){ - operateInventoryService.increaseInventory(skuId,count); - return Res.ok(); - } - - @Operation(summary = "增补指定 SKU 的可售库存") - @PostMapping("/increaseAvailable") - public ResResult increaseAvailable(Long skuId, int count){ - operateInventoryService.increaseAvailable(skuId,count); - return Res.ok(); - } - - @Operation(summary = "扣减指定的 SKU 的库存") - @PostMapping("/reduceLockedAndCapacity") - public ResResult reduceLockedAndCapacity(Long skuId, int count, String token){ - operateInventoryService.reduceLockedAndCapacity(skuId,count,token); - return Res.ok(); - } - - - @Operation(summary = "扣减指定 SKU 的售出库存并减少总库存") - @PostMapping("/reduceSoldAndCapacity") - public ResResult reduceSoldAndCapacity(Long skuId, int count){ - operateInventoryService.reduceSoldAndCapacity(skuId,count); - return Res.ok(); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/SpecificationController.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/SpecificationController.java deleted file mode 100644 index a8f45b5fae65578e1fe13bfe4440b0bebd08175c..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/controller/SpecificationController.java +++ /dev/null @@ -1,66 +0,0 @@ -package cn.bootx.goods.controller; - -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.goods.core.category.service.SpecificationService; -import cn.bootx.goods.dto.category.SpecificationDto; -import cn.bootx.goods.param.category.SpecificationParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * 规格 - * @author xxm - * @date 2022-05-09 - */ -@Tag(name ="规格") -@RestController -@RequestMapping("/specification") -@RequiredArgsConstructor -public class SpecificationController { - private final SpecificationService specificationService; - - @Operation( summary = "添加") - @PostMapping(value = "/add") - public ResResult add(@RequestBody SpecificationParam param){ - specificationService.add(param); - return Res.ok(); - } - - @Operation( summary = "修改") - @PostMapping(value = "/update") - public ResResult update(@RequestBody SpecificationParam param){ - return Res.ok(specificationService.update(param)); - } - - @Operation( summary = "删除") - @DeleteMapping(value = "/delete") - public ResResult delete(Long id){ - specificationService.delete(id); - return Res.ok(); - } - - @Operation( summary = "通过ID查询") - @GetMapping(value = "/findById") - public ResResult findById(Long id){ - return Res.ok(specificationService.findById(id)); - } - - @Operation( summary = "查询所有") - @GetMapping(value = "/findAll") - public ResResult> findAll(){ - return Res.ok(specificationService.findAll()); - } - - @Operation( summary = "分页查询") - @GetMapping(value = "/page") - public ResResult> page(PageParam pageParam, SpecificationParam specificationParam){ - return Res.ok(specificationService.page(pageParam,specificationParam)); - } -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/BrandConvert.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/BrandConvert.java deleted file mode 100644 index aa7604963893792b5eee29cc2b549acbfd54665e..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/BrandConvert.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bootx.goods.core.category.convert; - -import cn.bootx.goods.core.category.entity.Brand; -import cn.bootx.goods.dto.category.BrandDto; -import cn.bootx.goods.param.category.BrandParam; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -/** - * 品牌 - * @author xxm - * @date 2022-05-09 - */ -@Mapper -public interface BrandConvert { - BrandConvert CONVERT = Mappers.getMapper(BrandConvert.class); - - Brand convert(BrandParam in); - - BrandDto convert(Brand in); - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/CategoryConvert.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/CategoryConvert.java deleted file mode 100644 index b6351621806c117acf741ca9fbe287be00414335..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/CategoryConvert.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bootx.goods.core.category.convert; - -import cn.bootx.goods.core.category.entity.Category; -import cn.bootx.goods.dto.category.CategoryDto; -import cn.bootx.goods.param.category.CategoryParam; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface CategoryConvert { - CategoryConvert CONVERT = Mappers.getMapper(CategoryConvert.class); - CategoryDto convert(Category in); - - Category convert(CategoryParam in); -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/CategoryParameterConvert.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/CategoryParameterConvert.java deleted file mode 100644 index b71219821b43d011f16b4d2d831d71a0ccd0c85b..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/CategoryParameterConvert.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bootx.goods.core.category.convert; - -import cn.bootx.goods.core.category.entity.CategoryParameter; -import cn.bootx.goods.dto.category.CategoryParameterDto; -import cn.bootx.goods.param.category.CategoryParameterParam; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -/** - * 类目参数 - * @author xxm - * @date 2022-05-09 - */ -@Mapper -public interface CategoryParameterConvert { - CategoryParameterConvert CONVERT = Mappers.getMapper(CategoryParameterConvert.class); - - CategoryParameter convert(CategoryParameterParam in); - - CategoryParameterDto convert(CategoryParameter in); - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/CategoryParameterGroupConvert.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/CategoryParameterGroupConvert.java deleted file mode 100644 index ba35f682173c0e0b7d434994406c91b1ec2081d7..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/CategoryParameterGroupConvert.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bootx.goods.core.category.convert; - -import cn.bootx.goods.core.category.entity.CategoryParameterGroup; -import cn.bootx.goods.dto.category.CategoryParameterGroupDto; -import cn.bootx.goods.param.category.CategoryParameterGroupParam; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -/** - * 类目参数组 - * @author xxm - * @date 2022-05-09 - */ -@Mapper -public interface CategoryParameterGroupConvert { - CategoryParameterGroupConvert CONVERT = Mappers.getMapper(CategoryParameterGroupConvert.class); - - CategoryParameterGroup convert(CategoryParameterGroupParam in); - - CategoryParameterGroupDto convert(CategoryParameterGroup in); - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/SpecificationConvert.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/SpecificationConvert.java deleted file mode 100644 index 493e0deb87d995e76e961ce131abd975578621bf..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/convert/SpecificationConvert.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bootx.goods.core.category.convert; - -import cn.bootx.goods.core.category.entity.Specification; -import cn.bootx.goods.dto.category.SpecificationDto; -import cn.bootx.goods.param.category.SpecificationParam; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -/** - * 规格 - * @author xxm - * @date 2022-05-09 - */ -@Mapper -public interface SpecificationConvert { - SpecificationConvert CONVERT = Mappers.getMapper(SpecificationConvert.class); - - Specification convert(SpecificationParam in); - - SpecificationDto convert(Specification in); - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/BrandManager.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/BrandManager.java deleted file mode 100644 index 7b827e525324a6c9dc8fd69d5497e2f88f9d0282..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/BrandManager.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.mybatisplus.base.MpIdEntity; -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.goods.core.category.entity.Brand; -import cn.bootx.goods.param.category.BrandParam; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Repository; - -/** - * 品牌 - * @author xxm - * @date 2022-05-09 - */ -@Repository -@RequiredArgsConstructor -public class BrandManager extends BaseManager { - private final BrandMapper mapper; - - /** - * 分页 - */ - public Page page(PageParam pageParam, BrandParam param) { - Page mpPage = MpUtil.getMpPage(pageParam, Brand.class); - return lambdaQuery().orderByDesc(MpIdEntity::getId).page(mpPage); - } -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/BrandMapper.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/BrandMapper.java deleted file mode 100644 index b28500c7bde713eda0c0c35c0baf926504c1e70e..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/BrandMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.goods.core.category.entity.Brand; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** - * 品牌 - * @author xxm - * @date 2022-05-09 - */ -@Mapper -public interface BrandMapper extends BaseMapper { -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryBrandManager.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryBrandManager.java deleted file mode 100644 index 78ac2a6868178206e38793d813e1e9e47358c227..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryBrandManager.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.goods.core.category.entity.CategoryBrand; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** -* -* @author xxm -* @date 2022/5/9 -*/ -@Slf4j -@Repository -@RequiredArgsConstructor -public class CategoryBrandManager extends BaseManager { - - public List findAllByCategoryId(Long categoryId) { - return findAllByField(CategoryBrand::getCategoryId,categoryId); - } - - public void deleteByCategoryId(Long categoryId){ - deleteByField(CategoryBrand::getCategoryId,categoryId); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryBrandMapper.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryBrandMapper.java deleted file mode 100644 index c1f252c117dc9b991dee4cd751fad300120849aa..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryBrandMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.goods.core.category.entity.CategoryBrand; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** -* -* @author xxm -* @date 2022/5/9 -*/ -@Mapper -public interface CategoryBrandMapper extends BaseMapper { -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryManager.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryManager.java deleted file mode 100644 index e8a8e6a545d132472701e935ea9083a733329549..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryManager.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.goods.core.category.entity.Category; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; - -/** -* 类目 -* @author xxm -* @date 2020/11/19 -*/ -@Slf4j -@Repository -@RequiredArgsConstructor -public class CategoryManager extends BaseManager { - - public boolean existsByChildren(Long id) { - return existedByField(Category::getPid,id); - } - - public boolean existsName(String name) { - return existedByField(Category::getName,name); - } - - public boolean existsName(String name,Long id) { - return existedByField(Category::getName,name,id); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryMapper.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryMapper.java deleted file mode 100644 index d3c1108ace5130b7ea18482687eb0722c19bb462..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.goods.core.category.entity.Category; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** -* 类目 -* @author xxm -* @date 2020/11/19 -*/ -@Mapper -public interface CategoryMapper extends BaseMapper { -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterGroupManager.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterGroupManager.java deleted file mode 100644 index cf88667cbc1134a78cd86d62ddea5b6c1a2fa49c..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterGroupManager.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.mybatisplus.base.MpIdEntity; -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.goods.core.category.entity.CategoryParameterGroup; -import cn.bootx.goods.param.category.CategoryParameterGroupParam; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Repository; - -/** - * 类目参数组 - * @author xxm - * @date 2022-05-09 - */ -@Repository -@RequiredArgsConstructor -public class CategoryParameterGroupManager extends BaseManager { - private final CategoryParameterGroupMapper mapper; - - /** - * 分页 - */ - public Page page(PageParam pageParam, CategoryParameterGroupParam param) { - Page mpPage = MpUtil.getMpPage(pageParam, CategoryParameterGroup.class); - return lambdaQuery() - .eq(CategoryParameterGroup::getCategoryId,param.getCategoryId()) - .orderByDesc(MpIdEntity::getId) - .page(mpPage); - } - - /** - * 名称是否存在 - */ - public boolean existsByName(String name, Long categoryId){ - return this.lambdaQuery() - .eq(CategoryParameterGroup::getName,name) - .eq(CategoryParameterGroup::getCategoryId,categoryId) - .exists(); - } - /** - * 名称是否存在 - */ - public boolean existsByName(String name, Long categoryId, Long id){ - return this.lambdaQuery() - .eq(CategoryParameterGroup::getName,name) - .eq(CategoryParameterGroup::getCategoryId,categoryId) - .ne(CategoryParameterGroup::getId,id) - .exists(); - } -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterGroupMapper.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterGroupMapper.java deleted file mode 100644 index 440f10d7feea33d162eb6be8590acc4eec6155e5..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterGroupMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.goods.core.category.entity.CategoryParameterGroup; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** - * 类目参数组 - * @author xxm - * @date 2022-05-09 - */ -@Mapper -public interface CategoryParameterGroupMapper extends BaseMapper { -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterManager.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterManager.java deleted file mode 100644 index fdf0e508a4d2be8b2c6bb20b0fb9f7fb6512f9a9..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterManager.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.mybatisplus.base.MpIdEntity; -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.goods.core.category.entity.CategoryParameter; -import cn.bootx.goods.param.category.CategoryParameterParam; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Repository; - -/** - * 类目参数 - * @author xxm - * @date 2022-05-09 - */ -@Repository -@RequiredArgsConstructor -public class CategoryParameterManager extends BaseManager { - private final CategoryParameterMapper mapper; - - /** - * 分页 - */ - public Page page(PageParam pageParam, CategoryParameterParam param) { - Page mpPage = MpUtil.getMpPage(pageParam, CategoryParameter.class); - return lambdaQuery() - .eq(CategoryParameter::getCategoryId,param.getCategoryId()) - .eq(CategoryParameter::getGroupId,param.getGroupId()) - .orderByDesc(MpIdEntity::getId) - .page(mpPage); - } - - /** - * 名称是否存在 - */ - public boolean existsByName(String name, Long groupId){ - return this.lambdaQuery() - .eq(CategoryParameter::getName,name) - .eq(CategoryParameter::getGroupId,groupId) - .exists(); - } - /** - * 名称是否存在 - */ - public boolean existsByName(String name, Long groupId, Long id){ - return this.lambdaQuery() - .eq(CategoryParameter::getName,name) - .eq(CategoryParameter::getGroupId,groupId) - .ne(CategoryParameter::getId,id) - .exists(); - } -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterMapper.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterMapper.java deleted file mode 100644 index 808327b81456cc6ebe733941cb32f2b3c8dadb18..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategoryParameterMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.goods.core.category.entity.CategoryParameter; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** - * 类目参数 - * @author xxm - * @date 2022-05-09 - */ -@Mapper -public interface CategoryParameterMapper extends BaseMapper { -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategorySpecificationManager.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategorySpecificationManager.java deleted file mode 100644 index ea9a34516d16cb301a15cdd5241ba8531d8a92f5..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategorySpecificationManager.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.goods.core.category.entity.CategorySpecification; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** -* -* @author xxm -* @date 2022/5/13 -*/ -@Slf4j -@Repository -@RequiredArgsConstructor -public class CategorySpecificationManager extends BaseManager { - - public List findAllByCategoryId(Long categoryId) { - return findAllByField(CategorySpecification::getCategoryId,categoryId); - } - - public void deleteByCategoryId(Long categoryId){ - deleteByField(CategorySpecification::getCategoryId,categoryId); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategorySpecificationMapper.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategorySpecificationMapper.java deleted file mode 100644 index 2bab2c82b2463020e14ea49d15c1d8eb13a996be..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/CategorySpecificationMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.goods.core.category.entity.CategorySpecification; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** -* -* @author xxm -* @date 2022/5/13 -*/ -@Mapper -public interface CategorySpecificationMapper extends BaseMapper { -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/SpecificationManager.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/SpecificationManager.java deleted file mode 100644 index c3d70952c4be57e56468d14cc4ef275ece87f615..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/SpecificationManager.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.mybatisplus.base.MpIdEntity; -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.goods.core.category.entity.Specification; -import cn.bootx.goods.param.category.SpecificationParam; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Repository; - -/** - * 规格 - * @author xxm - * @date 2022-05-09 - */ -@Repository -@RequiredArgsConstructor -public class SpecificationManager extends BaseManager { - private final SpecificationMapper mapper; - - /** - * 分页 - */ - public Page page(PageParam pageParam, SpecificationParam param) { - Page mpPage = MpUtil.getMpPage(pageParam, Specification.class); - return lambdaQuery().orderByDesc(MpIdEntity::getId).page(mpPage); - } -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/SpecificationMapper.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/SpecificationMapper.java deleted file mode 100644 index 16f2f68e7b723dccd6195c8fabfae8773e1e967a..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/dao/SpecificationMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.goods.core.category.dao; - -import cn.bootx.goods.core.category.entity.Specification; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** - * 规格 - * @author xxm - * @date 2022-05-09 - */ -@Mapper -public interface SpecificationMapper extends BaseMapper { -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Brand.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Brand.java deleted file mode 100644 index 7522d8e1694eab11c6405638e7325b58009d3eda..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Brand.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.bootx.goods.core.category.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.goods.core.category.convert.BrandConvert; -import cn.bootx.goods.dto.category.BrandDto; -import cn.bootx.goods.param.category.BrandParam; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 品牌 -* @author xxm -* @date 2022-05-09 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@TableName("goods_brand") -@Accessors(chain = true) -public class Brand extends MpBaseEntity implements EntityBaseFunction{ - - /** 品牌名称 */ - private String name; - /** 品牌图标 */ - private String logo; - /** 状态 */ - private Boolean enable; - /** 描述 */ - private String remark; - - /** 创建对象 */ - public static Brand init(BrandParam in) { - return BrandConvert.CONVERT.convert(in); - } - - /** 转换成dto */ - @Override - public BrandDto toDto() { - return BrandConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Category.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Category.java deleted file mode 100644 index e18e85df92f93314262056a59e395fa1c3edc6ca..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Category.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.bootx.goods.core.category.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.goods.core.category.convert.CategoryConvert; -import cn.bootx.goods.dto.category.CategoryDto; -import cn.bootx.goods.param.category.CategoryParam; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - - -/** -* 类目 -* @author xxm -* @date 2020/11/19 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@TableName("goods_category") -@Accessors(chain = true) -public class Category extends MpBaseEntity implements EntityBaseFunction { - private static final long serialVersionUID = -3604408346443111551L; - - /** 上级类目id */ - private Long pid; - /** 类目名称 */ - private String name; - /** 描述 */ - private String remark; - /** 状态 */ - private Boolean enable; - /** 排序 */ - private Double sortNo; - /** 图标/图片地址 */ - private String image; - /** 层级 */ - private Integer level; - - public static Category init(CategoryParam in) { - return CategoryConvert.CONVERT.convert(in); - } - - @Override - public CategoryDto toDto() { - return CategoryConvert.CONVERT.convert(this); - } - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategoryBrand.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategoryBrand.java deleted file mode 100644 index de1ea551f233c5824d11b6605c67fe7a13ded573..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategoryBrand.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.bootx.goods.core.category.entity; - -import cn.bootx.common.mybatisplus.base.MpIdEntity; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 类目品牌关联 -* @author xxm -* @date 2022/5/9 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("goods_category_brand") -public class CategoryBrand extends MpIdEntity { - - /** 分类id */ - private Long categoryId; - - /** 品牌id */ - private Long brandId; - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategoryParameter.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategoryParameter.java deleted file mode 100644 index f04d496b55c51ca3da281347aa3e77d5b9b08d98..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategoryParameter.java +++ /dev/null @@ -1,56 +0,0 @@ -package cn.bootx.goods.core.category.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.goods.core.category.convert.CategoryParameterConvert; -import cn.bootx.goods.dto.category.CategoryParameterDto; -import cn.bootx.goods.param.category.CategoryParameterParam; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.List; - -/** -* 类目参数 -* @author xxm -* @date 2022-05-09 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@TableName(value = "goods_category_parameter",autoResultMap = true) -@Accessors(chain = true) -public class CategoryParameter extends MpBaseEntity implements EntityBaseFunction{ - - /** 参数名称 */ - private String name; - /** 类型 */ - private String type; - /** 选择值(列表) */ - @TableField(typeHandler= JacksonTypeHandler.class) - private List options; - /** 是否必填 */ - private Boolean required; - /** 排序 */ - private Double sortNo; - /** 参数组id */ - private Long groupId; - /** 类目id */ - private Long categoryId; - /** 描述 */ - private String remark; - - /** 创建对象 */ - public static CategoryParameter init(CategoryParameterParam in) { - return CategoryParameterConvert.CONVERT.convert(in); - } - - /** 转换成dto */ - @Override - public CategoryParameterDto toDto() { - return CategoryParameterConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategoryParameterGroup.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategoryParameterGroup.java deleted file mode 100644 index 1a1f547a35d6932d5999202103bceb5c937f364d..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategoryParameterGroup.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.bootx.goods.core.category.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.goods.core.category.convert.CategoryParameterGroupConvert; -import cn.bootx.goods.dto.category.CategoryParameterGroupDto; -import cn.bootx.goods.param.category.CategoryParameterGroupParam; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 类目参数组 -* @author xxm -* @date 2022-05-09 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@TableName("goods_category_parameter_group") -@Accessors(chain = true) -public class CategoryParameterGroup extends MpBaseEntity implements EntityBaseFunction{ - - /** 参数组名称 */ - private String name; - /** 排序 */ - private Double sortNo; - /** 类目id */ - private Long categoryId; - /** 描述 */ - private String remark; - - /** 创建对象 */ - public static CategoryParameterGroup init(CategoryParameterGroupParam in) { - return CategoryParameterGroupConvert.CONVERT.convert(in); - } - - /** 转换成dto */ - @Override - public CategoryParameterGroupDto toDto() { - return CategoryParameterGroupConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Specification.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Specification.java deleted file mode 100644 index a67b65944c8bb294324c2568a55b3875772bd863..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/Specification.java +++ /dev/null @@ -1,55 +0,0 @@ -package cn.bootx.goods.core.category.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.goods.core.category.convert.SpecificationConvert; -import cn.bootx.goods.dto.category.SpecificationDto; -import cn.bootx.goods.param.category.SpecificationParam; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.List; - - -/** - * 规格 - * @author xxm - * @date 2022-05-09 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName(value = "goods_specification",autoResultMap = true) -public class Specification extends MpBaseEntity implements EntityBaseFunction{ - - /** 规格名称 */ - private String name; - - /** 规格类型(文本/列表选择) */ - private String type; - - /** 规格值(列表) */ - @TableField(typeHandler= JacksonTypeHandler.class) - private List options; - - /** 状态 */ - private String state; - - /** 描述 */ - private String remark; - - /** 创建对象 */ - public static Specification init(SpecificationParam in) { - return SpecificationConvert.CONVERT.convert(in); - } - - /** 转换成dto */ - @Override - public SpecificationDto toDto() { - return SpecificationConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/BrandService.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/BrandService.java deleted file mode 100644 index 93b5deaf00ec2e413ba5d842810c80d738e82fa7..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/BrandService.java +++ /dev/null @@ -1,77 +0,0 @@ -package cn.bootx.goods.core.category.service; - -import cn.bootx.common.core.exception.DataNotExistException; -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.core.util.ResultConvertUtil; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.goods.core.category.dao.BrandManager; -import cn.bootx.goods.core.category.entity.Brand; -import cn.bootx.goods.dto.category.BrandDto; -import cn.bootx.goods.param.category.BrandParam; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 品牌 - * @author xxm - * @date 2022-05-09 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class BrandService { - private final BrandManager brandManager; - - /** - * 添加 - */ - public BrandDto add(BrandParam param){ - Brand brand = Brand.init(param); - return brandManager.save(brand).toDto(); - } - - /** - * 修改 - */ - public BrandDto update(BrandParam param){ - Brand brand = brandManager.findById(param.getId()).orElseThrow(DataNotExistException::new); - - BeanUtil.copyProperties(param,brand, CopyOptions.create().ignoreNullValue()); - return brandManager.updateById(brand).toDto(); - } - - /** - * 分页 - */ - public PageResult page(PageParam pageParam,BrandParam brandParam){ - return MpUtil.convert2DtoPageResult(brandManager.page(pageParam,brandParam)); - } - - /** - * 获取单条 - */ - public BrandDto findById(Long id){ - return brandManager.findById(id).map(Brand::toDto).orElseThrow(DataNotExistException::new); - } - - /** - * 获取全部 - */ - public List findAll(){ - return ResultConvertUtil.dtoListConvert(brandManager.findAll()); - } - - /** - * 删除 - */ - public void delete(Long id){ - brandManager.deleteById(id); - } - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/CategoryParameterGroupService.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/CategoryParameterGroupService.java deleted file mode 100644 index af2763e0fd5ca830bcb71626e04f2f2e6f04f41c..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/CategoryParameterGroupService.java +++ /dev/null @@ -1,90 +0,0 @@ -package cn.bootx.goods.core.category.service; - -import cn.bootx.common.core.exception.DataNotExistException; -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.core.util.ResultConvertUtil; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.goods.core.category.dao.CategoryParameterGroupManager; -import cn.bootx.goods.core.category.entity.CategoryParameterGroup; -import cn.bootx.goods.dto.category.CategoryParameterGroupDto; -import cn.bootx.goods.param.category.CategoryParameterGroupParam; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 类目参数组 - * @author xxm - * @date 2022-05-09 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class CategoryParameterGroupService { - private final CategoryParameterGroupManager categoryParameterGroupManager; - - /** - * 添加 - */ - public CategoryParameterGroupDto add(CategoryParameterGroupParam param) { - CategoryParameterGroup categoryParameterGroup = CategoryParameterGroup.init(param); - return categoryParameterGroupManager.save(categoryParameterGroup).toDto(); - } - - /** - * 修改 - */ - public CategoryParameterGroupDto update(CategoryParameterGroupParam param) { - CategoryParameterGroup categoryParameterGroup = categoryParameterGroupManager.findById(param.getId()).orElseThrow(DataNotExistException::new); - param.setId(null); - BeanUtil.copyProperties(param, categoryParameterGroup, CopyOptions.create().ignoreNullValue()); - return categoryParameterGroupManager.updateById(categoryParameterGroup).toDto(); - } - - /** - * 分页 - */ - public PageResult page(PageParam pageParam, CategoryParameterGroupParam categoryParameterGroupParam) { - return MpUtil.convert2DtoPageResult(categoryParameterGroupManager.page(pageParam, categoryParameterGroupParam)); - } - - /** - * 获取单条 - */ - public CategoryParameterGroupDto findById(Long id) { - return categoryParameterGroupManager.findById(id).map(CategoryParameterGroup::toDto).orElseThrow(DataNotExistException::new); - } - - /** - * 获取全部 - */ - public List findAll() { - return ResultConvertUtil.dtoListConvert(categoryParameterGroupManager.findAll()); - } - - /** - * 删除 - */ - public void delete(Long id) { - categoryParameterGroupManager.deleteById(id); - } - - /** - * 名称是否存在 - */ - public boolean existsByName(String name, Long categoryId) { - return categoryParameterGroupManager.existsByName(name,categoryId); - } - - /** - * 名称是否存在 - */ - public boolean existsByName(String name, Long categoryId, Long id) { - return categoryParameterGroupManager.existsByName(name,categoryId,id); - } -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/CategoryParameterService.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/CategoryParameterService.java deleted file mode 100644 index 16301641a85094cf2424a25a0b411ba1d57a39fe..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/CategoryParameterService.java +++ /dev/null @@ -1,90 +0,0 @@ -package cn.bootx.goods.core.category.service; - -import cn.bootx.common.core.exception.DataNotExistException; -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.core.util.ResultConvertUtil; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.goods.core.category.dao.CategoryParameterManager; -import cn.bootx.goods.core.category.entity.CategoryParameter; -import cn.bootx.goods.dto.category.CategoryParameterDto; -import cn.bootx.goods.param.category.CategoryParameterParam; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 类目参数 - * @author xxm - * @date 2022-05-09 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class CategoryParameterService { - private final CategoryParameterManager categoryParameterManager; - - /** - * 添加 - */ - public CategoryParameterDto add(CategoryParameterParam param){ - CategoryParameter categoryParameter = CategoryParameter.init(param); - return categoryParameterManager.save(categoryParameter).toDto(); - } - - /** - * 修改 - */ - public CategoryParameterDto update(CategoryParameterParam param){ - CategoryParameter categoryParameter = categoryParameterManager.findById(param.getId()).orElseThrow(DataNotExistException::new); - - BeanUtil.copyProperties(param,categoryParameter, CopyOptions.create().ignoreNullValue()); - return categoryParameterManager.updateById(categoryParameter).toDto(); - } - - /** - * 分页 - */ - public PageResult page(PageParam pageParam,CategoryParameterParam categoryParameterParam){ - return MpUtil.convert2DtoPageResult(categoryParameterManager.page(pageParam,categoryParameterParam)); - } - - /** - * 获取单条 - */ - public CategoryParameterDto findById(Long id){ - return categoryParameterManager.findById(id).map(CategoryParameter::toDto).orElseThrow(DataNotExistException::new); - } - - /** - * 获取全部 - */ - public List findAll(){ - return ResultConvertUtil.dtoListConvert(categoryParameterManager.findAll()); - } - - /** - * 删除 - */ - public void delete(Long id){ - categoryParameterManager.deleteById(id); - } - - /** - * 名称是否存在 - */ - public boolean existsByName(String name, Long groupId) { - return categoryParameterManager.existsByName(name,groupId); - } - - /** - * 名称是否存在 - */ - public boolean existsByName(String name, Long groupId, Long id) { - return categoryParameterManager.existsByName(name,groupId,id); - } -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/CategoryService.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/CategoryService.java deleted file mode 100644 index 8f506c99c4cae0f5ab2f70b10d9ca5d9bb94873b..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/CategoryService.java +++ /dev/null @@ -1,181 +0,0 @@ -package cn.bootx.goods.core.category.service; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.common.core.exception.DataNotExistException; -import cn.bootx.goods.code.CategoryCode; -import cn.bootx.goods.core.category.convert.CategoryConvert; -import cn.bootx.goods.core.category.dao.CategoryBrandManager; -import cn.bootx.goods.core.category.dao.CategoryManager; -import cn.bootx.goods.core.category.dao.CategorySpecificationManager; -import cn.bootx.goods.core.category.entity.Category; -import cn.bootx.goods.core.category.entity.CategoryBrand; -import cn.bootx.goods.core.category.entity.CategorySpecification; -import cn.bootx.goods.core.category.util.CategoryTreeUtil; -import cn.bootx.goods.dto.category.CategoryDto; -import cn.bootx.goods.dto.category.CategoryTreeNode; -import cn.bootx.goods.exception.category.CategoryAlreadyExistedException; -import cn.bootx.goods.exception.category.CategoryNotExistedException; -import cn.bootx.goods.param.category.CategoryBrandParam; -import cn.bootx.goods.param.category.CategoryParam; -import cn.bootx.goods.param.category.CategorySpecParam; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Comparator; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * 类目 - * @author xxm - * @date 2020/11/19 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class CategoryService { - private final CategoryManager categoryManager; - private final CategoryBrandManager categoryBrandManager; - private final CategorySpecificationManager categorySpecificationManager; - - /** - * 添加新类目 - */ - @Transactional(rollbackFor = Exception.class) - public void add(CategoryParam param) { - int level = 1; - // 不传pid为根类目 - if (Objects.nonNull(param.getPid())){ - Category category = categoryManager.findById(param.getPid()).orElseThrow(() -> new BizException("父类不存在")); - level = category.getLevel() + 1; - if (level > CategoryCode.LEVEL_CHILD){ - throw new BizException("类目层级最高为三层"); - } - - } - if (categoryManager.existsName(param.getName())) { - throw new CategoryAlreadyExistedException(); - } - Category category = CategoryConvert.CONVERT.convert(param); - category.setLevel(level); - categoryManager.save(category); - } - - /** - * 更新类目基本信息 - */ - @Transactional(rollbackFor = Exception.class) - public CategoryDto update(CategoryDto param) { - Category category = categoryManager.findById(param.getId()).orElseThrow(CategoryNotExistedException::new); - // pid不可以更新 - param.setPid(null); - BeanUtil.copyProperties(param,category, CopyOptions.create().ignoreNullValue()); - return categoryManager.updateById(category).toDto(); - } - - /** - * 获取所有类目 - */ - public List findAll(){ - return categoryManager.findAll() - .stream() - .map(Category::toDto) - .collect(Collectors.toList()); - } - - /** - * 根据 id 获取相应的类目 - */ - public CategoryDto findById(Long id){ - return categoryManager.findById(id).map(Category::toDto).orElseThrow(DataNotExistException::new); - } - - /** - * 获取类目树 - */ - public List findTree() { - List categories = categoryManager.findAll().stream() - .sorted(Comparator.comparingDouble(Category::getSortNo)) - .collect(Collectors.toList()); - return CategoryTreeUtil.build(categories); - } - - /** - * 判断类目是否已经存在 - */ - public boolean existsByName(String name) { - return categoryManager.existsName(name); - } - - /** - * 判断类目是否已经存在 - */ - public boolean existsByName(String name, Long id) { - return categoryManager.existsName(name,id); - } - - /** - * 根据 id 删除相应的类目 - */ - public void delete(Long id){ - // 判断是否还有子类目 - if (categoryManager.existsByChildren(id)){ - throw new BizException("无法删除, 还有子类目"); - } - categoryManager.deleteById(id); - } - - /** - * 查询已经绑定的品牌id - */ - public List findBindBrandIds(Long categoryId){ - return categoryBrandManager.findAllByCategoryId(categoryId).stream() - .map(CategoryBrand::getBrandId) - .collect(Collectors.toList()); - } - - /** - * 绑定品牌 - */ - @Transactional(rollbackFor = Exception.class) - public void bindBrand(CategoryBrandParam param){ - // 先删后增 - categoryBrandManager.deleteByCategoryId(param.getCategoryId()); - if (CollUtil.isNotEmpty(param.getBrandIds())){ - List collect = param.getBrandIds().stream() - .map(id -> new CategoryBrand().setCategoryId(param.getCategoryId()).setBrandId(id)) - .collect(Collectors.toList()); - categoryBrandManager.saveAll(collect); - } - } - - /** - * 查询绑定的规格id集合 - */ - public List findBindSpecIds(Long categoryId){ - return categorySpecificationManager.findAllByCategoryId(categoryId).stream() - .map(CategorySpecification::getSpecificationId) - .collect(Collectors.toList()); - } - - /** - * 绑定规格 - */ - @Transactional(rollbackFor = Exception.class) - public void bindSpec(CategorySpecParam param){ - // 删旧增新 - categorySpecificationManager.deleteByCategoryId(param.getCategoryId()); - if (CollUtil.isNotEmpty(param.getSpecIds())) { - List collect = param.getSpecIds().stream() - .map(id -> new CategorySpecification().setCategoryId(param.getCategoryId()).setSpecificationId(id)) - .collect(Collectors.toList()); - categorySpecificationManager.saveAll(collect); - } - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/SpecificationService.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/SpecificationService.java deleted file mode 100644 index f1de6ddaf62eae067184bcac91b1d8986840eb90..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/service/SpecificationService.java +++ /dev/null @@ -1,77 +0,0 @@ -package cn.bootx.goods.core.category.service; - -import cn.bootx.common.core.exception.DataNotExistException; -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.core.util.ResultConvertUtil; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.goods.core.category.dao.SpecificationManager; -import cn.bootx.goods.core.category.entity.Specification; -import cn.bootx.goods.dto.category.SpecificationDto; -import cn.bootx.goods.param.category.SpecificationParam; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 规格 - * @author xxm - * @date 2022-05-09 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class SpecificationService { - private final SpecificationManager specificationManager; - - /** - * 添加 - */ - public void add(SpecificationParam param){ - Specification specification = Specification.init(param); - specificationManager.save(specification); - } - - /** - * 修改 - */ - public SpecificationDto update(SpecificationParam param){ - Specification specification = specificationManager.findById(param.getId()).orElseThrow(DataNotExistException::new); - - BeanUtil.copyProperties(param,specification, CopyOptions.create().ignoreNullValue()); - return specificationManager.updateById(specification).toDto(); - } - - /** - * 分页 - */ - public PageResult page(PageParam pageParam,SpecificationParam specificationParam){ - return MpUtil.convert2DtoPageResult(specificationManager.page(pageParam,specificationParam)); - } - - /** - * 获取单条 - */ - public SpecificationDto findById(Long id){ - return specificationManager.findById(id).map(Specification::toDto).orElseThrow(DataNotExistException::new); - } - - /** - * 获取全部 - */ - public List findAll(){ - return ResultConvertUtil.dtoListConvert(specificationManager.findAll()); - } - - /** - * 删除 - */ - public void delete(Long id){ - specificationManager.deleteById(id); - } - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/util/CategoryTreeUtil.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/util/CategoryTreeUtil.java deleted file mode 100644 index 1bbcdd9680c727c015f025ae7aff3f285ce842dd..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/util/CategoryTreeUtil.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.bootx.goods.core.category.util; - - -import cn.bootx.goods.core.category.entity.Category; -import cn.bootx.goods.dto.category.CategoryTreeNode; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** -* 类目树构建 -* @author xxm -* @date 2020/11/20 -*/ -public class CategoryTreeUtil { - - /** - * 构建类目树 - */ - public static List build(List categories) { - List tree = new ArrayList<>(); - for (Category category : categories) { - // 顶级类目 - if (Objects.isNull(category.getPid())) { - CategoryTreeNode treeNode = new CategoryTreeNode(category); - findChildren(treeNode, categories); - tree.add(treeNode); - } - } - return tree; - } - - /** - * 递归查找子节点 - */ - private static void findChildren(CategoryTreeNode treeNode, List categories) { - for (Category category : categories) { - if (Objects.equals(treeNode.getId(),category.getPid())) { - if (treeNode.getChildren() == null) { - treeNode.setChildren(new ArrayList<>()); - } - CategoryTreeNode childNode = new CategoryTreeNode(category); - findChildren(childNode, categories); - treeNode.getChildren().add(childNode); - } - } - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/util/Descartes.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/util/Descartes.java deleted file mode 100644 index 851cbc5193fa79e0c0272a9b23867fa845a51f58..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/util/Descartes.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.bootx.goods.core.category.util; - -import java.util.ArrayList; -import java.util.List; - -/** -* 未知维度集合的笛卡尔积 -* @author xxm -* @date 2020/11/21 -*/ -public class Descartes { - /** - * 递归实现 dimValue 中的笛卡尔积,结果放在 result 中 - * - * @param dimValue 原始数据 - * @param result 结果数据 - * @param layer dimValue的层数 - * @param curList 每次笛卡尔积的结果 - */ - public static void recursive(List> dimValue, List> result, int layer, List curList) { - if (layer < dimValue.size() - 1) { - if (dimValue.get(layer).size() == 0) { - recursive(dimValue, result, layer + 1, curList); - } else { - for (int i = 0; i < dimValue.get(layer).size(); i++) { - List list = new ArrayList<>(curList); - list.add(dimValue.get(layer).get(i)); - recursive(dimValue, result, layer + 1, list); - } - } - } else if (layer == dimValue.size() - 1) { - if (dimValue.get(layer).size() == 0) { - result.add(curList); - } else { - for (int i = 0; i < dimValue.get(layer).size(); i++) { - List list = new ArrayList<>(curList); - list.add(dimValue.get(layer).get(i)); - result.add(list); - } - } - } - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/convert/GoodsConvert.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/convert/GoodsConvert.java deleted file mode 100644 index bae25a381822891f9e1e4e1f3e6acbdc66fda5f5..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/convert/GoodsConvert.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bootx.goods.core.goods.convert; - -import cn.bootx.goods.core.goods.entity.Goods; -import cn.bootx.goods.dto.goods.GoodsDto; -import cn.bootx.goods.param.goods.GoodsParam; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -/** -* 转换 -* @author xxm -* @date 2021/7/23 -*/ -@Mapper -public interface GoodsConvert { - GoodsConvert CONVERT = Mappers.getMapper(GoodsConvert.class); - - Goods convert(GoodsParam in); - - GoodsDto convert(Goods in); -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/dao/GoodsMapper.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/dao/GoodsMapper.java deleted file mode 100644 index 759cd72bac08da079f49735d2a7b4a4619e88844..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/dao/GoodsMapper.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.bootx.goods.core.goods.dao; - -import cn.bootx.goods.core.goods.entity.Goods; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -import java.util.Collection; -import java.util.List; -import java.util.Optional; - -/** -* 商品 -* @author xxm -* @date 2021/8/10 -*/ -@Mapper -public interface GoodsMapper extends BaseMapper { - Optional findByIdAndTid(Long id, Long tid); - - List findAllByTid(Long tid); - - List findAllByCidAndTid(Long cid, Long tid); - - List findAllByIdInAndTid(Collection goodsIds, Long tid); -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/entity/Goods.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/entity/Goods.java deleted file mode 100644 index 62aa185984b1667a724e364c523773a8afcec185..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/entity/Goods.java +++ /dev/null @@ -1,61 +0,0 @@ -package cn.bootx.goods.core.goods.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.goods.core.goods.convert.GoodsConvert; -import cn.bootx.goods.dto.goods.GoodsDto; -import cn.bootx.goods.param.goods.GoodsParam; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.math.BigDecimal; - -/** -* 商品表 -* @author xxm -* @date 2020/11/19 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("goods_goods") -public class Goods extends MpBaseEntity implements EntityBaseFunction { - - /** 所属类目id */ - private Long cid; - - /** 所属类目名称 */ - private String cname; - - /** 商品名称 */ - private String name; - - /** 描述*/ - private String remark; - - /** banner图片 多个图片逗号分隔 */ - private String bannerUri; - - /** 商品介绍主图 多个图片逗号分隔 */ - private String mainUri; - - /** 显示上限价格 */ - private BigDecimal displayUpperPrice; - - /** 显示下限价格 */ - private BigDecimal displayLowerPrice; - - /** 状态(1:可用,0:不可用) */ - private int state; - - public static Goods init(GoodsParam in){ - return GoodsConvert.CONVERT.convert(in); - } - - @Override - public GoodsDto toDto() { - return GoodsConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/entity/GoodsGallery.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/entity/GoodsGallery.java deleted file mode 100644 index b3c92a27fb5b4a67fbc878005df61f80ea18e3a9..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/entity/GoodsGallery.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.bootx.goods.core.goods.entity; - -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 商品相册 -* @author xxm -* @date 2022/5/9 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("goods_goods_gallery") -public class GoodsGallery extends MpBaseEntity { - - /** 商品id */ - private Long goodsId; - - /** 缩略图 */ - private String thumbnail; - - /** 小图 */ - private String small; - - /** 原图 */ - private String original; - - /** 是否主图 */ - private Boolean main; - - /** 排序 */ - private Double sortNo; -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/entity/GoodsWords.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/entity/GoodsWords.java deleted file mode 100644 index 5934e84895c209a473f937f7c33924e3f8969ade..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/entity/GoodsWords.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.bootx.goods.core.goods.entity; - -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.experimental.Accessors; - -/** -* 商品关键字 -* @author xxm -* @date 2022/5/9 -*/ -@Data -@Accessors(chain = true) -@TableName("goods_goods_words") -public class GoodsWords { -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/service/GoodsService.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/service/GoodsService.java deleted file mode 100644 index 15815168c6957e5d44afca8e28b4f7f922d8d7f4..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/service/GoodsService.java +++ /dev/null @@ -1,82 +0,0 @@ -package cn.bootx.goods.core.goods.service; - -import cn.bootx.common.core.exception.DataNotExistException; -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.core.util.ResultConvertUtil; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.goods.core.goods.dao.GoodsManager; -import cn.bootx.goods.core.goods.entity.Goods; -import cn.bootx.goods.core.sku.dao.GoodsSkuManager; -import cn.bootx.goods.dto.goods.GoodsDto; -import cn.bootx.goods.dto.sku.GoodsSkuDto; -import cn.bootx.goods.param.goods.GoodsParam; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Objects; - -/** - * - * @author xxm - * @date 2020/11/20 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class GoodsService { - private final GoodsManager goodsManager; - private final GoodsSkuManager goodsSkuManager; - - /** - * 新增商品 - */ - public GoodsDto add(GoodsParam goodsParam){ - Goods goods = Goods.init(goodsParam); - return goodsManager.save(goods).toDto(); - } - - /** - * 查询全部 - */ - public List findAll(){ - return ResultConvertUtil.dtoListConvert(goodsManager.findAll()); - } - - /** - * 分页 - */ - public PageResult page(PageParam param,GoodsParam query){ - return MpUtil.convert2DtoPageResult(goodsManager.page(param,query)); - } - - /** - * 查询商品详情 - */ - public GoodsDto getDetails(Long goodsId){ - GoodsDto goodsDto = goodsManager.findById(goodsId).map(Goods::toDto).orElseThrow(DataNotExistException::new); - if (Objects.nonNull(goodsDto)){ - // 查询sku - List goodsSkus = ResultConvertUtil.dtoListConvert(goodsSkuManager.findByGoodsId(goodsId)); - goodsDto.setSkus(goodsSkus); - } - return goodsDto; - } - - - /** - * 获取商品信息 - */ - public GoodsDto findById(Long goodsId){ - return goodsManager.findById(goodsId).map(Goods::toDto).orElseThrow(DataNotExistException::new); - } - - /** - * 按照类目查询商品 - */ - public List findByCategory(Long cid){ - return ResultConvertUtil.dtoListConvert(goodsManager.findByCid(cid)); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/dao/InventoryMapper.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/dao/InventoryMapper.java deleted file mode 100644 index 7ad5d3b580a2f62f99c73cc063387ceb8ce3783d..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/dao/InventoryMapper.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.bootx.goods.core.inventory.dao; - -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Param; - -/** -* 库存操作 数据库 -* @author xxm -* @date 2020/11/23 -*/ -@Mapper -public interface InventoryMapper { - - /** - * 锁定库存 - */ - int lockInventory(@Param("id") Long id, @Param("count") int count); - - /** - * 解锁库存 - */ - int unlockInventory(@Param("id") Long id, @Param("count") int count); - - /** - * 减少库存 - */ - int reduceInventory(@Param("id") Long id, @Param("count") int count); - - /** - * 增补指定 SKU 的可售库存, 扣减对应售出 - */ - int increaseInventory(@Param("id") Long id, @Param("count") int count); - - /** - * 增补指定 SKU 的可售库存 - */ - int increaseAvailable(@Param("id") Long id, @Param("count") int count); - - /** - * 扣减指定 SKU 的预占库存并减少总库存 - */ - int reduceLockedAndCapacity(@Param("id") Long id, @Param("count") int count); - - /** - * 扣减指定 SKU 的售出库存并减少总库存 - */ - int reduceSoldAndCapacity(@Param("id") Long id, @Param("count") int count); -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/dao/InventoryTokenExpiredTimeRepository.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/dao/InventoryTokenExpiredTimeRepository.java deleted file mode 100644 index 522b85b67be5be4bff551dcb50056d5377af6444..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/dao/InventoryTokenExpiredTimeRepository.java +++ /dev/null @@ -1,46 +0,0 @@ -package cn.bootx.goods.core.inventory.dao; - -import cn.bootx.common.redis.RedisClient; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.Set; - -/** - * 用于对库存操作 token 过期时间的管理 - * 在 Redis 中每一个 token 对应的键 sku:lock:{skuId}:{token} - * 都存储在有序集合 sku:lock:expiredtime 里,有序集合的 score 为各 token 的过期时间。 - * @author xxm - * @date 2020/11/23 - */ -@Component -@RequiredArgsConstructor -public class InventoryTokenExpiredTimeRepository { - - private static final String KEY = "sku:lock:expiredtime"; - - private final RedisClient redisClient; - - /** - * 根据 token 存储对应的 ExpiredTokenKey - */ - public void store(String key, long expiredTime) { - redisClient.zadd(KEY, key, expiredTime); - } - - /** - * 获取所有已过期的ExpiredTokenKey - */ - public Set retrieveExpiredKeys(long deadline) { - return redisClient.zrangeByScore(KEY, 0L, deadline); - } - - /** - * 删除指定的ExpiredTokenKey - */ - public void removeKeys(String... keys) { - if (keys != null && keys.length > 0) { - redisClient.zremByMembers(KEY, keys); - } - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/dao/InventoryTokenRepository.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/dao/InventoryTokenRepository.java deleted file mode 100644 index ae362addbf7620a4475a9e290e5e4e1df2763af8..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/dao/InventoryTokenRepository.java +++ /dev/null @@ -1,126 +0,0 @@ -package cn.bootx.goods.core.inventory.dao; - -import cn.bootx.common.redis.RedisClient; -import cn.hutool.core.collection.CollectionUtil; -import cn.hutool.core.util.StrUtil; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.stream.Collectors; - -/** - * 用于对库存操作 token 的存取管理 - * 在 Redis 中每一个 token 对应一个键为 sku:lock:{skuId}:{token} 的字符串,值为预占库存数。 - * @author xxm - * @date 2020/11/23 - */ -@Component -@RequiredArgsConstructor -public class InventoryTokenRepository { - - private static final String SPLITTER = ":"; - - private static final String KEY_PREFIX = "sku" + SPLITTER + "lock" + SPLITTER; - - private final RedisClient redisClient; - - /** - * 根据 token 存储对应的库存数,返回 token 对应的 Redis 键 - */ - public String storeByToken(Long skuId, String token, int count) { - String key = buildKey(skuId, token); - redisClient.set(key, String.valueOf(count)); - return key; - } - - /** - * 根据 token 获取对应的库存数 - */ - public int retrieveByToken(Long skuId, String token) { - String key = buildKey(skuId, token); - String value = redisClient.get(key); - return StrUtil.isEmpty(value) ? 0 : Integer.parseInt(value); - } - - /** - * 移除 token 相关信息 - */ - public void removeByToken(Long skuId, String token) { - String key = buildKey(skuId, token); - redisClient.deleteKey(key); - } - - /** - * 根据 token 对应的 key 进行处理,对相同 sku 的预占库存数进行合计 - * - * @return Map,key 为 skuId,value 为(预占库存总数和相关 token 列表)对象 - */ - public Map extractSkuIdCountMap(List keys) { - Map skuIdCountMap = new HashMap<>(keys.size()); - if (!CollectionUtil.isEmpty(keys)) { - Set skuIdSet = extractSkuIds(keys); - // 先批量取回所有 key 的值,值的顺序与 keys 的顺序是一致的 - List countList = redisClient.get(keys); - - for (String skuId : skuIdSet) { - int count = 0; - List keyList = new ArrayList<>(keys.size()); - - for (int i = 0; i < keys.size(); i++) { - String key = keys.get(i); - if (key.contains(skuId)) { - String value = countList.get(i); - count += (value == null ? 0 : Integer.parseInt(value)); - keyList.add(key); - } - } - - skuIdCountMap.put(skuId, new KeysCountPair(count, keyList)); - } - } - return skuIdCountMap; - } - - /** - * 按键计数对 - */ - @Getter - @AllArgsConstructor - public static class KeysCountPair { - /** 数量 */ - private final int count; - /** 预占库存key */ - private final List keys; - } - - /** - * 提取skuIds - */ - private Set extractSkuIds(Collection keys) { - return keys.stream().map(this::extractSkuId).collect(Collectors.toSet()); - } - - /** - * 提取SkuId - */ - private String extractSkuId(String key) { - return key.split(SPLITTER)[2]; - } - - /** - * 移除指定的 key - */ - public void removeByKeys(Collection keys) { - redisClient.deleteKeys(keys); - } - - /** - * 构建key - */ - public String buildKey(Long skuId, String token) { - return KEY_PREFIX + skuId + SPLITTER + token; - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/handler/PackedInventoryHandler.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/handler/PackedInventoryHandler.java deleted file mode 100644 index d146c6e323de0f2847822596fd4b0fef3ddc40dd..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/handler/PackedInventoryHandler.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bootx.goods.core.inventory.handler; - -/** -* 被打包商品库存处理器 -* @author xxm -* @date 2021/2/7 -*/ -@FunctionalInterface -public interface PackedInventoryHandler { - - /** - * 处理函数 - */ - void handle(Long skuId, int count); -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/manager/InventoryManager.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/manager/InventoryManager.java deleted file mode 100644 index c4e9f760211784cb06a347316799ec037bd67fef..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/manager/InventoryManager.java +++ /dev/null @@ -1,104 +0,0 @@ -package cn.bootx.goods.core.inventory.manager; - -import cn.bootx.goods.core.inventory.dao.InventoryMapper; -import cn.bootx.goods.exception.inventory.InventoryInsufficientException; -import cn.bootx.goods.exception.inventory.InventoryLockInsufficientException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; -import org.springframework.transaction.annotation.Transactional; - -/** -* 库存操作 -* @author xxm -* @date 2020/11/22 -*/ -@Slf4j -@Repository -@RequiredArgsConstructor -public class InventoryManager { - private final InventoryMapper inventoryMapper; - - /** - * 锁定库存 - */ - @Transactional(rollbackFor = Exception.class) - public void lockInventory(Long skuId, int count) { - int rows = inventoryMapper.lockInventory(skuId, count); - if (rows < 1) { - log.warn("库存操作,skuId:"+ skuId + ",库存不足,count:" + count); - throw new InventoryInsufficientException(); - } - log.info("库存操作,skuId:"+ skuId + ",正常锁定,count:" + count); - } - - /** - * 解锁库存 - */ - @Transactional(rollbackFor = Exception.class) - public void unlockInventory(Long skuId, int count) { - int rows = inventoryMapper.unlockInventory(skuId, count); - if (rows < 1) { - log.warn("库存操作,skuId:"+ skuId + ",解锁库存不足,count:" + count); - throw new InventoryLockInsufficientException(); - } - log.info("库存操作,skuId:"+ skuId + ",库存正常解锁,count:" + count); - } - - /** - * 减少库存 - */ - @Transactional(rollbackFor = Exception.class) - public void reduceInventory(Long skuId, int count) { - int rows = inventoryMapper.reduceInventory(skuId, count); - if (rows < 1) { - log.warn("库存操作,skuId:"+ skuId + ",库存不足,count:" + count); - throw new InventoryLockInsufficientException(); - } - log.info("库存操作,skuId:"+ skuId + ",库存正常扣除,count:" + count); - } - - /** - * 增补指定 SKU 的可售库存, 扣减对应售出 - */ - @Transactional(rollbackFor = Exception.class) - public void increaseInventory(Long skuId, int amount) { - inventoryMapper.increaseInventory(skuId, amount); - log.info("库存操作,skuId:"+ skuId + ",increaseInventory,count:" + amount); - } - - /** - * 增补指定 SKU 的可售库存 - */ - @Transactional(rollbackFor = Exception.class) - public void increaseAvailable(Long skuId, int amount) { - inventoryMapper.increaseAvailable(skuId, amount); - log.info("库存操作,skuId:"+ skuId + ",increaseAvailable,count:" + amount); - } - - /** - * 扣减指定 SKU 的预占库存并减少总库存 - */ - @Transactional(rollbackFor = Exception.class) - public void reduceLockedAndCapacity(Long skuId, int amount) { - int rows = inventoryMapper.reduceLockedAndCapacity(skuId, amount); - if (rows < 1) { - log.warn("库存操作,skuId:"+ skuId + ",扣减库存总数库存不足,count:" + amount); - throw new InventoryLockInsufficientException(); - } - log.info("库存操作,skuId:"+ skuId + ",扣减库存总数正常扣除,count:" + amount); - } - - /** - * 扣减指定 SKU 的售出库存并减少总库存 - */ - @Transactional(rollbackFor = Exception.class) - public void reduceSoldAndCapacity(Long skuId, int amount) { - int rows = inventoryMapper.reduceSoldAndCapacity(skuId, amount); - if (rows < 1) { - log.warn("库存操作,skuId:"+ skuId + ",扣减库存总数和sold库存不足,count:" + amount); - throw new InventoryInsufficientException(); - } - log.info("库存操作,skuId:"+ skuId + ",扣减库存总数和sold正常扣除,count:" + amount); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/manager/InventoryTokenContainer.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/manager/InventoryTokenContainer.java deleted file mode 100644 index 39e7ec46ac6e60eb4e662b79973cf435930c2fcc..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/manager/InventoryTokenContainer.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.bootx.goods.core.inventory.manager; - -import cn.bootx.goods.exception.inventory.InventoryLockInsufficientException; -import cn.hutool.core.util.RandomUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -/** -* 库存操作 Token 容器 -* @author xxm -* @date 2020/11/23 -*/ -@Slf4j -@Component -@RequiredArgsConstructor -public class InventoryTokenContainer{ - - private final InventoryTokenManager manager; - - /** - * 获取锁定库存操作 token - */ - public String saveAndGetToken(Long skuId,int count) { - String token = RandomUtil.randomString(6); - // 锁定并存储过期时间 - manager.storeByToken(skuId, token, count); - return token; - } - - /** - * 消耗指定 token 锁定的库存 - */ - public void consumeInventory(Long skuId, int count, String token) { - int inventory = manager.retrieveByToken(skuId, token); - // 库存锁定不足异常 - if (inventory < count) { - throw new InventoryLockInsufficientException(); - } - int remain = inventory - count; - if (remain > 0) { - // 重新设置库存锁定数 - manager.resetByToken(skuId, token, remain); - } else { - // 删除库存锁定和过期时间key值 - manager.removeByToken(skuId, token); - manager.removeExpiredTimeTokenKey(skuId,token); - } - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/manager/InventoryTokenManager.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/manager/InventoryTokenManager.java deleted file mode 100644 index f4baeeaa0e9f1943f7ea857d44aa79d31f4bd0b3..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/manager/InventoryTokenManager.java +++ /dev/null @@ -1,99 +0,0 @@ -package cn.bootx.goods.core.inventory.manager; - -import cn.bootx.goods.code.GoodsCode; -import cn.bootx.goods.core.inventory.dao.InventoryTokenExpiredTimeRepository; -import cn.bootx.goods.core.inventory.dao.InventoryTokenRepository; -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Map; -import java.util.Set; - -/** - * 库存操作 Token 管理器 - * @author xxm - * @date 2020/11/23 - */ -@Component -@RequiredArgsConstructor -public class InventoryTokenManager { - - private final InventoryTokenRepository tokenRepository; - private final InventoryTokenExpiredTimeRepository expiredTimeRepository; - - /** - * 通过token存储预占库存数 - */ - public void storeByToken(Long skuId, String token, int count) { - // 存储预占库存数量 - String key = tokenRepository.storeByToken(skuId, token, count); - // 过期时间 - long expiredTime = this.calculateExpiredTime(); - expiredTimeRepository.store(key, expiredTime); - } - - /** - * 通过token检索预占库存数 - */ - public int retrieveByToken(Long skuId, String token) { - return tokenRepository.retrieveByToken(skuId, token); - } - - /** - * 通过token重新设置预占库存数 - */ - public void resetByToken(Long skuId, String token, int count) { - tokenRepository.storeByToken(skuId, token, count); - } - - /** - * 通过token删除预占库存数 - */ - public void removeByToken(Long skuId, String token) { - tokenRepository.removeByToken(skuId, token); - } - - /** - * 计算过期时间 - */ - private long calculateExpiredTime() { - return System.currentTimeMillis() + GoodsCode.INVENTORY_TOKEN_EXPIRED_TIME; - } - - /** - * 返回所有已过期的 预占库存数 token - */ - public Set retrieveExpiredTokenKeys() { - long deadline = System.currentTimeMillis(); - return expiredTimeRepository.retrieveExpiredKeys(deadline); - } - - /** - * 根据 token 对应的 key,抽取 skuId,并合计其预占的库存总数,形成 map - */ - public Map extractSkuIdCountMap(Set keys) { - return tokenRepository.extractSkuIdCountMap(new ArrayList<>(keys)); - } - - /** - * 通过token删除 预占库存过期时间信息 - */ - public void removeExpiredTimeTokenKey(Long skuId, String token) { - expiredTimeRepository.removeKeys(tokenRepository.buildKey(skuId,token)); - } - - /** - * 根据 token 删除对应的 预占库存过期时间信息 - */ - public void removeExpiredTokenKeys(Collection keys) { - if (!CollUtil.isEmpty(keys)) { - // 删除过期的 key - tokenRepository.removeByKeys(keys); - // 删除过期表中的数据 - expiredTimeRepository.removeKeys(keys.toArray(new String[0])); - } - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/service/InventoryService.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/service/InventoryService.java deleted file mode 100644 index 4f6690ebf5ec35e53f8cefd9c4114ae70ea88284..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/service/InventoryService.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.bootx.goods.core.inventory.service; - -import cn.bootx.goods.core.inventory.manager.InventoryManager; -import cn.bootx.goods.core.sku.dao.GoodsSkuManager; -import cn.bootx.goods.core.sku.entity.GoodsSku; -import cn.bootx.goods.exception.inventory.InventoryNotFoundException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -/** - * 库存服务 - * @author xxm - * @date 2020/11/21 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class InventoryService { - private final GoodsSkuManager skuManager; - private final InventoryManager inventoryManager; - - /** - * 获取指定 SKU 的可用库存 - */ - public Integer getAvailable(Long skuId){ - GoodsSku sku = skuManager.findById(skuId).orElseThrow(InventoryNotFoundException::new); - return sku.getAvailable(); - } - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/service/OperateInventoryService.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/service/OperateInventoryService.java deleted file mode 100644 index 89ead833a425e62cd2b29bd9f6cb31f0acba0b65..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/inventory/service/OperateInventoryService.java +++ /dev/null @@ -1,116 +0,0 @@ -package cn.bootx.goods.core.inventory.service; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.goods.core.inventory.manager.InventoryManager; -import cn.bootx.goods.core.inventory.manager.InventoryTokenContainer; -import cn.bootx.goods.core.sku.dao.GoodsSkuManager; -import cn.bootx.goods.core.sku.entity.GoodsSku; -import cn.bootx.goods.dto.inventory.LockInventoryDto; -import cn.bootx.goods.exception.inventory.InventoryNotFoundException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -/** - * 库存操作 - * @author xxm - * @date 2021/2/7 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class OperateInventoryService { - private final InventoryTokenContainer tokenContainer; - - private final GoodsSkuManager skuManager; - private final InventoryManager inventoryManager; - - /** - * 预占指定 SKU 的库存,返回授权码,需要在调用释放或扣减库存API时使用 - */ - @Transactional(rollbackFor = Exception.class) - public LockInventoryDto lockInventory(Long skuId, int count) { - if (count < 1){ - throw new BizException("要锁定的库存不得小于1"); - } - - LockInventoryDto result = new LockInventoryDto(); - result.setCount(count); - GoodsSku sku = skuManager.findById(skuId).orElseThrow(InventoryNotFoundException::new); - - inventoryManager.lockInventory(skuId, count); - - result.setStartIndex(sku.getLocked() + sku.getSold() + 1); - // 记录锁定数和过期时间 - result.setToken(tokenContainer.saveAndGetToken(skuId, count)); - return result; - } - - /** - * 释放指定的 SKU 的库存,需要使用预占库存时分配的 token - */ - @Transactional(rollbackFor = Exception.class) - public void unlockInventory(Long skuId, int count, String token) { - // 解锁库存 - this.unlockInventoryWithoutToken(skuId, count); - tokenContainer.consumeInventory(skuId, count, token); - } - - /** - * 解锁没有令牌的库存 - */ - @Transactional(rollbackFor = Exception.class) - public void unlockInventoryWithoutToken(Long skuId, int count) { - skuManager.findById(skuId).orElseThrow(InventoryNotFoundException::new); - // 自身处理 - inventoryManager.unlockInventory(skuId, count); - } - - /** - * 扣减指定的 SKU 的库存,需要使用预占库存时分配的 token - */ - @Transactional(rollbackFor = Exception.class) - public void reduceInventory(Long skuId, int count, String token) { - skuManager.findById(skuId).orElseThrow(InventoryNotFoundException::new); - inventoryManager.reduceInventory(skuId, count); - tokenContainer.consumeInventory(skuId, count, token); - } - - /** - * 增补指定 SKU 的可售库存, 扣减对应售出 - */ - @Transactional(rollbackFor = Exception.class) - public void increaseInventory(Long skuId, int count) { - skuManager.findById(skuId).orElseThrow(InventoryNotFoundException::new); - inventoryManager.increaseInventory(skuId, count); - } - - /** - * 增补指定 SKU 的可售库存 - */ - @Transactional(rollbackFor = Exception.class) - public void increaseAvailable(Long skuId, int count) { - skuManager.findById(skuId).orElseThrow(InventoryNotFoundException::new); - inventoryManager.increaseAvailable(skuId, count); - } - - /** - * 扣减指定 SKU 的预占库存并减少总库存 - */ - @Transactional(rollbackFor = Exception.class) - public void reduceLockedAndCapacity(Long skuId, int count, String token) { - skuManager.findById(skuId).orElseThrow(InventoryNotFoundException::new); - tokenContainer.consumeInventory(skuId, count, token); - inventoryManager.reduceLockedAndCapacity(skuId, count); - } - - /** - * 扣减指定 SKU 的售出库存并减少总库存 - */ - @Transactional(rollbackFor = Exception.class) - public void reduceSoldAndCapacity(Long skuId, int count) { - skuManager.findById(skuId).orElseThrow(InventoryNotFoundException::new); - inventoryManager.reduceSoldAndCapacity(skuId, count); - } -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/convert/SkuConvert.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/convert/SkuConvert.java deleted file mode 100644 index 20b75104691faed9f8291a0054d8e138a5c970e1..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/convert/SkuConvert.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.bootx.goods.core.sku.convert; - -import cn.bootx.goods.core.sku.entity.GoodsSku; -import cn.bootx.goods.dto.sku.GoodsSkuDto; -import cn.bootx.goods.param.sku.SkuParam; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -/** -* 转换 -* @author xxm -* @date 2021/7/23 -*/ -@Mapper -public interface SkuConvert { - SkuConvert CONVERT = Mappers.getMapper(SkuConvert.class); - - GoodsSku convert(SkuParam in); - - GoodsSku convert(GoodsSkuDto in); - - GoodsSkuDto convert(GoodsSku in); -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/dao/GoodsSkuManager.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/dao/GoodsSkuManager.java deleted file mode 100644 index 3c325c9e917b6e0703ff9eb115150297745aa4b5..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/dao/GoodsSkuManager.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.bootx.goods.core.sku.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.goods.core.sku.entity.GoodsSku; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** -* 商品sku -* @author xxm -* @date 2020/11/20 -*/ -@Repository -@RequiredArgsConstructor -public class GoodsSkuManager extends BaseManager { - - - public List findByGoodsId(Long goodsId) { - return findAllByField(GoodsSku::getGoodsId,goodsId); - } - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/dao/GoodsSkuMapper.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/dao/GoodsSkuMapper.java deleted file mode 100644 index b2033b9acacd908d4359ffffc5d5bf040ec02a51..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/dao/GoodsSkuMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.goods.core.sku.dao; - -import cn.bootx.goods.core.sku.entity.GoodsSku; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** -* 商品sku -* @author xxm -* @date 2021/8/10 -*/ -@Mapper -public interface GoodsSkuMapper extends BaseMapper { -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/entity/GoodsSku.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/entity/GoodsSku.java deleted file mode 100644 index 66c20e466295580794efe77fc97b37cfd5ec1997..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/entity/GoodsSku.java +++ /dev/null @@ -1,72 +0,0 @@ -package cn.bootx.goods.core.sku.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.goods.core.sku.convert.SkuConvert; -import cn.bootx.goods.dto.sku.GoodsSkuDto; -import cn.bootx.goods.param.sku.SkuParam; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.math.BigDecimal; - -/** - * 商品 SKU - * @author xxm - * @date 2020/11/19 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("goods_goods_sku") -public class GoodsSku extends MpBaseEntity implements EntityBaseFunction { - - /** 所属类目id */ - private Long cid; - /** 商品 id */ - private Long goodsId; - /** 外部编码 */ - private String outNo; - /** SKU 名称 */ - private String name; - /** 描述 */ - private String description; - /** 附加信息 */ - private String addition; - - /** 是否无限库存 */ - @TableField("is_unlimited") - private boolean unlimited; - - /** 初始库存 */ - private Integer capacity; - /** 预占库存 */ - private int locked; - /** 已用库存 */ - private int sold; - /** 可用库存 */ - private Integer available; - - /** 价格 */ - private BigDecimal price; - - /** 状态 */ - private int state; - - public static GoodsSku init(GoodsSkuDto in) { - return SkuConvert.CONVERT.convert(in); - } - - public static GoodsSku init(SkuParam in) { - return SkuConvert.CONVERT.convert(in); - } - - @Override - public GoodsSkuDto toDto() { - return SkuConvert.CONVERT.convert(this); - } - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/service/GoodsSkuService.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/service/GoodsSkuService.java deleted file mode 100644 index 050dc4e6de2a1229d0f5fb4ea2ed3ae905c1f9f2..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/sku/service/GoodsSkuService.java +++ /dev/null @@ -1,64 +0,0 @@ -package cn.bootx.goods.core.sku.service; - -import cn.bootx.common.core.util.ResultConvertUtil; -import cn.bootx.goods.core.sku.dao.GoodsSkuManager; -import cn.bootx.goods.core.sku.entity.GoodsSku; -import cn.bootx.goods.dto.sku.GoodsSkuDto; -import cn.bootx.goods.exception.sku.SkuNotFoundException; -import cn.bootx.goods.param.sku.SkuParam; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * sku管理 - * @author xxm - * @date 2020/11/20 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class GoodsSkuService { - private final GoodsSkuManager skuManager; - - - /** - * 添加sku - */ - public GoodsSkuDto add(SkuParam skuParam){ - GoodsSku goodsSku = GoodsSku.init(skuParam); - - // 无限库存 - if (goodsSku.isUnlimited()){ - goodsSku.setAvailable(999999999) - .setCapacity(999999999); - } - return skuManager.save(goodsSku).toDto(); - } - - - /** - * 根据 id 获取相应的商品SKU - */ - public GoodsSkuDto getById(Long id) { - GoodsSku goodsSku = skuManager.findById(id).orElseThrow(SkuNotFoundException::new); - return goodsSku.toDto(); - } - - /** - * 根据goodsId查询 - */ - public List findByGoodsId(Long goodsId){ - return ResultConvertUtil.dtoListConvert(skuManager.findByGoodsId(goodsId)); - } - - /** - * 批量查询sku - */ - public List findBySkuIds(List skuIds){ - return ResultConvertUtil.dtoListConvert(skuManager.findAllByIds(skuIds)); - } - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryDto.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryDto.java deleted file mode 100644 index 6c7eb9ca75df34d3ebc205917556eb9a19397ecd..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryDto.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.bootx.goods.dto.category; - -import cn.bootx.common.core.rest.dto.BaseDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2020/11/19 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@Schema(title = "类目DTO") -public class CategoryDto extends BaseDto implements Serializable { - private static final long serialVersionUID = -6395120064541083702L; - - @Schema(description="上级类目id") - private Long pid; - - @Schema(description="类目名称", required = true) - private String name; - - @Schema(description="类目描述") - private String remark; - - @Schema(description="是否启用") - private Boolean enable; - - @Schema(description="排序,默认0") - private Double sortNo; - - @Schema(description= "层级") - private Integer level; - - @Schema(description= " 图标/图片地址") - private String image; - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryParameterDto.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryParameterDto.java deleted file mode 100644 index f8be6d9b52b210dfe7dd6e5b2bf1f39b332e2735..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryParameterDto.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.bootx.goods.dto.category; - -import cn.bootx.common.core.rest.dto.BaseDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.ArrayList; -import java.util.List; - -/** - * 类目参数 - * @author xxm - * @date 2022-05-09 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Schema(title = "类目参数") -@Accessors(chain = true) -public class CategoryParameterDto extends BaseDto { - - @Schema(description = "品牌名称") - private String name; - @Schema(description = "类型") - private String type; - @Schema(description = "选择值(列表)") - private List options = new ArrayList<>(); - @Schema(description = "是否必填") - private Boolean required; - @Schema(description = "排序") - private Double sortNo; - @Schema(description = "参数组id") - private Long groupId; - @Schema(description = "类目id") - private Long categoryId; - @Schema(description = "描述") - private String remark; - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryParameterGroupDto.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryParameterGroupDto.java deleted file mode 100644 index 8701c87698d7b9536d89d2f40c34c93f2c632ec5..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryParameterGroupDto.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.bootx.goods.dto.category; - -import cn.bootx.common.core.rest.dto.BaseDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 类目参数组 - * @author xxm - * @date 2022-05-09 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Schema(title = "类目参数组") -@Accessors(chain = true) -public class CategoryParameterGroupDto extends BaseDto { - - @Schema(description = "参数组名称") - private String name; - @Schema(description = "排序") - private Double sortNo; - @Schema(description = "类目id") - private Long categoryId; - @Schema(description = "描述") - private String remark; - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryTreeNode.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryTreeNode.java deleted file mode 100644 index c45cc44c186ddb584495b65fdd822854ad617e97..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/CategoryTreeNode.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.bootx.goods.dto.category; - -import cn.bootx.goods.core.category.entity.Category; -import cn.hutool.core.bean.BeanUtil; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** -* 类目树节点 -* @author xxm -* @date 2020/11/20 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "类目树节点") -@NoArgsConstructor -public class CategoryTreeNode implements Serializable { - - private static final long serialVersionUID = -1587023420309803676L; - - @Schema(description="主键") - private Long id; - - @Schema(description="类目名称") - private String name; - - @Schema(description="类目描述") - private String remark; - - @Schema(description="排序,默认0") - private Double sortNo; - - @Schema(description="是否启用") - private Boolean enable; - - @Schema(description= "层级") - private Integer level; - - @Schema(description= " 图标/图片地址") - private String image; - - @Schema(description="子节点列表") - private List children; - - public CategoryTreeNode(Category category) { - BeanUtil.copyProperties(category,this); - } -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/SpecificationDto.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/SpecificationDto.java deleted file mode 100644 index f6f75c41dfa84a29a4e0300b58d1c81d4e1df16b..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/SpecificationDto.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.bootx.goods.dto.category; - -import cn.bootx.common.core.rest.dto.BaseDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.util.ArrayList; -import java.util.List; - -/** - * 规格 - * @author xxm - * @date 2022-05-09 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Schema(title = "规格") -@Accessors(chain = true) -public class SpecificationDto extends BaseDto { - - @Schema(description = "规格名称") - private String name; - @Schema(description = "类型") - private String type; - @Schema(description = "列表选择值") - private List options = new ArrayList<>(); - @Schema(description = "状态") - private String state; - @Schema(description = "描述") - private String remark; - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/goods/GoodsDto.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/goods/GoodsDto.java deleted file mode 100644 index 178f5925e3626e699f737bfdd9576cd916291140..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/goods/GoodsDto.java +++ /dev/null @@ -1,51 +0,0 @@ -package cn.bootx.goods.dto.goods; - -import cn.bootx.common.core.rest.dto.BaseDto; -import cn.bootx.goods.dto.sku.GoodsSkuDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** -* @author xxm -* @date 2020/11/20 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@Schema(title = "商品DTO") -public class GoodsDto extends BaseDto implements Serializable { - private static final long serialVersionUID = 9191023721658520976L; - - @Schema(description= "所属类目id", required = true) - private Long cid; - - @Schema(description= "所属类目名称(前端展示使用)") - private String cname; - - @Schema(description= "商品名称", required = true) - private String name; - - @Schema(description= "商品描述") - private String remark; - - /** banner图片 多个图片逗号分隔 */ - private String bannerUri; - - /** 商品介绍主图 多个图片逗号分隔 */ - private String mainUri; - - @Schema(description= "附加信息") - private String addition; - - @Schema(description= "状态(1:可用,0:不可用)") - private int state; - - @Schema(description= "关联sku") - private List skus; - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/inventory/LockInventoryDto.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/inventory/LockInventoryDto.java deleted file mode 100644 index 637d84942dce97d4f3b425cba088889c188fb2fb..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/inventory/LockInventoryDto.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.bootx.goods.dto.inventory; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2020/11/21 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "库存锁定") -public class LockInventoryDto implements Serializable { - private static final long serialVersionUID = 7373301471799658911L; - @Schema(description= "锁库存token") - private String token; - - @Schema(description= "锁定库存的起始顺序号") - private Integer startIndex; - - @Schema(description= "锁定总数") - private Integer count; - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/sku/GoodsSkuDto.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/sku/GoodsSkuDto.java deleted file mode 100644 index d59c87f7af3d5ade4b19558b4c179ade36bd0e85..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/sku/GoodsSkuDto.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.bootx.goods.dto.sku; - -import cn.bootx.common.core.rest.dto.BaseDto; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** -* 商品SKU -* @author xxm -* @date 2020/11/19 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@Schema(title = "商品SKU DTO") -public class GoodsSkuDto extends BaseDto implements Serializable { - private static final long serialVersionUID = 9214661437061650242L; - - @Schema(description= "主键") - private Long id; - @Schema(description= "所属类目id") - private Long cid; - @Schema(description= "所属商品id") - private Long goodsId; - @Schema(description= "SKU名称", required = true) - private String name; - @Schema(description= "SKU描述") - private String description; - @Schema(description= "附加信息") - private String addition; - - @Schema(description= "无限库存") - private boolean unlimited; - @Schema(description= "库存总量") - private Integer capacity; - @Schema(description= "预占库存") - private int locked; - @Schema(description= "已用库存") - private int sold; - @Schema(description= "可用库存") - private Integer available; - - @Schema(description= "售价") - private BigDecimal price; - @Schema(description= "状态") - private int state; -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/category/CategoryAlreadyExistedException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/category/CategoryAlreadyExistedException.java deleted file mode 100644 index 78985b242b0382cf2f15373bc3f7ec3435740821..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/category/CategoryAlreadyExistedException.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bootx.goods.exception.category; - - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.goods.code.GoodsErrorCode.CATEGORY_ALREADY_EXISTED; - -/** -* 已存在异常 -* @author xxm -* @date 2020/11/20 -*/ -public class CategoryAlreadyExistedException extends BizException { - public CategoryAlreadyExistedException() { - super(CATEGORY_ALREADY_EXISTED, "类别已经存在"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/category/CategoryAttrDefAlreadyExistedException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/category/CategoryAttrDefAlreadyExistedException.java deleted file mode 100644 index ad1434d8c6e2f1580c063881d578522dcc28e634..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/category/CategoryAttrDefAlreadyExistedException.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.bootx.goods.exception.category; - - -import cn.bootx.common.core.exception.BizException; - -import java.io.Serializable; - -import static cn.bootx.goods.code.GoodsErrorCode.CATEGORY_ATTR_DEF_ALREADY_EXISTED; - -/** -* 类别属性定义已存在 -* @author xxm -* @date 2020/11/22 -*/ -public class CategoryAttrDefAlreadyExistedException extends BizException implements Serializable { - public CategoryAttrDefAlreadyExistedException() { - super(CATEGORY_ATTR_DEF_ALREADY_EXISTED, "类别属性定义已存在"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/category/CategoryNotExistedException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/category/CategoryNotExistedException.java deleted file mode 100644 index 9d549127ed0eb27c960cff02d72c0e07ca1da9dc..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/category/CategoryNotExistedException.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.bootx.goods.exception.category; - - -import cn.bootx.common.core.exception.BizException; - -import java.io.Serializable; - -import static cn.bootx.goods.code.GoodsErrorCode.CATEGORY_NOT_EXISTED; - -/** -* Category 不存在异常 -* @author xxm -* @date 2020/11/20 -*/ -public class CategoryNotExistedException extends BizException implements Serializable { - public CategoryNotExistedException() { - super(CATEGORY_NOT_EXISTED, "类目不存在"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/goods/GoodsAlreadyExistedException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/goods/GoodsAlreadyExistedException.java deleted file mode 100644 index bc395478f9da8e533f239003b4e3393b5e91b0b2..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/goods/GoodsAlreadyExistedException.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bootx.goods.exception.goods; - - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.goods.code.GoodsErrorCode.GOODS_ALREADY_EXISTED; - -/** -* 商品已存在异常 -* @author xxm -* @date 2020/11/20 -*/ -public class GoodsAlreadyExistedException extends BizException { - public GoodsAlreadyExistedException() { - super(GOODS_ALREADY_EXISTED, "商品已经存在"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/goods/GoodsNotOnException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/goods/GoodsNotOnException.java deleted file mode 100644 index 98473f6c7e1811ff6a909985ff14b006cb92f4ec..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/goods/GoodsNotOnException.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.bootx.goods.exception.goods; - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.goods.code.GoodsErrorCode.GOODS_NOT_EXISTED; - -/** -* -* @author xxm -* @date 2020/12/10 -*/ -public class GoodsNotOnException extends BizException { - public GoodsNotOnException() { - super(GOODS_NOT_EXISTED, "商品不存在"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/InventoryInsufficientException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/InventoryInsufficientException.java deleted file mode 100644 index 4ed567c2988228de19d181c2205adbb55d282823..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/InventoryInsufficientException.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bootx.goods.exception.inventory; - - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.goods.code.GoodsErrorCode.INVENTORY_INSUFFICIENT; - -/** -* 库存不足异常 -* @author xxm -* @date 2020/11/23 -*/ -public class InventoryInsufficientException extends BizException { - public InventoryInsufficientException() { - super(INVENTORY_INSUFFICIENT, "库存不足异常"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/InventoryLockInsufficientException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/InventoryLockInsufficientException.java deleted file mode 100644 index 6d85f212d79483d258894b3ab6eee2ddd1924b48..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/InventoryLockInsufficientException.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bootx.goods.exception.inventory; - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.goods.code.GoodsErrorCode.INVENTORY_LOCK_INSUFFICIENT; - - -/** -* 预占的库存不足异常 -* @author xxm -* @date 2020/11/23 -*/ -public class InventoryLockInsufficientException extends BizException { - public InventoryLockInsufficientException() { - super(INVENTORY_LOCK_INSUFFICIENT, "预占的库存不足异常"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/InventoryNotFoundException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/InventoryNotFoundException.java deleted file mode 100644 index 36fa0af55c372c48e4fa91998da49969770cc6af..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/InventoryNotFoundException.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.bootx.goods.exception.inventory; - - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.goods.code.GoodsErrorCode.INVENTORY_NOT_FOUND; - - -/** -* 库存未找到异常 -* @author xxm -* @date 2020/11/22 -*/ -public class InventoryNotFoundException extends BizException { - public InventoryNotFoundException() { - super(INVENTORY_NOT_FOUND, "找不到库存"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/TokenOutOfDateException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/TokenOutOfDateException.java deleted file mode 100644 index d9dcf58b173125b9e097595b736359559eaa4927..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/inventory/TokenOutOfDateException.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.bootx.goods.exception.inventory; - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.goods.code.GoodsErrorCode.TOKEN_OUT_OF_DADE; - -/** -* 库存Token已过期 -* @author xxm -* @date 2020/11/23 -*/ -public class TokenOutOfDateException extends BizException { - public TokenOutOfDateException() { - super(TOKEN_OUT_OF_DADE, "库存Token已过期"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/sku/SkuAlreadyOffException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/sku/SkuAlreadyOffException.java deleted file mode 100644 index fd4afcd7af375ebf95852703dae4537ed1cee474..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/sku/SkuAlreadyOffException.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bootx.goods.exception.sku; - - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.goods.code.GoodsErrorCode.GOODS_SKU_ALREADY_OFF; - -/** -* 商品 SKU 已下架异常 -* @author xxm -* @date 2020/11/24 -*/ -public class SkuAlreadyOffException extends BizException { - public SkuAlreadyOffException() { - super(GOODS_SKU_ALREADY_OFF, "商品 SKU 已下架异常"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/sku/SkuNotFoundException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/sku/SkuNotFoundException.java deleted file mode 100644 index 74cf2d3c825bfcdcaa66ddfde96f63b559cad5ed..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/sku/SkuNotFoundException.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bootx.goods.exception.sku; - - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.goods.code.GoodsErrorCode.GOODS_SKU_NOT_EXISTED; - -/** -* sku不存在 -* @author xxm -* @date 2020/12/10 -*/ -public class SkuNotFoundException extends BizException { - public SkuNotFoundException() { - super(GOODS_SKU_NOT_EXISTED, "商品SKU不存在"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/sku/SkuNotOnException.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/sku/SkuNotOnException.java deleted file mode 100644 index b47211bcc25d726911775ea1a983874633c08cee..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/exception/sku/SkuNotOnException.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bootx.goods.exception.sku; - - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.goods.code.GoodsErrorCode.GOODS_SKU_NOT_ON; - -/** -* 商品 SKU 尚未开售异常 -* @author xxm -* @date 2020/11/24 -*/ -public class SkuNotOnException extends BizException { - public SkuNotOnException() { - super(GOODS_SKU_NOT_ON, "商品 SKU 尚未开售异常"); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/mq/InventoryExpiredListener.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/mq/InventoryExpiredListener.java deleted file mode 100644 index c19c9607e84852b787095ce81c9a8b414ea83bff..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/mq/InventoryExpiredListener.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bootx.goods.mq; - -import cn.bootx.common.redis.listener.RedisKeyExpiredListener; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -/** - * 库存解锁事件 - * @author xxm - * @date 2022/5/9 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class InventoryExpiredListener implements RedisKeyExpiredListener { - - @Override - public String getPrefixKey() { - return "inventory:lock"; - } - - @Override - public void onMessage(String key) { - log.info("过期key: "+key); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryBrandParam.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryBrandParam.java deleted file mode 100644 index cf8fdc9ed2b9bd8a6438fb97898481e650811d61..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryBrandParam.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.bootx.goods.param.category; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.util.List; - -/** -* 类目绑定品牌参数 -* @author xxm -* @date 2022/5/13 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "类目绑定品牌参数") -public class CategoryBrandParam { - - @NotNull - @Schema(description = "类目id") - private Long categoryId; - - @Schema(description = "品牌ids") - private List brandIds; -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryParam.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryParam.java deleted file mode 100644 index 6927109ec72f685b8ab497280d0769fdc63ef05d..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryParam.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.bootx.goods.param.category; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2020/11/19 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "类目") -public class CategoryParam implements Serializable { - - private static final long serialVersionUID = 88503981680088056L; - - @Schema(description="主键") - private Long id; - - @Schema(description="上级类目id") - private Long pid; - - @Schema(description="类目名称", required = true) - private String name; - - @Schema(description="类目描述") - private String remark; - - @Schema(description="是否启用") - private Boolean enable; - - @Schema(description="排序,默认0") - private Double sortNo; - - @Schema(description= " 图标/图片地址") - private String image; - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryParameterGroupParam.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryParameterGroupParam.java deleted file mode 100644 index 21ac2db1c556647a51a50b559e8ada88b403ca51..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryParameterGroupParam.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.bootx.goods.param.category; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; - -/** - * 类目参数组 - * @author xxm - * @date 2022-05-09 - */ -@Data -@Schema(title = "类目参数组") -@Accessors(chain = true) -public class CategoryParameterGroupParam { - - @Schema(description= "主键") - private Long id; - @NotEmpty - @Schema(description = "参数组名称") - private String name; - @Schema(description = "排序") - private Double sortNo; - @NotNull - @Schema(description = "类目id") - private Long categoryId; - @Schema(description = "描述") - private String remark; - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryParameterParam.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryParameterParam.java deleted file mode 100644 index 74612a99bc503130921df8a2f93574d5cc7b1149..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategoryParameterParam.java +++ /dev/null @@ -1,46 +0,0 @@ -package cn.bootx.goods.param.category; - -import cn.bootx.common.core.validation.ValidationGroup; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotEmpty; -import javax.validation.constraints.NotNull; -import java.util.List; - -/** - * 类目参数 - * @author xxm - * @date 2022-05-09 - */ -@Data -@Schema(title = "类目参数") -@Accessors(chain = true) -public class CategoryParameterParam { - - @NotNull(groups = ValidationGroup.edit.class) - @Schema(description= "主键") - private Long id; - @NotNull(groups = ValidationGroup.add.class) - @Schema(description = "参数名称") - private String name; - @NotEmpty - @Schema(description = "手动输入or列表选择") - private String type; - @Schema(description = "选择值(列表)") - private List options; - @Schema(description = "是否必填") - private Boolean required; - @Schema(description = "排序") - private Double sortNo; - @NotNull - @Schema(description = "参数组id") - private Long groupId; - @NotNull - @Schema(description = "类目id") - private Long categoryId; - @Schema(description = "描述") - private String remark; - -} \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategorySpecParam.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategorySpecParam.java deleted file mode 100644 index abdade1220d48b473b4e734cebddfc5cdbc8f927..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/CategorySpecParam.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.bootx.goods.param.category; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.util.List; - -/** -* @author xxm -* @date 2022/5/13 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "类目规格绑定") -public class CategorySpecParam { - @NotNull - @Schema(description = "类目id") - private Long categoryId; - - @Schema(description = "品牌ids") - private List specIds; -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/goods/GoodsParam.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/goods/GoodsParam.java deleted file mode 100644 index 72810aab50434bd2e3e57ffff38edb801e34f1a1..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/goods/GoodsParam.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.bootx.goods.param.goods; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2021/2/2 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "商品创建参数") -public class GoodsParam implements Serializable { - private static final long serialVersionUID = -8666559882709167480L; - - @Schema(description= "主键") - private Long id; - - @Schema(description= "所属类目id", required = true) - private Long cid; - - @Schema(description= "所属类目名称(前端展示使用)") - private String cname; - - @Schema(description= "商品名称", required = true) - private String name; - - @Schema(description= "商品描述") - private String remark; - - @Schema(description= "附加信息") - private String addition; - - @Schema(description= "价格表类型id") - private Long priceTypeId; - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/inventory/ReduceInventoryParam.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/inventory/ReduceInventoryParam.java deleted file mode 100644 index 9ff653ec7c23cdbeb05116f07b79c1f594b01a1a..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/inventory/ReduceInventoryParam.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.bootx.goods.param.inventory; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -/** -* @author xxm -* @date 2021/4/29 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "减少SKU库存参数") -public class ReduceInventoryParam { - - @Schema(description= "skuID") - private Long skuId; - - @Schema(description= "数量") - private int count; - - @Schema(description= "token") - private String token; -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/inventory/UnlockInventoryParam.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/inventory/UnlockInventoryParam.java deleted file mode 100644 index 110ad369da568577001abe3b4a31f8929558f83a..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/inventory/UnlockInventoryParam.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.bootx.goods.param.inventory; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -/** -* @author xxm -* @date 2021/4/22 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "释放SKU库存参数") -public class UnlockInventoryParam { - - @Schema(description= "skuID") - private Long skuId; - - @Schema(description= "数量") - private int count; - - @Schema(description= "token") - private String token; -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/sku/SkuParam.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/sku/SkuParam.java deleted file mode 100644 index 14dbbb0f57edede61dade1fd2a1ecb7720ec3fc4..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/sku/SkuParam.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.bootx.goods.param.sku; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** -* @author xxm -* @date 2021/7/23 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "sku添加") -public class SkuParam implements Serializable { - private static final long serialVersionUID = -8038996282288514501L; - - @Schema(description= "主键") - private Long id; - - @Schema(description= "所属类目id") - private Long cid; - - @Schema(description= "外部编码") - private String outNo; - - @Schema(description= "所属商品id") - private Long goodsId; - - @Schema(description= "SKU名称") - private String name; - - @Schema(description= "SKU描述") - private String description; - - @Schema(description= "附加信息") - private String addition; - - @Schema(description= "是否打包品") - private boolean packing; - - @Schema(description= "是否无限库存") - private boolean unlimited; - - @Schema(description= "初始库存") - private Integer capacity; - - @Schema(description= "售价") - private BigDecimal price; - -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/task/InventoryTask.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/task/InventoryTask.java deleted file mode 100644 index 0eb917c5791843631577526070e66e24366d0c71..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/task/InventoryTask.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bootx.goods.task; - -import lombok.RequiredArgsConstructor; -import org.quartz.Job; -import org.quartz.JobExecutionContext; -import org.springframework.stereotype.Component; - -/** -* 库存定时任务 -* @author xxm -* @date 2021/4/16 -*/ -@Component -@RequiredArgsConstructor -public class InventoryTask implements Job { - private final InventoryTaskService inventoryTaskService; - - @Override - public void execute(JobExecutionContext context) { - inventoryTaskService.expireTokens(); - } -} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/task/InventoryTaskService.java b/bootx-services/service-goods/src/main/java/cn/bootx/goods/task/InventoryTaskService.java deleted file mode 100644 index 56bbfc07bb9d9be0956bd8cc11542eafa75e6d95..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/task/InventoryTaskService.java +++ /dev/null @@ -1,59 +0,0 @@ -package cn.bootx.goods.task; - -import cn.bootx.goods.core.inventory.dao.InventoryTokenRepository; -import cn.bootx.goods.core.inventory.manager.InventoryTokenManager; -import cn.bootx.goods.core.inventory.service.OperateInventoryService; -import cn.bootx.goods.exception.inventory.InventoryLockInsufficientException; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.map.MapUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * 库存任务 token 过期处理服务 - * @author xxm - * @date 2021/2/12 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class InventoryTaskService { - - private final OperateInventoryService inventoryService; - private final InventoryTokenManager tokenManager; - - /** - * 释放过期 - */ - public void expireTokens(){ - // 1,获取所有过期的 token 对应的 key - Set keys = tokenManager.retrieveExpiredTokenKeys(); - if (!CollUtil.isEmpty(keys)) { - // 2,获取过期 key 预占的 sku 库存数 - Map skuIdCountMap = tokenManager.extractSkuIdCountMap(keys); - if (!MapUtil.isEmpty(skuIdCountMap)) { - Set skuIdSet = skuIdCountMap.keySet(); - // 3,释放 sku 的库存 - for (String skuId : skuIdSet) { - int count = skuIdCountMap.get(skuId).getCount(); - List keyList = skuIdCountMap.get(skuId).getKeys(); - log.info("到期Tokens解锁 skuId={} 数量= {}",skuId, count); - try { - if (count > 0) { - inventoryService.unlockInventoryWithoutToken(Long.parseLong(skuId), count); - } - // 4,移除过期的 token 对应的 key - tokenManager.removeExpiredTokenKeys(keyList); - } catch (InventoryLockInsufficientException ex) { - log.error("过期 skuId 或 打包SkuId:=" + skuId + " " + ex.getMessage(), ex); - } - } - } - } - } -} diff --git a/bootx-services/service-goods/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/bootx-services/service-goods/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 8729b696402313fed9ee5af5fc849da856bdd55c..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -cn.bootx.goods.GoodsApplication \ No newline at end of file diff --git a/bootx-services/service-goods/src/main/resources/mapper/inventory/InventoryMapper.xml b/bootx-services/service-goods/src/main/resources/mapper/inventory/InventoryMapper.xml deleted file mode 100644 index 7ce1c0cad5f8a023cdec211fb5b85d153980ccfd..0000000000000000000000000000000000000000 --- a/bootx-services/service-goods/src/main/resources/mapper/inventory/InventoryMapper.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - update goods_goods_sku - set available = (available - #{count}), - locked = (locked + #{count}), - version = (version + 1) - where id = #{id} and (available - #{count}) >= 0 - - - - update goods_goods_sku - set available = (available + #{count}), - locked = (locked - #{count}), - version = (version + 1) - where id = #{id} and (locked - #{count}) >= 0 - - - - update goods_goods_sku - set locked = (locked - #{count}), - sold = (sold + #{count}), - version = (version + 1) - where id = #{id} and (locked - #{count}) >= 0 - - - - update goods_goods_sku - set available = (available + #{count}), - sold = (sold - #{count}), - version = (version + 1) - where id = #{id} - - - - update goods_goods_sku - set available = (available + #{count}), - capacity = (capacity + #{count}), - version = (version + 1) - where id = #{id} - - - - update goods_goods_sku - set locked = (locked - #{count}), - capacity = (capacity - #{count}), - version = (version + 1) - where id = #{id} and (locked - #{count}) >= 0 - - - - update goods_goods_sku - set sold = (sold - #{count}), - capacity = (capacity - #{count}), - version = (version + 1) - where id = #{id} and (capacity - #{count}) >= 0 and (sold - #{count}) >= 0 - - \ No newline at end of file diff --git a/bootx-services/service-iam/pom.xml b/bootx-services/service-iam/pom.xml index d23754c29564884895c5ba164a8232f075e68ab4..b8dec3ba56750160a07f033b910fd0c7a51c93fb 100644 --- a/bootx-services/service-iam/pom.xml +++ b/bootx-services/service-iam/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-services - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-services/service-notice/pom.xml b/bootx-services/service-notice/pom.xml index 2feacdcfe27be418b6421c3edb4a4862024abc45..c7a50bd47d1bf5e1a78c5df0742bdb259e8d5134 100644 --- a/bootx-services/service-notice/pom.xml +++ b/bootx-services/service-notice/pom.xml @@ -5,7 +5,7 @@ bootx-services cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-services/service-office/pom.xml b/bootx-services/service-office/pom.xml index ef6b81211e4a426b63848b8c942a4f0f66a23f5e..f29e0c7233d001b7e7784dbc4cb49bfa658f54d3 100644 --- a/bootx-services/service-office/pom.xml +++ b/bootx-services/service-office/pom.xml @@ -5,7 +5,7 @@ bootx-services cn.bootx.platform - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-services/service-order/README.md b/bootx-services/service-order/README.md deleted file mode 100644 index 0a7ba745f8c2e48b87c031f3715cf9f8f30c267f..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/README.md +++ /dev/null @@ -1 +0,0 @@ -# 订单中心 \ No newline at end of file diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/OrderApplication.java b/bootx-services/service-order/src/main/java/cn/bootx/order/OrderApplication.java deleted file mode 100644 index 554d719ea7c8d5bbc3ab2962805deed4af47c040..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/OrderApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bootx.order; - -import org.apache.ibatis.annotations.Mapper; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.ComponentScan; - -/** -* 订单中心 -* @author xxm -* @date 2021/8/11 -*/ -@ComponentScan -@MapperScan(annotationClass = Mapper.class) -public class OrderApplication { -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderCenterCode.java b/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderCenterCode.java deleted file mode 100644 index d3160400becfca2d220231e3ae533d0723644497..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderCenterCode.java +++ /dev/null @@ -1,13 +0,0 @@ -package cn.bootx.order.code; - -/** -* -* @author xxm -* @date 2021/4/13 -*/ -public interface OrderCenterCode { - /** - * 项目名称 - */ - String APPLICATION_NAME = "service-order-center"; -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderCenterErrorCode.java b/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderCenterErrorCode.java deleted file mode 100644 index a65df19936b35a7c233473821a1b0f66149d5717..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderCenterErrorCode.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.bootx.order.code; - -/** -* 商品中心 -* @author xxm -* @date 2021/3/10 -*/ -public interface OrderCenterErrorCode { - - - /** - * 订单不存在 - */ - int ORDER_NOT_EXIST = 23015; - - /** - * 订单超时 - */ - int ORDER_TIME_OUT = 44007; - - /** - * 订单支付中 - */ - int ORDER_PAYING = 44008; - - /** - * 订单已支付 - */ - int ORDER_ALREADY_PAID = 44009; - - /** - * 订单已取消 - */ - int ORDER_CANCELLED = 44010; -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderStatusCode.java b/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderStatusCode.java deleted file mode 100644 index e3e5a0bb64df0b4c917c6942fc836f27f4038625..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderStatusCode.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.bootx.order.code; - -/** -* 订单状态 -* @author xxm -* @date 2020/11/27 -*/ -public interface OrderStatusCode { - - /** 未支付 */ - int STATUS_NORMAL = 0; - /** 支付中 */ - int STATUS_PAYING = 1; - /** 已支付未发货 */ - int STATUS_NOT_YET_SHIPPED = 2; - /** 已支付已完成 */ - int STATUS_PAYED = 3; - /** 已取消 */ - int STATUS_CANCEL = 4; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderTypeCode.java b/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderTypeCode.java deleted file mode 100644 index e91d9b3061d1c8d83ad438375aa77ae3c431e7be..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/code/OrderTypeCode.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.bootx.order.code; - -/** -* 订单类型 -* @author xxm -* @date 2021/4/16 -*/ -public interface OrderTypeCode { - - /** 普通订单 */ - int NORMAL = 1; -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/controller/OrderFindController.java b/bootx-services/service-order/src/main/java/cn/bootx/order/controller/OrderFindController.java deleted file mode 100644 index 8b62e668ff363f76158b2b0547113b5457e75448..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/controller/OrderFindController.java +++ /dev/null @@ -1,61 +0,0 @@ -package cn.bootx.order.controller; - -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.order.core.order.service.OrderFindService; -import cn.bootx.order.dto.order.OrderDto; -import cn.hutool.core.date.DatePattern; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import lombok.AllArgsConstructor; -import org.springframework.format.annotation.DateTimeFormat; -import org.springframework.web.bind.annotation.*; - -import java.time.LocalDateTime; -import java.util.List; - -/** -* @author xxm -* @date 2021/4/13 -*/ -@Tag(name ="订单查询") -@RestController -@RequestMapping("/order") -@AllArgsConstructor -public class OrderFindController { - private final OrderFindService orderFindService; - - - @Operation(summary = "根据用户获取订单") - @GetMapping("/findByUser") - public ResResult> findByUser(Long id){ - return Res.ok(orderFindService.findByUser(id)); - } - - @Operation(summary = "订单列表 分页") - @GetMapping("/page") - public ResResult> page(PageParam page){ - return Res.ok(orderFindService.page(page)); - } - - @Operation(summary = "获取完整订单详情") - @GetMapping("/getWholeById") - public ResResult getWholeById(Long id) { - return Res.ok(orderFindService.getWholeById(id)); - } - - @Operation(summary = "查询订单包含的skuIds") - @GetMapping("/findOrderSkuIds") - public ResResult> findOrderSkuIds(Long orderId){ - return Res.ok(orderFindService.findOrderSkuIds(orderId)); - } - - @Operation(summary = "获取指定类型超时订单的id集合") - @GetMapping("/findPayTimeoutOrderIdsByType") - public ResResult> findPayTimeoutOrderIdsByType(@DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) LocalDateTime date, Integer type){ - return Res.ok(orderFindService.findPayTimeoutOrderIdsByType(date,type)); - } - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/controller/OrderOperateController.java b/bootx-services/service-order/src/main/java/cn/bootx/order/controller/OrderOperateController.java deleted file mode 100644 index 9dc5321c841156c9d8c6e5ac9483372386759224..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/controller/OrderOperateController.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.bootx.order.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.order.core.order.service.OrderOperateService; -import cn.bootx.order.dto.order.OrderDto; -import cn.bootx.order.param.order.OrderWholeParam; -import io.swagger.v3.oas.annotations.tags.Tag; -import io.swagger.v3.oas.annotations.Operation; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** -* -* @author xxm -* @date 2021/4/13 -*/ -@Tag(name ="订单操作") -@RestController -@RequestMapping("/order") -@AllArgsConstructor -public class OrderOperateController { - private final OrderOperateService orderOperateService; - - @Operation(summary = "传入订单和优惠, 下单") - @PostMapping("/placeOrder") - public ResResult placeOrder(@RequestBody OrderWholeParam orderWholeParam){ - return Res.ok(orderOperateService.placeOrder(orderWholeParam)); - } - - @Operation(summary = "付款成功状态变更") - @PostMapping("/paidOrderState") - public ResResult paidOrderState(Long orderId){ - orderOperateService.paidOrderState(orderId); - return Res.ok(); - } - - @Operation(summary = "取消订单") - @PostMapping("/cancelOrderState") - public ResResult cancelOrderState(Long orderId) { - orderOperateService.cancelOrderState(orderId); - return Res.ok(); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/context/OrderDetailContext.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/context/OrderDetailContext.java deleted file mode 100644 index c8a4665fdf6b8586bf642c55160ffb29c53c3726..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/context/OrderDetailContext.java +++ /dev/null @@ -1,69 +0,0 @@ -package cn.bootx.order.core.billing.context; - -import lombok.Data; -import lombok.experimental.Accessors; - -import java.math.BigDecimal; -import java.util.List; - -/** -* 订单详情的上下文,将原来的订单详情, - * 转换为更适合我们的格式,同时屏蔽各种不同的订单详情的差异化 -* @author xxm -* @date 2020/12/9 -*/ -@Data -@Accessors(chain = true) -public class OrderDetailContext { - - /** - * ID != order detail id - * 因为多个项目会共用一个相同的order detail id 所以此处重新生成,保证每个都不一致。 - */ - private Long id; - - /** - * 订单详情的id - */ - private Long orderDetailId; - - /** - * 对应的skuId - */ - private Long skuId; - - /** - * 支付金额 - */ - private BigDecimal payAmount; - - /** - * 已经记账的金额 - */ - private BigDecimal recordedAmount; - - /** - * 该订单项目不支持的payMode列表,部分订单详情可能不支持某种支付方式,拆分的时候需要过滤的 - */ - private List unSupportPayModeList; - - /** - * 交易目的 - * @see PayTransactionPurposeCode - */ - private int transactionPurpose; - - /** - * 交易类型 - * @see PayTransactionTypeCode - */ - private int transactionType; - - /** - * 剩余的记账金额 - * @return 这个order detail 剩余的记账金额 - */ - public BigDecimal getRemainingAmount() { - return this.getPayAmount().subtract(this.getRecordedAmount()); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/context/PayModeContext.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/context/PayModeContext.java deleted file mode 100644 index ee9470c5b37d79e03708ccfc4ff5f2af60130582..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/context/PayModeContext.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.bootx.order.core.billing.context; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.math.BigDecimal; - -/** -* 支付信息的上下文,将支付参数中的支付方式列表转换成更适合billing拆分的格式 -* @author xxm -* @date 2020/12/9 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "支付信息的上下文") -public class PayModeContext { - - /** - * 当前的支付类型 - */ - private int type; - - /** - * 当前支付类型支付的金额 - */ - private BigDecimal totalAmount; - - /** - * 当前支付类型支付的积分数量 - */ - private BigDecimal count; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/convert/BillingConvert.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/convert/BillingConvert.java deleted file mode 100644 index 22402d576b873f2a293788f8d5d38ccda6cafc60..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/convert/BillingConvert.java +++ /dev/null @@ -1,25 +0,0 @@ -package cn.bootx.order.core.billing.convert; - -import cn.bootx.order.core.billing.entity.OrderBilling; -import cn.bootx.order.core.billing.entity.OrderItemBilling; -import cn.bootx.order.dto.billing.OrderBillingDto; -import cn.bootx.order.dto.billing.OrderItemBillingDto; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -/** -* 账单转换 -* @author xxm -* @date 2021/6/28 -*/ -@Mapper -public interface BillingConvert { - BillingConvert CONVERT = Mappers.getMapper(BillingConvert.class); - - OrderBillingDto convert(OrderBilling in); - - OrderItemBillingDto convert(OrderItemBilling in); - - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderBillingManager.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderBillingManager.java deleted file mode 100644 index abcb0075769794ea402e9d0e547bc08c009cd4a1..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderBillingManager.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.order.core.billing.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.order.core.billing.entity.OrderBilling; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderBillingManager extends BaseManager { - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderBillingMapper.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderBillingMapper.java deleted file mode 100644 index 0f0e99df61095a5b5d6e3f0ad8041c94a8bf441a..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderBillingMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.bootx.order.core.billing.dao; - -import cn.bootx.order.core.billing.entity.OrderBilling; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.springframework.stereotype.Repository; - -@Repository -public interface OrderBillingMapper extends BaseMapper { -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderItemBillingManager.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderItemBillingManager.java deleted file mode 100644 index a55d3b37eb7749590d8a953eaf6ab2749f363fe7..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderItemBillingManager.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bootx.order.core.billing.dao; - -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Service; - -/** - * 订单明细账单 - * @author xxm - * @date 2020/12/11 - */ -@Service -@RequiredArgsConstructor -public class OrderItemBillingManager { - - private final OrderItemBillingMapper orderItemBillingRepository; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderItemBillingMapper.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderItemBillingMapper.java deleted file mode 100644 index eaeafb07a9711db256f3fbe29b0f92bfe25f3ce8..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/dao/OrderItemBillingMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.bootx.order.core.billing.dao; - -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface OrderItemBillingMapper extends BaseMapper { - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/entity/OrderBilling.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/entity/OrderBilling.java deleted file mode 100644 index c90348b1f477c413b4279b5ab8c40d768a87ad36..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/entity/OrderBilling.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.bootx.order.core.billing.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.order.core.billing.convert.BillingConvert; -import cn.bootx.order.dto.billing.OrderBillingDto; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.math.BigDecimal; - -/** -* 订单账单 -* @author xxm -* @date 2020/12/11 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("order_order_billing") -public class OrderBilling extends MpBaseEntity implements EntityBaseFunction { - - /** 用户id */ - private Long userId; - - /** 渠道id */ - private Long channelId; - - /** 订单id */ - private Long orderId; - - /** 支付类型 */ - private Integer payType; - - /** 金额 */ - private BigDecimal amount; - - /** - * 交易数量(积分,代金券,兑换券的场合具体数量 - */ - private Integer count; - - /** 业务id */ - private String businessId; - - @Override - public OrderBillingDto toDto() { - return BillingConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/entity/OrderItemBilling.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/entity/OrderItemBilling.java deleted file mode 100644 index c197ac1f122d55ddbe8bf6f02ddf3b56d70787e7..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/entity/OrderItemBilling.java +++ /dev/null @@ -1,56 +0,0 @@ -package cn.bootx.order.core.billing.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.order.core.billing.convert.BillingConvert; -import cn.bootx.order.dto.billing.OrderItemBillingDto; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.math.BigDecimal; - -/** -* 订单项账单 -* @author xxm -* @date 2020/12/11 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("order_order_item_billing") -public class OrderItemBilling extends MpBaseEntity implements EntityBaseFunction { - - /** 账单id */ - private Long orderBillingId; - - /** 用户id */ - private Long userId; - - /** 订单id */ - private Long orderId; - - /** 订单项id */ - private Long orderItemId; - - /** 订单项目skuId */ - private Long skuId; - - /** 支付金额 */ - private BigDecimal amount; - - /** 入账时间 */ - private Long bookkeepingTime; - - /** 原始订单项id */ - private Long sourceItemBillingId; - - /** 原始订单项d */ - private Long sourceOrderItemId; - - @Override - public OrderItemBillingDto toDto() { - return BillingConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/service/OrderBillingService.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/service/OrderBillingService.java deleted file mode 100644 index ae53cf1c4a04e71015b2e09427f0c481e69db1ba..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/service/OrderBillingService.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.bootx.order.core.billing.service; - -import cn.bootx.order.core.billing.dao.OrderBillingManager; -import cn.bootx.order.core.billing.dao.OrderItemBillingManager; -import cn.bootx.payment.core.payment.dao.PaymentManager; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - - -/** - * 账单服务 - * @author xxm - * @date 2021/2/25 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderBillingService { - - private final OrderBillingManager orderBillingManager; - private final OrderItemBillingManager orderItemBillingManager; - private final PaymentManager paymentManager; - - - /** - * billing 的拆分操作 - */ - @Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRES_NEW) - public void handleBilling(Long paymentId) { - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/service/OrderItemBillingService.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/service/OrderItemBillingService.java deleted file mode 100644 index 324a0fcad03057f9e9e9449ca6905815938e6e9f..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/billing/service/OrderItemBillingService.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.bootx.order.core.billing.service; - -import cn.bootx.order.core.billing.dao.OrderItemBillingManager; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -/** -* 订单明细账单服务 -* @author xxm -* @date 2021/2/25 -*/ -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderItemBillingService { - private final OrderItemBillingManager orderItemBillingManager; -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/convert/OrderConvert.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/convert/OrderConvert.java deleted file mode 100644 index 1df20a3723c16c720d8b3a26990704b18a227968..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/convert/OrderConvert.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.bootx.order.core.order.convert; - -import cn.bootx.order.core.order.entity.Order; -import cn.bootx.order.core.order.entity.OrderDetail; -import cn.bootx.order.core.order.entity.OrderStrategyMapping; -import cn.bootx.order.dto.order.OrderDetailDto; -import cn.bootx.order.dto.order.OrderDto; -import cn.bootx.order.dto.order.OrderStrategyMappingDto; -import cn.bootx.order.param.order.OrderDetailParam; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -/** -* 订单转换 -* @author xxm -* @date 2021/8/11 -*/ -@Mapper -public interface OrderConvert { - OrderConvert CONVERT = Mappers.getMapper(OrderConvert.class); - OrderDto convert(Order in); - - Order convert(OrderDto in); - - OrderDetailDto convert(OrderDetail in); - - OrderDetail convert(OrderDetailDto in); - - OrderDetail convert(OrderDetailParam in); - - OrderStrategyMappingDto convert(OrderStrategyMapping in); - - OrderStrategyMapping convert(OrderStrategyMappingDto in); - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderDetailManager.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderDetailManager.java deleted file mode 100644 index 7da41b218edd189d7d56e51f538a43f6925b41e5..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderDetailManager.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.bootx.order.core.order.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.order.core.order.entity.OrderDetail; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** -* 订单明细 -* @author xxm -* @date 2020/11/18 -*/ -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderDetailManager extends BaseManager { - - public List findByOrder(Long orderId){ - return findAllByField(OrderDetail::getOrderId,orderId); - } - - /** - * 获取订单中的sku列表 - */ - public List findOrderSkuIds(Long orderId){ - return lambdaQuery().eq(OrderDetail::getOrderId,orderId) - .select(OrderDetail::getSkuId) - .list(); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderDetailMapper.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderDetailMapper.java deleted file mode 100644 index 03e0618ee4ba3d2025b09fa45753deae3b6c8b7a..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderDetailMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.order.core.order.dao; - -import cn.bootx.order.core.order.entity.OrderDetail; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** -* 订单明细 -* @author xxm -* @date 2020/11/18 -*/ -@Mapper -public interface OrderDetailMapper extends BaseMapper { -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderManager.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderManager.java deleted file mode 100644 index 0e6682d1089f955ccc3b53a39c59a094d677c8ca..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderManager.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.bootx.order.core.order.dao; - -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.mybatisplus.base.MpIdEntity; -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.order.code.OrderStatusCode; -import cn.bootx.order.core.order.entity.Order; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * 订单 - * @author xxm - * @date 2020/11/18 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderManager extends BaseManager { - - public List findByUser(Long id) { - return findAllByField(Order::getUserId,id); - } - - public Page page(PageParam pageParam) { - Page mpPage = MpUtil.getMpPage(pageParam, Order.class); - return lambdaQuery() - .orderByDesc(MpIdEntity::getId) - .page(mpPage); - } - - /** - * 获取超时订单的id集合 - */ - public List findPayTimeoutOrderIdsByType(LocalDateTime date, Integer type) { - // select id from Order where state = ?1 and createTime < ?2 and businessId = ?3 - return lambdaQuery().eq(Order::getStatus,OrderStatusCode.STATUS_NORMAL) - .le(MpIdEntity::getId,date) - .eq(Order::getType,type) - .list(); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderMapper.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderMapper.java deleted file mode 100644 index 6eab717d75c7e2541cbf8386e92775a41315c64e..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.bootx.order.core.order.dao; - -import cn.bootx.order.core.order.entity.Order; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface OrderMapper extends BaseMapper { -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderStrategyMappingManager.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderStrategyMappingManager.java deleted file mode 100644 index 20e0fc311f88bb0da7eb9ecd58965229d9d6c165..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderStrategyMappingManager.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bootx.order.core.order.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.order.core.order.entity.OrderStrategyMapping; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** -* 订单策略映射 -* @author xxm -* @date 2020/11/27 -*/ -@Repository -@RequiredArgsConstructor -public class OrderStrategyMappingManager extends BaseManager { - - public List findByOrder(Long orderId) { - return findAllByField(OrderStrategyMapping::getOrderId,orderId); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderStrategyMappingMapper.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderStrategyMappingMapper.java deleted file mode 100644 index 596c90358b19a7f865d1fd1759fc0fd0ff2d8366..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/dao/OrderStrategyMappingMapper.java +++ /dev/null @@ -1,10 +0,0 @@ -package cn.bootx.order.core.order.dao; - -import cn.bootx.order.core.order.entity.OrderStrategyMapping; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface OrderStrategyMappingMapper extends BaseMapper { - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/entity/Order.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/entity/Order.java deleted file mode 100644 index 682f60443886bfac65296d2d4a758c2cf72af331..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/entity/Order.java +++ /dev/null @@ -1,96 +0,0 @@ -package cn.bootx.order.core.order.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.order.core.order.convert.OrderConvert; -import cn.bootx.order.dto.order.OrderAddressDto; -import cn.bootx.order.dto.order.OrderDto; -import cn.bootx.order.dto.order.OrderInvoiceDto; -import cn.hutool.core.collection.CollUtil; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.List; -import java.util.stream.Collectors; - -/** -* 订单 -* @author xxm -* @date 2020/10/15 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("order_order") -public class Order extends MpBaseEntity implements EntityBaseFunction { - - /** 编码 */ - private String code; - - /** 渠道 */ - private Long channelId; - - /** 描述 */ - private String description; - - /** 购买用户ID */ - private Long userId; - - /** - * 状态 - * @see cn.bootx.order.code.OrderStatusCode - */ - private int status; - - /** 支付时间 */ - private LocalDateTime payTime; - - /** 类型 */ - private Integer type; - - /** 总金额 */ - private BigDecimal totalAmount; - - /** 实付金额 */ - private BigDecimal payAmount; - - /** 所用优惠券 */ - private String couponIds; - - /** 业务id */ - private Long businessId; - - /** 附加参数 */ - private String addition; - - /** 订单明细 */ - @TableField(exist = false) - private List orderDetails; - - /** 收货信息 */ - @TableField(typeHandler = JacksonTypeHandler.class) - private OrderAddressDto addressInfo; - - /** 发票信息 */ - @TableField(typeHandler = JacksonTypeHandler.class) - private OrderInvoiceDto invoiceInfo; - - public static Order init(OrderDto in){ - return OrderConvert.CONVERT.convert(in); - } - - @Override - public OrderDto toDto() { - OrderDto dto = OrderConvert.CONVERT.convert(this); - if (CollUtil.isNotEmpty(orderDetails)){ - dto.setDetails(orderDetails.stream().map(OrderDetail::toDto).collect(Collectors.toList())); - } - return dto; - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/entity/OrderDetail.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/entity/OrderDetail.java deleted file mode 100644 index 34ad5d4adedbe5b3f9c65e250cb339ff6ca6e36f..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/entity/OrderDetail.java +++ /dev/null @@ -1,73 +0,0 @@ -package cn.bootx.order.core.order.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.order.core.order.convert.OrderConvert; -import cn.bootx.order.dto.order.OrderDetailDto; -import cn.bootx.order.param.order.OrderDetailParam; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.math.BigDecimal; -import java.util.List; - -/** - * 订单明细 - * @author xxm - * @date 2020/10/15 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("order_order_detail") -public class OrderDetail extends MpBaseEntity implements EntityBaseFunction { - - /** 订单id */ - private Long orderId; - - /** 店铺id */ - private Long shopId; - - /** 类目 */ - private Long categoryId; - - /** 商品id */ - private Long goodsId; - - /** 库存id */ - private Long skuId; - - /** 商品名称 */ - private String goodsTitle; - - /** 商品价格 */ - private BigDecimal goodsPrice; - - /** 数量 */ - private int num; - - /** 总价 */ - private BigDecimal totalAmount; - - /** 支付价 */ - private BigDecimal payAmount; - - /** 状态 */ - private Integer state; - - /** 策略映射 */ - @TableField(exist = false) - private List mappings; - - public static OrderDetail init(OrderDetailParam in){ - return OrderConvert.CONVERT.convert(in); - } - - @Override - public OrderDetailDto toDto() { - return OrderConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/entity/OrderStrategyMapping.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/entity/OrderStrategyMapping.java deleted file mode 100644 index bbcbf8bed02fd30808ffe78c30d261a929e3eebc..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/entity/OrderStrategyMapping.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.bootx.order.core.order.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.order.core.order.convert.OrderConvert; -import cn.bootx.order.dto.order.OrderStrategyMappingDto; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.math.BigDecimal; - -/** - * 订单策略映射 - * 用于保存策略计算过程中的结果,会保存当时计算的订单策略、订单类型(订单/明细)和价格变动数量 - * @author xxm - * @date 2020/10/11 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("order_order_strategy_mapping") -public class OrderStrategyMapping extends MpBaseEntity implements EntityBaseFunction { - - /** 订单id */ - private Long orderId; - - /** 明细id */ - private Long orderDetailId; - - /** 策略类型 1 活动策略 2 优惠券策略*/ - private Integer strategyType; - - /** 优惠券ID */ - private Long couponId; - - /** 策略ID */ - private Long strategyId; - - /** 策略注册ID */ - private Long strategyRegisterId; - - /** 价格变动 */ - private BigDecimal priceChange; - - /** 描述 */ - private String description; - - @Override - public OrderStrategyMappingDto toDto() { - return OrderConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/factory/OrderFactory.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/factory/OrderFactory.java deleted file mode 100644 index b11fe93e647571970a21f0912e65c5516625040d..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/factory/OrderFactory.java +++ /dev/null @@ -1,95 +0,0 @@ -package cn.bootx.order.core.order.factory; - -import cn.bootx.order.core.order.entity.Order; -import cn.bootx.order.core.order.entity.OrderDetail; -import cn.bootx.order.core.order.entity.OrderStrategyMapping; -import cn.bootx.order.param.order.OrderParam; -import cn.bootx.sales.dto.coupon.CouponDto; -import cn.bootx.sales.dto.order.OrderDetailPreviewResult; -import cn.bootx.sales.dto.order.OrderPreviewResult; -import cn.bootx.sales.dto.order.OrderStrategyMappingResult; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.IdUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.stream.Collectors; - -/** - * 订单工厂 - * @author xxm - * @date 2020/11/19 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class OrderFactory { - - /** - * 转换订单为可持久化对象 - */ - public Order buildOrder(OrderPreviewResult previewResult, OrderParam orderParam){ - List orderDetails = previewResult.getOrderDetails(); - - long orderId = IdUtil.getSnowflakeNextId(); - - // 明细转换为持久类 - List collect = orderDetails.stream() - .map(o -> this.buildOrderDetail(o,orderId)) - .collect(Collectors.toList()); - - String couponIds = null; - if (CollUtil.isNotEmpty(previewResult.getCoupons())){ - couponIds = previewResult.getCoupons().stream() - .map(CouponDto::getId) - .map(String::valueOf) - .collect(Collectors.joining(",")); - } - - Order order = new Order(); - BeanUtil.copyProperties(previewResult,order); - BeanUtil.copyProperties(orderParam,order,CopyOptions.create().ignoreNullValue()); - - order.setId(orderId); - order.setOrderDetails(collect) - .setCouponIds(couponIds); - return order; - } - - /** - * 转换订单明细 - */ - private OrderDetail buildOrderDetail(OrderDetailPreviewResult orderDetailCheckDto, long orderId){ - long orderDetailId = IdUtil.getSnowflakeNextId(); - OrderDetail orderDetail = new OrderDetail(); - BeanUtil.copyProperties(orderDetailCheckDto,orderDetail, CopyOptions.create().ignoreNullValue()); - - List mappingDtos = orderDetailCheckDto.getMappings(); - List collect = mappingDtos.stream() - .map(o -> this.buildMapping(o,orderId,orderDetailId)) - .collect(Collectors.toList()); - orderDetail.setOrderId(orderId) - .setGoodsTitle(orderDetailCheckDto.getGoodsTitle()) - .setMappings(collect) - .setId(orderDetailId); - return orderDetail; - } - - - - /** - * 转换策略映射 - */ - private OrderStrategyMapping buildMapping(OrderStrategyMappingResult strategyMappingResult, Long orderId, Long orderDetailId){ - OrderStrategyMapping orderStrategyMapping = new OrderStrategyMapping(); - BeanUtil.copyProperties(strategyMappingResult,orderStrategyMapping,CopyOptions.create().ignoreNullValue()); - orderStrategyMapping.setOrderDetailId(orderDetailId) - .setOrderId(orderId); - return orderStrategyMapping; - } - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/service/OrderFindService.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/service/OrderFindService.java deleted file mode 100644 index 3392c1f053fcc55b31fc639da16bf110a3582fc7..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/service/OrderFindService.java +++ /dev/null @@ -1,97 +0,0 @@ -package cn.bootx.order.core.order.service; - -import cn.bootx.common.core.rest.PageResult; -import cn.bootx.common.core.rest.param.PageParam; -import cn.bootx.common.core.util.ResultConvertUtil; -import cn.bootx.common.mybatisplus.base.MpIdEntity; -import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.order.core.order.dao.OrderDetailManager; -import cn.bootx.order.core.order.dao.OrderManager; -import cn.bootx.order.core.order.dao.OrderStrategyMappingManager; -import cn.bootx.order.core.order.entity.Order; -import cn.bootx.order.core.order.entity.OrderDetail; -import cn.bootx.order.core.order.entity.OrderStrategyMapping; -import cn.bootx.order.dto.order.OrderDetailDto; -import cn.bootx.order.dto.order.OrderDto; -import cn.bootx.order.dto.order.OrderStrategyMappingDto; -import cn.bootx.order.exception.order.OrderNotExistException; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 订单查询 - * @author xxm - * @date 2020/11/26 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderFindService { - private final OrderManager orderManager; - private final OrderDetailManager orderDetailManager; - private final OrderStrategyMappingManager mappingManager; - - /** - * 根据用户获取订单 - */ - public List findByUser(Long id){ - return ResultConvertUtil.dtoListConvert(orderManager.findByUser(id)); - } - - /** - * 订单列表 分页 - */ - public PageResult page(PageParam page){ - return MpUtil.convert2DtoPageResult(orderManager.page(page)); - } - - /** - * 订单详情 - */ - public OrderDto getWholeById(Long id){ - - // 订单 - Order order = orderManager.findById(id).orElseThrow(OrderNotExistException::new); - OrderDto orderDto = order.toDto(); - - // 获取生效的优惠 - Map> mappingMap = mappingManager.findByOrder(id).stream() - .map(OrderStrategyMapping::toDto) - .collect(Collectors.groupingBy(OrderStrategyMappingDto::getOrderDetailId)); - - // 获取明细 - List details = orderDetailManager.findByOrder(id) - .stream() - .map(OrderDetail::toDto) - .map(orderDetailDto -> orderDetailDto.setMappings(mappingMap.get(orderDetailDto.getId()))) - .collect(Collectors.toList()); - orderDto.setDetails(details); - - return orderDto; - } - - /** - * 获取订单中的sku列表 - */ - public List findOrderSkuIds(Long orderId) { - return orderDetailManager.findOrderSkuIds(orderId).stream() - .map(OrderDetail::getSkuId) - .collect(Collectors.toList()); - } - - /** - * 获取指定类型超时订单的id集合 - */ - public List findPayTimeoutOrderIdsByType(LocalDateTime date,Integer type){ - return orderManager.findPayTimeoutOrderIdsByType(date,type) - .stream().map(MpIdEntity::getId) - .collect(Collectors.toList()); - } - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/service/OrderOperateService.java b/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/service/OrderOperateService.java deleted file mode 100644 index 7f27c39823eec4aae992958f44f835bab6463cef..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/core/order/service/OrderOperateService.java +++ /dev/null @@ -1,143 +0,0 @@ -package cn.bootx.order.core.order.service; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.order.code.OrderStatusCode; -import cn.bootx.order.core.order.dao.OrderDetailManager; -import cn.bootx.order.core.order.dao.OrderManager; -import cn.bootx.order.core.order.dao.OrderStrategyMappingManager; -import cn.bootx.order.core.order.entity.Order; -import cn.bootx.order.core.order.entity.OrderDetail; -import cn.bootx.order.core.order.entity.OrderStrategyMapping; -import cn.bootx.order.core.order.factory.OrderFactory; -import cn.bootx.order.dto.order.OrderDto; -import cn.bootx.order.param.order.OrderParam; -import cn.bootx.order.param.order.OrderWholeParam; -import cn.bootx.sales.core.calculate.service.OrderPreviewService; -import cn.bootx.sales.core.coupon.service.CouponService; -import cn.bootx.sales.dto.coupon.CouponDto; -import cn.bootx.sales.dto.order.OrderPreviewResult; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * 订单构建操作类 - * @author xxm - * @date 2020/10/12 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderOperateService { - private final OrderManager orderManager; - private final OrderDetailManager orderDetailManager; - private final OrderStrategyMappingManager orderStrategyMappingManager; - - private final CouponService couponService; - private final OrderPreviewService orderPreviewService; - - private final OrderFactory orderFactory; - - /** - * 传入订单和优惠, 下单 - */ - @Transactional(rollbackFor = Exception.class) - public OrderDto placeOrder(OrderWholeParam orderWholeParam){ - - OrderParam orderParam = orderWholeParam.getOrderParam(); - OrderCheckParam orderCheckParam = this.buildCheckOrder(orderParam); - - // 计算价格 - OrderPreviewResult orderCheck = orderPreviewService.previewOrderPrice(orderCheckParam); - - // 转换成订单对象 - Order order = orderFactory.buildOrder(orderCheck,orderWholeParam.getOrderParam()); - order.setAddressInfo(orderWholeParam.getOrderAddressInfo()); - order.setInvoiceInfo(orderWholeParam.getOrderInvoiceInfo()); - - // 锁定优惠券 - if (CollUtil.isNotEmpty(orderCheck.getCoupons())){ - List couponIds = orderCheck.getCoupons().stream().map(CouponDto::getId).collect(Collectors.toList()); - couponService.lockByIds(couponIds); - } - - // 订单持久化 - this.orderInfoPersistence(order); - // 发布订单创建成功事件 - - return order.toDto(); - } - - /** - * 持久化 - */ - private void orderInfoPersistence(Order order){ - order.setStatus(OrderStatusCode.STATUS_NORMAL); - - // 保存订单 - orderManager.save(order); - // 保存明细 - orderDetailManager.saveAll(order.getOrderDetails()); - - List orderStrategyMappings = order.getOrderDetails() - .stream() - .map(OrderDetail::getMappings) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - // 保存策略映射 - orderStrategyMappingManager.saveAll(orderStrategyMappings); - } - - /** - * 付款成功状态变更 - */ - public void paidOrderState(Long orderId) { - Order order = orderManager.findById(orderId).orElseThrow(() -> new BizException("订单未查到")); - if (!Objects.equals(order.getStatus(), OrderStatusCode.STATUS_NORMAL)) { - throw new BizException("不可以操作的状态"); - } - - order.setStatus(OrderStatusCode.STATUS_NOT_YET_SHIPPED) - .setPayTime(LocalDateTime.now()); - orderManager.updateById(order); - - // 使用优惠券 - String couponIds = order.getCouponIds(); - if (StrUtil.isNotBlank(couponIds)) { - List ids = StrUtil.split(couponIds, ",").stream() - .map(Long::new) - .collect(Collectors.toList()); -// couponClient.useBatch(ids,orderId); - } - } - - /** - * 转化成销售中心所需参数 - */ - private OrderCheckParam buildCheckOrder(OrderParam orderParam){ - OrderCheckParam orderCheckParam = new OrderCheckParam(); - BeanUtil.copyProperties(orderParam,orderCheckParam); - return orderCheckParam; - } - - /** - * 取消订单 - */ - public void cancelOrderState(Long orderId) { - Order order = orderManager.findById(orderId).orElseThrow(() -> new BizException("订单未查到")); - order.setStatus(OrderStatusCode.STATUS_CANCEL); -// throw new BizException("回滚测试"); - orderManager.updateById(order); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/billing/OrderBillingDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/billing/OrderBillingDto.java deleted file mode 100644 index c823a9e830f2762b30b8572db7d97c5605a26d9d..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/billing/OrderBillingDto.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.bootx.order.dto.billing; - -import cn.bootx.common.core.rest.dto.BaseDto; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -/** -* @author xxm -* @date 2020/12/9 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@Schema(title = "订单账单") -public class OrderBillingDto extends BaseDto implements Serializable { - - private static final long serialVersionUID = 6684557809868264317L; - - @Schema(description= "账户") - private Long userId; - - @Schema(description= "订单id") - private Long orderId; - - @Schema(description= "支付通道") - private Integer payType; - - @Schema(description= "支付类型名称") - private String payTypeName; - - @Schema(description= "支付金额") - private BigDecimal amount; - - @Schema(description= "使用数量") - private int count; - - @Schema(description= "业务主键") - private String businessId; - - private List orderItemBillings; -} \ No newline at end of file diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/billing/OrderItemBillingDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/billing/OrderItemBillingDto.java deleted file mode 100644 index 550d438568a481f24990fcb0b19e7f4ed94e1ba1..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/billing/OrderItemBillingDto.java +++ /dev/null @@ -1,64 +0,0 @@ -package cn.bootx.order.dto.billing; - -import cn.bootx.common.core.rest.dto.BaseDto; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** -* @author xxm -* @date 2020/12/9 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@Schema(title = "订单详情账单") -public class OrderItemBillingDto extends BaseDto implements Serializable { - - private static final long serialVersionUID = -5696250791473519741L; - - @Schema(description= "账单id") - private Long orderBillingId; - - @Schema(description= "用户id") - private Long userId; - - @Schema(description= "订单id") - private Long orderId; - - @Schema(description= "订单项id") - private Long orderItemId; - - @Schema(description= "订单项目skuId") - private Long orderItemSkuId; - - /** - * @see PayTransactionPurposeCode - */ - @Schema(description= "交易目的") - private int transactionPurpose; - - /** - * @see PayTransactionTypeCode - */ - @Schema(description= "交易类型") - private int transactionType; - - @Schema(description= "支付类型") - private int payType; - - @Schema(description= "支付金额") - private BigDecimal amount; - - @Schema(description= "使用数量") - private int count; - - @Schema(description= "入账时间") - private Long bookkeepingTime; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderAddressDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderAddressDto.java deleted file mode 100644 index ed3167fd0437cbc7168e8bf51a394bc24441cc0e..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderAddressDto.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.bootx.order.dto.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -/** -* 订单收货地址 -* @author xxm -* @date 2021/1/31 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "订单收货地址") -public class OrderAddressDto { - - /** 收货人 */ - private String consignee; - - /** 联系方式 */ - private String contact; - - /** 手机号 */ - private String phone; - - /** 邮政编码 */ - private String postalCode; - - /** 省编号 */ - private Integer provinceId; - - /** 省名称 */ - private String provinceName; - - /** 市编号 */ - private Integer cityId; - - /** 市名称 */ - private String cityName; - - /** 区县编号 */ - private Integer countyId; - - /** 区县名称 */ - private String countyName; - - /** 详细地址 */ - private String street; -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderDetailDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderDetailDto.java deleted file mode 100644 index 90df3e1aa40509c9f7efc693cc922fff1c7d2be0..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderDetailDto.java +++ /dev/null @@ -1,75 +0,0 @@ -package cn.bootx.order.dto.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -/** -* @author xxm -* @date 2020/10/21 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "订单明细") -public class OrderDetailDto implements Serializable { - - private static final long serialVersionUID = 7528634567769864592L; - - @Schema(description= "主键ID") - private Long id; - - @Schema(description= "活动ID") - private Long activeId; - - @Schema(description= "店铺ID") - private Long shopId; - - @Schema(description= "订单ID") - private Long orderId; - - @Schema(description= "类目ID") - private Long categoryId; - - @Schema(description= "商品ID") - private Long goodsId; - - @Schema(description= "skuId") - private Long skuId; - - @Schema(description= "商品名") - private String goodsTitle; - - @Schema(description= "商品价格") - private BigDecimal goodsPrice; - - @Schema(description= "商品数量") - private int num; - - @Schema(description= "总金额(原始)") - private BigDecimal totalAmount; - - @Schema(description= "优惠差价") - private BigDecimal payChange; - - @Schema(description= "总金额(优惠后)") - private BigDecimal payAmount; - - @Schema(description= "状态") - private int state = 0; - - @Schema(description= "是否虚拟商品") - private Boolean isVirtual = false; - - @Schema(description= "addition") - private String addition; - - @Schema(description= "应用策略后价格变动记录") - private List mappings = new ArrayList<>(); - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderDetailPriceDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderDetailPriceDto.java deleted file mode 100644 index c2d65d560c5847052cf31c486732b2b137cd8ae6..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderDetailPriceDto.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.bootx.order.dto.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * @author xxm - * @date 2020/10/30 - */ -@Data -@Accessors(chain = true) -@Schema(title = "订单详细价格") -public class OrderDetailPriceDto implements Serializable { - - private static final long serialVersionUID = 6826090889958126998L; - - private Long id; - - private Long orderId; - - private Long orderDetailId; - - private Long orderPriceId; - - private String name; - - private int type; - - private BigDecimal amount; - - private String addition; - - private String remark; - -} - diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderDto.java deleted file mode 100644 index 472dee15da3770d3875defd500e8c6caf9bbd71e..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderDto.java +++ /dev/null @@ -1,77 +0,0 @@ -package cn.bootx.order.dto.order; - -import cn.bootx.order.code.OrderStatusCode; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; - -/** - * 订单 - * @author xxm - * @date 2020/10/11 - */ -@Data -@Accessors(chain = true) -@Schema(title = "订单") -public class OrderDto implements Serializable { - private static final long serialVersionUID = -7600415200619006458L; - - @Schema(description= "主键ID") - private Long id; - - @Schema(description= "code") - private String code; - - @Schema(description= "支付时间") - private LocalDateTime payTime; - - @Schema(description= "订单描述") - private String description; - - @Schema(description= "创建时间") - private LocalDateTime createTime; - - @Schema(description= "购买人ID") - private Long userId; - - /** - * @see OrderStatusCode - */ - @Schema(description= "状态") - private Integer status; - - @Schema(description= "类型") - private Integer type; - - @Schema(description= "总金额") - private BigDecimal totalAmount; - - @Schema(description= "实付金额") - private BigDecimal payAmount; - - @Schema(description= "渠道ID") - private Long channelId; - - @Schema(description= "所用优惠券") - private String couponIds; - - @Schema(description= "订单明细") - private List details; - - @Schema(description= "优惠金额") - private List mappings = new ArrayList<>(); - - @Schema(description= "收货地址") - private OrderAddressDto orderAddressInfo; - - @Schema(description= "发票信息") - private OrderInvoiceDto orderInvoiceInfo; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderInvoiceDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderInvoiceDto.java deleted file mode 100644 index 20f54ae4abd4ffb4eaccd0b8f339429165aab75a..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderInvoiceDto.java +++ /dev/null @@ -1,61 +0,0 @@ -package cn.bootx.order.dto.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.util.Date; - -/** - * 订单发票信息 - * @author xxm - * @date 2021/1/31 - */ -@Data -@Accessors(chain = true) -@Schema(title = "订单发票信息") -public class OrderInvoiceDto { - - /** 发票id */ - private Integer invoiceId; - - /** 用户增值税发票id */ - private Integer userInvoiceId; - - /** 税号 */ - private String contact; - - /** 开户行名称 */ - private String bankName; - - /** 开户行账号 */ - private String bankNo; - - /** 详细地址 */ - private String registerAddress; - - /** 手机号 */ - private String invoicePhone; - - /** 发票抬头 */ - private String invoiceTitle; - - /** 发票类型 0普通发票1电子发票2增值税发票 */ - private Integer invoiceType; - - /** 发票类型名称 0普通发票1电子发票2增值税发票 */ - private String invoiceTypeName; - - /** 发票内容 */ - private String invoiceDesc; - - /** 开票时间 */ - private Date addTime; - - /** 发票状态 */ - private Integer status; - - /** 公司名称 */ - private String companyName; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderPriceDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderPriceDto.java deleted file mode 100644 index ad6f850f79c0195ec688eb37920a834d295bd423..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderPriceDto.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.bootx.order.dto.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * @author xxm - * @date 2020/10/18 - */ -@Data -@Accessors(chain = true) -@Schema(title = "订单价格") -public class OrderPriceDto implements Serializable { - - private static final long serialVersionUID = 7509707540439019092L; - - public static final int TYPE_STRATEGY = 1; - - public static final int TYPE_FEE = 2; - - public static final int TYPE_TAX = 3; - - public static final int TYPE_OTHER = 4; - - private Long id; - - private Long orderId; - - private String name; - - private int type; - - private BigDecimal amount; - - private String addition; - - private String remark; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderStrategyMappingDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderStrategyMappingDto.java deleted file mode 100644 index 6535d76d1305ddf3c3caa0105cf729457058b4fc..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/order/OrderStrategyMappingDto.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.bootx.order.dto.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** -* -* @author xxm -* @date 2021/3/10 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "应用策略后价格变动记录") -public class OrderStrategyMappingDto implements Serializable { - private static final long serialVersionUID = 5845910774643018583L; - - @Schema(description= "主键ID") - private Long id; - - @Schema(description= "订单id") - private Long orderId; - - @Schema(description= "明细id") - private Long orderDetailId; - - @Schema(description= "优惠券ID") - private Long couponId; - - @Schema(description= "策略ID") - private Long strategyId; - - @Schema(description= "策略注册ID") - private Long strategyRegisterId; - - @Schema(description= "价格变动") - private BigDecimal priceChange; - - @Schema(description= "描述") - private String desc; -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/returm/ReturnOrderDetailDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/returm/ReturnOrderDetailDto.java deleted file mode 100644 index 6f9bb9b87f82832be07ebd6ae51a892a0b8e4d6e..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/returm/ReturnOrderDetailDto.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.bootx.order.dto.returm; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** -* -* @author xxm -* @date 2020/11/19 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "退货单明细dto") -public class ReturnOrderDetailDto implements Serializable { - - private static final long serialVersionUID = 3467727603218965746L; - - @Schema(description= "主键ID") - private Long id; - - @Schema(description= "订单ID") - private Long orderId; - - @Schema(description= "skuId") - private Long skuId; - - @Schema(description= "支付金额") - private BigDecimal payAmount; - - @Schema(description= "原订单明细ID") - private Long originDetailId; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/returm/ReturnOrderDto.java b/bootx-services/service-order/src/main/java/cn/bootx/order/dto/returm/ReturnOrderDto.java deleted file mode 100644 index 8abfc91d271de2a74a3e96d2c16956bd941bd19e..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/dto/returm/ReturnOrderDto.java +++ /dev/null @@ -1,60 +0,0 @@ -package cn.bootx.order.dto.returm; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -/** -* @author xxm -* @date 2020/11/19 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "退货单dto") -public class ReturnOrderDto implements Serializable { - private static final long serialVersionUID = 3654344763212531452L; - - /** - * 退款中 - */ - public static final int STATE_REFUNDING = 0; - - /** - * 退款成功 - */ - public static final int STATE_REFUNDED = 1; - - /** - * 退款失败 - */ - public static final int STATE_REFUND_FAILURE = 2; - - - @Schema(description= "主键ID") - private Long id; - - @Schema(description= "租户ID") - private Long tenantId; - - @Schema(description= "渠道ID") - private Long channelId; - - @Schema(description= "支付金额") - private BigDecimal payAmount; - - @Schema(description= "原订单ID") - private Long originOrderId; - - @Schema(description= "退货单状态") - private Integer state; - - @Schema(description= "业务主键") - private Long businessId; - - private List detailDtos; -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderAlreadyPaidException.java b/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderAlreadyPaidException.java deleted file mode 100644 index 91afb3f8e36240b0823e44bac4ae9c9b1d30d5d3..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderAlreadyPaidException.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.bootx.order.exception.order; - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.order.code.OrderCenterErrorCode.ORDER_ALREADY_PAID; - -/** - * 订单已支付 -* @author xxm -* @date 2020/12/10 -*/ -public class OrderAlreadyPaidException extends BizException { - - public OrderAlreadyPaidException() { - super(ORDER_ALREADY_PAID, "订单已支付"); - } -} - diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderCancelledException.java b/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderCancelledException.java deleted file mode 100644 index fb5cc06ea93da376251d007dae492fc4bfdc7613..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderCancelledException.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.bootx.order.exception.order; - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.order.code.OrderCenterErrorCode.ORDER_CANCELLED; - -/** -* 订单已取消 -* @author xxm -* @date 2019/5/28 13:51 -*/ - -public class OrderCancelledException extends BizException { - - public OrderCancelledException() { - super(ORDER_CANCELLED, "订单被取消"); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderNotExistException.java b/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderNotExistException.java deleted file mode 100644 index 9b84073248cb4ea32475db9989bd27d818c57482..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderNotExistException.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.bootx.order.exception.order; - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.order.code.OrderCenterErrorCode.ORDER_NOT_EXIST; - -/** - * 订单不存在 - * @author xxm - * @date 2020/11/26 - */ -public class OrderNotExistException extends BizException { - public OrderNotExistException() { - super(ORDER_NOT_EXIST, "订单不存在"); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderPayingException.java b/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderPayingException.java deleted file mode 100644 index e846470aa4a605845e89170ab3db50d0bb6f076b..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderPayingException.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bootx.order.exception.order; - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.order.code.OrderCenterErrorCode.ORDER_PAYING; - -/** -* 订单已付款 -* @author xxm -* @date 2020/12/10 -*/ -public class OrderPayingException extends BizException { - - public OrderPayingException() { - super(ORDER_PAYING, "订单已付款"); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderTimeOutException.java b/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderTimeOutException.java deleted file mode 100644 index 365e142ca848474d67fd21ea8365f7ca1ea895eb..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/exception/order/OrderTimeOutException.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.bootx.order.exception.order; - - -import cn.bootx.common.core.exception.BizException; - -import static cn.bootx.order.code.OrderCenterErrorCode.ORDER_TIME_OUT; - -/** -* 订单超时 -* @author xxm -* @date 2020/12/10 -*/ -public class OrderTimeOutException extends BizException { - - public OrderTimeOutException() { - super(ORDER_TIME_OUT, "订单超时"); - } -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingItemQueryParam.java b/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingItemQueryParam.java deleted file mode 100644 index 3a066a6779cb153c83972bf7604895ac96f272f5..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingItemQueryParam.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bootx.order.param.billing; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.List; - -@Data -@Accessors(chain = true) -@Schema(title = "") -public class BillingItemQueryParam implements Serializable { - - private static final long serialVersionUID = -1207002879020383711L; - private LocalDateTime startDate; - - private LocalDateTime endDate; - - private LocalDateTime startBookingKeepingDate; - - private LocalDateTime endBookingKeepingDate; - - private List shiftIds; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingOrderDetailParam.java b/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingOrderDetailParam.java deleted file mode 100644 index 8354652d1463bd4b589c5eb9763a184bc82080b7..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingOrderDetailParam.java +++ /dev/null @@ -1,58 +0,0 @@ -package cn.bootx.order.param.billing; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -/** -* @author xxm -* @date 2020/12/09 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "分账订单明细参数") -public class BillingOrderDetailParam implements Serializable { - - private static final long serialVersionUID = 6183800463776194467L; - @Schema(description= "订单明细ID", required = true) - private Long id; - - @Schema(description= "库存单品Id", required = true) - private Long skuId; - - @Schema(description= "商品标题") - private String goodsTitle; - - @Schema(description= "商品价格") - private BigDecimal goodsPrice; - - @Schema(description= "数量") - private int num; - - @Schema(description= "支付金额") - private BigDecimal payAmount; - - @Schema(description= "状态") - private int state = 0; - - @Schema(description= "订单项扩展信息") - private String addition; - - /** - * 该detail不支持的支付方式 - * (例如 部分prod不支持积分支付,那么在记账的时候该product将无法分担积分部分的账单金额) - */ - @Schema(description= "该detail不支持的支付方式") - private List unsupportedPaymentType; - - @Schema(description= "剩余记账次数(当前只用于订单,不支持商品附加服务额外付款)", hidden = true) - private int leftBillingNum; - - @Schema(description= "未记账金额", hidden = true) - private BigDecimal leftBillingAmount; -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingOrderParam.java b/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingOrderParam.java deleted file mode 100644 index 01a92e292fd5be4bf7161462e715d9b93a93cac9..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingOrderParam.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.bootx.order.param.billing; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -/** -* @author xxm -* @date 2020/12/10 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "分账订单参数") -public class BillingOrderParam implements Serializable { - - private static final long serialVersionUID = 157222599179861801L; - @Schema(description= "订单ID", required = true) - private Long id; - - @Schema(description= "订单号") - private String code; - - @Schema(description= "订单描述") - private String description; - - @Schema(description= "支付金额") - private BigDecimal payAmount; - - @Schema(description= "订单详情列表",required = true) - private List orderDetailParams = new ArrayList<>(); -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingQueryWithPageParam.java b/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingQueryWithPageParam.java deleted file mode 100644 index c0be4fef65c09bee1b8d2a01ea046062ac646ad7..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingQueryWithPageParam.java +++ /dev/null @@ -1,20 +0,0 @@ -package cn.bootx.order.param.billing; - -import cn.bootx.common.core.rest.param.PageParam; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@Schema(title = "") -public class BillingQueryWithPageParam extends PageParam implements Serializable { - - private static final long serialVersionUID = -1135003203694525261L; - private Long userId; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderDetailParam.java b/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderDetailParam.java deleted file mode 100644 index 25f9d51284dd4e1a6a9e8694bdd33dd8a39a8f7e..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderDetailParam.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.bootx.order.param.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -@Data -@Accessors(chain = true) -@Schema(title = "订单明细参数") -public class OrderDetailParam implements Serializable { - - private static final long serialVersionUID = 2984639517325652160L; - @Schema(description= "类目id") - private Long categoryId; - - @Schema(description= "活动ID") - private Long activeId; - - @Schema(description= "店铺id") - private Long shopId; - - @Schema(description= "商品id") - private Long goodsId; - - @Schema(description= "sku id") - private Long skuId; - - @Schema(description= "商品名") - private String goodsTitle; - - @Schema(description= "商品价格") - private BigDecimal goodsPrice; - - @Schema(description= "数量") - private int num; - - @Schema(description= "附加参数 json") - private String addition; - - @Schema(description= "使用的活动策略id集合") - private List activityIds; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderParam.java b/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderParam.java deleted file mode 100644 index cd59590d2addbc1ccd28313fe50ddfe22ce2cc6e..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderParam.java +++ /dev/null @@ -1,62 +0,0 @@ -package cn.bootx.order.param.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -/** -* @author xxm -* @date 2020/10/15 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "订单参数") -public class OrderParam implements Serializable { - - private static final long serialVersionUID = 546385575171313726L; - - @Schema(description= "code") - private String code; - - @Schema(description= "购者id") - private Long userId; - - @Schema(description= "订单描述") - private String description; - - @Schema(description= "来源") - private String source; - - @Schema(description= "渠道id") - private Long channelId; - - @Schema(description= "订单类型") - private Integer type; - - @Schema(description= "总金额") - private BigDecimal totalAmount; - - @Schema(description= "附加参数 json") - private String addition; - - @Schema(description= "设备id") - private String deviceId; - - @Schema(description= "业务 ID") - private Long businessId; - - @Schema(description= "订单明细") - private List details; - - @Schema(description= "选择的优惠券") - private List couponIds; - - @Schema(description= "全部待选优惠券",hidden = true) - private List allCouponIds; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderPriceInfoParam.java b/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderPriceInfoParam.java deleted file mode 100644 index 7a70aa799e598d981b39babd5c273f40b99c2e44..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderPriceInfoParam.java +++ /dev/null @@ -1,54 +0,0 @@ -package cn.bootx.order.param.order; - - -import cn.bootx.order.dto.order.OrderPriceDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** -* 应用于订单的价格项目,实付金额会根据本列表进行计算 -* @author xxm -* @date 2020/10/15 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "订单价格信息参数") -public class OrderPriceInfoParam implements Serializable { - - - public static final int TYPE_STRATEGY = OrderPriceDto.TYPE_STRATEGY; - - public static final int TYPE_FEE = OrderPriceDto.TYPE_FEE; - - public static final int TYPE_TAX = OrderPriceDto.TYPE_TAX; - - public static final int TYPE_OTHER = OrderPriceDto.TYPE_OTHER; - private static final long serialVersionUID = -2629554281566395675L; - - - /** - * 价格类型 (默认 TYPE_OTHER) - */ - private Integer type = TYPE_OTHER; - - /** - * 价格项目名称 - */ - private String name; - - /** - * 金额(实付金额会+/-本金额) - */ - private BigDecimal amount; - - /** - * 备注内容会直接计入价格项目的备注 - */ - private String remark; - - private String addition; -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderUpdateParam.java b/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderUpdateParam.java deleted file mode 100644 index 082812bfcbd4b522ea73659df33a95f5e76ffe47..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderUpdateParam.java +++ /dev/null @@ -1,40 +0,0 @@ -package cn.bootx.order.param.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.Date; - -/** -* @author xxm -* @date 2020/10/31 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "订单更新参数") -public class OrderUpdateParam implements Serializable { - - private static final long serialVersionUID = 4460069559043995466L; - private Long id; - - @Schema(description= "姓名") - private String contactName; - - @Schema(description= "手机") - private String contactPhone; - - @Schema(description= "邮箱") - private String contactEmail; - - @Schema(description= "支付时间") - private Date payTime; - - @Schema(description= "状态") - private Integer state; - - private Long buyerId; - -} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderWholeParam.java b/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderWholeParam.java deleted file mode 100644 index d590e719b7109e3e0daf6e9b70472fdc6c1deebe..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/param/order/OrderWholeParam.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.bootx.order.param.order; - -import cn.bootx.order.dto.order.OrderAddressDto; -import cn.bootx.order.dto.order.OrderInvoiceDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* 下单参数 -* @author xxm -* @date 2021/3/14 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "下单参数") -public class OrderWholeParam implements Serializable { - private static final long serialVersionUID = 7661069240452921149L; - - /** 订单参数 */ - private OrderParam orderParam; - - /** 收货信息 */ - private OrderAddressDto orderAddressInfo; - - /** 发票信息 */ - private OrderInvoiceDto orderInvoiceInfo; -} diff --git a/bootx-services/service-order/src/main/resources/META-INF/spring.factories b/bootx-services/service-order/src/main/resources/META-INF/spring.factories deleted file mode 100644 index 52fb738b6dc6b64482e876470ec04d871e7b034b..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -## 配置自动化配置 -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - cn.bootx.order.OrderApplication diff --git a/bootx-services/service-order/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/bootx-services/service-order/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index fd445ebb2cca8d683cc778d86e1dd47ff64f1367..0000000000000000000000000000000000000000 --- a/bootx-services/service-order/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -cn.bootx.starter.wecom.WeComAutoConfiguration \ No newline at end of file diff --git a/bootx-services/service-payment/pom.xml b/bootx-services/service-payment/pom.xml index 24af9dff77f18b7dabe9f78bbeff86881fac733e..b932bc107e70a321908a616fcde31574918561a1 100644 --- a/bootx-services/service-payment/pom.xml +++ b/bootx-services/service-payment/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-services - 1.2.1 + 1.2.2 4.0.0 diff --git a/bootx-services/service-sales/README.md b/bootx-services/service-sales/README.md deleted file mode 100644 index 8f69a8034aaf724cc7b01718b75b84e8f299373e..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/README.md +++ /dev/null @@ -1,124 +0,0 @@ -# 销售中心 - -## 介绍 - -## 核心概念 -- 策略定义 -- 策略注册 -- 策略参数定义 -- 策略参数配置 -- 优惠活动 -- 优惠券模板 -- 优惠券 -- 检查规则 -- 匹配规则 -- 特征点 -- 优惠互斥 -- 优惠叠加(使用平行优惠) - -## 核心流程时序图 -### 优惠选择时序图 -![优惠选择时序图](https://images.gitee.com/uploads/images/2021/0811/161133_c69de0a1_524686.png "优惠选择时序图.png") -### 优惠检查时序图 -![优惠检查时序图](https://images.gitee.com/uploads/images/2021/0811/161231_ac273a5e_524686.png "优惠检查时序图.png") -### 优惠计算时序图 -![优惠计算时序图](https://images.gitee.com/uploads/images/2021/0811/161258_b6479e84_524686.png "优惠计算时序图") - -## 说明 -1. 策略定义 - 一种行为的抽象定义,如满减,满折,立减就是一种优惠策略,首次购买、需要身份是会员、生日当天可用就是一种检测策略 - 策略定义根据执行引擎分,有Java原生、Groovy脚本引擎和JavaScript引擎 - - Java原生,通常推荐使用这种类型,性能最优,运行稳定,缺点是无法在运行时进行动态修改 - - JavaScript,可以被热部署,编写脚本保存到数据库中就可以生效,但是无法访问和调用传入参数之外的资源 - - Groovy,相对于JavaScript,Groovy脚本在执行的时候可以调用项目中的Java代码,能实现更灵活的 - 根据应用目标分,有计算、检查、匹配三种。 - -2. 策略注册 - 策略注册分为优惠活动和优惠券模板,把策略定义看为类的话,策略注册就是根据定义创建的一个个对象,如一个满减策略就可以创建出90-50、30-20,5-4等多种满减方式 -3. 策略参数定义 - 和策略定义是一对多关系,一个策略定义会有多个策略参数定义,把策略定义看做一个函数的话,策略参数定义就是函数的入参定义,例如一个满减策略,需要配置满多少减多少,满多少和减多少就是两个策略参数定义。 -4. 策略参数配置 - 拿90-50满减策略打比喻,通过策略定义创建出这个具体的满减策略时,90和50就是要配置参数。策略参数配置依赖于策略注册,可以视为是创建对象时,所传入的参数值 -5. 优惠活动 - 只要用户符合条件就可以参加的优惠,如双十一全场300-40活动,具体体现可以看看京东, -6. 优惠券模板 - 根据优惠券模板可以定义将要发送多少张优惠券,使用领取时的限定条件,具体的优惠措施等 -7. 优惠券 - 在购物支付时可以使用的卡券,与活动不同的是,优惠券需要自己手动领取 -8. 检查规则 - 检查传入订单选择的优惠是否合法,分为优惠活动检查和优惠券检查,有领取检查、选择检查和使用检查。一个检查规则会对应到一个策略定义上, -9. 匹配规则 - 根据特征点匹配关系进行匹配对应策略,核心属性是特征类型、特征点和匹配类型构成 - - 特征类型 如商品分类、所属商店等 - - 特征点 如电子产品,Apple自营店 - - 匹配类型 例如,属于、不属于、大于、小于等 -10. 特征点 - 对传入订单参数进行特征点提取,通过特征点判断是否适用对应的优惠策略,目前抽取特征点算法都是通过java编写,暂不支持其他语言引擎 - -## 使用说明 -### 添加策略定义 - -参数对象说明 - -策略定义对象 `cn.bootx.sales.param.strategy.StrategyParam` -策略参数定义对象 `cn.bootx.sales.param.strategy.StrategyConfigParam` - -通过code和engineType参数找到要执行的优惠策略,想要增加对应的java原生类型策略,需要实现对应接口,并将策略类注册到Spring的Bean容器中 -1. 检查策略,实现`AbstractCheckRule`接口 -2. 计算策略,实现`JavaCalculateHandler`接口 -3. 特征点提取规则,实现`FeatureHandler`接口(虽然不属于策略定义, 但定义方式类似,这也放一份了) - - -### 检查规则 - -计算时具体执行逻辑通过 - -**检查规则对象 CheckRuleParam** - -| 参数 | 名称 | 说明 | -| ---------- | -------- | ------------------------------------------ | -| priority | 优先级 | 运行时的顺序,优先级越高越靠前 | -| name | 规则名称 | 名称 | -| code | 规则code | 编码 | -| ruleType | 规则类型 | 优惠券模板类型和活动类型 | -| strategyId | 策略id | 策略定义的id, 用来关联到检查策略 | -| addition | 附加对象 | 计算时所需要的参数,相当于策略运行时的参数 | - -### 匹配规则 - -**匹配规则对象 MatchRuleParam** - -| 参数 | 名称 | 说明 | -| ------------ | -------- | ----------------------------- | -| featureType | 特征类型 | 要被抽取特征点的类型,如skuId | -| featurePoint | 特征点 | 具体的特征点值 | -| matchType | 匹配类型 | 和订单进行匹配的明细 | - -1. 新增特征点提取规则,实现`FeatureHandler`接口 - -### 添加活动 - -第一需要设置应用的是那种策略,第二是设置会根据哪些特征点进行匹配,第三是选择、使用等时候的检查规则 - -参数对象说明 - -活动参数对象 `cn.bootx.sales.param.activity.ActivityParam` -策略参数值 `cn.bootx.sales.param.strategy.StrategyConfigValueParam` -检查规则参数 `cn.bootx.sales.param.strategy.CheckRuleParam` -匹配配置 `cn.bootx.sales.param.strategy.MatchRuleParam` - -### 添加优惠劵模板 - -基本同优惠活动,第一需要设置应用的是那种策略,第二是设置会根据哪些特征点进行匹配,第三是领取、使用等时候的检查规则, 第四是优惠券特有的一些配置 - -参数对象说明 -优惠券模板 `cn.bootx.sales.param.coupon.CouponTemplateParam` -策略参数值 `cn.bootx.sales.param.strategy.StrategyConfigValueParam` -检查规则参数 `cn.bootx.sales.param.strategy.CheckRuleParam` -匹配配置 `cn.bootx.sales.param.strategy.MatchRuleParam` - -### 计算价格 -调用 `cn.bootx.sales.core.calculate.service.OrderPreviewService`的 `previewOrderPrice`或者`previewOrderPriceNoCheck`方法 - -### 缓存构建 -因为计算时或对订单策略进行监察室会访问很多数据,io开销较大,为了提高预算是的速度,在进行计算之前,会提前缓存计算过程中所需要的数据,参见`CalculateFactory`和`CalculateCache`对象 \ No newline at end of file diff --git a/bootx-services/service-sales/pom.xml b/bootx-services/service-sales/pom.xml deleted file mode 100644 index 05b0b1cdac84e3add8ff218e30a56e54f399dc6f..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/pom.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - bootx-services - cn.bootx.platform - 1.2.1 - - 4.0.0 - - service-sales - - - - - com.mysql - mysql-connector-j - runtime - - - - - com.baomidou - mybatis-plus-boot-starter - - - - diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/SalesApplication.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/SalesApplication.java deleted file mode 100644 index 23bc6dd522d963f443abd8a4557a2381e876bb1c..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/SalesApplication.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bootx.sales; - -import org.apache.ibatis.annotations.Mapper; -import org.mybatis.spring.annotation.MapperScan; -import org.springframework.context.annotation.ComponentScan; - -/** -* 销售中心 -* @author xxm -* @date 2021/8/10 -*/ -@ComponentScan -@MapperScan(annotationClass = Mapper.class) -public class SalesApplication { -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/CheckRuleCode.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/CheckRuleCode.java deleted file mode 100644 index 60a8f8f2b93f34b9a36f876888e3618c32e7b9d7..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/CheckRuleCode.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.bootx.sales.code; - -/** - * - * @author xxm - * @date 2021/5/8 - */ -public interface CheckRuleCode { - - /** 活动策略类型 */ - int RULE_ACTIVITY = StrategyCode.ACTIVITY; - - /** 优惠券类型 */ - int RULE_COUPON = StrategyCode.COUPON; - - /* 检查类型规则 */ - /** 活动使用检查 */ - int RULE_TYPE_ACTIVITY_CHECK = 1; - - /** 优惠券使用检查 */ - int RULE_TYPE_COUPON_CHECK = 2; - - /** 优惠券领取检查 */ - int RULE_TYPE_COUPON_OBTAIN = 3; - - interface Activity { - /** 渠道检查 */ - String CHECK_CHANNEL = "activityCheckChannel"; - - } - - interface Coupon { - - /** 渠道检查 */ - String CHECK_CHANNEL = "couponCheckChannel"; - - /** 是否支持多个同时使用 */ - String CHECK_USE_MULTIPLE = "couponCheckUseMultiple"; - - /** 是否支持领取多张 */ - String OBTAIN_MULTIPLE = "obtainMultiple"; - - /** 领取时渠道限制 */ - String OBTAIN_CHANNEL_LIMIT = "obtainChannelLimit"; - - /** 领取时间限制 */ - String OBTAIN_TIME_LIMIT = "obtainTimeLimit"; - - /** 领取张数限制 */ - String OBTAIN_NUM_LIMIT = "obtainNumLimit"; - - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/CouponStatusCode.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/CouponStatusCode.java deleted file mode 100644 index 827c1dd61c778c8ff923a3eeb2b0998ba78e2215..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/CouponStatusCode.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.bootx.sales.code; - -/** -* 优惠券状态 -* @author xxm -* @date 2020/12/1 -*/ -public interface CouponStatusCode { - /** 正常可用 */ - int STATUS_NORMAL = 1; - /** 冻结 */ - int STATUS_FREEZE = 2; - /** 已使用 */ - int STATUS_USED = 3; - /** 已过期 */ - int STATUS_EXPIRED = 4; - /** 已撤销 */ - int STATUS_REVOKE = 5; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/MatchRuleCode.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/MatchRuleCode.java deleted file mode 100644 index f8b297e98c5cecf7209746632be46fc98ea2e497..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/MatchRuleCode.java +++ /dev/null @@ -1,76 +0,0 @@ -package cn.bootx.sales.code; - -import java.util.Arrays; -import java.util.List; - -/** -* 匹配策略 -* @author xxm -* @date 2020/12/3 -*/ -public interface MatchRuleCode { - - /** 活动策略类型 */ - int MATCH_ACTIVITY = StrategyCode.ACTIVITY; - /** 优惠券类型 */ - int MATCH_COUPON = StrategyCode.COUPON; - - /** - * 注册类型 - SKU - */ - int MATCH_TYPE_SKU = 1; - - /** - * 注册类型 - 商品 - */ - int MATCH_TYPE_GOODS = 2; - - /** - * 注册类型 - 类目 - */ - int MATCH_TYPE_CATEGORY = 3; - - /** - * 注册类型 - 店铺 - */ - int MATCH_TYPE_SHOP = 4; - - /** - * 注册类型 - 活动 - */ - int MATCH_TYPE_ACTIVE = 5; - - /** - * 注册类型 - 全局适用 - */ - int MATCH_TYPE_GLOBAL = 6; - - /** - * 注册类型 - 非虚拟商品 - */ - int MATCH_TYPE_NOT_VIRTUAL = 7; - - /** - * 注册类型 - 排除指定SKU - */ - int MATCH_TYPE_EXCLUDE_SKU = 11; - - /** - * 注册类型 - 排除指定商品 - */ - int MATCH_TYPE_EXCLUDE_GOODS = 12; - - /** - * 注册类型 - 排除指定类目 - */ - int MATCH_TYPE_EXCLUDE_CATEGORY = 13; - - List GLOBAL_ACTIVITY = Arrays.asList( - MATCH_TYPE_GLOBAL, - MATCH_TYPE_NOT_VIRTUAL, - MATCH_TYPE_EXCLUDE_SKU, - MATCH_TYPE_EXCLUDE_GOODS, - MATCH_TYPE_EXCLUDE_CATEGORY - ); - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/MatchTypeCode.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/MatchTypeCode.java deleted file mode 100644 index 22f4c8e03af406c174d7506ce115ad3ec2a39e03..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/MatchTypeCode.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.bootx.sales.code; - -/** -* 匹配类型 -* @author xxm -* @date 2021/5/18 -*/ -public interface MatchTypeCode { - String EQ = "eq"; - String NE = "ne"; - String LIKE = "like"; - String GT = "gt"; - String GE = "ge"; - String LT = "lt"; - String LE = "le"; - String IN = "in"; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/SalesCenterCode.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/SalesCenterCode.java deleted file mode 100644 index 2f506b444771466ed03c328d97c9de3913a18996..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/SalesCenterCode.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.sales.code; - -/** -* -* @author xxm -* @date 2021/4/13 -*/ -public interface SalesCenterCode { - - /** - * 项目名称 - */ - String APPLICATION_NAME = "service-sales-center"; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/SalesCenterErrorCode.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/SalesCenterErrorCode.java deleted file mode 100644 index 0ad118bdda821f0588a7a2d78fc1a499f5326ddd..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/SalesCenterErrorCode.java +++ /dev/null @@ -1,66 +0,0 @@ - -package cn.bootx.sales.code; - -/** -* 错误码定义类 -* @author xxm -* @date 2020/10/11 -*/ -public interface SalesCenterErrorCode { - - /** - * 策略计算错误 - */ - int STRATEGY_CALCULATE_ERROR = 23010; - - /** - * 策略已使用不可修改 - */ - int STRATEGY_ALREADY_USED = 23011; - - /** - * 策略注册信息已存在 - */ - int STRATEGY_REGISTER_ALREADY_EXIST = 23012; - - /** - * 策略类型错误 - */ - int STRATEGY_TYPE_ERROR = 23013; - - /** - * 策略不存在 - */ - int STRATEGY_NOT_EXIST = 23014; - - /** - * 渠道端已经被使用 - */ - int CLIENT_ALREADY_USED = 23016; - - /** - * 渠道端不存在 - */ - int CLIENT_NOT_FOUND = 23017; - - /** - * ID不存在 - */ - int ID_NOT_EXISTS = 23018; - - /** - * 渠道已存在 - */ - int CHANNEL_ALREADY_EXISTS = 23019; - - /** - * 优惠券领取异常 - */ - int COUPON_OBTAIN_EXCEPTION = 23020; - - /** - * 优惠券使用异常 - */ - int COUPON_USE_EXCEPTION = 23021; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/StrategyCode.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/StrategyCode.java deleted file mode 100644 index 5b3b5e57fc6abec597409d9bdd0a695af27e8557..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/StrategyCode.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.bootx.sales.code; - -/** -* 策略code -* @author xxm -* @date 2021/3/10 -*/ -public interface StrategyCode { - - /** 系统内置 */ - int ENGINE_SYSTEM = 1; - /** JavaScript引擎 */ - int ENGINE_JAVASCRIPT = 2; - /** Groovy引擎 */ - int ENGINE_GROOVY = 3; - - /** 活动策略 */ - int ACTIVITY = 1; - /** 优惠券 */ - int COUPON = 2; - - /** 计算 */ - int TARGET_TYPE_CALCULATE = 1; - /** 匹配 */ - int TARGET_TYPE_MATCH = 2; - /** 检查 */ - int TARGET_TYPE_CHECK = 3; - - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/StrategyRegisterCode.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/StrategyRegisterCode.java deleted file mode 100644 index a3b1699dc30514f72d65c0db8af578b24bad22f8..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/code/StrategyRegisterCode.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.bootx.sales.code; - -/** -* 策略注册相关常量 -* @author xxm -* @date 2020/11/8 -*/ -public interface StrategyRegisterCode { - - /** - * 策略类型 活动 - */ - int STRATEGY_TYPE_ACTIVITY = StrategyCode.ACTIVITY; - - /** - * 策略类型 优惠券 - */ - int STRATEGY_TYPE_COUPON = StrategyCode.COUPON; - - /** - * 策略状态 - */ - int STATE_NORMAL = 1; - int STATE_NOT_ACTIVE = 0; - - /** - * 策略激活状态 - */ - int ACTIVE_YES = 1; - int ACTIVE_NO = 0; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/ActivityController.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/ActivityController.java deleted file mode 100644 index 0a7c4b2c1a6602ac822cbc561b668daea4032c58..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/ActivityController.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.bootx.sales.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.sales.core.activity.service.ActivityService; -import cn.bootx.sales.dto.activity.ActivityDto; -import cn.bootx.sales.param.activity.ActivityParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** -* @author xxm -* @date 2021/5/7 -*/ -@Tag(name ="活动") -@RestController -@RequestMapping("/activity") -@AllArgsConstructor -public class ActivityController { - private final ActivityService activityService; - - @Operation(summary = "注册活动") - @PostMapping("/add") - public ResResult add(@RequestBody ActivityParam param){ - return Res.ok(activityService.addByActivity(param)); - } - - @Operation(summary = "查询活动") - @GetMapping("/findAll") - public ResResult> findAll(){ - return Res.ok(activityService.findAll()); - } - - @Operation(summary = "查询活动") - @GetMapping("//get/{id}") - public ResResult get(@PathVariable Long id){ - return Res.ok(activityService.get(id)); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/CouponController.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/CouponController.java deleted file mode 100644 index 603f26f1082251c4089b05d2ed8018be9a4e98dd..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/CouponController.java +++ /dev/null @@ -1,66 +0,0 @@ -package cn.bootx.sales.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.sales.core.coupon.service.CouponService; -import cn.bootx.sales.dto.coupon.CouponDto; -import cn.bootx.sales.param.coupon.ObtainCouponParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** -* @author xxm -* @date 2020/11/1 -*/ -@Tag(name ="优惠券") -@RestController -@RequestMapping("/coupon") -@RequiredArgsConstructor -public class CouponController { - private final CouponService couponService; - - @Operation(summary = "领取优惠券") - @PostMapping("/obtainCoupon") - public ResResult obtainCoupon(@RequestBody ObtainCouponParam param){ - couponService.obtainCoupon(param); - return Res.ok(); - } - - @Operation(summary = "个人可用的优惠券") - @GetMapping("/findCoupon") - public ResResult> findCoupon(Long userId){ - return Res.ok(couponService.findCouponByUserId(userId)); - } - - @Operation(summary = "批量优惠券") - @GetMapping("/getById") - public ResResult getByIds(Long couponId){ - return Res.ok(couponService.getById(couponId)); - } - - @Operation(summary = "批量查询优惠券") - @GetMapping("/findByIds") - public ResResult> findByIds(List couponIds){ - return Res.ok(couponService.findByIds(couponIds)); - } - - @Operation(summary = "锁定优惠券") - @PostMapping("/lockById") - public ResResult lockById(Long couponId){ - couponService.lockById(couponId); - return Res.ok(); - } - - @Operation(summary = "批量锁定优惠券") - @PostMapping("/lockByIds") - public ResResult lockByIds(List couponIds){ - couponService.lockByIds(couponIds); - return Res.ok(); - } - - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/CouponTemplateController.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/CouponTemplateController.java deleted file mode 100644 index 5d11fcb06ecbaf87aff3559854b757fbae9ac1ad..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/CouponTemplateController.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.bootx.sales.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.sales.core.coupon.service.CouponTemplateService; -import cn.bootx.sales.dto.coupon.CouponTemplateDto; -import cn.bootx.sales.param.coupon.CouponTemplateParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** -* @author xxm -* @date 2020/11/1 -*/ -@Tag(name ="优惠券模板") -@RestController -@RequestMapping("/coupon/template") -@AllArgsConstructor -public class CouponTemplateController { - private final CouponTemplateService couponTemplateService; - - @Operation(summary = "新建优惠券模板") - @PostMapping("/add") - public ResResult addCouponTemplate(@RequestBody CouponTemplateParam param){ - return Res.ok(couponTemplateService.add(param)); - } - - @Operation(summary = "查询优惠券模板") - @PostMapping("/findAll") - public ResResult> findAll(){ - return Res.ok(couponTemplateService.findAll()); - } - - @Operation(summary = "优惠券模板详情") - @PostMapping("/get/{id}") - public ResResult get(@PathVariable Long id){ - return Res.ok(couponTemplateService.findById(id)); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/OrderPreviewController.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/OrderPreviewController.java deleted file mode 100644 index 7199dc7bd05bea8d3852394cac27123b55247086..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/OrderPreviewController.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.bootx.sales.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.sales.core.calculate.service.OrderPreviewService; -import cn.bootx.sales.dto.order.OrderPreviewResult; -import cn.bootx.sales.param.order.OrderCheckParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** -* @author xxm -* @date 2020/10/17 -*/ -@Tag(name ="订单计算") -@RestController -@RequestMapping("/order/preview") -@AllArgsConstructor -public class OrderPreviewController { - private final OrderPreviewService orderPreviewService; - - - @Operation(summary = "预览价格(手动)") - @PostMapping("/previewOrderPrice") - public ResResult previewOrderPrice(@RequestBody OrderCheckParam orderParam){ - return Res.ok(orderPreviewService.previewOrderPrice(orderParam)); - } - - @Operation(summary = "预览价格(手动无检查)") - @PostMapping("/previewOrderPriceNoCheck") - public ResResult previewOrderPriceNoCheck(@RequestBody OrderCheckParam orderParam){ - return Res.ok(orderPreviewService.previewOrderPriceNoCheck(orderParam)); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/OrderRecommendController.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/OrderRecommendController.java deleted file mode 100644 index 3037ea58dfe905ecd8b34eabcab135b42bfc7320..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/OrderRecommendController.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.bootx.sales.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.sales.core.recommend.OrderFindActivityService; -import cn.bootx.sales.core.recommend.OrderFindCouponService; -import cn.bootx.sales.dto.coupon.CouponDto; -import cn.bootx.sales.dto.order.GoodsActivityResult; -import cn.bootx.sales.param.order.OrderCheckParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.List; - -/** -* @author xxm -* @date 2021/5/14 -*/ -@Tag(name ="订单优惠选择与推荐") -@RestController -@RequestMapping("/order/recommend") -@AllArgsConstructor -public class OrderRecommendController { - - private final OrderFindCouponService couponSelectCheckService; - private final OrderFindActivityService orderFindActivityService; - - - @Operation(summary = "查询适用的活动") - @PostMapping("/findActivity") - public ResResult> findActivity(@RequestBody OrderCheckParam orderParam){ - return Res.ok(orderFindActivityService.findActivity(orderParam)); - } - - @Operation(summary = "查询适用的优惠券") - @PostMapping("/findCoupon") - public ResResult> findCoupon(@RequestBody OrderCheckParam orderParam){ - return Res.ok(couponSelectCheckService.findCoupon(orderParam)); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/StrategyController.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/StrategyController.java deleted file mode 100644 index e0e90c661e9e7b6afb907ffcec72a71387ad2860..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/StrategyController.java +++ /dev/null @@ -1,64 +0,0 @@ -package cn.bootx.sales.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.sales.core.strategy.service.StrategyService; -import cn.bootx.sales.dto.strategy.StrategyConfigDto; -import cn.bootx.sales.dto.strategy.StrategyDto; -import cn.bootx.sales.param.strategy.StrategyParam; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * @author xxm - * @date 2020/10/17 - */ -@Tag(name ="策略定义") -@RestController -@RequestMapping("/strategy") -@AllArgsConstructor -public class StrategyController { - private final StrategyService strategyService; - - @Operation(summary = "添加策略") - @PostMapping("/add") - public ResResult add(@RequestBody StrategyParam param){ - strategyService.add(param); - return Res.ok(); - } - - @Operation(summary = "更新策略") - @PostMapping("/update") - public ResResult update(@RequestBody StrategyParam param){ - return Res.ok(strategyService.update(param)); - } - - @Operation(summary = "查询全部策略") - @GetMapping("/findAll") - public ResResult> findAll(){ - return Res.ok(strategyService.findAll()); - } - - @Operation(summary = "获取策略及其配置项") - @GetMapping("/findById") - public ResResult findById(Long id){ - return Res.ok(strategyService.findById(id)); - } - - @Operation(summary = "获取参数配置") - @GetMapping("/findConfigs") - public ResResult> findConfigs(Long id){ - return Res.ok(strategyService.findConfigsByStrategyId(id)); - } - - @Operation(summary = "根据类型查询") - @GetMapping("/findByType") - public ResResult> findByType(Integer type){ - return Res.ok(strategyService.findByType(type)); - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/StrategyRegisterController.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/StrategyRegisterController.java deleted file mode 100644 index ac040f81be5e445f124a1c67bb6ff11b32a1ac9c..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/controller/StrategyRegisterController.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.bootx.sales.controller; - -import cn.bootx.common.core.rest.Res; -import cn.bootx.common.core.rest.ResResult; -import cn.bootx.sales.core.strategy.service.StrategyRegisterService; -import cn.bootx.sales.dto.strategy.StrategyRegisterDto; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.AllArgsConstructor; -import org.springframework.web.bind.annotation.*; - -import java.util.List; - -/** - * @author xxm - * @date 2020/10/17 - */ -@Tag(name ="策略注册") -@RestController -@RequestMapping("/strategy/register") -@AllArgsConstructor -public class StrategyRegisterController { - private final StrategyRegisterService strategyRegisterService; - - - @Operation(summary = "查询全部") - @GetMapping("/findAll") - public ResResult> findAll(){ - return Res.ok(strategyRegisterService.findAll()); - } - - @Operation(summary = "删除") - @DeleteMapping("/del/{id}") - public ResResult delete(@PathVariable Long id){ - strategyRegisterService.deleteById(id); - return Res.ok(); - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/convert/ActivityConvert.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/convert/ActivityConvert.java deleted file mode 100644 index 1db7af096fd27932d1e3ccf059154855a7ab5c44..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/convert/ActivityConvert.java +++ /dev/null @@ -1,33 +0,0 @@ -package cn.bootx.sales.core.activity.convert; - -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.dto.activity.ActivityDto; -import cn.bootx.sales.dto.activity.SimpleActivity; -import cn.bootx.sales.param.activity.ActivityParam; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -/** -* 转换 -* @author xxm -* @date 2021/5/19 -*/ -@Mapper -public interface ActivityConvert { - ActivityConvert CONVERT = Mappers.getMapper(ActivityConvert.class); - - @Mapping(target = "activityMutual", ignore = true) - Activity convert(ActivityParam in); - - @Mapping(target = "creator", ignore = true) - Activity convert(ActivityDto in); - - @Mapping(target = "configValues", ignore = true) - ActivityDto convert(Activity in); - - SimpleActivity simple(ActivityDto in); - - SimpleActivity simple(Activity in); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/dao/ActivityManager.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/dao/ActivityManager.java deleted file mode 100644 index 45dd9f28716fdde9fcbbb89dac6dc242d82df5ad..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/dao/ActivityManager.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bootx.sales.core.activity.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.sales.core.activity.entity.Activity; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** -* 优惠活动 -* @author xxm -* @date 2021/5/7 -*/ -@Slf4j -@Repository -@RequiredArgsConstructor -public class ActivityManager extends BaseManager { - - /** - * 根据策略注册ids查询 - */ - public List findByStrategyRegister(List strategyRegisterIds){ - return findAllByFields(Activity::getStrategyRegisterId,strategyRegisterIds); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/dao/ActivityMapper.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/dao/ActivityMapper.java deleted file mode 100644 index 2d00c6b670a91d5ed5276ba4532fb9afa39528e9..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/dao/ActivityMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.bootx.sales.core.activity.dao; - -import cn.bootx.sales.core.activity.entity.Activity; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** -* 活动 -* @author xxm -* @date 2021/5/7 -*/ -@Mapper -public interface ActivityMapper extends BaseMapper { -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/entity/Activity.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/entity/Activity.java deleted file mode 100644 index 0c6d61d4742530dc9441abddfda8c4944e89ade5..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/entity/Activity.java +++ /dev/null @@ -1,76 +0,0 @@ -package cn.bootx.sales.core.activity.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.sales.core.activity.convert.ActivityConvert; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import cn.bootx.sales.dto.activity.ActivityDto; -import cn.bootx.sales.dto.activity.SimpleActivity; -import cn.bootx.sales.param.activity.ActivityParam; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.time.LocalDateTime; -import java.util.List; - -/** -* 策略注册 -* @author xxm -* @date 2020/10/11 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("sales_activity") -public class Activity extends MpBaseEntity implements EntityBaseFunction { - - /** 名称 */ - private String name; - - /** 描述 */ - private String description; - - /** 策略注册id */ - private Long strategyRegisterId; - - /** 策略注册id */ - private String strategyId; - - /** 匹配内容规则*/ - @TableField(exist = false) - private List matchRules; - - /** 检测规则 */ - @TableField(exist = false) - private List checkRules; - - /** 活动互斥 */ - private String activityMutual; - - /** 有效开始时间 */ - private LocalDateTime startTime; - - /** 有效结束时间 */ - private LocalDateTime endTime; - - public static Activity init(ActivityDto dto) { - return ActivityConvert.CONVERT.convert(dto); - } - - public static Activity init(ActivityParam param) { - return ActivityConvert.CONVERT.convert(param); - } - - public SimpleActivity simple(){ - return ActivityConvert.CONVERT.simple(this); - } - - @Override - public ActivityDto toDto() { - return ActivityConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/service/ActivityService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/service/ActivityService.java deleted file mode 100644 index 5bd59babe2bef1afa2662c40053c2193fcd18ede..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/activity/service/ActivityService.java +++ /dev/null @@ -1,58 +0,0 @@ -package cn.bootx.sales.core.activity.service; - -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.code.StrategyRegisterCode; -import cn.bootx.sales.core.activity.dao.ActivityManager; -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.strategy.service.StrategyRegisterService; -import cn.bootx.sales.dto.activity.ActivityDto; -import cn.bootx.sales.dto.strategy.StrategyRegisterDto; -import cn.bootx.sales.param.activity.ActivityParam; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 策略活动处理类 - * @author xxm - * @date 2021/2/20 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class ActivityService { - private final StrategyRegisterService strategyRegisterService; - private final ActivityManager activityManager; - - /** - * 添加优惠活动 - */ - public ActivityDto addByActivity(ActivityParam param) { - // 设置活动的策略注册属性 - param.setStrategyType(StrategyRegisterCode.STRATEGY_TYPE_ACTIVITY); - param.getCheckRules().forEach(checkRuleParam -> checkRuleParam.setRuleType(CheckRuleCode.RULE_TYPE_ACTIVITY_CHECK)); - - StrategyRegisterDto strategyRegisterDto = strategyRegisterService.add(param); - - Activity activity = Activity.init(param); - activity.setStrategyRegisterId(strategyRegisterDto.getId()); - activityManager.save(activity); - return activity.toDto(); - } - - /** - * 查询全部 - */ - public List findAll() { - return null; - } - - /** - * 查询详情 - */ - public ActivityDto get(Long id) { - return null; - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/CalculateBufferService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/CalculateBufferService.java deleted file mode 100644 index 7e7cb87f2e9009e38eb0efde781da8a11c03088f..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/CalculateBufferService.java +++ /dev/null @@ -1,137 +0,0 @@ -package cn.bootx.sales.core.calculate.cache; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.sales.core.activity.dao.ActivityManager; -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.coupon.dao.CouponManager; -import cn.bootx.sales.core.coupon.dao.CouponTemplateManager; -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.core.match.injector.MatchRuleInjector; -import cn.bootx.sales.core.strategy.dao.StrategyConfigValueManager; -import cn.bootx.sales.core.strategy.dao.StrategyManager; -import cn.bootx.sales.core.strategy.dao.StrategyRegisterManager; -import cn.bootx.sales.core.strategy.entity.Strategy; -import cn.bootx.sales.core.strategy.entity.StrategyConfigValue; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** -* 计算缓存服务 -* @author xxm -* @date 2020/12/5 -*/ -@Slf4j -@Service -@RequiredArgsConstructor -public class CalculateBufferService { - private final MatchRuleInjector matchRuleInjector; - - private final StrategyRegisterManager strategyRegisterManager; - private final StrategyManager strategyManager; - private final CouponManager couponManager; - private final ActivityManager activityManager; - private final CouponTemplateManager couponTemplateManager; - private final StrategyConfigValueManager strategyConfigValueManager; - - - /** - * 构建优惠券缓存 - */ - public void buildCouponCache(OrderCheckParam orderParam, CalculateCache calculateCache) { - // 优惠券处理并构建缓存 - List couponIds = orderParam.getCouponIds(); - if (CollUtil.isNotEmpty(couponIds)){ - List coupons = couponManager.findAllByIds(couponIds); - // 判断ID是否有问题 - if (coupons.size()!=couponIds.size()){ - throw new BizException("优惠券有问题"); - } - calculateCache.appendCoupon(coupons); - - // 补充优惠券相关缓存(关联策略注册和策略) - List couponTemplates = couponTemplateManager.findAllByIds(coupons.stream().map(Coupon::getTemplateId).distinct().collect(Collectors.toList())); - calculateCache.appendCouponTemplate(couponTemplates); - List strategyRegisterIds = couponTemplates.stream() - .map(CouponTemplate::getStrategyRegisterId) - .distinct() - .collect(Collectors.toList()); - this.buildStrategyCache(calculateCache,strategyRegisterIds); - - // 获取优惠券模板对应的匹配规则 - matchRuleInjector.injectionTemplate(couponTemplates); - } - } - - /** - * 构建活动的策略注册缓存 根据活动id - */ - public void buildActivityCache(OrderCheckParam orderParam, CalculateCache calculateCache){ - List activityIds = orderParam.getDetails().stream() - .map(OrderDetailCheckParam::getActivityIds) - .filter(CollUtil::isNotEmpty) - .flatMap(Collection::stream) - .distinct() - .collect(Collectors.toList()); - List activities = activityManager.findAllByIds(activityIds); - // 判断ID是否有问题 - if (activityIds.size()!=activities.size()){ - throw new BizException("活动有问题"); - } - - calculateCache.appendActivity(activities); - // 补充优惠活动相关缓存(关联策略注册和策略) - List strategyRegisterIds = activities.stream() - .map(Activity::getStrategyRegisterId) - .collect(Collectors.toList()); - this.buildStrategyCache(calculateCache,strategyRegisterIds); - - // 获取优惠活动对应的匹配规则 - matchRuleInjector.injectionActivity(activities); - } - - - /** - * 构建策略缓存 已有缓存 - */ - private void buildStrategyCache(CalculateCache calculateCache, List strategyRegisterIds){ - this.buildCacheByRegister(calculateCache,strategyRegisterManager.findAllByIds(strategyRegisterIds)); - } - - /** - * 构建策略缓存 已有策略注册 - */ - @SafeVarargs - private final void buildCacheByRegister(CalculateCache calculateCache, List... strategyRegisters){ - // 策略注册 - calculateCache.appendStrategyRegister(strategyRegisters); - - // 策略 - Map strategyRegisterMap = calculateCache.getStrategyRegisterMap(); - List strategyIds = strategyRegisterMap.values() - .stream().map(StrategyRegister::getStrategyId) - .collect(Collectors.toList()); - List strategies = strategyManager.findAllByIds(strategyIds); - calculateCache.appendStrategy(strategies); - - // 参数 - List srIds = strategyRegisterMap.values() - .stream().map(StrategyRegister::getId) - .collect(Collectors.toList()); - List strategyConfigValues = strategyConfigValueManager.findAllStrategyRegisterIds(srIds); - - calculateCache.appendStrategyConfigValue(strategyConfigValues); - /* 结束 */ - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/CalculateCache.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/CalculateCache.java deleted file mode 100644 index 2d3131e33c8f446e38d4175d81ef294c1a66a90d..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/CalculateCache.java +++ /dev/null @@ -1,164 +0,0 @@ -package cn.bootx.sales.core.calculate.cache; - -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.core.strategy.entity.Strategy; -import cn.bootx.sales.core.strategy.entity.StrategyConfigValue; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import cn.hutool.core.map.MapUtil; -import lombok.Getter; -import lombok.Setter; -import lombok.experimental.Accessors; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 计算时策略缓存,包含计算时所有用到的数据, 其中的数据不可以进行修改和删除 - * @author xxm - * @date 2020/10/26 - */ -@Getter -@Accessors(chain = true) -public class CalculateCache { - - /** 订单缓存 */ - @Setter - private OrderCache order; - - /** 策略缓存 */ - private Map strategyMap; - - /** 策略注册缓存 */ - private Map strategyRegisterMap; - - /** 策略注册缓存 */ - private Map> strategyConfigValueMap; - - /** 优惠活动 */ - private Map activityMap; - - /** 优惠券 */ - private Map couponMap; - - /** 优惠券模板 */ - private Map couponTemplateMap; - - /** 订单使用到的优惠活动 */ - @Setter - private List activities; - - /** 订单使用到的优惠券 */ - @Setter - private List coupons; - - /** 订单使用到的优惠券模板 */ - @Setter - private List couponTemplates; - - /** 订单使用到的策略注册 */ - @Setter - private List strategyRegisters; - - - /** - * 追加策略 - */ - @SuppressWarnings("UnusedReturnValue") - public CalculateCache appendStrategy(List strategies){ - if (MapUtil.isEmpty(this.strategyMap)){ - this.strategyMap = new HashMap<>(); - } - Map collect = strategies.stream() - .collect(Collectors.toMap(Strategy::getId,Function.identity())); - strategyMap.putAll(collect); - return this; - } - - /** - * 追加策略注册 - */ - @SafeVarargs - @SuppressWarnings("UnusedReturnValue") - public final CalculateCache appendStrategyRegister(List... list){ - if (MapUtil.isEmpty(this.strategyRegisterMap)){ - this.strategyRegisterMap = new HashMap<>(); - this.strategyRegisters = new ArrayList<>(); - } - for (List strategyRegisters : list) { - Map collect = strategyRegisters.stream() - .collect(Collectors.toMap(StrategyRegister::getId,Function.identity())); - this.strategyRegisterMap.putAll(collect); - this.strategyRegisters.addAll(strategyRegisters); - - } - return this; - } - - /** - * 追加策略注册参数 - */ - @SuppressWarnings("UnusedReturnValue") - public CalculateCache appendStrategyConfigValue( List strategyRegisters){ - if (MapUtil.isEmpty(this.strategyConfigValueMap)){ - this.strategyConfigValueMap = new HashMap<>(); - } - Map> collect = strategyRegisters.stream() - .collect(Collectors.groupingBy(StrategyConfigValue::getStrategyRegisterId)); - this.strategyConfigValueMap.putAll(collect); - return this; - } - - /** - * 追加活动 - */ - @SuppressWarnings("UnusedReturnValue") - public CalculateCache appendActivity(List activities){ - if (MapUtil.isEmpty(this.activityMap)){ - this.activityMap = new HashMap<>(); - this.activities = new ArrayList<>(); - } - Map collect = activities.stream() - .collect(Collectors.toMap(Activity::getId,Function.identity())); - this.activityMap.putAll(collect); - this.activities.addAll(activities); - return this; - } - - /** - * 追加优惠券 - */ - @SuppressWarnings("UnusedReturnValue") - public CalculateCache appendCoupon(List coupons){ - if (MapUtil.isEmpty(this.couponMap)){ - this.couponMap = new HashMap<>(); - this.coupons = new ArrayList<>(); - } - Map collect = coupons.stream() - .collect(Collectors.toMap(Coupon::getId,Function.identity())); - this.couponMap.putAll(collect); - this.coupons.addAll(coupons); - return this; - } - - /** - * 追加优惠券模板 - */ - @SuppressWarnings("UnusedReturnValue") - public CalculateCache appendCouponTemplate( List couponTemplates){ - if (MapUtil.isEmpty(this.couponTemplateMap)){ - this.couponTemplateMap = new HashMap<>(); - this.couponTemplates = new ArrayList<>(); - } - Map collect = couponTemplates.stream() - .collect(Collectors.toMap(CouponTemplate::getId,Function.identity())); - this.couponTemplateMap.putAll(collect); - this.couponTemplates.addAll(couponTemplates); - return this; - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/OrderCache.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/OrderCache.java deleted file mode 100644 index e91f0f6a0d1706084ddd5ecca5c75a7fd66fdeb4..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/OrderCache.java +++ /dev/null @@ -1,65 +0,0 @@ -package cn.bootx.sales.core.calculate.cache; - -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.dto.order.OrderStrategyMappingResult; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.time.LocalDateTime; -import java.util.ArrayList; -import java.util.List; - -/** - * @author xxm - * @date 2020/10/11 - */ -@Data -@Accessors(chain = true) -@Schema(title = "订单计算缓存对象") -public class OrderCache implements Serializable { - private static final long serialVersionUID = -7600415200619006458L; - - @Schema(description= "主键ID") - private Long id; - - @Schema(description= "code") - private String code; - - @Schema(description= "支付时间") - private LocalDateTime payTime; - - @Schema(description= "创建时间") - private LocalDateTime createTime; - - @Schema(description= "购买人ID") - private Long userId; - - @Schema(description= "状态") - private Integer status; - - @Schema(description= "类型") - private Integer type; - - @Schema(description= "总金额") - private BigDecimal totalAmount; - - @Schema(description= "实付金额") - private BigDecimal payAmount; - - @Schema(description= "渠道ID") - private Long channelId; - - @Schema(description= "订单明细") - private List details; - - @Schema(description= "优惠券明细") - private List coupons; - - @Schema(description= "优惠映射") - private List mappings = new ArrayList<>(); - - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/OrderDetailCache.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/OrderDetailCache.java deleted file mode 100644 index e73b11dbd0dab5a63410410e3a62e254e7dfd1b2..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/cache/OrderDetailCache.java +++ /dev/null @@ -1,96 +0,0 @@ -package cn.bootx.sales.core.calculate.cache; - -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import cn.bootx.sales.dto.order.OrderDetailPreviewResult; -import cn.bootx.sales.dto.order.OrderStrategyMappingResult; -import cn.hutool.core.bean.BeanUtil; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -/** -* @author xxm -* @date 2020/10/21 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "订单计算缓存明细对象") -public class OrderDetailCache implements Serializable { - - private static final long serialVersionUID = 7528634567769864592L; - - @Schema(description= "主键ID") - private Long id; - - @Schema(description= "店铺ID") - private Long shopId; - - @Schema(description= "订单ID") - private Long orderId; - - @Schema(description= "类目ID") - private Long categoryId; - - @Schema(description= "商品ID") - private Long goodsId; - - @Schema(description= "skuId") - private Long skuId; - - @Schema(description= "商品名") - private String goodsTitle; - - @Schema(description= "商品价格") - private BigDecimal goodsPrice; - - @Schema(description= "商品数量") - private int num; - - @Schema(description= "总金额(原始)") - private BigDecimal totalAmount; - - @Schema(description= "优惠差价") - private BigDecimal payChange; - - @Schema(description= "总金额(优惠后)") - private BigDecimal payAmount; - - @Schema(description= "状态") - private int state = 0; - - @Schema(description= "是否虚拟商品") - private Boolean isVirtual = false; - - @Schema(description= "是否允许分摊") - private Boolean isShare = true; - - @Schema(description= "附加参数") - private String addition; - - @Schema(description= "活动集合") - private List activities; - - @Schema(description= "活动id集合") - private List activityIds; - - @Schema(description= "活动对应的策略注册集合") - private List strategyRegisters; - - @Schema(description= "活动对应的策略注册id集合") - private List strategyRegisterIds = new ArrayList<>(); - - @Schema(description= "应用策略后价格变动记录") - private List mappings = new ArrayList<>(); - - public OrderDetailPreviewResult toPreview(){ - OrderDetailPreviewResult dto = new OrderDetailPreviewResult(); - BeanUtil.copyProperties(this,dto); - return dto; - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/code/JavaCalculateCode.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/code/JavaCalculateCode.java deleted file mode 100644 index 3677da8942b75974d5e9a9516f18a95e37f34bc1..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/code/JavaCalculateCode.java +++ /dev/null @@ -1,71 +0,0 @@ -package cn.bootx.sales.core.calculate.code; - -import cn.bootx.sales.dto.strategy.StrategyConfigDto; -import lombok.AllArgsConstructor; -import lombok.Getter; - -import java.math.BigDecimal; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 内置java原生计算类相关常量 - * @author xxm - * @date 2021/4/14 - */ -public interface JavaCalculateCode { - - /** 立减 */ - String INSTANT_REDUCTION = "instantReduction"; - /** 满减 */ - String FULL_REDUCTION = "fullReduction"; - - /** - * 立减 - */ - @Getter - @AllArgsConstructor - enum InstantReduction{ - /** 配置立减的字段 */ - AMOUNT("amount","立减金额", BigDecimal.class.getSimpleName()); - - private final String key; - private final String name; - private final String type; - - public static List find(){ - return Arrays.stream(InstantReduction.values()) - .map(e -> new StrategyConfigDto() - .setKey(e.key) - .setName(e.name) - .setType(e.type)) - .collect(Collectors.toList()); - } - } - - /** - * 满减 - */ - @Getter - @AllArgsConstructor - enum FullReduction{ - /** 配置满多少的字段 */ - SATISFY ("satisfy","满多少",BigDecimal.class.getSimpleName()), - - /** 配置减多少的字段 */ - MINUS("minus","减多少",BigDecimal.class.getSimpleName()); - private final String key; - private final String name; - private final String type; - - public static List find(){ - return Arrays.stream(FullReduction.values()) - .map(e -> new StrategyConfigDto() - .setKey(e.key) - .setName(e.name) - .setType(e.type)) - .collect(Collectors.toList()); - } - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/factory/CalculateFactory.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/factory/CalculateFactory.java deleted file mode 100644 index f6bbbc6750317a6897c7afe8abd0889e5b69eef8..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/factory/CalculateFactory.java +++ /dev/null @@ -1,119 +0,0 @@ -package cn.bootx.sales.core.calculate.factory; - -import cn.bootx.common.core.util.BigDecimalUtil; -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.calculate.cache.CalculateBufferService; -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -import cn.hutool.core.collection.CollUtil; -import lombok.AllArgsConstructor; -import lombok.Getter; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 计算工厂 - * @author xxm - * @date 2020/11/19 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class CalculateFactory { - private final CalculateBufferService calculateBufferService; - - /** - * 为了同时返回订单dto和缓存 - */ - @AllArgsConstructor - @Getter - public static class OrderAndBuffer { - private final OrderCache orderCache; - private final CalculateCache calculateCache; - } - - /** - * 构建订单和缓存 - */ - public OrderAndBuffer buildOrderCache(OrderCheckParam orderParam){ - - /* 构建活动策略缓存 */ - CalculateCache calculateCache = new CalculateCache(); - - // 构建活动和优惠券缓存 - calculateBufferService.buildActivityCache(orderParam,calculateCache); - calculateBufferService.buildCouponCache(orderParam,calculateCache); - - // 构建订单缓存 - OrderCache orderDto = this.buildOrderCache(orderParam, calculateCache); - - return new OrderAndBuffer(orderDto, calculateCache); - } - /** - * 构建订单dto 带缓存 - */ - public OrderCache buildOrderCache(OrderCheckParam orderParam, CalculateCache calculateCache){ - OrderCache orderCache = new OrderCache(); - // 优惠券处理 - List couponIds = orderParam.getCouponIds(); - if (CollUtil.isNotEmpty(couponIds)){ - orderCache.setCoupons(calculateCache.getCoupons()); - } - // 构建订单及明细 - BeanUtil.copyProperties(orderParam,orderCache, CopyOptions.create().ignoreNullValue()); - List details = orderParam.getDetails() - .stream() - .map(param -> this.buildOrderDetailCache(param,calculateCache)) - .collect(Collectors.toList()); - - return orderCache.setDetails(details); - } - - /** - * 构建订单明细dto 带缓存 - */ - private OrderDetailCache buildOrderDetailCache(OrderDetailCheckParam param, CalculateCache calculateCache){ - OrderDetailCache dto = new OrderDetailCache(); - BeanUtil.copyProperties(param,dto,CopyOptions.create().ignoreNullValue()); - - Map strategyRegisterMap = calculateCache.getStrategyRegisterMap(); - Map activityMap = calculateCache.getActivityMap(); - List activityIds = param.getActivityIds(); - - // 活动存在则添加 - if (CollUtil.isNotEmpty(activityIds)) { - // 活动 - List activities = activityIds.stream() - .map(activityMap::get) - .collect(Collectors.toList()); - dto.setActivities(activities); - dto.setActivityIds(activityIds); - - // 策略注册 - List strategyRegisterIds = activityIds.stream() - .map(activityMap::get) - .map(Activity::getStrategyRegisterId) - .collect(Collectors.toList()); - List strategyRegisters = strategyRegisterIds.stream() - .map(strategyRegisterMap::get) - .collect(Collectors.toList()); - dto.setStrategyRegisterIds(strategyRegisterIds); - dto.setStrategyRegisters(strategyRegisters); - } - dto.setTotalAmount(BigDecimalUtil.multiply(BigDecimal.valueOf(dto.getNum()),dto.getGoodsPrice())); - return dto; - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/CalculateHandlerAdapter.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/CalculateHandlerAdapter.java deleted file mode 100644 index f4d2c1c53f82a629c196c01376e08ee51b5f8805..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/CalculateHandlerAdapter.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.bootx.sales.core.calculate.handler; - -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.calculate.handler.func.JavaCalculateHandler; -import cn.bootx.sales.core.strategy.entity.Strategy; -import cn.bootx.sales.core.strategy.entity.StrategyConfigValue; -import cn.bootx.sales.engine.JavaCalculateHandlerFactory; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.util.List; - -/** - * 计算脚本适配器(动态分发到java/JavaScript/groovy处理器中) - * @author xxm - * @date 2020/12/13 - */ -@Component -@RequiredArgsConstructor -public class CalculateHandlerAdapter { - private final JavaCalculateHandlerFactory javaCalculateHandlerFactory; - - /** - * 计算适配器 - * @param originalValue 要进行计算的价格 - * @param details 要计算的明细 - * @param strategy 策略 - * @param configValues 策略参数 - * @param calculateCache 缓存 - * @return 计算后的价格 - */ - public BigDecimal calculateByScript(BigDecimal originalValue, List details, Strategy strategy, List configValues, CalculateCache calculateCache){ - - JavaCalculateHandler calculateHandler = javaCalculateHandlerFactory.getCalculateHandler(strategy.getCode()); - return calculateHandler.calculate(originalValue,details,configValues,calculateCache); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/func/JavaCalculateHandler.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/func/JavaCalculateHandler.java deleted file mode 100644 index f07e857cef0dd34f703cac3b8134022a2294199c..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/func/JavaCalculateHandler.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.bootx.sales.core.calculate.handler.func; - -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.strategy.entity.StrategyConfigValue; - -import java.math.BigDecimal; -import java.util.List; - -/** - * java策略计算服务接口 - * @author xxm - * @date 2020/12/13 - */ -public interface JavaCalculateHandler { - - /** 唯一code标示 */ - String getCode(); - - /** - * 计算接口 - * @param originalValue 要进行计算的价格 原价 - * @param details 要计算的明细 - * @param configValues 策略参数 - * @param calculateCache 缓存 - * @return 计算后的价格 - */ - BigDecimal calculate(BigDecimal originalValue, List details, List configValues, CalculateCache calculateCache); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/impl/FullReductionRule.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/impl/FullReductionRule.java deleted file mode 100644 index 42d107e44401bef0d38ece7a31c21a761fa46ce4..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/impl/FullReductionRule.java +++ /dev/null @@ -1,59 +0,0 @@ -package cn.bootx.sales.core.calculate.handler.impl; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.common.core.util.BigDecimalUtil; -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.calculate.code.JavaCalculateCode; -import cn.bootx.sales.core.calculate.handler.func.JavaCalculateHandler; -import cn.bootx.sales.core.strategy.entity.StrategyConfigValue; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Objects; - -/** -* 满减优惠 -* @author xxm -* @date 2021/4/14 -*/ -@Slf4j -@Component -@RequiredArgsConstructor -public class FullReductionRule implements JavaCalculateHandler { - @Override - public String getCode() { - return JavaCalculateCode.FULL_REDUCTION; - } - - /** - * 计算接口 - * @param originalValue 要进行计算的价格 原价 - * @param details 要计算的明细 - * @param configValues 策略参数 - * @param calculateCache 缓存 - * @return 计算后的价格 - */ - @Override - public BigDecimal calculate(BigDecimal originalValue, List details, List configValues, CalculateCache calculateCache) { - - StrategyConfigValue satisfy = getFiled(JavaCalculateCode.FullReduction.SATISFY.getKey(), configValues); - StrategyConfigValue minus = getFiled(JavaCalculateCode.FullReduction.MINUS.getKey(), configValues); - - if (BigDecimalUtil.compareTo(originalValue,new BigDecimal(satisfy.getValue())) > 0){ - return new BigDecimal(minus.getValue()); - } else { - return BigDecimal.ZERO; - } - } - - public StrategyConfigValue getFiled(String key,List configValues){ - return configValues.stream() - .filter(value -> Objects.equals(key, value.getKey())) - .findFirst() - .orElseThrow(() -> new BizException("配置计算参数有误")); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/impl/InstantReductionRule.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/impl/InstantReductionRule.java deleted file mode 100644 index f5aede53f85a5b5132fac6ee685a783973fb1516..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/handler/impl/InstantReductionRule.java +++ /dev/null @@ -1,51 +0,0 @@ -package cn.bootx.sales.core.calculate.handler.impl; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.calculate.code.JavaCalculateCode; -import cn.bootx.sales.core.calculate.handler.func.JavaCalculateHandler; -import cn.bootx.sales.core.strategy.entity.StrategyConfigValue; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.math.BigDecimal; -import java.util.List; -import java.util.Objects; - -/** - * 立减优惠 - * @author xxm - * @date 2021/4/14 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class InstantReductionRule implements JavaCalculateHandler { - @Override - public String getCode() { - return JavaCalculateCode.INSTANT_REDUCTION; - } - - /** - * 计算接口 - * @param originalValue 要进行计算的价格 原价 - * @param details 要计算的明细 - * @param configValues 策略参数 - * @param calculateCache 缓存 - * @return 计算后的价格 - */ - @Override - public BigDecimal calculate(BigDecimal originalValue, List details, List configValues, CalculateCache calculateCache) { - String field = JavaCalculateCode.InstantReduction.AMOUNT.getKey(); - StrategyConfigValue configValue = configValues.stream() - .filter(value -> Objects.equals(field, value.getKey())) - .findFirst() - .orElseThrow(() -> new BizException("配置计算参数有误")); - - String value = configValue.getValue(); - - return new BigDecimal(value); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/service/CalculateService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/service/CalculateService.java deleted file mode 100644 index 2aade5131422e1ab1f0e82b0d1b260a26783af88..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/service/CalculateService.java +++ /dev/null @@ -1,216 +0,0 @@ -package cn.bootx.sales.core.calculate.service; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.common.core.util.BigDecimalUtil; -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.calculate.handler.CalculateHandlerAdapter; -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.strategy.entity.Strategy; -import cn.bootx.sales.core.strategy.entity.StrategyConfigValue; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import cn.bootx.sales.dto.order.OrderStrategyMappingResult; -import cn.bootx.sales.dto.strategy.StrategyRegisterDto; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.math.BigDecimal; -import java.util.*; -import java.util.stream.Collectors; - -/** - * 计算服务,提供更细化的计算功能供其他模块调用 - * @author xxm - * @date 2020/10/15 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class CalculateService { - private final CalculateHandlerAdapter calculateHandlerAdapter; - - /** - * 计算选定的活动策略 - * @param strategyRegister 策略 - * @param list 订单明细列表 - * @param calculateCache 缓存 - */ - public void calculateChoose(StrategyRegister strategyRegister, List list, CalculateCache calculateCache){ - if (Objects.isNull(strategyRegister)){ - throw new BizException("策略注册为空"); - } - // 求符合条件明细的总价 - BigDecimal originalValue = list.stream() - .map(detail -> BigDecimalUtil.multiply(detail.getGoodsPrice(), BigDecimal.valueOf(detail.getNum()))) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - Map strategyMap = calculateCache.getStrategyMap(); - Strategy strategy = strategyMap.get(strategyRegister.getStrategyId()); - - //获取订单类型的策略的执行参数 - Map> strategyConfigValueMap = calculateCache.getStrategyConfigValueMap(); - List configValues = - Optional.ofNullable(strategyConfigValueMap.get(strategyRegister.getId())) - .orElseThrow(() -> new BizException("策略参数未找到")); - - log.info("明细策略: {},原价: {}", strategy.getName(), originalValue); - - // 执行脚本计算价格 - BigDecimal amountChange = calculateHandlerAdapter - .calculateByScript(originalValue,list,strategy,configValues,calculateCache); - - log.info("明细策略: {},优惠价: {}",strategy.getName(), amountChange); - - // 分摊 - this.shareAmount(amountChange,list,null, strategyRegister); - } - - /** - * 优惠券计算 - */ - public void calculateCoupon(StrategyRegister strategyRegister, List list, Coupon coupon, OrderCache orderCache, CalculateCache calculateCache) { - // 求符合条件明细的总价 - BigDecimal originalValue = list.stream() - .map(detail -> BigDecimalUtil.multiply(detail.getGoodsPrice(), BigDecimal.valueOf(detail.getNum()))) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - Map strategyMap = calculateCache.getStrategyMap(); - Strategy strategy = strategyMap.get(strategyRegister.getStrategyId()); - - //获取订单类型的策略的执行参数 - Map> strategyConfigValueMap = calculateCache.getStrategyConfigValueMap(); - List orderTypeStrategyConfigValues = - Optional.ofNullable(strategyConfigValueMap.get(strategyRegister.getId())) - .orElseThrow(() -> new BizException("策略参数未找到")); - - log.info("明细策略: {},原价: {}", strategy.getName(), originalValue); - - //执行脚本计算价格 - BigDecimal amountChange = calculateHandlerAdapter - .calculateByScript(originalValue, list, strategy, orderTypeStrategyConfigValues, calculateCache); - - log.info("明细策略: {},优惠价: {}", strategy.getName(), amountChange); - - // 分摊 - this.shareAmount(amountChange,list,coupon.getId(),strategyRegister); - } - - - /** - * 优惠后订单明细金额分摊 - */ - private void shareAmount(BigDecimal amountChange, List list, Long couponId, StrategyRegister strategyRegister){ - - // 需要进行分摊的总价 - BigDecimal shareValue = list.stream() - .filter(detail -> Objects.equals(detail.getIsShare(), true)) - .map(detail -> BigDecimalUtil.multiply(detail.getGoodsPrice(), BigDecimal.valueOf(detail.getNum()))) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - // 已经分摊金额 - BigDecimal alreadyShareValue = BigDecimal.ZERO; - // 价格分摊 如果价格已变即策略已执行生效 - if (amountChange.compareTo(BigDecimal.ZERO) != 0) { - - // 可分摊明细(从小到大进行排序) - List shareList = list.stream() - .filter(detail -> Objects.equals(detail.getIsShare(), true)) - .sorted((o1, o2) -> BigDecimalUtil.compareTo(o1.getTotalAmount(), o2.getTotalAmount())) - .collect(Collectors.toList()); - // 可分摊总额 - BigDecimal shareTotal = shareList.stream() - .map(OrderDetailCache::getTotalAmount) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - // 优惠金额超过分摊总价, - if (BigDecimalUtil.compareTo(amountChange, shareTotal) == 1) { - amountChange = shareTotal; - } - - //计算 分摊至订单细节的金额 先分摊N-1个, 剩下的分摊到最后一个 - for (int i = 0; i < shareList.size(); i++) { - OrderDetailCache detail = shareList.get(i); - // 价格变动值 - BigDecimal priceChange; - // 最后一个订单分摊剩余的 - if (shareList.size() - 1 == i) { - priceChange = BigDecimalUtil.subtract(amountChange, alreadyShareValue); - } else { - // 计算所占需分摊比率 - BigDecimal proportion = BigDecimalUtil.divide(detail.getTotalAmount(), shareValue); - priceChange = BigDecimalUtil.multiply(amountChange, proportion); - // 分摊金额超过明细金额, 分摊金额作为价格变动值 - if (BigDecimalUtil.compareTo(priceChange,detail.getTotalAmount()) == 1){ - priceChange = detail.getTotalAmount(); - } - // 累加到已分摊金额上 - alreadyShareValue = BigDecimalUtil.add(alreadyShareValue, priceChange); - } - - // 记录到订单明细中的价格变动记录中 - OrderStrategyMappingResult orderStrategyMapping = new OrderStrategyMappingResult() - .setStrategyRegisterId(strategyRegister.getId()) - .setStrategyId(strategyRegister.getStrategyId()) - .setStrategyType(strategyRegister.getStrategyType()) - .setCouponId(couponId) - .setPriceChange(priceChange) - .setDescription("优惠策略 : " + strategyRegister.getName()); - detail.getMappings().add(orderStrategyMapping); - } - } - } - - /** - * 计算单个明细的价格 - */ - public BigDecimal calculateSingle(StrategyRegisterDto registerDto, OrderDetailCache detail, CalculateCache calculateCache){ - Map strategyRegisterMap = calculateCache.getStrategyRegisterMap(); - StrategyRegister strategyRegister = Optional.ofNullable(strategyRegisterMap.get(registerDto.getId())) - .orElseThrow(() -> new BizException("策略注册未找到")); - - // 求符合条件明细的总价 - BigDecimal originalValue = detail.getGoodsPrice().multiply(new BigDecimal(detail.getNum())); - - Map strategyMap = calculateCache.getStrategyMap(); - Strategy strategy = Optional.ofNullable(strategyMap.get(strategyRegister.getStrategyId())) - .orElseThrow(() -> new BizException("策略未找到")); - - //获取订单类型的策略的执行参数 - Map> strategyConfigValueMap = calculateCache.getStrategyConfigValueMap(); - List configValues = - Optional.ofNullable(strategyConfigValueMap.get(strategyRegister.getId())) - .orElseThrow(() -> new BizException("策略参数未找到")); - - log.info("明细策略: {},原价: {}", strategy.getName() , originalValue); - - //执行脚本计算价格 - BigDecimal amountChange = calculateHandlerAdapter - .calculateByScript(originalValue, Collections.singletonList(detail),strategy,configValues,calculateCache); - - log.info("明细策略: {},优惠价: {}",strategy.getName(), amountChange); - return amountChange; - } - - /** - * 计算明细价格 - */ - public void calculateAmountByDetail(List details){ - for (OrderDetailCache detail : details) { - BigDecimal priceChange = detail.getMappings() - .stream() - .map(OrderStrategyMappingResult::getPriceChange) - .reduce(BigDecimal.ZERO, BigDecimal::add); - BigDecimal totalAmount = detail.getTotalAmount(); - if (BigDecimalUtil.compareTo(totalAmount,priceChange) == 1){ - detail.setPayAmount(BigDecimalUtil.subtract(totalAmount,priceChange)); - detail.setPayChange(priceChange); - } else { - // 这样子是优惠额度超出了应付金额,产生了负数 - detail.setPayAmount(BigDecimalUtil.getZero()); - detail.setPayChange(totalAmount); - } - } - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/service/OrderCalculateService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/service/OrderCalculateService.java deleted file mode 100644 index 0aad7d26d4e02d44905e639653e0c4a68f797964..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/service/OrderCalculateService.java +++ /dev/null @@ -1,161 +0,0 @@ -package cn.bootx.sales.core.calculate.service; - -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.check.service.activity.ActivityCalculateCheckService; -import cn.bootx.sales.core.check.service.coupon.CouponCalculateCheckService; -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.core.match.service.MatchRuleService; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import cn.bootx.sales.dto.order.OrderDetailPreviewResult; -import cn.bootx.sales.dto.order.OrderPreviewResult; -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.math.BigDecimal; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import java.util.stream.Collectors; - -/** - * 订单价格计算服务供 - * @author xxm - * @date 2020/11/1 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderCalculateService { - - private final CalculateService calculateService; - private final MatchRuleService matchRuleService; - - private final CouponCalculateCheckService couponCalculateCheckService; - private final ActivityCalculateCheckService activityCalculateCheckService; - - /** - * 计算价格 - */ - public OrderPreviewResult calculateOrderPrice(OrderCache orderCache, CalculateCache calculateCache){ - - // 活动公共检查 - activityCalculateCheckService.checkCommons(orderCache,calculateCache); - // 活动按配置规则检查 - activityCalculateCheckService.checkByRule(orderCache,calculateCache); - - // 优惠券公共检查 - couponCalculateCheckService.checkCommons(orderCache,calculateCache); - // 优惠券按配置规则检查 - couponCalculateCheckService.checkByRule(orderCache,calculateCache); - - // 计算价格 - return calculateOrderPriceNoCheck(orderCache,calculateCache); - } - - /** - * 计算订单价格, 不进行检查 - */ - public OrderPreviewResult calculateOrderPriceNoCheck(OrderCache orderCache, CalculateCache calculateCache){ - List details = orderCache.getDetails(); - // 策略计算 - this.calculateActivityPrice(orderCache,calculateCache); - // 优惠券计算 - this.calculateCouponPrice(orderCache,calculateCache); - // 计算出来明细条目具体的价格 - calculateService.calculateAmountByDetail(details); - - // 支付总价 - BigDecimal payAmount = details.stream() - .map(OrderDetailCache::getPayAmount) - .reduce(BigDecimal.ZERO, BigDecimal::add); - // 原始总价 - BigDecimal totalAmount = details.stream() - .map(OrderDetailCache::getTotalAmount) - .reduce(BigDecimal.ZERO, BigDecimal::add); - - // 构建预览对象 - List detailPreviews = details.stream() - .map(OrderDetailCache::toPreview) - .collect(Collectors.toList()); - OrderPreviewResult orderPreviewResult = new OrderPreviewResult(); - BeanUtil.copyProperties(orderCache,orderPreviewResult); - orderPreviewResult.setOrderDetails(detailPreviews) - .setTotalAmount(totalAmount) - .setPayAmount(payAmount); - return orderPreviewResult; - } - - /** - * 活动计算 - */ - private void calculateActivityPrice(OrderCache orderCache, CalculateCache calculateCache){ - List details = orderCache.getDetails(); - - // 获取明细所有活动对应的策略注册id - List strategyRegisterIds = details.stream() - .map(OrderDetailCache::getStrategyRegisterIds) - .filter(CollUtil::isNotEmpty) - .flatMap(Collection::stream) - .distinct() - .collect(Collectors.toList()); - - // 没有对应的策略注册, 不需要计算 - if (CollUtil.isEmpty(strategyRegisterIds)){ - return; - } - - // 获取策略注册对象集合 - Map strategyRegisterMap = calculateCache.getStrategyRegisterMap(); - Map srMap = strategyRegisterIds.stream() - .map(strategyRegisterMap::get) - .collect(Collectors.toMap(StrategyRegister::getId, Function.identity())); - - // 根据策略注册Id对订单明细进行分组 - Map> odMap = new TreeMap<>(); - for (Long id : strategyRegisterIds) { - List orderDetailParams = details.stream() - .filter(detail -> detail.getStrategyRegisterIds().contains(id)) - .collect(Collectors.toList()); - odMap.put(id, orderDetailParams); - } - - // 遍历活动策略进行计算 - for (Long strategyRegisterId : strategyRegisterIds) { - List list = odMap.get(strategyRegisterId); - calculateService.calculateChoose(srMap.get(strategyRegisterId),list, calculateCache); - } - } - - /** - * 优惠券计算 - */ - private void calculateCouponPrice(OrderCache orderCache, CalculateCache calculateCache){ - // 获取优惠 - List coupons = orderCache.getCoupons(); - if (CollUtil.isEmpty(coupons)){ - return; - } - - List details = orderCache.getDetails(); - Map strategyRegisterMap = calculateCache.getStrategyRegisterMap(); - Map couponTemplateMap = calculateCache.getCouponTemplateMap(); - - // 遍历优惠卷 进行分组并计算 - for (Coupon coupon : coupons) { - StrategyRegister strategyRegister = strategyRegisterMap.get(coupon.getStrategyRegisterId()); - CouponTemplate couponTemplate = couponTemplateMap.get(coupon.getTemplateId()); - // 匹配到优惠券适用的订单明细组 - List orderDetails = details.stream() - .filter(detail -> matchRuleService.detailMatch(detail,couponTemplate.getMatchRules())) - .collect(Collectors.toList()); - calculateService.calculateCoupon(strategyRegister,orderDetails,coupon,orderCache,calculateCache); - } - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/service/OrderPreviewService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/service/OrderPreviewService.java deleted file mode 100644 index 20838104a8d43253515a812077935cd39105b297..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/calculate/service/OrderPreviewService.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.bootx.sales.core.calculate.service; - -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.calculate.factory.CalculateFactory; -import cn.bootx.sales.dto.order.OrderPreviewResult; -import cn.bootx.sales.param.order.OrderCheckParam; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -/** - * 订单计算预览, 使用平行优惠 - * @author xxm - * @date 2020/10/16 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderPreviewService { - private final CalculateFactory calculateFactory; - private final OrderCalculateService orderCalculateService; - - /** - * 费用计算预览 - */ - public OrderPreviewResult previewOrderPrice(OrderCheckParam orderParam) { - // 无缓存构建订单 - CalculateFactory.OrderAndBuffer orderDtoAndBuffer = calculateFactory.buildOrderCache(orderParam); - OrderCache orderCache = orderDtoAndBuffer.getOrderCache(); - CalculateCache calculateCache = orderDtoAndBuffer.getCalculateCache(); - // 计算价格 - return orderCalculateService.calculateOrderPrice(orderCache, calculateCache); - } - - /** - * 费用计算预览(不检查合法性) - */ - public OrderPreviewResult previewOrderPriceNoCheck(OrderCheckParam orderParam){ - // 无缓存构建订单 - CalculateFactory.OrderAndBuffer orderDtoAndBuffer = calculateFactory.buildOrderCache(orderParam); - OrderCache orderCache = orderDtoAndBuffer.getOrderCache(); - CalculateCache calculateCache = orderDtoAndBuffer.getCalculateCache(); - - return orderCalculateService.calculateOrderPriceNoCheck(orderCache,calculateCache); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/convert/CheckRuleConvert.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/convert/CheckRuleConvert.java deleted file mode 100644 index fff2b26da452bd88a0a7629eac3a9c5227332e6e..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/convert/CheckRuleConvert.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.bootx.sales.core.check.config.convert; - -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.dto.check.CheckRuleDto; -import cn.bootx.sales.param.strategy.CheckRuleParam; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -/** -* 转换 -* @author xxm -* @date 2021/5/19 -*/ -@Mapper -public interface CheckRuleConvert { - CheckRuleConvert INSTANCE = Mappers.getMapper(CheckRuleConvert.class); - - CheckRuleConfig convert(CheckRuleDto in); - - CheckRuleConfig convert(CheckRuleParam in); - - CheckRuleDto convert(CheckRuleConfig in); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/dao/CheckRuleManager.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/dao/CheckRuleManager.java deleted file mode 100644 index 357e090a9dcd414589393d690c769f8e5a161c1a..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/dao/CheckRuleManager.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.bootx.sales.core.check.config.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Repository -@RequiredArgsConstructor -public class CheckRuleManager extends BaseManager { - - /** - * 优惠券规则 - * @see CheckRuleCode - */ - public List findByTemplates(List ids, int ruleType){ - return lambdaQuery().eq(CheckRuleConfig::getRuleType,CheckRuleCode.RULE_COUPON) - .in(CheckRuleConfig::getStrategyRegisterId,ids) - .list(); - } - - /** - * 优惠券规则 - * @see CheckRuleCode - */ - public List findByRegisters(List ids, int ruleType){ - return lambdaQuery().eq(CheckRuleConfig::getRuleType,CheckRuleCode.RULE_ACTIVITY) - .in(CheckRuleConfig::getStrategyRegisterId,ids) - .list(); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/dao/CheckRuleMapper.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/dao/CheckRuleMapper.java deleted file mode 100644 index 9feb0a091d99301df6addf6759c6c80bbf50f9b6..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/dao/CheckRuleMapper.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bootx.sales.core.check.config.dao; - -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -/** -* 检查规则 -* @author xxm -* @date 2021/8/10 -*/ -@Mapper -public interface CheckRuleMapper extends BaseMapper { - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/entity/CheckRuleConfig.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/entity/CheckRuleConfig.java deleted file mode 100644 index b1945dd0ec670a73861e2c222430fa9b70eadc39..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/entity/CheckRuleConfig.java +++ /dev/null @@ -1,89 +0,0 @@ -package cn.bootx.sales.core.check.config.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.code.StrategyCode; -import cn.bootx.sales.core.check.config.convert.CheckRuleConvert; -import cn.bootx.sales.dto.check.CheckRuleDto; -import cn.bootx.sales.param.strategy.CheckRuleParam; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 检查规则配置 - * @author xxm - * @date 2020/12/1 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("sales_check_rule") -public class CheckRuleConfig extends MpBaseEntity implements EntityBaseFunction,Comparable { - - /** 策略注册id */ - private Long strategyRegisterId; - - /** 策略id */ - private Long strategyId; - - /** - * 策略类型 活动/优惠券 - * @see CheckRuleCode - */ - private int registerType; - - /** - * 检查类型规则 - * @see CheckRuleCode - */ - private int ruleType; - - /** 优先级 */ - private int priority; - - /** 规则名称 */ - private String name; - - /** - * 规则code - * @see CheckRuleCode.Activity - * @see CheckRuleCode.Coupon - */ - private String code; - - /** - * 类型 - * @see StrategyCode#ENGINE_SYSTEM - */ - @TableField(exist = false) - private int engineType; - - /** 策略脚本 */ - @TableField(exist = false) - private String ruleScript; - - /** 附加对象 json */ - private String addition; - - public static CheckRuleConfig init(CheckRuleDto dto) { - return CheckRuleConvert.INSTANCE.convert(dto); - } - - public static CheckRuleConfig init(CheckRuleParam dto) { - return CheckRuleConvert.INSTANCE.convert(dto); - } - - @Override - public CheckRuleDto toDto() { - return CheckRuleConvert.INSTANCE.convert(this); - } - - @Override - public int compareTo(CheckRuleConfig o) { - return Integer.compare(this.priority, o.priority); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/query/MatchQuery.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/query/MatchQuery.java deleted file mode 100644 index 6b20480e78a47b44b8ef7078d29cd726595029c8..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/config/query/MatchQuery.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.bootx.sales.core.check.config.query; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.List; - -/** -* @author xxm -* @date 2021/5/12 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "匹配配置查询参数") -@NoArgsConstructor -@AllArgsConstructor -public class MatchQuery { - - @Schema(description= "匹配类型") - private Integer matchType; - - @Schema(description= "id集合") - private List ids; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/convert/OrderConvert.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/convert/OrderConvert.java deleted file mode 100644 index 0cf86c8b8c7179ec5b1929fa2a415864de257fd1..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/convert/OrderConvert.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.bootx.sales.core.check.convert; - -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -/** -* 订单转换 -* @author xxm -* @date 2021/5/19 -*/ -@Mapper -public interface OrderConvert { - OrderConvert INSTANCE = Mappers.getMapper(OrderConvert.class); - - OrderDetailCheckParam convert(OrderDetailCache in); - - OrderCheckParam convert(OrderCache in); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/handler/activity/ActivityCheckHandler.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/handler/activity/ActivityCheckHandler.java deleted file mode 100644 index 9b4be92dcd05ace67c4b6f50701248539c97ca81..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/handler/activity/ActivityCheckHandler.java +++ /dev/null @@ -1,74 +0,0 @@ -package cn.bootx.sales.core.check.handler.activity; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.common.core.util.LocalDateTimeUtil; -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.match.service.MatchRuleService; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; - -/** - * 策略基础(公共)检查 - * @author xxm - * @date 2020/12/7 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class ActivityCheckHandler { - private final MatchRuleService matchRuleService; - - /** - * 活动互斥检查 - */ - public void checkMutex(List activities, CalculateCache calculateCache){ - Map strategyRegisterMap = calculateCache.getStrategyRegisterMap(); - // 同类互斥检查 满减/打折/立减 同类策略不可叠加 - long sameClassCount = activities.stream() - .map(Activity::getStrategyRegisterId) - .map(strategyRegisterMap::get) - .map(StrategyRegister::getStrategyId) - .distinct() - .count(); - long classCount = activities.stream() - .map(Activity::getStrategyRegisterId) - .map(strategyRegisterMap::get) - .map(StrategyRegister::getStrategyId) - .count(); - if (sameClassCount != classCount){ - throw new BizException("同类活动互斥检查未通过"); - } - } - - - /** - * 可用时间检查 - */ - public void checkTime(List activities){ - for (Activity activity : activities) { - if (!LocalDateTimeUtil.between(LocalDateTime.now(), activity.getStartTime(), activity.getEndTime())) { - throw new BizException("活动时间不符合"); - } - } - } - - /** - * 活动特征匹配检查 - */ - public void checkMatch(OrderDetailCache detail, List activities) { - for (Activity activity : activities) { - // 如果有不通过的就抛出错误 - if (!matchRuleService.detailMatch(detail, activity.getMatchRules())){ - throw new BizException("活动不匹配"); - } - } - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/handler/coupon/CouponCheckHandler.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/handler/coupon/CouponCheckHandler.java deleted file mode 100644 index 660459bb5bb5b918d84deef9f46edbbd74186e8a..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/handler/coupon/CouponCheckHandler.java +++ /dev/null @@ -1,119 +0,0 @@ -package cn.bootx.sales.core.check.handler.coupon; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.common.core.util.CollUtil; -import cn.bootx.common.core.util.LocalDateTimeUtil; -import cn.bootx.sales.code.CouponStatusCode; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import cn.hutool.core.util.StrUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.Collection; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * 优惠券基础(公共)检查 - * @author xxm - * @date 2020/12/3 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class CouponCheckHandler { - - /** - * 检查优惠卷基础 - */ - public void checkBase(Coupon coupon, OrderCache orderDto) { - // 状态是否可用 - if (!Objects.equals(coupon.getStatus(), CouponStatusCode.STATUS_NORMAL)) { - throw new BizException("状态不可用"); - } - - // 用户是否符合 - if (!Objects.equals(orderDto.getUserId(), coupon.getUserId())) { - throw new BizException("用户不合法"); - } - - // 是否在可用的时间段 - if (!LocalDateTimeUtil.between(LocalDateTime.now(), coupon.getStartTime(), coupon.getEndTime())) { - throw new BizException("优惠券时间不符合"); - } - - } - - /** - * 优惠券是否可用 - */ - public boolean canUseCoupon(Coupon coupon) { - if (!LocalDateTimeUtil.between(LocalDateTime.now(), coupon.getStartTime(), coupon.getEndTime())) { - return false; - } - if (!Objects.equals(coupon.getStatus(), CouponStatusCode.STATUS_NORMAL)) { - return false; - } - return true; - } - - - /** - * 优惠券互斥检查 true通过/false不通过 - */ - public boolean couponMutual(CouponTemplate couponTemplate, OrderCache orderDto) { - List ids = orderDto.getCoupons().stream() - .map(Coupon::getTemplateId) - .collect(Collectors.toList()); - - return this.checkMutual(couponTemplate.getCouponMutual(),ids); - } - - /** - * 活动互斥检查 true通过/false不通过 - */ - public boolean activityMutual(CouponTemplate couponTemplate, OrderCheckParam orderParam) { - List registerIds = orderParam.getDetails() - .stream() - .map(OrderDetailCheckParam::getActivityIds) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - return this.checkMutual(couponTemplate.getActivityMutual(),registerIds); - } - - /** - * 活动互斥检查 true通过/false不通过 - */ - public boolean activityMutual(CouponTemplate couponTemplate, OrderCache orderDto) { - List registerIds = orderDto.getDetails() - .stream() - .map(OrderDetailCache::getActivityIds) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - return this.checkMutual(couponTemplate.getActivityMutual(),registerIds); - } - - /** - * 互斥检查 true通过/false不通过 - * @param contrastIds 要比对的ids(优惠券/策略注册) - */ - public boolean checkMutual(String mutual1,List contrastIds){ - // 无互斥 - if (StrUtil.isBlank(mutual1)){ - return true; - } - List mutual1Ids = StrUtil.split(mutual1,',').stream() - .map(Long::parseLong) - .collect(Collectors.toList()); - // 有互斥返回false - return !CollUtil.contains(contrastIds, mutual1Ids); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/injector/CheckRuleInjector.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/injector/CheckRuleInjector.java deleted file mode 100644 index 7d151e37e2446cfba9fd7878b02aacdca5b9127b..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/injector/CheckRuleInjector.java +++ /dev/null @@ -1,92 +0,0 @@ -package cn.bootx.sales.core.check.injector; - -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.check.config.dao.CheckRuleManager; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.core.strategy.dao.StrategyManager; -import cn.bootx.sales.core.strategy.entity.Strategy; -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * 优惠券使用规则检查注入器 - * @author xxm - * @date 2020/12/5 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class CheckRuleInjector { - private final CheckRuleManager checkRuleManager; - private final StrategyManager strategyManager; - - /** - * 注入计算规则数据 - * @see CheckRuleCode - */ - public void injectionTemplate(List couponTemplates,int checkType){ - List registerIds = couponTemplates.stream().map(CouponTemplate::getStrategyRegisterId).collect(Collectors.toList()); - List checkRules = checkRuleManager.findByTemplates(registerIds,checkType); - // 注入策略属性并返回分组 - Map> checkRuleMap = this.injectionAndGroupByStrategy(checkRules); - if (Objects.isNull(checkRuleMap)){ - return; - } - for (CouponTemplate couponTemplate : couponTemplates) { - couponTemplate.setCheckRules(checkRuleMap.get(couponTemplate.getStrategyRegisterId())); - } - } - - /** - * 注入计算规则数据 - * @see CheckRuleCode - */ - public void injectionActivity(List activities, int checkType){ - List registerIds = activities.stream().map(Activity::getStrategyRegisterId).collect(Collectors.toList()); - List checkRules = checkRuleManager.findByRegisters(registerIds,checkType); - - // 注入策略属性并返回分组 - Map> checkRuleMap = this.injectionAndGroupByStrategy(checkRules); - if (Objects.isNull(checkRuleMap)){ - return; - } - for (Activity activity : activities) { - activity.setCheckRules(checkRuleMap.get(activity.getStrategyRegisterId())); - } - } - - /** - * 给检查规则添加相对应的策略属性, 并对检查规则根据策略注册id进行分组 - */ - private Map> injectionAndGroupByStrategy(List checkRules){ - - List strategyIds = checkRules.stream() - .map(CheckRuleConfig::getStrategyId) - .distinct() - .collect(Collectors.toList()); - if (CollUtil.isEmpty(strategyIds)){ - return null; - } - - // 注入策略属性 - Map strategyMap = strategyManager.findAllByIds(strategyIds) - .stream() - .collect(Collectors.toMap(Strategy::getId, Function.identity())); - for (CheckRuleConfig checkRule : checkRules) { - Strategy strategy = strategyMap.get(checkRule.getStrategyId()); - checkRule.setRuleScript(strategy.getRuleScript()) - .setEngineType(strategy.getEngineType()); - } - return checkRules.stream() - .collect(Collectors.groupingBy(CheckRuleConfig::getStrategyRegisterId)); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/CheckRuleHandlerAdapter.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/CheckRuleHandlerAdapter.java deleted file mode 100644 index 99ebf0d316015c065a604e6a6d293b754034efc7..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/CheckRuleHandlerAdapter.java +++ /dev/null @@ -1,70 +0,0 @@ -package cn.bootx.sales.core.check.rule; - -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.rule.func.*; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.param.coupon.ObtainCouponParam; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -/** - * 调用检查规则适配器 - * @author xxm - * @date 2020/12/13 - */ -@Component -@RequiredArgsConstructor -public class CheckRuleHandlerAdapter { - private final CheckRuleHandlerFactory checkRuleHandlerFactory; - - /** - * 优惠券使用检查 - * @param template 优惠券 - * @param checkRule 规则 - * @param orderCache 订单 - * @param calculateCache 缓存 - */ - public CheckRuleResult couponUseCheck(CouponTemplate template, CheckRuleConfig checkRule, OrderCache orderCache, CalculateCache calculateCache) { - CouponCheckRule rule = checkRuleHandlerFactory.getRuleHandler(checkRule.getCode(), CouponCheckRule.class); - return rule.check(checkRule,template, orderCache, calculateCache); - } - - /** - * 优惠券选择检查 - */ - public CheckRuleResult couponSelectCheck(CouponTemplate template, CheckRuleConfig checkRule, OrderCheckParam orderParam) { - CouponCheckRule rule = checkRuleHandlerFactory.getRuleHandler(checkRule.getCode(), CouponCheckRule.class); - return rule.check(checkRule,template, orderParam); - } - - /** - * 优惠券领取检查 - */ - public CheckRuleResult couponObtainCheck(CheckRuleConfig checkRule, CouponTemplate template, ObtainCouponParam param) { - CouponObtainRule rule = checkRuleHandlerFactory.getRuleHandler(checkRule.getCode(), CouponObtainRule.class); - return rule.check(checkRule,template, param); - } - - /** - * 活动使用检查 - */ - public CheckRuleResult activityUseCheck(CheckRuleConfig checkRule, Activity activity, OrderDetailCache detail, OrderCache orderDto, CalculateCache calculateCache) { - ActivityCheckRule rule = checkRuleHandlerFactory.getRuleHandler(checkRule.getCode(), ActivityCheckRule.class); - return rule.check(checkRule,activity,detail,orderDto,calculateCache); - } - - /** - * 活动选择检查 - */ - public CheckRuleResult activitySelectCheck(CheckRuleConfig checkRule, Activity activity, OrderDetailCheckParam detail, OrderCheckParam orderParam){ - ActivityCheckRule rule = checkRuleHandlerFactory.getRuleHandler(checkRule.getCode(), ActivityCheckRule.class); - return rule.check(checkRule,activity,detail,orderParam); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/CheckRuleHandlerFactory.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/CheckRuleHandlerFactory.java deleted file mode 100644 index 782e4486d2004f2af8ea003a1c1c222a3ff51fb3..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/CheckRuleHandlerFactory.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.bootx.sales.core.check.rule; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.common.core.exception.FatalException; -import cn.bootx.sales.core.check.rule.func.AbstractCheckRule; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** -* 检查规则服务适配器工厂 -* @author xxm -* @date 2020/12/6 -*/ -@Component -public class CheckRuleHandlerFactory implements ApplicationContextAware { - - private List abstractCheckRules; - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - abstractCheckRules = new ArrayList<>(applicationContext.getBeansOfType(AbstractCheckRule.class).values()); - // 检查ruleCode是否有重复 - long count = abstractCheckRules.stream() - .map(AbstractCheckRule::getCode) - .distinct() - .count(); - if (abstractCheckRules.size()!=count){ - throw new FatalException(0,"CheckRule实现类RuleCode有重复"); - } - } - - /** - * 根据类型选择出 支持的类 - */ - public T getRuleHandler(String ruleCode, Class clazz){ - AbstractCheckRule abstractCheckRule = abstractCheckRules.stream() - .filter(handler -> Objects.equals(handler.getCode(), ruleCode)) - .findFirst() - .orElseThrow(() -> new BizException("ruleCode没有对应的处理类")); - - if (clazz.isAssignableFrom(abstractCheckRule.getClass())){ - //noinspection unchecked - return (T) abstractCheckRule; - } - throw new BizException("传入类型错误"); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/AbstractCheckRule.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/AbstractCheckRule.java deleted file mode 100644 index 87e4e11012156bb94da9664243a37b5e613c83a5..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/AbstractCheckRule.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bootx.sales.core.check.rule.func; - -/** - * 抽象规则检查接口 - * @author xxm - * @date 2020/12/6 - */ -public interface AbstractCheckRule { - - /** - * 规则类型 - */ - String getCode(); - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/ActivityCheckRule.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/ActivityCheckRule.java deleted file mode 100644 index d1b49f56cb5ec67890832ed94a7a16b1c1d25ee8..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/ActivityCheckRule.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.bootx.sales.core.check.rule.func; - -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.convert.OrderConvert; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.bootx.sales.param.order.OrderDetailCheckParam; - -/** -* 策略使用检查接口 -* @author xxm -* @date 2020/12/6 -*/ -public interface ActivityCheckRule extends AbstractCheckRule { - - /** - * 计算时检查 - */ - default CheckRuleResult check(CheckRuleConfig checkRule, Activity activity, OrderDetailCache detail, OrderCache orderCache, CalculateCache calculateCache) { - return check(checkRule,activity, OrderConvert.INSTANCE.convert(detail), OrderConvert.INSTANCE.convert(orderCache)); - } - - /** - * 选择是检查 - */ - CheckRuleResult check(CheckRuleConfig checkRule, Activity activity, OrderDetailCheckParam detail, OrderCheckParam orderParam); - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/CouponCheckRule.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/CouponCheckRule.java deleted file mode 100644 index 4be0e027571025b4b232ede933dc84c8d9283d83..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/CouponCheckRule.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.bootx.sales.core.check.rule.func; - -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.convert.OrderConvert; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.param.order.OrderCheckParam; - -/** -* 优惠券使用检查接口 -* @author xxm -* @date 2020/12/6 -*/ -public interface CouponCheckRule extends AbstractCheckRule { - - /** - * 计算时检查 - */ - default CheckRuleResult check(CheckRuleConfig checkRule, CouponTemplate template, OrderCache orderCache, CalculateCache calculateCache) { - return check(checkRule,template, OrderConvert.INSTANCE.convert(orderCache)); - } - - /** - * 选择时检查 - */ - CheckRuleResult check(CheckRuleConfig checkRule, CouponTemplate template, OrderCheckParam orderCheckParam); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/CouponObtainRule.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/CouponObtainRule.java deleted file mode 100644 index 47c45aa9f10b8919b728f8b90c8ff4c82c1d4958..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/func/CouponObtainRule.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.bootx.sales.core.check.rule.func; - -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.param.coupon.ObtainCouponParam; - -/** -* 优惠券领取检查接口 -* @author xxm -* @date 2020/12/6 -*/ -public interface CouponObtainRule extends AbstractCheckRule { - - /** - * 领取检查 - */ - CheckRuleResult check(CheckRuleConfig checkRule, CouponTemplate couponTemplate, ObtainCouponParam param); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/activity/select/ChannelActivitySelectRule.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/activity/select/ChannelActivitySelectRule.java deleted file mode 100644 index a492c30119bec8d1cf43f8cd2314ea31a56449c2..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/activity/select/ChannelActivitySelectRule.java +++ /dev/null @@ -1,42 +0,0 @@ -package cn.bootx.sales.core.check.rule.impl.activity.select; - -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.rule.func.ActivityCheckRule; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import cn.hutool.core.util.StrUtil; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** -* 渠道检查 -* @author xxm -* @date 2021/5/18 -*/ -@Component -@RequiredArgsConstructor -public class ChannelActivitySelectRule implements ActivityCheckRule { - - @Override - public String getCode() { - return CheckRuleCode.Activity.CHECK_CHANNEL; - } - - @Override - public CheckRuleResult check(CheckRuleConfig checkRule, Activity activity, OrderDetailCheckParam detail, OrderCheckParam orderParam) { - String addition = checkRule.getAddition(); - List channelIds = StrUtil.split(addition, ','); - boolean contains = channelIds.contains(String.valueOf(orderParam.getChannelId())); - CheckRuleResult checkRuleResult = new CheckRuleResult() - .setPass(contains); - if (!contains){ - checkRuleResult.setMsg("渠道检查未通过"); - } - return checkRuleResult; - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/coupon/obtain/ObtainMultipleRuleImpl.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/coupon/obtain/ObtainMultipleRuleImpl.java deleted file mode 100644 index 3e8e5ceb4248a1b973ee69ad60a3b4d1c66b7eed..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/coupon/obtain/ObtainMultipleRuleImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.bootx.sales.core.check.rule.impl.coupon.obtain; - -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.code.CouponStatusCode; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.rule.func.CouponObtainRule; -import cn.bootx.sales.core.coupon.dao.CouponManager; -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.param.coupon.ObtainCouponParam; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Objects; - -/** - * 重复领取限制 - * @author xxm - * @date 2020/12/6 - */ -@Component -@RequiredArgsConstructor -public class ObtainMultipleRuleImpl implements CouponObtainRule { - private final CouponManager couponManager; - - @Override - public String getCode() { - return CheckRuleCode.Coupon.OBTAIN_MULTIPLE; - } - - @Override - public CheckRuleResult check(CheckRuleConfig checkRule, CouponTemplate couponTemplate, ObtainCouponParam param) { - // 重复领取限制 - List coupons = couponManager.findByUserAndTemplate(param.getUserId(), param.getTemplateId()); - long count = coupons.stream() - .filter(coupon -> !Objects.equals(coupon.getStatus(), CouponStatusCode.STATUS_EXPIRED)) - .count(); - CheckRuleResult checkRuleResult = new CheckRuleResult(); - if (count>0){ - checkRuleResult.setMsg("优惠券不可重复领取") - .setPass(false); - } - return checkRuleResult; - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/coupon/select/ChannelCouponSelectRule.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/coupon/select/ChannelCouponSelectRule.java deleted file mode 100644 index 484533e169d3c02f09b9241e323ea133580e39bf..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/coupon/select/ChannelCouponSelectRule.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.bootx.sales.core.check.rule.impl.coupon.select; - -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.rule.func.CouponCheckRule; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.hutool.core.util.StrUtil; -import org.springframework.stereotype.Component; - -import java.util.List; - -/** -* 优惠券渠道检查 -* @author xxm -* @date 2021/5/21 -*/ -@Component -public class ChannelCouponSelectRule implements CouponCheckRule { - @Override - public String getCode() { - return CheckRuleCode.Coupon.CHECK_CHANNEL; - } - - @Override - public CheckRuleResult check(CheckRuleConfig checkRule, CouponTemplate template, OrderCheckParam orderCheckParam) { - String addition = checkRule.getAddition(); - List channelIds = StrUtil.split(addition, ','); - boolean contains = channelIds.contains(String.valueOf(orderCheckParam.getChannelId())); - CheckRuleResult checkRuleResult = new CheckRuleResult() - .setPass(contains); - if (!contains){ - checkRuleResult.setMsg("渠道检查未通过"); - } - return checkRuleResult; - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/coupon/select/CheckMultipleRuleImpl.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/coupon/select/CheckMultipleRuleImpl.java deleted file mode 100644 index 44ccf09eb423fb32d9da595915975b80745562aa..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/rule/impl/coupon/select/CheckMultipleRuleImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.bootx.sales.core.check.rule.impl.coupon.select; - -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.rule.func.CouponCheckRule; -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.param.order.OrderCheckParam; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** -* 优惠券叠加检查 -* @author xxm -* @date 2020/12/6 -*/ -@Component -public class CheckMultipleRuleImpl implements CouponCheckRule { - @Override - public String getCode() { - return CheckRuleCode.Coupon.CHECK_USE_MULTIPLE; - } - - @Override - public CheckRuleResult check(CheckRuleConfig checkRule,CouponTemplate template, OrderCache orderCache, CalculateCache calculateCache) { - List coupons = orderCache.getCoupons(); - // 根据模板ID分组 - Map> couponsByTemplate = coupons.stream() - .collect(Collectors.groupingBy(Coupon::getTemplateId)); - List list = couponsByTemplate.get(template.getId()); - CheckRuleResult checkRuleResult = new CheckRuleResult() - .setPass(list.size()>1); - if (list.size()>1){ - checkRuleResult.setMsg("优惠券不允许叠加使用"); - } - return checkRuleResult; - } - - @Override - public CheckRuleResult check(CheckRuleConfig checkRule, CouponTemplate template, OrderCheckParam orderCheckParam) { - return new CheckRuleResult(); - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/activity/ActivityCalculateCheckService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/activity/ActivityCalculateCheckService.java deleted file mode 100644 index 7033b289b6fb6c7a7874c79729d23cabd21c46e1..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/activity/ActivityCalculateCheckService.java +++ /dev/null @@ -1,92 +0,0 @@ -package cn.bootx.sales.core.check.service.activity; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.handler.activity.ActivityCheckHandler; -import cn.bootx.sales.core.check.injector.CheckRuleInjector; -import cn.bootx.sales.core.check.rule.CheckRuleHandlerAdapter; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.Collection; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 活动计算时检查 - * @author xxm - * @date 2020/11/26 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class ActivityCalculateCheckService { - private final ActivityCheckHandler activityCheckHandler; - private final CheckRuleHandlerAdapter checkRuleHandlerAdapter; - private final CheckRuleInjector checkRuleInjector; - - /** - * 活动检查(公共) - */ - public void checkCommons(OrderCache orderDto, CalculateCache calculateCache){ - - // 通用检查 时间检查 - activityCheckHandler.checkTime(calculateCache.getActivities()); - // 检查 明细策略 - List details = orderDto.getDetails(); - for (OrderDetailCache detail : details) { - List activities = detail.getActivities(); - // 无策略注册不检查 - if (CollUtil.isEmpty(activities)){ - continue; - } - // 活动匹配检查 - activityCheckHandler.checkMatch(detail,activities); - // 同类互斥检查 - activityCheckHandler.checkMutex(activities,calculateCache); - } - } - - /** - * 根据配置的规则进行检查 - */ - public void checkByRule(OrderCache orderDto, CalculateCache calculateCache) { - - // 有检测策略的订单明细 - List details = orderDto.getDetails() - .stream() - .filter(detail-> CollUtil.isNotEmpty(detail.getActivities())) - .collect(Collectors.toList()); - - // 填充检测规则 - List activities = details.stream() - .map(OrderDetailCache::getActivities) - .flatMap(Collection::stream) - .collect(Collectors.toList()); - checkRuleInjector.injectionActivity(activities, CheckRuleCode.RULE_TYPE_ACTIVITY_CHECK); - - // 多重循环进行遍历和检测 - for (OrderDetailCache detail : details) { - for (Activity activityDto : detail.getActivities()) { - List useCheckRules = activityDto.getCheckRules(); - if (CollUtil.isEmpty(useCheckRules)){ - continue; - } - for (CheckRuleConfig checkRule : useCheckRules) { - CheckRuleResult checkRuleResult = checkRuleHandlerAdapter.activityUseCheck(checkRule, activityDto, detail, orderDto, calculateCache); - if (!checkRuleResult.isPass()){ - throw new BizException(checkRuleResult.getMsg()); - } - } - } - } - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/activity/ActivitySelectCheckService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/activity/ActivitySelectCheckService.java deleted file mode 100644 index 55a21214d2bd182e689173fe003a52b3469b94e2..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/activity/ActivitySelectCheckService.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.bootx.sales.core.check.service.activity; - -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.rule.CheckRuleHandlerAdapter; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; - -/** -* 活动选择时检查 -* @author xxm -* @date 2021/5/14 -*/ -@Slf4j -@Service -@RequiredArgsConstructor -public class ActivitySelectCheckService { - private final CheckRuleHandlerAdapter checkRuleHandlerAdapter; - - /** - * 活动选择检查 - */ - public List activitiesCheck(OrderDetailCheckParam detail, OrderCheckParam orderParam, List activities) { - List selectActivities = new ArrayList<>(); - out:for (Activity activity : activities) { - List checkRules = Optional.ofNullable(activity.getCheckRules()) - .orElse(new ArrayList<>(0)); - // 排序 - checkRules.sort(CheckRuleConfig::compareTo); - for (CheckRuleConfig checkRule : checkRules) { - // 不通过 - CheckRuleResult checkRuleResult = checkRuleHandlerAdapter.activitySelectCheck(checkRule, activity, detail, orderParam); - if (!checkRuleResult.isPass()){ - continue out; - } - } - selectActivities.add(activity); - } - return selectActivities; - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/coupon/CouponCalculateCheckService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/coupon/CouponCalculateCheckService.java deleted file mode 100644 index 0d0f9a322d39e224efccc78c7ef247b769a68959..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/coupon/CouponCalculateCheckService.java +++ /dev/null @@ -1,130 +0,0 @@ -package cn.bootx.sales.core.check.service.coupon; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.common.core.util.LocalDateTimeUtil; -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.code.CouponStatusCode; -import cn.bootx.sales.core.calculate.cache.CalculateCache; -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.handler.coupon.CouponCheckHandler; -import cn.bootx.sales.core.check.injector.CheckRuleInjector; -import cn.bootx.sales.core.check.rule.CheckRuleHandlerAdapter; -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.core.match.service.MatchRuleService; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.time.LocalDateTime; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * 优惠券计算检查 - * @author xxm - * @date 2020/11/26 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class CouponCalculateCheckService { - - private final CheckRuleInjector checkRuleInjector; - private final CouponCheckHandler couponCheckHandler; - private final CheckRuleHandlerAdapter checkRuleHandlerAdapter; - private final MatchRuleService matchRuleService; - - /** - * 检查优惠券(公共) - */ - public void checkCommons(OrderCache orderCache, CalculateCache calculateCache) { - - // 没有优惠券则不进行检查 - List coupons = orderCache.getCoupons(); - if (CollUtil.isEmpty(coupons)){ - return; - } - - // 状态是否可用 - boolean statusFlag = coupons.stream() - .anyMatch(coupon -> !Objects.equals(coupon.getStatus(), CouponStatusCode.STATUS_NORMAL)); - if (statusFlag){ - throw new BizException("状态不可用"); - } - - // 用户是否符合 - boolean userFlag = coupons.stream() - .anyMatch(coupon -> !Objects.equals(orderCache.getUserId(), coupon.getUserId())); - if (userFlag){ - throw new BizException("用户不合法"); - } - - // 是否在可用的时间段 - boolean dateTimeFlag = coupons.stream() - .anyMatch(coupon -> !LocalDateTimeUtil.between(LocalDateTime.now(), coupon.getStartTime(), coupon.getEndTime())); - if (dateTimeFlag){ - throw new BizException("优惠券时间不符合"); - } - - // 优惠券模板 - Map couponTemplateMap = calculateCache.getCouponTemplateMap(); - List templates = coupons.stream() - .map(coupon -> couponTemplateMap.get(coupon.getTemplateId())) - .collect(Collectors.toList()); - - // 互斥检查 - for (CouponTemplate template : templates) { - if (!couponCheckHandler.activityMutual(template, orderCache)) { - throw new BizException("优惠券与当前策略互斥"); - } - if (!couponCheckHandler.couponMutual(template, orderCache)){ - throw new BizException("优惠券之间存在互斥"); - } - } - // 检查优惠券是否可以匹配到当前订单中 - for (CouponTemplate template : templates) { - if (!matchRuleService.orderMatch(orderCache, template.getMatchRules())) { - throw new BizException("优惠券不适用当前订单"); - } - } - } - - /** - * 根据配置的规则进行检查 - */ - public void checkByRule(OrderCache orderDto, CalculateCache calculateCache){ - // 没有优惠券则不进行检查 - List coupons = orderDto.getCoupons(); - if (CollUtil.isEmpty(coupons)){ - return; - } - Map couponTemplateMap = calculateCache.getCouponTemplateMap(); - List templates = coupons.stream() - .map(coupon -> couponTemplateMap.get(coupon.getTemplateId())) - .collect(Collectors.toList()); - - checkRuleInjector.injectionTemplate(templates, CheckRuleCode.RULE_TYPE_ACTIVITY_CHECK); - - /* 根据配置规则进行检查 */ - for (CouponTemplate template : templates) { - List useCheckRules = template.getCheckRules(); - if (CollUtil.isEmpty(useCheckRules)){ - continue; - } - for (CheckRuleConfig checkRule : useCheckRules) { - // 进行检查 - CheckRuleResult checkRuleResult = checkRuleHandlerAdapter.couponUseCheck(template, checkRule, orderDto, calculateCache); - if (!checkRuleResult.isPass()){ - throw new BizException(checkRuleResult.getMsg()); - } - } - } - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/coupon/CouponSelectCheckService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/coupon/CouponSelectCheckService.java deleted file mode 100644 index 29cf252cd472bd6a483bb5e729974b64b2cb16bf..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/check/service/coupon/CouponSelectCheckService.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bootx.sales.core.check.service.coupon; - -import cn.bootx.sales.core.check.injector.CheckRuleInjector; -import cn.bootx.sales.core.check.rule.CheckRuleHandlerAdapter; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -/** -* 优惠券匹配检查 -* @author xxm -* @date 2021/5/14 -*/ -@Slf4j -@Service -@RequiredArgsConstructor -public class CouponSelectCheckService { - private final CheckRuleHandlerAdapter checkRuleHandlerAdapter; - private final CheckRuleInjector checkRuleInjector; - - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/convert/CouponConvert.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/convert/CouponConvert.java deleted file mode 100644 index 1bf2eb52ff18a63c432615fbb418abad90242efc..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/convert/CouponConvert.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.bootx.sales.core.coupon.convert; - -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.dto.coupon.CouponDto; -import cn.bootx.sales.dto.coupon.CouponTemplateDto; -import cn.bootx.sales.param.coupon.CouponTemplateParam; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -/** -* 优惠转换 -* @author xxm -* @date 2021/5/20 -*/ -@Mapper -public interface CouponConvert { - CouponConvert INSTANCE = Mappers.getMapper(CouponConvert.class); - - @Mappings({ - @Mapping(target = "couponMutual",ignore = true), - @Mapping(target = "activityMutual",ignore = true) - }) - CouponTemplate convert(CouponTemplateParam in); - - CouponTemplate convert(CouponTemplateDto in); - - CouponTemplateDto convert(CouponTemplate in); - - Coupon convert(CouponDto in); - - CouponDto convert(Coupon in); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponManager.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponManager.java deleted file mode 100644 index 76d56319e7f20e9602f149cb315d979eeed340eb..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponManager.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.bootx.sales.core.coupon.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.sales.core.coupon.entity.Coupon; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; - -import java.util.List; - -/** -* 优惠券 -* @author xxm -* @date 2020/11/2 -*/ -@Slf4j -@Repository -@RequiredArgsConstructor -public class CouponManager extends BaseManager { - - /** - * 查询用户的优惠券 - */ - public List findByUser(Long userId){ - return findAllByField(Coupon::getUserId,userId); - } - /** - * 查询用户指定状态的优惠券 - */ - public List findByUserAndStatus(Long userId, int status){ - return lambdaQuery().eq(Coupon::getUserId,userId) - .eq(Coupon::getStatus,status) - .list(); - } - - /** - * 根据优惠券模板查询用户拥有的优惠券 - */ - public List findByUserAndTemplate(Long userId,Long templateId) { - return lambdaQuery().eq(Coupon::getUserId,userId) - .eq(Coupon::getTemplateId,templateId) - .list(); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponMapper.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponMapper.java deleted file mode 100644 index 8e48e89427021de41880b053aeb1ab44e4965b90..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.bootx.sales.core.coupon.dao; - -import cn.bootx.sales.core.coupon.entity.Coupon; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface CouponMapper extends BaseMapper { -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponTemplateManager.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponTemplateManager.java deleted file mode 100644 index 81e255fbadb930c6d2982c5b48e6cbbcd0864e3b..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponTemplateManager.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bootx.sales.core.coupon.dao; - - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; - -/** -* 优惠券策略 -* @author xxm -* @date 2020/10/19 -*/ -@Slf4j -@Repository -@RequiredArgsConstructor -public class CouponTemplateManager extends BaseManager { - private final CouponTemplateMapper couponTemplateMapper; - - /** - * 减少优惠券个数 - */ - public boolean reduceCoupons(Long couponTemplateId,int num){ - return couponTemplateMapper.reduceCoupons(couponTemplateId,num)>0; - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponTemplateMapper.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponTemplateMapper.java deleted file mode 100644 index e5df6f10722f8201c52ad9b2e7b972d2cb2af3dd..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/dao/CouponTemplateMapper.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.bootx.sales.core.coupon.dao; - -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Update; -import org.springframework.data.repository.query.Param; - -/** -* 优惠券模板 -* @author xxm -* @date 2021/8/10 -*/ -@Mapper -public interface CouponTemplateMapper extends BaseMapper { - - @Update("update sales_coupon_template " + - "set num = (num-${count}),version = (version + 1) " + - "where id = #{couponTemplateId} and (num - ${count}) >= 0") - int reduceCoupons(@Param("couponTemplateId") Long couponTemplateId, @Param("count")int count); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/entity/Coupon.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/entity/Coupon.java deleted file mode 100644 index 8cbf9d03ff8d40586d283cf795df5e70fbb5b35f..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/entity/Coupon.java +++ /dev/null @@ -1,67 +0,0 @@ -package cn.bootx.sales.core.coupon.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.sales.core.coupon.convert.CouponConvert; -import cn.bootx.sales.dto.coupon.CouponDto; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.time.LocalDateTime; - -/** - * 优惠券策略 - * @author xxm - * @date 2020/10/19 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("sales_coupon") -public class Coupon extends MpBaseEntity implements EntityBaseFunction { - - /** 名称 */ - private String name; - - /** 描述 */ - private String description; - - /** 模板id */ - private Long templateId; - - /** 策略注册id */ - private Long strategyRegisterId; - - /** 有效开始时间 */ - private LocalDateTime startTime; - - /** 有效结束时间 */ - private LocalDateTime endTime; - - /** 状态 */ - private int status; - - /** 用于的订单 */ - private Long orderId; - - /** 领取时间 */ - private LocalDateTime obtainTime; - - /** 使用时间 */ - private LocalDateTime usedTime; - - /** 用户id */ - private Long userId; - - public static Coupon init(CouponDto dto){ - return CouponConvert.INSTANCE.convert(dto); - } - - @Override - public CouponDto toDto() { - return CouponConvert.INSTANCE.convert(this); - - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/entity/CouponTemplate.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/entity/CouponTemplate.java deleted file mode 100644 index f6dffbf499d80e3067bc17ad27296249768dd112..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/entity/CouponTemplate.java +++ /dev/null @@ -1,83 +0,0 @@ -package cn.bootx.sales.core.coupon.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.coupon.convert.CouponConvert; -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import cn.bootx.sales.dto.coupon.CouponTemplateDto; -import cn.bootx.sales.param.coupon.CouponTemplateParam; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.time.LocalDateTime; -import java.util.List; - -/** - * 优惠券策略 - * @author xxm - * @date 2020/10/19 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("sales_coupon_template") -public class CouponTemplate extends MpBaseEntity implements EntityBaseFunction { - - /** 模板名称 */ - private String name; - - /** 策略注册id */ - private Long strategyRegisterId; - - /** 描述 */ - private String description; - - /** 数量 */ - private Integer num; - - /** 匹配内容规则*/ - @TableField(exist = false) - private List matchRules; - - /** 检测规则 */ - @TableField(exist = false) - private List checkRules; - - /** 优惠券互斥 */ - private String couponMutual; - - /** 策略互斥 */ - private String activityMutual; - - /** 有效类型 固定时间段/几天内有效 */ - private Integer effectiveType; - - /** 时间类型 小时/整天/多少天后*/ - private Integer timeType; - - /** 有效时间 */ - private Long effectiveTime; - - /** 有效开始时间 */ - private LocalDateTime startTime; - - /** 有效结束时间 */ - private LocalDateTime endTime; - - public static CouponTemplate init(CouponTemplateDto dto){ - return CouponConvert.INSTANCE.convert(dto); - } - - public static CouponTemplate init(CouponTemplateParam param){ - return CouponConvert.INSTANCE.convert(param); - } - - @Override - public CouponTemplateDto toDto() { - return CouponConvert.INSTANCE.convert(this); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/service/CouponService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/service/CouponService.java deleted file mode 100644 index ab4fea94216e254e3301839986dd4183321953f6..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/service/CouponService.java +++ /dev/null @@ -1,190 +0,0 @@ -package cn.bootx.sales.core.coupon.service; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.common.core.exception.DataNotExistException; -import cn.bootx.common.core.util.ResultConvertUtil; -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.code.CouponStatusCode; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.injector.CheckRuleInjector; -import cn.bootx.sales.core.check.rule.CheckRuleHandlerAdapter; -import cn.bootx.sales.core.coupon.dao.CouponManager; -import cn.bootx.sales.core.coupon.dao.CouponTemplateManager; -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.dto.coupon.CouponDto; -import cn.bootx.sales.dto.coupon.CouponTemplateDto; -import cn.bootx.sales.param.coupon.ObtainCouponParam; -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.time.LocalDateTime; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** - * 优惠券 - * @author xxm - * @date 2020/10/19 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class CouponService { - private final CheckRuleInjector checkRuleInjector; - private final CheckRuleHandlerAdapter checkRuleHandlerAdapter; - - private final CouponTemplateManager couponTemplateManager; - private final CouponManager couponManager; - - /** - * 领取优惠券 - */ - @Transactional(rollbackFor = Exception.class) - public void obtainCoupon(ObtainCouponParam param){ - CouponTemplate couponTemplate = couponTemplateManager.findById(param.getTemplateId()).orElseThrow(() -> new BizException("优惠券模板不存在")); - - Integer couponCount = couponTemplate.getNum(); - if (couponCount==0){ - throw new BizException("优惠券已发放完毕"); - } - - // 领取检查 - this.obtainCheck(couponTemplate,param); - - // 扣减优惠券数量 - couponTemplateManager.reduceCoupons(couponTemplate.getId(),1); - - // 设置优惠券时间可用范围 - Integer effectiveType = couponTemplate.getEffectiveType(); - LocalDateTime startTime = null; - LocalDateTime endTime = null; - - // 固定时间段 - if (Objects.equals(effectiveType, CouponTemplateDto.FIXED_TIME)){ - startTime = couponTemplate.getStartTime(); - endTime = couponTemplate.getEndTime(); - } - - // 生成优惠券 - Coupon coupon = new Coupon() - .setName(couponTemplate.getName()) - .setTemplateId(couponTemplate.getId()) - .setStatus(CouponStatusCode.STATUS_NORMAL) - .setStrategyRegisterId(couponTemplate.getStrategyRegisterId()) - .setStartTime(startTime) - .setEndTime(endTime) - .setObtainTime(LocalDateTime.now()) - .setUserId(param.getUserId()); - couponManager.save(coupon); - } - - /** - * 优惠券领取检查(根据设置的Rule) - */ - public void obtainCheck(CouponTemplate template,ObtainCouponParam param){ - // 获取领取检查规则 - checkRuleInjector.injectionTemplate(Collections.singletonList(template), CheckRuleCode.RULE_TYPE_COUPON_OBTAIN); - List useCheckRules = template.getCheckRules(); - if (CollUtil.isEmpty(useCheckRules)){ - return; - } - for (CheckRuleConfig checkRule : useCheckRules) { - // 进行检查 - CheckRuleResult checkRuleResult = checkRuleHandlerAdapter.couponObtainCheck(checkRule, template, param); - if (!checkRuleResult.isPass()){ - throw new BizException(checkRuleResult.getMsg()); - } - } - } - - /** - * 个人的优惠券 - */ - public List findCouponByUserId(Long userId){ - return couponManager.findByUser(userId) - .stream() - .map(Coupon::toDto) - .collect(Collectors.toList()); - } - - /** - * 查询 - */ - public CouponDto getById(Long couponId){ - return couponManager.findById(couponId).map(Coupon::toDto) - .orElseThrow(DataNotExistException::new); - } - - /** - * 查询批量 - */ - public List findByIds(List couponIds){ - return ResultConvertUtil.dtoListConvert(couponManager.findAllByIds(couponIds)); - } - - /** - * 撤销优惠券 - */ - public void revokeById(Long couponId){ - - } - - /** - * 取消锁定 - */ - public void unlockByIds(List couponIds){ - List coupons = couponManager.findAllByIds(couponIds); - coupons.forEach(coupon -> coupon.setStatus(CouponStatusCode.STATUS_NORMAL)); - couponManager.updateAllById(coupons); - } - - /** - * 锁定优惠券 - */ - public void lockByIds(List couponIds) { - List coupons = couponManager.findAllByIds(couponIds); - coupons.forEach(coupon -> coupon.setStatus(CouponStatusCode.STATUS_FREEZE)); - couponManager.updateAllById(coupons); - } - - /** - * 锁定优惠券 - */ - public void lockById(Long couponId) { - Coupon coupon = couponManager.findById(couponId) - .map(couponObj -> couponObj.setStatus(CouponStatusCode.STATUS_FREEZE)) - .orElseThrow(() -> new BizException("优惠券不存在")); - couponManager.updateById(coupon); - } - - /** - * 使用优惠券 - */ - public void use(Long couponId,Long orderId){ - Coupon coupon = couponManager.findById(couponId) - .map(couponObj -> couponObj.setStatus(CouponStatusCode.STATUS_USED) - .setOrderId(orderId) - .setUsedTime(LocalDateTime.now())) - .orElseThrow(() -> new BizException("优惠券不存在")); - couponManager.updateById(coupon); - } - - /** - * 批量使用优惠券 - */ - public void useBatch(List couponIds,Long orderId){ - List coupons = couponManager.findAllByIds(couponIds); - coupons.forEach(coupon -> coupon.setStatus(CouponStatusCode.STATUS_USED) - .setOrderId(orderId) - .setUsedTime(LocalDateTime.now())); - couponManager.updateAllById(coupons); - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/service/CouponTemplateService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/service/CouponTemplateService.java deleted file mode 100644 index bbb3ad51f23cd74e7d3a51ef9799103151d26fe7..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/coupon/service/CouponTemplateService.java +++ /dev/null @@ -1,107 +0,0 @@ -package cn.bootx.sales.core.coupon.service; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.code.StrategyRegisterCode; -import cn.bootx.sales.core.coupon.dao.CouponTemplateManager; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.core.match.dao.MatchRuleManager; -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import cn.bootx.sales.core.strategy.dao.StrategyRegisterManager; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import cn.bootx.sales.core.strategy.service.StrategyRegisterService; -import cn.bootx.sales.dto.coupon.CouponTemplateDto; -import cn.bootx.sales.dto.strategy.StrategyRegisterDto; -import cn.bootx.sales.param.coupon.CouponTemplateParam; -import cn.bootx.sales.param.strategy.CheckRuleParam; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; - -/** - * 优惠券模板 - * @author xxm - * @date 2020/10/19 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class CouponTemplateService { - - private final CouponTemplateManager couponTemplateManager; - private final StrategyRegisterManager strategyRegisterManager; - private final MatchRuleManager matchManager; - - private final StrategyRegisterService strategyRegisterService; - - /** - * 新建优惠券模板 - */ - @Transactional(rollbackFor = Exception.class) - public CouponTemplateDto add(CouponTemplateParam param){ - - // 设置优惠券的策略注册属性 - param.setStrategyType(StrategyRegisterCode.STRATEGY_TYPE_COUPON); - - // 选择和运算检查配置 - List checkRules = param.getCheckRules(); - checkRules.forEach(checkRuleParam -> checkRuleParam.setRuleType(CheckRuleCode.RULE_TYPE_COUPON_CHECK)); - // 领取检查配置 - List obtainRules = param.getObtainRules(); - obtainRules.forEach(checkRuleParam -> checkRuleParam.setRuleType(CheckRuleCode.RULE_TYPE_COUPON_OBTAIN)); - - List allCheckRules = new ArrayList<>(checkRules); - allCheckRules.addAll(obtainRules); - param.setCheckRules(allCheckRules); - - // 保存策略注册 - StrategyRegisterDto strategyRegisterDto = strategyRegisterService.add(param); - - // 保存模板优惠卷模板 - CouponTemplate couponTemplate = CouponTemplate.init(param); - - // 策略互斥 - String activityMutual = String.join(",", Optional.ofNullable(param.getActivityMutual()).orElse(Collections.emptyList())); - // 优惠券互斥 - String couponMutual = String.join(",", Optional.ofNullable(param.getCouponMutual()).orElse(Collections.emptyList())); - - couponTemplate.setActivityMutual(activityMutual) - .setCouponMutual(couponMutual) - .setStrategyRegisterId(strategyRegisterDto.getId()); - - return couponTemplateManager.save(couponTemplate).toDto(); - } - - - /** - * 查询优惠券模板 - */ - public List findAll(){ - return couponTemplateManager.findAll() - .stream() - .map(CouponTemplate::toDto) - .collect(Collectors.toList()); - } - - /** - * 优惠券模板详情 - */ - public CouponTemplateDto findById(Long templateId){ - CouponTemplate couponTemplate = couponTemplateManager.findById(templateId).orElseThrow(() -> new BizException("优惠券模板不存在")); - CouponTemplateDto couponTemplateDto = couponTemplate.toDto(); - // 策略参数 - StrategyRegister strategyRegister = strategyRegisterManager.findById(couponTemplate.getStrategyRegisterId()).orElseThrow(() -> new BizException("策略注册存在")); - // 匹配规则 - List checkMatches = matchManager.findByStrategyRegisterId(couponTemplate.getStrategyRegisterId()); - - return couponTemplateDto.setStrategyRegister(strategyRegister.toDto()); -// .setMatchIds(checkMatches.stream().map(MatchRuleConfig::getFeaturePoint).collect(Collectors.toList())); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/convert/MatchRuleConvert.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/convert/MatchRuleConvert.java deleted file mode 100644 index fe304e3be0569e8bacd6b71abafd9e0505c0cfe0..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/convert/MatchRuleConvert.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.bootx.sales.core.match.convert; - -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import cn.bootx.sales.dto.match.MatchRuleDto; -import cn.bootx.sales.param.strategy.MatchRuleParam; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -/** -* 转换 -* @author xxm -* @date 2021/5/19 -*/ -@Mapper -public interface MatchRuleConvert { - MatchRuleConvert INSTANCE = Mappers.getMapper(MatchRuleConvert.class); - - MatchRuleConfig convert(MatchRuleDto in); - - MatchRuleConfig convert(MatchRuleParam in); - - MatchRuleDto convert(MatchRuleConfig in); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/dao/MatchRuleManager.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/dao/MatchRuleManager.java deleted file mode 100644 index c33286c3f59a0d1936a5dd5c1055030f8c780c1a..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/dao/MatchRuleManager.java +++ /dev/null @@ -1,55 +0,0 @@ -package cn.bootx.sales.core.match.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.sales.code.MatchTypeCode; -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import cn.bootx.sales.dto.match.FeaturePoints; -import lombok.RequiredArgsConstructor; -import org.springframework.stereotype.Repository; - -import java.util.List; - -import static cn.bootx.sales.code.MatchRuleCode.MATCH_ACTIVITY; - -/** - * 匹配规则 - * @author xxm - * @date 2021/5/8 - */ -@Repository -@RequiredArgsConstructor -public class MatchRuleManager extends BaseManager { - - public List findByStrategyRegisterIds(List templateIds) { - return findAllByFields(MatchRuleConfig::getStrategyRegisterId,templateIds); - } - - public List findByStrategyRegisterId(Long strategyRegisterId){ - return findAllByField(MatchRuleConfig::getStrategyRegisterId,strategyRegisterId); - } - - - /** - * 全局生效的活动策略(非eq类型,) - */ - public List findGlobalActivityMatch(){ - return lambdaQuery().eq(MatchRuleConfig::getRegisterType,MATCH_ACTIVITY) - .ne(MatchRuleConfig::getMatchType,MatchTypeCode.EQ) - .list(); - } - - /** - * 查询匹配(eq类型) - */ - public List findByActivityMatch(List featurePoints) { - return lambdaQuery().eq(MatchRuleConfig::getRegisterType, MATCH_ACTIVITY) - .eq(MatchRuleConfig::getMatchType, MatchTypeCode.EQ) - // 特征点 - .and(queryWrapper ->{ - for (FeaturePoints feature : featurePoints) { - queryWrapper.or(o -> - o.eq(MatchRuleConfig::getFeatureType,feature.getType()).in(MatchRuleConfig::getFeaturePoint,feature.getPoints())); - } - }).list(); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/dao/MatchRuleMapper.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/dao/MatchRuleMapper.java deleted file mode 100644 index 5ae722356d9321a0524ce88864ff1cb8c96f3f81..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/dao/MatchRuleMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.bootx.sales.core.match.dao; - -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface MatchRuleMapper extends BaseMapper { -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/entity/MatchRuleConfig.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/entity/MatchRuleConfig.java deleted file mode 100644 index 2ec22a335fa56f22c4618b47a73c36d61385a9f8..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/entity/MatchRuleConfig.java +++ /dev/null @@ -1,59 +0,0 @@ -package cn.bootx.sales.core.match.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.sales.code.MatchRuleCode; -import cn.bootx.sales.code.MatchTypeCode; -import cn.bootx.sales.core.match.convert.MatchRuleConvert; -import cn.bootx.sales.dto.match.MatchRuleDto; -import cn.bootx.sales.param.strategy.MatchRuleParam; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * 匹配关系配置 - * @author xxm - * @date 2020/12/3 - */ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("sales_match_rule") -public class MatchRuleConfig extends MpBaseEntity implements EntityBaseFunction { - - /** 策略注册id */ - private Long strategyRegisterId; - - /** - * @see MatchRuleCode - * 外部关联类型 活动/优惠券 - */ - private int registerType; - - /** 特征类型 */ - private String featureType; - - /** 特征值 */ - private String featurePoint; - - /** - * 匹配类型 - * @see MatchTypeCode - */ - private String matchType; - - public static MatchRuleConfig init(MatchRuleDto dto) { - return MatchRuleConvert.INSTANCE.convert(dto); - } - - public static MatchRuleConfig init(MatchRuleParam param) { - return MatchRuleConvert.INSTANCE.convert(param); - } - - @Override - public MatchRuleDto toDto() { - return MatchRuleConvert.INSTANCE.convert(this); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/func/FeatureHandler.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/func/FeatureHandler.java deleted file mode 100644 index 95ab53e35a801d989d2c03ef4d65e986485a4e85..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/func/FeatureHandler.java +++ /dev/null @@ -1,70 +0,0 @@ -package cn.bootx.sales.core.match.handler.func; - -import cn.bootx.sales.code.MatchTypeCode; -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import cn.bootx.sales.dto.match.FeaturePoint; -import cn.bootx.sales.dto.match.FeaturePoints; -import cn.bootx.sales.param.order.OrderDetailCheckParam; - -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -/** -* 特征点处理接口 -* @author xxm -* @date 2021/5/18 -*/ -public interface FeatureHandler { - - /** - * 是否启用 - */ - default boolean use(MatchRuleConfig matchRuleConfig){ - return Objects.equals(matchRuleConfig.getFeatureType(),getFeatureType()); - } - - /** - * 特征类型 - */ - String getFeatureType(); - - /** - * 特征点 - */ - String getFeaturePoint(OrderDetailCheckParam checkParam); - - /** - * 抽取特征点 - */ - default FeaturePoint extract(OrderDetailCheckParam checkParam){ - return new FeaturePoint(getFeatureType(),getFeaturePoint(checkParam)); - } - - /** - * 抽取特征点 - */ - default FeaturePoints extract(List checkParams){ - List points = checkParams.stream() - .map(this::getFeaturePoint) - .collect(Collectors.toList()); - return new FeaturePoints(getFeatureType(),points); - } - - /** - * 匹配特征点(默认eq匹配) - */ - default boolean match(OrderDetailCheckParam checkParam,MatchRuleConfig matchRuleConfig){ - if (!use(matchRuleConfig)){ - return false; - } - String matchType = matchRuleConfig.getMatchType(); - if (Objects.equals(matchType, MatchTypeCode.EQ)){ - return Objects.equals(getFeaturePoint(checkParam),matchRuleConfig.getFeaturePoint()); - } - if (Objects.equals(matchType, MatchTypeCode.NE)){ - return !Objects.equals(getFeaturePoint(checkParam),matchRuleConfig.getFeaturePoint()); - } - return false; - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/CategoryFeatureHandler.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/CategoryFeatureHandler.java deleted file mode 100644 index d9792806bb98028536a3d36a517f9244d3a628ae..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/CategoryFeatureHandler.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.bootx.sales.core.match.handler.impl.feature; - -import cn.bootx.sales.core.match.handler.func.FeatureHandler; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import org.springframework.stereotype.Component; - -/** -* 类目特征点 -* @author xxm -* @date 2021/5/18 -*/ -@Component -public class CategoryFeatureHandler implements FeatureHandler { - - - @Override - public String getFeatureType() { - return "categoryId"; - } - - @Override - public String getFeaturePoint(OrderDetailCheckParam checkParam) { - return String.valueOf(checkParam.getCategoryId()); - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/GoodsFeatureHandler.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/GoodsFeatureHandler.java deleted file mode 100644 index eaf0a5bb8906d3e844339bbf3411277b000d2635..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/GoodsFeatureHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.bootx.sales.core.match.handler.impl.feature; - -import cn.bootx.sales.core.match.handler.func.FeatureHandler; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import org.springframework.stereotype.Component; - -/** -* 商品id抽取 -* @author xxm -* @date 2021/5/18 -*/ -@Component -public class GoodsFeatureHandler implements FeatureHandler { - - @Override - public String getFeatureType() { - return "goodsId"; - } - - @Override - public String getFeaturePoint(OrderDetailCheckParam checkParam) { - return String.valueOf(checkParam.getGoodsId()); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/ShopFeatureHandler.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/ShopFeatureHandler.java deleted file mode 100644 index 51a682d77af3dd5671ebe85adc96dc42011b750d..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/ShopFeatureHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.bootx.sales.core.match.handler.impl.feature; - -import cn.bootx.sales.core.match.handler.func.FeatureHandler; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import org.springframework.stereotype.Component; - -/** -* 商店id提取 -* @author xxm -* @date 2021/5/18 -*/ -@Component -public class ShopFeatureHandler implements FeatureHandler { - - @Override - public String getFeatureType() { - return "shopId"; - } - - @Override - public String getFeaturePoint(OrderDetailCheckParam checkParam) { - return String.valueOf(checkParam.getShopId()); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/SkuFeatureHandler.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/SkuFeatureHandler.java deleted file mode 100644 index 2121ab5dee26ea7a1c9ee4275f813997e3971c3f..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/handler/impl/feature/SkuFeatureHandler.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.bootx.sales.core.match.handler.impl.feature; - -import cn.bootx.sales.core.match.handler.func.FeatureHandler; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import org.springframework.stereotype.Component; - -/** -* sku特征点提取 -* @author xxm -* @date 2021/5/18 -*/ -@Component -public class SkuFeatureHandler implements FeatureHandler { - - @Override - public String getFeatureType() { - return "skuId"; - } - - @Override - public String getFeaturePoint(OrderDetailCheckParam checkParam) { - return String.valueOf(checkParam.getSkuId()); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/injector/MatchRuleInjector.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/injector/MatchRuleInjector.java deleted file mode 100644 index 47e5572d99b89ec07e0809cb6543c245f69794fb..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/injector/MatchRuleInjector.java +++ /dev/null @@ -1,51 +0,0 @@ -package cn.bootx.sales.core.match.injector; - -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.core.match.dao.MatchRuleManager; -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 匹配关联关系注入器 - * @author xxm - * @date 2020/12/3 - */ -@Slf4j -@Component -@RequiredArgsConstructor -public class MatchRuleInjector { - private final MatchRuleManager checkMatchManager; - - /** - * 注入活动匹配关系 - */ - public void injectionActivity(List activities) { - List strategyRegisterIds = activities.stream().map(Activity::getStrategyRegisterId).collect(Collectors.toList()); - // 匹配检查分组 - Map> checkMatchMapByActivity = checkMatchManager.findByStrategyRegisterIds(strategyRegisterIds).stream() - .collect(Collectors.groupingBy(MatchRuleConfig::getStrategyRegisterId)); - activities.forEach(activity -> - activity.setMatchRules(checkMatchMapByActivity.get(activity.getStrategyRegisterId())) - ); - } - - /** - * 注入优惠模板的匹配关系 - */ - public void injectionTemplate(List couponTemplates) { - List templateIds = couponTemplates.stream().map(CouponTemplate::getStrategyRegisterId).collect(Collectors.toList()); - // 匹配检查分组 - Map> checkMatchMapByTemplate = checkMatchManager.findByStrategyRegisterIds(templateIds).stream() - .collect(Collectors.groupingBy(MatchRuleConfig::getStrategyRegisterId)); - couponTemplates.forEach(couponTemplate -> - couponTemplate.setMatchRules(checkMatchMapByTemplate.get(couponTemplate.getStrategyRegisterId())) - ); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/service/FeaturePointService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/service/FeaturePointService.java deleted file mode 100644 index f2fa782a6fe740b5c46086ba00534734df023aaf..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/service/FeaturePointService.java +++ /dev/null @@ -1,50 +0,0 @@ -package cn.bootx.sales.core.match.service; - -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import cn.bootx.sales.core.match.handler.func.FeatureHandler; -import cn.bootx.sales.dto.match.FeaturePoints; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 特征点输出 - * @author xxm - * @date 2021/5/18 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class FeaturePointService { - private final List featureHandlers; - - /** - * 提取特征点 - */ - public List extractFeaturePoints(List detailCheckParams){ - return featureHandlers.stream() - .map(featureExtract -> featureExtract.extract(detailCheckParams)) - .distinct() - .collect(Collectors.toList()); - } - - /** - * 特征点匹配, 匹配成功返回对应的活动 - */ - public List matchAndGetActivity(OrderDetailCheckParam checkParam, List activityMatch, Map activityBySrMap) { - return activityMatch.stream() - .filter(matchRuleConfig -> featureHandlers.stream() - .anyMatch(featureHandler -> featureHandler.match(checkParam,matchRuleConfig))) - .map(MatchRuleConfig::getStrategyRegisterId) - .distinct() - .map(activityBySrMap::get) - .collect(Collectors.toList()); - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/service/MatchRuleService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/service/MatchRuleService.java deleted file mode 100644 index 9bd7c568ee88a9aed921a4c29f034fa0b34c4779..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/match/service/MatchRuleService.java +++ /dev/null @@ -1,79 +0,0 @@ -package cn.bootx.sales.core.match.service; - -import cn.bootx.sales.core.calculate.cache.OrderCache; -import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -import cn.bootx.sales.core.check.convert.OrderConvert; -import cn.bootx.sales.core.match.dao.MatchRuleManager; -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import cn.bootx.sales.core.match.handler.func.FeatureHandler; -import cn.bootx.sales.dto.match.FeaturePoints; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.List; - -/** - * 匹配规则关系管理 - * @author xxm - * @date 2021/5/8 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class MatchRuleService { - - private final MatchRuleManager matchRuleManager; - private final List featureHandlers; - - /** - * 查询全局适用优惠活动 - */ - public List findGlobalActivityMatch(){ - return matchRuleManager.findGlobalActivityMatch(); - } - - /** - * 查询适用的的优惠活动 - */ - public List findByActivityMatch(List featurePoints) { - return matchRuleManager.findByActivityMatch(featurePoints); - } - - /** - * 订单明细是否有匹配规则匹配到 - */ - public boolean detailMatch(OrderDetailCheckParam detailCheckParam, List matchRules){ - for (MatchRuleConfig matchRule : matchRules) { - // 任意配置匹配成功 - if (featureHandlers.stream().anyMatch(featureHandler -> featureHandler.match(detailCheckParam,matchRule))){ - return true; - } - } - return false; - } - - /** - * 订单明细是否有匹配规则匹配到 - */ - public boolean detailMatch(OrderDetailCache orderDetailCache, List matchRules){ - return this.detailMatch(OrderConvert.INSTANCE.convert(orderDetailCache),matchRules); - } - - /** - * 多个订单明细是否有匹配规则匹配到 - */ - public boolean orderMatch(OrderCheckParam orderCheckParam, List matchRules){ - List list = orderCheckParam.getDetails(); - return list.stream().anyMatch(detailCheckParam -> this.detailMatch(detailCheckParam,matchRules)); - } - - /** - * 多个订单明细是否有匹配规则匹配到 - */ - public boolean orderMatch(OrderCache orderCache, List matchRules){ - return this.orderMatch(OrderConvert.INSTANCE.convert(orderCache),matchRules); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/recommend/AutoCalculateService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/recommend/AutoCalculateService.java deleted file mode 100644 index 54d25d3e55227acef51bc26d5f8544bc9cd45aa8..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/recommend/AutoCalculateService.java +++ /dev/null @@ -1,122 +0,0 @@ -package cn.bootx.sales.core.recommend;//package cn.bootx.sales.core.recommend; -// -//import cn.bootx.common.util.BigDecimalUtil; -//import cn.bootx.sales.core.activity.entity.Activity; -//import cn.bootx.sales.core.calculate.cache.CalculateCache; -//import cn.bootx.sales.core.calculate.cache.OrderCache; -//import cn.bootx.sales.core.calculate.cache.OrderDetailCache; -//import cn.bootx.sales.core.calculate.factory.CalculateFactory; -//import cn.bootx.sales.core.calculate.service.CalculateService; -//import cn.bootx.sales.core.calculate.service.OrderCalculateService; -//import cn.bootx.sales.core.match.injector.MatchRuleInjector; -//import cn.bootx.sales.core.check.service.activity.ActivityCalculateCheckService; -//import cn.bootx.sales.dto.activity.ActivityDto; -//import cn.bootx.sales.dto.order.OrderPreviewResult; -//import cn.bootx.sales.param.order.OrderCheckParam; -//import cn.bootx.sales.param.order.OrderDetailCheckParam; -//import lombok.RequiredArgsConstructor; -//import lombok.extern.slf4j.Slf4j; -//import org.springframework.stereotype.Service; -// -//import java.math.BigDecimal; -//import java.util.List; -//import java.util.Map; -//import java.util.stream.Collectors; -// -///** -// * 订单优惠券和策略匹配和计算(自动应用策略,实验性质) -// * @author xxm -// * @date 2020/10/25 -// */ -//@Slf4j -//@Service -//@RequiredArgsConstructor -//public class AutoCalculateService { -// -// private final MatchRuleInjector matchRuleInjector; -// private final CalculateService calculateService; -// private final ActivityCalculateCheckService activityCalculateCheckService; -// private final OrderCalculateService orderCalculateService; -// private final CalculateFactory orderFactory; -// -// -// /** -// * 自动匹配策略并计算价格 -// */ -// public OrderPreviewResult previewOrderPriceByAuto(OrderCheckParam orderParam){ -// List details = orderParam.getDetails(); -// -// List skuIds = details.stream().map(OrderDetailCheckParam::getSkuId).collect(Collectors.toList()); -// List goodsIds = details.stream().map(OrderDetailCheckParam::getGoodsId).collect(Collectors.toList()); -// List categoryIds = details.stream().map(OrderDetailCheckParam::getCategoryId).collect(Collectors.toList()); -// List shopIds = details.stream().map(OrderDetailCheckParam::getShopId).collect(Collectors.toList()); -// -// // 构建订单 -// CalculateFactory.OrderAndBuffer orderAndBuffer = orderFactory.buildOrderDto(orderParam); -// OrderCache orderDto = orderAndBuffer.getOrderCache(); -// CalculateCache calculateCache = orderAndBuffer.getCalculateCache(); -// -// // 匹配策略 -// this.chooseActivityByAuto(orderDto,calculateCache); -// -// // 计算价格 -// return orderCalculateService.calculateOrderPrice(orderDto,calculateCache); -// -// } -// -// /** -// * 自动匹配最优策略 -// */ -// private void chooseActivityByAuto(OrderCache orderDto, CalculateCache calculateCache) { -// List details = orderDto.getDetails(); -// // 订单遍历 -// for (OrderDetailCache detail : details) { -// List activities = detail.getActivities(); -// // 求每种策略类型中的最高优惠,相同StrategyId的策略注册只可以使用一个 -// Map> matchType = activities.stream() -// .collect(Collectors.groupingBy(Activity::getStrategyId)); -// -// List baseList = matchType.values().stream() -// .map(list -> this.getMutex(detail,list,calculateCache)) -// .collect(Collectors.toList()); -// -//// // 分策略类型处理完毕后,处理互斥组冲突策略,保留最优 -//// Map> groupMap = baseList.stream() -//// .collect(Collectors.groupingBy(ActivityDto::getGroupId)); -//// -//// // 汇总 (先添加非互斥) -//// List collectActivities = baseList.stream() -//// .filter(o->Objects.isNull(o.getGroupId())) -//// .collect(Collectors.toList()); -//// // 互斥选中最优并添加 -//// List topActivities = groupMap.values() -//// .stream() -//// .map(list -> this.getMutex(detail,list, calculateCache)) -//// .collect(Collectors.toList()); -//// collectActivities.addAll(topActivities); -//// -//// detail.setActivities(collectActivities) -//// .setActivityIds(collectActivities.stream() -//// .map(ActivityDto::getId) -//// .collect(Collectors.toList())); -// } -// } -// -// /** -// * 互斥组选明细价格优惠额度最高的 -// */ -// private ActivityDto getMutex(OrderDetailCache detail, List list, CalculateCache calculateCache){ -// // 记录最高的优惠 -// ActivityDto activityDto = null; -// BigDecimal max = BigDecimal.ZERO; -// -// for (ActivityDto o : list) { -// BigDecimal amountChange = calculateService.calculateSingle(o, detail,calculateCache); -// if (BigDecimalUtil.compareTo(amountChange,max)>-1){ -// activityDto = o; -// } -// } -// return activityDto; -// } -// -//} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/recommend/OrderFindActivityService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/recommend/OrderFindActivityService.java deleted file mode 100644 index 960b2f988209713e4c73be1dcb0dfeed2c6bced8..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/recommend/OrderFindActivityService.java +++ /dev/null @@ -1,78 +0,0 @@ -package cn.bootx.sales.core.recommend; - -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.core.activity.dao.ActivityManager; -import cn.bootx.sales.core.activity.entity.Activity; -import cn.bootx.sales.core.check.injector.CheckRuleInjector; -import cn.bootx.sales.core.check.service.activity.ActivitySelectCheckService; -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import cn.bootx.sales.core.match.service.FeaturePointService; -import cn.bootx.sales.core.match.service.MatchRuleService; -import cn.bootx.sales.dto.match.FeaturePoints; -import cn.bootx.sales.dto.order.GoodsActivityResult; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.bootx.sales.param.order.OrderDetailCheckParam; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** - * 优惠活动匹配 - * @author xxm - * @date 2020/12/4 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderFindActivityService { - private final CheckRuleInjector checkRuleInjector; - private final ActivityManager activityManager; - - private final MatchRuleService matchRuleService; - private final ActivitySelectCheckService activitySelectCheckService; - private final FeaturePointService featureExtractService; - - /** - * 传入订单,返回所有可用的活动 - */ - public List findActivity(OrderCheckParam orderParam){ - // 提取特征点 - List featurePoints = featureExtractService.extractFeaturePoints(orderParam.getDetails()); - - // 获取订单初步匹配的活动 (全局适用和特征点匹配) - List globalActivityMatch = matchRuleService.findGlobalActivityMatch(); - List matchActivityMatch = matchRuleService.findByActivityMatch(featurePoints); - List allActivityMatch = new ArrayList<>(globalActivityMatch); - allActivityMatch.addAll(matchActivityMatch); - - // 查询出对应的活动 - List srIds = allActivityMatch.stream() - .map(MatchRuleConfig::getStrategyRegisterId) - .distinct() - .collect(Collectors.toList()); - List activities = activityManager.findByStrategyRegister(srIds); - Map activityBySrMap = activities.stream() - .collect(Collectors.toMap(Activity::getStrategyRegisterId, Function.identity())); - // 注入检查规则 - checkRuleInjector.injectionActivity(activities, CheckRuleCode.RULE_TYPE_ACTIVITY_CHECK); - - // 组装商品适用活动 - List activityResults = new ArrayList<>(); - for (OrderDetailCheckParam detail : orderParam.getDetails()) { - // 先根据特征点匹配 - List matchActivities = featureExtractService.matchAndGetActivity(detail, allActivityMatch, activityBySrMap); - // 然后根据检查策略过滤 - List list = activitySelectCheckService.activitiesCheck(detail, orderParam, matchActivities); - GoodsActivityResult goodsActivityResult = new GoodsActivityResult() - .setSkuId(detail.getSkuId()) - .setActivities(list.stream().map(Activity::simple).collect(Collectors.toList())); - activityResults.add(goodsActivityResult); - } - return activityResults; - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/recommend/OrderFindCouponService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/recommend/OrderFindCouponService.java deleted file mode 100644 index cf7339b0f2052cb89d9883b8810bfa085a2b524e..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/recommend/OrderFindCouponService.java +++ /dev/null @@ -1,126 +0,0 @@ -package cn.bootx.sales.core.recommend; - -import cn.bootx.sales.code.CheckRuleCode; -import cn.bootx.sales.code.CouponStatusCode; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.check.handler.coupon.CouponCheckHandler; -import cn.bootx.sales.core.check.injector.CheckRuleInjector; -import cn.bootx.sales.core.check.rule.CheckRuleHandlerAdapter; -import cn.bootx.sales.core.coupon.dao.CouponManager; -import cn.bootx.sales.core.coupon.dao.CouponTemplateManager; -import cn.bootx.sales.core.coupon.entity.Coupon; -import cn.bootx.sales.core.coupon.entity.CouponTemplate; -import cn.bootx.sales.core.match.injector.MatchRuleInjector; -import cn.bootx.sales.core.match.service.MatchRuleService; -import cn.bootx.sales.dto.check.CheckRuleResult; -import cn.bootx.sales.dto.coupon.CouponDto; -import cn.bootx.sales.param.order.OrderCheckParam; -import cn.hutool.core.collection.CollUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 优惠券匹配 - * @author xxm - * @date 2020/12/3 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class OrderFindCouponService { - - private final CheckRuleHandlerAdapter checkRuleHandlerAdapter; - private final CheckRuleInjector checkRuleInjector; - private final MatchRuleInjector matchRuleInjector; - private final CouponCheckHandler couponCheckHandler; - - private final CouponManager couponManager; - private final CouponTemplateManager couponTemplateManager; - private final MatchRuleService matchRuleService; - - - /** - * 获取订单可用的优惠券 - */ - public List findCoupon(OrderCheckParam orderParam){ - // 获取到用户可用的优惠券 - Long userId = orderParam.getUserId(); - List coupons = couponManager.findByUserAndStatus(userId, CouponStatusCode.STATUS_NORMAL) - .stream() - .filter(couponCheckHandler::canUseCoupon) - .collect(Collectors.toList()); - - // 获取对应的模板 - List couponTemplateIds = coupons.stream() - .map(Coupon::getTemplateId) - .distinct() - .collect(Collectors.toList()); - List couponTemplates = couponTemplateManager.findAllByIds(couponTemplateIds); - // 注入匹配规则 - matchRuleInjector.injectionTemplate(couponTemplates); - - // 初步筛选出可用的优惠卷策略 - List templates = couponTemplates.stream() - // 匹配订单适用的优惠券模板 - .filter(template -> matchRuleService.orderMatch(orderParam,template.getMatchRules())) - .collect(Collectors.toList()); - - // 根据初步筛选结果进行下一步的规则检查 - List templateIds = this.checkByRule(templates,orderParam); - - List collect = coupons.stream() - .map(Coupon::toDto) - .collect(Collectors.toList()); - collect.stream() - .filter(coupon -> !templateIds.contains(coupon.getTemplateId())) - // 标示出来不可用 - .forEach(couponDto -> couponDto.setCanUse(3)); - return collect; - } - - /** - * 根据已配置规则进行下一步的筛选 - */ - public List checkByRule(List templates, OrderCheckParam orderParam) { - // 填充检查规则 - checkRuleInjector.injectionTemplate(templates, CheckRuleCode.RULE_TYPE_COUPON_CHECK); - List templateIds = new ArrayList<>(); - - /* 根据配置规则进行检查 */ - for (CouponTemplate template : templates) { - List selectCheckRule = template.getCheckRules(); - - // 无检查配置默认添加到列表 - if (CollUtil.isEmpty(selectCheckRule)){ - templateIds.add(template.getId()); - } - // 遍历的配置规则集, 选择出通过检查的 - if (this.checkByRule(template,orderParam)){ - templateIds.add(template.getId()); - } - } - return templateIds; - } - - /** - * 根据已配置规则进行判断是否通过 - */ - public boolean checkByRule(CouponTemplate template, OrderCheckParam orderParam){ - List checkRules = template.getCheckRules(); - if (CollUtil.isEmpty(checkRules)){ - return true; - } - for (CheckRuleConfig checkRule : checkRules) { - CheckRuleResult checkRuleResult = checkRuleHandlerAdapter.couponSelectCheck(template, checkRule, orderParam); - if (!checkRuleResult.isPass()){ - return false; - } - } - return true; - } -} \ No newline at end of file diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/convert/StrategyConvert.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/convert/StrategyConvert.java deleted file mode 100644 index 3c9916179ae79c978137e8bc301b90f345e13064..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/convert/StrategyConvert.java +++ /dev/null @@ -1,42 +0,0 @@ -package cn.bootx.sales.core.strategy.convert; - -import cn.bootx.sales.core.strategy.entity.Strategy; -import cn.bootx.sales.core.strategy.entity.StrategyConfig; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import cn.bootx.sales.dto.strategy.StrategyConfigDto; -import cn.bootx.sales.dto.strategy.StrategyDto; -import cn.bootx.sales.dto.strategy.StrategyRegisterDto; -import cn.bootx.sales.param.strategy.StrategyConfigParam; -import cn.bootx.sales.param.strategy.StrategyParam; -import cn.bootx.sales.param.strategy.StrategyRegisterParam; -import org.mapstruct.Mapper; -import org.mapstruct.Mappings; -import org.mapstruct.factory.Mappers; - -/** -* 策略相关转换类 -* @author xxm -* @date 2021/8/11 -*/ -@Mapper -public interface StrategyConvert { - StrategyConvert CONVERT = Mappers.getMapper(StrategyConvert.class); - - StrategyDto convert(Strategy in); - - Strategy convert(StrategyParam in); - - Strategy convert(StrategyDto in); - - StrategyConfig convert(StrategyConfigDto in); - - StrategyConfig convert(StrategyConfigParam in); - - StrategyConfigDto convert(StrategyConfig in); - - StrategyRegister convert(StrategyRegisterParam in); - - StrategyRegister convert(StrategyRegisterDto in); - - StrategyRegisterDto convert(StrategyRegister in); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigManager.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigManager.java deleted file mode 100644 index 02a4a6520cc892c6e5ca864285aadccdadd7a059..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigManager.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bootx.sales.core.strategy.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.sales.core.strategy.entity.StrategyConfig; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Slf4j -@Repository -@RequiredArgsConstructor -public class StrategyConfigManager extends BaseManager { - - public List findByStrategyId(Long strategyId){ - return findAllByField(StrategyConfig::getStrategyId,strategyId); - } - - public void deleteByStrategyId(Long strategyId) { - deleteByField(StrategyConfig::getStrategyId,strategyId); - } - - public List findByType(Integer type) { - return findAllByField(StrategyConfig::getType,type); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigMapper.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigMapper.java deleted file mode 100644 index aa0757d2db104b771287b5c3996e556b35c81d55..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.bootx.sales.core.strategy.dao; - -import cn.bootx.sales.core.strategy.entity.StrategyConfig; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface StrategyConfigMapper extends BaseMapper { -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigValueManager.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigValueManager.java deleted file mode 100644 index 38ea5b78df3fa155194eb754375f862295a7f6ba..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigValueManager.java +++ /dev/null @@ -1,31 +0,0 @@ -package cn.bootx.sales.core.strategy.dao; - -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.sales.core.strategy.entity.StrategyConfigValue; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; - -import java.util.List; - -@Slf4j -@Repository -@RequiredArgsConstructor -public class StrategyConfigValueManager extends BaseManager { - - /** - * 根据注册ids获取配置参数 - */ - public List findAllStrategyRegisterIds(List ids) { - return findAllByFields(StrategyConfigValue::getStrategyRegisterId,ids); - } - - public void deleteByStrategyRegisterId(Long id) { - deleteByField(StrategyConfigValue::getStrategyRegisterId,id); - } - - public void deleteByStrategyId(Long strategyId) { - deleteByField(StrategyConfigValue::getStrategyId,strategyId); - - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigValueMapper.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigValueMapper.java deleted file mode 100644 index 1acfa2114464813d3e7d5fa931e949db1a989fec..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyConfigValueMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.bootx.sales.core.strategy.dao; - -import cn.bootx.sales.core.strategy.entity.StrategyConfigValue; -import com.baomidou.mybatisplus.core.mapper.BaseMapper; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface StrategyConfigValueMapper extends BaseMapper { -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyManager.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyManager.java deleted file mode 100644 index 4df37c0353c7e0ec41a1a07415819c7f2f876426..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyManager.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.bootx.sales.core.strategy.dao; - -import cn.bootx.common.mybatisplus.base.MpIdEntity; -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.sales.core.strategy.entity.Strategy; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; - -/** -* 策略 -* @author xxm -* @date 2020/10/11 -*/ -@Slf4j -@Repository -@RequiredArgsConstructor -public class StrategyManager extends BaseManager { - - - public boolean existsByCode(String code){ - return existedByField(Strategy::getCode,code); - } - - public boolean existsByCode(String code,Long id){ - return existedByField(Strategy::getCode,code,id); - } - - public boolean existsById(Long id) { - return existedByField(MpIdEntity::getId,id); - } - - public Long countByStrategyId(Long id) { - return countByField(MpIdEntity::getId,id); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyRegisterManager.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyRegisterManager.java deleted file mode 100644 index 3d25d32165ebdda59dd07ae34b0e2b887368645d..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyRegisterManager.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.bootx.sales.core.strategy.dao; - -import cn.bootx.common.mybatisplus.base.MpIdEntity; -import cn.bootx.common.mybatisplus.impl.BaseManager; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Repository; - -@Slf4j -@Repository -@RequiredArgsConstructor -public class StrategyRegisterManager extends BaseManager { - - /** - * 策略注册是否存在 - */ - public boolean existsById(Long id){ - return existedByField(MpIdEntity::getId,id); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/Strategy.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/Strategy.java deleted file mode 100644 index db62f0e310347d89b9fcf0135afb2e0142582833..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/Strategy.java +++ /dev/null @@ -1,62 +0,0 @@ -package cn.bootx.sales.core.strategy.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.sales.code.StrategyCode; -import cn.bootx.sales.core.strategy.convert.StrategyConvert; -import cn.bootx.sales.dto.strategy.StrategyDto; -import cn.bootx.sales.param.strategy.StrategyParam; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 策略定义 -* @author xxm -* @date 2020/10/11 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("sales_strategy") -public class Strategy extends MpBaseEntity implements EntityBaseFunction { - - /** 策略名称 */ - private String name; - - /** 唯一编码 */ - private String code; - - /** 描述 */ - private String description; - - /** - * 目标类型 - * @see StrategyCode#TARGET_TYPE_CALCULATE - */ - private int targetType; - - /** - * 应用的引擎类型 (只支持java) - * @see StrategyCode#ENGINE_JAVASCRIPT - */ - private int engineType; - - /** 策略计算脚本 (废弃) */ - @Deprecated - private String ruleScript; - - /** 可用状态 */ - private Integer state; - - public static Strategy init(StrategyParam in) { - return StrategyConvert.CONVERT.convert(in); - } - - @Override - public StrategyDto toDto() { - return StrategyConvert.CONVERT.convert(this); - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/StrategyConfig.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/StrategyConfig.java deleted file mode 100644 index 51c61a649a86c60a5c2f6332b307d34902a9b697..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/StrategyConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -package cn.bootx.sales.core.strategy.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.sales.core.strategy.convert.StrategyConvert; -import cn.bootx.sales.dto.strategy.StrategyConfigDto; -import cn.bootx.sales.param.strategy.StrategyConfigParam; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - - -/** -* 策略配置 -* @author xxm -* @date 2020/10/11 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("sales_strategy_config") -public class StrategyConfig extends MpBaseEntity implements EntityBaseFunction { - - /** 策略id */ - private Long strategyId; - - /** 参数名称 */ - @TableField("`key`") - private String key; - - /** 名称 */ - private String name; - - /** 类型 */ - private String type; - - /** 描述 */ - private String description; - - public static StrategyConfig init(StrategyConfigDto in) { - return StrategyConvert.CONVERT.convert(in); - } - - public static StrategyConfig init(StrategyConfigParam in) { - return StrategyConvert.CONVERT.convert(in); - } - - @Override - public StrategyConfigDto toDto() { - return StrategyConvert.CONVERT.convert(this); - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/StrategyConfigValue.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/StrategyConfigValue.java deleted file mode 100644 index c06ae479b005324c29071e79744701b7174f463c..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/StrategyConfigValue.java +++ /dev/null @@ -1,61 +0,0 @@ -package cn.bootx.sales.core.strategy.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.sales.dto.strategy.StrategyConfigValueDto; -import cn.bootx.sales.param.strategy.StrategyConfigValueParam; -import com.baomidou.mybatisplus.annotation.TableField; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.springframework.beans.BeanUtils; - -/** -* 策略配置值 -* @author xxm -* @date 2020/10/11 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("sales_strategy_config_value") -public class StrategyConfigValue extends MpBaseEntity implements EntityBaseFunction { - - /** 策略id */ - private Long strategyId; - - /** 策略注册id */ - private Long strategyRegisterId; - - /** 策略配置 */ - private Long strategyConfigId; - - /** 策略key */ - @TableField("`key`") - private String key; - - /** 值 */ - private String value; - - - public static StrategyConfigValue init(StrategyConfigValueDto param) { - StrategyConfigValue entity = new StrategyConfigValue(); - BeanUtils.copyProperties(param, entity); - return entity; - } - - public static StrategyConfigValue init(StrategyConfigValueParam param) { - StrategyConfigValue entity = new StrategyConfigValue(); - BeanUtils.copyProperties(param, entity); - return entity; - } - - @Override - public StrategyConfigValueDto toDto() { - StrategyConfigValueDto dto = new StrategyConfigValueDto(); - BeanUtils.copyProperties(this, dto); - return dto; - } - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/StrategyRegister.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/StrategyRegister.java deleted file mode 100644 index 8a3aa9bef6216b5abc8da861282e95319554a194..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/entity/StrategyRegister.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.bootx.sales.core.strategy.entity; - -import cn.bootx.common.core.function.EntityBaseFunction; -import cn.bootx.common.mybatisplus.base.MpBaseEntity; -import cn.bootx.sales.code.StrategyRegisterCode; -import cn.bootx.sales.core.strategy.convert.StrategyConvert; -import cn.bootx.sales.dto.strategy.StrategyRegisterDto; -import cn.bootx.sales.param.strategy.StrategyRegisterParam; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** -* 策略注册 -* @author xxm -* @date 2020/10/11 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@TableName("sales_strategy_register") -public class StrategyRegister extends MpBaseEntity implements EntityBaseFunction { - - /** 策略id */ - private Long strategyId; - - /** 名称 */ - private String name; - - /** 描述 */ - private String description; - - /** - * 策略类型(普通/优惠券) - * @see StrategyRegisterCode - */ - private Integer strategyType; - - public static StrategyRegister init(StrategyRegisterDto in) { - return StrategyConvert.CONVERT.convert(in); - } - - public static StrategyRegister init(StrategyRegisterParam in) { - return StrategyConvert.CONVERT.convert(in); - } - - @Override - public StrategyRegisterDto toDto() { - return StrategyConvert.CONVERT.convert(this); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/service/StrategyRegisterService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/service/StrategyRegisterService.java deleted file mode 100644 index ca3a6a60a1b3081b9455caec5f3b8d2abbe120fe..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/service/StrategyRegisterService.java +++ /dev/null @@ -1,147 +0,0 @@ -package cn.bootx.sales.core.strategy.service; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.sales.core.check.config.dao.CheckRuleManager; -import cn.bootx.sales.core.check.config.entity.CheckRuleConfig; -import cn.bootx.sales.core.match.dao.MatchRuleManager; -import cn.bootx.sales.core.match.entity.MatchRuleConfig; -import cn.bootx.sales.core.strategy.dao.*; -import cn.bootx.sales.core.strategy.entity.StrategyConfig; -import cn.bootx.sales.core.strategy.entity.StrategyConfigValue; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; -import cn.bootx.sales.dto.strategy.StrategyRegisterDto; -import cn.bootx.sales.exception.strategy.StrategyNotExistException; -import cn.bootx.sales.param.strategy.CheckRuleParam; -import cn.bootx.sales.param.strategy.MatchRuleParam; -import cn.bootx.sales.param.strategy.StrategyConfigValueParam; -import cn.bootx.sales.param.strategy.StrategyRegisterParam; -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.collection.CollectionUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 策略注册 - * @author xxm - * @date 2020/10/11 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class StrategyRegisterService { - private final StrategyRegisterManager strategyRegisterManager; - - private final StrategyManager strategyManager; - private final StrategyConfigValueManager strategyConfigValueManager; - private final StrategyConfigManager strategyConfigManager; - - private final CheckRuleManager checkRuleManager; - private final MatchRuleManager matchRuleManager; - - /** - * 新增策略注册 - */ - @Transactional(rollbackFor = Exception.class) - public StrategyRegisterDto add(StrategyRegisterParam param){ - StrategyRegister strategyRegister = this.build(param); - strategyRegister = strategyRegisterManager.save(strategyRegister); - - // 保存匹配规则 - this.addCheckMatch(param.getMatchRules(),strategyRegister); - // 保存检查规则 - this.addCheckRules(param.getCheckRules(),strategyRegister); - // 保存策略参数值 - this.addConfigValue(strategyRegister.getStrategyId(),strategyRegister.getId(),param.getConfigValues()); - return strategyRegister.toDto(); - } - - - /** - * 建立策略注册 - */ - public StrategyRegister build(StrategyRegisterParam param){ - StrategyRegister strategyRegister = StrategyRegister.init(param); - boolean strategyExist = strategyManager.existsById(param.getStrategyId()); - if (!strategyExist){ - throw new StrategyNotExistException(); - } - return strategyRegister; - } - - /** - * 添加匹配规则 - */ - private void addCheckMatch(List matchRules, StrategyRegister strategyRegister) { - List checkMatches = matchRules - .stream() - .map(rule -> MatchRuleConfig.init(rule) - .setRegisterType(strategyRegister.getStrategyType()) - .setStrategyRegisterId(strategyRegister.getId()) - ).collect(Collectors.toList()); - matchRuleManager.saveAll(checkMatches); - } - - /** - * 添加检查规则 - */ - private void addCheckRules(List checkRules, StrategyRegister strategyRegister) { - if (CollUtil.isEmpty(checkRules)){ - return; - } - List rules = checkRules.stream() - .map(rule -> CheckRuleConfig.init(rule) - .setRegisterType(strategyRegister.getStrategyType()) - .setStrategyRegisterId(strategyRegister.getId())) - .collect(Collectors.toList()); - checkRuleManager.saveAll(rules); - } - - /** - * 策略配置处理 - */ - private void addConfigValue(Long strategyId, Long strategyRegisterId, List configValues) { - if (!CollectionUtil.isEmpty(configValues)) { - List strategyConfigValues = new ArrayList<>(); - configValues.forEach(configValue -> { - StrategyConfig strategyConfig = strategyConfigManager.findById(configValue.getStrategyConfigId()) - .orElseThrow(() -> new BizException("策略配置不存在")); - StrategyConfigValue strategyConfigValue = StrategyConfigValue.init(configValue) - .setKey(strategyConfig.getKey()) - .setStrategyRegisterId(strategyRegisterId) - .setStrategyId(strategyId); - - strategyConfigValues.add(strategyConfigValue); - }); - strategyConfigValueManager.saveAll(strategyConfigValues); - } - } - - /** - * 查询全部策略注册信息 - */ - public List findAll(){ - List all = strategyRegisterManager.findAll(); - return all.stream() - .map(StrategyRegister::toDto) - .collect(Collectors.toList()); - } - - /** - * 删除策略注册 - */ - @Transactional(rollbackFor = Exception.class) - public void deleteById(Long id){ - if (strategyRegisterManager.existsById(id)){ - // 删除策略 - strategyManager.deleteById(id); - // 删除策略配置信息 - strategyConfigValueManager.deleteByStrategyRegisterId(id); - } - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/service/StrategyService.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/service/StrategyService.java deleted file mode 100644 index e9af3d780d7bfd0ad353e5f5903373995e3997cd..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/service/StrategyService.java +++ /dev/null @@ -1,169 +0,0 @@ -package cn.bootx.sales.core.strategy.service; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.common.core.util.ResultConvertUtil; -import cn.bootx.sales.core.strategy.dao.StrategyConfigManager; -import cn.bootx.sales.core.strategy.dao.StrategyConfigValueManager; -import cn.bootx.sales.core.strategy.dao.StrategyManager; -import cn.bootx.sales.core.strategy.entity.Strategy; -import cn.bootx.sales.core.strategy.entity.StrategyConfig; -import cn.bootx.sales.dto.strategy.StrategyConfigDto; -import cn.bootx.sales.dto.strategy.StrategyDto; -import cn.bootx.sales.exception.strategy.StrategyAlreadyUsedException; -import cn.bootx.sales.exception.strategy.StrategyNotExistException; -import cn.bootx.sales.param.strategy.StrategyConfigParam; -import cn.bootx.sales.param.strategy.StrategyParam; -import cn.hutool.core.collection.CollectionUtil; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.dao.EmptyResultDataAccessException; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -/** - * 策略 - * @author xxm - * @date 2020/10/11 - */ -@Slf4j -@Service -@RequiredArgsConstructor -public class StrategyService { - - private final StrategyManager strategyManager; - private final StrategyConfigManager strategyConfigManager; - private final StrategyConfigValueManager strategyConfigValueManager; - - /** - * 添加策略及其配置项 - */ - public void add(StrategyParam param){ - Strategy strategy = Strategy.init(param); - // 检查code是否重复 - if (strategyManager.existsByCode(param.getCode())){ - throw new BizException("策略code重复"); - } - Strategy save = strategyManager.save(strategy); - this.strategyConfigsPersistence(save.getId(), param.getConfigParams()); - } - - /** - * 更新策略及其配置项 如果已被注册则不允许更改 配置项及脚本程序 - */ - @Transactional(rollbackFor = Exception.class) - public StrategyDto update(StrategyParam strategyParam){ - - Long strategyId = strategyParam.getId(); - - if (strategyManager.countByStrategyId(strategyId) == 0){ - Strategy strategy = Strategy.init(strategyParam); - //删除原有配置项 - strategyManager.deleteById(strategyId); - //如果存在配置项 则持久化配置项 - this.strategyConfigsPersistence(strategyId, strategyParam.getConfigParams()); - - Strategy save = strategyManager.save(strategy); - - return save.toDto(); - } else { - throw new StrategyAlreadyUsedException(); - } - } - - /** - * 查询所有的策略 - */ - public List findAll() { - List strategyList = strategyManager.findAll(); - if (CollectionUtil.isEmpty(strategyList)) { - return new ArrayList<>(); - } - return strategyList.stream() - .map(strategy -> { - StrategyDto dto = strategy.toDto(); - dto.setRuleScript(null); - return dto; - }).collect(Collectors.toList()); - } - - /** - * 策略配置持久性 - */ - private void strategyConfigsPersistence(Long strategyId, List configParams){ - if (!CollectionUtil.isEmpty(configParams)){ - List strategyConfigs = new ArrayList<>(); - configParams.forEach(strategyConfigParam -> { - StrategyConfig strategyConfig = StrategyConfig.init(strategyConfigParam); - strategyConfig.setStrategyId(strategyId); - strategyConfigs.add(strategyConfig); - }); - - strategyConfigManager.saveAll(strategyConfigs); - } - } - /** - * 删除策略及其配置项 - */ - @Transactional(rollbackFor = Exception.class) - public void deleteById(Long strategyId){ - try { - strategyManager.deleteById(strategyId); - //删除原有配置项 - strategyConfigManager.deleteByStrategyId(strategyId); - - // 策略注册 - strategyManager.deleteById(strategyId); - - // 策略脚本配置项 - strategyConfigValueManager.deleteByStrategyId(strategyId); - }catch (EmptyResultDataAccessException e) { - log.info("策略不存在,策略ID为:{}", strategyId); - throw new StrategyNotExistException(); - } - } - - /** - * 获取策略及其配置项 - */ - public StrategyDto findById(Long strategyId){ - StrategyDto strategy = strategyManager.findById(strategyId) - .map(Strategy::toDto) - .orElseThrow(StrategyNotExistException::new); - - List strategyConfigs = strategyConfigManager.findByStrategyId(strategyId); - List strategyConfigDtoList = strategyConfigs.stream() - .map(StrategyConfig::toDto) - .collect(Collectors.toList()); - - strategy.setConfigParams(strategyConfigDtoList); - - // 是否被注册使用 - if (strategyManager.countByStrategyId(strategyId) == 0){ - strategy.setUpdatable(true); - } - return strategy; - } - - /** - * 通过策略ID获取配置 - */ - public List findConfigsByStrategyId(Long strategyId) { - List strategyConfigs = strategyConfigManager.findByStrategyId(strategyId); - List strategyConfigDtoList = new ArrayList<>(); - if(!CollectionUtil.isEmpty(strategyConfigs)) { - strategyConfigs.forEach(strategyConfig -> strategyConfigDtoList.add(strategyConfig.toDto())); - } - return strategyConfigDtoList; - } - - /** - * 根据类型查询 - */ - public List findByType(Integer type) { - return ResultConvertUtil.dtoListConvert(strategyConfigManager.findByType(type)); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/activity/ActivityDto.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/activity/ActivityDto.java deleted file mode 100644 index ce56eb9f6e5afe90bb7b4deaf4bbad501c303022..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/activity/ActivityDto.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bootx.sales.dto.activity; - -import cn.bootx.sales.dto.strategy.StrategyRegisterDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; - -import java.time.LocalDateTime; - -/** -* @author xxm -* @date 2021/5/7 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Schema(title = "活动") -public class ActivityDto extends StrategyRegisterDto { - - /** 有效开始时间 */ - private LocalDateTime startTime; - - /** 有效结束时间 */ - private LocalDateTime endTime; - - /** 活动互斥 */ - private String activityMutual; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/activity/SimpleActivity.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/activity/SimpleActivity.java deleted file mode 100644 index 2f1663444caa91bdb8ecb5512b0a75f876c3d6b7..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/activity/SimpleActivity.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.bootx.sales.dto.activity; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -/** -* @author xxm -* @date 2021/5/19 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "活动简单展示") -public class SimpleActivity { - - @Schema(description= "主键") - private Long id; - - @Schema(description= "名称") - private String name; - - @Schema(description= "描述") - private String description; - - @Schema(description= "活动互斥") - private String activityMutual; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/check/CheckRuleDto.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/check/CheckRuleDto.java deleted file mode 100644 index 68805771c97eea67b5828b6c037b10fb3d2bfb54..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/check/CheckRuleDto.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.bootx.sales.dto.check; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2020/12/1 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "优惠券检查规则") -public class CheckRuleDto implements Serializable { - private static final long serialVersionUID = 664176956159699317L; - - private Long id; - - @Schema(description= "策略注册ID") - private Long registerId; - - @Schema(description= "关联策略注册类型 活动/优惠券") - private int registerType; - - @Schema(description= "优先级") - private int priority; - - @Schema(description= "规则名称") - private String name; - - @Schema(description= "规则code") - private String code; - - @Schema(description= "类型(引擎)") - private int engineType; - - @Schema(description= "策略id") - private Long strategyId; - - @Schema(description= "策略脚本") - private String ruleScript; - - @Schema(description= "附加对象 json") - private String addition; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/check/CheckRuleResult.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/check/CheckRuleResult.java deleted file mode 100644 index 5d8b000976051396652a16b5a7b5814470d43573..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/check/CheckRuleResult.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bootx.sales.dto.check; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* 检查结果 -* @author xxm -* @date 2021/5/20 -*/ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -public class CheckRuleResult implements Serializable { - private static final long serialVersionUID = 7350355891944002874L; - - /** 通过状态 */ - private boolean pass = true; - - /** 错误提示 */ - private String msg; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/coupon/CouponDto.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/coupon/CouponDto.java deleted file mode 100644 index 077b775b0e899f1b493e3dab7ab956dfe1e2081c..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/coupon/CouponDto.java +++ /dev/null @@ -1,58 +0,0 @@ -package cn.bootx.sales.dto.coupon; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** -* @author xxm -* @date 2020/11/2 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "优惠卷") -public class CouponDto implements Serializable { - private static final long serialVersionUID = 3307473463220855296L; - - /** 主键 */ - private Long id; - - /** 名称 */ - private String name; - - /** 模板id */ - private Long templateId; - - /** 策略注册id */ - private Long strategyRegisterId; - - /** 状态 */ - private int status; - - /** 用于的订单 */ - private Long orderId; - - /** 1可选2已选3不可选 */ - private int canUse; - - /** 描述 */ - private String description; - - /** 有效开始时间 */ - private LocalDateTime startTime; - - /** 有效结束时间 */ - private LocalDateTime endTime; - - /** 领取时间 */ - private LocalDateTime obtainTime; - - /** 使用时间 */ - private LocalDateTime usedTime; - - /** 用户id */ - private Long userId; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/coupon/CouponTemplateDto.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/coupon/CouponTemplateDto.java deleted file mode 100644 index 5fd1594d281f4f79b5af133ba59b2069e02ca08c..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/coupon/CouponTemplateDto.java +++ /dev/null @@ -1,60 +0,0 @@ -package cn.bootx.sales.dto.coupon; - -import cn.bootx.sales.dto.strategy.StrategyRegisterDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** -* @author xxm -* @date 2020/11/1 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "优惠券模板") -public class CouponTemplateDto implements Serializable { - private static final long serialVersionUID = 1529981112623712342L; - - /** 固定时间 */ - public static final int FIXED_TIME = 1; - - private Long id; - - /** 名称 */ - private String name; - - /** 描述 */ - private String description; - - /** 数量 */ - private Integer num; - - /** 策略注册id */ - private Long strategyRegisterId; - - /** 优惠券互斥 */ - private String couponMutual; - - /** 活动互斥 */ - private String activityMutual; - - /** 有效类型 固定时间段/几天内有效 */ - private int effectiveType; - - /** 时间类型 小时/整天/多少天后*/ - private int timeType; - - /** 有效时间 */ - private Long effectiveTime; - - /** 有效开始时间 */ - private LocalDateTime startTime; - - /** 有效结束时间 */ - private LocalDateTime endTime; - - private StrategyRegisterDto strategyRegister; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/match/FeaturePoints.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/match/FeaturePoints.java deleted file mode 100644 index 6a3f7e75d43777dfe0fea3c7c200690c38b8e3ba..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/match/FeaturePoints.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bootx.sales.dto.match; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.List; - -/** -* @author xxm -* @date 2021/5/18 -*/ -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -@Schema(title = "特征点") -public class FeaturePoints { - - /** 特征点类型 */ - private String type; - - /** 特征点值 */ - private List points; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/match/MatchRuleDto.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/match/MatchRuleDto.java deleted file mode 100644 index 6f8222f8c6e6f8759f6e25177e6076f0b856587c..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/match/MatchRuleDto.java +++ /dev/null @@ -1,38 +0,0 @@ -package cn.bootx.sales.dto.match; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2020/12/3 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "匹配关系") -public class MatchRuleDto implements Serializable { - private static final long serialVersionUID = 4632655262933598313L; - - @Schema(description= "主键") - private Long id; - - @Schema(description= "策略注册ID") - private Long strategyRegisterId; - - @Schema(description= "外部关联类型 活动/优惠券") - private int registerType; - - @Schema(description= "特征类型") - private String featureType; - - @Schema(description= "特征值") - private String featurePoint; - - @Schema(description= "匹配类型") - private String matchType; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/GoodsActivityResult.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/GoodsActivityResult.java deleted file mode 100644 index 8cd7bd9873395a69664064e253610a5789c6e0d2..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/GoodsActivityResult.java +++ /dev/null @@ -1,26 +0,0 @@ -package cn.bootx.sales.dto.order; - -import cn.bootx.sales.dto.activity.SimpleActivity; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** -* @author xxm -* @date 2021/3/10 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "商品适用活动") -public class GoodsActivityResult implements Serializable { - private static final long serialVersionUID = 7331502272797651564L; - - @Schema(description= "skuId") - private Long skuId; - - @Schema(description= "活动集合") - private List activities; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/OrderDetailPreviewResult.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/OrderDetailPreviewResult.java deleted file mode 100644 index f4e1e3d3b2623fff304ff9851c4c0a0cf7587019..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/OrderDetailPreviewResult.java +++ /dev/null @@ -1,58 +0,0 @@ -package cn.bootx.sales.dto.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.List; - -/** -* @author xxm -* @date 2020/10/25 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "订单明细预览结果") -public class OrderDetailPreviewResult implements Serializable { - - private static final long serialVersionUID = -5612212555027798683L; - - @Schema(description= "类目ID") - private Long categoryId; - - @Schema(description= "店铺ID") - private Long shopId; - - @Schema(description= "商品ID") - private Long goodsId; - - @Schema(description= "skuId") - private Long skuId; - - @Schema(description= "商品名") - private String goodsTitle; - - @Schema(description= "商品价格") - private BigDecimal goodsPrice; - - @Schema(description= "商品数量") - private int num; - - @Schema(description= "是否允许分摊") - private Boolean isShare = true; - - @Schema(description= "总金额(原始)") - private BigDecimal totalAmount; - - @Schema(description= "优惠差价") - private BigDecimal payChange; - - @Schema(description= "总金额(优惠后)") - private BigDecimal payAmount; - - @Schema(description= "应用策略后价格变动记录") - private List mappings = new ArrayList<>(); -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/OrderPreviewResult.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/OrderPreviewResult.java deleted file mode 100644 index 605415865a462d3803c3acf54624c388a174379f..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/OrderPreviewResult.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.bootx.sales.dto.order; - -import cn.bootx.sales.dto.coupon.CouponDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -/** -* @author xxm -* @date 2020/10/15 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "订单预览结果") -public class OrderPreviewResult implements Serializable { - - private static final long serialVersionUID = 4645952272491229258L; - - @Schema(description= "code") - private String code; - - @Schema(description= "购买人ID") - private Long userId; - - @Schema(description= "类型") - private Integer type; - - @Schema(description= "渠道ID") - private Long channelId; - - @Schema(description= "总金额") - private BigDecimal totalAmount; - - @Schema(description= "待支付总金额") - private BigDecimal payAmount; - - @Schema(description= "优惠券明细") - private List coupons; - - @Schema(description= "明细预览") - List orderDetails; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/OrderStrategyMappingResult.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/OrderStrategyMappingResult.java deleted file mode 100644 index 2b27684e4da765d1cde53953b95bd950ebad3c2d..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/order/OrderStrategyMappingResult.java +++ /dev/null @@ -1,42 +0,0 @@ -package cn.bootx.sales.dto.order; - -import cn.bootx.sales.code.StrategyCode; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; - -/** - * @author xxm - * @date 2020/10/24 - */ -@Data -@Accessors(chain = true) -@Schema(title = "订单策略映射DTO") -public class OrderStrategyMappingResult implements Serializable { - - private static final long serialVersionUID = -2719923793104400815L; - - @Schema(description= "优惠券ID") - private Long couponId; - - @Schema(description= "策略ID") - private Long strategyId; - - @Schema(description= "策略注册ID") - private Long strategyRegisterId; - - /** - * @see StrategyCode - */ - @Schema(description= "策略类型") - private int strategyType; - - @Schema(description= "价格变动") - private BigDecimal priceChange; - - @Schema(description= "描述") - private String description; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyConfigDto.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyConfigDto.java deleted file mode 100644 index d7220ed16c35180a3f320437b201f4f9e1138381..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyConfigDto.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.bootx.sales.dto.strategy; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2020/10/25 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "策略脚本配置项") -public class StrategyConfigDto implements Serializable { - - private static final long serialVersionUID = -3690333270256315691L; - - @Schema(description= "主键ID") - private Long id; - - @Schema(description= "参数key") - private String key; - - @Schema(description= "名称") - private String name; - - @Schema(description= "字段类型") - private String type; - - @Schema(description= "描述") - private String description; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyConfigValueDto.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyConfigValueDto.java deleted file mode 100644 index 31009912b3155c0ffd518cd239dd01928dd916a9..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyConfigValueDto.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.bootx.sales.dto.strategy; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.time.LocalDateTime; - -/** -* @author xxm -* @date 2020/10/11 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "策略脚本配置项值") -public class StrategyConfigValueDto implements Serializable { - - private static final long serialVersionUID = -7481890055777714856L; - - @Schema(description= "主键") - private Long id; - - @Schema(description= "策略配置主键", required = true) - private Long strategyConfigId; - - @Schema(description= "值", required = true) - private String value; - - @Schema(description= "创建时间") - private LocalDateTime createTime; - - //只用于展示 - /** - * 配置项名称 - */ - private String configName; - /** - * 配置项字段类型 - */ - private String configType; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyDto.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyDto.java deleted file mode 100644 index 5ce6341096be4dbe1314835a70635d0ecb5c0408..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyDto.java +++ /dev/null @@ -1,60 +0,0 @@ -package cn.bootx.sales.dto.strategy; - -import cn.bootx.common.core.rest.dto.BaseDto; -import cn.bootx.sales.code.StrategyCode; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** -* @author xxm -* @date 2020/10/15 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@Schema(title = "策略") -public class StrategyDto extends BaseDto implements Serializable { - private static final long serialVersionUID = 6586989712139176276L; - - @Schema(description= "策略主键") - private Long id; - - @Schema(description= "编码") - private String code; - - @Schema(description= "名称") - private String name; - - @Schema(description= "描述") - private String description; - - /** - * @see StrategyCode - */ - @Schema(description= "目标类型") - private int targetType; - - /** - * @see StrategyCode - */ - @Schema(description= "引擎类型") - private int engineType; - - @Schema(description= "策略计算脚本") - private String ruleScript; - - @Schema(description= "可用状态") - private Integer state; - - @Schema(description= "配置项") - private List configParams; - - @Schema(description= "是否可更改") - private boolean updatable = true; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyRegisterDto.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyRegisterDto.java deleted file mode 100644 index 5fa100a197bb1c0f576cce373b711c80ac4fd1d1..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/strategy/StrategyRegisterDto.java +++ /dev/null @@ -1,43 +0,0 @@ -package cn.bootx.sales.dto.strategy; - -import cn.bootx.common.core.rest.dto.BaseDto; -import cn.bootx.sales.dto.check.CheckRuleDto; -import cn.bootx.sales.dto.match.MatchRuleDto; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** -* 策略注册 -* @author xxm -* @date 2020/10/15 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@Schema(title = "策略注册") -public class StrategyRegisterDto extends BaseDto implements Serializable { - private static final long serialVersionUID = -7198577385245322049L; - - @Schema(description= "策略主键") - private Long strategyId; - - @Schema(description= "名称") - private String name; - - @Schema(description= "描述") - private String description; - - @Schema(description= "检测规则") - private List checkRules; - - @Schema(description= "匹配内容规则") - private List matchRules; - - @Schema(description= "策略脚本配置项值") - private List configValues; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/engine/JavaCalculateHandlerFactory.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/engine/JavaCalculateHandlerFactory.java deleted file mode 100644 index df5dbd8ee241b841118dd7411416c82c8c352ef8..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/engine/JavaCalculateHandlerFactory.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.bootx.sales.engine; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.common.core.exception.FatalException; -import cn.bootx.sales.core.calculate.handler.func.JavaCalculateHandler; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.stereotype.Component; - -import java.util.ArrayList; -import java.util.List; -import java.util.Objects; - -/** -* 自定义策略计算规则(java接口) -* @author xxm -* @date 2020/12/13 -*/ -@Component -public class JavaCalculateHandlerFactory implements ApplicationContextAware { - - private List javaCalculateHandlers; - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - javaCalculateHandlers = new ArrayList<>(applicationContext.getBeansOfType(JavaCalculateHandler.class).values()); - // 检查ruleCode是否有重复 - long count = javaCalculateHandlers.stream() - .map(JavaCalculateHandler::getCode) - .distinct() - .count(); - if (javaCalculateHandlers.size()!=count){ - throw new FatalException(0,"策略计算类实现类Code有重复"); - } - } - - /** - * 根据类型选择出 支持的类 - */ - public JavaCalculateHandler getCalculateHandler(String ruleCode){ - return javaCalculateHandlers.stream() - .filter(handler -> Objects.equals(handler.getCode(), ruleCode)) - .findFirst() - .orElseThrow(() -> new BizException("Code没有对应的处理类")); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/coupon/CouponObtainException.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/coupon/CouponObtainException.java deleted file mode 100644 index bd192fc407d3c5f4ad9942ff91a94365f1b05369..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/coupon/CouponObtainException.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bootx.sales.exception.coupon; - -import cn.bootx.common.core.exception.BizException; - -import java.io.Serializable; - -import static cn.bootx.sales.code.SalesCenterErrorCode.COUPON_USE_EXCEPTION; - -/** -* 领取优惠券异常 -* @author xxm -* @date 2020/12/1 -*/ -public class CouponObtainException extends BizException implements Serializable { - public CouponObtainException(){ - super(COUPON_USE_EXCEPTION,"领取优惠券异常"); - } - - public CouponObtainException(String msg){ - super(COUPON_USE_EXCEPTION,msg); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/coupon/CouponUseException.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/coupon/CouponUseException.java deleted file mode 100644 index bd5be204c5eddb903d326f9993bc176f3660fc8f..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/coupon/CouponUseException.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.bootx.sales.exception.coupon; - -import cn.bootx.common.core.exception.BizException; - -import java.io.Serializable; - -import static cn.bootx.sales.code.SalesCenterErrorCode.COUPON_USE_EXCEPTION; - -/** -* 使用优惠券异常 -* @author xxm -* @date 2020/12/1 -*/ -public class CouponUseException extends BizException implements Serializable { - public CouponUseException(){ - super(COUPON_USE_EXCEPTION,"使用优惠券异常"); - } - - public CouponUseException(String msg){ - super(COUPON_USE_EXCEPTION,msg); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyAlreadyUsedException.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyAlreadyUsedException.java deleted file mode 100644 index 202d98881026d7a0c1aa5e0910859408c12017dc..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyAlreadyUsedException.java +++ /dev/null @@ -1,11 +0,0 @@ -package cn.bootx.sales.exception.strategy; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.sales.code.SalesCenterErrorCode; - - -public class StrategyAlreadyUsedException extends BizException { - public StrategyAlreadyUsedException() { - super(SalesCenterErrorCode.STRATEGY_ALREADY_USED, "已经使用的策略"); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyCalculateException.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyCalculateException.java deleted file mode 100644 index 75d0826e6d2dfe1ee09425193ab7085bf4af20c4..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyCalculateException.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.bootx.sales.exception.strategy; - - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.sales.code.SalesCenterErrorCode; - -/** - * 策略计算异常 - * @author xxm - * @date 2020/10/15 - */ -public class StrategyCalculateException extends BizException { - public StrategyCalculateException() { - super(SalesCenterErrorCode.STRATEGY_CALCULATE_ERROR, "策略计算异常"); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyNotExistException.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyNotExistException.java deleted file mode 100644 index 65721ce0d2fd65a3cbb07f02592a0925e97e5869..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyNotExistException.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bootx.sales.exception.strategy; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.sales.code.SalesCenterErrorCode; - -/** - * - * @author zhangguoquan - * @date 18/4/8 - */ -public class StrategyNotExistException extends BizException { - public StrategyNotExistException() { - super(SalesCenterErrorCode.STRATEGY_NOT_EXIST, "策略不存在"); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyRegisterAlreadyExistException.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyRegisterAlreadyExistException.java deleted file mode 100644 index 76e70fd785849eee23406232d73cd23f0c5d43db..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/exception/strategy/StrategyRegisterAlreadyExistException.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.bootx.sales.exception.strategy; - -import cn.bootx.common.core.exception.BizException; -import cn.bootx.sales.code.SalesCenterErrorCode; - -/** -* -* @author xxm -* @date 2020/10/11 -*/ -public class StrategyRegisterAlreadyExistException extends BizException { - public StrategyRegisterAlreadyExistException() { - super(SalesCenterErrorCode.STRATEGY_REGISTER_ALREADY_EXIST, "策略已经注册"); - } -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/activity/ActivityParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/activity/ActivityParam.java deleted file mode 100644 index 4cb0c256f8660d7a9ff1b4605af64e5272823b61..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/activity/ActivityParam.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.bootx.sales.param.activity; - -import cn.bootx.sales.param.strategy.StrategyRegisterParam; -import cn.hutool.core.date.DatePattern; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.springframework.format.annotation.DateTimeFormat; - -import java.time.LocalDateTime; - -/** -* @author xxm -* @date 2021/5/7 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Schema(title = "活动参数") -public class ActivityParam extends StrategyRegisterParam { - - @Schema(description= "有效开始时间") - @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) - private LocalDateTime startTime; - - @Schema(description= "有效结束时间") - @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) - private LocalDateTime endTime; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/coupon/CouponTemplateParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/coupon/CouponTemplateParam.java deleted file mode 100644 index 0b8d76ce413dd7d35bd49502e702743739b942e3..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/coupon/CouponTemplateParam.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.bootx.sales.param.coupon; - -import cn.bootx.sales.param.strategy.CheckRuleParam; -import cn.bootx.sales.param.strategy.StrategyRegisterParam; -import cn.hutool.core.date.DatePattern; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; -import org.springframework.format.annotation.DateTimeFormat; - -import java.io.Serializable; -import java.time.LocalDateTime; -import java.util.List; - -/** -* @author xxm -* @date 2020/11/1 -*/ -@EqualsAndHashCode(callSuper = true) -@Data -@Accessors(chain = true) -@Schema(title = "优惠券模板参数") -public class CouponTemplateParam extends StrategyRegisterParam implements Serializable { - private static final long serialVersionUID = 7480182214926404754L; - - @Schema(description= "数量") - private Integer num; - - @Schema(description= "优惠券互斥(模板id)") - private List couponMutual; - - @Schema(description= "活动互斥(活动id)") - private List activityMutual; - - @Schema(description= "领取检查规则") - private List obtainRules; - - @Schema(description= "有效类型 固定时间段/几天内有效") - private int effectiveType; - - @Schema(description= "时间类型 小时/整天/多少天后") - private int timeType; - - @Schema(description= "有效时间") - private Long effectiveTime; - - @Schema(description= "有效开始时间") - @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) - private LocalDateTime startTime; - - @Schema(description= "有效结束时间") - @DateTimeFormat(pattern = DatePattern.NORM_DATETIME_PATTERN) - private LocalDateTime endTime; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/coupon/ObtainCouponParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/coupon/ObtainCouponParam.java deleted file mode 100644 index c5040fe86de9d47419c4991a78bb32c429edbc31..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/coupon/ObtainCouponParam.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.bootx.sales.param.coupon; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2020/12/1 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "优惠券领取参数") -public class ObtainCouponParam implements Serializable { - - private static final long serialVersionUID = -2819314899657082887L; - - @Schema(description= "优惠券模板Id") - private Long templateId; - - @Schema(description= "用户Id") - private Long userId; - - @Schema(description= "设备id") - private Long deviceId; - - @Schema(description= "ip") - private String ip; - - @Schema(description= "渠道Id") - private Long channelId; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/coupon/UseCouponParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/coupon/UseCouponParam.java deleted file mode 100644 index 4341d5d20d75b9f0e6badf603db459e65ff0ffaf..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/coupon/UseCouponParam.java +++ /dev/null @@ -1,27 +0,0 @@ -package cn.bootx.sales.param.coupon; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** -* @author xxm -* @date 2021/3/9 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "优惠券使用") -public class UseCouponParam implements Serializable { - private static final long serialVersionUID = 7400322396295360022L; - - @Schema(description= "订单Id") - private Long orderId; - - @Schema(description= "优惠券Id") - private List couponIds; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/order/OrderCheckParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/order/OrderCheckParam.java deleted file mode 100644 index 907b79fb364a434b2a76fc2b1143479b6514093b..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/order/OrderCheckParam.java +++ /dev/null @@ -1,49 +0,0 @@ -package cn.bootx.sales.param.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -/** -* @author xxm -* @date 2020/10/15 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "订单参数") -public class OrderCheckParam implements Serializable { - - private static final long serialVersionUID = 546385575171313726L; - - @Schema(description= "code") - private String code; - - @Schema(description= "购者id") - private Long userId; - - @Schema(description= "渠道id") - private Long channelId; - - @Schema(description= "订单类型") - private Integer type; - - @Schema(description= "总金额") - private BigDecimal totalAmount; - - @Schema(description= "订单明细") - private List details; - - @Schema(description= "选择的优惠券") - private List couponIds; - - @Schema(description= "全部待选优惠券",hidden = true) - private List allCouponIds; - - - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/order/OrderDetailCheckParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/order/OrderDetailCheckParam.java deleted file mode 100644 index 523650676875dcd865d95b96e79dbda47a0fe46e..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/order/OrderDetailCheckParam.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.bootx.sales.param.order; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.math.BigDecimal; -import java.util.List; - -@Data -@Accessors(chain = true) -@Schema(title = "订单明细参数") -public class OrderDetailCheckParam implements Serializable { - - private static final long serialVersionUID = 2984639517325652160L; - @Schema(description= "类目id") - private Long categoryId; - - @Schema(description= "店铺id") - private Long shopId; - - @Schema(description= "商品id") - private Long goodsId; - - @Schema(description= "sku id") - private Long skuId; - - @Schema(description= "商品名") - private String goodsTitle; - - @Schema(description= "商品价格") - private BigDecimal goodsPrice; - - @Schema(description= "是否虚拟商品") - private Boolean isVirtual = false; - - @Schema(description= "是否允许分摊") - private Boolean isShare = true; - - @Schema(description= "数量") - private int num; - - @Schema(description= "使用的活动策略id集合") - private List activityIds; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/CheckRuleParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/CheckRuleParam.java deleted file mode 100644 index 48030f747933089df7faf2c597d65555de61573f..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/CheckRuleParam.java +++ /dev/null @@ -1,44 +0,0 @@ -package cn.bootx.sales.param.strategy; - -import cn.bootx.sales.code.CheckRuleCode; -import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2021/5/7 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "检查规则参数") -public class CheckRuleParam implements Serializable { - private static final long serialVersionUID = 689686610474750635L; - - @Schema(description= "优先级") - private int priority; - - @Schema(description= "规则名称") - private String name; - - @Schema(description= "规则code") - private String code; - - /** - * 规则类型 - * @see CheckRuleCode.Activity - * @see CheckRuleCode.Coupon - */ - @JsonIgnore - private int ruleType; - - @Schema(description= "策略id") - private Long strategyId; - - @Schema(description= "附加对象 json") - private String addition; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/MatchRuleParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/MatchRuleParam.java deleted file mode 100644 index 2966216b88ec1149f97f8107e0a770e355b77e14..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/MatchRuleParam.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.bootx.sales.param.strategy; - -import cn.bootx.sales.code.MatchTypeCode; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2021/5/19 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "匹配配置参数") -public class MatchRuleParam implements Serializable { - private static final long serialVersionUID = -4122307649683307643L; - - @Schema(description= "特征类型") - private String featureType; - - @Schema(description= "特征值") - private String featurePoint; - - /** - * @see MatchTypeCode - */ - @Schema(description= "匹配类型") - private String matchType; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyConfigParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyConfigParam.java deleted file mode 100644 index a38b0bcc9c4829c879f4a4e084b58233cfc9112b..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyConfigParam.java +++ /dev/null @@ -1,34 +0,0 @@ -package cn.bootx.sales.param.strategy; - -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; - -/** -* @author xxm -* @date 2020/10/25 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "策略脚本配置项") -public class StrategyConfigParam implements Serializable { - private static final long serialVersionUID = -3690333270256315691L; - - @Schema(description= "主键ID") - private Long id; - - @Schema(description= "参数key") - private String key; - - @Schema(description= "名称") - private String name; - - @Schema(description= "字段类型") - private String type; - - @Schema(description= "描述") - private String description; -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyConfigValueParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyConfigValueParam.java deleted file mode 100644 index ff6d188cdad9f8c224ca582b737f4bf675aadfc2..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyConfigValueParam.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.bootx.sales.param.strategy; - -import cn.bootx.common.core.validation.ValidationGroup.add; -import cn.bootx.common.core.validation.ValidationGroup.edit; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; - -/** -* @author xxm -* @date 2021/5/7 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "策略参数值") -public class StrategyConfigValueParam implements Serializable { - private static final long serialVersionUID = -7024845343648657278L; - - @Schema(description= "主键") - @NotNull(groups = edit.class) - private Long id; - - @Schema(description= "策略配置主键") - @NotNull(groups = {add.class,edit.class}) - private Long strategyConfigId; - - @Schema(description= "值") - @NotNull(groups = {add.class, edit.class}) - private String value; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyParam.java deleted file mode 100644 index dbece4ea5382c468620ea43cff656d7996ae0b99..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyParam.java +++ /dev/null @@ -1,55 +0,0 @@ -package cn.bootx.sales.param.strategy; - -import cn.bootx.sales.code.StrategyCode; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import java.io.Serializable; -import java.util.List; - -/** -* @author xxm -* @date 2020/10/15 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "策略定义参数") -public class StrategyParam implements Serializable { - - private static final long serialVersionUID = -4666152410169234985L; - - @Schema(description= "策略主键") - private Long id; - - @Schema(description= "编码") - private String code; - - @Schema(description= "名称") - private String name; - - @Schema(description= "描述") - private String description; - - /** - * @see StrategyCode TARGET_TYPE_* - */ - @Schema(description= "目标类型") - private int targetType; - - /** - * @see StrategyCode - */ - @Schema(description= "引擎类型") - private int engineType; - - @Schema(description= "策略计算脚本") - private String ruleScript; - - @Schema(description= "可用状态") - private Integer state; - - @Schema(description= "配置项") - private List configParams; - -} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyRegisterParam.java b/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyRegisterParam.java deleted file mode 100644 index 571ff3c6c2761aa0a118d8518b8c361c32d0fb87..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/param/strategy/StrategyRegisterParam.java +++ /dev/null @@ -1,53 +0,0 @@ -package cn.bootx.sales.param.strategy; - -import cn.bootx.sales.code.StrategyRegisterCode; -import com.fasterxml.jackson.annotation.JsonIgnore; -import io.swagger.v3.oas.annotations.media.Schema; -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; -import lombok.experimental.Accessors; - -import javax.validation.constraints.NotNull; -import java.io.Serializable; -import java.util.List; - -import static cn.bootx.common.core.validation.ValidationGroup.add; -import static cn.bootx.common.core.validation.ValidationGroup.edit; - -/** -* @author xxm -* @date 2020/12/4 -*/ -@Data -@Accessors(chain = true) -@Schema(title = "策略注册参数类") -public class StrategyRegisterParam implements Serializable { - - private static final long serialVersionUID = -6901032367671927153L; - - @Schema(description= "策略主键") - @NotNull(groups = {add.class, edit.class}) - private Long strategyId; - - @Schema(description= "名称") - private String name; - - @Schema(description= "描述") - private String description; - - /** - * @see StrategyRegisterCode - */ - @Schema(description= "策略类型") - @JsonIgnore - private Integer strategyType; - - @Schema(description= "匹配配置") - private List matchRules; - - @Schema(description= "选择与使用检查规则") - private List checkRules; - - @Schema(description= "策略参数值") - private List configValues; -} diff --git a/bootx-services/service-sales/src/main/resources/META-INF/spring.factories b/bootx-services/service-sales/src/main/resources/META-INF/spring.factories deleted file mode 100644 index f2c80b003d831d519c88ee055b259a1d57c38d34..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/resources/META-INF/spring.factories +++ /dev/null @@ -1,3 +0,0 @@ -## 配置自动化配置 -org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ - cn.bootx.sales.SalesApplication diff --git a/bootx-services/service-sales/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/bootx-services/service-sales/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index fd445ebb2cca8d683cc778d86e1dd47ff64f1367..0000000000000000000000000000000000000000 --- a/bootx-services/service-sales/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -cn.bootx.starter.wecom.WeComAutoConfiguration \ No newline at end of file diff --git a/bootx-services/service-order/pom.xml b/bootx-services/service-visualization/pom.xml similarity index 71% rename from bootx-services/service-order/pom.xml rename to bootx-services/service-visualization/pom.xml index 280503dbcf25e779bc41b64e778ec1ef5bfdb411..53f885516ede2bde9df49d8386fc998994435941 100644 --- a/bootx-services/service-order/pom.xml +++ b/bootx-services/service-visualization/pom.xml @@ -3,13 +3,14 @@ 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"> - bootx-services cn.bootx.platform - 1.2.1 + bootx-services + 1.2.2 - 4.0.0 - service-order + 4.0.0 + service-visualization + jar @@ -25,18 +26,21 @@ mybatis-plus-boot-starter - + cn.bootx.platform - service-sales + service-iam ${bootx-platform.version} + cn.bootx.platform - service-payment - ${bootx-platform.version} + common-starter-auth + + + cn.bootx.platform + common-starter-file - diff --git a/bootx-modules/module-eshop/src/main/java/cn/bootx/models/eshop/EshopApplication.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/VisualizationApplication.java similarity index 71% rename from bootx-modules/module-eshop/src/main/java/cn/bootx/models/eshop/EshopApplication.java rename to bootx-services/service-visualization/src/main/java/cn/bootx/visualization/VisualizationApplication.java index f33bff7c890c9eab1b293920f921dad916a8d4f4..12d08796eab3c365597a7b367c0860f455c1d2d9 100644 --- a/bootx-modules/module-eshop/src/main/java/cn/bootx/models/eshop/EshopApplication.java +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/VisualizationApplication.java @@ -1,4 +1,4 @@ -package cn.bootx.models.eshop; +package cn.bootx.visualization; import org.apache.ibatis.annotations.Mapper; import org.mybatis.spring.annotation.MapperScan; @@ -6,12 +6,12 @@ import org.springframework.boot.context.properties.ConfigurationPropertiesScan; import org.springframework.context.annotation.ComponentScan; /** -* 网上商城 -* @author xxm -* @date 2022/5/9 -*/ + * 可视化模块 + * @author xxm + * @date 2023/2/16 + */ @ComponentScan @ConfigurationPropertiesScan @MapperScan(annotationClass = Mapper.class) -public class EshopApplication { +public class VisualizationApplication { } diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/code/GoVIewCode.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/code/GoVIewCode.java new file mode 100644 index 0000000000000000000000000000000000000000..d85f7f327513358c70c7777b643cd07e2d02a81a --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/code/GoVIewCode.java @@ -0,0 +1,13 @@ +package cn.bootx.visualization.code; + +/** + * GoVIew大屏相关常量 + * @author xxm + * @date 2023/2/21 + */ +public interface GoVIewCode { + /** 发布 */ + int STATE_PUBLISH = 1; + /** 未发布 */ + int STATE_UN_PUBLISH = -1; +} diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/configuration/VisualizationProperties.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/configuration/VisualizationProperties.java new file mode 100644 index 0000000000000000000000000000000000000000..7526b17e352631f85dc9f8e14883ed3cf2d95bea --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/configuration/VisualizationProperties.java @@ -0,0 +1,18 @@ +package cn.bootx.visualization.configuration; + +import lombok.Data; +import lombok.experimental.Accessors; +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * + * @author xxm + * @date 2023/3/2 + */ +@Data +@Accessors(chain = true) +@ConfigurationProperties(prefix = "bootx.service.visualization") +public class VisualizationProperties { + /** GoView大屏服务地址 */ + private String goViewUrl = "http://localhost:6000"; +} diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/controller/GoViewAdminController.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/controller/GoViewAdminController.java new file mode 100644 index 0000000000000000000000000000000000000000..013bb1c9067b95d6ffe924cf13a4a02eb196f64c --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/controller/GoViewAdminController.java @@ -0,0 +1,106 @@ +package cn.bootx.visualization.controller; + +import cn.bootx.common.core.rest.PageResult; +import cn.bootx.common.core.rest.Res; +import cn.bootx.common.core.rest.ResResult; +import cn.bootx.common.core.rest.param.PageParam; +import cn.bootx.visualization.core.service.ProjectInfoService; +import cn.bootx.visualization.dto.ProjectInfoDto; +import cn.bootx.visualization.dto.ProjectInfoResult; +import cn.bootx.visualization.param.CreateParam; +import cn.bootx.visualization.param.ProjectInfoParam; +import cn.bootx.visualization.param.ProjectInfoSave; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import javax.validation.Valid; + +/** + * GoView可视化大屏管理接口 + * @author xxm + * @date 2023/2/24 + */ +@Validated +@Tag(name = "GoView可视化大屏管理接口") +@RestController +@RequestMapping("/goview/admin") +@RequiredArgsConstructor +public class GoViewAdminController { + private final ProjectInfoService projectInfoService; + + @Operation(summary = "创建项目") + @PostMapping("/add") + public ResResult add(@Valid @RequestBody CreateParam param) { + return Res.ok(projectInfoService.create(param)); + } + + @Operation(summary = "获取项目列表分页 ") + @GetMapping("/page") + public ResResult> page(PageParam pageParam, ProjectInfoSave query){ + return Res.ok(projectInfoService.pageByAdmin(pageParam,query)); + } + + @Operation(summary = "获取详情") + @GetMapping("/findById") + public ResResult findById(Long id){ + return Res.ok(projectInfoService.findById(id)); + } + + @Operation(summary = "更新数据") + @PostMapping("/update") + public ResResult update(@RequestBody ProjectInfoParam param) { + projectInfoService.updateByAdmin(param); + return Res.ok(); + } + + @Operation(summary = "复制") + @PostMapping("/copy") + public ResResult copy(Long id) { + projectInfoService.copy(id); + return Res.ok(); + } + + @Operation(summary = "发布") + @PostMapping("/publish") + public ResResult publish(Long id) { + projectInfoService.publish(id); + return Res.ok(); + } + + @Operation(summary = "取消发布") + @PostMapping("/unPublish") + public ResResult unPublish(Long id) { + projectInfoService.unPublish(id); + return Res.ok(); + } + + @Operation(summary = "应用编辑中的信息") + @PostMapping("/enableEditContent") + public ResResult enableEditContent(Long id) { + projectInfoService.enableEditContent(id); + return Res.ok(); + } + + @Operation(summary = "重置编辑中的信息") + @PostMapping("/resetEditContent") + public ResResult resetEditContent(Long id) { + projectInfoService.resetEditContent(id); + return Res.ok(); + } + + @Operation(summary = "获取GoView服务的地址") + @GetMapping("/getGoViewUrl") + public ResResult getGoViewUrl(){ + return Res.ok(projectInfoService.getGoViewUrl()); + } + + @Operation(summary = "删除") + @DeleteMapping("/delete") + public ResResult delete(Long id) { + projectInfoService.delete(id); + return Res.ok(); + } +} diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/controller/GoViewController.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/controller/GoViewController.java new file mode 100644 index 0000000000000000000000000000000000000000..f04ebcb65556e3e786b526766b7aaecca8779c5c --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/controller/GoViewController.java @@ -0,0 +1,63 @@ +package cn.bootx.visualization.controller; + +import cn.bootx.common.core.annotation.IgnoreAuth; +import cn.bootx.common.core.rest.Res; +import cn.bootx.common.core.rest.ResResult; +import cn.bootx.visualization.core.service.ProjectInfoService; +import cn.bootx.visualization.dto.OssInfo; +import cn.bootx.visualization.dto.GoVIewPageResult; +import cn.bootx.visualization.dto.ProjectInfoResult; +import cn.bootx.visualization.param.ProjectInfoSave; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * GoView可视化大屏对接接口 + * @author xxm + * @date 2023/2/21 + */ +@Validated +@Tag(name = "GoView可视化大屏对接接口") +@RestController +@RequestMapping("/goview") +@RequiredArgsConstructor +public class GoViewController { + private final ProjectInfoService projectInfoService; + + @IgnoreAuth + @Operation(summary = "获取文件oss存储信息") + @GetMapping("/getOssInfo") + public ResResult getOssInfo(){ + return Res.ok(projectInfoService.getOssInfo()); + } + @Operation(summary = "获取项目列表分页 ") + @GetMapping("/page") + public GoVIewPageResult> page(Integer page, Integer limit){ + return projectInfoService.pageByGoVIew(page,limit); + } + + @IgnoreAuth + @Operation(summary = "获取发布的数据(报表内容为空返回null)") + @GetMapping("/getPublishData") + public ResResult getPublishData(Long projectId) { + return Res.ok(projectInfoService.getPublishData(projectId)); + } + + @Operation(summary = "获取编辑时的数据(报表内容为空返回null)") + @GetMapping("/getEditData") + public ResResult getEditData(Long projectId) { + return Res.ok(projectInfoService.getEditData(projectId)); + } + + @Operation(summary = "更新数据") + @PostMapping("/update") + public ResResult update(@RequestBody ProjectInfoSave param) { + projectInfoService.update(param); + return Res.ok(); + } +} diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/convert/GoViewConvert.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/convert/GoViewConvert.java new file mode 100644 index 0000000000000000000000000000000000000000..a93c898e0e475f4e8ccac5c7e656a2ddb465084a --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/convert/GoViewConvert.java @@ -0,0 +1,19 @@ +package cn.bootx.visualization.core.convert; + +import cn.bootx.visualization.core.entity.ProjectInfo; +import cn.bootx.visualization.dto.ProjectInfoDto; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +/** + * 转换 + * @author xxm + * @date 2023/3/2 + */ +@Mapper +public interface GoViewConvert { + GoViewConvert CONVERT = Mappers.getMapper(GoViewConvert.class); + + ProjectInfoDto convert(ProjectInfo in); + +} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/dao/GoodsManager.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoManager.java similarity index 36% rename from bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/dao/GoodsManager.java rename to bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoManager.java index 4cb11692c93299b081c6eff037d36bdc12b43de4..40f2fecf8f3ad5f218890f29f326cd3b606bf86b 100644 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/goods/dao/GoodsManager.java +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoManager.java @@ -1,37 +1,36 @@ -package cn.bootx.goods.core.goods.dao; +package cn.bootx.visualization.core.dao; import cn.bootx.common.core.rest.param.PageParam; import cn.bootx.common.mybatisplus.base.MpIdEntity; import cn.bootx.common.mybatisplus.impl.BaseManager; import cn.bootx.common.mybatisplus.util.MpUtil; -import cn.bootx.goods.core.goods.entity.Goods; -import cn.bootx.goods.param.goods.GoodsParam; +import cn.bootx.visualization.core.entity.ProjectInfo; +import cn.bootx.visualization.param.ProjectInfoSave; +import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Repository; -import java.util.List; +import java.util.Objects; /** -* 商品 -* @author xxm -* @date 2020/11/20 -*/ + * + * @author xxm + * @date 2023/2/21 + */ @Repository -@RequiredArgsConstructor -public class GoodsManager extends BaseManager { - - public List findByCid(Long cid) { - return findAllByField(Goods::getCid,cid); - } +public class ProjectInfoManager extends BaseManager { /** * 分页 */ - public Page page(PageParam param, GoodsParam query){ - Page mpPage = MpUtil.getMpPage(param, Goods.class); + public Page page(PageParam pageParam, ProjectInfoSave query) { + Page mpPage = MpUtil.getMpPage(pageParam, ProjectInfo.class); return this.lambdaQuery() + .select(this.getEntityClass(),MpUtil::excludeBigField) .orderByDesc(MpIdEntity::getId) + .like(Objects.nonNull(query.getProjectId()),MpIdEntity::getId,query.getProjectId()) + .like(StrUtil.isNotBlank(query.getName()),ProjectInfo::getName,query.getName()) + .eq(Objects.nonNull(query.getState()),ProjectInfo::getState,query.getState()) .page(mpPage); } } diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyMapper.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoMapper.java similarity index 42% rename from bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyMapper.java rename to bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoMapper.java index 9059007351c2b6e604877d2bbd06d4e3f7dec468..e06ab8b970ccca2bd77ba2da15f1af495f121497 100644 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyMapper.java +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoMapper.java @@ -1,14 +1,14 @@ -package cn.bootx.sales.core.strategy.dao; +package cn.bootx.visualization.core.dao; -import cn.bootx.sales.core.strategy.entity.Strategy; +import cn.bootx.visualization.core.entity.ProjectInfo; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** + * * @author xxm - * @date 2020/10/31 + * @date 2023/2/21 */ @Mapper -public interface StrategyMapper extends BaseMapper { - +public interface ProjectInfoMapper extends BaseMapper { } diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoPublishManager.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoPublishManager.java new file mode 100644 index 0000000000000000000000000000000000000000..8a096db1cc461ff1cd234c2dd7a3e232e59b1e85 --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoPublishManager.java @@ -0,0 +1,15 @@ +package cn.bootx.visualization.core.dao; + +import cn.bootx.common.mybatisplus.impl.BaseManager; +import cn.bootx.visualization.core.entity.ProjectInfoPublish; +import org.springframework.stereotype.Repository; + +/** + * + * @author xxm + * @date 2023/2/24 + */ +@Repository +public class ProjectInfoPublishManager extends BaseManager { + +} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyRegisterMapper.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoPublishMapper.java similarity index 39% rename from bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyRegisterMapper.java rename to bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoPublishMapper.java index 5cb5ce2d0fe3b970b5d6de9ff9b0b7cfd55ae23d..6d8c6f799b3986cee73782d95dee41b3c32677a5 100644 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/core/strategy/dao/StrategyRegisterMapper.java +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/dao/ProjectInfoPublishMapper.java @@ -1,15 +1,14 @@ -package cn.bootx.sales.core.strategy.dao; +package cn.bootx.visualization.core.dao; -import cn.bootx.sales.core.strategy.entity.StrategyRegister; +import cn.bootx.visualization.core.entity.ProjectInfoPublish; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; /** + * * @author xxm - * @date 2020/10/31 + * @date 2023/2/24 */ @Mapper -public interface StrategyRegisterMapper extends BaseMapper { - - +public interface ProjectInfoPublishMapper extends BaseMapper { } diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/entity/ProjectInfo.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/entity/ProjectInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..4431992f7483a1a0f9e69fd992f24e85f6878283 --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/entity/ProjectInfo.java @@ -0,0 +1,79 @@ +package cn.bootx.visualization.core.entity; + +import cn.bootx.common.core.annotation.BigField; +import cn.bootx.common.core.annotation.actable.Column; +import cn.bootx.common.core.annotation.actable.Table; +import cn.bootx.common.core.code.actable.MySqlFieldType; +import cn.bootx.common.core.function.EntityBaseFunction; +import cn.bootx.common.core.util.CollUtil; +import cn.bootx.common.jackson.util.JacksonUtil; +import cn.bootx.common.mybatisplus.base.MpBaseEntity; +import cn.bootx.visualization.core.convert.GoViewConvert; +import cn.bootx.visualization.dto.ProjectInfoDto; +import cn.bootx.visualization.param.ProjectInfoSave; +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +/** + * 自定义大屏信息 + * @author xxm + * @date 2023/2/21 + */ +@Table(comment = "自定义大屏信息") +@EqualsAndHashCode(callSuper = true) +@Data +@Accessors(chain = true) +@TableName("report_project_info") +public class ProjectInfo extends MpBaseEntity implements EntityBaseFunction { + + /** 项目名称 */ + @Column(comment = "项目名称") + private String name; + + /** + * 发布状态 + * @see cn.bootx.visualization.code.GoVIewCode + */ + @Column(comment = "发布状态") + private Integer state; + + /** 是否在编辑中 */ + @Column(comment = "是否在编辑中") + private Boolean edit; + + /** 报表内容 */ + @BigField + @Column(comment = "报表内容",type = MySqlFieldType.LONGTEXT) + private String content; + + /** 预览图片id */ + @Column(comment = "预览图片id") + private Long indexImage; + + /** 备注 */ + @Column(comment = "备注") + private String remark; + + + public static ProjectInfo init(ProjectInfoSave param){ + ProjectInfo entity = new ProjectInfo() + .setName(param.getName()) + .setIndexImage(param.getIndexImage()) + .setRemark(param.getRemark()); + entity.setId(param.getProjectId()); + if (CollUtil.isNotEmpty(param.getContent())){ + entity.setContent(JacksonUtil.toJson(param.getContent())); + } + return entity; + } + + /** + * 转换 + */ + @Override + public ProjectInfoDto toDto() { + return GoViewConvert.CONVERT.convert(this); + } +} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategorySpecification.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/entity/ProjectInfoPublish.java similarity index 32% rename from bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategorySpecification.java rename to bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/entity/ProjectInfoPublish.java index f2e1dce068976b51774df6629cfa5a7f47303a7c..7c6cfcee96246f22b043be006f71d11ce41e5a8b 100644 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/core/category/entity/CategorySpecification.java +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/entity/ProjectInfoPublish.java @@ -1,5 +1,9 @@ -package cn.bootx.goods.core.category.entity; +package cn.bootx.visualization.core.entity; +import cn.bootx.common.core.annotation.actable.Column; +import cn.bootx.common.core.annotation.actable.Table; +import cn.bootx.common.core.code.actable.MySqlFieldType; +import cn.bootx.common.mybatisplus.base.MpBaseEntity; import cn.bootx.common.mybatisplus.base.MpIdEntity; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @@ -7,19 +11,19 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** - * 商品分类规格 + * 自定义大屏编辑时缓存信息 * @author xxm - * @date 2022/5/9 + * @date 2023/2/21 */ +@Table(comment = "自定义大屏发布信息") @EqualsAndHashCode(callSuper = true) @Data @Accessors(chain = true) -@TableName("goods_category_specification") -public class CategorySpecification extends MpIdEntity { +@TableName("report_project_info_publish") +public class ProjectInfoPublish extends MpBaseEntity { - /** 类目id */ - private Long categoryId; + /** 发布的报表内容 */ + @Column(comment = "报表内容",type = MySqlFieldType.LONGTEXT) + private String content; - /** 规格id */ - private Long specificationId; } diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/service/ProjectInfoService.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/service/ProjectInfoService.java new file mode 100644 index 0000000000000000000000000000000000000000..81ebf4b1a1db6445232754626ac349251482037b --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/core/service/ProjectInfoService.java @@ -0,0 +1,268 @@ +package cn.bootx.visualization.core.service; + +import cn.bootx.common.core.exception.BizException; +import cn.bootx.common.core.exception.DataNotExistException; +import cn.bootx.common.core.rest.PageResult; +import cn.bootx.common.core.rest.param.PageParam; +import cn.bootx.common.mybatisplus.util.MpUtil; +import cn.bootx.starter.file.service.FileUploadService; +import cn.bootx.visualization.code.GoVIewCode; +import cn.bootx.visualization.configuration.VisualizationProperties; +import cn.bootx.visualization.core.dao.ProjectInfoManager; +import cn.bootx.visualization.core.dao.ProjectInfoPublishManager; +import cn.bootx.visualization.core.entity.ProjectInfo; +import cn.bootx.visualization.core.entity.ProjectInfoPublish; +import cn.bootx.visualization.dto.GoVIewPageResult; +import cn.bootx.visualization.dto.OssInfo; +import cn.bootx.visualization.dto.ProjectInfoDto; +import cn.bootx.visualization.dto.ProjectInfoResult; +import cn.bootx.visualization.param.CreateParam; +import cn.bootx.visualization.param.ProjectInfoParam; +import cn.bootx.visualization.param.ProjectInfoSave; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.List; +import java.util.Objects; +import java.util.stream.Collectors; + +/** + * 自定义大屏数据接口 + * @author xxm + * @date 2023/2/21 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class ProjectInfoService { + private final FileUploadService fileUploadService; + private final VisualizationProperties visualizationProperties; + + private final ProjectInfoManager projectInfoManager; + private final ProjectInfoPublishManager publishManager; + + /** + * 获取文件上传oss信息 + */ + public OssInfo getOssInfo(){ + String filePreviewUrlPrefix = fileUploadService.getFilePreviewUrlPrefix(); + return new OssInfo().setBucketURL(filePreviewUrlPrefix); + } + + + /** + * 创建项目 + */ + @Transactional(rollbackFor = Exception.class) + public ProjectInfoResult create(CreateParam param) { + ProjectInfo info = new ProjectInfo() + .setState(GoVIewCode.STATE_UN_PUBLISH) + .setEdit(false) + .setName(param.getProjectName()) + .setRemark(param.getRemark()); + projectInfoManager.save(info); + ProjectInfoPublish projectInfoPublish = new ProjectInfoPublish(); + projectInfoPublish.setId(info.getId()); + publishManager.save(projectInfoPublish); + return this.toResult(info); + } + + /** + * 获取项目列表分页 (大屏) + */ + public GoVIewPageResult> pageByGoVIew(Integer page, Integer limit){ + Page infoPage = projectInfoManager.page(new PageParam(page, limit),new ProjectInfoSave()); + GoVIewPageResult> pageResult = new GoVIewPageResult<>(); + pageResult.setCount(Math.toIntExact(infoPage.getTotal())); + List projectInfoResults = infoPage.getRecords().stream().map(this::toResult).collect(Collectors.toList()); + pageResult.setData(projectInfoResults); + return pageResult; + } + + /** + * 获取项目列表分页 (后台) + */ + public PageResult pageByAdmin(PageParam pageParam, ProjectInfoSave query){ + Page infoPage = projectInfoManager.page(pageParam,query); + return MpUtil.convert2DtoPageResult(infoPage); + } + + /** + * 查询详情(后台) + */ + public ProjectInfoDto findById(Long id) { + return projectInfoManager.findById(id).map(ProjectInfo::toDto) + .orElseThrow(DataNotExistException::new); + } + + /** + * 获取预览(已发布)数据 + */ + public ProjectInfoResult getPublishData(Long projectId) { + ProjectInfoResult projectInfoResult = projectInfoManager.findById(projectId).map(this::toResult).orElseThrow(DataNotExistException::new); + ProjectInfoPublish projectInfoPublish = publishManager.findById(projectId).orElseThrow(DataNotExistException::new); + if (StrUtil.isBlank(projectInfoPublish.getContent())){ + return null; + } + if (Objects.equals(projectInfoResult.getState(),GoVIewCode.STATE_UN_PUBLISH)){ + return null; + } + return projectInfoResult.setContent(projectInfoPublish.getContent()); + } + + /** + * 获取编辑数据 + */ + public ProjectInfoResult getEditData(Long projectId){ + ProjectInfo projectInfo = projectInfoManager.findById(projectId).orElseThrow(DataNotExistException::new); + if (StrUtil.isBlank(projectInfo.getContent())){ + return null; + } + return this.toResult(projectInfo); + } + + /** + * 更新项目数据 + */ + @SuppressWarnings("unchecked") + @Transactional(rollbackFor = Exception.class) + public void update(ProjectInfoSave param) { + ProjectInfo init = ProjectInfo.init(param); + ProjectInfo projectInfo = projectInfoManager.findById(param.getProjectId()).orElseThrow(DataNotExistException::new); + CopyOptions copyOptions = CopyOptions.create() + .ignoreNullValue() + .setIgnoreProperties(ProjectInfo::getVersion); + BeanUtil.copyProperties(init,projectInfo,copyOptions); + projectInfo.setEdit(true); + projectInfoManager.updateById(projectInfo); + } + /** + * 更新项目数据 (后台) + */ + @Transactional(rollbackFor = Exception.class) + public void updateByAdmin(ProjectInfoParam param) { + ProjectInfo projectInfo = projectInfoManager.findById(param.getId()).orElseThrow(DataNotExistException::new); + projectInfo.setName(param.getName()) + .setRemark(param.getRemark()); + projectInfoManager.updateById(projectInfo); + } + + /** + * 发布 + */ + @Transactional(rollbackFor = Exception.class) + public void publish(Long id){ + ProjectInfo projectInfo = projectInfoManager.findById(id).orElseThrow(DataNotExistException::new); + projectInfo.setState(GoVIewCode.STATE_PUBLISH) + .setEdit(false); + projectInfoManager.updateById(projectInfo); + } + + /** + * 取消发布 + */ + @Transactional(rollbackFor = Exception.class) + public void unPublish(Long id){ + ProjectInfo projectInfo = projectInfoManager.findById(id).orElseThrow(DataNotExistException::new); + projectInfo.setState(GoVIewCode.STATE_UN_PUBLISH); + projectInfoManager.updateById(projectInfo); + } + + /** + * 重置编辑数据为已发布的内容 + */ + public void reset(){ + + } + + /** + * 复制 + */ + @Transactional(rollbackFor = Exception.class) + public void copy(Long id){ + ProjectInfo projectInfo = projectInfoManager.findById(id).orElseThrow(DataNotExistException::new); + ProjectInfoPublish projectInfoPublish = publishManager.findById(id).orElseThrow(DataNotExistException::new); + ProjectInfo newProjectInfo = new ProjectInfo() + .setName(projectInfo.getName()+"复制") + .setContent(projectInfo.getContent()) + .setRemark(projectInfo.getRemark()) + .setState(projectInfo.getState()) + .setEdit(false) + .setIndexImage(projectInfo.getIndexImage()); + projectInfoManager.save(newProjectInfo); + ProjectInfoPublish newProjectInfoPublish = new ProjectInfoPublish() + .setContent(projectInfoPublish.getContent()); + newProjectInfoPublish.setId(newProjectInfo.getId()); + publishManager.save(newProjectInfoPublish); + } + + /** + * 应用编辑中的信息 + */ + @Transactional(rollbackFor = Exception.class) + public void enableEditContent(Long id){ + ProjectInfo projectInfo = projectInfoManager.findById(id).orElseThrow(DataNotExistException::new); + projectInfo.setEdit(false); + ProjectInfoPublish publish = publishManager.findById(id).orElseThrow(DataNotExistException::new); + publish.setContent(projectInfo.getContent()); + projectInfoManager.updateById(projectInfo); + publishManager.updateById(publish); + } + + /** + * 重置编辑中的信息 + */ + @Transactional(rollbackFor = Exception.class) + public void resetEditContent(Long id){ + ProjectInfo projectInfo = projectInfoManager.findById(id).orElseThrow(DataNotExistException::new); + projectInfo.setEdit(false); + ProjectInfoPublish publish = publishManager.findById(id).orElseThrow(DataNotExistException::new); + projectInfo.setContent(publish.getContent()); + projectInfoManager.updateById(projectInfo); + } + + /** + * 删除 + */ + @Transactional(rollbackFor = Exception.class) + public void delete(Long id){ + ProjectInfo projectInfo = projectInfoManager.findById(id).orElseThrow(DataNotExistException::new); + if (Objects.equals(projectInfo.getState(),GoVIewCode.STATE_PUBLISH)){ + throw new BizException("已发布的无法删除"); + } + projectInfoManager.deleteById(id); + publishManager.deleteById(id); + } + + /** + * 转换成Result + */ + private ProjectInfoResult toResult(ProjectInfo projectInfo){ + ProjectInfoResult projectInfoResult = new ProjectInfoResult() + .setId(projectInfo.getId()) + .setProjectName(projectInfo.getName()) + .setState(projectInfo.getState()) + .setContent(projectInfo.getContent()) + .setRemarks(projectInfo.getRemark()); + // 转换访问地址 + String filePreviewUrlPrefix = fileUploadService.getFilePreviewUrlPrefix(); + if (Objects.nonNull(projectInfo.getIndexImage())) { + projectInfoResult.setIndexImage(filePreviewUrlPrefix + projectInfo.getIndexImage()); + } + return projectInfoResult; + } + + /** + * GoView服务地址 + */ + public String getGoViewUrl(){ + return visualizationProperties.getGoViewUrl(); + } + +} diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/GoVIewPageResult.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/GoVIewPageResult.java new file mode 100644 index 0000000000000000000000000000000000000000..91ffcf60f628aa76034cdce1cc36563f14b928c4 --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/GoVIewPageResult.java @@ -0,0 +1,20 @@ +package cn.bootx.visualization.dto; + +import cn.bootx.common.core.rest.ResResult; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; + +/** + * GoView分页 + * @author xxm + * @date 2023/2/21 + */ +@Getter +@Setter +@ToString +public class GoVIewPageResult extends ResResult { + + /** 数据条数 */ + private int count; +} diff --git a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/match/FeaturePoint.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/OssInfo.java similarity index 30% rename from bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/match/FeaturePoint.java rename to bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/OssInfo.java index f9b71dd2386d8e7e27752574ff89e6a18ab33426..629d27203ed01fdaff74cde6539cc7ca9d41f14b 100644 --- a/bootx-services/service-sales/src/main/java/cn/bootx/sales/dto/match/FeaturePoint.java +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/OssInfo.java @@ -1,25 +1,20 @@ -package cn.bootx.sales.dto.match; +package cn.bootx.visualization.dto; import io.swagger.v3.oas.annotations.media.Schema; -import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; import lombok.experimental.Accessors; /** -* @author xxm -* @date 2021/5/18 -*/ + * 文件上传oss信息 + * @author xxm + * @date 2023/2/21 + */ @Data -@NoArgsConstructor -@AllArgsConstructor @Accessors(chain = true) -@Schema(title = "特征点") -public class FeaturePoint { +@Schema(title = "文件上传oss信息") +public class OssInfo { + private String bucketName; + /** bucket 文件访预览地址 */ + private String bucketURL; - /** 特征点类型 */ - private String type; - - /** 特征点值 */ - private String point; } diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/BrandDto.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/ProjectInfoDto.java similarity index 43% rename from bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/BrandDto.java rename to bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/ProjectInfoDto.java index 23811bdc4f5707ca0be933bf6415c12bf424dad8..88ebd3237932b658942c736f30f1dfe2245a9b2c 100644 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/dto/category/BrandDto.java +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/ProjectInfoDto.java @@ -1,4 +1,4 @@ -package cn.bootx.goods.dto.category; +package cn.bootx.visualization.dto; import cn.bootx.common.core.rest.dto.BaseDto; import io.swagger.v3.oas.annotations.media.Schema; @@ -7,23 +7,31 @@ import lombok.EqualsAndHashCode; import lombok.experimental.Accessors; /** - * 品牌 + * 项目大屏信息 * @author xxm - * @date 2022-05-09 + * @date 2023/2/24 */ @EqualsAndHashCode(callSuper = true) @Data -@Schema(title = "品牌") @Accessors(chain = true) -public class BrandDto extends BaseDto { +@Schema(description = "项目大屏信息") +public class ProjectInfoDto extends BaseDto { - @Schema(description = "品牌名称") + /** 项目名称 */ private String name; - @Schema(description = "品牌图标") - private String logo; - @Schema(description = "是否启用") - private Boolean enable; - @Schema(description = "描述") - private String remark; -} \ No newline at end of file + /** + * 发布状态 + * @see cn.bootx.visualization.code.GoVIewCode + */ + private Integer state; + + /** 是否在编辑中 */ + private Boolean edit; + + /** 预览图片id */ + private Long indexImage; + + /** 备注 */ + private String remark; +} diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/ProjectInfoResult.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/ProjectInfoResult.java new file mode 100644 index 0000000000000000000000000000000000000000..faddc7593286f49fa2680ee00a5dda3bb658f040 --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/dto/ProjectInfoResult.java @@ -0,0 +1,35 @@ +package cn.bootx.visualization.dto; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 项目大屏信息 + * @author xxm + * @date 2023/2/21 + */ +@Data +@Accessors(chain = true) +@Schema(description = "项目大屏信息") +public class ProjectInfoResult { + + @Schema(description = "主键") + private Long id; + + @Schema(description = "项目名称") + private String projectName; + + @Schema(description = "发布状态") + private Integer state; + + @Schema(description = "报表内容") + private String content; + + @Schema(description = "预览图片(会拼接成完整请求地址)") + private String indexImage; + + @Schema(description = "项目备注") + private String remarks; + +} diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/login/GoViewLoginAuthentication.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/login/GoViewLoginAuthentication.java new file mode 100644 index 0000000000000000000000000000000000000000..144bcecb76c2c276eb0582a6bc1800a0695badf1 --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/login/GoViewLoginAuthentication.java @@ -0,0 +1,38 @@ +package cn.bootx.visualization.login; + +import cn.bootx.baseapi.core.captcha.service.CaptchaService; +import cn.bootx.iam.core.auth.login.PasswordLoginHandler; +import cn.bootx.iam.core.user.service.UserAdminService; +import cn.bootx.iam.core.user.service.UserQueryService; +import cn.bootx.starter.auth.code.AuthLoginTypeCode; +import cn.bootx.starter.auth.entity.LoginAuthContext; +import cn.bootx.starter.auth.util.PasswordEncoder; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Component; + +/** + * + * @author xxm + * @date 2023/2/16 + */ +@Slf4j +@Component +public class GoViewLoginAuthentication extends PasswordLoginHandler { + + public GoViewLoginAuthentication(PasswordEncoder passwordEncoder, UserAdminService userAdminService, UserQueryService userQueryService, CaptchaService captchaService) { + super(passwordEncoder, userAdminService, userQueryService, captchaService); + } + + /** + * 获取终端编码 + */ + @Override + public String getLoginType() { + return AuthLoginTypeCode.PASSWORD_GO_VIEW; + } + + @Override + public void authenticationBefore(LoginAuthContext context) { + // 去除验证码的校验 + } +} diff --git a/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/CreateParam.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/CreateParam.java new file mode 100644 index 0000000000000000000000000000000000000000..64183a3c859095f1aaf51986f3ed59981ce9e465 --- /dev/null +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/CreateParam.java @@ -0,0 +1,21 @@ +package cn.bootx.visualization.param; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +/** + * GoView项目创建参数 + * @author xxm + * @date 2023/2/21 + */ +@Data +@Schema(description = "GoView项目创建参数") +public class CreateParam { + + @Schema(description = "项目名称") + private String projectName; + + @Schema(description = "备注") + private String remark; + +} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/BrandParam.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/ProjectInfoParam.java similarity index 38% rename from bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/BrandParam.java rename to bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/ProjectInfoParam.java index 9b85e32a7483f08f50691526291cf0bdc5aff527..2ef39b55891aa6f25ce1681d7efb203930dd81ab 100644 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/BrandParam.java +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/ProjectInfoParam.java @@ -1,28 +1,25 @@ -package cn.bootx.goods.param.category; +package cn.bootx.visualization.param; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.experimental.Accessors; /** - * 品牌 + * * @author xxm - * @date 2022-05-09 + * @date 2023/3/3 */ @Data -@Schema(title = "品牌") @Accessors(chain = true) -public class BrandParam { +@Schema(title = "GoView项目修改参数(后台 )") +public class ProjectInfoParam { - @Schema(description= "品牌主键") + @Schema(description = "主键") private Long id; - @Schema(description = "类目名称") + + @Schema(description = "项目名称") private String name; - @Schema(description = "品牌图标") - private String logo; - @Schema(description = "是否启用") - private Boolean enable; - @Schema(description = "描述") - private String remark; -} \ No newline at end of file + @Schema(description = "备注") + private String remark; +} diff --git a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/SpecificationParam.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/ProjectInfoSave.java similarity index 34% rename from bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/SpecificationParam.java rename to bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/ProjectInfoSave.java index 5ec67e28061310469954ec48fd44e2c9ed287711..432ed7cd542d093f2d79ed7e4d5ceace03538ec2 100644 --- a/bootx-services/service-goods/src/main/java/cn/bootx/goods/param/category/SpecificationParam.java +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/ProjectInfoSave.java @@ -1,32 +1,36 @@ -package cn.bootx.goods.param.category; +package cn.bootx.visualization.param; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.experimental.Accessors; -import java.util.List; +import java.util.Map; /** - * 规格 + * 大屏更新参数 * @author xxm - * @date 2022-05-09 + * @date 2023/2/21 */ @Data -@Schema(title = "规格") @Accessors(chain = true) -public class SpecificationParam { +@Schema(title = "更新参数") +public class ProjectInfoSave { - @Schema(description= "主键") - private Long id; - @Schema(description = "规格名称") + @Schema(description = "主键") + private Long projectId; + + @Schema(description = "项目名称") private String name; - @Schema(description = "类型") - private String type; - @Schema(description = "列表选择值") - private List options; + @Schema(description = "状态") - private String state; - @Schema(description = "描述") - private String remark; + private Integer state; -} \ No newline at end of file + @Schema(description = "报表内容") + private Map content; + + @Schema(description = "预览图片id") + private Long indexImage; + + @Schema(description = "备注") + private String remark; +} diff --git a/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingQueryParam.java b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/PublishParam.java similarity index 33% rename from bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingQueryParam.java rename to bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/PublishParam.java index 071fcfa3efa63ac1d7d010bd5ac2b7589e0b2a68..c6e1f5d68dbc70af793a63f7c0470f6b6669b906 100644 --- a/bootx-services/service-order/src/main/java/cn/bootx/order/param/billing/BillingQueryParam.java +++ b/bootx-services/service-visualization/src/main/java/cn/bootx/visualization/param/PublishParam.java @@ -1,22 +1,22 @@ -package cn.bootx.order.param.billing; +package cn.bootx.visualization.param; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import lombok.experimental.Accessors; -import java.io.Serializable; -import java.time.LocalDateTime; - +/** + * 发布/取消发布参数 + * @author xxm + * @date 2023/2/21 + */ @Data @Accessors(chain = true) @Schema(title = "") -public class BillingQueryParam implements Serializable { - - private static final long serialVersionUID = 8185462187197241155L; - private LocalDateTime startDate; - - private LocalDateTime endDate; +public class PublishParam { - private Long userId; + @Schema(description = "主键") + private Long id; + @Schema(description = "发布状态 -1 未发布, 1 已发布") + private Integer state; } diff --git a/bootx-services/service-visualization/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/bootx-services/service-visualization/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000000000000000000000000000000000000..6260cde58dc292cf721b6cfbdfc2f4bee7460db4 --- /dev/null +++ b/bootx-services/service-visualization/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1 @@ +cn.bootx.visualization.VisualizationApplication diff --git a/bootx-start/pom.xml b/bootx-start/pom.xml index 2e064bfa3b0c5cd75b6825937b9e4d1233e19e16..2d88bb9d1f310480acfefccee7dbb7c8f381afb0 100644 --- a/bootx-start/pom.xml +++ b/bootx-start/pom.xml @@ -5,7 +5,7 @@ cn.bootx.platform bootx-platform - 1.2.1 + 1.2.2 4.0.0 bootx-start diff --git a/bootx-start/src/main/resources/application-dev.yml b/bootx-start/src/main/resources/application-dev.yml index e77a775f0cb5e1939c9920028b8cf17dfce16c65..5fdb91f0585ef0171bc6671cc0c886a1e223535a 100644 --- a/bootx-start/src/main/resources/application-dev.yml +++ b/bootx-start/src/main/resources/application-dev.yml @@ -86,7 +86,7 @@ bootx: swagger: enabled: true author: bootx - version: 1.2.1 + version: 1.2.2 title: bootx开发平台单体版 description: bootx-platform开发平台单体版 # basic认证 @@ -103,6 +103,7 @@ bootx: - cn.bootx.starter.flowable "[支付服务]": cn.bootx.payment "[演示模块]": cn.bootx.demo + "[可视化大屏]": cn.bootx.visualization "[第三方对接]": - cn.bootx.starter.dingtalk - cn.bootx.starter.wecom @@ -143,9 +144,9 @@ bootx: # 扫描包路径, 可以用 ,和 ; 分隔 scan-package: cn.bootx.**.entity # 指定生成索引前缀 - prefix-index: actable_idx_ + prefix-index: idx_ # 指定生成唯一约束前缀 - prefix-unique: actable_uni_ + prefix-unique: uni_ starter: # 三方平台 third: @@ -211,6 +212,19 @@ bootx: local-path: /data/file mongo: bucket: fs + minio: + # 地址 + endpoint: http://127.0.0.1:9000 + # 账号 + access-key: root + # 密码 + access-secret: password + # 存储桶 需要至少三位 + bucket: bootx # 数据权限 data-perm: field-decrypt-key: "UCrtxSCwYZNCIlav" + service: + # 可视化平台 + visualization: + go-view-url: http://localhost:6000 diff --git a/bootx-start/src/main/resources/db/migration/V1.2.1_230212__release.sql b/bootx-start/src/main/resources/db/migration/V1.2.2_230303__release.sql similarity index 91% rename from bootx-start/src/main/resources/db/migration/V1.2.1_230212__release.sql rename to bootx-start/src/main/resources/db/migration/V1.2.2_230303__release.sql index e66a1ad8c0ceffa6aeb83fc16c1a06b5bf1950b8..3ba3dba131aa3140f0c4e081fc3c30ea305bc101 100644 --- a/bootx-start/src/main/resources/db/migration/V1.2.1_230212__release.sql +++ b/bootx-start/src/main/resources/db/migration/V1.2.2_230303__release.sql @@ -9,7 +9,7 @@ Target Server Version : 50735 File Encoding : 65001 - Date: 12/02/2023 15:11:59 + Date: 03/03/2023 16:59:26 */ SET NAMES utf8mb4; @@ -4034,316 +4034,6 @@ INSERT INTO `demo_super_query` VALUES (1496372489909899264, '张飞', 54, b'0', INSERT INTO `demo_super_query` VALUES (1496372766427779072, '梁冀', 38, b'1', '1958-02-08', '08:30:00', '2022-02-23 14:34:03', '1', '', 1399985191002447872, '2022-02-23 14:34:03', 1399985191002447872, '2022-02-23 14:34:03', 0, 0); INSERT INTO `demo_super_query` VALUES (1496373512871284736, '刘备', 108, b'0', '1993-11-12', '09:30:10', '2022-02-23 14:37:01', '2', '刘羽禅的粑粑', 1399985191002447872, '2022-02-23 14:37:01', 1399985191002447872, '2022-02-23 14:37:01', 0, 0); --- ---------------------------- --- Table structure for goods_brand --- ---------------------------- -DROP TABLE IF EXISTS `goods_brand`; -CREATE TABLE `goods_brand` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌名称', - `logo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '品牌图标', - `enable` bit(1) NULL DEFAULT NULL COMMENT '是否启用', - `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '品牌' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_brand --- ---------------------------- -INSERT INTO `goods_brand` VALUES (1524046765181800448, '鸭鸭', '', NULL, '', 1399985191002447872, '2022-05-10 23:20:39', 1399985191002447872, '2022-05-10 23:20:39', 0, 0); -INSERT INTO `goods_brand` VALUES (1525092807788691456, '微信', '', b'1', '', 1399985191002447872, '2022-05-13 20:37:15', 1399985191002447872, '2022-05-13 20:37:15', 0, 0); -INSERT INTO `goods_brand` VALUES (1525092835118776320, '舜泰', '', b'1', '', 1399985191002447872, '2022-05-13 20:37:21', 1399985191002447872, '2022-05-13 20:37:21', 0, 0); -INSERT INTO `goods_brand` VALUES (1525092854139944960, '绿城', '', b'1', '', 1399985191002447872, '2022-05-13 20:37:26', 1399985191002447872, '2022-05-13 20:37:26', 0, 0); - --- ---------------------------- --- Table structure for goods_category --- ---------------------------- -DROP TABLE IF EXISTS `goods_category`; -CREATE TABLE `goods_category` ( - `id` bigint(20) NOT NULL, - `pid` bigint(20) NULL DEFAULT NULL COMMENT '上级类目id', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类目名称', - `image` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标/图片地址', - `enable` bit(1) NOT NULL COMMENT '是否启用', - `sort_no` double(8, 2) NULL DEFAULT NULL COMMENT '排序', - `level` int(5) NULL DEFAULT NULL COMMENT '层级', - `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_category --- ---------------------------- - --- ---------------------------- --- Table structure for goods_category_brand --- ---------------------------- -DROP TABLE IF EXISTS `goods_category_brand`; -CREATE TABLE `goods_category_brand` ( - `id` bigint(20) NOT NULL, - `category_id` bigint(20) NOT NULL COMMENT '分类id', - `brand_id` bigint(20) NOT NULL COMMENT '品牌id', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目品牌关联' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_category_brand --- ---------------------------- - --- ---------------------------- --- Table structure for goods_category_parameter --- ---------------------------- -DROP TABLE IF EXISTS `goods_category_parameter`; -CREATE TABLE `goods_category_parameter` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '品牌名称', - `type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '类型', - `options` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '选择值(列表)', - `required` bit(1) NULL DEFAULT NULL COMMENT '是否必填', - `sort_no` double(8, 2) NULL DEFAULT NULL COMMENT '排序', - `group_id` bigint(20) NULL DEFAULT NULL COMMENT '参数组id', - `category_id` bigint(20) NULL DEFAULT NULL COMMENT '类目id', - `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目参数' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_category_parameter --- ---------------------------- - --- ---------------------------- --- Table structure for goods_category_parameter_group --- ---------------------------- -DROP TABLE IF EXISTS `goods_category_parameter_group`; -CREATE TABLE `goods_category_parameter_group` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', - `sort_no` double(8, 2) NULL DEFAULT NULL COMMENT '排序', - `category_id` bigint(20) NULL DEFAULT NULL COMMENT '类目id', - `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目参数组' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_category_parameter_group --- ---------------------------- - --- ---------------------------- --- Table structure for goods_category_specification --- ---------------------------- -DROP TABLE IF EXISTS `goods_category_specification`; -CREATE TABLE `goods_category_specification` ( - `id` bigint(20) NOT NULL, - `category_id` bigint(20) NOT NULL COMMENT '分类id', - `specification_id` bigint(20) NOT NULL COMMENT '规格id', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '类目规格关联' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_category_specification --- ---------------------------- -INSERT INTO `goods_category_specification` VALUES (1525131071690076160, 1523994966466924544, 1524258633343254528); -INSERT INTO `goods_category_specification` VALUES (1525131071694270464, 1523994966466924544, 1524360756764590080); - --- ---------------------------- --- Table structure for goods_goods --- ---------------------------- -DROP TABLE IF EXISTS `goods_goods`; -CREATE TABLE `goods_goods` ( - `id` bigint(20) NOT NULL, - `cid` bigint(20) NULL DEFAULT NULL COMMENT '类目id', - `cname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类目名称', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编码', - `packing` bit(1) NOT NULL COMMENT '是否是打包品', - `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `addition` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数', - `state` int(11) NOT NULL COMMENT '状态', - `banner_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `display_price` decimal(19, 2) NULL DEFAULT NULL, - `goods_type` int(11) NULL DEFAULT NULL, - `main_uri` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `sale_off_time` datetime(6) NULL DEFAULT NULL, - `sale_on_time` datetime(6) NULL DEFAULT NULL, - `sale_state` int(11) NULL DEFAULT NULL, - `shop_id` bigint(20) NULL DEFAULT NULL, - `attr_def_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `attr_value_displays` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `attr_values` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `display_lower_price` decimal(19, 2) NULL DEFAULT NULL, - `display_upper_price` decimal(19, 2) NULL DEFAULT NULL, - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - `out_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品spu' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_goods --- ---------------------------- - --- ---------------------------- --- Table structure for goods_goods_packing --- ---------------------------- -DROP TABLE IF EXISTS `goods_goods_packing`; -CREATE TABLE `goods_goods_packing` ( - `id` bigint(20) NOT NULL, - `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '打包品', - `packed_goods_id` bigint(20) NULL DEFAULT NULL COMMENT '被打包品', - `create_time` datetime(6) NULL DEFAULT NULL, - `creator` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品打包关系' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_goods_packing --- ---------------------------- - --- ---------------------------- --- Table structure for goods_goods_sku --- ---------------------------- -DROP TABLE IF EXISTS `goods_goods_sku`; -CREATE TABLE `goods_goods_sku` ( - `id` bigint(20) NOT NULL, - `cid` bigint(20) NULL DEFAULT NULL COMMENT '所属类目id', - `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '所属商品 id', - `shop_id` bigint(20) NULL DEFAULT NULL COMMENT '所属商户', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '外部编码', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'SKU 名称', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `packing` bit(1) NOT NULL COMMENT '是否打包品', - `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加信息', - `business_id` bigint(20) NULL DEFAULT NULL COMMENT '业务id', - `attr_def_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '生成此商品 SKU 的属性定义的 id 拼接串', - `attr_values` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性值id拼接串', - `attr_value_displays` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '示值拼接串', - `is_unlimited` bit(1) NOT NULL COMMENT '是否无限库存', - `capacity` int(11) NOT NULL COMMENT '初始库存', - `locked` int(11) NOT NULL COMMENT '预占库存', - `sold` int(11) NOT NULL COMMENT '已用库存', - `available` int(11) NOT NULL COMMENT '可用库存', - `sale_state` int(11) NULL DEFAULT NULL COMMENT '销售状态', - `sale_off_time` datetime(6) NULL DEFAULT NULL COMMENT '上架时间', - `sale_on_time` datetime(6) NULL DEFAULT NULL COMMENT '下架时间', - `price` decimal(19, 2) NULL DEFAULT NULL COMMENT '价格', - `state` int(11) NOT NULL COMMENT '状态', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NULL DEFAULT NULL, - `out_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '商品sku' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_goods_sku --- ---------------------------- - --- ---------------------------- --- Table structure for goods_goods_sku_attr --- ---------------------------- -DROP TABLE IF EXISTS `goods_goods_sku_attr`; -CREATE TABLE `goods_goods_sku_attr` ( - `id` bigint(20) NOT NULL, - `cid` bigint(20) NULL DEFAULT NULL COMMENT '类目 id', - `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '商品 id', - `sku_id` bigint(20) NULL DEFAULT NULL COMMENT 'SKU id', - `attr_def_id` bigint(20) NULL DEFAULT NULL COMMENT '属性定义 id', - `attr_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '属性值', - `attr_value_display` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '显示值', - `tid` bigint(20) NOT NULL, - `attr_values_display` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - `attr_value_displays` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sku属性' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_goods_sku_attr --- ---------------------------- - --- ---------------------------- --- Table structure for goods_goods_sku_packing --- ---------------------------- -DROP TABLE IF EXISTS `goods_goods_sku_packing`; -CREATE TABLE `goods_goods_sku_packing` ( - `id` bigint(20) NOT NULL, - `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '打包品', - `packed_goods_id` bigint(20) NULL DEFAULT NULL COMMENT '被打包品', - `goods_sku_id` bigint(20) NULL DEFAULT NULL COMMENT '打包SKU', - `packed_sku_id` bigint(20) NULL DEFAULT NULL COMMENT '被打包SKU', - `create_time` datetime(6) NULL DEFAULT NULL, - `creator` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = 'sku打包关系' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_goods_sku_packing --- ---------------------------- - --- ---------------------------- --- Table structure for goods_specification --- ---------------------------- -DROP TABLE IF EXISTS `goods_specification`; -CREATE TABLE `goods_specification` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格名称', - `type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '类型', - `options` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规格列表值', - `state` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '状态', - `remark` varchar(300) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建人', - `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', - `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修改人', - `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', - `version` int(11) NOT NULL COMMENT '版本', - `deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '0:未删除。1:已删除', - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '规格' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of goods_specification --- ---------------------------- - -- ---------------------------- -- Table structure for iam_client -- ---------------------------- @@ -4371,6 +4061,7 @@ CREATE TABLE `iam_client` ( INSERT INTO `iam_client` VALUES (1430430071299207168, 'admin', 'pc管理端', b'1', b'1', '1430430071299207168,1435138582839009280,1430478946919653376,1542091599907115008,1542804450312122368,1543126042909016064', 'pc浏览器', 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-07-02 14:55:11', 4, 0); INSERT INTO `iam_client` VALUES (1430430071299207169, 'h5', 'h5端', b'1', b'1', '1430430071299207168,1435138582839009280', '手机wap', 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-06-29 18:31:45', 1, 0); INSERT INTO `iam_client` VALUES (1580487061605175296, 'adminv3', 'pc管理端(vue3版)', b'0', b'1', '1430430071299207168,1430478946919653376,1435138582839009280,1542091599907115008,1542804450312122368,1543126042909016064', 'vue3版本', 1399985191002447872, '2022-10-13 17:14:14', 1399985191002447872, '2022-10-13 17:14:25', 1, 0); +INSERT INTO `iam_client` VALUES (1626840094767714304, 'GoView', '可视化平台', b'0', b'1', '1430430071299207168', '', 1414143554414059520, '2023-02-18 15:04:38', 1414143554414059520, '2023-02-18 15:04:38', 0, 0); -- ---------------------------- -- Table structure for iam_data_scope @@ -4509,12 +4200,13 @@ CREATE TABLE `iam_login_type` ( -- ---------------------------- -- Records of iam_login_type -- ---------------------------- -INSERT INTO `iam_login_type` VALUES (1430430071299207168, 'password', '账号密码登陆', 'password', b'1', 3600, b'1', -1, b'1', NULL, 1399985191002447872, '2021-08-25 15:21:20', 1414143554414059520, '2022-11-02 21:32:48', 19, 0); +INSERT INTO `iam_login_type` VALUES (1430430071299207168, 'password', '账号密码登陆', 'password', b'1', 3600, b'0', -1, b'1', NULL, 1399985191002447872, '2021-08-25 15:21:20', 1399985191002447872, '2022-11-03 22:24:53', 20, 0); INSERT INTO `iam_login_type` VALUES (1430478946919653376, 'miniApp', '微信小程序', 'openId', b'0', 99999, b'0', 0, b'1', NULL, 1399985191002447872, '2021-08-25 18:35:33', 1399985191002447872, '2022-07-16 12:32:26', 3, 0); INSERT INTO `iam_login_type` VALUES (1435138582839009280, 'phone', '手机短信登录', 'openId', b'0', 3600, b'0', 0, b'1', NULL, 1399985191002447872, '2021-09-07 15:11:16', 1399985191002447872, '2022-07-16 12:32:19', 5, 0); INSERT INTO `iam_login_type` VALUES (1542091599907115008, 'dingTalk', '钉钉', 'openId', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-06-29 18:24:23', 1399985191002447872, '2022-07-02 14:55:01', 5, 0); INSERT INTO `iam_login_type` VALUES (1542804450312122368, 'weCom', '企业微信', 'openId', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-07-01 17:37:00', 1399985191002447872, '2022-07-01 17:37:00', 0, 0); INSERT INTO `iam_login_type` VALUES (1543126042909016064, 'weChat', '微信登录', 'openId', b'0', 5, b'0', -1, b'1', '', 1399985191002447872, '2022-07-02 14:54:53', 0, '2022-10-12 22:15:05', 2, 0); +INSERT INTO `iam_login_type` VALUES (1626845524617203712, 'passwordGoView', '可视化平台登录', 'password', b'0', 3600, b'0', -1, b'1', '', 1414143554414059520, '2023-02-18 15:26:13', 1414143554414059520, '2023-02-18 15:26:13', 0, 0); -- ---------------------------- -- Table structure for iam_perm_menu @@ -4749,8 +4441,10 @@ INSERT INTO `iam_perm_menu` VALUES (1617847653746315264, 'adminv3', 159710279937 INSERT INTO `iam_perm_menu` VALUES (1617847747375763456, 'adminv3', 1597102799370317824, '数据脱敏', 'DataSensitiveDemoList', NULL, b'0', '', b'0', b'0', '/modules/demo/data/sensitive/DataSensitiveDemoList.vue', NULL, '/demo/data/sensitive', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-01-24 19:32:16', 1414143554414059520, '2023-01-24 20:06:58', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1621150743447965696, 'admin', 1495968302034210816, '省市区联动', 'ChinaRegionDemo', NULL, b'0', '', b'0', b'0', 'demo/chinaregion/ChinaRegionDemo', NULL, '/demo/chinaregion', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2023-02-02 22:17:11', 1399985191002447872, '2023-02-08 09:43:39', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1623156857846034432, 'adminv3', 1582276516905177088, '省市区联动', 'ChinaRegionDemo', NULL, b'0', '', b'0', b'0', '/modules/demo/chinaregion/ChinaRegionDemo', NULL, '/demo/chinaregion', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-02-08 11:08:46', 1414143554414059520, '2023-02-08 11:08:46', 0, 0); -INSERT INTO `iam_perm_menu` VALUES (1623325795944439808, 'adminv3', 1599378992811429888, '邮件通知', '', NULL, b'0', '', b'0', b'0', '', NULL, '/demo/notice', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-02-08 22:20:04', 1414143554414059520, '2023-02-08 22:20:04', 0, 0); +INSERT INTO `iam_perm_menu` VALUES (1623325795944439808, 'adminv3', 1599378992811429888, '邮件通知', 'EmailSenderDemo', NULL, b'0', '', b'0', b'0', '/modules/demo/notice/email/EmailSenderDemo.vue', NULL, '/demo/notice/email', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-02-08 22:20:04', 1414143554414059520, '2023-02-20 10:38:55', 1, 0); INSERT INTO `iam_perm_menu` VALUES (1623494586215579648, 'admin', 1552207982510706688, '行政区划', 'ChinaRegion', NULL, b'0', '', b'1', b'0', 'develop/region/ChinaRegionList', NULL, '/develop/region', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2023-02-09 09:30:47', 1399985191002447872, '2023-02-09 17:50:05', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1629039360928075776, 'adminv3', 1582276341792985088, '可视化大屏', 'ProjectInfoList', NULL, b'0', '', b'0', b'0', '/modules/develop/report/ProjectInfoList', NULL, '/develop/report', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1414143554414059520, '2023-02-24 16:43:44', 1414143554414059520, '2023-02-24 16:44:17', 1, 0); +INSERT INTO `iam_perm_menu` VALUES (1631946120891707392, 'admin', 1552207982510706688, '可视化大屏', 'ProjectInfoList', NULL, b'0', '', b'0', b'0', 'develop/report/ProjectInfoList', NULL, '/develop/report', '', 0, 1, NULL, b'1', b'0', b'0', b'0', NULL, 1399985191002447872, '2023-03-04 17:14:10', 1399985191002447872, '2023-03-04 17:14:10', 0, 0); -- ---------------------------- -- Table structure for iam_perm_path @@ -4940,8 +4634,8 @@ CREATE TABLE `iam_user_info` ( -- ---------------------------- -- Records of iam_user_info -- ---------------------------- -INSERT INTO `iam_user_info` VALUES (1399985191002447872, '小小明', 'xxm', 'f52020dca765fd3943ed40a615dc2c5c', '13333333333', 'xxm1995@outlook.com', '1430430071299207168,1430430071299207169', NULL, NULL, b'1', '2021-06-02 15:04:12', 1, 1, '2021-06-02 15:04:15', 1399985191002447872, '2022-06-27 23:09:31', 50, 0); -INSERT INTO `iam_user_info` VALUES (1414143554414059520, '小小明1995', 'xxm1995', 'f52020dca765fd3943ed40a615dc2c5c', '13000000000', 'xxm1995@foxmail.com', NULL, NULL, NULL, b'1', '2021-07-11 16:44:31', 1, 1, '2021-07-11 16:44:32', 1414143554414059520, '2022-10-31 13:30:07', 5, 0); +INSERT INTO `iam_user_info` VALUES (1399985191002447872, '小小明', 'xxm', 'f52020dca765fd3943ed40a615dc2c5c', '133****3333', 'x******@outlook.com', '1430430071299207168,1430430071299207169,1626840094767714304,1580487061605175296', NULL, NULL, b'1', '2021-06-02 15:04:12', 1, 1, '2021-06-02 15:04:15', 1414143554414059520, '2023-02-18 15:08:42', 55, 0); +INSERT INTO `iam_user_info` VALUES (1414143554414059520, '小小明1995', 'xxm1995', 'f52020dca765fd3943ed40a615dc2c5c', '130****0000', 'x******@foxmail.com', '1430430071299207168,1580487061605175296,1430430071299207169,1626840094767714304', NULL, NULL, b'1', '2021-07-11 16:44:31', 1, 1, '2021-07-11 16:44:32', 1414143554414059520, '2023-02-18 15:08:48', 9, 0); INSERT INTO `iam_user_info` VALUES (1435894470432456704, '管理员', 'admin', 'f52020dca765fd3943ed40a615dc2c5c', '13000001111', 'admin@qq.com', '1430430071299207168', '', NULL, b'0', '2021-09-09 17:14:52', 1, 1399985191002447872, '2021-09-09 17:14:54', 1399985191002447872, '2022-09-16 16:41:51', 7, 0); INSERT INTO `iam_user_info` VALUES (1435967884114194432, '测试', 'test', 'f52020dca765fd3943ed40a615dc2c5c', '13311111111', 'test@qq.com', '1430430071299207168', '', NULL, b'0', '2021-09-09 22:06:37', 1, 1414143554414059520, '2021-09-09 22:06:37', 1399985191002447872, '2022-05-31 15:59:37', 9, 0); INSERT INTO `iam_user_info` VALUES (1477990832987361280, '测试用户001', 'test001', 'f52020dca765fd3943ed40a615dc2c5c', '', '', '1430430071299207168', '', NULL, b'0', '2022-01-03 21:10:49', 1, 1399985191002447872, '2022-01-03 21:10:49', 1399985191002447872, '2022-06-05 20:26:26', 1, 0); @@ -5196,166 +4890,6 @@ CREATE TABLE `notice_wechat_config` ( -- ---------------------------- INSERT INTO `notice_wechat_config` VALUES (181361815405135421, 0, 'test01', 'test01', 'ww9d6247559117d202', '8n6A3SzN-DJNkw8wyCcJnr8-SOjFFWSOlBqZN8vypKM', 1, 1415, '2018-11-20 11:07:07', 1415, '2018-11-20 11:07:07', 0, 0); --- ---------------------------- --- Table structure for order_order --- ---------------------------- -DROP TABLE IF EXISTS `order_order`; -CREATE TABLE `order_order` ( - `id` bigint(20) NOT NULL, - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '编码', - `contact_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系人', - `contact_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '手机号', - `contact_email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '联系邮箱', - `channel_id` bigint(20) NULL DEFAULT NULL COMMENT '渠道', - `pay_time` datetime(6) NULL DEFAULT NULL COMMENT '支付时间', - `user_id` bigint(20) NULL DEFAULT NULL COMMENT '购买用户id', - `status` int(11) NOT NULL COMMENT '状态', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `type` int(11) NULL DEFAULT NULL COMMENT '类型', - `total_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '总金额', - `pay_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '实付金额', - `coupon_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '所用优惠券ids', - `address_info` json NULL COMMENT '地址参数', - `invoice_info` json NULL COMMENT '发票参数', - `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数', - `device_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '设备id', - `source` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '来源', - `business_id` bigint(20) NULL DEFAULT NULL COMMENT '业务id', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of order_order --- ---------------------------- - --- ---------------------------- --- Table structure for order_order_billing --- ---------------------------- -DROP TABLE IF EXISTS `order_order_billing`; -CREATE TABLE `order_order_billing` ( - `id` bigint(20) NOT NULL, - `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', - `channel_id` bigint(20) NULL DEFAULT NULL COMMENT '渠道id', - `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', - `pay_type` int(11) NOT NULL COMMENT '交易目的', - `transaction_purpose` int(11) NOT NULL COMMENT '交易类型', - `transaction_type` int(11) NOT NULL COMMENT '支付类型', - `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '金额', - `count` int(11) NULL DEFAULT NULL COMMENT '交易数量', - `business_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '业务id', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单账单' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of order_order_billing --- ---------------------------- - --- ---------------------------- --- Table structure for order_order_detail --- ---------------------------- -DROP TABLE IF EXISTS `order_order_detail`; -CREATE TABLE `order_order_detail` ( - `id` bigint(20) NOT NULL, - `active_id` bigint(20) NULL DEFAULT NULL COMMENT '活动id', - `shop_id` bigint(20) NULL DEFAULT NULL COMMENT '店铺id', - `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', - `category_id` bigint(20) NULL DEFAULT NULL COMMENT '类目id', - `goods_id` bigint(20) NULL DEFAULT NULL COMMENT '商品id', - `sku_id` bigint(20) NULL DEFAULT NULL COMMENT '库存id', - `goods_title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '商品名称', - `goods_price` decimal(19, 2) NULL DEFAULT NULL COMMENT '商品价格', - `num` int(11) NOT NULL COMMENT '数量', - `total_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '总价', - `pay_amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '支付价', - `state` int(11) NULL DEFAULT NULL COMMENT '状态', - `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单明细' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of order_order_detail --- ---------------------------- - --- ---------------------------- --- Table structure for order_order_item_billing --- ---------------------------- -DROP TABLE IF EXISTS `order_order_item_billing`; -CREATE TABLE `order_order_item_billing` ( - `id` bigint(20) NOT NULL, - `order_billing_id` bigint(20) NULL DEFAULT NULL COMMENT '账单id', - `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', - `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', - `order_item_id` bigint(20) NULL DEFAULT NULL COMMENT '订单项id', - `sku_id` bigint(20) NULL DEFAULT NULL COMMENT '订单项目skuId', - `transaction_purpose` int(11) NOT NULL COMMENT '交易目的', - `transaction_type` int(11) NOT NULL COMMENT '交易类型(名目)', - `pay_type` int(11) NOT NULL COMMENT '支付类型', - `amount` decimal(19, 2) NULL DEFAULT NULL COMMENT '支付金额', - `count` int(11) NULL DEFAULT NULL COMMENT '使用数量', - `bookkeeping_time` bigint(20) NULL DEFAULT NULL COMMENT '入账时间', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NOT NULL, - `business_type` int(11) NULL DEFAULT NULL, - `source_item_billing_id` bigint(20) NULL DEFAULT NULL, - `source_order_item_id` bigint(20) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单明细账单' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of order_order_item_billing --- ---------------------------- - --- ---------------------------- --- Table structure for order_order_strategy_mapping --- ---------------------------- -DROP TABLE IF EXISTS `order_order_strategy_mapping`; -CREATE TABLE `order_order_strategy_mapping` ( - `id` bigint(20) NOT NULL, - `order_id` bigint(20) NULL DEFAULT NULL COMMENT '订单id', - `order_detail_id` bigint(20) NULL DEFAULT NULL COMMENT '明细id', - `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略ID', - `strategy_type` int(11) NULL DEFAULT NULL COMMENT '策略类型(普通/优惠券ID)', - `strategy_register_id` bigint(20) NULL DEFAULT NULL COMMENT '策略注册ID', - `price_change` decimal(19, 2) NULL DEFAULT NULL COMMENT '价格变动', - `desc` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注信息', - `coupon_id` bigint(20) NULL DEFAULT NULL, - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '订单策略映射' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of order_order_strategy_mapping --- ---------------------------- - -- ---------------------------- -- Table structure for pay_ali_payment -- ---------------------------- @@ -6034,276 +5568,48 @@ CREATE TABLE `qrtz_triggers` ( INSERT INTO `qrtz_triggers` VALUES ('quartzScheduler', '1546857070483939328', 'DEFAULT', '1546857070483939328', 'DEFAULT', NULL, 1663741925000, 1663741920000, 5, 'ACQUIRED', 'CRON', 1657634445000, 0, NULL, 0, ''); -- ---------------------------- --- Table structure for sales_activity --- ---------------------------- -DROP TABLE IF EXISTS `sales_activity`; -CREATE TABLE `sales_activity` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT 'name', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `strategy_id` bigint(255) NULL DEFAULT NULL COMMENT '策略id', - `strategy_register_id` bigint(20) NOT NULL COMMENT '策略注册id', - `activity_mutual` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '活动互斥', - `start_time` datetime(6) NOT NULL COMMENT '有效开始时间', - `end_time` datetime(6) NOT NULL COMMENT '有效结束时间', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠活动' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_activity --- ---------------------------- -INSERT INTO `sales_activity` VALUES (1394892920481533952, '100-16', '100-16活动策略2', NULL, 1394892919403597824, '', '2021-05-18 17:43:59.000000', '2021-07-01 17:44:02.000000', 1, '2021-05-19 13:49:22.757000', 1, '2021-05-19 13:49:22.757000', 0, b'0'); -INSERT INTO `sales_activity` VALUES (1394918400265965568, '100-5', '100-5活动策略3', NULL, 1394918398827319296, '', '2021-05-18 17:43:59.000000', '2021-07-01 17:44:02.000000', 1, '2021-05-19 15:30:37.611000', 1, '2021-05-19 15:30:37.611000', 0, b'0'); -INSERT INTO `sales_activity` VALUES (1395308738893729792, '50-20', '50-20活动策略3', 1382517531398524928, 1395308573587820544, '', '2021-05-18 17:43:59.000000', '2021-07-01 17:44:02.000000', 1, '2021-05-20 17:21:41.592000', 1, '2021-05-20 17:21:41.592000', 0, b'0'); - --- ---------------------------- --- Table structure for sales_check_rule --- ---------------------------- -DROP TABLE IF EXISTS `sales_check_rule`; -CREATE TABLE `sales_check_rule` ( - `id` bigint(20) NOT NULL, - `strategy_register_id` bigint(20) NOT NULL COMMENT '关联策略注册id', - `register_type` int(6) NOT NULL COMMENT '策略类型 策略/优惠券', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则名称', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则code', - `rule_type` int(11) NOT NULL COMMENT '规则类型', - `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '对应策略id', - `addition` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '附加对象 json', - `priority` int(11) NULL DEFAULT NULL COMMENT '优先级', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '检查规则' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_check_rule +-- Table structure for report_project_info -- ---------------------------- - --- ---------------------------- --- Table structure for sales_coupon --- ---------------------------- -DROP TABLE IF EXISTS `sales_coupon`; -CREATE TABLE `sales_coupon` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `template_id` bigint(20) NULL DEFAULT NULL COMMENT '模板id', - `strategy_register_id` bigint(20) NULL DEFAULT NULL COMMENT '策略注册id', - `start_time` datetime(6) NULL DEFAULT NULL COMMENT '有效开始时间', - `end_time` datetime(6) NULL DEFAULT NULL COMMENT '有效结束时间', - `status` int(6) NOT NULL COMMENT '状态', - `obtain_time` datetime(6) NULL DEFAULT NULL COMMENT '领取时间', - `used_time` datetime(6) NULL DEFAULT NULL COMMENT '使用时间', - `order_id` bigint(20) NULL DEFAULT NULL COMMENT '所用订单Id', - `user_id` bigint(20) NULL DEFAULT NULL COMMENT '用户id', - `creator` bigint(20) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠券' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_coupon --- ---------------------------- - --- ---------------------------- --- Table structure for sales_coupon_template --- ---------------------------- -DROP TABLE IF EXISTS `sales_coupon_template`; -CREATE TABLE `sales_coupon_template` ( - `id` bigint(20) NOT NULL, - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', - `strategy_register_id` bigint(20) NOT NULL COMMENT '策略注册id', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `num` int(11) NOT NULL COMMENT '数量', - `channel_ids` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '渠道', - `activity_mutual` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '活动互斥', - `coupon_mutual` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '优惠券互斥', - `effective_type` int(8) NOT NULL COMMENT '有效类型', - `time_type` int(8) NULL DEFAULT NULL COMMENT '时间类型', - `effective_time` bigint(20) NULL DEFAULT NULL COMMENT '有效时间', - `start_time` datetime(6) NULL DEFAULT NULL COMMENT '开始时间', - `end_time` datetime(6) NULL DEFAULT NULL COMMENT '结束时间', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '优惠券模板' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_coupon_template --- ---------------------------- -INSERT INTO `sales_coupon_template` VALUES (1395284918623424512, '100-33', 1395284918430486528, '100-33优惠券', 999, NULL, '', '', 0, 1, NULL, NULL, NULL, 1, '2021-05-20 15:47:02.397000', 1, '2021-05-20 15:58:10.795000', 1, b'0'); -INSERT INTO `sales_coupon_template` VALUES (1395320423364841472, '100-33', 1395320422941216768, '100-33优惠券', 988, NULL, '', '', 0, 1, NULL, NULL, NULL, 1, '2021-05-20 18:08:07.387000', 1, '2021-05-20 18:28:33.743000', 12, b'0'); - --- ---------------------------- --- Table structure for sales_match_rule --- ---------------------------- -DROP TABLE IF EXISTS `sales_match_rule`; -CREATE TABLE `sales_match_rule` ( - `id` bigint(20) NOT NULL, - `strategy_register_id` bigint(20) NOT NULL COMMENT '关联策略注册id', - `register_type` int(6) NOT NULL COMMENT '策略类型 策略/优惠券', - `feature_type` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '特征类型(sku/spu/shop)', - `feature_point` varchar(55) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '特征点', - `match_type` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '匹配类型', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '匹配检查' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_match_rule --- ---------------------------- - --- ---------------------------- --- Table structure for sales_strategy --- ---------------------------- -DROP TABLE IF EXISTS `sales_strategy`; -CREATE TABLE `sales_strategy` ( - `id` bigint(20) NOT NULL, - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '唯一编码', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '名称', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `engine_type` int(1) NOT NULL COMMENT '引擎类型, java/js/groovy', - `target_type` int(11) NOT NULL COMMENT '目标类型', - `rule_script` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '规则脚本', - `show` int(1) NULL DEFAULT NULL COMMENT '是否展示 0不展示,1展示(default)', - `state` int(1) NOT NULL COMMENT '0 可用 1 不可用', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - `tid` bigint(20) NULL DEFAULT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_strategy --- ---------------------------- -INSERT INTO `sales_strategy` VALUES (1382516141636866048, 'instantReduction', '立减策略', '立减指定的金额', 1, 1, NULL, 1, 1, 1, '2021-04-15 10:08:28.720000', 1, '2021-04-15 10:08:28.720000', 0, b'0', 10011); -INSERT INTO `sales_strategy` VALUES (1382517531398524928, 'fullReduction', '满减策略', '满减策略', 1, 1, NULL, 1, 1, 1, '2021-04-15 10:14:00.075000', 1, '2021-04-15 10:14:00.075000', 0, b'0', 10011); -INSERT INTO `sales_strategy` VALUES (1394909889247203328, 'channelCheck', '渠道检查', '渠道检查', 1, 2, NULL, 1, 1, 1, '2021-05-19 14:56:48.426000', 1, '2021-05-19 14:56:48.426000', 0, b'0', 10011); -INSERT INTO `sales_strategy` VALUES (1395320340615417856, 'obtainMultiple', '多张领取检查', '多张领取检查', 1, 3, '', NULL, 1, 1, '2021-05-20 18:07:47.642000', 1, '2021-05-20 18:07:47.642000', 0, b'0', 10011); - --- ---------------------------- --- Table structure for sales_strategy_check_rule --- ---------------------------- -DROP TABLE IF EXISTS `sales_strategy_check_rule`; -CREATE TABLE `sales_strategy_check_rule` ( - `id` bigint(20) NOT NULL, - `register_id` bigint(20) NULL DEFAULT NULL COMMENT '模板id', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则名称', - `code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '规则code', - `type` int(11) NOT NULL COMMENT '类型', - `addition` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '附加参数 json', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NULL DEFAULT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略规则检查' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_strategy_check_rule --- ---------------------------- - --- ---------------------------- --- Table structure for sales_strategy_config --- ---------------------------- -DROP TABLE IF EXISTS `sales_strategy_config`; -CREATE TABLE `sales_strategy_config` ( - `id` bigint(20) NOT NULL, - `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略id', - `type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数类型', - `key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '方法参数名', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数名称', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, - PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略参数定义' ROW_FORMAT = DYNAMIC; - --- ---------------------------- --- Records of sales_strategy_config --- ---------------------------- -INSERT INTO `sales_strategy_config` VALUES (1382517531788595199, 1382516141636866048, 'BigDecimal', 'amount', '立减金额', '立减金额', 1, '2021-04-15 10:08:28.873000', 1, '2021-04-15 10:08:28.873000', 0, b'0'); -INSERT INTO `sales_strategy_config` VALUES (1382517531788595200, 1382517531398524928, 'BigDecimal', 'satisfy', '满多少', '配置满多少的字段', 1, '2021-04-15 10:14:00.169000', 1, '2021-04-15 10:14:00.169000', 0, b'0'); -INSERT INTO `sales_strategy_config` VALUES (1382517531788595201, 1382517531398524928, 'BigDecimal', 'minus', '减多少', '配置减多少的字段', 1, '2021-04-15 10:14:00.169000', 1, '2021-04-15 10:14:00.169000', 0, b'0'); - --- ---------------------------- --- Table structure for sales_strategy_config_value --- ---------------------------- -DROP TABLE IF EXISTS `sales_strategy_config_value`; -CREATE TABLE `sales_strategy_config_value` ( - `id` bigint(20) NOT NULL, - `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略id', - `strategy_register_id` bigint(20) NULL DEFAULT NULL COMMENT '策略注册id', - `strategy_config_id` bigint(20) NULL DEFAULT NULL COMMENT '策略定义id', - `key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '策略参数key', - `value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '参数值', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, +DROP TABLE IF EXISTS `report_project_info`; +CREATE TABLE `report_project_info` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '项目名称', + `state` int(11) NULL DEFAULT NULL COMMENT '发布状态', + `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '报表内容', + `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建者ID', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修者ID', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '乐观锁', + `deleted` bit(1) NOT NULL COMMENT '删除标志', + `index_image` bigint(20) NULL DEFAULT NULL COMMENT '预览图片id', + `edit` bit(1) NULL DEFAULT NULL COMMENT '是否在编辑中', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略配置参数' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义大屏信息' ROW_FORMAT = DYNAMIC; -- ---------------------------- --- Records of sales_strategy_config_value +-- Records of report_project_info -- ---------------------------- -- ---------------------------- --- Table structure for sales_strategy_register +-- Table structure for report_project_info_publish -- ---------------------------- -DROP TABLE IF EXISTS `sales_strategy_register`; -CREATE TABLE `sales_strategy_register` ( - `id` bigint(20) NOT NULL, - `strategy_id` bigint(20) NULL DEFAULT NULL COMMENT '策略id', - `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '策略注册名称', - `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '描述', - `strategy_type` int(11) NULL DEFAULT NULL COMMENT '策略类型(1活动/2优惠券)', - `creator` bigint(20) NULL DEFAULT NULL, - `create_time` datetime(6) NULL DEFAULT NULL, - `last_modifier` bigint(20) NULL DEFAULT NULL, - `last_modified_time` datetime(6) NULL DEFAULT NULL, - `version` int(11) NOT NULL, - `deleted` bit(1) NOT NULL, +DROP TABLE IF EXISTS `report_project_info_publish`; +CREATE TABLE `report_project_info_publish` ( + `id` bigint(20) NOT NULL COMMENT '主键', + `content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '报表内容', + `creator` bigint(20) NULL DEFAULT NULL COMMENT '创建者ID', + `create_time` datetime(0) NULL DEFAULT NULL COMMENT '创建时间', + `last_modifier` bigint(20) NULL DEFAULT NULL COMMENT '最后修者ID', + `last_modified_time` datetime(0) NULL DEFAULT NULL COMMENT '最后修改时间', + `version` int(11) NOT NULL COMMENT '乐观锁', + `deleted` bit(1) NOT NULL COMMENT '删除标志', PRIMARY KEY (`id`) USING BTREE -) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '策略注册' ROW_FORMAT = DYNAMIC; +) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '自定义大屏发布信息' ROW_FORMAT = DYNAMIC; -- ---------------------------- --- Records of sales_strategy_register +-- Records of report_project_info_publish -- ---------------------------- -- ---------------------------- diff --git a/pom.xml b/pom.xml index 85a2aecbd7bab40ea320e54aa543283499cd69f8..a452a05d24d63ea99734e4dbcfd8b90e38cd5045 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.8 + 2.7.9 @@ -15,7 +15,7 @@ cn.bootx.platform bootx-platform pom - 1.2.1 + 1.2.2 bootx-common-core @@ -24,7 +24,6 @@ bootx-services bootx-start bootx-demo - bootx-modules @@ -33,9 +32,9 @@ 1.8 - 1.2.1 + 1.2.2 - 5.8.11 + 5.8.13 6.4.0 2.12.3 3.11 @@ -51,24 +50,24 @@ 1.4.01 6.7.2 - 1.2.11 + 1.2.4 3.5.2 - 3.2.0 + 3.2.1 2.3.1 - 2.9.4 + 2.9.3 1.33.0 1.16.5 - 1.4.0 + 8.4.6 3.5.3.1 3.5.2 - 1.6.13 - 3.19.0 + 1.6.14 + 3.20.0 4.0.0 1.5.3.Final 0.2.0 1.6.2 - 7.2 + 7.3 1.2.83_noneautotype 0.41 V1.4-SNAPSHOT @@ -358,10 +357,10 @@ - - jitpack.io - https://jitpack.io - + + + +