|
|
@ -55,6 +55,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -202,18 +203,22 @@ public class UserPointStatisticalDailyServiceImpl extends BaseServiceImpl<UserPo |
|
|
|
} |
|
|
|
List<String> userIds = rankList.stream().map(ResiPointRankResultDTO::getUserId).collect(Collectors.toList()); |
|
|
|
//查询用户昵称
|
|
|
|
Result<List<UserBaseInfoResultDTO>> userInfo = |
|
|
|
epmetUserOpenFeignClient.queryUserBaseInfo(userIds); |
|
|
|
boolean userRequestCallback = userInfo.success() && null != userInfo.getData() && !userInfo.getData().isEmpty(); |
|
|
|
|
|
|
|
for (int i = NumConstant.ZERO; i < rankList.size(); i++) { |
|
|
|
ResiPointRankListResultDTO resultObj = ConvertUtils.sourceToTarget(o,ResiPointRankListResultDTO.class); |
|
|
|
Result<List<UserBaseInfoResultDTO>> userInfo = epmetUserOpenFeignClient.queryUserBaseInfo(userIds); |
|
|
|
Map<String,UserBaseInfoResultDTO> userInfoMap = new HashMap<>(); |
|
|
|
if (userInfo.success() && CollectionUtils.isNotEmpty(userInfo.getData())){ |
|
|
|
userInfoMap = userInfo.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, Function.identity(),(o1,o2)->o1)); |
|
|
|
} |
|
|
|
for (ResiPointRankResultDTO resiPointRankResultDTO : rankList) { |
|
|
|
ResiPointRankListResultDTO resultObj = ConvertUtils.sourceToTarget(o, ResiPointRankListResultDTO.class); |
|
|
|
ResiPointRankingResultDTO target = new ResiPointRankingResultDTO(); |
|
|
|
target.setRanking(rankList.get(i).getRank()); |
|
|
|
target.setPoint(rankList.get(i).getTotalPoint()); |
|
|
|
if(userRequestCallback) { |
|
|
|
target.setNickname(null == userInfo.getData().get(i) ? "" : userInfo.getData().get(i).getNickname()); |
|
|
|
target.setHeadImgUrl(null == userInfo.getData().get(i) ? "" : userInfo.getData().get(i).getHeadImgUrl()); |
|
|
|
target.setRanking(resiPointRankResultDTO.getRank()); |
|
|
|
target.setPoint(resiPointRankResultDTO.getTotalPoint()); |
|
|
|
target.setNickname(StrConstant.EPMETY_STR); |
|
|
|
target.setHeadImgUrl(StrConstant.EPMETY_STR); |
|
|
|
UserBaseInfoResultDTO infoResultDTO = userInfoMap.get(resiPointRankResultDTO.getUserId()); |
|
|
|
if (infoResultDTO != null) { |
|
|
|
target.setNickname(infoResultDTO.getNickname()); |
|
|
|
target.setHeadImgUrl(infoResultDTO.getHeadImgUrl()); |
|
|
|
} |
|
|
|
resultObj.setRankList(target); |
|
|
|
result.add(resultObj); |
|
|
|