Member:增加积分记录的时间筛选

This commit is contained in:
YunaiV 2023-12-27 20:39:14 +08:00
parent 2f5afdb5c9
commit c019136f07
10 changed files with 60 additions and 14 deletions

View File

@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.trade.controller.app.brokerage;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.record.AppBrokerageProductPriceRespVO;
import cn.iocoder.yudao.module.trade.controller.app.brokerage.vo.record.AppBrokerageRecordPageReqVO;
@ -39,7 +40,7 @@ public class AppBrokerageRecordController {
public CommonResult<PageResult<AppBrokerageRecordRespVO>> getBrokerageRecordPage(@Valid AppBrokerageRecordPageReqVO pageReqVO) {
PageResult<BrokerageRecordDO> pageResult = brokerageRecordService.getBrokerageRecordPage(
BrokerageRecordConvert.INSTANCE.convert(pageReqVO, getLoginUserId()));
return success(BrokerageRecordConvert.INSTANCE.convertPage02(pageResult));
return success(BeanUtils.toBean(pageResult, AppBrokerageRecordRespVO.class));
}
@GetMapping("/get-product-brokerage-price")

View File

@ -6,11 +6,20 @@ import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordBizTypeEnum;
import cn.iocoder.yudao.module.trade.enums.brokerage.BrokerageRecordStatusEnum;
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 = "应用 App - 分销记录分页 Request VO")
@Data
public class AppBrokerageRecordPageReqVO extends PageParam {
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "业务类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@InEnum(value = BrokerageRecordBizTypeEnum.class, message = "业务类型必须是 {value}")
private Integer bizType;

View File

@ -12,12 +12,18 @@ public class AppBrokerageRecordRespVO {
@Schema(description = "记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
private Long id;
@Schema(description = "业务编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
private String bizId;
@Schema(description = "分销标题", requiredMode = Schema.RequiredMode.REQUIRED, example = "用户下单")
private String title;
@Schema(description = "分销金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
private Integer price;
@Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
private Integer status;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
private LocalDateTime createTime;

View File

@ -70,8 +70,6 @@ public interface BrokerageRecordConvert {
BrokerageRecordPageReqVO convert(AppBrokerageRecordPageReqVO pageReqVO, Long userId);
PageResult<AppBrokerageRecordRespVO> convertPage02(PageResult<BrokerageRecordDO> pageResult);
default PageResult<AppBrokerageUserRankByPriceRespVO> convertPage03(PageResult<AppBrokerageUserRankByPriceRespVO> pageResult, Map<Long, MemberUserRespDTO> userMap) {
for (AppBrokerageUserRankByPriceRespVO vo : pageResult.getList()) {
copyTo(userMap.get(vo.getId()), vo);

View File

@ -3,7 +3,9 @@ package cn.iocoder.yudao.module.member.controller.app.point;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordRespVO;
import cn.iocoder.yudao.module.member.convert.point.MemberPointRecordConvert;
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
@ -33,9 +35,10 @@ public class AppMemberPointRecordController {
@GetMapping("/page")
@Operation(summary = "获得用户积分记录分页")
@PreAuthenticated
public CommonResult<PageResult<AppMemberPointRecordRespVO>> getPointRecordPage(@Valid PageParam pageVO) {
PageResult<MemberPointRecordDO> pageResult = pointRecordService.getPointRecordPage(getLoginUserId(), pageVO);
return success(MemberPointRecordConvert.INSTANCE.convertPage02(pageResult));
public CommonResult<PageResult<AppMemberPointRecordRespVO>> getPointRecordPage(
@Valid AppMemberPointRecordPageReqVO pageReqVO) {
PageResult<MemberPointRecordDO> pageResult = pointRecordService.getPointRecordPage(getLoginUserId(), pageReqVO);
return success(BeanUtils.toBean(pageResult, AppMemberPointRecordRespVO.class));
}
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.member.controller.app.point.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
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 = "用户 App - 用户积分记录分页 Request VO")
@Data
public class AppMemberPointRecordPageReqVO extends PageParam {
@Schema(description = "是否增加积分", example = "true")
private Boolean addStatus; // true - 增加false - 减少null - 不筛选
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@Schema(description = "创建时间")
private LocalDateTime[] createTime;
}

View File

@ -34,6 +34,4 @@ public interface MemberPointRecordConvert {
}
PageResult<MemberPointRecordRespVO> convertPage(PageResult<MemberPointRecordDO> pageResult);
PageResult<AppMemberPointRecordRespVO> convertPage02(PageResult<MemberPointRecordDO> pageResult);
}

View File

@ -5,6 +5,7 @@ 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.MemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
import org.apache.ibatis.annotations.Mapper;
@ -27,9 +28,14 @@ public interface MemberPointRecordMapper extends BaseMapperX<MemberPointRecordDO
.orderByDesc(MemberPointRecordDO::getId));
}
default PageResult<MemberPointRecordDO> selectPage(Long userId, PageParam pageVO) {
return selectPage(pageVO, new LambdaQueryWrapperX<MemberPointRecordDO>()
default PageResult<MemberPointRecordDO> selectPage(Long userId, AppMemberPointRecordPageReqVO pageReqVO) {
return selectPage(pageReqVO, new LambdaQueryWrapperX<MemberPointRecordDO>()
.eq(MemberPointRecordDO::getUserId, userId)
.betweenIfPresent(MemberPointRecordDO::getCreateTime, pageReqVO.getCreateTime())
.gt(Boolean.TRUE.equals(pageReqVO.getAddStatus()),
MemberPointRecordDO::getPoint, 0)
.lt(Boolean.FALSE.equals(pageReqVO.getAddStatus()),
MemberPointRecordDO::getPoint, 0)
.orderByDesc(MemberPointRecordDO::getId));
}

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.member.service.point;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
import cn.iocoder.yudao.module.member.enums.point.MemberPointBizTypeEnum;
@ -25,10 +26,10 @@ public interface MemberPointRecordService {
* 会员获得积分记录分页
*
* @param userId 用户编号
* @param pageVO 分页查询
* @param pageReqVO 分页查询
* @return 签到记录分页
*/
PageResult<MemberPointRecordDO> getPointRecordPage(Long userId, PageParam pageVO);
PageResult<MemberPointRecordDO> getPointRecordPage(Long userId, AppMemberPointRecordPageReqVO pageReqVO);
/**
* 创建用户积分记录

View File

@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.member.controller.admin.point.vo.recrod.MemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.controller.app.point.vo.AppMemberPointRecordPageReqVO;
import cn.iocoder.yudao.module.member.dal.dataobject.point.MemberPointRecordDO;
import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO;
import cn.iocoder.yudao.module.member.dal.mysql.point.MemberPointRecordMapper;
@ -59,8 +60,8 @@ public class MemberPointRecordServiceImpl implements MemberPointRecordService {
}
@Override
public PageResult<MemberPointRecordDO> getPointRecordPage(Long userId, PageParam pageVO) {
return memberPointRecordMapper.selectPage(userId, pageVO);
public PageResult<MemberPointRecordDO> getPointRecordPage(Long userId, AppMemberPointRecordPageReqVO pageReqVO) {
return memberPointRecordMapper.selectPage(userId, pageReqVO);
}
@Override