mall + member:

1、review 积分
This commit is contained in:
YunaiV 2023-07-02 23:19:13 +08:00
parent 2f42964a96
commit 040a66965c
26 changed files with 62 additions and 437 deletions

View File

@ -24,10 +24,8 @@ public interface ErrorCodeConstants {
ErrorCode ADDRESS_NOT_EXISTS = new ErrorCode(1004004000, "用户收件地址不存在");
//========== 用户积分 1004005000 ==========
ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1004005001, "积分设置不存在");
ErrorCode CONFIG_EXISTS = new ErrorCode(1004005002, "积分设置已存在,只允配置一条记录");
// TODO @xiaqing错误码要分段例如说这里积分配置积分记录签到配置签到记录分成 4
ErrorCode SIGN_IN_CONFIG_NOT_EXISTS = new ErrorCode(1004005003, "签到天数规则不存在");
ErrorCode SIGN_IN_CONFIG_EXISTS = new ErrorCode(1004005004, "签到天数规则已存在");

View File

@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.member.controller.admin.point;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.*;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO;
import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
import cn.iocoder.yudao.module.member.service.point.MemberPointRecordService;
@ -16,14 +16,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 用户积分记录")
@RestController
@ -34,6 +29,7 @@ public class MemberPointRecordController {
@Resource
private MemberPointRecordService recordService;
// TODO @xiaqing积分应该没有更新操作呀可以删除哈
@PutMapping("/update")
@Operation(summary = "更新用户积分记录")
@PreAuthorize("@ss.hasPermission('point:record:update')")
@ -51,15 +47,6 @@ public class MemberPointRecordController {
return success(MemberPointRecordConvert.INSTANCE.convert(record));
}
@GetMapping("/list")
@Operation(summary = "获得用户积分记录列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('point:record:query')")
public CommonResult<List<MemberPointRecordRespVO>> getRecordList(@RequestParam("ids") Collection<Long> ids) {
List<MemberPointRecordDO> list = recordService.getRecordList(ids);
return success(MemberPointRecordConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得用户积分记录分页")
@PreAuthorize("@ss.hasPermission('point:record:query')")
@ -68,16 +55,4 @@ public class MemberPointRecordController {
return success(MemberPointRecordConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出用户积分记录 Excel")
@PreAuthorize("@ss.hasPermission('point:record:export')")
@OperateLog(type = EXPORT)
public void exportRecordExcel(@Valid MemberPointRecordExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<MemberPointRecordDO> list = recordService.getRecordList(exportReqVO);
// 导出 Excel
List<MemberPointRecordExcelVO> datas = MemberPointRecordConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "用户积分记录.xls", "数据", MemberPointRecordExcelVO.class, datas);
}
}

View File

@ -1,61 +0,0 @@
package cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod;
import lombok.*;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
/**
* 用户积分记录 Excel VO
*
* @author QingX
*/
@Data
public class MemberPointRecordExcelVO {
@ExcelProperty("自增主键")
private Long id;
@ExcelProperty("业务编码")
private String bizId;
@ExcelProperty(value = "业务类型", converter = DictConvert.class)
@DictFormat("biz_type") // TODO 代码优化建议设置到对应的 XXXDictTypeConstants 枚举类中
private String bizType;
@ExcelProperty("1增加 0扣减")
private String type;
@ExcelProperty("积分标题")
private String title;
@ExcelProperty("积分描述")
private String description;
@ExcelProperty("积分")
private Integer point;
@ExcelProperty("变动后的积分")
private Integer totalPoint;
@ExcelProperty(value = "状态1-订单创建2-冻结期3-完成4-失效(订单退款) ", converter = DictConvert.class)
@DictFormat("point_status") // TODO 代码优化建议设置到对应的 XXXDictTypeConstants 枚举类中
private Integer status;
@ExcelProperty("用户id")
private Integer userId;
@ExcelProperty("冻结时间")
private LocalDateTime freezingTime;
@ExcelProperty("解冻时间")
private LocalDateTime thawingTime;
@ExcelProperty("发生时间")
private LocalDateTime createTime;
}

View File

@ -2,9 +2,10 @@ package cn.iocoder.yudao.module.member.controller.admin.signin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.*;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigRespVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO;
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInConfigConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
import cn.iocoder.yudao.module.member.service.signin.MemberSignInConfigService;
@ -16,14 +17,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 积分签到规则")
@RestController
@ -67,15 +63,6 @@ public class MemberSignInConfigController {
return success(MemberSignInConfigConvert.INSTANCE.convert(signInConfig));
}
@GetMapping("/list")
@Operation(summary = "获得积分签到规则列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
public CommonResult<List<MemberSignInConfigRespVO>> getSignInConfigList(@RequestParam("ids") Collection<Integer> ids) {
List<MemberSignInConfigDO> list = memberSignInConfigService.getSignInConfigList(ids);
return success(MemberSignInConfigConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得积分签到规则分页")
@PreAuthorize("@ss.hasPermission('point:sign-in-config:query')")
@ -84,16 +71,4 @@ public class MemberSignInConfigController {
return success(MemberSignInConfigConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出积分签到规则 Excel")
@PreAuthorize("@ss.hasPermission('point:sign-in-config:export')")
@OperateLog(type = EXPORT)
public void exportSignInConfigExcel(@Valid MemberSignInConfigExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<MemberSignInConfigDO> list = memberSignInConfigService.getSignInConfigList(exportReqVO);
// 导出 Excel
List<MemberSignInConfigExcelVO> datas = MemberSignInConfigConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "积分签到规则.xls", "数据", MemberSignInConfigExcelVO.class, datas);
}
}

View File

@ -2,9 +2,8 @@ package cn.iocoder.yudao.module.member.controller.admin.signin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.*;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordRespVO;
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
import cn.iocoder.yudao.module.member.service.signin.MemberSignInRecordService;
@ -16,14 +15,9 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 用户签到积分")
@RestController
@ -34,6 +28,7 @@ public class MemberSignInRecordController {
@Resource
private MemberSignInRecordService memberSignInRecordService;
// TODO @xiaqing签到是不是不用删除
@DeleteMapping("/delete")
@Operation(summary = "删除用户签到积分")
@Parameter(name = "id", description = "编号", required = true)
@ -52,15 +47,6 @@ public class MemberSignInRecordController {
return success(MemberSignInRecordConvert.INSTANCE.convert(signInRecord));
}
@GetMapping("/list")
@Operation(summary = "获得用户签到积分列表")
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048")
@PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
public CommonResult<List<MemberSignInRecordRespVO>> getSignInRecordList(@RequestParam("ids") Collection<Long> ids) {
List<MemberSignInRecordDO> list = memberSignInRecordService.getSignInRecordList(ids);
return success(MemberSignInRecordConvert.INSTANCE.convertList(list));
}
@GetMapping("/page")
@Operation(summary = "获得用户签到积分分页")
@PreAuthorize("@ss.hasPermission('point:sign-in-record:query')")
@ -68,17 +54,4 @@ public class MemberSignInRecordController {
PageResult<MemberSignInRecordDO> pageResult = memberSignInRecordService.getSignInRecordPage(pageVO);
return success(MemberSignInRecordConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/export-excel")
@Operation(summary = "导出用户签到积分 Excel")
@PreAuthorize("@ss.hasPermission('point:sign-in-record:export')")
@OperateLog(type = EXPORT)
public void exportSignInRecordExcel(@Valid MemberSignInRecordExportReqVO exportReqVO,
HttpServletResponse response) throws IOException {
List<MemberSignInRecordDO> list = memberSignInRecordService.getSignInRecordList(exportReqVO);
// 导出 Excel
List<MemberSignInRecordExcelVO> datas = MemberSignInRecordConvert.INSTANCE.convertList02(list);
ExcelUtils.write(response, "用户签到积分.xls", "数据", MemberSignInRecordExcelVO.class, datas);
}
}

View File

@ -10,7 +10,7 @@ import lombok.*;
@Data
public class MemberSignInConfigBaseVO {
@Schema(description = "签到第x天", example = "7")
@Schema(description = "签到第 x ", example = "7")
private Integer day;
@Schema(description = "签到天数对应分数", example = "10")

View File

@ -1,26 +0,0 @@
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
import lombok.*;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.ExcelProperty;
/**
* 积分签到规则 Excel VO
*
* @author QingX
*/
@Data
public class MemberSignInConfigExcelVO {
@ExcelProperty("签到第x天")
private Integer day;
@ExcelProperty("签到天数对应分数")
private Integer point;
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}

View File

@ -1,13 +0,0 @@
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
import lombok.*;
import io.swagger.v3.oas.annotations.media.Schema;
@Schema(description = "管理后台 - 积分签到规则 Excel 导出 Request VO参数和 SignInConfigPageReqVO 是一致的")
@Data
public class MemberSignInConfigExportReqVO {
@Schema(description = "签到第x天", example = "7")
private Integer day;
}

View File

@ -1,31 +0,0 @@
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 用户签到积分 Excel VO
*
* @author 芋道源码
*/
@Data
public class MemberSignInRecordExcelVO {
@ExcelProperty("签到自增id")
private Long id;
@ExcelProperty("签到用户")
private Integer userId;
@ExcelProperty("第几天签到")
private Integer day;
@ExcelProperty("签到的分数")
private Integer point;
@ExcelProperty("签到时间")
private LocalDateTime createTime;
}

View File

@ -1,25 +0,0 @@
package cn.iocoder.yudao.module.member.controller.admin.signin.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 用户签到积分 Excel 导出 Request VO参数和 SignInRecordPageReqVO 是一致的")
@Data
public class MemberSignInRecordExportReqVO {
@Schema(description = "签到用户", example = "6507")
private Integer userId;
@Schema(description = "第几天签到")
private Integer day;
@Schema(description = "签到时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
}

View File

@ -1,11 +1,7 @@
package cn.iocoder.yudao.module.member.convert.point;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordExcelVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordRespVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
@ -28,10 +24,6 @@ public interface MemberPointRecordConvert {
MemberPointRecordRespVO convert(MemberPointRecordDO bean);
List<MemberPointRecordRespVO> convertList(List<MemberPointRecordDO> list);
PageResult<MemberPointRecordRespVO> convertPage(PageResult<MemberPointRecordDO> page);
List<MemberPointRecordExcelVO> convertList02(List<MemberPointRecordDO> list);
}

View File

@ -1,13 +1,14 @@
package cn.iocoder.yudao.module.member.convert.signin;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigRespVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.*;
import java.util.List;
/**
* 积分签到规则 Convert
@ -29,6 +30,4 @@ public interface MemberSignInConfigConvert {
PageResult<MemberSignInConfigRespVO> convertPage(PageResult<MemberSignInConfigDO> page);
List<MemberSignInConfigExcelVO> convertList02(List<MemberSignInConfigDO> list);
}

View File

@ -1,11 +1,7 @@
package cn.iocoder.yudao.module.member.convert.signin;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordExcelVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordRespVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordUpdateReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
@ -28,10 +24,6 @@ public interface MemberSignInRecordConvert {
MemberSignInRecordRespVO convert(MemberSignInRecordDO bean);
List<MemberSignInRecordRespVO> convertList(List<MemberSignInRecordDO> list);
PageResult<MemberSignInRecordRespVO> convertPage(PageResult<MemberSignInRecordDO> page);
List<MemberSignInRecordExcelVO> convertList02(List<MemberSignInRecordDO> list);
}

View File

@ -35,12 +35,13 @@ public class MemberPointRecordDO extends BaseDO {
/**
* 业务类型
*
* 枚举 {@link TODO biz_type 对应的类}
* 枚举 {@link TODO biz_type 对应枚举然后改成 int 类型哈}
*/
private String bizType;
/**
* 1增加 0扣减
*/
// TODO @xiaqing要不把 type 合并到 point 增加 point 是正数减少 point 是负数
private String type;
/**
* 积分标题
@ -60,7 +61,6 @@ public class MemberPointRecordDO extends BaseDO {
private Integer totalPoint;
/**
* 状态1-订单创建2-冻结期3-完成4-失效订单退款
*
* 枚举 {@link TODO point_status 对应的类}
*/

View File

@ -3,13 +3,10 @@ package cn.iocoder.yudao.module.member.dal.mysql.point;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 用户积分记录 Mapper
*
@ -28,14 +25,4 @@ public interface MemberPointRecordMapper extends BaseMapperX<MemberPointRecordDO
.orderByDesc(MemberPointRecordDO::getId));
}
default List<MemberPointRecordDO> selectList(MemberPointRecordExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<MemberPointRecordDO>()
.eqIfPresent(MemberPointRecordDO::getBizId, reqVO.getBizId())
.eqIfPresent(MemberPointRecordDO::getBizType, reqVO.getBizType())
.eqIfPresent(MemberPointRecordDO::getType, reqVO.getType())
.eqIfPresent(MemberPointRecordDO::getTitle, reqVO.getTitle())
.eqIfPresent(MemberPointRecordDO::getStatus, reqVO.getStatus())
.orderByDesc(MemberPointRecordDO::getId));
}
}

View File

@ -3,14 +3,11 @@ package cn.iocoder.yudao.module.member.dal.mysql.signin;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 积分签到规则 Mapper
*
@ -25,12 +22,6 @@ public interface MemberSignInConfigMapper extends BaseMapperX<MemberSignInConfig
.orderByAsc(MemberSignInConfigDO::getDay));
}
default List<MemberSignInConfigDO> selectList(MemberSignInConfigExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<MemberSignInConfigDO>()
.eqIfPresent(MemberSignInConfigDO::getDay, reqVO.getDay())
.orderByDesc(MemberSignInConfigDO::getId));
}
//
default long selectSameDayNotSelf(MemberSignInConfigUpdateReqVO reqVO){
return selectCount(new LambdaQueryWrapperX <MemberSignInConfigDO>()

View File

@ -3,13 +3,10 @@ package cn.iocoder.yudao.module.member.dal.mysql.signin;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 用户签到积分 Mapper
*
@ -26,12 +23,4 @@ public interface MemberSignInRecordMapper extends BaseMapperX<MemberSignInRecord
.orderByDesc(MemberSignInRecordDO::getId));
}
default List<MemberSignInRecordDO> selectList(MemberSignInRecordExportReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<MemberSignInRecordDO>()
.eqIfPresent(MemberSignInRecordDO::getUserId, reqVO.getUserId())
.eqIfPresent(MemberSignInRecordDO::getDay, reqVO.getDay())
.betweenIfPresent(MemberSignInRecordDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(MemberSignInRecordDO::getId));
}
}

View File

@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.member.service.point;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.config.MemberPointConfigSaveReqVO;
import cn.iocoder.yudao.module.member.convert.point.MemberPointConfigConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointConfigDO;
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
import cn.iocoder.yudao.module.member.dal.mysql.point.MemberPointConfigMapper;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
@ -25,6 +24,7 @@ public class MemberPointConfigServiceImpl implements MemberPointConfigService {
@Override
public void saveConfig(MemberPointConfigSaveReqVO saveReqVO) {
// TODO @xiaqing直接 getConfig() 查询如果不存在则插入存在则进行更新
long total = pointConfigMapper.selectCount();
MemberPointConfigDO pointConfigDO = MemberPointConfigConvert.INSTANCE.convert(saveReqVO);
//大于0存在记录则更新否则插入
@ -38,6 +38,8 @@ public class MemberPointConfigServiceImpl implements MemberPointConfigService {
@Override
public MemberPointConfigDO getConfig() {
List <MemberPointConfigDO> list = pointConfigMapper.selectList();
// TODO @xiaqing可以使用 CollUtil.getFirst()
return list == null ? null : list.get(0);
}
}

View File

@ -1,15 +1,11 @@
package cn.iocoder.yudao.module.member.service.point;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
import javax.validation.Valid;
import java.util.Collection;
import java.util.List;
/**
* 用户积分记录 Service 接口
@ -17,7 +13,7 @@ import java.util.List;
* @author QingX
*/
public interface MemberPointRecordService {
// TODO @xiaqing方法和方法之间是空一行哈
/**
* 更新用户积分记录
@ -27,7 +23,6 @@ public interface MemberPointRecordService {
void updateRecord(@Valid MemberPointRecordUpdateReqVO updateReqVO);
/**
* 获得用户积分记录
*
@ -36,14 +31,6 @@ public interface MemberPointRecordService {
*/
MemberPointRecordDO getRecord(Long id);
/**
* 获得用户积分记录列表
*
* @param ids 编号
* @return 用户积分记录列表
*/
List<MemberPointRecordDO> getRecordList(Collection<Long> ids);
/**
* 获得用户积分记录分页
*
@ -52,12 +39,4 @@ public interface MemberPointRecordService {
*/
PageResult<MemberPointRecordDO> getRecordPage(MemberPointRecordPageReqVO pageReqVO);
/**
* 获得用户积分记录列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 用户积分记录列表
*/
List<MemberPointRecordDO> getRecordList(MemberPointRecordExportReqVO exportReqVO);
}

View File

@ -1,8 +1,6 @@
package cn.iocoder.yudao.module.member.service.point;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordUpdateReqVO;
import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert;
@ -40,7 +38,6 @@ public class MemberPointRecordServiceImpl implements MemberPointRecordService {
recordMapper.updateById(updateObj);
}
private void validateRecordExists(Long id) {
if (recordMapper.selectById(id) == null) {
throw exception(ErrorCodeConstants.RECORD_NOT_EXISTS);
@ -52,19 +49,9 @@ public class MemberPointRecordServiceImpl implements MemberPointRecordService {
return recordMapper.selectById(id);
}
@Override
public List<MemberPointRecordDO> getRecordList(Collection<Long> ids) {
return recordMapper.selectBatchIds(ids);
}
@Override
public PageResult<MemberPointRecordDO> getRecordPage(MemberPointRecordPageReqVO pageReqVO) {
return recordMapper.selectPage(pageReqVO);
}
@Override
public List<MemberPointRecordDO> getRecordList(MemberPointRecordExportReqVO exportReqVO) {
return recordMapper.selectList(exportReqVO);
}
}

View File

@ -1,14 +1,12 @@
package cn.iocoder.yudao.module.member.service.signin;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigExportReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import javax.validation.Valid;
/**
* 积分签到规则 Service 接口
@ -47,14 +45,6 @@ public interface MemberSignInConfigService {
*/
MemberSignInConfigDO getSignInConfig(Integer id);
/**
* 获得积分签到规则列表
*
* @param ids 编号
* @return 积分签到规则列表
*/
List<MemberSignInConfigDO> getSignInConfigList(Collection<Integer> ids);
/**
* 获得积分签到规则分页
*
@ -63,12 +53,4 @@ public interface MemberSignInConfigService {
*/
PageResult<MemberSignInConfigDO> getSignInConfigPage(MemberSignInConfigPageReqVO pageReqVO);
/**
* 获得积分签到规则列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 积分签到规则列表
*/
List<MemberSignInConfigDO> getSignInConfigList(MemberSignInConfigExportReqVO exportReqVO);
}

View File

@ -1,20 +1,20 @@
package cn.iocoder.yudao.module.member.service.signin;
import cn.iocoder.yudao.module.member.service.signin.MemberSignInConfigService;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInConfigUpdateReqVO;
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInConfigConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInConfigMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.*;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInConfigConvert;
import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInConfigMapper;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.SIGN_IN_CONFIG_EXISTS;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.SIGN_IN_CONFIG_NOT_EXISTS;
/**
* 积分签到规则 Service 实现类
@ -28,17 +28,19 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService
@Resource
private MemberSignInConfigMapper memberSignInConfigMapper;
// TODO @xiaqing这种写的逻辑最好按照 校验 - 更新这样的顺序写类似这里37 要放到 34 前面updateSignInConfig 也是一样的思路
@Override
public Integer createSignInConfig(MemberSignInConfigCreateReqVO createReqVO) {
// 插入
MemberSignInConfigDO signInConfig = MemberSignInConfigConvert.INSTANCE.convert(createReqVO);
//判断是否重复插入签到天数
// 判断是否重复插入签到天数
validateSignInConfigExistsDay(signInConfig.getDay());
memberSignInConfigMapper.insert(signInConfig);
// 返回
return signInConfig.getId();
}
// TODO @xiaqing这个逻辑的空行要注意52 53 是没必要的空行 49 50 之间有个空行会好点可以区分出是 校验 - 更新这样的逻辑间隔
@Override
public void updateSignInConfig(MemberSignInConfigUpdateReqVO updateReqVO) {
// 校验存在
@ -65,6 +67,8 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService
throw exception(SIGN_IN_CONFIG_NOT_EXISTS);
}
}
// TODO @xiaqing这个唯一判断也可以参考下别的模块哈
//根据签到天数判断是否存在一个相同的天数
private void validateSignInConfigExistsDay(Integer day) {
if (memberSignInConfigMapper.selectCount(MemberSignInConfigDO::getDay,day)>0) {
@ -72,32 +76,22 @@ public class MemberSignInConfigServiceImpl implements MemberSignInConfigService
}
}
//更新天数时判断是否有重复的天数需要去除自己
// TODO @xiaqing参考下别的模块判断唯一排除自己怎么写的哈
// 更新天数时判断是否有重复的天数需要去除自己
private void validateSignInConfigSameDayNotSelf(MemberSignInConfigUpdateReqVO reqVO) {
if (memberSignInConfigMapper.selectSameDayNotSelf(reqVO)>0) {
throw exception(SIGN_IN_CONFIG_EXISTS);
}
}
@Override
public MemberSignInConfigDO getSignInConfig(Integer id) {
return memberSignInConfigMapper.selectById(id);
}
@Override
public List<MemberSignInConfigDO> getSignInConfigList(Collection<Integer> ids) {
return memberSignInConfigMapper.selectBatchIds(ids);
}
@Override
public PageResult<MemberSignInConfigDO> getSignInConfigPage(MemberSignInConfigPageReqVO pageReqVO) {
return memberSignInConfigMapper.selectPage(pageReqVO);
}
@Override
public List<MemberSignInConfigDO> getSignInConfigList(MemberSignInConfigExportReqVO exportReqVO) {
return memberSignInConfigMapper.selectList(exportReqVO);
}
}

View File

@ -1,10 +1,8 @@
package cn.iocoder.yudao.module.member.service.signin;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.*;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
/**
* 用户签到积分 Service 接口
@ -13,8 +11,6 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
*/
public interface MemberSignInRecordService {
/**
* 删除用户签到积分
*
@ -30,14 +26,6 @@ public interface MemberSignInRecordService {
*/
MemberSignInRecordDO getSignInRecord(Long id);
/**
* 获得用户签到积分列表
*
* @param ids 编号
* @return 用户签到积分列表
*/
List<MemberSignInRecordDO> getSignInRecordList(Collection<Long> ids);
/**
* 获得用户签到积分分页
*
@ -46,12 +34,4 @@ public interface MemberSignInRecordService {
*/
PageResult<MemberSignInRecordDO> getSignInRecordPage(MemberSignInRecordPageReqVO pageReqVO);
/**
* 获得用户签到积分列表, 用于 Excel 导出
*
* @param exportReqVO 查询条件
* @return 用户签到积分列表
*/
List<MemberSignInRecordDO> getSignInRecordList(MemberSignInRecordExportReqVO exportReqVO);
}

View File

@ -1,22 +1,16 @@
package cn.iocoder.yudao.module.member.service.signin;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordCreateReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordExportReqVO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.MemberSignInRecordUpdateReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInRecordMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
import cn.iocoder.yudao.module.member.dal.mysql.signin.MemberSignInRecordMapper;
import javax.annotation.Resource;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.member.enums.ErrorCodeConstants.SIGN_IN_RECORD_NOT_EXISTS;
/**
* 用户签到积分 Service 实现类
@ -49,19 +43,9 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
return memberSignInRecordMapper.selectById(id);
}
@Override
public List<MemberSignInRecordDO> getSignInRecordList(Collection<Long> ids) {
return memberSignInRecordMapper.selectBatchIds(ids);
}
@Override
public PageResult<MemberSignInRecordDO> getSignInRecordPage(MemberSignInRecordPageReqVO pageReqVO) {
return memberSignInRecordMapper.selectPage(pageReqVO);
}
@Override
public List<MemberSignInRecordDO> getSignInRecordList(MemberSignInRecordExportReqVO exportReqVO) {
return memberSignInRecordMapper.selectList(exportReqVO);
}
}

View File

@ -6,8 +6,9 @@ import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
// TODO @jason修改 MemberWalletDO PayWalletDO
/**
* 支付-会员钱包 DO
* 支付 - 会员钱包 DO
*
* @author jason
*/
@ -22,10 +23,12 @@ public class MemberWalletDO extends BaseDO {
@TableId
private Long id;
// TODO @jaosn增加 userType 字段
/**
* 用户 id
*
* 关联 MemberUserDO id 编号
* 关联 AdminUserDO id 编号
*/
private Long userId;

View File

@ -44,31 +44,31 @@ spring:
primary: master
datasource:
master:
name: mall
url: jdbc:mysql://10.211.55.5:3308/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
name: ruoyi-vue-pro
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例
username: root
password: 1qaz!QAZ
password: 123456
# username: sa
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
slave: # 模拟从库,可根据自己需要修改
name: mall
url: jdbc:mysql://10.211.55.5:3308/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
name: ruoyi-vue-pro
url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例
# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例
# url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例
username: root
password: 1qaz!QAZ
password: 123456
# username: sa
# password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
redis:
host: 10.211.55.5 # 地址
host: 127.0.0.1 # 地址
port: 6379 # 端口
database: 0 # 数据库索引
# password: dev # 密码,建议生产环境开启
@ -159,7 +159,6 @@ logging:
cn.iocoder.yudao.module.member.dal.mysql: debug
cn.iocoder.yudao.module.trade.dal.mysql: debug
cn.iocoder.yudao.module.promotion.dal.mysql: debug
cn.iocoder.yudao.module.point.dal.mysql: debug
debug: false