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
384a8053
Commit
384a8053
authored
Sep 14, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查重
parent
89d143f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
7 deletions
+13
-7
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+2
-1
ThemeTextCheckService.java
...va/com/tanpu/community/service/ThemeTextCheckService.java
+11
-6
No files found.
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
384a8053
...
@@ -959,7 +959,8 @@ public class ThemeManager {
...
@@ -959,7 +959,8 @@ public class ThemeManager {
List
<
ThemeContentQo
>
content
=
themeQo
.
getContent
();
List
<
ThemeContentQo
>
content
=
themeQo
.
getContent
();
for
(
ThemeContentQo
themeContentQo
:
content
)
{
for
(
ThemeContentQo
themeContentQo
:
content
)
{
if
(
themeContentQo
.
getType
().
equals
(
RelTypeEnum
.
TEXT
.
type
))
{
if
(
themeContentQo
.
getType
().
equals
(
RelTypeEnum
.
TEXT
.
type
))
{
themeTextCheckService
.
insertInit
(
themeContentQo
.
getValue
(),
themeQo
.
getThemeId
(),
themeQo
.
getAuthorId
(),
TimeUtils
.
getDateTimeOfTimestamp
(
themeQo
.
getCreateTime
()));
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 @
384a8053
...
@@ -31,7 +31,8 @@ public class ThemeTextCheckService {
...
@@ -31,7 +31,8 @@ public class ThemeTextCheckService {
String
[]
split
=
content
.
split
(
"。"
);
String
[]
split
=
content
.
split
(
"。"
);
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
String
trim
=
StringUtils
.
trim
(
split
[
i
]);
String
trim
=
StringUtils
.
trim
(
split
[
i
]);
insert
(
themeId
,
trim
,
getMD5
(
trim
),
i
+
1
,
split
.
length
,
userId
);
insert
(
themeId
,
trim
,
getHash
(
trim
),
i
+
1
,
split
.
length
,
userId
,
themeType
);
}
}
}
}
...
@@ -40,7 +41,7 @@ public class ThemeTextCheckService {
...
@@ -40,7 +41,7 @@ public class ThemeTextCheckService {
themeCheckDuplicateMapper
.
deleteByThemeId
(
themeId
);
themeCheckDuplicateMapper
.
deleteByThemeId
(
themeId
);
}
}
private
void
insert
(
String
themeId
,
String
partition
,
String
partitionHash
,
Integer
num
,
Integer
total
,
String
userId
)
{
private
void
insert
(
String
themeId
,
String
partition
,
String
partitionHash
,
Integer
num
,
Integer
total
,
String
userId
,
Integer
themeType
)
{
ThemeCheckDuplicateEntity
build
=
ThemeCheckDuplicateEntity
.
builder
()
ThemeCheckDuplicateEntity
build
=
ThemeCheckDuplicateEntity
.
builder
()
.
themeId
(
themeId
)
.
themeId
(
themeId
)
...
@@ -49,6 +50,7 @@ public class ThemeTextCheckService {
...
@@ -49,6 +50,7 @@ public class ThemeTextCheckService {
.
partitionNum
(
num
)
.
partitionNum
(
num
)
.
totalParts
(
total
)
.
totalParts
(
total
)
.
userId
(
userId
)
.
userId
(
userId
)
.
themeType
(
themeType
)
.
build
();
.
build
();
themeCheckDuplicateMapper
.
insert
(
build
);
themeCheckDuplicateMapper
.
insert
(
build
);
}
}
...
@@ -63,7 +65,7 @@ public class ThemeTextCheckService {
...
@@ -63,7 +65,7 @@ public class ThemeTextCheckService {
List
<
String
>
list
=
new
ArrayList
<>();
List
<
String
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
split
.
length
;
i
++)
{
String
trim
=
StringUtils
.
trim
(
split
[
i
]);
String
trim
=
StringUtils
.
trim
(
split
[
i
]);
list
.
add
(
get
MD5
(
trim
));
list
.
add
(
get
Hash
(
trim
));
}
}
// 一年以内
// 一年以内
LambdaQueryWrapper
<
ThemeCheckDuplicateEntity
>
w
=
new
LambdaQueryWrapper
<
ThemeCheckDuplicateEntity
>().
in
(
ThemeCheckDuplicateEntity:
:
getPartitionHash
,
list
)
LambdaQueryWrapper
<
ThemeCheckDuplicateEntity
>
w
=
new
LambdaQueryWrapper
<
ThemeCheckDuplicateEntity
>().
in
(
ThemeCheckDuplicateEntity:
:
getPartitionHash
,
list
)
...
@@ -79,7 +81,7 @@ public class ThemeTextCheckService {
...
@@ -79,7 +81,7 @@ public class ThemeTextCheckService {
}
}
public
static
String
get
MD5
(
String
str
)
{
public
static
String
get
Hash
(
String
str
)
{
try
{
try
{
// 生成一个MD5加密计算摘要
// 生成一个MD5加密计算摘要
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
...
@@ -94,7 +96,7 @@ public class ThemeTextCheckService {
...
@@ -94,7 +96,7 @@ public class ThemeTextCheckService {
}
}
// 初始化
// 初始化
public
void
insertInit
(
String
content
,
String
themeId
,
String
userId
,
LocalDateTime
createTime
)
{
public
void
insertInit
(
String
content
,
String
themeId
,
String
userId
,
LocalDateTime
createTime
,
Integer
themeType
)
{
themeCheckDuplicateMapper
.
deleteByThemeId
(
themeId
);
themeCheckDuplicateMapper
.
deleteByThemeId
(
themeId
);
content
=
content
.
replaceAll
(
regex
,
"。"
);
content
=
content
.
replaceAll
(
regex
,
"。"
);
...
@@ -105,15 +107,18 @@ public class ThemeTextCheckService {
...
@@ -105,15 +107,18 @@ public class ThemeTextCheckService {
ThemeCheckDuplicateEntity
build
=
ThemeCheckDuplicateEntity
.
builder
()
ThemeCheckDuplicateEntity
build
=
ThemeCheckDuplicateEntity
.
builder
()
.
themeId
(
themeId
)
.
themeId
(
themeId
)
.
partitionText
(
trim
)
.
partitionText
(
trim
)
.
partitionHash
(
get
MD5
(
split
[
i
]))
.
partitionHash
(
get
Hash
(
split
[
i
]))
.
partitionNum
(
i
+
1
)
.
partitionNum
(
i
+
1
)
.
totalParts
(
split
.
length
)
.
totalParts
(
split
.
length
)
.
userId
(
userId
)
.
userId
(
userId
)
.
themeType
(
themeType
)
.
createTime
(
createTime
)
.
createTime
(
createTime
)
.
updateTime
(
createTime
)
.
updateTime
(
createTime
)
.
build
();
.
build
();
themeCheckDuplicateMapper
.
insert
(
build
);
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