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;
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.UserInfoResp;
import com.tanpu.community.feign.activity.FeignClientForActivity;
import com.tanpu.community.manager.HomePageManager;
import com.tanpu.community.manager.ThemeManager;
import com.tanpu.community.service.HotRecommendService;
......@@ -54,6 +55,9 @@ public class HomePageController {
@Resource
private HotRecommendService hotRecommendService;
@Resource
private FeignClientForActivity feignClientForActivity;
// 用户信息查询 (供圈子服务调用)
@ApiOperation(value = "个人中心 查询")
......@@ -114,5 +118,4 @@ public class HomePageController {
public CommonResp<HomeSettingsResp> getHomeSettings() {
return hotRecommendService.getHomeSettings();
}
}
package com.tanpu.community.feign.activity;
import com.alibaba.fastjson.JSONObject;
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 feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
......@@ -29,7 +31,12 @@ public class FeignBackClientForActivity implements FallbackFactory<FeignClientFo
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 {
@ApiOperation("线下活动列表-通过机构查询")
@GetMapping(value = "/offlineActivity/inter/listByOrgId")
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 {
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())) {
List<OfflineActivitySimpleResp> activities = activitySimpleResps.getData();
if (CollectionUtils.isNotEmpty(activities)){
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()));
if (CollectionUtils.isNotEmpty(activities)) {
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()));
}
}
......@@ -201,9 +201,9 @@ public class HomePageManager {
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()));
}else {
} else {
userInfoNew.setBackgroundImgUrl(CommunityConstant.BACKGROUND_IMG_URL_MAP.get("default"));
}
......@@ -279,7 +279,7 @@ public class HomePageManager {
// 第一次关注才有消息通知
if (followRelService.addFollowRel(req.getFollowUserId(), followerId)) {
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())) {
followRelService.deleteFollowRel(req.getFollowUserId(), followerId);
......@@ -295,10 +295,10 @@ public class HomePageManager {
}
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();
}
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());
if (StringUtils.isNotEmpty(userId)) {
judgeFollowed(followQos, userId);
......
......@@ -22,12 +22,17 @@ import com.tanpu.community.dao.mapper.community.HotRecommendMapper;
import com.tanpu.community.dao.mapper.community.HotRecommendUserMapper;
import com.tanpu.community.feign.fatools.FeignClientForFatools;
import com.tanpu.community.util.ConvertUtil;
import com.tanpu.community.util.HttpServletHelper;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.validation.constraints.NotEmpty;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
/**
......@@ -44,6 +49,12 @@ public class HotRecommendService {
@Resource
private FeignClientForFatools feignClientForFatools;
@Resource
private FollowRelService followRelService;
@Resource
private HttpServletHelper httpServletHelper;
/**
* 首页热门推荐列表
......@@ -53,6 +64,7 @@ public class HotRecommendService {
public List<HotRecommendResp> hotRecommendList() {
LambdaQueryWrapper<HotRecommend> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HotRecommend::getDeleteTag, DeleteTagEnum.NOT_DELETED)
.eq(HotRecommend::getIsShow, 1)
.orderByAsc(HotRecommend::getSort)
.orderByDesc(HotRecommend::getCreateTime);
List<HotRecommend> hotRecommends = hotRecommendMapper.selectList(queryWrapper);
......@@ -83,15 +95,29 @@ public class HotRecommendService {
LambdaQueryWrapper<HotRecommend> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(HotRecommend::getHotRecommendId, req.getHotRecommendId());
HotRecommend hotRecommend = hotRecommendMapper.selectOne(queryWrapper);
List<FollowQo> list = null;
Page<FollowQo> page = null;
if (hotRecommend.getType() == 1) {
return this.getChiefInvAdv(req);
page = this.getChiefInvAdv(req);
} else if (hotRecommend.getType() == 2) {
return this.getCorpInfo(req);
page = this.getCorpInfo(req);
} 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) {
......
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