Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
D
data-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
licc
data-server
Commits
63bfbfd9
Commit
63bfbfd9
authored
Mar 26, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化提现接口
parent
d96d8b6a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
4 deletions
+77
-4
BankManger.java
...rc/main/java/cn/wisenergy/service/Manager/BankManger.java
+53
-0
BankServiceImpl.java
...n/java/cn/wisenergy/service/app/impl/BankServiceImpl.java
+24
-4
No files found.
wisenergy-service/src/main/java/cn/wisenergy/service/Manager/BankManger.java
0 → 100644
View file @
63bfbfd9
package
cn
.
wisenergy
.
service
.
Manager
;
import
cn.wisenergy.mapper.AccountMapper
;
import
cn.wisenergy.mapper.BankInfoMapper
;
import
cn.wisenergy.mapper.TradeRecordMapper
;
import
cn.wisenergy.model.app.AccountInfo
;
import
cn.wisenergy.model.app.TradeRecord
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* @author 86187
* @ Description: 银行卡管理类
* @ Author : 86187
* @ Date : 2021/3/26 19:38
*/
@Component
@Slf4j
public
class
BankManger
{
@Autowired
private
TradeRecordMapper
recordMapper
;
@Autowired
private
AccountMapper
accountMapper
;
/**
* 更新账户信息和保存交易流水记录
*
* @param accountInfo 账户信息
* @param record 交易流水信息
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
Boolean
updateAccountAddRecord
(
AccountInfo
accountInfo
,
TradeRecord
record
)
{
//更新账户信息
if
(
null
!=
accountInfo
)
{
int
count
=
accountMapper
.
edit
(
accountInfo
);
if
(
count
==
0
)
{
return
false
;
}
}
//新增交易流水记录
if
(
null
!=
record
)
{
int
count
=
recordMapper
.
add
(
record
);
return
count
!=
0
;
}
return
true
;
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/BankServiceImpl.java
View file @
63bfbfd9
...
...
@@ -8,6 +8,7 @@ import cn.wisenergy.model.enums.FrozenStatus;
import
cn.wisenergy.model.enums.TradeRecordEnum
;
import
cn.wisenergy.model.enums.TradeStatusEnum
;
import
cn.wisenergy.model.vo.TaxRateVo
;
import
cn.wisenergy.service.Manager.BankManger
;
import
cn.wisenergy.service.app.BankService
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -15,6 +16,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -49,6 +51,9 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
@Autowired
private
VariableMapper
variableMapper
;
@Autowired
private
BankManger
bankManger
;
private
static
final
String
TAX_RATE_KEY
=
"TAX_RATE_CODE"
;
...
...
@@ -181,15 +186,30 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
return
R
.
error
(
1
,
"验证码已过期!"
,
false
);
}
//3、添加提现交易流水记录
//3、更新可提现金额和
BigDecimal
money
=
BigDecimal
.
valueOf
(
dto
.
getMoney
());
BigDecimal
extractMoney
=
accountInfo
.
getExtractMoney
().
subtract
(
money
);
accountInfo
.
setExtractMoney
(
extractMoney
);
BigDecimal
frozenMoney
=
accountInfo
.
getFrozenMoney
().
add
(
money
);
accountInfo
.
setFrozenMoney
(
frozenMoney
);
BigDecimal
earningsMonth
=
accountInfo
.
getEarningsMonth
().
subtract
(
money
);
accountInfo
.
setEarningsMonth
(
earningsMonth
);
BigDecimal
earningsTotal
=
accountInfo
.
getEarningsTotal
().
subtract
(
money
);
accountInfo
.
setEarningsTotal
(
earningsTotal
);
//4、添加提现交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
accountInfo
.
getUserId
());
tradeRecord
.
setTradeType
(
TradeRecordEnum
.
WITHDRAW_DEPOSIT
.
getCode
());
tradeRecord
.
setTradeNo
(
null
);
tradeRecord
.
setStatus
(
TradeStatusEnum
.
BANK_TRANSFER_ACCOUNTS
.
getCode
());
int
count
=
recordMapper
.
add
(
tradeRecord
);
if
(
count
==
0
)
{
return
R
.
error
(
"保存交易流水失败!"
);
Boolean
bool
=
bankManger
.
updateAccountAddRecord
(
accountInfo
,
tradeRecord
);
if
(!
bool
)
{
return
R
.
ok
(
1
,
false
);
}
return
R
.
ok
(
0
,
true
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment