Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in
Toggle navigation
T
tanpu-community
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
探普后端
tanpu-community
Commits
4e7816dd
Commit
4e7816dd
authored
Aug 06, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
类型参数校验
parent
252e22eb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+9
-3
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
4e7816dd
...
...
@@ -52,6 +52,7 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.HashSet
;
...
...
@@ -160,6 +161,8 @@ public class ThemeManager {
if
(
CollectionUtils
.
isEmpty
(
req
.
getContent
()))
{
throw
new
BizException
(
"正文内容不能为空"
);
}
//校验参数
checkAttachment
(
req
.
getContent
());
// 保存主题表
ThemeEntity
themeEntity
=
new
ThemeEntity
();
...
...
@@ -169,8 +172,7 @@ public class ThemeManager {
checkContent
(
req
);
themeEntity
.
setContent
(
JsonUtil
.
toJson
(
req
.
getContent
()));
//附件校验
checkAttachment
(
req
.
getContent
());
if
(
StringUtils
.
isBlank
(
req
.
getEditThemeId
()))
{
// 新建
...
...
@@ -207,9 +209,13 @@ public class ThemeManager {
*/
private
void
checkAttachment
(
List
<
ThemeContentReq
>
themeAttachments
)
{
for
(
ThemeContentReq
content
:
themeAttachments
)
{
if
(
content
.
getType
()
==
null
)
{
if
(
content
.
getType
()
==
null
)
{
throw
new
IllegalArgumentException
(
"主题内容ThemeContentReq缺少类型"
);
}
Set
<
String
>
types
=
Arrays
.
stream
(
RelTypeEnum
.
values
()).
map
(
o
->
o
.
type
).
collect
(
Collectors
.
toSet
());
if
(!
types
.
contains
(
content
.
getType
())){
throw
new
IllegalArgumentException
(
"主题内容ThemeContentReq类型错误"
);
}
if
(
content
.
getType
().
equals
(
RelTypeEnum
.
FUND
.
type
))
{
if
(
content
.
getProductType
()
==
null
)
{
throw
new
IllegalArgumentException
(
"附件产品FUND缺少类型"
);
...
...
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