Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
118e6226
Commit
118e6226
authored
Oct 09, 2018
by
Junling Bu
Browse files
fix[litemall-admin-api]: 事务管理失败时,返回前台错误信息。
parent
8dae438d
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-admin-api/src/main/java/org/linlinjava/litemall/admin/web/AdminGoodsController.java
View file @
118e6226
...
@@ -16,6 +16,7 @@ import org.springframework.transaction.PlatformTransactionManager;
...
@@ -16,6 +16,7 @@ import org.springframework.transaction.PlatformTransactionManager;
import
org.springframework.transaction.TransactionDefinition
;
import
org.springframework.transaction.TransactionDefinition
;
import
org.springframework.transaction.TransactionStatus
;
import
org.springframework.transaction.TransactionStatus
;
import
org.springframework.transaction.support.DefaultTransactionDefinition
;
import
org.springframework.transaction.support.DefaultTransactionDefinition
;
import
org.springframework.util.StringUtils
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -133,6 +134,7 @@ public class AdminGoodsController {
...
@@ -133,6 +134,7 @@ public class AdminGoodsController {
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
txManager
.
rollback
(
status
);
txManager
.
rollback
(
status
);
logger
.
error
(
"系统内部错误"
,
ex
);
logger
.
error
(
"系统内部错误"
,
ex
);
return
ResponseUtil
.
fail
();
}
}
txManager
.
commit
(
status
);
txManager
.
commit
(
status
);
...
@@ -161,6 +163,7 @@ public class AdminGoodsController {
...
@@ -161,6 +163,7 @@ public class AdminGoodsController {
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
txManager
.
rollback
(
status
);
txManager
.
rollback
(
status
);
logger
.
error
(
"系统内部错误"
,
ex
);
logger
.
error
(
"系统内部错误"
,
ex
);
return
ResponseUtil
.
fail
();
}
}
txManager
.
commit
(
status
);
txManager
.
commit
(
status
);
return
ResponseUtil
.
ok
();
return
ResponseUtil
.
ok
();
...
@@ -195,9 +198,11 @@ public class AdminGoodsController {
...
@@ -195,9 +198,11 @@ public class AdminGoodsController {
//将生成的分享图片地址写入数据库
//将生成的分享图片地址写入数据库
String
url
=
qCodeService
.
createGoodShareImage
(
goods
.
getId
().
toString
(),
goods
.
getPicUrl
(),
goods
.
getName
());
String
url
=
qCodeService
.
createGoodShareImage
(
goods
.
getId
().
toString
(),
goods
.
getPicUrl
(),
goods
.
getName
());
goods
.
setShareUrl
(
url
);
if
(!
StringUtils
.
isEmpty
(
url
))
{
if
(
goodsService
.
updateById
(
goods
)
==
0
){
goods
.
setShareUrl
(
url
);
throw
new
Exception
(
"跟新数据已失效"
);
if
(
goodsService
.
updateById
(
goods
)
==
0
)
{
throw
new
Exception
(
"跟新数据已失效"
);
}
}
}
// 商品规格表litemall_goods_specification
// 商品规格表litemall_goods_specification
...
@@ -223,6 +228,7 @@ public class AdminGoodsController {
...
@@ -223,6 +228,7 @@ public class AdminGoodsController {
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
txManager
.
rollback
(
status
);
txManager
.
rollback
(
status
);
logger
.
error
(
"系统内部错误"
,
ex
);
logger
.
error
(
"系统内部错误"
,
ex
);
return
ResponseUtil
.
fail
();
}
}
txManager
.
commit
(
status
);
txManager
.
commit
(
status
);
...
...
Write
Preview
Supports
Markdown
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