From 4878c1755c9473a9fdf1d393a47731ffe2b5a44c Mon Sep 17 00:00:00 2001 From: tianfeng <769204422@qq.com> Date: Tue, 3 Feb 2026 19:20:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E4=BB=A3=E7=90=86=E6=94=BF=E7=AD=96-?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E5=88=9D=E5=A7=8B=E5=8C=96=E6=96=B0=E5=A2=9E?= =?UTF-8?q?region,countryCode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../other/infra/common/team/TeamTargetCommon.java | 14 +++++++++++--- .../common/team/decay/UpdateMemberTeamDecay.java | 8 ++++++++ .../team/impl/TeamBillCycleClientServiceImpl.java | 6 ++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/team/TeamTargetCommon.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/team/TeamTargetCommon.java index cd9b1d28..eee1a101 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/team/TeamTargetCommon.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/team/TeamTargetCommon.java @@ -1,7 +1,9 @@ package com.red.circle.other.infra.common.team; import com.red.circle.component.redis.service.RedisService; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; import com.red.circle.other.domain.gateway.user.ability.UserRegionGateway; +import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMemberTarget; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamProfile; @@ -39,6 +41,7 @@ public class TeamTargetCommon { private final TeamMemberService teamMemberService; private final TeamProfileService teamProfileService; private final TeamMemberTargetService teamMemberTargetService; + private final UserProfileGateway userProfileGateway; /** * 累计直播时间. @@ -121,11 +124,14 @@ public class TeamTargetCommon { VoidCallable consumer) { TeamMember teamMember = teamMemberService.getByMemberId(userId); - if (Objects.isNull(teamMember)) { + TeamProfile teamProfile = teamProfileService.getById(teamMember.getTeamId()); + if (Objects.isNull(teamMember) || Objects.isNull(teamProfile)) { return TeamTargetBillRes.of((long) getCalcBillBelong(), Boolean.FALSE); } + UserProfile userProfile = userProfileGateway.getByUserId(userId); + // 成员目标单据不存在 if (Boolean.FALSE.equals(existsBillTarget(userId))) { @@ -134,7 +140,7 @@ public class TeamTargetCommon { if (Boolean.TRUE.equals(redisService.lock(key, 5))) { // 单据创建完成立刻解锁 - teamMemberTargetService.createMemberTarget(builderTeamMemberTarget(teamMember)); + teamMemberTargetService.createMemberTarget(builderTeamMemberTarget(teamMember, teamProfile.getRegion(), userProfile.getCountryCode())); redisService.unlock(key); return consumer.apply(); } @@ -151,7 +157,7 @@ public class TeamTargetCommon { return consumer.apply(); } - private TeamMemberTarget builderTeamMemberTarget(TeamMember teamMember) { + private TeamMemberTarget builderTeamMemberTarget(TeamMember teamMember, String region, String countryCode) { return new TeamMemberTarget() .setTimeId(IdWorkerUtils.getId()) @@ -160,6 +166,8 @@ public class TeamTargetCommon { .setBillBelong(getCalcBillBelong()) .setBillTitle(getCalcBillBelong().toString()) .setUserId(teamMember.getMemberId()) + .setRegion(region) + .setCountryCode(countryCode) .setStatus(Boolean.TRUE.equals(getOpenDailyAutoSalary(teamMember)) ? TeamMemberTargetStatus.AUTO : TeamMemberTargetStatus.NOT_RECORDED) .setDailyTargets(List.of( diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/team/decay/UpdateMemberTeamDecay.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/team/decay/UpdateMemberTeamDecay.java index 8fcb9975..5acf3d9d 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/team/decay/UpdateMemberTeamDecay.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/common/team/decay/UpdateMemberTeamDecay.java @@ -11,6 +11,8 @@ import com.red.circle.mq.business.model.event.team.TeamSalaryCountEvent; import com.red.circle.mq.rocket.business.producer.UserMqMessageService; import com.red.circle.mq.rocket.business.service.MessageSenderService; import com.red.circle.mq.rocket.business.streams.TeamSalaryCountSink; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.convertor.team.TeamInfraConvertor; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamApplicationProcessApproval; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamImportanceLog; @@ -66,6 +68,7 @@ public class UpdateMemberTeamDecay { private final TeamInfraConvertor teamInfraConvertor; private final TeamProfileService teamProfileService; private final TeamMemberAddDecay teamMemberAddDecay; + private final UserProfileGateway userProfileGateway; private final SysRegionConfigService sysRegionConfigService; private final TeamMemberTargetService teamMemberTargetService; private final TeamImportanceLogService teamImportanceLogService; @@ -94,6 +97,9 @@ public class UpdateMemberTeamDecay { TeamProfile teamProfile = teamProfileService.getById(teamMember.getTeamId()); ResponseAssert.notNull(TeamErrorCode.USER_NOT_TEAM_MEMBER, teamProfile); + UserProfile userProfile = userProfileGateway.getByUserId(param.getMemberUserId()); + ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, userProfile); + // 移除成员 TeamMember removeTeamMember = processRemoveTeamMember(teamMember.getSortId()); if (Objects.isNull(removeTeamMember)) { @@ -161,6 +167,8 @@ public class UpdateMemberTeamDecay { .setBillBelong(ZonedDateTimeAsiaRiyadhUtils.nowYearMonthToInt()) .setBillTitle(ZonedDateTimeAsiaRiyadhUtils.nowFormat(DateFormatConstant.MM_SLASH_YYYY)) .setUserId(param.getMemberUserId()) + .setRegion(newTeamProfile.getRegion()) + .setCountryCode(userProfile.getCountryCode()) .setStatus(Boolean.TRUE.equals(isOpenAutoSalary) ? TeamMemberTargetStatus.AUTO : TeamMemberTargetStatus.NOT_RECORDED) .setDailyTargets(List.of( diff --git a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/impl/TeamBillCycleClientServiceImpl.java b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/impl/TeamBillCycleClientServiceImpl.java index 5527e583..937bf9f6 100644 --- a/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/impl/TeamBillCycleClientServiceImpl.java +++ b/rc-service/rc-service-other/other-inner-endpoint/src/main/java/com/red/circle/other/app/inner/service/team/impl/TeamBillCycleClientServiceImpl.java @@ -11,6 +11,7 @@ import com.red.circle.mq.rocket.business.streams.TeamSalaryCountSink; import com.red.circle.other.app.inner.convertor.user.UserProfileInnerConvertor; import com.red.circle.other.app.inner.service.team.TeamBillCycleClientService; import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.convertor.team.TeamInfraConvertor; import com.red.circle.other.infra.database.mongo.dto.team.TeamBillMemberTarget; import com.red.circle.other.infra.database.mongo.entity.team.team.TeamBillCycle; @@ -333,6 +334,9 @@ public class TeamBillCycleClientServiceImpl implements TeamBillCycleClientServic teamProfileService.getById(teamMember.getTeamId()); ResponseAssert.notNull(TeamErrorCode.TEAM_NOT_FOUND, teamProfile); + UserProfile userProfile = userProfileGateway.getByUserId(teamMember.getMemberId()); + ResponseAssert.notNull(UserErrorCode.USER_INFO_NOT_FOUND, userProfile); + Boolean isOpenAutoSalary = isOpenDailyAutoSalary(teamProfile.getRegion()); Integer billBelong = ZonedDateTimeAsiaRiyadhUtils.nowYearMonthToInt(); @@ -363,6 +367,8 @@ public class TeamBillCycleClientServiceImpl implements TeamBillCycleClientServic .setStatus(Boolean.TRUE.equals(isOpenAutoSalary) ? TeamMemberTargetStatus.AUTO : TeamMemberTargetStatus.NOT_RECORDED) .setUserId(teamMember.getMemberId()) + .setRegion(teamProfile.getRegion()) + .setCountryCode(userProfile.getCountryCode()) .setDailyTargets(List.of(new TeamMemberTargetIndex() .setOwnOnlineTime(0L) .setOtherOnlineTime(0L)