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
fdc95ecd
Commit
fdc95ecd
authored
Aug 13, 2021
by
刘基明
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
圈子消息通知-fix
parent
2d1c98a1
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
36 additions
and
17 deletions
+36
-17
NotificationQo.java
...java/com/tanpu/community/api/beans/qo/NotificationQo.java
+0
-1
ThemeNotifyQo.java
.../java/com/tanpu/community/api/beans/qo/ThemeNotifyQo.java
+8
-10
NotifyQueryReq.java
.../community/api/beans/req/notification/NotifyQueryReq.java
+0
-1
CommunityApplication.java
...c/main/java/com/tanpu/community/CommunityApplication.java
+2
-0
SwaggerConfig.java
...c/main/java/com/tanpu/community/config/SwaggerConfig.java
+1
-1
NotificationController.java
...om/tanpu/community/controller/NotificationController.java
+5
-0
NotificationManager.java
...java/com/tanpu/community/manager/NotificationManager.java
+12
-1
RankService.java
...rc/main/java/com/tanpu/community/service/RankService.java
+3
-3
application-dev.yml
community-service/src/main/resources/application-dev.yml
+5
-0
No files found.
community-api/src/main/java/com/tanpu/community/api/beans/qo/NotificationQo.java
View file @
fdc95ecd
...
...
@@ -11,7 +11,6 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"圈子消息通知-概要"
)
public
class
NotificationQo
{
@ApiModelProperty
(
value
=
"未读条数"
)
...
...
community-api/src/main/java/com/tanpu/community/api/beans/qo/ThemeNotifyQo.java
View file @
fdc95ecd
package
com
.
tanpu
.
community
.
api
.
beans
.
qo
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
...
...
@@ -13,7 +12,6 @@ import java.util.List;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel
(
value
=
"圈子消息通知-详情"
)
public
class
ThemeNotifyQo
{
@ApiModelProperty
(
value
=
"通知主键Id"
)
...
...
@@ -25,13 +23,13 @@ public class ThemeNotifyQo {
@ApiModelProperty
(
value
=
"1:转发 2:点赞 3:评论 4:关注"
)
private
Integer
messageType
;
@ApiModelProperty
(
value
=
"作者id"
)
public
String
authorId
;
@ApiModelProperty
(
value
=
"用户头像"
)
public
String
userImg
;
@ApiModelProperty
(
value
=
"昵称"
)
public
String
nickName
;
@ApiModelProperty
(
value
=
"用户简介"
)
private
String
userIntroduction
;
@ApiModelProperty
(
value
=
"当前用户是否关注该作者"
)
...
...
@@ -49,15 +47,15 @@ public class ThemeNotifyQo {
public
String
topicId
;
@ApiModelProperty
(
value
=
"话题名称"
)
public
String
topicTitle
;
@ApiModelProperty
(
value
=
"昵称"
)
public
String
nickName
;
@ApiModelProperty
(
value
=
"转发内容"
)
@ApiModelProperty
(
value
=
"评论/转发内容"
)
private
String
content
;
@ApiModelProperty
(
value
=
"被转发的主题"
)
public
String
formerThemeId
;
@ApiModelProperty
(
value
=
"转发的主题"
)
public
FormerThemeQo
formerTheme
;
@ApiModelProperty
(
value
=
"转发的主题内容"
)
public
String
formerContent
;
@ApiModelProperty
(
value
=
"转发的主题用户昵称"
)
public
String
formerUserName
;
// 点赞聚合
@ApiModelProperty
(
value
=
"用户头像"
)
...
...
community-api/src/main/java/com/tanpu/community/api/beans/req/notification/NotifyQueryReq.java
View file @
fdc95ecd
...
...
@@ -8,7 +8,6 @@ import lombok.Data;
import
lombok.NoArgsConstructor
;
@ApiModel
(
value
=
"请求"
)
@Data
@Builder
@NoArgsConstructor
...
...
community-service/src/main/java/com/tanpu/community/CommunityApplication.java
View file @
fdc95ecd
...
...
@@ -8,6 +8,7 @@ import org.springframework.cache.annotation.EnableCaching;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
@SpringBootApplication
@EnableTransactionManagement
...
...
@@ -15,6 +16,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableScheduling
@EnableFeignClients
@EnableConfigurationProperties
({
ESConfig
.
class
})
@EnableSwagger2
public
class
CommunityApplication
{
public
static
void
main
(
String
[]
args
)
{
...
...
community-service/src/main/java/com/tanpu/community/config/SwaggerConfig.java
View file @
fdc95ecd
...
...
@@ -29,7 +29,7 @@ public class SwaggerConfig {
Docket
docket
=
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
CommunityConstant
.
PACKAGE_BASE
))
.
apis
(
RequestHandlerSelectors
.
basePackage
(
CommunityConstant
.
PACKAGE_BASE
+
".controller"
))
.
paths
(
PathSelectors
.
any
())
.
build
();
...
...
community-service/src/main/java/com/tanpu/community/controller/NotificationController.java
View file @
fdc95ecd
...
...
@@ -7,6 +7,8 @@ import com.tanpu.community.api.beans.qo.NotificationQo;
import
com.tanpu.community.api.beans.qo.ThemeNotifyQo
;
import
com.tanpu.community.api.beans.req.notification.NotifyQueryReq
;
import
com.tanpu.community.manager.NotificationManager
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -24,6 +26,7 @@ import java.util.List;
@Slf4j
@RestController
@RequestMapping
(
"/api/notification"
)
@Api
(
value
=
"圈子消息通知"
)
public
class
NotificationController
{
@Autowired
...
...
@@ -35,6 +38,7 @@ public class NotificationController {
@AuthLogin
@PostMapping
(
"/query"
)
@ResponseBody
@ApiOperation
(
value
=
"查找用戶的消息通知列表"
)
public
CommonResp
<
List
<
ThemeNotifyQo
>>
query
(
@RequestBody
NotifyQueryReq
req
){
List
<
ThemeNotifyQo
>
query
=
notificationManager
.
queryList
(
req
,
userHolder
.
getUserId
());
...
...
@@ -44,6 +48,7 @@ public class NotificationController {
@AuthLogin
@GetMapping
(
"/updateCount"
)
@ResponseBody
@ApiOperation
(
value
=
"更新推送"
)
public
CommonResp
<
NotificationQo
>
query
(){
NotificationQo
notificationQO
=
notificationManager
.
queryBriefInfo
(
userHolder
.
getUserId
());
...
...
community-service/src/main/java/com/tanpu/community/manager/NotificationManager.java
View file @
fdc95ecd
...
...
@@ -8,6 +8,7 @@ import com.tanpu.community.api.beans.qo.ThemeNotifyQo;
import
com.tanpu.community.api.beans.qo.ThemeQo
;
import
com.tanpu.community.api.beans.req.notification.NotifyQueryReq
;
import
com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp
;
import
com.tanpu.community.api.enums.ThemeTypeEnum
;
import
com.tanpu.community.cache.RedisCache
;
import
com.tanpu.community.dao.entity.community.NotificationEntity
;
import
com.tanpu.community.dao.entity.community.TopicEntity
;
...
...
@@ -68,7 +69,17 @@ public class NotificationManager {
if
(
StringUtils
.
isNotEmpty
(
themeNotifyQo
.
getFormerThemeId
())){
FormerThemeQo
former
=
redisCache
.
getObject
(
StringUtils
.
joinWith
(
"_"
,
CACHE_FORWARD_THEME_ID
,
themeNotifyQo
.
getFormerThemeId
()),
60
,
()
->
this
.
getFormerTheme
(
themeNotifyQo
.
getFormerThemeId
()),
FormerThemeQo
.
class
);
themeNotifyQo
.
setFormerTheme
(
former
);
if
(
former
!=
null
){
themeNotifyQo
.
setFormerUserName
(
former
.
getNickName
());
if
(
ThemeTypeEnum
.
DISCUSSION
.
getCode
().
equals
(
former
.
getThemeType
())){
themeNotifyQo
.
setContent
(
former
.
getContent
().
get
(
0
).
getValue
());
}
if
(
ThemeTypeEnum
.
LONG_TEXT
.
getCode
().
equals
(
former
.
getThemeType
())){
themeNotifyQo
.
setContent
(
former
.
getTitle
());
}
}
}
if
(
StringUtils
.
isNotEmpty
(
themeNotifyQo
.
getTopicId
())){
TopicEntity
topicEntity
=
topicService
.
queryById
(
themeNotifyQo
.
getTopicId
());
...
...
community-service/src/main/java/com/tanpu/community/service/RankService.java
View file @
fdc95ecd
...
...
@@ -37,8 +37,8 @@ public class RankService {
public
Double
forwardRate
;
@Value
(
"${rank.theme.commentRate:2}"
)
public
Double
commentRate
;
@Value
(
"${rank.theme.likeRate
n
:3}"
)
public
Double
likeRate
n
;
@Value
(
"${rank.theme.likeRate:3}"
)
public
Double
likeRate
;
@Value
(
"${rank.theme.collectRate:3}"
)
public
Double
collectRate
;
//用户质量权重
...
...
@@ -278,7 +278,7 @@ public class RankService {
double
w
=
theme
.
getViewCount
()
*
viewRate
+
theme
.
getForwardCount
()
*
forwardRate
+
theme
.
getCommentCount
()
*
commentRate
+
theme
.
getLikeCount
()
*
likeRate
n
+
theme
.
getLikeCount
()
*
likeRate
+
theme
.
getCollectCount
()
*
collectRate
+
Math
.
pow
(
theme
.
getUserWeight
(),
userWeightRate
);
double
score
=
(
w
+
initialWeight
)
/
Math
.
pow
(
theme
.
getMinutesTillNow
()
+
1
,
timeRate
);
...
...
community-service/src/main/resources/application-dev.yml
View file @
fdc95ecd
apollo.bootstrap.enabled
:
false
#app.id: tanpu-community
springfox
:
documentation
:
swagger
:
v2
:
path
:
/api-docs
#apollo:
# meta: http://dev-apollo.tamp-innner.com:8080
# cacheDir: ./apollocache/
...
...
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