Commit 5af7e2b0 authored by 张辰's avatar 张辰

主题查询,添加主题不可见

parent 31e44573
...@@ -52,7 +52,7 @@ public class ThemeController { ...@@ -52,7 +52,7 @@ public class ThemeController {
@ResponseBody @ResponseBody
public CommonResp<ThemeQo> getDetail(@RequestParam(value = "themeId") String themeId) { public CommonResp<ThemeQo> getDetail(@RequestParam(value = "themeId") String themeId) {
String userId = userHolder.getUserId(); String userId = userHolder.getUserId();
return CommonResp.success(themeManager.getThemeDetail(themeId, userId)); return themeManager.getThemeDetail(themeId, userId);
} }
@AuthLogin @AuthLogin
......
...@@ -25,11 +25,7 @@ import com.tanpu.community.api.beans.resp.CreateThemeResp; ...@@ -25,11 +25,7 @@ import com.tanpu.community.api.beans.resp.CreateThemeResp;
import com.tanpu.community.api.beans.resp.ThemeFullSearchResp; import com.tanpu.community.api.beans.resp.ThemeFullSearchResp;
import com.tanpu.community.api.beans.resp.ThemeListResp; import com.tanpu.community.api.beans.resp.ThemeListResp;
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.BlockTypeEnum; import com.tanpu.community.api.enums.*;
import com.tanpu.community.api.enums.OperationTypeEnum;
import com.tanpu.community.api.enums.ThemeListTypeEnum;
import com.tanpu.community.api.enums.ThemeRecordTypeEnum;
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.BlackListEntity; import com.tanpu.community.dao.entity.community.BlackListEntity;
import com.tanpu.community.dao.entity.community.CollectionEntity; import com.tanpu.community.dao.entity.community.CollectionEntity;
...@@ -450,21 +446,15 @@ public class ThemeManager { ...@@ -450,21 +446,15 @@ public class ThemeManager {
// 查询正文 // 查询正文
public ThemeQo getThemeDetail(String themeId, String userId) { public CommonResp<ThemeQo> getThemeDetail(String themeId, String userId) {
// 查询详情
ThemeQo themeQo = redisCache.getObject(StringUtils.joinWith("_", CACHE_THEME_ID, themeId), 60,
() -> this.getDetailCommon(themeId), ThemeQo.class);
// 添加用户相关信息
buildThemeExtraInfoByUser(userId, themeQo);
return themeQo;
}
// 正文通用信息,与用户无关,可使用缓存
private ThemeQo getDetailCommon(String themeId) {
ThemeEntity themeEntity = themeService.queryByThemeId(themeId); ThemeEntity themeEntity = themeService.queryByThemeId(themeId);
if (themeEntity == null) { if (themeEntity == null) {
throw new BizException("找不到帖子id:" + themeId); throw new BizException("找不到帖子id:" + themeId);
} }
if (themeEntity.getDeleteTag().equals(DeleteTagEnum.DELETED.getCode())) {
return CommonResp.error(ErrorCodeConstant.UNREACHABLE, null);
}
ThemeQo themeQo = ConvertUtil.themeEntityToQo(themeEntity); ThemeQo themeQo = ConvertUtil.themeEntityToQo(themeEntity);
//附件 //附件
batchFeignCallService.getAttachDetail(themeQo); batchFeignCallService.getAttachDetail(themeQo);
...@@ -474,11 +464,11 @@ public class ThemeManager { ...@@ -474,11 +464,11 @@ public class ThemeManager {
//时间重制 //时间重制
themeQo.setUpToNowTime(TimeUtils.format(themeEntity.getCreateTime())); themeQo.setUpToNowTime(TimeUtils.format(themeEntity.getCreateTime()));
// 添加用户相关信息
return themeQo; buildThemeExtraInfoByUser(userId, themeQo);
return CommonResp.success();
} }
// 点赞/取消点赞 // 点赞/取消点赞
public void like(LikeThemeReq req, String userId) { public void like(LikeThemeReq req, String userId) {
if (OperationTypeEnum.CONFIRM.getCode().equals(req.getType())) { if (OperationTypeEnum.CONFIRM.getCode().equals(req.getType())) {
......
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