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

圈子消息通知-fix

parent 2d1c98a1
......@@ -11,7 +11,6 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
@ApiModel(value = "圈子消息通知-概要")
public class NotificationQo {
@ApiModelProperty(value = "未读条数")
......
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 = "用户头像")
......
......@@ -8,7 +8,6 @@ import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value = "请求")
@Data
@Builder
@NoArgsConstructor
......
......@@ -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) {
......
......@@ -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();
......
......@@ -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());
......
......@@ -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());
......
......@@ -37,8 +37,8 @@ public class RankService {
public Double forwardRate;
@Value("${rank.theme.commentRate:2}")
public Double commentRate;
@Value("${rank.theme.likeRaten:3}")
public Double likeRaten;
@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() * likeRaten
+ theme.getLikeCount() * likeRate
+ theme.getCollectCount() * collectRate
+ Math.pow(theme.getUserWeight(), userWeightRate);
double score = (w + initialWeight) / Math.pow(theme.getMinutesTillNow() + 1, timeRate);
......
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/
......
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