Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
C
clx-performance
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
姜武杰
clx-performance
Commits
bb83a418
提交
bb83a418
authored
10月 19, 2023
作者:
huyufan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
冻结资金相关
上级
3ff63f73
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
77 行增加
和
47 行删除
+77
-47
OwnerAccountDao.java
...rc/main/java/com/clx/performance/dao/OwnerAccountDao.java
+4
-1
OwnerAccountDaoImpl.java
...ava/com/clx/performance/dao/impl/OwnerAccountDaoImpl.java
+12
-7
OwnerAccountMapper.java
...n/java/com/clx/performance/mapper/OwnerAccountMapper.java
+8
-4
OwnerAccountServiceImpl.java
...clx/performance/service/impl/OwnerAccountServiceImpl.java
+28
-20
OwnerAccountSqlProvider.java
.../clx/performance/sqlProvider/OwnerAccountSqlProvider.java
+25
-15
没有找到文件。
performance-web/src/main/java/com/clx/performance/dao/OwnerAccountDao.java
浏览文件 @
bb83a418
...
@@ -17,5 +17,8 @@ public interface OwnerAccountDao extends BaseDao<OwnerAccountMapper, OwnerAccoun
...
@@ -17,5 +17,8 @@ public interface OwnerAccountDao extends BaseDao<OwnerAccountMapper, OwnerAccoun
OwnerAccount
getAccountByOwnerUserNoAndAccountType
(
Long
ownerUserNo
,
Integer
accountType
);
OwnerAccount
getAccountByOwnerUserNoAndAccountType
(
Long
ownerUserNo
,
Integer
accountType
);
int
updateAccount
(
OwnerAccount
account
,
LocalDateTime
now
);
int
updateOwnerAccountForConfirm
(
OwnerAccount
account
);
int
updateAccountCAS
(
OwnerAccount
account
,
LocalDateTime
now
,
boolean
flag
);
}
}
performance-web/src/main/java/com/clx/performance/dao/impl/OwnerAccountDaoImpl.java
浏览文件 @
bb83a418
...
@@ -37,14 +37,19 @@ public class OwnerAccountDaoImpl extends BaseDaoImpl<OwnerAccountMapper, OwnerAc
...
@@ -37,14 +37,19 @@ public class OwnerAccountDaoImpl extends BaseDaoImpl<OwnerAccountMapper, OwnerAc
return
baseMapper
.
selectOne
(
lQrWrapper
().
eq
(
OwnerAccount:
:
getAccountType
,
accountType
).
eq
(
OwnerAccount:
:
getOwnerUserNo
,
ownerUserNo
));
return
baseMapper
.
selectOne
(
lQrWrapper
().
eq
(
OwnerAccount:
:
getAccountType
,
accountType
).
eq
(
OwnerAccount:
:
getOwnerUserNo
,
ownerUserNo
));
}
}
@Override
public
int
updateOwnerAccountForConfirm
(
OwnerAccount
account
)
{
return
baseMapper
.
updateOwnerAccountForConfirm
(
account
);
}
@Override
@Override
public
int
updateAccount
(
OwnerAccount
account
,
LocalDateTime
now
)
{
public
int
updateAccountCAS
(
OwnerAccount
account
,
LocalDateTime
now
,
boolean
flag
)
{
return
baseMapper
.
updateAccount
(
account
,
now
);
if
(
flag
)
{
// if (flag) {
return
baseMapper
.
addAccount
(
account
,
now
);
// baseMapper.addAccount(account, now);
}
else
{
// } else {
return
baseMapper
.
subAccount
(
account
,
now
);
// baseMapper.subAccount(account, now);
}
// }
}
}
...
...
performance-web/src/main/java/com/clx/performance/mapper/OwnerAccountMapper.java
浏览文件 @
bb83a418
...
@@ -22,9 +22,12 @@ public interface OwnerAccountMapper extends BaseMapper<OwnerAccount> {
...
@@ -22,9 +22,12 @@ public interface OwnerAccountMapper extends BaseMapper<OwnerAccount> {
@SelectProvider
(
type
=
OwnerAccountSqlProvider
.
class
,
method
=
"pageList"
)
@SelectProvider
(
type
=
OwnerAccountSqlProvider
.
class
,
method
=
"pageList"
)
IPage
<
OwnerAccountVO
>
pageList
(
Page
<
OwnerAccountVO
>
page
,
PageOwnerAccountListParam
param
);
IPage
<
OwnerAccountVO
>
pageList
(
Page
<
OwnerAccountVO
>
page
,
PageOwnerAccountListParam
param
);
@SelectProvider
(
type
=
OwnerAccountSqlProvider
.
class
,
method
=
"
update
Account"
)
@SelectProvider
(
type
=
OwnerAccountSqlProvider
.
class
,
method
=
"
add
Account"
)
int
update
Account
(
OwnerAccount
account
,
LocalDateTime
now
);
int
add
Account
(
OwnerAccount
account
,
LocalDateTime
now
);
// @SelectProvider(type = OwnerAccountSqlProvider.class, method = "subAccount")
@SelectProvider
(
type
=
OwnerAccountSqlProvider
.
class
,
method
=
"subAccount"
)
// int subAccount(OwnerAccount account, LocalDateTime now);
int
subAccount
(
OwnerAccount
account
,
LocalDateTime
now
);
@SelectProvider
(
type
=
OwnerAccountSqlProvider
.
class
,
method
=
"updateOwnerAccountForConfirm"
)
int
updateOwnerAccountForConfirm
(
OwnerAccount
account
);
}
}
\ No newline at end of file
performance-web/src/main/java/com/clx/performance/service/impl/OwnerAccountServiceImpl.java
浏览文件 @
bb83a418
...
@@ -140,11 +140,12 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
...
@@ -140,11 +140,12 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
//冻结账户可用金额
//冻结账户可用金额
OwnerAccount
account
=
ownerAccountDao
.
getAccountByOwnerUserNoAndAccountType
(
param
.
getOwnerUserNo
(),
param
.
getAccountType
());
OwnerAccount
account
=
ownerAccountDao
.
getAccountByOwnerUserNoAndAccountType
(
param
.
getOwnerUserNo
(),
param
.
getAccountType
());
OwnerAccount
update
=
new
OwnerAccount
();
OwnerAccount
update
=
new
OwnerAccount
();
update
.
setUsableBalance
(
caseOutBalance
.
negate
()
);
update
.
setUsableBalance
(
caseOutBalance
);
update
.
setFrozenBalance
(
caseOutBalance
);
update
.
setFrozenBalance
(
caseOutBalance
);
update
.
setAccountBalance
(
caseOutBalance
);
update
.
setModifiedTime
(
account
.
getModifiedTime
());
update
.
setModifiedTime
(
account
.
getModifiedTime
());
update
.
setId
(
account
.
getId
());
update
.
setId
(
account
.
getId
());
int
flag
=
ownerAccountDao
.
updateAccount
(
update
,
now
);
int
flag
=
ownerAccountDao
.
updateAccount
CAS
(
update
,
now
,
false
);
if
(
flag
>
0
)
{
if
(
flag
>
0
)
{
break
;
break
;
}
}
...
@@ -190,7 +191,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
...
@@ -190,7 +191,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
update
.
setFrozenBalance
(
caseOutBalance
);
update
.
setFrozenBalance
(
caseOutBalance
);
update
.
setModifiedTime
(
account
.
getModifiedTime
());
update
.
setModifiedTime
(
account
.
getModifiedTime
());
update
.
setId
(
account
.
getId
());
update
.
setId
(
account
.
getId
());
int
flag
=
ownerAccountDao
.
updateAccount
(
update
,
now
);
int
flag
=
ownerAccountDao
.
updateAccount
CAS
(
update
,
now
,
false
);
if
(
flag
>
0
)
{
if
(
flag
>
0
)
{
break
;
break
;
}
}
...
@@ -250,7 +251,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
...
@@ -250,7 +251,7 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
update
.
setUsableBalance
(
topUpBalance
);
update
.
setUsableBalance
(
topUpBalance
);
update
.
setId
(
account
.
getId
());
update
.
setId
(
account
.
getId
());
update
.
setModifiedTime
(
account
.
getModifiedTime
());
update
.
setModifiedTime
(
account
.
getModifiedTime
());
int
flag
=
ownerAccountDao
.
updateAccount
(
update
,
now
);
int
flag
=
ownerAccountDao
.
updateAccount
CAS
(
update
,
now
,
true
);
if
(
flag
>
0
)
{
if
(
flag
>
0
)
{
break
;
break
;
}
}
...
@@ -296,6 +297,8 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
...
@@ -296,6 +297,8 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
@Override
@Override
public
void
accountBalanceConfirm
(
Integer
id
)
{
public
void
accountBalanceConfirm
(
Integer
id
)
{
UserSessionData
loginUserInfo
=
TokenUtil
.
getLoginUserInfo
();
Optional
<
OwnerCaseOut
>
optional
=
ownerCaseOutDao
.
getEntityByKey
(
id
);
Optional
<
OwnerCaseOut
>
optional
=
ownerCaseOutDao
.
getEntityByKey
(
id
);
if
(!
optional
.
isPresent
())
{
if
(!
optional
.
isPresent
())
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前ID未查询到有效记录"
);
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前ID未查询到有效记录"
);
...
@@ -308,19 +311,24 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
...
@@ -308,19 +311,24 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
}
}
//给对应账户减少金额
//给对应账户减少金额
OwnerAccount
account
=
ownerAccountDao
.
getAccountByOwnerUserNoAndAccountType
(
ownerCaseOut
.
getOwnerUserNo
(),
ownerCaseOut
.
getAccountType
());
while
(
true
)
{
OwnerAccount
update
=
new
OwnerAccount
();
OwnerAccount
account
=
ownerAccountDao
.
getAccountByOwnerUserNoAndAccountType
(
ownerCaseOut
.
getOwnerUserNo
(),
ownerCaseOut
.
getAccountType
());
update
.
setAccountBalance
(
account
.
getAccountBalance
().
subtract
(
caseOutBalance
));
OwnerAccount
update
=
new
OwnerAccount
();
update
.
setUsableBalance
(
account
.
getUsableBalance
().
subtract
(
caseOutBalance
));
update
.
setFrozenBalance
(
caseOutBalance
);
update
.
setFrozenBalance
(
account
.
getFrozenBalance
().
subtract
(
caseOutBalance
));
update
.
setId
(
account
.
getId
());
update
.
setId
(
account
.
getId
());
update
.
setModifiedTime
(
account
.
getModifiedTime
());
ownerAccountDao
.
updateEntityByKey
(
update
);
int
flag
=
ownerAccountDao
.
updateOwnerAccountForConfirm
(
update
);
if
(
flag
>
0
)
{
break
;
}
}
//插入提现成功流水
//插入提现成功流水
OwnerRunningWaterRecord
runningWaterRecord
=
new
OwnerRunningWaterRecord
();
OwnerRunningWaterRecord
runningWaterRecord
=
new
OwnerRunningWaterRecord
();
runningWaterRecord
.
setOwnerName
(
"测试"
);
runningWaterRecord
.
setOwnerName
(
loginUserInfo
.
getUserName
()
);
runningWaterRecord
.
setMobile
(
"11111111111"
);
runningWaterRecord
.
setMobile
(
loginUserInfo
.
getUserMobile
()
);
runningWaterRecord
.
setCreateBy
(
"操作人"
);
runningWaterRecord
.
setCreateBy
(
loginUserInfo
.
getUserName
()
);
runningWaterRecord
.
setRelationId
(
ownerCaseOut
.
getCaseOutNo
());
runningWaterRecord
.
setRelationId
(
ownerCaseOut
.
getCaseOutNo
());
runningWaterRecord
.
setAccountBalance
(
caseOutBalance
);
runningWaterRecord
.
setAccountBalance
(
caseOutBalance
);
...
@@ -600,22 +608,22 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
...
@@ -600,22 +608,22 @@ public class OwnerAccountServiceImpl implements OwnerAccountService {
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前货主保证金账户可用余额不够冻结"
);
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前货主保证金账户可用余额不够冻结"
);
}
}
//冻结金额
//冻结金额
entity
.
setFrozenBalance
(
ownerAccount
.
getFrozenBalance
().
subtract
(
frozenBalance
)
);
entity
.
setFrozenBalance
(
frozenBalance
);
//可用余额
//可用余额
entity
.
setUsableBalance
(
ownerAccount
.
getUsableBalance
().
subtract
(
frozenBalance
)
);
entity
.
setUsableBalance
(
frozenBalance
);
//updateList.add(entity);
//updateList.add(entity);
flag
+=
ownerAccountDao
.
updateAccount
(
entity
,
now
);
flag
+=
ownerAccountDao
.
updateAccount
CAS
(
entity
,
now
,
false
);
}
else
{
}
else
{
if
(
ownerAccount
.
getUsableBalance
().
compareTo
(
ensureBalance
)
<
0
)
{
if
(
ownerAccount
.
getUsableBalance
().
compareTo
(
ensureBalance
)
<
0
)
{
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前货主预付运费账户可用余额不够冻结"
);
throw
new
ServiceSystemException
(
PerformanceResultEnum
.
HTTP_ERROR
,
"当前货主预付运费账户可用余额不够冻结"
);
}
}
//冻结金额
//冻结金额
entity
.
setFrozenBalance
(
ownerAccount
.
getFrozenBalance
().
subtract
(
ensureBalance
)
);
entity
.
setFrozenBalance
(
ensureBalance
);
//可用余额
//可用余额
entity
.
setUsableBalance
(
ownerAccount
.
getUsableBalance
().
subtract
(
ensureBalance
)
);
entity
.
setUsableBalance
(
ensureBalance
);
//updateList.add(entity);
//updateList.add(entity);
flag
+=
ownerAccountDao
.
updateAccount
(
entity
,
now
);
flag
+=
ownerAccountDao
.
updateAccount
CAS
(
entity
,
now
,
false
);
}
}
}
}
if
(
flag
==
2
)
{
if
(
flag
==
2
)
{
...
...
performance-web/src/main/java/com/clx/performance/sqlProvider/OwnerAccountSqlProvider.java
浏览文件 @
bb83a418
...
@@ -37,12 +37,11 @@ public class OwnerAccountSqlProvider {
...
@@ -37,12 +37,11 @@ public class OwnerAccountSqlProvider {
return
sql
;
return
sql
;
}
}
public
String
update
Account
(
OwnerAccount
account
,
LocalDateTime
now
)
{
public
String
add
Account
(
OwnerAccount
account
,
LocalDateTime
now
)
{
StringBuffer
sqlList
=
new
StringBuffer
();
StringBuffer
sqlList
=
new
StringBuffer
();
sqlList
.
append
(
"update owner_account set usable_balance = usable_balance +"
+
sqlList
.
append
(
"update owner_account set usable_balance = usable_balance +"
+
account
.
getUsableBalance
()
+
",frozen_balance = frozen_balance +"
account
.
getUsableBalance
()
+
",account_balance = account_balance +"
+
account
.
getUsableBalance
()
+
",account_balance = account_balance +"
+
account
.
getAccountBalance
()+
+
account
.
getAccountBalance
()+
",modified_time="
+
now
",modified_time="
+
now
+
"where id = "
+
account
.
getId
()
+
"and modified_time = "
+
account
.
getModifiedTime
()
+
"where id = "
+
account
.
getId
()
+
"and modified_time = "
+
account
.
getModifiedTime
()
...
@@ -50,16 +49,27 @@ public class OwnerAccountSqlProvider {
...
@@ -50,16 +49,27 @@ public class OwnerAccountSqlProvider {
return
sqlList
.
toString
();
return
sqlList
.
toString
();
}
}
//
// public String subAccount(OwnerAccount account, LocalDateTime now) {
public
String
subAccount
(
OwnerAccount
account
,
LocalDateTime
now
)
{
// StringBuffer sqlList = new StringBuffer();
StringBuffer
sqlList
=
new
StringBuffer
();
//
// sqlList.append("update owner_account set usable_balance = usable_balance -" +
sqlList
.
append
(
"update owner_account set usable_balance = usable_balance -"
+
// account.getUsableBalance() + ",frozen_balance = frozen_balance -"
account
.
getUsableBalance
()
+
",frozen_balance = frozen_balance +"
// + account.getUsableBalance() + ",modified_time=" + now
+
account
.
getFrozenBalance
()
+
",account_balance = account_balance -"
+
account
.
getFrozenBalance
()
// + "where id = " + account.getId() + "and modified_time = " + account.getModifyTime()
+
",modified_time="
+
now
// );
+
"where id = "
+
account
.
getId
()
+
"and modified_time = "
+
account
.
getModifiedTime
()
//
);
// return sqlList.toString();
// }
return
sqlList
.
toString
();
}
public
String
updateOwnerAccountForConfirm
(
OwnerAccount
account
)
{
StringBuffer
sqlList
=
new
StringBuffer
();
sqlList
.
append
(
"update owner_account set frozen_balance = frozen_balance -"
+
account
.
getFrozenBalance
()
+
"where id = "
+
account
.
getId
()
+
"and modified_time = "
+
account
.
getModifiedTime
()
);
return
sqlList
.
toString
();
}
}
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论