新增hostSalaryToAgent主播薪资转给代理逻辑

This commit is contained in:
tianfeng 2025-11-11 12:14:08 +08:00
parent 7b20bafcb0
commit 7aa395f3fc
4 changed files with 27 additions and 7 deletions

View File

@ -18,4 +18,11 @@ public class TeamSetting implements Serializable {
*/ */
private Integer maxMember; private Integer maxMember;
/**
* 主播工资是否给代理.
* true: 主播工资给代理
* false: 主播工资直接给主播
*/
private Boolean hostSalaryToAgent;
} }

View File

@ -11,6 +11,7 @@ import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
import com.red.circle.other.app.dto.cmd.team.DbInviteMessageProcessCmd; import com.red.circle.other.app.dto.cmd.team.DbInviteMessageProcessCmd;
import com.red.circle.other.app.util.OfficialNoticeUtils; 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.UserProfileGateway;
import com.red.circle.other.domain.gateway.user.ability.RegisterDeviceGateway;
import com.red.circle.other.infra.database.mongo.entity.team.bd.BdInviteAgentMessage; import com.red.circle.other.infra.database.mongo.entity.team.bd.BdInviteAgentMessage;
import com.red.circle.other.infra.database.mongo.entity.team.bd.MessageInviteGroup; import com.red.circle.other.infra.database.mongo.entity.team.bd.MessageInviteGroup;
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
@ -60,7 +61,7 @@ public class BdInviteMessageProcessExe {
private final TeamMemberService teamMemberService; private final TeamMemberService teamMemberService;
private final UserProfileGateway userProfileGateway; private final UserProfileGateway userProfileGateway;
private final TeamProfileService teamProfileService; private final TeamProfileService teamProfileService;
private final OfficialNoticeClient officialNoticeClient; private final RegisterDeviceGateway registerDeviceGateway;
private final TeamBillCycleService teamBillCycleService; private final TeamBillCycleService teamBillCycleService;
private final UserProfileAppConvertor userProfileAppConvertor; private final UserProfileAppConvertor userProfileAppConvertor;
private final UserHistoryIdentityService userHistoryIdentityService; private final UserHistoryIdentityService userHistoryIdentityService;
@ -118,6 +119,11 @@ public class BdInviteMessageProcessExe {
message.getUserId()); message.getUserId());
ResponseAssert.notNull(TeamErrorCode.USER_IS_NOT_BD, bdBaseInfo); ResponseAssert.notNull(TeamErrorCode.USER_IS_NOT_BD, bdBaseInfo);
// 主播设备指纹校验
Boolean hasAnchorWithSameDevice = registerDeviceGateway.checkDeviceFingerprintHasAnchor(
message.getInviteUserId());
ResponseAssert.isFalse(TeamErrorCode.DEVICE_FINGERPRINT_USED_BY_ANCHOR, hasAnchorWithSameDevice);
UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO( UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(
userProfileGateway.getByUserId(message.getInviteUserId())); userProfileGateway.getByUserId(message.getInviteUserId()));
TeamProfile teamProfile = new TeamProfile() TeamProfile teamProfile = new TeamProfile()

View File

