Browse Source

红娘订单

master
张彭杰 1 year ago
parent
commit
449f60184f
4 changed files with 11 additions and 2 deletions
  1. 4
      dating-agency-mall-entity/src/main/java/com/qniao/dam/domain/aggregate/walletaccount/valueobj/WalletAccountRecord.java
  2. 3
      dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/walletaccount/WalletAccountApplicationService.java
  3. 2
      dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/withdrawaudit/WithdrawAuditEventHandler.java
  4. 4
      dating-agency-mall-server/src/main/java/com/qniao/dam/domain/service/revenuereward/AcquireRevenueRewardDomainService.java

4
dating-agency-mall-entity/src/main/java/com/qniao/dam/domain/aggregate/walletaccount/valueobj/WalletAccountRecord.java

@ -32,9 +32,13 @@ public class WalletAccountRecord extends ValueObject<WalletAccountRecord> {
@ApiModelProperty("当前金额") @ApiModelProperty("当前金额")
private BigDecimal currentBalance; private BigDecimal currentBalance;
@ApiModelProperty("关联ID")
private Long associateId;
@ApiModelProperty("备注") @ApiModelProperty("备注")
private String remark; private String remark;
public static WalletAccountRecord build(TradeTypeEnum tradeType, public static WalletAccountRecord build(TradeTypeEnum tradeType,
BigDecimal tradeAmount, BigDecimal tradeAmount,
Boolean isIncome, Boolean isIncome,

3
dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/walletaccount/WalletAccountApplicationService.java

@ -19,12 +19,13 @@ public class WalletAccountApplicationService {
@Resource @Resource
private WalletAccountAggregate walletAccountAggregate; private WalletAccountAggregate walletAccountAggregate;
public void confirmWithdraw(Long walletAccountId, BigDecimal withdrawAmount) {
public void confirmWithdraw(Long walletAccountId, BigDecimal withdrawAmount, Long associateId) {
WalletAccount walletAccount = walletAccountDao.selectById(walletAccountId); WalletAccount walletAccount = walletAccountDao.selectById(walletAccountId);
BigDecimal originalBalance = walletAccount.getTotalBalance(); BigDecimal originalBalance = walletAccount.getTotalBalance();
walletAccount.setFrozenBalance(walletAccount.getFrozenBalance().subtract(withdrawAmount)); walletAccount.setFrozenBalance(walletAccount.getFrozenBalance().subtract(withdrawAmount));
walletAccount.setTotalBalance(walletAccount.getAvailableBalance().add(walletAccount.getFrozenBalance())); walletAccount.setTotalBalance(walletAccount.getAvailableBalance().add(walletAccount.getFrozenBalance()));
WalletAccountRecord walletAccountRecord = WalletAccountRecord.build(TradeTypeEnum.WITHDRAW, withdrawAmount, false, originalBalance, walletAccount.getTotalBalance()); WalletAccountRecord walletAccountRecord = WalletAccountRecord.build(TradeTypeEnum.WITHDRAW, withdrawAmount, false, originalBalance, walletAccount.getTotalBalance());
walletAccountRecord.setAssociateId(associateId);
walletAccount.setRecordList(Collections.singletonList(walletAccountRecord)); walletAccount.setRecordList(Collections.singletonList(walletAccountRecord));
walletAccountAggregate.save(walletAccount); walletAccountAggregate.save(walletAccount);
} }

2
dating-agency-mall-server/src/main/java/com/qniao/dam/application/handler/withdrawaudit/WithdrawAuditEventHandler.java

@ -40,7 +40,7 @@ public class WithdrawAuditEventHandler extends BaseApplicationService {
try { try {
WithdrawAudit withdrawAudit = withdrawAuditDao.selectById(event.getId()); WithdrawAudit withdrawAudit = withdrawAuditDao.selectById(event.getId());
if (withdrawAudit.getRemitStatus()) { if (withdrawAudit.getRemitStatus()) {
walletAccountApplicationService.confirmWithdraw(withdrawAudit.getWalletAccountId(), withdrawAudit.getWithdrawAmount());
walletAccountApplicationService.confirmWithdraw(withdrawAudit.getWalletAccountId(), withdrawAudit.getWithdrawAmount(),withdrawAudit.getId());
} }
} catch (Exception e) { } catch (Exception e) {
log.error("提现申请审核事件处理异常", e); log.error("提现申请审核事件处理异常", e);

4
dating-agency-mall-server/src/main/java/com/qniao/dam/domain/service/revenuereward/AcquireRevenueRewardDomainService.java

@ -1,5 +1,6 @@
package com.qniao.dam.domain.service.revenuereward; package com.qniao.dam.domain.service.revenuereward;
import cn.hutool.core.collection.CollUtil;
import com.qniao.dam.domain.aggregate.revenuereward.RevenueRewardAggregate; import com.qniao.dam.domain.aggregate.revenuereward.RevenueRewardAggregate;
import com.qniao.dam.domain.aggregate.revenuereward.entity.RevenueReward; import com.qniao.dam.domain.aggregate.revenuereward.entity.RevenueReward;
import com.qniao.dam.domain.aggregate.walletaccount.WalletAccountAggregate; import com.qniao.dam.domain.aggregate.walletaccount.WalletAccountAggregate;
@ -20,6 +21,9 @@ public class AcquireRevenueRewardDomainService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void handle(RevenueReward revenueReward, WalletAccount walletAccount) { public void handle(RevenueReward revenueReward, WalletAccount walletAccount) {
revenueRewardAggregate.save(revenueReward); revenueRewardAggregate.save(revenueReward);
walletAccount.getRecordList().forEach(record -> {
record.setAssociateId(revenueReward.getRecordList().get(0).getId());
});
walletAccountAggregate.save(walletAccount); walletAccountAggregate.save(walletAccount);
} }
} }
Loading…
Cancel
Save