家族功能 消息模块处理
This commit is contained in:
parent
da9570fb80
commit
a08536c00f
@ -84,6 +84,30 @@ public class FamilyRestController extends BaseController {
|
||||
return familyService.getBaseInfo(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请加入家族.
|
||||
*/
|
||||
@PostMapping("/apply-join")
|
||||
public void applyJoin(@RequestBody @Validated ApplyJoinFamilyCmd cmd) {
|
||||
familyService.applyJoin(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族消息处理.
|
||||
*/
|
||||
@PostMapping("/message/handle")
|
||||
public void messageHandle(@RequestBody @Validated FamilyMessageHandleCmd cmd) {
|
||||
familyService.messageHandle(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族消息列表.
|
||||
*/
|
||||
@GetMapping("/list/message")
|
||||
public List<FamilyMsgListCO> listMessage(FamilyMessageListCmd cmd) {
|
||||
return familyService.listMessage(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族族长信息(与家族成员信息 数据结构一致).
|
||||
*
|
||||
@ -162,45 +186,6 @@ public class FamilyRestController extends BaseController {
|
||||
return familyService.listLevelConfig(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请加入家族.
|
||||
*
|
||||
* @eo.name 申请加入家族.
|
||||
* @eo.url /apply-join
|
||||
* @eo.method post
|
||||
* @eo.request-type json
|
||||
*/
|
||||
@PostMapping("/apply-join")
|
||||
public void applyJoin(@RequestBody @Validated ApplyJoinFamilyCmd cmd) {
|
||||
familyService.applyJoin(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族消息处理.
|
||||
*
|
||||
* @eo.name 家族消息处理.
|
||||
* @eo.url /message/handle
|
||||
* @eo.method post
|
||||
* @eo.request-type json
|
||||
*/
|
||||
@PostMapping("/message/handle")
|
||||
public void messageHandle(@RequestBody @Validated FamilyMessageHandleCmd cmd) {
|
||||
familyService.messageHandle(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族消息列表.
|
||||
*
|
||||
* @eo.name 家族消息列表.
|
||||
* @eo.url /list/message
|
||||
* @eo.method get
|
||||
* @eo.request-type formdata
|
||||
*/
|
||||
@GetMapping("/list/message")
|
||||
public List<FamilyMsgListCO> listMessage(FamilyMessageListCmd cmd) {
|
||||
return familyService.listMessage(cmd);
|
||||
}
|
||||
|
||||
/**
|
||||
* 家族在线房间.
|
||||
*
|
||||
|
||||
@ -1,9 +1,16 @@
|
||||
package com.red.circle.other.app.command.family;
|
||||
|
||||
import com.red.circle.component.redis.service.RedisService;
|
||||
import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient;
|
||||
import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateTypeCmd;
|
||||
import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum;
|
||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||
import com.red.circle.framework.core.response.CommonErrorCode;
|
||||
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
||||
import com.red.circle.other.app.dto.cmd.family.ApplyJoinFamilyCmd;
|
||||
import com.red.circle.other.app.util.OfficialNoticeUtils;
|
||||
import com.red.circle.other.domain.gateway.user.UserProfileGateway;
|
||||
import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway;
|
||||
import com.red.circle.other.infra.common.family.FamilyCommon;
|
||||
import com.red.circle.other.infra.database.rds.entity.family.FamilyMessage;
|
||||
import com.red.circle.other.infra.database.rds.service.family.FamilyMemberInfoService;
|
||||
@ -12,7 +19,11 @@ import com.red.circle.other.infra.enums.family.FamilyMsgTypeEnum;
|
||||
import com.red.circle.other.inner.asserts.DynamicErrorCode;
|
||||
import com.red.circle.other.inner.asserts.FamilyErrorCode;
|
||||
import com.red.circle.other.inner.model.dto.famliy.FamilyDetailsDTO;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@ -49,11 +60,6 @@ public class ApplyJoinFamilyExe {
|
||||
ResponseAssert
|
||||
.isTrue(FamilyErrorCode.FAMILY_MEMBER_MAX, levelCacheCO.getMaxMember() > familyMemberCount);
|
||||
|
||||
// 防止重复触发
|
||||
ResponseAssert.isTrue(DynamicErrorCode.REPEATED_SUBMIT, redisService.setIfAbsent(
|
||||
"APPLY_JOIN_FAMILY_:" + cmd.getReqUserId() + ":" + cmd.getFamilyId(), 40,
|
||||
TimeUnit.SECONDS));
|
||||
|
||||
saveMsg(cmd);
|
||||
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ public class FamilyMessageHandleExe {
|
||||
addFamilyMember(memberId, levelConfig.getFamilyId(), msg.getSenderUser(),
|
||||
cmd.getReqSysOrigin().getOrigin());
|
||||
|
||||
sendHonorReward(msg.getSenderUser(), levelConfig);
|
||||
// sendHonorReward(msg.getSenderUser(), levelConfig);
|
||||
}
|
||||
|
||||
private Integer getMemberCount(FamilyDetailsDTO levelConfig) {
|
||||
|
||||
@ -54,6 +54,8 @@ import com.red.circle.other.app.dto.cmd.family.ReceiveFamilyAwardCmd;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.red.circle.other.app.util.DistributedLockUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -93,6 +95,7 @@ public class FamilyServiceImpl implements FamilyService {
|
||||
private final FamilyDismissGroupChatExe familyDismissGroupChatExe;
|
||||
private final FamilyMemberIdGetUserIdExe familyMemberIdGetUserIdExe;
|
||||
private final FamilyPurchasingGroupChatExe familyPurchasingGroupChatExe;
|
||||
private final DistributedLockUtil distributedLockUtil;
|
||||
|
||||
@Override
|
||||
public Long create(FamilyCreateCmd cmd) {
|
||||
@ -177,7 +180,10 @@ public class FamilyServiceImpl implements FamilyService {
|
||||
|
||||
@Override
|
||||
public void applyJoin(ApplyJoinFamilyCmd cmd) {
|
||||
applyJoinFamilyExe.execute(cmd);
|
||||
String key = "FAMILY_APPLY_JOIN" + ":" + cmd.getReqUserId() + "_" + cmd.getReqUserId();
|
||||
distributedLockUtil.executeWithLock(key, () -> {
|
||||
applyJoinFamilyExe.execute(cmd);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -403,7 +403,7 @@ public class FamilyCommon {
|
||||
*/
|
||||
private void handleFamilyLevel(FamilyLevelConfig levelConfig, FamilyDetailsDTO familyCO) {
|
||||
|
||||
PropsSourceRecord avatarFrame = getPropsSourceById(levelConfig.getAvatarFrameId());
|
||||
/*PropsSourceRecord avatarFrame = getPropsSourceById(levelConfig.getAvatarFrameId());
|
||||
BadgePictureConfig badge = getByBadgeId(levelConfig.getSysOrigin(),
|
||||
levelConfig.getBadgeId());
|
||||
GiftConfig gift = getEffectiveById(levelConfig);
|
||||
@ -424,7 +424,7 @@ public class FamilyCommon {
|
||||
familyCO.setGiftId(gift.getId());
|
||||
familyCO.setGiftCover(gift.getGiftPhoto());
|
||||
familyCO.setGiftSvg(gift.getGiftSourceUrl());
|
||||
}
|
||||
}*/
|
||||
|
||||
familyCO.setLevelSort(levelConfig.getSort());
|
||||
familyCO.setFamilyLevelId(levelConfig.getId());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user