@ -24,6 +24,7 @@ import com.red.circle.other.inner.endpoint.team.target.TeamProfileClient;
import com.red.circle.other.inner.enums.team.*; import com.red.circle.other.inner.enums.team.*;
import com.red.circle.other.inner.model.dto.agency.agency.TeamMemberDTO; import com.red.circle.other.inner.model.dto.agency.agency.TeamMemberDTO;
import com.red.circle.other.inner.model.dto.agency.agency.TeamRemark; import com.red.circle.other.inner.model.dto.agency.agency.TeamRemark;
import com.red.circle.other.inner.model.dto.agency.agency.TeamSetting;
import com.red.circle.tool.core.collection.CollectionUtils; import com.red.circle.tool.core.collection.CollectionUtils;
import com.red.circle.tool.core.date.LocalDateTimeUtils; import com.red.circle.tool.core.date.LocalDateTimeUtils;
import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.tool.core.date.TimestampUtils;
@ -238,8 +239,11 @@ public class TeamBillSettleListener implements MessageListener {
return CollectionUtils.isNotEmpty(teamMemberTargets) ? teamMemberTargets.size() : 0; return CollectionUtils.isNotEmpty(teamMemberTargets) ? teamMemberTargets.size() : 0;
} }
private boolean isHostSalaryToAgent(Map<String, String> metadata) { private boolean isHostSalaryToAgent(TeamProfile teamProfile) {
return Objects.equals(metadata.get("hostSalaryToAgent"), "true"); return Optional.ofNullable(teamProfile)
.map(TeamProfile::getSetting)
.map(TeamSetting::getHostSalaryToAgent)
.orElse(false);
} }
/** /**
@ -259,7 +263,7 @@ public class TeamBillSettleListener implements MessageListener {
Map<String, String> metadata = getMetadata(regionConfig); Map<String, String> metadata = getMetadata(regionConfig);
boolean isOpenDailyAutoSalary = isOpenDailyAutoSalary(metadata); boolean isOpenDailyAutoSalary = isOpenDailyAutoSalary(metadata);
boolean isHostSalaryToAgent = isHostSalaryToAgent(metadata); boolean isHostSalaryToAgent = isHostSalaryToAgent(teamProfile);
for (TeamMemberTarget memberTarget : teamMemberTargets) { for (TeamMemberTarget memberTarget : teamMemberTargets) {
ResultResponse<Boolean> body = userBankRunningWaterClient.existsTrackId(memberTarget.getId()); ResultResponse<Boolean> body = userBankRunningWaterClient.existsTrackId(memberTarget.getId());
@ -364,7 +368,7 @@ public class TeamBillSettleListener implements MessageListener {
Map<String, String> metadata = getMetadata(regionConfig); Map<String, String> metadata = getMetadata(regionConfig);
boolean isOpenDailyAutoSalary = isOpenDailyAutoSalary(metadata); boolean isOpenDailyAutoSalary = isOpenDailyAutoSalary(metadata);
boolean isHostSalaryToAgent = isHostSalaryToAgent(metadata); boolean isHostSalaryToAgent = isHostSalaryToAgent(teamProfile);
for (TeamMemberTarget memberTarget : teamMemberTargets) { for (TeamMemberTarget memberTarget : teamMemberTargets) {
ResultResponse<Boolean> body = salaryDiamondRunningWaterClient.existsTrackId(memberTarget.getId()); ResultResponse<Boolean> body = salaryDiamondRunningWaterClient.existsTrackId(memberTarget.getId());
@ -508,7 +512,7 @@ public class TeamBillSettleListener implements MessageListener {
Map<String, String> metadata = getMetadata(regionConfig); Map<String, String> metadata = getMetadata(regionConfig);
if (!isHostSalaryToAgent(metadata)) { if (!isHostSalaryToAgent(teamProfile)) {
return; return;
} }
@ -658,7 +662,7 @@ public class TeamBillSettleListener implements MessageListener {
Map<String, String> metadata = getMetadata(regionConfig); Map<String, String> metadata = getMetadata(regionConfig);
if (!isHostSalaryToAgent(metadata)) { if (!isHostSalaryToAgent(teamProfile)) {
return; return;
} }

View File

@ -83,6 +83,9 @@ public class TeamProfileServiceImpl implements TeamProfileService {
if (Objects.nonNull(setting.getMaxMember())) { if (Objects.nonNull(setting.getMaxMember())) {
update.set("setting.maxMember", setting.getMaxMember()); update.set("setting.maxMember", setting.getMaxMember());
} }
if (Objects.nonNull(setting.getHostSalaryToAgent())) {
update.set("setting.hostSalaryToAgent", setting.getHostSalaryToAgent());
}
} }
if (Objects.nonNull(teamProfile.getCountry())) { if (Objects.nonNull(teamProfile.getCountry())) {