Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
dj
/
rpc-dj-goods-listing
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 9ef04287
authored
May 15, 2026
by
周立明
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
refactor(goods-listing): 异步处理商品上架逻辑并增加异常捕获
将原同步的商品上架处理改为异步执行,同时添加全局异常捕获避免事务同步回调出错影响主流程
1 parent
b17ec07d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
10 deletions
rpc-dj-goods-listing/src/main/java/cn/com/glsx/dj/goods/listing/service/GoodsListingApprovalService.java
rpc-dj-goods-listing/src/main/java/cn/com/glsx/dj/goods/listing/service/GoodsListingApprovalService.java
View file @
9ef0428
...
@@ -407,16 +407,22 @@ public class GoodsListingApprovalService {
...
@@ -407,16 +407,22 @@ public class GoodsListingApprovalService {
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronizationAdapter
()
{
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronizationAdapter
()
{
@Override
@Override
public
void
afterCommit
()
{
public
void
afterCommit
()
{
if
(
CollectionUtils
.
isNotEmpty
(
context
.
details
)){
try
{
context
.
details
.
forEach
(
item
->{
taskExecutor
.
execute
(()
->
{
MerchantGoodsInfoDTO
merchantGoodsInfo
=
MerchantGoodsInfoDTO
.
builder
()
if
(
CollectionUtils
.
isNotEmpty
(
context
.
details
)){
.
updatedBy
(
updatedBy
)
context
.
details
.
forEach
(
item
->{
.
merchantGoodsCodeList
(
Arrays
.
asList
(
item
.
getMerchantGoodsCode
()))
MerchantGoodsInfoDTO
merchantGoodsInfo
=
MerchantGoodsInfoDTO
.
builder
()
.
build
();
.
updatedBy
(
updatedBy
)
RpcResponse
<
Boolean
>
res
=
merchantGoodsInfoRemote
.
onShelfHandler
(
merchantGoodsInfo
);
.
merchantGoodsCodeList
(
Arrays
.
asList
(
item
.
getMerchantGoodsCode
()))
log
.
info
(
"上架ID:{}处理完成,处理结果:{}"
,
item
.
getMerchantGoodsCode
(),
res
);
.
build
();
});
RpcResponse
<
Boolean
>
res
=
merchantGoodsInfoRemote
.
onShelfHandler
(
merchantGoodsInfo
);
}
log
.
info
(
"上架ID:{}处理完成,处理结果:{}"
,
item
.
getMerchantGoodsCode
(),
res
);
});
}
});
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
});
});
}
catch
(
RpcServiceException
e
)
{
}
catch
(
RpcServiceException
e
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment