Browse Source

徽章查询修改

master
wangchao 5 years ago
parent
commit
5e6dd0d610
  1. 110
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

110
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/topic/service/impl/ResiTopicServiceImpl.java

@ -373,31 +373,33 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
//3.用户徽章
//3.1首先需要拿到客户Id
ResiGroupEntity group = resiGroupDao.selectById(groupId);
if(null != group && StringUtils.isNotBlank(group.getCustomerId())){
Result<Map<String, List<UserBadgeUnitFormDTO>>> badgeR
= userOpenFeignClient.userShowBadge(
new UserGroupFormDTO(group.getCustomerId(),
latestTenTopics.stream()
.filter(top -> StringUtils.equals("other",top.getReleaseUserFlag()))
.map(ResiTopicIncludeIssueInfoResultDTO::getUserId)
.distinct().collect(Collectors.toList())));
if(null != badgeR && badgeR.success() && null != badgeR.getData() && !badgeR.getData().isEmpty()){
Map<String, List<UserBadgeUnitFormDTO>> badgeM = badgeR.getData();
latestTenTopics.forEach(top -> {
if(StringUtils.equals("other",top.getReleaseUserFlag())){
top.setBadgeList(
CollectionUtils.isEmpty(badgeM.get(top.getUserId())) ?
Collections.EMPTY_LIST :
badgeM.get(top.getUserId()).stream().map(UserBadgeUnitFormDTO :: getBadgeIcon).collect(Collectors.toList())
);
}else top.setBadgeList(Collections.EMPTY_LIST);
});
}else latestTenTopics.forEach(top -> top.setBadgeList(Collections.EMPTY_LIST));
List<String> other = latestTenTopics.stream()
.filter(top -> StringUtils.equals("other", top.getReleaseUserFlag()))
.map(ResiTopicIncludeIssueInfoResultDTO::getUserId)
.distinct().collect(Collectors.toList());
if(!CollectionUtils.isEmpty(other)) {
ResiGroupEntity group = resiGroupDao.selectById(groupId);
if (null != group && StringUtils.isNotBlank(group.getCustomerId())) {
Result<Map<String, List<UserBadgeUnitFormDTO>>> badgeR
= userOpenFeignClient.userShowBadge(
new UserGroupFormDTO(group.getCustomerId(),other));
if (null != badgeR && badgeR.success() && null != badgeR.getData() && !badgeR.getData().isEmpty()) {
Map<String, List<UserBadgeUnitFormDTO>> badgeM = badgeR.getData();
latestTenTopics.forEach(top -> {
if (StringUtils.equals("other", top.getReleaseUserFlag())) {
top.setBadgeList(
CollectionUtils.isEmpty(badgeM.get(top.getUserId())) ?
Collections.EMPTY_LIST :
badgeM.get(top.getUserId()).stream().map(UserBadgeUnitFormDTO::getBadgeIcon).collect(Collectors.toList())
);
} else top.setBadgeList(Collections.EMPTY_LIST);
});
}
} else latestTenTopics.forEach(top -> top.setBadgeList(Collections.EMPTY_LIST));
}
}
}
return new Result<List<ResiTopicIncludeIssueInfoResultDTO>>().ok(latestTenTopics);
@ -429,15 +431,16 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
//3.用户徽章
//3.1首先需要拿到客户Id
List<String> other = pastTopics.stream()
.filter(top -> StringUtils.equals("other",top.getReleaseUserFlag()))
.map(ResiTopicIncludeIssueInfoResultDTO::getUserId)
.distinct().collect(Collectors.toList());
if(!CollectionUtils.isEmpty(other)){
ResiGroupEntity group = resiGroupDao.selectById(topicPageFormDTO.getGroupId());
if(null != group && StringUtils.isNotBlank(group.getCustomerId())){
Result<Map<String, List<UserBadgeUnitFormDTO>>> badgeR
= userOpenFeignClient.userShowBadge(
new UserGroupFormDTO(group.getCustomerId(),
pastTopics.stream()
.filter(top -> StringUtils.equals("other",top.getReleaseUserFlag()))
.map(ResiTopicIncludeIssueInfoResultDTO::getUserId)
.distinct().collect(Collectors.toList())));
new UserGroupFormDTO(group.getCustomerId(),other));
if(null != badgeR && badgeR.success() && null != badgeR.getData() && !badgeR.getData().isEmpty()){
Map<String, List<UserBadgeUnitFormDTO>> badgeM = badgeR.getData();
pastTopics.forEach(top -> {
@ -454,7 +457,7 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
}
}
}
@ -739,32 +742,33 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
//3.用户徽章
//3.1首先需要拿到客户Id
ResiGroupEntity group = resiGroupDao.selectById(topicPageFormDTO.getGroupId());
if(null != group && StringUtils.isNotBlank(group.getCustomerId())){
Result<Map<String, List<UserBadgeUnitFormDTO>>> badgeR
= userOpenFeignClient.userShowBadge(
new UserGroupFormDTO(group.getCustomerId(),
hiddenTopics.stream()
.filter(top -> StringUtils.equals("other",top.getReleaseUserFlag()))
.map(ResiTopicInfoResultDTO::getUserId)
.distinct().collect(Collectors.toList())));
if(null != badgeR && badgeR.success() && null != badgeR.getData() && !badgeR.getData().isEmpty()){
Map<String, List<UserBadgeUnitFormDTO>> badgeM = badgeR.getData();
hiddenTopics.forEach(top -> {
if(StringUtils.equals("other",top.getReleaseUserFlag())){
top.setBadgeList(
CollectionUtils.isEmpty(badgeM.get(top.getUserId())) ?
Collections.EMPTY_LIST :
badgeM.get(top.getUserId()).stream().map(UserBadgeUnitFormDTO :: getBadgeIcon).collect(Collectors.toList())
);
}else top.setBadgeList(Collections.EMPTY_LIST);
});
List<String> other = hiddenTopics.stream()
.filter(top -> StringUtils.equals("other",top.getReleaseUserFlag()))
.map(ResiTopicInfoResultDTO::getUserId)
.distinct().collect(Collectors.toList());
if(!CollectionUtils.isEmpty(other)) {
ResiGroupEntity group = resiGroupDao.selectById(topicPageFormDTO.getGroupId());
if (null != group && StringUtils.isNotBlank(group.getCustomerId())) {
Result<Map<String, List<UserBadgeUnitFormDTO>>> badgeR
= userOpenFeignClient.userShowBadge(
new UserGroupFormDTO(group.getCustomerId(), other));
if (null != badgeR && badgeR.success() && null != badgeR.getData() && !badgeR.getData().isEmpty()) {
Map<String, List<UserBadgeUnitFormDTO>> badgeM = badgeR.getData();
hiddenTopics.forEach(top -> {
if (StringUtils.equals("other", top.getReleaseUserFlag())) {
top.setBadgeList(
CollectionUtils.isEmpty(badgeM.get(top.getUserId())) ?
Collections.EMPTY_LIST :
badgeM.get(top.getUserId()).stream().map(UserBadgeUnitFormDTO::getBadgeIcon).collect(Collectors.toList())
);
} else top.setBadgeList(Collections.EMPTY_LIST);
});
}else hiddenTopics.forEach(top -> top.setBadgeList(Collections.EMPTY_LIST));
} else hiddenTopics.forEach(top -> top.setBadgeList(Collections.EMPTY_LIST));
}
}
}
return new Result<List<ResiTopicInfoResultDTO>>().ok(hiddenTopics);
@ -903,9 +907,6 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
@Override
public Result<List<ResiTopicInfoResultDTO>> getPastTopicListGov(ResiTopicPageFormDTO topicPageFormDTO) {
//1.查询历史话题列表
topicPageFormDTO.setUserId(topicPageFormDTO.getUserId());
topicPageFormDTO.setPageNo((topicPageFormDTO.getPageNo() - NumConstant.ONE) * topicPageFormDTO.getPageSize());
List<ResiTopicInfoResultDTO> pastTopics =
@ -953,7 +954,8 @@ public class ResiTopicServiceImpl extends BaseServiceImpl<ResiTopicDao, ResiTopi
**/
@Override
public Result<List<ResiTopicInfoResultDTO>> getHiddenTopicsGov(ResiTopicPageFormDTO topicPageFormDTO) {
return getHiddenTopics(null,topicPageFormDTO);
topicPageFormDTO.setStatus("hidden");
return getPastTopicListGov(topicPageFormDTO);
}
@Override

Loading…
Cancel
Save