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

主题接口修改

parent b4d12b79
package com.tanpu.community.api.constants;
public class CommunityConstant {
public static final String OSS_PREFIX_URL ="https://tamp-sit.oss-cn-shanghai.aliyuncs.com";
}
......@@ -14,11 +14,9 @@ import com.tanpu.community.api.beans.vo.feign.CoursePackageDetail;
import com.tanpu.community.api.beans.vo.feign.ProductInfoVO;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.ZhiboDetailVO;
import com.tanpu.community.api.constants.CommunityConstant;
import com.tanpu.community.api.enums.*;
import com.tanpu.community.dao.entity.community.BlackListEntity;
import com.tanpu.community.dao.entity.community.HomePageEntity;
import com.tanpu.community.dao.entity.community.ThemeAttachmentEntity;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.dao.entity.community.*;
import com.tanpu.community.feign.course.FeignClientForCourse;
import com.tanpu.community.feign.product.FeignClientForProducts;
import com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom;
......@@ -87,6 +85,8 @@ public class ThemeManager {
@Autowired
private FeignClientForCourse feignClientForCourse;
private OSSFileService ossFileService;
public void publishTheme(CreateThemeReq req, String userId) {
......@@ -298,10 +298,15 @@ public class ThemeManager {
String packageId = themeContentQo.getValue();
CommonResp<CoursePackageDetail> courseIdDetailInfo = feignClientForCourse.getCoursePackageDetailInfo(packageId);
themeContentQo.setDetail(AttachmentDetailVo.builder().coursePackageDetail(courseIdDetailInfo.getData()).build());
}else if (RelTypeEnum.SINGLE_IMG.type.equals(type)) {
//单图,根据id传入url
String imgId = themeContentQo.getValue();
FileRecordEntity fileEntity = ossFileService.queryById(imgId);
themeContentQo.setValue(CommunityConstant.OSS_PREFIX_URL+fileEntity.getFileOssKey());
}
}
}
//计算迄今时间
......
......@@ -79,4 +79,8 @@ public class OSSFileService {
return record;
}
public FileRecordEntity queryById(String fileId) {
return fileRecordMapper.selectById(fileId);
}
}
......@@ -2,6 +2,7 @@ package com.tanpu.community.util;
import com.fasterxml.jackson.core.type.TypeReference;
import com.tanpu.common.util.JsonUtil;
import com.tanpu.community.api.beans.ImagesDTO;
import com.tanpu.community.api.beans.TopicDO;
import com.tanpu.community.api.beans.qo.*;
import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
......@@ -105,17 +106,35 @@ public class ConvertUtil {
}
}
/**
* 解析 List<ThemeContentReq>为Attachment列表
* @param req
* @param themeId
* @return
*/
public static List<ThemeAttachmentEntity> themeReqToAttachmentList(CreateThemeReq req, String themeId) {
List<ThemeContentReq> contents = req.getContent();
List<ThemeAttachmentEntity> list = new ArrayList<>();
for (ThemeContentReq content : contents) {
if (!RelTypeEnum.TEXT.type.equals(content.getType())){
list.add(ThemeAttachmentEntity.builder()
.attachType(Integer.valueOf(content.getType()))
.attachId(content.getValue())
.themeId(themeId)
.build());
//讨论-多图类型,拆开解析到attachment表中
if ((content.getType().equals(RelTypeEnum.MULTIPLE_IMAGE.type))){
List<ImagesDTO> imgList = content.getImgList();
for (ImagesDTO imagesDTO : imgList) {
list.add(ThemeAttachmentEntity.builder()
.attachType(Integer.valueOf(RelTypeEnum.SINGLE_IMG.type))
.attachId(imagesDTO.getRelId())
.themeId(themeId)
.build());
}
}else {
list.add(ThemeAttachmentEntity.builder()
.attachType(Integer.valueOf(content.getType()))
.attachId(content.getValue())
.themeId(themeId)
.build());
}
}
}
return list;
......
......@@ -30,7 +30,7 @@ CREATE TABLE `follow_rel` (
CREATE TABLE `theme` (
`id` int(32) auto_increment PRIMARY KEY COMMENT 'id',
`theme_id` varchar(64) NOT NULL COMMENT 'UUID',
`title` varchar(64) NOT NULL COMMENT '标题',
`title` varchar(64) COMMENT '标题',
`theme_type` int(4) NOT NULL COMMENT '类型',
`content` text COMMENT '文本内容',
`attach_type` int(4) NOT NULL COMMENT '附件类型',
......
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