提交新功能 分销商 积分 会员体系
This commit is contained in:
59
.gitignore
vendored
59
.gitignore
vendored
@ -1,51 +1,36 @@
|
||||
######################################################################
|
||||
# Build Tools
|
||||
*.class
|
||||
.DS_Store
|
||||
|
||||
.gradle
|
||||
/build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.ear
|
||||
**/target/
|
||||
**/**/target/
|
||||
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
# eclipse
|
||||
.settings/
|
||||
.classpath
|
||||
.project
|
||||
logs/
|
||||
|
||||
######################################################################
|
||||
# IDE
|
||||
# idea
|
||||
.idea/
|
||||
*.iml
|
||||
.murphy.yml
|
||||
|
||||
*velocity.log*
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
nbproject/private/
|
||||
build/*
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
######################################################################
|
||||
# Others
|
||||
*.log
|
||||
*.xml.versionsBackup
|
||||
*.swp
|
||||
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
||||
|
||||
### JRebel ###
|
||||
rebel.xml
|
||||
|
||||
application-my.yaml
|
||||
|
||||
/yshop-ui-app/unpackage/
|
||||
tmp/
|
||||
!DmJdbcDriver18.jar
|
||||
!kingbase8-8.6.0.jar
|
||||
|
@ -7542,7 +7542,7 @@ CREATE TABLE `yshop_store_product_attr_bak` (
|
||||
`attr_values` varchar(256) NOT NULL COMMENT '属性值',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `store_id` (`product_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=538 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品属性表备份';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品属性表备份';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_attr_bak
|
||||
@ -7561,7 +7561,7 @@ CREATE TABLE `yshop_store_product_attr_result` (
|
||||
`change_time` datetime NOT NULL COMMENT '上次修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `product_id` (`product_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=349 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品属性详情表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品属性详情表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_attr_result
|
||||
@ -7634,7 +7634,7 @@ CREATE TABLE `yshop_store_product_attr_result_bak` (
|
||||
`change_time` datetime NOT NULL COMMENT '上次修改时间',
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
KEY `product_id` (`product_id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=346 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品属性详情表备份';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品属性详情表备份';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_attr_result_bak
|
||||
@ -7670,7 +7670,7 @@ CREATE TABLE `yshop_store_product_attr_value` (
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `unique` (`unique`,`sku`) USING BTREE,
|
||||
KEY `store_id` (`product_id`,`sku`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=515 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品属性值表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品属性值表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_attr_value
|
||||
@ -7862,7 +7862,7 @@ CREATE TABLE `yshop_store_product_attr_value_bak` (
|
||||
PRIMARY KEY (`id`) USING BTREE,
|
||||
UNIQUE KEY `unique` (`unique`,`sku`) USING BTREE,
|
||||
KEY `store_id` (`product_id`,`sku`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=515 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品属性值表备份';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品属性值表备份';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_attr_value_bak
|
||||
@ -8087,7 +8087,7 @@ CREATE TABLE `yshop_store_product_bak` (
|
||||
KEY `sales` (`sales`) USING BTREE,
|
||||
KEY `add_time` (`create_time`) USING BTREE,
|
||||
KEY `is_postage` (`is_postage`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=69 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品表';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品表';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_bak
|
||||
@ -8113,7 +8113,7 @@ CREATE TABLE `yshop_store_product_brand` (
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品品牌';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品品牌';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_brand
|
||||
@ -8144,7 +8144,7 @@ CREATE TABLE `yshop_store_product_brand_bak` (
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品品牌备份';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品品牌备份';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_brand_bak
|
||||
@ -8176,7 +8176,7 @@ CREATE TABLE `yshop_store_product_category` (
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品分类';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品分类';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_category
|
||||
@ -8230,7 +8230,7 @@ CREATE TABLE `yshop_store_product_category_bak` (
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品分类备份';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='商品分类备份';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_category_bak
|
||||
@ -8354,7 +8354,7 @@ CREATE TABLE `yshop_store_product_coupon_relation_bak` (
|
||||
`deleted` bit(1) DEFAULT b'0' COMMENT '删除',
|
||||
`tenant_id` bigint(20) DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品优惠券关联表备份';
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='商品优惠券关联表备份';
|
||||
|
||||
-- ----------------------------
|
||||
-- Records of yshop_store_product_coupon_relation_bak
|
||||
@ -8642,3 +8642,182 @@ INSERT INTO `yshop_wechat_template` (`id`, `tempkey`, `name`, `content`, `tempid
|
||||
COMMIT;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for yshop_material_bak 2023/11/24 素材库备份表
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `yshop_material_bak`;
|
||||
CREATE TABLE `yshop_material_bak` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`creator` varchar(100) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建者',
|
||||
`type` char(2) COLLATE utf8mb4_bin NOT NULL COMMENT '类型1、图片;2、视频',
|
||||
`group_id` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '分组ID',
|
||||
`name` varchar(200) COLLATE utf8mb4_bin NOT NULL COMMENT '素材名',
|
||||
`url` varchar(500) COLLATE utf8mb4_bin DEFAULT '' COMMENT '素材链接',
|
||||
`updater` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=121 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='素材库备份表';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for yshop_material_group_bak
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `yshop_material_group_bak`;
|
||||
CREATE TABLE `yshop_material_group_bak` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '编号',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`creator` varchar(32) CHARACTER SET utf8 DEFAULT NULL COMMENT '创建者',
|
||||
`name` varchar(200) COLLATE utf8mb4_bin NOT NULL COMMENT '分组名',
|
||||
`updater` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '更新者',
|
||||
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC COMMENT='素材分组备份表';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
-- 2024-1-15
|
||||
CREATE TABLE `yshop_campaign_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '营销活动id',
|
||||
`name` varchar(50) NOT NULL COMMENT '活动名称',
|
||||
`type` tinyint(4) NOT NULL COMMENT '活动类型:1、拼团,2、秒杀,3、限时折扣',
|
||||
`remark` varchar(255) DEFAULT NULL COMMENT '备注',
|
||||
`start_time` varchar(20) NOT NULL COMMENT '活动开始时间',
|
||||
`end_time` varchar(20) NOT NULL COMMENT '活动结束时间',
|
||||
`if_limit` tinyint(1) NOT NULL COMMENT '商品限购 1-不限购 2-限购',
|
||||
`limit_number` int(11) DEFAULT NULL COMMENT '限购几件/人',
|
||||
`if_enable` tinyint(1) NOT NULL COMMENT '活动预热 1-停用 2-启用',
|
||||
`enable_time` int(11) DEFAULT NULL COMMENT '预热几分钟前',
|
||||
`state` tinyint(1) DEFAULT NULL COMMENT '活动状态 0-未开始 1-进行中 2-已结束',
|
||||
`person` int(11) DEFAULT NULL COMMENT '成团人数',
|
||||
`effective_time` int(11) DEFAULT NULL COMMENT '成团有效时间几(分钟)',
|
||||
`creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='活动信息表';
|
||||
|
||||
CREATE TABLE `yshop_campaign_detail` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '营销活动明细id',
|
||||
`campaign_id` bigint(20) NOT NULL COMMENT '营销活动id',
|
||||
`product_id` bigint(20) NOT NULL COMMENT '商品id',
|
||||
`sku_id` bigint(20) NOT NULL COMMENT '规格id',
|
||||
`original_price` decimal(15,2) NOT NULL COMMENT '原价',
|
||||
`price` decimal(15,2) NOT NULL COMMENT '活动价格',
|
||||
`discount` decimal(4,2) DEFAULT NULL COMMENT '折扣比例',
|
||||
`stock` int(11) NOT NULL COMMENT '活动库存剩余数量',
|
||||
`total` int(11) NOT NULL COMMENT '活动库存总数量',
|
||||
`creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='营销活动明细表';
|
||||
|
||||
-- 订单表新增字段
|
||||
ALTER TABLE yshop_store_order ADD `campaign_detail_id` bigint(20) DEFAULT NULL COMMENT '营销活动明细id';
|
||||
ALTER TABLE yshop_store_order ADD `campaign_type` tinyint(4) DEFAULT NULL COMMENT '活动类型:1、拼团,2、秒杀,3、限时折扣';
|
||||
|
||||
CREATE TABLE `yshop_store_order_detail` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '订单明细id',
|
||||
`oid` bigint(20) NOT NULL COMMENT '订单id',
|
||||
`order_cart_id` bigint(20) NOT NULL COMMENT '订单购物详情id',
|
||||
`product_id` bigint(20) NOT NULL COMMENT '商品ID',
|
||||
`sku_id` bigint(20) NOT NULL COMMENT '规格id',
|
||||
`product_attr_unique` varchar(50) NOT NULL DEFAULT '' COMMENT '唯一id',
|
||||
`original_price` decimal(15,2) NOT NULL COMMENT '原价',
|
||||
`price` decimal(15,2) NOT NULL COMMENT '实际价格',
|
||||
`postage_price` decimal(8,2) DEFAULT '0.00' COMMENT '邮费金额',
|
||||
`state` tinyint(1) DEFAULT '0' COMMENT '状态:1、正常,2、售后中,3、售后完成',
|
||||
`creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='订单明细表';
|
||||
|
||||
CREATE TABLE `yshop_canvas` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '画布id',
|
||||
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '名称',
|
||||
`json` longtext COMMENT '画布json数据',
|
||||
`state` tinyint(1) DEFAULT NULL COMMENT '状态 0-关闭 1-开启',
|
||||
`creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='画布信息表';
|
||||
|
||||
CREATE TABLE `yshop_popup` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '弹窗id',
|
||||
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '名称',
|
||||
`start_time` varchar(20) NOT NULL COMMENT '开始时间',
|
||||
`end_time` varchar(20) NOT NULL COMMENT '结束时间',
|
||||
`popup_image` text NOT NULL COMMENT '弹窗图',
|
||||
`button_image` text NOT NULL COMMENT '按钮图',
|
||||
`type` tinyint(4) NOT NULL COMMENT '跳转类型:0、不跳转,1、商品,2、分类,3、优惠券,4、小程序',
|
||||
`link` text DEFAULT NULL COMMENT '链接',
|
||||
`state` tinyint(1) DEFAULT NULL COMMENT '状态 0-关闭 1-开启',
|
||||
`creator` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='弹窗表';
|
||||
|
||||
-- 2024-1-16 --
|
||||
alter table yshop_store_order_detail add `order_id` varchar(32) NOT NULL COMMENT '订单号';
|
||||
alter table yshop_store_product add `is_distribution` tinyint(1) DEFAULT '0' COMMENT '是否分销:0-否,1-是';
|
||||
alter table yshop_campaign_info add `is_virtually` tinyint(1) DEFAULT '0' COMMENT '是否虚拟成团:0-否,1-是';
|
||||
alter table yshop_store_order add `teamwork_id` bigint(20) DEFAULT NULL COMMENT '拼团id';
|
||||
|
||||
CREATE TABLE `yshop_teamwork_info` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '拼团id',
|
||||
`campaign_id` bigint(20) NOT NULL COMMENT '拼团活动id',
|
||||
`people` int(11) NOT NULL COMMENT '参团人数',
|
||||
`state` tinyint(1) NOT NULL COMMENT '成团状态 0-拼团中 1-拼团成功 2-拼团失败',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='拼团信息表'
|
||||
|
||||
|
||||
alter table yshop_teamwork_info add `regimental_commander_id` bigint(20) NOT NULL COMMENT '团长id';
|
||||
alter table yshop_teamwork_info add `campaign_detail_id` bigint(20) NOT NULL COMMENT '营销活动明细id';
|
||||
alter table yshop_canvas add `type` tinyint(1) NOT NULL COMMENT '画布类型 1-首页 2-我的';
|
||||
|
||||
CREATE TABLE `yshop_canvas_detail` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '画布明细id',
|
||||
`canvas_id` bigint(20) NOT NULL COMMENT '画布id',
|
||||
`terminal` tinyint(1) NOT NULL COMMENT '终端 1-小程序 2-H5 3-APP',
|
||||
`json` longtext COMMENT '画布json数据',
|
||||
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
|
||||
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
|
||||
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
|
||||
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
|
||||
`tenant_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '租户编号',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='画布明细表';
|
||||
|
||||
|
7
sql/初始化分销商.sql
Normal file
7
sql/初始化分销商.sql
Normal file
@ -0,0 +1,7 @@
|
||||
TRUNCATE TABLE yshop_distributor;
|
||||
TRUNCATE TABLE yshop_distributor_dynamics;
|
||||
TRUNCATE TABLE yshop_distributor_order;
|
||||
TRUNCATE TABLE yshop_distributor_user;
|
||||
TRUNCATE TABLE yshop_distributor_wages;
|
||||
TRUNCATE TABLE yshop_distributor_wages_log;
|
||||
TRUNCATE TABLE yshop_distributor_withdrawal_method;
|
@ -72,7 +72,9 @@
|
||||
<wx-java-mp.version>4.3.0</wx-java-mp.version>
|
||||
<pay.boot.version>1.0.3</pay.boot.version>
|
||||
<pay.version>2.14.5</pay.version>
|
||||
<qrcode.version>3.3.3</qrcode.version>
|
||||
<!-- <pay.version>2.14.4-fix</pay.version>-->
|
||||
<weixin-java-cp.version>4.6.0</weixin-java-cp.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@ -87,6 +89,11 @@
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-module-distributor-biz</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-banner</artifactId>
|
||||
@ -584,12 +591,19 @@
|
||||
<artifactId>justauth-spring-boot-starter</artifactId> <!-- 社交登陆(例如说,个人微信、企业微信等等) -->
|
||||
<version>${justauth.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--微信公众号-->
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>wx-java-mp-spring-boot-starter</artifactId>
|
||||
<version>${wx-java-mp.version}</version>
|
||||
</dependency>
|
||||
<!--企业微信-->
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-cp</artifactId>
|
||||
<version>${weixin-java-cp.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!-- 积木报表-->
|
||||
<dependency>
|
||||
@ -635,6 +649,12 @@
|
||||
<artifactId>pay-java-web-support</artifactId>
|
||||
<version>${pay.version}</version>
|
||||
</dependency>
|
||||
<!--二维码-->
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>${qrcode.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
@ -137,6 +137,10 @@
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>transmittable-thread-local</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
@ -194,4 +194,27 @@ public interface ShopConstants {
|
||||
|
||||
//快递查询接口Logistic
|
||||
String KDNIAO_LOGISTIC_QUERY="https://api.kdniao.com/Ebusiness/EbusinessOrderHandle.aspx";
|
||||
|
||||
/**
|
||||
* redis营销活动状态变更key
|
||||
*/
|
||||
String CAMPAIGN_CHANGE = "campaign-change-queue";
|
||||
|
||||
/**
|
||||
* redis广告弹窗状态变更key
|
||||
*/
|
||||
String POPUP_CHANGE = "popup-change-queue";
|
||||
|
||||
/**
|
||||
* redis拼团状态变更key
|
||||
*/
|
||||
String TEAMWORK_CHANGE = "teamwork-change-queue";
|
||||
|
||||
String DAY_FORMAT_STR = "yyyy-MM-dd";
|
||||
|
||||
/**
|
||||
* redis 订单收货后不可关闭售后 key
|
||||
*/
|
||||
String CLOSE_AFTER_SALE_KEY = "close-after-sale-key";
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.yshop.framework.common.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author pepis
|
||||
* @apiNote 开启关闭枚举
|
||||
**/
|
||||
@Getter
|
||||
public enum EnableEnum {
|
||||
DISABLE(0,"禁用"),
|
||||
ENABLE(1,"启用"),
|
||||
;
|
||||
private final Integer value;
|
||||
|
||||
private final String desc;
|
||||
|
||||
EnableEnum(Integer value, String desc) {
|
||||
this.value = value;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
@ -20,11 +20,13 @@ public enum OrderInfoEnum {
|
||||
|
||||
STATUS_APPLY_REFUND(-1,"申请退款"),
|
||||
STATUS_REFUND_SUCCESS(-2,"退款成功"),
|
||||
STATUS_GROUP_FAILURE(-4,"成团失败"),
|
||||
STATUS_DEFAULT(0,"默认"),
|
||||
STATUS_WAIT_RECEIVED(1,"待收货"),
|
||||
STATUS_RECEIVED(2,"已收货"),
|
||||
STATUS_FINISHED(3,"已完成"),
|
||||
STATUS_CANCEL(4,"取消"),
|
||||
STATUS_WAIT_GROUP(5,"待成团"),
|
||||
|
||||
PAY_STATUS_UNPAID(0,"未支付"),
|
||||
PAY_STATUS_HAVE_PAID(1,"已支付"),
|
||||
@ -61,7 +63,9 @@ public enum OrderInfoEnum {
|
||||
SHIPPING_TYPE_STORE_PICKUP(2,"门店自提"),
|
||||
|
||||
UNABLE_AFTER_SALES(0,"不能售后"),
|
||||
ABLE_AFTER_SALES(1,"能售后");
|
||||
ABLE_AFTER_SALES(1,"能售后"),
|
||||
|
||||
CAMPAIGN_ORDER(2,"活动订单");
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package co.yixiang.yshop.framework.common.util.date;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
|
||||
import java.time.*;
|
||||
@ -170,4 +171,82 @@ public class DateUtils {
|
||||
return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断当前时间是否处在开始时间和结束时间之间
|
||||
*
|
||||
* @param start
|
||||
* @param end
|
||||
* @return 是否
|
||||
*/
|
||||
public static boolean isBelong(LocalDateTime start,LocalDateTime end) {
|
||||
return isBefore(end) && isAfter(start);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前时间是否处在传入时间前
|
||||
*
|
||||
* @param time
|
||||
* @return 是否
|
||||
*/
|
||||
public static boolean isBefore(LocalDateTime time) {
|
||||
return toTimeStamp(time) > System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前时间是否处在传入时间后
|
||||
*
|
||||
* @param time 时间
|
||||
* @return 是否
|
||||
*/
|
||||
public static boolean isAfter(LocalDateTime time) {
|
||||
return toTimeStamp(time) < System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 传入时间累加
|
||||
*
|
||||
* @param time 时间
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static LocalDateTime getMoreMinuteAfter(LocalDateTime time, int minute) {
|
||||
return time.plusMinutes(minute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算与当前时间的差值(毫秒)
|
||||
*
|
||||
* @param time
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static long getMoreMillisecondAfter(LocalDateTime time) {
|
||||
return toTimeStamp(time) - System.currentTimeMillis();
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算时间戳
|
||||
*
|
||||
* @param time
|
||||
* @param
|
||||
* @return
|
||||
*/
|
||||
public static long toTimeStamp(LocalDateTime time) {
|
||||
return time.toInstant(ZoneOffset.ofHours(8)).toEpochMilli();
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断两个日期是否同一天
|
||||
* @param date1 /
|
||||
* @param date2 /
|
||||
* @return /
|
||||
*/
|
||||
public static Boolean isSameDay(Date date1,Date date2){
|
||||
return DateUtil.formatDate(date1).equals(DateUtil.formatDate(date2));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -3,10 +3,13 @@ package co.yixiang.yshop.framework.common.util.date;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.temporal.TemporalAdjusters;
|
||||
|
||||
/**
|
||||
* 时间工具类,用于 {@link LocalDateTime}
|
||||
* 时间工具类,用于 {@link java.time.LocalDateTime}
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
@ -60,4 +63,42 @@ public class LocalDateTimeUtils {
|
||||
return LocalDateTimeUtil.isIn(LocalDateTime.now(), startTime, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 本周开始时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static LocalDateTime weekStartTime() {
|
||||
LocalDate now = LocalDate.now();
|
||||
return LocalDateTime.of(now.minusDays(now.getDayOfWeek().getValue() - 1), LocalTime.MIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 本周结束时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static LocalDateTime weekEndTime() {
|
||||
LocalDate now = LocalDate.now();
|
||||
return LocalDateTime.of(now.plusDays(7 - now.getDayOfWeek().getValue()), LocalTime.MAX);
|
||||
}
|
||||
|
||||
/**
|
||||
* 本月开始时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static LocalDateTime monthStartTime() {
|
||||
return LocalDateTime.of(LocalDate.now().with(TemporalAdjusters.firstDayOfMonth()), LocalTime.MIN);
|
||||
}
|
||||
|
||||
/**
|
||||
* 本月结束时间
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static LocalDateTime monthEndTime() {
|
||||
return LocalDateTime.of(LocalDate.now().with(TemporalAdjusters.lastDayOfMonth()), LocalTime.MAX);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
package co.yixiang.yshop.framework.common.util.distancecalculator;
|
||||
|
||||
/**
|
||||
* @author pepis
|
||||
* @apiNote
|
||||
**/
|
||||
public class DistanceCalculatorUtil {
|
||||
public static void main(String[] args) {
|
||||
double lat1 = 37.7749; // 第一个点的纬度
|
||||
double lon1 = -122.4194; // 第一个点的经度
|
||||
|
||||
double lat2 = 34.0522; // 第二个点的纬度
|
||||
double lon2 = -118.2437; // 第二个点的经度
|
||||
|
||||
double distance = calculateDistance(lat1, lon1, lat2, lon2);
|
||||
System.out.println("Distance: " + distance + " m");
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算两地之间距离
|
||||
* @param lat1 第一个点的纬度
|
||||
* @param lon1 第一个点的经度
|
||||
* @param lat2 第二个点的纬度
|
||||
* @param lon2 第二个点的经度
|
||||
* @return 距离单位 米
|
||||
*/
|
||||
public static double calculateDistance(double lat1, double lon1, double lat2, double lon2) {
|
||||
// 地球半径,单位:千米
|
||||
final double R = 6371.0;
|
||||
|
||||
// 将经纬度转换为弧度
|
||||
double radLat1 = Math.toRadians(lat1);
|
||||
double radLon1 = Math.toRadians(lon1);
|
||||
double radLat2 = Math.toRadians(lat2);
|
||||
double radLon2 = Math.toRadians(lon2);
|
||||
|
||||
// Haversine公式计算距离
|
||||
double dlon = radLon2 - radLon1;
|
||||
double dlat = radLat2 - radLat1;
|
||||
double a = Math.pow(Math.sin(dlat / 2), 2) + Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(dlon / 2), 2);
|
||||
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));
|
||||
|
||||
// 计算距离
|
||||
return Math.round(R * c * 1000);
|
||||
}
|
||||
}
|
@ -5,11 +5,13 @@ import cn.hutool.core.map.TableMap;
|
||||
import cn.hutool.core.net.url.UrlBuilder;
|
||||
import cn.hutool.core.util.ReflectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import okhttp3.*;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.util.UriComponents;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Map;
|
||||
@ -39,12 +41,11 @@ public class HttpUtils {
|
||||
|
||||
/**
|
||||
* 拼接 URL
|
||||
*
|
||||
* copy from Spring Security OAuth2 的 AuthorizationEndpoint 类的 append 方法
|
||||
*
|
||||
* @param base 基础 URL
|
||||
* @param query 查询参数
|
||||
* @param keys query 的 key,对应的原本的 key 的映射。例如说 query 里有个 key 是 xx,实际它的 key 是 extra_xx,则通过 keys 里添加这个映射
|
||||
* @param base 基础 URL
|
||||
* @param query 查询参数
|
||||
* @param keys query 的 key,对应的原本的 key 的映射。例如说 query 里有个 key 是 xx,实际它的 key 是 extra_xx,则通过 keys 里添加这个映射
|
||||
* @param fragment URL 的 fragment,即拼接到 # 中
|
||||
* @return 拼接后的 URL
|
||||
*/
|
||||
@ -109,7 +110,7 @@ public class HttpUtils {
|
||||
authorization = Base64.decodeStr(authorization);
|
||||
clientId = StrUtil.subBefore(authorization, ":", false);
|
||||
clientSecret = StrUtil.subAfter(authorization, ":", false);
|
||||
// 再从 Param 中获取
|
||||
// 再从 Param 中获取
|
||||
} else {
|
||||
clientId = request.getParameter("client_id");
|
||||
clientSecret = request.getParameter("client_secret");
|
||||
@ -122,5 +123,31 @@ public class HttpUtils {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getAppletNoticeToken(String appid, String secret) throws IOException {
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=" + appid + "&secret=" + secret)
|
||||
.get()
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
assert response.body() != null;
|
||||
return response.body().string();
|
||||
}
|
||||
|
||||
public static String sendAppletNotice(String token,String bodyString) throws IOException {
|
||||
OkHttpClient client = new OkHttpClient().newBuilder()
|
||||
.build();
|
||||
MediaType mediaType = MediaType.parse("text/plain");
|
||||
RequestBody body = RequestBody.create(mediaType, bodyString);
|
||||
Request request = new Request.Builder()
|
||||
.url("https://api.weixin.qq.com/wxa/sec/order/upload_shipping_info?access_token="+token)
|
||||
.method("POST", body)
|
||||
.build();
|
||||
Response response = client.newCall(request).execute();
|
||||
assert response.body() != null;
|
||||
return response.body().string();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import cn.hutool.core.util.StrUtil;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* IO 工具类,用于 {@link IoUtil} 缺失的方法
|
||||
* IO 工具类,用于 {@link cn.hutool.core.io.IoUtil} 缺失的方法
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
|
@ -3,7 +3,7 @@ package co.yixiang.yshop.framework.common.util.object;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
|
||||
/**
|
||||
* {@link PageParam} 工具类
|
||||
* {@link co.yixiang.yshop.framework.common.pojo.PageParam} 工具类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
|
@ -10,7 +10,7 @@ import org.springframework.aop.support.ComposablePointcut;
|
||||
import org.springframework.aop.support.annotation.AnnotationMatchingPointcut;
|
||||
|
||||
/**
|
||||
* {@link DataPermission} 注解的 Advisor 实现类
|
||||
* {@link co.yixiang.yshop.framework.datapermission.core.annotation.DataPermission} 注解的 Advisor 实现类
|
||||
*
|
||||
* @author yshop
|
||||
*/
|
||||
|
@ -43,7 +43,6 @@ public class SmsClientFactoryImpl implements SmsClientFactory {
|
||||
/**
|
||||
* 短信客户端 Map
|
||||
* key:渠道编码,使用 {@link SmsChannelProperties#getCode()} ()}
|
||||
*
|
||||
* 注意,一些场景下,需要获得某个渠道类型的客户端,所以需要使用它。
|
||||
* 例如说,解析短信接收结果,是相对通用的,不需要使用某个渠道编号的 {@link #channelIdClients}
|
||||
*/
|
||||
|
@ -0,0 +1,52 @@
|
||||
package co.yixiang.yshop.framework.weixin.config;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl;
|
||||
import cn.binarywang.wx.miniapp.config.WxMaConfig;
|
||||
import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 微信小程序配置文件
|
||||
*
|
||||
* @author: moxiangrong
|
||||
**/
|
||||
@Configuration
|
||||
@ConditionalOnClass(WxMaService.class)
|
||||
@EnableConfigurationProperties(WxMiniProgramProperties.class)
|
||||
public class WxMiniProgramConfig {
|
||||
|
||||
/*注入小程序相关配置*/
|
||||
@Autowired
|
||||
private WxMiniProgramProperties properties;
|
||||
|
||||
/**
|
||||
* 配置默认参数
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public WxMaConfig wxMaConfig() {
|
||||
WxMaDefaultConfigImpl wxMaDefaultConfig = new WxMaDefaultConfigImpl();
|
||||
//设置默认参数-appid,secret
|
||||
wxMaDefaultConfig.setAppid(this.properties.getAppid());
|
||||
wxMaDefaultConfig.setSecret(this.properties.getSecret());
|
||||
return wxMaDefaultConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置WxMaService
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public WxMaService wxMaService(WxMaConfig wxMaConfig) {
|
||||
WxMaService wxMaService = new WxMaServiceImpl();
|
||||
wxMaService.setWxMaConfig(wxMaConfig);
|
||||
return wxMaService;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.yshop.framework.weixin.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@ConfigurationProperties(prefix = "wx.miniapp")
|
||||
@Validated
|
||||
@Data
|
||||
public class WxMiniProgramProperties {
|
||||
|
||||
/*微信小程序app_id*/
|
||||
private String appid;
|
||||
|
||||
/*微信小程序app_secret*/
|
||||
private String secret;
|
||||
|
||||
}
|
@ -13,7 +13,6 @@ public class YshopFlowableConfiguration {
|
||||
|
||||
/**
|
||||
* 参考 {@link org.flowable.spring.boot.FlowableJobConfiguration} 类,创建对应的 AsyncListenableTaskExecutor Bean
|
||||
*
|
||||
* 如果不创建,会导致项目启动时,Flowable 报错的问题
|
||||
*/
|
||||
@Bean
|
||||
|
@ -5,7 +5,7 @@ import co.yixiang.yshop.framework.quartz.core.handler.JobHandlerInvoker;
|
||||
import org.quartz.*;
|
||||
|
||||
/**
|
||||
* {@link Scheduler} 的管理器,负责创建任务
|
||||
* {@link org.quartz.Scheduler} 的管理器,负责创建任务
|
||||
*
|
||||
* 考虑到实现的简洁性,我们使用 jobHandlerName 作为唯一标识,即:
|
||||
* 1. Job 的 {@link JobDetail#getKey()}
|
||||
|
@ -23,7 +23,7 @@ public class DefaultStreamMessageListenerContainerX<K, V extends Record<K, ?>> e
|
||||
/**
|
||||
* 参考 {@link StreamMessageListenerContainer#create(RedisConnectionFactory, StreamMessageListenerContainerOptions)} 的实现
|
||||
*/
|
||||
public static <K, V extends Record<K, ?>> StreamMessageListenerContainer<K, V> create(RedisConnectionFactory connectionFactory, StreamMessageListenerContainerOptions<K, V> options) {
|
||||
public static <K, V extends Record<K, ?>> StreamMessageListenerContainer<K, V> create(RedisConnectionFactory connectionFactory, StreamMessageListenerContainer.StreamMessageListenerContainerOptions<K, V> options) {
|
||||
Assert.notNull(connectionFactory, "RedisConnectionFactory must not be null!");
|
||||
Assert.notNull(options, "StreamMessageListenerContainerOptions must not be null!");
|
||||
return new DefaultStreamMessageListenerContainerX<>(connectionFactory, options);
|
||||
|
@ -27,6 +27,20 @@ public class LambdaQueryWrapperX<T> extends LambdaQueryWrapper<T> {
|
||||
return this;
|
||||
}
|
||||
|
||||
public LambdaQueryWrapperX<T> likeRightIfPresent(SFunction<T, ?> column, String val) {
|
||||
if (StringUtils.hasText(val)) {
|
||||
return (LambdaQueryWrapperX<T>) super.likeRight(column, val);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public LambdaQueryWrapperX<T> likeLeftIfPresent(SFunction<T, ?> column, String val) {
|
||||
if (StringUtils.hasText(val)) {
|
||||
return (LambdaQueryWrapperX<T>) super.likeLeft(column, val);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public LambdaQueryWrapperX<T> inIfPresent(SFunction<T, ?> column, Collection<?> values) {
|
||||
if (!CollectionUtils.isEmpty(values)) {
|
||||
return (LambdaQueryWrapperX<T>) super.in(column, values);
|
||||
|
@ -13,7 +13,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
|
||||
/**
|
||||
* 字段字段的 TypeHandler 实现类,基于 {@link AES} 实现
|
||||
* 字段字段的 TypeHandler 实现类,基于 {@link cn.hutool.crypto.symmetric.AES} 实现
|
||||
* 可通过 jasypt.encryptor.password 配置项,设置密钥
|
||||
*
|
||||
* @author yshop
|
||||
|
@ -1,5 +1,7 @@
|
||||
package co.yixiang.yshop.framework.redis.config;
|
||||
|
||||
import co.yixiang.yshop.framework.redis.util.RedissonUtil;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||
@ -30,4 +32,14 @@ public class YshopRedisAutoConfiguration {
|
||||
return template;
|
||||
}
|
||||
|
||||
/**
|
||||
* /
|
||||
* @param redissonClient /
|
||||
* @return Redisson 操作工具类
|
||||
*/
|
||||
@Bean
|
||||
public RedissonUtil redissonUtil(RedissonClient redissonClient){
|
||||
return new RedissonUtil(redissonClient);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,87 @@
|
||||
package co.yixiang.yshop.framework.redis.util;
|
||||
|
||||
import co.yixiang.yshop.framework.common.exception.ErrorCode;
|
||||
import co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil;
|
||||
import org.redisson.api.RBlockingDeque;
|
||||
import org.redisson.api.RDelayedQueue;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* @author pepis
|
||||
* @apiNote Redisson 操作工具类
|
||||
**/
|
||||
public class RedissonUtil {
|
||||
private final RedissonClient redissonClient;
|
||||
Logger logger = LoggerFactory.getLogger(RedissonUtil.class);
|
||||
|
||||
public RedissonUtil(RedissonClient redissonClient) {
|
||||
this.redissonClient = redissonClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定key的延时队列中添加任务
|
||||
* @param key 延时队列
|
||||
* @param v 订单id
|
||||
* @param delay 延时时长
|
||||
* @param timeUnit 延时单位
|
||||
* @param <V> id类型
|
||||
*/
|
||||
public <V> void delayedOffer(String key,V v,long delay, TimeUnit timeUnit){
|
||||
try {
|
||||
RBlockingDeque<Object> blockingDeque = redissonClient.getBlockingDeque(key);
|
||||
RDelayedQueue<Object> delayedQueue = redissonClient.getDelayedQueue(blockingDeque);
|
||||
delayedQueue.offer(v, delay, timeUnit);
|
||||
String s = delay + timeUnit.toString();
|
||||
logger.info("添加延时队列成功 ,延迟时间:" + s + "订单id: " + v);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定key的延时队列中添加任务
|
||||
* @param key 延时队列
|
||||
* @param v 订单id
|
||||
* @param delay 延时时长
|
||||
* @param timeUnit 延时单位
|
||||
* @param code 添加失败抛出异常
|
||||
* @param <V> id类型
|
||||
*/
|
||||
public <V> void delayedOfferThrow(String key, V v, long delay, TimeUnit timeUnit, ErrorCode code){
|
||||
try {
|
||||
RBlockingDeque<Object> blockingDeque = redissonClient.getBlockingDeque(key);
|
||||
RDelayedQueue<Object> delayedQueue = redissonClient.getDelayedQueue(blockingDeque);
|
||||
delayedQueue.offer(v, delay, timeUnit);
|
||||
String s = delay + timeUnit.toString();
|
||||
logger.info("添加延时队列成功 ,延迟时间:" + s + "订单id: " + v);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
throw ServiceExceptionUtil.exception(code,e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 向指定key的延时队列中删除任务
|
||||
* @param key 延时队列
|
||||
* @param v 订单id
|
||||
* @param code 添加失败抛出异常
|
||||
* @param <V> id类型
|
||||
*/
|
||||
public <V> void delayedRemoveThrow(String key, V v, ErrorCode code){
|
||||
try {
|
||||
RBlockingDeque<Object> blockingDeque = redissonClient.getBlockingDeque(key);
|
||||
RDelayedQueue<Object> delayedQueue = redissonClient.getDelayedQueue(blockingDeque);
|
||||
delayedQueue.remove(v);
|
||||
logger.info("删除延时队列成功 , 订单id: " + v);
|
||||
} catch (Exception e) {
|
||||
logger.error(e.getMessage());
|
||||
throw ServiceExceptionUtil.exception(code,e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -186,4 +186,4 @@ public class YshopWebSecurityConfigurerAdapter {
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package co.yixiang.yshop.module.express.kdniao.model.dto;
|
||||
|
||||
import lombok.*;
|
||||
import org.omg.PortableInterceptor.INACTIVE;
|
||||
|
||||
/**
|
||||
* 电子面单 DTO
|
||||
|
@ -27,6 +27,7 @@ import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
@ -107,6 +108,13 @@ public class ExpressController {
|
||||
@Operation(summary = "获得快递鸟配置")
|
||||
public CommonResult<KdniaoApiBaseDTO> getExpressSet() {
|
||||
KdniaoApiBaseDTO kdniaoApiBaseDTO = expressRedisDAO.get();
|
||||
if(Objects.isNull(kdniaoApiBaseDTO)){
|
||||
kdniaoApiBaseDTO = new KdniaoApiBaseDTO();
|
||||
kdniaoApiBaseDTO.setApiKey("");
|
||||
kdniaoApiBaseDTO.setReqURL("");
|
||||
kdniaoApiBaseDTO.setEBusinessID("");
|
||||
expressRedisDAO.set(kdniaoApiBaseDTO);
|
||||
}
|
||||
//返回数据加密一下
|
||||
String genSalt = BCrypt.gensalt();
|
||||
//这个是盐 29个字符,随机生成 System.out.println(gensalt);
|
||||
|
@ -0,0 +1,17 @@
|
||||
package co.yixiang.yshop.module.infra.api.config;
|
||||
|
||||
import co.yixiang.yshop.module.infra.api.config.dto.ConfigDTO;
|
||||
|
||||
/**
|
||||
* @author pepis
|
||||
* @apiNote
|
||||
**/
|
||||
public interface ConfigApi {
|
||||
/**
|
||||
* 根据参数键,获得参数配置
|
||||
*
|
||||
* @param key 配置键
|
||||
* @return 参数配置
|
||||
*/
|
||||
ConfigDTO getConfigByKey(String key);
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package co.yixiang.yshop.module.infra.api.config.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author pepis
|
||||
* @apiNote
|
||||
**/
|
||||
@Data
|
||||
public class ConfigDTO {
|
||||
private Long id;
|
||||
/**
|
||||
* 参数分类
|
||||
*/
|
||||
private String category;
|
||||
/**
|
||||
* 参数名称
|
||||
*/
|
||||
private String name;
|
||||
/**
|
||||
* 参数键名
|
||||
*
|
||||
* 支持多 DB 类型时,无法直接使用 key + @TableField("config_key") 来实现转换,原因是 "config_key" AS key 而存在报错
|
||||
*/
|
||||
private String configKey;
|
||||
/**
|
||||
* 参数键值
|
||||
*/
|
||||
private String value;
|
||||
/**
|
||||
* 参数类型
|
||||
*/
|
||||
private Integer type;
|
||||
}
|
@ -117,6 +117,12 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.binarywang</groupId>
|
||||
<artifactId>weixin-java-miniapp</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
@ -0,0 +1,25 @@
|
||||
package co.yixiang.yshop.module.infra.api.config;
|
||||
|
||||
import co.yixiang.yshop.module.infra.api.config.dto.ConfigDTO;
|
||||
import co.yixiang.yshop.module.infra.convert.config.ConfigConvert;
|
||||
import co.yixiang.yshop.module.infra.dal.dataobject.config.ConfigDO;
|
||||
import co.yixiang.yshop.module.infra.service.config.ConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* @author pepis
|
||||
* @apiNote
|
||||
**/
|
||||
@Service
|
||||
public class ConfigApiImpl implements ConfigApi {
|
||||
@Resource
|
||||
private ConfigService configService;
|
||||
|
||||
@Override
|
||||
public ConfigDTO getConfigByKey(String key) {
|
||||
ConfigDO configDO = configService.getConfigByKey(key);
|
||||
return ConfigConvert.INSTANCE.convert2DTO(configDO);
|
||||
}
|
||||
}
|
@ -81,6 +81,14 @@ public class ConfigController {
|
||||
return success(config.getValue());
|
||||
}
|
||||
|
||||
@GetMapping(value = "/get-value-by-category")
|
||||
@Operation(summary = "根据参数分类查询参数值")
|
||||
@Parameter(name = "category", description = "分类", required = true, example = "url")
|
||||
public CommonResult<List<ConfigRespVO>> getConfigCategory(@RequestParam("category") String category) {
|
||||
List<ConfigDO> configs = configService.getConfigByCategory(category);
|
||||
return success(ConfigConvert.INSTANCE.convertList02(configs));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获取参数配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('infra:config:query')")
|
||||
|
@ -0,0 +1,70 @@
|
||||
package co.yixiang.yshop.module.infra.controller.app.qrcode;
|
||||
|
||||
import cn.binarywang.wx.miniapp.api.WxMaQrcodeService;
|
||||
import cn.binarywang.wx.miniapp.api.WxMaService;
|
||||
import cn.binarywang.wx.miniapp.bean.WxMaCodeLineColor;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.qrcode.QrCodeUtil;
|
||||
import cn.hutool.extra.qrcode.QrConfig;
|
||||
import co.yixiang.yshop.framework.common.exception.ServiceException;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.module.infra.controller.app.qrcode.vo.QrCodeGenerateDTO;
|
||||
import co.yixiang.yshop.module.infra.controller.app.qrcode.vo.QrCodeGenerateMiniDTO;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Base64;
|
||||
|
||||
import static cn.hutool.core.img.ImgUtil.IMAGE_TYPE_JPG;
|
||||
|
||||
/**
|
||||
* @author pepis
|
||||
* @apiNote
|
||||
**/
|
||||
@Tag(name = "用户 APP - 二维码")
|
||||
@RestController
|
||||
@RequestMapping("/infra/QrCode")
|
||||
@Validated
|
||||
@Slf4j
|
||||
public class QrCodeController {
|
||||
|
||||
@Resource
|
||||
private WxMaService wxMaService;
|
||||
|
||||
@PostMapping("generate")
|
||||
@Operation(summary = "生成二维码")
|
||||
public CommonResult<String> generate(@RequestBody QrCodeGenerateDTO dto){
|
||||
String content = dto.getContent();
|
||||
if(StrUtil.isBlank(content)){
|
||||
throw new ServiceException();
|
||||
}
|
||||
String base64 = QrCodeUtil.generateAsBase64(content, QrConfig.create(), IMAGE_TYPE_JPG);
|
||||
return CommonResult.success(base64);
|
||||
}
|
||||
|
||||
@PostMapping("generate-mini")
|
||||
@Operation(summary = "生成小程序码")
|
||||
public CommonResult<String> generateMini(@RequestBody QrCodeGenerateMiniDTO dto){
|
||||
try {
|
||||
WxMaQrcodeService wxMaQrcodeService = wxMaService.getQrcodeService();
|
||||
/* 获取二维码字节数组 */
|
||||
byte[] bytes = wxMaQrcodeService.createWxaCodeUnlimitBytes
|
||||
(dto.getName(), dto.getPath(), false,"trial",430, true,
|
||||
new WxMaCodeLineColor("0", "0", "0"), true);
|
||||
return CommonResult.success(Base64.getEncoder().encodeToString(bytes));
|
||||
|
||||
} catch (Exception ex) {
|
||||
log.info("生成小程序码失败,message:{}", ex.getMessage());
|
||||
return CommonResult.success(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package co.yixiang.yshop.module.infra.controller.app.qrcode.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author pepis
|
||||
* @apiNote
|
||||
**/
|
||||
@Data
|
||||
public class QrCodeGenerateDTO {
|
||||
@Schema(description = "二维码内容")
|
||||
private String content;
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.yshop.module.infra.controller.app.qrcode.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author pepis
|
||||
* @apiNote
|
||||
**/
|
||||
@Data
|
||||
public class QrCodeGenerateMiniDTO {
|
||||
|
||||
@Schema(description = "标头")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "小程序跳转地址")
|
||||
private String path;
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
package co.yixiang.yshop.module.infra.convert.config;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.infra.api.config.dto.ConfigDTO;
|
||||
import co.yixiang.yshop.module.infra.controller.admin.config.vo.ConfigCreateReqVO;
|
||||
import co.yixiang.yshop.module.infra.controller.admin.config.vo.ConfigExcelVO;
|
||||
import co.yixiang.yshop.module.infra.controller.admin.config.vo.ConfigRespVO;
|
||||
@ -30,4 +31,8 @@ public interface ConfigConvert {
|
||||
@Mapping(source = "configKey", target = "key")
|
||||
List<ConfigExcelVO> convertList(List<ConfigDO> list);
|
||||
|
||||
ConfigDTO convert2DTO(ConfigDO configDO);
|
||||
|
||||
@Mapping(source = "configKey", target = "key")
|
||||
List<ConfigRespVO> convertList02(List<ConfigDO> configs);
|
||||
}
|
||||
|
@ -63,7 +63,7 @@ public class CodegenBuilder {
|
||||
*/
|
||||
public static final String TENANT_ID_FIELD = "tenantId";
|
||||
/**
|
||||
* {@link BaseDO} 的字段
|
||||
* {@link co.yixiang.yshop.framework.mybatis.core.dataobject.BaseDO} 的字段
|
||||
*/
|
||||
public static final Set<String> BASE_DO_FIELDS = new HashSet<>();
|
||||
/**
|
||||
|
@ -72,4 +72,11 @@ public interface ConfigService {
|
||||
List<ConfigDO> getConfigList(@Valid ConfigExportReqVO reqVO);
|
||||
|
||||
|
||||
/**
|
||||
* 根据分类,获得参数配置
|
||||
*
|
||||
* @param category 分类
|
||||
* @return 参数配置
|
||||
*/
|
||||
List<ConfigDO> getConfigByCategory(String category);
|
||||
}
|
||||
|
@ -84,6 +84,11 @@ public class ConfigServiceImpl implements ConfigService {
|
||||
return configMapper.selectList(reqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConfigDO> getConfigByCategory(String category) {
|
||||
return configMapper.selectList(ConfigDO::getCategory,category);
|
||||
}
|
||||
|
||||
private void validateConfigForCreateOrUpdate(Long id, String key) {
|
||||
// 校验自己存在
|
||||
validateConfigExists(id);
|
||||
|
@ -26,6 +26,8 @@
|
||||
<module>yshop-module-cart-biz</module>
|
||||
<module>yshop-module-order-api</module>
|
||||
<module>yshop-module-order-biz</module>
|
||||
<module>yshop-module-distributor-api</module>
|
||||
<module>yshop-module-distributor-biz</module>
|
||||
</modules>
|
||||
|
||||
</project>
|
||||
|
@ -5,13 +5,13 @@ import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author hupeng
|
||||
* 优惠券类型枚举
|
||||
* 购物车类型枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum CartTypeEnum {
|
||||
ADD_SHOPPING_CART(0,"加入购物车"),
|
||||
DIRECT_PURCHASING(1,"加入购物车直接购买");
|
||||
DIRECT_PURCHASING(1,"直接购买");
|
||||
|
||||
private Integer value;
|
||||
private String desc;
|
||||
|
@ -11,4 +11,6 @@ public interface ErrorCodeConstants {
|
||||
// ========== 购物车 1008006000 ==========
|
||||
ErrorCode STORE_CART_NOT_EXISTS = new ErrorCode(1008006000, "购物车不存在");
|
||||
ErrorCode STORE_STOCK_ERROR = new ErrorCode(1008006001, "库存错误");
|
||||
|
||||
ErrorCode CAMPAIGN_NOT_EXISTS = new ErrorCode(1008006002, "规格未参加活动");
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Copyright (C) 2018-2022
|
||||
* All rights reserved, Designed By www.yixiang.co
|
||||
|
||||
*/
|
||||
package co.yixiang.yshop.module.cart.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @author moxiangrong
|
||||
* 下单类型枚举
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum OrderTypeEnum {
|
||||
|
||||
NORMAL_ORDER(1,"正常下单"),
|
||||
CAMPAIGN_ORDER(2,"活动下单");
|
||||
|
||||
|
||||
|
||||
private Integer value;
|
||||
private String desc;
|
||||
|
||||
public static OrderTypeEnum toType(int value) {
|
||||
return Stream.of(OrderTypeEnum.values())
|
||||
.filter(p -> p.value == value)
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -8,15 +8,19 @@
|
||||
*/
|
||||
package co.yixiang.yshop.module.cart.controller.app.cart;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.security.core.annotations.PreAuthenticated;
|
||||
import co.yixiang.yshop.module.cart.controller.app.cart.param.AppCartChangeSkuParam;
|
||||
import co.yixiang.yshop.module.cart.controller.app.cart.param.AppCartIdsParm;
|
||||
import co.yixiang.yshop.module.cart.controller.app.cart.param.AppCartNumParam;
|
||||
import co.yixiang.yshop.module.cart.controller.app.cart.param.AppCartParam;
|
||||
import co.yixiang.yshop.module.cart.enums.OrderTypeEnum;
|
||||
import co.yixiang.yshop.module.cart.service.storecart.AppStoreCartService;
|
||||
import co.yixiang.yshop.module.product.controller.app.campaigninfo.vo.CampaignNumberJudgeVO;
|
||||
import co.yixiang.yshop.module.product.controller.app.couponrelation.vo.CartCouponVO;
|
||||
import co.yixiang.yshop.module.product.controller.app.couponrelation.vo.UserCouponVO;
|
||||
import co.yixiang.yshop.module.product.service.campaigninfo.AppCampaignInfoService;
|
||||
import co.yixiang.yshop.module.product.service.teamworkinfo.TeamworkInfoService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
@ -50,6 +54,10 @@ public class AppCartController {
|
||||
|
||||
private final AppStoreCartService appStoreCartService;
|
||||
|
||||
private final TeamworkInfoService teamworkInfoService;
|
||||
|
||||
private final AppCampaignInfoService appCampaignInfoService;
|
||||
|
||||
/**
|
||||
* 购物车 获取数量
|
||||
*/
|
||||
@ -71,8 +79,17 @@ public class AppCartController {
|
||||
@Operation(summary = "添加购物车")
|
||||
|
||||
public CommonResult<Map<String,Object>> add(@Validated @RequestBody AppCartParam cartParam){
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
Long uid = getLoginUserId();
|
||||
if(OrderTypeEnum.CAMPAIGN_ORDER.getValue().equals(cartParam.getOrderType())){
|
||||
// 判断是否重复参加拼团
|
||||
if(ObjectUtil.isNotEmpty(cartParam.getTeamworkId()))
|
||||
teamworkInfoService.joinJudge(uid, cartParam.getTeamworkId());
|
||||
// 活动商品购买数量限制
|
||||
appCampaignInfoService.numberJudge(new CampaignNumberJudgeVO
|
||||
(cartParam.getUniqueId(), uid, cartParam.getCartNum()));
|
||||
}
|
||||
// 加入购物车并返回购物车id
|
||||
Map<String,Object> map = new LinkedHashMap<>();
|
||||
map.put("cartId",appStoreCartService.addCart(uid,cartParam.getProductId(),cartParam.getCartNum(),
|
||||
cartParam.getUniqueId(),cartParam.getIsNew(),cartParam.getCombinationId(),
|
||||
cartParam.getSecKillId(),cartParam.getBargainId()));
|
||||
|
@ -43,4 +43,13 @@ public class AppCartParam {
|
||||
|
||||
@Schema(description = "产品砍价ID", required = true)
|
||||
private Long bargainId = 0L;
|
||||
|
||||
@Schema(description = "活动id", required = true)
|
||||
private Long campaignId;
|
||||
|
||||
@Schema(description = "下单类型:1、普通下单,2、商品活动下单", required = true)
|
||||
private Integer orderType;
|
||||
|
||||
@Schema(description = "拼团id", required = true)
|
||||
private Long teamworkId;
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public interface AppStoreCartService extends IService<StoreCartDO> {
|
||||
* 购物车列表
|
||||
* @param uid 用户id
|
||||
* @param cartIds 购物车id,多个逗号隔开
|
||||
* @param status 0-购购物车列表
|
||||
* @param status 0-购购物车列表,2-活动商品
|
||||
* @return map valid-有效购物车 invalid-失效购物车
|
||||
*/
|
||||
Map<String,Object> getUserProductCartList(Long uid, String cartIds, Integer status);
|
||||
|
@ -12,16 +12,19 @@ import co.yixiang.yshop.module.cart.convert.storecart.StoreCartConvert;
|
||||
import co.yixiang.yshop.module.cart.dal.dataobject.storecart.StoreCartDO;
|
||||
import co.yixiang.yshop.module.cart.dal.mysql.storecart.StoreCartMapper;
|
||||
import co.yixiang.yshop.module.cart.enums.CartTypeEnum;
|
||||
import co.yixiang.yshop.module.product.controller.app.campaigninfo.vo.CampaignSkuVO;
|
||||
import co.yixiang.yshop.module.product.controller.app.cart.vo.AppStoreCartQueryVo;
|
||||
import co.yixiang.yshop.module.product.controller.app.couponrelation.vo.CartCouponVO;
|
||||
import co.yixiang.yshop.module.product.controller.app.product.vo.AppStoreProductRespVo;
|
||||
import co.yixiang.yshop.module.product.dal.dataobject.storeproduct.StoreProductDO;
|
||||
import co.yixiang.yshop.module.product.dal.dataobject.storeproductattrvalue.StoreProductAttrValueDO;
|
||||
import co.yixiang.yshop.module.product.service.campaigninfo.AppCampaignInfoService;
|
||||
import co.yixiang.yshop.module.product.service.productcouponrelation.AppCouponRelationService;
|
||||
import co.yixiang.yshop.module.product.service.productcouponrelation.dto.CartCouponDto;
|
||||
import co.yixiang.yshop.module.product.service.storeproduct.AppStoreProductService;
|
||||
import co.yixiang.yshop.module.product.service.storeproductattrvalue.StoreProductAttrValueService;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -32,13 +35,13 @@ import org.springframework.validation.annotation.Validated;
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static co.yixiang.yshop.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
||||
import static co.yixiang.yshop.module.cart.enums.ErrorCodeConstants.STORE_STOCK_ERROR;
|
||||
import static co.yixiang.yshop.module.cart.enums.ErrorCodeConstants.*;
|
||||
import static co.yixiang.yshop.module.product.enums.ErrorCodeConstants.STORE_PRODUCT_NOT_EXISTS;
|
||||
import static co.yixiang.yshop.module.cart.enums.ErrorCodeConstants.STORE_CART_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 购物车 Service 实现类
|
||||
@ -60,6 +63,9 @@ public class AppStoreCartServiceImpl extends ServiceImpl<StoreCartMapper, StoreC
|
||||
@Resource
|
||||
private AppCouponRelationService couponRelationService;
|
||||
|
||||
@Resource
|
||||
private AppCampaignInfoService appCampaignInfoService;
|
||||
|
||||
|
||||
/**
|
||||
* 返回当前用户购物车总数量
|
||||
@ -161,7 +167,7 @@ public class AppStoreCartServiceImpl extends ServiceImpl<StoreCartMapper, StoreC
|
||||
*
|
||||
* @param uid 用户id
|
||||
* @param cartIds 购物车id,多个逗号隔开
|
||||
* @param status 0-购购物车列表
|
||||
* @param status 0-购购物车列表,2-活动商品
|
||||
* @return map valid-有效购物车 invalid-失效购物车
|
||||
*/
|
||||
@Override
|
||||
@ -181,8 +187,33 @@ public class AppStoreCartServiceImpl extends ServiceImpl<StoreCartMapper, StoreC
|
||||
List<AppStoreCartQueryVo> valid = new ArrayList<>();
|
||||
List<AppStoreCartQueryVo> invalid = new ArrayList<>();
|
||||
|
||||
Map<Long, AppStoreProductRespVo> productMap = null;
|
||||
Map<String, StoreProductAttrValueDO> skuMap = null;
|
||||
Map<String, CampaignSkuVO> campaignSkuVOMap = null;
|
||||
if(CollectionUtils.isNotEmpty(carts)){
|
||||
// 查询商品列表
|
||||
List<Long> productIds = carts.stream().map(StoreCartDO::getProductId).collect(Collectors.toList());
|
||||
List<AppStoreProductRespVo> products = appStoreProductService.getStoreProductByIds(productIds);
|
||||
productMap = products.stream().collect(Collectors.toMap(AppStoreProductRespVo::getId, Function.identity()));
|
||||
// 查询商品规格列表
|
||||
List<String> skuUniques =
|
||||
carts.stream().map(StoreCartDO::getProductAttrUnique).collect(Collectors.toList());
|
||||
List<StoreProductAttrValueDO> skus =
|
||||
storeProductAttrValueService.list(Wrappers.<StoreProductAttrValueDO>lambdaQuery()
|
||||
.in(StoreProductAttrValueDO::getUnique, skuUniques));
|
||||
skuMap = skus.stream().collect(Collectors.toMap(StoreProductAttrValueDO::getUnique, Function.identity()));
|
||||
// 活动下单查询
|
||||
if (OrderInfoEnum.CAMPAIGN_ORDER.getValue().equals(status)) {
|
||||
List<CampaignSkuVO> campaignSkuVOS = appCampaignInfoService.getCampaignsByProductAttrUniques(skuUniques);
|
||||
if (CollectionUtils.isEmpty(campaignSkuVOS)) throw exception(CAMPAIGN_NOT_EXISTS);
|
||||
campaignSkuVOMap =
|
||||
campaignSkuVOS.stream().collect(Collectors
|
||||
.toMap(CampaignSkuVO::getProductAttrUnique, Function.identity()));
|
||||
}
|
||||
}
|
||||
|
||||
for (StoreCartDO storeCart : carts) {
|
||||
AppStoreProductRespVo storeProduct = appStoreProductService.getStoreProductById(storeCart.getProductId());
|
||||
AppStoreProductRespVo storeProduct = productMap.get(storeCart.getProductId());
|
||||
AppStoreCartQueryVo storeCartQueryVo = StoreCartConvert.INSTANCE.convert01(storeCart);
|
||||
if (ObjectUtil.isNull(storeProduct)) {
|
||||
this.removeById(storeCart.getId());
|
||||
@ -191,9 +222,7 @@ public class AppStoreCartServiceImpl extends ServiceImpl<StoreCartMapper, StoreC
|
||||
storeCartQueryVo.setProductInfo(storeProduct);
|
||||
invalid.add(storeCartQueryVo);
|
||||
} else {
|
||||
StoreProductAttrValueDO productAttrValue =
|
||||
storeProductAttrValueService.getOne(Wrappers.<StoreProductAttrValueDO>lambdaQuery()
|
||||
.eq(StoreProductAttrValueDO::getUnique, storeCart.getProductAttrUnique()));
|
||||
StoreProductAttrValueDO productAttrValue = skuMap.get(storeCart.getProductAttrUnique());
|
||||
if (ObjectUtil.isNull(productAttrValue) || productAttrValue.getStock() == 0) {
|
||||
storeCartQueryVo.setProductInfo(storeProduct);
|
||||
invalid.add(storeCartQueryVo);
|
||||
@ -202,6 +231,7 @@ public class AppStoreCartServiceImpl extends ServiceImpl<StoreCartMapper, StoreC
|
||||
storeCartQueryVo.setProductInfo(storeProduct);
|
||||
// 普通商品金额
|
||||
BigDecimal truePrice = productAttrValue.getPrice();
|
||||
Integer stock = productAttrValue.getStock();
|
||||
// 设置拼团价格
|
||||
if (storeCart.getCombinationId() > 0) {
|
||||
truePrice = productAttrValue.getPinkPrice();
|
||||
@ -210,8 +240,14 @@ public class AppStoreCartServiceImpl extends ServiceImpl<StoreCartMapper, StoreC
|
||||
if (storeCart.getSeckillId() > 0) {
|
||||
truePrice = productAttrValue.getSeckillPrice();
|
||||
}
|
||||
// 设置活动价格
|
||||
if (ObjectUtil.isNotNull(campaignSkuVOMap) &&
|
||||
campaignSkuVOMap.containsKey(productAttrValue.getUnique())) {
|
||||
truePrice = campaignSkuVOMap.get(productAttrValue.getUnique()).getPrice();
|
||||
stock = campaignSkuVOMap.get(productAttrValue.getUnique()).getStock();
|
||||
}
|
||||
storeCartQueryVo.setTruePrice(truePrice);
|
||||
storeCartQueryVo.setTrueStock(productAttrValue.getStock());
|
||||
storeCartQueryVo.setTrueStock(stock);
|
||||
valid.add(storeCartQueryVo);
|
||||
|
||||
}
|
||||
|
40
yshop-module-mall/yshop-module-distributor-api/pom.xml
Normal file
40
yshop-module-mall/yshop-module-distributor-api/pom.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-module-mall</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>yshop-module-distributor-api</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
分销商 API 模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-common</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>2.2.8</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,15 @@
|
||||
package co.yixiang.yshop.module.distributor.api;
|
||||
|
||||
import co.yixiang.yshop.module.distributor.api.dto.DistributorOrderDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DistributorOrderApi {
|
||||
|
||||
void createDistributorOrder(DistributorOrderDTO distributorOrderDTO);
|
||||
|
||||
void cancelDistributorOrder(List<Long> ids);
|
||||
|
||||
void updateDistributorOrder(DistributorOrderDTO distributorOrderDTO);
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.distributor.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorOrderDTO {
|
||||
|
||||
// 订单ID
|
||||
private Long oid;
|
||||
// 订单号
|
||||
private String orderId;
|
||||
// 下单用户
|
||||
private Long userId;
|
||||
// 用户昵称
|
||||
private String userName;
|
||||
// 分销商ID
|
||||
private Long distributorId;
|
||||
// 商品
|
||||
private List<DistributorProductDTO> productDTOList;
|
||||
// 结算类型
|
||||
private Integer distributorSettlementType;
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package co.yixiang.yshop.module.distributor.api.dto;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorProductDTO {
|
||||
|
||||
// 商品ID
|
||||
private Long productId;
|
||||
// 商品规格ID
|
||||
private Long productAttrValueId;
|
||||
// 商品名称
|
||||
private String productName;
|
||||
// 原价
|
||||
private BigDecimal productOriginalPrice;
|
||||
// 商品金额
|
||||
private BigDecimal productPrice;
|
||||
// 订单详情id
|
||||
private Long detailId;
|
||||
// 分销规则 0-默认 1-自定义
|
||||
private Integer distributionRule;
|
||||
// 分销自购 0-关闭 1-开启
|
||||
private Integer distributionPurchase;
|
||||
// 商品结算方式 0-实际支付价格 1-商品价格
|
||||
private Integer distributionProductSettlement;
|
||||
// 佣金结算方式 0-支付后结算 1-确认收获后结算 2-订单完成结算
|
||||
private Integer distributionWagesSettlement;
|
||||
// 分销规则 1-一级 2-二级
|
||||
private Integer distributionLevel;
|
||||
// 一级佣金比例
|
||||
private Integer firstWages;
|
||||
// 二级佣金比例
|
||||
private Integer secondWages;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.distributor.enums;
|
||||
|
||||
public interface DistributorConstants {
|
||||
|
||||
// 不自动通过
|
||||
String APPLY_FALSE = "0";
|
||||
|
||||
// 自动通过
|
||||
String APPLY_TRUE = "1";
|
||||
|
||||
// 无限制客户保护
|
||||
String UNLIMITED_USER_EXPIRE = "-1";
|
||||
|
||||
// 无限制年数
|
||||
Integer UNLIMITED_YEAR = 100;
|
||||
|
||||
String FALSE_STR = "0";
|
||||
|
||||
String TURE_STR = "1";
|
||||
|
||||
Integer FALSE_INTEGER = 0;
|
||||
|
||||
Integer TURE_INTEGER = 1;
|
||||
|
||||
Integer DEFAULT_LEVEL = 1;
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.distributor.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DistributorLevelTypeEnum {
|
||||
|
||||
P1(1,"一级分销商"),
|
||||
P2(2,"二级分销商"),;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String name;
|
||||
|
||||
public static DistributorLevelTypeEnum toType(Integer type) {
|
||||
return Stream.of(DistributorLevelTypeEnum.values())
|
||||
.filter(p -> Objects.equals(p.type, type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.distributor.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DistributorLevelUpTypeEnum {
|
||||
|
||||
ONLY(0,"任意"),
|
||||
ALL(1,"全部"),;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String name;
|
||||
|
||||
public static DistributorLevelUpTypeEnum toType(Integer type) {
|
||||
return Stream.of(DistributorLevelUpTypeEnum.values())
|
||||
.filter(p -> Objects.equals(p.type, type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.distributor.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DistributorOrderStatusEnum {
|
||||
|
||||
WAIT(0,"待结算"),
|
||||
COMPLETE(1,"已结算"),
|
||||
CANCEL(2,"已取消");
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String name;
|
||||
|
||||
public static DistributorOrderStatusEnum toStatus(Integer status) {
|
||||
return Stream.of(DistributorOrderStatusEnum.values())
|
||||
.filter(p -> Objects.equals(p.status, status))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.distributor.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DistributorProductTypeEnum {
|
||||
|
||||
NO(0,"不参加分销"),
|
||||
YES(1,"参加分销"),;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String name;
|
||||
|
||||
public static DistributorProductTypeEnum toType(Integer type) {
|
||||
return Stream.of(DistributorProductTypeEnum.values())
|
||||
.filter(p -> Objects.equals(p.type, type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.distributor.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DistributorSettlementTypeEnum {
|
||||
|
||||
PAY(0,"支付后结算"),
|
||||
CONFIRM(1,"确认收获后结算"),
|
||||
COMPLETE(2,"订单完成结算");
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String name;
|
||||
|
||||
public static DistributorSettlementTypeEnum toType(Integer type) {
|
||||
return Stream.of(DistributorSettlementTypeEnum.values())
|
||||
.filter(p -> Objects.equals(p.type, type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package co.yixiang.yshop.module.distributor.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DistributorStatusEnum {
|
||||
|
||||
NOT_APPLIED(-1,"已清退"),
|
||||
AUDIT(0,"待审核"),
|
||||
PASSED(1,"已通过"),
|
||||
REFUSED(2,"已拒绝");
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String name;
|
||||
|
||||
public static DistributorStatusEnum toStatus(Integer status) {
|
||||
return Stream.of(DistributorStatusEnum.values())
|
||||
.filter(p -> Objects.equals(p.status, status))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package co.yixiang.yshop.module.distributor.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DistributorWagesLogTypeEnum {
|
||||
|
||||
WAIT(0,"待入账"),
|
||||
COMPLETE(1,"已入账"),
|
||||
CANCEL(2,"已取消"),
|
||||
WITHDRAW_WAIT(3,"提现中"),
|
||||
WITHDRAW_COMPLETE(4,"提现成功"),
|
||||
WITHDRAW_FAIL(5,"提现失败"),
|
||||
;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String name;
|
||||
|
||||
public static DistributorWagesLogTypeEnum toType(Integer type) {
|
||||
return Stream.of(DistributorWagesLogTypeEnum.values())
|
||||
.filter(p -> Objects.equals(p.type, type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package co.yixiang.yshop.module.distributor.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DistributorWithdrawalMethodTypeEnum {
|
||||
|
||||
BALANCE(0,"余额"),
|
||||
AIL_PAY(1,"支付宝"),
|
||||
;
|
||||
|
||||
private Integer type;
|
||||
|
||||
private String paymentMethod;
|
||||
|
||||
public static DistributorWithdrawalMethodTypeEnum toType(Integer type) {
|
||||
return Stream.of(DistributorWithdrawalMethodTypeEnum.values())
|
||||
.filter(p -> Objects.equals(p.type, type))
|
||||
.findAny()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package co.yixiang.yshop.module.distributor.enums;
|
||||
|
||||
import co.yixiang.yshop.framework.common.exception.ErrorCode;
|
||||
|
||||
public interface ErrorCodeConstants {
|
||||
ErrorCode DISTRIBUTOR_NOT_EXISTS = new ErrorCode(1000001, "分销商不存在");
|
||||
|
||||
ErrorCode DISTRIBUTOR_USER_EXISTS = new ErrorCode(1000002, "您已申请过成为分销商请勿重复申请");
|
||||
|
||||
ErrorCode LEVEL_NOT_EXISTS = new ErrorCode(1100001, "分销商等级不存在");
|
||||
|
||||
ErrorCode LEVEL_EXISTS = new ErrorCode(1100002, "分销商等级已存在,请从新选择");
|
||||
|
||||
ErrorCode LEVEL_SUPERIOR_NOT_EXISTS = new ErrorCode(1100003, "上一等级未设置,请从新选择");
|
||||
|
||||
ErrorCode LEVEL_USERCOUNT_ERROR = new ErrorCode(1100004, "累计金额需要大于上一等级");
|
||||
|
||||
ErrorCode LEVEL_AMOUNT_ERROR = new ErrorCode(1100005, "累计用户需要大于上一等级");
|
||||
|
||||
ErrorCode LEVEL_WAGES_ERROR = new ErrorCode(1100006, "累计佣金需要大于上一等级");
|
||||
|
||||
ErrorCode LEVEL_USERCOUNT_LESS_ERROR = new ErrorCode(1100007, "累计金额需要小于下一等级");
|
||||
|
||||
ErrorCode LEVEL_AMOUNT_LESS_ERROR = new ErrorCode(1100008, "累计用户需要小于下一等级");
|
||||
|
||||
ErrorCode LEVEL_WAGES_LESS_ERROR = new ErrorCode(1100009, "累计佣金需要小于下一等级");
|
||||
|
||||
|
||||
ErrorCode ORDER_NOT_EXISTS = new ErrorCode(80003, "分销商订单不存在");
|
||||
|
||||
ErrorCode USER_NOT_EXISTS = new ErrorCode(80004, "分销商所属用户不存在");
|
||||
|
||||
ErrorCode WAGES_NOT_EXISTS = new ErrorCode(80005, "分销商佣金不存在");
|
||||
|
||||
ErrorCode WAGES_LOG_NOT_EXISTS = new ErrorCode(80006, "分销商佣金记录不存在");
|
||||
|
||||
ErrorCode DYNAMICS_NOT_EXISTS = new ErrorCode(80007, "分销商动态不存在");
|
||||
|
||||
ErrorCode WITHDRAWAL_METHOD_NOT_EXISTS = new ErrorCode(80008, "分销商提现方式不存在");
|
||||
|
||||
ErrorCode WITHDRAWAL_METHOD_EXISTS_USER = new ErrorCode(1200001, "提现方式不属于此登录用户");
|
||||
|
||||
ErrorCode WITHDRAWAL_AMOUNT_INSUFFICIENT = new ErrorCode(1200002, "可提现余额不足");
|
||||
|
||||
ErrorCode WITHDRAWAL_ALI_NOT_EXISTS = new ErrorCode(1200003, "未绑定支付宝账号");
|
||||
}
|
||||
|
84
yshop-module-mall/yshop-module-distributor-biz/pom.xml
Normal file
84
yshop-module-mall/yshop-module-distributor-biz/pom.xml
Normal file
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-module-mall</artifactId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>yshop-module-distributor-biz</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>${project.artifactId}</name>
|
||||
<description>
|
||||
分销商模块
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-module-distributor-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务组件 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-biz-operatelog</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Web 相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- DB 相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-mybatis</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test 测试相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 工具类相关 -->
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-excel</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-spring-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-module-member-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-module-product-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>co.yixiang.boot</groupId>
|
||||
<artifactId>yshop-module-member-biz</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,279 @@
|
||||
package co.yixiang.yshop.module.distributor.api;
|
||||
|
||||
import co.yixiang.yshop.framework.common.util.collection.CollectionUtils;
|
||||
import co.yixiang.yshop.framework.dict.core.util.DictFrameworkUtils;
|
||||
import co.yixiang.yshop.module.distributor.api.dto.DistributorOrderDTO;
|
||||
import co.yixiang.yshop.module.distributor.api.dto.DistributorProductDTO;
|
||||
import co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo.DistributorOrderExportReqVO;
|
||||
import co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo.DistributorOrderUpdateReqVO;
|
||||
import co.yixiang.yshop.module.distributor.dal.dataobject.distributor.DistributorDO;
|
||||
import co.yixiang.yshop.module.distributor.dal.dataobject.distributorlevel.DistributorLevelDO;
|
||||
import co.yixiang.yshop.module.distributor.dal.dataobject.distributororder.DistributorOrderDO;
|
||||
import co.yixiang.yshop.module.distributor.dal.dataobject.distributoruser.DistributorUserDO;
|
||||
import co.yixiang.yshop.module.distributor.enums.DistributorConstants;
|
||||
import co.yixiang.yshop.module.distributor.enums.DistributorLevelTypeEnum;
|
||||
import co.yixiang.yshop.module.distributor.enums.DistributorOrderStatusEnum;
|
||||
import co.yixiang.yshop.module.distributor.enums.DistributorSettlementTypeEnum;
|
||||
import co.yixiang.yshop.module.distributor.service.distributor.DistributorFacade;
|
||||
import co.yixiang.yshop.module.distributor.service.distributor.DistributorService;
|
||||
import co.yixiang.yshop.module.distributor.service.distributorlevel.DistributorLevelService;
|
||||
import co.yixiang.yshop.module.distributor.service.distributororder.DistributorOrderService;
|
||||
import co.yixiang.yshop.module.distributor.service.distributoruser.DistributorUserFacade;
|
||||
import co.yixiang.yshop.module.distributor.service.distributoruser.DistributorUserService;
|
||||
import co.yixiang.yshop.module.distributor.service.distributorwages.DistributorWagesFacade;
|
||||
import co.yixiang.yshop.module.system.enums.DistributorDictEnum;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class DistributorOrderApiImpl implements DistributorOrderApi {
|
||||
|
||||
@Resource
|
||||
private DistributorUserService distributorUserService;
|
||||
|
||||
@Resource
|
||||
private DistributorService distributorService;
|
||||
|
||||
@Resource
|
||||
private DistributorLevelService distributorLevelService;
|
||||
|
||||
@Resource
|
||||
private DistributorFacade distributorFacade;
|
||||
|
||||
@Resource
|
||||
private DistributorOrderService distributorOrderService;
|
||||
|
||||
@Resource
|
||||
private DistributorWagesFacade distributorWagesFacade;
|
||||
|
||||
@Override
|
||||
public void createDistributorOrder(DistributorOrderDTO distributorOrderDTO) {
|
||||
List<DistributorOrderDO> list = new ArrayList<>();
|
||||
|
||||
// 所属一级ID
|
||||
Long superiorIdP1 = null;
|
||||
// 一级名称
|
||||
String superiorNameP1 = null;
|
||||
// 所属二级ID
|
||||
Long superiorIdP2 = null;
|
||||
// 二级名称
|
||||
String superiorNameP2 = null;
|
||||
// 下单是不是分销商
|
||||
Boolean isDistributor = Boolean.FALSE;
|
||||
|
||||
Integer distributorWager = 0;
|
||||
Integer firstWages = 0;
|
||||
Integer secondWages = 0;
|
||||
|
||||
// 获取全局自购返佣
|
||||
String purchase = DictFrameworkUtils.parseDictDataValue(DistributorDictEnum.DISTRIBUTOR_PURCHASE.getDictType(), DistributorDictEnum.DISTRIBUTOR_PURCHASE.getLabel());
|
||||
|
||||
// 获取下单用户是不是分销商
|
||||
DistributorDO distributorDO = distributorService.getDistributorByUserId(distributorOrderDTO.getUserId());
|
||||
DistributorLevelDO levelP0 = null;
|
||||
if (distributorDO != null) {
|
||||
isDistributor = Boolean.TRUE;
|
||||
levelP0 = distributorLevelService.getLevel(distributorDO.getLevelId());
|
||||
distributorWager = levelP0.getFirstWages();
|
||||
}
|
||||
|
||||
// 没有分销商id 获取绑定关系 订单分销商id为空
|
||||
if (distributorOrderDTO.getDistributorId() == null) {
|
||||
// 获取绑定关系
|
||||
DistributorUserDO distributorUserDO = distributorUserService.getByUserId(distributorOrderDTO.getUserId());
|
||||
if (distributorUserDO != null && distributorUserDO.getExpireTime().isAfter(LocalDateTime.now())) {
|
||||
// 有绑定搞关系
|
||||
superiorIdP1 = distributorUserDO.getSuperiorIdP1();
|
||||
superiorNameP1 = distributorUserDO.getSuperiorNameP1();
|
||||
superiorIdP2 = distributorUserDO.getSuperiorIdP2();
|
||||
superiorNameP2 = distributorUserDO.getSuperiorNameP2();
|
||||
}else if (!isDistributor){
|
||||
// 不是分销并且没有绑定关系
|
||||
return;
|
||||
}
|
||||
}else {
|
||||
// 有分销商id绑定用户
|
||||
Long distributorUserId = distributorFacade.bindUser(distributorOrderDTO.getDistributorId(), distributorOrderDTO.getUserId(), DistributorConstants.FALSE_INTEGER);
|
||||
// 获取用户绑定关系
|
||||
DistributorUserDO distributorUserDO = distributorUserService.getUser(distributorUserId);
|
||||
superiorIdP1 = distributorUserDO.getSuperiorIdP1();
|
||||
superiorNameP1 = distributorUserDO.getSuperiorNameP1();
|
||||
superiorIdP2 = distributorUserDO.getSuperiorIdP2();
|
||||
superiorNameP2 = distributorUserDO.getSuperiorNameP2();
|
||||
}
|
||||
|
||||
// 一级分销商
|
||||
DistributorDO superiorP1;
|
||||
DistributorLevelDO levelP1;
|
||||
|
||||
if (superiorIdP1 != null) {
|
||||
// 一级分销商
|
||||
superiorP1 = distributorService.get(superiorIdP1);
|
||||
levelP1 = distributorLevelService.getLevel(superiorP1.getLevelId());
|
||||
firstWages = levelP1.getFirstWages();
|
||||
}
|
||||
|
||||
// 二级分销商
|
||||
DistributorDO superiorP2;
|
||||
DistributorLevelDO levelP2;
|
||||
|
||||
if (superiorIdP2 != null) {
|
||||
superiorP2 = distributorService.get(superiorIdP2);
|
||||
levelP2 = distributorLevelService.getLevel(superiorP2.getLevelId());
|
||||
secondWages = levelP2.getSecondWages();
|
||||
}
|
||||
|
||||
// 保存订单
|
||||
List<DistributorProductDTO> productDTOList = distributorOrderDTO.getProductDTOList();
|
||||
for (DistributorProductDTO dto: productDTOList) {
|
||||
DistributorOrderDO distributorOrderDO = new DistributorOrderDO();
|
||||
distributorOrderDO.setOid(distributorOrderDTO.getOid());
|
||||
distributorOrderDO.setOrderId(distributorOrderDTO.getOrderId());
|
||||
distributorOrderDO.setUserId(distributorOrderDTO.getUserId());
|
||||
distributorOrderDO.setUserName(distributorOrderDTO.getUserName());
|
||||
distributorOrderDO.setProductOriginalPrice(dto.getProductOriginalPrice());
|
||||
distributorOrderDO.setProductPrice(dto.getProductPrice());
|
||||
distributorOrderDO.setProductId(dto.getProductId());
|
||||
distributorOrderDO.setProductName(dto.getProductName());
|
||||
distributorOrderDO.setProductAttrValueId(dto.getProductAttrValueId());
|
||||
distributorOrderDO.setDetailId(dto.getDetailId());
|
||||
distributorOrderDO.setDistributionRule(dto.getDistributionRule());
|
||||
|
||||
// 判断商品结算方式
|
||||
BigDecimal price;
|
||||
distributorOrderDO.setDistributionProductSettlement(dto.getDistributionProductSettlement());
|
||||
if (dto.getDistributionProductSettlement().equals(DistributorConstants.FALSE_INTEGER)) {
|
||||
// 实际支付
|
||||
price = dto.getProductPrice();
|
||||
}else {
|
||||
// 商品价格
|
||||
price = dto.getProductOriginalPrice();
|
||||
}
|
||||
// 判断分销等级
|
||||
distributorOrderDO.setDistributionLevel(dto.getDistributionLevel());
|
||||
// 判断全局自购开启并且商品支持自购
|
||||
if (purchase.equals(DistributorConstants.TURE_STR) && dto.getDistributionPurchase().equals(DistributorConstants.TURE_INTEGER) && isDistributor) {
|
||||
// 自购逻辑
|
||||
distributorOrderDO.setSuperiorIdP1(distributorDO.getId());
|
||||
distributorOrderDO.setSuperiorNameP1(distributorDO.getRealName());
|
||||
|
||||
// 判断商品分销规则
|
||||
if (dto.getDistributionRule().equals(DistributorConstants.FALSE_INTEGER)) {
|
||||
// 默认
|
||||
distributorOrderDO.setFirstWages(distributorWager);
|
||||
distributorOrderDO.setSecondWages(firstWages);
|
||||
}else {
|
||||
// 自定义
|
||||
distributorOrderDO.setFirstWages(dto.getFirstWages());
|
||||
distributorOrderDO.setSecondWages(dto.getSecondWages());
|
||||
}
|
||||
|
||||
distributorOrderDO.setFirstAmount(new BigDecimal(distributorOrderDO.getFirstWages()).multiply(price).divide(new BigDecimal(100), RoundingMode.HALF_DOWN));
|
||||
|
||||
// 判断开启二级分销
|
||||
if (dto.getDistributionLevel().equals(DistributorLevelTypeEnum.P2.getType())) {
|
||||
// 有二级
|
||||
distributorOrderDO.setSuperiorIdP2(superiorIdP1);
|
||||
distributorOrderDO.setSuperiorNameP2(superiorNameP1);
|
||||
distributorOrderDO.setSecondAmount(new BigDecimal(distributorOrderDO.getSecondWages()).multiply(price).divide(new BigDecimal(100), RoundingMode.HALF_DOWN));
|
||||
}
|
||||
}else {
|
||||
// 正常逻辑
|
||||
distributorOrderDO.setSuperiorIdP1(superiorIdP1);
|
||||
distributorOrderDO.setSuperiorNameP1(superiorNameP1);
|
||||
// 判断商品分销规则
|
||||
if (dto.getDistributionRule().equals(DistributorConstants.FALSE_INTEGER)) {
|
||||
// 默认
|
||||
distributorOrderDO.setFirstWages(firstWages);
|
||||
distributorOrderDO.setSecondWages(secondWages);
|
||||
}else {
|
||||
// 自定义
|
||||
distributorOrderDO.setFirstWages(dto.getFirstWages());
|
||||
distributorOrderDO.setSecondWages(dto.getSecondWages());
|
||||
}
|
||||
|
||||
distributorOrderDO.setFirstAmount(new BigDecimal(distributorOrderDO.getFirstWages()).multiply(price).divide(new BigDecimal(100), RoundingMode.HALF_DOWN));
|
||||
|
||||
// 判断开启二级分销
|
||||
if (dto.getDistributionLevel().equals(DistributorLevelTypeEnum.P2.getType())) {
|
||||
// 有二级
|
||||
distributorOrderDO.setSuperiorIdP2(superiorIdP2);
|
||||
distributorOrderDO.setSuperiorNameP2(superiorNameP2);
|
||||
distributorOrderDO.setSecondAmount(new BigDecimal(distributorOrderDO.getSecondWages()).multiply(price).divide(new BigDecimal(100), RoundingMode.HALF_DOWN));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 佣金结算方式 0-支付后结算 1-确认收获后结算 2-订单完成结算
|
||||
distributorOrderDO.setDistributionWagesSettlement(dto.getDistributionWagesSettlement());
|
||||
if (dto.getDistributionWagesSettlement().equals(DistributorSettlementTypeEnum.PAY.getType())) {
|
||||
// 支付后结算
|
||||
distributorOrderDO.setStatus(DistributorOrderStatusEnum.COMPLETE.getStatus());
|
||||
distributorOrderDO.setSettlementTime(LocalDateTime.now());
|
||||
}else {
|
||||
distributorOrderDO.setStatus(DistributorOrderStatusEnum.WAIT.getStatus());
|
||||
}
|
||||
|
||||
|
||||
// 保存集合
|
||||
list.add(distributorOrderDO);
|
||||
}
|
||||
|
||||
// 批量保存
|
||||
distributorOrderService.insertBatch(list);
|
||||
// 结算佣金
|
||||
list.forEach(x -> {
|
||||
distributorWagesFacade.saveWages(x);
|
||||
if (x.getStatus().equals(DistributorOrderStatusEnum.COMPLETE.getStatus())) {
|
||||
distributorWagesFacade.settlementWages(x);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelDistributorOrder(List<Long> ids) {
|
||||
List<DistributorOrderDO> orderList = distributorOrderService.getOrderList(new DistributorOrderExportReqVO().setDetailIds(ids));
|
||||
// 所有详情id
|
||||
List<Long> distributorOrderIds = CollectionUtils.convertList(orderList, DistributorOrderDO::getId);
|
||||
distributorWagesFacade.cancelWages(distributorOrderIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDistributorOrder(DistributorOrderDTO distributorOrderDTO) {
|
||||
// 所有商品
|
||||
List<DistributorProductDTO> productDTOList = distributorOrderDTO.getProductDTOList();
|
||||
|
||||
for (DistributorProductDTO dto : productDTOList) {
|
||||
// 查询此订单
|
||||
DistributorOrderDO distributorOrderDO = distributorOrderService.getOrderByDetailId(dto.getDetailId());
|
||||
if (distributorOrderDO.getStatus().equals(DistributorOrderStatusEnum.WAIT.getStatus())) {
|
||||
// 判断结算步骤
|
||||
boolean isCompleteSettlementType = distributorOrderDTO.getDistributorSettlementType().equals(DistributorSettlementTypeEnum.COMPLETE.getType());
|
||||
boolean isMatchingDistributionProductSettlement = distributorOrderDTO.getDistributorSettlementType().equals(distributorOrderDO.getDistributionProductSettlement());
|
||||
|
||||
if (isCompleteSettlementType || isMatchingDistributionProductSettlement) {
|
||||
// 直接结算
|
||||
settleOrderAndWages(distributorOrderDO);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void settleOrderAndWages(DistributorOrderDO distributorOrderDO) {
|
||||
// 更新订单状态订单
|
||||
DistributorOrderUpdateReqVO distributorOrderUpdateReqVO = new DistributorOrderUpdateReqVO();
|
||||
distributorOrderUpdateReqVO.setId(distributorOrderDO.getId());
|
||||
distributorOrderUpdateReqVO.setStatus(DistributorOrderStatusEnum.COMPLETE.getStatus());
|
||||
distributorOrderUpdateReqVO.setSettlementTime(LocalDateTime.now());
|
||||
distributorOrderService.updateOrder(distributorOrderUpdateReqVO);
|
||||
distributorWagesFacade.settlementWages(distributorOrderDO);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributor;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.module.distributor.controller.admin.distributor.vo.*;
|
||||
import co.yixiang.yshop.module.distributor.convert.distributor.DistributorConvert;
|
||||
import co.yixiang.yshop.module.distributor.dal.dataobject.distributor.DistributorDO;
|
||||
import co.yixiang.yshop.module.distributor.service.distributor.DistributorFacade;
|
||||
import co.yixiang.yshop.module.distributor.service.distributor.DistributorService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
@Tag(name = "管理后台 - 分销商")
|
||||
@RestController
|
||||
@RequestMapping("/distributor/distributor")
|
||||
@Validated
|
||||
public class DistributorController {
|
||||
|
||||
@Resource
|
||||
private DistributorService distributorService;
|
||||
|
||||
@Resource
|
||||
private DistributorFacade distributorFacade;
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新分销商")
|
||||
@PreAuthorize("@ss.hasPermission('distributor::update')")
|
||||
public CommonResult<Boolean> update(@Valid @RequestBody DistributorUpdateReqVO updateReqVO) {
|
||||
distributorService.update(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除分销商")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('distributor::delete')")
|
||||
public CommonResult<Boolean> delete(@RequestParam("id") Long id) {
|
||||
distributorService.delete(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得分销商详情")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('distributor::query')")
|
||||
public CommonResult<DistributorRespVO> get(@RequestParam("id") Long id) {
|
||||
return success(distributorFacade.getDetails(id));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得分销商列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('distributor::query')")
|
||||
public CommonResult<List<DistributorRespVO>> getList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<DistributorDO> list = distributorService.getList(ids);
|
||||
return success(DistributorConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得分销商分页")
|
||||
@PreAuthorize("@ss.hasPermission('distributor::query')")
|
||||
public CommonResult<PageResult<DistributorRespVO>> getPage(@Valid DistributorPageReqVO pageVO) {
|
||||
PageResult<DistributorDO> pageResult = distributorFacade.getPage(pageVO);
|
||||
return success(DistributorConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@PostMapping("/verify")
|
||||
@Operation(summary = "审核分销商")
|
||||
@PreAuthorize("@ss.hasPermission('distributor::create')")
|
||||
public CommonResult<Boolean> verify(@Valid @RequestBody DistributorApplyReqVO reqVO) {
|
||||
distributorFacade.verify(reqVO);
|
||||
return success(Boolean.TRUE);
|
||||
}
|
||||
|
||||
// 清退分销商
|
||||
@PostMapping("/clearance")
|
||||
@Operation(summary = "清退/恢复分销商")
|
||||
@PreAuthorize("@ss.hasPermission('distributor::create')")
|
||||
public CommonResult<Boolean> clearance(@Valid @RequestBody DistributorClearanceReqVO reqVO) {
|
||||
distributorFacade.clearance(reqVO);
|
||||
return success(Boolean.TRUE);
|
||||
}
|
||||
|
||||
@PostMapping("/restore")
|
||||
@Operation(summary = "恢复分销商")
|
||||
@PreAuthorize("@ss.hasPermission('distributor::create')")
|
||||
public CommonResult<Boolean> restore(@Valid @RequestBody DistributorClearanceReqVO reqVO) {
|
||||
distributorFacade.restore(reqVO);
|
||||
return success(Boolean.TRUE);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributor.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 分销商 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class DistributorApplyReqVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "463")
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "拒绝原因")
|
||||
private String refuse;
|
||||
|
||||
@Schema(description = "状态 -1-清退 0-待审核 1-已通过 2-已拒绝", example = "1")
|
||||
private Integer status;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributor.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 分销商 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class DistributorBaseVO {
|
||||
|
||||
@Schema(description = "用户ID", example = "12876")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "真实姓名", example = "王五")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "等级ID", example = "7188")
|
||||
private Long levelId;
|
||||
|
||||
@Schema(description = "上级ID", example = "16998")
|
||||
private Long superiorId;
|
||||
|
||||
@Schema(description = "上级名称", example = "yshop")
|
||||
private String superiorName;
|
||||
|
||||
@Schema(description = "地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "申请原因", example = "不对")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "拒绝原因")
|
||||
private String refuse;
|
||||
|
||||
@Schema(description = "状态 -1-清退 0-待审核 1-已通过 2-已拒绝", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "累计金额")
|
||||
private BigDecimal addUpAmount;
|
||||
|
||||
@Schema(description = "累计佣金")
|
||||
private BigDecimal addUpWages;
|
||||
|
||||
@Schema(description = "累计用户")
|
||||
private Integer addUpUser;
|
||||
|
||||
@Schema(description = "累计下级经销商")
|
||||
private Integer addUpDistributor;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributor.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 分销商 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class DistributorClearanceReqVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "463")
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributor.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "创建分销商")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorCreateReqVO {
|
||||
|
||||
@Schema(description = "用户ID", example = "12876")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "等级ID", example = "7188")
|
||||
private Long levelId;
|
||||
|
||||
@Schema(description = "真实姓名", example = "王五")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "上级ID")
|
||||
private Long superiorId;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributor.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 分销商 Excel VO
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Data
|
||||
public class DistributorExcelVO {
|
||||
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("用户ID")
|
||||
private Long userId;
|
||||
|
||||
@ExcelProperty("真实姓名")
|
||||
private String realName;
|
||||
|
||||
@ExcelProperty("等级ID")
|
||||
private Long levelId;
|
||||
|
||||
@ExcelProperty("上级ID")
|
||||
private Long superiorId;
|
||||
|
||||
@ExcelProperty("上级名称")
|
||||
private String superiorName;
|
||||
|
||||
@ExcelProperty("地址")
|
||||
private String address;
|
||||
|
||||
@ExcelProperty("申请原因")
|
||||
private String reason;
|
||||
|
||||
@ExcelProperty("拒绝原因")
|
||||
private String refuse;
|
||||
|
||||
@ExcelProperty("状态 0-待审核 1-已通过 2-已拒绝")
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("累计金额")
|
||||
private BigDecimal addUpAmount;
|
||||
|
||||
@ExcelProperty("累计佣金")
|
||||
private BigDecimal addUpWages;
|
||||
|
||||
@ExcelProperty("累计用户")
|
||||
private Integer addUpUser;
|
||||
|
||||
@ExcelProperty("累计下级经销商")
|
||||
private Integer addUpDistributor;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributor.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商 Excel 导出 Request VO,参数和 DistributorPageReqVO 是一致的")
|
||||
@Data
|
||||
public class DistributorExportReqVO {
|
||||
|
||||
@Schema(description = "用户ID", example = "12876")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "真实姓名", example = "王五")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "等级ID", example = "7188")
|
||||
private Long levelId;
|
||||
|
||||
@Schema(description = "地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "申请原因", example = "不对")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "拒绝原因")
|
||||
private String refuse;
|
||||
|
||||
@Schema(description = "累计金额")
|
||||
private BigDecimal addUpAmount;
|
||||
|
||||
@Schema(description = "累计佣金")
|
||||
private BigDecimal addUpWages;
|
||||
|
||||
@Schema(description = "累计下级经销商")
|
||||
private Integer addUpDistributor;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "所属一级ID")
|
||||
private Long superiorIdP1;
|
||||
|
||||
@Schema(description = "上级名称")
|
||||
private String superiorNameP1;
|
||||
|
||||
@Schema(description = "所属二级ID")
|
||||
private Long superiorIdP2;
|
||||
|
||||
@Schema(description = "上级名称")
|
||||
private String superiorNameP2;
|
||||
|
||||
@Schema(description = "状态-1-清退 0-待审核 1-已通过 2-已拒绝", example = "2")
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributor.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户ID", example = "12876")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "真实姓名", example = "王五")
|
||||
private String realName;
|
||||
|
||||
@Schema(description = "等级ID", example = "7188")
|
||||
private Long levelId;
|
||||
|
||||
@Schema(description = "上级ID", example = "16998")
|
||||
private Long superiorId;
|
||||
|
||||
@Schema(description = "上级名称", example = "yshop")
|
||||
private String superiorName;
|
||||
|
||||
@Schema(description = "地址")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "申请原因", example = "不对")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "拒绝原因")
|
||||
private String refuse;
|
||||
|
||||
@Schema(description = "状态 0-待审核 1-已通过 2-已拒绝", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "累计金额")
|
||||
private BigDecimal addUpAmount;
|
||||
|
||||
@Schema(description = "累计佣金")
|
||||
private BigDecimal addUpWages;
|
||||
|
||||
@Schema(description = "累计用户")
|
||||
private Integer addUpUser;
|
||||
|
||||
@Schema(description = "累计下级经销商")
|
||||
private Integer addUpDistributor;
|
||||
|
||||
/**
|
||||
* 所属一级ID
|
||||
*/
|
||||
private Long superiorIdP1;
|
||||
/**
|
||||
* 上级名称
|
||||
*/
|
||||
private String superiorNameP1;
|
||||
/**
|
||||
* 所属二级ID
|
||||
*/
|
||||
private Long superiorIdP2;
|
||||
/**
|
||||
* 上级名称
|
||||
*/
|
||||
private String superiorNameP2;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributor.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorRespVO extends DistributorBaseVO {
|
||||
|
||||
@Schema(description = "主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "分销商等级名称")
|
||||
private String levelName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
// 一级佣金比例
|
||||
@Schema(description = "一级佣金比例")
|
||||
private Integer firstWages;
|
||||
|
||||
// 二级佣金比例
|
||||
@Schema(description = "二级佣金比例")
|
||||
private Integer secondWages;
|
||||
|
||||
// 团队人数
|
||||
@Schema(description = "团队人数")
|
||||
private Integer userCount;
|
||||
|
||||
// 一级团队人数
|
||||
@Schema(description = "一级团队人数")
|
||||
private Integer p1UserCount;
|
||||
|
||||
// 二级团队人数
|
||||
@Schema(description = "二级团队人数")
|
||||
private Integer p2UserCount;
|
||||
|
||||
// 一级分销商数
|
||||
@Schema(description = "一级分销商数")
|
||||
private Integer firstDistributorCount;
|
||||
|
||||
// 二级分销商数
|
||||
@Schema(description = "二级分销商数")
|
||||
private Integer secondDistributorCount;
|
||||
|
||||
// 团队分销金额
|
||||
@Schema(description = "团队分销金额")
|
||||
private BigDecimal amountCount;
|
||||
|
||||
// 团队分销订单数
|
||||
@Schema(description = "团队分销订单数")
|
||||
private Integer orderCount;
|
||||
|
||||
@Schema(description = "一级分销商分销金额")
|
||||
private BigDecimal firstAmountCount;
|
||||
|
||||
@Schema(description = "一级分销商订单数")
|
||||
private Integer firstOrderCount;
|
||||
|
||||
@Schema(description = "二级分销商分销金额")
|
||||
private BigDecimal secondAmountCount;
|
||||
|
||||
@Schema(description = "二级分销商订单数")
|
||||
private Integer secondOrderCount;
|
||||
|
||||
/**
|
||||
* 所属一级ID
|
||||
*/
|
||||
private Long superiorIdP1;
|
||||
/**
|
||||
* 上级名称
|
||||
*/
|
||||
private String superiorNameP1;
|
||||
/**
|
||||
* 所属二级ID
|
||||
*/
|
||||
private Long superiorIdP2;
|
||||
/**
|
||||
* 上级名称
|
||||
*/
|
||||
private String superiorNameP2;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributor.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorUpdateReqVO extends DistributorBaseVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "463")
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributordynamics;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import co.yixiang.yshop.module.distributor.controller.admin.distributordynamics.vo.*;
|
||||
import co.yixiang.yshop.module.distributor.dal.dataobject.distributordynamics.DistributorDynamicsDO;
|
||||
import co.yixiang.yshop.module.distributor.convert.distributordynamics.DistributorDynamicsConvert;
|
||||
import co.yixiang.yshop.module.distributor.service.distributordynamics.DistributorDynamicsService;
|
||||
|
||||
@Tag(name = "管理后台 - 分销商动态")
|
||||
@RestController
|
||||
@RequestMapping("/distributor/dynamics")
|
||||
@Validated
|
||||
public class DistributorDynamicsController {
|
||||
|
||||
@Resource
|
||||
private DistributorDynamicsService dynamicsService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建分销商动态")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:dynamics:create')")
|
||||
public CommonResult<Long> createDynamics(@Valid @RequestBody DistributorDynamicsCreateReqVO createReqVO) {
|
||||
return success(dynamicsService.createDynamics(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新分销商动态")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:dynamics:update')")
|
||||
public CommonResult<Boolean> updateDynamics(@Valid @RequestBody DistributorDynamicsUpdateReqVO updateReqVO) {
|
||||
dynamicsService.updateDynamics(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除分销商动态")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('distributor:dynamics:delete')")
|
||||
public CommonResult<Boolean> deleteDynamics(@RequestParam("id") Long id) {
|
||||
dynamicsService.deleteDynamics(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得分销商动态")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:dynamics:query')")
|
||||
public CommonResult<DistributorDynamicsRespVO> getDynamics(@RequestParam("id") Long id) {
|
||||
DistributorDynamicsDO dynamics = dynamicsService.getDynamics(id);
|
||||
return success(DistributorDynamicsConvert.INSTANCE.convert(dynamics));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得分销商动态列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:dynamics:query')")
|
||||
public CommonResult<List<DistributorDynamicsRespVO>> getDynamicsList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<DistributorDynamicsDO> list = dynamicsService.getDynamicsList(ids);
|
||||
return success(DistributorDynamicsConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得分销商动态分页")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:dynamics:query')")
|
||||
public CommonResult<PageResult<DistributorDynamicsRespVO>> getDynamicsPage(@Valid DistributorDynamicsPageReqVO pageVO) {
|
||||
PageResult<DistributorDynamicsDO> pageResult = dynamicsService.getDynamicsPage(pageVO);
|
||||
return success(DistributorDynamicsConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出分销商动态 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:dynamics:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportDynamicsExcel(@Valid DistributorDynamicsExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<DistributorDynamicsDO> list = dynamicsService.getDynamicsList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<DistributorDynamicsExcelVO> datas = DistributorDynamicsConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "分销商动态.xls", "数据", DistributorDynamicsExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributordynamics.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 分销商动态 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class DistributorDynamicsBaseVO {
|
||||
|
||||
@Schema(description = "动态类型", example = "2")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "分销商ID", example = "27176")
|
||||
private Long distributorId;
|
||||
|
||||
@Schema(description = "分销商名称", example = "张三")
|
||||
private String distributorName;
|
||||
|
||||
@Schema(description = "内容")
|
||||
private String content;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributordynamics.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商动态创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorDynamicsCreateReqVO extends DistributorDynamicsBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributordynamics.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 分销商动态 Excel VO
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Data
|
||||
public class DistributorDynamicsExcelVO {
|
||||
|
||||
@ExcelProperty("主键ID")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("动态类型")
|
||||
private Integer type;
|
||||
|
||||
@ExcelProperty("分销商ID")
|
||||
private Long distributorId;
|
||||
|
||||
@ExcelProperty("分销商名称")
|
||||
private String distributorName;
|
||||
|
||||
@ExcelProperty("内容")
|
||||
private String content;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributordynamics.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商动态 Excel 导出 Request VO,参数和 DistributorDynamicsPageReqVO 是一致的")
|
||||
@Data
|
||||
public class DistributorDynamicsExportReqVO {
|
||||
|
||||
@Schema(description = "动态类型", example = "2")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "分销商ID", example = "27176")
|
||||
private Long distributorId;
|
||||
|
||||
@Schema(description = "分销商名称", example = "张三")
|
||||
private String distributorName;
|
||||
|
||||
@Schema(description = "内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributordynamics.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商动态分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorDynamicsPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "动态类型", example = "2")
|
||||
private Integer type;
|
||||
|
||||
@Schema(description = "分销商ID", example = "27176")
|
||||
private Long distributorId;
|
||||
|
||||
@Schema(description = "分销商名称", example = "张三")
|
||||
private String distributorName;
|
||||
|
||||
@Schema(description = "内容")
|
||||
private String content;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributordynamics.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商动态 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorDynamicsRespVO extends DistributorDynamicsBaseVO {
|
||||
|
||||
@Schema(description = "主键ID", required = true, example = "7459")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributordynamics.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商动态更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorDynamicsUpdateReqVO extends DistributorDynamicsBaseVO {
|
||||
|
||||
@Schema(description = "主键ID", required = true, example = "7459")
|
||||
@NotNull(message = "主键ID不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributorlevel;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import co.yixiang.yshop.module.distributor.controller.admin.distributorlevel.vo.*;
|
||||
import co.yixiang.yshop.module.distributor.convert.distributorlevel.DistributorLevelConvert;
|
||||
import co.yixiang.yshop.module.distributor.dal.dataobject.distributorlevel.DistributorLevelDO;
|
||||
import co.yixiang.yshop.module.distributor.service.distributorlevel.DistributorLevelFacade;
|
||||
import co.yixiang.yshop.module.distributor.service.distributorlevel.DistributorLevelService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
import static co.yixiang.yshop.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
||||
|
||||
@Tag(name = "管理后台 - 分销商等级")
|
||||
@RestController
|
||||
@RequestMapping("/distributor/level")
|
||||
@Validated
|
||||
public class DistributorLevelController {
|
||||
|
||||
@Resource
|
||||
private DistributorLevelService levelService;
|
||||
|
||||
@Resource
|
||||
private DistributorLevelFacade distributorLevelFacade;
|
||||
|
||||
// 获取已有分销商等级
|
||||
@GetMapping("/get-all")
|
||||
@Operation(summary = "获取已有分销商等级")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:level:query')")
|
||||
public CommonResult<List<Integer>> getAllLevel() {
|
||||
List<DistributorLevelDO> levelList = levelService.getLevelList(new DistributorLevelExportReqVO());
|
||||
List<Integer> levels = convertList(levelList, DistributorLevelDO::getLevel);
|
||||
return success(levels);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建分销商等级")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:level:create')")
|
||||
public CommonResult<Long> createLevel(@Valid @RequestBody DistributorLevelCreateReqVO createReqVO) {
|
||||
Long level = distributorLevelFacade.createLevel(createReqVO);
|
||||
return success(level);
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新分销商等级")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:level:update')")
|
||||
public CommonResult<Boolean> updateLevel(@Valid @RequestBody DistributorLevelUpdateReqVO updateReqVO) {
|
||||
distributorLevelFacade.updateLevel(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除分销商等级")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('distributor:level:delete')")
|
||||
public CommonResult<Boolean> deleteLevel(@RequestParam("id") Long id) {
|
||||
levelService.deleteLevel(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得分销商等级")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:level:query')")
|
||||
public CommonResult<DistributorLevelRespVO> getLevel(@RequestParam("id") Long id) {
|
||||
DistributorLevelDO level = levelService.getLevel(id);
|
||||
return success(DistributorLevelConvert.INSTANCE.convert(level));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得分销商等级列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:level:query')")
|
||||
public CommonResult<List<DistributorLevelRespVO>> getLevelList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<DistributorLevelDO> list = levelService.getLevelList(ids);
|
||||
return success(DistributorLevelConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得分销商等级分页")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:level:query')")
|
||||
public CommonResult<PageResult<DistributorLevelRespVO>> getLevelPage(@Valid DistributorLevelPageReqVO pageVO) {
|
||||
return success(distributorLevelFacade.getLevelPage(pageVO));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出分销商等级 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:level:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportLevelExcel(@Valid DistributorLevelExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<DistributorLevelDO> list = levelService.getLevelList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<DistributorLevelExcelVO> datas = DistributorLevelConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "分销商等级.xls", "数据", DistributorLevelExcelVO.class, datas);
|
||||
}
|
||||
|
||||
@PostMapping("/level-up")
|
||||
@Operation(summary = "分销商升级")
|
||||
public CommonResult<Boolean> levelUp(@RequestParam("id") Long id) {
|
||||
distributorLevelFacade.levelUp(id);
|
||||
return success(Boolean.TRUE);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributorlevel.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
/**
|
||||
* 分销商等级 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class DistributorLevelBaseVO {
|
||||
|
||||
@Schema(description = "等级 1-10")
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "等级名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "一级佣金比例")
|
||||
private Integer firstWages;
|
||||
|
||||
@Schema(description = "二级佣金比例")
|
||||
private Integer secondWages;
|
||||
|
||||
@Schema(description = "三级佣金比例")
|
||||
private Integer thirdWages;
|
||||
|
||||
@Schema(description = "升级类型 0-满足任意 1-满足全部", example = "2")
|
||||
private Integer upType;
|
||||
|
||||
@Schema(description = "人数 值为-1是未选中", example = "2581")
|
||||
private Integer userCount;
|
||||
|
||||
@Schema(description = "金额 值为-1是未选中")
|
||||
private BigDecimal amount;
|
||||
|
||||
@Schema(description = "佣金 值为-1是未选中")
|
||||
private BigDecimal wages;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributorlevel.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商等级创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorLevelCreateReqVO extends DistributorLevelBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributorlevel.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 分销商等级 Excel VO
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Data
|
||||
public class DistributorLevelExcelVO {
|
||||
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("等级 1-10")
|
||||
private Integer level;
|
||||
|
||||
@ExcelProperty("等级名称")
|
||||
private String name;
|
||||
|
||||
@ExcelProperty("一级佣金比例")
|
||||
private Integer firstWages;
|
||||
|
||||
@ExcelProperty("二级佣金比例")
|
||||
private Integer secondWages;
|
||||
|
||||
@ExcelProperty("三级佣金比例")
|
||||
private Integer thirdWages;
|
||||
|
||||
@ExcelProperty("升级类型 0-满足任意 1-满足全部")
|
||||
private Integer upType;
|
||||
|
||||
@ExcelProperty("人数 值为-1是未选中")
|
||||
private Integer userCount;
|
||||
|
||||
@ExcelProperty("金额 值为-1是未选中")
|
||||
private Integer amount;
|
||||
|
||||
@ExcelProperty("佣金 值为-1是未选中")
|
||||
private Integer wages;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributorlevel.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商等级 Excel 导出 Request VO,参数和 DistributorLevelPageReqVO 是一致的")
|
||||
@Data
|
||||
public class DistributorLevelExportReqVO {
|
||||
|
||||
@Schema(description = "等级 1-10")
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "等级名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "一级佣金比例")
|
||||
private Integer firstWages;
|
||||
|
||||
@Schema(description = "二级佣金比例")
|
||||
private Integer secondWages;
|
||||
|
||||
@Schema(description = "三级佣金比例")
|
||||
private Integer thirdWages;
|
||||
|
||||
@Schema(description = "升级类型 0-满足任意 1-满足全部", example = "2")
|
||||
private Integer upType;
|
||||
|
||||
@Schema(description = "人数 值为-1是未选中", example = "2581")
|
||||
private Integer userCount;
|
||||
|
||||
@Schema(description = "金额 值为-1是未选中")
|
||||
private Integer amount;
|
||||
|
||||
@Schema(description = "佣金 值为-1是未选中")
|
||||
private Integer wages;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributorlevel.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商等级分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorLevelPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "等级 1-10")
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "等级名称", example = "张三")
|
||||
private String name;
|
||||
|
||||
@Schema(description = "一级佣金比例")
|
||||
private Integer firstWages;
|
||||
|
||||
@Schema(description = "二级佣金比例")
|
||||
private Integer secondWages;
|
||||
|
||||
@Schema(description = "三级佣金比例")
|
||||
private Integer thirdWages;
|
||||
|
||||
@Schema(description = "升级类型 0-满足任意 1-满足全部", example = "2")
|
||||
private Integer upType;
|
||||
|
||||
@Schema(description = "人数 值为-1是未选中", example = "2581")
|
||||
private Integer userCount;
|
||||
|
||||
@Schema(description = "金额 值为-1是未选中")
|
||||
private Integer amount;
|
||||
|
||||
@Schema(description = "佣金 值为-1是未选中")
|
||||
private Integer wages;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributorlevel.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商等级 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorLevelRespVO extends DistributorLevelBaseVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "9364")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "分销商数量", required = true)
|
||||
private Integer count;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributorlevel.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商等级更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorLevelUpdateReqVO extends DistributorLevelBaseVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "9364")
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributororder;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo.*;
|
||||
import co.yixiang.yshop.module.distributor.dal.dataobject.distributororder.DistributorOrderDO;
|
||||
import co.yixiang.yshop.module.distributor.convert.distributororder.DistributorOrderConvert;
|
||||
import co.yixiang.yshop.module.distributor.service.distributororder.DistributorOrderService;
|
||||
|
||||
@Tag(name = "管理后台 - 分销商订单")
|
||||
@RestController
|
||||
@RequestMapping("/distributor/order")
|
||||
@Validated
|
||||
public class DistributorOrderController {
|
||||
|
||||
@Resource
|
||||
private DistributorOrderService orderService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建分销商订单")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:order:create')")
|
||||
public CommonResult<Long> createOrder(@Valid @RequestBody DistributorOrderCreateReqVO createReqVO) {
|
||||
return success(orderService.createOrder(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新分销商订单")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:order:update')")
|
||||
public CommonResult<Boolean> updateOrder(@Valid @RequestBody DistributorOrderUpdateReqVO updateReqVO) {
|
||||
orderService.updateOrder(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除分销商订单")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('distributor:order:delete')")
|
||||
public CommonResult<Boolean> deleteOrder(@RequestParam("id") Long id) {
|
||||
orderService.deleteOrder(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得分销商订单")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:order:query')")
|
||||
public CommonResult<DistributorOrderRespVO> getOrder(@RequestParam("id") Long id) {
|
||||
DistributorOrderDO order = orderService.getOrder(id);
|
||||
return success(DistributorOrderConvert.INSTANCE.convert(order));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得分销商订单列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:order:query')")
|
||||
public CommonResult<List<DistributorOrderRespVO>> getOrderList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<DistributorOrderDO> list = orderService.getOrderList(ids);
|
||||
return success(DistributorOrderConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得分销商订单分页")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:order:query')")
|
||||
public CommonResult<PageResult<DistributorOrderRespVO>> getOrderPage(@Valid DistributorOrderPageReqVO pageVO) {
|
||||
PageResult<DistributorOrderDO> pageResult = orderService.getOrderPage(pageVO);
|
||||
return success(DistributorOrderConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import javax.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
/**
|
||||
* 分销商订单 Base VO,提供给添加、修改、详细的子 VO 使用
|
||||
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
|
||||
*/
|
||||
@Data
|
||||
public class DistributorOrderBaseVO {
|
||||
|
||||
@Schema(description = "结算时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime settlementTime;
|
||||
|
||||
@Schema(description = "订单ID", example = "18018")
|
||||
private Long oid;
|
||||
|
||||
@Schema(description = "订单号", example = "32634")
|
||||
private String orderId;
|
||||
|
||||
@Schema(description = "佣金状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "分销规则 0-默认 1-自定义")
|
||||
private Integer distributionRule;
|
||||
|
||||
@Schema(description = "分销自购 0-关闭 1-开启")
|
||||
private Integer distributionPurchase;
|
||||
|
||||
@Schema(description = "商品结算方式 0-实际支付价格 1-商品价格")
|
||||
private Integer distributionProductSettlement;
|
||||
|
||||
@Schema(description = "佣金结算方式 0-支付后结算 1-确认收获后结算 2-订单完成结算")
|
||||
private Integer distributionWagesSettlement;
|
||||
|
||||
@Schema(description = "下单用户", example = "625")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户昵称", example = "王五")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "商品ID", example = "32461")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "商品规格ID", example = "20034")
|
||||
private Long productAttrValueId;
|
||||
|
||||
@Schema(description = "商品名称", example = "张三")
|
||||
private String productName;
|
||||
|
||||
@Schema(description = "商品金额", example = "27614")
|
||||
private BigDecimal productPrice;
|
||||
|
||||
@Schema(description = "订单详情id", example = "12663")
|
||||
private Long detailId;
|
||||
|
||||
@Schema(description = "所属一级ID")
|
||||
private Long superiorIdP1;
|
||||
|
||||
@Schema(description = "所属一级名称")
|
||||
private String superiorNameP1;
|
||||
|
||||
@Schema(description = "所属二级ID")
|
||||
private Long superiorIdP2;
|
||||
|
||||
@Schema(description = "所属二级名称")
|
||||
private String superiorNameP2;
|
||||
|
||||
@Schema(description = "一级佣金比例")
|
||||
private Integer firstWages;
|
||||
|
||||
@Schema(description = "二级佣金比例")
|
||||
private Integer secondWages;
|
||||
|
||||
@Schema(description = "一级佣金")
|
||||
private BigDecimal firstAmount;
|
||||
|
||||
@Schema(description = "二级佣金")
|
||||
private BigDecimal secondAmount;
|
||||
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商订单创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorOrderCreateReqVO extends DistributorOrderBaseVO {
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商订单 Response VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorOrderDetailsRespVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "22172")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "订单号", example = "32634")
|
||||
private String orderId;
|
||||
|
||||
@Schema(description = "一级分销商", example = "12335")
|
||||
private String p1Name;
|
||||
|
||||
@Schema(description = "二级分销商", example = "12335")
|
||||
private String p2Name;
|
||||
|
||||
@Schema(description = "一级佣金比例")
|
||||
private Integer firstWages;
|
||||
|
||||
// 二级佣金比例
|
||||
@Schema(description = "二级佣金比例")
|
||||
private Integer secondWages;
|
||||
|
||||
@Schema(description = "一级佣金")
|
||||
private BigDecimal firstAmount;
|
||||
|
||||
// 二级佣金比例
|
||||
@Schema(description = "二级佣金")
|
||||
private BigDecimal secondAmount;
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
|
||||
/**
|
||||
* 分销商订单 Excel VO
|
||||
*
|
||||
* @author admin
|
||||
*/
|
||||
@Data
|
||||
public class DistributorOrderExcelVO {
|
||||
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@ExcelProperty("结算时间")
|
||||
private LocalDateTime settlementTime;
|
||||
|
||||
@ExcelProperty("订单ID")
|
||||
private Long oid;
|
||||
|
||||
@ExcelProperty("订单号")
|
||||
private String orderId;
|
||||
|
||||
@ExcelProperty("佣金状态")
|
||||
private Integer status;
|
||||
|
||||
@ExcelProperty("分销规则 0-默认 1-自定义")
|
||||
private Integer distributionRule;
|
||||
|
||||
@ExcelProperty("分销自购 0-关闭 1-开启")
|
||||
private Integer distributionPurchase;
|
||||
|
||||
@ExcelProperty("商品结算方式 0-实际支付价格 1-商品价格")
|
||||
private Integer distributionProductSettlement;
|
||||
|
||||
@ExcelProperty("佣金结算方式 0-支付后结算 1-确认收获后结算 2-订单完成结算")
|
||||
private Integer distributionWagesSettlement;
|
||||
|
||||
@ExcelProperty("下单用户")
|
||||
private Long userId;
|
||||
|
||||
@ExcelProperty("用户昵称")
|
||||
private String userName;
|
||||
|
||||
@ExcelProperty("商品ID")
|
||||
private Long productId;
|
||||
|
||||
@ExcelProperty("商品规格ID")
|
||||
private Long productAttrValueId;
|
||||
|
||||
@ExcelProperty("商品名称")
|
||||
private String productName;
|
||||
|
||||
@ExcelProperty("商品金额")
|
||||
private BigDecimal productPrice;
|
||||
|
||||
@ExcelProperty("订单详情id")
|
||||
private Long detailId;
|
||||
|
||||
@ExcelProperty("所属一级ID")
|
||||
private Long superiorIdP1;
|
||||
|
||||
@ExcelProperty("上级名称")
|
||||
private String superiorNameP1;
|
||||
|
||||
@ExcelProperty("所属二级ID")
|
||||
private Long superiorIdP2;
|
||||
|
||||
@ExcelProperty("上级名称")
|
||||
private String superiorNameP2;
|
||||
|
||||
@ExcelProperty("一级佣金比例")
|
||||
private Integer firstWages;
|
||||
|
||||
@ExcelProperty("二级佣金比例")
|
||||
private Integer secondWages;
|
||||
|
||||
@ExcelProperty("一级佣金")
|
||||
private BigDecimal firstAmount;
|
||||
|
||||
@ExcelProperty("二级佣金")
|
||||
private BigDecimal secondAmount;
|
||||
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import java.time.LocalDateTime;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商订单 Excel 导出 Request VO,参数和 DistributorOrderPageReqVO 是一致的")
|
||||
@Data
|
||||
public class DistributorOrderExportReqVO {
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "结算时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] settlementTime;
|
||||
|
||||
@Schema(description = "订单ID", example = "18018")
|
||||
private Long oid;
|
||||
|
||||
@Schema(description = "订单号", example = "32634")
|
||||
private String orderId;
|
||||
|
||||
@Schema(description = "佣金状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "分销规则 0-默认 1-自定义")
|
||||
private Integer distributionRule;
|
||||
|
||||
@Schema(description = "分销自购 0-关闭 1-开启")
|
||||
private Integer distributionPurchase;
|
||||
|
||||
@Schema(description = "商品结算方式 0-实际支付价格 1-商品价格")
|
||||
private Integer distributionProductSettlement;
|
||||
|
||||
@Schema(description = "佣金结算方式 0-支付后结算 1-确认收获后结算 2-订单完成结算")
|
||||
private Integer distributionWagesSettlement;
|
||||
|
||||
@Schema(description = "下单用户", example = "625")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户昵称", example = "王五")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "商品ID", example = "32461")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "商品规格ID", example = "20034")
|
||||
private Long productAttrValueId;
|
||||
|
||||
@Schema(description = "商品名称", example = "张三")
|
||||
private String productName;
|
||||
|
||||
@Schema(description = "商品金额", example = "27614")
|
||||
private BigDecimal productPrice;
|
||||
|
||||
@Schema(description = "订单详情id", example = "12663")
|
||||
private Long detailId;
|
||||
|
||||
@Schema(description = "所属一级ID")
|
||||
private Long superiorIdP1;
|
||||
|
||||
@Schema(description = "上级名称")
|
||||
private String superiorNameP1;
|
||||
|
||||
@Schema(description = "所属二级ID")
|
||||
private Long superiorIdP2;
|
||||
|
||||
@Schema(description = "上级名称")
|
||||
private String superiorNameP2;
|
||||
|
||||
@Schema(description = "一级佣金比例")
|
||||
private Integer firstWages;
|
||||
|
||||
@Schema(description = "二级佣金比例")
|
||||
private Integer secondWages;
|
||||
|
||||
@Schema(description = "一级佣金")
|
||||
private BigDecimal firstAmount;
|
||||
|
||||
@Schema(description = "二级佣金")
|
||||
private BigDecimal secondAmount;
|
||||
|
||||
@Schema(description = "下单用户ids", example = "625")
|
||||
private List<Long> userIds;
|
||||
|
||||
@Schema(description = "订单详情ids", example = "12663")
|
||||
private List<Long> detailIds;
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo;
|
||||
|
||||
import lombok.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import co.yixiang.yshop.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static co.yixiang.yshop.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商订单分页 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorOrderPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
@Schema(description = "结算时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] settlementTime;
|
||||
|
||||
@Schema(description = "订单ID", example = "18018")
|
||||
private Long oid;
|
||||
|
||||
@Schema(description = "订单号", example = "32634")
|
||||
private String orderId;
|
||||
|
||||
@Schema(description = "佣金状态", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "分销规则 0-默认 1-自定义")
|
||||
private Integer distributionRule;
|
||||
|
||||
@Schema(description = "分销自购 0-关闭 1-开启")
|
||||
private Integer distributionPurchase;
|
||||
|
||||
@Schema(description = "商品结算方式 0-实际支付价格 1-商品价格")
|
||||
private Integer distributionProductSettlement;
|
||||
|
||||
@Schema(description = "佣金结算方式 0-支付后结算 1-确认收获后结算 2-订单完成结算")
|
||||
private Integer distributionWagesSettlement;
|
||||
|
||||
@Schema(description = "下单用户", example = "625")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "用户昵称", example = "王五")
|
||||
private String userName;
|
||||
|
||||
@Schema(description = "商品ID", example = "32461")
|
||||
private Long productId;
|
||||
|
||||
@Schema(description = "商品规格ID", example = "20034")
|
||||
private Long productAttrValueId;
|
||||
|
||||
@Schema(description = "商品名称", example = "张三")
|
||||
private String productName;
|
||||
|
||||
@Schema(description = "商品金额", example = "27614")
|
||||
private BigDecimal productPrice;
|
||||
|
||||
@Schema(description = "订单详情id", example = "12663")
|
||||
private Long detailId;
|
||||
|
||||
@Schema(description = "所属一级ID")
|
||||
private Long superiorIdP1;
|
||||
|
||||
@Schema(description = "上级名称")
|
||||
private String superiorNameP1;
|
||||
|
||||
@Schema(description = "所属二级ID")
|
||||
private Long superiorIdP2;
|
||||
|
||||
@Schema(description = "上级名称")
|
||||
private String superiorNameP2;
|
||||
|
||||
@Schema(description = "一级佣金比例")
|
||||
private Integer firstWages;
|
||||
|
||||
@Schema(description = "二级佣金比例")
|
||||
private Integer secondWages;
|
||||
|
||||
@Schema(description = "一级佣金")
|
||||
private BigDecimal firstAmount;
|
||||
|
||||
@Schema(description = "二级佣金")
|
||||
private BigDecimal secondAmount;
|
||||
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商订单 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorOrderRespVO extends DistributorOrderBaseVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "22172")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "创建时间", required = true)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributororder.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 分销商订单更新 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class DistributorOrderUpdateReqVO extends DistributorOrderBaseVO {
|
||||
|
||||
@Schema(description = "主键", required = true, example = "22172")
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
package co.yixiang.yshop.module.distributor.controller.admin.distributoruser;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.*;
|
||||
import javax.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import co.yixiang.yshop.framework.common.pojo.PageResult;
|
||||
import co.yixiang.yshop.framework.common.pojo.CommonResult;
|
||||
import static co.yixiang.yshop.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import co.yixiang.yshop.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import co.yixiang.yshop.framework.operatelog.core.annotations.OperateLog;
|
||||
import static co.yixiang.yshop.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import co.yixiang.yshop.module.distributor.controller.admin.distributoruser.vo.*;
|
||||
import co.yixiang.yshop.module.distributor.dal.dataobject.distributoruser.DistributorUserDO;
|
||||
import co.yixiang.yshop.module.distributor.convert.distributoruser.DistributorUserConvert;
|
||||
import co.yixiang.yshop.module.distributor.service.distributoruser.DistributorUserService;
|
||||
|
||||
@Tag(name = "管理后台 - 分销商所属用户")
|
||||
@RestController
|
||||
@RequestMapping("/distributor/user")
|
||||
@Validated
|
||||
public class DistributorUserController {
|
||||
|
||||
@Resource
|
||||
private DistributorUserService userService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建分销商所属用户")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:user:create')")
|
||||
public CommonResult<Long> createUser(@Valid @RequestBody DistributorUserCreateReqVO createReqVO) {
|
||||
return success(userService.createUser(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新分销商所属用户")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:user:update')")
|
||||
public CommonResult<Boolean> updateUser(@Valid @RequestBody DistributorUserUpdateReqVO updateReqVO) {
|
||||
userService.updateUser(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除分销商所属用户")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('distributor:user:delete')")
|
||||
public CommonResult<Boolean> deleteUser(@RequestParam("id") Long id) {
|
||||
userService.deleteUser(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得分销商所属用户")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:user:query')")
|
||||
public CommonResult<DistributorUserRespVO> getUser(@RequestParam("id") Long id) {
|
||||
DistributorUserDO user = userService.getUser(id);
|
||||
return success(DistributorUserConvert.INSTANCE.convert(user));
|
||||
}
|
||||
|
||||
@GetMapping("/list")
|
||||
@Operation(summary = "获得分销商所属用户列表")
|
||||
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:user:query')")
|
||||
public CommonResult<List<DistributorUserRespVO>> getUserList(@RequestParam("ids") Collection<Long> ids) {
|
||||
List<DistributorUserDO> list = userService.getUserList(ids);
|
||||
return success(DistributorUserConvert.INSTANCE.convertList(list));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得分销商所属用户分页")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:user:query')")
|
||||
public CommonResult<PageResult<DistributorUserRespVO>> getUserPage(@Valid DistributorUserPageReqVO pageVO) {
|
||||
PageResult<DistributorUserDO> pageResult = userService.getUserPage(pageVO);
|
||||
return success(DistributorUserConvert.INSTANCE.convertPage(pageResult));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出分销商所属用户 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('distributor:user:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportUserExcel(@Valid DistributorUserExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<DistributorUserDO> list = userService.getUserList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<DistributorUserExcelVO> datas = DistributorUserConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "分销商所属用户.xls", "数据", DistributorUserExcelVO.class, datas);
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user