From c019136f07e4f3aacc1cdbeb62f2475e48c45890 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 27 Dec 2023 20:39:14 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Member=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=A7=AF=E5=88=86=E8=AE=B0=E5=BD=95=E7=9A=84=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../AppBrokerageRecordController.java | 3 ++- .../record/AppBrokerageRecordPageReqVO.java | 9 ++++++++ .../vo/record/AppBrokerageRecordRespVO.java | 6 +++++ .../brokerage/BrokerageRecordConvert.java | 2 -- .../point/AppMemberPointRecordController.java | 9 +++++--- .../vo/AppMemberPointRecordPageReqVO.java | 23 +++++++++++++++++++ .../point/MemberPointRecordConvert.java | 2 -- .../mysql/point/MemberPointRecordMapper.java | 10 ++++++-- .../point/MemberPointRecordService.java | 5 ++-- .../point/MemberPointRecordServiceImpl.java | 5 ++-- 10 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/point/vo/AppMemberPointRecordPageReqVO.java diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageRecordController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageRecordController.java index dd0fe6b20..28666cb43 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageRecordController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/AppBrokerageRecordController.java @@ -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> getBrokerageRecordPage(@Valid AppBrokerageRecordPageReqVO pageReqVO) { PageResult 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") diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/record/AppBrokerageRecordPageReqVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/record/AppBrokerageRecordPageReqVO.java index e2df6dae6..2100c2324 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/record/AppBrokerageRecordPageReqVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/record/AppBrokerageRecordPageReqVO.java @@ -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; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/record/AppBrokerageRecordRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/record/AppBrokerageRecordRespVO.java index 221d19758..993006e34 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/record/AppBrokerageRecordRespVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/brokerage/vo/record/AppBrokerageRecordRespVO.java @@ -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; diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/BrokerageRecordConvert.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/BrokerageRecordConvert.java index e6c0e4f8c..0f1fe6178 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/BrokerageRecordConvert.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/convert/brokerage/BrokerageRecordConvert.java @@ -70,8 +70,6 @@ public interface BrokerageRecordConvert { BrokerageRecordPageReqVO convert(AppBrokerageRecordPageReqVO pageReqVO, Long userId); - PageResult convertPage02(PageResult pageResult); - default PageResult convertPage03(PageResult pageResult, Map userMap) { for (AppBrokerageUserRankByPriceRespVO vo : pageResult.getList()) { copyTo(userMap.get(vo.getId()), vo); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/point/AppMemberPointRecordController.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/point/AppMemberPointRecordController.java index d57d195c0..f6d183d5c 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/point/AppMemberPointRecordController.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/point/AppMemberPointRecordController.java @@ -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> getPointRecordPage(@Valid PageParam pageVO) { - PageResult pageResult = pointRecordService.getPointRecordPage(getLoginUserId(), pageVO); - return success(MemberPointRecordConvert.INSTANCE.convertPage02(pageResult)); + public CommonResult> getPointRecordPage( + @Valid AppMemberPointRecordPageReqVO pageReqVO) { + PageResult pageResult = pointRecordService.getPointRecordPage(getLoginUserId(), pageReqVO); + return success(BeanUtils.toBean(pageResult, AppMemberPointRecordRespVO.class)); } } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/point/vo/AppMemberPointRecordPageReqVO.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/point/vo/AppMemberPointRecordPageReqVO.java new file mode 100644 index 000000000..5e51ce658 --- /dev/null +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/controller/app/point/vo/AppMemberPointRecordPageReqVO.java @@ -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; + +} diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java index 018670c51..896ae350a 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/convert/point/MemberPointRecordConvert.java @@ -34,6 +34,4 @@ public interface MemberPointRecordConvert { } PageResult convertPage(PageResult pageResult); - PageResult convertPage02(PageResult pageResult); - } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java index 5c3370929..d0e2452c7 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/dal/mysql/point/MemberPointRecordMapper.java @@ -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 selectPage(Long userId, PageParam pageVO) { - return selectPage(pageVO, new LambdaQueryWrapperX() + default PageResult selectPage(Long userId, AppMemberPointRecordPageReqVO pageReqVO) { + return selectPage(pageReqVO, new LambdaQueryWrapperX() .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)); } diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java index 74e91880f..26d18a852 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordService.java @@ -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 getPointRecordPage(Long userId, PageParam pageVO); + PageResult getPointRecordPage(Long userId, AppMemberPointRecordPageReqVO pageReqVO); /** * 创建用户积分记录 diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java index 8a5491431..d4ce47c67 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/point/MemberPointRecordServiceImpl.java @@ -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 getPointRecordPage(Long userId, PageParam pageVO) { - return memberPointRecordMapper.selectPage(userId, pageVO); + public PageResult getPointRecordPage(Long userId, AppMemberPointRecordPageReqVO pageReqVO) { + return memberPointRecordMapper.selectPage(userId, pageReqVO); } @Override