抽奖新增抽奖活动提现和记录
This commit is contained in:
parent
32d9284320
commit
3882501590
@ -162,6 +162,16 @@ public enum LotteryErrorCode implements IResponseErrorCode {
|
||||
*/
|
||||
MULTI_DRAW_NOT_ENABLED(9730, "Multi-draw feature is not enabled for this activity"),
|
||||
|
||||
/**
|
||||
* 没有可提现金额.
|
||||
*/
|
||||
NO_WITHDRAWAL_AMOUNT(9731, "No withdrawal amount available"),
|
||||
|
||||
/**
|
||||
* 可提现金额不足.
|
||||
*/
|
||||
INSUFFICIENT_WITHDRAWAL_AMOUNT(9732, "Insufficient withdrawal amount"),
|
||||
|
||||
;
|
||||
|
||||
private final Integer code;
|
||||
|
||||
@ -11,11 +11,15 @@ import com.red.circle.other.app.dto.clientobject.activity.LotteryRankCO;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.LotteryRecordCO;
|
||||
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.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.service.activity.LotteryActivityRestService;
|
||||
|
||||
import java.util.List;
|
||||
@ -180,4 +184,43 @@ public class LotteryActivityRestController extends BaseController {
|
||||
return lotteryActivityRestService.getWinnerHistory(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交提现申请.
|
||||
*
|
||||
* @eo.name 提交提现申请.
|
||||
* @eo.url /withdraw/apply
|
||||
* @eo.method post
|
||||
* @eo.request-type json
|
||||
*/
|
||||
@PostMapping("/withdraw/apply")
|
||||
public void applyWithdraw(@RequestBody @Validated LotteryWithdrawCmd cmd) {
|
||||
lotteryActivityRestService.applyWithdraw(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询提现记录.
|
||||
*
|
||||
* @eo.name 查询提现记录.
|
||||
* @eo.url /withdraw/records
|
||||
* @eo.method get
|
||||
* @eo.request-type formdata
|
||||
*/
|
||||
@GetMapping("/withdraw/records")
|
||||
public PageResult<LotteryWithdrawCO> listWithdrawRecords(LotteryWithdrawQryCmd cmd) {
|
||||
return lotteryActivityRestService.listWithdrawRecords(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询可提现金额.
|
||||
*
|
||||
* @eo.name 查询可提现金额.
|
||||
* @eo.url /withdraw/amount
|
||||
* @eo.method get
|
||||
* @eo.request-type formdata
|
||||
*/
|
||||
@GetMapping("/withdraw/amount")
|
||||
public LotteryWithdrawAmountCO getWithdrawAmount(AppExtCommand cmd, Long activityId) {
|
||||
return lotteryActivityRestService.getWithdrawAmount(cmd, activityId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
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.LotteryWithdrawAmountCO;
|
||||
import com.red.circle.other.infra.database.rds.entity.activity.LotteryUserProgress;
|
||||
import com.red.circle.other.infra.database.rds.entity.activity.LotteryWithdraw;
|
||||
import com.red.circle.other.infra.database.rds.service.activity.LotteryUserProgressService;
|
||||
import com.red.circle.other.infra.database.rds.service.activity.LotteryWithdrawService;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.WeekFields;
|
||||
import java.util.Locale;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 查询可提现金额.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class LotteryWithdrawAmountQryExe {
|
||||
|
||||
private final LotteryUserProgressService lotteryUserProgressService;
|
||||
private final LotteryWithdrawService lotteryWithdrawService;
|
||||
|
||||
public LotteryWithdrawAmountCO execute(AppExtCommand cmd, Long activityId) {
|
||||
Long userId = cmd.requiredReqUserId();
|
||||
|
||||
// 1. 获取用户本周累计金额
|
||||
String weekKey = getCurrentWeekKey();
|
||||
LotteryUserProgress progress = lotteryUserProgressService.query()
|
||||
.eq(LotteryUserProgress::getUserId, userId)
|
||||
.eq(activityId != null, LotteryUserProgress::getActivityId, activityId)
|
||||
.eq(LotteryUserProgress::getWeekKey, weekKey)
|
||||
.getOne();
|
||||
|
||||
BigDecimal totalAmount = progress != null && progress.getTotalAmount() != null
|
||||
? progress.getTotalAmount()
|
||||
: BigDecimal.ZERO;
|
||||
|
||||
// 2. 计算已提现金额
|
||||
BigDecimal withdrawnAmount = lotteryWithdrawService.query()
|
||||
.eq(LotteryWithdraw::getUserId, userId)
|
||||
.eq(activityId != null, LotteryWithdraw::getActivityId, activityId)
|
||||
.in(LotteryWithdraw::getStatus, 1, 3) // 已通过、已完成
|
||||
.list()
|
||||
.stream()
|
||||
.map(LotteryWithdraw::getAmount)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
// 3. 计算待审核金额
|
||||
BigDecimal pendingAmount = lotteryWithdrawService.query()
|
||||
.eq(LotteryWithdraw::getUserId, userId)
|
||||
.eq(activityId != null, LotteryWithdraw::getActivityId, activityId)
|
||||
.eq(LotteryWithdraw::getStatus, 0) // 待审核
|
||||
.list()
|
||||
.stream()
|
||||
.map(LotteryWithdraw::getAmount)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
// 4. 计算可提现金额
|
||||
BigDecimal availableAmount = totalAmount.subtract(withdrawnAmount).subtract(pendingAmount);
|
||||
|
||||
LotteryWithdrawAmountCO amountCO = new LotteryWithdrawAmountCO();
|
||||
amountCO.setTotalAmount(totalAmount);
|
||||
amountCO.setWithdrawnAmount(withdrawnAmount);
|
||||
amountCO.setPendingAmount(pendingAmount);
|
||||
amountCO.setAvailableAmount(availableAmount.compareTo(BigDecimal.ZERO) > 0 ? availableAmount : BigDecimal.ZERO);
|
||||
|
||||
return amountCO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前周标识.
|
||||
*/
|
||||
private String getCurrentWeekKey() {
|
||||
LocalDate now = LocalDate.now();
|
||||
int year = now.getYear();
|
||||
int weekOfYear = now.get(WeekFields.of(Locale.getDefault()).weekOfYear());
|
||||
return String.format("%dW%02d", year, weekOfYear);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,126 @@
|
||||
package com.red.circle.other.app.command.activity;
|
||||
|
||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||
import com.red.circle.other.app.dto.cmd.activity.LotteryWithdrawCmd;
|
||||
import com.red.circle.other.infra.database.rds.entity.activity.LotteryUserProgress;
|
||||
import com.red.circle.other.infra.database.rds.entity.activity.LotteryWithdraw;
|
||||
import com.red.circle.other.infra.database.rds.service.activity.LotteryUserProgressService;
|
||||
import com.red.circle.other.infra.database.rds.service.activity.LotteryWithdrawService;
|
||||
import com.red.circle.other.inner.asserts.lottery.LotteryErrorCode;
|
||||
import com.red.circle.tool.core.date.TimestampUtils;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.temporal.WeekFields;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 提交抽奖提现申请.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class LotteryWithdrawApplyExe {
|
||||
|
||||
private final LotteryUserProgressService lotteryUserProgressService;
|
||||
private final LotteryWithdrawService lotteryWithdrawService;
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void execute(LotteryWithdrawCmd cmd) {
|
||||
Long userId = cmd.requiredReqUserId();
|
||||
BigDecimal amount = cmd.getAmount();
|
||||
|
||||
// 1. 获取用户本周累计金额
|
||||
String weekKey = getCurrentWeekKey();
|
||||
LotteryUserProgress progress = lotteryUserProgressService.query()
|
||||
.eq(LotteryUserProgress::getUserId, userId)
|
||||
.eq(cmd.getActivityId() != null, LotteryUserProgress::getActivityId, cmd.getActivityId())
|
||||
.eq(LotteryUserProgress::getWeekKey, weekKey)
|
||||
.getOne();
|
||||
|
||||
ResponseAssert.notNull(LotteryErrorCode.NO_WITHDRAWAL_AMOUNT, progress);
|
||||
ResponseAssert.isTrue(LotteryErrorCode.NO_WITHDRAWAL_AMOUNT,
|
||||
progress.getTotalAmount() != null && progress.getTotalAmount().compareTo(BigDecimal.ZERO) > 0);
|
||||
|
||||
// 2. 计算可提现金额(总金额 - 已提现金额 - 待审核金额)
|
||||
BigDecimal withdrawnAmount = getWithdrawnAmount(userId, cmd.getActivityId());
|
||||
BigDecimal pendingAmount = getPendingAmount(userId, cmd.getActivityId());
|
||||
BigDecimal availableAmount = progress.getTotalAmount().subtract(withdrawnAmount).subtract(pendingAmount);
|
||||
|
||||
// 3. 校验提现金额
|
||||
ResponseAssert.isTrue(LotteryErrorCode.INSUFFICIENT_WITHDRAWAL_AMOUNT,
|
||||
amount.compareTo(availableAmount) <= 0);
|
||||
|
||||
// 4. 创建提现申请
|
||||
LotteryWithdraw withdraw = new LotteryWithdraw();
|
||||
withdraw.setWithdrawNo(generateWithdrawNo());
|
||||
withdraw.setUserId(userId);
|
||||
withdraw.setActivityId(cmd.getActivityId());
|
||||
withdraw.setAmount(amount);
|
||||
withdraw.setContactNumber(cmd.getContactNumber());
|
||||
withdraw.setDescription(cmd.getDescription());
|
||||
withdraw.setCardImages(cmd.getCardImages());
|
||||
withdraw.setStatus(0); // 待审核
|
||||
withdraw.setCreateTime(TimestampUtils.now());
|
||||
withdraw.setUpdateTime(TimestampUtils.now());
|
||||
|
||||
lotteryWithdrawService.save(withdraw);
|
||||
|
||||
log.info("Lottery withdraw application submitted, userId: {}, amount: {}, withdrawNo: {}",
|
||||
userId, amount, withdraw.getWithdrawNo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取已提现金额.
|
||||
*/
|
||||
private BigDecimal getWithdrawnAmount(Long userId, Long activityId) {
|
||||
return lotteryWithdrawService.query()
|
||||
.eq(LotteryWithdraw::getUserId, userId)
|
||||
.eq(activityId != null, LotteryWithdraw::getActivityId, activityId)
|
||||
.in(LotteryWithdraw::getStatus, 1, 3) // 已通过、已完成
|
||||
.list()
|
||||
.stream()
|
||||
.map(LotteryWithdraw::getAmount)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待审核金额.
|
||||
*/
|
||||
private BigDecimal getPendingAmount(Long userId, Long activityId) {
|
||||
return lotteryWithdrawService.query()
|
||||
.eq(LotteryWithdraw::getUserId, userId)
|
||||
.eq(activityId != null, LotteryWithdraw::getActivityId, activityId)
|
||||
.eq(LotteryWithdraw::getStatus, 0) // 待审核
|
||||
.list()
|
||||
.stream()
|
||||
.map(LotteryWithdraw::getAmount)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前周标识.
|
||||
*/
|
||||
private String getCurrentWeekKey() {
|
||||
LocalDate now = LocalDate.now();
|
||||
int year = now.getYear();
|
||||
int weekOfYear = now.get(WeekFields.of(Locale.getDefault()).weekOfYear());
|
||||
return String.format("%dW%02d", year, weekOfYear);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成提现单号.
|
||||
*/
|
||||
private String generateWithdrawNo() {
|
||||
return "WD" + System.currentTimeMillis() +
|
||||
String.format("%06d", ThreadLocalRandom.current().nextInt(1000000));
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
package com.red.circle.other.app.command.activity;
|
||||
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.LotteryWithdrawCO;
|
||||
import com.red.circle.other.app.dto.cmd.activity.LotteryWithdrawQryCmd;
|
||||
import com.red.circle.other.infra.database.rds.entity.activity.LotteryWithdraw;
|
||||
import com.red.circle.other.infra.database.rds.service.activity.LotteryWithdrawService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 查询抽奖提现记录.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class LotteryWithdrawQryExe {
|
||||
|
||||
private final LotteryWithdrawService lotteryWithdrawService;
|
||||
|
||||
public PageResult<LotteryWithdrawCO> execute(LotteryWithdrawQryCmd cmd) {
|
||||
PageResult<LotteryWithdraw> pageResult = lotteryWithdrawService.query()
|
||||
.eq(cmd.getUserId() != null, LotteryWithdraw::getUserId, cmd.getUserId())
|
||||
.eq(cmd.getActivityId() != null, LotteryWithdraw::getActivityId, cmd.getActivityId())
|
||||
.eq(cmd.getStatus() != null, LotteryWithdraw::getStatus, cmd.getStatus())
|
||||
.orderByDesc(LotteryWithdraw::getCreateTime)
|
||||
.page(cmd.getPageQuery());
|
||||
|
||||
return pageResult.convert(this::convertToCO);
|
||||
}
|
||||
|
||||
private LotteryWithdrawCO convertToCO(LotteryWithdraw withdraw) {
|
||||
LotteryWithdrawCO co = new LotteryWithdrawCO();
|
||||
BeanUtils.copyProperties(withdraw, co);
|
||||
co.setStatusText(getStatusText(withdraw.getStatus()));
|
||||
return co;
|
||||
}
|
||||
|
||||
private String getStatusText(Integer status) {
|
||||
if (status == null) {
|
||||
return "未知";
|
||||
}
|
||||
return switch (status) {
|
||||
case 0 -> "待审核";
|
||||
case 1 -> "已通过";
|
||||
case 2 -> "已拒绝";
|
||||
case 3 -> "已完成";
|
||||
default -> "未知";
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@ -11,19 +11,12 @@ 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.LotteryWinnerHistoryQryExe;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.LotteryActivityCO;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.LotteryActivityDetailCO;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.LotteryDrawResultCO;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.LotteryMultiDrawResultCO;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.LotteryRankCO;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.LotteryRecordCO;
|
||||
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.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.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.dto.clientobject.activity.*;
|
||||
import com.red.circle.other.app.dto.cmd.activity.*;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -47,6 +40,9 @@ public class LotteryActivityRestServiceImpl implements LotteryActivityRestServic
|
||||
private final LotteryTicketCountQryExe lotteryTicketCountQryExe;
|
||||
private final LotteryRankQryExe lotteryRankQryExe;
|
||||
private final LotteryWinnerHistoryQryExe lotteryWinnerHistoryQryExe;
|
||||
private final LotteryWithdrawApplyExe lotteryWithdrawApplyExe;
|
||||
private final LotteryWithdrawQryExe lotteryWithdrawQryExe;
|
||||
private final LotteryWithdrawAmountQryExe lotteryWithdrawAmountQryExe;
|
||||
|
||||
@Override
|
||||
public List<LotteryActivityCO> listValidActivities(AppExtCommand cmd) {
|
||||
@ -93,4 +89,19 @@ public class LotteryActivityRestServiceImpl implements LotteryActivityRestServic
|
||||
return lotteryWinnerHistoryQryExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyWithdraw(LotteryWithdrawCmd cmd) {
|
||||
lotteryWithdrawApplyExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<LotteryWithdrawCO> listWithdrawRecords(LotteryWithdrawQryCmd cmd) {
|
||||
return lotteryWithdrawQryExe.execute(cmd);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LotteryWithdrawAmountCO getWithdrawAmount(AppExtCommand cmd, Long activityId) {
|
||||
return lotteryWithdrawAmountQryExe.execute(cmd, activityId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
package com.red.circle.other.app.dto.clientobject.activity;
|
||||
|
||||
import com.red.circle.framework.dto.ClientObject;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 可提现金额CO.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LotteryWithdrawAmountCO extends ClientObject {
|
||||
|
||||
/**
|
||||
* 可提现金额.
|
||||
*/
|
||||
private BigDecimal availableAmount;
|
||||
|
||||
/**
|
||||
* 总中奖金额.
|
||||
*/
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
/**
|
||||
* 已提现金额.
|
||||
*/
|
||||
private BigDecimal withdrawnAmount;
|
||||
|
||||
/**
|
||||
* 待审核金额.
|
||||
*/
|
||||
private BigDecimal pendingAmount;
|
||||
|
||||
}
|
||||
@ -0,0 +1,91 @@
|
||||
package com.red.circle.other.app.dto.clientobject.activity;
|
||||
|
||||
import com.red.circle.framework.dto.ClientObject;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 抽奖提现记录CO.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LotteryWithdrawCO extends ClientObject {
|
||||
|
||||
/**
|
||||
* 主键ID.
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 提现单号.
|
||||
*/
|
||||
private String withdrawNo;
|
||||
|
||||
/**
|
||||
* 用户ID.
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 活动ID.
|
||||
*/
|
||||
private Long activityId;
|
||||
|
||||
/**
|
||||
* 提现金额.
|
||||
*/
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 联系号码.
|
||||
*/
|
||||
private String contactNumber;
|
||||
|
||||
/**
|
||||
* 描述信息.
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 卡片图片(多个用逗号分隔).
|
||||
*/
|
||||
private String cardImages;
|
||||
|
||||
/**
|
||||
* 状态:0-待审核,1-已通过,2-已拒绝,3-已完成.
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 状态文本.
|
||||
*/
|
||||
private String statusText;
|
||||
|
||||
/**
|
||||
* 拒绝原因.
|
||||
*/
|
||||
private String rejectReason;
|
||||
|
||||
/**
|
||||
* 审核时间.
|
||||
*/
|
||||
private Timestamp auditTime;
|
||||
|
||||
/**
|
||||
* 完成时间.
|
||||
*/
|
||||
private Timestamp completeTime;
|
||||
|
||||
/**
|
||||
* 创建时间.
|
||||
*/
|
||||
private Timestamp createTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.red.circle.other.app.dto.cmd.activity;
|
||||
|
||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import jakarta.validation.constraints.DecimalMin;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import java.math.BigDecimal;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 抽奖提现申请CMD.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LotteryWithdrawCmd extends AppExtCommand {
|
||||
|
||||
/**
|
||||
* 活动ID(可选).
|
||||
*/
|
||||
private Long activityId;
|
||||
|
||||
/**
|
||||
* 提现金额.
|
||||
*/
|
||||
@NotNull(message = "提现金额不能为空")
|
||||
@DecimalMin(value = "0.01", message = "提现金额必须大于0")
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 联系号码.
|
||||
*/
|
||||
@NotBlank(message = "联系号码不能为空")
|
||||
private String contactNumber;
|
||||
|
||||
/**
|
||||
* 描述信息.
|
||||
*/
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 卡片图片(多个用逗号分隔).
|
||||
*/
|
||||
@NotBlank(message = "卡片图片不能为空")
|
||||
private String cardImages;
|
||||
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package com.red.circle.other.app.dto.cmd.activity;
|
||||
|
||||
import com.red.circle.framework.core.dto.PageCommand;
|
||||
import java.io.Serial;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 抽奖提现记录查询CMD.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class LotteryWithdrawQryCmd extends PageCommand {
|
||||
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID.
|
||||
*/
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 活动ID.
|
||||
*/
|
||||
private Long activityId;
|
||||
|
||||
/**
|
||||
* 状态:0-待审核,1-已通过,2-已拒绝,3-已完成.
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@ -10,11 +10,15 @@ import com.red.circle.other.app.dto.clientobject.activity.LotteryRankCO;
|
||||
import com.red.circle.other.app.dto.clientobject.activity.LotteryRecordCO;
|
||||
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.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 java.util.List;
|
||||
|
||||
/**
|
||||
@ -70,4 +74,19 @@ public interface LotteryActivityRestService {
|
||||
*/
|
||||
List<LotteryWinnerHistoryCO> getWinnerHistory(LotteryWinnerHistoryQryCmd cmd);
|
||||
|
||||
/**
|
||||
* 提交提现申请.
|
||||
*/
|
||||
void applyWithdraw(LotteryWithdrawCmd cmd);
|
||||
|
||||
/**
|
||||
* 查询提现记录.
|
||||
*/
|
||||
PageResult<LotteryWithdrawCO> listWithdrawRecords(LotteryWithdrawQryCmd cmd);
|
||||
|
||||
/**
|
||||
* 查询可提现金额.
|
||||
*/
|
||||
LotteryWithdrawAmountCO getWithdrawAmount(AppExtCommand cmd, Long activityId);
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
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.activity.LotteryWithdraw;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 抽奖提现申请Mapper.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Mapper
|
||||
public interface LotteryWithdrawDAO extends BaseDAO<LotteryWithdraw> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
package com.red.circle.other.infra.database.rds.entity.activity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.red.circle.framework.mybatis.entity.TimestampBaseEntity;
|
||||
import java.io.Serial;
|
||||
import java.math.BigDecimal;
|
||||
import java.sql.Timestamp;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 抽奖提现申请表.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("lottery_withdraw")
|
||||
public class LotteryWithdraw {
|
||||
|
||||
/**
|
||||
* 主键ID.
|
||||
*/
|
||||
@TableId("id")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 提现单号.
|
||||
*/
|
||||
@TableField("withdraw_no")
|
||||
private String withdrawNo;
|
||||
|
||||
/**
|
||||
* 用户ID.
|
||||
*/
|
||||
@TableField("user_id")
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 活动ID.
|
||||
*/
|
||||
@TableField("activity_id")
|
||||
private Long activityId;
|
||||
|
||||
/**
|
||||
* 提现金额.
|
||||
*/
|
||||
@TableField("amount")
|
||||
private BigDecimal amount;
|
||||
|
||||
/**
|
||||
* 联系号码.
|
||||
*/
|
||||
@TableField("contact_number")
|
||||
private String contactNumber;
|
||||
|
||||
/**
|
||||
* 描述信息.
|
||||
*/
|
||||
@TableField("description")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 卡片图片(多个用逗号分隔).
|
||||
*/
|
||||
@TableField("card_images")
|
||||
private String cardImages;
|
||||
|
||||
/**
|
||||
* 状态:0-待审核,1-已通过,2-已拒绝,3-已完成.
|
||||
*/
|
||||
@TableField("status")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 拒绝原因.
|
||||
*/
|
||||
@TableField("reject_reason")
|
||||
private String rejectReason;
|
||||
|
||||
/**
|
||||
* 审核人.
|
||||
*/
|
||||
@TableField("audit_user")
|
||||
private Long auditUser;
|
||||
|
||||
/**
|
||||
* 审核时间.
|
||||
*/
|
||||
@TableField("audit_time")
|
||||
private Timestamp auditTime;
|
||||
|
||||
/**
|
||||
* 完成时间.
|
||||
*/
|
||||
@TableField("complete_time")
|
||||
private Timestamp completeTime;
|
||||
|
||||
/**
|
||||
* 备注.
|
||||
*/
|
||||
@TableField("remark")
|
||||
private String remark;
|
||||
|
||||
@TableField("create_time")
|
||||
private Timestamp createTime;
|
||||
|
||||
@TableField("update_time")
|
||||
private Timestamp updateTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,14 @@
|
||||
package com.red.circle.other.infra.database.rds.service.activity;
|
||||
|
||||
import com.red.circle.framework.mybatis.service.BaseService;
|
||||
import com.red.circle.other.infra.database.rds.entity.activity.LotteryWithdraw;
|
||||
|
||||
/**
|
||||
* 抽奖提现申请Service.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
public interface LotteryWithdrawService extends BaseService<LotteryWithdraw> {
|
||||
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.red.circle.other.infra.database.rds.service.activity.impl;
|
||||
|
||||
import com.red.circle.framework.mybatis.service.impl.BaseServiceImpl;
|
||||
import com.red.circle.other.infra.database.rds.dao.activity.LotteryWithdrawDAO;
|
||||
import com.red.circle.other.infra.database.rds.entity.activity.LotteryWithdraw;
|
||||
import com.red.circle.other.infra.database.rds.service.activity.LotteryWithdrawService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 抽奖提现申请Service实现.
|
||||
*
|
||||
* @author system
|
||||
* @since 2025-10-21
|
||||
*/
|
||||
@Service
|
||||
public class LotteryWithdrawServiceImpl extends BaseServiceImpl<LotteryWithdrawDAO, LotteryWithdraw>
|
||||
implements LotteryWithdrawService {
|
||||
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user