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
51f558a1
Commit
51f558a1
authored
Sep 16, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查重bug fix
parent
31064242
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
16 deletions
+27
-16
ThemeTextCheckService.java
...va/com/tanpu/community/service/ThemeTextCheckService.java
+27
-16
No files found.
community-service/src/main/java/com/tanpu/community/service/ThemeTextCheckService.java
View file @
51f558a1
...
...
@@ -18,6 +18,7 @@ import java.util.List;
@Slf4j
public
class
ThemeTextCheckService
{
public
static
final
int
SENTENCE_MIN_LENGTH
=
5
;
@Resource
private
ThemeCheckDuplicateMapper
themeCheckDuplicateMapper
;
...
...
@@ -37,8 +38,9 @@ public class ThemeTextCheckService {
String
[]
split
=
content
.
split
(
"。"
);
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
String
trim
=
StringUtils
.
trim
(
split
[
i
]);
if
(
trim
.
length
()
>
SENTENCE_MIN_LENGTH
)
{
insert
(
themeId
,
trim
,
getHash
(
trim
),
i
+
1
,
split
.
length
,
userId
,
themeType
);
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"文本查重insert失败,themeId:"
+
themeId
);
...
...
@@ -75,8 +77,15 @@ public class ThemeTextCheckService {
List
<
Integer
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
String
trim
=
StringUtils
.
trim
(
split
[
i
]);
if
(
trim
.
length
()
>
SENTENCE_MIN_LENGTH
)
{
list
.
add
(
getHash
(
trim
));
}
}
if
(
list
.
size
()
<=
2
)
{
return
false
;
}
// 一年以内
LambdaQueryWrapper
<
ThemeCheckDuplicateEntity
>
w
=
new
LambdaQueryWrapper
<
ThemeCheckDuplicateEntity
>().
in
(
ThemeCheckDuplicateEntity:
:
getPartitionHash
,
list
)
.
eq
(
ThemeCheckDuplicateEntity:
:
getDeleteTag
,
BizStatus
.
DeleteTag
.
tag_init
)
...
...
@@ -84,7 +93,7 @@ public class ThemeTextCheckService {
.
groupBy
(
ThemeCheckDuplicateEntity:
:
getThemeId
);
Integer
check
=
themeCheckDuplicateMapper
.
check
(
w
);
// 重复率大于80%
if
(
check
!=
null
&&
check
*
10
>=
split
.
length
*
8
)
{
if
(
check
!=
null
&&
check
>=
list
.
size
()
*
0.
8
)
{
return
true
;
}
return
false
;
...
...
@@ -114,7 +123,7 @@ public class ThemeTextCheckService {
String
[]
split
=
content
.
split
(
"。"
);
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
String
trim
=
StringUtils
.
trim
(
split
[
i
]);
if
(
trim
.
length
()
>
SENTENCE_MIN_LENGTH
)
{
ThemeCheckDuplicateEntity
build
=
ThemeCheckDuplicateEntity
.
builder
()
.
themeId
(
themeId
)
.
partitionText
(
trim
)
...
...
@@ -129,6 +138,8 @@ public class ThemeTextCheckService {
themeCheckDuplicateMapper
.
insert
(
build
);
}
}
}
...
...
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