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

Merge remote-tracking branch 'origin/v2.2.10' into v2.2.10

parents 3a400da5 d3325545
...@@ -14,6 +14,7 @@ import com.tanpu.community.api.beans.resp.Customer; ...@@ -14,6 +14,7 @@ import com.tanpu.community.api.beans.resp.Customer;
import com.tanpu.community.api.beans.resp.HomeSettingsResp; import com.tanpu.community.api.beans.resp.HomeSettingsResp;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNewChief; import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoNewChief;
import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp; import com.tanpu.community.api.beans.vo.feign.fatools.UserInfoResp;
import com.tanpu.community.feign.activity.FeignClientForActivity;
import com.tanpu.community.manager.HomePageManager; import com.tanpu.community.manager.HomePageManager;
import com.tanpu.community.manager.ThemeManager; import com.tanpu.community.manager.ThemeManager;
import com.tanpu.community.service.HotRecommendService; import com.tanpu.community.service.HotRecommendService;
...@@ -54,6 +55,9 @@ public class HomePageController { ...@@ -54,6 +55,9 @@ public class HomePageController {
@Resource @Resource
private HotRecommendService hotRecommendService; private HotRecommendService hotRecommendService;
@Resource
private FeignClientForActivity feignClientForActivity;
// 用户信息查询 (供圈子服务调用) // 用户信息查询 (供圈子服务调用)
@ApiOperation(value = "个人中心 查询") @ApiOperation(value = "个人中心 查询")
...@@ -114,5 +118,4 @@ public class HomePageController { ...@@ -114,5 +118,4 @@ public class HomePageController {
public CommonResp<HomeSettingsResp> getHomeSettings() { public CommonResp<HomeSettingsResp> getHomeSettings() {
return hotRecommendService.getHomeSettings(); return hotRecommendService.getHomeSettings();
} }
} }
package com.tanpu.community.feign.activity; package com.tanpu.community.feign.activity;
import com.alibaba.fastjson.JSONObject;
import com.tanpu.common.api.CommonResp; import com.tanpu.common.api.CommonResp;
import com.tanpu.community.api.beans.req.page.Page;
import com.tanpu.community.api.beans.vo.feign.activity.OfflineActivitySimpleResp; import com.tanpu.community.api.beans.vo.feign.activity.OfflineActivitySimpleResp;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -29,7 +31,12 @@ public class FeignBackClientForActivity implements FallbackFactory<FeignClientFo ...@@ -29,7 +31,12 @@ public class FeignBackClientForActivity implements FallbackFactory<FeignClientFo
return CommonResp.error(); return CommonResp.error();
} }
@Override
public CommonResp<List<OfflineActivitySimpleResp>> queryCorpHomeActivityList(String orgId) {
log.error("请求信息", throwable);
log.error("FeignClientForActivity.offlineActivityDetail-查询活动orgId:{}", orgId);
return CommonResp.error();
}
}; };
} }
} }
...@@ -21,4 +21,8 @@ public interface FeignClientForActivity { ...@@ -21,4 +21,8 @@ public interface FeignClientForActivity {
@ApiOperation("线下活动列表-通过机构查询") @ApiOperation("线下活动列表-通过机构查询")
@GetMapping(value = "/offlineActivity/inter/listByOrgId") @GetMapping(value = "/offlineActivity/inter/listByOrgId")
CommonResp<List<OfflineActivitySimpleResp>> simpleListByOrgid(@ApiParam("机构id") @RequestParam(value = "orgId") String orgId); CommonResp<List<OfflineActivitySimpleResp>> simpleListByOrgid(@ApiParam("机构id") @RequestParam(value = "orgId") String orgId);
@ApiOperation("线下活动列表-查询机构首页线下活动列表")
@GetMapping(value = "/offlineActivity/inter/queryCorpHomeActivityList")
CommonResp<List<OfflineActivitySimpleResp>> queryCorpHomeActivityList(@ApiParam("活动id") @RequestParam(value = "corpId") String corpId);
} }
...@@ -184,12 +184,12 @@ public class HomePageManager { ...@@ -184,12 +184,12 @@ public class HomePageManager {
userInfoNew.setUserInfoOrgList(userInfoOrgs); userInfoNew.setUserInfoOrgList(userInfoOrgs);
} }
// 家办活动 // 家办活动
CommonResp<List<OfflineActivitySimpleResp>> activitySimpleResps = feignClientForActivity.simpleListByOrgid(userInfoNew.getUserInfoNewOrg().getCorpId()); CommonResp<List<OfflineActivitySimpleResp>> activitySimpleResps = feignClientForActivity.queryCorpHomeActivityList(userInfoNew.getUserInfoNewOrg().getCorpId());
if (activitySimpleResps.isSuccess() && CollectionUtils.isNotEmpty(activitySimpleResps.getData())) { if (activitySimpleResps.isSuccess() && CollectionUtils.isNotEmpty(activitySimpleResps.getData())) {
List<OfflineActivitySimpleResp> activities = activitySimpleResps.getData(); List<OfflineActivitySimpleResp> activities = activitySimpleResps.getData();
if (CollectionUtils.isNotEmpty(activities)){ if (CollectionUtils.isNotEmpty(activities)) {
userInfoNew.setHoldActivities(activities.stream().filter(o->o.getActivityType().equals(1)).collect(Collectors.toList())); userInfoNew.setHoldActivities(activities.stream().filter(o -> o.getActivityType().equals(1)).collect(Collectors.toList()));
userInfoNew.setTeamRecruitment(activities.stream().filter(o->o.getActivityType().equals(2)).collect(Collectors.toList())); userInfoNew.setTeamRecruitment(activities.stream().filter(o -> o.getActivityType().equals(2)).collect(Collectors.toList()));
} }
} }
...@@ -201,9 +201,9 @@ public class HomePageManager { ...@@ -201,9 +201,9 @@ public class HomePageManager {
if (integerCommonResp.isSuccess()) userInfoNew.setCourseNumber(integerCommonResp.getData()); if (integerCommonResp.isSuccess()) userInfoNew.setCourseNumber(integerCommonResp.getData());
} }
// 主页背景图 // 主页背景图
if (CommunityConstant.BACKGROUND_IMG_URL_MAP.containsKey(userInfoNew.getUserId())){ if (CommunityConstant.BACKGROUND_IMG_URL_MAP.containsKey(userInfoNew.getUserId())) {
userInfoNew.setBackgroundImgUrl(CommunityConstant.BACKGROUND_IMG_URL_MAP.get(userInfoNew.getUserId())); userInfoNew.setBackgroundImgUrl(CommunityConstant.BACKGROUND_IMG_URL_MAP.get(userInfoNew.getUserId()));
}else { } else {
userInfoNew.setBackgroundImgUrl(CommunityConstant.BACKGROUND_IMG_URL_MAP.get("default")); userInfoNew.setBackgroundImgUrl(CommunityConstant.BACKGROUND_IMG_URL_MAP.get("default"));
} }
...@@ -252,7 +252,7 @@ public class HomePageManager { ...@@ -252,7 +252,7 @@ public class HomePageManager {
followRelService.queryFansByIdolId(req.userId, pageNumber, pageSize) followRelService.queryFansByIdolId(req.userId, pageNumber, pageSize)
: followRelService.queryIdolsByFansId(req.userId, pageNumber, pageSize); : followRelService.queryIdolsByFansId(req.userId, pageNumber, pageSize);
if (CollectionUtils.isEmpty(userIdsPage.getContent())) { if (CollectionUtils.isEmpty(userIdsPage.getContent())) {
return PageUtils.page(userIdsPage, Lists.newArrayListWithCapacity(0)); return PageUtils.page(userIdsPage, Lists.newArrayListWithCapacity(0));
} }
List<UserInfoResp> userInfoNews = feignClientForFatools.queryUserListNew(userIdsPage.getContent()); List<UserInfoResp> userInfoNews = feignClientForFatools.queryUserListNew(userIdsPage.getContent());
List<FollowQo> followQos = userInfoNews.stream().map(ConvertUtil::userInfoNew2FollowQo).collect(Collectors.toList()); List<FollowQo> followQos = userInfoNews.stream().map(ConvertUtil::userInfoNew2FollowQo).collect(Collectors.toList());
...@@ -279,7 +279,7 @@ public class HomePageManager { ...@@ -279,7 +279,7 @@ public class HomePageManager {
// 第一次关注才有消息通知 // 第一次关注才有消息通知
if (followRelService.addFollowRel(req.getFollowUserId(), followerId)) { if (followRelService.addFollowRel(req.getFollowUserId(), followerId)) {
notificationService.insert(followerId, req.getFollowUserId(), NotificationTypeEnum.FOLLOW, req.getFollowUserId(), null); notificationService.insert(followerId, req.getFollowUserId(), NotificationTypeEnum.FOLLOW, req.getFollowUserId(), null);
notificationService.putNotifyCache(req.getFollowUserId(), followerId,NotificationTypeEnum.FOLLOW); notificationService.putNotifyCache(req.getFollowUserId(), followerId, NotificationTypeEnum.FOLLOW);
} }
} else if (OperationTypeEnum.CANCEL.getCode().equals(req.getType())) { } else if (OperationTypeEnum.CANCEL.getCode().equals(req.getType())) {
followRelService.deleteFollowRel(req.getFollowUserId(), followerId); followRelService.deleteFollowRel(req.getFollowUserId(), followerId);
...@@ -295,10 +295,10 @@ public class HomePageManager { ...@@ -295,10 +295,10 @@ public class HomePageManager {
} }
public List<FollowQo> userNameSerach(String keyword, Integer pageNumber, Integer pageSize, String ident, String userId) { public List<FollowQo> userNameSerach(String keyword, Integer pageNumber, Integer pageSize, String ident, String userId) {
if (StringUtils.isBlank(keyword)){ if (StringUtils.isBlank(keyword)) {
return Collections.emptyList(); return Collections.emptyList();
} }
List<UserInfoResp> userInfoResps = feignClientForFatools.queryByUserNameMp(keyword,pageSize,pageNumber); List<UserInfoResp> userInfoResps = feignClientForFatools.queryByUserNameMp(keyword, pageSize, pageNumber);
List<FollowQo> followQos = userInfoResps.stream().map(ConvertUtil::userInfoNew2FollowQo).collect(Collectors.toList()); List<FollowQo> followQos = userInfoResps.stream().map(ConvertUtil::userInfoNew2FollowQo).collect(Collectors.toList());
if (StringUtils.isNotEmpty(userId)) { if (StringUtils.isNotEmpty(userId)) {
judgeFollowed(followQos, userId); judgeFollowed(followQos, userId);
......
...@@ -22,12 +22,17 @@ import com.tanpu.community.dao.mapper.community.HotRecommendMapper; ...@@ -22,12 +22,17 @@ import com.tanpu.community.dao.mapper.community.HotRecommendMapper;
import com.tanpu.community.dao.mapper.community.HotRecommendUserMapper; import com.tanpu.community.dao.mapper.community.HotRecommendUserMapper;
import com.tanpu.community.feign.fatools.FeignClientForFatools; import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.util.ConvertUtil; import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.util.HttpServletHelper;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -44,6 +49,12 @@ public class HotRecommendService { ...@@ -44,6 +49,12 @@ public class HotRecommendService {
@Resource @Resource
private FeignClientForFatools feignClientForFatools; private FeignClientForFatools feignClientForFatools;
@Resource
private FollowRelService followRelService;
@Resource
private HttpServletHelper httpServletHelper;
/** /**
* 首页热门推荐列表 * 首页热门推荐列表
...@@ -53,6 +64,7 @@ public class HotRecommendService { ...@@ -53,6 +64,7 @@ public class HotRecommendService {
public List<HotRecommendResp> hotRecommendList() { public List<HotRecommendResp> hotRecommendList() {
LambdaQueryWrapper<HotRecommend> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<HotRecommend> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HotRecommend::getDeleteTag, DeleteTagEnum.NOT_DELETED) queryWrapper.eq(HotRecommend::getDeleteTag, DeleteTagEnum.NOT_DELETED)
.eq(HotRecommend::getIsShow, 1)
.orderByAsc(HotRecommend::getSort) .orderByAsc(HotRecommend::getSort)
.orderByDesc(HotRecommend::getCreateTime); .orderByDesc(HotRecommend::getCreateTime);
List<HotRecommend> hotRecommends = hotRecommendMapper.selectList(queryWrapper); List<HotRecommend> hotRecommends = hotRecommendMapper.selectList(queryWrapper);
...@@ -83,15 +95,29 @@ public class HotRecommendService { ...@@ -83,15 +95,29 @@ public class HotRecommendService {
LambdaQueryWrapper<HotRecommend> queryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<HotRecommend> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HotRecommend::getHotRecommendId, req.getHotRecommendId()); queryWrapper.eq(HotRecommend::getHotRecommendId, req.getHotRecommendId());
HotRecommend hotRecommend = hotRecommendMapper.selectOne(queryWrapper); HotRecommend hotRecommend = hotRecommendMapper.selectOne(queryWrapper);
List<FollowQo> list = null; Page<FollowQo> page = null;
if (hotRecommend.getType() == 1) { if (hotRecommend.getType() == 1) {
return this.getChiefInvAdv(req); page = this.getChiefInvAdv(req);
} else if (hotRecommend.getType() == 2) { } else if (hotRecommend.getType() == 2) {
return this.getCorpInfo(req); page = this.getCorpInfo(req);
} else if (hotRecommend.getType() == 3) { } else if (hotRecommend.getType() == 3) {
return this.getUserInfo(req); page = this.getUserInfo(req);
}
if (StringUtils.isNotEmpty(httpServletHelper.getCurrentUserId())) {
page.setContent(judgeFollowed(page.getContent(), httpServletHelper.getCurrentUserId()));
} }
return null; return page;
}
//判断返回列表中的用户是否被当前用户关注
public List<FollowQo> judgeFollowed(List<FollowQo> followQos, @NotEmpty String followerId) {
Set<String> idolSet = new HashSet<>(followRelService.queryIdolsByFansId(followerId));
return followQos.stream().map(o -> {
if (idolSet.contains(o.getUserId())) {
o.setFollowed(true);
}
return o;
}).collect(Collectors.toList());
} }
private Page<FollowQo> getCorpInfo(UserInfoCorpReq req) { private Page<FollowQo> getCorpInfo(UserInfoCorpReq req) {
......
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