Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cust-api
Project
Project
Details
Activity
Releases
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
李伟
cust-api
Commits
91c884c6
Commit
91c884c6
authored
Feb 27, 2025
by
liwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改了互换微信bug
parent
170f687c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
7 deletions
+25
-7
MemInfoServiceImpl.java
...oft/business/memInfo/service/impl/MemInfoServiceImpl.java
+25
-7
No files found.
src/main/java/org/rcisoft/business/memInfo/service/impl/MemInfoServiceImpl.java
View file @
91c884c6
...
@@ -882,8 +882,6 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
...
@@ -882,8 +882,6 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
DictData
dictData2
=
userLikeConfig
.
stream
().
filter
(
item
->
item
.
getDictLabel
().
equals
(
"accept_exchange_wechat"
)).
findFirst
().
orElse
(
null
);
DictData
dictData2
=
userLikeConfig
.
stream
().
filter
(
item
->
item
.
getDictLabel
().
equals
(
"accept_exchange_wechat"
)).
findFirst
().
orElse
(
null
);
Integer
requestGoldCoinCount
=
Integer
.
valueOf
(
dictData1
.
getDictValue
());
//发起请求需消耗的金币数
Integer
requestGoldCoinCount
=
Integer
.
valueOf
(
dictData1
.
getDictValue
());
//发起请求需消耗的金币数
Integer
acceptGoldCoinCount
=
Integer
.
valueOf
(
dictData2
.
getDictValue
());
//接收需消耗的金币数
Integer
acceptGoldCoinCount
=
Integer
.
valueOf
(
dictData2
.
getDictValue
());
//接收需消耗的金币数
// Integer requestGoldCoinCount = Integer.valueOf('1');//发起请求需消耗的金币数
// Integer acceptGoldCoinCount = Integer.valueOf('1');//接收需消耗的金币数
if
(
memUserTaskDTO
.
getType
().
equals
(
"1"
)){
if
(
memUserTaskDTO
.
getType
().
equals
(
"1"
)){
//发起请求
//发起请求
//扣除该用户的金币数量
//扣除该用户的金币数量
...
@@ -894,17 +892,27 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
...
@@ -894,17 +892,27 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
isGetLock
=
lock
.
tryLock
(
Long
.
parseLong
(
MemberInfoRedisBean
.
USER_WECHAT_TASK_LOCK_WAIT_TIME
),
isGetLock
=
lock
.
tryLock
(
Long
.
parseLong
(
MemberInfoRedisBean
.
USER_WECHAT_TASK_LOCK_WAIT_TIME
),
Long
.
parseLong
(
MemberInfoRedisBean
.
USER_WECHAT_LOCK_LEASE_TIME
),
TimeUnit
.
SECONDS
);
Long
.
parseLong
(
MemberInfoRedisBean
.
USER_WECHAT_LOCK_LEASE_TIME
),
TimeUnit
.
SECONDS
);
if
(
isGetLock
)
{
if
(
isGetLock
)
{
//查询用户信息
MemInfo
memInfo
=
memInfoRepository
.
selectByOpenId
(
memUserTaskDTO
.
getWxOpenid
());
MemInfo
memInfo
=
memInfoRepository
.
selectByOpenId
(
memUserTaskDTO
.
getWxOpenid
());
if
(
memInfo
.
getGoldCoinsCount
()
-
acceptGoldCoinCount
<
0
){
if
(
memInfo
.
getGoldCoinsCount
()
-
acceptGoldCoinCount
<
0
){
throw
new
CyServiceException
(
1003
,
"金币余额不足,请先充值"
);
throw
new
CyServiceException
(
1003
,
"金币余额不足,请先充值"
);
}
}
memInfo
.
setGoldCoinsCount
(
memInfo
.
getGoldCoinsCount
()
-
acceptGoldCoinCount
);
memInfoRepository
.
updateById
(
memInfo
);
//添加索要微信任务
//添加索要微信任务
memUserTaskDTO
.
setStatus
(
"0"
);
memUserTaskDTO
.
setStatus
(
"0"
);
line
=
baseMapper
.
addWeChatTask
(
memUserTaskDTO
);
line
=
baseMapper
.
addWeChatTask
(
memUserTaskDTO
);
//增加金币流水记录
MemGoldCoinFlow
memGoldCoinFlow
=
new
MemGoldCoinFlow
();
memGoldCoinFlow
.
setUpdateBy
(
String
.
valueOf
(
createBy
));
memGoldCoinFlow
.
setCount
(
acceptGoldCoinCount
);
memGoldCoinFlow
.
setEndCount
(
memInfo
.
getGoldCoinsCount
()
-
acceptGoldCoinCount
);
memGoldCoinFlow
.
setType
(
"2"
);
memGoldCoinFlow
.
setActionType
(
"24"
);
memGoldCoinFlowRepository
.
insert
(
memGoldCoinFlow
);
//修改用户金币数量
memInfo
.
setGoldCoinsCount
(
memInfo
.
getGoldCoinsCount
()
-
acceptGoldCoinCount
);
memInfoRepository
.
updateById
(
memInfo
);
lock
.
unlock
();
}
}
lock
.
unlock
();
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
Thread
.
currentThread
().
interrupt
();
lock
.
unlock
();
lock
.
unlock
();
...
@@ -927,14 +935,24 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
...
@@ -927,14 +935,24 @@ public class MemInfoServiceImpl extends ServiceImpl<MemInfoRepository,MemInfo>
isGetLock
=
lock
.
tryLock
(
Long
.
parseLong
(
MemberInfoRedisBean
.
USER_WECHAT_TASK_LOCK_WAIT_TIME
),
isGetLock
=
lock
.
tryLock
(
Long
.
parseLong
(
MemberInfoRedisBean
.
USER_WECHAT_TASK_LOCK_WAIT_TIME
),
Long
.
parseLong
(
MemberInfoRedisBean
.
USER_WECHAT_LOCK_LEASE_TIME
),
TimeUnit
.
SECONDS
);
Long
.
parseLong
(
MemberInfoRedisBean
.
USER_WECHAT_LOCK_LEASE_TIME
),
TimeUnit
.
SECONDS
);
if
(
isGetLock
)
{
if
(
isGetLock
)
{
//查询用户信息
MemInfo
memInfo
=
memInfoRepository
.
selectByOpenId
(
memUserTaskDTO
.
getWxOpenid
());
MemInfo
memInfo
=
memInfoRepository
.
selectByOpenId
(
memUserTaskDTO
.
getWxOpenid
());
if
(
memInfo
.
getGoldCoinsCount
()
-
requestGoldCoinCount
<
0
){
if
(
memInfo
.
getGoldCoinsCount
()
-
requestGoldCoinCount
<
0
){
throw
new
CyServiceException
(
1003
,
"金币余额不足,请先充值"
);
throw
new
CyServiceException
(
1003
,
"金币余额不足,请先充值"
);
}
}
memInfo
.
setGoldCoinsCount
(
memInfo
.
getGoldCoinsCount
()
-
requestGoldCoinCount
);
memInfoRepository
.
updateById
(
memInfo
);
//修改微信任务
//修改微信任务
line
=
baseMapper
.
updateWeChatTask
(
memUserTaskDTO
);
line
=
baseMapper
.
updateWeChatTask
(
memUserTaskDTO
);
//添加金币流水记录
MemGoldCoinFlow
memGoldCoinFlow
=
new
MemGoldCoinFlow
();
memGoldCoinFlow
.
setUpdateBy
(
String
.
valueOf
(
createBy
));
memGoldCoinFlow
.
setCount
(
requestGoldCoinCount
);
memGoldCoinFlow
.
setEndCount
(
memInfo
.
getGoldCoinsCount
()
-
requestGoldCoinCount
);
memGoldCoinFlow
.
setType
(
"2"
);
memGoldCoinFlow
.
setActionType
(
"23"
);
memGoldCoinFlowRepository
.
insert
(
memGoldCoinFlow
);
//修改用户金币数量
memInfo
.
setGoldCoinsCount
(
memInfo
.
getGoldCoinsCount
()
-
requestGoldCoinCount
);
memInfoRepository
.
updateById
(
memInfo
);
lock
.
unlock
();
lock
.
unlock
();
}
}
}
catch
(
InterruptedException
e
)
{
}
catch
(
InterruptedException
e
)
{
...
...
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