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

修改RelType类型

parent b75a6026
......@@ -9,13 +9,11 @@ import lombok.Data;
@ApiModel(value = "讨论多图存储对象,等同于newsFeedRes")
public class ImagesDTO {
private Integer productType;
@ApiModelProperty("关联id")
private String relId;
@ApiModelProperty("关联类型 产品:88 直播:3 短视频:6 图片:122")
private Integer relType;
private String remark;
......
......@@ -24,6 +24,9 @@ public class ThemeContentQo {
@ApiModelProperty(value = "产品推荐语")
private String remark;
@ApiModelProperty(value = "附件标题")
private String resTitle;
@ApiModelProperty(value = "讨论中的图片列表")
private List<ImagesDTO> imgList;
......
......@@ -23,6 +23,9 @@ public class ThemeContentReq {
@ApiModelProperty(value = "产品推荐语")
private String remark;
@ApiModelProperty(value = "附件标题")
private String resTitle;
@ApiModelProperty(value = "讨论中的图片列表")
private List<ImagesDTO> imgList;
......
package com.tanpu.community.api.beans.vo.feign;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author: zyh
* @date: 2021-03-13 4:51 下午
* @description:
*/
@ApiModel("附件查询返回结果")
@Data
public class FileQueryResp {
@ApiModelProperty("附件ID")
private String guid;
@ApiModelProperty("文件原始名称")
private String originalName;
@ApiModelProperty("文件原链接")
private String originalUrl;
@ApiModelProperty("文件链接")
private String logicalPath;
@ApiModelProperty("文件后缀名")
private String fileSuffix;
@ApiModelProperty(value = "文件类型", notes = "com.tanpu.common.enums.FileTypeEnums")
private String fileType;
@ApiModelProperty("文件属性")
private String fileAttr;
}
package com.tanpu.community.api.enums;
import org.apache.commons.collections4.SetUtils;
import java.util.HashSet;
public enum FileTypeEnum {
IMAGE(1,"图片类型"),QUERY_IDOLS(2,"查询关注");
public static final HashSet<String> imageTypeSet = SetUtils.hashSet("jpg", "jpeg", "png");
private Integer code;
private String type;
FileTypeEnum(Integer code, String type) {
this.code = code;
this.type = type;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
......@@ -7,85 +7,90 @@ public enum RelTypeEnum {
/**
* 专栏
*/
COLUMN(1, "栏目"),
COLUMN(1, "栏目", 4),
/**
* 课程包
*/
PACKAGE(2, "课程包"),
PACKAGE(2, "课程包", 2),
/**
* 直播
*/
LIVE(3, "直播"),
LIVE(3, "直播", 1),
/**
* 视频
*/
VIDEO(4, "视频"),
VIDEO(4, "视频", 2),
/**
* 音频
*/
AUDIO(5, "音频"),
AUDIO(5, "音频", 2),
/**
* 短视频
*/
SHORT_VIDEO(6, "小视频"),
SHORT_VIDEO(6, "小视频", 6),
/**
* 课件
*/
COURSE_WARE(7, "直播课件"),
/**
* 文本类型
*/
TEXT(8, "文本"),
SINGLE_IMG(9, "单图"),
MULTIPLE_IMAGE(10, "多图"),
FUND(88, "产品", 88),
PINGLUN(99, "评论", 99),
TAMP_CAMP(101, "训练营", 101),
FUND(88, "产品"),
TEXT(108, "圈子-文本",108),
PINGLUN(99, "评论"),
SINGLE_IMG(109, "圈子-单图",109),
TAMP_CAMP(101, "训练营"),
MULTIPLE_IMAGE(110, "圈子-多图",110),
SPECIAL_IMG(122, "专栏-图片"),
RES_FILE(121, "资源文件", 121),
RES_FILE(121, "资源文件"),
IMAGE_FILE(122,"图片文件",122),
ARTICLE(202, "文章"),
ARTICLE(202, "文章", 202),
DAYREPORT(204, "早报"),
DAYREPORT(204, "早报", 204),
/**
* 新版课程
* 新版课程
*/
NEW_COURSE_WARE(300, "新版课程 - 课程包"),
NEW_COURSE_WARE(300, "新版课程 - 课程包", 300),
/**
* 新版课程
*/
NEW_COURSE_CHAPTER(301, "新版课程 - 章节"),
NEW_COURSE_CHAPTER(301, "新版课程 - 章节", 301),
/**
* 新版课程
*/
NEW_COURSE_SECTION_AUDIO(303, "新版课程 - 小节 - 音频"),
NEW_COURSE_SECTION_AUDIO(303, "新版课程 - 小节 - 音频", 303),
/**
* 新版课程
*/
NEW_COURSE_SECTION_VIDEO(304, "新版课程 - 小节 - 视频"),
NEW_COURSE_SECTION_VIDEO(304, "新版课程 - 小节 - 视频", 303),
/**
* 新版课件
* 新版课程附
*/
NEW_COURSE_SECTION_KEJIAN(305, "新版课件 - 课件 - 课件");
NEW_COURSE_COURSE_ATTACHMENT(305, "新版课程 - 课件", 305),
/**
* 运营活动 对应 tamp_jifen.activity_config
*/
ACTIVITY_CONFIG(306, "活动", 306),
INVITE_ACTIVITY(307, "邀请活动", 307),
GROUP_BUY(310, "拼团活动", 307),
SYSTEM(999, "系统赠送", 999),
;
/**
* 前端用的类型
......@@ -97,11 +102,37 @@ public enum RelTypeEnum {
*/
public String name;
/**
* 服务端使用的类型
*/
public Integer serverType;
RelTypeEnum(Integer type, String name) {
this.type = type.toString();
this.name = name;
}
RelTypeEnum(Integer type, String name, Integer serverType) {
this.type = type.toString();
this.name = name;
this.serverType = serverType;
}
/**
* 获取名称
*
* @param type
* @return
*/
public static String getTypeName(Integer type) {
if (type == null) {
return "";
}
for (RelTypeEnum relTypeEnum : RelTypeEnum.values()) {
if (Integer.valueOf(relTypeEnum.type)== type) {
return relTypeEnum.name;
}
}
return "";
}
}
package com.tanpu.community.feign.fatools;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.FileQueryResp;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.UserInfoVo;
import io.swagger.annotations.ApiOperation;
......@@ -10,6 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
import java.util.Set;
@FeignClient(value = "fatools", fallbackFactory = FeignbackForFatools.class, url = "http://172.20.1.250:8060/fatools")
......@@ -28,4 +30,7 @@ public interface FeignClientForFatools {
CommonResp<Set<String>> getNotRelaySet(@ApiParam("用户id") @RequestParam("userId") String userId,
@ApiParam("直播列表id") @RequestParam("roomIds") Set<String> roomIds);
@ApiOperation(value = "查询附件")
@GetMapping(value = "/file/queryFileMap")
Map<String, FileQueryResp> queryFileMap(@RequestParam("ids") List<String> ids);
}
package com.tanpu.community.feign.fatools;
import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.vo.feign.FileQueryResp;
import com.tanpu.community.api.beans.vo.feign.ShortVideoBaseInfoResp;
import com.tanpu.community.api.beans.vo.feign.UserInfoVo;
import feign.hystrix.FallbackFactory;
......@@ -8,6 +9,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
import java.util.Set;
@Slf4j
......@@ -29,6 +31,12 @@ public class FeignbackForFatools implements FallbackFactory<FeignClientForFatool
return null;
}
@Override
public Map<String, FileQueryResp> queryFileMap(List<String> ids) {
log.info("FeignbackForFatools.getCurriculumByColumnRelId调用失败", throwable);
return null;
}
@Override
public CommonResp<Set<String>> getNotRelaySet(String userId, Set roomIds) {
log.info("FeignbackForFatools.getNotRelaySet", throwable);
......
package com.tanpu.community.service;
import com.tanpu.common.constant.BizStatus;
import com.tanpu.common.exception.BizException;
import com.tanpu.common.util.AliyunOSSHelper;
import com.tanpu.common.uuid.UuidGenHelper;
import com.tanpu.community.api.enums.FileTypeEnum;
import com.tanpu.community.api.enums.OssRelType;
import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.dao.mapper.community.FileRecordMapper;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
......@@ -46,6 +49,7 @@ public class OSSFileService {
ossHelper = AliyunOSSHelper.build(endpoint, accessId, accessSK);
}
@Transactional
public FileRecordEntity uploadFile(byte[] data, String fileName) {
String fileSuffix = fileName.substring(fileName.lastIndexOf('.') + 1);
......@@ -62,23 +66,31 @@ public class OSSFileService {
public FileRecordEntity uploadFile(byte[] data, String fileName, String fileSuffix,
String relId, OssRelType relType) {
// todo uniqueLong
String key = String.valueOf(System.currentTimeMillis());
String id = String.valueOf(System.currentTimeMillis());
String[] arr = StringUtils.split(fileName, ".");
String suffix = arr[arr.length - 1];
if (FileTypeEnum.imageTypeSet.contains(suffix)) {
String id = uuidGenHelper.getUuidStr();
String key = id + "." + suffix;
ossHelper.writeFile(bucketName, key, data, fileSuffix);
FileRecordEntity record = new FileRecordEntity();
record.setFileId(uuidGenHelper.getUuidStr());
record.setDeleteTag(BizStatus.DeleteTag.tag_init);
record.setFileOssKey(key);
record.setFileId(fileName);
record.setFileName(fileName);
record.setFileId(id);
record.setPreviewUrl(ossHelper.getPreSignedUrl(bucketName, key));
record.setFileType(relType.type);
fileRecordMapper.insert(record);
return record;
}
throw new BizException("文件格式中暂不支持");
}
public FileRecordEntity queryById(String fileId) {
return fileRecordMapper.selectById(fileId);
......
......@@ -137,14 +137,13 @@ public class ProductService {
List<String> topicIds = Lists.newArrayList();
// 获取关联资源id
if (themeQos != null) {
themeQos.stream().forEach(o -> {
themeQos.forEach(o -> {
if (o.getTopicId() != null) {
topicIds.add(o.getTopicId());
}
});
themeQos.stream().forEach(o -> {
if (o.getContent() != null) {
o.getContent().stream().forEach(c -> {
themeQos.forEach(o -> o.getContent().forEach(c -> {
if (c.getType().equals(RelTypeEnum.LIVE.type)) {
zhiboIds.add(c.getValue());
} else if (c.getType().equals(RelTypeEnum.SHORT_VIDEO.type)) {
......@@ -170,9 +169,9 @@ public class ProductService {
c.getType().equals(RelTypeEnum.NEW_COURSE_SECTION_VIDEO.type)) {
courseIds.add(c.getValue());
}
});
}
});
})
);
}
if (!CollectionUtils.isEmpty(shortVideoIds)) {
......@@ -343,7 +342,7 @@ public class ProductService {
if (!StringUtils.isEmpty(themeQo.getTopicId()) && topicMap.containsKey(themeQo.getTopicId())) {
themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId()));
}
if (themeQo.getContent()==null){
if (themeQo.getContent() == null) {
continue;
}
for (ThemeContentQo themeContent : themeQo.getContent()) {
......
......@@ -91,4 +91,4 @@ aliyun:
endpoint: http://oss-cn-shanghai.aliyuncs.com
accessId: LTAIAKEzVydP0Q9P
accessSK: 59V9ke9txaIFzWxHFKTb1eoOOpmKpJ
bucketName: tamperfeodev
bucketName: tamp-sit
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