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
b8aaaf01
Commit
b8aaaf01
authored
Sep 14, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查重边际条件
parent
551bd9ea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
8 deletions
+15
-8
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+4
-1
ThemeTextCheckService.java
...va/com/tanpu/community/service/ThemeTextCheckService.java
+11
-7
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
b8aaaf01
...
...
@@ -951,6 +951,9 @@ public class ThemeManager {
}
/**
* 查重初始化
*/
@Transactional
public
void
initThemeTextCheck
()
{
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryLatestThemes
(
30
);
...
...
@@ -959,7 +962,7 @@ public class ThemeManager {
List
<
ThemeContentQo
>
content
=
themeQo
.
getContent
();
for
(
ThemeContentQo
themeContentQo
:
content
)
{
if
(
themeContentQo
.
getType
().
equals
(
RelTypeEnum
.
TEXT
.
type
))
{
if
(
themeContentQo
.
getValue
().
length
()
>
50
)
if
(
StringUtils
.
isNotBlank
(
themeContentQo
.
getValue
())
&&
themeContentQo
.
getValue
().
length
()
>
50
)
themeTextCheckService
.
insertInit
(
themeContentQo
.
getValue
(),
themeQo
.
getThemeId
(),
themeQo
.
getAuthorId
(),
TimeUtils
.
getDateTimeOfTimestamp
(
themeQo
.
getCreateTime
()),
themeQo
.
getThemeType
());
}
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeTextCheckService.java
View file @
b8aaaf01
...
...
@@ -25,19 +25,23 @@ public class ThemeTextCheckService {
// 插入
public
void
insert
(
String
content
,
String
themeId
,
String
userId
,
Integer
themeType
,
String
editThemeId
)
{
try
{
if
(
StringUtils
.
isNotBlank
(
editThemeId
)){
if
(
StringUtils
.
isBlank
(
content
)
||
content
.
length
()
<
50
)
{
return
;
}
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
);
insert
(
themeId
,
trim
,
getHash
(
trim
),
i
+
1
,
split
.
length
,
userId
,
themeType
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"文本查重insert失败,themeId:"
+
themeId
);
}
catch
(
Exception
e
)
{
log
.
error
(
"文本查重insert失败,themeId:"
+
themeId
);
}
}
...
...
@@ -47,7 +51,7 @@ public class ThemeTextCheckService {
themeCheckDuplicateMapper
.
deleteByThemeId
(
themeId
);
}
private
void
insert
(
String
themeId
,
String
partition
,
Integer
partitionHash
,
Integer
num
,
Integer
total
,
String
userId
,
Integer
themeType
)
{
private
void
insert
(
String
themeId
,
String
partition
,
Integer
partitionHash
,
Integer
num
,
Integer
total
,
String
userId
,
Integer
themeType
)
{
ThemeCheckDuplicateEntity
build
=
ThemeCheckDuplicateEntity
.
builder
()
.
themeId
(
themeId
)
...
...
@@ -103,7 +107,7 @@ public class ThemeTextCheckService {
}
// 初始化
public
void
insertInit
(
String
content
,
String
themeId
,
String
userId
,
LocalDateTime
createTime
,
Integer
themeType
)
{
public
void
insertInit
(
String
content
,
String
themeId
,
String
userId
,
LocalDateTime
createTime
,
Integer
themeType
)
{
themeCheckDuplicateMapper
.
deleteByThemeId
(
themeId
);
content
=
content
.
replaceAll
(
regex
,
"。"
);
...
...
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