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
855b9561
Commit
855b9561
authored
Feb 17, 2022
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
讨论区字段
parent
1c8f353e
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
261 additions
and
24 deletions
+261
-24
CommentQo.java
...main/java/com/tanpu/community/api/beans/qo/CommentQo.java
+4
-1
TopicFollowQo.java
.../java/com/tanpu/community/api/beans/qo/TopicFollowQo.java
+50
-0
TopicRankQo.java
...in/java/com/tanpu/community/api/beans/qo/TopicRankQo.java
+9
-0
TopicSearchReq.java
...m/tanpu/community/api/beans/req/topic/TopicSearchReq.java
+1
-1
TopicSearchTypeEnum.java
...va/com/tanpu/community/api/enums/TopicSearchTypeEnum.java
+32
-0
TopicSpecialPermissionEnum.java
...tanpu/community/api/enums/TopicSpecialPermissionEnum.java
+32
-0
TopicController.java
.../java/com/tanpu/community/controller/TopicController.java
+17
-8
CodeAutoGenerator.java
.../main/java/com/tanpu/community/dao/CodeAutoGenerator.java
+4
-4
TopicEntity.java
...com/tanpu/community/dao/entity/community/TopicEntity.java
+53
-4
TopicMapper.java
...com/tanpu/community/dao/mapper/community/TopicMapper.java
+1
-1
CommentManager.java
...main/java/com/tanpu/community/manager/CommentManager.java
+1
-0
TopicManager.java
...c/main/java/com/tanpu/community/manager/TopicManager.java
+46
-4
TopicService.java
...c/main/java/com/tanpu/community/service/TopicService.java
+5
-1
application-test.yml
community-service/src/main/resources/application-test.yml
+2
-0
TopicEntityMapper.xml
...src/main/resources/mapper/community/TopicEntityMapper.xml
+4
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/CommentQo.java
View file @
855b9561
...
@@ -38,9 +38,12 @@ public class CommentQo {
...
@@ -38,9 +38,12 @@ public class CommentQo {
@ApiModelProperty
(
value
=
"当前用户是否点赞"
)
@ApiModelProperty
(
value
=
"当前用户是否点赞"
)
private
boolean
hasLiked
;
private
boolean
hasLiked
;
@ApiModelProperty
(
value
=
"2级评论"
)
@ApiModelProperty
(
value
=
"2级评论
,目前未使用
"
)
private
List
<
CommentLv2Qo
>
commentLv2Qos
;
private
List
<
CommentLv2Qo
>
commentLv2Qos
;
@ApiModelProperty
(
value
=
"是否讨论区管理员"
)
private
boolean
isManager
;
// 认证标签相关
// 认证标签相关
@ApiModelProperty
(
"认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾"
)
@ApiModelProperty
(
"认证标签用-用户等级体系 0 游客 1注册用户 10投资人 20 探普理顾 30 探普专家理顾 40 交易理财师 50 首席投顾"
)
private
Integer
levelGrade
;
private
Integer
levelGrade
;
...
...
community-api/src/main/java/com/tanpu/community/api/beans/qo/Topic
Detail
Qo.java
→
community-api/src/main/java/com/tanpu/community/api/beans/qo/Topic
Follow
Qo.java
View file @
855b9561
...
@@ -11,8 +11,8 @@ import lombok.NoArgsConstructor;
...
@@ -11,8 +11,8 @@ import lombok.NoArgsConstructor;
@Builder
@Builder
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
@ApiModel
(
"
话题详情对象
"
)
@ApiModel
(
"
关注话题列表
"
)
public
class
Topic
Detail
Qo
{
public
class
Topic
Follow
Qo
{
@ApiModelProperty
(
value
=
"话题ID"
)
@ApiModelProperty
(
value
=
"话题ID"
)
private
String
topicId
;
private
String
topicId
;
...
@@ -26,4 +26,25 @@ public class TopicDetailQo {
...
@@ -26,4 +26,25 @@ public class TopicDetailQo {
@ApiModelProperty
(
value
=
"讨论量"
)
@ApiModelProperty
(
value
=
"讨论量"
)
private
Integer
disscussCount
;
private
Integer
disscussCount
;
@ApiModelProperty
(
value
=
"阅读量-格式化"
)
private
String
formatViewCount
;
@ApiModelProperty
(
value
=
"讨论量-格式化"
)
private
String
formatDisscussCount
;
@ApiModelProperty
(
value
=
"话题介绍"
)
private
String
topicDesc
;
@ApiModelProperty
(
value
=
"封面"
)
private
String
coverImg
;
@ApiModelProperty
(
value
=
"是否专属 0否,1是"
)
private
Integer
specialPermission
;
@ApiModelProperty
(
value
=
"更新帖子数量"
)
private
Integer
updateCount
;
@ApiModelProperty
(
value
=
"发表时间-标准格式化"
)
public
String
formatTime
;
}
}
community-api/src/main/java/com/tanpu/community/api/beans/qo/TopicRankQo.java
View file @
855b9561
...
@@ -39,6 +39,15 @@ public class TopicRankQo {
...
@@ -39,6 +39,15 @@ public class TopicRankQo {
@ApiModelProperty
(
value
=
"话题下的帖子权重"
)
@ApiModelProperty
(
value
=
"话题下的帖子权重"
)
private
Double
themeWeight
;
private
Double
themeWeight
;
@ApiModelProperty
(
value
=
"话题介绍"
)
private
String
topicDesc
;
@ApiModelProperty
(
value
=
"封面"
)
private
String
coverImg
;
@ApiModelProperty
(
value
=
"是否专属 0否,1是"
)
private
Integer
specialPermission
;
private
Integer
minutesTillNow
;
private
Integer
minutesTillNow
;
private
Double
score
;
private
Double
score
;
...
...
community-api/src/main/java/com/tanpu/community/api/beans/req/topic/TopicSearchReq.java
View file @
855b9561
...
@@ -8,7 +8,7 @@ import lombok.Data;
...
@@ -8,7 +8,7 @@ import lombok.Data;
@Data
@Data
public
class
TopicSearchReq
{
public
class
TopicSearchReq
{
@ApiModelProperty
(
value
=
"搜索关键字,可以为空"
)
@ApiModelProperty
(
value
=
"搜索关键字,可以为空"
)
private
String
searchKeyword
=
""
;
private
String
searchKeyword
=
""
;
@ApiModelProperty
(
value
=
"分页"
)
@ApiModelProperty
(
value
=
"分页"
)
private
Pageable
page
;
private
Pageable
page
;
...
...
community-api/src/main/java/com/tanpu/community/api/enums/TopicSearchTypeEnum.java
0 → 100644
View file @
855b9561
package
com
.
tanpu
.
community
.
api
.
enums
;
public
enum
TopicSearchTypeEnum
{
RECOMMEND
(
1
,
"推荐列表"
),
FOLLOW
(
2
,
"关注列表"
);
private
Integer
code
;
private
String
type
;
TopicSearchTypeEnum
(
Integer
code
,
String
type
)
{
this
.
code
=
code
;
this
.
type
=
type
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
}
community-api/src/main/java/com/tanpu/community/api/enums/TopicSpecialPermissionEnum.java
0 → 100644
View file @
855b9561
package
com
.
tanpu
.
community
.
api
.
enums
;
public
enum
TopicSpecialPermissionEnum
{
FALSE
(
0
,
"没有特殊权限"
),
TRUE
(
1
,
"有特殊权限"
);
private
Integer
code
;
private
String
type
;
TopicSpecialPermissionEnum
(
Integer
code
,
String
type
)
{
this
.
code
=
code
;
this
.
type
=
type
;
}
public
Integer
getCode
()
{
return
code
;
}
public
void
setCode
(
Integer
code
)
{
this
.
code
=
code
;
}
public
String
getType
()
{
return
type
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
}
community-service/src/main/java/com/tanpu/community/controller/TopicController.java
View file @
855b9561
...
@@ -2,7 +2,7 @@ package com.tanpu.community.controller;
...
@@ -2,7 +2,7 @@ package com.tanpu.community.controller;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.auth.AuthLogin
;
import
com.tanpu.common.auth.AuthLogin
;
import
com.tanpu.comm
on.auth.UserHolder
;
import
com.tanpu.comm
unity.api.beans.qo.TopicFollowQo
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.req.page.Page
;
import
com.tanpu.community.api.beans.req.page.Page
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
...
@@ -10,34 +10,44 @@ import com.tanpu.community.manager.TopicManager;
...
@@ -10,34 +10,44 @@ import com.tanpu.community.manager.TopicManager;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
import
java.util.List
;
@RestController
@RestController
@Slf4j
@Slf4j
@RequestMapping
(
value
=
"/api/topic"
)
@RequestMapping
(
value
=
"/api/topic"
)
@ResponseBody
public
class
TopicController
{
public
class
TopicController
{
@Autowired
@Autowired
private
TopicManager
topicManager
;
private
TopicManager
topicManager
;
@Autowired
private
UserHolder
userHolder
;
@AuthLogin
@GetMapping
(
value
=
"/followList"
)
@ApiOperation
(
"关注话题列表"
)
public
CommonResp
<
List
<
TopicFollowQo
>>
getFollowList
(){
return
CommonResp
.
success
(
topicManager
.
getFollowTopicList
());
}
@PostMapping
(
value
=
"/list"
)
@PostMapping
(
value
=
"/list"
)
@ApiOperation
(
"APP全部话题页面,可搜索"
)
@ApiOperation
(
"热门话题,含搜索"
)
@ResponseBody
public
CommonResp
<
Page
<
TopicRankQo
>>
getTopicList
(
@RequestBody
TopicSearchReq
req
){
public
CommonResp
<
Page
<
TopicRankQo
>>
getTopicList
(
@RequestBody
TopicSearchReq
req
){
return
CommonResp
.
success
(
topicManager
.
getAllTopicBriefInfo
(
req
));
return
CommonResp
.
success
(
topicManager
.
getAllTopicBriefInfo
(
req
));
}
}
@GetMapping
(
value
=
"/detailPage"
)
@GetMapping
(
value
=
"/detailPage"
)
@ApiOperation
(
"话题详情页顶部"
)
@ApiOperation
(
"话题详情页顶部"
)
@ResponseBody
public
CommonResp
<
TopicRankQo
>
getDetail
(
@RequestParam
String
topicId
){
public
CommonResp
<
TopicRankQo
>
getDetail
(
@RequestParam
String
topicId
){
return
topicManager
.
getDetail
(
topicId
);
return
topicManager
.
getDetail
(
topicId
);
}
}
...
@@ -45,7 +55,6 @@ public class TopicController {
...
@@ -45,7 +55,6 @@ public class TopicController {
@GetMapping
(
value
=
"/titleList"
)
@GetMapping
(
value
=
"/titleList"
)
@ApiOperation
(
"首页顶部话题标题列"
)
@ApiOperation
(
"首页顶部话题标题列"
)
@ResponseBody
public
CommonResp
<
List
<
TopicRankQo
>>
getTop4Topic
(){
public
CommonResp
<
List
<
TopicRankQo
>>
getTop4Topic
(){
return
CommonResp
.
success
(
topicManager
.
getTop4TopicTitles
());
return
CommonResp
.
success
(
topicManager
.
getTop4TopicTitles
());
...
...
community-service/src/main/java/com/tanpu/community/dao/CodeAutoGenerator.java
View file @
855b9561
...
@@ -19,11 +19,11 @@ public class CodeAutoGenerator {
...
@@ -19,11 +19,11 @@ 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
=
"
dev
"
;
String
mysqlUserName
=
"
tamp_admin
"
;
String
mysqlPassword
=
"
q
imeng123"
;
String
mysqlPassword
=
"
@
imeng123"
;
String
jdbcUrl
=
"jdbc:mysql://rm-uf6
lqwk9969zao53ur
o.mysql.rds.aliyuncs.com:3306/tamp_community"
;
String
jdbcUrl
=
"jdbc:mysql://rm-uf6
r22t3d798q4kmka
o.mysql.rds.aliyuncs.com:3306/tamp_community"
;
// String[] tables = new String[]{"theme"};
// String[] tables = new String[]{"theme"};
String
[]
tables
=
new
String
[]{
"t
heme_check_duplicate
"
};
String
[]
tables
=
new
String
[]{
"t
opic
"
};
String
basePackage
=
"com.tanpu.community"
;
String
basePackage
=
"com.tanpu.community"
;
String
mapperPackage
=
"dao.mapper.community"
;
String
mapperPackage
=
"dao.mapper.community"
;
String
entityPackage
=
"dao.entity.community"
;
String
entityPackage
=
"dao.entity.community"
;
...
...
community-service/src/main/java/com/tanpu/community/dao/entity/community/TopicEntity.java
View file @
855b9561
package
com
.
tanpu
.
community
.
dao
.
entity
.
community
;
package
com
.
tanpu
.
community
.
dao
.
entity
.
community
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
java.time.LocalDateTime
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
/**
/**
* <p>
* <p>
* 话题
* 话题
* </p>
* </p>
*
*
* @author xudong
* @author xudong
* @since 202
1-07-29
* @since 202
2-02-17
*/
*/
@TableName
(
"topic"
)
@TableName
(
"topic"
)
@ApiModel
(
value
=
"TopicEntity对象"
,
description
=
"话题"
)
@ApiModel
(
value
=
"TopicEntity对象"
,
description
=
"话题"
)
...
@@ -38,6 +39,18 @@ public class TopicEntity implements Serializable {
...
@@ -38,6 +39,18 @@ public class TopicEntity implements Serializable {
@ApiModelProperty
(
value
=
"话题名称"
)
@ApiModelProperty
(
value
=
"话题名称"
)
private
String
topicTitle
;
private
String
topicTitle
;
@ApiModelProperty
(
value
=
"话题介绍"
)
private
String
topicDesc
;
@ApiModelProperty
(
value
=
"封面"
)
private
String
coverImg
;
@ApiModelProperty
(
value
=
"是否专属 0否,1是"
)
private
Integer
specialPermission
;
@ApiModelProperty
(
value
=
"是否同步动态至管理员企业微信 0:否 1:是"
)
private
Integer
syncCorpWechat
;
@ApiModelProperty
(
value
=
"是否置顶"
)
@ApiModelProperty
(
value
=
"是否置顶"
)
private
Integer
isTop
;
private
Integer
isTop
;
...
@@ -78,6 +91,38 @@ public class TopicEntity implements Serializable {
...
@@ -78,6 +91,38 @@ public class TopicEntity implements Serializable {
this
.
topicTitle
=
topicTitle
;
this
.
topicTitle
=
topicTitle
;
}
}
public
String
getTopicDesc
()
{
return
topicDesc
;
}
public
void
setTopicDesc
(
String
topicDesc
)
{
this
.
topicDesc
=
topicDesc
;
}
public
String
getCoverImg
()
{
return
coverImg
;
}
public
void
setCoverImg
(
String
coverImg
)
{
this
.
coverImg
=
coverImg
;
}
public
Integer
getSpecialPermission
()
{
return
specialPermission
;
}
public
void
setSpecialPermission
(
Integer
specialPermission
)
{
this
.
specialPermission
=
specialPermission
;
}
public
Integer
getSyncCorpWechat
()
{
return
syncCorpWechat
;
}
public
void
setSyncCorpWechat
(
Integer
syncCorpWechat
)
{
this
.
syncCorpWechat
=
syncCorpWechat
;
}
public
Integer
getIsTop
()
{
public
Integer
getIsTop
()
{
return
isTop
;
return
isTop
;
}
}
...
@@ -132,6 +177,10 @@ public class TopicEntity implements Serializable {
...
@@ -132,6 +177,10 @@ public class TopicEntity implements Serializable {
"id="
+
id
+
"id="
+
id
+
", topicId="
+
topicId
+
", topicId="
+
topicId
+
", topicTitle="
+
topicTitle
+
", topicTitle="
+
topicTitle
+
", topicDesc="
+
topicDesc
+
", coverImg="
+
coverImg
+
", specialPermission="
+
specialPermission
+
", syncCorpWechat="
+
syncCorpWechat
+
", isTop="
+
isTop
+
", isTop="
+
isTop
+
", isConceal="
+
isConceal
+
", isConceal="
+
isConceal
+
", viewCntAdjust="
+
viewCntAdjust
+
", viewCntAdjust="
+
viewCntAdjust
+
...
...
community-service/src/main/java/com/tanpu/community/dao/mapper/community/TopicMapper.java
View file @
855b9561
...
@@ -13,7 +13,7 @@ import java.util.List;
...
@@ -13,7 +13,7 @@ import java.util.List;
* </p>
* </p>
*
*
* @author xudong
* @author xudong
* @since 202
1-07-22
* @since 202
2-02-17
*/
*/
public
interface
TopicMapper
extends
BaseMapper
<
TopicEntity
>
{
public
interface
TopicMapper
extends
BaseMapper
<
TopicEntity
>
{
@Select
(
"select * from topic where id>#{startId} and delete_tag=0 and is_conceal=0 order by id asc limit #{size}"
)
@Select
(
"select * from topic where id>#{startId} and delete_tag=0 and is_conceal=0 order by id asc limit #{size}"
)
...
...
community-service/src/main/java/com/tanpu/community/manager/CommentManager.java
View file @
855b9561
...
@@ -132,6 +132,7 @@ public class CommentManager {
...
@@ -132,6 +132,7 @@ public class CommentManager {
commentQo
.
setHasLiked
(
likeCommentList
.
contains
(
commentId
));
commentQo
.
setHasLiked
(
likeCommentList
.
contains
(
commentId
));
Integer
countByTypeAndId
=
collectionService
.
getCountByTypeAndId
(
commentId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
Integer
countByTypeAndId
=
collectionService
.
getCountByTypeAndId
(
commentId
,
CollectionTypeEnum
.
LIKE_COMMENT
);
commentQo
.
setLikeCount
(
countByTypeAndId
);
commentQo
.
setLikeCount
(
countByTypeAndId
);
commentQo
.
setManager
(
true
);
}
}
//排序:点赞降序+时间降序
//排序:点赞降序+时间降序
...
...
community-service/src/main/java/com/tanpu/community/manager/TopicManager.java
View file @
855b9561
package
com
.
tanpu
.
community
.
manager
;
package
com
.
tanpu
.
community
.
manager
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.api.CommonResp
;
import
com.tanpu.common.auth.UserHolder
;
import
com.tanpu.common.constant.ErrorCodeConstant
;
import
com.tanpu.common.constant.ErrorCodeConstant
;
import
com.tanpu.community.api.beans.qo.TopicFollowQo
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.beans.req.page.Page
;
import
com.tanpu.community.api.beans.req.page.Page
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
import
com.tanpu.community.api.beans.req.topic.TopicSearchReq
;
import
com.tanpu.community.api.enums.TopicSpecialPermissionEnum
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.service.RankService
;
import
com.tanpu.community.service.RankService
;
import
com.tanpu.community.service.TopicService
;
import
com.tanpu.community.service.TopicService
;
...
@@ -23,7 +26,8 @@ public class TopicManager {
...
@@ -23,7 +26,8 @@ public class TopicManager {
@Autowired
@Autowired
private
RankService
rankService
;
private
RankService
rankService
;
@Autowired
private
UserHolder
userHolder
;
// 首页-话题标签
// 首页-话题标签
public
List
<
TopicRankQo
>
getTop4TopicTitles
()
{
public
List
<
TopicRankQo
>
getTop4TopicTitles
()
{
...
@@ -33,20 +37,58 @@ public class TopicManager {
...
@@ -33,20 +37,58 @@ public class TopicManager {
// 话题搜索列表
// 话题搜索列表
public
Page
<
TopicRankQo
>
getAllTopicBriefInfo
(
TopicSearchReq
req
)
{
public
Page
<
TopicRankQo
>
getAllTopicBriefInfo
(
TopicSearchReq
req
)
{
// 全量排序,内存分页
List
<
TopicRankQo
>
topicList
=
rankService
.
getRankTopicList
(
req
.
getSearchKeyword
());
List
<
TopicRankQo
>
topicList
=
rankService
.
getRankTopicList
(
req
.
getSearchKeyword
());
return
PageUtils
.
page
(
req
.
getPage
(),
topicList
);
return
PageUtils
.
page
(
req
.
getPage
(),
topicList
);
}
}
// 关注话题(讨论区)列表
public
List
<
TopicFollowQo
>
getFollowTopicList
()
{
String
userId
=
userHolder
.
getUserId
();
// 全量排序,内存分页
topicService
.
queryFollowTopic
(
userId
);
return
null
;
}
// 话题详情页
// 话题详情页
public
CommonResp
<
TopicRankQo
>
getDetail
(
String
topicId
)
{
public
CommonResp
<
TopicRankQo
>
getDetail
(
String
topicId
)
{
TopicEntity
topicEntity
=
topicService
.
queryById
(
topicId
);
if
(
topicEntity
==
null
){
TopicEntity
topicEntity
=
topicService
.
queryOnlineTopicById
(
topicId
);
if
(
topicEntity
==
null
)
{
return
CommonResp
.
error
(
ErrorCodeConstant
.
TOPIC_NOT_FOUND
.
getCode
(),
"抱歉!该话题已下线。"
);
return
CommonResp
.
error
(
ErrorCodeConstant
.
TOPIC_NOT_FOUND
.
getCode
(),
"抱歉!该话题已下线。"
);
}
}
//
if
(
TopicSpecialPermissionEnum
.
TRUE
.
getCode
().
equals
(
topicEntity
.
getSpecialPermission
())
&&
!
checkPermission
(
topicId
,
userHolder
.
getUserId
()))
{
return
CommonResp
.
error
(
ErrorCodeConstant
.
TOPIC_PERMISSION_ABORT
.
getCode
(),
getPermissionToast
(
topicId
));
}
return
CommonResp
.
success
(
rankService
.
getTopicDetail
(
topicId
));
return
CommonResp
.
success
(
rankService
.
getTopicDetail
(
topicId
));
}
}
private
String
getPermissionToast
(
String
topicId
)
{
String
permission
=
"专业版会员"
;
// return "暂无权限参与此话题~您可联系官方客服 021- 了解详情";
return
"该话题仅限"
+
permission
+
"可参与哦~"
;
}
/**
* 判断用户是否拥有权限(1对1)
*
* @param topicId
* @param userId
*/
private
boolean
checkPermission
(
String
topicId
,
String
userId
)
{
return
true
;
}
}
}
community-service/src/main/java/com/tanpu/community/service/TopicService.java
View file @
855b9561
...
@@ -2,6 +2,7 @@ package com.tanpu.community.service;
...
@@ -2,6 +2,7 @@ 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.uuid.UuidGenHelper
;
import
com.tanpu.common.uuid.UuidGenHelper
;
import
com.tanpu.community.api.beans.qo.TopicRankQo
;
import
com.tanpu.community.api.enums.StatusEnum
;
import
com.tanpu.community.api.enums.StatusEnum
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
import
com.tanpu.community.dao.mapper.community.TopicMapper
;
import
com.tanpu.community.dao.mapper.community.TopicMapper
;
...
@@ -43,7 +44,7 @@ public class TopicService {
...
@@ -43,7 +44,7 @@ public class TopicService {
public
TopicEntity
queryById
(
String
topicId
)
{
public
TopicEntity
query
OnlineTopic
ById
(
String
topicId
)
{
return
topicMapper
.
selectOne
(
new
LambdaQueryWrapper
<
TopicEntity
>()
return
topicMapper
.
selectOne
(
new
LambdaQueryWrapper
<
TopicEntity
>()
.
eq
(
TopicEntity:
:
getTopicId
,
topicId
)
.
eq
(
TopicEntity:
:
getTopicId
,
topicId
)
.
eq
(
TopicEntity:
:
getIsConceal
,
StatusEnum
.
FALSE
)
.
eq
(
TopicEntity:
:
getIsConceal
,
StatusEnum
.
FALSE
)
...
@@ -64,4 +65,7 @@ public class TopicService {
...
@@ -64,4 +65,7 @@ public class TopicService {
return
topicMapper
.
selectList
(
new
LambdaQueryWrapper
<
TopicEntity
>().
in
(
TopicEntity:
:
getTopicId
,
topicIds
));
return
topicMapper
.
selectList
(
new
LambdaQueryWrapper
<
TopicEntity
>().
in
(
TopicEntity:
:
getTopicId
,
topicIds
));
}
}
public
List
<
TopicRankQo
>
queryFollowTopic
(
String
userId
)
{
return
null
;
}
}
}
community-service/src/main/resources/application-test.yml
View file @
855b9561
...
@@ -95,6 +95,8 @@ recommend:
...
@@ -95,6 +95,8 @@ recommend:
tmpfile
:
tmpfile
:
dir
:
/data/tmp
dir
:
/data/tmp
logging.level.com.tanpu
:
debug
tanpu
:
tanpu
:
fatools
:
fatools
:
svc
:
https://testtamper.tanpuyun.com
svc
:
https://testtamper.tanpuyun.com
...
...
community-service/src/main/resources/mapper/community/TopicEntityMapper.xml
View file @
855b9561
...
@@ -7,6 +7,10 @@
...
@@ -7,6 +7,10 @@
<id
column=
"id"
property=
"id"
/>
<id
column=
"id"
property=
"id"
/>
<result
column=
"topic_id"
property=
"topicId"
/>
<result
column=
"topic_id"
property=
"topicId"
/>
<result
column=
"topic_title"
property=
"topicTitle"
/>
<result
column=
"topic_title"
property=
"topicTitle"
/>
<result
column=
"topic_desc"
property=
"topicDesc"
/>
<result
column=
"cover_img"
property=
"coverImg"
/>
<result
column=
"special_permission"
property=
"specialPermission"
/>
<result
column=
"sync_corp_wechat"
property=
"syncCorpWechat"
/>
<result
column=
"is_top"
property=
"isTop"
/>
<result
column=
"is_top"
property=
"isTop"
/>
<result
column=
"is_conceal"
property=
"isConceal"
/>
<result
column=
"is_conceal"
property=
"isConceal"
/>
<result
column=
"view_cnt_adjust"
property=
"viewCntAdjust"
/>
<result
column=
"view_cnt_adjust"
property=
"viewCntAdjust"
/>
...
...
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