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

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

parent 31e44573
......@@ -52,7 +52,7 @@ public class ThemeController {
@ResponseBody
public CommonResp<ThemeQo> getDetail(@RequestParam(value = "themeId") String themeId) {
String userId = userHolder.getUserId();
return CommonResp.success(themeManager.getThemeDetail(themeId, userId));
return themeManager.getThemeDetail(themeId, userId);
}
@AuthLogin
......
......@@ -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.ThemeListResp;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp;
import com.tanpu.community.api.enums.BlockTypeEnum;
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.api.enums.*;
import com.tanpu.community.cache.RedisCache;
import com.tanpu.community.dao.entity.community.BlackListEntity;
import com.tanpu.community.dao.entity.community.CollectionEntity;
......@@ -450,21 +446,15 @@ public class ThemeManager {
// 查询正文
public 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) {
public CommonResp<ThemeQo> getThemeDetail(String themeId, String userId) {
ThemeEntity themeEntity = themeService.queryByThemeId(themeId);
if (themeEntity == null) {
throw new BizException("找不到帖子id:" + themeId);
}
if (themeEntity.getDeleteTag().equals(DeleteTagEnum.DELETED.getCode())) {
return CommonResp.error(ErrorCodeConstant.UNREACHABLE, null);
}
ThemeQo themeQo = ConvertUtil.themeEntityToQo(themeEntity);
//附件
batchFeignCallService.getAttachDetail(themeQo);
......@@ -474,11 +464,11 @@ public class ThemeManager {
//时间重制
themeQo.setUpToNowTime(TimeUtils.format(themeEntity.getCreateTime()));
return themeQo;
// 添加用户相关信息
buildThemeExtraInfoByUser(userId, themeQo);
return CommonResp.success();
}
// 点赞/取消点赞
public void like(LikeThemeReq req, String userId) {
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