From 834a1fc0b00faa6308186e80ae6b9d5624b70f5a Mon Sep 17 00:00:00 2001 From: hailin Date: Wed, 17 Dec 2025 03:44:48 -0800 Subject: [PATCH] =?UTF-8?q?fix(authorization):=20=E7=9C=81=E5=8C=BA?= =?UTF-8?q?=E5=9F=9F=E5=92=8C=E5=B8=82=E5=8C=BA=E5=9F=9F=E6=8E=88=E6=9D=83?= =?UTF-8?q?=E5=8D=B3=E6=BF=80=E6=B4=BB=EF=BC=8C=E6=97=A0=E9=9C=80=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E8=80=83=E6=A0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改 createProvinceCompany 和 createCityCompany 方法: - 授权后立即激活权益 (benefitActive: true) - 从第1个月开始考核 (currentMonthIndex: 1) - 省区域月度目标:150, 300, 600, 1200, 2400, 4800, 9600, 19200, 11750 - 市区域月度目标:30, 60, 120, 240, 480, 960, 1920, 3840, 2350 - 保留 skipAssessment 参数兼容性 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- .../authorization-role.aggregate.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/backend/services/authorization-service/src/domain/aggregates/authorization-role.aggregate.ts b/backend/services/authorization-service/src/domain/aggregates/authorization-role.aggregate.ts index 17a7fae3..49cc5fd2 100644 --- a/backend/services/authorization-service/src/domain/aggregates/authorization-role.aggregate.ts +++ b/backend/services/authorization-service/src/domain/aggregates/authorization-role.aggregate.ts @@ -371,14 +371,14 @@ export class AuthorizationRole extends AggregateRoot { } // 工厂方法 - 创建正式省公司 + // 授权即激活,开始按月考核(150, 300, 600, 1200, 2400, 4800, 9600, 19200, 11750) static createProvinceCompany(params: { userId: UserId provinceCode: string provinceName: string adminId: AdminUserId - skipAssessment?: boolean + skipAssessment?: boolean // 保留兼容,但不再影响激活状态 }): AuthorizationRole { - const skipAssessment = params.skipAssessment ?? false const now = new Date() const auth = new AuthorizationRole({ authorizationId: AuthorizationId.generate(), @@ -396,14 +396,14 @@ export class AuthorizationRole extends AggregateRoot { assessmentConfig: AssessmentConfig.forProvince(), requireLocalPercentage: 0, exemptFromPercentageCheck: true, - benefitActive: skipAssessment, - benefitActivatedAt: skipAssessment ? now : null, + benefitActive: true, // 授权即激活 + benefitActivatedAt: now, benefitDeactivatedAt: null, - benefitValidUntil: skipAssessment ? AuthorizationRole.calculateBenefitValidUntil(now) : null, - lastAssessmentMonth: skipAssessment ? AuthorizationRole.getCurrentMonthString(now) : null, + benefitValidUntil: AuthorizationRole.calculateBenefitValidUntil(now), + lastAssessmentMonth: AuthorizationRole.getCurrentMonthString(now), monthlyTreesAdded: 0, lastMonthTreesAdded: 0, - currentMonthIndex: skipAssessment ? 1 : 0, + currentMonthIndex: 1, // 从第1个月开始考核 createdAt: now, updatedAt: now, }) @@ -469,14 +469,14 @@ export class AuthorizationRole extends AggregateRoot { } // 工厂方法 - 创建正式市公司 + // 授权即激活,开始按月考核(30, 60, 120, 240, 480, 960, 1920, 3840, 2350) static createCityCompany(params: { userId: UserId cityCode: string cityName: string adminId: AdminUserId - skipAssessment?: boolean + skipAssessment?: boolean // 保留兼容,但不再影响激活状态 }): AuthorizationRole { - const skipAssessment = params.skipAssessment ?? false const now = new Date() const auth = new AuthorizationRole({ authorizationId: AuthorizationId.generate(), @@ -494,14 +494,14 @@ export class AuthorizationRole extends AggregateRoot { assessmentConfig: AssessmentConfig.forCity(), requireLocalPercentage: 0, exemptFromPercentageCheck: true, - benefitActive: skipAssessment, - benefitActivatedAt: skipAssessment ? now : null, + benefitActive: true, // 授权即激活 + benefitActivatedAt: now, benefitDeactivatedAt: null, - benefitValidUntil: skipAssessment ? AuthorizationRole.calculateBenefitValidUntil(now) : null, - lastAssessmentMonth: skipAssessment ? AuthorizationRole.getCurrentMonthString(now) : null, + benefitValidUntil: AuthorizationRole.calculateBenefitValidUntil(now), + lastAssessmentMonth: AuthorizationRole.getCurrentMonthString(now), monthlyTreesAdded: 0, lastMonthTreesAdded: 0, - currentMonthIndex: skipAssessment ? 1 : 0, + currentMonthIndex: 1, // 从第1个月开始考核 createdAt: now, updatedAt: now, })