Commit 83fc55bd authored by 刘基明's avatar 刘基明

接口调整

parent 494f79af
package com.tanpu.community.api.beans.req.theme; package com.tanpu.community.api.beans.req.theme;
import com.tanpu.community.api.beans.ImagesDTO;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.util.List;
@Data @Data
@ApiModel(value = "主题内容") @ApiModel(value = "主题内容")
public class ThemeContentReq { public class ThemeContentReq {
...@@ -17,4 +14,10 @@ public class ThemeContentReq { ...@@ -17,4 +14,10 @@ public class ThemeContentReq {
@ApiModelProperty(value = "文本的值是内容,附件的值为id") @ApiModelProperty(value = "文本的值是内容,附件的值为id")
private String value; private String value;
@ApiModelProperty(value = "产品类型")
private Integer productType;
@ApiModelProperty(value = "产品推荐语")
private String remark;
} }
package com.tanpu.community.api.enums;
/**
* 资源类型
*/
public enum RelTypeEnum {
/**
* 专栏
*/
COLUMN(1, "栏目"),
/**
* 课程包
*/
PACKAGE(2, "课程包"),
/**
* 直播
*/
LIVE(3, "直播"),
/**
* 视频
*/
VIDEO(4, "视频"),
/**
* 音频
*/
AUDIO(5, "音频"),
/**
* 短视频
*/
SHORT_VIDEO(6, "小视频"),
/**
* 课件
*/
COURSE_WARE(7, "直播课件"),
/**
* 文本类型
*/
TEXT(8, "文本"),
FUND(88, "产品"),
PINGLUN(99, "评论"),
TAMP_CAMP(101, "训练营"),
SPECIAL_IMG(122, "专栏-图片"),
RES_FILE(121, "资源文件"),
ARTICLE(202, "文章"),
DAYREPORT(204, "早报"),
/**
* 新版课程包
*/
NEW_COURSE_WARE(300, "新版课程 - 课程包"),
/**
* 新版课程
*/
NEW_COURSE_CHAPTER(301, "新版课程 - 章节"),
/**
* 新版课程
*/
NEW_COURSE_SECTION_AUDIO(303, "新版课程 - 小节 - 音频"),
/**
* 新版课程
*/
NEW_COURSE_SECTION_VIDEO(304, "新版课程 - 小节 - 视频"),
/**
* 新版课件
*/
NEW_COURSE_SECTION_KEJIAN(305, "新版课件 - 课件 - 课件");
/**
* 前端用的类型
*/
public String type;
/**
* 名称
*/
public String name;
RelTypeEnum(Integer type, String name) {
this.type = type.toString();
this.name = name;
}
}
package com.tanpu.community.util; package com.tanpu.community.util;
import com.tanpu.community.api.beans.qo.TopicTitileQo;
import com.tanpu.community.api.beans.TopicDO; import com.tanpu.community.api.beans.TopicDO;
import com.tanpu.community.api.beans.qo.CommentLv2Qo; import com.tanpu.community.api.beans.qo.*;
import com.tanpu.community.api.beans.qo.CommentQo;
import com.tanpu.community.api.beans.qo.FollowQo;
import com.tanpu.community.api.beans.qo.ThemeQo;
import com.tanpu.community.api.beans.req.theme.CreateThemeReq; import com.tanpu.community.api.beans.req.theme.CreateThemeReq;
import com.tanpu.community.api.beans.req.theme.ThemeContentReq;
import com.tanpu.community.api.enums.DeleteTagEnum; import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.dao.entity.community.*; import com.tanpu.community.dao.entity.community.*;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -100,17 +97,18 @@ public class ConvertUtil { ...@@ -100,17 +97,18 @@ public class ConvertUtil {
} }
public static List<ThemeAttachmentEntity> themeReqToAttachmentList(CreateThemeReq req, String themeId) { public static List<ThemeAttachmentEntity> themeReqToAttachmentList(CreateThemeReq req, String themeId) {
if (req == null || req.getAttachment() == null || req.getAttachment().size() == 0) { List<ThemeContentReq> contents = req.getContent();
return Collections.emptyList();
}
List<ThemeAttachmentEntity> list = new ArrayList<>(); List<ThemeAttachmentEntity> list = new ArrayList<>();
req.getAttachment().forEach((k, v) -> { for (ThemeContentReq content : contents) {
list.add(ThemeAttachmentEntity.builder() if (!RelTypeEnum.TEXT.type.equals(content.getType())){
.attachType(Integer.valueOf(k)) list.add(ThemeAttachmentEntity.builder()
.attachId(v) .attachType(Integer.valueOf(content.getType()))
.themeId(themeId) .attachId(content.getValue())
.build()); .themeId(themeId)
}); .build());
}
}
return list; return list;
} }
......
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