From 2fc3a28539dfce94f851f1f0722a64b05574499c Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Tue, 06 Dec 2022 21:42:05 +0800
Subject: [PATCH] 20221130
---
src/main/resources/mapper/dapp/DappFundFlowDao.xml | 6 ++++++
src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java | 2 ++
src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java | 8 ++++++--
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java b/src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java
index 863234f..d3e5311 100644
--- a/src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java
+++ b/src/main/java/cc/mrbird/febs/dapp/mapper/DappFundFlowDao.java
@@ -34,4 +34,6 @@
int updateStatusById(@Param("status")int status, @Param("id")Long id);
DappFundFlowEntity selectByStateAndVersionAndFromHashLimitOne(@Param("status")int withdrawStatusAgree, @Param("version")int withdrawStatusAgree1);
+
+ DappFundFlowEntity selectBymemberIdAndType(@Param("memberId")Long id, @Param("type")int type);
}
diff --git a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
index e640603..ae6f35b 100644
--- a/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/dapp/service/impl/DappWalletServiceImpl.java
@@ -219,6 +219,10 @@
type = 6;
}
if (transferDto.getId() == null) {
+ DappFundFlowEntity fundFlowOld = dappFundFlowDao.selectBymemberIdAndType(member.getId(),type);
+ if(ObjectUtil.isNotEmpty(fundFlowOld)){
+ throw new FebsException("Do not repeat purchase");
+ }
DappFundFlowEntity fundFlow = new DappFundFlowEntity(member.getId(), transferDto.getAmount(), type, 1, transferDto.getFee(), transferDto.getTxHash());
dappFundFlowDao.insert(fundFlow);
return fundFlow.getId();
@@ -227,12 +231,12 @@
if ("success".equals(transferDto.getFlag())) {
DappFundFlowEntity flow = dappFundFlowDao.selectById(transferDto.getId());
if(DappFundFlowEntity.WITHDRAW_STATUS_AGREE == flow.getStatus()){
- return null;
+ throw new FebsException("Do not repeat purchase");
}
//是否已经加入动能
DappSystemProfit dappSystemProfitIng = dappSystemProfitDao.selectByMemberIdAndState(member.getId(), DappSystemProfit.STATE_IN);
if(ObjectUtil.isNotEmpty(dappSystemProfitIng)){
- return null;
+ throw new FebsException("Do not repeat purchase");
}
//插入一条会员入列记录,即加入动能队列
diff --git a/src/main/resources/mapper/dapp/DappFundFlowDao.xml b/src/main/resources/mapper/dapp/DappFundFlowDao.xml
index 0d65329..f0600b7 100644
--- a/src/main/resources/mapper/dapp/DappFundFlowDao.xml
+++ b/src/main/resources/mapper/dapp/DappFundFlowDao.xml
@@ -113,4 +113,10 @@
id ASC
LIMIT 1
</select>
+
+ <select id="selectBymemberIdAndType" resultType="cc.mrbird.febs.dapp.entity.DappFundFlowEntity">
+ select * from dapp_fund_flow
+ where member_id = #{memberId}
+ and type = #{type}
+ </select>
</mapper>
\ No newline at end of file
--
Gitblit v1.9.1