Commit 9ba3d0a1 authored by Smile's avatar Smile

会员等级修改

parent 00497c42
ALTER TABLE member_user_level_config
ADD COLUMN level INT COMMENT '等级',
ADD COLUMN status INT COMMENT '状态(0.未发布,1.已启用,2.已禁用,3.已过期)',
ADD COLUMN rule_number VARCHAR(20) COMMENT '规则编号',
ADD COLUMN validity_period INT COMMENT '等级有效期',
ADD COLUMN accumulation_period INT COMMENT '积分累计周期',
ADD COLUMN start_date DATETIME COMMENT '积分开始累计时间',
ADD COLUMN enable_date DATETIME COMMENT '启用日期',
ADD COLUMN start_time DATETIME COMMENT '等级规则有效期开始时间',
ADD COLUMN end_time DATETIME COMMENT '等级规则有效期结束时间',
ADD COLUMN description VARCHAR(200) COMMENT '等级说明',
ADD COLUMN sort INT COMMENT '匹配顺序(限制为数字)';
INSERT INTO jiedao.system_menu (name, permission, menu_type, sort, parent_id, `path`, icon, component, status, creator, create_time, updater, update_time, deleted, is_show_in_menu_bar, name_en, keepalive, redirect, badge_field) VALUES('会员等级设置', '', 2, 1, 1520, 'operatingLevel', '#', 'ecw/memberManagement/operatingLevel', 0, '1', '2024-12-13 14:37:24', '1', '2024-12-13 15:14:29', 0, 0, '会员等级设置', 0, NULL, NULL);
CREATE TABLE `jiedao`.`member_user_level_log`
(
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`config_id` bigint NOT NULL COMMENT '会员等级配置id',
`operator` VARCHAR(255) NOT NULL COMMENT '操作人',
`remarks` TEXT NULL COMMENT '备注',
`operate_type` INT NOT NULL COMMENT '操作类型',
`bpm_process_id` BIGINT NULL COMMENT '流程ID',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员等级日志表' ROW_FORMAT = Dynamic;
INSERT INTO jiedao.system_dict_type (name, `type`, status, remark, creator, create_time, updater, update_time, deleted) VALUES('会员等级', 'membership_levels', 0, NULL, '1', '2024-12-12 14:03:26', '1', '2024-12-12 14:09:37', 0);
INSERT INTO jiedao.system_dict_data (sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted, label_en, label_fr) VALUES(0, '青铜会员', '1', 'membership_levels', 0, 'default', '', NULL, '1', '2024-12-12 14:10:46', '1', '2024-12-12 14:17:06', 0, 'Bronze Member', 'Bronze Member');
INSERT INTO jiedao.system_dict_data (sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted, label_en, label_fr) VALUES(0, '银级会员', '2', 'membership_levels', 0, 'default', '', NULL, '1', '2024-12-12 14:14:17', '1', '2024-12-12 14:17:25', 0, 'Silver Member', 'Silver Member');
INSERT INTO jiedao.system_dict_data (sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted, label_en, label_fr) VALUES(0, '黄金级会员', '3', 'membership_levels', 0, 'default', '', NULL, '1', '2024-12-12 14:15:09', '1', '2024-12-12 14:17:37', 0, 'Gold Member', 'Gold Member');
INSERT INTO jiedao.system_dict_data (sort, label, value, dict_type, status, color_type, css_class, remark, creator, create_time, updater, update_time, deleted, label_en, label_fr) VALUES(0, '白金级会员', '4', 'membership_levels', 0, 'default', '', NULL, '1', '2024-12-12 14:15:59', '1', '2024-12-12 14:17:48', 0, 'Platinum Member', 'Platinum Member');
CREATE TABLE `jiedao`.`member_user_level_details`
(
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`config_id` bigint NOT NULL COMMENT '会员等级配置id',
`member_id` bigint NOT NULL COMMENT '会员id',
`level` INT NULL COMMENT '等级',
`validity_period` INT NULL COMMENT '等级有效期',
`specific_settings` bit(1) NOT NULL DEFAULT b'0' COMMENT '特殊设置(0关闭 1开启)',
`remarks` TEXT NULL COMMENT '备注',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员等级详情表' ROW_FORMAT = Dynamic;
CREATE TABLE `jiedao`.`member_user_level_operate_log`
(
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键',
`config_id` bigint NOT NULL COMMENT '会员等级配置id',
`config_name` VARCHAR(255) NOT NULL COMMENT '会员等级配置名称',
`member_id` bigint NOT NULL COMMENT '会员id',
`operator` VARCHAR(255) NOT NULL COMMENT '操作人',
`remarks` TEXT NULL COMMENT '说明',
`level` INT COMMENT '等级',
`operate_type` INT NOT NULL COMMENT '操作类型',
`creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '会员等级操作记录日志表' ROW_FORMAT = Dynamic;
\ No newline at end of file
This diff is collapsed.
...@@ -71,4 +71,5 @@ public interface ErrorCodeConstants { ...@@ -71,4 +71,5 @@ public interface ErrorCodeConstants {
ErrorCode USER_ADDRESS_NOT_EXISTS = new ErrorCode(1004008026, "user.address.not.exists"); ErrorCode USER_ADDRESS_NOT_EXISTS = new ErrorCode(1004008026, "user.address.not.exists");
ErrorCode USER_ADDRESS_FIELD_ERROR = new ErrorCode(1004008027, "user.address.field.error"); ErrorCode USER_ADDRESS_FIELD_ERROR = new ErrorCode(1004008027, "user.address.field.error");
ErrorCode SCORE_RULE_CUSTOMERSIDE_ERROR = new ErrorCode(1004008028, "score.rule.customer.side.error"); ErrorCode SCORE_RULE_CUSTOMERSIDE_ERROR = new ErrorCode(1004008028, "score.rule.customer.side.error");
ErrorCode LEVEL_RULE_NOT_EXISTS = new ErrorCode(1004008028, "level.rule.not.exists");
} }
package cn.iocoder.yudao.module.member.enums;
public enum MemberLevelStatusEnum {
ENABLED(1, "已启用"),
DRAFT(0, "未发布"),
CLOSED(2, "已禁用"),
EXPIRED(3, "已过期");
private final int value;
private final String name;
MemberLevelStatusEnum(int value, String name) {
this.value = value;
this.name = name;
}
public int getValue() {
return value;
}
public String getName() {
return name;
}
}
...@@ -3,9 +3,8 @@ package cn.iocoder.yudao.module.member.controller.admin.level; ...@@ -3,9 +3,8 @@ package cn.iocoder.yudao.module.member.controller.admin.level;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.service.level.MemberUserLevelConfigService; import cn.iocoder.yudao.module.member.service.level.MemberUserLevelConfigService;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigBaseRespVO; import cn.iocoder.yudao.module.member.vo.scoreRule.ScoreRuleStatusReqVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigReqVO; import cn.iocoder.yudao.module.member.vo.userLevel.*;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigUpdateVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -44,7 +43,13 @@ public class MemberUserLevelConfigController { ...@@ -44,7 +43,13 @@ public class MemberUserLevelConfigController {
public CommonResult<Boolean> delete(@Valid @RequestBody List<Long> ids) { public CommonResult<Boolean> delete(@Valid @RequestBody List<Long> ids) {
return success(userLevelConfigService.delete(ids)); return success(userLevelConfigService.delete(ids));
} }
@PostMapping("/get")
@ApiOperation("获得等级规则详情")
//@PreAuthorize("@ss.hasPermission('member:score-rule:query')")
public CommonResult<MemberUserLevelConfigBaseRespVO> getMemberUserLevelConfig(@Valid @RequestBody IdReqVo idReqVo) {
MemberUserLevelConfigBaseRespVO memberUserLevelConfigBaseRespVO = userLevelConfigService.getMemberUserLevelConfig(idReqVo.getId());
return success(memberUserLevelConfigBaseRespVO);
}
@PostMapping("/add") @PostMapping("/add")
@ApiOperation("新增") @ApiOperation("新增")
public CommonResult<Boolean> add(@Valid @RequestBody MemberUserLevelConfigUpdateVO query) { public CommonResult<Boolean> add(@Valid @RequestBody MemberUserLevelConfigUpdateVO query) {
...@@ -56,4 +61,11 @@ public class MemberUserLevelConfigController { ...@@ -56,4 +61,11 @@ public class MemberUserLevelConfigController {
public CommonResult<Boolean> update(@Valid @RequestBody MemberUserLevelConfigUpdateVO query) { public CommonResult<Boolean> update(@Valid @RequestBody MemberUserLevelConfigUpdateVO query) {
return success(userLevelConfigService.updateLevel(query)); return success(userLevelConfigService.updateLevel(query));
} }
@PostMapping("/status")
@ApiOperation("启用关闭")
//@PreAuthorize("@ss.hasPermission('member:score-rule:update')")
public CommonResult<Boolean> updateStatus(@Valid @RequestBody MemberUserLevelStatusReqVO memberUserLevelReqVO) {
userLevelConfigService.updateStatus(memberUserLevelReqVO);
return success(true);
}
} }
package cn.iocoder.yudao.module.member.controller.admin.levelLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.service.levelLog.MemberUserLevelLogService;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogBackVO;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogQueryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "管理后台 - 会员等级记录")
@RequestMapping("/member/user-level-log")
public class MemberUserLevelLogController {
@Resource
private MemberUserLevelLogService memberUserLevelLogService;
@PostMapping("/page")
@ApiOperation("获得等级记录分页")
//@PreAuthorize("@ss.hasPermission('member:user-level-log:query')")
public CommonResult<PageResult<MemberUserLevelLogBackVO>> page(@Valid @RequestBody MemberUserLevelLogQueryVO query) {
PageResult<MemberUserLevelLogBackVO> pageResult = memberUserLevelLogService.getPage(query);
return success(pageResult);
}
}
package cn.iocoder.yudao.module.member.controller.admin.levelOperateLog;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.service.levelOperateLog.MemberUserLevelOperateLogService;
import cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogBackVO;
import cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogQueryVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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 javax.validation.Valid;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "管理后台 - 会员等级操作记录")
@RequestMapping("/member/level-operate-log")
public class MemberUserLevelOperateLogController {
@Resource
private MemberUserLevelOperateLogService memberUserLevelOperateLogService;
@PostMapping("/page")
@ApiOperation("获得等级操作记录分页")
//@PreAuthorize("@ss.hasPermission('member:user-level-log:query')")
public CommonResult<PageResult<MemberUserLevelOperateLogBackVO>> page(@Valid @RequestBody MemberUserLevelOperateLogQueryVO query) {
PageResult<MemberUserLevelOperateLogBackVO> pageResult = memberUserLevelOperateLogService.getPage(query);
return success(pageResult);
}
}
...@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; ...@@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*; import lombok.*;
import java.util.Date;
@Data @Data
@Builder @Builder
...@@ -34,4 +35,48 @@ public class MemberUserLevelConfigDO extends BaseDO { ...@@ -34,4 +35,48 @@ public class MemberUserLevelConfigDO extends BaseDO {
* 图标 * 图标
*/ */
private String icon; private String icon;
/**
* 等级(字典配置)
*/
private Integer level;
/**
* 状态(0.未发布,1.已启用,2.已禁用,3.已过期)
*/
private Integer status;
/**
* 规则编号
*/
private String ruleNumber;
/**
* 等级有效期(数字正整数或为空)
*/
private Integer validityPeriod;
/**
* 积分累计周期(数字正整数或为空)
*/
private Integer accumulationPeriod;
/**
* 积分累计开始日期(时间选择框,时间选择,不需要日期,可为空)
*/
private Date startDate;
/**
* 启用日期
*/
private Date enableDate;
/**
* 等级规则有效期开始时间(时间选择框,结束时间可不填写,代表长期有效)
*/
private Date startTime;
/**
* 等级规则有效期结束时间(时间选择框,结束时间可不填写,代表长期有效)
*/
private Date endTime;
/**
* 等级说明
*/
private String description;
/**
* 匹配顺序(限制为数字)
*/
private Integer sort;
} }
package cn.iocoder.yudao.module.member.dal.dataobject.levelLog;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("member_user_level_log")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MemberUserLevelLogDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
private Long configId;
private String operator;
private String remarks;
private Integer operateType;
private Long bpmProcessId;
}
package cn.iocoder.yudao.module.member.dal.dataobject.levelOperatLog;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName("member_user_level_operate_log")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MemberUserLevelOperateLogDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
private Long configId;
private String configName;
private Long memberId;
private String operator;
private String remarks;
private Integer level;
private Integer operateType;
}
...@@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.member.dal.mysql.memberUserLevel; ...@@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.member.dal.mysql.memberUserLevel;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper; import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberUserLevelConfigDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberUserLevelConfigDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
/** /**
* 会员等级 Mapper * 会员等级 Mapper
...@@ -10,5 +12,7 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -10,5 +12,7 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface MemberUserLevelConfigMapper extends AbstractMapper<MemberUserLevelConfigDO> { public interface MemberUserLevelConfigMapper extends AbstractMapper<MemberUserLevelConfigDO> {
@ResultType(String.class)
@Select({"select rule_number from member_user_level_config order by rule_number desc limit 1"})
String getCurrentMaxMemberUserLevelRuleNumber();
} }
package cn.iocoder.yudao.module.member.dal.mysql.memberUserLevelLog;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.levelLog.MemberUserLevelLogDO;
import cn.iocoder.yudao.module.member.dal.dataobject.scoreLog.MemberUserScoreLogDO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogBackVO;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 会员积分 Mapper
* @author 系统管理员
*/
@Mapper
public interface MemberUserLevelLogMapper extends AbstractMapper<MemberUserLevelLogDO> {
List<MemberUserLevelLogBackVO> getPageRecordList(@Param("start") int start, @Param("size") int size, @Param("query") MemberUserLevelLogQueryVO query);
int getPageCount(@Param("query") MemberUserLevelLogQueryVO query);
}
package cn.iocoder.yudao.module.member.dal.mysql.memberUserLevelOperateLog;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.levelLog.MemberUserLevelLogDO;
import cn.iocoder.yudao.module.member.dal.dataobject.levelOperatLog.MemberUserLevelOperateLogDO;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogBackVO;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogQueryVO;
import cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogBackVO;
import cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 会员积分 Mapper
* @author 系统管理员
*/
@Mapper
public interface MemberUserLevelOperateLogMapper extends AbstractMapper<MemberUserLevelOperateLogDO> {
List<MemberUserLevelOperateLogBackVO> getPageRecordList(@Param("start") int start, @Param("size") int size, @Param("query") MemberUserLevelOperateLogQueryVO query);
int getPageCount(@Param("query") MemberUserLevelOperateLogQueryVO query);
}
...@@ -6,7 +6,9 @@ import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberUserLevelConfig ...@@ -6,7 +6,9 @@ import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberUserLevelConfig
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigBaseRespVO; import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigBaseRespVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigReqVO; import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigReqVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigUpdateVO; import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigUpdateVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelStatusReqVO;
import javax.validation.Valid;
import java.util.List; import java.util.List;
/** /**
...@@ -20,9 +22,13 @@ public interface MemberUserLevelConfigService extends IService<MemberUserLevelCo ...@@ -20,9 +22,13 @@ public interface MemberUserLevelConfigService extends IService<MemberUserLevelCo
Boolean delete(List<Long> ids); Boolean delete(List<Long> ids);
MemberUserLevelConfigBaseRespVO getMemberUserLevelConfig(Long id);
Boolean add(MemberUserLevelConfigUpdateVO query); Boolean add(MemberUserLevelConfigUpdateVO query);
Boolean updateLevel(MemberUserLevelConfigUpdateVO query); Boolean updateLevel(MemberUserLevelConfigUpdateVO query);
MemberUserLevelConfigBaseRespVO getLevelByCount(Integer scoreCount); MemberUserLevelConfigBaseRespVO getLevelByCount(Integer scoreCount);
void updateStatus(@Valid MemberUserLevelStatusReqVO memberUserLevelReqVO);
} }
...@@ -5,9 +5,15 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; ...@@ -5,9 +5,15 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService; import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberUserLevelConfigDO; import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberUserLevelConfigDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserLevel.MemberUserLevelConfigMapper; import cn.iocoder.yudao.module.member.dal.mysql.memberUserLevel.MemberUserLevelConfigMapper;
import cn.iocoder.yudao.module.member.enums.MemberLevelStatusEnum;
import cn.iocoder.yudao.module.member.service.levelLog.MemberUserLevelLogService;
import cn.iocoder.yudao.module.member.util.MenberUserLevelGenCodeUtils;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigBaseRespVO; import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigBaseRespVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigReqVO; import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigReqVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigUpdateVO; import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelConfigUpdateVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelStatusReqVO;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogCreateReq;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
...@@ -16,13 +22,14 @@ import org.springframework.context.annotation.Lazy; ...@@ -16,13 +22,14 @@ import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Comparator; import java.util.Comparator;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.LEVEL_BOUND_RANGE_CONFLICT; import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.LEVEL_BOUND_RANGE_ERROR;
/** /**
* 会员积分 Service 实现类 * 会员积分 Service 实现类
...@@ -35,7 +42,12 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.LEVEL_BOUN ...@@ -35,7 +42,12 @@ import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.LEVEL_BOUN
public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUserLevelConfigMapper, MemberUserLevelConfigDO> implements MemberUserLevelConfigService { public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUserLevelConfigMapper, MemberUserLevelConfigDO> implements MemberUserLevelConfigService {
private final MemberUserLevelConfigMapper memberUserLevelConfigMapper; private final MemberUserLevelConfigMapper memberUserLevelConfigMapper;
@Resource
private MenberUserLevelGenCodeUtils menberUserLevelGenCodeUtils;
@Resource
private MemberUserLevelLogService logService;
@Resource
private AdminUserApi adminUserApi;
public MemberUserLevelConfigServiceImpl(MemberUserLevelConfigMapper memberUserLevelConfigMapper) { public MemberUserLevelConfigServiceImpl(MemberUserLevelConfigMapper memberUserLevelConfigMapper) {
this.memberUserLevelConfigMapper = memberUserLevelConfigMapper; this.memberUserLevelConfigMapper = memberUserLevelConfigMapper;
} }
...@@ -45,6 +57,18 @@ public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUser ...@@ -45,6 +57,18 @@ public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUser
int start = (query.getPageNo() - 1) * query.getPageSize(); int start = (query.getPageNo() - 1) * query.getPageSize();
int size = query.getPageSize(); int size = query.getPageSize();
LambdaQueryWrapper<MemberUserLevelConfigDO> wrapper = Wrappers.lambdaQuery(); LambdaQueryWrapper<MemberUserLevelConfigDO> wrapper = Wrappers.lambdaQuery();
if (query.getName() != null){
wrapper.like(MemberUserLevelConfigDO::getName, query.getName());
}
if (query.getStatus() != null){
wrapper.eq(MemberUserLevelConfigDO::getStatus, query.getStatus());
}
if (query.getLevel() != null){
wrapper.eq(MemberUserLevelConfigDO::getLevel, query.getLevel());
}
if (query.getBeginCreateTime() != null&& query.getEndCreateTime() != null){
wrapper.between(MemberUserLevelConfigDO::getEnableDate, query.getBeginCreateTime(), query.getEndCreateTime());
}
wrapper.eq(MemberUserLevelConfigDO::getDeleted, 0); wrapper.eq(MemberUserLevelConfigDO::getDeleted, 0);
wrapper.last(String.format("limit %s, %s", start, size)); wrapper.last(String.format("limit %s, %s", start, size));
List<MemberUserLevelConfigDO> list = this.list(wrapper); List<MemberUserLevelConfigDO> list = this.list(wrapper);
...@@ -64,11 +88,40 @@ public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUser ...@@ -64,11 +88,40 @@ public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUser
return this.update(wrapper); return this.update(wrapper);
} }
@Override
public MemberUserLevelConfigBaseRespVO getMemberUserLevelConfig(Long id) {
MemberUserLevelConfigDO memberUserLevelConfigDO = memberUserLevelConfigMapper.selectById(id);
if (memberUserLevelConfigDO== null){
throw exception(SCORE_RULE_NOT_EXISTS);
}
MemberUserLevelConfigBaseRespVO memberUserLevelConfigBaseRespVO = BeanUtil.copyProperties(memberUserLevelConfigDO, MemberUserLevelConfigBaseRespVO.class);
String creator = adminUserApi.getUserName(memberUserLevelConfigDO.getCreator());
memberUserLevelConfigBaseRespVO.setCreator(creator);
String updater = adminUserApi.getUserName(memberUserLevelConfigDO.getUpdater());
memberUserLevelConfigBaseRespVO.setUpdater(updater);
return memberUserLevelConfigBaseRespVO;
}
@Override @Override
public Boolean add(MemberUserLevelConfigUpdateVO query) { public Boolean add(MemberUserLevelConfigUpdateVO query) {
validate(query); validate(query);
MemberUserLevelConfigDO memberUserLevelConfigDO = BeanUtil.copyProperties(query, MemberUserLevelConfigDO.class); MemberUserLevelConfigDO memberUserLevelConfigDO = BeanUtil.copyProperties(query, MemberUserLevelConfigDO.class);
return this.saveOrUpdate(memberUserLevelConfigDO); //生成编号
String ruleNumber = menberUserLevelGenCodeUtils.generateMemberLevelCode();
memberUserLevelConfigDO.setRuleNumber(ruleNumber);
//是否传入状态
if (query.getStatus() != null && query.getStatus() == 1){
memberUserLevelConfigDO.setStatus(query.getStatus());
memberUserLevelConfigDO.setEnableDate(new Date());
}else {
memberUserLevelConfigDO.setStatus(0);
}
//插入日志
boolean updateStatus = this.saveOrUpdate(memberUserLevelConfigDO);
if (updateStatus){
createLog(memberUserLevelConfigDO,1);
}
return updateStatus;
} }
private void validate(MemberUserLevelConfigUpdateVO query) { private void validate(MemberUserLevelConfigUpdateVO query) {
...@@ -95,7 +148,12 @@ public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUser ...@@ -95,7 +148,12 @@ public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUser
public Boolean updateLevel(MemberUserLevelConfigUpdateVO query) { public Boolean updateLevel(MemberUserLevelConfigUpdateVO query) {
validate(query); validate(query);
MemberUserLevelConfigDO memberUserLevelConfigDO = BeanUtil.copyProperties(query, MemberUserLevelConfigDO.class); MemberUserLevelConfigDO memberUserLevelConfigDO = BeanUtil.copyProperties(query, MemberUserLevelConfigDO.class);
return this.saveOrUpdate(memberUserLevelConfigDO); //插入日志
boolean updateStatus = this.saveOrUpdate(memberUserLevelConfigDO);
if (updateStatus){
createLog(memberUserLevelConfigDO,2);
}
return updateStatus;
} }
@Override @Override
...@@ -108,4 +166,35 @@ public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUser ...@@ -108,4 +166,35 @@ public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUser
.findAny().orElse(sortLevelConfig.get(sortLevelConfig.size() - 1)); .findAny().orElse(sortLevelConfig.get(sortLevelConfig.size() - 1));
return BeanUtil.copyProperties(memberUserLevelConfigDO, MemberUserLevelConfigBaseRespVO.class); return BeanUtil.copyProperties(memberUserLevelConfigDO, MemberUserLevelConfigBaseRespVO.class);
} }
@Override
public void updateStatus(MemberUserLevelStatusReqVO memberUserLevelStatusReqVO) {
MemberUserLevelConfigDO memberUserLevelConfigDO = memberUserLevelConfigMapper.selectById(memberUserLevelStatusReqVO.getId());
if (memberUserLevelConfigDO == null) {
throw exception(LEVEL_RULE_NOT_EXISTS);
}
Integer oldStatus = memberUserLevelConfigDO.getStatus();
MemberUserLevelConfigDO upMemberLevelConfigDO = new MemberUserLevelConfigDO();
upMemberLevelConfigDO.setId(memberUserLevelStatusReqVO.getId());
if (oldStatus == MemberLevelStatusEnum.ENABLED.getValue() && memberUserLevelStatusReqVO.getStatus() == MemberLevelStatusEnum.CLOSED.getValue()) {
upMemberLevelConfigDO.setStatus(memberUserLevelStatusReqVO.getStatus());
} else if (oldStatus == MemberLevelStatusEnum.DRAFT.getValue() && memberUserLevelStatusReqVO.getStatus() == MemberLevelStatusEnum.ENABLED.getValue()) {
upMemberLevelConfigDO.setStatus(memberUserLevelStatusReqVO.getStatus());
upMemberLevelConfigDO.setEnableDate(new Date());
} else {
throw exception(SCORE_RULE_STATUS_ERROR);
}
memberUserLevelConfigMapper.updateById(upMemberLevelConfigDO);
}
private void createLog(MemberUserLevelConfigDO memberUserLevelConfigDO,Integer operateType){
MemberUserLevelLogCreateReq memberUserLevelLogcreateReq = MemberUserLevelLogCreateReq
.builder().createTime(memberUserLevelConfigDO.getCreateTime())
.configId(memberUserLevelConfigDO.getId())
.operator(memberUserLevelConfigDO.getCreator())
.remarks(null)
.operateType(operateType)
.bpmProcessId(null)
.build();
logService.createLevelLog(memberUserLevelLogcreateReq);
}
} }
package cn.iocoder.yudao.module.member.service.levelLog;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.member.dal.dataobject.levelLog.MemberUserLevelLogDO;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogBackVO;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogCreateReq;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogQueryVO;
/**
* 会员等级日志 Service 接口
*
* @author 系统管理员
*/
public interface MemberUserLevelLogService extends IService<MemberUserLevelLogDO> {
PageResult<MemberUserLevelLogBackVO> getPage(MemberUserLevelLogQueryVO query);
Long createLevelLog(MemberUserLevelLogCreateReq createReq);
}
package cn.iocoder.yudao.module.member.service.levelLog;
import cn.hutool.core.lang.generator.SnowflakeGenerator;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.member.dal.dataobject.levelLog.MemberUserLevelLogDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserLevelLog.MemberUserLevelLogMapper;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogBackVO;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogCreateReq;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogQueryVO;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.MEMBER_ID_IS_NULL;
/**
* 会员等级日志 Service 实现类
*
* @author 系统管理员
*/
@Service
@Validated
public class MemberUserLevelLogServiceImpl extends AbstractService<MemberUserLevelLogMapper, MemberUserLevelLogDO> implements MemberUserLevelLogService {
@Resource
private MemberUserLevelLogMapper userLevelLogMapper;
@Resource
private SnowflakeGenerator snowflakeGenerator;
@Override
public PageResult<MemberUserLevelLogBackVO> getPage(MemberUserLevelLogQueryVO query) {
int start = (query.getPageNo() - 1) * query.getPageSize();
int size = query.getPageSize();
List<MemberUserLevelLogBackVO> list = userLevelLogMapper.getPageRecordList(start, size, query);
int total = userLevelLogMapper.getPageCount(query);
return new PageResult<>(list, total, query.getPageSize(), query.getPageNo(), (total + query.getPageSize() - 1) / query.getPageSize());
}
@Override
public Long createLevelLog(MemberUserLevelLogCreateReq createReq) {
if (createReq.getConfigId() == null) {
throw exception(MEMBER_ID_IS_NULL);
}
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
MemberUserLevelLogDO userLevelLogDO = new MemberUserLevelLogDO();
userLevelLogDO.setId(snowflakeGenerator.next());
userLevelLogDO.setConfigId(createReq.getConfigId());
userLevelLogDO.setRemarks(createReq.getRemarks());
userLevelLogDO.setOperator(loginUser.getNickname());
userLevelLogDO.setOperateType(createReq.getOperateType());
userLevelLogDO.setBpmProcessId(createReq.getBpmProcessId());
this.saveOrUpdate(userLevelLogDO);
return userLevelLogDO.getId();
}
}
package cn.iocoder.yudao.module.member.service.levelOperateLog;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.member.dal.dataobject.levelOperatLog.MemberUserLevelOperateLogDO;
import cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogBackVO;
import cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogCreateReq;
import cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogQueryVO;
/**
* 会员等级日志 Service 接口
*
* @author 系统管理员
*/
public interface MemberUserLevelOperateLogService extends IService<MemberUserLevelOperateLogDO> {
PageResult<MemberUserLevelOperateLogBackVO> getPage(MemberUserLevelOperateLogQueryVO query);
// Long createLevelLog(MemberUserLevelOperateLogCreateReq createReq);
}
package cn.iocoder.yudao.module.member.service.levelOperateLog;
import cn.hutool.core.lang.generator.SnowflakeGenerator;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.member.dal.dataobject.levelLog.MemberUserLevelLogDO;
import cn.iocoder.yudao.module.member.dal.dataobject.levelOperatLog.MemberUserLevelOperateLogDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserLevelLog.MemberUserLevelLogMapper;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserLevelOperateLog.MemberUserLevelOperateLogMapper;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogBackVO;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogCreateReq;
import cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogQueryVO;
import cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogBackVO;
import cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogCreateReq;
import cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogQueryVO;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.MEMBER_ID_IS_NULL;
/**
* 会员等级日志 Service 实现类
*
* @author 系统管理员
*/
@Service
@Validated
public class MemberUserLevelOperateLogServiceImpl extends AbstractService<MemberUserLevelOperateLogMapper, MemberUserLevelOperateLogDO> implements MemberUserLevelOperateLogService {
@Resource
private MemberUserLevelOperateLogMapper userLevelOperateLogMapper;
@Resource
private SnowflakeGenerator snowflakeGenerator;
@Override
public PageResult<MemberUserLevelOperateLogBackVO> getPage(MemberUserLevelOperateLogQueryVO query) {
int start = (query.getPageNo() - 1) * query.getPageSize();
int size = query.getPageSize();
List<MemberUserLevelOperateLogBackVO> list = userLevelOperateLogMapper.getPageRecordList(start, size, query);
int total = userLevelOperateLogMapper.getPageCount(query);
return new PageResult<>(list, total, query.getPageSize(), query.getPageNo(), (total + query.getPageSize() - 1) / query.getPageSize());
}
// @Override
// public Long createLevelLog(MemberUserLevelOperateLogCreateReq createReq) {
// if (createReq.getConfigId() == null) {
// throw exception(MEMBER_ID_IS_NULL);
// }
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// MemberUserLevelLogDO userLevelLogDO = new MemberUserLevelLogDO();
// userLevelLogDO.setId(snowflakeGenerator.next());
// userLevelLogDO.setConfigId(createReq.getConfigId());
// userLevelLogDO.setRemarks(createReq.getRemarks());
// userLevelLogDO.setOperator(loginUser.getNickname());
// userLevelLogDO.setOperateType(createReq.getOperateType());
// userLevelLogDO.setBpmProcessId(createReq.getBpmProcessId());
// this.saveOrUpdate(userLevelLogDO);
// return userLevelLogDO.getId();
// }
}
package cn.iocoder.yudao.module.member.util;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.member.dal.mysql.ScoreRuleShareRecord.ScoreRuleShareRecordMapper;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserLevel.MemberUserLevelConfigMapper;
import cn.iocoder.yudao.module.member.dal.mysql.scoreRule.ScoreRuleMapper;
import com.alibaba.excel.util.DateUtils;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.GET_LOCK_FAILED;
/**
* 根据规则生成各种code
*/
@Component
public class MenberUserLevelGenCodeUtils {
@Resource
private RedisHelper redisHelper;
@Resource
private RedissonClient redissonClient;
@Resource
private MemberUserLevelConfigMapper memberUserLevelConfigMapper;
/**
* 生成积分规则编号
*/
public String generateMemberLevelCode() {
// 编号规则为MB+年份+5位数,例如MB2400001
String key = "memberLevel:max:number";
StringBuilder code = new StringBuilder();
code.append("MB");
code.append(DateUtils.format(new Date(), "yy"));
Long codeNum;
if (redisHelper.hasKey(key)) {
codeNum = redisHelper.incrBy(key, 1);
} else {
RLock lock = redissonClient.getLock("next:memberLevel:code:lock");
try {
boolean lockSuccess = lock.tryLock(2, 2, TimeUnit.SECONDS);
if (!lockSuccess) {
throw exception(GET_LOCK_FAILED);
}
String currentMaxMemberUserLevelRuleNumber = memberUserLevelConfigMapper.getCurrentMaxMemberUserLevelRuleNumber();
if (currentMaxMemberUserLevelRuleNumber == null){
codeNum = 1L;
} else {
codeNum = Long.parseLong(currentMaxMemberUserLevelRuleNumber.substring(4)) + 1;
}
redisHelper.set(key, String.valueOf(codeNum),10, TimeUnit.SECONDS);
} catch (InterruptedException e) {
throw exception(GET_LOCK_FAILED);
} finally {
lock.unlock();
}
}
// 获得5位序列号,不足位前面补0
codeNum = codeNum % 100000;
code.append(String.format("%05d", codeNum));
return code.toString();
}
}
package cn.iocoder.yudao.module.member.vo.userLevel; package cn.iocoder.yudao.module.member.vo.userLevel;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data @Data
@ApiModel("管理后台 - 会员等级查询返回 VO") @ApiModel("管理后台 - 会员等级查询返回 VO")
...@@ -29,4 +35,78 @@ public class MemberUserLevelConfigBaseRespVO { ...@@ -29,4 +35,78 @@ public class MemberUserLevelConfigBaseRespVO {
*/ */
@ApiModelProperty(value = "图标") @ApiModelProperty(value = "图标")
private String icon; private String icon;
/**
* 等级(字典配置)
*/
@ApiModelProperty(value = "等级")
private Integer level;
/**
* 状态(0.未发布,1.已启用,2.已禁用,3.已过期)
*/
@ApiModelProperty(value = "状态")
private Integer status;
/**
* 规则编号
*/
@ApiModelProperty(value = "规则编号")
private String ruleNumber;
/**
* 等级有效期
*/
@ApiModelProperty(value = "等级有效期")
private Integer validityPeriod;
/**
* 积分累计周期
*/
@ApiModelProperty(value = "积分累计周期")
private Integer accumulationPeriod;
/**
* 积分累计开始日期
*/
@ApiModelProperty(value = "积分开始累计时间")
private Date startDate;
/**
* 启用日期
*/
@ApiModelProperty(value = "启用日期")
private Date enableDate;
/**
* 积分开始累计时间
*/
@ApiModelProperty(value = "等级规则有效期开始时间")
private Date startTime;
/**
* 等级规则有效期结束时间
*/
@ApiModelProperty(value = "等级规则有效期结束时间")
private Date endTime;
/**
* 等级说明
*/
@ApiModelProperty(value = "等级说明")
private String description;
/**
* 匹配顺序(限制为数字)
*/
@ApiModelProperty(value = "匹配顺序")
private Integer sort;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
@ExcelProperty("更新时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "更新时间", required = true)
private Date updateTime;
@ExcelProperty("创建人")
@ApiModelProperty(value = "创建人", required = true)
private String creator;
@ExcelProperty("更新人")
@ApiModelProperty(value = "更新人", required = true)
private String updater;
} }
...@@ -4,6 +4,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam; ...@@ -4,6 +4,11 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/** /**
* @author zhaobiyan * @author zhaobiyan
...@@ -13,4 +18,32 @@ import lombok.Data; ...@@ -13,4 +18,32 @@ import lombok.Data;
public class MemberUserLevelConfigReqVO extends PageParam { public class MemberUserLevelConfigReqVO extends PageParam {
@ApiModelProperty(value = "id") @ApiModelProperty(value = "id")
private Long id; private Long id;
/**
* 名称
*/
@ApiModelProperty(value = "等级名称")
private String name;
/**
* 等级(字典配置)
*/
@ApiModelProperty(value = "等级")
private Integer level;
/**
* 状态(0.未发布,1.已启用,2.已禁用,3.已过期)
*/
@ApiModelProperty(value = "状态")
private Integer status;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始启用时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束启用时间")
private Date endCreateTime;
} }
...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import java.util.Date;
@Data @Data
@ApiModel("管理后台 - 会员等级编辑 VO") @ApiModel("管理后台 - 会员等级编辑 VO")
...@@ -35,4 +36,66 @@ public class MemberUserLevelConfigUpdateVO { ...@@ -35,4 +36,66 @@ public class MemberUserLevelConfigUpdateVO {
@ApiModelProperty(value = "图标") @ApiModelProperty(value = "图标")
@NotNull(message = "icon is null") @NotNull(message = "icon is null")
private String icon; private String icon;
/**
* 等级(字典配置)
*/
@ApiModelProperty(value = "等级")
@NotNull(message = "等级不能为空")
private Integer level;
/**
* 状态(0.未发布,1.已启用,2.已禁用,3.已过期)
*/
@ApiModelProperty(value = "状态")
private Integer status;
/**
* 规则编号
*/
@ApiModelProperty(value = "规则编号")
private String ruleNumber;
/**
* 等级有效期
*/
@ApiModelProperty(value = "等级有效期")
private Integer validityPeriod;
/**
* 积分累计周期
*/
@ApiModelProperty(value = "积分累计周期")
@NotNull(message = "积分累计周期不能为空")
private Integer accumulationPeriod;
/**
* 积分累计开始日期
*/
@ApiModelProperty(value = "积分开始累计时间")
private Date startDate;
/**
* 启用日期
*/
@ApiModelProperty(value = "启用日期")
private Date enableDate;
/**
* 积分开始累计时间
*/
@ApiModelProperty(value = "等级规则有效期开始时间")
@NotNull(message = "等级规则有效期开始时间不能为空")
private Date startTime;
/**
* 等级规则有效期结束时间
*/
@ApiModelProperty(value = "等级规则有效期结束时间")
private Date endTime;
/**
* 等级说明
*/
@ApiModelProperty(value = "等级说明")
@NotNull(message = "等级说明不能为空")
private String description;
/**
* 匹配顺序(限制为数字)
*/
@ApiModelProperty(value = "匹配顺序")
@NotNull(message = "匹配顺序不能为空")
private Integer sort;
} }
package cn.iocoder.yudao.module.member.vo.userLevel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
@ApiModel("管理后台 - 启用关闭规则 VO")
public class MemberUserLevelStatusReqVO {
@ApiModelProperty(value = "主键", required = true)
@NotNull(message = "主键不能为空")
private Long id;
@ApiModelProperty(value = "状态(1已启用,2未启用,3已关闭,4已过期)", required = true)
@NotNull(message = "状态不能为空")
private Integer status;
}
package cn.iocoder.yudao.module.member.vo.userLevelLog;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* @author Smile
*/
@Data
@ApiModel("管理后台 - 等级规则记录查询 VO")
public class MemberUserLevelLogBackVO {
@ApiModelProperty(value = "操作记录id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@ApiModelProperty(value = "会员等级配置id")
private Long configId;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "操作时间")
private Date createTime;
@ApiModelProperty(value = "操作人")
private String operator;
@ApiModelProperty(value = "备注")
private String remarks;
@ApiModelProperty(value = "操作类型,1-新增,2-编辑", required = true)
private Integer operateType;
@ExcelProperty("审批流程ID")
@ApiModelProperty(value = "审批流程ID")
private String bpmProcessId;
}
package cn.iocoder.yudao.module.member.vo.userLevelLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.Map;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* @author Smile
*/
@Data
@Builder
public class MemberUserLevelLogCreateReq {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "操作时间")
private Date createTime;
@ApiModelProperty(value = "会员等级配置id")
private Long configId;
@ApiModelProperty(value = "操作人")
private String operator;
@ApiModelProperty(value = "备注")
private String remarks;
@ApiModelProperty(value = "操作类型,1-新增,2-编辑", required = true)
private Integer operateType;
@ApiModelProperty(value = "审批流程ID")
private Long bpmProcessId;
}
package cn.iocoder.yudao.module.member.vo.userLevelLog;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
/**
* @author zhaobiyan
*/
@Data
@ApiModel("管理后台 - 积分记录查询 VO")
public class MemberUserLevelLogQueryVO extends PageParam {
@ApiModelProperty(value = "会员等级配置id")
private Long configId;
}
package cn.iocoder.yudao.module.member.vo.userLevelOperateLog;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Smile
*/
@Data
@ApiModel("管理后台 - 等级规则记录查询 VO")
public class MemberUserLevelOperateLogBackVO {
@ApiModelProperty(value = "操作记录id")
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
@ApiModelProperty(value = "会员等级配置id")
private Long configId;
@ApiModelProperty(value = "会员id")
private Long memberId;
@ApiModelProperty(value = "操作人")
private String configName;
@ApiModelProperty(value = "操作人")
private String operator;
@ApiModelProperty(value = "备注")
private String remarks;
@ApiModelProperty(value = "操作类型,1-升级 2-降级 3-修改", required = true)
private Integer operateType;
@ApiModelProperty(value = "等级")
private Integer level;
}
package cn.iocoder.yudao.module.member.vo.userLevelOperateLog;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
/**
* @author Smile
*/
@Data
@Builder
public class MemberUserLevelOperateLogCreateReq {
@ApiModelProperty(value = "会员等级配置id")
private Long configId;
@ApiModelProperty(value = "会员id")
private Long memberId;
@ApiModelProperty(value = "操作人")
private String configName;
@ApiModelProperty(value = "操作人")
private String operator;
@ApiModelProperty(value = "备注")
private String remarks;
@ApiModelProperty(value = "操作类型,1-升级 2-降级 3-修改", required = true)
private Integer operateType;
@ApiModelProperty(value = "等级")
private Integer level;
}
package cn.iocoder.yudao.module.member.vo.userLevelOperateLog;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author zhaobiyan
*/
@Data
@ApiModel("管理后台 - 会员等级操作记录查询 VO")
public class MemberUserLevelOperateLogQueryVO extends PageParam {
@ApiModelProperty(value = "会员id")
private Long memberId;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.member.dal.mysql.memberUserLevelLog.MemberUserLevelLogMapper">
<select id="getPageRecordList"
resultType="cn.iocoder.yudao.module.member.vo.userLevelLog.MemberUserLevelLogBackVO">
select
mull.id as id,
mull.config_id as configId,
mull.operator as operator,
mull.create_time as createTime,
mull.operate_type as operateType,
mull.remarks as remarks,
mull.bpm_process_id as bpmProcessId
from member_user_level_log mull
where 1=1
and mull.config_id = #{query.configId}
order by mull.create_time desc
limit #{start}, #{size}
</select>
<select id="getPageCount" resultType="java.lang.Integer">
select count(*)
from member_user_level_log mull
where 1=1
and mull.config_id = #{query.configId}
</select>
</mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.iocoder.yudao.module.member.dal.mysql.memberUserLevelOperateLog.MemberUserLevelOperateLogMapper">
<select id="getPageRecordList"
resultType="cn.iocoder.yudao.module.member.vo.userLevelOperateLog.MemberUserLevelOperateLogBackVO">
SELECT
mulol.id as id,
mulol.config_id as configId,
mulol.config_name as configName,
mulol.member_id as memberId,
mulol.operator as operator,
mulol.remarks as remarks,
mulol.`level` as level,
mulol.operate_type as operateType
FROM member_user_level_operate_log mulol
where 1=1
and mulol.member_id = #{query.memberId}
order by mulol.create_time desc
limit #{start}, #{size}
</select>
<select id="getPageCount" resultType="java.lang.Integer">
select count(*)
from member_user_level_operate_log mulol
where 1=1
and mulol.member_id = #{query.memberId}
</select>
</mapper>
...@@ -1059,6 +1059,7 @@ date.format.error = \u65E5\u671F\u683C\u5F0F\u4E0D\u6B63\u786E, \u6B63\u786E\u68 ...@@ -1059,6 +1059,7 @@ date.format.error = \u65E5\u671F\u683C\u5F0F\u4E0D\u6B63\u786E, \u6B63\u786E\u68
redeem.cancel.status.error = \u5151\u6362\u4E2D\u72B6\u6001\u7684\u8BB0\u5F55\u624D\u80FD\u64A4\u9500 redeem.cancel.status.error = \u5151\u6362\u4E2D\u72B6\u6001\u7684\u8BB0\u5F55\u624D\u80FD\u64A4\u9500
level.bound.range.error = \u4E0A\u754C\u6570\u503C\u5FC5\u987B\u5927\u4E8E\u4E0B\u754C\u6570\u503C level.bound.range.error = \u4E0A\u754C\u6570\u503C\u5FC5\u987B\u5927\u4E8E\u4E0B\u754C\u6570\u503C
level.bound.range.conflict = \u79EF\u5206\u8303\u56F4\u5B58\u5728\u51B2\u7A81 level.bound.range.conflict = \u79EF\u5206\u8303\u56F4\u5B58\u5728\u51B2\u7A81
level.rule.not.exists = \u4F1A\u5458\u7B49\u7EA7\u89C4\u5219\u4E0D\u5B58\u5728
score.operate.idempotent.error = \u5E42\u7B49key\u51B2\u7A81 score.operate.idempotent.error = \u5E42\u7B49key\u51B2\u7A81
score.rule.not.exists = \u79EF\u5206\u89C4\u5219\u4E0D\u5B58\u5728 score.rule.not.exists = \u79EF\u5206\u89C4\u5219\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