Commit 03417dfe authored by zhaobiyan's avatar zhaobiyan

Merge branch 'feature_member_score' into dev

parents ec82b75d fe56588f
...@@ -53,4 +53,6 @@ public interface ErrorCodeConstants { ...@@ -53,4 +53,6 @@ public interface ErrorCodeConstants {
ErrorCode REVERSE_SOURCE_NO_RELEATION_ID = new ErrorCode(1004008008, "reverse.source.no.releation.id"); ErrorCode REVERSE_SOURCE_NO_RELEATION_ID = new ErrorCode(1004008008, "reverse.source.no.releation.id");
ErrorCode LEVEL_BOUND_RANGE_ERROR = new ErrorCode(1004008009, "level.bound.range.error");
ErrorCode LEVEL_BOUND_RANGE_CONFLICT = new ErrorCode(1004008010, "level.bound.range.conflict");
} }
...@@ -2,17 +2,17 @@ package cn.iocoder.yudao.module.member.api.score; ...@@ -2,17 +2,17 @@ package cn.iocoder.yudao.module.member.api.score;
import cn.iocoder.yudao.framework.apollo.core.event.export.MemberScoreDetailExpireEvent; import cn.iocoder.yudao.framework.apollo.core.event.export.MemberScoreDetailExpireEvent;
import cn.iocoder.yudao.module.member.api.score.dto.*; import cn.iocoder.yudao.module.member.api.score.dto.*;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO; import cn.iocoder.yudao.module.member.dal.dataobject.score.MemberUserScoreDO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreDetail.MemberUserScoreDetailDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetail.MemberUserScoreDetailDO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreDetailReleation.MemberUserScoreDetailReleationDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetailReleation.MemberUserScoreDetailReleationDO;
import cn.iocoder.yudao.module.member.dto.ScoreDetailChangeDto; import cn.iocoder.yudao.module.member.dto.ScoreDetailChangeDto;
import cn.iocoder.yudao.module.member.enums.MemberScoreDetailReleationStatueEnum; import cn.iocoder.yudao.module.member.enums.MemberScoreDetailReleationStatueEnum;
import cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
import cn.iocoder.yudao.module.member.service.memberUserScore.MemberUserScoreService; import cn.iocoder.yudao.module.member.service.score.MemberUserScoreService;
import cn.iocoder.yudao.module.member.service.memberUserScoreDetail.MemberUserScoreDetailService; import cn.iocoder.yudao.module.member.service.scoreDetail.MemberUserScoreDetailService;
import cn.iocoder.yudao.module.member.service.memberUserScoreDetailReleation.MemberUserScoreDetailReleationService; import cn.iocoder.yudao.module.member.service.scoreDetailReleation.MemberUserScoreDetailReleationService;
import cn.iocoder.yudao.module.member.service.memberUserScoreLog.MemberUserScoreLogService; import cn.iocoder.yudao.module.member.service.scoreLog.MemberUserScoreLogService;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogCreateReq; import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogCreateReq;
import com.alibaba.excel.util.CollectionUtils; import com.alibaba.excel.util.CollectionUtils;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
......
...@@ -5,10 +5,10 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils; ...@@ -5,10 +5,10 @@ import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.module.member.api.score.MemberUserScoreApi; import cn.iocoder.yudao.module.member.api.score.MemberUserScoreApi;
import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreOperateReqDTO; import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreOperateReqDTO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreDetail.MemberUserScoreDetailDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetail.MemberUserScoreDetailDO;
import cn.iocoder.yudao.module.member.enums.MemberScoreStatueEnum; import cn.iocoder.yudao.module.member.enums.MemberScoreStatueEnum;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
import cn.iocoder.yudao.module.member.service.memberUserScoreDetail.MemberUserScoreDetailService; import cn.iocoder.yudao.module.member.service.scoreDetail.MemberUserScoreDetailService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......
package cn.iocoder.yudao.module.member.controller.admin.level;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.service.level.MemberUserLevelConfigService;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelBaseRespVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelReqVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelUpdateVO;
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.validation.Valid;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "管理后台 - 会员等级配置")
@RequestMapping("/member/user-level")
public class MemberUserLevelConfigController {
private final MemberUserLevelConfigService userLevelConfigService;
public MemberUserLevelConfigController(MemberUserLevelConfigService userLevelConfigService) {
this.userLevelConfigService = userLevelConfigService;
}
@PostMapping("/page")
@ApiOperation("列表")
public CommonResult<PageResult<MemberUserLevelBaseRespVO>> getLevelPage(@Valid @RequestBody MemberUserLevelReqVO query) {
return success(userLevelConfigService.getLevelPage(query));
}
@PostMapping("/delete")
@ApiOperation("删除")
public CommonResult<Boolean> delete(@Valid @RequestBody List<Long> ids) {
return success(userLevelConfigService.delete(ids));
}
@PostMapping("/add")
@ApiOperation("新增")
public CommonResult<Boolean> add(@Valid @RequestBody MemberUserLevelUpdateVO query) {
return success(userLevelConfigService.add(query));
}
@PostMapping("/update")
@ApiOperation("编辑")
public CommonResult<Boolean> update(@Valid @RequestBody MemberUserLevelUpdateVO query) {
return success(userLevelConfigService.updateLevel(query));
}
}
package cn.iocoder.yudao.module.member.controller.admin.memberUserScore; package cn.iocoder.yudao.module.member.controller.admin.userScore;
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;
...@@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreBatchOperateR ...@@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreBatchOperateR
import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreOperateRespDTO; import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreOperateRespDTO;
import cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
import cn.iocoder.yudao.module.member.service.memberUserScore.MemberUserScoreService; import cn.iocoder.yudao.module.member.service.score.MemberUserScoreService;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO; import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreOperateQueryVO; import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreOperateQueryVO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO; import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO;
......
package cn.iocoder.yudao.module.member.controller.admin.memberUserScoreLog; package cn.iocoder.yudao.module.member.controller.admin.userScoreLog;
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.memberUserScoreLog.MemberUserScoreLogService; import cn.iocoder.yudao.module.member.service.scoreLog.MemberUserScoreLogService;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO; 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.memberUserScoreLog.MemberUserScoreLogQueryVO;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
......
package cn.iocoder.yudao.module.member.dal.dataobject.level;
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_config")
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class MemberUserLevelConfigDO extends BaseDO {
/**
* 主键
*/
@TableId
private Long id;
/**
* 名称
*/
private String name;
/**
* 积分范围 下界
*/
private Integer lowerCount;
/**
* 积分范围 上界
*/
private Integer upperCount;
/**
* 图标
*/
private String icon;
}
package cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore; package cn.iocoder.yudao.module.member.dal.dataobject.score;
public class MemberUserScoreBackDO { public class MemberUserScoreBackDO {
} }
package cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore; package cn.iocoder.yudao.module.member.dal.dataobject.score;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
......
package cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreDetail; package cn.iocoder.yudao.module.member.dal.dataobject.scoreDetail;
import cn.hutool.json.JSONArray; import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
...@@ -6,12 +6,9 @@ import cn.hutool.json.JSONUtil; ...@@ -6,12 +6,9 @@ import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 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 io.vavr.collection.List;
import lombok.*; import lombok.*;
import org.apache.commons.lang.StringUtils;
import java.util.Date; import java.util.Date;
import java.util.Map;
/** /**
* 会员积分 DO * 会员积分 DO
......
package cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreDetailReleation; package cn.iocoder.yudao.module.member.dal.dataobject.scoreDetailReleation;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 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;
/** /**
* 会员积分 DO * 会员积分 DO
* *
......
package cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreLog; package cn.iocoder.yudao.module.member.dal.dataobject.scoreLog;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableId;
......
package cn.iocoder.yudao.module.member.dal.mysql.memberUserLevel;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.member.dal.dataobject.level.MemberUserLevelConfigDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 会员等级 Mapper
* @author 系统管理员
*/
@Mapper
public interface MemberUserLevelConfigMapper extends AbstractMapper<MemberUserLevelConfigDO> {
}
package cn.iocoder.yudao.module.member.dal.mysql.memberUserScore; package cn.iocoder.yudao.module.member.dal.mysql.memberUserScore;
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.memberUserScore.MemberUserScoreDO; import cn.iocoder.yudao.module.member.dal.dataobject.score.MemberUserScoreDO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO; import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO; import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreQueryVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
......
package cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreDetail; package cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreDetail;
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.memberUserScoreDetail.MemberUserScoreDetailDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetail.MemberUserScoreDetailDO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreLog.MemberUserScoreLogDO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.List;
/** /**
* 会员积分详情 Mapper * 会员积分详情 Mapper
......
package cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreDetailReleation; package cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreDetailReleation;
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.memberUserScoreDetailReleation.MemberUserScoreDetailReleationDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetailReleation.MemberUserScoreDetailReleationDO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.Collection;
/** /**
* 会员积分详情 Mapper * 会员积分详情 Mapper
......
package cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreLog; package cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreLog;
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.memberUserScoreLog.MemberUserScoreLogDO; 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.MemberUserScoreLogBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO; import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
......
...@@ -6,9 +6,9 @@ import cn.hutool.json.JSONUtil; ...@@ -6,9 +6,9 @@ import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.apollo.core.event.export.MemberScoreDetailExpireEvent; import cn.iocoder.yudao.framework.apollo.core.event.export.MemberScoreDetailExpireEvent;
import cn.iocoder.yudao.module.member.api.score.MemberUserScoreApi; import cn.iocoder.yudao.module.member.api.score.MemberUserScoreApi;
import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreOperateReqDTO; import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreOperateReqDTO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreDetail.MemberUserScoreDetailDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetail.MemberUserScoreDetailDO;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
import cn.iocoder.yudao.module.member.service.memberUserScoreDetail.MemberUserScoreDetailService; import cn.iocoder.yudao.module.member.service.scoreDetail.MemberUserScoreDetailService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
......
package cn.iocoder.yudao.module.member.service.level;
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.level.MemberUserLevelConfigDO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelBaseRespVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelReqVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelUpdateVO;
import java.util.List;
/**
* 会员等级 Service 接口
*
* @author 系统管理员
*/
public interface MemberUserLevelConfigService extends IService<MemberUserLevelConfigDO> {
PageResult<MemberUserLevelBaseRespVO> getLevelPage(MemberUserLevelReqVO query);
Boolean delete(List<Long> ids);
Boolean add(MemberUserLevelUpdateVO query);
Boolean updateLevel(MemberUserLevelUpdateVO query);
}
package cn.iocoder.yudao.module.member.service.level;
import cn.hutool.core.bean.BeanUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.mysql.memberUserLevel.MemberUserLevelConfigMapper;
import cn.iocoder.yudao.module.member.vo.memberUserScore.MemberUserScoreBackVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelBaseRespVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelReqVO;
import cn.iocoder.yudao.module.member.vo.userLevel.MemberUserLevelUpdateVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import java.util.List;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.GET_LOCK_FAILED;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.LEVEL_BOUND_RANGE_CONFLICT;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.LEVEL_BOUND_RANGE_ERROR;
/**
* 会员积分 Service 实现类
*
* @author 系统管理员
*/
@Service
@Validated
@Lazy
public class MemberUserLevelConfigServiceImpl extends AbstractService<MemberUserLevelConfigMapper, MemberUserLevelConfigDO> implements MemberUserLevelConfigService {
private final MemberUserLevelConfigMapper memberUserLevelConfigMapper;
public MemberUserLevelConfigServiceImpl(MemberUserLevelConfigMapper memberUserLevelConfigMapper) {
this.memberUserLevelConfigMapper = memberUserLevelConfigMapper;
}
@Override
public PageResult<MemberUserLevelBaseRespVO> getLevelPage(MemberUserLevelReqVO query) {
int start = (query.getPageNo() - 1) * query.getPageSize();
int size = query.getPageSize();
LambdaQueryWrapper<MemberUserLevelConfigDO> wrapper = Wrappers.lambdaQuery();
wrapper.eq(MemberUserLevelConfigDO::getDeleted, 0);
wrapper.last(String.format("limit %s, %s", start, size));
List<MemberUserLevelConfigDO> list = this.list(wrapper);
List<MemberUserLevelBaseRespVO> result = list.stream().map(i -> BeanUtil.copyProperties(i, MemberUserLevelBaseRespVO.class)).collect(Collectors.toList());
Long total = memberUserLevelConfigMapper.selectCount();
return new PageResult<>(result, total, query.getPageSize(), query.getPageNo(), (total + query.getPageSize() - 1) / query.getPageSize());
}
@Override
public Boolean delete(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return true;
}
LambdaUpdateWrapper<MemberUserLevelConfigDO> wrapper = Wrappers.lambdaUpdate();
wrapper.in(MemberUserLevelConfigDO::getId, ids);
wrapper.set(MemberUserLevelConfigDO::getDeleted, 1);
return this.update(wrapper);
}
@Override
public Boolean add(MemberUserLevelUpdateVO query) {
validate(query);
MemberUserLevelConfigDO memberUserLevelConfigDO = BeanUtil.copyProperties(query, MemberUserLevelConfigDO.class);
return this.saveOrUpdate(memberUserLevelConfigDO);
}
private void validate(MemberUserLevelUpdateVO query) {
if (query.getLowerCount() > query.getUpperCount()) {
throw exception(LEVEL_BOUND_RANGE_ERROR);
}
LambdaQueryWrapper<MemberUserLevelConfigDO> wrapper = Wrappers.lambdaQuery();
wrapper.eq(MemberUserLevelConfigDO::getDeleted, 0);
if (query.getId() != null) {
wrapper.ne(MemberUserLevelConfigDO::getId, query.getId());
}
List<MemberUserLevelConfigDO> list = this.list(wrapper);
for (MemberUserLevelConfigDO memberUserLevelConfigDO : list) {
if (query.getLowerCount() >= memberUserLevelConfigDO.getLowerCount() && query.getLowerCount() <= memberUserLevelConfigDO.getUpperCount()) {
throw exception(LEVEL_BOUND_RANGE_CONFLICT);
}
if (query.getUpperCount() >= memberUserLevelConfigDO.getLowerCount() && query.getUpperCount() <= memberUserLevelConfigDO.getUpperCount()) {
throw exception(LEVEL_BOUND_RANGE_CONFLICT);
}
}
}
@Override
public Boolean updateLevel(MemberUserLevelUpdateVO query) {
validate(query);
MemberUserLevelConfigDO memberUserLevelConfigDO = BeanUtil.copyProperties(query, MemberUserLevelConfigDO.class);
return this.saveOrUpdate(memberUserLevelConfigDO);
}
}
package cn.iocoder.yudao.module.member.service.memberUserScore; package cn.iocoder.yudao.module.member.service.score;
import java.util.*; import java.util.*;
import cn.iocoder.yudao.framework.mybatis.core.service.IService; import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreUpdateReqDTO; import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreUpdateReqDTO;
import cn.iocoder.yudao.module.member.vo.memberUserScore.*; import cn.iocoder.yudao.module.member.vo.memberUserScore.*;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO; import cn.iocoder.yudao.module.member.dal.dataobject.score.MemberUserScoreDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
/** /**
......
package cn.iocoder.yudao.module.member.service.memberUserScore; package cn.iocoder.yudao.module.member.service.score;
import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.api.score.dto.MemberUserScoreUpdateReqDTO; import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreUpdateReqDTO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO; import cn.iocoder.yudao.module.member.dal.dataobject.score.MemberUserScoreDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserScore.MemberUserScoreMapper; import cn.iocoder.yudao.module.member.dal.mysql.memberUserScore.MemberUserScoreMapper;
import cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
......
package cn.iocoder.yudao.module.member.service.memberUserScoreDetail; package cn.iocoder.yudao.module.member.service.scoreDetail;
import cn.iocoder.yudao.framework.mybatis.core.service.IService; import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreDetailUpdateReqDto; import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreDetailUpdateReqDto;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreDetail.MemberUserScoreDetailDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetail.MemberUserScoreDetailDO;
import cn.iocoder.yudao.module.member.dto.ScoreDetailChangeDto; import cn.iocoder.yudao.module.member.dto.ScoreDetailChangeDto;
import java.util.List; import java.util.List;
......
package cn.iocoder.yudao.module.member.service.memberUserScoreDetail; package cn.iocoder.yudao.module.member.service.scoreDetail;
import cn.hutool.core.lang.generator.SnowflakeGenerator; import cn.hutool.core.lang.generator.SnowflakeGenerator;
import cn.hutool.json.JSONObject; import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService; import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreDetailUpdateReqDto; import cn.iocoder.yudao.module.member.api.score.dto.MemberUserScoreDetailUpdateReqDto;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreDetail.MemberUserScoreDetailDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetail.MemberUserScoreDetailDO;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreDetailReleation.MemberUserScoreDetailReleationDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetailReleation.MemberUserScoreDetailReleationDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreDetail.MemberUserScoreDetailMapper; import cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreDetail.MemberUserScoreDetailMapper;
import cn.iocoder.yudao.module.member.dto.ScoreDetailChangeDto; import cn.iocoder.yudao.module.member.dto.ScoreDetailChangeDto;
import cn.iocoder.yudao.module.member.enums.MemberScoreStatueEnum; import cn.iocoder.yudao.module.member.enums.MemberScoreStatueEnum;
import cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum;
import cn.iocoder.yudao.module.member.service.memberUserScoreDetailReleation.MemberUserScoreDetailReleationService; import cn.iocoder.yudao.module.member.service.scoreDetailReleation.MemberUserScoreDetailReleationService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
......
package cn.iocoder.yudao.module.member.service.memberUserScoreDetailReleation; package cn.iocoder.yudao.module.member.service.scoreDetailReleation;
import cn.iocoder.yudao.framework.mybatis.core.service.IService; import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreDetailReleation.MemberUserScoreDetailReleationDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetailReleation.MemberUserScoreDetailReleationDO;
import cn.iocoder.yudao.module.member.dto.ScoreDetailChangeDto; import cn.iocoder.yudao.module.member.dto.ScoreDetailChangeDto;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
......
package cn.iocoder.yudao.module.member.service.memberUserScoreDetailReleation; package cn.iocoder.yudao.module.member.service.scoreDetailReleation;
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.memberUserScoreDetailReleation.MemberUserScoreDetailReleationDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreDetailReleation.MemberUserScoreDetailReleationDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreDetailReleation.MemberUserScoreDetailReleationMapper; import cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreDetailReleation.MemberUserScoreDetailReleationMapper;
import cn.iocoder.yudao.module.member.dto.ScoreDetailChangeDto; import cn.iocoder.yudao.module.member.dto.ScoreDetailChangeDto;
import cn.iocoder.yudao.module.member.enums.MemberScoreDetailReleationStatueEnum; import cn.iocoder.yudao.module.member.enums.MemberScoreDetailReleationStatueEnum;
import cn.iocoder.yudao.module.member.enums.ScoreOperateTypeEnum;
import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum; import cn.iocoder.yudao.module.member.enums.ScoreSourceTypeEnum;
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;
......
package cn.iocoder.yudao.module.member.service.memberUserScoreLog; package cn.iocoder.yudao.module.member.service.scoreLog;
import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService; import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.member.dal.dataobject.memberUserScoreLog.MemberUserScoreLogDO; 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.MemberUserScoreLogBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogCreateReq; import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogCreateReq;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO; import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO;
......
package cn.iocoder.yudao.module.member.service.memberUserScoreLog; package cn.iocoder.yudao.module.member.service.scoreLog;
import cn.hutool.core.lang.generator.SnowflakeGenerator; import cn.hutool.core.lang.generator.SnowflakeGenerator;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.memberUserScoreLog.MemberUserScoreLogDO; import cn.iocoder.yudao.module.member.dal.dataobject.scoreLog.MemberUserScoreLogDO;
import cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreLog.MemberUserScoreLogMapper; import cn.iocoder.yudao.module.member.dal.mysql.memberUserScoreLog.MemberUserScoreLogMapper;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO; import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogBackVO;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogCreateReq; import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogCreateReq;
import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO; import cn.iocoder.yudao.module.member.vo.memberUserScoreLog.MemberUserScoreLogQueryVO;
import cn.iocoder.yudao.module.system.service.dict.DictTypeService; import cn.iocoder.yudao.module.system.service.dict.DictTypeService;
import com.alibaba.excel.util.CollectionUtils;
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 javax.annotation.Resource;
import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
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.MEMBER_ID_IS_NULL; import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.MEMBER_ID_IS_NULL;
......
package cn.iocoder.yudao.module.member.vo.userLevel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("管理后台 - 会员等级查询返回 VO")
public class MemberUserLevelBaseRespVO {
@ApiModelProperty(value = "id")
private Long id;
/**
* 名称
*/
@ApiModelProperty(value = "等级名称")
private String name;
/**
* 积分范围 下界
*/
@ApiModelProperty(value = "积分范围 下界")
private Integer lowerCount;
/**
* 积分范围 上界
*/
@ApiModelProperty(value = "积分范围 上界")
private Integer upperCount;
/**
* 图标
*/
@ApiModelProperty(value = "图标")
private String icon;
}
package cn.iocoder.yudao.module.member.vo.userLevel;
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 MemberUserLevelReqVO extends PageParam {
@ApiModelProperty(value = "id")
private Long id;
}
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 MemberUserLevelUpdateVO {
@ApiModelProperty(value = "id")
private Long id;
/**
* 名称
*/
@ApiModelProperty(value = "等级名称")
@NotNull(message = "name is null")
private String name;
/**
* 积分范围 下界
*/
@ApiModelProperty(value = "积分范围 下界")
@NotNull(message = "lowerCount is null")
private Integer lowerCount;
/**
* 积分范围 上界
*/
@ApiModelProperty(value = "积分范围 上界")
@NotNull(message = "upperCount is null")
private Integer upperCount;
/**
* 图标
*/
@ApiModelProperty(value = "图标")
@NotNull(message = "icon is null")
private String icon;
}
<?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.memberUserLevel.MemberUserLevelConfigMapper">
</mapper>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<include refid="scoreCondition"/> <include refid="scoreCondition"/>
</select> </select>
<select id="getByMemberId" <select id="getByMemberId"
resultType="cn.iocoder.yudao.module.member.dal.dataobject.memberUserScore.MemberUserScoreDO"> resultType="cn.iocoder.yudao.module.member.dal.dataobject.score.MemberUserScoreDO">
select * from member_user_score where member_id = #{memberId} and deleted = 0 select * from member_user_score where member_id = #{memberId} and deleted = 0
</select> </select>
......
...@@ -1023,4 +1023,6 @@ dict.unknown.error = Not in dict {0}: {1} ...@@ -1023,4 +1023,6 @@ dict.unknown.error = Not in dict {0}: {1}
express.not.exist = express not exist express.not.exist = express not exist
currency.not.exist = currency not exist currency.not.exist = currency not exist
date.format.error = date format error, for example : 2024-01-01 12:11:11 date.format.error = date format error, for example : 2024-01-01 12:11:11
redeem.cancel.status.error = record status must be redeeming redeem.cancel.status.error = record status must be redeeming
\ No newline at end of file level.bound.range.error = upper count must greater than lower count
level.bound.range.conflict = score range exist conflict
\ No newline at end of file
...@@ -1025,4 +1025,6 @@ dict.unknown.error = \u4E0D\u5728{0}\u5B57\u5178\u4E2D: {1} ...@@ -1025,4 +1025,6 @@ dict.unknown.error = \u4E0D\u5728{0}\u5B57\u5178\u4E2D: {1}
express.not.exist = \u5FEB\u9012\u516C\u53F8\u4E0D\u5B58\u5728 express.not.exist = \u5FEB\u9012\u516C\u53F8\u4E0D\u5B58\u5728
currency.not.exist = \u5E01\u79CD\u4E0D\u5B58\u5728 currency.not.exist = \u5E01\u79CD\u4E0D\u5B58\u5728
date.format.error = \u65E5\u671F\u683C\u5F0F\u4E0D\u6B63\u786E, \u6B63\u786E\u683C\u5F0F\u53C2\u8003: 2024-01-01 12:11:11 date.format.error = \u65E5\u671F\u683C\u5F0F\u4E0D\u6B63\u786E, \u6B63\u786E\u683C\u5F0F\u53C2\u8003: 2024-01-01 12:11:11
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
\ No newline at end of file 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
\ No newline at end of file
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