家族新增首页家族列表功能
This commit is contained in:
parent
ba5a1f052d
commit
66a6880735
@ -63,7 +63,7 @@ public class FamilyDetailsDTO implements Serializable {
|
||||
/**
|
||||
* 等级key
|
||||
*/
|
||||
private String levelKey;
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 等级经验值
|
||||
|
||||
@ -6,28 +6,7 @@ import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import com.red.circle.framework.web.controller.BaseController;
|
||||
import com.red.circle.other.app.dto.clientobject.family.*;
|
||||
import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO;
|
||||
import com.red.circle.other.app.dto.cmd.family.ApplyJoinFamilyCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.CancelFamilyApplyCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.ReapplyFamilyCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyBoxClaimCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyAdminQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyBaseInfoQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyCreateCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyDailyTaskCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyGrantUserRoleCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyGroupChatPayCheckCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyGroupChatQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyInfoEditCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyListCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyMemberListCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyMemberListQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyMessageHandleCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyMessageListCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.MyFamilyApplyListCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyOnlineRoomQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyRemoveUserCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyUserInfoQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.ReceiveFamilyAwardCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.*;
|
||||
import com.red.circle.other.app.service.family.FamilyService;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import java.math.BigDecimal;
|
||||
@ -163,6 +142,14 @@ public class FamilyRestController extends BaseController {
|
||||
return familyService.listLevelConfig(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页家族列表.
|
||||
*/
|
||||
@GetMapping("/home-list")
|
||||
public PageResult<FamilyHomeListCO> familyHomeList(FamilyHomeListCmd cmd) {
|
||||
return familyService.familyHomeList(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族在线房间.
|
||||
*
|
||||
|
||||
@ -9,12 +9,10 @@ import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
import com.red.circle.other.domain.model.user.OwnSpecialId;
|
||||
import com.red.circle.other.domain.model.user.UserProfile;
|
||||
import com.red.circle.other.infra.common.family.FamilyCommon;
|
||||
import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService;
|
||||
import com.red.circle.other.infra.database.rds.entity.family.FamilyBaseInfo;
|
||||
import com.red.circle.other.infra.database.rds.entity.family.FamilyBoxDaily;
|
||||
import com.red.circle.other.infra.database.rds.entity.family.FamilyBoxUserReward;
|
||||
import com.red.circle.other.infra.database.rds.entity.family.FamilyMemberInfo;
|
||||
import com.red.circle.other.infra.database.rds.enums.OtherConfigEnum;
|
||||
import com.red.circle.other.infra.database.rds.service.family.FamilyBaseInfoService;
|
||||
import com.red.circle.other.infra.database.rds.service.family.FamilyBoxDailyService;
|
||||
import com.red.circle.other.infra.database.rds.service.family.FamilyBoxUserContributeService;
|
||||
@ -26,11 +24,8 @@ import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberSer
|
||||
import com.red.circle.other.infra.enums.family.FamilyRoleEnum;
|
||||
import com.red.circle.other.infra.enums.family.FamilyStatusEnum;
|
||||
import com.red.circle.other.infra.enums.family.FamilyBoxConfigEnum;
|
||||
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
||||
import com.red.circle.other.inner.enums.team.TeamMemberRole;
|
||||
import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -42,7 +37,6 @@ import java.util.stream.Collectors;
|
||||
|
||||
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@ -120,8 +114,7 @@ public class FamilyBaseInfoExe {
|
||||
.setCurrentExp(
|
||||
familyLevelExpService.getExp(baseInfo.getId(), baseInfo.getFamilyLevelId()).longValue())
|
||||
.setCurrentMember(getFamilyMemberCount(baseInfo.getId()))
|
||||
.setFamilyLevel(Optional.ofNullable(familyLevel.getLevelKey())
|
||||
.map(key -> Integer.parseInt(key.substring(6)))
|
||||
.setFamilyLevel(Optional.ofNullable(familyLevel.getLevel())
|
||||
.orElse(0))
|
||||
.setLevelExp(familyLevel.getLevelExp())
|
||||
.setMaxMember(familyLevel.getMaxMember())
|
||||
|
||||
@ -0,0 +1,231 @@
|
||||
package com.red.circle.other.app.command.family;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyHomeListCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyHomeMemberCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyHomeRoomCO;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyHomeListCmd;
|
||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
import com.red.circle.other.domain.model.user.UserConsumptionLevel;
|
||||
import com.red.circle.other.domain.model.user.UserProfile;
|
||||
import com.red.circle.other.infra.common.family.FamilyCommon;
|
||||
import com.red.circle.other.infra.database.mongo.entity.live.ActiveVoiceRoom;
|
||||
import com.red.circle.other.infra.database.mongo.entity.user.status.OnlineUser;
|
||||
import com.red.circle.other.infra.database.mongo.service.live.ActiveVoiceRoomService;
|
||||
import com.red.circle.other.infra.database.mongo.service.user.status.OnlineUserService;
|
||||
import com.red.circle.other.infra.database.rds.entity.family.FamilyBaseInfo;
|
||||
import com.red.circle.other.infra.database.rds.entity.family.FamilyMemberInfo;
|
||||
import com.red.circle.other.infra.database.rds.service.family.FamilyBaseInfoService;
|
||||
import com.red.circle.other.infra.database.rds.service.family.FamilyLevelExpService;
|
||||
import com.red.circle.other.infra.database.rds.service.family.FamilyMemberInfoService;
|
||||
import com.red.circle.other.infra.enums.family.FamilyRoleEnum;
|
||||
import com.red.circle.other.infra.enums.family.FamilyStatusEnum;
|
||||
import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO;
|
||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||
import com.red.circle.tool.core.num.NumUtils;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 家族首页列表
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class FamilyHomeListExe {
|
||||
|
||||
private final FamilyCommon familyCommon;
|
||||
private final UserProfileGateway userProfileGateway;
|
||||
private final OnlineUserService onlineUserService;
|
||||
private final ActiveVoiceRoomService activeVoiceRoomService;
|
||||
private final FamilyBaseInfoService familyBaseInfoService;
|
||||
private final FamilyLevelExpService familyLevelExpService;
|
||||
private final FamilyMemberInfoService familyMemberInfoService;
|
||||
|
||||
public PageResult<FamilyHomeListCO> execute(FamilyHomeListCmd cmd) {
|
||||
List<FamilyBaseInfo> familyList = getFamilyList(cmd);
|
||||
|
||||
if (CollectionUtils.isEmpty(familyList)) {
|
||||
return PageResult.newPageResult(0);
|
||||
}
|
||||
|
||||
Set<Long> familyIds = familyList.stream()
|
||||
.map(FamilyBaseInfo::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<Long, BigDecimal> expMap = familyLevelExpService.mapTotalExpCountByFamilyIds(familyIds);
|
||||
|
||||
List<FamilyHomeListCO> result = familyList.stream()
|
||||
.map(family -> buildFamilyHomeCO(cmd, family, expMap.getOrDefault(family.getId(), BigDecimal.ZERO)))
|
||||
.sorted(Comparator.comparing(FamilyHomeListExe::replaceExp, Comparator.reverseOrder()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
PageResult<FamilyHomeListCO> pageResult = new PageResult<>();
|
||||
pageResult.setCurrent(cmd.getCurrent());
|
||||
pageResult.setSize(cmd.getSize());
|
||||
pageResult.setRecords(result);
|
||||
return pageResult;
|
||||
}
|
||||
|
||||
private static long replaceExp(FamilyHomeListCO co) {
|
||||
String replace = co.getExp()
|
||||
.replace(",", "")
|
||||
.replace("K", "")
|
||||
.replace("M", "")
|
||||
;
|
||||
return Long.parseLong(replace);
|
||||
}
|
||||
|
||||
private List<FamilyBaseInfo> getFamilyList(FamilyHomeListCmd cmd) {
|
||||
IPage<FamilyBaseInfo> page = new Page<>();
|
||||
page.setCurrent(cmd.getCurrent());
|
||||
page.setSize(cmd.getSize());
|
||||
|
||||
return familyBaseInfoService.page(
|
||||
page,
|
||||
familyBaseInfoService.query()
|
||||
.eq(FamilyBaseInfo::getSysOrigin, cmd.requireReqSysOrigin())
|
||||
.eq(FamilyBaseInfo::getFamilyStatus, FamilyStatusEnum.NORMAL.name())
|
||||
.orderByDesc(FamilyBaseInfo::getCreateTime)
|
||||
.getWrapper()
|
||||
).getRecords();
|
||||
}
|
||||
|
||||
private FamilyHomeListCO buildFamilyHomeCO(FamilyHomeListCmd cmd, FamilyBaseInfo family, BigDecimal totalExp) {
|
||||
FamilyDetailsDTO levelDetails = familyCommon.getFamilyDetails(cmd.requireReqSysOrigin(), family.getId());
|
||||
|
||||
List<FamilyMemberInfo> members = familyMemberInfoService.listByFamilyId(family.getId());
|
||||
Set<Long> memberUserIds = members.stream()
|
||||
.map(FamilyMemberInfo::getMemberUserId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<OnlineUser> onlineUsers = CollectionUtils.isEmpty(memberUserIds)
|
||||
? List.of()
|
||||
: onlineUserService.userOnlineByUserIds(memberUserIds);
|
||||
|
||||
Set<Long> onlineUserIds = onlineUsers.stream()
|
||||
.map(OnlineUser::getUserId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<FamilyHomeMemberCO> displayMembers = buildDisplayMembers(cmd, members, onlineUserIds);
|
||||
|
||||
List<ActiveVoiceRoom> onlineRooms = activeVoiceRoomService.listByFamilyId(family.getId(), 4);
|
||||
List<FamilyHomeRoomCO> roomCOs = buildRoomCOs(onlineRooms);
|
||||
|
||||
return new FamilyHomeListCO()
|
||||
.setFamilyId(family.getId())
|
||||
.setFamilyName(family.getFamilyName())
|
||||
.setFamilyAvatar(family.getFamilyAvatar())
|
||||
.setFamilyAccount(family.getFamilyAccount())
|
||||
.setLevel(levelDetails.getLevel())
|
||||
.setMemberCount(members.size())
|
||||
.setOnlineCount(onlineUsers.size())
|
||||
.setExp(NumUtils.formatLong(totalExp.longValue()))
|
||||
.setAvatarFrameCover(levelDetails.getAvatarFrameCover())
|
||||
.setAvatarFrameSvg(levelDetails.getAvatarFrameSvg())
|
||||
.setDisplayMembers(displayMembers)
|
||||
.setOnlineRooms(roomCOs);
|
||||
}
|
||||
|
||||
private List<FamilyHomeMemberCO> buildDisplayMembers(FamilyHomeListCmd cmd,
|
||||
List<FamilyMemberInfo> members, Set<Long> onlineUserIds) {
|
||||
|
||||
if (CollectionUtils.isEmpty(members)) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
Set<Long> userIds = members.stream()
|
||||
.map(FamilyMemberInfo::getMemberUserId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<Long, UserProfile> profileMap = userProfileGateway.mapByUserIds(userIds);
|
||||
Map<Long, UserConsumptionLevel> levelMap = userProfileGateway.getUserConsumptionLevel(
|
||||
cmd.requireReqSysOriginEnum(), userIds);
|
||||
|
||||
return members.stream()
|
||||
.limit(8)
|
||||
.sorted(getMemberComparator(levelMap))
|
||||
.map(member -> {
|
||||
UserProfile profile = profileMap.get(member.getMemberUserId());
|
||||
UserConsumptionLevel level = levelMap.get(member.getMemberUserId());
|
||||
|
||||
return new FamilyHomeMemberCO()
|
||||
.setUserId(member.getMemberUserId())
|
||||
.setAvatar(Objects.nonNull(profile) ? profile.getUserAvatar() : "")
|
||||
.setOnline(onlineUserIds.contains(member.getMemberUserId()))
|
||||
.setFamilyRole(member.getMemberRole())
|
||||
.setConsumptionLevel(Objects.nonNull(level) ? level.getWealthLevel() : 0);
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Comparator<FamilyMemberInfo> getMemberComparator(Map<Long, UserConsumptionLevel> levelMap) {
|
||||
return (m1, m2) -> {
|
||||
int roleOrder1 = getRoleOrder(m1.getMemberRole());
|
||||
int roleOrder2 = getRoleOrder(m2.getMemberRole());
|
||||
|
||||
if (roleOrder1 != roleOrder2) {
|
||||
return Integer.compare(roleOrder1, roleOrder2);
|
||||
}
|
||||
|
||||
if (FamilyRoleEnum.MEMBER.name().equals(m1.getMemberRole())) {
|
||||
UserConsumptionLevel level1 = levelMap.get(m1.getMemberUserId());
|
||||
UserConsumptionLevel level2 = levelMap.get(m2.getMemberUserId());
|
||||
|
||||
int l1 = Objects.nonNull(level1) ? level1.getWealthLevel() : 0;
|
||||
int l2 = Objects.nonNull(level2) ? level2.getWealthLevel() : 0;
|
||||
|
||||
return Integer.compare(l2, l1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
}
|
||||
|
||||
private int getRoleOrder(String role) {
|
||||
if (FamilyRoleEnum.ADMIN.name().equals(role)) {
|
||||
return 1;
|
||||
} else if (FamilyRoleEnum.MANAGE.name().equals(role)) {
|
||||
return 2;
|
||||
} else {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
private List<FamilyHomeRoomCO> buildRoomCOs(List<ActiveVoiceRoom> rooms) {
|
||||
if (CollectionUtils.isEmpty(rooms)) {
|
||||
return List.of();
|
||||
}
|
||||
|
||||
Set<Long> userIds = rooms.stream()
|
||||
.map(ActiveVoiceRoom::getUserId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<Long, UserProfile> profileMap = userProfileGateway.mapByUserIds(userIds);
|
||||
|
||||
return rooms.stream()
|
||||
.map(room -> {
|
||||
UserProfile profile = profileMap.get(room.getUserId());
|
||||
|
||||
return new FamilyHomeRoomCO()
|
||||
.setRoomId(room.getId())
|
||||
.setRoomAccount(room.getRoomAccount())
|
||||
.setUserId(room.getUserId())
|
||||
.setUserAvatar(Objects.nonNull(profile) ? profile.getUserAvatar() : "")
|
||||
.setUserNickname(Objects.nonNull(profile) ? profile.getUserNickname() : "")
|
||||
.setOnlineQuantity(room.getOnlineQuantity());
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.red.circle.other.app.command.family;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||
import com.red.circle.live.inner.endpoint.LiveMicClient;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyLeaderboardCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyMemberWeekRankCO;
|
||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
|
||||
@ -37,7 +37,7 @@ public class FamilyLevelListExe {
|
||||
|
||||
private FamilyLevelCO convertToLevelCO(FamilyLevelConfig config) {
|
||||
return new FamilyLevelCO()
|
||||
.setLevelKey(config.getLevelKey())
|
||||
.setLevel(config.getLevelKey().substring(6))
|
||||
.setLevelExp(config.getLevelExp())
|
||||
.setMaxMember(config.getMaxMember())
|
||||
.setMaxManager(config.getMaxManager())
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
package com.red.circle.other.app.command.family;
|
||||
|
||||
import com.red.circle.mq.business.model.event.task.TaskApprovalEvent;
|
||||
import com.red.circle.mq.rocket.business.producer.TaskMqMessage;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyUserInfoCO;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyUserInfoQueryCmd;
|
||||
@ -12,7 +11,6 @@ import com.red.circle.other.infra.database.rds.service.family.FamilyMemberInfoSe
|
||||
import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.red.circle.tool.core.date.LocalDateTimeUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -74,7 +72,7 @@ public class FamilyUserInfoExe {
|
||||
.setFamilyAvatar(baseInfo.getFamilyAvatar())
|
||||
.setFamilyName(baseInfo.getFamilyName())
|
||||
.setFamilyRole(familyMemberInfo.getMemberRole())
|
||||
.setLevelKey(familyLevel.getLevelKey())
|
||||
.setLevel(familyLevel.getLevel())
|
||||
.setCurrentMember(getFamilyMemberCount(baseInfo))
|
||||
.setMaxMember(familyLevel.getMaxMember())
|
||||
.setLevelBackgroundPicture(familyLevel.getLevelBackgroundPicture())
|
||||
|
||||
@ -31,39 +31,10 @@ import com.red.circle.other.app.command.family.ReapplyFamilyExe;
|
||||
import com.red.circle.other.app.command.family.FamilyListExe;
|
||||
import com.red.circle.other.app.command.family.FamilyBoxContributeExe;
|
||||
import com.red.circle.other.app.command.family.FamilyBoxClaimExe;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyBaseInfoCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyCreateRulesCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyLeaderboardCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyLevelCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyListCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyMemberCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyMsgListCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.MyFamilyApplyCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyRewardCO;
|
||||
import com.red.circle.other.app.dto.clientobject.family.FamilyUserInfoCO;
|
||||
import com.red.circle.other.app.command.family.FamilyHomeListExe;
|
||||
import com.red.circle.other.app.dto.clientobject.family.*;
|
||||
import com.red.circle.other.app.dto.clientobject.room.RoomVoiceProfileCO;
|
||||
import com.red.circle.other.app.dto.cmd.family.ApplyJoinFamilyCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.CancelFamilyApplyCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.ReapplyFamilyCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyBoxClaimCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyAdminQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyBaseInfoQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyCreateCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyDailyTaskCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyGrantUserRoleCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyGroupChatPayCheckCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyGroupChatQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyInfoEditCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyListCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyMemberListCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyMemberListQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyMessageHandleCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyMessageListCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.MyFamilyApplyListCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyOnlineRoomQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyRemoveUserCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.FamilyUserInfoQueryCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.ReceiveFamilyAwardCmd;
|
||||
import com.red.circle.other.app.dto.cmd.family.*;
|
||||
import com.red.circle.framework.dto.PageResult;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@ -116,6 +87,7 @@ public class FamilyServiceImpl implements FamilyService {
|
||||
private final FamilyBoxContributeExe familyBoxContributeExe;
|
||||
private final FamilyBoxClaimExe familyBoxClaimExe;
|
||||
private final DistributedLockUtil distributedLockUtil;
|
||||
private final FamilyHomeListExe familyHomeListExe;
|
||||
|
||||
@Override
|
||||
public Long create(FamilyCreateCmd cmd) {
|
||||
@ -285,4 +257,9 @@ public class FamilyServiceImpl implements FamilyService {
|
||||
familyBoxClaimExe.execute(cmd);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<FamilyHomeListCO> familyHomeList(FamilyHomeListCmd cmd) {
|
||||
return familyHomeListExe.execute(cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
package com.red.circle.other.app.dto.clientobject.family;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 家族首页列表
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class FamilyHomeListCO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 家族ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long familyId;
|
||||
|
||||
/**
|
||||
* 家族名称
|
||||
*/
|
||||
private String familyName;
|
||||
|
||||
/**
|
||||
* 家族头像
|
||||
*/
|
||||
private String familyAvatar;
|
||||
|
||||
/**
|
||||
* 家族ID号
|
||||
*/
|
||||
private String familyAccount;
|
||||
|
||||
/**
|
||||
* 家族等级
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 家族总人数
|
||||
*/
|
||||
private Integer memberCount;
|
||||
|
||||
/**
|
||||
* 在线用户数
|
||||
*/
|
||||
private Integer onlineCount;
|
||||
|
||||
/**
|
||||
* 家族经验值
|
||||
*/
|
||||
private String exp;
|
||||
|
||||
/**
|
||||
* 头像框封面
|
||||
*/
|
||||
private String avatarFrameCover;
|
||||
|
||||
/**
|
||||
* 头像框SVG
|
||||
*/
|
||||
private String avatarFrameSvg;
|
||||
|
||||
/**
|
||||
* 展示的成员列表(按规则排序)
|
||||
*/
|
||||
private List<FamilyHomeMemberCO> displayMembers;
|
||||
|
||||
/**
|
||||
* 在线房间列表(最多4个)
|
||||
*/
|
||||
private List<FamilyHomeRoomCO> onlineRooms;
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.red.circle.other.app.dto.clientobject.family;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 家族首页成员信息
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class FamilyHomeMemberCO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 是否在线
|
||||
*/
|
||||
private Boolean online;
|
||||
|
||||
/**
|
||||
* 家族角色
|
||||
*/
|
||||
private String familyRole;
|
||||
|
||||
/**
|
||||
* 财富等级
|
||||
*/
|
||||
private Integer consumptionLevel;
|
||||
|
||||
}
|
||||
@ -0,0 +1,50 @@
|
||||
package com.red.circle.other.app.dto.clientobject.family;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 家族首页房间信息
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class FamilyHomeRoomCO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 房间ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long roomId;
|
||||
|
||||
/**
|
||||
* 房间账号
|
||||
*/
|
||||
private String roomAccount;
|
||||
|
||||
/**
|
||||
* 房主ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long userId;
|
||||
|
||||
/**
|
||||
* 房主头像
|
||||
*/
|
||||
private String userAvatar;
|
||||
|
||||
/**
|
||||
* 房主昵称
|
||||
*/
|
||||
private String userNickname;
|
||||
|
||||
/**
|
||||
* 在线人数
|
||||
*/
|
||||
private Long onlineQuantity;
|
||||
|
||||
}
|
||||
@ -23,7 +23,7 @@ public class FamilyLevelCO implements Serializable {
|
||||
/**
|
||||
* 等级key
|
||||
*/
|
||||
private String levelKey;
|
||||
private String level;
|
||||
|
||||
/**
|
||||
* 等级经验值
|
||||
|
||||
@ -51,9 +51,9 @@ public class FamilyUserInfoCO extends ClientObject {
|
||||
private String familyRole;
|
||||
|
||||
/**
|
||||
* 等级KEY.
|
||||
* 等级
|
||||
*/
|
||||
private String levelKey;
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 当前成员数.
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package com.red.circle.other.app.dto.cmd.family;
|
||||
|
||||
import com.red.circle.common.business.dto.PageQueryCmd;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 家族首页列表查询
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Accessors(chain = true)
|
||||
public class FamilyHomeListCmd extends PageQueryCmd {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
||||
@ -165,4 +165,9 @@ public interface FamilyService {
|
||||
* 领取家族宝箱奖励.
|
||||
*/
|
||||
void boxClaim(FamilyBoxClaimCmd cmd);
|
||||
|
||||
/**
|
||||
* 家族首页列表.
|
||||
*/
|
||||
PageResult<FamilyHomeListCO> familyHomeList(FamilyHomeListCmd cmd);
|
||||
}
|
||||
|
||||
@ -144,6 +144,8 @@ public interface UserProfileGateway {
|
||||
*/
|
||||
UserConsumptionLevel getUserConsumptionLevel(SysOriginPlatformEnum sysOrigin, Long userId);
|
||||
|
||||
Map<Long, UserConsumptionLevel> getUserConsumptionLevel(SysOriginPlatformEnum sysOrigin, Set<Long> userIds);
|
||||
|
||||
/**
|
||||
* 检测是否是好友关系.
|
||||
*
|
||||
|
||||
@ -190,7 +190,7 @@ public class FamilyCommon {
|
||||
}
|
||||
|
||||
FamilyDetailsDTO currentLevel = getFamilyDetails(sysOrigin, member.getFamilyId());
|
||||
if (StringUtils.isBlank(sysOrigin) || Objects.isNull(currentLevel) || StringUtils.isBlank(currentLevel.getLevelKey())) {
|
||||
if (StringUtils.isBlank(sysOrigin) || Objects.isNull(currentLevel) || Objects.isNull(currentLevel.getLevel())) {
|
||||
log.error("增加家族经验失败,FamilyId:{}", member.getFamilyId());
|
||||
return;
|
||||
}
|
||||
@ -460,7 +460,7 @@ public class FamilyCommon {
|
||||
|
||||
familyCO.setLevelSort(levelConfig.getSort());
|
||||
familyCO.setFamilyLevelId(levelConfig.getId());
|
||||
familyCO.setLevelKey(levelConfig.getLevelKey());
|
||||
familyCO.setLevel(Integer.parseInt(levelConfig.getLevelKey().substring(6)));
|
||||
familyCO.setLevelExp(Long.valueOf(levelConfig.getLevelExp()));
|
||||
familyCO.setMaxMember(levelConfig.getMaxMember());
|
||||
familyCO.setMaxManager(levelConfig.getMaxManager());
|
||||
|
||||
@ -451,6 +451,19 @@ public class UserProfileGatewayImpl implements UserProfileGateway {
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Long, UserConsumptionLevel> getUserConsumptionLevel(SysOriginPlatformEnum sysOrigin, Set<Long> userIds) {
|
||||
if (CollectionUtils.isEmpty(userIds)) {
|
||||
return Map.of();
|
||||
}
|
||||
|
||||
return userIds.stream()
|
||||
.collect(Collectors.toMap(
|
||||
userId -> userId,
|
||||
userId -> getUserConsumptionLevel(sysOrigin, userId)
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean checkFriend(Long userId, Long friendUserId) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user