From fdaf2c16b4decd5909e5c11e162834ae0fe5f148 Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Fri, 16 Jan 2026 15:59:21 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=8A=BD=E5=A5=96=E8=83=8C?= =?UTF-8?q?=E5=8C=85=E6=B5=81=E6=B0=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/activity/LotteryBackpackLogCO.java | 28 +++++++++++++ .../LotteryActivityRestController.java | 27 ++++++------ .../activity/LotteryBackpackLogQryExe.java | 29 +++++++++++++ .../app/command/activity/LotteryDrawExe.java | 7 +++- .../command/activity/LotteryMultiDrawExe.java | 8 +++- .../LotteryActivityRestServiceImpl.java | 22 ++++------ .../activity/LotteryBackpackLogQryCmd.java | 31 ++++++++++++++ .../activity/LotteryActivityRestService.java | 16 ++++---- .../{ => activity}/LotteryBackpackLogDAO.java | 2 +- .../LotteryBackpackLogDatabaseService.java | 33 ++++++++++++++- .../lottery/LotteryBackpackGateway.java | 9 ++++ .../impl/LotteryBackpackGatewayImpl.java | 41 ++++++++++++++++++- 12 files changed, 208 insertions(+), 45 deletions(-) create mode 100644 rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/activity/LotteryBackpackLogCO.java create mode 100644 rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryBackpackLogQryExe.java create mode 100644 rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/activity/LotteryBackpackLogQryCmd.java rename rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/{ => activity}/LotteryBackpackLogDAO.java (79%) diff --git a/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/activity/LotteryBackpackLogCO.java b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/activity/LotteryBackpackLogCO.java new file mode 100644 index 00000000..e11c60bb --- /dev/null +++ b/rc-service/rc-inner-api/other-inner/other-inner-model/src/main/java/com/red/circle/other/inner/model/dto/activity/LotteryBackpackLogCO.java @@ -0,0 +1,28 @@ +package com.red.circle.other.inner.model.dto.activity; + +import lombok.Data; + +import java.sql.Timestamp;import java.time.LocalDateTime; + +/** + * 抽奖背包流水 + */ +@Data +public class LotteryBackpackLogCO { + + private Long id; + + private String itemType; + + private String itemName; + + private String itemIcon; + + private Integer changeType; + + private Integer changeAmount; + + private String source; + + private Timestamp createdAt; +} \ No newline at end of file diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/LotteryActivityRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/LotteryActivityRestController.java index f4c60e27..33079c2d 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/LotteryActivityRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/activity/LotteryActivityRestController.java @@ -18,22 +18,11 @@ import com.red.circle.other.app.dto.clientobject.activity.UserActivityRechargeCO import com.red.circle.other.app.dto.clientobject.activity.ActivityRewardConfigCO; import com.red.circle.other.app.dto.clientobject.activity.ClaimRewardResultCO; import com.red.circle.other.app.dto.clientobject.activity.MyTotalDrawCountCO; -import com.red.circle.other.app.dto.cmd.activity.LotteryDrawCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryMultiDrawCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryRankQryCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryRecordQryCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryWinnerHistoryQryCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryWithdrawCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryWithdrawQryCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryExchangeGoldCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryTransferCmd; -import com.red.circle.other.app.dto.cmd.activity.ActivityRechargeRankCmd; -import com.red.circle.other.app.dto.cmd.activity.UserActivityRechargeCmd; -import com.red.circle.other.app.dto.cmd.activity.ActivityRewardConfigCmd; -import com.red.circle.other.app.dto.cmd.activity.ClaimActivityRewardCmd; +import com.red.circle.other.app.dto.cmd.activity.*; import com.red.circle.other.app.service.activity.LotteryActivityRestService; import com.red.circle.other.app.service.activity.ActivityRechargeService; import com.red.circle.other.app.service.activity.ActivityRewardConfigService; +import com.red.circle.other.inner.model.dto.activity.LotteryBackpackLogCO; import java.util.List; import lombok.RequiredArgsConstructor; @@ -142,6 +131,18 @@ public class LotteryActivityRestController extends BaseController { return lotteryActivityRestService.listMyRecords(cmd); } + /** + * 查询抽奖背包流水 + * @eo.name 查询背包流水 + * @eo.url /backpack/logs + * @eo.method post + * @eo.request-type json + */ + @PostMapping("/backpack/logs") + public PageResult queryBackpackLogs(@RequestBody LotteryBackpackLogQryCmd cmd) { + return lotteryActivityRestService.queryBackpackLogs(cmd); + } + /** * 查询我的抽奖券列表(详细信息). * diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryBackpackLogQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryBackpackLogQryExe.java new file mode 100644 index 00000000..49004ae2 --- /dev/null +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryBackpackLogQryExe.java @@ -0,0 +1,29 @@ +package com.red.circle.other.app.command.activity; + +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.app.dto.cmd.activity.LotteryBackpackLogQryCmd; +import com.red.circle.other.infra.gateway.lottery.LotteryBackpackGateway; +import com.red.circle.other.inner.model.dto.activity.LotteryBackpackLogCO; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Component; + +/** + * 查询抽奖背包流水 + */ +@Component +@RequiredArgsConstructor +public class LotteryBackpackLogQryExe { + + private final LotteryBackpackGateway lotteryBackpackGateway; + + public PageResult query(LotteryBackpackLogQryCmd cmd) { + return lotteryBackpackGateway.queryUserLogs( + cmd.getReqUserId(), + cmd.getItemType(), + cmd.getChangeType(), + cmd.getSource(), + cmd.getPageNum(), + cmd.getPageSize() + ); + } +} \ No newline at end of file diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryDrawExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryDrawExe.java index decfe2f0..acf5faa8 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryDrawExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryDrawExe.java @@ -78,6 +78,7 @@ public class LotteryDrawExe { private final UserActivityRechargeService userActivityRechargeService; private final WalletGoldClient walletGoldClient; private final LotteryBackpackGateway lotteryBackpackGateway; + private static final Long FIXED_ACTIVITY_ID = 2004471533988167125L; @Transactional(rollbackFor = Exception.class) public LotteryDrawResultCO execute(LotteryDrawCmd cmd) { @@ -549,8 +550,10 @@ public class LotteryDrawExe { remaining -= deduct; - String deductBizNo = "lottery_deduct:" + IdWorker.getIdStr(); - lotteryBackpackGateway.recordTicketDeduct(userId, deduct, "lottery", deductBizNo); + if (Objects.equals(activityId, FIXED_ACTIVITY_ID)) { + String deductBizNo = "lottery_deduct:" + IdWorker.getIdStr(); + lotteryBackpackGateway.recordTicketDeduct(userId, deduct, "lottery", deductBizNo); + } } if (!records.isEmpty()) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryMultiDrawExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryMultiDrawExe.java index b2ca8e1b..400afe82 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryMultiDrawExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/activity/LotteryMultiDrawExe.java @@ -77,6 +77,7 @@ public class LotteryMultiDrawExe { private final UserActivityRechargeService userActivityRechargeService; private final WalletGoldClient walletGoldClient; private final LotteryBackpackGateway lotteryBackpackGateway; + private static final Long FIXED_ACTIVITY_ID = 2004471533988167125L; @Transactional(rollbackFor = Exception.class) public LotteryMultiDrawResultCO execute(LotteryMultiDrawCmd cmd) { @@ -522,8 +523,11 @@ public class LotteryMultiDrawExe { records.add(ticketRecord); remaining -= deduct; - String deductBizNo = "lottery_deduct:" + IdWorker.getTimeId(); - lotteryBackpackGateway.recordTicketDeduct(userId, deduct, "lottery", deductBizNo); + + if (Objects.equals(activityId, FIXED_ACTIVITY_ID)) { + String deductBizNo = "lottery_deduct:" + IdWorker.getTimeId(); + lotteryBackpackGateway.recordTicketDeduct(userId, deduct, "lottery", deductBizNo); + } } if (!records.isEmpty()) { lotteryTicketRecordService.saveBatch(records); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestServiceImpl.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestServiceImpl.java index ed4c2971..9c0a0d6c 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestServiceImpl.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestServiceImpl.java @@ -2,21 +2,7 @@ package com.red.circle.other.app.service.activity; import com.red.circle.common.business.dto.cmd.AppExtCommand; import com.red.circle.framework.dto.PageResult; -import com.red.circle.other.app.command.activity.LotteryActivityDetailQryExe; -import com.red.circle.other.app.command.activity.LotteryActivityListQryExe; -import com.red.circle.other.app.command.activity.LotteryDrawExe; -import com.red.circle.other.app.command.activity.LotteryMultiDrawExe; -import com.red.circle.other.app.command.activity.LotteryRankQryExe; -import com.red.circle.other.app.command.activity.LotteryRecordQryExe; -import com.red.circle.other.app.command.activity.LotteryTicketCountQryExe; -import com.red.circle.other.app.command.activity.LotteryTicketQryExe; -import com.red.circle.other.app.command.activity.MyTotalDrawCountQryExe; -import com.red.circle.other.app.command.activity.LotteryWinnerHistoryQryExe; -import com.red.circle.other.app.command.activity.LotteryWithdrawAmountQryExe; -import com.red.circle.other.app.command.activity.LotteryWithdrawApplyExe; -import com.red.circle.other.app.command.activity.LotteryWithdrawQryExe; -import com.red.circle.other.app.command.activity.LotteryExchangeGoldExe; -import com.red.circle.other.app.command.activity.LotteryTransferExe; +import com.red.circle.other.app.command.activity.*; import com.red.circle.other.app.dto.clientobject.activity.*; import com.red.circle.other.app.dto.cmd.activity.*; @@ -51,6 +37,7 @@ public class LotteryActivityRestServiceImpl implements LotteryActivityRestServic private final LotteryWithdrawAmountQryExe lotteryWithdrawAmountQryExe; private final LotteryExchangeGoldExe lotteryExchangeGoldExe; private final LotteryTransferExe lotteryTransferExe; + private final LotteryBackpackLogQryExe lotteryBackpackLogQryExe; private final DistributedLockUtil distributedLockUtil; private static final String LOCK_KEY_PREFIX = "activity:lottery:draw:lock"; @@ -133,4 +120,9 @@ public class LotteryActivityRestServiceImpl implements LotteryActivityRestServic lotteryTransferExe.execute(cmd); } + @Override + public PageResult queryBackpackLogs(LotteryBackpackLogQryCmd cmd) { + return lotteryBackpackLogQryExe.query(cmd); + } + } diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/activity/LotteryBackpackLogQryCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/activity/LotteryBackpackLogQryCmd.java new file mode 100644 index 00000000..67a45a13 --- /dev/null +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/activity/LotteryBackpackLogQryCmd.java @@ -0,0 +1,31 @@ +package com.red.circle.other.app.dto.cmd.activity; + +import com.red.circle.common.business.dto.PageQueryCmd; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 查询抽奖背包流水 + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class LotteryBackpackLogQryCmd extends PageQueryCmd { + + /** + * 道具类型:lottery_ticket-抽奖券, cp_fragment-碎片 + */ + private String itemType; + + /** + * 变动类型:1-增加, 2-扣除 + */ + private Integer changeType; + + /** + * 来源:sign_in-签到, lottery-抽奖, exchange-兑换 + */ + private String source; + + private Integer pageNum; + private Integer pageSize; +} \ No newline at end of file diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestService.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestService.java index 0d91dd59..dc76e9f6 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestService.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/service/activity/LotteryActivityRestService.java @@ -13,15 +13,8 @@ import com.red.circle.other.app.dto.clientobject.activity.LotteryWinnerHistoryCO import com.red.circle.other.app.dto.clientobject.activity.LotteryWithdrawAmountCO; import com.red.circle.other.app.dto.clientobject.activity.LotteryWithdrawCO; import com.red.circle.other.app.dto.clientobject.activity.MyTotalDrawCountCO; -import com.red.circle.other.app.dto.cmd.activity.LotteryDrawCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryMultiDrawCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryRankQryCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryRecordQryCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryWinnerHistoryQryCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryWithdrawCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryWithdrawQryCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryExchangeGoldCmd; -import com.red.circle.other.app.dto.cmd.activity.LotteryTransferCmd; +import com.red.circle.other.app.dto.cmd.activity.*; + import java.util.List; /** @@ -107,4 +100,9 @@ public interface LotteryActivityRestService { */ void transfer(LotteryTransferCmd cmd); + /** + * 查询抽奖背包流水 + */ + PageResult queryBackpackLogs(LotteryBackpackLogQryCmd cmd); + } diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/LotteryBackpackLogDAO.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/activity/LotteryBackpackLogDAO.java similarity index 79% rename from rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/LotteryBackpackLogDAO.java rename to rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/activity/LotteryBackpackLogDAO.java index b9044c84..5c194c89 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/LotteryBackpackLogDAO.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/dao/activity/LotteryBackpackLogDAO.java @@ -1,4 +1,4 @@ -package com.red.circle.other.infra.database.rds.dao; +package com.red.circle.other.infra.database.rds.dao.activity; import com.red.circle.framework.mybatis.dao.BaseDAO; import com.red.circle.other.infra.database.rds.entity.LotteryBackpackLog; diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/lottery/LotteryBackpackLogDatabaseService.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/lottery/LotteryBackpackLogDatabaseService.java index f05c8a7f..6d5c8018 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/lottery/LotteryBackpackLogDatabaseService.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/database/rds/service/lottery/LotteryBackpackLogDatabaseService.java @@ -1,6 +1,10 @@ package com.red.circle.other.infra.database.rds.service.lottery; -import com.red.circle.other.infra.database.rds.dao.LotteryBackpackLogDAO; +import com.alibaba.nacos.common.utils.StringUtils; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.red.circle.other.infra.database.rds.dao.activity.LotteryBackpackLogDAO; import com.red.circle.other.infra.database.rds.entity.LotteryBackpackLog; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -26,4 +30,31 @@ public class LotteryBackpackLogDatabaseService { } } + + /** + * 分页查询流水 + */ + public IPage queryPage(Long userId, String itemType, Integer changeType, + String source, Integer pageNum, Integer pageSize) { + LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.eq(LotteryBackpackLog::getUserId, userId); + + if (StringUtils.hasText(itemType)) { + wrapper.eq(LotteryBackpackLog::getItemType, itemType); + } + + if (changeType != null) { + wrapper.eq(LotteryBackpackLog::getChangeType, changeType); + } + + if (StringUtils.hasText(source)) { + wrapper.eq(LotteryBackpackLog::getSource, source); + } + + wrapper.orderByDesc(LotteryBackpackLog::getCreatedAt); + + Page page = new Page<>(pageNum, pageSize); + return lotteryBackpackLogDAO.selectPage(page, wrapper); + } + } \ No newline at end of file diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/lottery/LotteryBackpackGateway.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/lottery/LotteryBackpackGateway.java index fc10f6a8..c7885571 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/lottery/LotteryBackpackGateway.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/lottery/LotteryBackpackGateway.java @@ -1,5 +1,8 @@ package com.red.circle.other.infra.gateway.lottery; +import com.red.circle.framework.dto.PageResult; +import com.red.circle.other.inner.model.dto.activity.LotteryBackpackLogCO; + /** * 抽奖背包网关 */ @@ -24,4 +27,10 @@ public interface LotteryBackpackGateway { * 记录碎片扣除 */ void recordFragmentDeduct(Long userId, Integer amount, String source, String bizNo); + + /** + * 查询用户流水 + */ + PageResult queryUserLogs(Long userId, String itemType, Integer changeType, + String source, Integer pageNum, Integer pageSize); } \ No newline at end of file diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/lottery/impl/LotteryBackpackGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/lottery/impl/LotteryBackpackGatewayImpl.java index 23450a94..84441475 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/lottery/impl/LotteryBackpackGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/lottery/impl/LotteryBackpackGatewayImpl.java @@ -1,12 +1,18 @@ package com.red.circle.other.infra.gateway.lottery.impl; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.red.circle.framework.dto.PageResult; import com.red.circle.other.infra.database.rds.entity.LotteryBackpackLog; +import com.red.circle.other.inner.model.dto.activity.LotteryBackpackLogCO; import com.red.circle.other.infra.database.rds.service.lottery.LotteryBackpackLogDatabaseService; import com.red.circle.other.infra.gateway.lottery.LotteryBackpackGateway; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; +import java.sql.Timestamp; import java.time.LocalDateTime; +import java.util.List; +import java.util.stream.Collectors; /** * 抽奖背包网关实现 @@ -47,8 +53,8 @@ public class LotteryBackpackGatewayImpl implements LotteryBackpackGateway { logDatabaseService.save(log); } - private LotteryBackpackLog buildLog(Long userId, String itemType, String itemName, - String itemIcon, Integer changeType, Integer changeAmount, + private LotteryBackpackLog buildLog(Long userId, String itemType, String itemName, + String itemIcon, Integer changeType, Integer changeAmount, String source, String bizNo) { LotteryBackpackLog log = new LotteryBackpackLog(); log.setUserId(userId); @@ -63,4 +69,35 @@ public class LotteryBackpackGatewayImpl implements LotteryBackpackGateway { log.setCreatedAt(LocalDateTime.now()); return log; } + + @Override + public PageResult queryUserLogs(Long userId, String itemType, Integer changeType, + String source, Integer pageNum, Integer pageSize) { + IPage page = logDatabaseService.queryPage(userId, itemType, changeType, source, pageNum, pageSize); + + List records = page.getRecords().stream() + .map(this::convertToCO) + .collect(Collectors.toList()); + PageResult pageResult = new PageResult<>(); + pageResult.setRecords(records); + pageResult.setTotal(page.getTotal()); + pageResult.setCurrent(page.getCurrent()); + pageResult.setSize(page.getSize()); + + return pageResult; + } + + private LotteryBackpackLogCO convertToCO(LotteryBackpackLog log) { + LotteryBackpackLogCO co = new LotteryBackpackLogCO(); + co.setId(log.getId()); + co.setItemType(log.getItemType()); + co.setItemName(log.getItemName()); + co.setItemIcon(log.getItemIcon()); + co.setChangeType(log.getChangeType()); + co.setChangeAmount(log.getChangeAmount()); + co.setSource(log.getSource()); + co.setCreatedAt(Timestamp.valueOf(log.getCreatedAt())); + return co; + } + } \ No newline at end of file