新增我的家族信息接口
This commit is contained in:
parent
f075c8a87d
commit
3fc79799d5
@ -62,6 +62,14 @@ public class FamilyRestController extends BaseController {
|
|||||||
return familyService.getBaseInfo(cmd);
|
return familyService.getBaseInfo(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户家族基本信息
|
||||||
|
*/
|
||||||
|
@GetMapping("/user-base-info")
|
||||||
|
public FamilyBaseInfoCO getBaseInfo(AppExtCommand cmd) {
|
||||||
|
return familyService.getUserBaseInfo(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 申请加入家族.
|
* 申请加入家族.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.red.circle.other.app.command.family;
|
package com.red.circle.other.app.command.family;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.red.circle.common.business.dto.cmd.AppExtCommand;
|
||||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||||
import com.red.circle.framework.core.response.CommonErrorCode;
|
import com.red.circle.framework.core.response.CommonErrorCode;
|
||||||
import com.red.circle.other.app.dto.clientobject.family.FamilyBaseInfoCO;
|
import com.red.circle.other.app.dto.clientobject.family.FamilyBaseInfoCO;
|
||||||
@ -81,6 +82,44 @@ public class FamilyBaseInfoExe {
|
|||||||
return getFamilyInfoCO(baseInfo, familyLevel, adminInfo, myFamilyInfo, boxInfo, memberList, joinWaiting);
|
return getFamilyInfoCO(baseInfo, familyLevel, adminInfo, myFamilyInfo, boxInfo, memberList, joinWaiting);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户自己的家族
|
||||||
|
*/
|
||||||
|
public FamilyBaseInfoCO execute2(AppExtCommand cmd) {
|
||||||
|
FamilyMemberInfo myFamilyInfo = familyMemberInfoService.getFamilyMemberByUserId(cmd.getReqUserId());
|
||||||
|
if (Objects.isNull(myFamilyInfo)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
Long familyId = myFamilyInfo.getFamilyId();
|
||||||
|
|
||||||
|
FamilyBaseInfo baseInfo = familyBaseInfoService.getBaseInfoById(familyId);
|
||||||
|
if (Objects.isNull(baseInfo)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
FamilyDetailsDTO familyLevel = familyCommon.getFamilyDetails(cmd.getReqSysOrigin().getOrigin(), baseInfo.getId());
|
||||||
|
FamilyMemberInfo familyMemberInfo = familyMemberInfoService.getAdmin(familyId, FamilyRoleEnum.ADMIN.getKey());
|
||||||
|
|
||||||
|
//族长信息
|
||||||
|
FamilyBaseInfoCO.FamilyAdminInfo adminInfo = getFamilyAdminInfo(familyMemberInfo);
|
||||||
|
|
||||||
|
return new FamilyBaseInfoCO()
|
||||||
|
.setFamilyId(baseInfo.getId())
|
||||||
|
.setFamilyAdmin(adminInfo)
|
||||||
|
.setFamilyAccount(baseInfo.getFamilyAccount())
|
||||||
|
.setFamilyAvatar(baseInfo.getFamilyAvatar())
|
||||||
|
.setFamilyName(baseInfo.getFamilyName())
|
||||||
|
.setFamilyNotice(baseInfo.getFamilyNotice())
|
||||||
|
.setFamilyIntro(baseInfo.getFamilyIntro())
|
||||||
|
.setCurrentMember(getFamilyMemberCount(baseInfo.getId()))
|
||||||
|
.setFamilyLevel(Optional.ofNullable(familyLevel.getLevel()).orElse(0))
|
||||||
|
.setLevelExp(familyLevel.getLevelExp())
|
||||||
|
.setMaxMember(familyLevel.getMaxMember())
|
||||||
|
.setLevelBackgroundPicture(familyLevel.getLevelBackgroundPicture())
|
||||||
|
.setMyFamilyRole(Optional.of(myFamilyInfo).map(FamilyMemberInfo::getMemberRole).orElse(null))
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
private FamilyBaseInfoCO.FamilyAdminInfo getFamilyAdminInfo(FamilyMemberInfo familyMemberInfo) {
|
private FamilyBaseInfoCO.FamilyAdminInfo getFamilyAdminInfo(FamilyMemberInfo familyMemberInfo) {
|
||||||
FamilyBaseInfoCO.FamilyAdminInfo adminInfo = null;
|
FamilyBaseInfoCO.FamilyAdminInfo adminInfo = null;
|
||||||
if (familyMemberInfo != null) {
|
if (familyMemberInfo != null) {
|
||||||
|
|||||||
@ -121,6 +121,11 @@ public class FamilyServiceImpl implements FamilyService {
|
|||||||
return familyBaseInfoExe.execute(cmd);
|
return familyBaseInfoExe.execute(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FamilyBaseInfoCO getUserBaseInfo(AppExtCommand cmd) {
|
||||||
|
return familyBaseInfoExe.execute2(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void grantUserRole(FamilyGrantUserRoleCmd cmd) {
|
public void grantUserRole(FamilyGrantUserRoleCmd cmd) {
|
||||||
if (Objects.equals(cmd.getRoleKey(), "REMOVE")) {
|
if (Objects.equals(cmd.getRoleKey(), "REMOVE")) {
|
||||||
|
|||||||
@ -45,6 +45,11 @@ public interface FamilyService {
|
|||||||
*/
|
*/
|
||||||
FamilyBaseInfoCO getBaseInfo(FamilyBaseInfoQueryCmd cmd);
|
FamilyBaseInfoCO getBaseInfo(FamilyBaseInfoQueryCmd cmd);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户家族基本信息.
|
||||||
|
*/
|
||||||
|
FamilyBaseInfoCO getUserBaseInfo(AppExtCommand cmd);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 授权用户家族权限.
|
* 授权用户家族权限.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user