Commit f043bc2c authored by xd's avatar xd

Merge branch 'dev' of 47.100.44.39:tp-backend/tanpu-community into dev

parents d06593d4 69bbe345
...@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModelProperty; ...@@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.Map;
@Data @Data
public class ThemeQo { public class ThemeQo {
...@@ -57,7 +57,7 @@ public class ThemeQo { ...@@ -57,7 +57,7 @@ public class ThemeQo {
private Long likeAmount; private Long likeAmount;
@ApiModelProperty("附件") @ApiModelProperty("附件")
private List<Object> attachment; private Map<String,Object> attachment;
private Object attachmentInfo; private Object attachmentInfo;
......
...@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import java.util.List; import java.util.List;
//@FeignClient(value = "service-tanpuroom", contextId = "tanpuroom", fallbackFactory = FeignBackClientForTanpuroom.class, path = "/tanpuroom") //@FeignClient(value = "service-tanpuroom", contextId = "tanpuroom", fallbackFactory = FeignBackClientForTanpuroom.class, path = "/tanpuroom")
@FeignClient(value = "service-tanpuroom", contextId = "tanpuroom", fallbackFactory = FeignBackClientForTanpuroom.class, path = "http://127.0.0.1:8194/tanpuroom") @FeignClient(value = "service-tanpuroom", contextId = "tanpuroom", fallbackFactory = FeignBackClientForTanpuroom.class, url = "http://127.0.0.1:8086/tanpuroom")
public interface FeignClientForTanpuroom { public interface FeignClientForTanpuroom {
......
...@@ -12,8 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -12,8 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.List; import java.util.List;
@FeignClient(value = "service-zhibo", fallbackFactory = FeignbackForZhibo.class, path = "/zhibo") //@FeignClient(value = "service-zhibo", fallbackFactory = FeignbackForZhibo.class, path = "/zhibo")
//@FeignClient(value = "service-zhibo", fallbackFactory = FeignbackForZhibo.class, url = "http://127.0.0.1:8183/zhibo") @FeignClient(value = "service-zhibo", fallbackFactory = FeignbackForZhibo.class, url = "http://127.0.0.1:8183/zhibo")
public interface FeignClientForZhibo { public interface FeignClientForZhibo {
@ApiOperation(value = "根据直播间id查询直播间信息") @ApiOperation(value = "根据直播间id查询直播间信息")
......
package com.tanpu.community.manager; package com.tanpu.community.manager;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.common.exception.BizException;
import com.tanpu.community.api.beans.ForwardThemeReq; import com.tanpu.community.api.beans.ForwardThemeReq;
import com.tanpu.community.api.beans.qo.MainTextQo; import com.tanpu.community.api.beans.qo.MainTextQo;
import com.tanpu.community.api.beans.qo.ThemeQo; import com.tanpu.community.api.beans.qo.ThemeQo;
...@@ -11,11 +12,12 @@ import com.tanpu.community.api.enums.CollectionTypeEnum; ...@@ -11,11 +12,12 @@ import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.CommentTypeEnum; import com.tanpu.community.api.enums.CommentTypeEnum;
import com.tanpu.community.api.enums.ThemeTypeEnum; import com.tanpu.community.api.enums.ThemeTypeEnum;
import com.tanpu.community.dao.entity.community.*; import com.tanpu.community.dao.entity.community.*;
import com.tanpu.community.feign.course.FeignClientForCourse;
import com.tanpu.community.feign.course.vo.CourseDetailExt;
import com.tanpu.community.feign.product.FeignClientForProducts; import com.tanpu.community.feign.product.FeignClientForProducts;
import com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom; import com.tanpu.community.feign.tanpuroom.FeignClientForTanpuroom;
import com.tanpu.community.feign.tanpuroom.vo.CurriCulumInfoDetailDto; import com.tanpu.community.feign.vo.ProductInfoVO;
import com.tanpu.community.feign.tanpuroom.vo.CurriculumDetailVo; import com.tanpu.community.feign.vo.ShortVideoBaseInfoResp;
import com.tanpu.community.feign.vo.*;
import com.tanpu.community.feign.zhibo.FeignClientForZhibo; import com.tanpu.community.feign.zhibo.FeignClientForZhibo;
import com.tanpu.community.feign.zhibo.vo.ZhiboDetailVO; import com.tanpu.community.feign.zhibo.vo.ZhiboDetailVO;
import com.tanpu.community.service.*; import com.tanpu.community.service.*;
...@@ -29,11 +31,7 @@ import javax.annotation.Resource; ...@@ -29,11 +31,7 @@ import javax.annotation.Resource;
import java.time.Duration; import java.time.Duration;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Arrays; import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@Service @Service
public class ThemeManager { public class ThemeManager {
...@@ -82,6 +80,9 @@ public class ThemeManager { ...@@ -82,6 +80,9 @@ public class ThemeManager {
@Resource @Resource
private FeignClientForProducts feignClientForProducts; private FeignClientForProducts feignClientForProducts;
@Autowired
private FeignClientForCourse feignClientForCourse;
public void publishTheme(CreateThemeReq req, String userId) { public void publishTheme(CreateThemeReq req, String userId) {
ThemeEntity themeEntity = new ThemeEntity(); ThemeEntity themeEntity = new ThemeEntity();
BeanUtils.copyProperties(req, themeEntity); BeanUtils.copyProperties(req, themeEntity);
...@@ -113,7 +114,7 @@ public class ThemeManager { ...@@ -113,7 +114,7 @@ public class ThemeManager {
//计算迄今时间 //计算迄今时间
private String calUpToNowTime(LocalDateTime start) { private String calUpToNowTime(LocalDateTime start) {
Duration between = Duration.between(LocalDateTime.now(), start); Duration between = Duration.between(start, LocalDateTime.now());
long duration = between.toMinutes(); long duration = between.toMinutes();
if (duration < 1) { if (duration < 1) {
return "刚刚"; return "刚刚";
...@@ -211,13 +212,14 @@ public class ThemeManager { ...@@ -211,13 +212,14 @@ public class ThemeManager {
for (ThemeQo themeQO : themeQos) { for (ThemeQo themeQO : themeQos) {
//附件列表 //附件列表
List<ThemeAttachmentEntity> attachments = themeAttachmentService.selectByThemeId(themeQO.getId()); List<ThemeAttachmentEntity> attachments = themeAttachmentService.selectByThemeId(themeQO.getId());
if (CollectionUtils.isEmpty(attachments)) { if (!CollectionUtils.isEmpty(attachments)) {
continue; HashMap<String,Object> attachmentQos= new HashMap<>();
attachments.forEach(o->attachmentQos.put(o.getAttchId(),transferAttachment(o,userId)));
themeQO.setAttachment(attachmentQos);
} }
List<Object> obs = attachments.stream().map(themeAttachmentEntity -> transferAttachment(themeAttachmentEntity, userId)).collect(Collectors.toList()); //迄今时间
themeQO.setAttachment(obs);
//是否关注作者
themeQO.setUpToNowTime(calUpToNowTime(themeQO.getCreateTime())); themeQO.setUpToNowTime(calUpToNowTime(themeQO.getCreateTime()));
//是否关注作者
String authorId = themeQO.getAuthorId(); String authorId = themeQO.getAuthorId();
Set<String> fansSet = new HashSet<>(fansRelService.queryFansByFollowerId(userId)); Set<String> fansSet = new HashSet<>(fansRelService.queryFansByFollowerId(userId));
themeQO.setFollow(fansSet.contains(authorId)); themeQO.setFollow(fansSet.contains(authorId));
...@@ -225,6 +227,8 @@ public class ThemeManager { ...@@ -225,6 +227,8 @@ public class ThemeManager {
HomePageEntity userEntity = homePageService.selectByUserId(userId); HomePageEntity userEntity = homePageService.selectByUserId(userId);
themeQO.setUserImg(userEntity.getHeadImg()); themeQO.setUserImg(userEntity.getHeadImg());
themeQO.setNickName(userEntity.getNickName()); themeQO.setNickName(userEntity.getNickName());
} }
return themeQos; return themeQos;
} }
...@@ -245,16 +249,25 @@ public class ThemeManager { ...@@ -245,16 +249,25 @@ public class ThemeManager {
return zhiboDetailVOCommonResp.getData(); return zhiboDetailVOCommonResp.getData();
// return zhiboService.selectByid(themeAttachment.getAttchId()); // return zhiboService.selectByid(themeAttachment.getAttchId());
case 3: case 3:
String[] attachmentIds= new String[]{attachmentId}; String[] attachmentIds = new String[]{attachmentId};
CommonResp<List<ShortVideoBaseInfoResp>> shortVideoBaseInfo = CommonResp<List<ShortVideoBaseInfoResp>> shortVideoBaseInfo =
feignClientForTanpuroom.getShortVideoBaseInfo(Arrays.asList(attachmentIds)); feignClientForTanpuroom.getShortVideoBaseInfo(Arrays.asList(attachmentIds));
return shortVideoBaseInfo.getData().get(0); return shortVideoBaseInfo.getData().get(0);
// CurriculumResEntity curriculumResEntity = curriculumResService.selectShortVideo(themeAttachment.getAttchId()); // CurriculumResEntity curriculumResEntity = curriculumResService.selectShortVideo(themeAttachment.getAttchId());
// return curriculumResEntity; // return curriculumResEntity;
case 4: case 4:
CurriCulumInfoDetailDto curriCulumInfoDetailDto = CurriCulumInfoDetailDto.builder().curriculumId(attachmentId).userId(userId).build(); String[] split = attachmentId.split(",");
CommonResp<CurriculumDetailVo> curriculumDetailVoCommonResp = feignClientForTanpuroom.queryCurriculumDetail(curriCulumInfoDetailDto); if (split.length != 2) {
return curriculumDetailVoCommonResp.getData(); throw new BizException("课程id格式错误:" + attachmentId);
}
String courseId = split[0];
String packageId = split[1];
CommonResp<CourseDetailExt> courseIdDetailInfo = feignClientForCourse.getCourseIdDetailInfo(courseId, packageId);
return courseIdDetailInfo.getData();
// CurriCulumInfoDetailDto curriCulumInfoDetailDto = CurriCulumInfoDetailDto.builder().curriculumId(attachmentId).userId(userId).build();
// CommonResp<CurriculumDetailVo> curriculumDetailVoCommonResp = feignClientForTanpuroom.queryCurriculumDetail(curriCulumInfoDetailDto);
// return curriculumDetailVoCommonResp.getData();
// curriculumResEntity = curriculumResService.selectById(themeAttachment.getAttchId()); // curriculumResEntity = curriculumResService.selectById(themeAttachment.getAttchId());
// //
// OrderFlowEntity orderFlowEntity = orderFlowService.queryByUserAndProId(themeAttachment.getThemeId(), userId); // OrderFlowEntity orderFlowEntity = orderFlowService.queryByUserAndProId(themeAttachment.getThemeId(), userId);
......
apollo.bootstrap.enabled: false apollo.bootstrap.enabled: true
#app.id: tanpu-community #app.id: tanpu-community
#apollo: #apollo:
......
...@@ -13,9 +13,7 @@ apollo.bootstrap.enabled: true ...@@ -13,9 +13,7 @@ apollo.bootstrap.enabled: true
app.id: tp-community app.id: tp-community
apollo: apollo:
meta: http://prod-feo-apollo.tamp-innner.com:8080 meta: http://apollo.caixiaoquan.com:8080
cacheDir: ./apollocache/ cacheDir: ./apollocache/
bootstrap: bootstrap:
namespaces: application.yml namespaces: application.yml
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<spring.boot.version>2.3.11.RELEASE</spring.boot.version> <spring.boot.version>2.3.11.RELEASE</spring.boot.version>
<spring-cloud.version>Hoxton.SR11</spring-cloud.version> <spring-cloud.version>Hoxton.SR11</spring-cloud.version>
<project.version>1.0.0-SNAPSHOT</project.version> <project.version>1.0.0-SNAPSHOT</project.version>
<springfox-version>2.9.2</springfox-version>
</properties> </properties>
<modules> <modules>
......
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