fix(authorization): 省区域和市区域授权即激活,无需初始考核

修改 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 <noreply@anthropic.com>
This commit is contained in:
hailin 2025-12-17 03:44:48 -08:00
parent 76108328c3
commit 834a1fc0b0
1 changed files with 14 additions and 14 deletions

View File

@ -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,
})