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
551bd9ea
Commit
551bd9ea
authored
Sep 14, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查重
parent
8d2a8dcb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
8 deletions
+15
-8
ThemeTextCheckService.java
...va/com/tanpu/community/service/ThemeTextCheckService.java
+15
-8
No files found.
community-service/src/main/java/com/tanpu/community/service/ThemeTextCheckService.java
View file @
551bd9ea
...
...
@@ -5,6 +5,7 @@ import com.tanpu.common.constant.BizStatus;
import
com.tanpu.community.dao.entity.community.ThemeCheckDuplicateEntity
;
import
com.tanpu.community.dao.mapper.community.ThemeCheckDuplicateMapper
;
import
com.tanpu.community.util.TimeUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -14,6 +15,7 @@ import java.util.ArrayList;
import
java.util.List
;
@Service
@Slf4j
public
class
ThemeTextCheckService
{
@Resource
...
...
@@ -23,16 +25,21 @@ public class ThemeTextCheckService {
// 插入
public
void
insert
(
String
content
,
String
themeId
,
String
userId
,
Integer
themeType
,
String
editThemeId
)
{
if
(
StringUtils
.
isNotBlank
(
editThemeId
)){
themeCheckDuplicateMapper
.
deleteByThemeId
(
editThemeId
);
try
{
if
(
StringUtils
.
isNotBlank
(
editThemeId
)){
themeCheckDuplicateMapper
.
deleteByThemeId
(
editThemeId
);
}
content
=
content
.
replaceAll
(
regex
,
"。"
);
String
[]
split
=
content
.
split
(
"。"
);
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
String
trim
=
StringUtils
.
trim
(
split
[
i
]);
insert
(
themeId
,
trim
,
getHash
(
trim
),
i
+
1
,
split
.
length
,
userId
,
themeType
);
}
}
catch
(
Exception
e
){
log
.
error
(
"文本查重insert失败,themeId:"
+
themeId
);
}
content
=
content
.
replaceAll
(
regex
,
"。"
);
String
[]
split
=
content
.
split
(
"。"
);
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
String
trim
=
StringUtils
.
trim
(
split
[
i
]);
insert
(
themeId
,
trim
,
getHash
(
trim
),
i
+
1
,
split
.
length
,
userId
,
themeType
);
}
}
// 删除
...
...
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