Commit 2eba7e55 authored by 刘基明's avatar 刘基明

用户信息源修改

parent 86342a55
...@@ -34,7 +34,7 @@ public class HomePageController { ...@@ -34,7 +34,7 @@ public class HomePageController {
@ResponseBody @ResponseBody
public CommonResp<String> editUserInfo(@Validated @RequestBody HomePageReq req){ public CommonResp<String> editUserInfo(@Validated @RequestBody HomePageReq req){
String userId="liujm"; String userId="liujm";
homePageManager.editUserInfo(req,userId); // homePageManager.editUserInfo(req,userId);
return CommonResp.success("修改成功"); return CommonResp.success("修改成功");
} }
......
package com.tanpu.community.controller; package com.tanpu.community.controller;
import com.tanpu.community.manager.KafkaManager; import com.tanpu.community.manager.KafkaManager;
import com.tanpu.community.service.UserInfoService;
import com.tanpu.community.service.VisitSummaryService; import com.tanpu.community.service.VisitSummaryService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -17,10 +18,13 @@ public class TestController { ...@@ -17,10 +18,13 @@ public class TestController {
@Autowired @Autowired
private VisitSummaryService visitSummaryService; private VisitSummaryService visitSummaryService;
@PostMapping(value = "/sendKafka")
@Autowired
private UserInfoService userInfoService;
@GetMapping(value = "/1")
@ResponseBody @ResponseBody
public String sendKafka(@RequestBody String message) { public Object sendKafka() {
visitSummaryService.updateDurByIdent("12", 1); return userInfoService.selectById("USER_INFO15912897523789");
return "22";
} }
} }
...@@ -21,13 +21,13 @@ public class CodeAutoGenerator { ...@@ -21,13 +21,13 @@ public class CodeAutoGenerator {
String author = "xudong"; String author = "xudong";
String mysqlUserName = "dev"; String mysqlUserName = "dev";
String mysqlPassword = "qimeng123"; String mysqlPassword = "qimeng123";
String jdbcUrl = "jdbc:mysql://47.101.189.151:31931/tamp_community"; String jdbcUrl = "jdbc:mysql://47.101.189.151:31931/tamp_user";
// String[] tables = new String[]{"follow_rel"}; String[] tables = new String[]{"user_info"};
String[] tables = new String[]{"follow_rel", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"}; // String[] tables = new String[]{"follow_rel", "black_list","collection","comment","follow_rel","file_record","home_page","theme","topic","theme_attachment"};
String basePackage = "com.tanpu.community"; String basePackage = "com.tanpu.community";
String mapperPackage = "dao.mapper.community"; String mapperPackage = "dao.mapper.user";
String entityPackage = "dao.entity.community"; String entityPackage = "dao.entity.user";
String xmlPath = "D:\\IdeaProjects\\tanpu-community\\community-service\\src\\main\\resources\\mapper\\community"; String xmlPath = "D:\\IdeaProjects\\tanpu-community\\community-service\\src\\main\\resources\\mapper\\user";
AutoGenerator autoGenerator = new AutoGenerator(); AutoGenerator autoGenerator = new AutoGenerator();
//全局配置 //全局配置
GlobalConfig gc = new GlobalConfig(); GlobalConfig gc = new GlobalConfig();
......
...@@ -6,14 +6,16 @@ import com.tanpu.community.api.beans.req.comment.LikeCommentReq; ...@@ -6,14 +6,16 @@ import com.tanpu.community.api.beans.req.comment.LikeCommentReq;
import com.tanpu.community.api.enums.CollectionTypeEnum; 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.dao.entity.community.CommentEntity; import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.entity.community.HomePageEntity; import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.service.CollectionService; import com.tanpu.community.service.CollectionService;
import com.tanpu.community.service.CommentService; import com.tanpu.community.service.CommentService;
import com.tanpu.community.service.HomePageService; import com.tanpu.community.service.HomePageService;
import com.tanpu.community.service.UserInfoService;
import com.tanpu.community.util.ConvertUtil; import com.tanpu.community.util.ConvertUtil;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
...@@ -29,6 +31,10 @@ public class CommentManager { ...@@ -29,6 +31,10 @@ public class CommentManager {
@Autowired @Autowired
private CollectionService collectionService; private CollectionService collectionService;
@Resource
private UserInfoService userInfoService;
// 评论(对主题) // 评论(对主题)
public void comment(CreateCommentReq req, String userId) { public void comment(CreateCommentReq req, String userId) {
CommentEntity commentEntity = CommentEntity.builder() CommentEntity commentEntity = CommentEntity.builder()
...@@ -54,9 +60,9 @@ public class CommentManager { ...@@ -54,9 +60,9 @@ public class CommentManager {
for (CommentQo commentQo : commentQos) { for (CommentQo commentQo : commentQos) {
//用户信息 //用户信息
String authorId = commentQo.getAuthorId(); String authorId = commentQo.getAuthorId();
HomePageEntity homePageEntity = homePageService.selectByUserId(authorId); UserInfoEntity userInfo = userInfoService.selectById(authorId);
commentQo.setUserImg(homePageEntity.getHeadImg()); commentQo.setUserImg(userInfo.getUiHeadimg());
commentQo.setNickName(homePageEntity.getNickName()); commentQo.setNickName(userInfo.getUiNickname());
//是否点赞及点赞数 //是否点赞及点赞数
String commentId = commentQo.getCommentId(); String commentId = commentQo.getCommentId();
if (likeCommentList.contains(commentId)){ if (likeCommentList.contains(commentId)){
......
...@@ -28,22 +28,22 @@ public class HomePageManager { ...@@ -28,22 +28,22 @@ public class HomePageManager {
@Resource @Resource
private HomePageService homePageService; private HomePageService homePageService;
public void editUserInfo(HomePageReq req,String userId) { // public void editUserInfo(HomePageReq req,String userId) {
HomePageEntity entity = HomePageEntity.builder() // HomePageEntity entity = HomePageEntity.builder()
.userId(userId) // .userId(userId)
.nickName(req.getNickName()) // .nickName(req.getNickName())
.headImg(req.getHeadImg()) // .headImg(req.getHeadImg())
.introduction(req.getIntroduction()) // .introduction(req.getIntroduction())
.sex(req.getSex()) // .sex(req.getSex())
.location(req.getLocation()) // .location(req.getLocation())
.build(); // .build();
if(homePageService.selectByUserId(userId) == null){ // if(homePageService.selectByUserId(userId) == null){
homePageService.insert(entity); // homePageService.insert(entity);
}else { // }else {
homePageService.update(entity); // homePageService.update(entity);
} // }
return; // return;
} // }
//获取用户关注、粉丝列表 //获取用户关注、粉丝列表
......
...@@ -10,9 +10,12 @@ import com.tanpu.community.api.enums.BlockTypeEnum; ...@@ -10,9 +10,12 @@ import com.tanpu.community.api.enums.BlockTypeEnum;
import com.tanpu.community.api.enums.CollectionTypeEnum; import com.tanpu.community.api.enums.CollectionTypeEnum;
import com.tanpu.community.api.enums.ThemeListTypeEnum; import com.tanpu.community.api.enums.ThemeListTypeEnum;
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.BlackListEntity;
import com.tanpu.community.dao.entity.community.CollectionEntity;
import com.tanpu.community.dao.entity.community.ThemeAttachmentEntity;
import com.tanpu.community.dao.entity.community.ThemeEntity;
import com.tanpu.community.service.*; import com.tanpu.community.service.*;
import com.tanpu.community.service.other.*; import com.tanpu.community.service.other.BlackListService;
import com.tanpu.community.util.ConvertUtil; import com.tanpu.community.util.ConvertUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
...@@ -46,19 +49,7 @@ public class ThemeManager { ...@@ -46,19 +49,7 @@ public class ThemeManager {
private BlackListService blackListService; private BlackListService blackListService;
@Autowired @Autowired
private FinProResService finProResService; private UserInfoService userInfoService;
@Autowired
private RedisService redisService;
@Autowired
private ZhiboService zhiboService;
@Autowired
private CurriculumResService curriculumResService;
@Autowired
private OrderFlowService orderFlowService;
@Autowired @Autowired
private ThemeAttachmentService themeAttachmentService; private ThemeAttachmentService themeAttachmentService;
...@@ -115,7 +106,7 @@ public class ThemeManager { ...@@ -115,7 +106,7 @@ public class ThemeManager {
// 返回用户发布、回复、收藏的主题列表 // 返回用户发布、回复、收藏的主题列表
public List<ThemeQo> queryThemesByUser(QueryRecordThemeReq req, String userId) { public List<ThemeQo> queryThemesByUser(QueryRecordThemeReq req, String userId) {
// TODO
// List<ThemeEntity> themeEntities = themeService.queryByUser(req.getUserId(), req.getPageSize(),req.getLastId()); // List<ThemeEntity> themeEntities = themeService.queryByUser(req.getUserId(), req.getPageSize(),req.getLastId());
List<ThemeEntity> themeEntities = themeService.selectAll(req.getLastId(), req.getPageSize()); List<ThemeEntity> themeEntities = themeService.selectAll(req.getLastId(), req.getPageSize());
return convertEntityToQo(themeEntities, userId); return convertEntityToQo(themeEntities, userId);
...@@ -238,24 +229,7 @@ public class ThemeManager { ...@@ -238,24 +229,7 @@ public class ThemeManager {
Integer forwardCountByUser = themeService.getForwardCountByUser(themeId, userId); Integer forwardCountByUser = themeService.getForwardCountByUser(themeId, userId);
themeQo.setHasForward(forwardCountByUser>0); themeQo.setHasForward(forwardCountByUser>0);
//转发原文 //转发原文
String formerThemeId = themeQo.getFormerThemeId(); buildFormerTheme(themeQo);
if (formerThemeId!=null){
ThemeQo formerTheme = ConvertUtil.themeEntityToQo2(themeService.queryByThemeId(formerThemeId));
if (formerTheme==null){
throw new BizException("转发主题Id错误,id:"+formerThemeId);
}
HomePageEntity formerUser = homePageService.selectByUserId(formerTheme.getAuthorId());
FormerThemeQo f = FormerThemeQo.builder().formerThemeId(formerThemeId)
.forwardContent(formerTheme.getContent())
.userImg(formerUser.getHeadImg())
.nickName(formerUser.getNickName())
.build();
themeQo.setFormerTheme(f);
}
//用户信息:头像、昵称
HomePageEntity userEntity = homePageService.selectByUserId(userId);
themeQo.setUserImg(userEntity.getHeadImg());
themeQo.setNickName(userEntity.getNickName());
//热点数据:点赞,收藏,转发 //热点数据:点赞,收藏,转发
Integer likeCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME); Integer likeCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.LIKE_THEME);
Integer bookCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.COLLECT_THEME); Integer bookCount = collectionService.getCountByTypeAndId(themeId, CollectionTypeEnum.COLLECT_THEME);
...@@ -273,31 +247,30 @@ public class ThemeManager { ...@@ -273,31 +247,30 @@ public class ThemeManager {
productService.transferAttachement(themeQo); productService.transferAttachement(themeQo);
//迄今时间 //迄今时间
themeQo.setUpToNowTime(calUpToNowTime(themeQo.getCreateTime())); themeQo.setUpToNowTime(calUpToNowTime(themeQo.getCreateTime()));
//用户信息:头像、昵称
HomePageEntity author = homePageService.selectByUserId(userId);
themeQo.setUserImg(author.getHeadImg());
themeQo.setNickName(author.getNickName());
//转发原文 //转发原文
buildFormerTheme(themeQo);
return;
}
private void buildFormerTheme(ThemeQo themeQo) {
String formerThemeId = themeQo.getFormerThemeId(); String formerThemeId = themeQo.getFormerThemeId();
if (formerThemeId!=null){ if (formerThemeId!=null){
ThemeQo formerTheme = ConvertUtil.themeEntityToQo2(themeService.queryByThemeId(formerThemeId)); ThemeQo formerTheme = ConvertUtil.themeEntityToQo2(themeService.queryByThemeId(formerThemeId));
if (formerTheme==null){ if (formerTheme==null){
throw new BizException("转发主题Id错误,id:"+formerThemeId); throw new BizException("转发主题Id错误,id:"+formerThemeId);
} }
HomePageEntity formerUser = homePageService.selectByUserId(formerTheme.getAuthorId()); productService.transferAttachement(formerTheme);
FormerThemeQo f = FormerThemeQo.builder().formerThemeId(formerThemeId) FormerThemeQo f = FormerThemeQo.builder().formerThemeId(formerThemeId)
.forwardContent(formerTheme.getContent()) .forwardContent(formerTheme.getContent())
.userImg(formerUser.getHeadImg()) .userImg(formerTheme.getUserImg())
.nickName(formerUser.getNickName()) .nickName(formerTheme.getNickName())
.build(); .build();
themeQo.setFormerTheme(f); themeQo.setFormerTheme(f);
} }
return;
} }
//计算迄今时间 //计算迄今时间
private String calUpToNowTime(LocalDateTime start) { private String calUpToNowTime(LocalDateTime start) {
Duration between = Duration.between(start, LocalDateTime.now()); Duration between = Duration.between(start, LocalDateTime.now());
......
...@@ -7,6 +7,7 @@ import com.tanpu.community.api.enums.DeleteTagEnum; ...@@ -7,6 +7,7 @@ import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.dao.entity.community.CollectionEntity; import com.tanpu.community.dao.entity.community.CollectionEntity;
import com.tanpu.community.dao.mapper.community.CollectionMapper; import com.tanpu.community.dao.mapper.community.CollectionMapper;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.time.LocalDateTime; import java.time.LocalDateTime;
...@@ -21,6 +22,7 @@ public class CollectionService { ...@@ -21,6 +22,7 @@ public class CollectionService {
// 若不存在则新增,若存在则修改deleteTag // 若不存在则新增,若存在则修改deleteTag
@Transactional
public void addIfNotExist(String themeId, String userId, CollectionTypeEnum type) { public void addIfNotExist(String themeId, String userId, CollectionTypeEnum type) {
// 判断记录是否存在,无论是否删除 // 判断记录是否存在,无论是否删除
CollectionEntity queryCollection = getTargetCollection(themeId, userId, type); CollectionEntity queryCollection = getTargetCollection(themeId, userId, type);
...@@ -43,19 +45,21 @@ public class CollectionService { ...@@ -43,19 +45,21 @@ public class CollectionService {
//根据用户、主题、类型查询未删除对象 //根据用户、主题、类型查询未删除对象
public CollectionEntity getNotDeleteTargetCollection(String targetId, String userId, CollectionTypeEnum type) { public CollectionEntity getNotDeleteTargetCollection(String targetId, String userId, CollectionTypeEnum type) {
return collectionMapper.selectOne(new LambdaQueryWrapper<CollectionEntity>() LambdaQueryWrapper<CollectionEntity> queryWrapper = new LambdaQueryWrapper<CollectionEntity>()
.eq(CollectionEntity::getCollectionType, type.getCode()) .eq(CollectionEntity::getCollectionType, type.getCode())
.eq(CollectionEntity::getUserId, userId) .eq(CollectionEntity::getUserId, userId)
.eq(CollectionEntity::getTargetId, targetId) .eq(CollectionEntity::getTargetId, targetId)
.eq(CollectionEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode())); .eq(CollectionEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode());
return collectionMapper.selectOne(queryWrapper);
} }
//根据用户、主题、类型查询记录,包括已删除对象 //根据用户、主题、类型查询记录,包括已删除对象
public CollectionEntity getTargetCollection(String themeId, String userId, CollectionTypeEnum type) { public CollectionEntity getTargetCollection(String themeId, String userId, CollectionTypeEnum type) {
return collectionMapper.selectOne(new LambdaQueryWrapper<CollectionEntity>() LambdaQueryWrapper<CollectionEntity> queryWrapper = new LambdaQueryWrapper<CollectionEntity>()
.eq(CollectionEntity::getCollectionType, type.getCode()) .eq(CollectionEntity::getCollectionType, type.getCode())
.eq(CollectionEntity::getUserId, userId) .eq(CollectionEntity::getUserId, userId)
.eq(CollectionEntity::getTargetId, themeId)); .eq(CollectionEntity::getTargetId, themeId);
return collectionMapper.selectOne(queryWrapper);
} }
// 根据用户id和行为type获取target_id列表 // 根据用户id和行为type获取target_id列表
...@@ -84,6 +88,7 @@ public class CollectionService { ...@@ -84,6 +88,7 @@ public class CollectionService {
.eq(CollectionEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode())); .eq(CollectionEntity::getDeleteTag, DeleteTagEnum.NOT_DELETED.getCode()));
} }
//逻辑删除,修改delete_tag //逻辑删除,修改delete_tag
@Transactional
public void delete(String themeId, String userId, CollectionTypeEnum type) { public void delete(String themeId, String userId, CollectionTypeEnum type) {
CollectionEntity queryCollection = getNotDeleteTargetCollection(themeId, userId, type); CollectionEntity queryCollection = getNotDeleteTargetCollection(themeId, userId, type);
if (queryCollection != null) { if (queryCollection != null) {
......
...@@ -8,6 +8,7 @@ import com.tanpu.community.dao.entity.community.CommentEntity; ...@@ -8,6 +8,7 @@ import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.mapper.community.CommentMapper; import com.tanpu.community.dao.mapper.community.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
...@@ -23,6 +24,7 @@ public class CommentService { ...@@ -23,6 +24,7 @@ public class CommentService {
@Autowired @Autowired
private UuidGenHelper uuidGenHelper; private UuidGenHelper uuidGenHelper;
@Transactional
public void insertComment(CommentEntity commentEntity) { public void insertComment(CommentEntity commentEntity) {
commentEntity.setCommentId(uuidGenHelper.getUuidStr()); commentEntity.setCommentId(uuidGenHelper.getUuidStr());
commentMapper.insert(commentEntity); commentMapper.insert(commentEntity);
......
...@@ -17,6 +17,7 @@ import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp; ...@@ -17,6 +17,7 @@ import com.tanpu.community.api.beans.vo.feign.course.CourseSimpleResp;
import com.tanpu.community.api.enums.RelTypeEnum; import com.tanpu.community.api.enums.RelTypeEnum;
import com.tanpu.community.dao.entity.community.FileRecordEntity; import com.tanpu.community.dao.entity.community.FileRecordEntity;
import com.tanpu.community.dao.entity.community.TopicEntity; import com.tanpu.community.dao.entity.community.TopicEntity;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.feign.course.FeignClientForCourse; import com.tanpu.community.feign.course.FeignClientForCourse;
import com.tanpu.community.feign.fatools.FeignClientForFatools; import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.feign.product.FeignClientForProducts; import com.tanpu.community.feign.product.FeignClientForProducts;
...@@ -68,6 +69,9 @@ public class ProductService { ...@@ -68,6 +69,9 @@ public class ProductService {
@Resource @Resource
private TopicService topicService; private TopicService topicService;
@Resource
private UserInfoService userInfoService;
public void transferAttachement(ThemeQo themeQo) { public void transferAttachement(ThemeQo themeQo) {
ArrayList<ThemeQo> themeQos = new ArrayList<>(); ArrayList<ThemeQo> themeQos = new ArrayList<>();
...@@ -91,10 +95,12 @@ public class ProductService { ...@@ -91,10 +95,12 @@ public class ProductService {
Map<String, FileRecordEntity> imgMap = Maps.newHashMap(); Map<String, FileRecordEntity> imgMap = Maps.newHashMap();
// 话题标题 // 话题标题
Map<String, String> topicMap = Maps.newHashMap(); Map<String, String> topicMap = Maps.newHashMap();
// 图片信息
Map<String, UserInfoEntity> userMap = Maps.newHashMap();
// 批量查询资源信息 // 批量查询资源信息
this.getResInfo(shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap, topicMap, themeQos); this.getResInfo(shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap, topicMap,userMap, themeQos);
//逐个装入 //逐个装入
setResInfo(themeQos, shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap, topicMap); setResInfo(themeQos, shortVideoMap, curriculumMap, courseMap, zhiboMap, fundMap, imgMap,userMap, topicMap);
} }
...@@ -114,6 +120,7 @@ public class ProductService { ...@@ -114,6 +120,7 @@ public class ProductService {
Map<String, FundInfoBaseResp> fundMap, Map<String, FundInfoBaseResp> fundMap,
Map<String, FileRecordEntity> imgMap, Map<String, FileRecordEntity> imgMap,
Map<String, String> topicMap, Map<String, String> topicMap,
Map<String, UserInfoEntity> userMap,
List<ThemeQo> themeQos List<ThemeQo> themeQos
) { ) {
// 白名单基金id // 白名单基金id
...@@ -138,9 +145,12 @@ public class ProductService { ...@@ -138,9 +145,12 @@ public class ProductService {
List<String> imageIds = Lists.newArrayList(); List<String> imageIds = Lists.newArrayList();
// 话题id // 话题id
List<String> topicIds = Lists.newArrayList(); List<String> topicIds = Lists.newArrayList();
// 用户id
List<String> userIds = Lists.newArrayList();
// 获取关联资源id // 获取关联资源id
if (themeQos != null) { if (themeQos != null) {
themeQos.forEach(o -> { themeQos.forEach(o -> {
userIds.add(o.getAuthorId());
if (o.getTopicId() != null) { if (o.getTopicId() != null) {
topicIds.add(o.getTopicId()); topicIds.add(o.getTopicId());
} }
...@@ -221,6 +231,14 @@ public class ProductService { ...@@ -221,6 +231,14 @@ public class ProductService {
.toMap(TopicEntity::getTopicId, TopicEntity::getTopicTitle))); .toMap(TopicEntity::getTopicId, TopicEntity::getTopicTitle)));
} }
} }
if (!CollectionUtils.isEmpty(userIds)) {
// 查询用户信息
List<UserInfoEntity> userInfos = userInfoService.selectByIds(userIds);
if (!CollectionUtils.isEmpty(userIds)) {
userMap.putAll(userInfos.stream().collect(Collectors
.toMap(UserInfoEntity::getId, o->o)));
}
}
this.getFundInfo(tanpuFundIds, fundIds, publicFundIds, ifaFundIds, notNetFundIds, fundMap); this.getFundInfo(tanpuFundIds, fundIds, publicFundIds, ifaFundIds, notNetFundIds, fundMap);
} }
...@@ -340,11 +358,16 @@ public class ProductService { ...@@ -340,11 +358,16 @@ public class ProductService {
Map<String, ZhiboListResp> zhiboMap, Map<String, ZhiboListResp> zhiboMap,
Map<String, FundInfoBaseResp> fundMap, Map<String, FundInfoBaseResp> fundMap,
Map<String, FileRecordEntity> imgUrlMap, Map<String, FileRecordEntity> imgUrlMap,
Map<String, UserInfoEntity> userMap,
Map<String, String> topicMap) { Map<String, String> topicMap) {
for (ThemeQo themeQo : themeQos) { for (ThemeQo themeQo : themeQos) {
if (!StringUtils.isEmpty(themeQo.getTopicId()) && topicMap.containsKey(themeQo.getTopicId())) { if (!StringUtils.isEmpty(themeQo.getTopicId()) && topicMap.containsKey(themeQo.getTopicId())) {
themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId())); themeQo.setTopicTitle(topicMap.get(themeQo.getTopicId()));
} }
if (!StringUtils.isEmpty(themeQo.getAuthorId()) && userMap.containsKey(themeQo.getAuthorId())) {
themeQo.setNickName(userMap.get(themeQo.getAuthorId()).getUiNickname());
themeQo.setUserImg(userMap.get(themeQo.getAuthorId()).getUiHeadimg());
}
if (themeQo.getContent() == null) { if (themeQo.getContent() == null) {
continue; continue;
} }
......
...@@ -44,7 +44,7 @@ public class ThemeService { ...@@ -44,7 +44,7 @@ public class ThemeService {
queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getUpdateTime()); queryWrapper.lt(ThemeEntity::getUpdateTime, lastEntity.getUpdateTime());
} }
queryWrapper.last("limit "+pageSize); queryWrapper.last("limit "+pageSize);
queryWrapper.orderByDesc(ThemeEntity::getUpdateTime); queryWrapper.orderByDesc(ThemeEntity::getId);
return themeMapper.selectList(queryWrapper); return themeMapper.selectList(queryWrapper);
} }
...@@ -67,6 +67,7 @@ public class ThemeService { ...@@ -67,6 +67,7 @@ public class ThemeService {
if (pageSize!=null){ if (pageSize!=null){
queryWrapper.last("limit "+pageSize); queryWrapper.last("limit "+pageSize);
} }
queryWrapper.orderByDesc(ThemeEntity::getId);
return themeMapper.selectList(queryWrapper); return themeMapper.selectList(queryWrapper);
} }
......
package com.tanpu.community.service;
import com.tanpu.community.dao.entity.user.UserInfoEntity;
import com.tanpu.community.dao.mapper.user.UserInfoMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Service
public class UserInfoService {
@Resource
private UserInfoMapper userInfoMapper;
public UserInfoEntity selectById(String userId) {
return userInfoMapper.selectById(userId);
}
public List<UserInfoEntity> selectByIds(List<String> ids) {
return userInfoMapper.selectBatchIds(ids);
}
}
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