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
7464bb8f
Commit
7464bb8f
authored
Mar 22, 2021
by
licc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提现接口,新增账户是否冻结校验
parent
7befb0f1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
6 deletions
+52
-6
FrozenStatus.java
.../src/main/java/cn/wisenergy/model/enums/FrozenStatus.java
+38
-0
BankServiceImpl.java
...n/java/cn/wisenergy/service/app/impl/BankServiceImpl.java
+14
-6
No files found.
wisenergy-model/src/main/java/cn/wisenergy/model/enums/FrozenStatus.java
0 → 100644
View file @
7464bb8f
package
cn
.
wisenergy
.
model
.
enums
;
/**
* 账户冻结状态枚举
* @author 86187
*/
public
enum
FrozenStatus
{
/**
* 账户冻结状态枚举
*/
NO_FROZEN
(
0
,
"未冻结"
),
ALREADY_FROZEN
(
1
,
"已冻结"
);
FrozenStatus
(
Integer
code
,
String
desc
)
{
this
.
code
=
code
;
this
.
desc
=
desc
;
}
private
Integer
code
;
private
String
desc
;
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getDesc
()
{
return
desc
;
}
public
void
setDesc
(
String
desc
)
{
this
.
desc
=
desc
;
}
}
wisenergy-service/src/main/java/cn/wisenergy/service/app/impl/BankServiceImpl.java
View file @
7464bb8f
...
...
@@ -4,6 +4,7 @@ import cn.wisenergy.common.utils.*;
import
cn.wisenergy.mapper.*
;
import
cn.wisenergy.model.app.*
;
import
cn.wisenergy.model.dto.WithdrawBankDto
;
import
cn.wisenergy.model.enums.FrozenStatus
;
import
cn.wisenergy.model.enums.TradeRecordEnum
;
import
cn.wisenergy.model.enums.TradeStatusEnum
;
import
cn.wisenergy.model.vo.TaxRateVo
;
...
...
@@ -135,21 +136,27 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
public
R
<
Boolean
>
userWithdrawBank
(
WithdrawBankDto
dto
)
{
log
.
info
(
"shop-mall[]BankServiceImpl[]edit[]input.param.dto:"
+
dto
);
if
(
null
==
dto
||
StringUtils
.
isBlank
(
dto
.
getUserId
())
||
StringUtils
.
isBlank
(
dto
.
getCode
())
||
null
!
=
dto
.
getMoney
())
{
null
=
=
dto
.
getMoney
())
{
return
R
.
error
(
"入参不能为空!"
);
}
//1、判断提现金额不得超过余额
//获取账户信息
AccountInfo
accountInfo
=
accountMapper
.
getByUserId
(
dto
.
getUserId
());
if
(
null
!=
accountInfo
)
{
if
(
null
==
accountInfo
)
{
return
R
.
error
(
"账户信息不存在!"
);
}
if
(
accountInfo
.
getFrozenStatus
().
equals
(
FrozenStatus
.
ALREADY_FROZEN
.
getCode
()))
{
return
R
.
error
(
"您的账户已被冻结,不能提现!"
);
}
if
(
dto
.
getMoney
()
>
accountInfo
.
getExtractMoney
().
doubleValue
())
{
return
R
.
error
(
"提现金额不得超过余额"
);
}
}
//2、验证短信验证码
//判断缓存是否过期
assert
accountInfo
!=
null
;
String
phone
=
accountInfo
.
getUserId
();
String
code
=
dto
.
getCode
();
String
key
=
StringUtil
.
formatKeyWithPrefix
(
Constants
.
RedisKey
.
BANK_PRIFIX
,
Constants
.
RedisKey
.
SMS_PRIFIX
,
phone
,
code
+
""
);
...
...
@@ -157,6 +164,7 @@ public class BankServiceImpl extends ServiceImpl<BankInfoMapper, BankInfo> imple
if
(
time
<
0
)
{
return
R
.
error
(
1
,
"验证码已过期!"
,
false
);
}
//3、添加提现交易流水记录
TradeRecord
tradeRecord
=
new
TradeRecord
();
tradeRecord
.
setUserId
(
accountInfo
.
getUserId
());
...
...
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