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
ba6b4927
Commit
ba6b4927
authored
Oct 29, 2021
by
胡定国
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v2.2.10' of 47.100.44.39:tp-backend/tanpu-community into v2.2.10
parents
22baff5b
81ba524f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
10 deletions
+61
-10
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+1
-1
ThemeService.java
...c/main/java/com/tanpu/community/service/ThemeService.java
+4
-2
ConvertUtil.java
...e/src/main/java/com/tanpu/community/util/ConvertUtil.java
+8
-7
OtherUtil.java
...ice/src/main/java/com/tanpu/community/util/OtherUtil.java
+48
-0
No files found.
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
ba6b4927
...
...
@@ -96,7 +96,7 @@ public class RankService {
LocalDateTime
start
=
LocalDateTime
.
now
();
//7天内所有主题进行热度值排序
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryRecentdays
(
3
0
);
List
<
ThemeEntity
>
themeEntities
=
themeService
.
queryRecentdays
(
6
0
);
if
(
CollectionUtils
.
isEmpty
(
themeEntities
))
{
return
;
}
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeService.java
View file @
ba6b4927
...
...
@@ -87,8 +87,9 @@ public class ThemeService {
//根据id返回主题详情(未删)
public
ThemeEntity
queryByThemeIdIgnoreDelete
(
String
themeId
)
{
return
themeMapper
.
selectOne
(
new
LambdaQueryWrapper
<
ThemeEntity
>()
ThemeEntity
themeEntity
=
themeMapper
.
selectOne
(
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
eq
(
ThemeEntity:
:
getThemeId
,
themeId
));
return
themeEntity
;
}
//根据用户id查询主题list
...
...
@@ -141,7 +142,8 @@ public class ThemeService {
.
in
(
ThemeEntity:
:
getThemeId
,
themeIds
)
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
());
return
themeMapper
.
selectList
(
queryWrapper
);
List
<
ThemeEntity
>
themeEntities
=
themeMapper
.
selectList
(
queryWrapper
);
return
themeEntities
;
}
...
...
community-service/src/main/java/com/tanpu/community/util/ConvertUtil.java
View file @
ba6b4927
...
...
@@ -47,7 +47,8 @@ public class ConvertUtil {
themeQO
.
setCreateTime
(
TimeUtils
.
getTimestampOfDateTime
(
themeEntity
.
getCreateTime
()));
themeQO
.
setUpToNowTime
(
TimeUtils
.
calUpToNowTime
(
themeEntity
.
getCreateTime
()));
themeQO
.
setFormatTime
(
TimeUtils
.
format
(
themeEntity
.
getCreateTime
()));
List
<
ThemeContentQo
>
themeContentQos
=
JsonUtil
.
toBean
(
themeEntity
.
getContent
(),
new
TypeReference
<
List
<
ThemeContentQo
>>()
{
// 屏蔽手机号和邮箱
List
<
ThemeContentQo
>
themeContentQos
=
JsonUtil
.
toBean
(
OtherUtil
.
blockPhoneAndEmail
(
themeEntity
.
getContent
()),
new
TypeReference
<
List
<
ThemeContentQo
>>()
{
});
themeQO
.
setContent
(
themeContentQos
);
return
themeQO
;
...
...
@@ -279,13 +280,13 @@ public class ConvertUtil {
themeNotifyQo
.
setFormerThemeId
(
entity
.
getTargetId
());
themeNotifyQo
.
setFormerUserName
(
entity
.
getNotifiedUserId
());
if
(!
StringUtils
.
isEmpty
(
entity
.
getContent
()))
{
try
{
try
{
NotificationForwardDO
forwardDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationForwardDO
.
class
);
themeNotifyQo
.
setContent
(
forwardDO
.
getContent
());
themeNotifyQo
.
setTopicId
(
forwardDO
.
getTopicId
());
themeNotifyQo
.
setForwardThemeId
(
forwardDO
.
getThemeId
());
}
catch
(
Exception
e
)
{
throw
new
BizException
(
"消息通知-转发类型-反序列化异常:"
+
entity
.
getContent
());
}
catch
(
Exception
e
)
{
throw
new
BizException
(
"消息通知-转发类型-反序列化异常:"
+
entity
.
getContent
());
}
}
}
...
...
@@ -298,10 +299,10 @@ public class ConvertUtil {
NotificationLikeDO
notificationLikeDO
=
JsonUtil
.
toBean
(
entity
.
getContent
(),
NotificationLikeDO
.
class
);
themeNotifyQo
.
setLikeUserCount
(
notificationLikeDO
.
getCount
());
ArrayList
<
UserBriefInfoQO
>
likeUsers
=
new
ArrayList
<>();
notificationLikeDO
.
getSet
().
stream
().
forEach
(
o
->
likeUsers
.
add
(
UserBriefInfoQO
.
builder
().
userId
(
o
).
build
()));
notificationLikeDO
.
getSet
().
stream
().
forEach
(
o
->
likeUsers
.
add
(
UserBriefInfoQO
.
builder
().
userId
(
o
).
build
()));
themeNotifyQo
.
setLikeUsers
(
likeUsers
);
}
catch
(
Exception
e
)
{
throw
new
BizException
(
"消息通知-点赞类型-反序列化异常:"
+
entity
.
getContent
());
}
catch
(
Exception
e
)
{
throw
new
BizException
(
"消息通知-点赞类型-反序列化异常:"
+
entity
.
getContent
());
}
}
}
...
...
community-service/src/main/java/com/tanpu/community/util/OtherUtil.java
0 → 100644
View file @
ba6b4927
package
com
.
tanpu
.
community
.
util
;
import
org.apache.commons.lang3.StringUtils
;
import
javax.servlet.http.HttpServletRequest
;
public
class
OtherUtil
{
private
final
static
String
numberPattern
=
"^[0-9]*[1-9][0-9]*$"
;
private
final
static
String
phonePattern
=
"(13[0-9]|14[5|7]|15[0|1|2|3|4|5|6|7|8|9]|18[0|1|2|3|5|6|7|8|9])\\d{8}"
;
private
final
static
String
emailPattern
=
"\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.com"
;
public
static
String
getRequestUrl
(
HttpServletRequest
request
)
{
String
s
=
request
.
getRequestURL
().
toString
();
String
querystr
=
request
.
getQueryString
();
if
(
StringUtils
.
isNotEmpty
(
querystr
))
{
s
=
s
+
"?"
+
querystr
;
}
return
s
;
}
public
static
String
blockPhoneAndEmail
(
String
line
)
{
// 屏蔽手机号
line
=
line
.
replaceAll
(
phonePattern
,
"**********"
);
// 屏蔽邮箱
line
=
line
.
replaceAll
(
emailPattern
,
"*@*.com"
);
return
line
;
}
/**
* 脱敏手机号
*
* @param mobile
* @return
*/
public
static
String
formatMobile
(
String
mobile
)
{
if
(
StringUtils
.
isNotBlank
(
mobile
))
{
mobile
=
mobile
.
replaceAll
(
"(\\w{3})\\w*(\\w{4})"
,
"$1****$2"
);
}
return
mobile
;
}
public
static
void
main
(
String
[]
args
)
{
System
.
out
.
println
(
OtherUtil
.
blockPhoneAndEmail
(
"我的手机号是18621088081!,邮箱是123@qq.com。"
));
}
}
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