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
a4c0dc51
Commit
a4c0dc51
authored
Sep 14, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
查重
parent
6d18b645
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
24 deletions
+22
-24
CodeAutoGenerator.java
.../main/java/com/tanpu/community/dao/CodeAutoGenerator.java
+3
-3
ThemeCheckDuplicateEntity.java
...unity/dao/entity/community/ThemeCheckDuplicateEntity.java
+4
-4
ThemeTextCheckService.java
...va/com/tanpu/community/service/ThemeTextCheckService.java
+15
-17
No files found.
community-service/src/main/java/com/tanpu/community/dao/CodeAutoGenerator.java
View file @
a4c0dc51
...
@@ -19,9 +19,9 @@ public class CodeAutoGenerator {
...
@@ -19,9 +19,9 @@ public class CodeAutoGenerator {
String
currentPath
=
System
.
getProperty
(
"user.dir"
);
String
currentPath
=
System
.
getProperty
(
"user.dir"
);
String
codeBaseHome
=
"/community-service/src/main/java"
;
String
codeBaseHome
=
"/community-service/src/main/java"
;
String
author
=
"xudong"
;
String
author
=
"xudong"
;
String
mysqlUserName
=
"
tamp_admin
"
;
String
mysqlUserName
=
"
dev
"
;
String
mysqlPassword
=
"
@
imeng123"
;
String
mysqlPassword
=
"
q
imeng123"
;
String
jdbcUrl
=
"jdbc:mysql://rm-uf6
r22t3d798q4kmk
.mysql.rds.aliyuncs.com:3306/tamp_community"
;
String
jdbcUrl
=
"jdbc:mysql://rm-uf6
lqwk9969zao53uro
.mysql.rds.aliyuncs.com:3306/tamp_community"
;
// String[] tables = new String[]{"theme"};
// String[] tables = new String[]{"theme"};
String
[]
tables
=
new
String
[]{
"theme_check_duplicate"
};
String
[]
tables
=
new
String
[]{
"theme_check_duplicate"
};
String
basePackage
=
"com.tanpu.community"
;
String
basePackage
=
"com.tanpu.community"
;
...
...
community-service/src/main/java/com/tanpu/community/dao/entity/community/ThemeCheckDuplicateEntity.java
View file @
a4c0dc51
...
@@ -19,7 +19,7 @@ import java.time.LocalDateTime;
...
@@ -19,7 +19,7 @@ import java.time.LocalDateTime;
* </p>
* </p>
*
*
* @author xudong
* @author xudong
* @since 2021-09-
08
* @since 2021-09-
14
*/
*/
@Builder
@Builder
@Data
@Data
...
@@ -44,7 +44,7 @@ public class ThemeCheckDuplicateEntity implements Serializable {
...
@@ -44,7 +44,7 @@ public class ThemeCheckDuplicateEntity implements Serializable {
private
String
partitionText
;
private
String
partitionText
;
@ApiModelProperty
(
value
=
"分块hash"
)
@ApiModelProperty
(
value
=
"分块hash"
)
private
String
partitionHash
;
private
Integer
partitionHash
;
@ApiModelProperty
(
value
=
"分块号"
)
@ApiModelProperty
(
value
=
"分块号"
)
private
Integer
partitionNum
;
private
Integer
partitionNum
;
...
@@ -94,11 +94,11 @@ public class ThemeCheckDuplicateEntity implements Serializable {
...
@@ -94,11 +94,11 @@ public class ThemeCheckDuplicateEntity implements Serializable {
this
.
partitionText
=
partitionText
;
this
.
partitionText
=
partitionText
;
}
}
public
String
getPartitionHash
()
{
public
Integer
getPartitionHash
()
{
return
partitionHash
;
return
partitionHash
;
}
}
public
void
setPartitionHash
(
String
partitionHash
)
{
public
void
setPartitionHash
(
Integer
partitionHash
)
{
this
.
partitionHash
=
partitionHash
;
this
.
partitionHash
=
partitionHash
;
}
}
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeTextCheckService.java
View file @
a4c0dc51
...
@@ -2,7 +2,6 @@ package com.tanpu.community.service;
...
@@ -2,7 +2,6 @@ package com.tanpu.community.service;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.tanpu.common.constant.BizStatus
;
import
com.tanpu.common.constant.BizStatus
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.dao.entity.community.ThemeCheckDuplicateEntity
;
import
com.tanpu.community.dao.entity.community.ThemeCheckDuplicateEntity
;
import
com.tanpu.community.dao.mapper.community.ThemeCheckDuplicateMapper
;
import
com.tanpu.community.dao.mapper.community.ThemeCheckDuplicateMapper
;
import
com.tanpu.community.util.TimeUtils
;
import
com.tanpu.community.util.TimeUtils
;
...
@@ -10,8 +9,6 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -10,8 +9,6 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.math.BigInteger
;
import
java.security.MessageDigest
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -43,7 +40,7 @@ public class ThemeTextCheckService {
...
@@ -43,7 +40,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
,
Integer
themeType
)
{
private
void
insert
(
String
themeId
,
String
partition
,
Integer
partitionHash
,
Integer
num
,
Integer
total
,
String
userId
,
Integer
themeType
)
{
ThemeCheckDuplicateEntity
build
=
ThemeCheckDuplicateEntity
.
builder
()
ThemeCheckDuplicateEntity
build
=
ThemeCheckDuplicateEntity
.
builder
()
.
themeId
(
themeId
)
.
themeId
(
themeId
)
...
@@ -64,7 +61,7 @@ public class ThemeTextCheckService {
...
@@ -64,7 +61,7 @@ public class ThemeTextCheckService {
}
}
content
=
content
.
replaceAll
(
regex
,
"。"
);
content
=
content
.
replaceAll
(
regex
,
"。"
);
String
[]
split
=
content
.
split
(
"。"
);
String
[]
split
=
content
.
split
(
"。"
);
List
<
String
>
list
=
new
ArrayList
<>();
List
<
Integer
>
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
(
getHash
(
trim
));
list
.
add
(
getHash
(
trim
));
...
@@ -83,18 +80,19 @@ public class ThemeTextCheckService {
...
@@ -83,18 +80,19 @@ public class ThemeTextCheckService {
}
}
public
static
String
getHash
(
String
str
)
{
public
static
Integer
getHash
(
String
str
)
{
try
{
return
str
.
hashCode
();
// 生成一个MD5加密计算摘要
// try {
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
// // 生成一个MD5加密计算摘要
// 计算md5函数
// MessageDigest md = MessageDigest.getInstance("MD5");
md
.
update
(
str
.
getBytes
());
// // 计算md5函数
// digest()最后确定返回md5 hash值,返回值为8为字符串。因为md5 hash值是16位的hex值,实际上就是8位的字符
// md.update(str.getBytes());
// BigInteger函数则将8位的字符串转换成16位hex值,用字符串来表示;得到字符串形式的hash值
// // digest()最后确定返回md5 hash值,返回值为8为字符串。因为md5 hash值是16位的hex值,实际上就是8位的字符
return
new
BigInteger
(
1
,
md
.
digest
()).
toString
(
16
);
// // BigInteger函数则将8位的字符串转换成16位hex值,用字符串来表示;得到字符串形式的hash值
}
catch
(
Exception
e
)
{
// return new BigInteger(1, md.digest()).toString(16);
throw
new
BizException
(
"MD5加密出现错误"
);
// } catch (Exception e) {
}
// throw new BizException("MD5加密出现错误");
// }
}
}
// 初始化
// 初始化
...
...
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