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
0e210072
Commit
0e210072
authored
Jul 27, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
临时埋点
parent
0c2e35e0
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
35 additions
and
24 deletions
+35
-24
Pageable.java
...java/com/tanpu/community/api/beans/req/page/Pageable.java
+4
-0
ThemeListReq.java
...com/tanpu/community/api/beans/req/theme/ThemeListReq.java
+1
-0
ThemeManager.java
...c/main/java/com/tanpu/community/manager/ThemeManager.java
+7
-1
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+5
-10
ThemeService.java
...c/main/java/com/tanpu/community/service/ThemeService.java
+7
-13
VisitSummaryService.java
...java/com/tanpu/community/service/VisitSummaryService.java
+11
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/req/page/Pageable.java
View file @
0e210072
...
...
@@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModel;
import
lombok.Builder
;
import
lombok.Data
;
import
javax.validation.constraints.NotEmpty
;
@Data
@Builder
@ApiModel
(
value
=
"分页"
)
...
...
@@ -15,8 +17,10 @@ public class Pageable {
public
static
final
Integer
DEFAULT_PAGE_NUMBER
=
0
;
@NotEmpty
(
message
=
"分页Number不能为空"
)
public
Integer
pageNumber
=
DEFAULT_PAGE_NUMBER
;
@NotEmpty
(
message
=
"分页pageSize不能为空"
)
public
Integer
pageSize
=
DEFAULT_PAGE_SIZE
;
public
Pageable
()
{
...
...
community-api/src/main/java/com/tanpu/community/api/beans/req/theme/ThemeListReq.java
View file @
0e210072
...
...
@@ -22,6 +22,7 @@ public class ThemeListReq {
@ApiModelProperty
(
value
=
"当前浏览的最后一个themeId,可以为空"
)
public
String
lastId
=
""
;
@NotNull
(
message
=
"分页"
)
public
Pageable
page
;
public
List
<
String
>
excludeIds
;
...
...
community-service/src/main/java/com/tanpu/community/manager/ThemeManager.java
View file @
0e210072
...
...
@@ -199,9 +199,13 @@ public class ThemeManager {
themes
=
themeService
.
queryByThemeIds
(
recmdIds
);
themes
=
RankUtils
.
sortThemeEntityByIds
(
themes
,
recmdIds
);
}
else
if
(
ThemeListTypeEnum
.
FOLLOW
.
getCode
().
equals
(
req
.
getType
()))
{
//TODO 临时埋点,接入新埋点后删除
if
(
CollectionUtils
.
isEmpty
(
req
.
getExcludeIds
()))
{
visitSummaryService
.
addPageView
(
userId
,
userId
,
VisitTypeEnum
.
FOLLOW_THEME_VIEW
);
}
//根据关注列表查询
List
<
String
>
fansList
=
followRelService
.
queryFansByFollowerId
(
userId
);
themes
=
themeService
.
queryByUserIds
(
fansList
,
req
.
getLastId
(),
req
.
page
.
getPageSize
()
);
themes
=
themeService
.
queryByUserIds
(
fansList
,
pageStart
,
pageSize
);
}
else
if
(
ThemeListTypeEnum
.
TOPIC_HOT
.
getCode
().
equals
(
req
.
getType
()))
{
//根据话题查询热门
if
(
StringUtils
.
isEmpty
(
req
.
getTopicId
()))
{
...
...
@@ -312,6 +316,8 @@ public class ThemeManager {
//查询正文
public
ThemeQo
getThemeDetail
(
String
themeId
,
String
userId
)
{
//TODO 临时埋点,接入新埋点后删除
visitSummaryService
.
addPageView
(
userId
,
themeId
,
VisitTypeEnum
.
THEME_PAGE_VIEW
);
//查询详情
ThemeQo
themeQo
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
"_"
,
CACHE_THEME_ID
,
themeId
),
60
,
()
->
this
.
getDetailCommon
(
themeId
),
ThemeQo
.
class
);
...
...
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
0e210072
package
com
.
tanpu
.
community
.
manager
;
import
com.tanpu.common.auth.UserHolder
;
import
com.tanpu.common.exception.BizException
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.req.page.Page
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
import
com.tanpu.community.api.enums.VisitTypeEnum
;
import
com.tanpu.community.service.*
;
import
com.tanpu.community.service.RankService
;
import
com.tanpu.community.service.TopicService
;
import
com.tanpu.community.service.VisitSummaryService
;
import
com.tanpu.community.util.PageUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -28,14 +29,6 @@ public class TopicManager {
@Resource
private
UserHolder
userHolder
;
// 新增话题
public
void
insertTopic
(
String
topicTitle
,
String
userId
)
{
if
(
topicService
.
queryByTitile
(
topicTitle
)
!=
null
)
{
throw
new
BizException
(
"话题名称已存在:"
+
topicTitle
);
}
topicService
.
addTopic
(
topicTitle
,
userId
);
}
// 首页-话题标签
public
List
<
TopicRankQo
>
getTop4TopicTitles
()
{
...
...
@@ -52,6 +45,8 @@ public class TopicManager {
// 话题详情页
public
TopicRankQo
getDetail
(
String
topicId
)
{
//TODO 临时埋点,接入新埋点后删除
visitSummaryService
.
addPageView
(
userHolder
.
getUserId
(),
topicId
,
VisitTypeEnum
.
TOPIC_PAGE_VIEW
);
return
rankService
.
getTopicDetail
(
topicId
);
}
...
...
community-service/src/main/java/com/tanpu/community/service/ThemeService.java
View file @
0e210072
...
...
@@ -227,27 +227,21 @@ public class ThemeService {
}
/**
* 根据作者查询主题列表(可分页)
*
* 根据作者查询主题分页列表
* @param userIds
* @param
lastId
* @param
pageStart
* @param pageSize
* @return
*/
public
List
<
ThemeEntity
>
queryByUserIds
(
List
<
String
>
userIds
,
String
lastId
,
Integer
pageSize
)
{
public
List
<
ThemeEntity
>
queryByUserIds
(
List
<
String
>
userIds
,
Integer
pageStart
,
Integer
pageSize
)
{
if
(
CollectionUtils
.
isEmpty
(
userIds
)){
return
Collections
.
emptyList
();
}
LambdaQueryWrapper
<
ThemeEntity
>
queryWrapper
=
new
LambdaQueryWrapper
<
ThemeEntity
>()
.
in
(
ThemeEntity:
:
getAuthorId
,
userIds
);
if
(
StringUtils
.
isNotEmpty
(
lastId
))
{
ThemeEntity
lastEntity
=
queryByThemeId
(
lastId
);
if
(
lastEntity
==
null
)
throw
new
BizException
(
"主题未找到,id:"
+
lastId
);
queryWrapper
.
lt
(
ThemeEntity:
:
getUpdateTime
,
lastEntity
.
getCreateTime
());
}
queryWrapper
.
last
(
"limit "
+
pageSize
);
queryWrapper
.
orderByDesc
(
ThemeEntity:
:
getCreateTime
);
queryWrapper
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
());
.
in
(
ThemeEntity:
:
getAuthorId
,
userIds
)
.
last
(
"limit "
+
pageStart
+
", "
+
pageSize
)
.
orderByDesc
(
ThemeEntity:
:
getCreateTime
)
.
eq
(
ThemeEntity:
:
getDeleteTag
,
DeleteTagEnum
.
NOT_DELETED
.
getCode
());
return
themeMapper
.
selectList
(
queryWrapper
);
}
...
...
community-service/src/main/java/com/tanpu/community/service/VisitSummaryService.java
View file @
0e210072
...
...
@@ -55,6 +55,17 @@ public class VisitSummaryService {
}
}
@Transactional
//TODO 临时埋点,接入新埋点后删除
public
void
addPageView
(
String
userId
,
String
targetId
,
VisitTypeEnum
type
)
{
visitSummaryMapper
.
insert
(
VisitSummaryEntity
.
builder
()
.
visitorId
(
userId
)
.
refId
(
targetId
)
.
refType
(
type
.
getCode
())
.
duration
(
0
)
.
build
());
}
// 查询话题 详细页面 浏览量
public
Integer
queryTopicDetailVisit
(
String
topicId
)
{
return
visitSummaryMapper
.
selectCount
(
new
LambdaQueryWrapper
<
VisitSummaryEntity
>()
...
...
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