抽奖新增我的总抽奖次数接口
This commit is contained in:
parent
aea6decffc
commit
22a464c907
@ -17,6 +17,7 @@ import com.red.circle.other.app.dto.clientobject.activity.ActivityRechargeRankCO
|
||||
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;
|
||||
@ -167,6 +168,19 @@ public class LotteryActivityRestController extends BaseController {
|
||||
return lotteryActivityRestService.getMyTicketCount(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取我的总抽奖次数.
|
||||
*
|
||||
* @eo.name 获取我的总抽奖次数.
|
||||
* @eo.url /my-total-draw-count
|
||||
* @eo.method get
|
||||
* @eo.request-type formdata
|
||||
*/
|
||||
@GetMapping("/my-total-draw-count")
|
||||
public MyTotalDrawCountCO getMyTotalDrawCount(AppExtCommand cmd) {
|
||||
return lotteryActivityRestService.getMyTotalDrawCount(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询排行榜.
|
||||
*
|
||||
|
||||
@ -0,0 +1,46 @@
|
||||
package com.red.circle.other.app.command.activity;
|
||||
|
||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.MyTotalDrawCountCO;
|
||||
import com.red.circle.other.infra.database.rds.entity.activity.LotteryTicket;
|
||||
import com.red.circle.other.infra.database.rds.service.activity.LotteryTicketService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 查询我的总抽奖次数
|
||||
*/
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class MyTotalDrawCountQryExe {
|
||||
|
||||
private final LotteryTicketService lotteryTicketService;
|
||||
|
||||
public MyTotalDrawCountCO execute(AppExtCommand cmd) {
|
||||
Long userId = cmd.requiredReqUserId();
|
||||
|
||||
List<LotteryTicket> tickets = lotteryTicketService.query()
|
||||
.eq(LotteryTicket::getUserId, userId)
|
||||
.eq(LotteryTicket::getStatus, 1)
|
||||
.list();
|
||||
|
||||
int totalCount = tickets.stream()
|
||||
.mapToInt(LotteryTicket::getTotalCount)
|
||||
.sum();
|
||||
|
||||
int usedCount = tickets.stream()
|
||||
.mapToInt(LotteryTicket::getUsedCount)
|
||||
.sum();
|
||||
|
||||
int remainingCount = tickets.stream()
|
||||
.mapToInt(LotteryTicket::getRemainingCount)
|
||||
.sum();
|
||||
|
||||
return new MyTotalDrawCountCO()
|
||||
.setTotalCount(totalCount)
|
||||
.setUsedCount(usedCount)
|
||||
.setRemainingCount(remainingCount);
|
||||
}
|
||||
}
|
||||
@ -10,6 +10,7 @@ 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;
|
||||
@ -42,6 +43,7 @@ public class LotteryActivityRestServiceImpl implements LotteryActivityRestServic
|
||||
private final LotteryRecordQryExe lotteryRecordQryExe;
|
||||
private final LotteryTicketQryExe lotteryTicketQryExe;
|
||||
private final LotteryTicketCountQryExe lotteryTicketCountQryExe;
|
||||
private final MyTotalDrawCountQryExe myTotalDrawCountQryExe;
|
||||
private final LotteryRankQryExe lotteryRankQryExe;
|
||||
private final LotteryWinnerHistoryQryExe lotteryWinnerHistoryQryExe;
|
||||
private final LotteryWithdrawApplyExe lotteryWithdrawApplyExe;
|
||||
@ -91,6 +93,11 @@ public class LotteryActivityRestServiceImpl implements LotteryActivityRestServic
|
||||
return lotteryTicketCountQryExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MyTotalDrawCountCO getMyTotalDrawCount(AppExtCommand cmd) {
|
||||
return myTotalDrawCountQryExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LotteryRankCO> getRankList(LotteryRankQryCmd cmd) {
|
||||
return lotteryRankQryExe.execute(cmd);
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
package com.red.circle.other.app.dto.clientobject.activity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 我的总抽奖次数CO
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class MyTotalDrawCountCO implements Serializable {
|
||||
|
||||
/**
|
||||
* 总抽奖次数
|
||||
*/
|
||||
private Integer totalCount;
|
||||
|
||||
/**
|
||||
* 已使用次数
|
||||
*/
|
||||
private Integer usedCount;
|
||||
|
||||
/**
|
||||
* 剩余次数
|
||||
*/
|
||||
private Integer remainingCount;
|
||||
}
|
||||
@ -12,6 +12,7 @@ import com.red.circle.other.app.dto.clientobject.activity.LotteryTicketCO;
|
||||
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;
|
||||
@ -66,6 +67,11 @@ public interface LotteryActivityRestService {
|
||||
*/
|
||||
Integer getMyTicketCount(AppExtCommand cmd);
|
||||
|
||||
/**
|
||||
* 查询我的总抽奖次数.
|
||||
*/
|
||||
MyTotalDrawCountCO getMyTotalDrawCount(AppExtCommand cmd);
|
||||
|
||||
/**
|
||||
* 查询排行榜.
|
||||
*/
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user