Commit fdc95ecd authored by 刘基明's avatar 刘基明

圈子消息通知-fix

parent 2d1c98a1
...@@ -11,7 +11,6 @@ import lombok.NoArgsConstructor; ...@@ -11,7 +11,6 @@ import lombok.NoArgsConstructor;
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ApiModel(value = "圈子消息通知-概要")
public class NotificationQo { public class NotificationQo {
@ApiModelProperty(value = "未读条数") @ApiModelProperty(value = "未读条数")
......
package com.tanpu.community.api.beans.qo; package com.tanpu.community.api.beans.qo;
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;
...@@ -13,7 +12,6 @@ import java.util.List; ...@@ -13,7 +12,6 @@ import java.util.List;
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@NoArgsConstructor @NoArgsConstructor
@ApiModel(value = "圈子消息通知-详情")
public class ThemeNotifyQo { public class ThemeNotifyQo {
@ApiModelProperty(value = "通知主键Id") @ApiModelProperty(value = "通知主键Id")
...@@ -25,13 +23,13 @@ public class ThemeNotifyQo { ...@@ -25,13 +23,13 @@ public class ThemeNotifyQo {
@ApiModelProperty(value = "1:转发 2:点赞 3:评论 4:关注") @ApiModelProperty(value = "1:转发 2:点赞 3:评论 4:关注")
private Integer messageType; private Integer messageType;
@ApiModelProperty(value = "作者id") @ApiModelProperty(value = "作者id")
public String authorId; public String authorId;
@ApiModelProperty(value = "用户头像") @ApiModelProperty(value = "用户头像")
public String userImg; public String userImg;
@ApiModelProperty(value = "昵称")
public String nickName;
@ApiModelProperty(value = "用户简介") @ApiModelProperty(value = "用户简介")
private String userIntroduction; private String userIntroduction;
@ApiModelProperty(value = "当前用户是否关注该作者") @ApiModelProperty(value = "当前用户是否关注该作者")
...@@ -49,15 +47,15 @@ public class ThemeNotifyQo { ...@@ -49,15 +47,15 @@ public class ThemeNotifyQo {
public String topicId; public String topicId;
@ApiModelProperty(value = "话题名称") @ApiModelProperty(value = "话题名称")
public String topicTitle; public String topicTitle;
@ApiModelProperty(value = "昵称") @ApiModelProperty(value = "评论/转发内容")
public String nickName;
@ApiModelProperty(value = "转发内容")
private String content; private String content;
@ApiModelProperty(value = "被转发的主题") @ApiModelProperty(value = "被转发的主题")
public String formerThemeId; public String formerThemeId;
@ApiModelProperty(value = "转发的主题") @ApiModelProperty(value = "转发的主题内容")
public FormerThemeQo formerTheme; public String formerContent;
@ApiModelProperty(value = "转发的主题用户昵称")
public String formerUserName;
// 点赞聚合 // 点赞聚合
@ApiModelProperty(value = "用户头像") @ApiModelProperty(value = "用户头像")
......
...@@ -8,7 +8,6 @@ import lombok.Data; ...@@ -8,7 +8,6 @@ import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
@ApiModel(value = "请求")
@Data @Data
@Builder @Builder
@NoArgsConstructor @NoArgsConstructor
......
...@@ -8,6 +8,7 @@ import org.springframework.cache.annotation.EnableCaching; ...@@ -8,6 +8,7 @@ import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication @SpringBootApplication
@EnableTransactionManagement @EnableTransactionManagement
...@@ -15,6 +16,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; ...@@ -15,6 +16,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableScheduling @EnableScheduling
@EnableFeignClients @EnableFeignClients
@EnableConfigurationProperties({ESConfig.class}) @EnableConfigurationProperties({ESConfig.class})
@EnableSwagger2
public class CommunityApplication { public class CommunityApplication {
public static void main(String[] args) { public static void main(String[] args) {
......
...@@ -29,7 +29,7 @@ public class SwaggerConfig { ...@@ -29,7 +29,7 @@ public class SwaggerConfig {
Docket docket = new Docket(DocumentationType.SWAGGER_2) Docket docket = new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo()) .apiInfo(apiInfo())
.select() .select()
.apis(RequestHandlerSelectors.basePackage(CommunityConstant.PACKAGE_BASE)) .apis(RequestHandlerSelectors.basePackage(CommunityConstant.PACKAGE_BASE+".controller"))
.paths(PathSelectors.any()) .paths(PathSelectors.any())
.build(); .build();
......
...@@ -7,6 +7,8 @@ import com.tanpu.community.api.beans.qo.NotificationQo; ...@@ -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.qo.ThemeNotifyQo;
import com.tanpu.community.api.beans.req.notification.NotifyQueryReq; import com.tanpu.community.api.beans.req.notification.NotifyQueryReq;
import com.tanpu.community.manager.NotificationManager; import com.tanpu.community.manager.NotificationManager;
import io.swagger.annotations.Api;
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.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -24,6 +26,7 @@ import java.util.List; ...@@ -24,6 +26,7 @@ import java.util.List;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("/api/notification") @RequestMapping("/api/notification")
@Api(value = "圈子消息通知")
public class NotificationController { public class NotificationController {
@Autowired @Autowired
...@@ -35,6 +38,7 @@ public class NotificationController { ...@@ -35,6 +38,7 @@ public class NotificationController {
@AuthLogin @AuthLogin
@PostMapping("/query") @PostMapping("/query")
@ResponseBody @ResponseBody
@ApiOperation(value = "查找用戶的消息通知列表")
public CommonResp<List<ThemeNotifyQo>> query(@RequestBody NotifyQueryReq req){ public CommonResp<List<ThemeNotifyQo>> query(@RequestBody NotifyQueryReq req){
List<ThemeNotifyQo> query = notificationManager.queryList(req, userHolder.getUserId()); List<ThemeNotifyQo> query = notificationManager.queryList(req, userHolder.getUserId());
...@@ -44,6 +48,7 @@ public class NotificationController { ...@@ -44,6 +48,7 @@ public class NotificationController {
@AuthLogin @AuthLogin
@GetMapping("/updateCount") @GetMapping("/updateCount")
@ResponseBody @ResponseBody
@ApiOperation(value = "更新推送")
public CommonResp<NotificationQo> query(){ public CommonResp<NotificationQo> query(){
NotificationQo notificationQO = notificationManager.queryBriefInfo(userHolder.getUserId()); NotificationQo notificationQO = notificationManager.queryBriefInfo(userHolder.getUserId());
......
...@@ -8,6 +8,7 @@ import com.tanpu.community.api.beans.qo.ThemeNotifyQo; ...@@ -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.qo.ThemeQo;
import com.tanpu.community.api.beans.req.notification.NotifyQueryReq; import com.tanpu.community.api.beans.req.notification.NotifyQueryReq;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp; 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.cache.RedisCache;
import com.tanpu.community.dao.entity.community.NotificationEntity; import com.tanpu.community.dao.entity.community.NotificationEntity;
import com.tanpu.community.dao.entity.community.TopicEntity; import com.tanpu.community.dao.entity.community.TopicEntity;
...@@ -68,7 +69,17 @@ public class NotificationManager { ...@@ -68,7 +69,17 @@ public class NotificationManager {
if (StringUtils.isNotEmpty(themeNotifyQo.getFormerThemeId())){ if (StringUtils.isNotEmpty(themeNotifyQo.getFormerThemeId())){
FormerThemeQo former = redisCache.getObject(StringUtils.joinWith("_", CACHE_FORWARD_THEME_ID, themeNotifyQo.getFormerThemeId()), 60, FormerThemeQo former = redisCache.getObject(StringUtils.joinWith("_", CACHE_FORWARD_THEME_ID, themeNotifyQo.getFormerThemeId()), 60,
() -> this.getFormerTheme(themeNotifyQo.getFormerThemeId()), FormerThemeQo.class); () -> 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())){ if (StringUtils.isNotEmpty(themeNotifyQo.getTopicId())){
TopicEntity topicEntity = topicService.queryById(themeNotifyQo.getTopicId()); TopicEntity topicEntity = topicService.queryById(themeNotifyQo.getTopicId());
......
...@@ -37,8 +37,8 @@ public class RankService { ...@@ -37,8 +37,8 @@ public class RankService {
public Double forwardRate; public Double forwardRate;
@Value("${rank.theme.commentRate:2}") @Value("${rank.theme.commentRate:2}")
public Double commentRate; public Double commentRate;
@Value("${rank.theme.likeRaten:3}") @Value("${rank.theme.likeRate:3}")
public Double likeRaten; public Double likeRate;
@Value("${rank.theme.collectRate:3}") @Value("${rank.theme.collectRate:3}")
public Double collectRate; public Double collectRate;
//用户质量权重 //用户质量权重
...@@ -278,7 +278,7 @@ public class RankService { ...@@ -278,7 +278,7 @@ public class RankService {
double w = theme.getViewCount() * viewRate double w = theme.getViewCount() * viewRate
+ theme.getForwardCount() * forwardRate + theme.getForwardCount() * forwardRate
+ theme.getCommentCount() * commentRate + theme.getCommentCount() * commentRate
+ theme.getLikeCount() * likeRaten + theme.getLikeCount() * likeRate
+ theme.getCollectCount() * collectRate + theme.getCollectCount() * collectRate
+ Math.pow(theme.getUserWeight(), userWeightRate); + Math.pow(theme.getUserWeight(), userWeightRate);
double score = (w + initialWeight) / Math.pow(theme.getMinutesTillNow() + 1, timeRate); double score = (w + initialWeight) / Math.pow(theme.getMinutesTillNow() + 1, timeRate);
......
apollo.bootstrap.enabled: false apollo.bootstrap.enabled: false
#app.id: tanpu-community #app.id: tanpu-community
springfox:
documentation:
swagger:
v2:
path: /api-docs
#apollo: #apollo:
# meta: http://dev-apollo.tamp-innner.com:8080 # meta: http://dev-apollo.tamp-innner.com:8080
# cacheDir: ./apollocache/ # cacheDir: ./apollocache/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment