diff --git a/backend/services/authorization-service/src/infrastructure/kafka/event-consumer.controller.ts b/backend/services/authorization-service/src/infrastructure/kafka/event-consumer.controller.ts index 15edbed7..457f61be 100644 --- a/backend/services/authorization-service/src/infrastructure/kafka/event-consumer.controller.ts +++ b/backend/services/authorization-service/src/infrastructure/kafka/event-consumer.controller.ts @@ -531,6 +531,7 @@ export class EventConsumerController { /** * 检查单个省团队是否可以升级为省区域 * 业务规则:省团队本人伞下认种数(不含自己)达到5万棵时自动升级 + * 注意:referral-service 返回的 totalTeamPlantingCount 已经是不含自己的伞下认种数 */ private async checkAuthProvinceUpgrade(authProvince: AuthorizationRole): Promise { const accountSequence = authProvince.userId.accountSequence @@ -544,12 +545,12 @@ export class EventConsumerController { return } - // 伞下认种数 = 团队总认种数 - 自己认种数 - const subordinateCount = teamStats.totalTeamPlantingCount - teamStats.selfPlantingCount + // totalTeamPlantingCount 已经是伞下认种数(不含自己) + const subordinateCount = teamStats.totalTeamPlantingCount // 2. 检查伞下认种数是否达到省区域升级阈值(5万棵) if (subordinateCount < EventConsumerController.PROVINCE_UPGRADE_THRESHOLD) { - this.logger.debug(`[TEAM-AUTO-UPGRADE] Auth province ${accountSequence} has subordinate count ${subordinateCount} (total=${teamStats.totalTeamPlantingCount}, self=${teamStats.selfPlantingCount}), not reaching ${EventConsumerController.PROVINCE_UPGRADE_THRESHOLD} threshold`) + this.logger.debug(`[TEAM-AUTO-UPGRADE] Auth province ${accountSequence} has subordinate count ${subordinateCount}, not reaching ${EventConsumerController.PROVINCE_UPGRADE_THRESHOLD} threshold`) return } @@ -621,6 +622,7 @@ export class EventConsumerController { /** * 检查单个市团队是否可以升级为市区域 * 业务规则:市团队本人伞下认种数(不含自己)达到1万棵时自动升级 + * 注意:referral-service 返回的 totalTeamPlantingCount 已经是不含自己的伞下认种数 */ private async checkAuthCityUpgrade(authCity: AuthorizationRole): Promise { const accountSequence = authCity.userId.accountSequence @@ -634,12 +636,12 @@ export class EventConsumerController { return } - // 伞下认种数 = 团队总认种数 - 自己认种数 - const subordinateCount = teamStats.totalTeamPlantingCount - teamStats.selfPlantingCount + // totalTeamPlantingCount 已经是伞下认种数(不含自己) + const subordinateCount = teamStats.totalTeamPlantingCount // 2. 检查伞下认种数是否达到市区域升级阈值(1万棵) if (subordinateCount < EventConsumerController.CITY_UPGRADE_THRESHOLD) { - this.logger.debug(`[TEAM-AUTO-UPGRADE] Auth city ${accountSequence} has subordinate count ${subordinateCount} (total=${teamStats.totalTeamPlantingCount}, self=${teamStats.selfPlantingCount}), not reaching ${EventConsumerController.CITY_UPGRADE_THRESHOLD} threshold`) + this.logger.debug(`[TEAM-AUTO-UPGRADE] Auth city ${accountSequence} has subordinate count ${subordinateCount}, not reaching ${EventConsumerController.CITY_UPGRADE_THRESHOLD} threshold`) return }