Commit 81b95ff0 authored by zhangfeng's avatar zhangfeng

Merge branch 'refs/heads/feature_member_score_zhangfeng' into feature_member_score

parents da4a1023 52365601
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:03:15
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for member_user_address
-- ----------------------------
DROP TABLE IF EXISTS `member_user_address`;
CREATE TABLE `member_user_address` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`member_id` bigint NOT NULL COMMENT '会员id',
`is_default` tinyint NULL DEFAULT NULL COMMENT '是否默认地址',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收货人姓名',
`area_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '区号',
`phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '收货人手机',
`address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '详细地址',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`creator` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
`updater` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员收货地址表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:03:24
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for member_user_level_config
-- ----------------------------
DROP TABLE IF EXISTS `member_user_level_config`;
CREATE TABLE `member_user_level_config` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '名称',
`lower_count` int NOT NULL COMMENT '起始分数',
`upper_count` int NOT NULL COMMENT '截止分数',
`icon` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图标',
`creator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '创建人',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`updater` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '更新人',
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 10 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员等级配置表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:03:34
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for member_user_score
-- ----------------------------
DROP TABLE IF EXISTS `member_user_score`;
CREATE TABLE `member_user_score` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`member_id` bigint NOT NULL COMMENT '会员id',
`hold_score` int NOT NULL DEFAULT 0 COMMENT '持有积分',
`used_score` int NOT NULL DEFAULT 0 COMMENT '已使用积分',
`expired_score` int NOT NULL DEFAULT 0 COMMENT '过期积分',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`creator` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
`updater` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
`deleted` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员积分表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:03:47
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for member_user_score_detail
-- ----------------------------
DROP TABLE IF EXISTS `member_user_score_detail`;
CREATE TABLE `member_user_score_detail` (
`id` bigint NOT NULL COMMENT '主键',
`member_id` bigint NOT NULL COMMENT '会员id',
`score_count` int NOT NULL DEFAULT 0 COMMENT '积分数量',
`status` int NOT NULL COMMENT '积分状态 ',
`remain_count` int NOT NULL COMMENT '剩余积分',
`expire_time` datetime NULL DEFAULT NULL COMMENT '积分过期时间',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`creator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
`updater` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除',
`ext_param` json NULL COMMENT '扩展字段',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员积分详情表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:03:55
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for member_user_score_detail_releation
-- ----------------------------
DROP TABLE IF EXISTS `member_user_score_detail_releation`;
CREATE TABLE `member_user_score_detail_releation` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`releation_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '关联id',
`source_type` int NOT NULL COMMENT '积分来源',
`detail_id` bigint NOT NULL COMMENT '积分明细id',
`score_count` int NOT NULL COMMENT '积分数量',
`status` int NOT NULL COMMENT '关系状态 1有效2无效',
`creator` varchar(255) CHARACTER SET tis620 COLLATE tis620_thai_ci NULL DEFAULT NULL COMMENT '创建人',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`updater` varchar(255) CHARACTER SET tis620 COLLATE tis620_thai_ci NULL DEFAULT NULL COMMENT '更新人',
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 23 CHARACTER SET = tis620 COLLATE = tis620_thai_ci COMMENT = '会员积分详情关联表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:04:03
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for member_user_score_log
-- ----------------------------
DROP TABLE IF EXISTS `member_user_score_log`;
CREATE TABLE `member_user_score_log` (
`id` bigint NOT NULL COMMENT '主键',
`member_id` bigint NOT NULL COMMENT '会员id',
`score_count` int UNSIGNED NOT NULL COMMENT '积分数量',
`operate_type` int NOT NULL COMMENT '操作类型 1增加2减少',
`source_type` int NOT NULL COMMENT '积分来源',
`rule_id` int NULL DEFAULT NULL COMMENT '积分规则id',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`ext_param` json NULL COMMENT '扩展参数',
`creator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
`updater` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除',
`update_time` datetime NULL DEFAULT NULL,
`unique_id` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '唯一键幂等',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `unique_id`(`unique_id` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员积分日志表' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE `jiedao`.`member_user` ADD COLUMN `code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '会员编号' AFTER `id`;
ALTER TABLE `jiedao`.`member_user` ADD COLUMN `country` int NULL DEFAULT NULL COMMENT '国家' AFTER `control_password`;
ALTER TABLE `jiedao`.`member_user` ADD COLUMN `city` int NULL DEFAULT NULL COMMENT '城市' AFTER `country`;
ALTER TABLE `jiedao`.`member_user` ADD COLUMN `referral_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '推荐码' AFTER `open_id`;
ALTER TABLE `jiedao`.`member_user` ADD COLUMN `register_platform` int NULL DEFAULT 0 COMMENT '注册平台' AFTER `referral_code`;
ALTER TABLE `jiedao`.`member_user` ADD UNIQUE INDEX `code`(`code` ASC) USING BTREE;
SET FOREIGN_KEY_CHECKS=1;
\ No newline at end of file
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:04:17
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for score_rule
-- ----------------------------
DROP TABLE IF EXISTS `score_rule`;
CREATE TABLE `score_rule` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`type` int NOT NULL COMMENT '指标类型',
`title_zh` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则标题中文',
`title_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '规则标题英文',
`desc_zh` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '规则说明中文',
`desc_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '规则说明英文',
`cover_image_zh` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '封面图中文',
`cover_image_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '封面图英文',
`get_score_once` int NOT NULL DEFAULT 0 COMMENT '单次获取积分数',
`max_score_total` int NOT NULL DEFAULT 0 COMMENT '累积最高积分',
`start_time` datetime NOT NULL COMMENT '活动开始时间',
`end_time` datetime NOT NULL COMMENT '活动结束时间',
`score_period` int NOT NULL COMMENT '积分有效期',
`order_num` int NOT NULL COMMENT '排序值',
`push_activity` tinyint NOT NULL DEFAULT 0 COMMENT '是否推送',
`show_platform` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '展示平台',
`status` int NOT NULL COMMENT '活动状态',
`extra` json NULL COMMENT '扩展字段',
`create_time` datetime NOT NULL COMMENT '创建时间',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`update_time` datetime NOT NULL COMMENT '更新时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新者',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 42 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:04:36
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for ecw_reward
-- ----------------------------
DROP TABLE IF EXISTS `ecw_reward`;
CREATE TABLE `ecw_reward` (
`id` bigint NOT NULL AUTO_INCREMENT,
`code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '礼品ID',
`title_zh` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '中文名称',
`title_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '英文名称',
`title_fr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '法文名称',
`img_zh` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '中文礼品图片',
`img_en` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '英文礼品图片',
`img_fr` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '法文礼品图片',
`points_require` int NOT NULL COMMENT '兑换所需积分',
`node_id` int NOT NULL COMMENT '兑换网点',
`exchange_count` int NULL DEFAULT 0 COMMENT '已兑换次数',
`quantity_remain` int NOT NULL COMMENT '剩余数量',
`start_time` datetime NULL DEFAULT NULL COMMENT '活动开始时间',
`end_time` datetime NULL DEFAULT NULL COMMENT '活动结束时间',
`pick_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '领取方式(1上门领取,2包邮到家,3邮寄到付)',
`allow_count` int NOT NULL COMMENT '允许兑换次数',
`remark_zh` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '中文备注',
`remark_en` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '英文备注',
`remark_fr` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '法文备注',
`status` int NOT NULL DEFAULT 0 COMMENT '礼品状态(1已启用,2未启用,3已关闭,4已过期)',
`create_time` datetime NOT NULL COMMENT '创建时间',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`update_time` datetime NOT NULL COMMENT '更新时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `unique_code`(`code` ASC) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 38 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_0900_ai_ci COMMENT = '礼品' ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
/*
Navicat Premium Data Transfer
Source Server : jiedao-uat
Source Server Type : MySQL
Source Server Version : 80031 (8.0.31)
Source Host : 159.75.224.138:2297
Source Schema : jiedao
Target Server Type : MySQL
Target Server Version : 80031 (8.0.31)
File Encoding : 65001
Date: 15/08/2024 11:17:08
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for ecw_reward_redeem
-- ----------------------------
DROP TABLE IF EXISTS `ecw_reward_redeem`;
CREATE TABLE `ecw_reward_redeem` (
`id` bigint NOT NULL COMMENT '主键',
`member_id` bigint NOT NULL COMMENT '会员id',
`reward_id` bigint NOT NULL COMMENT '礼品id',
`status` int NULL DEFAULT NULL COMMENT '兑换状态',
`score_count` int NOT NULL COMMENT '积分数量',
`reward_count` int NOT NULL COMMENT '兑换数量',
`redeem_type` int NOT NULL COMMENT '兑换方式',
`entrance` int NOT NULL COMMENT '兑换入口',
`expenses` decimal(10, 2) NULL DEFAULT NULL COMMENT '费用',
`currency` int NULL DEFAULT NULL COMMENT '费用币种',
`recipient_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '收件人姓名',
`recipient_phone_num` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '收件人电话',
`recipient_address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '收件人地址',
`redeemer` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '兑换人',
`redemption_time` datetime NULL DEFAULT NULL COMMENT '兑换时间',
`courier_company` int NULL DEFAULT NULL COMMENT '快递公司',
`express_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '快递单号',
`express_date` datetime NULL DEFAULT NULL COMMENT '快递日期',
`express_sender` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '快递寄出人',
`annex` varchar(1000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '上传附件',
`remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '备注',
`create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
`update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`creator` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '创建人',
`updater` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '更新人',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '是否删除',
`verify_user` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '核销人',
`verify_time` datetime NULL DEFAULT NULL COMMENT '核销时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = DYNAMIC;
SET FOREIGN_KEY_CHECKS = 1;
This diff is collapsed.
......@@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.member.enums.ScoreRuleTypeEnum;
* @author zhangfeng
*/
public interface ScoreProducerApi {
void sendOderMessage(ScoreRuleTypeEnum scoreRuleType, Long orderId);
void sendOderMessage(ScoreRuleTypeEnum scoreRuleType, Long orderId, String orderNo);
void sendRecommendMessage(ScoreRuleTypeEnum scoreRuleType, Long userId, String referralCode);
......
......@@ -121,7 +121,7 @@ public class ScoreRuleController {
@GetMapping("/warehouse-tree-region-list")
@ApiOperation("获得目的国、目的城市、目的仓列表")
public CommonResult<List<WarehouseTreeRegionSimpleVO>> warehouseTreeRegionList() {
List<WarehouseTreeRegionSimpleVO> list= scoreRuleService.getWarehouseTreeRegionListSimple();
List<WarehouseTreeRegionSimpleVO> list = scoreRuleService.getWarehouseTreeRegionListSimple();
return success(list);
}
......@@ -129,7 +129,7 @@ public class ScoreRuleController {
@ApiOperation("测试订单V值触发")
public CommonResult<Void> testScoreRule(@RequestParam Long orderId, @RequestParam String orderNo) {
//applicationContext.publishEvent(new OrderInShippingEvent(orderId, orderNo));
scoreProducerApi.sendOderMessage(ScoreRuleTypeEnum.ORDER_V, orderId);
scoreProducerApi.sendOderMessage(ScoreRuleTypeEnum.ORDER_V, orderId <= 0 ? null : orderId, orderNo);
return success(null);
}
......
......@@ -51,7 +51,7 @@ public class OrderVStrategy extends AbstractScoreRuleStrategy {
// 获取订单信息
OrderRespDTO order;
try {
order = orderApi.getOrder(orderId, "");
order = orderApi.getOrder(orderId, message.getOrderNo());
} catch (Exception e) {
log.error("Order in shipping listener: Get order error,orderId:{}", orderId, e);
return;
......
......@@ -20,6 +20,10 @@ public class ScoreMessage extends AbstractStreamMessage {
* 订单ID:订单V值消息必填
*/
private Long orderId;
/**
* 订单编号:目前仅测试使用
*/
private String orderNo;
/**
* userID:注册必填
*/
......
......@@ -19,10 +19,11 @@ public class ScoreProducer implements ScoreProducerApi {
private RedisMQTemplate redisMQTemplate;
@Override
public void sendOderMessage(ScoreRuleTypeEnum scoreRuleType, Long orderId) {
public void sendOderMessage(ScoreRuleTypeEnum scoreRuleType, Long orderId, String orderNo) {
ScoreMessage message = ScoreMessage.builder()
.scoreRuleType(scoreRuleType)
.orderId(orderId)
.orderNo(orderNo)
.build();
redisMQTemplate.send(message);
}
......
......@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
......@@ -20,12 +21,15 @@ public class RedeemRewardReqVO {
private Long rewardId;
@ApiModelProperty(value = "兑换数量", required = true)
@NotNull(message = "兑换数量不能为空")
private Integer rewardCount;
@ApiModelProperty(value = "兑换方式,同领取方式(1上门领取,2包邮到家,3邮寄到付)", required = true)
@NotNull(message = "兑换方式不能为空")
private Integer redeemType;
@ApiModelProperty(value = "兑换入口(后台,app,web)", required = true)
@NotNull(message = "兑换入口不能为空")
private Integer entrance;
@ApiModelProperty(value = "费用数字(两位小数)")
......
......@@ -29,5 +29,6 @@ public interface ErrorCodeConstants {
ErrorCode REDEEM_IMPORT_MAX_COUNT = new ErrorCode(1001011023, "redeem.import.max.count");
ErrorCode REDEEM_CANCEL_STATUS_ERROR = new ErrorCode(1001011024, "redeem.cancel.status.error");
ErrorCode REWARD_NODE_AND_POINTS_LIST_ERROR = new ErrorCode(1001011025, "reward.node.and.points.list.error");
ErrorCode REWARD_REDEEM_RECIPIENT_ERROR = new ErrorCode(1001011026, "reward.redeem.recipient.error");
}
......@@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.reward.dal.dataobject.redeem.RewardRedeemDO;
import cn.iocoder.yudao.module.reward.dal.dataobject.reward.RewardDO;
import cn.iocoder.yudao.module.reward.dal.mysql.redeem.RewardRedeemMapper;
import cn.iocoder.yudao.module.reward.dal.mysql.reward.RewardMapper;
import cn.iocoder.yudao.module.reward.enums.RewardPickMethedEnum;
import cn.iocoder.yudao.module.reward.enums.RewardRedeemStatusEnum;
import cn.iocoder.yudao.module.reward.enums.RewardStatusEnum;
import cn.iocoder.yudao.module.reward.service.reward.RewardService;
......@@ -26,6 +27,7 @@ import cn.iocoder.yudao.module.system.api.sms.dto.code.SmsCodeUseReqDTO;
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Service;
......@@ -70,19 +72,47 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean redeemReward(RedeemRewardReqVO redeemRewardReqVO) {
UserRespDTO memberUser = memberUserApi.getUser(redeemRewardReqVO.getMemberId());
if (memberUser == null) {
throw exception(USER_NOT_EXISTS);
}
// 验证短信验证码
if (redeemRewardReqVO.getEntrance() != PlatformTypeEnum.BACKEND.getValue() && redeemRewardReqVO instanceof AppRedeemRewardReqVO) {
AppRedeemRewardReqVO appRedeemRewardReqVO = (AppRedeemRewardReqVO) redeemRewardReqVO;
SmsCodeUseReqDTO smsCodeUseReqDTO = new SmsCodeUseReqDTO();
UserRespDTO memberUserApiUser = memberUserApi.getUser(redeemRewardReqVO.getMemberId());
if (memberUserApiUser == null) {
throw exception(USER_NOT_EXISTS);
}
smsCodeUseReqDTO.setMobile(memberUserApiUser.getMobile());
smsCodeUseReqDTO.setMobile(memberUser.getMobile());
smsCodeUseReqDTO.setCode(appRedeemRewardReqVO.getCode());
smsCodeUseReqDTO.setUsedIp(getClientIP());
smsCodeUseReqDTO.setScene(SmsSceneEnum.MEMBER_REDEEM_REWARD.getScene());
smsCodeApi.useSmsCode(smsCodeUseReqDTO);
}
// 校验收货人信息
verifyRecipientInfo(redeemRewardReqVO, memberUser);
// 校验礼品
RewardDO rewardDO = getAndVerifyRewardDO(redeemRewardReqVO);
// 校验会员
verifyMemberUser(redeemRewardReqVO, rewardDO, memberUser.getHoldScore());
String lockKey = "reward:redeem:lock:" + redeemRewardReqVO.getRewardId();
RLock lock = redissonClient.getLock(lockKey);
try {
if (!lock.tryLock(2, 10, TimeUnit.SECONDS)) {
throw exception(GET_LOCK_FAILED);
}
// 添加兑换记录
Long redeemId = addRedeemRecord(redeemRewardReqVO, rewardDO);
// 更新会员积分
updateMemberScore(redeemRewardReqVO, rewardDO, redeemId);
// 更新礼品
redeemReward(rewardDO, redeemRewardReqVO.getRewardCount());
} catch (InterruptedException e) {
throw exception(GET_LOCK_FAILED);
} finally {
lock.unlock();
}
return true;
}
private RewardDO getAndVerifyRewardDO(RedeemRewardReqVO redeemRewardReqVO) {
// 查询礼品
RewardDO rewardDO = rewardMapper.selectById(redeemRewardReqVO.getRewardId());
if (rewardDO == null) {
......@@ -102,25 +132,22 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
if (!Arrays.asList(split).contains(String.valueOf(redeemRewardReqVO.getRedeemType()))) {
throw exception(REWARD_PICK_METHOD_NOT_ALLOW);
}
verifyMemberUser(redeemRewardReqVO, rewardDO);
String lockKey = "reward:redeem:lock:" + redeemRewardReqVO.getRewardId();
RLock lock = redissonClient.getLock(lockKey);
try {
if (!lock.tryLock(2, 10, TimeUnit.SECONDS)) {
throw exception(GET_LOCK_FAILED);
return rewardDO;
}
private void verifyRecipientInfo(RedeemRewardReqVO redeemRewardReqVO, UserRespDTO memberUser) {
if (redeemRewardReqVO.getRedeemType() == RewardPickMethedEnum.SELF_PICKUP.getValue()) {
if (StringUtils.isBlank(redeemRewardReqVO.getRecipientName())) {
redeemRewardReqVO.setRecipientName(memberUser.getNickname());
}
if (StringUtils.isBlank(redeemRewardReqVO.getRecipientPhoneNum())) {
redeemRewardReqVO.setRecipientPhoneNum(memberUser.getMobile());
}
} else {
if (StringUtils.isAnyBlank(redeemRewardReqVO.getRecipientName(), redeemRewardReqVO.getRecipientPhoneNum(), redeemRewardReqVO.getRecipientAddress())) {
throw exception(REWARD_REDEEM_RECIPIENT_ERROR);
}
// 添加兑换记录
Long redeemId = addRedeemRecord(redeemRewardReqVO, rewardDO);
// 更新会员积分
updateMemberScore(redeemRewardReqVO, rewardDO, redeemId);
// 更新礼品
redeemReward(rewardDO, redeemRewardReqVO.getRewardCount());
} catch (InterruptedException e) {
throw exception(GET_LOCK_FAILED);
} finally {
lock.unlock();
}
return true;
}
private void redeemReward(RewardDO reward, Integer rewardCount) {
......@@ -172,6 +199,11 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
}
int totalCount = 0;
for (RedeemRewardReqVO redeemRewardReqVO : redeemRewardReqVOList) {
UserRespDTO memberUser = memberUserApi.getUser(redeemRewardReqVO.getMemberId());
if (memberUser == null) {
throw exception(USER_NOT_EXISTS);
}
verifyRecipientInfo(redeemRewardReqVO, memberUser);
// 每个兑换VO校验一遍
// 兑换方式不匹配,后台不校验
if (redeemRewardReqVO.getEntrance() != PlatformTypeEnum.BACKEND.getValue()) {
......@@ -181,7 +213,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
throw exception(REWARD_PICK_METHOD_NOT_ALLOW);
}
}
verifyMemberUser(redeemRewardReqVO, rewardDO);
verifyMemberUser(redeemRewardReqVO, rewardDO, memberUser.getHoldScore());
// 记录兑换总数
totalCount += redeemRewardReqVO.getRewardCount();
// 判断兑换总数是否大于礼物数量
......@@ -243,13 +275,7 @@ public class RedeemRewardApiImpl implements RedeemRewardApi {
smsCodeApi.sendSmsCode(smsCodeSendReqDTO);
}
private void verifyMemberUser(RedeemRewardReqVO redeemRewardReqVO, RewardDO rewardDO) {
// 查询会员积分
UserRespDTO memberUser = memberUserApi.getUser(redeemRewardReqVO.getMemberId());
if (memberUser == null) {
throw exception(USER_NOT_EXISTS);
}
Integer holdScore = memberUser.getHoldScore();
private void verifyMemberUser(RedeemRewardReqVO redeemRewardReqVO, RewardDO rewardDO, Integer holdScore) {
// 会员积分不够
if (holdScore < rewardDO.getPointsRequire() * redeemRewardReqVO.getRewardCount()) {
throw exception(REWARD_SCORE_NOT_ENOUGH, "userId:" + redeemRewardReqVO.getMemberId() + ",holdScore:" + holdScore, "requireScore:" + rewardDO.getPointsRequire() * redeemRewardReqVO.getRewardCount());
......
......@@ -212,6 +212,11 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
lambdaQuery.eqIfPresent(RewardDO::getNodeId, query.getNodeId())
.eq(StringUtils.isNotBlank(query.getPickMethod()), RewardDO::getPickMethod, query.getPickMethod())
.eqIfPresent(RewardDO::getStatus, query.getStatus());
//判断memberId,筛选会员所在城市网点礼品
if (query.getMemberId() != null && query.getNodeId() == null) {
List<Long> nodes = getMemberCityNodes(query.getMemberId());
lambdaQuery.in(CollectionUtil.isNotEmpty(nodes), RewardDO::getNodeId, nodes);
}
//备注,模糊匹配三种语言
if (StringUtils.isNotBlank(query.getRemark())) {
lambdaQuery.and(wrapper ->
......@@ -326,16 +331,9 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
if (reqVO.getNodeId() != null) {
rewardDOLambdaQuery.eq(RewardDO::getNodeId, reqVO.getNodeId());
} else {
UserRespDTO user = memberUserApi.getUser(reqVO.getMemberId());
List<NodeRespDTO> nodes = null;
// 如果用户没有填写国家或城市默认展示中国的礼品
if (user.getCity() == null || user.getCountry() == null) {
nodes = nodeApi.getNodesByCity(null, 130L);
} else {
nodes = nodeApi.getNodesByCity(user.getCity().longValue(), null);
}
List<Long> nodes = getMemberCityNodes(reqVO.getMemberId());
if (CollectionUtil.isNotEmpty(nodes)) {
rewardDOLambdaQuery.in(RewardDO::getNodeId, nodes.stream().map(NodeRespDTO::getId).collect(Collectors.toList()));
rewardDOLambdaQuery.in(RewardDO::getNodeId, nodes);
}
}
List<RewardDO> rewardDOS = rewardMapper.selectList(rewardDOLambdaQuery);
......@@ -344,7 +342,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
collect.forEach(this::setPickMethod);
return collect;
}
return Collections.EMPTY_LIST;
return Collections.emptyList();
}
@Override
......@@ -354,14 +352,14 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
BeanUtils.copyProperties(rewardDO, appRewardBackVO);
setPickMethod(appRewardBackVO);
NodeRespDTO nodesById = nodeApi.getNodesById(Long.valueOf(rewardDO.getNodeId()));
if (nodesById != null){
if (nodesById != null) {
appRewardBackVO.setNodeZh(nodesById.getTitleZh());
appRewardBackVO.setNodeEn(nodesById.getTitleEn());
}
return appRewardBackVO;
}
private void setPickMethod(AppRewardBackVO appRewardBackVO){
private void setPickMethod(AppRewardBackVO appRewardBackVO) {
for (String pickMethod : appRewardBackVO.getPickMethod().split(",")) {
AppRewardBackVO.PickMethod pickMethodDict = new AppRewardBackVO.PickMethod();
pickMethodDict.setValue(pickMethod);
......@@ -381,6 +379,7 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
/**
* 校验礼品是否过期并修改礼品状态
*/
@Override
public Boolean validateExpire(RewardDO rewardDO) {
if (rewardDO.getEndTime() != null) {
if (rewardDO.getStatus() == RewardStatusEnum.ENABLED.getValue() && rewardDO.getEndTime().toInstant().isBefore(Instant.now())) {
......@@ -394,4 +393,22 @@ public class RewardServiceImpl extends AbstractService<RewardMapper, RewardDO> i
}
return false;
}
/**
* 获取会员所在城市网点id
*/
private List<Long> getMemberCityNodes(Long memberId) {
UserRespDTO user = memberUserApi.getUser(memberId);
List<NodeRespDTO> nodes;
// 如果用户没有填写国家或城市默认展示中国的礼品
if (user.getCity() == null || user.getCountry() == null) {
nodes = nodeApi.getNodesByCity(null, 130L);
} else {
nodes = nodeApi.getNodesByCity(user.getCity().longValue(), null);
}
if (CollectionUtil.isNotEmpty(nodes)) {
return nodes.stream().map(NodeRespDTO::getId).collect(Collectors.toList());
}
return Collections.emptyList();
}
}
......@@ -51,4 +51,7 @@ public class RewardQueryVO {
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@ApiModelProperty(value = "会员id")
private Long memberId;
}
......@@ -1884,7 +1884,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
updateOrderStatusByOrderIdAndTransportType(orderIdList, orderStatus, inWarehouseState, shipmentState, auditType, auditResult, businessTime, estTime, transportType);
if (Objects.equals(orderStatus, OrderStatusEnum.IN_SHIPPING.getValue())) {
for (Long orderId : orderIdList) {
scoreProducerApi.sendOderMessage(ScoreRuleTypeEnum.ORDER_V, orderId);
scoreProducerApi.sendOderMessage(ScoreRuleTypeEnum.ORDER_V, orderId, null);
}
}
}
......
......@@ -1034,6 +1034,7 @@ reward.count.not.enough = reward count not enough
reward.redeem.count.not.allow = bulk redemption is limited to a maximum of 10 pieces at a time
reward.redeem.allow.count.error = the number of redemptions allowed by the individual has been exceeded:{}
reward.node.and.points.list.error = reward node and points create error
reward.redeem.recipient.error = recipient info information is incomplete
redeem.import.max.count = allow maximum number of imports is {}
dict.unknown.error = Not in dict {0}: {1}
......
......@@ -1029,6 +1029,7 @@ reward.count.not.enough = \u793C\u54C1\u6570\u91CF\u4E0D\u8DB3
reward.redeem.count.not.allow = \u6279\u91CF\u5151\u6362\u6BCF\u6B21\u6700\u591A\u5341\u6761
reward.redeem.allow.count.error = \u5DF2\u8D85\u51FA\u4E2A\u4EBA\u5141\u8BB8\u5151\u6362\u6B21\u6570\uFF1A{}
reward.node.and.points.list.error = \u521B\u5EFA\u793C\u54C1\u7F51\u70B9\u6216\u6240\u9700\u79EF\u5206\u9519\u8BEF
reward.redeem.recipient.error = \u793C\u54C1\u6536\u8D27\u4EBA\u4FE1\u606F\u4E0D\u5168
get.lock.failed = \u670D\u52A1\u7E41\u5FD9\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5
reward.redeem.not.exist = \u793C\u54C1\u5151\u6362\u8BB0\u5F55\u4E0D\u5B58\u5728
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment